@visulima/storage 1.0.0-alpha.18 → 1.0.0-alpha.19
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 +14 -0
- package/LICENSE.md +30 -0
- package/dist/adapter/nuxt/module.d.ts +3 -3
- package/dist/adapter/nuxt/module.js +1 -93
- package/dist/handler/http/fetch/index.d.ts +6 -6
- package/dist/handler/http/fetch/index.js +1 -4
- package/dist/handler/http/hono/index.d.ts +3 -3
- package/dist/handler/http/hono/index.js +1 -65
- package/dist/handler/http/nextjs/index.d.ts +4 -4
- package/dist/handler/http/nextjs/index.js +1 -37
- package/dist/handler/http/node/index.d.ts +6 -6
- package/dist/handler/http/node/index.js +1 -8
- package/dist/handler/http/solid-start/index.d.ts +4 -4
- package/dist/handler/http/solid-start/index.js +1 -44
- package/dist/index.js +1 -13
- package/dist/openapi/index.js +1 -5
- package/dist/packem_shared/AwsLightFile-BTLiRxXj.js +1 -0
- package/dist/packem_shared/AwsLightMetaStorage-DHz1nf_H.js +1 -0
- package/dist/packem_shared/AwsLightStorage-CA9cdfJ6.js +1 -0
- package/dist/packem_shared/AzureFile-BKHru1zB.js +1 -0
- package/dist/packem_shared/AzureSMetaStorage-BqA4jUDJ.js +1 -0
- package/dist/packem_shared/AzureStorage-BKUjCymW.js +1 -0
- package/dist/packem_shared/BaseTransformer-D68eLyz1.js +1 -0
- package/dist/packem_shared/DiskStorage-DNjpDMX9.js +1 -0
- package/dist/packem_shared/DiskStorageWithChecksum-Bb6JX_tC.js +1 -0
- package/dist/packem_shared/ERRORS-B9jkvKwx.js +1 -0
- package/dist/packem_shared/File-alcSNpLq.js +1 -0
- package/dist/packem_shared/GCSConfig-BQ0OpVhe.js +1 -0
- package/dist/packem_shared/GCSFile-CHjX_fJk.js +1 -0
- package/dist/packem_shared/GCSMetaStorage-CpxQ8wM9.js +1 -0
- package/dist/packem_shared/GCStorage-DAg1V55T.js +1 -0
- package/dist/packem_shared/LocalMetaStorage-BWuFvWn4.js +1 -0
- package/dist/packem_shared/MediaTransformer-2C8MJeAg.js +1 -0
- package/dist/packem_shared/MetaStorage-Y4m1dWgd.js +1 -0
- package/dist/packem_shared/Metadata-B6Ir0KO7.js +1 -0
- package/dist/packem_shared/Multipart-Bd9YFFn0.js +1 -0
- package/dist/packem_shared/Multipart-D5bcEvga.js +1 -0
- package/dist/packem_shared/NetlifyBlobFile-CpzkMKng.js +1 -0
- package/dist/packem_shared/NetlifyBlobMetaStorage-dD0oBLom.js +1 -0
- package/dist/packem_shared/NetlifyBlobStorage-ByTwCN-h.js +1 -0
- package/dist/packem_shared/NoOpMetrics-Dky06sf1.js +1 -0
- package/dist/packem_shared/OpenTelemetryMetrics-9uxQMSlg.js +1 -0
- package/dist/packem_shared/Rest-CYEBbtCD.js +1 -0
- package/dist/packem_shared/Rest-DoonVU7B.js +1 -0
- package/dist/packem_shared/S3File-Du6wP0Sz.js +1 -0
- package/dist/packem_shared/S3MetaStorage-vcriiosn.js +1 -0
- package/dist/packem_shared/S3Storage-Fx6-OSc-.js +1 -0
- package/dist/packem_shared/TUS_RESUMABLE-B7KtPVeC.js +1 -0
- package/dist/packem_shared/Tus-Bd_2Ki2G.js +1 -0
- package/dist/packem_shared/Tus-CUBCkuPE.js +1 -0
- package/dist/packem_shared/ValidationError-D8KKJiKA.js +1 -0
- package/dist/packem_shared/VercelBlobFile-CL9MjKcY.js +1 -0
- package/dist/packem_shared/VercelBlobMetaStorage-BsOTx-Su.js +1 -0
- package/dist/packem_shared/VercelBlobStorage-kNkk5Cn4.js +1 -0
- package/dist/packem_shared/_commonjsHelpers-D6W6KoPK.js +1 -0
- package/dist/packem_shared/aws-light-meta-storage-TPyQwLvk.js +4 -0
- package/dist/packem_shared/backblaze-DEflv87m.js +1 -0
- package/dist/packem_shared/base-handler-core-DaggCVsq.js +1 -0
- package/dist/packem_shared/base-handler-fetch-DnarP64X.js +1 -0
- package/dist/packem_shared/base-handler-node-BTes6sql.js +1 -0
- package/dist/packem_shared/cache-qV_5Umeq.js +1 -0
- package/dist/packem_shared/cloudflare-DLAeQvgD.js +1 -0
- package/dist/packem_shared/defaultCloudStorageFileNameValidation-yiM9GxHr.js +1 -0
- package/dist/packem_shared/digitalOcean-nhZUds87.js +1 -0
- package/dist/packem_shared/disk-storage-BvdK4bqF.js +5 -0
- package/dist/packem_shared/gcs-meta-storage-CvGkpzVE.js +1 -0
- package/dist/packem_shared/has-content-Bx2p8Okx.js +1 -0
- package/dist/packem_shared/headers-DC2MEOrK.js +27 -0
- package/dist/packem_shared/is-expired-1JuZjDtb.js +1 -0
- package/dist/packem_shared/isRetryableError-DQNSZiBc.js +1 -0
- package/dist/packem_shared/isValidMediaType-B-2UKjZx.js +1 -0
- package/dist/packem_shared/local-meta-storage-Bkwqi_gi.js +1 -0
- package/dist/packem_shared/{media-transformer.d-DeHZkBVx.d.ts → media-transformer.d-CY9CsEOe.d.ts} +1 -1
- package/dist/packem_shared/minio-BWwgGXeE.js +1 -0
- package/dist/packem_shared/multipart-base-C6OjBwMS.js +1 -0
- package/dist/packem_shared/part-match-DqD5U7An.js +1 -0
- package/dist/packem_shared/path-D7rMc9nq-B718mbm6.js +1 -0
- package/dist/packem_shared/response-builder-Wdo_fvcF.js +1 -0
- package/dist/packem_shared/rest-base-B2Dv7esY.js +1 -0
- package/dist/packem_shared/restOpenApiSpec-PaIVbESh.js +1 -0
- package/dist/packem_shared/s3-base-storage-xHZNtsGe.js +1 -0
- package/dist/packem_shared/sharedGet-Ce7WGAsc.js +1 -0
- package/dist/packem_shared/storage-m_Cxgiih.js +1 -0
- package/dist/packem_shared/tigris-DZoyrMNd.js +1 -0
- package/dist/packem_shared/transformOpenApiSpec-C0vEbDTO.js +1 -0
- package/dist/packem_shared/{tus-base.d-BftIixIA.d.ts → tus-base.d-DNZRXR9X.d.ts} +2 -2
- package/dist/packem_shared/tusOpenApiSpec-DF0-hlWV.js +1 -0
- package/dist/packem_shared/{types.d-BPd_JkW1.d.ts → types.d-BCN94sB_.d.ts} +1 -1
- package/dist/packem_shared/{types.d-D-mlfmef.d.ts → types.d-D4caL2Fp.d.ts} +1 -1
- package/dist/packem_shared/update-size-DANV7aa2.js +1 -0
- package/dist/packem_shared/validator-DK41xp8N.js +1 -0
- package/dist/packem_shared/waitForStorage-ChSBLhLc.js +1 -0
- package/dist/packem_shared/wasabi-Dmce4x9s.js +1 -0
- package/dist/packem_shared/xhrOpenApiSpec-nyoboz83.js +1 -0
- package/dist/storage/aws/clients/index.js +1 -6
- package/dist/storage/aws/index.js +1 -3
- package/dist/storage/aws-light/index.js +1 -3
- package/dist/storage/azure/index.js +1 -3
- package/dist/storage/gcs/index.js +1 -4
- package/dist/storage/local/index.js +1 -3
- package/dist/storage/netlify-blob/index.js +1 -3
- package/dist/storage/vercel-blob/index.js +1 -3
- package/dist/transformer/audio-transformer.d.ts +1 -1
- package/dist/transformer/audio-transformer.js +1 -278
- package/dist/transformer/image-transformer.d.ts +1 -1
- package/dist/transformer/image-transformer.js +1 -1100
- package/dist/transformer/index.d.ts +2 -2
- package/dist/transformer/index.js +1 -4
- package/dist/transformer/video-transformer.d.ts +1 -1
- package/dist/transformer/video-transformer.js +1 -310
- package/package.json +17 -17
- package/dist/packem_shared/AwsLightFile-C-Nd5rtl.js +0 -11
- package/dist/packem_shared/AwsLightMetaStorage-BIDb5EPg.js +0 -4
- package/dist/packem_shared/AwsLightStorage-CMuKw4bI.js +0 -133
- package/dist/packem_shared/AzureFile-C0kug4w4.js +0 -8
- package/dist/packem_shared/AzureSMetaStorage-BEbXX9Uk.js +0 -89
- package/dist/packem_shared/AzureStorage-98-LRZ1e.js +0 -359
- package/dist/packem_shared/BaseTransformer-9965D4pb.js +0 -83
- package/dist/packem_shared/DiskStorage-COMe_G42.js +0 -12
- package/dist/packem_shared/DiskStorageWithChecksum-BVaaZiyS.js +0 -249
- package/dist/packem_shared/ERRORS-D0apMqnc.js +0 -97
- package/dist/packem_shared/File-CPUhj3DI.js +0 -69
- package/dist/packem_shared/GCSConfig-vPP22kN6.js +0 -11
- package/dist/packem_shared/GCSFile-DaDiCKE2.js +0 -8
- package/dist/packem_shared/GCSMetaStorage-w3c8c5ak.js +0 -7
- package/dist/packem_shared/GCStorage-DSktYrrp.js +0 -410
- package/dist/packem_shared/LocalMetaStorage-DvnZqf61.js +0 -7
- package/dist/packem_shared/MediaTransformer-BRRqYA0E.js +0 -1202
- package/dist/packem_shared/MetaStorage-pECeFOad.js +0 -46
- package/dist/packem_shared/Metadata-DRLXeJ0F.js +0 -89
- package/dist/packem_shared/Multipart-BzzvNxt4.js +0 -128
- package/dist/packem_shared/Multipart-DLtFLQ8s.js +0 -163
- package/dist/packem_shared/NetlifyBlobFile-CfyJtGWN.js +0 -14
- package/dist/packem_shared/NetlifyBlobMetaStorage-eJT6RFy9.js +0 -9
- package/dist/packem_shared/NetlifyBlobStorage-nPv7iIAG.js +0 -376
- package/dist/packem_shared/NoOpMetrics-DhAk5rXc.js +0 -10
- package/dist/packem_shared/OpenTelemetryMetrics-BnxhqIaH.js +0 -67
- package/dist/packem_shared/Rest-DEa7IA9R.js +0 -267
- package/dist/packem_shared/Rest-qhMbCn5a.js +0 -228
- package/dist/packem_shared/S3File-BXCuJaQZ.js +0 -11
- package/dist/packem_shared/S3MetaStorage-yT4CznlV.js +0 -77
- package/dist/packem_shared/S3Storage-wi5XT-yu.js +0 -317
- package/dist/packem_shared/TUS_RESUMABLE-Dtfsffnj.js +0 -434
- package/dist/packem_shared/Tus-Ck0Hdle5.js +0 -195
- package/dist/packem_shared/Tus-_0vCdHyB.js +0 -200
- package/dist/packem_shared/ValidationError-BfF1aE4h.js +0 -26
- package/dist/packem_shared/VercelBlobFile-DkFIIb9Q.js +0 -18
- package/dist/packem_shared/VercelBlobMetaStorage-DjFmi4vp.js +0 -9
- package/dist/packem_shared/VercelBlobStorage-CmMgiDgr.js +0 -261
- package/dist/packem_shared/_commonjsHelpers-BqLXS_qQ.js +0 -5
- package/dist/packem_shared/aws-light-meta-storage-BGZEiY3y.js +0 -447
- package/dist/packem_shared/backblaze-BlMnIcBC.js +0 -20
- package/dist/packem_shared/base-handler-core-lVB-D59L.js +0 -306
- package/dist/packem_shared/base-handler-fetch-CitgN-Aw.js +0 -291
- package/dist/packem_shared/base-handler-node-BiO2DF87.js +0 -731
- package/dist/packem_shared/cache-B88MXQ_2.js +0 -18
- package/dist/packem_shared/cloudflare-Bi1q8wXE.js +0 -21
- package/dist/packem_shared/defaultCloudStorageFileNameValidation-Brw40ZEP.js +0 -11
- package/dist/packem_shared/digitalOcean-CWQRJM3L.js +0 -21
- package/dist/packem_shared/disk-storage-D9RfoKjW.js +0 -832
- package/dist/packem_shared/gcs-meta-storage-CPSVL_a7.js +0 -159
- package/dist/packem_shared/has-content-CY66ehMK.js +0 -3
- package/dist/packem_shared/headers-YLRp1dLo.js +0 -1318
- package/dist/packem_shared/is-expired-CTThU1q5.js +0 -8
- package/dist/packem_shared/isRetryableError-Dycp7127.js +0 -82
- package/dist/packem_shared/isValidMediaType-BeDgiObq.js +0 -35
- package/dist/packem_shared/local-meta-storage-D-pPc3FI.js +0 -658
- package/dist/packem_shared/minio-C2YBZQOw.js +0 -22
- package/dist/packem_shared/multipart-base-C994naBi.js +0 -102
- package/dist/packem_shared/part-match-Dt738Ddb.js +0 -96
- package/dist/packem_shared/path-aV9lMdcn-DMU5H1-h.js +0 -162
- package/dist/packem_shared/response-builder-BtnRiBUI.js +0 -45
- package/dist/packem_shared/rest-base-k1ory8uB.js +0 -457
- package/dist/packem_shared/restOpenApiSpec-BBJ_SiPE.js +0 -800
- package/dist/packem_shared/s3-base-storage-zUO8u8Cp.js +0 -510
- package/dist/packem_shared/sharedGet-CkSLSnMd.js +0 -1022
- package/dist/packem_shared/storage-5XW1E7XU.js +0 -1188
- package/dist/packem_shared/tigris-Hac8TKnX.js +0 -21
- package/dist/packem_shared/transformOpenApiSpec-BodFhFls.js +0 -975
- package/dist/packem_shared/tusOpenApiSpec-DzppyJTW.js +0 -740
- package/dist/packem_shared/update-size-CCGm6i1J.js +0 -8
- package/dist/packem_shared/validator-DuO17wFF.js +0 -79
- package/dist/packem_shared/waitForStorage-Cscw85sx.js +0 -18
- package/dist/packem_shared/wasabi-DIyflHSd.js +0 -21
- package/dist/packem_shared/xhrOpenApiSpec-CXz7BC5J.js +0 -264
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { ErrorMap } from './ERRORS-D0apMqnc.js';
|
|
2
|
-
|
|
3
|
-
class ValidationError extends Error {
|
|
4
|
-
code;
|
|
5
|
-
statusCode;
|
|
6
|
-
body;
|
|
7
|
-
headers;
|
|
8
|
-
name = "ValidationError";
|
|
9
|
-
/**
|
|
10
|
-
* Creates a new ValidationError instance.
|
|
11
|
-
* @param code Machine-readable error code
|
|
12
|
-
* @param statusCode HTTP status code for the error
|
|
13
|
-
* @param body Error response body (string or structured object)
|
|
14
|
-
* @param headers HTTP headers to include in error response
|
|
15
|
-
*/
|
|
16
|
-
constructor(code, statusCode, body, headers) {
|
|
17
|
-
const message = typeof body === "string" ? body : body?.message || "Validation error";
|
|
18
|
-
super(message);
|
|
19
|
-
this.code = code;
|
|
20
|
-
this.statusCode = statusCode;
|
|
21
|
-
this.body = body;
|
|
22
|
-
this.headers = headers;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const capitalize = (s) => s && s[0].toUpperCase() + s.slice(1);
|
|
27
|
-
const toResponse = (response) => {
|
|
28
|
-
if (!Array.isArray(response)) {
|
|
29
|
-
return response;
|
|
30
|
-
}
|
|
31
|
-
const [statusCode, body, headers] = response;
|
|
32
|
-
return { body, headers, statusCode };
|
|
33
|
-
};
|
|
34
|
-
class Validator {
|
|
35
|
-
/**
|
|
36
|
-
* Creates a new Validator instance.
|
|
37
|
-
* @param prefix Prefix for generated error codes (default: "ValidationError")
|
|
38
|
-
*/
|
|
39
|
-
constructor(prefix = "ValidationError") {
|
|
40
|
-
this.prefix = prefix;
|
|
41
|
-
}
|
|
42
|
-
prefix;
|
|
43
|
-
validators = {};
|
|
44
|
-
/**
|
|
45
|
-
* Adds validation rules to the validator.
|
|
46
|
-
* Each rule must include an `isValid` function.
|
|
47
|
-
* @param config Validation configuration object
|
|
48
|
-
* @throws TypeError if any validator is missing the isValid function
|
|
49
|
-
*/
|
|
50
|
-
add(config) {
|
|
51
|
-
Object.entries(config).forEach(([key, validator]) => {
|
|
52
|
-
const code = `${this.prefix}${capitalize(key)}`;
|
|
53
|
-
this.validators[code] = { ...this.validators[code], ...validator };
|
|
54
|
-
if (typeof this.validators[code].isValid !== "function") {
|
|
55
|
-
throw new TypeError('Validation config "isValid" is missing, or it is not a function!');
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Verifies an object against all configured validation rules.
|
|
61
|
-
* Throws ValidationError on first validation failure.
|
|
62
|
-
* @param t Object to validate
|
|
63
|
-
* @throws ValidationError if validation fails
|
|
64
|
-
*/
|
|
65
|
-
async verify(t) {
|
|
66
|
-
for (const [code, validator] of Object.entries(this.validators)) {
|
|
67
|
-
const isValid = await validator.isValid(t);
|
|
68
|
-
if (!isValid) {
|
|
69
|
-
const errorResponse = validator.response || (code in ErrorMap ? ErrorMap[code] : ErrorMap.UnknownError);
|
|
70
|
-
const response = toResponse(errorResponse);
|
|
71
|
-
const { body, headers, message, statusCode } = response;
|
|
72
|
-
throw new ValidationError(code, statusCode, body || message, headers);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
const isValidationError = (error) => error.name === "ValidationError";
|
|
78
|
-
|
|
79
|
-
export { ValidationError as V, Validator as a, isValidationError as i };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
const waitForStorage = async (storage, timeoutMs = 5e3) => {
|
|
2
|
-
if (storage.isReady) {
|
|
3
|
-
return;
|
|
4
|
-
}
|
|
5
|
-
const startTime = Date.now();
|
|
6
|
-
while (!storage.isReady && Date.now() - startTime < timeoutMs) {
|
|
7
|
-
await new Promise((resolve) => {
|
|
8
|
-
setTimeout(() => {
|
|
9
|
-
resolve();
|
|
10
|
-
}, 100);
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
if (!storage.isReady) {
|
|
14
|
-
throw new Error("Storage initialization timeout");
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export { waitForStorage };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const wasabi = (parameters) => {
|
|
2
|
-
const { accessKeyId, region, secretAccessKey } = parameters ?? {
|
|
3
|
-
accessKeyId: process.env.AWS_ACCESS_KEY_ID || process.env.WASABI_ACCESS_KEY_ID || process.env.WASABI_ACCESS_KEY,
|
|
4
|
-
region: process.env.AWS_REGION || process.env.WASABI_REGION,
|
|
5
|
-
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY || process.env.WASABI_SECRET_ACCESS_KEY || process.env.WASABI_SECRET_KEY
|
|
6
|
-
};
|
|
7
|
-
if (!region || !accessKeyId || !secretAccessKey) {
|
|
8
|
-
throw new Error("Missing required parameters for Wasabi client.");
|
|
9
|
-
}
|
|
10
|
-
return {
|
|
11
|
-
apiVersion: "2006-03-01",
|
|
12
|
-
credentials: {
|
|
13
|
-
accessKeyId,
|
|
14
|
-
secretAccessKey
|
|
15
|
-
},
|
|
16
|
-
endpoint: `https://s3.${region}.wasabisys.com`,
|
|
17
|
-
region
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export { wasabi as default };
|
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
import { createHash } from 'node:crypto';
|
|
2
|
-
import { createPaginationMetaSchemaObject, createPaginationSchemaObject } from '@visulima/pagination';
|
|
3
|
-
import { sharedFileMetaSchemaObject, sharedErrorSchemaObject, sharedFileMetaExampleObject, sharedGetList, sharedGet, sharedGetMeta } from './sharedGet-CkSLSnMd.js';
|
|
4
|
-
|
|
5
|
-
const swaggerSpec = (origin, path, options) => {
|
|
6
|
-
const { supportedTransformerFormat, tags, transformer } = { tags: ["Multipart"], transformer: false, ...options };
|
|
7
|
-
const pathHash = createHash("sha256").update(path).digest("base64");
|
|
8
|
-
return {
|
|
9
|
-
components: {
|
|
10
|
-
examples: sharedFileMetaExampleObject,
|
|
11
|
-
parameters: {
|
|
12
|
-
UploadIDinPath: {
|
|
13
|
-
description: "Upload ID",
|
|
14
|
-
in: "path",
|
|
15
|
-
name: "id",
|
|
16
|
-
schema: {
|
|
17
|
-
type: "string"
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
responses: {
|
|
22
|
-
404: {
|
|
23
|
-
content: {
|
|
24
|
-
"application/json": {
|
|
25
|
-
example: {
|
|
26
|
-
error: {
|
|
27
|
-
code: "FileNotFound",
|
|
28
|
-
message: "Not found"
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
schema: {
|
|
32
|
-
$ref: "#/components/schemas/Error"
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
description: "Not Found"
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
schemas: {
|
|
40
|
-
...createPaginationSchemaObject(
|
|
41
|
-
"FileMetaPagination",
|
|
42
|
-
{
|
|
43
|
-
$ref: "#/components/schemas/PaginationMeta"
|
|
44
|
-
},
|
|
45
|
-
"#/components/schemas/PaginationMeta"
|
|
46
|
-
),
|
|
47
|
-
...createPaginationMetaSchemaObject("PaginationMeta"),
|
|
48
|
-
...sharedErrorSchemaObject,
|
|
49
|
-
...sharedFileMetaSchemaObject
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
paths: {
|
|
53
|
-
[`${path.replace(/\/$/, "")}/{id}/metadata`]: {
|
|
54
|
-
get: sharedGetMeta(`${pathHash}MultipartGetFileMeta`, tags)
|
|
55
|
-
},
|
|
56
|
-
[`${path.replace(/\/$/, "")}/{id}`]: {
|
|
57
|
-
delete: {
|
|
58
|
-
description: "Cancel upload",
|
|
59
|
-
operationId: `${pathHash}MultipartCancel`,
|
|
60
|
-
parameters: [
|
|
61
|
-
{
|
|
62
|
-
$ref: "#/components/parameters/UploadIDinPath"
|
|
63
|
-
}
|
|
64
|
-
],
|
|
65
|
-
responses: {
|
|
66
|
-
204: {
|
|
67
|
-
description: "No Content"
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
summary: "Cancel upload",
|
|
71
|
-
tags
|
|
72
|
-
},
|
|
73
|
-
get: sharedGet(`${pathHash}TusGetFile`, tags, transformer, supportedTransformerFormat)
|
|
74
|
-
},
|
|
75
|
-
[path.trimEnd()]: {
|
|
76
|
-
get: sharedGetList(`${pathHash}MultipartGetList`, tags),
|
|
77
|
-
post: {
|
|
78
|
-
description: "Create upload",
|
|
79
|
-
operationId: `${pathHash}MultipartCreate`,
|
|
80
|
-
requestBody: {
|
|
81
|
-
content: {
|
|
82
|
-
"multipart/form-data": {
|
|
83
|
-
schema: {
|
|
84
|
-
properties: {
|
|
85
|
-
file: {
|
|
86
|
-
description: "File to upload",
|
|
87
|
-
format: "binary",
|
|
88
|
-
type: "string"
|
|
89
|
-
},
|
|
90
|
-
metadata: {
|
|
91
|
-
description: "JSON stringifies metadata",
|
|
92
|
-
example: '{ "name": "video.mp4", "mimeType": "video/mp4", "size": 741, "lastModified": 1631750105530 }',
|
|
93
|
-
type: "string"
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
type: "object"
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
description: "Upload Metadata",
|
|
101
|
-
required: false
|
|
102
|
-
},
|
|
103
|
-
responses: {
|
|
104
|
-
200: {
|
|
105
|
-
description: "The file already exists, send a resume request",
|
|
106
|
-
headers: {
|
|
107
|
-
ETag: {
|
|
108
|
-
description: "Upload ETag",
|
|
109
|
-
schema: {
|
|
110
|
-
example: "d41d8cd98f00b204e9800998ecf8427e",
|
|
111
|
-
type: "string"
|
|
112
|
-
}
|
|
113
|
-
},
|
|
114
|
-
Location: {
|
|
115
|
-
description: "Resumable URI",
|
|
116
|
-
schema: {
|
|
117
|
-
// eslint-disable-next-line no-secrets/no-secrets
|
|
118
|
-
example: `${origin}/files?uploadType=Upload&upload_id=2b62dbec20048158af963572fbdf89c6`,
|
|
119
|
-
format: "uri",
|
|
120
|
-
type: "string"
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
|
-
"X-Upload-Expires": {
|
|
124
|
-
description: "Upload expiration date",
|
|
125
|
-
schema: {
|
|
126
|
-
example: "2021-08-25T11:12:26.635Z",
|
|
127
|
-
format: "date-time",
|
|
128
|
-
type: "string"
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
},
|
|
133
|
-
201: {
|
|
134
|
-
description: "Upload accepted, send the file contents",
|
|
135
|
-
headers: {
|
|
136
|
-
ETag: {
|
|
137
|
-
description: "Upload ETag",
|
|
138
|
-
schema: {
|
|
139
|
-
example: "d41d8cd98f00b204e9800998ecf8427e",
|
|
140
|
-
type: "string"
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
|
-
Location: {
|
|
144
|
-
description: "Resumable URI",
|
|
145
|
-
schema: {
|
|
146
|
-
// eslint-disable-next-line no-secrets/no-secrets
|
|
147
|
-
example: `${origin}/files?uploadType=Upload&upload_id=2b62dbec20048158af963572fbdf89c6`,
|
|
148
|
-
format: "uri",
|
|
149
|
-
type: "string"
|
|
150
|
-
}
|
|
151
|
-
},
|
|
152
|
-
"X-Upload-Expires": {
|
|
153
|
-
description: "Upload expiration date",
|
|
154
|
-
schema: {
|
|
155
|
-
example: "2021-08-25T11:12:26.635Z",
|
|
156
|
-
format: "date-time",
|
|
157
|
-
type: "string"
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
},
|
|
162
|
-
400: {
|
|
163
|
-
content: {
|
|
164
|
-
"application/json": {
|
|
165
|
-
example: {
|
|
166
|
-
error: {
|
|
167
|
-
code: "InvalidFileName",
|
|
168
|
-
message: "Invalid file name",
|
|
169
|
-
name: "ValidationError"
|
|
170
|
-
}
|
|
171
|
-
},
|
|
172
|
-
schema: {
|
|
173
|
-
$ref: "#/components/schemas/Error"
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
},
|
|
177
|
-
description: "Bad Request"
|
|
178
|
-
},
|
|
179
|
-
413: {
|
|
180
|
-
content: {
|
|
181
|
-
"application/json": {
|
|
182
|
-
example: {
|
|
183
|
-
error: {
|
|
184
|
-
code: "RequestEntityTooLarge",
|
|
185
|
-
message: "Request entity too large",
|
|
186
|
-
name: "ValidationError"
|
|
187
|
-
}
|
|
188
|
-
},
|
|
189
|
-
schema: {
|
|
190
|
-
$ref: "#/components/schemas/Error"
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
},
|
|
194
|
-
description: "Request Entity Too Large"
|
|
195
|
-
},
|
|
196
|
-
415: {
|
|
197
|
-
content: {
|
|
198
|
-
"application/json": {
|
|
199
|
-
example: {
|
|
200
|
-
error: {
|
|
201
|
-
code: "UnsupportedMediaType",
|
|
202
|
-
message: "Unsupported media type",
|
|
203
|
-
name: "ValidationError"
|
|
204
|
-
}
|
|
205
|
-
},
|
|
206
|
-
schema: {
|
|
207
|
-
$ref: "#/components/schemas/Error"
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
},
|
|
211
|
-
description: "Unsupported Media Type"
|
|
212
|
-
},
|
|
213
|
-
423: {
|
|
214
|
-
content: {
|
|
215
|
-
"application/json": {
|
|
216
|
-
example: {
|
|
217
|
-
error: {
|
|
218
|
-
code: "FileLocked",
|
|
219
|
-
message: "File locked"
|
|
220
|
-
}
|
|
221
|
-
},
|
|
222
|
-
schema: {
|
|
223
|
-
$ref: "#/components/schemas/Error"
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
},
|
|
227
|
-
description: "File locked"
|
|
228
|
-
},
|
|
229
|
-
500: {
|
|
230
|
-
content: {
|
|
231
|
-
"application/json": {
|
|
232
|
-
example: {
|
|
233
|
-
error: {
|
|
234
|
-
code: "GenericUploadError",
|
|
235
|
-
message: "Generic Upload Error"
|
|
236
|
-
}
|
|
237
|
-
},
|
|
238
|
-
schema: {
|
|
239
|
-
$ref: "#/components/schemas/Error"
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
},
|
|
243
|
-
description: "Internal Server Error"
|
|
244
|
-
},
|
|
245
|
-
default: {
|
|
246
|
-
content: {
|
|
247
|
-
"application/json": {
|
|
248
|
-
schema: {
|
|
249
|
-
$ref: "#/components/schemas/Error"
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
},
|
|
253
|
-
description: "Error"
|
|
254
|
-
}
|
|
255
|
-
},
|
|
256
|
-
summary: "Create upload",
|
|
257
|
-
tags
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
};
|
|
262
|
-
};
|
|
263
|
-
|
|
264
|
-
export { swaggerSpec as default };
|