@epilot/file-client 1.1.7 → 1.3.0
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/dist/definition.js +1 -1
- package/dist/openapi.d.ts +43 -0
- package/package.json +2 -2
- package/src/openapi.d.ts +43 -0
package/dist/definition.js
CHANGED
|
@@ -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 a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var n=a(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":"
|
|
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 n=a(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":"Upload and manage all files stored in epilot"},"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":{"$ref":"#/components/schemas/UploadFilePayload"}}}},"responses":{"201":{"description":"Pre-signed URL for POST / PUT upload","content":{"application/json":{"schema":{"type":"object","properties":{"s3ref":{"allOf":[{"$ref":"#/components/schemas/S3Reference"},{"example":{"bucket":"epilot-files-prod","key":"123/temp/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf"}}]},"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"}}}}}}}}},"/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"],"parameters":[{"name":"file_entity_id","in":"query","description":"file entity id","schema":{"$ref":"#/components/schemas/FileEntityId"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UploadFilePayload","type":"object"}}}},"responses":{"201":{"description":"Pre-signed URL for POST / PUT upload","content":{"application/json":{"schema":{"type":"object","properties":{"s3ref":{"allOf":[{"$ref":"#/components/schemas/S3Reference"},{"example":{"bucket":"epilot-files-prod","key":"123/temp/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf"}}]},"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"},"public_url":{"description":"Returned only if file is permanent i.e. file_entity_id is passed","type":"string","format":"url","example":"https://epilot-files-prod.s3.eu-central-1.amazonaws.com/123/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf"}}}}}}}}},"/v1/files":{"post":{"operationId":"saveFile","summary":"saveFile","description":"Create / Update a permanent File entity\\n\\nMakes file object permanent\\n\\nSaves metadata to file entity\\n","tags":["files"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaveFilePayload"}}}},"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}},{"name":"attachment","in":"query","description":"Controls the Content-Disposition header to control browser behaviour. Set to true to trigger download.","schema":{"type":"boolean","default":true}}],"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:downloadS3":{"post":{"operationId":"downloadS3File","summary":"downloadS3File","description":"Generate pre-signed download S3 url for a file","tags":["files"],"parameters":[{"name":"s3_key","in":"query","required":true,"schema":{"type":"string"}},{"name":"s3_bucket","in":"query","required":true,"schema":{"type":"string"}},{"name":"attachment","in":"query","description":"Controls the Content-Disposition header to control browser behaviour. Set to true to trigger download.","schema":{"type":"boolean","default":true}}],"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":{}}}}}},"/v1/files:previewS3":{"post":{"operationId":"previewS3File","summary":"previewS3File","description":"Generate thumbnail preview from an s3 reference for a file entity","tags":["files"],"parameters":[{"name":"w","in":"query","description":"width","schema":{"type":"integer"}},{"name":"h","in":"query","description":"height","schema":{"type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/S3Reference"}}}},"responses":{"200":{"description":"Generated thumbnail image","content":{"image/png":{},"image/jpeg":{}}}}}},"/v1/files/delete":{"delete":{"operationId":"deleteFile","summary":"deleteFile","description":"Delete file entity","tags":["files"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteFilePayload"}}}},"responses":{"200":{"description":"File delete response"}}}}},"components":{"securitySchemes":{"EpilotAuth":{"type":"http","scheme":"bearer","description":"Authorization header with epilot OAuth2 bearer token","bearerFormat":"JWT"}},"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-read"]},"public_url":{"description":"Direct URL for file (public only if file access control is public-read)","type":"string","format":"url","example":"https://epilot-files-prod.s3.eu-central-1.amazonaws.com/123/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf"},"type":{"description":"Human readable type for file","type":"string","enum":["document","document_template","text","image","video","audio","spreadsheet","presentation","font","archive","application","unknown"]},"mime_type":{"type":"string","description":"MIME type of the file","example":"application/pdf"},"size_bytes":{"type":"integer","minimum":0,"description":"File size in bytes"},"versions":{"type":"array","items":{"type":"object","properties":{"s3ref":{"$ref":"#/components/schemas/S3Reference"}}}}}},"UploadFilePayload":{"type":"object","properties":{"filename":{"type":"string","example":"document.pdf"},"mime_type":{"description":"MIME type of file","type":"string","example":"application/pdf","default":"application/octet-stream"}},"required":["filename"]},"SaveFilePayload":{"type":"object","properties":{"s3ref":{"$ref":"#/components/schemas/S3Reference"},"file_entity_id":{"type":"string","description":"if passed, adds a new version to existing file entity"},"document_type":{"type":"string","enum":["document","document_template","text","image","video","audio","spreadsheet","presentation","font","archive","application","unknown"]},"filename":{"type":"string","example":"document.pdf"},"_tags":{"type":"array","items":{"type":"string"}},"access_control":{"type":"string","default":"private","enum":["private","public-read"]}},"required":["s3ref"]},"DeleteFilePayload":{"type":"object","properties":{"s3ref":{"$ref":"#/components/schemas/S3Reference"}},"required":["s3ref"]},"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},"mime_type":{"type":"string","example":"image/jpeg"}}}]}}}}')}},t={};return function i(a){if(t[a])return t[a].exports;var n=t[a]={exports:{}};return e[a].call(n.exports,n,n.exports,i),n.exports}(914)})());
|
package/dist/openapi.d.ts
CHANGED
|
@@ -145,6 +145,27 @@ declare namespace Paths {
|
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
|
+
namespace DownloadS3File {
|
|
149
|
+
namespace Parameters {
|
|
150
|
+
export type Attachment = boolean;
|
|
151
|
+
export type S3Bucket = string;
|
|
152
|
+
export type S3Key = string;
|
|
153
|
+
}
|
|
154
|
+
export interface QueryParameters {
|
|
155
|
+
s3_key: Parameters.S3Key;
|
|
156
|
+
s3_bucket: Parameters.S3Bucket;
|
|
157
|
+
attachment?: Parameters.Attachment;
|
|
158
|
+
}
|
|
159
|
+
namespace Responses {
|
|
160
|
+
export interface $200 {
|
|
161
|
+
/**
|
|
162
|
+
* example:
|
|
163
|
+
* https://epilot-files-prod.s3.eu-central-1.amazonaws.com/123/temp/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf?AWSParams=123
|
|
164
|
+
*/
|
|
165
|
+
download_url?: string; // uri
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
148
169
|
namespace PreviewFile {
|
|
149
170
|
namespace Parameters {
|
|
150
171
|
export type H = number;
|
|
@@ -306,6 +327,16 @@ export interface OperationMethods {
|
|
|
306
327
|
data?: any,
|
|
307
328
|
config?: AxiosRequestConfig
|
|
308
329
|
): OperationResponse<Paths.DownloadFile.Responses.$200>
|
|
330
|
+
/**
|
|
331
|
+
* downloadS3File - downloadS3File
|
|
332
|
+
*
|
|
333
|
+
* Generate pre-signed download S3 url for a file
|
|
334
|
+
*/
|
|
335
|
+
'downloadS3File'(
|
|
336
|
+
parameters?: Parameters<Paths.DownloadS3File.QueryParameters> | null,
|
|
337
|
+
data?: any,
|
|
338
|
+
config?: AxiosRequestConfig
|
|
339
|
+
): OperationResponse<Paths.DownloadS3File.Responses.$200>
|
|
309
340
|
/**
|
|
310
341
|
* previewFile - previewFile
|
|
311
342
|
*
|
|
@@ -398,6 +429,18 @@ export interface PathsDictionary {
|
|
|
398
429
|
config?: AxiosRequestConfig
|
|
399
430
|
): OperationResponse<Paths.DownloadFile.Responses.$200>
|
|
400
431
|
}
|
|
432
|
+
['/v1/files:downloadS3']: {
|
|
433
|
+
/**
|
|
434
|
+
* downloadS3File - downloadS3File
|
|
435
|
+
*
|
|
436
|
+
* Generate pre-signed download S3 url for a file
|
|
437
|
+
*/
|
|
438
|
+
'post'(
|
|
439
|
+
parameters?: Parameters<Paths.DownloadS3File.QueryParameters> | null,
|
|
440
|
+
data?: any,
|
|
441
|
+
config?: AxiosRequestConfig
|
|
442
|
+
): OperationResponse<Paths.DownloadS3File.Responses.$200>
|
|
443
|
+
}
|
|
401
444
|
['/v1/files/{id}/preview']: {
|
|
402
445
|
/**
|
|
403
446
|
* previewFile - previewFile
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epilot/file-client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "API client for epilot File API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"author": "epilot GmbH",
|
|
36
36
|
"license": "UNLICENSED",
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"axios": "^0.
|
|
38
|
+
"axios": "^0.25.0"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"buffer": "^6.0.3",
|
package/src/openapi.d.ts
CHANGED
|
@@ -145,6 +145,27 @@ declare namespace Paths {
|
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
|
+
namespace DownloadS3File {
|
|
149
|
+
namespace Parameters {
|
|
150
|
+
export type Attachment = boolean;
|
|
151
|
+
export type S3Bucket = string;
|
|
152
|
+
export type S3Key = string;
|
|
153
|
+
}
|
|
154
|
+
export interface QueryParameters {
|
|
155
|
+
s3_key: Parameters.S3Key;
|
|
156
|
+
s3_bucket: Parameters.S3Bucket;
|
|
157
|
+
attachment?: Parameters.Attachment;
|
|
158
|
+
}
|
|
159
|
+
namespace Responses {
|
|
160
|
+
export interface $200 {
|
|
161
|
+
/**
|
|
162
|
+
* example:
|
|
163
|
+
* https://epilot-files-prod.s3.eu-central-1.amazonaws.com/123/temp/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf?AWSParams=123
|
|
164
|
+
*/
|
|
165
|
+
download_url?: string; // uri
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
148
169
|
namespace PreviewFile {
|
|
149
170
|
namespace Parameters {
|
|
150
171
|
export type H = number;
|
|
@@ -306,6 +327,16 @@ export interface OperationMethods {
|
|
|
306
327
|
data?: any,
|
|
307
328
|
config?: AxiosRequestConfig
|
|
308
329
|
): OperationResponse<Paths.DownloadFile.Responses.$200>
|
|
330
|
+
/**
|
|
331
|
+
* downloadS3File - downloadS3File
|
|
332
|
+
*
|
|
333
|
+
* Generate pre-signed download S3 url for a file
|
|
334
|
+
*/
|
|
335
|
+
'downloadS3File'(
|
|
336
|
+
parameters?: Parameters<Paths.DownloadS3File.QueryParameters> | null,
|
|
337
|
+
data?: any,
|
|
338
|
+
config?: AxiosRequestConfig
|
|
339
|
+
): OperationResponse<Paths.DownloadS3File.Responses.$200>
|
|
309
340
|
/**
|
|
310
341
|
* previewFile - previewFile
|
|
311
342
|
*
|
|
@@ -398,6 +429,18 @@ export interface PathsDictionary {
|
|
|
398
429
|
config?: AxiosRequestConfig
|
|
399
430
|
): OperationResponse<Paths.DownloadFile.Responses.$200>
|
|
400
431
|
}
|
|
432
|
+
['/v1/files:downloadS3']: {
|
|
433
|
+
/**
|
|
434
|
+
* downloadS3File - downloadS3File
|
|
435
|
+
*
|
|
436
|
+
* Generate pre-signed download S3 url for a file
|
|
437
|
+
*/
|
|
438
|
+
'post'(
|
|
439
|
+
parameters?: Parameters<Paths.DownloadS3File.QueryParameters> | null,
|
|
440
|
+
data?: any,
|
|
441
|
+
config?: AxiosRequestConfig
|
|
442
|
+
): OperationResponse<Paths.DownloadS3File.Responses.$200>
|
|
443
|
+
}
|
|
401
444
|
['/v1/files/{id}/preview']: {
|
|
402
445
|
/**
|
|
403
446
|
* previewFile - previewFile
|