@visulima/storage 1.0.0-alpha.11 → 1.0.0-alpha.12
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 +28 -0
- package/dist/handler/http/fetch/index.js +3 -3
- package/dist/handler/http/hono/index.js +3 -3
- package/dist/handler/http/nextjs/index.d.ts +1 -1
- package/dist/handler/http/nextjs/index.js +3 -3
- package/dist/handler/http/node/index.js +3 -3
- package/dist/handler/http/solid-start/index.d.ts +1 -1
- package/dist/handler/http/solid-start/index.js +3 -3
- package/dist/handler/utils/upload-handlers.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/openapi/index.js +5 -5
- package/dist/packem_shared/{AwsLightFile-tTneXZgG.js → AwsLightFile-C-Nd5rtl.js} +1 -1
- package/dist/packem_shared/{AwsLightMetaStorage-D9qWQt6q.js → AwsLightMetaStorage-BIDb5EPg.js} +1 -1
- package/dist/packem_shared/{AwsLightStorage-CEJTYBVv.js → AwsLightStorage-C893xyaW.js} +4 -4
- package/dist/packem_shared/{AzureFile-CesgFzps.js → AzureFile-C0kug4w4.js} +1 -1
- package/dist/packem_shared/{AzureStorage-CH6nvQx8.js → AzureStorage-CpvzFT4y.js} +5 -3
- package/dist/packem_shared/{DiskStorage-DziI2mwX.js → DiskStorage-BF10kayx.js} +3 -3
- package/dist/packem_shared/{DiskStorageWithChecksum-B_XY8_cO.js → DiskStorageWithChecksum-pu9u6IF7.js} +17 -8
- package/dist/packem_shared/{File-Bb3P23dr.js → File-CPUhj3DI.js} +1 -1
- package/dist/packem_shared/{GCSFile-BIEunhAN.js → GCSFile-DaDiCKE2.js} +1 -1
- package/dist/packem_shared/{GCSMetaStorage-FypK8Tn1.js → GCSMetaStorage-BH6j7TM2.js} +1 -1
- package/dist/packem_shared/{GCStorage-CasTo9rF.js → GCStorage-BBHFEg7F.js} +6 -4
- package/dist/packem_shared/{MediaTransformer-BErvw2vE.js → MediaTransformer-BRRqYA0E.js} +9 -3
- package/dist/packem_shared/{Multipart-vxBL2VXm.js → Multipart-BzzvNxt4.js} +2 -2
- package/dist/packem_shared/{Multipart-CDDlDOs7.js → Multipart-DLtFLQ8s.js} +1 -1
- package/dist/packem_shared/{NetlifyBlobFile-CXzyjqrD.js → NetlifyBlobFile-CfyJtGWN.js} +1 -1
- package/dist/packem_shared/{NetlifyBlobStorage-DEpx_4q-.js → NetlifyBlobStorage-pZX0_VdO.js} +2 -2
- package/dist/packem_shared/{Rest-D14vM7aJ.js → Rest-DEa7IA9R.js} +3 -3
- package/dist/packem_shared/{Rest-CEj3EhMj.js → Rest-qhMbCn5a.js} +3 -3
- package/dist/packem_shared/{S3File-DZiyk9Qt.js → S3File-BXCuJaQZ.js} +1 -1
- package/dist/packem_shared/{S3Storage-B0scgwPa.js → S3Storage-2ZiheyWz.js} +2 -2
- package/dist/packem_shared/{Tus-WOVg-YnB.js → Tus-Ck0Hdle5.js} +3 -3
- package/dist/packem_shared/{Tus-Cjz87bpz.js → Tus-_0vCdHyB.js} +1 -1
- package/dist/packem_shared/{VercelBlobFile-BCg4aTEq.js → VercelBlobFile-DkFIIb9Q.js} +1 -1
- package/dist/packem_shared/{VercelBlobStorage-wOYxv8F7.js → VercelBlobStorage-CwgI91cP.js} +2 -2
- package/dist/packem_shared/{aws-light-meta-storage-Ba2b_h-o.js → aws-light-meta-storage-BGZEiY3y.js} +2 -2
- package/dist/packem_shared/{base-handler-core-BoAqTyz7.js → base-handler-core-lVB-D59L.js} +6 -3
- package/dist/packem_shared/{base-handler-fetch-CinvR65S.js → base-handler-fetch-CitgN-Aw.js} +1 -1
- package/dist/packem_shared/{base-handler-node-c02H0AxN.js → base-handler-node-BiO2DF87.js} +3 -3
- package/dist/packem_shared/{disk-storage-DeivH-J5.js → disk-storage-CC6-FUG9.js} +19 -10
- package/dist/packem_shared/{gcs-meta-storage-B0Baj0Xr.js → gcs-meta-storage-MsUrkgP6.js} +2 -2
- package/dist/packem_shared/{part-match-BMNqHDYD.js → part-match-Dt738Ddb.js} +3 -3
- package/dist/packem_shared/{rest-base-D9URIFkc.js → rest-base-k1ory8uB.js} +2 -2
- package/dist/packem_shared/{restOpenApiSpec-D1zbmid7.js → restOpenApiSpec-BBJ_SiPE.js} +1 -1
- package/dist/packem_shared/{s3-base-storage-CG21uusd.js → s3-base-storage-DSMObtht.js} +2 -5
- package/dist/packem_shared/{sharedGet-DAyJfjhl.js → sharedGet-CkSLSnMd.js} +6 -2
- package/dist/packem_shared/{transformOpenApiSpec-BC0r6PzI.js → transformOpenApiSpec-BodFhFls.js} +1 -1
- package/dist/packem_shared/{tusOpenApiSpec-BLIjKf0s.js → tusOpenApiSpec-DzppyJTW.js} +1 -1
- package/dist/packem_shared/{xhrOpenApiSpec-kItrSAsc.js → xhrOpenApiSpec-CXz7BC5J.js} +1 -1
- package/dist/storage/aws/index.js +2 -2
- package/dist/storage/aws/s3-base-storage.d.ts +1 -1
- package/dist/storage/aws/s3-storage.d.ts +1 -1
- package/dist/storage/aws/types.d.ts +1 -2
- package/dist/storage/aws-light/aws-light-storage.d.ts +3 -2
- package/dist/storage/aws-light/index.js +3 -3
- package/dist/storage/aws-light/types.d.ts +1 -2
- package/dist/storage/azure/azure-storage.d.ts +2 -2
- package/dist/storage/azure/index.js +2 -2
- package/dist/storage/azure/types.d.ts +1 -2
- package/dist/storage/gcs/gcs-storage.d.ts +2 -2
- package/dist/storage/gcs/index.js +3 -3
- package/dist/storage/gcs/types.d.ts +1 -2
- package/dist/storage/local/disk-storage.d.ts +1 -1
- package/dist/storage/local/index.js +2 -2
- package/dist/storage/local/local-meta-storage.d.ts +2 -7
- package/dist/storage/meta-storage-options.d.ts +11 -0
- package/dist/storage/meta-storage.d.ts +1 -1
- package/dist/storage/netlify-blob/index.js +2 -2
- package/dist/storage/netlify-blob/netlify-blob-meta-storage.d.ts +1 -2
- package/dist/storage/netlify-blob/netlify-blob-storage.d.ts +2 -2
- package/dist/storage/netlify-blob/types.d.ts +1 -2
- package/dist/storage/types.d.ts +2 -6
- package/dist/storage/vercel-blob/index.js +2 -2
- package/dist/storage/vercel-blob/types.d.ts +1 -2
- package/dist/storage/vercel-blob/vercel-blob-meta-storage.d.ts +1 -2
- package/dist/storage/vercel-blob/vercel-blob-storage.d.ts +2 -2
- package/dist/transformer/base-transformer.d.ts +1 -1
- package/dist/transformer/index.js +1 -1
- package/dist/transformer/transformer-config.d.ts +16 -0
- package/dist/transformer/types.d.ts +2 -15
- package/dist/utils/types.d.ts +1 -1
- package/package.json +6 -6
|
@@ -4,12 +4,12 @@ import { PassThrough, Transform, pipeline } from 'node:stream';
|
|
|
4
4
|
import { g as getDefaultExportFromCjs } from './_commonjsHelpers-BqLXS_qQ.js';
|
|
5
5
|
import require$$0 from 'crypto';
|
|
6
6
|
import require$$1 from 'fs';
|
|
7
|
-
import { g as getFileStatus, p as partMatch, d as detectFileTypeFromStream } from './part-match-
|
|
7
|
+
import { g as getFileStatus, p as partMatch, d as detectFileTypeFromStream } from './part-match-Dt738Ddb.js';
|
|
8
8
|
import { throwErrorCode, isUploadError, ERRORS } from './ERRORS-D0apMqnc.js';
|
|
9
9
|
import { createHash } from 'node:crypto';
|
|
10
10
|
import { B as BaseStorage, a as defaultFilesystemFileNameValidation, t as toMilliseconds } from './storage-CpJpqLdn.js';
|
|
11
11
|
import { a as assertValidFileOrDirectoryPath, g as getFileInfoType, e as ensureDir, t as toPath, i as isAccessible, L as LocalMetaStorage, b as readFile, r as remove } from './local-meta-storage-BlOk6m7F.js';
|
|
12
|
-
import File from './File-
|
|
12
|
+
import File from './File-CPUhj3DI.js';
|
|
13
13
|
import { createRequire } from 'node:module';
|
|
14
14
|
import { d as dirname, r as resolve, j as join, n as normalize, b as basename, i as isAbsolute } from './path-aV9lMdcn-DMU5H1-h.js';
|
|
15
15
|
import { u as updateSize } from './update-size-CCGm6i1J.js';
|
|
@@ -776,15 +776,22 @@ class DiskStorage extends BaseStorage {
|
|
|
776
776
|
cleanupStreams();
|
|
777
777
|
resolve([Number.NaN, code]);
|
|
778
778
|
};
|
|
779
|
-
lengthChecker.on("error", () =>
|
|
780
|
-
|
|
781
|
-
|
|
779
|
+
lengthChecker.on("error", () => {
|
|
780
|
+
failWithCode(ERRORS.FILE_CONFLICT);
|
|
781
|
+
});
|
|
782
|
+
checksumChecker.on("error", () => {
|
|
783
|
+
failWithCode(ERRORS.CHECKSUM_MISMATCH);
|
|
784
|
+
});
|
|
785
|
+
part.body.on("aborted", () => {
|
|
786
|
+
failWithCode(keepPartial ? void 0 : ERRORS.REQUEST_ABORTED);
|
|
787
|
+
});
|
|
782
788
|
part.body.on("error", (error) => {
|
|
783
789
|
cleanupStreams();
|
|
784
790
|
reject(error);
|
|
785
791
|
});
|
|
786
792
|
if (signal?.aborted) {
|
|
787
|
-
|
|
793
|
+
failWithCode(keepPartial ? void 0 : ERRORS.REQUEST_ABORTED);
|
|
794
|
+
return;
|
|
788
795
|
}
|
|
789
796
|
if (signal) {
|
|
790
797
|
signal.addEventListener("abort", () => {
|
|
@@ -799,12 +806,14 @@ class DiskStorage extends BaseStorage {
|
|
|
799
806
|
pipeline(part.body, lengthChecker, checksumChecker, destination, (error) => {
|
|
800
807
|
if (error) {
|
|
801
808
|
cleanupStreams();
|
|
802
|
-
if (signal
|
|
803
|
-
|
|
809
|
+
if (signal?.aborted) {
|
|
810
|
+
resolve([Number.NaN, keepPartial ? void 0 : ERRORS.REQUEST_ABORTED]);
|
|
811
|
+
return;
|
|
804
812
|
}
|
|
805
|
-
|
|
813
|
+
resolve([Number.NaN, ERRORS.FILE_ERROR]);
|
|
814
|
+
return;
|
|
806
815
|
}
|
|
807
|
-
|
|
816
|
+
resolve([part.start + destination.bytesWritten]);
|
|
808
817
|
});
|
|
809
818
|
});
|
|
810
819
|
}
|
|
@@ -7,14 +7,14 @@ import GCSConfig from './GCSConfig-vPP22kN6.js';
|
|
|
7
7
|
import { h as hasContent } from './has-content-CY66ehMK.js';
|
|
8
8
|
|
|
9
9
|
var name = "@visulima/storage";
|
|
10
|
-
var version = "1.0.0-alpha.
|
|
10
|
+
var version = "1.0.0-alpha.11";
|
|
11
11
|
const package_ = {
|
|
12
12
|
name: name,
|
|
13
13
|
version: version};
|
|
14
14
|
|
|
15
15
|
const getRangeEnd = (range) => {
|
|
16
16
|
const match = range.match(/(\d+)-(\d+)/);
|
|
17
|
-
const end = match
|
|
17
|
+
const end = match?.[2] ? +match[2] : 0;
|
|
18
18
|
return end > 0 ? end + 1 : 0;
|
|
19
19
|
};
|
|
20
20
|
const buildContentRange = (part) => {
|
|
@@ -50,7 +50,7 @@ const detectFileTypeFromStream = async (stream, options) => {
|
|
|
50
50
|
resolve();
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
53
|
-
const timeout = setTimeout(
|
|
53
|
+
const timeout = setTimeout(resolve, 10);
|
|
54
54
|
peekStream.once("data", () => {
|
|
55
55
|
clearTimeout(timeout);
|
|
56
56
|
resolve();
|
|
@@ -61,14 +61,14 @@ const detectFileTypeFromStream = async (stream, options) => {
|
|
|
61
61
|
});
|
|
62
62
|
}),
|
|
63
63
|
new Promise((resolve) => {
|
|
64
|
-
setTimeout(
|
|
64
|
+
setTimeout(resolve, 10);
|
|
65
65
|
})
|
|
66
66
|
]);
|
|
67
67
|
if (detectionPromise) {
|
|
68
68
|
await Promise.race([
|
|
69
69
|
detectionPromise.then(() => void 0),
|
|
70
70
|
new Promise((resolve) => {
|
|
71
|
-
setTimeout(
|
|
71
|
+
setTimeout(resolve, 150);
|
|
72
72
|
})
|
|
73
73
|
]).catch(() => {
|
|
74
74
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { c as createHttpError } from './headers-YLRp1dLo.js';
|
|
2
2
|
import { hasBody } from 'type-is';
|
|
3
|
-
import { a as getHeader } from './base-handler-core-
|
|
3
|
+
import { a as getHeader } from './base-handler-core-lVB-D59L.js';
|
|
4
4
|
import { ERRORS } from './ERRORS-D0apMqnc.js';
|
|
5
5
|
import { b as buildResponseFile, a as buildFileHeaders, c as buildChunkedUploadHeaders, d as buildFileMetadataHeaders } from './response-builder-BtnRiBUI.js';
|
|
6
6
|
|
|
@@ -136,7 +136,7 @@ const isUploadComplete = (chunks, totalSize) => {
|
|
|
136
136
|
}
|
|
137
137
|
const sorted = [...chunks].toSorted((a, b) => a.offset - b.offset);
|
|
138
138
|
const firstChunk = sorted[0];
|
|
139
|
-
if (
|
|
139
|
+
if (firstChunk?.offset !== 0) {
|
|
140
140
|
return false;
|
|
141
141
|
}
|
|
142
142
|
let currentEnd = firstChunk.length;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
2
|
import { createPaginationMetaSchemaObject, createPaginationSchemaObject } from '@visulima/pagination';
|
|
3
|
-
import { sharedFileMetaSchemaObject, sharedErrorSchemaObject, sharedFileMetaExampleObject, sharedGetList, sharedGet, sharedGetMeta } from './sharedGet-
|
|
3
|
+
import { sharedFileMetaSchemaObject, sharedErrorSchemaObject, sharedFileMetaExampleObject, sharedGetList, sharedGet, sharedGetMeta } from './sharedGet-CkSLSnMd.js';
|
|
4
4
|
|
|
5
5
|
const swaggerSpec = (origin, path, options) => {
|
|
6
6
|
const { supportedTransformerFormat, tags, transformer } = { tags: ["REST"], transformer: false, ...options };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Readable } from 'node:stream';
|
|
2
|
-
import { p as partMatch, d as detectFileTypeFromStream, g as getFileStatus } from './part-match-
|
|
2
|
+
import { p as partMatch, d as detectFileTypeFromStream, g as getFileStatus } from './part-match-Dt738Ddb.js';
|
|
3
3
|
import { throwErrorCode, ERRORS } from './ERRORS-D0apMqnc.js';
|
|
4
4
|
import { p as parseDuration, B as BaseStorage, b as parseBytes, t as toMilliseconds } from './storage-CpJpqLdn.js';
|
|
5
5
|
import { createRetryWrapper } from './isRetryableError-Dycp7127.js';
|
|
@@ -110,10 +110,7 @@ class S3BaseStorage extends BaseStorage {
|
|
|
110
110
|
Bucket: this.bucket,
|
|
111
111
|
ContentType: file.contentType,
|
|
112
112
|
Key: file.name,
|
|
113
|
-
Metadata: mapValues(
|
|
114
|
-
{ originalName: file.originalName, ...file.metadata },
|
|
115
|
-
(value) => encodeURI(String(value))
|
|
116
|
-
)
|
|
113
|
+
Metadata: mapValues({ originalName: file.originalName, ...file.metadata }, (value) => encodeURI(String(value)))
|
|
117
114
|
})
|
|
118
115
|
);
|
|
119
116
|
} catch {
|
|
@@ -520,7 +520,9 @@ const getOrganizedTransformationParameters = (transform, format = ["jpeg", "png"
|
|
|
520
520
|
return { groups, parameters };
|
|
521
521
|
};
|
|
522
522
|
const getTransformationHeaders = (transform) => {
|
|
523
|
-
if (!transform)
|
|
523
|
+
if (!transform) {
|
|
524
|
+
return {};
|
|
525
|
+
}
|
|
524
526
|
const headers = {
|
|
525
527
|
"X-Media-Type": {
|
|
526
528
|
description: "Type of media (image/video/audio)",
|
|
@@ -545,7 +547,9 @@ const getTransformationHeaders = (transform) => {
|
|
|
545
547
|
return headers;
|
|
546
548
|
};
|
|
547
549
|
const getTransformationErrorResponses = (transform) => {
|
|
548
|
-
if (!transform)
|
|
550
|
+
if (!transform) {
|
|
551
|
+
return {};
|
|
552
|
+
}
|
|
549
553
|
return {
|
|
550
554
|
400: {
|
|
551
555
|
content: {
|
package/dist/packem_shared/{transformOpenApiSpec-BC0r6PzI.js → transformOpenApiSpec-BodFhFls.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
2
|
import { createPaginationMetaSchemaObject, createPaginationSchemaObject } from '@visulima/pagination';
|
|
3
|
-
import { sharedFileMetaSchemaObject, sharedErrorSchemaObject, sharedFileMetaExampleObject } from './sharedGet-
|
|
3
|
+
import { sharedFileMetaSchemaObject, sharedErrorSchemaObject, sharedFileMetaExampleObject } from './sharedGet-CkSLSnMd.js';
|
|
4
4
|
|
|
5
5
|
const swaggerSpec = (path = "/", tags = ["Transform"]) => {
|
|
6
6
|
const pathHash = createHash("sha256").update(path).digest("base64");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
2
|
import { createPaginationMetaSchemaObject, createPaginationSchemaObject } from '@visulima/pagination';
|
|
3
|
-
import { sharedGet, sharedFileMetaSchemaObject, sharedErrorSchemaObject, sharedFileMetaExampleObject, sharedGetList, sharedGetMeta } from './sharedGet-
|
|
3
|
+
import { sharedGet, sharedFileMetaSchemaObject, sharedErrorSchemaObject, sharedFileMetaExampleObject, sharedGetList, sharedGetMeta } from './sharedGet-CkSLSnMd.js';
|
|
4
4
|
|
|
5
5
|
const swaggerSpec = (path, options) => {
|
|
6
6
|
const { supportedTransformerFormat, tags, transformer } = { tags: ["Tus"], transformer: false, ...options };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
2
|
import { createPaginationMetaSchemaObject, createPaginationSchemaObject } from '@visulima/pagination';
|
|
3
|
-
import { sharedFileMetaSchemaObject, sharedErrorSchemaObject, sharedFileMetaExampleObject, sharedGetList, sharedGet, sharedGetMeta } from './sharedGet-
|
|
3
|
+
import { sharedFileMetaSchemaObject, sharedErrorSchemaObject, sharedFileMetaExampleObject, sharedGetList, sharedGet, sharedGetMeta } from './sharedGet-CkSLSnMd.js';
|
|
4
4
|
|
|
5
5
|
const swaggerSpec = (origin, path, options) => {
|
|
6
6
|
const { supportedTransformerFormat, tags, transformer } = { tags: ["Multipart"], transformer: false, ...options };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { default as S3File } from '../../packem_shared/S3File-
|
|
1
|
+
export { default as S3File } from '../../packem_shared/S3File-BXCuJaQZ.js';
|
|
2
2
|
export { default as S3MetaStorage } from '../../packem_shared/S3MetaStorage-yT4CznlV.js';
|
|
3
|
-
export { default as S3Storage } from '../../packem_shared/S3Storage-
|
|
3
|
+
export { default as S3Storage } from '../../packem_shared/S3Storage-2ZiheyWz.js';
|
|
@@ -131,7 +131,7 @@ export interface S3ApiOperations {
|
|
|
131
131
|
* Contains all shared business logic for S3 operations.
|
|
132
132
|
* @template TFile The file type used by this storage backend.
|
|
133
133
|
*/
|
|
134
|
-
export declare abstract class S3BaseStorage<TFile extends S3CompatibleFile = S3CompatibleFile> extends BaseStorage<TFile
|
|
134
|
+
export declare abstract class S3BaseStorage<TFile extends S3CompatibleFile = S3CompatibleFile> extends BaseStorage<TFile> {
|
|
135
135
|
checksumTypes: string[];
|
|
136
136
|
protected bucket: string;
|
|
137
137
|
protected meta: MetaStorage<TFile>;
|
|
@@ -48,7 +48,7 @@ import type { AwsError, S3StorageOptions } from "./types.d.ts";
|
|
|
48
48
|
* - ❌ getUrl: Not implemented (presigned URLs available via buildPresigned for clientDirectUpload)
|
|
49
49
|
* - ❌ getUploadUrl: Not implemented (presigned URLs available via buildPresigned for clientDirectUpload)
|
|
50
50
|
*/
|
|
51
|
-
declare class S3Storage extends S3BaseStorage
|
|
51
|
+
declare class S3Storage extends S3BaseStorage {
|
|
52
52
|
static readonly name: string;
|
|
53
53
|
private s3Api;
|
|
54
54
|
constructor(config: S3StorageOptions);
|
|
@@ -2,7 +2,6 @@ import type { ObjectCannedACL, S3Client, S3ClientConfig } from "@aws-sdk/client-
|
|
|
2
2
|
import type { ResponseMetadata } from "@aws-sdk/types";
|
|
3
3
|
import type { LocalMetaStorageOptions } from "../local/local-meta-storage.d.ts";
|
|
4
4
|
import type { BaseStorageOptions, MetaStorageOptions } from "../types.d.ts";
|
|
5
|
-
import type S3File from "./s3-file.d.ts";
|
|
6
5
|
export type S3MetaStorageOptions = MetaStorageOptions & S3ClientConfig & {
|
|
7
6
|
bucket?: string;
|
|
8
7
|
/**
|
|
@@ -11,7 +10,7 @@ export type S3MetaStorageOptions = MetaStorageOptions & S3ClientConfig & {
|
|
|
11
10
|
client?: S3Client;
|
|
12
11
|
keyFile?: string;
|
|
13
12
|
};
|
|
14
|
-
export type S3StorageOptions = BaseStorageOptions
|
|
13
|
+
export type S3StorageOptions = BaseStorageOptions & S3ClientConfig & {
|
|
15
14
|
/**
|
|
16
15
|
* Specifying access rules for uploaded files.
|
|
17
16
|
*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Readable } from "node:stream";
|
|
2
|
+
import type { HttpError } from "../../utils/types.d.ts";
|
|
2
3
|
import { S3BaseStorage } from "../aws/s3-base-storage.d.ts";
|
|
3
4
|
import type { FileInit, FileQuery } from "../utils/index.d.ts";
|
|
4
5
|
import AwsLightApiAdapter from "./aws-light-api-adapter.d.ts";
|
|
@@ -43,14 +44,14 @@ import type { AwsLightError, AwsLightStorageOptions } from "./types.d.ts";
|
|
|
43
44
|
* - ✅ exists: Implemented (checks metadata and S3 object)
|
|
44
45
|
* - ⚠️ getUrl/getUploadUrl: Limited presigned URL support (uses aws4fetch signing)
|
|
45
46
|
*/
|
|
46
|
-
declare class AwsLightStorage extends S3BaseStorage
|
|
47
|
+
declare class AwsLightStorage extends S3BaseStorage {
|
|
47
48
|
static readonly name: string;
|
|
48
49
|
private s3Api;
|
|
49
50
|
constructor(config: AwsLightStorageOptions);
|
|
50
51
|
/**
|
|
51
52
|
* Normalizes AWS S3 errors with S3-specific context.
|
|
52
53
|
*/
|
|
53
|
-
normalizeError(error: AwsLightError | Error):
|
|
54
|
+
normalizeError(error: AwsLightError | Error): HttpError;
|
|
54
55
|
update({ id }: FileQuery, metadata: Partial<AwsLightFile>): Promise<AwsLightFile>;
|
|
55
56
|
getStream({ id }: FileQuery): Promise<{
|
|
56
57
|
headers?: Record<string, string>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { default as AwsLightFile } from '../../packem_shared/AwsLightFile-
|
|
2
|
-
export { A as AwsLightMetaStorage } from '../../packem_shared/aws-light-meta-storage-
|
|
3
|
-
export { default as AwsLightStorage } from '../../packem_shared/AwsLightStorage-
|
|
1
|
+
export { default as AwsLightFile } from '../../packem_shared/AwsLightFile-C-Nd5rtl.js';
|
|
2
|
+
export { A as AwsLightMetaStorage } from '../../packem_shared/aws-light-meta-storage-BGZEiY3y.js';
|
|
3
|
+
export { default as AwsLightStorage } from '../../packem_shared/AwsLightStorage-C893xyaW.js';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { BaseStorageOptions, MetaStorageOptions } from "../types.d.ts";
|
|
2
|
-
import type AwsLightFile from "./aws-light-file.d.ts";
|
|
3
2
|
export interface AwsLightClientConfig {
|
|
4
3
|
accessKeyId: string;
|
|
5
4
|
endpoint?: string;
|
|
@@ -11,7 +10,7 @@ export interface AwsLightClientConfig {
|
|
|
11
10
|
export type AwsLightMetaStorageOptions = AwsLightClientConfig & MetaStorageOptions & {
|
|
12
11
|
bucket?: string;
|
|
13
12
|
};
|
|
14
|
-
export type AwsLightStorageOptions = AwsLightClientConfig & BaseStorageOptions
|
|
13
|
+
export type AwsLightStorageOptions = AwsLightClientConfig & BaseStorageOptions & {
|
|
15
14
|
/**
|
|
16
15
|
* S3 bucket name.
|
|
17
16
|
*/
|
|
@@ -14,10 +14,10 @@ import type { AzureStorageOptions } from "./types.d.ts";
|
|
|
14
14
|
* - ❌ getUrl: Not implemented (Azure Blob URLs not supported)
|
|
15
15
|
* - ❌ getUploadUrl: Not implemented (Azure Blob upload URLs handled internally)
|
|
16
16
|
*/
|
|
17
|
-
declare class AzureStorage extends BaseStorage
|
|
17
|
+
declare class AzureStorage extends BaseStorage {
|
|
18
18
|
static readonly name: string;
|
|
19
19
|
checksumTypes: string[];
|
|
20
|
-
protected meta: MetaStorage
|
|
20
|
+
protected meta: MetaStorage;
|
|
21
21
|
private client;
|
|
22
22
|
private readonly containerClient;
|
|
23
23
|
private readonly root;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { default as AzureFile } from '../../packem_shared/AzureFile-
|
|
1
|
+
export { default as AzureFile } from '../../packem_shared/AzureFile-C0kug4w4.js';
|
|
2
2
|
export { default as AzureSMetaStorage } from '../../packem_shared/AzureSMetaStorage-BEbXX9Uk.js';
|
|
3
|
-
export { default as AzureStorage } from '../../packem_shared/AzureStorage-
|
|
3
|
+
export { default as AzureStorage } from '../../packem_shared/AzureStorage-CpvzFT4y.js';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { BlobServiceClient } from "@azure/storage-blob";
|
|
2
2
|
import type { LocalMetaStorageOptions } from "../local/local-meta-storage.d.ts";
|
|
3
3
|
import type { BaseStorageOptions, MetaStorageOptions } from "../types.d.ts";
|
|
4
|
-
import type AzureFile from "./azure-file.d.ts";
|
|
5
4
|
interface ClientConfig {
|
|
6
5
|
/**
|
|
7
6
|
* Azure account key.
|
|
@@ -38,7 +37,7 @@ interface ClientConfig {
|
|
|
38
37
|
export interface AzureMetaStorageOptions extends ClientConfig, MetaStorageOptions {
|
|
39
38
|
client?: BlobServiceClient;
|
|
40
39
|
}
|
|
41
|
-
export interface AzureStorageOptions extends BaseStorageOptions
|
|
40
|
+
export interface AzureStorageOptions extends BaseStorageOptions, ClientConfig {
|
|
42
41
|
/**
|
|
43
42
|
* Configure metafiles storage
|
|
44
43
|
* @example
|
|
@@ -27,10 +27,10 @@ import type { ClientError, GCStorageOptions } from "./types.d.ts";
|
|
|
27
27
|
* - ❌ getUrl: Not implemented (GCS public URLs not supported)
|
|
28
28
|
* - ❌ getUploadUrl: Not implemented (resumable upload URLs handled internally)
|
|
29
29
|
*/
|
|
30
|
-
declare class GCStorage extends BaseStorage
|
|
30
|
+
declare class GCStorage extends BaseStorage {
|
|
31
31
|
static readonly name: string;
|
|
32
32
|
checksumTypes: string[];
|
|
33
|
-
protected meta: MetaStorage
|
|
33
|
+
protected meta: MetaStorage;
|
|
34
34
|
private readonly bucket;
|
|
35
35
|
private authClient;
|
|
36
36
|
private readonly storageBaseURI;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { default as GCSConfig } from '../../packem_shared/GCSConfig-vPP22kN6.js';
|
|
2
|
-
export { default as GCSFile } from '../../packem_shared/GCSFile-
|
|
3
|
-
export { G as GCSMetaStorage } from '../../packem_shared/gcs-meta-storage-
|
|
4
|
-
export { default as GCStorage } from '../../packem_shared/GCStorage-
|
|
2
|
+
export { default as GCSFile } from '../../packem_shared/GCSFile-DaDiCKE2.js';
|
|
3
|
+
export { G as GCSMetaStorage } from '../../packem_shared/gcs-meta-storage-MsUrkgP6.js';
|
|
4
|
+
export { default as GCStorage } from '../../packem_shared/GCStorage-BBHFEg7F.js';
|
|
@@ -2,7 +2,6 @@ import type { RetryConfig } from "gaxios";
|
|
|
2
2
|
import type { GoogleAuth, GoogleAuthOptions } from "google-auth-library";
|
|
3
3
|
import type { LocalMetaStorageOptions } from "../local/local-meta-storage.d.ts";
|
|
4
4
|
import type { BaseStorageOptions, MetaStorageOptions } from "../types.d.ts";
|
|
5
|
-
import type GCSFile from "./gcs-file.d.ts";
|
|
6
5
|
interface StorageSettings {
|
|
7
6
|
projectId: string;
|
|
8
7
|
retryOptions?: RetryConfig;
|
|
@@ -16,7 +15,7 @@ export interface ClientError extends Error {
|
|
|
16
15
|
config: Record<string, unknown>;
|
|
17
16
|
response?: Record<string, unknown>;
|
|
18
17
|
}
|
|
19
|
-
export interface GCStorageOptions extends BaseStorageOptions
|
|
18
|
+
export interface GCStorageOptions extends BaseStorageOptions, Omit<GoogleAuthOptions, "authClient" | "projectId">, StorageSettings {
|
|
20
19
|
/**
|
|
21
20
|
* Google Cloud Storage bucket
|
|
22
21
|
*/
|
|
@@ -25,7 +25,7 @@ import type { FileReturn } from "../utils/file/types.d.ts";
|
|
|
25
25
|
* - Metadata files use the `.META` suffix by default
|
|
26
26
|
* - File paths are resolved relative to the storage directory
|
|
27
27
|
*/
|
|
28
|
-
declare class DiskStorage<TFile extends File = File> extends BaseStorage<TFile
|
|
28
|
+
declare class DiskStorage<TFile extends File = File> extends BaseStorage<TFile> {
|
|
29
29
|
static readonly name: string;
|
|
30
30
|
checksumTypes: string[];
|
|
31
31
|
directory: string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { D as DiskStorage } from '../../packem_shared/disk-storage-
|
|
2
|
-
export { default as DiskStorageWithChecksum } from '../../packem_shared/DiskStorageWithChecksum-
|
|
1
|
+
export { D as DiskStorage } from '../../packem_shared/disk-storage-CC6-FUG9.js';
|
|
2
|
+
export { default as DiskStorageWithChecksum } from '../../packem_shared/DiskStorageWithChecksum-pu9u6IF7.js';
|
|
3
3
|
export { L as LocalMetaStorage } from '../../packem_shared/local-meta-storage-BlOk6m7F.js';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import MetaStorage from "../meta-storage.d.ts";
|
|
2
|
-
import type {
|
|
2
|
+
import type { LocalMetaStorageOptions } from "../meta-storage-options.d.ts";
|
|
3
3
|
import type { File } from "../utils/index.d.ts";
|
|
4
|
+
export type { LocalMetaStorageOptions } from "../meta-storage-options.d.ts";
|
|
4
5
|
/**
|
|
5
6
|
* Stores upload metafiles on local disk
|
|
6
7
|
*/
|
|
@@ -23,10 +24,4 @@ declare class LocalMetaStorage<T extends File = File> extends MetaStorage<T> {
|
|
|
23
24
|
delete(id: string): Promise<void>;
|
|
24
25
|
private accessCheck;
|
|
25
26
|
}
|
|
26
|
-
export interface LocalMetaStorageOptions extends MetaStorageOptions {
|
|
27
|
-
/**
|
|
28
|
-
* Where the upload metadata should be stored
|
|
29
|
-
*/
|
|
30
|
-
directory?: string;
|
|
31
|
-
}
|
|
32
27
|
export default LocalMetaStorage;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { default as NetlifyBlobFile } from '../../packem_shared/NetlifyBlobFile-
|
|
1
|
+
export { default as NetlifyBlobFile } from '../../packem_shared/NetlifyBlobFile-CfyJtGWN.js';
|
|
2
2
|
export { default as NetlifyBlobMetaStorage } from '../../packem_shared/NetlifyBlobMetaStorage-DIkZ2umW.js';
|
|
3
|
-
export { default as NetlifyBlobStorage } from '../../packem_shared/NetlifyBlobStorage-
|
|
3
|
+
export { default as NetlifyBlobStorage } from '../../packem_shared/NetlifyBlobStorage-pZX0_VdO.js';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { LocalMetaStorageOptions } from "../local/local-meta-storage.d.ts";
|
|
2
2
|
import LocalMetaStorage from "../local/local-meta-storage.d.ts";
|
|
3
|
-
|
|
4
|
-
declare class NetlifyBlobMetaStorage extends LocalMetaStorage<NetlifyBlobFile> {
|
|
3
|
+
declare class NetlifyBlobMetaStorage extends LocalMetaStorage {
|
|
5
4
|
constructor(config?: LocalMetaStorageOptions);
|
|
6
5
|
}
|
|
7
6
|
export default NetlifyBlobMetaStorage;
|
|
@@ -22,10 +22,10 @@ import type { NetlifyBlobStorageOptions } from "./types.d.ts";
|
|
|
22
22
|
* - ❌ getUrl: Not implemented (Netlify Blob URLs available via Netlify Blob API)
|
|
23
23
|
* - ❌ getUploadUrl: Not implemented (Netlify Blob upload URLs handled internally)
|
|
24
24
|
*/
|
|
25
|
-
declare class NetlifyBlobStorage extends BaseStorage
|
|
25
|
+
declare class NetlifyBlobStorage extends BaseStorage {
|
|
26
26
|
static readonly name: string;
|
|
27
27
|
checksumTypes: string[];
|
|
28
|
-
protected meta: MetaStorage
|
|
28
|
+
protected meta: MetaStorage;
|
|
29
29
|
private readonly storeName;
|
|
30
30
|
private readonly siteID?;
|
|
31
31
|
private readonly token?;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { LocalMetaStorageOptions } from "../local/local-meta-storage.d.ts";
|
|
2
2
|
import type { BaseStorageOptions } from "../types.d.ts";
|
|
3
|
-
|
|
4
|
-
export interface NetlifyBlobStorageOptions extends BaseStorageOptions<NetlifyBlobFile> {
|
|
3
|
+
export interface NetlifyBlobStorageOptions extends BaseStorageOptions {
|
|
5
4
|
/**
|
|
6
5
|
* Configure metafiles storage
|
|
7
6
|
* @example
|
package/dist/storage/types.d.ts
CHANGED
|
@@ -2,14 +2,10 @@ import type { Readable } from "node:stream";
|
|
|
2
2
|
import type { Cache } from "../utils/cache.d.ts";
|
|
3
3
|
import type { RetryConfig } from "../utils/retry.d.ts";
|
|
4
4
|
import type { HttpError, HttpErrorBody, Metrics, Validation } from "../utils/types.d.ts";
|
|
5
|
-
import type { LocalMetaStorageOptions } from "./local/local-meta-storage.d.ts";
|
|
6
5
|
import type MetaStorage from "./meta-storage.d.ts";
|
|
6
|
+
import type { LocalMetaStorageOptions } from "./meta-storage-options.d.ts";
|
|
7
7
|
import type { File, FileInit, FilePart, FileQuery, FileReturn, UploadFile } from "./utils/index.d.ts";
|
|
8
|
-
export
|
|
9
|
-
logger?: Console;
|
|
10
|
-
prefix?: string;
|
|
11
|
-
suffix?: string;
|
|
12
|
-
}
|
|
8
|
+
export type { MetaStorageOptions } from "./meta-storage-options.d.ts";
|
|
13
9
|
export type OnCreate<TFile extends File = File> = (file: TFile) => Promise<void> | void;
|
|
14
10
|
export type OnUpdate<TFile extends File = File> = (file: TFile) => Promise<void> | void;
|
|
15
11
|
export type OnComplete<TFile extends File = File, TResponse = unknown, TRequest = unknown> = (file: TFile, response: TResponse, request?: TRequest) => Promise<void> | void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { default as VercelBlobFile } from '../../packem_shared/VercelBlobFile-
|
|
1
|
+
export { default as VercelBlobFile } from '../../packem_shared/VercelBlobFile-DkFIIb9Q.js';
|
|
2
2
|
export { default as VercelBlobMetaStorage } from '../../packem_shared/VercelBlobMetaStorage-c0M-TvAR.js';
|
|
3
|
-
export { default as VercelBlobStorage } from '../../packem_shared/VercelBlobStorage-
|
|
3
|
+
export { default as VercelBlobStorage } from '../../packem_shared/VercelBlobStorage-CwgI91cP.js';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { LocalMetaStorageOptions } from "../local/local-meta-storage.d.ts";
|
|
2
2
|
import type { BaseStorageOptions } from "../types.d.ts";
|
|
3
|
-
|
|
4
|
-
export interface VercelBlobStorageOptions extends BaseStorageOptions<VercelBlobFile> {
|
|
3
|
+
export interface VercelBlobStorageOptions extends BaseStorageOptions {
|
|
5
4
|
/**
|
|
6
5
|
* Configure metafiles storage
|
|
7
6
|
* @example
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { LocalMetaStorageOptions } from "../local/local-meta-storage.d.ts";
|
|
2
2
|
import LocalMetaStorage from "../local/local-meta-storage.d.ts";
|
|
3
|
-
|
|
4
|
-
declare class VercelBlobMetaStorage extends LocalMetaStorage<VercelBlobFile> {
|
|
3
|
+
declare class VercelBlobMetaStorage extends LocalMetaStorage {
|
|
5
4
|
constructor(config?: LocalMetaStorageOptions);
|
|
6
5
|
}
|
|
7
6
|
export default VercelBlobMetaStorage;
|
|
@@ -23,10 +23,10 @@ import VercelBlobFile from "./vercel-blob-file.d.ts";
|
|
|
23
23
|
* - ❌ getUrl: Not implemented (Vercel Blob URLs available via Vercel Blob API)
|
|
24
24
|
* - ❌ getUploadUrl: Not implemented (Vercel Blob upload URLs handled internally)
|
|
25
25
|
*/
|
|
26
|
-
declare class VercelBlobStorage extends BaseStorage
|
|
26
|
+
declare class VercelBlobStorage extends BaseStorage {
|
|
27
27
|
static readonly name: string;
|
|
28
28
|
checksumTypes: string[];
|
|
29
|
-
protected meta: MetaStorage
|
|
29
|
+
protected meta: MetaStorage;
|
|
30
30
|
private readonly token;
|
|
31
31
|
private readonly multipart;
|
|
32
32
|
constructor(config: VercelBlobStorageOptions);
|
|
@@ -2,7 +2,7 @@ import { Readable } from "node:stream";
|
|
|
2
2
|
import type { BaseStorage } from "../storage/storage.d.ts";
|
|
3
3
|
import type { File, FileReturn } from "../storage/utils/index.d.ts";
|
|
4
4
|
import type { Cache } from "../utils/cache.d.ts";
|
|
5
|
-
import type { BaseTransformerConfig } from "./
|
|
5
|
+
import type { BaseTransformerConfig } from "./transformer-config.d.ts";
|
|
6
6
|
/**
|
|
7
7
|
* Abstract base class for all media transformers.
|
|
8
8
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { default as BaseTransformer } from '../packem_shared/BaseTransformer-9965D4pb.js';
|
|
2
|
-
export { default as MediaTransformer } from '../packem_shared/MediaTransformer-
|
|
2
|
+
export { default as MediaTransformer } from '../packem_shared/MediaTransformer-BRRqYA0E.js';
|
|
3
3
|
export { getFormatFromContentType, isKnownContentType, isValidMediaType, validateMediaFile } from '../packem_shared/isValidMediaType-BeDgiObq.js';
|
|
4
4
|
export { default as ValidationError } from '../packem_shared/ValidationError-BfF1aE4h.js';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Cache } from "../utils/cache.d.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Base transformer configuration with common properties
|
|
4
|
+
*/
|
|
5
|
+
export interface BaseTransformerConfig {
|
|
6
|
+
/** Cache instance to use for caching */
|
|
7
|
+
cache?: Cache;
|
|
8
|
+
/** Cache TTL in seconds */
|
|
9
|
+
cacheTtl?: number;
|
|
10
|
+
/** Logger instance */
|
|
11
|
+
logger?: Console;
|
|
12
|
+
/** Maximum number of cached items */
|
|
13
|
+
maxCacheSize?: number;
|
|
14
|
+
/** Supported input formats */
|
|
15
|
+
supportedFormats?: string[] | undefined;
|
|
16
|
+
}
|
|
@@ -2,6 +2,8 @@ import type { BaseStorage } from "../storage/storage.d.ts";
|
|
|
2
2
|
import type { File, FileReturn } from "../storage/utils/index.d.ts";
|
|
3
3
|
import type { Cache } from "../utils/cache.d.ts";
|
|
4
4
|
import type BaseTransformer from "./base-transformer.d.ts";
|
|
5
|
+
import type { BaseTransformerConfig } from "./transformer-config.d.ts";
|
|
6
|
+
export type { BaseTransformerConfig } from "./transformer-config.d.ts";
|
|
5
7
|
/**
|
|
6
8
|
* Supported image formats for transformation
|
|
7
9
|
*/
|
|
@@ -606,21 +608,6 @@ export interface MediaTransformQuery {
|
|
|
606
608
|
/** Whether to avoid reducing larger images */
|
|
607
609
|
withoutReduction?: boolean;
|
|
608
610
|
}
|
|
609
|
-
/**
|
|
610
|
-
* Base transformer configuration with common properties
|
|
611
|
-
*/
|
|
612
|
-
export interface BaseTransformerConfig {
|
|
613
|
-
/** Cache instance to use for caching */
|
|
614
|
-
cache?: Cache;
|
|
615
|
-
/** Cache TTL in seconds */
|
|
616
|
-
cacheTtl?: number;
|
|
617
|
-
/** Logger instance */
|
|
618
|
-
logger?: Console;
|
|
619
|
-
/** Maximum number of cached items */
|
|
620
|
-
maxCacheSize?: number;
|
|
621
|
-
/** Supported input formats */
|
|
622
|
-
supportedFormats?: string[] | undefined;
|
|
623
|
-
}
|
|
624
611
|
/**
|
|
625
612
|
* Image transformer configuration
|
|
626
613
|
*/
|
package/dist/utils/types.d.ts
CHANGED
|
@@ -70,7 +70,7 @@ export interface UploadResponse<T = ResponseBody> extends Record<string, unknown
|
|
|
70
70
|
*/
|
|
71
71
|
export interface ValidatorConfig<T> {
|
|
72
72
|
isValid?: (t: T) => Promise<boolean> | boolean;
|
|
73
|
-
response?: HttpError
|
|
73
|
+
response?: HttpError | ResponseTuple;
|
|
74
74
|
value?: unknown;
|
|
75
75
|
}
|
|
76
76
|
/** Map of rule-name -> validator configuration. */
|