@visulima/storage 1.0.0-alpha.17 → 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.
Files changed (185) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/LICENSE.md +3 -0
  3. package/dist/adapter/nuxt/module.d.ts +3 -3
  4. package/dist/adapter/nuxt/module.js +1 -93
  5. package/dist/handler/http/fetch/index.d.ts +6 -6
  6. package/dist/handler/http/fetch/index.js +1 -4
  7. package/dist/handler/http/hono/index.d.ts +3 -3
  8. package/dist/handler/http/hono/index.js +1 -65
  9. package/dist/handler/http/nextjs/index.d.ts +4 -4
  10. package/dist/handler/http/nextjs/index.js +1 -37
  11. package/dist/handler/http/node/index.d.ts +6 -6
  12. package/dist/handler/http/node/index.js +1 -8
  13. package/dist/handler/http/solid-start/index.d.ts +4 -4
  14. package/dist/handler/http/solid-start/index.js +1 -44
  15. package/dist/index.js +1 -13
  16. package/dist/openapi/index.js +1 -5
  17. package/dist/packem_shared/AwsLightFile-BTLiRxXj.js +1 -0
  18. package/dist/packem_shared/AwsLightMetaStorage-DHz1nf_H.js +1 -0
  19. package/dist/packem_shared/AwsLightStorage-CA9cdfJ6.js +1 -0
  20. package/dist/packem_shared/AzureFile-BKHru1zB.js +1 -0
  21. package/dist/packem_shared/AzureSMetaStorage-BqA4jUDJ.js +1 -0
  22. package/dist/packem_shared/AzureStorage-BKUjCymW.js +1 -0
  23. package/dist/packem_shared/BaseTransformer-D68eLyz1.js +1 -0
  24. package/dist/packem_shared/DiskStorage-DNjpDMX9.js +1 -0
  25. package/dist/packem_shared/DiskStorageWithChecksum-Bb6JX_tC.js +1 -0
  26. package/dist/packem_shared/ERRORS-B9jkvKwx.js +1 -0
  27. package/dist/packem_shared/File-alcSNpLq.js +1 -0
  28. package/dist/packem_shared/GCSConfig-BQ0OpVhe.js +1 -0
  29. package/dist/packem_shared/GCSFile-CHjX_fJk.js +1 -0
  30. package/dist/packem_shared/GCSMetaStorage-CpxQ8wM9.js +1 -0
  31. package/dist/packem_shared/GCStorage-DAg1V55T.js +1 -0
  32. package/dist/packem_shared/LocalMetaStorage-BWuFvWn4.js +1 -0
  33. package/dist/packem_shared/MediaTransformer-2C8MJeAg.js +1 -0
  34. package/dist/packem_shared/MetaStorage-Y4m1dWgd.js +1 -0
  35. package/dist/packem_shared/Metadata-B6Ir0KO7.js +1 -0
  36. package/dist/packem_shared/Multipart-Bd9YFFn0.js +1 -0
  37. package/dist/packem_shared/Multipart-D5bcEvga.js +1 -0
  38. package/dist/packem_shared/NetlifyBlobFile-CpzkMKng.js +1 -0
  39. package/dist/packem_shared/NetlifyBlobMetaStorage-dD0oBLom.js +1 -0
  40. package/dist/packem_shared/NetlifyBlobStorage-ByTwCN-h.js +1 -0
  41. package/dist/packem_shared/NoOpMetrics-Dky06sf1.js +1 -0
  42. package/dist/packem_shared/OpenTelemetryMetrics-9uxQMSlg.js +1 -0
  43. package/dist/packem_shared/Rest-CYEBbtCD.js +1 -0
  44. package/dist/packem_shared/Rest-DoonVU7B.js +1 -0
  45. package/dist/packem_shared/S3File-Du6wP0Sz.js +1 -0
  46. package/dist/packem_shared/S3MetaStorage-vcriiosn.js +1 -0
  47. package/dist/packem_shared/S3Storage-Fx6-OSc-.js +1 -0
  48. package/dist/packem_shared/TUS_RESUMABLE-B7KtPVeC.js +1 -0
  49. package/dist/packem_shared/Tus-Bd_2Ki2G.js +1 -0
  50. package/dist/packem_shared/Tus-CUBCkuPE.js +1 -0
  51. package/dist/packem_shared/ValidationError-D8KKJiKA.js +1 -0
  52. package/dist/packem_shared/VercelBlobFile-CL9MjKcY.js +1 -0
  53. package/dist/packem_shared/VercelBlobMetaStorage-BsOTx-Su.js +1 -0
  54. package/dist/packem_shared/VercelBlobStorage-kNkk5Cn4.js +1 -0
  55. package/dist/packem_shared/_commonjsHelpers-D6W6KoPK.js +1 -0
  56. package/dist/packem_shared/aws-light-meta-storage-TPyQwLvk.js +4 -0
  57. package/dist/packem_shared/backblaze-DEflv87m.js +1 -0
  58. package/dist/packem_shared/base-handler-core-DaggCVsq.js +1 -0
  59. package/dist/packem_shared/base-handler-fetch-DnarP64X.js +1 -0
  60. package/dist/packem_shared/base-handler-node-BTes6sql.js +1 -0
  61. package/dist/packem_shared/cache-qV_5Umeq.js +1 -0
  62. package/dist/packem_shared/cloudflare-DLAeQvgD.js +1 -0
  63. package/dist/packem_shared/defaultCloudStorageFileNameValidation-yiM9GxHr.js +1 -0
  64. package/dist/packem_shared/digitalOcean-nhZUds87.js +1 -0
  65. package/dist/packem_shared/disk-storage-BvdK4bqF.js +5 -0
  66. package/dist/packem_shared/gcs-meta-storage-CvGkpzVE.js +1 -0
  67. package/dist/packem_shared/has-content-Bx2p8Okx.js +1 -0
  68. package/dist/packem_shared/headers-DC2MEOrK.js +27 -0
  69. package/dist/packem_shared/is-expired-1JuZjDtb.js +1 -0
  70. package/dist/packem_shared/isRetryableError-DQNSZiBc.js +1 -0
  71. package/dist/packem_shared/isValidMediaType-B-2UKjZx.js +1 -0
  72. package/dist/packem_shared/local-meta-storage-Bkwqi_gi.js +1 -0
  73. package/dist/packem_shared/{media-transformer.d-ChmjTvjc.d.ts → media-transformer.d-CY9CsEOe.d.ts} +1 -1
  74. package/dist/packem_shared/minio-BWwgGXeE.js +1 -0
  75. package/dist/packem_shared/multipart-base-C6OjBwMS.js +1 -0
  76. package/dist/packem_shared/part-match-DqD5U7An.js +1 -0
  77. package/dist/packem_shared/path-D7rMc9nq-B718mbm6.js +1 -0
  78. package/dist/packem_shared/response-builder-Wdo_fvcF.js +1 -0
  79. package/dist/packem_shared/rest-base-B2Dv7esY.js +1 -0
  80. package/dist/packem_shared/restOpenApiSpec-PaIVbESh.js +1 -0
  81. package/dist/packem_shared/s3-base-storage-xHZNtsGe.js +1 -0
  82. package/dist/packem_shared/sharedGet-Ce7WGAsc.js +1 -0
  83. package/dist/packem_shared/storage-m_Cxgiih.js +1 -0
  84. package/dist/packem_shared/tigris-DZoyrMNd.js +1 -0
  85. package/dist/packem_shared/transformOpenApiSpec-C0vEbDTO.js +1 -0
  86. package/dist/packem_shared/{tus-base.d-CpLzyd-S.d.ts → tus-base.d-DNZRXR9X.d.ts} +2 -2
  87. package/dist/packem_shared/tusOpenApiSpec-DF0-hlWV.js +1 -0
  88. package/dist/packem_shared/{types.d-DBjmJvIT.d.ts → types.d-BCN94sB_.d.ts} +1 -1
  89. package/dist/packem_shared/{types.d-DviSTLOg.d.ts → types.d-D4caL2Fp.d.ts} +1 -1
  90. package/dist/packem_shared/update-size-DANV7aa2.js +1 -0
  91. package/dist/packem_shared/validator-DK41xp8N.js +1 -0
  92. package/dist/packem_shared/waitForStorage-ChSBLhLc.js +1 -0
  93. package/dist/packem_shared/wasabi-Dmce4x9s.js +1 -0
  94. package/dist/packem_shared/xhrOpenApiSpec-nyoboz83.js +1 -0
  95. package/dist/storage/aws/clients/index.js +1 -6
  96. package/dist/storage/aws/index.js +1 -3
  97. package/dist/storage/aws-light/index.js +1 -3
  98. package/dist/storage/azure/index.js +1 -3
  99. package/dist/storage/gcs/index.js +1 -4
  100. package/dist/storage/local/index.js +1 -3
  101. package/dist/storage/netlify-blob/index.js +1 -3
  102. package/dist/storage/vercel-blob/index.js +1 -3
  103. package/dist/transformer/audio-transformer.d.ts +1 -1
  104. package/dist/transformer/audio-transformer.js +1 -278
  105. package/dist/transformer/image-transformer.d.ts +1 -1
  106. package/dist/transformer/image-transformer.js +1 -1100
  107. package/dist/transformer/index.d.ts +2 -2
  108. package/dist/transformer/index.js +1 -4
  109. package/dist/transformer/video-transformer.d.ts +1 -1
  110. package/dist/transformer/video-transformer.js +1 -310
  111. package/package.json +18 -18
  112. package/dist/packem_shared/AwsLightFile-C-Nd5rtl.js +0 -11
  113. package/dist/packem_shared/AwsLightMetaStorage-BIDb5EPg.js +0 -4
  114. package/dist/packem_shared/AwsLightStorage-CMuKw4bI.js +0 -133
  115. package/dist/packem_shared/AzureFile-C0kug4w4.js +0 -8
  116. package/dist/packem_shared/AzureSMetaStorage-BEbXX9Uk.js +0 -89
  117. package/dist/packem_shared/AzureStorage-98-LRZ1e.js +0 -359
  118. package/dist/packem_shared/BaseTransformer-9965D4pb.js +0 -83
  119. package/dist/packem_shared/DiskStorage-COMe_G42.js +0 -12
  120. package/dist/packem_shared/DiskStorageWithChecksum-BVaaZiyS.js +0 -249
  121. package/dist/packem_shared/ERRORS-D0apMqnc.js +0 -97
  122. package/dist/packem_shared/File-CPUhj3DI.js +0 -69
  123. package/dist/packem_shared/GCSConfig-vPP22kN6.js +0 -11
  124. package/dist/packem_shared/GCSFile-DaDiCKE2.js +0 -8
  125. package/dist/packem_shared/GCSMetaStorage-BygVH0Ee.js +0 -7
  126. package/dist/packem_shared/GCStorage-4hSx_bN1.js +0 -410
  127. package/dist/packem_shared/LocalMetaStorage-DvnZqf61.js +0 -7
  128. package/dist/packem_shared/MediaTransformer-BRRqYA0E.js +0 -1202
  129. package/dist/packem_shared/MetaStorage-pECeFOad.js +0 -46
  130. package/dist/packem_shared/Metadata-DRLXeJ0F.js +0 -89
  131. package/dist/packem_shared/Multipart-BzzvNxt4.js +0 -128
  132. package/dist/packem_shared/Multipart-DLtFLQ8s.js +0 -163
  133. package/dist/packem_shared/NetlifyBlobFile-CfyJtGWN.js +0 -14
  134. package/dist/packem_shared/NetlifyBlobMetaStorage-eJT6RFy9.js +0 -9
  135. package/dist/packem_shared/NetlifyBlobStorage-nPv7iIAG.js +0 -376
  136. package/dist/packem_shared/NoOpMetrics-DhAk5rXc.js +0 -10
  137. package/dist/packem_shared/OpenTelemetryMetrics-BnxhqIaH.js +0 -67
  138. package/dist/packem_shared/Rest-DEa7IA9R.js +0 -267
  139. package/dist/packem_shared/Rest-qhMbCn5a.js +0 -228
  140. package/dist/packem_shared/S3File-BXCuJaQZ.js +0 -11
  141. package/dist/packem_shared/S3MetaStorage-yT4CznlV.js +0 -77
  142. package/dist/packem_shared/S3Storage-wi5XT-yu.js +0 -317
  143. package/dist/packem_shared/TUS_RESUMABLE-Dtfsffnj.js +0 -434
  144. package/dist/packem_shared/Tus-Ck0Hdle5.js +0 -195
  145. package/dist/packem_shared/Tus-_0vCdHyB.js +0 -200
  146. package/dist/packem_shared/ValidationError-BfF1aE4h.js +0 -26
  147. package/dist/packem_shared/VercelBlobFile-DkFIIb9Q.js +0 -18
  148. package/dist/packem_shared/VercelBlobMetaStorage-DjFmi4vp.js +0 -9
  149. package/dist/packem_shared/VercelBlobStorage-CmMgiDgr.js +0 -261
  150. package/dist/packem_shared/_commonjsHelpers-BqLXS_qQ.js +0 -5
  151. package/dist/packem_shared/aws-light-meta-storage-BGZEiY3y.js +0 -447
  152. package/dist/packem_shared/backblaze-BlMnIcBC.js +0 -20
  153. package/dist/packem_shared/base-handler-core-lVB-D59L.js +0 -306
  154. package/dist/packem_shared/base-handler-fetch-CitgN-Aw.js +0 -291
  155. package/dist/packem_shared/base-handler-node-BiO2DF87.js +0 -731
  156. package/dist/packem_shared/cache-B88MXQ_2.js +0 -18
  157. package/dist/packem_shared/cloudflare-Bi1q8wXE.js +0 -21
  158. package/dist/packem_shared/defaultCloudStorageFileNameValidation-Brw40ZEP.js +0 -11
  159. package/dist/packem_shared/digitalOcean-CWQRJM3L.js +0 -21
  160. package/dist/packem_shared/disk-storage-D9RfoKjW.js +0 -832
  161. package/dist/packem_shared/gcs-meta-storage-8FovEDbW.js +0 -159
  162. package/dist/packem_shared/has-content-CY66ehMK.js +0 -3
  163. package/dist/packem_shared/headers-YLRp1dLo.js +0 -1318
  164. package/dist/packem_shared/is-expired-CTThU1q5.js +0 -8
  165. package/dist/packem_shared/isRetryableError-Dycp7127.js +0 -82
  166. package/dist/packem_shared/isValidMediaType-BeDgiObq.js +0 -35
  167. package/dist/packem_shared/local-meta-storage-D-pPc3FI.js +0 -658
  168. package/dist/packem_shared/minio-C2YBZQOw.js +0 -22
  169. package/dist/packem_shared/multipart-base-C994naBi.js +0 -102
  170. package/dist/packem_shared/part-match-Dt738Ddb.js +0 -96
  171. package/dist/packem_shared/path-aV9lMdcn-DMU5H1-h.js +0 -162
  172. package/dist/packem_shared/response-builder-BtnRiBUI.js +0 -45
  173. package/dist/packem_shared/rest-base-k1ory8uB.js +0 -457
  174. package/dist/packem_shared/restOpenApiSpec-BBJ_SiPE.js +0 -800
  175. package/dist/packem_shared/s3-base-storage-zUO8u8Cp.js +0 -510
  176. package/dist/packem_shared/sharedGet-CkSLSnMd.js +0 -1022
  177. package/dist/packem_shared/storage-5XW1E7XU.js +0 -1188
  178. package/dist/packem_shared/tigris-Hac8TKnX.js +0 -21
  179. package/dist/packem_shared/transformOpenApiSpec-BodFhFls.js +0 -975
  180. package/dist/packem_shared/tusOpenApiSpec-DzppyJTW.js +0 -740
  181. package/dist/packem_shared/update-size-CCGm6i1J.js +0 -8
  182. package/dist/packem_shared/validator-DuO17wFF.js +0 -79
  183. package/dist/packem_shared/waitForStorage-Cscw85sx.js +0 -18
  184. package/dist/packem_shared/wasabi-DIyflHSd.js +0 -21
  185. package/dist/packem_shared/xhrOpenApiSpec-CXz7BC5J.js +0 -264
@@ -1,8 +0,0 @@
1
- const updateSize = (file, size) => {
2
- if (size < file.size) {
3
- file.size = size;
4
- }
5
- return file;
6
- };
7
-
8
- export { updateSize as u };
@@ -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 };