workos-node
workos-node copied to clipboard
Release v8.0.0: Universal Runtime Support & API Modernization
Overview
Version 8 is a major release focused on universal runtime compatibility and API modernization. The SDK now works seamlessly across Node.js, Deno, Bun, and Cloudflare Workers while removing long-deprecated APIs.
๐ด BREAKING CHANGES
Runtime & Build System
1. Node.js Version Requirement (BREAKING)
- Changed: Minimum Node.js version:
16โ20 - Reason: Node 18 reached end-of-life in April 2025
- Files:
package.json(engines.node) - Migration: Update to Node.js 20 or higher
2. Package Type Change to ESM-First (BREAKING)
- Changed:
package.jsonnow includes"type": "module" - Impact: The package is now ESM-first with dual CJS/ESM exports
- Files:
package.json - Migration: Most users won't need changes due to conditional exports, but projects with custom build configurations may need adjustments
3. Build System Migration (Internal)
- Changed: Migrated from
tsctotsupfor building - Added:
tsup.config.tsconfiguration - Removed:
tslint.json - Impact: Better bundle output, improved tree-shaking, cleaner dist files
Removed Internal Classes (BREAKING)
4. HTTP Client Removal (BREAKING)
- Removed:
NodeHttpClientclass andcreateHttpClient()method - Files:
src/common/net/node-client.ts(deleted) - Impact: Only affects deep imports into internal modules (never part of public API)
- Migration: Use
WorkOSinstance instead - HTTP is handled automatically
5. Crypto Provider Removal (BREAKING)
- Removed:
NodeCryptoProvider,IronSessionProvider,EdgeIronSessionProvider,WebIronSessionProvider - Changed: Now using
iron-sessionlibrary directly (sealData/unsealData) - Files:
src/common/crypto/node-crypto-provider.ts(deleted),src/common/iron-session/*(deleted) - Impact: Only affects deep imports into internal modules
- Migration: Use
WorkOSinstance methods - crypto is handled automatically
Directory Sync (BREAKING)
6. DirectoryUser Interface Changes (BREAKING)
- Removed fields:
emailsโ UsecustomAttributes.emailsusernameโ UsecustomAttributes.usernamejobTitleโ UsecustomAttributes.jobTitle
- Removed utility:
getPrimaryEmail()function - Files:
src/directory-sync/interfaces/directory-user.interface.ts,src/directory-sync/utils/get-primary-email.ts(deleted) - Migration:
// v7 user.emails user.username user.jobTitle // v8 user.customAttributes?.emails user.customAttributes?.username user.customAttributes?.jobTitle
User Management (BREAKING)
7. AuthorizationURLOptions Changes (BREAKING)
- Removed:
contextfield (no longer supported) - Files:
src/user-management/interfaces/authorization-url-options.interface.ts - Migration: Remove the
contextparameter from authorization URL calls
8. Removed Deprecated Methods (BREAKING)
- Removed:
sendMagicAuthCode()โ UseuserManagement.sendMagicCode()insteadsendPasswordResetEmail()โ UseuserManagement.sendPasswordResetEmail()insteadrefreshAndSealSessionData()โ Use new session helper methods instead
- Files:
src/user-management/user-management.ts, serializers removed
SSO (BREAKING)
9. SSOAuthorizationURLOptions Type Changes (BREAKING)
- Changed: Converted to discriminated union for type safety
- Removed:
domainfield (deprecated) - Files:
src/sso/interfaces/authorization-url-options.interface.ts - Impact: Stricter TypeScript types - must now specify exactly one of:
connection,organization, orprovider - Migration:
// v7 - Multiple options allowed { connection: 'conn_123', organization: 'org_456' } // Both accepted // v8 - Mutually exclusive (enforced by types) { connection: 'conn_123' } // OR { organization: 'org_456' } // OR { provider: 'GoogleOAuth' }
10. Connection Interface (BREAKING)
- Removed: Several deprecated internal fields
- Files:
src/sso/interfaces/connection.interface.ts - Migration: Use only documented fields
MFA (BREAKING)
11. Method Removal (BREAKING)
- Removed:
verifyFactor()method - Files:
src/mfa/mfa.ts,src/mfa/interfaces/verify-factor-options.ts(deleted) - Migration: Use
verifyChallenge()instead (same functionality)// v7 await workos.mfa.verifyFactor({ authenticationFactorId, code }); // v8 await workos.mfa.verifyChallenge({ authenticationFactorId, code });
Organizations (BREAKING)
12. Organization Options Changes (BREAKING)
- Removed from CreateOrganizationOptions and UpdateOrganizationOptions:
allowProfilesOutsideOrganizationdomains(usedomainDatainstead)
- Files:
src/organizations/interfaces/*.interface.ts - Migration: Remove these fields from organization creation/update calls
13. Organization Domain Enum (BREAKING)
- Removed:
LegacyVerifiedfromOrganizationDomainStateenum - Files:
src/organizations/interfaces/organization-domain.interface.ts - Migration: Use
Verifiedinstead
Events (BREAKING)
14. Event Type Removals (BREAKING)
- Removed event interfaces:
DsyncDeactivatedEventโ Usedsync.deletedinsteadOrganizationMembershipAddedโ Not applicable in v8OrganizationMembershipRemovedโ Not applicable in v8
- Files:
src/common/interfaces/event.interface.ts - Migration:
// v7 if (event.event === 'dsync.deactivated') { } // v8 if (event.event === 'dsync.deleted') { }
Vault (BREAKING)
15. Removed Deprecated Method Aliases (BREAKING)
- Removed methods:
createSecret()โ UsecreateObject()insteadlistSecrets()โ UselistObjects()insteadlistSecretVersions()โ UselistObjectVersions()insteadreadSecret()โ UsereadObject()insteaddescribeSecret()โ UsedescribeObject()insteadupdateSecret()โ UseupdateObject()insteaddeleteSecret()โ UsedeleteObject()instead
- Files:
src/vault/vault.ts - Migration: Replace all
*Secretmethods with*Objectequivalents
โ NEW FEATURES
16. Client API for PKCE Flows (NON-BREAKING)
- Added: New
@workos-inc/node/clientexport for client-side operations without API key - Files:
src/client/*,src/index.client.ts - Use case: Browser-based PKCE flows, public client operations
- Example:
import * as userManagement from '@workos-inc/node/client'; const url = userManagement.getAuthorizationUrl({ clientId: 'client_123', redirectUri: 'https://example.com/callback', provider: 'authkit', });
17. Universal Runtime Support (NON-BREAKING)
- Improved: Better support for Deno, Bun, and Cloudflare Workers
- Added: Conditional exports in package.json for runtime-specific entry points
- Files:
package.json(exports),src/index.worker.ts - Example:
// Cloudflare Workers import { WorkOS } from '@workos-inc/node/worker'; // Deno import { WorkOS } from 'npm:@workos-inc/node'; // Bun (same as Node.js) import { WorkOS } from '@workos-inc/node';
18. Environment Variable Helper (NON-BREAKING)
- Added: Internal
getEnv()helper for better cross-runtime environment variable access - Files:
src/common/utils/env.ts - Benefit: Works consistently across Node.js, Deno, Cloudflare Workers, etc.
19. Pagination Improvements (NON-BREAKING)
- Changed:
AutoPaginatablenow properly defaultsPaginationOptionsgeneric parameter - Files:
src/common/utils/pagination.ts - Benefit: Better TypeScript inference and type safety
๐ง INTERNAL IMPROVEMENTS
20. Linting Migration (Internal)
- Changed: Migrated from TSLint to ESLint with flat config
- Added:
eslint.config.mjs - Removed:
tslint.json - Impact: Better code quality checks, modern linting setup
21. Runtime Testing (Internal)
- Added: New GitHub Actions workflow for testing across multiple runtimes
- Added: Ecosystem check script (
scripts/ecosystem-check.ts) - Files:
.github/workflows/runtime-tests.yml - Benefit: Ensures SDK works correctly in all supported runtimes
22. Dependency Updates (Internal)
- Updated: All dependencies to latest compatible versions
- Updated: Development tooling (Jest 30, TypeScript 5.9, etc.)
- Files:
package.json,package-lock.json
23. Test Infrastructure (Internal)
- Updated: Jest configuration migrated to CommonJS
- Added: Jest ESM transform
- Files:
jest.config.cjs,jest-transform-esm.cjs - Updated: Worker test environment with latest Miniflare
๐ Files Changed Summary
- 104 files changed: 9,161 insertions, 3,879 deletions
- Major additions: Client API module, runtime-specific exports, environment helper
- Major deletions: Internal HTTP/crypto providers, deprecated methods, legacy event types
- Configuration: New build system (tsup), new linting (ESLint), updated Jest
๐ Migration Guide
See V8_MIGRATION_GUIDE.md for detailed migration instructions.
Note: The migration guide needs minor updates for:
- Package type change to ESM-first
- SSO AuthorizationURLOptions discriminated union
- Vault method aliases removal
- Complete refreshAndSealSessionData() examples
๐งช Testing
- โ All existing tests updated and passing
- โ Runtime compatibility tests added
- โ Worker environment tests updated
- โ Ecosystem check script validates multi-runtime support
Since you're going for dual ESM/CJS, you might want to check "are the types wrong". For example: https://arethetypeswrong.github.io/?p=%40workos-inc%2Fnode%408.0.0-rc.2
[!WARNING] Review the following alerts detected in dependencies.
According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
| Action | Severity | Alert โ(click "โถ" to expand/collapse) |
|---|---|---|
| Warn | High CVE: npm
|
|
| Warn | High CVE: npm
|
Coana detected 1 new reachable vulnerability in this pull request. Please review the vulnerability below and take appropriate action before merging the PR.
Vulnerability: CVE-2025-64756
Type: Not previously seen vulnerability
Title: glob CLI: Command injection via -c/--cmd executes matches with shell:true
Severity: high
Package: glob
Affected workspace(s): .
Affected version(s): >=10.2.0 <10.5.0 || >=11.0.0 <11.1.0
Patched version(s):
Installed version(s): 10.4.5
Reachability: Undeterminable reachability
Detailed description: The vulnerability is only exposed in the Glob CLI. If you just use Glob programatically as a library, you are not exposed to the vulnerability.
To ignore this vulnerability add a comment with /coana_ignore GHSA-5j98-mcp5-4vw2 and restart the workflow.
This comment was automatically inserted by the Coana Guardrail check (Learn more)