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
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -85,7 +85,7 @@ Only maintainers can make releases. Releases to [npm](https://www.npmjs.com) are
85
85
86
86
1. Update the version using Yarn, e.g. `yarn version patch` (n.b. use `yarn version prerelease` for pre-releases). This will update the version in the `package.json` file.
87
87
2. Commit the changes to the `package.json` file.
88
-
3. Create a new Git tag, e.g. `git tag v4.0.0-6`.
88
+
3. Create a new Git tag, e.g. `git tag v4.0.0-6` (add the `v`!).
89
89
4. Push the tag to GitHub: `git push origin main --tags`
90
90
5. If the tests pass, GitHub actions will now publish the new version to npm.
91
91
6. When successful add [release notes](https://github.com/transloadit/node-sdk/releases).
This guide summarizes key changes and migration steps from SDK v3.x to v4.x, focusing on enhanced type safety, improved error handling, and Zod schema validation.
4
+
5
+
## Key Changes in v4.x
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.
14
+
15
+
## Migration Steps
16
+
17
+
### 1. Assembly Creation (`createAssembly`)
18
+
19
+
- Parameters are strictly validated against `assemblyInstructionsSchema`.
20
+
- Incorrect Robot names, parameters, or types now cause immediate client-side errors or detailed API errors.
21
+
22
+
**Migration Steps:**
23
+
24
+
- Review and update all `createAssembly` calls to match the schema.
- 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.
78
+
79
+
## Closing Thoughts
80
+
81
+
Transloadit is retrofitting types on an 15 year old codebase. The path we chose is to:
82
+
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
87
+
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.
89
+
90
+
Please Test your integration thoroughly after upgrading. For issues or unexpected behavior, consult the SDK documentation or raise an issue.
0 commit comments