transloadit 4.0.7 → 4.1.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 +20 -0
- package/README.md +200 -21
- package/dist/ApiError.d.ts +1 -1
- package/dist/ApiError.d.ts.map +1 -1
- package/dist/ApiError.js.map +1 -1
- package/dist/Transloadit.d.ts +23 -4
- package/dist/Transloadit.d.ts.map +1 -1
- package/dist/Transloadit.js +62 -28
- package/dist/Transloadit.js.map +1 -1
- package/dist/apiTypes.d.ts +1 -1
- package/dist/apiTypes.d.ts.map +1 -1
- package/dist/cli/OutputCtl.d.ts +46 -0
- package/dist/cli/OutputCtl.d.ts.map +1 -0
- package/dist/cli/OutputCtl.js +85 -0
- package/dist/cli/OutputCtl.js.map +1 -0
- package/dist/cli/commands/BaseCommand.d.ts +23 -0
- package/dist/cli/commands/BaseCommand.d.ts.map +1 -0
- package/dist/cli/commands/BaseCommand.js +54 -0
- package/dist/cli/commands/BaseCommand.js.map +1 -0
- package/dist/cli/commands/assemblies.d.ts +93 -0
- package/dist/cli/commands/assemblies.d.ts.map +1 -0
- package/dist/cli/commands/assemblies.js +1021 -0
- package/dist/cli/commands/assemblies.js.map +1 -0
- package/dist/cli/commands/auth.d.ts +28 -0
- package/dist/cli/commands/auth.d.ts.map +1 -0
- package/dist/cli/commands/auth.js +286 -0
- package/dist/cli/commands/auth.js.map +1 -0
- package/dist/cli/commands/bills.d.ts +14 -0
- package/dist/cli/commands/bills.d.ts.map +1 -0
- package/dist/cli/commands/bills.js +69 -0
- package/dist/cli/commands/bills.js.map +1 -0
- package/dist/cli/commands/index.d.ts +3 -0
- package/dist/cli/commands/index.d.ts.map +1 -0
- package/dist/cli/commands/index.js +39 -0
- package/dist/cli/commands/index.js.map +1 -0
- package/dist/cli/commands/notifications.d.ts +16 -0
- package/dist/cli/commands/notifications.d.ts.map +1 -0
- package/dist/cli/commands/notifications.js +44 -0
- package/dist/cli/commands/notifications.js.map +1 -0
- package/dist/cli/commands/templates.d.ts +81 -0
- package/dist/cli/commands/templates.d.ts.map +1 -0
- package/dist/cli/commands/templates.js +428 -0
- package/dist/cli/commands/templates.js.map +1 -0
- package/dist/cli/helpers.d.ts +9 -0
- package/dist/cli/helpers.d.ts.map +1 -0
- package/dist/cli/helpers.js +32 -0
- package/dist/cli/helpers.js.map +1 -0
- package/dist/cli/template-last-modified.d.ts +10 -0
- package/dist/cli/template-last-modified.d.ts.map +1 -0
- package/dist/cli/template-last-modified.js +134 -0
- package/dist/cli/template-last-modified.js.map +1 -0
- package/dist/cli/types.d.ts +152 -0
- package/dist/cli/types.d.ts.map +1 -0
- package/dist/cli/types.js +64 -0
- package/dist/cli/types.js.map +1 -0
- package/dist/cli.d.ts +2 -12
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +11 -256
- package/dist/cli.js.map +1 -1
- package/dist/tus.d.ts +2 -1
- package/dist/tus.d.ts.map +1 -1
- package/dist/tus.js +33 -5
- package/dist/tus.js.map +1 -1
- package/package.json +12 -7
- package/src/ApiError.ts +2 -1
- package/src/Transloadit.ts +98 -39
- package/src/apiTypes.ts +1 -1
- package/src/cli/OutputCtl.ts +115 -0
- package/src/cli/commands/BaseCommand.ts +73 -0
- package/src/cli/commands/assemblies.ts +1373 -0
- package/src/cli/commands/auth.ts +362 -0
- package/src/cli/commands/bills.ts +91 -0
- package/src/cli/commands/index.ts +65 -0
- package/src/cli/commands/notifications.ts +63 -0
- package/src/cli/commands/templates.ts +556 -0
- package/src/cli/helpers.ts +41 -0
- package/src/cli/template-last-modified.ts +156 -0
- package/src/cli/types.ts +183 -0
- package/src/cli.ts +12 -305
- package/src/tus.ts +37 -5
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
You may also want to refer to [GitHub releases](https://github.com/transloadit/node-sdk/releases).
|
|
4
4
|
|
|
5
|
+
## Unreleased
|
|
6
|
+
|
|
7
|
+
- TBD
|
|
8
|
+
|
|
9
|
+
## v4.1.0
|
|
10
|
+
|
|
11
|
+
Released: 2025-12-08.
|
|
12
|
+
|
|
13
|
+
[Diff](https://github.com/transloadit/node-sdk/compare/v4.0.7...v4.1.0).
|
|
14
|
+
|
|
15
|
+
- Add `signal` option to `createAssembly()` for cancelling in-flight HTTP requests and TUS uploads via `AbortController`
|
|
16
|
+
- Add `signal` and `onPoll` options to `awaitAssemblyCompletion()` for cancellation and early termination (useful for custom progress reporting or superseding assemblies in watch mode)
|
|
17
|
+
- Integrate transloadify CLI into the SDK, providing `assemblies`, `templates`, `bills`, and `assembly-notifications` commands
|
|
18
|
+
- Add `--log-level (-l)` CLI option using syslog severity levels (err=3, warn=4, notice=5, info=6, debug=7, trace=8)
|
|
19
|
+
- Add `--endpoint` CLI option for custom API endpoint (also reads `TRANSLOADIT_ENDPOINT` env var)
|
|
20
|
+
- Add `--single-assembly` flag to `assemblies create` for passing multiple input files to a single assembly
|
|
21
|
+
- Add `--concurrency` option to `assemblies create` to limit parallel processing (default: 5)
|
|
22
|
+
- Fix file descriptor exhaustion by closing streams immediately and creating fresh ones on demand
|
|
23
|
+
- Apply stricter biome lint rules (noExplicitAny, useAwait, noForEach, noNonNullAssertion)
|
|
24
|
+
|
|
5
25
|
## v4.0.7
|
|
6
26
|
|
|
7
27
|
Released: 2025-11-26.
|
package/README.md
CHANGED
|
@@ -42,7 +42,171 @@ or
|
|
|
42
42
|
npm install --save transloadit
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
##
|
|
45
|
+
## Command Line Interface (CLI)
|
|
46
|
+
|
|
47
|
+
This package includes a full-featured CLI for interacting with Transloadit from your terminal.
|
|
48
|
+
|
|
49
|
+
### Quick Start
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
# Set your credentials
|
|
53
|
+
export TRANSLOADIT_KEY="YOUR_TRANSLOADIT_KEY"
|
|
54
|
+
export TRANSLOADIT_SECRET="YOUR_TRANSLOADIT_SECRET"
|
|
55
|
+
|
|
56
|
+
# See all available commands
|
|
57
|
+
npx transloadit --help
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Processing Media
|
|
61
|
+
|
|
62
|
+
Create Assemblies to process files using Assembly Instructions (steps) or Templates:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# Process a file using a steps file
|
|
66
|
+
npx transloadit assemblies create --steps steps.json --input image.jpg --output result.jpg
|
|
67
|
+
|
|
68
|
+
# Process using a Template
|
|
69
|
+
npx transloadit assemblies create --template YOUR_TEMPLATE_ID --input image.jpg --output result.jpg
|
|
70
|
+
|
|
71
|
+
# Process with custom fields
|
|
72
|
+
npx transloadit assemblies create --template YOUR_TEMPLATE_ID --field size=100 --input image.jpg --output thumb.jpg
|
|
73
|
+
|
|
74
|
+
# Process a directory of files
|
|
75
|
+
npx transloadit assemblies create --template YOUR_TEMPLATE_ID --input images/ --output thumbs/
|
|
76
|
+
|
|
77
|
+
# Process recursively with file watching
|
|
78
|
+
npx transloadit assemblies create --template YOUR_TEMPLATE_ID --input images/ --output thumbs/ --recursive --watch
|
|
79
|
+
|
|
80
|
+
# Process multiple files in a single assembly
|
|
81
|
+
npx transloadit assemblies create --template YOUR_TEMPLATE_ID --input file1.jpg --input file2.jpg --output results/ --single-assembly
|
|
82
|
+
|
|
83
|
+
# Limit concurrent processing (default: 5)
|
|
84
|
+
npx transloadit assemblies create --template YOUR_TEMPLATE_ID --input images/ --output thumbs/ --concurrency 2
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Managing Assemblies
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# List recent assemblies
|
|
91
|
+
npx transloadit assemblies list
|
|
92
|
+
|
|
93
|
+
# List assemblies with filters
|
|
94
|
+
npx transloadit assemblies list --after 2024-01-01 --before 2024-12-31
|
|
95
|
+
|
|
96
|
+
# Get assembly status
|
|
97
|
+
npx transloadit assemblies get ASSEMBLY_ID
|
|
98
|
+
|
|
99
|
+
# Cancel an assembly
|
|
100
|
+
npx transloadit assemblies delete ASSEMBLY_ID
|
|
101
|
+
|
|
102
|
+
# Replay an assembly (re-run with original instructions)
|
|
103
|
+
npx transloadit assemblies replay ASSEMBLY_ID
|
|
104
|
+
|
|
105
|
+
# Replay with different steps
|
|
106
|
+
npx transloadit assemblies replay --steps new-steps.json ASSEMBLY_ID
|
|
107
|
+
|
|
108
|
+
# Replay using latest template version
|
|
109
|
+
npx transloadit assemblies replay --reparse-template ASSEMBLY_ID
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Managing Templates
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
# List all templates
|
|
116
|
+
npx transloadit templates list
|
|
117
|
+
|
|
118
|
+
# Get template content
|
|
119
|
+
npx transloadit templates get TEMPLATE_ID
|
|
120
|
+
|
|
121
|
+
# Create a template from a JSON file
|
|
122
|
+
npx transloadit templates create my-template template.json
|
|
123
|
+
|
|
124
|
+
# Modify a template
|
|
125
|
+
npx transloadit templates modify TEMPLATE_ID template.json
|
|
126
|
+
|
|
127
|
+
# Rename a template
|
|
128
|
+
npx transloadit templates modify TEMPLATE_ID --name new-name
|
|
129
|
+
|
|
130
|
+
# Delete a template
|
|
131
|
+
npx transloadit templates delete TEMPLATE_ID
|
|
132
|
+
|
|
133
|
+
# Sync local template files with Transloadit (bidirectional)
|
|
134
|
+
npx transloadit templates sync templates/*.json
|
|
135
|
+
npx transloadit templates sync --recursive templates/
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Billing
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# Get bill for a month
|
|
142
|
+
npx transloadit bills get 2024-01
|
|
143
|
+
|
|
144
|
+
# Get detailed bill as JSON
|
|
145
|
+
npx transloadit bills get 2024-01 --json
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Assembly Notifications
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
# Replay a notification
|
|
152
|
+
npx transloadit assembly-notifications replay ASSEMBLY_ID
|
|
153
|
+
|
|
154
|
+
# Replay to a different URL
|
|
155
|
+
npx transloadit assembly-notifications replay --notify-url https://example.com/hook ASSEMBLY_ID
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Signature Generation
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
# Generate a signature for assembly params
|
|
162
|
+
echo '{"steps":{}}' | npx transloadit auth signature
|
|
163
|
+
|
|
164
|
+
# Generate with specific algorithm
|
|
165
|
+
echo '{"steps":{}}' | npx transloadit auth signature --algorithm sha256
|
|
166
|
+
|
|
167
|
+
# Generate a signed Smart CDN URL
|
|
168
|
+
echo '{"workspace":"my-workspace","template":"my-template","input":"image.jpg"}' | npx transloadit auth smart-cdn
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### CLI Options
|
|
172
|
+
|
|
173
|
+
All commands support these common options:
|
|
174
|
+
|
|
175
|
+
- `--json, -j` - Output results as JSON (useful for scripting)
|
|
176
|
+
- `--log-level, -l` - Set log verbosity level by name or number (default: notice)
|
|
177
|
+
- `--endpoint` - Custom API endpoint URL (or set `TRANSLOADIT_ENDPOINT` env var)
|
|
178
|
+
- `--help, -h` - Show help for a command
|
|
179
|
+
|
|
180
|
+
The `assemblies create` command additionally supports:
|
|
181
|
+
|
|
182
|
+
- `--single-assembly` - Pass all input files to a single assembly instead of one assembly per file
|
|
183
|
+
|
|
184
|
+
#### Log Levels
|
|
185
|
+
|
|
186
|
+
The CLI uses [syslog severity levels](https://en.wikipedia.org/wiki/Syslog#Severity_level). Lower = more severe, higher = more verbose:
|
|
187
|
+
|
|
188
|
+
| Level | Value | Description |
|
|
189
|
+
| -------- | ----- | ------------------------------------- |
|
|
190
|
+
| `err` | 3 | Error conditions |
|
|
191
|
+
| `warn` | 4 | Warning conditions |
|
|
192
|
+
| `notice` | 5 | Normal but significant **(default)** |
|
|
193
|
+
| `info` | 6 | Informational messages |
|
|
194
|
+
| `debug` | 7 | Debug-level messages |
|
|
195
|
+
| `trace` | 8 | Most verbose/detailed |
|
|
196
|
+
|
|
197
|
+
You can use either the level name or its numeric value:
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
# Show only errors and warnings
|
|
201
|
+
npx transloadit assemblies list -l warn
|
|
202
|
+
npx transloadit assemblies list -l 4
|
|
203
|
+
|
|
204
|
+
# Show debug output
|
|
205
|
+
npx transloadit assemblies list -l debug
|
|
206
|
+
npx transloadit assemblies list -l 7
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## SDK Usage
|
|
46
210
|
|
|
47
211
|
The following code will upload an image and resize it to a thumbnail:
|
|
48
212
|
|
|
@@ -97,10 +261,12 @@ You can find [details about your executed Assemblies here](https://transloadit.c
|
|
|
97
261
|
|
|
98
262
|
- [Upload and resize image](https://github.com/transloadit/node-sdk/blob/main/examples/resize_an_image.ts)
|
|
99
263
|
- [Upload image and convert to WebP](https://github.com/transloadit/node-sdk/blob/main/examples/convert_to_webp.ts)
|
|
264
|
+
- [Rasterize SVG to PNG](https://github.com/transloadit/node-sdk/blob/main/examples/rasterize_svg_to_png.ts)
|
|
100
265
|
- [Crop a face out of an image and download the result](https://github.com/transloadit/node-sdk/blob/main/examples/face_detect_download.ts)
|
|
101
266
|
- [Retry example](https://github.com/transloadit/node-sdk/blob/main/examples/retry.ts)
|
|
102
267
|
- [Calculate total costs (GB usage)](https://github.com/transloadit/node-sdk/blob/main/examples/fetch_costs_of_all_assemblies_in_timeframe.ts)
|
|
103
268
|
- [Templates CRUD](https://github.com/transloadit/node-sdk/blob/main/examples/template_api.ts)
|
|
269
|
+
- [Template Credentials CRUD](https://github.com/transloadit/node-sdk/blob/main/examples/credentials.ts)
|
|
104
270
|
|
|
105
271
|
For more fully working examples take a look at [`examples/`](https://github.com/transloadit/node-sdk/blob/main/examples/).
|
|
106
272
|
|
|
@@ -116,6 +282,7 @@ Table of contents:
|
|
|
116
282
|
- [Assemblies](#assemblies)
|
|
117
283
|
- [Assembly notifications](#assembly-notifications)
|
|
118
284
|
- [Templates](#templates)
|
|
285
|
+
- [Template Credentials](#template-credentials)
|
|
119
286
|
- [Errors](#errors)
|
|
120
287
|
- [Rate limiting & auto retry](#rate-limiting--auto-retry)
|
|
121
288
|
|
|
@@ -301,6 +468,8 @@ This function will continously poll the specified Assembly `assemblyId` and reso
|
|
|
301
468
|
- `onAssemblyProgress` - A progress function called on each poll. See `createAssembly`
|
|
302
469
|
- `timeout` - How many milliseconds until polling times out (default: no timeout)
|
|
303
470
|
- `interval` - Poll interval in milliseconds (default `1000`)
|
|
471
|
+
- `signal` - An `AbortSignal` to cancel polling. When aborted, the promise rejects with an `AbortError`.
|
|
472
|
+
- `onPoll` - A callback invoked at the start of each poll iteration. Return `false` to stop polling early and resolve with the last known status. Useful for implementing custom cancellation logic (e.g., superseding assemblies in watch mode).
|
|
304
473
|
|
|
305
474
|
#### getLastUsedAssemblyUrl()
|
|
306
475
|
|
|
@@ -369,6 +538,34 @@ The method returns an object containing these properties:
|
|
|
369
538
|
|
|
370
539
|
Creates an `objectMode` `Readable` stream that automates handling of `listTemplates` pagination. Similar to `streamAssemblies`.
|
|
371
540
|
|
|
541
|
+
### Template Credentials
|
|
542
|
+
|
|
543
|
+
Template Credentials allow you to store third-party credentials (e.g., AWS S3, Google Cloud Storage, FTP) securely on Transloadit for use in your Assembly Instructions.
|
|
544
|
+
|
|
545
|
+
#### async createTemplateCredential(params)
|
|
546
|
+
|
|
547
|
+
Creates a new Template Credential. The `params` object should contain the credential configuration. See [API documentation](https://transloadit.com/docs/api/template-credentials-post/).
|
|
548
|
+
|
|
549
|
+
#### async editTemplateCredential(credentialId, params)
|
|
550
|
+
|
|
551
|
+
Updates an existing Template Credential identified by `credentialId`. See [API documentation](https://transloadit.com/docs/api/template-credentials-credential-id-put/).
|
|
552
|
+
|
|
553
|
+
#### async deleteTemplateCredential(credentialId)
|
|
554
|
+
|
|
555
|
+
Deletes the Template Credential identified by `credentialId`. See [API documentation](https://transloadit.com/docs/api/template-credentials-credential-id-delete/).
|
|
556
|
+
|
|
557
|
+
#### async getTemplateCredential(credentialId)
|
|
558
|
+
|
|
559
|
+
Retrieves the Template Credential identified by `credentialId`. See [API documentation](https://transloadit.com/docs/api/template-credentials-credential-id-get/).
|
|
560
|
+
|
|
561
|
+
#### async listTemplateCredentials(params)
|
|
562
|
+
|
|
563
|
+
Lists all Template Credentials. See [API documentation](https://transloadit.com/docs/api/template-credentials-get/).
|
|
564
|
+
|
|
565
|
+
#### streamTemplateCredentials(params)
|
|
566
|
+
|
|
567
|
+
Creates an `objectMode` `Readable` stream that automates handling of `listTemplateCredentials` pagination. Similar to `streamAssemblies`.
|
|
568
|
+
|
|
372
569
|
### Other
|
|
373
570
|
|
|
374
571
|
#### setDefaultTimeout(timeout)
|
|
@@ -385,25 +582,7 @@ Calculates a signature for the given `params` JSON object. If the `params` objec
|
|
|
385
582
|
|
|
386
583
|
This function returns an object with the key `signature` (containing the calculated signature string) and a key `params`, which contains the stringified version of the passed `params` object (including the set expires and authKey keys).
|
|
387
584
|
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
Generate a signed Smart CDN URL from the command line. The CLI reads a JSON object from stdin, injects credentials from `TRANSLOADIT_KEY`/`TRANSLOADIT_SECRET`, and prints the URL returned by `getSignedSmartCDNUrl()`.
|
|
391
|
-
|
|
392
|
-
```sh
|
|
393
|
-
TRANSLOADIT_KEY=... TRANSLOADIT_SECRET=... \
|
|
394
|
-
printf '{"workspace":"demo","template":"resize","input":"image.jpg","url_params":{"width":320}}' | npx transloadit smart_sig
|
|
395
|
-
```
|
|
396
|
-
|
|
397
|
-
You can also use `TRANSLOADIT_AUTH_KEY`/`TRANSLOADIT_AUTH_SECRET` as aliases for the environment variables.
|
|
398
|
-
|
|
399
|
-
#### CLI sig
|
|
400
|
-
|
|
401
|
-
Sign assembly params from the command line. The CLI reads a JSON object from stdin (or falls back to an empty object), injects credentials from `TRANSLOADIT_KEY`/`TRANSLOADIT_SECRET`, and prints the payload returned by `calcSignature()`. Use `--algorithm` to pick a specific hashing algorithm; it defaults to `sha384`.
|
|
402
|
-
|
|
403
|
-
```sh
|
|
404
|
-
TRANSLOADIT_KEY=... TRANSLOADIT_SECRET=... \
|
|
405
|
-
printf '{"auth":{"expires":"2025-01-02T00:00:00Z"}}' | npx transloadit sig --algorithm sha256
|
|
406
|
-
```
|
|
585
|
+
See [Signature Generation](#signature-generation) in the CLI section for command-line usage.
|
|
407
586
|
|
|
408
587
|
#### getSignedSmartCDNUrl(params)
|
|
409
588
|
|
|
@@ -495,7 +674,7 @@ If you want to retry on other errors, please see the [retry example code](exampl
|
|
|
495
674
|
This project uses [debug](https://github.com/visionmedia/debug) so you can run node with the `DEBUG=transloadit` evironment variable to enable verbose logging. Example:
|
|
496
675
|
|
|
497
676
|
```bash
|
|
498
|
-
DEBUG=transloadit*
|
|
677
|
+
DEBUG=transloadit* npx tsx examples/template_api.ts
|
|
499
678
|
```
|
|
500
679
|
|
|
501
680
|
## Maintainers
|
package/dist/ApiError.d.ts
CHANGED
package/dist/ApiError.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiError.d.ts","sourceRoot":"","sources":["../src/ApiError.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ApiError.d.ts","sourceRoot":"","sources":["../src/ApiError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,KAAK,CAAA;AAGvC,MAAM,WAAW,4BAA4B;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,qBAAa,QAAS,SAAQ,KAAK;IACxB,IAAI,SAAa;IAI1B,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb,UAAU,CAAC,EAAE,MAAM,CAAA;IAEnB,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf,cAAc,CAAC,EAAE,MAAM,CAAA;IAEvB,UAAU,CAAC,EAAE,MAAM,CAAA;IAEV,KAAK,CAAC,EAAE,YAAY,GAAG,SAAS,CAAA;gBAE7B,MAAM,EAAE;QAAE,KAAK,CAAC,EAAE,YAAY,CAAC;QAAC,IAAI,EAAE,4BAA4B,GAAG,SAAS,CAAA;KAAE;CAoB7F"}
|
package/dist/ApiError.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiError.js","sourceRoot":"","sources":["../src/ApiError.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ApiError.js","sourceRoot":"","sources":["../src/ApiError.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAU/B,MAAM,OAAO,QAAS,SAAQ,KAAK;IACxB,IAAI,GAAG,UAAU,CAAA;IAE1B,2GAA2G;IAC3G,oDAAoD;IACpD,IAAI,CAAS;IAEb,UAAU,CAAS;IAEnB,MAAM,CAAS;IAEf,cAAc,CAAS;IAEvB,UAAU,CAAS;IAEV,KAAK,CAA2B;IAEzC,YAAY,MAAgF;QAC1F,MAAM,EAAE,KAAK,EAAE,IAAI,GAAG,EAAE,EAAE,GAAG,MAAM,CAAA;QAEnC,MAAM,KAAK,GAAG,CAAC,WAAW,CAAC,CAAA;QAC3B,IAAI,KAAK,YAAY,SAAS,IAAI,KAAK,EAAE,QAAQ,CAAC,UAAU;YAC1D,KAAK,CAAC,IAAI,CAAC,SAAS,KAAK,CAAC,QAAQ,CAAC,UAAU,GAAG,CAAC,CAAA;QACnD,IAAI,IAAI,CAAC,KAAK;YAAE,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,CAAA;QAC5C,IAAI,IAAI,CAAC,OAAO;YAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAC1C,IAAI,IAAI,CAAC,gBAAgB;YAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAA;QAE5D,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QAE/B,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,OAAO,CAAA;QAC9B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;QACzB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,WAAW,CAAA;QAClC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,gBAAgB,CAAA;QAC3C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAA;QACtB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;CACF"}
|
package/dist/Transloadit.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Readable } from 'node:stream';
|
|
2
|
-
import {
|
|
2
|
+
import type { RetryOptions } from 'got';
|
|
3
3
|
import { type Input as IntoStreamInput } from 'into-stream';
|
|
4
4
|
import { ApiError } from './ApiError.ts';
|
|
5
|
-
import {
|
|
5
|
+
import type { AssemblyIndexItem, AssemblyStatus } from './alphalib/types/assemblyStatus.ts';
|
|
6
6
|
import type { BaseResponse, BillResponse, CreateAssemblyParams, CreateTemplateCredentialParams, CreateTemplateParams, EditTemplateParams, ListAssembliesParams, ListedTemplate, ListTemplateCredentialsParams, ListTemplatesParams, OptionalAuthParams, PaginationListWithCount, ReplayAssemblyNotificationParams, ReplayAssemblyNotificationResponse, ReplayAssemblyParams, ReplayAssemblyResponse, TemplateCredentialResponse, TemplateCredentialsResponse, TemplateResponse } from './apiTypes.ts';
|
|
7
7
|
import InconsistentResponseError from './InconsistentResponseError.ts';
|
|
8
8
|
import PaginationStream from './PaginationStream.ts';
|
|
@@ -30,12 +30,28 @@ export interface CreateAssemblyOptions {
|
|
|
30
30
|
onUploadProgress?: (uploadProgress: UploadProgress) => void;
|
|
31
31
|
onAssemblyProgress?: AssemblyProgress;
|
|
32
32
|
assemblyId?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Optional AbortSignal to cancel the assembly creation and upload.
|
|
35
|
+
* When aborted, any in-flight HTTP requests and TUS uploads will be cancelled.
|
|
36
|
+
*/
|
|
37
|
+
signal?: AbortSignal;
|
|
33
38
|
}
|
|
34
39
|
export interface AwaitAssemblyCompletionOptions {
|
|
35
40
|
onAssemblyProgress?: AssemblyProgress;
|
|
36
41
|
timeout?: number;
|
|
37
42
|
interval?: number;
|
|
38
43
|
startTimeMs?: number;
|
|
44
|
+
/**
|
|
45
|
+
* Optional AbortSignal to cancel polling.
|
|
46
|
+
* When aborted, the polling loop will stop and throw an AbortError.
|
|
47
|
+
*/
|
|
48
|
+
signal?: AbortSignal;
|
|
49
|
+
/**
|
|
50
|
+
* Optional callback invoked before each poll iteration.
|
|
51
|
+
* Return `false` to stop polling early and return the current assembly status.
|
|
52
|
+
* Useful for watch mode where a newer job may supersede the current one.
|
|
53
|
+
*/
|
|
54
|
+
onPoll?: () => boolean | undefined;
|
|
39
55
|
}
|
|
40
56
|
export interface SmartCDNUrlOptions {
|
|
41
57
|
/**
|
|
@@ -91,7 +107,7 @@ export declare class Transloadit {
|
|
|
91
107
|
* @param opts assembly options
|
|
92
108
|
*/
|
|
93
109
|
createAssembly(opts?: CreateAssemblyOptions): CreateAssemblyPromise;
|
|
94
|
-
awaitAssemblyCompletion(assemblyId: string, { onAssemblyProgress, timeout, startTimeMs, interval, }?: AwaitAssemblyCompletionOptions): Promise<AssemblyStatus>;
|
|
110
|
+
awaitAssemblyCompletion(assemblyId: string, { onAssemblyProgress, timeout, startTimeMs, interval, signal, onPoll, }?: AwaitAssemblyCompletionOptions): Promise<AssemblyStatus>;
|
|
95
111
|
maybeThrowInconsistentResponseError(message: string): void;
|
|
96
112
|
/**
|
|
97
113
|
* Cancel the assembly
|
|
@@ -128,9 +144,12 @@ export declare class Transloadit {
|
|
|
128
144
|
* Get an Assembly
|
|
129
145
|
*
|
|
130
146
|
* @param assemblyId the Assembly Id
|
|
147
|
+
* @param options optional request options
|
|
131
148
|
* @returns the retrieved Assembly
|
|
132
149
|
*/
|
|
133
|
-
getAssembly(assemblyId: string
|
|
150
|
+
getAssembly(assemblyId: string, options?: {
|
|
151
|
+
signal?: AbortSignal;
|
|
152
|
+
}): Promise<AssemblyStatus>;
|
|
134
153
|
/**
|
|
135
154
|
* Create a Credential
|
|
136
155
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Transloadit.d.ts","sourceRoot":"","sources":["../src/Transloadit.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"Transloadit.d.ts","sourceRoot":"","sources":["../src/Transloadit.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAI3C,OAAO,KAAK,EAA8C,YAAY,EAAE,MAAM,KAAK,CAAA;AAEnF,OAAmB,EAAE,KAAK,KAAK,IAAI,eAAe,EAAE,MAAM,aAAa,CAAA;AAKvE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,KAAK,EAEV,iBAAiB,EACjB,cAAc,EACf,MAAM,oCAAoC,CAAA;AAG3C,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,oBAAoB,EACpB,8BAA8B,EAC9B,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,EACd,6BAA6B,EAC7B,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,EACvB,gCAAgC,EAChC,kCAAkC,EAClC,oBAAoB,EACpB,sBAAsB,EACtB,0BAA0B,EAC1B,2BAA2B,EAC3B,gBAAgB,EACjB,MAAM,eAAe,CAAA;AACtB,OAAO,yBAAyB,MAAM,gCAAgC,CAAA;AACtE,OAAO,gB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