@epilot/file-client 1.22.0 → 1.24.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/openapi.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "openapi": "3.0.3",
3
3
  "info": {
4
4
  "title": "File API",
5
- "version": "1.9.0",
5
+ "version": "1.10.0",
6
6
  "description": "The File API enables you to upload, store, manage, and share files within the epilot platform.\n\n## Key Features\n- **Upload files** to temporary storage and save them permanently as File entities\n- **Generate previews** (thumbnails) for images and documents\n- **Create public links** to share private files externally\n- **Organize files** into collections for better management\n- **Version control** with automatic file versioning on updates\n\n## File Upload Workflow\n1. Call `uploadFileV2` to get a pre-signed S3 URL\n2. Upload your file directly to S3 using the pre-signed URL (PUT request)\n3. Call `saveFileV2` with the S3 reference to create a permanent File entity\n\n## Changelog\n<a href=\"changelog\">View API Changelog</a>\n"
7
7
  },
8
8
  "tags": [
@@ -162,7 +162,20 @@
162
162
  "content": {
163
163
  "application/json": {
164
164
  "schema": {
165
- "$ref": "#/components/schemas/SaveFilePayloadV2"
165
+ "oneOf": [
166
+ {
167
+ "$ref": "#/components/schemas/SaveFilePayloadV2"
168
+ },
169
+ {
170
+ "type": "array",
171
+ "description": "Batch version mode: array of s3ref payloads to add multiple versions to a single file entity.\nAll payloads must target the same file entity (_id or file_entity_id).\nRequires version_only=true query parameter.\nS3 operations run in parallel, with a single entity update at the end.\n",
172
+ "items": {
173
+ "$ref": "#/components/schemas/BatchSaveFileVersionPayload"
174
+ },
175
+ "minItems": 1,
176
+ "maxItems": 20
177
+ }
178
+ ]
166
179
  },
167
180
  "examples": {
168
181
  "New file from s3ref": {
@@ -220,6 +233,29 @@
220
233
  "custom_download_url": "https://some-api-url.com/download?file_id=123",
221
234
  "shared_with_end_customer": true
222
235
  }
236
+ },
237
+ "Batch save multiple versions": {
238
+ "description": "Save multiple file versions in a single request (parallel S3 processing)",
239
+ "value": [
240
+ {
241
+ "_id": "ef7d985c-2385-44f4-9c71-ae06a52264f8",
242
+ "filename": "photo1.jpg",
243
+ "access_control": "private",
244
+ "s3ref": {
245
+ "bucket": "epilot-prod-user-content",
246
+ "key": "123/temp/abc/photo1.jpg"
247
+ }
248
+ },
249
+ {
250
+ "_id": "ef7d985c-2385-44f4-9c71-ae06a52264f8",
251
+ "filename": "photo2.jpg",
252
+ "access_control": "private",
253
+ "s3ref": {
254
+ "bucket": "epilot-prod-user-content",
255
+ "key": "123/temp/def/photo2.jpg"
256
+ }
257
+ }
258
+ ]
223
259
  }
224
260
  }
225
261
  }
@@ -227,7 +263,7 @@
227
263
  },
