@epilot/file-client 0.1.0 → 0.1.1

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.
@@ -1 +1 @@
1
- !function(e,t){for(var i in t)e[i]=t[i];t.__esModule&&Object.defineProperty(e,"__esModule",{value:!0})}(exports,(()=>{"use strict";var e={914:function(e,t,i){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var n=r(i(279));t.default=n.default},279:e=>{e.exports=JSON.parse('{"openapi":"3.0.3","info":{"title":"File API","version":"0.1.0","description":"File Upload and Management for epilot SaaS"},"tags":[{"name":"files","description":"Files"}],"security":[{"EpilotAuth":[]}],"paths":{"/v1/files:upload":{"post":{"operationId":"uploadFile","summary":"uploadFile","description":"Create pre-signed S3 URL to upload a file to keep temporarily (one week).\\n\\nUse the createFile operation to store file file permanently.\\n","tags":["files"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"filename":{"type":"string","example":"document.pdf"}},"required":["filename"]}}}},"responses":{"201":{"description":"Pre-signed URL for POST / PUT upload","content":{"application/json":{"schema":{"type":"object","properties":{"upload_url":{"type":"string","format":"url","example":"https://epilot-files-prod.s3.eu-central-1.amazonaws.com/123/temp/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf?AWSParams=123"},"s3ref":{"allOf":[{"$ref":"#/components/schemas/S3Reference"},{"example":{"bucket":"epilot-files-prod","key":"123/temp/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf"}}]}}}}}}}}},"/v1/files":{"post":{"operationId":"createFile","summary":"createFile","description":"Create a permanent File entity","tags":["files"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileEntityPayload"}}}},"responses":{"201":{"description":"Created File Entity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileEntity"}}}}}}},"/v1/files/{id}:download":{"get":{"operationId":"downloadFile","summary":"downloadFile","description":"Generate pre-signed download S3 url for a file","tags":["files"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/FileEntityId"}},{"name":"version","in":"query","description":"index of file version","schema":{"type":"integer","default":0}}],"responses":{"200":{"description":"Generated thumbnail image","content":{"application/json":{"schema":{"type":"object","properties":{"download_url":{"type":"string","format":"uri","example":"https://epilot-files-prod.s3.eu-central-1.amazonaws.com/123/temp/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf?AWSParams=123"}}}}}}}}},"/v1/files/{id}:preview":{"get":{"operationId":"previewFile","summary":"previewFile","description":"Generate thumbnail preview for a file entity","tags":["files"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/FileEntityId"}},{"name":"version","in":"query","description":"index of file version","schema":{"type":"integer","default":0}},{"name":"w","in":"query","description":"width","schema":{"type":"integer"}},{"name":"h","in":"query","description":"height","schema":{"type":"integer"}}],"responses":{"200":{"description":"Generated thumbnail image","content":{"image/png":{},"image/jpeg":{}}}}}}},"components":{"securitySchemes":{"EpilotAuth":{"type":"http","scheme":"bearer","description":"Epilot Bearer Token"}},"schemas":{"FileEntityId":{"type":"string","example":"ef7d985c-2385-44f4-9c71-ae06a52264f8"},"FileEntity":{"type":"object","properties":{"_id":{"$ref":"#/components/schemas/FileEntityId"},"filename":{"type":"string","example":"document.pdf"},"access_control":{"type":"string","default":"private","enum":["private","public"]},"versions":{"type":"array","items":{"type":"object","properties":{"s3ref":{"$ref":"#/components/schemas/S3Reference"}}}}}},"FileEntityPayload":{"type":"object","properties":{"filename":{"type":"string","example":"document.pdf"},"access_control":{"type":"string","default":"private","enum":["private","public"]},"versions":{"type":"array","items":{"$ref":"#/components/schemas/FileItem"}}}},"S3Reference":{"type":"object","properties":{"bucket":{"type":"string","example":"epilot-files-prod"},"key":{"type":"string","example":"123/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf"}},"required":["bucket","key"]},"FileItem":{"allOf":[{"$ref":"#/components/schemas/S3Reference"},{"type":"object","properties":{"filename":{"type":"string","example":"document.pdf"},"size_bytes":{"type":"integer","example":1234}}}]}}}}')}},t={};return function i(r){if(t[r])return t[r].exports;var n=t[r]={exports:{}};return e[r].call(n.exports,n,n.exports,i),n.exports}(914)})());
1
+ !function(e,t){for(var i in t)e[i]=t[i];t.__esModule&&Object.defineProperty(e,"__esModule",{value:!0})}(exports,(()=>{"use strict";var e={914:function(e,t,i){var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var r=a(i(279));t.default=r.default},279:e=>{e.exports=JSON.parse('{"openapi":"3.0.3","info":{"title":"File API","version":"0.1.0","description":"File Upload and Management for epilot SaaS"},"tags":[{"name":"files","description":"Files"}],"security":[{"EpilotAuth":[]}],"paths":{"/v1/files/public/upload":{"post":{"operationId":"uploadFilePublic","summary":"uploadFilePublic","security":[],"description":"Create pre-signed S3 URL to upload a file to keep temporarily (one week).\\n\\nUse the createFile operation to store file file permanently.\\n","tags":["files"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"filename":{"type":"string","example":"document.pdf"}},"required":["filename"]}}}},"responses":{"201":{"description":"Pre-signed URL for POST / PUT upload","content":{"application/json":{"schema":{"type":"object","properties":{"upload_url":{"type":"string","format":"url","example":"https://epilot-files-prod.s3.eu-central-1.amazonaws.com/123/temp/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf?AWSParams=123"},"s3ref":{"allOf":[{"$ref":"#/components/schemas/S3Reference"},{"example":{"bucket":"epilot-files-prod","key":"123/temp/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf"}}]}}}}}}}}},"/v1/files/upload":{"post":{"operationId":"uploadFile","summary":"uploadFile","description":"Create pre-signed S3 URL to upload a file to keep temporarily (one week).\\n\\nUse the createFile operation to store file file permanently.\\n","tags":["files"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"filename":{"type":"string","example":"document.pdf"}},"required":["filename"]}}}},"responses":{"201":{"description":"Pre-signed URL for POST / PUT upload","content":{"application/json":{"schema":{"type":"object","properties":{"upload_url":{"type":"string","format":"url","example":"https://epilot-files-prod.s3.eu-central-1.amazonaws.com/123/temp/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf?AWSParams=123"},"s3ref":{"allOf":[{"$ref":"#/components/schemas/S3Reference"},{"example":{"bucket":"epilot-files-prod","key":"123/temp/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf"}}]}}}}}}}}},"/v1/files":{"post":{"operationId":"createFile","summary":"createFile","description":"Create a permanent File entity","tags":["files"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileEntityPayload"}}}},"responses":{"201":{"description":"Created File Entity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileEntity"}}}}}}},"/v1/files/{id}/download":{"get":{"operationId":"downloadFile","summary":"downloadFile","description":"Generate pre-signed download S3 url for a file","tags":["files"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/FileEntityId"}},{"name":"version","in":"query","description":"index of file version","schema":{"type":"integer","default":0}}],"responses":{"200":{"description":"Generated thumbnail image","content":{"application/json":{"schema":{"type":"object","properties":{"download_url":{"type":"string","format":"uri","example":"https://epilot-files-prod.s3.eu-central-1.amazonaws.com/123/temp/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf?AWSParams=123"}}}}}}}}},"/v1/files/{id}/preview":{"get":{"operationId":"previewFile","summary":"previewFile","description":"Generate thumbnail preview for a file entity","tags":["files"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/FileEntityId"}},{"name":"version","in":"query","description":"index of file version","schema":{"type":"integer","default":0}},{"name":"w","in":"query","description":"width","schema":{"type":"integer"}},{"name":"h","in":"query","description":"height","schema":{"type":"integer"}}],"responses":{"200":{"description":"Generated thumbnail image","content":{"image/png":{},"image/jpeg":{}}}}}}},"components":{"securitySchemes":{"EpilotAuth":{"type":"http","scheme":"bearer","description":"Epilot Bearer Token"}},"schemas":{"FileEntityId":{"type":"string","example":"ef7d985c-2385-44f4-9c71-ae06a52264f8"},"FileEntity":{"type":"object","properties":{"_id":{"$ref":"#/components/schemas/FileEntityId"},"filename":{"type":"string","example":"document.pdf"},"access_control":{"type":"string","default":"private","enum":["private","public"]},"versions":{"type":"array","items":{"type":"object","properties":{"s3ref":{"$ref":"#/components/schemas/S3Reference"}}}}}},"FileEntityPayload":{"type":"object","properties":{"filename":{"type":"string","example":"document.pdf"},"access_control":{"type":"string","default":"private","enum":["private","public"]},"versions":{"type":"array","items":{"$ref":"#/components/schemas/FileItem"}}}},"S3Reference":{"type":"object","properties":{"bucket":{"type":"string","example":"epilot-files-prod"},"key":{"type":"string","example":"123/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf"}},"required":["bucket","key"]},"FileItem":{"allOf":[{"$ref":"#/components/schemas/S3Reference"},{"type":"object","properties":{"filename":{"type":"string","example":"document.pdf"},"size_bytes":{"type":"integer","example":1234}}}]}}}}')}},t={};return function i(a){if(t[a])return t[a].exports;var r=t[a]={exports:{}};return e[a].call(r.exports,r,r.exports,i),r.exports}(914)})());
package/dist/openapi.d.ts CHANGED
@@ -152,9 +152,59 @@ declare namespace Paths {
152
152
  }
