From 2a0ec7f78c56a968a00864b7f2f0ae4b69657d2d Mon Sep 17 00:00:00 2001 From: Darcy Ye Date: Thu, 9 Feb 2023 15:39:50 +0800 Subject: [PATCH] refactor: update connector interfaces (#3080) --- .changeset-staged/nine-apes-attend.md | 5 +++++ packages/core/src/libraries/social.ts | 2 +- packages/toolkit/connector-kit/src/types.ts | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 .changeset-staged/nine-apes-attend.md diff --git a/.changeset-staged/nine-apes-attend.md b/.changeset-staged/nine-apes-attend.md new file mode 100644 index 000000000..aa8ee9443 --- /dev/null +++ b/.changeset-staged/nine-apes-attend.md @@ -0,0 +1,5 @@ +--- +"@logto/connector-kit": minor +--- + +`getSession` and `setSession` are actually used as REQUIRED parameters, update interface definition. diff --git a/packages/core/src/libraries/social.ts b/packages/core/src/libraries/social.ts index e22648475..462135926 100644 --- a/packages/core/src/libraries/social.ts +++ b/packages/core/src/libraries/social.ts @@ -65,7 +65,7 @@ export const createSocialLibrary = (queries: Queries, connectorLibrary: Connecto const getUserInfoByAuthCode = async ( connectorId: string, data: unknown, - getConnectorSession?: GetSession + getConnectorSession: GetSession ): Promise => { const connector = await getConnector(connectorId); diff --git a/packages/toolkit/connector-kit/src/types.ts b/packages/toolkit/connector-kit/src/types.ts index 2ea427157..3036587c4 100644 --- a/packages/toolkit/connector-kit/src/types.ts +++ b/packages/toolkit/connector-kit/src/types.ts @@ -191,7 +191,7 @@ export type GetAuthorizationUri = ( jti: string; headers: { userAgent?: string }; }, - setSession?: SetSession + setSession: SetSession ) => Promise; export const socialUserInfoGuard = z.object({ @@ -206,5 +206,5 @@ export type SocialUserInfo = z.infer; export type GetUserInfo = ( data: unknown, - getSession?: GetSession + getSession: GetSession ) => Promise>;