@epilot/file-client 0.1.3 → 0.1.4

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 o=a(i(279));t.default=o.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":"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"},"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"]},"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 o=t[a]={exports:{}};return e[a].call(o.exports,o,o.exports,i),o.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"],"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)})());
package/dist/openapi.d.ts CHANGED
@@ -26,15 +26,6 @@ declare namespace Components {
26
26
  * ef7d985c-2385-44f4-9c71-ae06a52264f8
27
27
  */
28
28
  export type FileEntityId = string;
29
- export interface FileEntityPayload {
30
- /**
31
- * example:
32
- * document.pdf
33
- */
34
- filename?: string;
35
- access_control?: "private" | "public";
36
- versions?: FileItem[];
37
- }
38
29
  export interface FileItem {
39
30
  /**
40
31
  * example:
@@ -69,6 +60,19 @@ declare namespace Components {
69
60
  */
70
61
  key: string;
71
62
  }
63
+ export interface SaveFilePayload {
64
+ s3ref: S3Reference;
65
+ /**
66
+ * if passed, adds a new version to existing file entity
67
+ */
68
+ file_entity_id?: string;
69
+ /**
70
+ * example:
71
+ * document.pdf
72
+ */
73
+ filename?: string;
74
+ access_control?: "private" | "public";
75
+ }
72
76
  export interface UploadFilePayload {
73
77
  /**
74
78
  * example:
@@ -85,12 +89,6 @@ declare namespace Components {
85
89
  }
86
90
  }
87
91
  declare namespace Paths {
88
- namespace CreateFile {
89
- export type RequestBody = Components.Schemas.FileEntityPayload;
90
- namespace Responses {
91
- export type $201 = Components.Schemas.FileEntity;
92
- }
93
- }
94
92
  namespace DownloadFile {
95
93
  namespace Parameters {
96
94
  export type Id = Components.Schemas.FileEntityId;
@@ -128,6 +126,12 @@ declare namespace Paths {
128
126
  h?: Parameters.H;
129
127
  }
130
128
  }
129
+ namespace SaveFile {
130
+ export type RequestBody = Components.Schemas.SaveFilePayload;
131
+ namespace Responses {
132
+ export type $201 = Components.Schemas.FileEntity;
133
+ }
134
+ }
131
135
  namespace UploadFile {
132
136
  export type RequestBody = Components.Schemas.UploadFilePayload;
133
137
  namespace Responses {
@@ -220,15 +224,20 @@ export interface OperationMethods {
220
224
  config?: AxiosRequestConfig
221
225
  ): OperationResponse<Paths.UploadFile.Responses.$201>
222
226
  /**
223
- * createFile - createFile
227
+ * saveFile - saveFile
228
+ *
229
+ * Create / Update a permanent File entity
230
+ *
231
+ * Makes file object permanent
232
+ *
233
+ * Saves metadata to file entity
224
234
  *
225
- * Create a permanent File entity
226
235
  */
227
- 'createFile'(
236
+ 'saveFile'(
228
237
  parameters?: Parameters<UnknownParamsObject> | null,
229
- data?: Paths.CreateFile.RequestBody,
238
+ data?: Paths.SaveFile.RequestBody,
230
239
  config?: AxiosRequestConfig
231
- ): OperationResponse<Paths.CreateFile.Responses.$201>
240
+ ): OperationResponse<Paths.SaveFile.Responses.$201>
232
241
  /**
233
242
  * downloadFile - downloadFile
234
243
  *
@@ -284,15 +293,20 @@ export interface PathsDictionary {
284
293
  }
285
294
  ['/v1/files']: {
286
295
  /**
287
- * createFile - createFile
296
+ * saveFile - saveFile
297
+ *
298
+ * Create / Update a permanent File entity
299
+ *
300
+ * Makes file object permanent
301
+ *
302
+ * Saves metadata to file entity
288
303
  *
289
- * Create a permanent File entity
290
304
  */
291
305
  'post'(
292
306
  parameters?: Parameters<UnknownParamsObject> | null,
293
- data?: Paths.CreateFile.RequestBody,
307
+ data?: Paths.SaveFile.RequestBody,
294
308
  config?: AxiosRequestConfig
295
- ): OperationResponse<Paths.CreateFile.Responses.$201>
309
+ ): OperationResponse<Paths.SaveFile.Responses.$201>
296
310
  }
