@poe-platform/safe-fs 0.1.727 → 0.1.729
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -8
- package/dist/safe-fs/contracts/errors.js +8 -1
- package/dist/safe-fs/contracts/filesystem.d.ts +68 -2
- package/dist/safe-fs/contracts/io.js +210 -28
- package/dist/safe-fs/contracts/virtual-path.d.ts +3 -1
- package/dist/safe-fs/contracts/virtual-path.js +20 -1
- package/dist/safe-fs/core.d.ts +1 -0
- package/dist/safe-fs/core.js +1 -0
- package/dist/safe-fs/fs/capabilities.d.ts +1 -1
- package/dist/safe-fs/fs/capabilities.js +59 -21
- package/dist/safe-fs/fs/conditional-chmod.d.ts +7 -0
- package/dist/safe-fs/fs/conditional-chmod.js +19 -0
- package/dist/safe-fs/fs/descriptor.js +51 -25
- package/dist/safe-fs/fs/devices/index.d.ts +7 -2
- package/dist/safe-fs/fs/devices/index.js +210 -29
- package/dist/safe-fs/fs/devices/path.d.ts +3 -1
- package/dist/safe-fs/fs/devices/path.js +70 -12
- package/dist/safe-fs/fs/memory/index.d.ts +70 -48
- package/dist/safe-fs/fs/memory/index.js +1595 -244
- package/dist/safe-fs/fs/memory/ledger.d.ts +8 -1
- package/dist/safe-fs/fs/memory/ledger.js +46 -6
- package/dist/safe-fs/fs/memory/missing-target.js +21 -1
- package/dist/safe-fs/fs/mount/index.d.ts +11 -3
- package/dist/safe-fs/fs/mount/index.js +326 -15
- package/dist/safe-fs/fs/object-publication/index.js +79 -3
- package/dist/safe-fs/fs/overlay/index.d.ts +2 -2
- package/dist/safe-fs/fs/overlay/index.js +27 -5
- package/dist/safe-fs/fs/overlay/memory-publication.d.ts +2 -1
- package/dist/safe-fs/fs/overlay/memory-publication.js +39 -2
- package/dist/safe-fs/fs/quota/index.js +5 -5
- package/dist/safe-fs/fs/readonly/index.d.ts +1 -0
- package/dist/safe-fs/fs/readonly/index.js +13 -0
- package/dist/safe-fs/fs/real/index.d.ts +6 -2
- package/dist/safe-fs/fs/real/index.js +78 -8
- package/dist/safe-fs/fs/s3/filesystem.d.ts +3 -0
- package/dist/safe-fs/fs/s3/filesystem.js +57 -25
- package/dist/safe-fs/fs/s3/http/transport.js +20 -3
- package/dist/safe-fs/fs/s3/mock.js +19 -2
- package/dist/safe-fs/fs/s3/namespace.js +8 -2
- package/dist/safe-fs/fs/s3/registry.js +2 -0
- package/dist/safe-fs/fs/scoped.d.ts +1 -0
- package/dist/safe-fs/fs/scoped.js +261 -74
- package/dist/safe-fs/fs/staging-ancestry.d.ts +8 -0
- package/dist/safe-fs/fs/staging-ancestry.js +115 -0
- package/dist/safe-fs/fs/staging-cleanup.d.ts +5 -0
- package/dist/safe-fs/fs/staging-cleanup.js +63 -0
- package/dist/safe-fs/fs/webdav/webdav.js +7 -5
- package/dist/safe-fs/platform/browser.d.ts +5 -0
- package/dist/safe-fs/platform/browser.js +17 -0
- package/dist/safe-fs/platform/node.d.ts +5 -0
- package/dist/safe-fs/platform/node.js +28 -0
- package/dist/safe-fs/platform/transport-budget.d.ts +7 -0
- package/dist/safe-fs/platform/transport-budget.js +4 -0
- package/dist/safe-fs/testing/object-io-metrics.d.ts +3 -0
- package/dist/safe-fs/testing/object-io-metrics.js +29 -0
- package/dist/safe-fs/testing/object-publication.d.ts +3 -1
- package/dist/safe-fs/testing/object-publication.js +2 -2
- package/package.json +1 -1
|
@@ -1,62 +1,49 @@
|
|
|
1
|
-
import type { AppendFileOptions, CopyFileOptions, DirectoryEntry, EntryComparison, FileReadHandle, FileResizeHandle, FileStat, FileSystem, FsOptions, RenameOptions, MkdirOptions, ReadDirectoryOptions, ReadFileOptions, ReadStreamOptions, RemoveOptions, FileDescriptor, OpenFileOptions, OpenReadFileOptions, OpenResizeFileOptions, WriteFileOptions, ConditionalWriteFileOptions, ConditionalRemoveFileOptions, ConditionalRemoveEntryOptions, CreateStagedFileOptions, FileStaging, PublishStagedFileOptions, PrepareDirectoryOptions, StagedFileContent } from "../../contracts/filesystem.js";
|
|
1
|
+
import type { AppendFileOptions, CopyFileOptions, DirectoryEntry, EntryComparison, FileReadHandle, FileResizeHandle, FileStat, FileSystem, FileSystemCapabilities, FsOptions, ChmodOptions, RenameOptions, MkdirOptions, ReadDirectoryOptions, ReadFileOptions, ReadStreamOptions, RemoveOptions, FileDescriptor, OpenFileOptions, OpenReadFileOptions, OpenResizeFileOptions, WriteFileOptions, ConditionalWriteFileOptions, ConditionalRemoveFileOptions, ConditionalRemoveEntryOptions, ConditionalRemoveEntryReceiptOptions, CreateStagedFileOptions, FileStaging, FileStagingEntry, FileStagingResolution, PublishStagedFileOptions, PrepareDirectoryOptions, StagedFileContent } from "../../contracts/filesystem.js";
|
|
2
2
|
import type { ByteSource } from "../../contracts/io.js";
|
|
3
|
+
import { MemoryAllocation } from "./ledger.js";
|
|
3
4
|
import { type MemoryFileSystemOptions } from "./limits.js";
|
|
4
5
|
export { defaultMemoryFileSystemLimits, type MemoryFileSystemLimits, type MemoryFileSystemOptions } from "./limits.js";
|
|
6
|
+
interface Metadata {
|
|
7
|
+
revision: number;
|
|
8
|
+
mode: number;
|
|
9
|
+
ino: number;
|
|
10
|
+
nlink: number;
|
|
11
|
+
atimeMs: number;
|
|
12
|
+
mtimeMs: number;
|
|
13
|
+
ctimeMs: number;
|
|
14
|
+
birthtimeMs: number;
|
|
15
|
+
references: number;
|
|
16
|
+
}
|
|
17
|
+
interface FileNode extends Metadata {
|
|
18
|
+
type: "file";
|
|
19
|
+
byteLength: number;
|
|
20
|
+
view: Uint8Array | undefined;
|
|
21
|
+
data: Uint8Array;
|
|
22
|
+
allocation: MemoryAllocation;
|
|
23
|
+
}
|
|
24
|
+
export interface ConditionalMutationBinding {
|
|
25
|
+
readonly path: string;
|
|
26
|
+
readonly parent: FileStat;
|
|
27
|
+
readonly expected: FileStat;
|
|
28
|
+
readonly ancestors: readonly FileStagingEntry[];
|
|
29
|
+
}
|
|
30
|
+
export declare function bindConditionalMutation<Result>(identityScope: object | symbol | undefined, binding: ConditionalMutationBinding, action: () => Promise<Result>): Promise<Result>;
|
|
5
31
|
export declare class MemoryFileSystem implements FileSystem {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
stat: true;
|
|
9
|
-
readdir: true;
|
|
10
|
-
realpath: true;
|
|
11
|
-
access: true;
|
|
12
|
-
open: true;
|
|
13
|
-
write: true;
|
|
14
|
-
append: true;
|
|
15
|
-
exclusiveCreate: true;
|
|
16
|
-
explicitDirectories: true;
|
|
17
|
-
implicitDirectories: false;
|
|
18
|
-
mkdir: true;
|
|
19
|
-
recursiveMkdir: true;
|
|
20
|
-
remove: true;
|
|
21
|
-
removeDirectory: true;
|
|
22
|
-
recursiveRemove: true;
|
|
23
|
-
rename: true;
|
|
24
|
-
atomicRenameNoReplace: true;
|
|
25
|
-
copy: true;
|
|
26
|
-
exclusiveCopy: true;
|
|
27
|
-
readlink: true;
|
|
28
|
-
truncate: true;
|
|
29
|
-
streamingAppend: true;
|
|
30
|
-
randomAccessWrite: true;
|
|
31
|
-
readOnly: false;
|
|
32
|
-
symlinks: true;
|
|
33
|
-
hardlinks: true;
|
|
34
|
-
permissions: true;
|
|
35
|
-
timestamps: true;
|
|
36
|
-
atomicRename: true;
|
|
37
|
-
atomicFileStaging: true;
|
|
38
|
-
atomicStagingAncestry: true;
|
|
39
|
-
atomicFileMutation: true;
|
|
40
|
-
atomicEntryRemoval: true;
|
|
41
|
-
atomicTreeRemoval: true;
|
|
42
|
-
atomicDirectoryMetadata: true;
|
|
43
|
-
streamingRead: true;
|
|
44
|
-
retainedRead: true;
|
|
45
|
-
readonly retainedResize: boolean;
|
|
46
|
-
streamingWrite: true;
|
|
47
|
-
readonly descriptorWriteStream: boolean;
|
|
48
|
-
}>;
|
|
32
|
+
capabilitiesFor?: NonNullable<FileSystem["capabilitiesFor"]>;
|
|
33
|
+
readonly capabilities: FileSystemCapabilities;
|
|
49
34
|
private readonly identityScope;
|
|
50
35
|
private nextInode;
|
|
51
36
|
private readonly ledger;
|
|
52
37
|
private readonly root;
|
|
53
38
|
private totalBytes;
|
|
39
|
+
symlinkCount: number;
|
|
54
40
|
constructor(options?: MemoryFileSystemOptions);
|
|
55
41
|
compareEntry(path: string, peer: FileSystem, peerPath: string, options?: FsOptions): Promise<EntryComparison>;
|
|
56
42
|
canonicalizeMissingTarget(path: string, options?: FsOptions): string | undefined;
|
|
57
43
|
confineExtraction(roots: readonly string[], options?: FsOptions): Promise<FileSystem>;
|
|
58
44
|
private metadata;
|
|
59
45
|
private directory;
|
|
46
|
+
private addDirectoryNode;
|
|
60
47
|
private addNode;
|
|
61
48
|
private releaseNode;
|
|
62
49
|
private releaseReference;
|
|
@@ -68,10 +55,12 @@ export declare class MemoryFileSystem implements FileSystem {
|
|
|
68
55
|
private mode;
|
|
69
56
|
private integer;
|
|
70
57
|
private changed;
|
|
58
|
+
private resolveNode;
|
|
71
59
|
private resolve;
|
|
72
60
|
private file;
|
|
73
61
|
private entry;
|
|
74
62
|
private terminalDot;
|
|
63
|
+
private directoryNlink;
|
|
75
64
|
private snapshot;
|
|
76
65
|
private bytes;
|
|
77
66
|
private allocate;
|
|
@@ -80,15 +69,25 @@ export declare class MemoryFileSystem implements FileSystem {
|
|
|
80
69
|
private openWrite;
|
|
81
70
|
private writeData;
|
|
82
71
|
private writeAt;
|
|
72
|
+
writeMemoryFileFast(path: string, data: Uint8Array, append: boolean, mode: number): void;
|
|
73
|
+
writeMemoryFileInDirFast(dirPrefix: string, name: string, data: Uint8Array, append: boolean, mode: number): void;
|
|
83
74
|
readFile(path: string, options?: ReadFileOptions): Promise<Uint8Array>;
|
|
84
75
|
private expectEntry;
|
|
85
76
|
private stagingLocations;
|
|
86
77
|
createStagedFile(directoryPath: string, name: string, content: StagedFileContent, options: CreateStagedFileOptions): Promise<FileStaging>;
|
|
87
|
-
|
|
78
|
+
private retainStagingCleanup;
|
|
79
|
+
prepareDirectoryAncestry(ancestors: readonly FileStagingEntry[], options?: FsOptions): Promise<() => true>;
|
|
80
|
+
prepareStagingResolution(path: string, options?: FsOptions): Promise<FileStagingResolution>;
|
|
81
|
+
private verifyDirectoryAncestry;
|
|
82
|
+
publishStagedFile(receipt: FileStaging, destination: string, options: PublishStagedFileOptions): Promise<void>;
|
|
88
83
|
removeStagedFile(staging: FileStaging, options?: FsOptions): Promise<void>;
|
|
84
|
+
private removeStagingLocations;
|
|
89
85
|
prepareDirectory(path: string, options: PrepareDirectoryOptions): Promise<FileStat>;
|
|
90
86
|
writeFileConditional(path: string, data: Uint8Array, options: ConditionalWriteFileOptions): Promise<FileStat>;
|
|
91
|
-
removeEntryConditional(path: string, options: ConditionalRemoveEntryOptions
|
|
87
|
+
removeEntryConditional(path: string, options: ConditionalRemoveEntryOptions & {
|
|
88
|
+
readonly returnRemainingStat?: false | undefined;
|
|
89
|
+
}): Promise<void>;
|
|
90
|
+
removeEntryConditional(path: string, options: ConditionalRemoveEntryReceiptOptions): Promise<void | FileStat>;
|
|
92
91
|
removeFileConditional(path: string, options: ConditionalRemoveFileOptions): Promise<void>;
|
|
93
92
|
removeTreeConditional(path: string, options: ConditionalRemoveEntryOptions): Promise<void>;
|
|
94
93
|
writeFile(path: string, data: Uint8Array, options?: WriteFileOptions): Promise<void>;
|
|
@@ -98,7 +97,7 @@ export declare class MemoryFileSystem implements FileSystem {
|
|
|
98
97
|
readdir(path: string, options?: ReadDirectoryOptions): Promise<DirectoryEntry[]>;
|
|
99
98
|
mkdir(path: string, options?: MkdirOptions): Promise<void>;
|
|
100
99
|
rmdir(path: string, options?: FsOptions): Promise<void>;
|
|
101
|
-
rm(path: string, options?: RemoveOptions): Promise<void>;
|
|
100
|
+
rm(path: string, options?: RemoveOptions & Partial<ConditionalMutationBinding>): Promise<void>;
|
|
102
101
|
private removeLocation;
|
|
103
102
|
unlink(path: string, options?: FsOptions): Promise<void>;
|
|
104
103
|
rename(source: string, destination: string, options?: RenameOptions): Promise<void>;
|
|
@@ -108,7 +107,7 @@ export declare class MemoryFileSystem implements FileSystem {
|
|
|
108
107
|
readlink(path: string, options?: FsOptions): Promise<string>;
|
|
109
108
|
symlink(target: string, path: string, options?: FsOptions): Promise<void>;
|
|
110
109
|
link(existingPath: string, newPath: string, options?: FsOptions): Promise<void>;
|
|
111
|
-
chmod(path: string, mode: number, options?:
|
|
110
|
+
chmod(path: string, mode: number, options?: ChmodOptions): Promise<void>;
|
|
112
111
|
utimes(path: string, atimeMs: number, mtimeMs: number, options?: FsOptions): Promise<void>;
|
|
113
112
|
truncate(path: string, length?: number, options?: FsOptions): Promise<void>;
|
|
114
113
|
private resizeNode;
|
|
@@ -118,3 +117,26 @@ export declare class MemoryFileSystem implements FileSystem {
|
|
|
118
117
|
writeStream(path: string, source: ByteSource, options?: WriteFileOptions): Promise<void>;
|
|
119
118
|
}
|
|
120
119
|
export declare function createMemoryFileSystem(options?: MemoryFileSystemOptions | Readonly<Record<string, unknown>>): MemoryFileSystem;
|
|
120
|
+
export declare class MemoryRedirectHandle {
|
|
121
|
+
readonly fs: MemoryFileSystem;
|
|
122
|
+
readonly path: string;
|
|
123
|
+
readonly node: FileNode;
|
|
124
|
+
readonly append: boolean;
|
|
125
|
+
position: number;
|
|
126
|
+
closed: boolean;
|
|
127
|
+
constructor(fs: MemoryFileSystem, path: string, node: FileNode, append: boolean);
|
|
128
|
+
writeSync(chunk: Uint8Array, signal?: AbortSignal): void;
|
|
129
|
+
close(): void;
|
|
130
|
+
}
|
|
131
|
+
export declare function tryOpenMemoryRedirectHandleSync(filesystem: FileSystem, path: string, append: boolean, mode: number, signal?: AbortSignal): MemoryRedirectHandle | undefined;
|
|
132
|
+
export declare function utf8ByteLength(value: string): number;
|
|
133
|
+
export declare function isCleanAbsolutePath(path: string): boolean;
|
|
134
|
+
export declare function tryResolveMemoryDevicePath(filesystem: FileSystem, path: string, resizeCreate?: boolean): string | undefined;
|
|
135
|
+
export declare function tryReadMemoryFileViewSync(filesystem: FileSystem, path: string, maxBytes?: number, signal?: AbortSignal): Uint8Array | undefined;
|
|
136
|
+
export declare function tryGetMemoryDirectoryEntryNamesSync(filesystem: FileSystem, path: string): ReadonlyMap<string, {
|
|
137
|
+
readonly type: "file" | "directory" | "symlink";
|
|
138
|
+
}> | undefined;
|
|
139
|
+
export declare function tryWriteMemoryFileSync(filesystem: FileSystem, path: string, data: Uint8Array, append: boolean, mode: number, signal?: AbortSignal): boolean;
|
|
140
|
+
export declare function tryMkdirMemorySync(filesystem: FileSystem, path: string, recursive: boolean, mode: number, signal?: AbortSignal): boolean;
|
|
141
|
+
export declare function tryRmRfMemorySync(filesystem: FileSystem, path: string, signal?: AbortSignal): boolean;
|
|
142
|
+
export declare function tryWriteMemoryFileInDirSync(filesystem: FileSystem, dirPrefix: string, name: string, data: Uint8Array, append: boolean, mode: number, signal?: AbortSignal): boolean;
|