poe-code 12.0.2 → 12.0.4

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.
Files changed (79) hide show
  1. package/README.md +24 -0
  2. package/dist/index.js +430 -6
  3. package/dist/index.js.map +4 -4
  4. package/dist/metafile.json +1 -1
  5. package/package.json +8 -2
  6. package/packages/package-lint/dist/bundle-policy.d.ts +45 -0
  7. package/packages/package-lint/dist/bundle-policy.js +169 -0
  8. package/packages/package-lint/dist/model.d.ts +4 -10
  9. package/packages/package-lint/dist/model.js +4 -2
  10. package/packages/package-lint/dist/packlist.js +5 -1
  11. package/packages/package-lint/dist/rules/bundle-self-contained.js +11 -25
  12. package/packages/safe-fs/dist/contracts/abort.d.ts +5 -0
  13. package/packages/safe-fs/dist/contracts/cleanup.d.ts +1 -0
  14. package/packages/safe-fs/dist/contracts/errors.d.ts +49 -0
  15. package/packages/safe-fs/dist/contracts/filesystem.d.ts +96 -0
  16. package/packages/safe-fs/dist/contracts/index.d.ts +4 -0
  17. package/packages/safe-fs/dist/contracts/io.d.ts +8 -0
  18. package/packages/safe-fs/dist/contracts/path.d.ts +13 -0
  19. package/packages/safe-fs/dist/fs/memory/index.d.ts +58 -0
  20. package/packages/safe-fs/dist/fs/mount/comparison.d.ts +18 -0
  21. package/packages/safe-fs/dist/fs/mount/identity.d.ts +2 -0
  22. package/packages/safe-fs/dist/fs/mount/index.d.ts +44 -0
  23. package/packages/safe-fs/dist/fs/overlay/index.d.ts +72 -0
  24. package/packages/safe-fs/dist/fs/readonly/index.d.ts +30 -0
  25. package/packages/safe-fs/dist/fs/real/allocation.d.ts +1 -0
  26. package/packages/safe-fs/dist/fs/real/index.d.ts +76 -0
  27. package/packages/safe-fs/dist/fs/s3/authority.d.ts +13 -0
  28. package/packages/safe-fs/dist/fs/s3/filesystem.d.ts +93 -0
  29. package/packages/safe-fs/dist/fs/s3/http/index.d.ts +2 -0
  30. package/packages/safe-fs/dist/fs/s3/http/request.d.ts +16 -0
  31. package/packages/safe-fs/dist/fs/s3/http/signature.d.ts +20 -0
  32. package/packages/safe-fs/dist/fs/s3/http/transport.d.ts +3 -0
  33. package/packages/safe-fs/dist/fs/s3/http/types.d.ts +30 -0
  34. package/packages/safe-fs/dist/fs/s3/http/xml.d.ts +11 -0
  35. package/packages/safe-fs/dist/fs/s3/index.d.ts +6 -0
  36. package/packages/safe-fs/dist/fs/s3/mock.d.ts +48 -0
  37. package/packages/safe-fs/dist/fs/s3/transport.d.ts +103 -0
  38. package/packages/safe-fs/dist/fs/webdav/index.d.ts +2 -0
  39. package/packages/safe-fs/dist/fs/webdav/resource-id.d.ts +18 -0
  40. package/packages/safe-fs/dist/fs/webdav/webdav.d.ts +98 -0
  41. package/packages/safe-fs/dist/fs/webdav/xml.d.ts +15 -0
  42. package/packages/safe-fs/dist/index.d.ts +11 -0
  43. package/packages/safe-fs/dist/node/filesystem.d.ts +11 -0
  44. package/packages/safe-fs/dist/node/index.d.ts +2 -0
  45. package/packages/safe-fs/dist/node/stats.d.ts +4 -0
  46. package/packages/safe-fs/dist/node/values.d.ts +6 -0
  47. package/packages/safejs/dist/chunks/{chunk-T55OILHA.js → chunk-LF5LY5O3.js} +2 -2
  48. package/packages/safejs/dist/chunks/{chunk-Z3ZMLYCK.js → chunk-XBRQ72W6.js} +387 -5
  49. package/packages/safejs/dist/chunks/chunk-XBRQ72W6.js.map +7 -0
  50. package/packages/safejs/dist/cli.js +2 -2
  51. package/packages/safejs/dist/core.js +1 -1
  52. package/packages/safejs/dist/index.js +2 -2
  53. package/packages/safejs/dist/interp/float32.d.ts +16 -0
  54. package/packages/safejs/dist/interp/float32.js +65 -0
  55. package/packages/safejs/dist/interp/globals/float32array.d.ts +6 -0
  56. package/packages/safejs/dist/interp/globals/float32array.js +130 -0
  57. package/packages/safejs/dist/interp/globals/object-array.js +6 -0
  58. package/packages/safejs/dist/interp/host-bridge.js +18 -0
  59. package/packages/safejs/dist/interp/host-call.js +15 -0
  60. package/packages/safejs/dist/interp/interpreter.js +17 -1
  61. package/packages/safejs/dist/interp/iteration.js +4 -0
  62. package/packages/safejs/dist/interp/values.d.ts +1 -1
  63. package/packages/safejs/dist/interp/values.js +56 -0
  64. package/packages/safejs/dist/lint/rules/known-globals.d.ts +1 -1
  65. package/packages/safejs/dist/lint/rules/known-globals.js +1 -0
  66. package/packages/safejs/dist/run.js +2 -0
  67. package/packages/safejs/dist/safe-fs.js +6476 -0
  68. package/packages/safejs/dist/safe-fs.js.map +7 -0
  69. package/packages/safejs/dist/snapshot/dump-format.js +20 -2
  70. package/packages/safejs/dist/snapshot/float32array.d.ts +12 -0
  71. package/packages/safejs/dist/snapshot/float32array.js +46 -0
  72. package/packages/safejs/dist/snapshot/replay-data.d.ts +5 -1
  73. package/packages/safejs/dist/snapshot/replay-data.js +29 -0
  74. package/packages/safejs/dist/snapshot/restore.js +14 -0
  75. package/packages/safejs/dist/snapshot/serialize.d.ts +5 -2
  76. package/packages/safejs/dist/snapshot/serialize.js +17 -2
  77. package/packages/safejs/dist/snapshot/validation.js +11 -1
  78. package/packages/safejs/dist/chunks/chunk-Z3ZMLYCK.js.map +0 -7
  79. /package/packages/safejs/dist/chunks/{chunk-T55OILHA.js.map → chunk-LF5LY5O3.js.map} +0 -0