297
311
  ['/v1/files/{id}/download']: {
298
312
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epilot/file-client",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
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
@@ -26,15 +26,6 @@ declare namespace Components {
26
26
  * ef7d985c-2385-44f4-9c71-ae06a52264f8
27
27
  */
28
28
  export type FileEntityId = string;
29
- export interface FileEntityPayload {
30
- /**
31
- * example:
32
- * document.pdf
33
- */
34
- filename?: string;
35
- access_control?: "private" | "public";
36
- versions?: FileItem[];
37
- }
38
29
  export interface FileItem {
39
30
  /**
40
31
  * example:
@@ -69,6 +60,19 @@ declare namespace Components {
69
60
  */
70
61
  key: string;
71
62
  }
63
+ export interface SaveFilePayload {
64
+ s3ref: S3Reference;
65
+ /**
66
+ * if passed, adds a new version to existing file entity
67
+ */
68
+ file_entity_id?: string;
69
+ /**
70
+ * example:
71
+ * document.pdf
72
+ */
73
+ filename?: string;
74
+ access_control?: "private" | "public";
75
+ }
72
76
  export interface UploadFilePayload {
73
77
  /**
74
78
  * example:
@@ -85,12 +89,6 @@ declare namespace Components {
85
89
  }
86
90
  }
87
91
  declare namespace Paths {
88
- namespace CreateFile {
89
- export type RequestBody = Components.Schemas.FileEntityPayload;
90
- namespace Responses {
91
- export type $201 = Components.Schemas.FileEntity;
92
- }
93
- }
94
92
  namespace DownloadFile {
95
93
  namespace Parameters {
96
94
  export type Id = Components.Schemas.FileEntityId;
@@ -128,6 +126,12 @@ declare namespace Paths {
128
126
  h?: Parameters.H;
129
127
  }
130
128
  }
129
+ namespace SaveFile {
130
+ export type RequestBody = Components.Schemas.SaveFilePayload;
131
+ namespace Responses {
132
+ export type $201 = Components.Schemas.FileEntity;
133
+ }
134
+ }
131
135
  namespace UploadFile {
132
136
  export type RequestBody = Components.Schemas.UploadFilePayload;
133
137
  namespace Responses {
@@ -220,15 +224,20 @@ export interface OperationMethods {
220
224
  config?: AxiosRequestConfig
221
225
  ): OperationResponse<Paths.UploadFile.Responses.$201>
222
226
  /**
223
- * createFile - createFile
227
+ * saveFile - saveFile
228
+ *
229
+ * Create / Update a permanent File entity
230
+ *
231
+ * Makes file object permanent
232
+ *
233
+ * Saves metadata to file entity
224
234
  *
225
- * Create a permanent File entity
226
235
  */
227
- 'createFile'(
236
+ 'saveFile'(
228
237
  parameters?: Parameters<UnknownParamsObject> | null,
229
- data?: Paths.CreateFile.RequestBody,
238
+ data?: Paths.SaveFile.RequestBody,
230
239
  config?: AxiosRequestConfig
231
- ): OperationResponse<Paths.CreateFile.Responses.$201>
240
+ ): OperationResponse<Paths.SaveFile.Responses.$201>
232
241
  /**
233
242
  * downloadFile - downloadFile
234
243
  *
@@ -284,15 +293,20 @@ export interface PathsDictionary {
284
293
  }
285
294
  ['/v1/files']: {
286
295
  /**
287
- * createFile - createFile
296
+ * saveFile - saveFile
297
+ *
298
+ * Create / Update a permanent File entity
299
+ *
300
+ * Makes file object permanent
301
+ *
302
+ * Saves metadata to file entity
288
303
  *
289
- * Create a permanent File entity
290
304
  */
291
305
  'post'(
292
306
  parameters?: Parameters<UnknownParamsObject> | null,
293
- data?: Paths.CreateFile.RequestBody,
307
+ data?: Paths.SaveFile.RequestBody,
294
308
  config?: AxiosRequestConfig
295
- ): OperationResponse<Paths.CreateFile.Responses.$201>
309
+ ): OperationResponse<Paths.SaveFile.Responses.$201>
296
310
  }
297
311
  ['/v1/files/{id}/download']: {
298
312
  /**