@epilot/file-client 1.7.1 → 1.8.0-rc2

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":{"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":{}}}}}},"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
+ !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)})());
package/dist/index.d.ts CHANGED
File without changes
package/dist/index.js CHANGED
File without changes
@@ -145,6 +145,29 @@
145
145
  }
146
146
  },
147
147
  "/v1/files:previewS3": {
148
+ "get": {
149
+ "operationId": "previewS3FileGet",
150
+ "parameters": [
151
+ {
152
+ "name": "key",
153
+ "in": "query",
154
+ "required": true
155
+ },
156
+ {
157
+ "name": "bucket",
158
+ "in": "query",
159
+ "required": true
160
+ },
161
+ {
162
+ "name": "w",
163
+ "in": "query"
164
+ },
165
+ {
166
+ "name": "h",
167
+ "in": "query"
168
+ }
169
+ ]
170
+ },
148
171
  "post": {
149
172
  "operationId": "previewS3File",
150
173
  "parameters": [
@@ -173,6 +196,14 @@
173
196
  }
174
197
  }
175
198
  }
199
+ },
200
+ "/v1/files/session": {
201
+ "get": {
202
+ "operationId": "getSession"
203
+ },
204
+ "delete": {
205
+ "operationId": "deleteSession"
206
+ }
176
207
  }
177
208
  },
178
209
  "components": {},
package/dist/openapi.d.ts CHANGED
@@ -9,6 +9,21 @@ 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
+ }
12
27
  export interface DeleteFilePayload {
13
28
  s3ref: S3Reference;
14
29
  }
@@ -105,9 +120,28 @@ declare namespace Components {
105
120
  */
106
121
  key: string;
107
122
  }
