Summary
pryv@3.5.0 adds a module-level connectFromKey helper and Service#connectFromKey for the new key-based auth-flow handoff, but neither declaration is present in src/index.d.ts. TypeScript consumers calling the documented migration helper hit:
error TS2339: Property 'connectFromKey' does not exist on type 'typeof import("pryv")'.
Reproduction
import pryv from 'pryv'
// Documented 3.5.0 migration recipe
const connection = await pryv.connectFromKey(state.key, serviceInfoUrl)
// ^ TS2339
Service form:
const service = new pryv.Service(serviceInfoUrl)
await service.connectFromKey(key)
// ^ also TS2339 — Service interface in src/index.d.ts is missing the method
Evidence the function exists at runtime
src/index.js:30 — re-exports connectFromKey from the module
src/index.js:46-50 — definition: async function connectFromKey(key, serviceInfoUrl, serviceCustomizations) returning a Connection built via a transient Service
src/Service.js:540-552 — Service.prototype.connectFromKey(key)
test/Service.accessRequest.test.js:41+ — [CFKX] Service.connectFromKey test suite confirms the public-API intent
Suggested fix
Add to src/index.d.ts:
declare module 'pryv' {
/**
* Module-level convenience over `Service#connectFromKey`. Resolves the
* service-info URL, instantiates a transient `Service`, and returns a
* working `Connection` for the granted access.
*/
export function connectFromKey(
key: string,
serviceInfoUrl?: string,
serviceCustomizations?: unknown
): Promise<Connection>;
interface Service {
connectFromKey(key: string): Promise<Connection>;
}
}
Until upstream lands the type, downstream consumers can augment locally. hds-lib (a downstream wrapper around pryv) has applied this workaround at https://github.com/healthdatasafe/hds-lib-js/blob/1.1.1/ts/patchedPryv.ts — referenced for context.
Impact
Affects every TypeScript consumer following the 3.5.0 AUTHORIZED-state migration recipe. Runtime behavior is fine; the symptom is purely a tsc --noEmit failure.
Environment
pryv@3.5.0 (installed via npm, latest as of 2026-06-02)
- TypeScript
5.7+
- Verified across three independent consumers (apps in our workspace)
Summary
pryv@3.5.0adds a module-levelconnectFromKeyhelper andService#connectFromKeyfor the new key-based auth-flow handoff, but neither declaration is present insrc/index.d.ts. TypeScript consumers calling the documented migration helper hit:Reproduction
Service form:
Evidence the function exists at runtime
src/index.js:30— re-exportsconnectFromKeyfrom the modulesrc/index.js:46-50— definition:async function connectFromKey(key, serviceInfoUrl, serviceCustomizations)returning aConnectionbuilt via a transientServicesrc/Service.js:540-552—Service.prototype.connectFromKey(key)test/Service.accessRequest.test.js:41+—[CFKX] Service.connectFromKeytest suite confirms the public-API intentSuggested fix
Add to
src/index.d.ts:Until upstream lands the type, downstream consumers can augment locally.
hds-lib(a downstream wrapper around pryv) has applied this workaround at https://github.com/healthdatasafe/hds-lib-js/blob/1.1.1/ts/patchedPryv.ts — referenced for context.Impact
Affects every TypeScript consumer following the
3.5.0AUTHORIZED-state migration recipe. Runtime behavior is fine; the symptom is purely atsc --noEmitfailure.Environment
pryv@3.5.0(installed vianpm, latest as of 2026-06-02)5.7+