@weapnl/js-junction 0.1.4 → 0.3.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/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## v0.3.0
6
+ - Added `chunkUploadsBySize` option on the `Api` class to automatically chunk file uploads across multiple requests when the total size exceeds the configured size.
7
+
8
+ ## v0.2.0
9
+ - Added `data` propery to `delete` function of a Request to allow sending json data in the delete request.
10
+ - Added `extraData` property to `destroy` function of a Model to allow sending extra json data in the delete request.
11
+ - Now also sending custom parameters of a request in the `store`, `update` and `destroy` functions of a Model.
12
+
5
13
  ## v0.1.4
6
14
  - Added response in `onSuccess` and `onValidationError` callbacks.
7
15
 
package/README.md CHANGED
@@ -13,6 +13,7 @@ This package has support for Typescript (TS).
13
13
  - [Performing Requests](#performing-requests)
14
14
  - [Applying Filters and Scopes](#applying-filters-and-scopes)
15
15
  - [Uploading Files with Spatie Medialibrary](#uploading-files-with-spatie-medialibrary)
16
+ - [Chunked Uploads](#chunked-uploads)
16
17
 
17
18
  ## Installation
18
19
  ```bash
@@ -439,3 +440,22 @@ employee.save();
439
440
  ```
440
441
 
441
442
  In this scenario, the uploaded files are linked to the `ProfilePicture` collection within the `Contact` relationship of the `Employee` model. When the `save()` method is called, the files are properly attached within the nested structure.
443
+
444
+ ### Chunked Uploads
445
+
446
+ When uploading multiple files via the `upload` method, the total combined size may exceed the server's limit, or you may want to split large batches into smaller requests. Use `chunkUploadsBySize` to split files across multiple requests automatically.
447
+
448
+ **Configuring chunk size:**
449
+ ```js
450
+ api.chunkUploadsBySize(10 * 1024 * 1024); // 10 MB per request
451
+ ```
452
+
453
+ **Resetting (single request for all files):**
454
+ ```js
455
+ api.chunkUploadsBySize(null); // default behavior
456
+ ```
457
+
458
+ **How it works:**
459
+ - When set, the `upload` method groups files into chunks where the total file size per chunk does not exceed the configured size.
460
+ - Each chunk is uploaded in a separate request; response data is combined automatically.
461
+ - A single file that exceeds the size on its own is sent as its own request.