153
153
  }
154
154
  }
155
+ namespace UploadFilePublic {
156
+ export interface RequestBody {
157
+ /**
158
+ * example:
159
+ * document.pdf
160
+ */
161
+ filename: string;
162
+ }
163
+ namespace Responses {
164
+ export interface $201 {
165
+ /**
166
+ * example:
167
+ * https://epilot-files-prod.s3.eu-central-1.amazonaws.com/123/temp/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf?AWSParams=123
168
+ */
169
+ upload_url?: string; // url
170
+ /**
171
+ * example:
172
+ * {
173
+ * "bucket": "epilot-files-prod",
174
+ * "key": "123/temp/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf"
175
+ * }
176
+ */
177
+ s3ref?: {
178
+ /**
179
+ * example:
180
+ * epilot-files-prod
181
+ */
182
+ bucket: string;
183
+ /**
184
+ * example:
185
+ * 123/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf
186
+ */
187
+ key: string;
188
+ };
189
+ }
190
+ }
191
+ }
155
192
  }
156
193
 
157
194
  export interface OperationMethods {
195
+ /**
196
+ * uploadFilePublic - uploadFilePublic
197
+ *
198
+ * Create pre-signed S3 URL to upload a file to keep temporarily (one week).
199
+ *
200
+ * Use the createFile operation to store file file permanently.
201
+ *
202
+ */
203
+ 'uploadFilePublic'(
204
+ parameters?: Parameters<UnknownParamsObject> | null,
205
+ data?: Paths.UploadFilePublic.RequestBody,
206
+ config?: AxiosRequestConfig
207
+ ): OperationResponse<Paths.UploadFilePublic.Responses.$201>
158
208
  /**
159
209
  * uploadFile - uploadFile
160
210
  *
@@ -201,7 +251,22 @@ export interface OperationMethods {
201
251
  }
202
252
 
203
253
  export interface PathsDictionary {
204
- ['/v1/files:upload']: {
254
+ ['/v1/files/public/upload']: {
255
+ /**
256
+ * uploadFilePublic - uploadFilePublic
257
+ *
258
+ * Create pre-signed S3 URL to upload a file to keep temporarily (one week).
259
+ *
260
+ * Use the createFile operation to store file file permanently.
261
+ *
262
+ */
263
+ 'post'(
264
+ parameters?: Parameters<UnknownParamsObject> | null,
265
+ data?: Paths.UploadFilePublic.RequestBody,
266
+ config?: AxiosRequestConfig
267
+ ): OperationResponse<Paths.UploadFilePublic.Responses.$201>
268
+ }
269
+ ['/v1/files/upload']: {
205
270
  /**
206
271
  * uploadFile - uploadFile
207
272
  *
@@ -228,7 +293,7 @@ export interface PathsDictionary {
228
293
  config?: AxiosRequestConfig
229
294
  ): OperationResponse<Paths.CreateFile.Responses.$201>
230
295
  }
231
- ['/v1/files/{id}:download']: {
296
+ ['/v1/files/{id}/download']: {
232
297
  /**
233
298
  * downloadFile - downloadFile
234
299
  *
@@ -240,7 +305,7 @@ export interface PathsDictionary {
240
305
  config?: AxiosRequestConfig
241
306
  ): OperationResponse<Paths.DownloadFile.Responses.$200>
242
307
  }
243
- ['/v1/files/{id}:preview']: {
308
+ ['/v1/files/{id}/preview']: {
244
309
  /**
245
310
  * previewFile - previewFile
246
311
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epilot/file-client",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "API client for epilot File API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/openapi.d.ts CHANGED
@@ -152,9 +152,59 @@ declare namespace Paths {
152
152
  }
153
153
  }
154
154
  }
155
+ namespace UploadFilePublic {
156
+ export interface RequestBody {
157
+ /**
158
+ * example:
159
+ * document.pdf
160
+ */
161
+ filename: string;
162
+ }
163
+ namespace Responses {
164
+ export interface $201 {
165
+ /**
166
+ * example:
167
+ * https://epilot-files-prod.s3.eu-central-1.amazonaws.com/123/temp/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf?AWSParams=123
168
+ */
169
+ upload_url?: string; // url
170
+ /**
171
+ * example:
172
+ * {
173
+ * "bucket": "epilot-files-prod",
174
+ * "key": "123/temp/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf"
175
+ * }
176
+ */
177
+ s3ref?: {
178
+ /**
179
+ * example:
180
+ * epilot-files-prod
181
+ */
182
+ bucket: string;
183
+ /**
184
+ * example:
185
+ * 123/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf
186
+ */
187
+ key: string;
188
+ };
189
+ }
190
+ }
191
+ }
155
192
  }
