Skip to content

Commit

Permalink
refactor: update userinfo response type (#760)
Browse files Browse the repository at this point in the history
  • Loading branch information
charIeszhao authored Jul 4, 2024
1 parent 33f7c21 commit 5f64e0e
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .changeset/clever-zoos-scream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@logto/capacitor": patch
"@logto/express": patch
"@logto/remix": patch
"@logto/next": patch
---

export `UserInfoResponse` type
5 changes: 5 additions & 0 deletions .changeset/real-bears-glow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@logto/js": patch
---

update `UserInfoResponse` type definition by adding `organization_data` claim
1 change: 1 addition & 0 deletions packages/capacitor/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export type {
IdTokenClaims,
InteractionMode,
LogtoErrorCode,
UserInfoResponse,
} from '@logto/browser';

export type CapacitorConfig = {
Expand Down
1 change: 1 addition & 0 deletions packages/express/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export type {
LogtoContext,
InteractionMode,
LogtoErrorCode,
UserInfoResponse,
} from '@logto/node';
export type { LogtoExpressConfig } from './types.js';

Expand Down
9 changes: 9 additions & 0 deletions packages/js/src/core/user-info.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { type Nullable } from 'vitest';

import { type IdTokenClaims } from '../index.js';
import type { Requester } from '../types/index.js';

Expand All @@ -6,9 +8,16 @@ type Identity = {
details?: Record<string, unknown>;
};

type OrganizationData = {
id: string;
name: string;
description: Nullable<string>;
};

export type UserInfoResponse = IdTokenClaims & {
custom_data?: unknown;
identities?: Record<string, Identity>;
organization_data?: OrganizationData[];
};

export const fetchUserInfo = async (
Expand Down
1 change: 1 addition & 0 deletions packages/next/edge/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export type {
LogtoContext,
InteractionMode,
LogtoErrorCode,
UserInfoResponse,
} from '@logto/node';

export default class LogtoClient extends BaseClient {
Expand Down
1 change: 1 addition & 0 deletions packages/next/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export type {
LogtoContext,
InteractionMode,
LogtoErrorCode,
UserInfoResponse,
} from '@logto/node';

export default class LogtoClient extends LogtoNextBaseClient {
Expand Down
1 change: 1 addition & 0 deletions packages/remix/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export type {
LogtoContext,
InteractionMode,
LogtoErrorCode,
UserInfoResponse,
} from '@logto/node';

export {
Expand Down

0 comments on commit 5f64e0e

Please sign in to comment.