@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,800 +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: ["REST"], 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
- "X-Chunk-Checksum": {
41
- description: "SHA256 checksum of the chunk data for validation. Format: 'sha256 <base64-encoded-checksum>'.",
42
- type: "string"
43
- },
44
- "X-Chunk-Offset": {
45
- description: "Byte offset for the chunk being uploaded. Required for PATCH requests in chunked uploads.",
46
- type: "integer"
47
- },
48
- "X-Chunked-Upload": {
49
- description: "Header to indicate chunked upload initialization. Set to 'true' to initialize a chunked upload session.",
50
- enum: ["true"],
51
- type: "string"
52
- },
53
- "X-Chunked-Upload-Response": {
54
- description: "Indicates this is a chunked upload session. Returned in HEAD responses.",
55
- enum: ["true"],
56
- type: "string"
57
- },
58
- "X-Received-Chunks": {
59
- description: "JSON array of received chunk offsets. Used for resumable uploads.",
60
- type: "string"
61
- },
62
- "X-Total-Size": {
63
- description: "Total size of the file in bytes for chunked uploads. Required when X-Chunked-Upload is 'true'.",
64
- type: "integer"
65
- },
66
- "X-Upload-Complete": {
67
- description: "Indicates if the upload is complete. Set to 'true' when all chunks have been uploaded.",
68
- enum: ["true", "false"],
69
- type: "string"
70
- },
71
- "X-Upload-Offset": {
72
- description: "Current upload offset in bytes. Returned in responses for chunked uploads.",
73
- type: "integer"
74
- },
75
- ...createPaginationSchemaObject(
76
- "FileMetaPagination",
77
- {
78
- $ref: "#/components/schemas/PaginationMeta"
79
- },
80
- "#/components/schemas/PaginationMeta"
81
- ),
82
- ...createPaginationMetaSchemaObject("PaginationMeta"),
83
- ...sharedErrorSchemaObject,
84
- ...sharedFileMetaSchemaObject
85
- }
86
- },
87
- paths: {
88
- [`${path.replace(/\/$/, "")}/{id}/metadata`]: {
89
- get: sharedGetMeta(`${pathHash}RestGetFileMeta`, tags)
90
- },
91
- [`${path.replace(/\/$/, "")}/{id}`]: {
92
- delete: {
93
- description: "Delete a single file",
94
- operationId: `${pathHash}RestDeleteFile`,
95
- parameters: [
96
- {
97
- $ref: "#/components/parameters/UploadIDinPath"
98
- }
99
- ],
100
- responses: {
101
- 204: {
102
- description: "No Content - File deleted successfully"
103
- },
104
- 404: {
105
- $ref: "#/components/responses/404"
106
- },
107
- default: {
108
- content: {
109
- "application/json": {
110
- schema: {
111
- $ref: "#/components/schemas/Error"
112
- }
113
- }
114
- },
115
- description: "Error"
116
- }
117
- },
118
- summary: "Delete file",
119
- tags
120
- },
121
- get: sharedGet(`${pathHash}RestGetFile`, tags, transformer, supportedTransformerFormat),
122
- head: {
123
- description: "Get file metadata and upload progress. For chunked uploads, returns progress information including current offset and completion status.",
124
- operationId: `${pathHash}RestHeadFile`,
125
- parameters: [
126
- {
127
- $ref: "#/components/parameters/UploadIDinPath"
128
- }
129
- ],
130
- responses: {
131
- 200: {
132
- description: "OK",
133
- headers: {
134
- "Content-Length": {
135
- description: "File size in bytes",
136
- schema: {
137
- type: "integer"
138
- }
139
- },
140
- "Content-Type": {
141
- description: "MIME type of the file",
142
- schema: {
143
- type: "string"
144
- }
145
- },
146
- ETag: {
147
- description: "Entity tag for caching",
148
- schema: {
149
- example: "d41d8cd98f00b204e9800998ecf8427e",
150
- type: "string"
151
- }
152
- },
153
- "Last-Modified": {
154
- description: "Last modified date",
155
- schema: {
156
- example: "2021-08-25T11:12:26.635Z",
157
- format: "date-time",
158
- type: "string"
159
- }
160
- },
161
- "X-Chunked-Upload": {
162
- description: "Indicates this is a chunked upload session",
163
- schema: {
164
- $ref: "#/components/schemas/X-Chunked-Upload-Response"
165
- }
166
- },
167
- "X-Received-Chunks": {
168
- description: "JSON array of received chunk offsets (chunked uploads only)",
169
- schema: {
170
- $ref: "#/components/schemas/X-Received-Chunks"
171
- }
172
- },
173
- "X-Upload-Complete": {
174
- description: "Indicates if upload is complete (chunked uploads only)",
175
- schema: {
176
- $ref: "#/components/schemas/X-Upload-Complete"
177
- }
178
- },
179
- "X-Upload-Expires": {
180
- description: "Upload expiration date",
181
- schema: {
182
- example: "2021-08-25T11:12:26.635Z",
183
- format: "date-time",
184
- type: "string"
185
- }
186
- },
187
- "X-Upload-Offset": {
188
- description: "Current upload offset in bytes (chunked uploads only)",
189
- schema: {
190
- $ref: "#/components/schemas/X-Upload-Offset"
191
- }
192
- }
193
- }
194
- },
195
- 404: {
196
- $ref: "#/components/responses/404"
197
- },
198
- default: {
199
- content: {
200
- "application/json": {
201
- schema: {
202
- $ref: "#/components/schemas/Error"
203
- }
204
- }
205
- },
206
- description: "Error"
207
- }
208
- },
209
- summary: "Get file metadata",
210
- tags
211
- },
212
- patch: {
213
- description: "Upload a chunk for chunked uploads. Requires X-Chunk-Offset header and chunk data in the request body.",
214
- operationId: `${pathHash}RestPatchChunk`,
215
- parameters: [
216
- {
217
- $ref: "#/components/parameters/UploadIDinPath"
218
- },
219
- {
220
- description: "Byte offset for this chunk",
221
- in: "header",
222
- name: "X-Chunk-Offset",
223
- required: true,
224
- schema: {
225
- $ref: "#/components/schemas/X-Chunk-Offset"
226
- }
227
- },
228
- {
229
- description: "SHA256 checksum of the chunk (optional)",
230
- in: "header",
231
- name: "X-Chunk-Checksum",
232
- required: false,
233
- schema: {
234
- $ref: "#/components/schemas/X-Chunk-Checksum"
235
- }
236
- }
237
- ],
238
- requestBody: {
239
- content: {
240
- "application/octet-stream": {
241
- description: "Chunk data as raw binary",
242
- schema: {
243
- format: "binary",
244
- type: "string"
245
- }
246
- }
247
- },
248
- description: "Chunk data",
249
- required: true
250
- },
251
- responses: {
252
- 200: {
253
- description: "Chunk uploaded successfully",
254
- headers: {
255
- ETag: {
256
- description: "Upload ETag",
257
- schema: {
258
- example: "d41d8cd98f00b204e9800998ecf8427e",
259
- type: "string"
260
- }
261
- },
262
- Location: {
263
- description: "File URL",
264
- schema: {
265
- example: `${origin}${path}/file-id`,
266
- format: "uri",
267
- type: "string"
268
- }
269
- },
270
- "X-Upload-Complete": {
271
- description: "Indicates if upload is complete",
272
- schema: {
273
- $ref: "#/components/schemas/X-Upload-Complete"
274
- }
275
- },
276
- "X-Upload-Expires": {
277
- description: "Upload expiration date",
278
- schema: {
279
- example: "2021-08-25T11:12:26.635Z",
280
- format: "date-time",
281
- type: "string"
282
- }
283
- },
284
- "X-Upload-Offset": {
285
- description: "Current upload offset after this chunk",
286
- schema: {
287
- $ref: "#/components/schemas/X-Upload-Offset"
288
- }
289
- }
290
- }
291
- },
292
- 201: {
293
- description: "Upload completed (all chunks received)",
294
- headers: {
295
- ETag: {
296
- description: "Upload ETag",
297
- schema: {
298
- example: "d41d8cd98f00b204e9800998ecf8427e",
299
- type: "string"
300
- }
301
- },
302
- Location: {
303
- description: "File URL",
304
- schema: {
305
- example: `${origin}${path}/file-id`,
306
- format: "uri",
307
- type: "string"
308
- }
309
- },
310
- "X-Upload-Complete": {
311
- description: "Upload is complete",
312
- schema: {
313
- enum: ["true"],
314
- type: "string"
315
- }
316
- },
317
- "X-Upload-Expires": {
318
- description: "Upload expiration date",
319
- schema: {
320
- example: "2021-08-25T11:12:26.635Z",
321
- format: "date-time",
322
- type: "string"
323
- }
324
- }
325
- }
326
- },
327
- 400: {
328
- content: {
329
- "application/json": {
330
- example: {
331
- error: {
332
- code: "BadRequest",
333
- message: "X-Chunk-Offset header is required"
334
- }
335
- },
336
- schema: {
337
- $ref: "#/components/schemas/Error"
338
- }
339
- }
340
- },
341
- description: "Bad Request"
342
- },
343
- 404: {
344
- content: {
345
- "application/json": {
346
- example: {
347
- error: {
348
- code: "FileNotFound",
349
- message: "Upload session not found"
350
- }
351
- },
352
- schema: {
353
- $ref: "#/components/schemas/Error"
354
- }
355
- }
356
- },
357
- description: "Not Found"
358
- },
359
- 413: {
360
- content: {
361
- "application/json": {
362
- example: {
363
- error: {
364
- code: "RequestEntityTooLarge",
365
- message: "Chunk size exceeds maximum allowed size of 104857600 bytes"
366
- }
367
- },
368
- schema: {
369
- $ref: "#/components/schemas/Error"
370
- }
371
- }
372
- },
373
- description: "Request Entity Too Large"
374
- },
375
- default: {
376
- content: {
377
- "application/json": {
378
- schema: {
379
- $ref: "#/components/schemas/Error"
380
- }
381
- }
382
- },
383
- description: "Error"
384
- }
385
- },
386
- summary: "Upload chunk",
387
- tags
388
- },
389
- put: {
390
- description: "Create or update a file. Requires file ID in the URL path. If file exists, it will be overwritten.",
391
- operationId: `${pathHash}RestPutFile`,
392
- parameters: [
393
- {
394
- $ref: "#/components/parameters/UploadIDinPath"
395
- }
396
- ],
397
- requestBody: {
398
- content: {
399
- "application/octet-stream": {
400
- description: "File data as raw binary",
401
- schema: {
402
- format: "binary",
403
- type: "string"
404
- }
405
- }
406
- },
407
- description: "File data",
408
- required: true
409
- },
410
- responses: {
411
- 200: {
412
- description: "File updated successfully",
413
- headers: {
414
- ETag: {
415
- description: "Upload ETag",
416
- schema: {
417
- example: "d41d8cd98f00b204e9800998ecf8427e",
418
- type: "string"
419
- }
420
- },
421
- Location: {
422
- description: "File URL",
423
- schema: {
424
- example: `${origin}${path}/file-id`,
425
- format: "uri",
426
- type: "string"
427
- }
428
- },
429
- "X-Upload-Expires": {
430
- description: "Upload expiration date",
431
- schema: {
432
- example: "2021-08-25T11:12:26.635Z",
433
- format: "date-time",
434
- type: "string"
435
- }
436
- }
437
- }
438
- },
439
- 201: {
440
- description: "File created successfully",
441
- headers: {
442
- ETag: {
443
- description: "Upload ETag",
444
- schema: {
445
- example: "d41d8cd98f00b204e9800998ecf8427e",
446
- type: "string"
447
- }
448
- },
449
- Location: {
450
- description: "File URL",
451
- schema: {
452
- example: `${origin}${path}/file-id`,
453
- format: "uri",
454
- type: "string"
455
- }
456
- },
457
- "X-Upload-Expires": {
458
- description: "Upload expiration date",
459
- schema: {
460
- example: "2021-08-25T11:12:26.635Z",
461
- format: "date-time",
462
- type: "string"
463
- }
464
- }
465
- }
466
- },
467
- 400: {
468
- content: {
469
- "application/json": {
470
- example: {
471
- error: {
472
- code: "BadRequest",
473
- message: "Request body is required"
474
- }
475
- },
476
- schema: {
477
- $ref: "#/components/schemas/Error"
478
- }
479
- }
480
- },
481
- description: "Bad Request"
482
- },
483
- 413: {
484
- content: {
485
- "application/json": {
486
- example: {
487
- error: {
488
- code: "RequestEntityTooLarge",
489
- message: "File size exceeds maximum allowed size"
490
- }
491
- },
492
- schema: {
493
- $ref: "#/components/schemas/Error"
494
- }
495
- }
496
- },
497
- description: "Request Entity Too Large"
498
- },
499
- default: {
500
- content: {
501
- "application/json": {
502
- schema: {
503
- $ref: "#/components/schemas/Error"
504
- }
505
- }
506
- },
507
- description: "Error"
508
- }
509
- },
510
- summary: "Create or update file",
511
- tags
512
- }
513
- },
514
- [path.trimEnd()]: {
515
- delete: {
516
- description: 'Delete multiple files. Supports batch delete via query parameter (?ids=id1,id2,id3) or JSON body ({ids: ["id1", "id2"]} or ["id1", "id2"]).',
517
- operationId: `${pathHash}RestBatchDelete`,
518
- parameters: [
519
- {
520
- description: "Comma-separated list of file IDs to delete",
521
- in: "query",
522
- name: "ids",
523
- required: false,
524
- schema: {
525
- example: "id1,id2,id3",
526
- type: "string"
527
- }
528
- }
529
- ],
530
- requestBody: {
531
- content: {
532
- "application/json": {
533
- schema: {
534
- oneOf: [
535
- {
536
- properties: {
537
- ids: {
538
- description: "Array of file IDs to delete",
539
- items: {
540
- type: "string"
541
- },
542
- type: "array"
543
- }
544
- },
545
- required: ["ids"],
546
- type: "object"
547
- },
548
- {
549
- description: "Array of file IDs to delete",
550
- items: {
551
- type: "string"
552
- },
553
- type: "array"
554
- }
555
- ]
556
- }
557
- }
558
- },
559
- description: "File IDs to delete (optional if using query parameter)",
560
- required: false
561
- },
562
- responses: {
563
- 204: {
564
- description: "All files deleted successfully"
565
- },
566
- 207: {
567
- description: "Multi-Status - Some files deleted successfully",
568
- headers: {
569
- "X-Delete-Errors": {
570
- description: "JSON array of deletion errors",
571
- schema: {
572
- type: "string"
573
- }
574
- },
575
- "X-Delete-Failed": {
576
- description: "Number of files that failed to delete",
577
- schema: {
578
- type: "integer"
579
- }
580
- },
581
- "X-Delete-Successful": {
582
- description: "Number of files successfully deleted",
583
- schema: {
584
- type: "integer"
585
- }
586
- }
587
- }
588
- },
589
- 400: {
590
- content: {
591
- "application/json": {
592
- example: {
593
- error: {
594
- code: "BadRequest",
595
- message: "No file IDs provided"
596
- }
597
- },
598
- schema: {
599
- $ref: "#/components/schemas/Error"
600
- }
601
- }
602
- },
603
- description: "Bad Request"
604
- },
605
- 404: {
606
- content: {
607
- "application/json": {
608
- example: {
609
- error: {
610
- code: "FileNotFound",
611
- message: "Failed to delete files: id1, id2"
612
- }
613
- },
614
- schema: {
615
- $ref: "#/components/schemas/Error"
616
- }
617
- }
618
- },
619
- description: "Not Found"
620
- },
621
- default: {
622
- content: {
623
- "application/json": {
624
- schema: {
625
- $ref: "#/components/schemas/Error"
626
- }
627
- }
628
- },
629
- description: "Error"
630
- }
631
- },
632
- summary: "Batch delete files",
633
- tags
634
- },
635
- get: sharedGetList(`${pathHash}RestGetList`, tags),
636
- post: {
637
- description: "Upload a file with raw binary data or initialize a chunked upload session. For chunked uploads, set X-Chunked-Upload: true and X-Total-Size headers.",
638
- operationId: `${pathHash}RestPostFile`,
639
- parameters: [
640
- {
641
- description: "Set to 'true' to initialize a chunked upload session",
642
- in: "header",
643
- name: "X-Chunked-Upload",
644
- required: false,
645
- schema: {
646
- $ref: "#/components/schemas/X-Chunked-Upload"
647
- }
648
- },
649
- {
650
- description: "Total size of the file in bytes (required for chunked uploads)",
651
- in: "header",
652
- name: "X-Total-Size",
653
- required: false,
654
- schema: {
655
- $ref: "#/components/schemas/X-Total-Size"
656
- }
657
- },
658
- {
659
- description: "Optional filename",
660
- in: "header",
661
- name: "Content-Disposition",
662
- required: false,
663
- schema: {
664
- example: 'attachment; filename="photo.jpg"',
665
- type: "string"
666
- }
667
- },
668
- {
669
- description: "Optional JSON metadata",
670
- in: "header",
671
- name: "X-File-Metadata",
672
- required: false,
673
- schema: {
674
- example: '{"description":"My photo"}',
675
- type: "string"
676
- }
677
- }
678
- ],
679
- requestBody: {
680
- content: {
681
- "application/octet-stream": {
682
- description: "File data as raw binary. For chunked upload initialization, body can be empty.",
683
- schema: {
684
- format: "binary",
685
- type: "string"
686
- }
687
- }
688
- },
689
- description: "File data (optional for chunked upload initialization)",
690
- required: false
691
- },
692
- responses: {
693
- 200: {
694
- description: "The file already exists, send a resume request",
695
- headers: {
696
- ETag: {
697
- description: "Upload ETag",
698
- schema: {
699
- example: "d41d8cd98f00b204e9800998ecf8427e",
700
- type: "string"
701
- }
702
- },
703
- Location: {
704
- description: "File URL",
705
- schema: {
706
- example: `${origin}${path}/file-id`,
707
- format: "uri",
708
- type: "string"
709
- }
710
- },
711
- "X-Upload-Expires": {
712
- description: "Upload expiration date",
713
- schema: {
714
- example: "2021-08-25T11:12:26.635Z",
715
- format: "date-time",
716
- type: "string"
717
- }
718
- }
719
- }
720
- },
721
- 201: {
722
- description: "File uploaded successfully or chunked upload session initialized",
723
- headers: {
724
- ETag: {
725
- description: "Upload ETag",
726
- schema: {
727
- example: "d41d8cd98f00b204e9800998ecf8427e",
728
- type: "string"
729
- }
730
- },
731
- Location: {
732
- description: "File URL or chunked upload session URL",
733
- schema: {
734
- example: `${origin}${path}/file-id`,
735
- format: "uri",
736
- type: "string"
737
- }
738
- },
739
- "X-Upload-Expires": {
740
- description: "Upload expiration date",
741
- schema: {
742
- example: "2021-08-25T11:12:26.635Z",
743
- format: "date-time",
744
- type: "string"
745
- }
746
- }
747
- }
748
- },
749
- 400: {
750
- content: {
751
- "application/json": {
752
- example: {
753
- error: {
754
- code: "BadRequest",
755
- message: "Request body is required for non-chunked uploads"
756
- }
757
- },
758
- schema: {
759
- $ref: "#/components/schemas/Error"
760
- }
761
- }
762
- },
763
- description: "Bad Request"
764
- },
765
- 413: {
766
- content: {
767
- "application/json": {
768
- example: {
769
- error: {
770
- code: "RequestEntityTooLarge",
771
- message: "File size exceeds maximum allowed size"
772
- }
773
- },
774
- schema: {
775
- $ref: "#/components/schemas/Error"
776
- }
777
- }
778
- },
779
- description: "Request Entity Too Large"
780
- },
781
- default: {
782
- content: {
783
- "application/json": {
784
- schema: {
785
- $ref: "#/components/schemas/Error"
786
- }
787
- }
788
- },
789
- description: "Error"
790
- }
791
- },
792
- summary: "Upload file or initialize chunked upload",
793
- tags
794
- }
795
- }
796
- }
797
- };
798
- };
799
-
800
- export { swaggerSpec as default };