@stacksjs/storage 0.74.32 → 0.74.33
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/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/types/filesystem.d.ts +27 -0
- package/dist/types/filesystem.js +1 -1
- package/package.json +10 -10
package/dist/index.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ export { serveFile } from './static-serve';
|
|
|
38
38
|
export { Storage, StorageManager } from './facade';
|
|
39
39
|
export { UploadedFile, uploadedFile, uploadedFiles } from './uploaded-file';
|
|
40
40
|
// Filesystem type helpers
|
|
41
|
-
export { backblazeDisk, configFromEnv, filebaseDisk, hetznerDisk, localDisk, r2Disk, s3Disk } from './types/filesystem';
|
|
41
|
+
export { backblazeDisk, configFromEnv, filebaseDisk, gcsDisk, hetznerDisk, localDisk, r2Disk, s3Disk } from './types/filesystem';
|
|
42
42
|
// Signed-URL helpers (used by Storage.disk('local').signedUrl())
|
|
43
43
|
export {
|
|
44
44
|
clearRevokedSignedStorageTokens,
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./copy";export*from"./delete";export*from"./files";export*from"./folders";export*from"./fs";export*from"./glob";export*from"./hash";export*from"./helpers";export* as storage from"./storage";export*from"./zip";export{ensureBucket,ensureConfiguredBuckets}from"./provision";export*from"./adapters";export*from"./types";export*from"./drivers";export{serveFile}from"./static-serve";export{Storage,StorageManager}from"./facade";export{UploadedFile,uploadedFile,uploadedFiles}from"./uploaded-file";export{backblazeDisk,configFromEnv,filebaseDisk,hetznerDisk,localDisk,r2Disk,s3Disk}from"./types/filesystem";export{clearRevokedSignedStorageTokens,createSignedStorageToken,isSignedStorageTokenRevoked,revokeSignedStorageToken,verifySignedStorageToken}from"./signed-url";export{parseDiskPath,PathSanitizeError,sanitizePresignedDir,sanitizePresignedFilename}from"./path-sanitize";export{detectMimeFromMagicBytes,verifyUploadedMime}from"./mime-verify";export{signS3PresignedPost}from"./s3-presigned-post";
|
|
1
|
+
export*from"./copy";export*from"./delete";export*from"./files";export*from"./folders";export*from"./fs";export*from"./glob";export*from"./hash";export*from"./helpers";export* as storage from"./storage";export*from"./zip";export{ensureBucket,ensureConfiguredBuckets}from"./provision";export*from"./adapters";export*from"./types";export*from"./drivers";export{serveFile}from"./static-serve";export{Storage,StorageManager}from"./facade";export{UploadedFile,uploadedFile,uploadedFiles}from"./uploaded-file";export{backblazeDisk,configFromEnv,filebaseDisk,gcsDisk,hetznerDisk,localDisk,r2Disk,s3Disk}from"./types/filesystem";export{clearRevokedSignedStorageTokens,createSignedStorageToken,isSignedStorageTokenRevoked,revokeSignedStorageToken,verifySignedStorageToken}from"./signed-url";export{parseDiskPath,PathSanitizeError,sanitizePresignedDir,sanitizePresignedFilename}from"./path-sanitize";export{detectMimeFromMagicBytes,verifyUploadedMime}from"./mime-verify";export{signS3PresignedPost}from"./s3-presigned-post";
|
|
@@ -35,6 +35,33 @@ export declare function backblazeDisk(bucket: string, region: string, options?:
|
|
|
35
35
|
* via `options.credentials` or the AWS_* env vars.
|
|
36
36
|
*/
|
|
37
37
|
export declare function r2Disk(bucket: string, accountId: string, options?: Partial<Omit<S3DiskConfig, 'driver' | 'bucket'>>): S3DiskConfig;
|
|
38
|
+
/**
|
|
39
|
+
* Helper to create a Google Cloud Storage disk config (stacksjs/stacks#1896).
|
|
40
|
+
*
|
|
41
|
+
* GCS publishes an S3-compatible XML API at `storage.googleapis.com`, which
|
|
42
|
+
* Google calls interoperability mode, so this reuses the `s3` adapter rather
|
|
43
|
+
* than pulling in `@google-cloud/storage`. That SDK is heavy, it brings its own
|
|
44
|
+
* auth-flow surface, and - the reason it never landed - there is no way to
|
|
45
|
+
* exercise it without a real Google account, which is a poor trade for the
|
|
46
|
+
* common case of reading and writing objects.
|
|
47
|
+
*
|
|
48
|
+
* Two things to know, because they are the ways this differs from a bucket you
|
|
49
|
+
* would drive with the official SDK:
|
|
50
|
+
*
|
|
51
|
+
* - **Credentials are HMAC keys, not a service account.** Create them under
|
|
52
|
+
* Cloud Storage > Settings > Interoperability; a service-account JSON file
|
|
53
|
+
* will not authenticate here. Supply them via `options.credentials` or the
|
|
54
|
+
* AWS_* env vars, like every other S3-compatible disk.
|
|
55
|
+
* - **The interop API is a subset.** Object CRUD, listing and signed URLs work;
|
|
56
|
+
* GCS-only features - resumable-upload sessions, object lifecycle management,
|
|
57
|
+
* customer-managed encryption keys - do not, because they have no S3 verb. A
|
|
58
|
+
* project needing those wants the official SDK and a dedicated adapter.
|
|
59
|
+
*
|
|
60
|
+
* `region` defaults to `auto`, which the interop endpoint accepts for a
|
|
61
|
+
* single-region or multi-region bucket alike. Pass the bucket's real location
|
|
62
|
+
* (`us-east1`, `europe-west4`) when you have configured one that requires it.
|
|
63
|
+
*/
|
|
64
|
+
export declare function gcsDisk(bucket: string, options?: Partial<Omit<S3DiskConfig, 'driver' | 'bucket'>>): S3DiskConfig;
|
|
38
65
|
/**
|
|
39
66
|
* Helper to create a Hetzner Object Storage disk config (stacksjs/stacks#1897).
|
|
40
67
|
*
|
package/dist/types/filesystem.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export function localDisk(root,options){return{driver:"local",root,visibility:"private",...options}}export function s3Disk(bucket,options){return{driver:"s3",bucket,region:process.env.AWS_DEFAULT_REGION||"us-east-1",visibility:"private",...options}}export function filebaseDisk(bucket,options){return{driver:"s3",bucket,region:"us-east-1",endpoint:"https://s3.filebase.com",visibility:"private",...options}}export function backblazeDisk(bucket,region,options){return{driver:"s3",bucket,region,endpoint:`https://s3.${region}.backblazeb2.com`,visibility:"private",...options}}export function r2Disk(bucket,accountId,options){return{driver:"s3",bucket,region:"auto",endpoint:`https://${accountId}.r2.cloudflarestorage.com`,visibility:"private",...options}}export function hetznerDisk(bucket,location="fsn1",options){return{driver:"s3",bucket,region:location,endpoint:`https://${location}.your-objectstorage.com`,usePathStyleEndpoint:!0,visibility:"private",...options}}export function configFromEnv(base={}){const env=process.env;return{default:env.FILESYSTEM_DISK||base.default||"local",disks:{...base.disks,...env.AWS_ACCESS_KEY_ID&&env.AWS_BUCKET?{s3:{driver:"s3",bucket:env.AWS_BUCKET,region:env.AWS_DEFAULT_REGION||"us-east-1",endpoint:env.AWS_ENDPOINT,url:env.AWS_URL,usePathStyleEndpoint:env.AWS_USE_PATH_STYLE_ENDPOINT==="true",credentials:{key:env.AWS_ACCESS_KEY_ID,secret:env.AWS_SECRET_ACCESS_KEY||""}}}:{}}}}
|
|
1
|
+
export function localDisk(root,options){return{driver:"local",root,visibility:"private",...options}}export function s3Disk(bucket,options){return{driver:"s3",bucket,region:process.env.AWS_DEFAULT_REGION||"us-east-1",visibility:"private",...options}}export function filebaseDisk(bucket,options){return{driver:"s3",bucket,region:"us-east-1",endpoint:"https://s3.filebase.com",visibility:"private",...options}}export function backblazeDisk(bucket,region,options){return{driver:"s3",bucket,region,endpoint:`https://s3.${region}.backblazeb2.com`,visibility:"private",...options}}export function r2Disk(bucket,accountId,options){return{driver:"s3",bucket,region:"auto",endpoint:`https://${accountId}.r2.cloudflarestorage.com`,visibility:"private",...options}}export function gcsDisk(bucket,options){return{driver:"s3",bucket,region:"auto",endpoint:"https://storage.googleapis.com",visibility:"private",...options}}export function hetznerDisk(bucket,location="fsn1",options){return{driver:"s3",bucket,region:location,endpoint:`https://${location}.your-objectstorage.com`,usePathStyleEndpoint:!0,visibility:"private",...options}}export function configFromEnv(base={}){const env=process.env;return{default:env.FILESYSTEM_DISK||base.default||"local",disks:{...base.disks,...env.AWS_ACCESS_KEY_ID&&env.AWS_BUCKET?{s3:{driver:"s3",bucket:env.AWS_BUCKET,region:env.AWS_DEFAULT_REGION||"us-east-1",endpoint:env.AWS_ENDPOINT,url:env.AWS_URL,usePathStyleEndpoint:env.AWS_USE_PATH_STYLE_ENDPOINT==="true",credentials:{key:env.AWS_ACCESS_KEY_ID,secret:env.AWS_SECRET_ACCESS_KEY||""}}}:{}}}}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/storage",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.74.
|
|
5
|
+
"version": "0.74.33",
|
|
6
6
|
"description": "The Stacks file system.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -61,19 +61,19 @@
|
|
|
61
61
|
"prepublishOnly": "bun run build"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@stacksjs/arrays": "0.74.
|
|
65
|
-
"@stacksjs/cli": "0.74.
|
|
66
|
-
"@stacksjs/config": "0.74.
|
|
67
|
-
"@stacksjs/env": "0.74.
|
|
68
|
-
"@stacksjs/error-handling": "0.74.
|
|
69
|
-
"@stacksjs/logging": "0.74.
|
|
70
|
-
"@stacksjs/path": "0.74.
|
|
71
|
-
"@stacksjs/strings": "0.74.
|
|
64
|
+
"@stacksjs/arrays": "0.74.33",
|
|
65
|
+
"@stacksjs/cli": "0.74.33",
|
|
66
|
+
"@stacksjs/config": "0.74.33",
|
|
67
|
+
"@stacksjs/env": "0.74.33",
|
|
68
|
+
"@stacksjs/error-handling": "0.74.33",
|
|
69
|
+
"@stacksjs/logging": "0.74.33",
|
|
70
|
+
"@stacksjs/path": "0.74.33",
|
|
71
|
+
"@stacksjs/strings": "0.74.33",
|
|
72
72
|
"@stacksjs/ts-cloud": "^0.12.15",
|
|
73
73
|
"ts-images": "^0.2.11"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@stacksjs/types": "0.74.
|
|
76
|
+
"@stacksjs/types": "0.74.33",
|
|
77
77
|
"better-dx": "^0.2.24"
|
|
78
78
|
}
|
|
79
79
|
}
|