@epilot/file-client 1.8.0-rc1 → 1.8.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/client.d.ts CHANGED
File without changes
package/dist/client.js CHANGED
File without changes
File without changes
@@ -1 +1 @@
1
- !function(e,i){for(var t in i)e[t]=i[t];i.__esModule&&Object.defineProperty(e,"__esModule",{value:!0})}(exports,(()=>{"use strict";var e={914:function(e,i,t){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(i,"__esModule",{value:!0});var r=n(t(946));i.default=r.default},946:e=>{e.exports=JSON.parse('{"openapi":"3.0.3","info":{"title":"","version":""},"paths":{"/v1/files/public/upload":{"post":{"operationId":"uploadFilePublic","requestBody":{"content":{"application/json":{}}}}},"/v1/files/upload":{"post":{"operationId":"uploadFile","parameters":[{"name":"file_entity_id","in":"query"}],"requestBody":{"content":{"application/json":{}}}}},"/v1/files":{"post":{"operationId":"saveFile","requestBody":{"content":{"application/json":{}}}}},"/v1/files/{id}/download":{"get":{"operationId":"downloadFile","parameters":[{"name":"id","in":"path","required":true},{"name":"version","in":"query"},{"name":"attachment","in":"query"}]}},"/v1/files:downloadFiles":{"post":{"operationId":"downloadFiles","requestBody":{"content":{"application/json":{}}}}},"/v1/files:downloadS3":{"post":{"operationId":"downloadS3File","parameters":[{"name":"s3_key","in":"query","required":true},{"name":"s3_bucket","in":"query","required":true},{"name":"attachment","in":"query"}]}},"/v1/files/{id}/preview":{"get":{"operationId":"previewFile","parameters":[{"name":"id","in":"path","required":true},{"name":"version","in":"query"},{"name":"w","in":"query"},{"name":"h","in":"query"}]}},"/v1/files/public/{id}/preview":{"get":{"operationId":"previewPublicFile","parameters":[{"name":"id","in":"path","required":true},{"name":"version","in":"query"},{"name":"w","in":"query"},{"name":"h","in":"query"},{"name":"org_id","in":"query"}]}},"/v1/files:previewS3":{"get":{"operationId":"previewS3FileGet","parameters":[{"name":"key","in":"query","required":true},{"name":"bucket","in":"query","required":true},{"name":"w","in":"query"},{"name":"h","in":"query"}]},"post":{"operationId":"previewS3File","parameters":[{"name":"w","in":"query"},{"name":"h","in":"query"}],"requestBody":{"content":{"application/json":{}}}}},"/v1/files/delete":{"delete":{"operationId":"deleteFile","requestBody":{"content":{"application/json":{}}}}},"/v1/files/session":{"post":{"operationId":"getSession"},"delete":{"operationId":"deleteSession"}}},"components":{},"servers":[{"url":"https://file.sls.epilot.io"}]}')}},i={};return function t(n){if(i[n])return i[n].exports;var r=i[n]={exports:{}};return e[n].call(r.exports,r,r.exports,t),r.exports}(914)})());
1
+ (()=>{"use strict";var e={914:function(e,i,t){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(i,"__esModule",{value:!0});var r=n(t(240));i.default=r.default},240:e=>{e.exports=JSON.parse('{"openapi":"3.0.3","info":{"title":"","version":""},"paths":{"/v1/files/public/upload":{"post":{"operationId":"uploadFilePublic","requestBody":{"content":{"application/json":{}}}}},"/v1/files/upload":{"post":{"operationId":"uploadFile","parameters":[{"name":"file_entity_id","in":"query"}],"requestBody":{"content":{"application/json":{}}}}},"/v1/files":{"post":{"operationId":"saveFile","requestBody":{"content":{"application/json":{}}}}},"/v1/files/{id}/download":{"get":{"operationId":"downloadFile","parameters":[{"name":"id","in":"path","required":true},{"name":"version","in":"query"},{"name":"attachment","in":"query"}]}},"/v1/files/download:verify":{"post":{"operationId":"verifyCustomDownloadUrl","requestBody":{"content":{"application/json":{}}}}},"/v1/files:downloadFiles":{"post":{"operationId":"downloadFiles","requestBody":{"content":{"application/json":{}}}}},"/v1/files:downloadS3":{"post":{"operationId":"downloadS3File","parameters":[{"name":"s3_key","in":"query","required":true},{"name":"s3_bucket","in":"query","required":true},{"name":"attachment","in":"query"}]}},"/v1/files/{id}/preview":{"get":{"operationId":"previewFile","parameters":[{"name":"id","in":"path","required":true},{"name":"version","in":"query"},{"name":"w","in":"query"},{"name":"h","in":"query"}]}},"/v1/files/public/{id}/preview":{"get":{"operationId":"previewPublicFile","parameters":[{"name":"id","in":"path","required":true},{"name":"version","in":"query"},{"name":"w","in":"query"},{"name":"h","in":"query"},{"name":"org_id","in":"query"}]}},"/v1/files:previewS3":{"get":{"operationId":"previewS3FileGet","parameters":[{"name":"key","in":"query","required":true},{"name":"bucket","in":"query","required":true},{"name":"w","in":"query"},{"name":"h","in":"query"}]},"post":{"operationId":"previewS3File","parameters":[{"name":"w","in":"query"},{"name":"h","in":"query"}],"requestBody":{"content":{"application/json":{}}}}},"/v1/files/delete":{"delete":{"operationId":"deleteFile","requestBody":{"content":{"application/json":{}}}}},"/v1/files/session":{"get":{"operationId":"getSession"},"delete":{"operationId":"deleteSession"}}},"components":{},"servers":[{"url":"https://file.sls.epilot.io"}]}')}},i={},t=function t(n){var r=i[n];if(void 0!==r)return r.exports;var o=i[n]={exports:{}};return e[n].call(o.exports,o,o.exports,t),o.exports}(914),n=exports;for(var r in t)n[r]=t[r];t.__esModule&&Object.defineProperty(n,"__esModule",{value:!0})})();
package/dist/index.d.ts CHANGED
File without changes
package/dist/index.js CHANGED
File without changes
@@ -61,6 +61,16 @@
61
61
  ]
