@insureco/bio 0.5.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -35,6 +35,15 @@ interface AuthorizeOptions {
35
35
  /** Optional org slug to pre-select during authorization (for multi-org users) */
36
36
  organization?: string;
37
37
  }
38
+ /** Options for silent authentication (prompt=none) */
39
+ interface SilentAuthOptions {
40
+ /** Callback URL where Bio-ID redirects after silent auth */
41
+ redirectUri: string;
42
+ /** OAuth scopes to request (default: ['openid', 'profile', 'email']) */
43
+ scopes?: string[];
44
+ /** CSRF state parameter (auto-generated if not provided) */
45
+ state?: string;
46
+ }
38
47
  /** Result from getAuthorizationUrl() */
39
48
  interface AuthorizeResult {
40
49
  /** Full authorization URL to redirect the user to */
@@ -266,19 +275,32 @@ interface OrgMemberFilters {
266
275
  modules?: string[];
267
276
  /** Only return members with these roles */
268
277
  roles?: string[];
278
+ /** Service ID for role-taxonomy resolution (e.g. 'iifs-collections') */
279
+ service?: string;
269
280
  /** Max results (default: 50) */
270
281
  limit?: number;
271
282
  /** Page number for pagination (default: 1) */
272
283
  page?: number;
273
284
  }
285
+ /** A role within a service's taxonomy, resolved when querying with `service` filter */
286
+ interface ServiceRole {
287
+ /** Role ID within the service taxonomy (e.g. 'collections:manager') */
288
+ id: string;
289
+ /** Human-readable label (e.g. 'Collections Manager') */
290
+ label: string;
291
+ }
274
292
  /** A member as returned by GET /api/v2/users or GET /api/orgs/[slug]/members */
275
293
  interface OrgMember {
276
294
  bioId: string;
277
295
  email: string;
278
296
  name: string;
297
+ /** Which org this user belongs to */
298
+ orgSlug?: string;
279
299
  jobTitle?: string;
280
300
  enabled_modules: string[];
281
301
  roles?: string[];
302
+ /** Roles within the querying service's taxonomy (present when `service` filter is used) */
303
+ serviceRoles?: ServiceRole[];
282
304
  }
283
305
  /** Paginated response from the user access endpoints */
284
306
  interface OrgMembersResult {
@@ -298,5 +320,99 @@ interface AdminResponse<T> {
298
320
  limit: number;
299
321
  };
300
322
  }
323
+ /** Configuration for EmbedClient (headless embed auth) */
324
+ interface EmbedClientConfig {
325
+ /** OAuth client ID (env: BIO_CLIENT_ID) */
326
+ clientId: string;
327
+ /** OAuth client secret (env: BIO_CLIENT_SECRET) */
328
+ clientSecret: string;
329
+ /** Bio-ID base URL (env: BIO_ID_URL, default: https://bio.tawa.pro) */
330
+ bioIdUrl?: string;
331
+ /** Number of retry attempts on transient failures (default: 2) */
332
+ retries?: number;
333
+ /** Request timeout in milliseconds (default: 10000) */
334
+ timeoutMs?: number;
335
+ }
336
+ /** Parameters for embed login */
337
+ interface EmbedLoginParams {
338
+ /** User email address */
339
+ email: string;
340
+ /** User password */
341
+ password: string;
342
+ }
343
+ /** Parameters for embed signup */
344
+ interface EmbedSignupParams {
345
+ /** User email address */
346
+ email: string;
347
+ /** User password */
348
+ password: string;
349
+ /** Display name */
350
+ name: string;
351
+ /** Optional invite token for org-scoped signups */
352
+ inviteToken?: string;
353
+ }
354
+ /** Parameters for sending a magic link */
355
+ interface EmbedMagicLinkParams {
356
+ /** Email address to send the magic link to */
357
+ email: string;
358
+ }
359
+ /** Parameters for verifying a magic link token */
360
+ interface EmbedVerifyParams {
361
+ /** Magic link token from the email */
362
+ token: string;
363
+ }
364
+ /** Parameters for refreshing an access token */
365
+ interface EmbedRefreshParams {
366
+ /** Refresh token from a previous login/signup/verify/refresh */
367
+ refreshToken: string;
368
+ }
369
+ /** Parameters for logout (token revocation) */
370
+ interface EmbedLogoutParams {
371
+ /** Refresh token to revoke */
372
+ refreshToken: string;
373
+ }
374
+ /** User profile returned by embed endpoints */
375
+ interface EmbedUser {
376
+ /** Unique Bio-ID identifier */
377
+ bioId: string;
378
+ /** User email address */
379
+ email: string;
380
+ /** Display name */
381
+ name: string;
382
+ /** Organization slug (if the user belongs to an org) */
383
+ orgSlug?: string;
384
+ }
385
+ /** Branding data returned by embed endpoints */
386
+ interface EmbedBranding {
387
+ /** Organization display name */
388
+ displayName?: string;
389
+ /** Full logo URL */
390
+ logoUrl?: string;
391
+ /** Logo mark (icon) URL */
392
+ logoMarkUrl?: string;
393
+ /** Primary brand color (hex) */
394
+ primaryColor?: string;
395
+ /** Secondary brand color (hex) */
396
+ secondaryColor?: string;
397
+ /** Whether the org is verified */
398
+ verified?: boolean;
399
+ /** Whether white-label is approved for this org */
400
+ whiteLabelApproved?: boolean;
401
+ }
402
+ /** Auth result from embed login, signup, verify, or refresh */
403
+ interface EmbedAuthResult {
404
+ /** JWT access token */
405
+ accessToken: string;
406
+ /** Refresh token (use with refresh() or logout()) */
407
+ refreshToken: string;
408
+ /** Token type (always 'Bearer') */
409
+ tokenType: 'Bearer';
410
+ /** Access token lifetime in seconds */
411
+ expiresIn: number;
412
+ /** Authenticated user profile */
413
+ user: EmbedUser;
414
+ /** Optional org branding (present when the user belongs to a branded org) */
415
+ branding?: EmbedBranding;
416
+ }
301
417
 
302
- export type { AuthorizeOptions as A, BioAuthConfig as B, CreateDepartmentData as C, IntrospectResult as I, JWKSVerifyOptions as J, OrgMember as O, TokenResponse as T, UserFilters as U, VerifyOptions as V, AuthorizeResult as a, BioUser as b, BioAdminConfig as c, UpdateUserData as d, BioDepartment as e, BioRole as f, CreateRoleData as g, BioOAuthClient as h, CreateClientData as i, BioTokenPayload as j, AdminResponse as k, BioAddress as l, BioClientTokenPayload as m, BioMessaging as n, BioUsersConfig as o, OrgMemberFilters as p, OrgMembersResult as q };
418
+ export type { AuthorizeOptions as A, BioUsersConfig as B, CreateDepartmentData as C, ServiceRole as D, EmbedClientConfig as E, IntrospectResult as I, JWKSVerifyOptions as J, OrgMemberFilters as O, SilentAuthOptions as S, TokenResponse as T, UserFilters as U, VerifyOptions as V, OrgMembersResult as a, BioAuthConfig as b, AuthorizeResult as c, BioUser as d, BioAdminConfig as e, UpdateUserData as f, BioDepartment as g, BioRole as h, CreateRoleData as i, BioOAuthClient as j, CreateClientData as k, EmbedLoginParams as l, EmbedAuthResult as m, EmbedSignupParams as n, EmbedMagicLinkParams as o, EmbedVerifyParams as p, EmbedRefreshParams as q, EmbedLogoutParams as r, BioTokenPayload as s, AdminResponse as t, BioAddress as u, BioClientTokenPayload as v, BioMessaging as w, EmbedBranding as x, EmbedUser as y, OrgMember as z };
package/dist/users.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { o as BioUsersConfig, p as OrgMemberFilters, q as OrgMembersResult } from './types-Dkb-drHZ.mjs';
1
+ import { B as BioUsersConfig, O as OrgMemberFilters, a as OrgMembersResult } from './types-DOpXwdF2.mjs';
2
2
 
3
3
  /**
4
4
  * Client for Bio-ID user access endpoints.
package/dist/users.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { o as BioUsersConfig, p as OrgMemberFilters, q as OrgMembersResult } from './types-Dkb-drHZ.js';
1
+ import { B as BioUsersConfig, O as OrgMemberFilters, a as OrgMembersResult } from './types-DOpXwdF2.js';
2
2
 
3
3
  /**
4
4
  * Client for Bio-ID user access endpoints.
package/dist/users.js CHANGED
@@ -175,6 +175,7 @@ function buildParams(filters) {
175
175
  if (filters.orgSlug) params.set("orgSlug", filters.orgSlug);
176
176
  if (filters.modules?.length) params.set("modules", filters.modules.join(","));
177
177
  if (filters.roles?.length) params.set("roles", filters.roles.join(","));
178
+ if (filters.service) params.set("service", filters.service);
178
179
  if (filters.limit) params.set("limit", String(filters.limit));
179
180
  if (filters.page) params.set("page", String(filters.page));
180
181
  return params;
package/dist/users.mjs CHANGED
@@ -119,6 +119,7 @@ function buildParams(filters) {
119
119
  if (filters.orgSlug) params.set("orgSlug", filters.orgSlug);
120
120
  if (filters.modules?.length) params.set("modules", filters.modules.join(","));
121
121
  if (filters.roles?.length) params.set("roles", filters.roles.join(","));
122
+ if (filters.service) params.set("service", filters.service);
122
123
  if (filters.limit) params.set("limit", String(filters.limit));
123
124
  if (filters.page) params.set("page", String(filters.page));
124
125
  return params;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@insureco/bio",
3
- "version": "0.5.0",
3
+ "version": "0.8.0",
4
4
  "description": "SDK for Bio-ID SSO integration on the Tawa platform",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -20,13 +20,23 @@
20
20
  "types": "./dist/graph.d.ts",
21
21
  "import": "./dist/graph.mjs",
22
22
  "require": "./dist/graph.js"
23
+ },
24
+ "./passport": {
25
+ "types": "./dist/passport.d.ts",
26
+ "import": "./dist/passport.mjs",
27
+ "require": "./dist/passport.js"
28
+ },
29
+ "./passport/react": {
30
+ "types": "./dist/passport-react.d.ts",
31
+ "import": "./dist/passport-react.mjs",
32
+ "require": "./dist/passport-react.js"
23
33
  }
24
34
  },
25
35
  "files": [
26
36
  "dist"
27
37
  ],
28
38
  "scripts": {
29
- "build": "tsup src/index.ts src/users.ts src/graph.ts --format cjs,esm --dts --clean",
39
+ "build": "tsup src/index.ts src/users.ts src/graph.ts src/passport.ts src/passport-react.ts --format cjs,esm --dts --clean",
30
40
  "test": "vitest run",
31
41
  "test:watch": "vitest",
32
42
  "lint": "tsc --noEmit",
@@ -47,11 +57,23 @@
47
57
  "access": "public"
48
58
  },
49
59
  "devDependencies": {
60
+ "@testing-library/dom": "^10.4.1",
61
+ "@testing-library/react": "^16.3.2",
50
62
  "@types/node": "^22.0.0",
63
+ "@types/react": "^18.0.0",
64
+ "jsdom": "^28.1.0",
51
65
  "tsup": "^8.0.0",
52
66
  "typescript": "^5.4.0",
53
67
  "vitest": "^2.0.0"
54
68
  },
69
+ "peerDependencies": {
70
+ "react": ">=18.0.0"
71
+ },
72
+ "peerDependenciesMeta": {
73
+ "react": {
74
+ "optional": true
75
+ }
76
+ },
55
77
  "engines": {
56
78
  "node": ">=18.0.0"
57
79
  }