@@ -0,0 +1,44 @@
1
+ import type { AppendFileOptions, CopyFileOptions, DirectoryEntry, FileStat, FileSystem, FileSystemCapabilities, FsOptions, MkdirOptions, ReadFileOptions, ReadStreamOptions, RemoveOptions, WriteFileOptions } from "../../contracts/filesystem.js";
2
+ import type { ByteSource } from "../../contracts/io.js";
3
+ export interface MountFileSystemOptions {
4
+ readonly root: FileSystem;
5
+ readonly mounts?: Readonly<Record<string, FileSystem>>;
6
+ }
7
+ export declare class MountFileSystem implements FileSystem {
8
+ readonly capabilities: FileSystemCapabilities;
9
+ private readonly mounts;
10
+ constructor(options: MountFileSystemOptions);
11
+ private select;
12
+ private protected;
13
+ private error;
14
+ private operation;
15
+ private components;
16
+ private lookup;
17
+ private resolve;
18
+ private mutable;
19
+ private entryPath;
20
+ private optional;
21
+ readFile(path: string, options?: ReadFileOptions): Promise<Uint8Array>;
22
+ writeFile(path: string, data: Uint8Array, options?: WriteFileOptions): Promise<void>;
23
+ appendFile(path: string, data: Uint8Array, options?: AppendFileOptions): Promise<void>;
24
+ stat(path: string, options?: FsOptions): Promise<FileStat>;
25
+ lstat(path: string, options?: FsOptions): Promise<FileStat>;
26
+ readdir(path: string, options?: FsOptions): Promise<DirectoryEntry[]>;
27
+ mkdir(path: string, options?: MkdirOptions): Promise<void>;
28
+ rmdir(path: string, options?: FsOptions): Promise<void>;
29
+ rm(path: string, options?: RemoveOptions): Promise<void>;
30
+ rename(source: string, destination: string, options?: FsOptions): Promise<void>;
31
+ copyFile(source: string, destination: string, options?: CopyFileOptions): Promise<void>;
32
+ realpath(path: string, options?: FsOptions): Promise<string>;
33
+ compareEntry(path: string, peer: FileSystem, peerPath: string, options?: FsOptions): Promise<import("../../contracts/filesystem.js").EntryComparison>;
34
+ access(path: string, mode?: number, options?: FsOptions): Promise<void>;
35
+ readlink(path: string, options?: FsOptions): Promise<string>;
36
+ symlink(target: string, path: string, options?: FsOptions): Promise<void>;
37
+ link(existingPath: string, newPath: string, options?: FsOptions): Promise<void>;
38
+ chmod(path: string, mode: number, options?: FsOptions): Promise<void>;
39
+ utimes(path: string, atimeMs: number, mtimeMs: number, options?: FsOptions): Promise<void>;
40
+ truncate(path: string, length?: number, options?: FsOptions): Promise<void>;
41
+ readStream(path: string, options?: ReadStreamOptions): ByteSource;
42
+ writeStream(path: string, source: ByteSource, options?: WriteFileOptions): Promise<void>;
43
+ }
44
+ export declare function createMountFileSystem(options: MountFileSystemOptions): MountFileSystem;
@@ -0,0 +1,72 @@
1
+ import type { AppendFileOptions, ByteSource, CopyFileOptions, DirectoryEntry, FileStat, FileSystem, FileSystemCapabilities, FsOptions, MkdirOptions, ReadFileOptions, ReadStreamOptions, RemoveOptions, WriteFileOptions } from "../../contracts/index.js";
2
+ export interface OverlayFileSystemOptions {
3
+ readonly upper: FileSystem;
4
+ readonly lower: FileSystem;
5
+ readonly maxBufferBytes?: number;
6
+ }
7
+ export declare class OverlayFileSystem implements FileSystem {
8
+ #private;
9
+ readonly capabilities: FileSystemCapabilities;
10
+ private readonly maxBufferBytes;
11
+ private readonly whiteouts;
12
+ private readonly opaque;
13
+ private readonly garbage;
14
+ private readonly activeStages;
15
+ private readonly linkMetadata;
16
+ private readonly linkOrigins;
17
+ private queue;
18
+ constructor(options: OverlayFileSystemOptions);
19
+ private run;
20
+ private writable;
21
+ private permission;
22
+ private maybeStat;
23
+ private hidden;
24
+ private lowerVisible;
25
+ private lookup;
26
+ private resolve;
27
+ private linkTarget;
28
+ private movableLinkTarget;
29
+ private required;
30
+ private listing;
31
+ private bytes;
32
+ private cleanGarbage;
33
+ cleanup(options?: FsOptions): Promise<void>;
34
+ private staged;
35
+ private preserve;
36
+ private clone;
37
+ private rememberLink;
38
+ private ensureDirectory;
39
+ private copyUp;
40
+ private parent;
41
+ private makeDirectory;
42
+ private writeOptions;
43
+ private writeLocation;
44
+ private replace;
45
+ readFile(path: string, options?: ReadFileOptions): Promise<Uint8Array>;
46
+ writeFile(path: string, data: Uint8Array, options?: WriteFileOptions): Promise<void>;
47
+ appendFile(path: string, data: Uint8Array, options?: AppendFileOptions): Promise<void>;
48
+ stat(path: string, options?: FsOptions): Promise<FileStat>;
49
+ lstat(path: string, options?: FsOptions): Promise<FileStat>;
50
+ compareEntry(path: string, peer: FileSystem, peerPath: string, options?: FsOptions): Promise<import("../../contracts/filesystem.js").EntryComparison>;
51
+ readdir(path: string, options?: FsOptions): Promise<DirectoryEntry[]>;
52
+ realpath(path: string, options?: FsOptions): Promise<string>;
53
+ access(path: string, requestedMode?: number, options?: FsOptions): Promise<void>;
54
+ mkdir(path: string, options?: MkdirOptions): Promise<void>;
55
+ rmdir(path: string, options?: FsOptions): Promise<void>;
56
+ rm(path: string, options?: RemoveOptions): Promise<void>;
57
+ private materialize;
58
+ rename(source: string, destination: string, options?: FsOptions): Promise<void>;
59
+ copyFile(source: string, destination: string, options?: CopyFileOptions): Promise<void>;
60
+ readlink(path: string, options?: FsOptions): Promise<string>;
61
+ symlink(target: string, path: string, options?: FsOptions): Promise<void>;
62
+ link(_existingPath: string, newPath: string, options?: FsOptions): Promise<void>;
63
+ private metadata;
64
+ chmod(path: string, permissions: number, options?: FsOptions): Promise<void>;
65
+ utimes(path: string, atimeMs: number, mtimeMs: number, options?: FsOptions): Promise<void>;
66
+ truncate(path: string, length?: number, options?: FsOptions): Promise<void>;
67
+ readStream(path: string, options?: ReadStreamOptions): ByteSource;
68
+ private bounded;
69
+ private streamToUpper;
70
+ writeStream(path: string, source: ByteSource, options?: WriteFileOptions): Promise<void>;
71
+ }
72
+ export declare function createOverlayFileSystem(options: OverlayFileSystemOptions): OverlayFileSystem;
@@ -0,0 +1,30 @@
1
+ import type { AppendFileOptions, ByteSource, CopyFileOptions, DirectoryEntry, FileStat, FileSystem, FileSystemCapabilities, FsOptions, MkdirOptions, ReadFileOptions, ReadStreamOptions, RemoveOptions, WriteFileOptions } from "../../contracts/index.js";
2
+ export declare class ReadOnlyFileSystem implements FileSystem {
3
+ #private;
4
+ constructor(filesystem: FileSystem);
5
+ get capabilities(): FileSystemCapabilities;
6
+ readFile(path: string, options?: ReadFileOptions): Promise<Uint8Array>;
7
+ stat(path: string, options?: FsOptions): Promise<FileStat>;
8
+ lstat(path: string, options?: FsOptions): Promise<FileStat>;
9
+ compareEntry(path: string, peer: FileSystem, peerPath: string, options?: FsOptions): Promise<import("../../contracts/filesystem.js").EntryComparison>;
10
+ readdir(path: string, options?: FsOptions): Promise<DirectoryEntry[]>;
11
+ realpath(path: string, options?: FsOptions): Promise<string>;
12
+ access(path: string, mode?: number, options?: FsOptions): Promise<void>;
13
+ readlink(path: string, options?: FsOptions): Promise<string>;
14
+ readStream(path: string, options?: ReadStreamOptions): ByteSource;
15
+ writeFile(path: string, _data: Uint8Array, _options?: WriteFileOptions): Promise<void>;
16
+ appendFile(path: string, _data: Uint8Array, _options?: AppendFileOptions): Promise<void>;
17
+ writeStream(path: string, _source: ByteSource, _options?: WriteFileOptions): Promise<void>;
18
+ mkdir(path: string, _options?: MkdirOptions): Promise<void>;
19
+ rm(path: string, _options?: RemoveOptions): Promise<void>;
20
+ unlink(path: string, _options?: FsOptions): Promise<void>;
21
+ rmdir(path: string, _options?: FsOptions): Promise<void>;
22
+ rename(source: string, destination: string, _options?: FsOptions): Promise<void>;
23
+ copyFile(source: string, destination: string, _options?: CopyFileOptions): Promise<void>;
24
+ symlink(target: string, path: string, _options?: FsOptions): Promise<void>;
25
+ link(existingPath: string, newPath: string, _options?: FsOptions): Promise<void>;
26
+ chmod(path: string, _mode: number, _options?: FsOptions): Promise<void>;
27
+ utimes(path: string, _atimeMs: number, _mtimeMs: number, _options?: FsOptions): Promise<void>;
28
+ truncate(path: string, _length?: number, _options?: FsOptions): Promise<void>;
29
+ }
30
+ export declare function createReadOnlyFileSystem(filesystem: FileSystem): ReadOnlyFileSystem;
@@ -0,0 +1 @@
1
+ export declare function nativeAllocatedBytes(blocks: unknown, platform: string): number | undefined;
@@ -0,0 +1,76 @@
1
+ import type { AppendFileOptions, ByteSource, CopyFileOptions, DirectoryEntry, FileStat, FileSystem, FileSystemCapabilities, FsOptions, MkdirOptions, ReadFileOptions, ReadStreamOptions, RemoveOptions, WriteFileOptions } from "../../contracts/index.js";
2
+ export interface RealFileSystemOptions {
3
+ /** An existing, absolute host directory. It is never created implicitly. */
4
+ readonly root: string;
5
+ }
6
+ /**
7
+ * Async byte filesystem for trusted POSIX hosts (Windows is unsupported).
8
+ * Both relative and absolute input paths are virtual POSIX paths rooted at `/`;
9
+ * components resolve in order, following symlinks before subsequent `..` and
10
+ * preserving trailing directory requirements. Empty paths are ENOENT. Excess
11
+ * input `..` clamps at the virtual root; symlink targets may never cross it.
12
+ * There is no process cwd dependency. The configured host root must already
13
+ * exist; its canonical location is pinned on first use or by the async factory.
14
+ *
15
+ * Absolute symlink targets created here are virtual paths, stored as rooted
16
+ * host targets without lexical normalization. Relative targets retain their
17
+ * text; safe dangling, non-directory, and looping targets may be created.
18
+ * Existing host symlinks are
19
+ * followed only when every traversed component remains beneath the root, with
20
+ * a 40-link traversal limit. Existing absolute host targets must start with the
21
+ * canonical root, not a different host alias of that root. lstat, removal, and
22
+ * rename inspect or modify a final symlink itself rather than its target. Absolute readlink results are
23
+ * translated back into virtual paths; external absolute targets are refused.
24
+ *
25
+ * SECURITY LIMIT: containment checks and subsequent Node path operations are
26
+ * not atomic. O_NOFOLLOW narrows final-file open races, but ancestor swaps,
27
+ * concurrent renames, mount changes, and preexisting hardlinks cannot be made
28
+ * safe by these APIs. This is NOT a race-proof sandbox or an isolation boundary
29
+ * against another process modifying the tree. Use an OS sandbox for that.
30
+ *
31
+ * Only regular files, directories, and symlinks are represented. Permissions,
32
+ * ownership, timestamp precision, case sensitivity, umask, and rename behavior
33
+ * are those of the host filesystem. Copy is not atomic; rename can fail EXDEV.
34
+ * Cancellation is cooperative between operations/chunks, not rollback: failed
35
+ * or canceled writes/copies may leave partial data. No native commands execute.
36
+ * Destructive rm/rename operands ending in `.` or `..` are refused with EINVAL,
37
+ * including native recursive-rm edge cases that could otherwise delete content.
38
+ * Public filesystem errors carry only virtual operands; native causes are
39
+ * intentionally omitted so host paths cannot escape through nested errors.
40
+ */
41
+ export declare class RealFileSystem implements FileSystem {
42
+ readonly capabilities: FileSystemCapabilities;
43
+ private readonly configuredRoot;
44
+ private rootPromise;
45
+ constructor(options: RealFileSystemOptions | string);
46
+ private root;
47
+ private absoluteTarget;
48
+ private walk;
49
+ private path;
50
+ private operation;
51
+ private protectRoot;
52
+ private protectTerminal;
53
+ readFile(path: string, options?: ReadFileOptions): Promise<Uint8Array>;
54
+ writeFile(path: string, data: Uint8Array, options?: WriteFileOptions): Promise<void>;
55
+ appendFile(path: string, data: Uint8Array, options?: AppendFileOptions): Promise<void>;
56
+ stat(path: string, options?: FsOptions): Promise<FileStat>;
57
+ lstat(path: string, options?: FsOptions): Promise<FileStat>;
58
+ readdir(path: string, options?: FsOptions): Promise<DirectoryEntry[]>;
59
+ mkdir(path: string, options?: MkdirOptions): Promise<void>;
60
+ rmdir(path: string, options?: FsOptions): Promise<void>;
61
+ rm(path: string, options?: RemoveOptions): Promise<void>;
62
+ rename(source: string, destination: string, options?: FsOptions): Promise<void>;
63
+ copyFile(source: string, destination: string, options?: CopyFileOptions): Promise<void>;
64
+ realpath(path: string, options?: FsOptions): Promise<string>;
65
+ access(path: string, mode?: number, options?: FsOptions): Promise<void>;
66
+ readlink(path: string, options?: FsOptions): Promise<string>;
67
+ symlink(target: string, path: string, options?: FsOptions): Promise<void>;
68
+ link(existingPath: string, newPath: string, options?: FsOptions): Promise<void>;
69
+ chmod(path: string, mode: number, options?: FsOptions): Promise<void>;
70
+ utimes(path: string, atimeMs: number, mtimeMs: number, options?: FsOptions): Promise<void>;
71
+ truncate(path: string, length?: number, options?: FsOptions): Promise<void>;
72
+ readStream(path: string, options?: ReadStreamOptions): ByteSource;
73
+ writeStream(path: string, source: ByteSource, options?: WriteFileOptions): Promise<void>;
74
+ }
75
+ /** Construct and validate an existing root before returning the backend. */
76
+ export declare function createRealFileSystem(options: RealFileSystemOptions | string): Promise<RealFileSystem>;
@@ -0,0 +1,13 @@
1
+ import type { EntryComparison, FileStat, FileSystem, FsOptions } from "../../contracts/filesystem.js";
2
+ import type { EntryView } from "../mount/comparison.js";
3
+ import type { S3HeadOutput, S3ObjectInput } from "./transport.js";
4
+ export interface OwnedS3Entry {
5
+ readonly storage: object;
6
+ readonly key: string;
7
+ }
8
+ export declare function recordMockS3Head(output: S3HeadOutput, input: S3ObjectInput, storage: object): void;
9
+ export declare function queryS3Head(input: S3ObjectInput, action: () => Promise<S3HeadOutput>): Promise<S3HeadOutput>;
10
+ export declare function recordS3Stat(filesystem: FileSystem, path: string, stat: FileStat, metadata: S3HeadOutput | undefined): void;
11
+ export declare function registerS3EntryOwner(filesystem: FileSystem, normalize: (path: string) => string, intact: () => boolean, baseComparison: NonNullable<FileSystem["compareEntry"]>, comparison?: NonNullable<FileSystem["compareEntry"]>): void;
12
+ export declare function getOwnedS3Entry(view: EntryView): OwnedS3Entry | undefined;
13
+ export declare function compareOwnedS3Entries(own: EntryView, peer: EntryView, options: FsOptions): Promise<EntryComparison>;
@@ -0,0 +1,93 @@
1
+ import { FsError } from "../../contracts/errors.js";
2
+ import type { AppendFileOptions, CopyFileOptions, DirectoryEntry, EntryComparison, FileStat, FileSystem, FsOptions, MkdirOptions, ReadFileOptions, ReadStreamOptions, RemoveOptions, WriteFileOptions } from "../../contracts/filesystem.js";
3
+ import type { ByteSource } from "../../contracts/io.js";
4
+ import type { S3Transport } from "./transport.js";
5
+ export interface S3FileSystemOptions {
6
+ readonly transport: S3Transport;
7
+ readonly bucket: string;
8
+ readonly prefix?: string;
9
+ readonly compareEntry?: (this: FileSystem, ...args: Parameters<NonNullable<FileSystem["compareEntry"]>>) => ReturnType<NonNullable<FileSystem["compareEntry"]>>;
10
+ readonly readOnly?: boolean;
11
+ readonly allowNonAtomicRename?: boolean;
12
+ readonly pageSize?: number;
13
+ readonly maxReadBytes?: number;
14
+ readonly maxStreamBytes?: number;
15
+ readonly maxListEntries?: number;
16
+ }
17
+ export declare class S3RenameError extends FsError {
18
+ readonly phase: "copy" | "delete";
19
+ readonly copiedKeys: readonly string[];
20
+ readonly deletedKeys: readonly string[];
21
+ constructor(source: string, destination: string, phase: "copy" | "delete", copied: string[], deleted: string[], cause: FsError);
22
+ }
23
+ export declare class S3FileSystem implements FileSystem {
24
+ readonly capabilities: Readonly<{
25
+ readOnly: boolean;
26
+ symlinks: false;
27
+ hardlinks: false;
28
+ permissions: false;
29
+ timestamps: boolean;
30
+ atomicRename: false;
31
+ snapshotRmdir: true;
32
+ streamingRead: boolean;
33
+ streamingWrite: boolean;
34
+ }>;
35
+ readonly readStream?: (path: string, options?: ReadStreamOptions) => ByteSource;
36
+ readonly writeStream?: (path: string, source: ByteSource, options?: WriteFileOptions) => Promise<void>;
37
+ private readonly transport;
38
+ private readonly bucket;
39
+ private readonly prefix;
40
+ private readonly allowRename;
41
+ private readonly pageSize;
42
+ private readonly maxReadBytes;
43
+ private readonly maxStreamBytes;
44
+ private readonly maxListEntries;
45
+ constructor(options: S3FileSystemOptions);
46
+ compareEntry(path: string, peer: FileSystem, peerPath: string, options?: FsOptions): Promise<EntryComparison>;
47
+ private path;
48
+ private key;
49
+ private directoryKey;
50
+ private checkAbort;
51
+ private requestOptions;
52
+ private call;
53
+ private writable;
54
+ private unsupported;
55
+ private head;
56
+ private makeStat;
57
+ private page;
58
+ private validateKey;
59
+ private validateObject;
60
+ private pages;
61
+ private inspect;
62
+ private lookup;
63
+ private requireDirectorySuffix;
64
+ stat(input: string, options?: FsOptions): Promise<FileStat>;
65
+ lstat(path: string, options?: FsOptions): Promise<FileStat>;
66
+ private body;
67
+ private get;
68
+ readFile(input: string, options?: ReadFileOptions): Promise<Uint8Array>;
69
+ private etag;
70
+ writeFile(input: string, data: Uint8Array, options?: WriteFileOptions): Promise<void>;
71
+ private writeMetadata;
72
+ appendFile(path: string, data: Uint8Array, options?: AppendFileOptions): Promise<void>;
73
+ mkdir(input: string, options?: MkdirOptions): Promise<void>;
74
+ readdir(input: string, options?: FsOptions): Promise<DirectoryEntry[]>;
75
+ private tree;
76
+ rmdir(input: string, options?: FsOptions): Promise<void>;
77
+ rm(input: string, options?: RemoveOptions): Promise<void>;
78
+ private copy;
79
+ copyFile(sourceInput: string, destinationInput: string, options?: CopyFileOptions): Promise<void>;
80
+ rename(sourceInput: string, destinationInput: string, options?: FsOptions): Promise<void>;
81
+ private copyWithPut;
82
+ realpath(input: string, options?: FsOptions): Promise<string>;
83
+ access(path: string, mode?: number, options?: FsOptions): Promise<void>;
84
+ readlink(path: string): Promise<string>;
85
+ symlink(_target: string, path: string): Promise<void>;
86
+ link(_existingPath: string, path: string): Promise<void>;
87
+ chmod(path: string, _mode: number): Promise<void>;
88
+ utimes(input: string, atimeMs: number, mtimeMs: number, options?: FsOptions): Promise<void>;
89
+ truncate(input: string, length?: number, options?: FsOptions): Promise<void>;
90
+ private streamRead;
91
+ private dispose;
92
+ private streamWrite;
93
+ }
@@ -0,0 +1,2 @@
1
+ export { createS3HttpTransport } from "./transport.js";
2
+ export type { S3HttpCredentials, S3HttpCredentialProvider, S3HttpRequestFactory, S3HttpTransportOptions } from "./types.js";
@@ -0,0 +1,16 @@
1
+ import type { IncomingMessage, RequestOptions } from "node:http";
2
+ import type { S3HttpRequestFactory } from "./types.js";
3
+ export interface RequestScope {
4
+ readonly signal: AbortSignal;
5
+ readonly finish: () => void;
6
+ }
7
+ export declare function scopeFor(signal: AbortSignal | undefined, timeout: number): RequestScope;
8
+ export declare function abortable<Value>(pending: Promise<Value>, signal: AbortSignal): Promise<Value>;
9
+ export interface WireResponse {
10
+ readonly message: IncomingMessage;
11
+ readonly body: AsyncIterable<Uint8Array>;
12
+ readonly close: () => void;
13
+ }
14
+ export declare function sendRequest(options: RequestOptions, body: Uint8Array, scope: RequestScope, factory?: S3HttpRequestFactory): Promise<WireResponse>;
15
+ export declare function limitedBody(response: WireResponse, maximum: number, expected?: number): AsyncIterable<Uint8Array>;
16
+ export declare function collect(response: WireResponse, maximum: number, expected?: number): Promise<Uint8Array>;
@@ -0,0 +1,20 @@
1
+ import type { S3HttpCredentials } from "./types.js";
2
+ export declare function invalid(message: string): never;
3
+ export declare function uriEncode(value: string, preserveSlash?: boolean): string;
4
+ export declare function canonicalQuery(entries: readonly (readonly [string, string])[]): string;
5
+ export declare function sha256(bytes: Uint8Array | string): string;
6
+ export declare function headerValue(value: string): string;
7
+ export declare function signRequest(input: {
8
+ readonly method: string;
9
+ readonly path: string;
10
+ readonly query: string;
11
+ readonly headers: Readonly<Record<string, string>>;
12
+ readonly body: Uint8Array;
13
+ readonly region: string;
14
+ readonly credentials: S3HttpCredentials;
15
+ readonly date: Date;
16
+ }): {
17
+ readonly headers: Record<string, string>;
18
+ readonly canonicalRequest: string;
19
+ readonly signature: string;
20
+ };
@@ -0,0 +1,3 @@
1
+ import type { S3Transport } from "../transport.js";
2
+ import type { S3HttpTransportOptions } from "./types.js";
3
+ export declare function createS3HttpTransport(options: S3HttpTransportOptions): S3Transport;
@@ -0,0 +1,30 @@
1
+ import type { ClientRequest, IncomingMessage, RequestOptions } from "node:http";
2
+ export interface S3HttpCredentials {
3
+ readonly accessKeyId: string;
4
+ readonly secretAccessKey: string;
5
+ readonly sessionToken?: string;
6
+ }
7
+ export type S3HttpCredentialProvider = (options: {
8
+ readonly signal: AbortSignal;
9
+ }) => Promise<S3HttpCredentials>;
10
+ export type S3HttpRequestFactory = (options: RequestOptions, onResponse: (response: IncomingMessage) => void) => ClientRequest;
11
+ export interface S3HttpTransportOptions {
12
+ readonly endpoint: string;
13
+ readonly region: string;
14
+ readonly credentials: S3HttpCredentials | S3HttpCredentialProvider;
15
+ readonly addressingStyle?: "path" | "virtual-hosted";
16
+ readonly listUrlEncoding?: "percent" | "form";
17
+ readonly clock?: () => Date;
18
+ readonly request?: S3HttpRequestFactory;
19
+ readonly allowInsecureHttp?: boolean;
20
+ readonly maxPutBytes?: number;
21
+ readonly maxGetBytes?: number;
22
+ readonly maxXmlBytes?: number;
23
+ readonly requestTimeoutMs?: number;
24
+ readonly enableCopy?: boolean;
25
+ readonly verifiedConditionalOperations?: {
26
+ readonly put?: boolean;
27
+ readonly copy?: boolean;
28
+ readonly delete?: boolean;
29
+ };
30
+ }
@@ -0,0 +1,11 @@
1
+ export interface XmlNode {
2
+ readonly name: string;
3
+ readonly children: XmlNode[];
4
+ text: string;
5
+ }
6
+ export declare function malformed(message?: string): never;
7
+ export declare function parseXml(bytes: Uint8Array): XmlNode;
8
+ export declare function children(node: XmlNode, name: string): XmlNode[];
9
+ export declare function text(node: XmlNode, name: string, required?: boolean): string | undefined;
10
+ export declare function integer(value: string): number;
11
+ export declare function timestamp(value: string): Date;
@@ -0,0 +1,6 @@
1
+ export { S3FileSystem, S3RenameError } from "./filesystem.js";
2
+ export type { S3FileSystemOptions } from "./filesystem.js";
3
+ export { MockS3Client } from "./mock.js";
4
+ export type { MockS3ClientOptions, MockS3Operation, MockS3Request } from "./mock.js";
5
+ export { createS3Transport, encodeCopySource, S3ServiceError } from "./transport.js";
6
+ export type { S3Body, S3Client, S3CopyInput, S3CopyOutput, S3DeleteInput, S3GetOutput, S3HeadOutput, S3ListInput, S3ListOutput, S3ObjectInput, S3ObjectSummary, S3PutInput, S3RequestOptions, S3Transport, S3TransportCapabilities, } from "./transport.js";
@@ -0,0 +1,48 @@
1
+ import type { S3StreamGetInput, S3StreamGetOutput, S3StreamPutInput } from "./transport.js";
2
+ import type { S3CopyInput, S3CopyOutput, S3DeleteInput, S3GetOutput, S3HeadOutput, S3ListInput, S3ListOutput, S3ObjectInput, S3PutInput, S3RequestOptions, S3Transport } from "./transport.js";
3
+ export type MockS3Operation = "headObject" | "getObject" | "putObject" | "deleteObject" | "copyObject" | "listObjectsV2";
4
+ export interface MockS3Request {
5
+ readonly operation: MockS3Operation;
6
+ readonly input: S3ObjectInput | S3ListInput | S3CopyInput | S3PutInput | S3DeleteInput;
7
+ }
8
+ export interface MockS3ClientOptions {
9
+ readonly buckets: readonly string[];
10
+ readonly pageSize?: number;
11
+ readonly now?: () => Date;
12
+ readonly authorize?: (request: MockS3Request) => void | Promise<void>;
13
+ }
14
+ export declare class MockS3Client implements S3Transport {
15
+ readonly capabilities: Readonly<{
16
+ conditionalPut: true;
17
+ conditionalCopy: true;
18
+ conditionalDelete: true;
19
+ streamingRead: true;
20
+ streamingWrite: true;
21
+ }>;
22
+ private readonly buckets;
23
+ private readonly cursors;
24
+ private readonly history;
25
+ private readonly pageSize;
26
+ private readonly now;
27
+ private readonly authorize;
28
+ private nextToken;
29
+ constructor(options: MockS3ClientOptions);
30
+ get requests(): readonly MockS3Request[];
31
+ private begin;
32
+ private bucket;
33
+ private object;
34
+ private head;
35
+ private store;
36
+ headObject(input: S3ObjectInput, options?: S3RequestOptions): Promise<S3HeadOutput>;
37
+ getObject(input: S3ObjectInput, options?: S3RequestOptions): Promise<S3GetOutput>;
38
+ putObject(input: S3PutInput, options?: S3RequestOptions): Promise<{
39
+ ETag: string;
40
+ }>;
41
+ getObjectStream(input: S3StreamGetInput, options?: S3RequestOptions): Promise<S3StreamGetOutput>;
42
+ putObjectStream(input: S3StreamPutInput, options?: S3RequestOptions): Promise<{
43
+ ETag: string;
44
+ }>;
45
+ deleteObject(input: S3DeleteInput, options?: S3RequestOptions): Promise<Record<string, never>>;
46
+ copyObject(input: S3CopyInput, options?: S3RequestOptions): Promise<S3CopyOutput>;
47
+ listObjectsV2(input: S3ListInput, options?: S3RequestOptions): Promise<S3ListOutput>;
48
+ }
@@ -0,0 +1,103 @@
1
+ export interface S3RequestOptions {
2
+ readonly abortSignal?: AbortSignal;
3
+ }
4
+ export interface S3ObjectInput {
5
+ readonly Bucket: string;
6
+ readonly Key: string;
7
+ }
8
+ export interface S3HeadOutput {
9
+ readonly ContentLength?: number | undefined;
10
+ readonly LastModified?: Date | undefined;
11
+ readonly ETag?: string | undefined;
12
+ readonly Metadata?: Record<string, string> | undefined;
13
+ }
14
+ export type S3Body = Uint8Array | AsyncIterable<Uint8Array> | {
15
+ transformToByteArray(): Promise<Uint8Array>;
16
+ };
17
+ export interface S3GetOutput extends S3HeadOutput {
18
+ readonly Body?: S3Body | undefined;
19
+ }
20
+ export interface S3StreamGetInput extends S3ObjectInput {
21
+ readonly Range?: string;
22
+ readonly IfMatch?: string;
23
+ }
24
+ export interface S3StreamGetOutput extends S3HeadOutput {
25
+ readonly Body: AsyncIterable<Uint8Array>;
26
+ }
27
+ export interface S3StreamPutInput extends Omit<S3PutInput, "Body"> {
28
+ readonly Body: AsyncIterable<Uint8Array>;
29
+ }
30
+ export interface S3PutInput extends S3ObjectInput {
31
+ readonly Body: Uint8Array;
32
+ readonly IfMatch?: string;
33
+ readonly IfNoneMatch?: "*";
34
+ readonly Metadata?: Record<string, string>;
35
+ }
36
+ export interface S3DeleteInput extends S3ObjectInput {
37
+ readonly IfMatch?: string;
38
+ }
39
+ export interface S3CopyInput extends S3ObjectInput {
40
+ readonly CopySource: string;
41
+ readonly CopySourceIfMatch?: string;
42
+ readonly IfNoneMatch?: "*";
43
+ readonly IfMatch?: string;
44
+ readonly MetadataDirective?: "COPY" | "REPLACE";
45
+ readonly Metadata?: Record<string, string>;
46
+ }
47
+ export interface S3CopyOutput {
48
+ readonly CopyObjectResult?: {
49
+ readonly ETag?: string | undefined;
50
+ readonly LastModified?: Date | undefined;
51
+ } | undefined;
52
+ }
53
+ export interface S3ListInput {
54
+ readonly Bucket: string;
55
+ readonly Prefix?: string;
56
+ readonly Delimiter?: string;
57
+ readonly MaxKeys?: number;
58
+ readonly ContinuationToken?: string;
59
+ }
60
+ export interface S3ObjectSummary {
61
+ readonly Key?: string | undefined;
62
+ readonly Size?: number | undefined;
63
+ readonly ETag?: string | undefined;
64
+ readonly LastModified?: Date | undefined;
65
+ }
66
+ export interface S3ListOutput {
67
+ readonly Contents?: readonly S3ObjectSummary[] | undefined;
68
+ readonly CommonPrefixes?: readonly {
69
+ readonly Prefix?: string | undefined;
70
+ }[] | undefined;
71
+ readonly IsTruncated?: boolean | undefined;
72
+ readonly NextContinuationToken?: string | undefined;
73
+ readonly KeyCount?: number | undefined;
74
+ }
75
+ export interface S3Client {
76
+ getObjectStream?(input: S3StreamGetInput, options?: S3RequestOptions): Promise<S3StreamGetOutput>;
77
+ putObjectStream?(input: S3StreamPutInput, options?: S3RequestOptions): Promise<unknown>;
78
+ headObject(input: S3ObjectInput, options?: S3RequestOptions): Promise<S3HeadOutput>;
79
+ getObject(input: S3ObjectInput, options?: S3RequestOptions): Promise<S3GetOutput>;
80
+ putObject(input: S3PutInput, options?: S3RequestOptions): Promise<unknown>;
81
+ deleteObject(input: S3DeleteInput, options?: S3RequestOptions): Promise<unknown>;
82
+ copyObject(input: S3CopyInput, options?: S3RequestOptions): Promise<S3CopyOutput>;
83
+ listObjectsV2(input: S3ListInput, options?: S3RequestOptions): Promise<S3ListOutput>;
84
+ }
85
+ export interface S3TransportCapabilities {
86
+ readonly streamingRead?: boolean;
87
+ readonly streamingWrite?: boolean;
88
+ readonly conditionalPut?: boolean;
89
+ readonly conditionalCopy?: boolean;
90
+ readonly conditionalDelete?: boolean;
91
+ }
92
+ export interface S3Transport extends S3Client {
93
+ readonly capabilities?: S3TransportCapabilities;
94
+ }
95
+ export declare function createS3Transport(client: S3Client, capabilities?: S3TransportCapabilities): S3Transport;
96
+ export declare class S3ServiceError extends Error {
97
+ readonly code: string;
98
+ readonly $metadata: {
99
+ readonly httpStatusCode: number;
100
+ };
101
+ constructor(code: string, status: number, message?: string);
102
+ }
103
+ export declare function encodeCopySource(bucket: string, key: string): string;
@@ -0,0 +1,2 @@
1
+ export { WebDavFileSystem } from "./webdav.js";
2
+ export type { WebDavFileSystemOptions, WebDavFetch, WebDavAtomicEmptyDirectoryBinding, WebDavAtomicEmptyDirectoryRequest, WebDavAtomicEmptyDirectoryResult, } from "./webdav.js";
@@ -0,0 +1,18 @@
1
+ import type { FileStat, FileSystem, FsOptions } from "../../contracts/filesystem.js";
2
+ import type { EntryAuthority, EntryView } from "../mount/comparison.js";
3
+ export interface OwnedWebDavEntry {
4
+ readonly storage: object;
5
+ readonly resource: object;
6
+ }
7
+ export interface OwnedWebDavResource extends OwnedWebDavEntry {
8
+ readonly identifier: string;
9
+ }
10
+ export declare function registerOwnedResourceResponse(response: Response, entries: ReadonlyMap<string, OwnedWebDavResource>): void;
11
+ export declare function recordOwnedResourceStat(response: Response, filesystem: FileSystem, path: string, stat: FileStat): void;
12
+ export declare function getOwnedWebDavEntry(view: EntryView): OwnedWebDavEntry | undefined;
13
+ export declare function ownedResponseIdentifier(response: Response, path: string): string | undefined;
14
+ type ResourceQuery = (path: string, options: FsOptions) => Promise<string | undefined>;
15
+ export declare function registerResourceQuery(filesystem: FileSystem, query: ResourceQuery, baseComparison: NonNullable<FileSystem["compareEntry"]>, callback?: NonNullable<FileSystem["compareEntry"]>): void;
16
+ export declare function resourceIdentifier(value: string): string;
17
+ export declare const compareWebDavResources: EntryAuthority;
18
+ export {};