108
- export interface SaveFilePayload {
123
+ export interface SaveCustomFilePayload {
124
+ [name: string]: any;
125
+ /**
126
+ * if passed, adds a new version to existing file entity
127
+ */
128
+ file_entity_id?: string;
129
+ document_type?: "document" | "document_template" | "text" | "image" | "video" | "audio" | "spreadsheet" | "presentation" | "font" | "archive" | "application" | "unknown";
130
+ /**
131
+ * example:
132
+ * document.pdf
133
+ */
134
+ filename?: string;
135
+ _tags?: string[];
136
+ access_control?: "private" | "public-read";
137
+ /**
138
+ * Custom external download url used for the file
139
+ */
140
+ custom_download_url: string; // url
141
+ }
142
+ export type SaveFilePayload = SaveS3FilePayload | SaveCustomFilePayload;
143
+ export interface SaveS3FilePayload {
109
144
  [name: string]: any;
110
- s3ref: S3Reference;
111
145
  /**
112
146
  * if passed, adds a new version to existing file entity
113
147
  */
@@ -120,6 +154,7 @@ declare namespace Components {
120
154
  filename?: string;
121
155
  _tags?: string[];
122
156
  access_control?: "private" | "public-read";
157
+ s3ref: S3Reference;
123
158
  }
124
159
  export interface UploadFilePayload {
125
160
  /**
@@ -144,6 +179,12 @@ declare namespace Paths {
144
179
  }
145
180
  }
146
181
  }
182
+ namespace DeleteSession {
183
+ namespace Responses {
184
+ export interface $200 {
185
+ }
186
+ }
187
+ }
147
188
  namespace DownloadFile {
148
189
  namespace Parameters {
149
190
  export type Attachment = boolean;
@@ -205,6 +246,12 @@ declare namespace Paths {
205
246
  }
206
247
  }
207
248
  }
249
+ namespace GetSession {
250
+ namespace Responses {
251
+ export interface $200 {
252
+ }
253
+ }
254
+ }
208
255
  namespace PreviewFile {
209
256
  namespace Parameters {
210
257
  export type H = number;
@@ -258,6 +305,20 @@ declare namespace Paths {
258
305
  }
259
306
  export type RequestBody = Components.Schemas.S3Reference;
260
307
  }
308
+ namespace PreviewS3FileGet {
309
+ namespace Parameters {
310
+ export type Bucket = string;
311
+ export type H = number;
312
+ export type Key = string;
313
+ export type W = number;
314
+ }
315
+ export interface QueryParameters {
316
+ key: Parameters.Key;
317
+ bucket: Parameters.Bucket;
318
+ w?: Parameters.W;
319
+ h?: Parameters.H;
320
+ }
321
+ }
261
322
  namespace SaveFile {
262
323
  export type RequestBody = Components.Schemas.SaveFilePayload;
263
324
  namespace Responses {
@@ -436,6 +497,16 @@ export interface OperationMethods {
436
497
  data?: any,
437
498
  config?: AxiosRequestConfig
438
499
  ): OperationResponse<any>
500
+ /**
501
+ * previewS3FileGet - previewS3FileGet
502
+ *
503
+ * Get thumbnail preview from an s3 reference for a file entity
504
+ */
505
+ 'previewS3FileGet'(
506
+ parameters?: Parameters<Paths.PreviewS3FileGet.QueryParameters> | null,
507
+ data?: any,
508
+ config?: AxiosRequestConfig
509
+ ): OperationResponse<any>
439
510
  /**
440
511
  * previewS3File - previewS3File
441
512
  *
@@ -456,6 +527,29 @@ export interface OperationMethods {
456
527
  data?: Paths.DeleteFile.RequestBody,
457
528
  config?: AxiosRequestConfig
458
529
  ): OperationResponse<Paths.DeleteFile.Responses.$200>
530
+ /**
531
+ * getSession - getSession
532
+ *
533
+ * Start a browser session by setting passed Authorization token in a server side cookie.
534
+ *
535
+ * Allows using preview urls directly in img src for private files using cookie authentication.
536
+ *
537
+ */
538
+ 'getSession'(
539
+ parameters?: Parameters<UnknownParamsObject> | null,
540
+ data?: any,
541
+ config?: AxiosRequestConfig
542
+ ): OperationResponse<Paths.GetSession.Responses.$200>
543
+ /**
544
+ * deleteSession - deleteSession
545
+ *
546
+ * End browser session by deleting token cookie
547
+ */
548
+ 'deleteSession'(
549
+ parameters?: Parameters<UnknownParamsObject> | null,
550
+ data?: any,
551
+ config?: AxiosRequestConfig
552
+ ): OperationResponse<Paths.DeleteSession.Responses.$200>
459
553
  }
460
554
 
461
555
  export interface PathsDictionary {
@@ -567,6 +661,16 @@ export interface PathsDictionary {
567
661
  ): OperationResponse<any>
568
662
  }
569
663
  ['/v1/files:previewS3']: {
664
+ /**
665
+ * previewS3FileGet - previewS3FileGet
666
+ *
667
+ * Get thumbnail preview from an s3 reference for a file entity
668
+ */
669
+ 'get'(
670
+ parameters?: Parameters<Paths.PreviewS3FileGet.QueryParameters> | null,
671
+ data?: any,
672
+ config?: AxiosRequestConfig
673
+ ): OperationResponse<any>
570
674
  /**
571
675
  * previewS3File - previewS3File
572
676
  *
@@ -590,6 +694,31 @@ export interface PathsDictionary {
590
694
  config?: AxiosRequestConfig
591
695
  ): OperationResponse<Paths.DeleteFile.Responses.$200>
592
696
  }
697
+ ['/v1/files/session']: {
698
+ /**
699
+ * getSession - getSession
700
+ *
701
+ * Start a browser session by setting passed Authorization token in a server side cookie.
702
+ *
703
+ * Allows using preview urls directly in img src for private files using cookie authentication.
704
+ *
705
+ */
706
+ 'get'(
707
+ parameters?: Parameters<UnknownParamsObject> | null,
708
+ data?: any,
709
+ config?: AxiosRequestConfig
710
+ ): OperationResponse<Paths.GetSession.Responses.$200>
711
+ /**
712
+ * deleteSession - deleteSession
713
+ *
714
+ * End browser session by deleting token cookie
715
+ */
716
+ 'delete'(
717
+ parameters?: Parameters<UnknownParamsObject> | null,
718
+ data?: any,
719
+ config?: AxiosRequestConfig
720
+ ): OperationResponse<Paths.DeleteSession.Responses.$200>
721
+ }
593
722
  }
594
723
 
595
724
  export type Client = OpenAPIClient<OperationMethods, PathsDictionary>
package/dist/openapi.json CHANGED
@@ -8,12 +8,19 @@
8
8
  "tags": [
9
9
  {
10
10
  "name": "files",
11
- "description": "Files"
11
+ "description": "Files API"
12
+ },
13
+ {
14
+ "name": "session",
15
+ "description": "Session API for cookie authentication"
12
16
  }
13
17
  ],
14
18
  "security": [
15
19
  {
16
20
  "EpilotAuth": []
21
+ },
22
+ {
23
+ "CookieAuth": []
17
24
  }
18
25
  ],
19
26
  "paths": {
@@ -150,6 +157,38 @@
150
157
  "application/json": {
151
158
  "schema": {
152
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
+ }
153
192
  }
154
193
  }
155
194
  }
@@ -444,6 +483,59 @@
444
483
  }
445
484
  },