228
264
  "responses": {
229
265
  "200": {
230
- "description": "Created File Entity",
266
+ "description": "Created or updated File Entity",
231
267
  "content": {
232
268
  "application/json": {
233
269
  "schema": {
@@ -744,6 +780,101 @@
744
780
  }
745
781
  }
746
782
  },
783
+ "/v1/files:zipJob": {
784
+ "post": {
785
+ "operationId": "createZipJob",
786
+ "summary": "createZipJob",
787
+ "description": "Create a background job to ZIP multiple files and send a download link via email.\n\nFor bulk downloads of more than 50 files, use this async endpoint instead of client-side zipping.\nThe job will:\n1. Download all requested files from S3\n2. Create a ZIP archive\n3. Upload the ZIP to temporary storage\n4. Send an email notification with the download link\n\nThe ZIP file will be available for 7 days.\n",
788
+ "tags": [
789
+ "File"
790
+ ],
791
+ "requestBody": {
792
+ "content": {
793
+ "application/json": {
794
+ "schema": {
795
+ "$ref": "#/components/schemas/CreateZipJobPayload"
796
+ },
797
+ "examples": {
798
+ "Zip multiple files": {
799
+ "value": {
800
+ "file_entity_ids": [
801
+ "ef7d985c-2385-44f4-9c71-ae06a52264f8",
802
+ "3fa85f64-5717-4562-b3fc-2c963f66afa6"
803
+ ],
804
+ "zip_filename": "Documents.zip",
805
+ "notify_email": true
806
+ }
807
+ }
808
+ }
809
+ }
810
+ }
811
+ },
812
+ "responses": {
813
+ "202": {
814
+ "description": "Job created, processing in background",
815
+ "content": {
816
+ "application/json": {
817
+ "schema": {
818
+ "$ref": "#/components/schemas/ZipJob"
819
+ }
820
+ }
821
+ }
822
+ },
823
+ "400": {
824
+ "$ref": "#/components/responses/BadRequestError"
825
+ },
826
+ "401": {
827
+ "$ref": "#/components/responses/UnauthorizedError"
828
+ },
829
+ "500": {
830
+ "$ref": "#/components/responses/InternalServerError"
831
+ }
832
+ }
833
+ }
834
+ },
835
+ "/v1/files:zipJob/{job_id}": {
836
+ "get": {
837
+ "operationId": "getZipJob",
838
+ "summary": "getZipJob",
839
+ "description": "Get the status of a ZIP job",
840
+ "tags": [
841
+ "File"
842
+ ],
843
+ "parameters": [
844
+ {
845
+ "name": "job_id",
846
+ "in": "path",
847
+ "required": true,
848
+ "description": "The UUID of the ZIP job",
849
+ "schema": {
850
+ "type": "string",
851
+ "format": "uuid"
852
+ }
853
+ }
854
+ ],
855
+ "responses": {
856
+ "200": {
857
+ "description": "ZIP job status",
858
+ "content": {
859
+ "application/json": {
860
+ "schema": {
861
+ "$ref": "#/components/schemas/ZipJob"
862
+ }
863
+ }
864
+ }
865
+ },
866
+ "401": {
867
+ "$ref": "#/components/responses/UnauthorizedError"
868
+ },
869
+ "404": {
870
+ "$ref": "#/components/responses/NotFoundError"
871
+ },
872
+ "500": {
873
+ "$ref": "#/components/responses/InternalServerError"
874
+ }
875
+ }
876
+ }
877
+ },
747
878
  "/v1/files/{id}/preview": {
748
879
  "get": {
749
880
  "operationId": "previewFile",
@@ -1163,8 +1294,7 @@
1163
1294
  "get": {
1164
1295
  "operationId": "listPublicLinksForFile",
1165
1296
  "summary": "listPublicLinksForFile",
1166
- "description": "**Not yet implemented.**\n\nThis endpoint will fetch all public links previously generated for a file.\n",
1167
- "x-not-implemented": true,
1297
+ "description": "Fetches all public links previously generated for a file",
1168
1298
  "parameters": [
1169
1299
  {
1170
1300
  "name": "id",
@@ -1304,8 +1434,7 @@
1304
1434
  "delete": {
1305
1435
  "operationId": "revokePublicLink",
1306
1436
  "summary": "revokePublicLink",
1307
- "description": "**Not yet implemented.**\n\nThis endpoint will revoke a public link, making the file inaccessible via that link.\n",
1308
- "x-not-implemented": true,
1437
+ "description": "Revokes a given public link by ID",
1309
1438
  "parameters": [
1310
1439
  {
1311
1440
  "name": "id",
@@ -2212,6 +2341,50 @@
2212
2341
  }
2213
2342
  ]
2214
2343
  },
2344
+ "BatchSaveFileVersionPayload": {
2345
+ "type": "object",
2346
+ "description": "Payload for batch version save. Only s3ref payloads are supported.",
2347
+ "properties": {
2348
+ "_id": {
2349
+ "allOf": [
2350
+ {
2351
+ "$ref": "#/components/schemas/FileEntityId"
2352
+ },
2353
+ {
2354
+ "description": "Target file entity to add version to"
2355
+ }
2356
+ ]
2357
+ },
2358
+ "file_entity_id": {
2359
+ "type": "string",
2360
+ "description": "Deprecated, use _id instead",
2361
+ "deprecated": true
2362
+ },
2363
+ "filename": {
2364
+ "type": "string",
2365
+ "example": "document.pdf"
2366
+ },
2367
+ "mime_type": {
2368
+ "type": "string",
2369
+ "example": "application/pdf"
2370
+ },
2371
+ "access_control": {
2372
+ "type": "string",
2373
+ "default": "private",
2374
+ "enum": [
2375
+ "private",
2376
+ "public-read"
2377
+ ]
2378
+ },
2379
+ "s3ref": {
2380
+ "$ref": "#/components/schemas/S3Ref"
2381
+ }
2382
+ },
2383
+ "required": [
2384
+ "s3ref"
2385
+ ],
2386
+ "additionalProperties": false
2387
+ },
2215
2388
  "UploadFilePayload": {
2216
2389
  "type": "object",
2217
2390
  "properties": {
@@ -2298,6 +2471,171 @@
2298
2471
  ]
2299
2472
  }
2300
2473
  },
2474
+ "CreateZipJobPayload": {
2475
+ "type": "object",
2476
+ "description": "Request payload to create a ZIP job for bulk file download.\nProvide either an explicit list of `file_entity_ids` (up to 1000) or an\n`entity_query` that resolves to file entities (up to 10000).\n",
2477
+ "properties": {
2478
+ "file_entity_ids": {
2479
+ "type": "array",
2480
+ "description": "List of file entity IDs to include in the ZIP",
2481
+ "items": {
2482
+ "type": "string",
2483
+ "format": "uuid"
2484
+ },
2485
+ "minItems": 1,
2486
+ "maxItems": 1000,
2487
+ "example": [
2488
+ "ef7d985c-2385-44f4-9c71-ae06a52264f8",
2489
+ "3fa85f64-5717-4562-b3fc-2c963f66afa6"
2490
+ ]
2491
+ },
2492
+ "entity_query": {
2493
+ "type": "object",
2494
+ "description": "Entity search query used to resolve files to include in the ZIP",
2495
+ "properties": {
2496
+ "q": {
2497
+ "type": "string",
2498
+ "description": "Lucene-style search query (same syntax as entity search)",
2499
+ "example": "_schema:file AND _tags:invoice"
2500
+ },
2501
+ "sort": {
2502
+ "type": "string",
2503
+ "description": "Sort expression forwarded to the entity search",
2504
+ "example": "_created_at:desc"
2505
+ }
2506
+ },
2507
+ "required": [
2508
+ "q"
2509
+ ]
2510
+ },
2511
+ "zip_filename": {
2512
+ "type": "string",
2513
+ "description": "Name of the generated ZIP file",
2514
+ "default": "Files.zip",
2515
+ "example": "Documents.zip"
2516
+ },
2517
+ "notify_email": {
2518
+ "type": "boolean",
2519
+ "description": "Send email notification when ZIP is ready",
2520
+ "default": true
2521
+ }
2522
+ },
2523
+ "oneOf": [
2524
+ {
2525
+ "required": [
2526
+ "file_entity_ids"
2527
+ ]
2528
+ },
2529
+ {
2530
+ "required": [
2531
+ "entity_query"
2532
+ ]
2533
+ }
2534
+ ]
2535
+ },
2536
+ "ZipJob": {
2537
+ "type": "object",
2538
+ "description": "ZIP job status and result",
2539
+ "properties": {
2540
+ "job_id": {
2541
+ "type": "string",
2542
+ "format": "uuid",
2543
+ "description": "Unique identifier for the ZIP job",
2544
+ "example": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
2545
+ },
2546
+ "status": {
2547
+ "type": "string",
2548
+ "description": "Current status of the ZIP job",
2549
+ "enum": [
2550
+ "queued",
2551
+ "downloading",
2552
+ "zipping",
2553
+ "uploading",
2554
+ "sending_notification",
2555
+ "completed",
2556
+ "failed"
2557
+ ],
2558
+ "example": "completed"
2559
+ },
2560
+ "progress": {
2561
+ "type": "object",
2562
+ "description": "Progress information for the job",
2563
+ "properties": {
2564
+ "total_files": {
2565
+ "type": "integer",
2566
+ "description": "Total number of files to process",
2567
+ "example": 100
2568
+ },
2569
+ "downloaded_files": {
2570
+ "type": "integer",
2571
+ "description": "Number of files successfully downloaded",
2572
+ "example": 75
2573
+ },
2574
+ "failed_files": {
2575
+ "type": "integer",
2576
+ "description": "Number of files that failed to download",
2577
+ "example": 2
2578
+ }
2579
+ }
2580
+ },
2581
+ "result": {
2582
+ "type": "object",
2583
+ "description": "Result of the completed ZIP job",
2584
+ "properties": {
2585
+ "file_entity_id": {
2586
+ "type": "string",
2587
+ "format": "uuid",
2588
+ "description": "File entity ID of the generated ZIP",
2589
+ "example": "ef7d985c-2385-44f4-9c71-ae06a52264f8"
2590
+ },
2591
+ "download_url": {
2592
+ "type": "string",
2593
+ "format": "uri",
2594
+ "description": "Presigned download URL (expires in 24 hours)",
2595
+ "example": "https://epilot-prod-user-content.s3.eu-central-1.amazonaws.com/123/files.zip?X-Amz-..."
2596
+ },
2597
+ "expires_at": {
2598
+ "type": "string",
2599
+ "format": "date-time",
2600
+ "description": "When the download URL expires",
2601
+ "example": "2024-01-02T12:00:00Z"
2602
+ },
2603
+ "zip_size_bytes": {
2604
+ "type": "integer",
2605
+ "description": "Size of the generated ZIP file in bytes",
2606
+ "example": 104857600
2607
+ }
2608
+ }
2609
+ },
2610
+ "error": {
2611
+ "type": "string",
2612
+ "description": "Error message if job failed",
2613
+ "example": "Failed to download file: access denied"
2614
+ },
2615
+ "created_at": {
2616
+ "type": "string",
2617
+ "format": "date-time",
2618
+ "description": "When the job was created",
2619
+ "example": "2024-01-01T12:00:00Z"
2620
+ },
2621
+ "created_by": {
2622
+ "type": "string",
2623
+ "description": "User ID who created the job",
2624
+ "example": "10234"
2625
+ },
2626
+ "org_id": {
2627
+ "type": "string",
2628
+ "description": "Organization ID",
2629
+ "example": "123"
2630
+ },
2631
+ "updated_at": {
2632
+ "type": "string",
2633
+ "format": "date-time",
2634
+ "description": "When the job was last updated",
2635
+ "example": "2024-01-01T12:05:00Z"
2636
+ }
2637
+ }
2638
+ },
2301
2639
  "VerifyCustomDownloadUrlPayload": {
2302
2640
  "type": "object",
2303
2641
  "properties": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epilot/file-client",
3
- "version": "1.22.0",
3
+ "version": "1.24.0",
4
4
  "description": "Client library for the epilot File API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -8,16 +8,16 @@
8
8
  "license": "MIT",
9
9
  "private": false,
10
10
  "scripts": {
11
- "test": "jest",
11
+ "test": "vitest",
12
12
  "typescript": "tsc",
13
13
  "bundle-definition": "webpack",
14
14
  "openapi": "node ../../scripts/update-openapi.js https://docs.api.epilot.io/file.yaml",
15
- "typegen": "openapi typegen src/openapi.json --client -b '/* eslint-disable */' > src/openapi.d.ts",
15
+ "typegen": "openapi typegen src/openapi.json --client > src/openapi.d.ts",
16
16
  "build": "tsc && npm run build:patch && npm run bundle-definition",
17
17
  "build:patch": "sed -i'' -e '/^__exportStar.*openapi.*$/d' dist/index.js",
18
18
  "build:watch": "npm run build && tsc -w",
19
19
  "prepublishOnly": "npm run typegen && npm run build",
20
- "lint": "pnpm exec eslint src"
20
+ "lint": "biome check src"
21
21
  },
22
22
  "repository": {
23
23
  "type": "git",
@@ -58,13 +58,10 @@
58
58
  "util": "^0.12.3"
59
59
  },
60
60
  "devDependencies": {
61
- "@types/jest": "^26.0.20",
62
61
  "axios": "^1.11.0",
63
62
  "copy-webpack-plugin": "^7.0.0",
64
- "jest": "^29.6.2",
65
63
  "json-loader": "^0.5.7",
66
- "openapicmd": "^2.7.0",
67
- "ts-jest": "^29.4.1",
64
+ "openapicmd": "^2.9.2",
68
65
  "ts-loader": "^8.0.14",
69
66
  "ts-node": "^10.9.1",
70
67
  "typescript": "^4.1.3",