Releases: junction-api/junction-typescript
1.01
1.0.0
Changelog
Major release and a migration from tryVital/vital-node@3.1.544
Breaking changes
-
Package renamed: @tryvital/vital-node to @junction-api/sdk -
The published npm package has been renamed from@tryvital/vital-nodeto@junction-api/sdk. Uninstall the old package and install the new one. This is a replacement, not a version bump — there is no overlap window where both packages publish the same release. After installing the new package, update every import to point at@junction-api/sdkand update the imported symbols per the rename sections below. -
Error classes renamed: VitalError to JunctionError, VitalTimeoutError to JunctionTimeoutError -
The thrown error classes have been renamed. Updatecatchblocks andinstanceofchecks:VitalErroris nowJunctionError, andVitalTimeoutErroris nowJunctionTimeoutError. Both are still re-exported from the package root. -
Namespace export renamed: Vital to Junction -
The package's namespace alias has changed fromVitaltoJunction. Code that doesimport { Vital } from "@tryvital/vital-node"(orimport * as Vital from ...) and references types asVital.SomeTypemust switch toJunctionandJunction.SomeType. -
Server base URLs replaced (Environment enum also renamed) -
The SDK's server base URLs have been replaced as part of the rebrand:api.tryvital.iois nowapi.us.junction.comapi.eu.tryvital.iois nowapi.eu.junction.comapi.sandbox.tryvital.iois nowapi.sandbox.us.junction.comapi.sandbox.eu.tryvital.iois nowapi.sandbox.eu.junction.com
If you pass an environment value through the
VitalEnvironmentenum (nowJunctionEnvironment), the new URL is picked up automatically once you switch to the renamed enum (e.g.JunctionEnvironment.Production). If you pass a literal URL string into the clientenvironmentoption, you must update the string yourself. -
Top-level client class renamed: VitalClient to JunctionClient -
The default exported client class has been renamed fromVitalClienttoJunctionClient. Update everynew VitalClient(...)construction site and every type annotation that referencesVitalClient. -
Path parameters are now inline on the request object -
Methods that previously accepted a positional path-parameter argument followed by a request object now take a single request object containing the path-parameter fields. For example,client.labTests.bookPhlebotomyAppointment("order_id", { bookingKey: "..." })becomesclient.labTests.bookPhlebotomyAppointment({ orderId: "order_id", body: { bookingKey: "..." } }). Methods that already took only a request object are unaffected. -
Per-endpoint request types renamed to read verb-first -
Generated per-endpoint request interface names have been reordered so the verb leads, e.g.LabTestsGetOrdersRequestis nowGetOrdersLabTestsRequestandLabTestsGetRequestis nowGetLabTestsRequest. Most callers pass an object literal and never name these types, but if you import them for explicit type annotations on helper functions, you must update the type names. -
File-download responses return a Web Response wrapper -
Endpoints that download binary content (PDFs, raw lab files) now resolve to acore.BinaryResponseobject with Web-platform methods:arrayBuffer(),blob(),bytes(), andstream()(which returns a WebReadableStream). Code that previously called.pipe(),.toString(), or otherwise treated the body as a NodeBufferorReadablemust read it through one of these methods. -
Node 18+ required at runtime -
The SDK now relies on the platform's nativefetchandFormDataglobals. Node 16 and earlier are no longer supported. The previously bundlednode-fetchruntime dependency and the Node-16 multipart shim have been removed. If you run on Node 16, upgrade to Node 18 LTS (or newer) before adopting this release.
New & improved
-
New top-level resources: lab accounts, order transactions, compendium search
The SDK now exposes three new top-level resource modules:client.labAccount— read your team's lab accounts (getTeamLabAccounts).client.orderTransaction— fetch the consolidated order-transaction view (getTransaction).client.compendium— convert and search lab-test compendium entries (convert,search).
Accompanying model types appear under the namespace export (
Junction.ClientFacingLabAccount,Junction.ClientFacingOrderTransaction,Junction.ConvertCompendiumResponse, etc.). See the API reference for endpoint details. -
Inline anonymous types in method signatures -
Method signatures and IDE hovers now show inline object types instead of named imports for many anonymous shapes. The named types are still exported, so existing imports continue to compile; the change is mostly visible when reading hover docs. -
Raw response shapes formalized —
*V2InDBtypes are now*Raw
Endpoints whose responses were previously typed as*V2InDBnow use*Rawtypes. The values are unchanged; only the type names differ:ActivityV2InDB→RawActivityBodyV2InDB→RawBodyDeviceV2InDB→RawDevicesSleepV2InDB→RawSleepWorkoutV2InDB→RawWorkout
If you imported one of the old names directly, switch to the new
Raw*type. -
Client-scoped passthrough fetch
The client now exposes afetchmethod that proxies a Web-style fetch call through the same auth provider, base URL, and default headers configured on the client. Use it to call endpoints the SDK does not yet model, without re-implementing auth and URL handling.const res = await client.fetch("/v3/some/new/endpoint", { method: "GET" }); const data = await res.json();
-
Optional fields now reflect API nullability -
Fields that the API marks as nullable are now typed as nullable/optional in TypeScript, matching what you actually receive on the wire. Existing code that already accounted for missing fields keeps working; code that assumed non-nullable values may need a guard or non-null assertion in places where the new typing surfaces a possiblenull. -
Corepack-aware packageManager field
The publishedpackage.jsondeclarespackageManager: pnpm@10.x. Repos using Corepack will automatically switch to pnpm when running scripts in this package's directory. Consumers using npm or yarn directly remain unaffected; CI configs that pin a specific package manager via Corepack enforcement may need to opt out for this dependency.
Removed
-
Public types removed -
Three top-level public types were removed from the SDK with no equivalent. If you imported any of these, drop the import:AuthType— was used by the legacyemail_authflow only.ManualProviders— was the parameter type for the now-removedconnectManualProvidermethod (one of the legacy link methods, see above). With that method gone, this enum is removed too.ClientFacingUserKey— the endpoint that used to return this model now returnsClientFacingUserinstead. If you depended on the user-key shape, switch to reading the user fields offClientFacingUserdirectly.
-
Legacy link methods removed -
These six methods have been deprecated for over two years and were never part of the documented Junction Link integration path; they should not have been in the SDK in the first place. They are removed in this release:emailAuthpasswordAuthstartConnectconnectManualProvidertokenStateisTokenValid
If you have call sites referencing these methods, see the Junction Link API reference for the documented integration path. The supporting request/body classes that backed them are also removed.
The supporting request/body classes that backed these methods are also removed:
BeginLinkTokenRequest,EmailAuthLink,PasswordAuthLink,LinkTokenValidationRequest,ManualConnectionData.