62
62
  }
63
63
  },
64
+ "/v1/files/download:verify": {
65
+ "post": {
66
+ "operationId": "verifyCustomDownloadUrl",
67
+ "requestBody": {
68
+ "content": {
69
+ "application/json": {}
70
+ }
71
+ }
72
+ }
73
+ },
64
74
  "/v1/files:downloadFiles": {
65
75
  "post": {
66
76
  "operationId": "downloadFiles",
@@ -198,7 +208,7 @@
198
208
  }
199
209
  },
200
210
  "/v1/files/session": {
201
- "post": {
211
+ "get": {
202
212
  "operationId": "getSession"
203
213
  },
204
214
  "delete": {
package/dist/openapi.d.ts CHANGED
@@ -9,6 +9,25 @@ import type {
9
9
 
10
10
  declare namespace Components {
11
11
  namespace Schemas {
12
+ export interface CommonSaveFilePayload {
13
+ [name: string]: any;
14
+ /**
15
+ * if passed, adds a new version to existing file entity
16
+ */
17
+ file_entity_id?: string;
18
+ document_type?: "document" | "document_template" | "text" | "image" | "video" | "audio" | "spreadsheet" | "presentation" | "font" | "archive" | "application" | "unknown";
19
+ /**
20
+ * example:
21
+ * document.pdf
22
+ */
23
+ filename?: string;
24
+ _tags?: string[];
25
+ access_control?: "private" | "public-read";
26
+ /**
27
+ * List of entities to relate the file to
28
+ */
29
+ relations?: FileRelationItem[];
30
+ }
12
31
  export interface DeleteFilePayload {
13
32
  s3ref: S3Reference;
14
33
  }
@@ -25,6 +44,17 @@ declare namespace Components {
25
44
  */
26
45
  version?: number;
27
46
  }[];
47
+ /**
48
+ * example:
49
+ * ef7d985c-2385-44f4-9c71-ae06a52264f8
50
+ */
51
+ export type EntityId = string;
52
+ /**
53
+ * URL-friendly identifier for the entity schema
54
+ * example:
55
+ * contact
56
+ */
57
+ export type EntitySlug = string;
28
58
  export interface FileEntity {
29
59
  _id?: /**
30
60
  * example:
@@ -93,6 +123,20 @@ declare namespace Components {
93
123
  */
94
124
  mime_type?: string;
95
125
  }
126
+ export interface FileRelationItem {
127
+ entity_id: /**
128
+ * example:
129
+ * ef7d985c-2385-44f4-9c71-ae06a52264f8
130
+ */
131
+ EntityId;
132
+ _schema?: /**
133
+ * URL-friendly identifier for the entity schema
134
+ * example:
135
+ * contact
136
+ */
137
+ EntitySlug;
138
+ _tags?: string[];
139
+ }
96
140
  export interface S3Reference {
97
141
  /**
98
142
  * example:
@@ -105,9 +149,8 @@ declare namespace Components {
105
149
  */
106
150
  key: string;
107
151
  }
108
- export interface SaveFilePayload {
152
+ export interface SaveCustomFilePayload {
109
153
  [name: string]: any;
110
- s3ref: S3Reference;
111
154
  /**
112
155
  * if passed, adds a new version to existing file entity
113
156
  */
@@ -120,6 +163,35 @@ declare namespace Components {
120
163
  filename?: string;
121
164
  _tags?: string[];
122
165
  access_control?: "private" | "public-read";
166
+ /**
167
+ * List of entities to relate the file to
168
+ */
169
+ relations?: FileRelationItem[];
170
+ /**
171
+ * Custom external download url used for the file
172
+ */
173
+ custom_download_url: string; // uri
174
+ }
175
+ export type SaveFilePayload = SaveS3FilePayload | SaveCustomFilePayload;
176
+ export interface SaveS3FilePayload {
177
+ [name: string]: any;
178
+ /**
179
+ * if passed, adds a new version to existing file entity
180
+ */
181
+ file_entity_id?: string;
182
+ document_type?: "document" | "document_template" | "text" | "image" | "video" | "audio" | "spreadsheet" | "presentation" | "font" | "archive" | "application" | "unknown";
183
+ /**
184
+ * example:
185
+ * document.pdf
186
+ */
187
+ filename?: string;
188
+ _tags?: string[];
189
+ access_control?: "private" | "public-read";
190
+ /**
191
+ * List of entities to relate the file to
192
+ */
193
+ relations?: FileRelationItem[];
194
+ s3ref: S3Reference;
123
195
  }
124
196
  export interface UploadFilePayload {
125
197
  /**
@@ -134,6 +206,14 @@ declare namespace Components {
134
206
  */
135
207
  mime_type?: string;
136
208
  }
209
+ export interface VerifyCustomDownloadUrlPayload {
210
+ /**
211
+ * Custom external download url with signature and expiration time
212
+ * example:
213
+ * https://some-api-url.com?file_id=123&expires_at=1699273500029&signature=abcdefg
214
+ */
215
+ custom_download_url: string; // uri
216
+ }
137
217
  }
138
218
  }
139
219
  declare namespace Paths {
@@ -368,6 +448,14 @@ declare namespace Paths {
368
448
  }
369
449
  }
370
450
  }
451
+ namespace VerifyCustomDownloadUrl {
452
+ export type RequestBody = Components.Schemas.VerifyCustomDownloadUrlPayload;
453
+ namespace Responses {
454
+ export interface $200 {
455
+ valid?: boolean;
456
+ }
457
+ }
458
+ }
371
459
  }
372
460
 
373
461
  export interface OperationMethods {
@@ -422,6 +510,16 @@ export interface OperationMethods {
422
510
  data?: any,
423
511
  config?: AxiosRequestConfig
424
512
  ): OperationResponse<Paths.DownloadFile.Responses.$200>
513
+ /**
514
+ * verifyCustomDownloadUrl - verifyCustomDownloadUrl
515
+ *
516
+ * Verify a pre-signed custom download url for a file
517
+ */
518
+ 'verifyCustomDownloadUrl'(
519
+ parameters?: Parameters<UnknownParamsObject> | null,
520
+ data?: Paths.VerifyCustomDownloadUrl.RequestBody,
521
+ config?: AxiosRequestConfig
522
+ ): OperationResponse<Paths.VerifyCustomDownloadUrl.Responses.$200>
425
523
  /**
426
524
  * downloadFiles - downloadFiles
427
525
  *
@@ -577,6 +675,18 @@ export interface PathsDictionary {
577
675
  config?: AxiosRequestConfig
578
676
  ): OperationResponse<Paths.DownloadFile.Responses.$200>
579
677
  }
678
+ ['/v1/files/download:verify']: {
679
+ /**
680
+ * verifyCustomDownloadUrl - verifyCustomDownloadUrl
681
+ *
682
+ * Verify a pre-signed custom download url for a file
683
+ */
684
+ 'post'(
685
+ parameters?: Parameters<UnknownParamsObject> | null,
686
+ data?: Paths.VerifyCustomDownloadUrl.RequestBody,
687
+ config?: AxiosRequestConfig
688
+ ): OperationResponse<Paths.VerifyCustomDownloadUrl.Responses.$200>
689
+ }
580
690
  ['/v1/files:downloadFiles']: {
581
691
  /**
582
692
  * downloadFiles - downloadFiles
@@ -668,7 +778,7 @@ export interface PathsDictionary {
668
778
  * Allows using preview urls directly in img src for private files using cookie authentication.
669
779
  *
670
780
  */
671
- 'post'(
781
+ 'get'(
672
782
  parameters?: Parameters<UnknownParamsObject> | null,
673
783
  data?: any,
674
784
  config?: AxiosRequestConfig
package/dist/openapi.json CHANGED
@@ -157,6 +157,58 @@
157
157
  "application/json": {
158
158
  "schema": {
159
159
  "$ref": "#/components/schemas/SaveFilePayload"
160
+ },
161
+ "examples": {
162
+ "S3File": {
163
+ "description": "Standard epilot file entity with S3 Ref",
164
+ "value": {
165
+ "file_entity_id": "string",
166
+ "document_type": "document",
167
+ "filename": "document.pdf",
168
+ "_tags": [
169
+ "string"
170
+ ],
171
+ "access_control": "private",
172
+ "s3ref": {
173
+ "bucket": "epilot-files-prod",
174
+ "key": "123/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf"
175
+ }
176
+ }
177
+ },
178
+ "CustomFile": {
179
+ "description": "Custom file entity with custom download url",
180
+ "value": {
181
+ "file_entity_id": "string",
182
+ "document_type": "document",
183
+ "filename": "document.pdf",
184
+ "_tags": [
185
+ "string"
186
+ ],
187
+ "access_control": "private",
188
+ "custom_download_url": "https://some-api-url.com/download?file_id=123",
189
+ "shared_with_end_customer": true
190
+ }
191
+ },
192
+ "CustomFileWithRelations": {
193
+ "description": "Custom file entity with custom download url",
194
+ "value": {
195
+ "file_entity_id": "string",
196
+ "document_type": "document",
197
+ "filename": "document.pdf",
198
+ "_tags": [
199
+ "string"
200
+ ],
201
+ "access_control": "private",
202
+ "custom_download_url": "https://some-api-url.com/download?file_id=123",
203
+ "shared_with_end_customer": true,
204
+ "relations": [
205
+ {
206
+ "entity_id": "77a1e0cc-7b92-4d41-8cce-eefd317ec004",
207
+ "_schema": "contact"
208
+ }
209
+ ]
210
+ }
211
+ }
160
212
  }
161
213
  }
162
214
  }
@@ -232,6 +284,42 @@
232
284
  }
233
285
  }
234
286
  },
287
+ "/v1/files/download:verify": {
288
+ "post": {
289
+ "operationId": "verifyCustomDownloadUrl",
290
+ "summary": "verifyCustomDownloadUrl",
291
+ "description": "Verify a pre-signed custom download url for a file",
292
+ "tags": [
293
+ "files"
294
+ ],
295
+ "requestBody": {
296
+ "content": {
297
+ "application/json": {
298
+ "schema": {
299
+ "$ref": "#/components/schemas/VerifyCustomDownloadUrlPayload"
300
+ }
301
+ }
302
+ }
303
+ },
304
+ "responses": {
305
+ "200": {
306
+ "description": "Download Url matches signature and has not expired",
307
+ "content": {
308
+ "application/json": {
309
+ "schema": {
310
+ "type": "object",
311
+ "properties": {
312
+ "valid": {
313
+ "type": "boolean"
314
+ }
315
+ }
316
+ }
317
+ }
318
+ }
319
+ }
320
+ }
321
+ }
322
+ },
235
323
  "/v1/files:downloadFiles": {
236
324
  "post": {
237
325
  "operationId": "downloadFiles",
@@ -574,7 +662,7 @@
574
662
  }
575
663
  },
576
664
  "/v1/files/session": {
577
- "post": {
665
+ "get": {
578
666
  "operationId": "getSession",
579
667
  "summary": "getSession",
580
668
  "description": "Start a browser session by setting passed Authorization token in a server side cookie.\n\nAllows using preview urls directly in img src for private files using cookie authentication.\n",
@@ -618,6 +706,15 @@
618
706
  }
619
707
  },
620
708
  "schemas": {
709
+ "EntityId": {
710
+ "type": "string",
711
+ "example": "ef7d985c-2385-44f4-9c71-ae06a52264f8"
712
+ },
713
+ "EntitySlug": {
714
+ "description": "URL-friendly identifier for the entity schema",
715
+ "type": "string",
716
+ "example": "contact"
717
+ },
621
718
  "FileEntityId": {
622
719
  "type": "string",
623
720
  "example": "ef7d985c-2385-44f4-9c71-ae06a52264f8"
@@ -724,12 +821,9 @@
724
821
  ]
725
822
  }
726
823
  },
727
- "SaveFilePayload": {
824
+ "CommonSaveFilePayload": {
728
825
  "type": "object",
729
826
  "properties": {
730
- "s3ref": {
731
- "$ref": "#/components/schemas/S3Reference"
732
- },
733
827
  "file_entity_id": {
734
828
  "type": "string",
735
829
  "description": "if passed, adds a new version to existing file entity"
@@ -768,11 +862,63 @@
768
862
  "private",
769
863
  "public-read"
770
864
  ]
865
+ },
866
+ "relations": {
867
+ "type": "array",
868
+ "description": "List of entities to relate the file to",
869
+ "items": {
870
+ "$ref": "#/components/schemas/FileRelationItem"
871
+ }
771
872
  }
772
873
  },
773
- "additionalProperties": true,
774
- "required": [
775
- "s3ref"
874
+ "additionalProperties": true
875
+ },
876
+ "SaveS3FilePayload": {
877
+ "allOf": [
878
+ {
879
+ "$ref": "#/components/schemas/CommonSaveFilePayload"
880
+ },
881
+ {
882
+ "type": "object",
883
+ "properties": {
884
+ "s3ref": {
885
+ "$ref": "#/components/schemas/S3Reference"
886
+ }
887
+ },
888
+ "required": [
889
+ "s3ref"
890
+ ]
891
+ }
892
+ ]
893
+ },
894
+ "SaveCustomFilePayload": {
895
+ "allOf": [
896
+ {
897
+ "$ref": "#/components/schemas/CommonSaveFilePayload"
898
+ },
899
+ {
900
+ "type": "object",
901
+ "properties": {
902
+ "custom_download_url": {
903
+ "description": "Custom external download url used for the file",
904
+ "type": "string",
905
+ "format": "uri"
906
+ }
907
+ },
908
+ "required": [
909
+ "custom_download_url"
910
+ ]
911
+ }
912
+ ]
913
+ },
914
+ "SaveFilePayload": {
915
+ "anyOf": [
916
+ {
917
+ "$ref": "#/components/schemas/SaveS3FilePayload"
918
+ },
919
+ {
920
+ "$ref": "#/components/schemas/SaveCustomFilePayload"
921
+ }
776
922
  ]
777
923
  },
778
924
  "DeleteFilePayload": {
@@ -786,6 +932,20 @@
786
932
  "s3ref"
787
933
  ]
788
934
  },
935
+ "VerifyCustomDownloadUrlPayload": {
936
+ "type": "object",
937
+ "properties": {
938
+ "custom_download_url": {
939
+ "description": "Custom external download url with signature and expiration time",
940
+ "type": "string",
941
+ "format": "uri",
942
+ "example": "https://some-api-url.com?file_id=123&expires_at=1699273500029&signature=abcdefg"
943
+ }
944
+ },
945
+ "required": [
946
+ "custom_download_url"
947
+ ]
948
+ },
789
949
  "S3Reference": {
790
950
  "type": "object",
791
951
  "properties": {
@@ -826,10 +986,33 @@
826
986
  }
827
987
  }
828
988
  ]
989
+ },
990
+ "FileRelationItem": {
991
+ "type": "object",
992
+ "properties": {
993
+ "entity_id": {
994
+ "$ref": "#/components/schemas/EntityId"
995
+ },
996
+ "_schema": {
997
+ "$ref": "#/components/schemas/EntitySlug"
998
+ },
999
+ "_tags": {
1000
+ "type": "array",
1001
+ "items": {
1002
+ "type": "string"
1003
+ }
1004
+ }
1005
+ },
1006
+ "required": [
1007
+ "entity_id"
1008
+ ]
829
1009
  }
830
1010
  }