446
485
  "/v1/files:previewS3": {
486
+ "get": {
487
+ "operationId": "previewS3FileGet",
488
+ "summary": "previewS3FileGet",
489
+ "description": "Get thumbnail preview from an s3 reference for a file entity",
490
+ "tags": [
491
+ "files"
492
+ ],
493
+ "parameters": [
494
+ {
495
+ "name": "key",
496
+ "in": "query",
497
+ "description": "s3 key",
498
+ "required": true,
499
+ "schema": {
500
+ "type": "string"
501
+ }
502
+ },
503
+ {
504
+ "name": "bucket",
505
+ "in": "query",
506
+ "description": "s3 bucket",
507
+ "required": true,
508
+ "schema": {
509
+ "type": "string"
510
+ }
511
+ },
512
+ {
513
+ "name": "w",
514
+ "in": "query",
515
+ "description": "width",
516
+ "schema": {
517
+ "type": "integer"
518
+ }
519
+ },
520
+ {
521
+ "name": "h",
522
+ "in": "query",
523
+ "description": "height",
524
+ "schema": {
525
+ "type": "integer"
526
+ }
527
+ }
528
+ ],
529
+ "responses": {
530
+ "200": {
531
+ "description": "Generated thumbnail image",
532
+ "content": {
533
+ "image/png": {},
534
+ "image/jpeg": {}
535
+ }
536
+ }
537
+ }
538
+ },
447
539
  "post": {
448
540
  "operationId": "previewS3File",
449
541
  "summary": "previewS3File",
@@ -512,6 +604,34 @@
512
604
  }
513
605
  }
514
606
  }
607
+ },
608
+ "/v1/files/session": {
609
+ "get": {
610
+ "operationId": "getSession",
611
+ "summary": "getSession",
612
+ "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",
613
+ "tags": [
614
+ "session"
615
+ ],
616
+ "responses": {
617
+ "200": {
618
+ "description": "Session started successfully"
619
+ }
620
+ }
621
+ },
622
+ "delete": {
623
+ "operationId": "deleteSession",
624
+ "summary": "deleteSession",
625
+ "description": "End browser session by deleting token cookie",
626
+ "tags": [
627
+ "session"
628
+ ],
629
+ "responses": {
630
+ "200": {
631
+ "description": "Session deleted successfully"
632
+ }
633
+ }
634
+ }
515
635
  }
516
636
  },
517
637
  "components": {
@@ -521,6 +641,12 @@
521
641
  "scheme": "bearer",
522
642
  "description": "Authorization header with epilot OAuth2 bearer token",
523
643
  "bearerFormat": "JWT"
644
+ },
645
+ "CookieAuth": {
646
+ "type": "apiKey",
647
+ "in": "cookie",
648
+ "name": "token",
649
+ "description": "Cookie with epilot OAuth2 token"
524
650
  }
525
651
  },
526
652
  "schemas": {
@@ -630,12 +756,9 @@
630
756
  ]
631
757
  }
632
758
  },
633
- "SaveFilePayload": {
759
+ "CommonSaveFilePayload": {
634
760
  "type": "object",
635
761
  "properties": {
636
- "s3ref": {
637
- "$ref": "#/components/schemas/S3Reference"
638
- },
639
762
  "file_entity_id": {
640
763
  "type": "string",
641
764
  "description": "if passed, adds a new version to existing file entity"
@@ -676,9 +799,54 @@
676
799
  ]
677
800
  }
678
801
  },
679
- "additionalProperties": true,
680
- "required": [
681
- "s3ref"
802
+ "additionalProperties": true
803
+ },
804
+ "SaveS3FilePayload": {
805
+ "allOf": [
806
+ {
807
+ "$ref": "#/components/schemas/CommonSaveFilePayload"
808
+ },
809
+ {
810
+ "type": "object",
811
+ "properties": {
812
+ "s3ref": {
813
+ "$ref": "#/components/schemas/S3Reference"
814
+ }
815
+ },
816
+ "required": [
817
+ "s3ref"
818
+ ]
819
+ }
820
+ ]
821
+ },
822
+ "SaveCustomFilePayload": {
823
+ "allOf": [
824
+ {
825
+ "$ref": "#/components/schemas/CommonSaveFilePayload"
826
+ },
827
+ {
828
+ "type": "object",
829
+ "properties": {
830
+ "custom_download_url": {
831
+ "description": "Custom external download url used for the file",
832
+ "type": "string",
833
+ "format": "url"
834
+ }
835
+ },
836
+ "required": [
837
+ "custom_download_url"
838
+ ]
839
+ }
840
+ ]
841
+ },
842
+ "SaveFilePayload": {
843
+ "anyOf": [
844
+ {
845
+ "$ref": "#/components/schemas/SaveS3FilePayload"
846
+ },
847
+ {
848
+ "$ref": "#/components/schemas/SaveCustomFilePayload"
849
+ }
682
850
  ]
683
851
  },
684
852
  "DeleteFilePayload": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epilot/file-client",
3
- "version": "1.7.1",
3
+ "version": "1.8.0-rc2",
4
4
  "description": "Client library for the epilot File API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",