@epilot/file-client 0.1.4 → 1.0.2

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 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":"File Upload and Management for epilot SaaS"},"tags":[{"name":"files","description":"Files"}],"security":[{"EpilotAuth":[]},{"AsOrganization":[]}],"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":{"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":{"$ref":"#/components/schemas/UploadFilePayload","type":"object"}}}},"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":"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}}],"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"},"AsOrganization":{"type":"apiKey","in":"header","name":"x-ivy-org-id","description":"Set organization id when using internal auth"}},"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"}}}}}},"UploadFilePayload":{"type":"object","properties":{"filename":{"type":"string","example":"document.pdf"},"content_type":{"description":"MIME type of file","type":"string","example":"image/png","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"},"filename":{"type":"string","example":"document.pdf"},"access_control":{"type":"string","default":"private","enum":["private","public"]}},"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}}}]}}}}')}},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)})());
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":"File Upload and Management for epilot SaaS"},"tags":[{"name":"files","description":"Files"}],"security":[{"EpilotAuth":[]},{"AsOrganization":[]}],"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":{"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"],"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":{"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":"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}}],"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/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":"Epilot Bearer Token"},"AsOrganization":{"type":"apiKey","in":"header","name":"x-ivy-org-id","description":"Set organization id when using internal auth"}},"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"}}}}}},"UploadFilePayload":{"type":"object","properties":{"filename":{"type":"string","example":"document.pdf"},"mime_type":{"description":"MIME type of file","type":"string","example":"image/png","default":"application/octet-stream"}},"required":["name"]},"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"},"filename":{"type":"string","example":"document.pdf"},"size_bytes":{"type":"number","example":42012},"mime_type":{"type":"string","example":"image/jpeg"},"access_control":{"type":"string","default":"private","enum":["private","public"]}},"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
@@ -9,6 +9,9 @@ import {
9
9
 
10
10
  declare namespace Components {
11
11
  namespace Schemas {
12
+ export interface DeleteFilePayload {
13
+ s3ref: S3Reference;
14
+ }
12
15
  export interface FileEntity {
13
16
  _id?: FileEntityId;
14
17
  /**
@@ -47,6 +50,11 @@ declare namespace Components {
47
50
  * 1234
48
51
  */
49
52
  size_bytes?: number;
53
+ /**
54
+ * example:
55
+ * image/jpeg
56
+ */
57
+ mime_type?: string;
50
58
  }
51
59
  export interface S3Reference {
52
60
  /**
@@ -71,6 +79,16 @@ declare namespace Components {
71
79
  * document.pdf
72
80
  */
73
81
  filename?: string;
82
+ /**
83
+ * example:
84
+ * 42012
85
+ */
86
+ size_bytes?: number;
87
+ /**
88
+ * example:
89
+ * image/jpeg
90
+ */
91
+ mime_type?: string;
74
92
  access_control?: "private" | "public";
75
93
  }
76
94
  export interface UploadFilePayload {
@@ -78,17 +96,20 @@ declare namespace Components {
78
96
  * example:
79
97
  * document.pdf
80
98
  */
81
- filename: string;
99
+ filename?: string;
82
100
  /**
83
101
  * MIME type of file
84
102
  * example:
85
103
  * image/png
86
104
  */
87
- content_type?: string;
105
+ mime_type?: string;
88
106
  }
89
107
  }
90
108
  }
91
109
  declare namespace Paths {
110
+ namespace DeleteFile {
111
+ export type RequestBody = Components.Schemas.DeleteFilePayload;
112
+ }
92
113
  namespace DownloadFile {
93
114
  namespace Parameters {
94
115
  export type Id = Components.Schemas.FileEntityId;
@@ -133,6 +154,12 @@ declare namespace Paths {
133
154
  }
134
155
  }
135
156
  namespace UploadFile {
157
+ namespace Parameters {
158
+ export type FileEntityId = Components.Schemas.FileEntityId;
159
+ }
160
+ export interface QueryParameters {
161
+ file_entity_id?: Parameters.FileEntityId;
162
+ }
136
163
  export type RequestBody = Components.Schemas.UploadFilePayload;
137
164
  namespace Responses {
138
165
  export interface $201 {
@@ -219,7 +246,7 @@ export interface OperationMethods {
219
246
  *
220
247
  */
221
248
  'uploadFile'(
222
- parameters?: Parameters<UnknownParamsObject> | null,
249
+ parameters?: Parameters<Paths.UploadFile.QueryParameters> | null,
223
250
  data?: Paths.UploadFile.RequestBody,
224
251
  config?: AxiosRequestConfig
225
252
  ): OperationResponse<Paths.UploadFile.Responses.$201>
@@ -258,6 +285,16 @@ export interface OperationMethods {
258
285
  data?: any,
259
286
  config?: AxiosRequestConfig
260
287
  ): OperationResponse<any>
288
+ /**
289
+ * deleteFile - deleteFile
290
+ *
291
+ * Delete file entity
292
+ */
293
+ 'deleteFile'(
294
+ parameters?: Parameters<UnknownParamsObject> | null,
295
+ data?: Paths.DeleteFile.RequestBody,
296
+ config?: AxiosRequestConfig
297
+ ): OperationResponse<any>
261
298
  }
262
299
 
263
300
  export interface PathsDictionary {
@@ -286,7 +323,7 @@ export interface PathsDictionary {
286
323
  *
287
324
  */
288
325
  'post'(
289
- parameters?: Parameters<UnknownParamsObject> | null,
326
+ parameters?: Parameters<Paths.UploadFile.QueryParameters> | null,
290
327
  data?: Paths.UploadFile.RequestBody,
291
328
  config?: AxiosRequestConfig
292
329
  ): OperationResponse<Paths.UploadFile.Responses.$201>
@@ -332,6 +369,18 @@ export interface PathsDictionary {
332
369
  config?: AxiosRequestConfig
333
370
  ): OperationResponse<any>
334
371
  }
372
+ ['/v1/files/delete']: {
373
+ /**
374
+ * deleteFile - deleteFile
375
+ *
376
+ * Delete file entity
377
+ */
378
+ 'delete'(
379
+ parameters?: Parameters<UnknownParamsObject> | null,
380
+ data?: Paths.DeleteFile.RequestBody,
381
+ config?: AxiosRequestConfig
382
+ ): OperationResponse<any>
383
+ }
335
384
  }
336
385
 
337
386
  export type Client = OpenAPIClient<OperationMethods, PathsDictionary>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epilot/file-client",
3
- "version": "0.1.4",
3
+ "version": "1.0.2",
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
@@ -9,6 +9,9 @@ import {
9
9
 
10
10
  declare namespace Components {
11
11
  namespace Schemas {
12
+ export interface DeleteFilePayload {
13
+ s3ref: S3Reference;
14
+ }
12
15
  export interface FileEntity {
13
16
  _id?: FileEntityId;
14
17
  /**
@@ -47,6 +50,11 @@ declare namespace Components {
47
50
  * 1234
48
51
  */
49
52
  size_bytes?: number;
53
+ /**
54
+ * example:
55
+ * image/jpeg
56
+ */
57
+ mime_type?: string;
50
58
  }
51
59
  export interface S3Reference {
52
60
  /**
@@ -71,6 +79,16 @@ declare namespace Components {
71
79
  * document.pdf
72
80
  */
73
81
  filename?: string;
82
+ /**
83
+ * example:
84
+ * 42012
85
+ */
86
+ size_bytes?: number;
87
+ /**
88
+ * example:
89
+ * image/jpeg
90
+ */
91
+ mime_type?: string;
74
92
  access_control?: "private" | "public";
75
93
  }
76
94
  export interface UploadFilePayload {
@@ -78,17 +96,20 @@ declare namespace Components {
78
96
  * example:
79
97
  * document.pdf
80
98
  */
81
- filename: string;
99
+ filename?: string;
82
100
  /**
83
101
  * MIME type of file
84
102
  * example:
85
103
  * image/png
86
104
  */
87
- content_type?: string;
105
+ mime_type?: string;
88
106
  }
89
107
  }
90
108
  }
91
109
  declare namespace Paths {
110
+ namespace DeleteFile {
111
+ export type RequestBody = Components.Schemas.DeleteFilePayload;
112
+ }
92
113
  namespace DownloadFile {
93
114
  namespace Parameters {
94
115
  export type Id = Components.Schemas.FileEntityId;
@@ -133,6 +154,12 @@ declare namespace Paths {
133
154
  }
134
155
  }
135
156
  namespace UploadFile {
157
+ namespace Parameters {
158
+ export type FileEntityId = Components.Schemas.FileEntityId;
159
+ }
160
+ export interface QueryParameters {
161
+ file_entity_id?: Parameters.FileEntityId;
162
+ }
136
163
  export type RequestBody = Components.Schemas.UploadFilePayload;
137
164
  namespace Responses {
138
165
  export interface $201 {
@@ -219,7 +246,7 @@ export interface OperationMethods {
219
246
  *
220
247
  */
221
248
  'uploadFile'(
222
- parameters?: Parameters<UnknownParamsObject> | null,
249
+ parameters?: Parameters<Paths.UploadFile.QueryParameters> | null,
223
250
  data?: Paths.UploadFile.RequestBody,
224
251
  config?: AxiosRequestConfig
225
252
  ): OperationResponse<Paths.UploadFile.Responses.$201>
@@ -258,6 +285,16 @@ export interface OperationMethods {
258
285
  data?: any,
259
286
  config?: AxiosRequestConfig
260
287
  ): OperationResponse<any>
288
+ /**
289
+ * deleteFile - deleteFile
290
+ *
291
+ * Delete file entity
292
+ */
293
+ 'deleteFile'(
294
+ parameters?: Parameters<UnknownParamsObject> | null,
295
+ data?: Paths.DeleteFile.RequestBody,
296
+ config?: AxiosRequestConfig
297
+ ): OperationResponse<any>
261
298
  }
262
299
 
263
300
  export interface PathsDictionary {
@@ -286,7 +323,7 @@ export interface PathsDictionary {
286
323
  *
287
324
  */
288
325
  'post'(
289
- parameters?: Parameters<UnknownParamsObject> | null,
326
+ parameters?: Parameters<Paths.UploadFile.QueryParameters> | null,
290
327
  data?: Paths.UploadFile.RequestBody,
291
328
  config?: AxiosRequestConfig
292
329
  ): OperationResponse<Paths.UploadFile.Responses.$201>
@@ -332,6 +369,18 @@ export interface PathsDictionary {
332
369
  config?: AxiosRequestConfig
333
370
  ): OperationResponse<any>
334
371
  }
372
+ ['/v1/files/delete']: {
373
+ /**
374
+ * deleteFile - deleteFile
375
+ *
376
+ * Delete file entity
377
+ */
378
+ 'delete'(
379
+ parameters?: Parameters<UnknownParamsObject> | null,
380
+ data?: Paths.DeleteFile.RequestBody,
381
+ config?: AxiosRequestConfig
382
+ ): OperationResponse<any>
383
+ }
335
384
  }
336
385
 
337
386
  export type Client = OpenAPIClient<OperationMethods, PathsDictionary>