You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This guide summarizes key changes and migration steps from SDK v3.x to v4.x, focusing on enhanced typesafety, improved error handling, and Zod schema validation.
3
+
v4 focuses on type-safety, clearer errors, and modern Node support. Most changes are mechanical.
4
4
5
-
## Key Changes in v4.x
5
+
## Breaking changes (quick scan)
6
6
7
-
- Renamed `TransloaditClient` to `Transloadit`
8
-
- Use named export for `Transloadit`, instead of default export.
9
-
- Dropped support for Node.js < 20.
10
-
-**Type Safety with Zod:** Assembly creation parameters and API responses are now validated using Zod schemas, providing accurate TypeScript types and IDE autocompletion. The main benefit for customers is less trips to the documentation as they are typing Assembly Instructions. Robot names and their available parameters are now all autocompleted.
11
-
-**Improved Error Reporting:** Clearer client-side and API errors (`ApiError`, `InconsistentResponseError`) help quickly identify issues.
12
-
-**Exported Schemas and Types:** Core schemas (`assemblyInstructionsSchema`, `assemblyStatusSchema`, etc.) and inferred types (`AssemblyInstructionsInput`, `AssemblyIndexItem`) are exported for reuse.
13
-
-**Modernized Codebase:** Fully transitioned to TypeScript, removing manual `.d.ts` files.
- New custom errors (`ApiError`, `InconsistentResponseError`, `PollingTimeoutError`).
70
-
- Modernized build system and testing (`vitest`).
71
-
- Make sure you are on Node.js 20 or higher.
72
-
73
-
## Benefits of Upgrading
74
-
75
-
-**Increased Reliability:** Early detection of errors through schema validation.
76
-
-**Improved Developer Experience:** Accurate types and autocompletion reduce guesswork.
77
-
-**Clearer Diagnostics:** Specific errors pinpoint exact issues.
46
+
4. Run your code on **Node 20+**.
78
47
79
-
## Closing Thoughts
48
+
## Why upgrade?
80
49
81
-
Transloadit is retrofitting types on an 15 year old codebase. The path we chose is to:
50
+
- IDE autocomplete for every Robot & parameter, as well as the API response
51
+
- Local schema validation catches mistakes before the request
52
+
- Improved error objects simplify debugging
82
53
83
-
1. create schemas that model closely what the API currently outputs, and allows as inputs
84
-
2. roll out the schemas in clients, and our test suite, even though they are not as narrow as we would like yet
85
-
3. gradually narrow the schemas, our test suite will raise red flags, so we can adjust the API (unless it would break backwards compatibility)
86
-
4. we rinse and repeat, until our API is as narrow as we like our schemas/types to be
54
+
## Heads-up
87
55
88
-
We are currently at step 2, this means you'll find fairly wide types, but at least they do not lie, so that you should be able to build your integration on them without runtime type errors.
56
+
Schemas are still bit wider than we would like as the first priority when retrofitting our API with schemas/types, was modeling its behavior exactly, or we'd risk the types being a lie, and hence runtime type errors.
89
57
90
-
Please Test your integration thoroughly after upgrading. For issues or unexpected behavior, consult the SDK documentation or raise an issue.
58
+
We'll also outfit our API's testsuite with these schemas, and this will allow us to gradually, over time, narrow what our API can respond, along with the schemas.
0 commit comments