831
1011
  },
832
1012
  "servers": [
1013
+ {
1014
+ "url": "https://file.sls.epilot.io"
1015
+ },
833
1016
  {
834
1017
  "url": "https://file.sls.epilot.io"
835
1018
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epilot/file-client",
3
- "version": "1.8.0-rc1",
3
+ "version": "1.8.0",
4
4
  "description": "Client library for the epilot File API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -50,7 +50,7 @@
50
50
  "dependencies": {
51
51
  "buffer": "^6.0.3",
52
52
  "https-browserify": "^1.0.0",
53
- "openapi-client-axios": "^6.0.0",
53
+ "openapi-client-axios": "^7.1.3",
54
54
  "stream-http": "^3.1.1",
55
55
  "url": "^0.11.0",
56
56
  "util": "^0.12.3"
@@ -61,7 +61,7 @@
61
61
  "copy-webpack-plugin": "^7.0.0",
62
62
  "jest": "^26.6.3",
63
63
  "json-loader": "^0.5.7",
64
- "openapi-client-axios-typegen": "^7.2.0",
64
+ "openapi-client-axios-typegen": "^7.4.1",
65
65
  "openapicmd": "^1.16.2",
66
66
  "ts-jest": "^26.5.0",
67
67
  "ts-loader": "^8.0.14",
@@ -71,4 +71,4 @@
71
71
  "webpack-cli": "^4.4.0"
72
72
  },
73
73
  "gitHead": "39426e86cfb320fa3227dc03f60ee6a10848e7c7"
74
- }
74
+ }