@stacksjs/storage 0.75.520 → 0.75.524

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.
@@ -35,7 +35,19 @@ export declare interface AzureStorageAdapterConfig {
35
35
  endpoint?: string
36
36
  }
37
37
  export declare class AzureBlobStorageAdapter implements StorageAdapter {
38
+ private account;
39
+ private accountKey;
40
+ private sasToken;
41
+ private container;
42
+ private prefix;
43
+ private endpoint;
44
+ private publicBaseUrl;
38
45
  constructor(config: AzureStorageAdapterConfig);
46
+ private blobName;
47
+ private stripPrefix;
48
+ private blobUrl;
49
+ private request;
50
+ private contentsToBuffer;
39
51
  write(path: string, contents: FileContents): Promise<PutResult>;
40
52
  read(path: string): Promise<FileContents>;
41
53
  readToString(path: string): Promise<string>;
@@ -50,6 +62,7 @@ export declare class AzureBlobStorageAdapter implements StorageAdapter {
50
62
  copyFile(from: string, to: string): Promise<void>;
51
63
  stat(path: string): Promise<StatEntry>;
52
64
  list(path: string, options?: ListOptions): DirectoryListing;
65
+ private listBlobs;
53
66
  changeVisibility(_path: string, _visibility: Visibility): Promise<void>;
54
67
  visibility(_path: string): Promise<Visibility>;
55
68
  fileExists(path: string): Promise<boolean>;
@@ -58,6 +71,7 @@ export declare class AzureBlobStorageAdapter implements StorageAdapter {
58
71
  temporaryUrl(path: string, options: TemporaryUrlOptions): Promise<string>;
59
72
  signedUrl(path: string, options: SignedUrlOptions): Promise<string>;
60
73
  presignedUploadUrl(options: PresignedUploadUrlOptions): Promise<PresignedUploadUrl>;
74
+ private signUrl;
61
75
  checksum(path: string, options?: ChecksumOptions): Promise<string>;
62
76
  mimeType(path: string, _options?: MimeTypeOptions): Promise<string>;
63
77
  lastModified(path: string): Promise<number>;
@@ -4,7 +4,11 @@ import type { ChecksumOptions, DirectoryListing, FileContents, GetStreamOptions,
4
4
  import type { DirectoryPage, DirectoryPageOptions } from '../types';
5
5
  export declare function createBunStorage(config?: StorageAdapterConfig): BunStorageAdapter;
6
6
  export declare class BunStorageAdapter implements StorageAdapter {
7
+ private root;
8
+ private url;
9
+ private disk;
7
10
  constructor(config?: StorageAdapterConfig);
11
+ private resolvePath;
8
12
  write(path: string, contents: FileContents): Promise<PutResult>;
9
13
  read(path: string): Promise<FileContents>;
10
14
  getStream(path: string, _options?: GetStreamOptions): Promise<ReadableStream<Uint8Array>>;
@@ -20,6 +24,7 @@ export declare class BunStorageAdapter implements StorageAdapter {
20
24
  stat(path: string): Promise<StatEntry>;
21
25
  listPage(path: string, options?: DirectoryPageOptions): Promise<DirectoryPage>;
22
26
  list(path: string, options?: ListOptions): DirectoryListing;
27
+ private createAsyncIterator;
23
28
  changeVisibility(path: string, vis: Visibility): Promise<void>;
24
29
  visibility(path: string): Promise<Visibility>;
25
30
  fileExists(path: string): Promise<boolean>;
@@ -10,7 +10,11 @@ export declare function createLocalStorage(config?: StorageAdapterConfig): Local
10
10
  * Local filesystem storage adapter using Node.js fs APIs
11
11
  */
12
12
  export declare class LocalStorageAdapter implements StorageAdapter {
13
+ private root;
14
+ private url;
15
+ private disk;
13
16
  constructor(config?: StorageAdapterConfig);
17
+ private resolvePath;
14
18
  write(path: string, contents: FileContents): Promise<PutResult>;
15
19
  read(path: string): Promise<FileContents>;
16
20
  getStream(path: string, options?: GetStreamOptions): Promise<ReadableStream<Uint8Array>>;
@@ -26,6 +30,8 @@ export declare class LocalStorageAdapter implements StorageAdapter {
26
30
  stat(path: string): Promise<StatEntry>;
27
31
  listPage(path: string, options?: DirectoryPageOptions): Promise<DirectoryPage>;
28
32
  list(path: string, options?: ListOptions): DirectoryListing;
33
+ private createAsyncIterator;
34
+ private readDirectoryRecursive;
29
35
  changeVisibility(path: string, vis: Visibility): Promise<void>;
30
36
  visibility(path: string): Promise<Visibility>;
31
37
  fileExists(path: string): Promise<boolean>;
@@ -35,6 +41,7 @@ export declare class LocalStorageAdapter implements StorageAdapter {
35
41
  signedUrl(path: string, options: SignedUrlOptions): Promise<string>;
36
42
  checksum(path: string, options?: ChecksumOptions): Promise<string>;
37
43
  mimeType(path: string, options?: MimeTypeOptions): Promise<string>;
44
+ private detectMimeType;
38
45
  lastModified(path: string): Promise<number>;
39
46
  fileSize(path: string): Promise<number>;
40
47
  }
@@ -8,7 +8,12 @@ export declare function createMemoryStorage(): InMemoryStorageAdapter;
8
8
  * In-memory storage adapter for testing and temporary storage
9
9
  */
10
10
  export declare class InMemoryStorageAdapter implements StorageAdapter {
11
+ private files;
12
+ private directories;
11
13
  constructor();
14
+ private normalizePath;
15
+ private getDirectoryPath;
16
+ private contentsToUint8Array;
12
17
  write(path: string, contents: FileContents): Promise<PutResult>;
13
18
  read(path: string): Promise<FileContents>;
14
19
  getStream(path: string, _options?: GetStreamOptions): Promise<ReadableStream<Uint8Array>>;
@@ -23,6 +28,7 @@ export declare class InMemoryStorageAdapter implements StorageAdapter {
23
28
  copyFile(from: string, to: string): Promise<void>;
24
29
  stat(path: string): Promise<StatEntry>;
25
30
  list(path: string, options?: ListOptions): DirectoryListing;
31
+ private createAsyncIterator;
26
32
  changeVisibility(path: string, visibility: Visibility): Promise<void>;
27
33
  visibility(path: string): Promise<Visibility>;
28
34
  fileExists(path: string): Promise<boolean>;
@@ -32,6 +38,7 @@ export declare class InMemoryStorageAdapter implements StorageAdapter {
32
38
  signedUrl(_path: string, _options: SignedUrlOptions): Promise<string>;
33
39
  checksum(path: string, options?: ChecksumOptions): Promise<string>;
34
40
  mimeType(path: string, _options?: MimeTypeOptions): Promise<string>;
41
+ private detectMimeType;
35
42
  lastModified(path: string): Promise<number>;
36
43
  fileSize(path: string): Promise<number>;
37
44
  clear(): void;
@@ -1,4 +1,5 @@
1
1
  import { Buffer } from 'node:buffer';
2
+ import { extensionForContentType } from '../mime-from-extension';
2
3
  import type { ChecksumOptions, DirectoryListing, FileContents, GetStreamOptions, ListOptions, MimeTypeOptions, PresignedUploadPolicy, PresignedUploadPolicyOptions, PresignedUploadUrl, PresignedUploadUrlOptions, PublicUrlOptions, PutResult, PutStreamOptions, SignedUrlOptions, StatEntry, StorageAdapter, StorageAdapterConfig, TemporaryUrlOptions, Visibility } from '../types';
3
4
  import type { DirectoryPage, DirectoryPageOptions } from '../types';
4
5
  import type { S3Client } from '@stacksjs/ts-cloud';
@@ -44,6 +45,8 @@ declare interface S3ClientOptions {
44
45
  * via `take(n)` or `flush()`.
45
46
  */
46
47
  declare class ChunkBuffer {
48
+ private chunks;
49
+ private total;
47
50
  constructor(_partSize: number);
48
51
  get length(): number;
49
52
  push(c: Uint8Array): void;
@@ -54,7 +57,21 @@ declare class ChunkBuffer {
54
57
  * AWS S3 storage adapter using ts-cloud S3Client
55
58
  */
56
59
  export declare class S3StorageAdapter implements StorageAdapter {
60
+ private _client;
61
+ private _clientPromise;
62
+ private bucket;
63
+ private prefix;
64
+ private region;
65
+ private endpoint;
66
+ private usePathStyleEndpoint;
67
+ private publicBaseUrl;
68
+ private credentials;
57
69
  constructor(client: S3Client | null, config: StorageAdapterConfig);
70
+ private getClient;
71
+ private resolveCredentials;
72
+ private prefixPath;
73
+ private stripPrefix;
74
+ private contentsToBuffer;
58
75
  write(path: string, contents: FileContents): Promise<PutResult>;
59
76
  read(path: string): Promise<FileContents>;
60
77
  getStream(path: string, _options?: GetStreamOptions): Promise<ReadableStream<Uint8Array>>;
@@ -70,17 +87,22 @@ export declare class S3StorageAdapter implements StorageAdapter {
70
87
  stat(path: string): Promise<StatEntry>;
71
88
  listPage(path: string, options?: DirectoryPageOptions): Promise<DirectoryPage>;
72
89
  list(path: string, options?: ListOptions): DirectoryListing;
90
+ private createAsyncIterator;
73
91
  changeVisibility(path: string, vis: Visibility): Promise<void>;
74
92
  visibility(path: string): Promise<Visibility>;
75
93
  fileExists(path: string): Promise<boolean>;
76
94
  directoryExists(path: string): Promise<boolean>;
77
95
  publicUrl(path: string, options?: PublicUrlOptions): Promise<string>;
96
+ private endpointBaseUrl;
78
97
  temporaryUrl(path: string, options: TemporaryUrlOptions): Promise<string>;
79
98
  signedUrl(path: string, options: SignedUrlOptions): Promise<string>;
80
99
  presignedUploadUrl(options: PresignedUploadUrlOptions): Promise<PresignedUploadUrl>;
81
100
  presignedUploadPolicy(options: PresignedUploadPolicyOptions): Promise<PresignedUploadPolicy>;
101
+ private extensionForContentType;
82
102
  checksum(path: string, options?: ChecksumOptions): Promise<string>;
83
103
  mimeType(path: string, _options?: MimeTypeOptions): Promise<string>;
104
+ private detectMimeType;
84
105
  lastModified(path: string): Promise<number>;
85
106
  fileSize(path: string): Promise<number>;
86
107
  }
108
+ export {};
@@ -37,7 +37,12 @@ export declare interface ScopedAdapterOptions {
37
37
  * ```
38
38
  */
39
39
  export declare class ScopedStorageAdapter implements StorageAdapter {
40
+ private inner;
41
+ private scope;
42
+ private scopeWithSlash;
40
43
  constructor(inner: StorageAdapter, options: ScopedAdapterOptions);
44
+ private scopePath;
45
+ private unscopePath;
41
46
  write(path: string, contents: FileContents): Promise<PutResult>;
42
47
  read(path: string): Promise<FileContents>;
43
48
  readToString(path: string): Promise<string>;
@@ -5,6 +5,6 @@ export type { CompletedArtifactIdentity, PreparedCompletedArtifactDirectory, Pre
5
5
  * this protocol is not a tested storage hardware power-loss guarantee.
6
6
  */
7
7
  export declare function writeCompletedArtifact(directory: string, entries: readonly CompletedArtifactEntry[], manifestJson: string, options?: { directories?: readonly string[] }): Promise<{ directory: string, manifest: string }>;
8
- export declare const completedArtifactLimits: unknown;
8
+ export declare const completedArtifactLimits: ReturnType<typeof Object.freeze>;
9
9
  export declare interface CompletedArtifactEntry { path: string, contents: string | Uint8Array }
10
10
  export { prepareCompletedArtifactDirectorySync } from './prepared-completed-artifact-directory';
@@ -2,3 +2,4 @@ import type { StorageDriver } from '@stacksjs/types';
2
2
  declare const adapter: unknown;
3
3
  export declare const memoryStorage: unknown;
4
4
  export declare const memory: StorageDriver;
5
+ export {};
package/dist/facade.d.ts CHANGED
@@ -13,8 +13,16 @@ export type {
13
13
  // =============================================================================
14
14
  export declare const Storage: StorageManager;
15
15
  declare class StorageManager {
16
+ private _config;
17
+ private disks;
18
+ private customConfig;
19
+ private config;
16
20
  init(config: Partial<FilesystemConfig>): this;
17
21
  disk(name?: DiskName): StorageAdapter;
22
+ private createAdapter;
23
+ private createLocalAdapter;
24
+ private createS3Adapter;
25
+ private createAzureAdapter;
18
26
  put(path: string, contents: string | Uint8Array | Buffer): Promise<PutResult>;
19
27
  put(file: UploadedFileLike, opts?: PutFileOptions): Promise<PutResult & { url: string }>;
20
28
  put(pathOrFile: string | UploadedFileLike, contentsOrOpts?: string | Uint8Array | Buffer | PutFileOptions): Promise<PutResult | (PutResult & { url: string })>;
package/dist/helpers.d.ts CHANGED
@@ -5,3 +5,4 @@ declare interface Helpers {
5
5
  _dirname: string
6
6
  updateConfigFile: (filePath: string, newConfig: Record<string, unknown>) => Promise<void>
7
7
  }
8
+ export {};
package/dist/image.d.ts CHANGED
@@ -18,6 +18,10 @@ export declare interface NativeImagePipeline {
18
18
  }
19
19
  export type NativeImageFormat = 'jpeg' | 'png' | 'webp' | 'avif';
20
20
  declare class Pipeline implements NativeImagePipeline {
21
+ private operations;
22
+ private format;
23
+ private options;
24
+ private input;
21
25
  constructor(input: Uint8Array);
22
26
  resize(width?: number, height?: number, options?: NativeResizeOptions): NativeImagePipeline;
23
27
  jpeg(options?: NativeEncodeOptions): NativeImagePipeline;
@@ -28,4 +32,6 @@ declare class Pipeline implements NativeImagePipeline {
28
32
  blur(sigma?: number): NativeImagePipeline;
29
33
  withMetadata(): NativeImagePipeline;
30
34
  toBuffer(): Promise<Buffer>;
35
+ private output;
31
36
  }
37
+ export {};
package/dist/move.d.ts CHANGED
@@ -16,3 +16,4 @@ export declare function rename(from: string, to: string, options?: MoveOptions):
16
16
  declare interface MoveOptions {
17
17
  overwrite?: boolean
18
18
  }
19
+ export {};
@@ -52,3 +52,4 @@ export type FilenameStrategy = | 'uuid'
52
52
  | 'hash'
53
53
  | 'original'
54
54
  | ((file: UploadedFileLike) => string);
55
+ export {};
@@ -68,3 +68,4 @@ export declare interface SignedTokenVerification {
68
68
  reason?: 'malformed' | 'bad_signature' | 'expired' | 'path_mismatch' | 'revoked'
69
69
  claims?: SignedTokenClaims
70
70
  }
71
+ export {};
@@ -38,10 +38,19 @@ export declare class TemporaryWorkspaceJournal {
38
38
  readonly temporaryRoot: string;
39
39
  readonly prefix: string;
40
40
  readonly ownerUid: number;
41
+ private active;
42
+ private rootInode;
43
+ private rootDevice;
44
+ private journalInode;
45
+ private journalDevice;
41
46
  constructor(options: { directory: string, temporaryRoot: string, prefix: string, ownerUid?: number });
42
47
  create(key: string): TemporaryWorkspaceRecord;
43
48
  list(): TemporaryWorkspaceRecord[];
44
49
  complete(record: TemporaryWorkspaceRecord): boolean;
45
50
  retire(id: string, mayRetire: (record: TemporaryWorkspaceRecord) => boolean | Promise<boolean>): Promise<boolean>;
46
51
  inspectRetirement(id: string, mayRetire: (record: TemporaryWorkspaceRecord) => boolean | Promise<boolean>): Promise<TemporaryWorkspaceRetirementInspection>;
52
+ private identity;
53
+ private remove;
54
+ private read;
55
+ private rootsUnchanged;
47
56
  }
@@ -241,3 +241,4 @@ export type DiskName = (keyof KnownDisks & string) | (string & {});
241
241
  * request to a host that does not resolve.
242
242
  */
243
243
  export type HetznerLocation = 'fsn1' | 'nbg1' | 'hel1';
244
+ export {};
@@ -10,6 +10,8 @@ export declare interface UploadedFileOptions {
10
10
  hashName?: boolean
11
11
  }
12
12
  export declare class UploadedFile {
13
+ private _file;
14
+ private _hashName;
13
15
  constructor(file: File);
14
16
  get name(): string;
15
17
  get extension(): string;
package/dist/zip.d.ts CHANGED
@@ -78,3 +78,4 @@ export declare interface ZipEntriesOptions {
78
78
  level?: number
79
79
  date?: Date
80
80
  }
81
+ export {};
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/storage",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.75.520",
5
+ "version": "0.75.524",
6
6
  "description": "The Stacks file system.",
7
7
  "author": "Chris Breuer",
8
8
  "contributors": [
@@ -61,20 +61,20 @@
61
61
  "prepublishOnly": "bun run build"
62
62
  },
63
63
  "dependencies": {
64
- "@stacksjs/arrays": "0.75.520",
65
- "@stacksjs/cli": "0.75.520",
66
- "@stacksjs/config": "0.75.520",
67
- "@stacksjs/env": "0.75.520",
68
- "@stacksjs/error-handling": "0.75.520",
69
- "@stacksjs/logging": "0.75.520",
70
- "@stacksjs/path": "0.75.520",
71
- "@stacksjs/strings": "0.75.520",
64
+ "@stacksjs/arrays": "0.75.524",
65
+ "@stacksjs/cli": "0.75.524",
66
+ "@stacksjs/config": "0.75.524",
67
+ "@stacksjs/env": "0.75.524",
68
+ "@stacksjs/error-handling": "0.75.524",
69
+ "@stacksjs/logging": "0.75.524",
70
+ "@stacksjs/path": "0.75.524",
71
+ "@stacksjs/strings": "0.75.524",
72
72
  "@stacksjs/ts-cloud": "^0.16.109",
73
73
  "@stacksjs/ts-xml": "^0.1.0",
74
74
  "ts-images": "^0.2.33"
75
75
  },
76
76
  "devDependencies": {
77
- "@stacksjs/types": "0.75.520",
77
+ "@stacksjs/types": "0.75.524",
78
78
  "better-dx": "^0.2.24"
79
79
  }
80
80
  }