156
193
 
157
194
  export interface OperationMethods {
195
+ /**
196
+ * uploadFilePublic - uploadFilePublic
197
+ *
198
+ * Create pre-signed S3 URL to upload a file to keep temporarily (one week).
199
+ *
200
+ * Use the createFile operation to store file file permanently.
201
+ *
202
+ */
203
+ 'uploadFilePublic'(
204
+ parameters?: Parameters<UnknownParamsObject> | null,
205
+ data?: Paths.UploadFilePublic.RequestBody,
206
+ config?: AxiosRequestConfig
207
+ ): OperationResponse<Paths.UploadFilePublic.Responses.$201>
158
208
  /**
159
209
  * uploadFile - uploadFile
160
210
  *
@@ -201,7 +251,22 @@ export interface OperationMethods {
201
251
  }
202
252
 
203
253
  export interface PathsDictionary {
204
- ['/v1/files:upload']: {
254
+ ['/v1/files/public/upload']: {
255
+ /**
256
+ * uploadFilePublic - uploadFilePublic
257
+ *
258
+ * Create pre-signed S3 URL to upload a file to keep temporarily (one week).
259
+ *
260
+ * Use the createFile operation to store file file permanently.
261
+ *
262
+ */
263
+ 'post'(
264
+ parameters?: Parameters<UnknownParamsObject> | null,
265
+ data?: Paths.UploadFilePublic.RequestBody,
266
+ config?: AxiosRequestConfig
267
+ ): OperationResponse<Paths.UploadFilePublic.Responses.$201>
268
+ }
269
+ ['/v1/files/upload']: {
205
270
  /**
206
271
  * uploadFile - uploadFile
207
272
  *
@@ -228,7 +293,7 @@ export interface PathsDictionary {
228
293
  config?: AxiosRequestConfig
229
294
  ): OperationResponse<Paths.CreateFile.Responses.$201>
230
295
  }
231
- ['/v1/files/{id}:download']: {
296
+ ['/v1/files/{id}/download']: {
232
297
  /**
233
298
  * downloadFile - downloadFile
234
299
  *
@@ -240,7 +305,7 @@ export interface PathsDictionary {
240
305
  config?: AxiosRequestConfig
241
306
  ): OperationResponse<Paths.DownloadFile.Responses.$200>
242
307
  }
243
- ['/v1/files/{id}:preview']: {
308
+ ['/v1/files/{id}/preview']: {
244
309
  /**
245
310
  * previewFile - previewFile
246
311
  *