@epilot/file-client 1.8.0-rc2 → 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":{"get":{"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",
package/dist/openapi.d.ts CHANGED
@@ -23,6 +23,10 @@ declare namespace Components {
23
23
  filename?: string;
24
24
  _tags?: string[];
25
25
  access_control?: "private" | "public-read";
26
+ /**
27
+ * List of entities to relate the file to
28
+ */
29
+ relations?: FileRelationItem[];
26
30
  }
27
31
  export interface DeleteFilePayload {
28
32
  s3ref: S3Reference;
@@ -40,6 +44,17 @@ declare namespace Components {
40
44
  */
41
45
  version?: number;
42
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;
43
58
  export interface FileEntity {
44
59
  _id?: /**
45
60
  * example:
@@ -108,6 +123,20 @@ declare namespace Components {
108
123
  */
109
124
  mime_type?: string;
110
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
+ }
111
140
  export interface S3Reference {
112
141
  /**
113
142
  * example:
@@ -134,10 +163,14 @@ declare namespace Components {
134
163
  filename?: string;
135
164
  _tags?: string[];
136
165
  access_control?: "private" | "public-read";
166
+ /**
167
+ * List of entities to relate the file to
168
+ */
169
+ relations?: FileRelationItem[];
137
170
  /**
138
171
  * Custom external download url used for the file
139
172
  */
140
- custom_download_url: string; // url
173
+ custom_download_url: string; // uri
141
174
  }
142
175
  export type SaveFilePayload = SaveS3FilePayload | SaveCustomFilePayload;
143
176
  export interface SaveS3FilePayload {
@@ -154,6 +187,10 @@ declare namespace Components {
154
187
  filename?: string;
155
188
  _tags?: string[];
156
189
  access_control?: "private" | "public-read";
190
+ /**
191
+ * List of entities to relate the file to
192
+ */
193
+ relations?: FileRelationItem[];
157
194
  s3ref: S3Reference;
158
195
  }
159
196
  export interface UploadFilePayload {
@@ -169,6 +206,14 @@ declare namespace Components {
169
206
  */
170
207
  mime_type?: string;
171
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
+ }
172
217
  }
173
218
  }
174
219
  declare namespace Paths {
@@ -403,6 +448,14 @@ declare namespace Paths {
403
448
  }
404
449
  }
405
450
  }
451
+ namespace VerifyCustomDownloadUrl {
452
+ export type RequestBody = Components.Schemas.VerifyCustomDownloadUrlPayload;
453
+ namespace Responses {
454
+ export interface $200 {
455
+ valid?: boolean;
456
+ }
457
+ }
458
+ }
406
459
  }
407
460
 
408
461
  export interface OperationMethods {
@@ -457,6 +510,16 @@ export interface OperationMethods {
457
510
  data?: any,
458
511
  config?: AxiosRequestConfig
459
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>
460
523
  /**
461
524
  * downloadFiles - downloadFiles
462
525
  *
@@ -612,6 +675,18 @@ export interface PathsDictionary {
612
675
  config?: AxiosRequestConfig
613
676
  ): OperationResponse<Paths.DownloadFile.Responses.$200>
614
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
+ }
615
690
  ['/v1/files:downloadFiles']: {
616
691
  /**
617
692
  * downloadFiles - downloadFiles
package/dist/openapi.json CHANGED
@@ -188,6 +188,26 @@
188
188
  "custom_download_url": "https://some-api-url.com/download?file_id=123",
189
189
  "shared_with_end_customer": true
190
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
+ }
191
211
  }
192
212
  }
193
213
  }
@@ -264,6 +284,42 @@
264
284
  }
265
285
  }
266
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
+ },
267
323
  "/v1/files:downloadFiles": {
268
324
  "post": {
269
325
  "operationId": "downloadFiles",
@@ -650,6 +706,15 @@
650
706
  }
651
707
  },
652
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
+ },
653
718
  "FileEntityId": {
654
719
  "type": "string",
655
720
  "example": "ef7d985c-2385-44f4-9c71-ae06a52264f8"
@@ -797,6 +862,13 @@
797
862
  "private",
798
863
  "public-read"
799
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
+ }
800
872
  }
801
873
  },
802
874
  "additionalProperties": true
@@ -830,7 +902,7 @@
830
902
  "custom_download_url": {
831
903
  "description": "Custom external download url used for the file",
832
904
  "type": "string",
833
- "format": "url"
905
+ "format": "uri"
834
906
  }
835
907
  },
836
908
  "required": [
@@ -860,6 +932,20 @@
860
932
  "s3ref"
861
933
  ]
862
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
+ },
863
949
  "S3Reference": {
864
950
  "type": "object",
865
951
  "properties": {
@@ -900,10 +986,33 @@
900
986
  }
901
987
  }
902
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
+ ]
903
1009
  }
904
1010
  }
905
1011
  },
906
1012
  "servers": [
1013
+ {
1014
+ "url": "https://file.sls.epilot.io"
1015
+ },
907
1016
  {
908
1017
  "url": "https://file.sls.epilot.io"
909
1018
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epilot/file-client",
3
- "version": "1.8.0-rc2",
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
+ }