@openclaw/fs-safe 0.17.0 → 0.18.1
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 +53 -0
- package/dist/absolute-path.d.ts +0 -1
- package/dist/advanced.d.ts +2 -2
- package/dist/archive-crc32.d.ts +0 -1
- package/dist/archive-deadline.d.ts +0 -1
- package/dist/archive-durability.d.ts +1 -2
- 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-parser-errors.d.ts +0 -1
- package/dist/archive-parser.wasm +0 -0
- package/dist/archive-plan.d.ts +72 -2
- package/dist/archive-plan.js +86 -22
- package/dist/archive-read.d.ts +0 -1
- package/dist/archive-staging.d.ts +0 -1
- package/dist/archive-tar-stream.d.ts +0 -1
- package/dist/archive-tar-wasm.d.ts +1 -2
- 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 +1 -2
- package/dist/archive-zip-entry.d.ts +1 -2
- package/dist/archive-zip-entry.js +1 -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 +8 -6
- package/dist/archive.js +204 -168
- package/dist/async-lock.d.ts +0 -1
- package/dist/atomic.d.ts +3 -2
- 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 +1 -2
- 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-owned-file.d.ts +0 -1
- package/dist/create.d.ts +16 -3
- package/dist/create.js +388 -2
- package/dist/creation-boundary.d.ts +60 -0
- package/dist/creation-boundary.js +371 -0
- 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-node.js +12 -2
- package/dist/directory-mode-owner.d.ts +0 -1
- package/dist/directory-receipt.d.ts +0 -1
- package/dist/durability.d.ts +2 -2
- 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 +33 -103
- 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 +3 -3
- 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 +18 -27
- package/dist/file-lock-sync.d.ts +4 -22
- 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 +7 -2
- package/dist/file-store-boundary.js +64 -27
- 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 +18 -29
- package/dist/file-store.d.ts +0 -1
- package/dist/file-store.js +4 -10
- 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 +1 -2
- 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 +9 -7
- 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 +13 -9
- package/dist/json-durable-queue.d.ts +0 -1
- package/dist/json-durable-queue.js +8 -132
- package/dist/json-store.d.ts +0 -1
- package/dist/json-store.js +1 -2
- package/dist/json-stringify.d.ts +0 -1
- package/dist/json.d.ts +0 -1
- package/dist/json.js +7 -17
- 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/move-path.js +1 -2
- 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 -7
- package/dist/native-parent-admission.d.ts +0 -1
- package/dist/native-pinned-write-windows.d.ts +1 -2
- package/dist/native-pinned-write-windows.js +1 -1
- package/dist/native-pinned-write.d.ts +1 -2
- package/dist/native-pinned-write.js +7 -16
- package/dist/native-policy-directory-observation.d.ts +0 -1
- package/dist/native-policy-parent-windows.d.ts +1 -2
- package/dist/native-rename-outcome.d.ts +0 -1
- package/dist/native-staged-file.d.ts +17 -5
- package/dist/native-staged-file.js +56 -65
- 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 +1 -2
- 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 +7 -2
- package/dist/pinned-operation.d.ts +1 -2
- package/dist/pinned-operation.js +3 -16
- package/dist/pinned-write-input.d.ts +0 -1
- package/dist/pinned-write-mode.d.ts +0 -1
- package/dist/pinned-write-mode.js +1 -1
- package/dist/pinned-write-staged.d.ts +0 -1
- package/dist/pinned-write-staged.js +1 -2
- package/dist/pinned-write-types.d.ts +9 -21
- package/dist/pinned-write.d.ts +0 -2
- package/dist/pinned-write.js +3 -5
- package/dist/positional-read.d.ts +0 -1
- package/dist/private-directory.d.ts +0 -1
- package/dist/private-producer-handoff-sync.d.ts +2 -13
- package/dist/private-producer-handoff-sync.js +10 -52
- package/dist/private-producer-handoff.d.ts +23 -4
- package/dist/private-producer-handoff.js +69 -46
- package/dist/private-temp-workspace.d.ts +0 -1
- package/dist/private-temp-workspace.js +11 -37
- package/dist/publish-copy-stage.d.ts +1 -2
- package/dist/publish-file-failure.d.ts +0 -1
- package/dist/publish-file.d.ts +0 -2
- package/dist/publish-file.js +1 -2
- 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-directory.js +1 -2
- 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 +1 -3
- 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 +3 -4
- package/dist/replace-file.js +1 -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-context.js +3 -7
- package/dist/root-create-input.d.ts +1 -2
- package/dist/root-directory-creation.d.ts +1 -2
- package/dist/root-directory-creation.js +1 -1
- package/dist/root-directory-list.d.ts +0 -1
- package/dist/root-directory-list.js +3 -7
- package/dist/root-directory.d.ts +0 -1
- package/dist/root-entries.d.ts +0 -1
- package/dist/root-entries.js +2 -2
- package/dist/root-errors.d.ts +4 -1
- package/dist/root-errors.js +5 -3
- 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 -15
- package/dist/root-impl.js +136 -112
- package/dist/root-move-noreplace.d.ts +0 -1
- package/dist/root-move-noreplace.js +4 -10
- package/dist/root-move-preflight.d.ts +0 -1
- package/dist/root-observed-path.d.ts +0 -1
- package/dist/root-observed-path.js +2 -4
- package/dist/root-options.d.ts +1 -2
- package/dist/root-path-errors.d.ts +0 -1
- package/dist/root-path-existing.d.ts +3 -1
- package/dist/root-path-existing.js +38 -18
- package/dist/root-path-observation.d.ts +0 -1
- package/dist/root-path-stat.d.ts +0 -1
- package/dist/root-path-stat.js +2 -4
- 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-public-types.d.ts +11 -0
- 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-identity.js +2 -4
- package/dist/root-remove-receipt.d.ts +0 -1
- package/dist/root-remove.d.ts +0 -1
- package/dist/root-remove.js +2 -4
- package/dist/root-symlink-policy.d.ts +0 -1
- package/dist/root-walk.d.ts +0 -1
- package/dist/root-write-admission.d.ts +1 -2
- package/dist/root-write-admission.js +3 -7
- package/dist/root-write-compatibility.d.ts +0 -1
- package/dist/root-write-complete-parent.d.ts +0 -1
- package/dist/root-write-complete-parent.js +2 -3
- 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 +1 -2
- package/dist/root.d.ts +2 -7
- 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 -18
- 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/secure-temp-repair.js +5 -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 +37 -61
- 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 +4 -1
- package/dist/sidecar-lock-policy.js +23 -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-stale-admission.js +2 -6
- package/dist/sidecar-lock-target.d.ts +0 -1
- package/dist/sidecar-lock-types.d.ts +22 -17
- 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/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 +1 -7
- package/dist/temp-workspace-child-admission.d.ts +16 -6
- package/dist/temp-workspace-child-admission.js +71 -15
- package/dist/temp-workspace-descriptor.d.ts +1 -7
- package/dist/temp-workspace-descriptor.js +1 -4
- package/dist/temp-workspace-owner.d.ts +1 -1
- package/dist/temp-workspace-owner.js +45 -22
- 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/text-atomic.js +1 -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 +5 -2
- package/dist/windows-path-alias.d.ts +1 -1
- package/dist/windows-path-alias.js +12 -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/advanced.md +3 -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 +8 -0
- package/docs/sidecar-lock.md +4 -0
- package/docs/store.md +6 -0
- package/docs/temp.md +8 -1
- package/docs/writing.md +14 -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 +0 -22
- package/dist/archive-native.d.ts.map +0 -1
- package/dist/archive-native.js +0 -98
- package/dist/archive-options.d.ts +0 -25
- 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 +0 -22
- package/dist/archive-policy.d.ts.map +0 -1
- package/dist/archive-policy.js +0 -38
- 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 +0 -7
- package/dist/archive-tar-inspect.d.ts.map +0 -1
- package/dist/archive-tar-inspect.js +0 -62
- 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 +0 -19
- package/dist/archive-tar.d.ts.map +0 -1
- package/dist/archive-tar.js +0 -21
- 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 +0 -20
- package/dist/create-directory.d.ts.map +0 -1
- package/dist/create-directory.js +0 -130
- package/dist/create-file-async.d.ts +0 -7
- package/dist/create-file-async.d.ts.map +0 -1
- package/dist/create-file-async.js +0 -121
- package/dist/create-file.d.ts +0 -8
- package/dist/create-file.d.ts.map +0 -1
- package/dist/create-file.js +0 -190
- package/dist/create-owned-file.d.ts.map +0 -1
- package/dist/create.d.ts.map +0 -1
- package/dist/creation-darwin.d.ts +0 -6
- package/dist/creation-darwin.d.ts.map +0 -1
- package/dist/creation-darwin.js +0 -70
- package/dist/creation-file-state.d.ts +0 -19
- package/dist/creation-file-state.d.ts.map +0 -1
- package/dist/creation-file-state.js +0 -118
- package/dist/creation-path.d.ts +0 -21
- package/dist/creation-path.d.ts.map +0 -1
- package/dist/creation-path.js +0 -71
- package/dist/creation-permissions.d.ts +0 -19
- package/dist/creation-permissions.d.ts.map +0 -1
- package/dist/creation-permissions.js +0 -125
- 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 +0 -5
- package/dist/file-store-copy-source.d.ts.map +0 -1
- package/dist/file-store-copy-source.js +0 -31
- package/dist/file-store-limit.d.ts +0 -2
- package/dist/file-store-limit.d.ts.map +0 -1
- package/dist/file-store-limit.js +0 -8
- package/dist/file-store-path.d.ts +0 -3
- package/dist/file-store-path.d.ts.map +0 -1
- package/dist/file-store-path.js +0 -30
- 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 +0 -2
- package/dist/standalone-publication-path.d.ts.map +0 -1
- package/dist/standalone-publication-path.js +0 -6
- 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 +0 -15
- package/dist/temp-workspace-identity.d.ts.map +0 -1
- package/dist/temp-workspace-identity.js +0 -41
- package/dist/temp-workspace-owner.d.ts.map +0 -1
- package/dist/temp-workspace-permissions.d.ts +0 -4
- package/dist/temp-workspace-permissions.d.ts.map +0 -1
- package/dist/temp-workspace-permissions.js +0 -32
- 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
- /package/dist/{archive-options.js → root-public-types.js} +0 -0
package/dist/archive.js
CHANGED
|
@@ -1,39 +1,37 @@
|
|
|
1
|
-
import { createTarEntryPlanner } from "./archive-
|
|
1
|
+
import { createTarEntryPlanner, createArchiveEntrySelector, resolveArchiveFilteredEntryPolicy, createArchiveEntryPlanner, } from "./archive-plan.js";
|
|
2
2
|
import { inspectTar, replayTar } from "./archive-tar-stream.js";
|
|
3
3
|
import { runPinnedWriteHelper } from "./pinned-write.js";
|
|
4
4
|
import { constants as fsConstants } from "node:fs";
|
|
5
|
-
import fs from "node:fs/promises";
|
|
5
|
+
import fs, {} from "node:fs/promises";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { Readable } from "node:stream";
|
|
8
8
|
import { pipeline } from "node:stream/promises";
|
|
9
|
-
import { createArchiveOutputPathTracker, resolveArchiveOutputPath, stripArchivePath, validateArchiveEntryPath, } from "./archive-entry.js";
|
|
10
9
|
import { createPipelineTimeoutError, waitForDeadline, withExtractionDeadline, } from "./archive-deadline.js";
|
|
11
|
-
import { assertArchiveEntryCountWithinLimit,
|
|
10
|
+
import { assertArchiveEntryCountWithinLimit, createByteBudgetTracker, createExtractBudgetTransform, resolveExtractLimits, resolveTarMeterLimits, } from "./archive-limits.js";
|
|
12
11
|
import { resolveArchiveKind } from "./archive-kind.js";
|
|
13
|
-
import { prepareArchiveDestinationGuard, preparePrivateArchiveOutputPath,
|
|
14
|
-
import {
|
|
12
|
+
import { prepareArchiveDestinationGuard, preparePrivateArchiveOutputPath, } from "./archive-staging.js";
|
|
13
|
+
import { withStagedArchivePublication } from "./archive-merge.js";
|
|
15
14
|
import { loadZipArchiveWithPreflight } from "./archive-zip-preflight.js";
|
|
16
15
|
import { admittedZipEntries } from "./archive-zip-loader.js";
|
|
17
16
|
import { zipEntryKind, zipEntryDeclaredSize, zipEntryMode, } from "./archive-zip-entry.js";
|
|
18
17
|
import { createZipIntegrityTransform, normalizeZipIntegrityError, } from "./archive-zip-integrity.js";
|
|
19
|
-
import {
|
|
20
|
-
import { ArchiveSecurityError } from "./archive-errors.js";
|
|
21
|
-
import { extractNativeArchive } from "./archive-native.js";
|
|
18
|
+
import { ArchiveSecurityError, ArchiveFormatError, isArchiveFormatErrorMessage, } from "./archive-errors.js";
|
|
22
19
|
import { stageArchiveFileForExtraction } from "./archive-input.js";
|
|
23
|
-
import { getNativeBinding } from "./native.js";
|
|
24
|
-
import { resolveArchiveFilteredEntryPolicy, shouldExtractArchiveEntry, } from "./archive-policy.js";
|
|
20
|
+
import { getNativeBinding, } from "./native.js";
|
|
25
21
|
import { writeSiblingTempFile } from "./sibling-temp.js";
|
|
26
22
|
import { assertNoWindowsPathAlias } from "./windows-path-alias.js";
|
|
27
|
-
import {
|
|
23
|
+
import { classifyArchiveParserError } from "./archive-parser-errors.js";
|
|
24
|
+
import { validateArchiveEntryPath } from "./archive-entry.js";
|
|
25
|
+
import { admitZipFile } from "./archive-zip-admission.js";
|
|
26
|
+
import { validateNativeZipManifest } from "./archive-zip-manifest.js";
|
|
28
27
|
export { isWindowsDrivePath, normalizeArchiveEntryPath, resolveArchiveOutputPath, stripArchivePath, validateArchiveEntryPath, } from "./archive-entry.js";
|
|
29
28
|
export { resolveArchiveKind, resolvePackedRootDir } from "./archive-kind.js";
|
|
30
29
|
export { readArchiveEntry } from "./archive-read.js";
|
|
31
|
-
export { inspectTarArchive } from "./archive-tar-inspect.js";
|
|
32
30
|
export { ARCHIVE_LIMIT_ERROR_CODE, ArchiveLimitError, DEFAULT_MAX_ARCHIVE_BYTES_ZIP, DEFAULT_MAX_ENTRIES, DEFAULT_MAX_EXTRACTED_BYTES, DEFAULT_MAX_ENTRY_BYTES, DEFAULT_MAX_META_ENTRY_BYTES, DEFAULT_MAX_ENTRY_PATH_COMPONENTS, } from "./archive-limits.js";
|
|
33
31
|
export { ArchiveFormatError } from "./archive-errors.js";
|
|
34
32
|
export { ArchiveSecurityError } from "./archive-staging.js";
|
|
35
33
|
export { createArchiveSymlinkTraversalError, mergeExtractedTreeIntoDestination, prepareArchiveDestinationDir, prepareArchiveOutputPath, withStagedArchiveDestination, } from "./archive-staging.js";
|
|
36
|
-
export { createTarEntryPreflightChecker } from "./archive-
|
|
34
|
+
export { createTarEntryPreflightChecker } from "./archive-plan.js";
|
|
37
35
|
export { loadZipArchiveWithPreflight, readZipCentralDirectoryEntryCount, } from "./archive-zip-preflight.js";
|
|
38
36
|
const SUPPORTS_NOFOLLOW = process.platform !== "win32" && "O_NOFOLLOW" in fsConstants;
|
|
39
37
|
const OPEN_WRITE_CREATE_FLAGS = fsConstants.O_WRONLY |
|
|
@@ -48,26 +46,6 @@ async function readZipEntryStream(entry) {
|
|
|
48
46
|
const buf = await entry.async("nodebuffer");
|
|
49
47
|
return Readable.from(buf);
|
|
50
48
|
}
|
|
51
|
-
function resolveZipOutputPath(params) {
|
|
52
|
-
validateArchiveEntryPath(params.entryPath);
|
|
53
|
-
const canonicalPath = stripArchivePath(params.entryPath, 0);
|
|
54
|
-
if (!canonicalPath)
|
|
55
|
-
return null;
|
|
56
|
-
const relPath = params.strip === 0 ? canonicalPath : stripArchivePath(canonicalPath, params.strip);
|
|
57
|
-
if (!relPath) {
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
validateArchiveEntryPath(relPath);
|
|
61
|
-
return {
|
|
62
|
-
canonicalPath,
|
|
63
|
-
relPath,
|
|
64
|
-
outPath: resolveArchiveOutputPath({
|
|
65
|
-
rootDir: params.destinationDir,
|
|
66
|
-
relPath,
|
|
67
|
-
originalPath: params.entryPath,
|
|
68
|
-
}),
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
49
|
async function writeZipFileEntry(params) {
|
|
72
50
|
params.deadline.check();
|
|
73
51
|
params.budget.startEntry();
|
|
@@ -118,93 +96,48 @@ async function writeZipFileEntry(params) {
|
|
|
118
96
|
}
|
|
119
97
|
}
|
|
120
98
|
async function extractZip(params) {
|
|
121
|
-
const limits =
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
99
|
+
const { limits, deadline } = params;
|
|
100
|
+
const destinationGuard = await prepareArchiveDestinationGuard(params.destDir);
|
|
101
|
+
deadline.check();
|
|
102
|
+
const buffer = await fs.readFile(params.archivePath, { signal: deadline.signal });
|
|
103
|
+
deadline.check();
|
|
104
|
+
const zip = await waitForDeadline(loadZipArchiveWithPreflight(buffer, limits), deadline);
|
|
105
|
+
deadline.check();
|
|
106
|
+
const entries = admittedZipEntries(zip);
|
|
107
|
+
assertArchiveEntryCountWithinLimit(entries.length, limits);
|
|
108
|
+
const budget = createByteBudgetTracker(limits);
|
|
109
|
+
await withStagedArchivePublication({ ...params, destinationGuard }, async (stagingDir) => {
|
|
110
|
+
const { select } = createArchiveEntrySelector({ ...params, rootDir: stagingDir });
|
|
111
|
+
const acceptedEntries = [];
|
|
112
|
+
for (const entry of entries) {
|
|
113
|
+
deadline.check();
|
|
114
|
+
const entryKind = zipEntryKind(entry);
|
|
115
|
+
const relPath = select({ path: entry.name, kind: entryKind, size: zipEntryDeclaredSize(entry) });
|
|
116
|
+
if (relPath === null)
|
|
117
|
+
continue;
|
|
118
|
+
if (entryKind === "symlink") {
|
|
119
|
+
throw new ArchiveSecurityError("entry-link", `zip entry is a link: ${entry.name}`);
|
|
120
|
+
}
|
|
121
|
+
if (entryKind === "other")
|
|
122
|
+
continue;
|
|
123
|
+
const mode = zipEntryMode(entry, params.entryModes);
|
|
124
|
+
acceptedEntries.push({ path: relPath, kind: entry.dir ? "directory" : "file", mode });
|
|
125
|
+
const outPath = path.join(stagingDir, relPath);
|
|
126
|
+
await preparePrivateArchiveOutputPath({
|
|
127
|
+
destinationDir: stagingDir,
|
|
128
|
+
destinationRealDir: stagingDir,
|
|
129
|
+
relPath,
|
|
130
|
+
outPath,
|
|
131
|
+
originalPath: entry.name,
|
|
132
|
+
isDirectory: entry.dir,
|
|
133
|
+
deadline,
|
|
134
|
+
});
|
|
135
|
+
if (!entry.dir) {
|
|
136
|
+
await writeZipFileEntry({ entry, outPath, budget, deadline });
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return acceptedEntries;
|
|
126
140
|
});
|
|
127
|
-
try {
|
|
128
|
-
const destinationGuard = await prepareArchiveDestinationGuard(params.destDir);
|
|
129
|
-
const destinationRealDir = destinationGuard.realPath;
|
|
130
|
-
params.deadline.check();
|
|
131
|
-
const buffer = await fs.readFile(stagedArchive.path, { signal: params.deadline.signal });
|
|
132
|
-
params.deadline.check();
|
|
133
|
-
const zip = await waitForDeadline(loadZipArchiveWithPreflight(buffer, limits), params.deadline);
|
|
134
|
-
params.deadline.check();
|
|
135
|
-
const entries = admittedZipEntries(zip);
|
|
136
|
-
const strip = Math.max(0, Math.floor(params.stripComponents ?? 0));
|
|
137
|
-
assertArchiveEntryCountWithinLimit(entries.length, limits);
|
|
138
|
-
const budget = createByteBudgetTracker(limits);
|
|
139
|
-
const trackOutputPath = createArchiveOutputPathTracker();
|
|
140
|
-
await withStagedArchiveDestination({
|
|
141
|
-
destinationRealDir,
|
|
142
|
-
run: async (stagingDir) => {
|
|
143
|
-
const stagingRealDir = realpathSync.native(stagingDir);
|
|
144
|
-
const acceptedEntries = [];
|
|
145
|
-
for (const entry of entries) {
|
|
146
|
-
params.deadline.check();
|
|
147
|
-
const output = resolveZipOutputPath({
|
|
148
|
-
entryPath: entry.name,
|
|
149
|
-
strip,
|
|
150
|
-
destinationDir: stagingRealDir,
|
|
151
|
-
});
|
|
152
|
-
if (!output) {
|
|
153
|
-
continue;
|
|
154
|
-
}
|
|
155
|
-
assertArchiveEntryPathComponentsWithinLimit(output.relPath, limits);
|
|
156
|
-
trackOutputPath(output.relPath, entry.name);
|
|
157
|
-
const entryKind = zipEntryKind(entry);
|
|
158
|
-
const entrySize = zipEntryDeclaredSize(entry);
|
|
159
|
-
if (!shouldExtractArchiveEntry({
|
|
160
|
-
filter: params.entryFilter,
|
|
161
|
-
onFiltered: params.onFiltered,
|
|
162
|
-
entry: { path: output.canonicalPath, kind: entryKind, size: entrySize },
|
|
163
|
-
})) {
|
|
164
|
-
continue;
|
|
165
|
-
}
|
|
166
|
-
if (entryKind === "symlink") {
|
|
167
|
-
throw new ArchiveSecurityError("entry-link", `zip entry is a link: ${entry.name}`);
|
|
168
|
-
}
|
|
169
|
-
if (entryKind === "other")
|
|
170
|
-
continue;
|
|
171
|
-
const mode = zipEntryMode(entry, params.entryModes);
|
|
172
|
-
acceptedEntries.push({ path: output.relPath, kind: entry.dir ? "directory" : "file", mode });
|
|
173
|
-
await preparePrivateArchiveOutputPath({
|
|
174
|
-
destinationDir: stagingRealDir,
|
|
175
|
-
destinationRealDir: stagingRealDir,
|
|
176
|
-
relPath: output.relPath,
|
|
177
|
-
outPath: output.outPath,
|
|
178
|
-
originalPath: entry.name,
|
|
179
|
-
isDirectory: entry.dir,
|
|
180
|
-
deadline: params.deadline,
|
|
181
|
-
});
|
|
182
|
-
if (entry.dir) {
|
|
183
|
-
continue;
|
|
184
|
-
}
|
|
185
|
-
await writeZipFileEntry({
|
|
186
|
-
entry,
|
|
187
|
-
outPath: output.outPath,
|
|
188
|
-
budget,
|
|
189
|
-
deadline: params.deadline,
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
params.deadline.check();
|
|
193
|
-
await mergePlannedArchiveIntoDestination({
|
|
194
|
-
entries: acceptedEntries,
|
|
195
|
-
durable: params.durable,
|
|
196
|
-
entryUmask: params.entryUmask,
|
|
197
|
-
sourceDir: stagingRealDir,
|
|
198
|
-
destinationGuard,
|
|
199
|
-
deadline: params.deadline,
|
|
200
|
-
});
|
|
201
|
-
params.deadline.check();
|
|
202
|
-
},
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
finally {
|
|
206
|
-
await stagedArchive.cleanup();
|
|
207
|
-
}
|
|
208
141
|
}
|
|
209
142
|
export async function extractArchive(params) {
|
|
210
143
|
const archivePath = params.archivePath;
|
|
@@ -232,62 +165,165 @@ export async function extractArchive(params) {
|
|
|
232
165
|
stripComponents: params.stripComponents, limits,
|
|
233
166
|
entryModes: params.entryModes, entryUmask, entryFilter: params.entryFilter, onFiltered,
|
|
234
167
|
};
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
}
|
|
252
|
-
});
|
|
253
|
-
return;
|
|
254
|
-
}
|
|
255
|
-
await withExtractionDeadline(params.timeoutMs, label, async (deadline) => extractZip({ ...options, deadline }));
|
|
168
|
+
await withExtractionDeadline(params.timeoutMs, label, async (deadline) => {
|
|
169
|
+
const stagedArchive = await stageArchiveFileForExtraction({ archivePath, limits, deadline });
|
|
170
|
+
try {
|
|
171
|
+
deadline.check();
|
|
172
|
+
const stagedOptions = { ...options, archivePath: stagedArchive.path, deadline };
|
|
173
|
+
if (native)
|
|
174
|
+
await extractNativeArchive({ ...stagedOptions, binding: native, kind, tarLimits });
|
|
175
|
+
else if (kind === "zip")
|
|
176
|
+
await extractZip(stagedOptions);
|
|
177
|
+
else
|
|
178
|
+
await extractWasmTar({ ...stagedOptions, kind, tarLimits });
|
|
179
|
+
}
|
|
180
|
+
finally {
|
|
181
|
+
await stagedArchive.cleanup();
|
|
182
|
+
}
|
|
183
|
+
});
|
|
256
184
|
}
|
|
257
185
|
async function extractWasmTar(params) {
|
|
258
|
-
const {
|
|
186
|
+
const { deadline, tarLimits } = params;
|
|
259
187
|
const manifest = [];
|
|
260
188
|
await inspectTar({ archivePath: params.archivePath, kind: params.kind, limits: tarLimits, signal: deadline.signal,
|
|
261
189
|
onMember: (entry) => { manifest.push(entry); } });
|
|
262
190
|
deadline.check();
|
|
263
|
-
const destinationGuard = await prepareArchiveDestinationGuard(
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
const
|
|
191
|
+
const destinationGuard = await prepareArchiveDestinationGuard(params.destDir);
|
|
192
|
+
await withStagedArchivePublication({ ...params, destinationGuard }, async (stagingDir) => {
|
|
193
|
+
const planEntry = createTarEntryPlanner({ ...params, rootDir: destinationGuard.realPath });
|
|
194
|
+
const accepted = manifest.flatMap((entry) => {
|
|
195
|
+
deadline.check();
|
|
196
|
+
const planned = planEntry(entry);
|
|
197
|
+
return planned ? [{ ...entry, ...planned }] : [];
|
|
198
|
+
});
|
|
199
|
+
await replayTar({ archivePath: params.archivePath, kind: params.kind, limits: tarLimits, signal: deadline.signal, members: accepted,
|
|
200
|
+
async consume(member, payload) {
|
|
269
201
|
deadline.check();
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
202
|
+
await preparePrivateArchiveOutputPath({ destinationDir: stagingDir, destinationRealDir: stagingDir,
|
|
203
|
+
relPath: member.path, outPath: path.join(stagingDir, member.path), originalPath: member.path,
|
|
204
|
+
isDirectory: member.kind === "directory", deadline });
|
|
205
|
+
if (member.kind === "file") {
|
|
206
|
+
await runPinnedWriteHelper({ rootPath: stagingDir, relativeParentPath: path.posix.dirname(member.path),
|
|
207
|
+
basename: path.posix.basename(member.path), mkdir: false, mode: 0o600, overwrite: false,
|
|
208
|
+
sync: false,
|
|
209
|
+
maxBytes: member.size, input: { kind: "stream", stream: Readable.from(payload) } });
|
|
210
|
+
}
|
|
211
|
+
deadline.check();
|
|
212
|
+
},
|
|
213
|
+
});
|
|
214
|
+
return accepted;
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
function throwMappedNativeArchiveError(error) {
|
|
218
|
+
if (error instanceof Error) {
|
|
219
|
+
const mapped = classifyArchiveParserError(error.message, { cause: error });
|
|
220
|
+
if (mapped)
|
|
221
|
+
throw mapped;
|
|
222
|
+
if (isArchiveFormatErrorMessage(error.message)) {
|
|
223
|
+
throw new ArchiveFormatError(error.message, { cause: error });
|
|
224
|
+
}
|
|
225
|
+
if (error.code === "InvalidArg") {
|
|
226
|
+
throw new ArchiveFormatError(`invalid archive: ${error.message}`, { cause: error });
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
throw error;
|
|
230
|
+
}
|
|
231
|
+
async function extractNativeArchive(params) {
|
|
232
|
+
const { archivePath, limits, tarLimits, deadline } = params;
|
|
233
|
+
const zipEntries = [];
|
|
234
|
+
if (params.kind === "zip") {
|
|
235
|
+
await admitZipFile(archivePath, limits, deadline, (entry) => { zipEntries.push(entry); });
|
|
236
|
+
}
|
|
237
|
+
const destinationGuard = await prepareArchiveDestinationGuard(params.destDir);
|
|
238
|
+
await withStagedArchivePublication({ ...params, destinationGuard }, async (stagingDir) => {
|
|
239
|
+
deadline.check();
|
|
240
|
+
// N-API retains completed task state on its signal; each pass needs its own.
|
|
241
|
+
const manifest = await params.binding
|
|
242
|
+
.inspectArchiveNative(archivePath, params.kind, tarLimits, AbortSignal.any([deadline.signal]))
|
|
243
|
+
.catch(throwMappedNativeArchiveError);
|
|
244
|
+
deadline.check();
|
|
245
|
+
assertArchiveEntryCountWithinLimit(manifest.length, limits);
|
|
246
|
+
if (params.kind === "zip") {
|
|
247
|
+
validateNativeZipManifest(manifest, zipEntries);
|
|
248
|
+
}
|
|
249
|
+
// Recheck the native manifest before any caller callback observes an entry.
|
|
250
|
+
if (params.kind !== "zip") {
|
|
251
|
+
for (const entry of manifest)
|
|
252
|
+
validateArchiveEntryPath(entry.path);
|
|
253
|
+
}
|
|
254
|
+
const planEntry = createArchiveEntryPlanner({ ...params, rootDir: stagingDir }, params.kind);
|
|
255
|
+
const plan = [];
|
|
256
|
+
for (const entry of manifest) {
|
|
257
|
+
deadline.check();
|
|
258
|
+
const mode = params.kind === "zip"
|
|
259
|
+
? zipEntries[entry.index].creatorSystem === 3
|
|
260
|
+
? zipEntries[entry.index].externalAttributes >>> 16
|
|
261
|
+
: undefined
|
|
262
|
+
: entry.mode;
|
|
263
|
+
const accepted = planEntry({ ...entry, mode });
|
|
264
|
+
if (accepted)
|
|
265
|
+
plan.push({ ...accepted, index: entry.index });
|
|
266
|
+
}
|
|
267
|
+
const directory = await fs.open(stagingDir, fsConstants.O_RDONLY |
|
|
268
|
+
(typeof fsConstants.O_DIRECTORY === "number" ? fsConstants.O_DIRECTORY : 0));
|
|
269
|
+
try {
|
|
270
|
+
deadline.check();
|
|
271
|
+
await params.binding.extractArchiveNative(archivePath, params.kind, directory.fd, plan.map((entry) => ({ ...entry, mode: entry.kind === "directory" ? 0o700 : 0o600 })), tarLimits, AbortSignal.any([deadline.signal])).catch(throwMappedNativeArchiveError);
|
|
272
|
+
}
|
|
273
|
+
finally {
|
|
274
|
+
await directory.close().catch(() => undefined);
|
|
275
|
+
}
|
|
276
|
+
return plan;
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
/** Complete TAR/gzip admission and zero-strip extraction policy, without output writes. */
|
|
280
|
+
export async function inspectTarArchive(params) {
|
|
281
|
+
const archivePath = params.archivePath;
|
|
282
|
+
const onFiltered = resolveArchiveFilteredEntryPolicy(params.onFiltered);
|
|
283
|
+
const limits = resolveExtractLimits(params.limits);
|
|
284
|
+
const tarLimits = resolveTarMeterLimits(limits);
|
|
285
|
+
const native = getNativeBinding();
|
|
286
|
+
assertNoWindowsPathAlias(archivePath, "filesystem", "archive source uses a Windows filesystem namespace alias");
|
|
287
|
+
return await withExtractionDeadline(params.timeoutMs, "inspect tar", async (deadline) => {
|
|
288
|
+
const staged = await stageArchiveFileForExtraction({ archivePath, limits, deadline });
|
|
289
|
+
try {
|
|
290
|
+
// Staging closes descriptors asynchronously; expiry there must not start a decoder.
|
|
291
|
+
deadline.check();
|
|
292
|
+
const entries = [];
|
|
293
|
+
const append = (entry) => {
|
|
294
|
+
if (entry)
|
|
295
|
+
entries.push(Object.freeze({ path: entry.path, kind: entry.kind, size: entry.size }));
|
|
296
|
+
};
|
|
297
|
+
const policy = { limits, entryFilter: params.entryFilter, onFiltered };
|
|
298
|
+
if (native) {
|
|
299
|
+
const manifest = await native.inspectArchiveNative(staged.path, "tar", tarLimits, deadline.signal)
|
|
300
|
+
.catch(throwMappedNativeArchiveError);
|
|
301
|
+
deadline.check();
|
|
302
|
+
// Match extraction's whole-manifest validation before caller policy runs.
|
|
303
|
+
for (const entry of manifest)
|
|
304
|
+
validateArchiveEntryPath(entry.path);
|
|
305
|
+
const planEntry = createArchiveEntryPlanner(policy, "tar");
|
|
306
|
+
for (const entry of manifest) {
|
|
275
307
|
deadline.check();
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
308
|
+
append(planEntry(entry));
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
else {
|
|
312
|
+
const manifest = [];
|
|
313
|
+
await inspectTar({ archivePath: staged.path, limits: tarLimits, signal: deadline.signal,
|
|
314
|
+
onMember: (entry) => { manifest.push(entry); } });
|
|
315
|
+
const planEntry = createTarEntryPlanner(policy);
|
|
316
|
+
for (const entry of manifest) {
|
|
285
317
|
deadline.check();
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
await mergePlannedArchiveIntoDestination({ entries: accepted, sourceDir: stagingDir, destinationGuard,
|
|
290
|
-
deadline, durable: options.durable, entryUmask: options.entryUmask });
|
|
318
|
+
append(planEntry(entry));
|
|
319
|
+
}
|
|
320
|
+
}
|
|
291
321
|
deadline.check();
|
|
292
|
-
|
|
322
|
+
// This is bounded evidence about the staged bytes, not a reusable write plan.
|
|
323
|
+
return Object.freeze(entries);
|
|
324
|
+
}
|
|
325
|
+
finally {
|
|
326
|
+
await staged.cleanup();
|
|
327
|
+
}
|
|
328
|
+
});
|
|
293
329
|
}
|
package/dist/async-lock.d.ts
CHANGED
package/dist/atomic.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export { replaceFileAtomic, replaceFileAtomicSync, type
|
|
1
|
+
export { replaceFileAtomic, replaceFileAtomicSync, type ReplaceFileAtomicFileSystem, type ReplaceFileAtomicOptions, type ReplaceFileAtomicResult, type ReplaceFileAtomicSyncFileSystem, type ReplaceFileAtomicSyncOptions, } from "./replace-file.js";
|
|
2
|
+
export type { RenameIdentityPolicy } from "./pinned-write-types.js";
|
|
3
|
+
export type { ReplaceFileAtomicRestoreCleanup, ReplaceFileAtomicRestoreFailureDetails, ReplaceFileCopyFallbackRestorePolicy, ReplaceFileDestinationHardlinkPolicy, } from "./replace-file-copy-fallback.js";
|
|
2
4
|
export { writeTextAtomic, type WriteTextAtomicOptions } from "./text-atomic.js";
|
|
3
5
|
export { replaceDirectoryAtomic, type ReplaceDirectoryAtomicOptions } from "./replace-directory.js";
|
|
4
6
|
export { movePathWithCopyFallback, type MovePathPublicationReceipt, type MovePathWithCopyFallbackOptions, } from "./move-path.js";
|
|
5
|
-
//# sourceMappingURL=atomic.d.ts.map
|
package/dist/bounded-read.d.ts
CHANGED
|
@@ -23,4 +23,3 @@ export declare function readBoundedSync(maxBytes: number, readChunk: (scratch: B
|
|
|
23
23
|
/** Sync bounded read from a numeric descriptor. The caller owns the descriptor. */
|
|
24
24
|
export declare function readFileDescriptorBoundedSync(fd: number, maxBytes: number): Buffer;
|
|
25
25
|
export {};
|
|
26
|
-
//# sourceMappingURL=bounded-read.d.ts.map
|
package/dist/byte-budget.d.ts
CHANGED
package/dist/byte-view.d.ts
CHANGED
package/dist/clone-metadata.d.ts
CHANGED
|
@@ -17,4 +17,3 @@ export type CloneFileMetadata = {
|
|
|
17
17
|
* These are point-in-time facts, not authorization or a guarantee against later edits.
|
|
18
18
|
*/
|
|
19
19
|
export declare function readCloneFileMetadata(files: readonly string[]): Promise<(CloneFileMetadata | undefined)[]>;
|
|
20
|
-
//# sourceMappingURL=clone-metadata.d.ts.map
|
package/dist/config.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
export { configureFsSafePython, configureFsSafeNative, getFsSafeNativeConfig, type FsSafePythonConfig, type FsSafeNativeConfig, type FsSafeNativeMode, } from "./native-config.js";
|
|
2
2
|
export { configureFsSafeLocks, getFsSafeLockConfig, type FsSafeLockConfig, } from "./lock-config.js";
|
|
3
|
-
//# sourceMappingURL=config.d.ts.map
|
package/dist/containment.d.ts
CHANGED
|
@@ -19,4 +19,3 @@ export declare function assertCopySourceCurrent(source: {
|
|
|
19
19
|
export declare function writeCopyFileToFd(fd: number, input: CopyFileInput, maxBytes?: number, assertBeforeMutation?: () => void): Promise<void>;
|
|
20
20
|
export declare function createNativeCopyFile(native: NativeBinding, input: CopyFileInput, parentFd: number, basename: string, maxBytes: number | undefined, sync: boolean): Promise<NativeFileCopyResult | undefined>;
|
|
21
21
|
export declare function assertNativeCopyCompleted(input: CopyFileInput, copied?: NativeFileCopyResult): void;
|
|
22
|
-
//# sourceMappingURL=copy-file-input.d.ts.map
|
package/dist/copy-policy.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BigIntStats } from "node:fs";
|
|
2
|
-
import type { PinnedWriteParams, PublishedWriteIdentity } from "./pinned-write.js";
|
|
2
|
+
import type { PinnedWriteParams, PublishedWriteIdentity } from "./pinned-write-types.js";
|
|
3
3
|
export type RootCopyPublicationReceipt = Readonly<{
|
|
4
4
|
path: string;
|
|
5
5
|
dev: bigint;
|
|
@@ -18,4 +18,3 @@ export type CopyPublicationOptions = {
|
|
|
18
18
|
verify(): void;
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
|
-
//# sourceMappingURL=copy-publication.d.ts.map
|
|
@@ -11,7 +11,7 @@ function timestampSeconds(nanoseconds) {
|
|
|
11
11
|
}
|
|
12
12
|
/** Byte-copy adapter for the shared immutable-source, caller-owned namespace contract. */
|
|
13
13
|
export async function copyOwnedTree(source, destination, options) {
|
|
14
|
-
options.signal
|
|
14
|
+
const callerSignal = options.signal ? AbortSignal.any([options.signal]) : undefined;
|
|
15
15
|
const cancellation = new AbortController();
|
|
16
16
|
const signal = cancellation.signal;
|
|
17
17
|
setMaxListeners(options.concurrency, signal);
|
|
@@ -23,8 +23,8 @@ export async function copyOwnedTree(source, destination, options) {
|
|
|
23
23
|
failure ??= { value };
|
|
24
24
|
cancellation.abort(failure);
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
if (callerSignal)
|
|
27
|
+
callerSignal.onabort = () => recordFailure(callerSignal.reason);
|
|
28
28
|
async function schedule(operation, children) {
|
|
29
29
|
signal.throwIfAborted();
|
|
30
30
|
const task = operation()
|
|
@@ -51,8 +51,8 @@ export async function copyOwnedTree(source, destination, options) {
|
|
|
51
51
|
}
|
|
52
52
|
output = await fsp.open(to, "wx", 0o600);
|
|
53
53
|
if (options.copyFileContents) {
|
|
54
|
-
// napi-rs owns onabort. Each admitted file gets a separate signal
|
|
55
|
-
//
|
|
54
|
+
// napi-rs owns onabort. Each admitted file gets a separate signal; the
|
|
55
|
+
// shared failure signal is private, so callers cannot intercept its relay.
|
|
56
56
|
const fileCancellation = new AbortController();
|
|
57
57
|
const abortFile = () => fileCancellation.abort();
|
|
58
58
|
signal.addEventListener("abort", abortFile, { once: true });
|
|
@@ -62,6 +62,7 @@ export async function copyOwnedTree(source, destination, options) {
|
|
|
62
62
|
}
|
|
63
63
|
finally {
|
|
64
64
|
signal.removeEventListener("abort", abortFile);
|
|
65
|
+
fileCancellation.signal.onabort = null;
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
68
|
else {
|
|
@@ -224,6 +225,7 @@ export async function copyOwnedTree(source, destination, options) {
|
|
|
224
225
|
signal.throwIfAborted();
|
|
225
226
|
}
|
|
226
227
|
try {
|
|
228
|
+
callerSignal?.throwIfAborted();
|
|
227
229
|
await copyDirectory(source.receipt.realPath, destination);
|
|
228
230
|
await Promise.all(finishing);
|
|
229
231
|
signal.throwIfAborted();
|
|
@@ -233,7 +235,8 @@ export async function copyOwnedTree(source, destination, options) {
|
|
|
233
235
|
}
|
|
234
236
|
finally {
|
|
235
237
|
await Promise.all(finishing);
|
|
236
|
-
|
|
238
|
+
if (callerSignal)
|
|
239
|
+
callerSignal.onabort = null;
|
|
237
240
|
}
|
|
238
241
|
if (failure)
|
|
239
242
|
throw failure.value;
|
package/dist/copy.d.ts
CHANGED
|
@@ -13,4 +13,3 @@ export declare function probeTreeClone(parentPath: string): TreeCloneBackend | u
|
|
|
13
13
|
export declare function createCloneSource(destination: string, options?: Pick<CopyTreeOptions, "signal">): Promise<void>;
|
|
14
14
|
/** Copy an immutable, caller-owned tree, preferring native cloning unless configured otherwise. */
|
|
15
15
|
export declare function copyTree(source: string, destination: string, options?: CopyTreeOptions): Promise<void>;
|
|
16
|
-
//# sourceMappingURL=copy.d.ts.map
|
package/dist/copy.js
CHANGED
|
@@ -94,12 +94,11 @@ async function materializeTree(source, destination, options, policy) {
|
|
|
94
94
|
let cloned = false;
|
|
95
95
|
// napi-rs uses the supplied signal's onabort property. Give it a private
|
|
96
96
|
// signal so caller handlers and other admitted native operations stay intact.
|
|
97
|
-
const
|
|
98
|
-
const abort = () => cancellation?.abort();
|
|
99
|
-
options.signal?.addEventListener("abort", abort, { once: true });
|
|
97
|
+
const nativeSignal = options.signal && supported ? AbortSignal.any([options.signal]) : undefined;
|
|
100
98
|
try {
|
|
101
99
|
if (native && supported) {
|
|
102
|
-
|
|
100
|
+
nativeSignal?.throwIfAborted();
|
|
101
|
+
await native.cloneTree(original?.fd ?? null, parent.fd, name, concurrency, nativeSignal);
|
|
103
102
|
cloned = true;
|
|
104
103
|
}
|
|
105
104
|
}
|
|
@@ -113,7 +112,8 @@ async function materializeTree(source, destination, options, policy) {
|
|
|
113
112
|
}
|
|
114
113
|
}
|
|
115
114
|
finally {
|
|
116
|
-
|
|
115
|
+
if (nativeSignal)
|
|
116
|
+
nativeSignal.onabort = null;
|
|
117
117
|
}
|
|
118
118
|
options.signal?.throwIfAborted();
|
|
119
119
|
assertStagedDirectoryCurrent(parent.receipt);
|
|
@@ -5,4 +5,3 @@ export type OwnedFileDescriptorSync = {
|
|
|
5
5
|
};
|
|
6
6
|
/** Capture the descriptor's creator-owned closer before it can be reused. */
|
|
7
7
|
export declare function ownFileDescriptorSync(fd: number, closeFd?: (fd: number) => void): OwnedFileDescriptorSync;
|
|
8
|
-
//# sourceMappingURL=create-owned-file.d.ts.map
|
package/dist/create.d.ts
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { type FileHandle } from "node:fs/promises";
|
|
2
|
+
import { type OwnedFileDescriptorSync } from "./create-owned-file.js";
|
|
3
|
+
import { type CreationPermissions, type CreationParentIdentity } from "./creation-boundary.js";
|
|
3
4
|
export type { OwnedFileDescriptorSync } from "./create-owned-file.js";
|
|
4
|
-
|
|
5
|
+
export type CreateFileOptions = CreateDirectoryOptions;
|
|
6
|
+
export declare function createFileSync(targetPath: string, options?: CreateFileOptions): OwnedFileDescriptorSync;
|
|
7
|
+
/** Internal async writer; Windows preparation uses the nonblocking stage owner. */
|
|
8
|
+
export declare function createFileHandle(targetPath: string, options?: CreateFileOptions, admission?: CreationAdmission): Promise<FileHandle>;
|
|
9
|
+
export type CreateDirectoryOptions = CreationPermissions & {
|
|
10
|
+
assertBeforeMutation?: () => void;
|
|
11
|
+
};
|
|
12
|
+
export type CreationAdmission = {
|
|
13
|
+
expectedParentIdentity?: CreationParentIdentity;
|
|
14
|
+
};
|
|
15
|
+
export declare function createDirectory(targetPath: string, options?: CreateDirectoryOptions): Promise<void>;
|
|
16
|
+
export declare function createDirectoryWithAdmission(targetPath: string, options?: CreateDirectoryOptions, admission?: CreationAdmission): Promise<void>;
|
|
17
|
+
export declare function createDirectorySync(targetPath: string, options?: CreateDirectoryOptions): void;
|