From 99e74cc53c8c93a4b94cd2871a07cca6f46dcf41 Mon Sep 17 00:00:00 2001 From: kakkokari-gtyih <67428053+kakkokari-gtyih@users.noreply.github.com> Date: Sun, 3 Nov 2024 16:21:55 +0900 Subject: [PATCH 1/5] =?UTF-8?q?fix(misskey-js):=20miauth=20check=E3=81=AE?= =?UTF-8?q?=E5=9E=8B=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/misskey-js/etc/misskey-js.api.md | 14 ++++++++++++++ packages/misskey-js/src/api.types.ts | 7 ++++++- packages/misskey-js/src/entities.ts | 8 ++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/packages/misskey-js/etc/misskey-js.api.md b/packages/misskey-js/etc/misskey-js.api.md index 061b533b72..a99cefb0aa 100644 --- a/packages/misskey-js/etc/misskey-js.api.md +++ b/packages/misskey-js/etc/misskey-js.api.md @@ -1194,6 +1194,10 @@ export type Endpoints = Overwrite; res: AdminRolesCreateResponse; }; + [ep: `miauth/${string}/check`]: { + req: EmptyRequest; + res: MiAuthCheckResponse; + }; }>; // @public (undocumented) @@ -1223,6 +1227,7 @@ declare namespace entities { SigninWithPasskeyRequest, SigninWithPasskeyInitResponse, SigninWithPasskeyResponse, + MiAuthCheckResponse, PartialRolePolicyOverride, EmptyRequest, EmptyResponse, @@ -2439,6 +2444,15 @@ type MetaRequest = operations['meta']['requestBody']['content']['application/jso // @public (undocumented) type MetaResponse = operations['meta']['responses']['200']['content']['application/json']; +// @public (undocumented) +type MiAuthCheckResponse = { + ok: true; + token: string; + user: User; +} | { + ok: false; +}; + // @public (undocumented) type MiauthGenTokenRequest = operations['miauth___gen-token']['requestBody']['content']['application/json']; diff --git a/packages/misskey-js/src/api.types.ts b/packages/misskey-js/src/api.types.ts index 838949f8e1..7be1b6ce5f 100644 --- a/packages/misskey-js/src/api.types.ts +++ b/packages/misskey-js/src/api.types.ts @@ -1,6 +1,6 @@ import { Endpoints as Gen } from './autogen/endpoint.js'; import { UserDetailed } from './autogen/models.js'; -import { AdminRolesCreateRequest, AdminRolesCreateResponse, UsersShowRequest } from './autogen/entities.js'; +import { AdminRolesCreateRequest, AdminRolesCreateResponse, UsersShowRequest, EmptyRequest } from './autogen/entities.js'; import { PartialRolePolicyOverride, SigninFlowRequest, @@ -12,6 +12,7 @@ import { SignupPendingResponse, SignupRequest, SignupResponse, + MiAuthCheckResponse, } from './entities.js'; type Overwrite = Omit< @@ -104,6 +105,10 @@ export type Endpoints = Overwrite< 'admin/roles/create': { req: Overwrite; res: AdminRolesCreateResponse; + }, + [ep: `miauth/${string}/check`]: { + req: EmptyRequest; + res: MiAuthCheckResponse; } } > diff --git a/packages/misskey-js/src/entities.ts b/packages/misskey-js/src/entities.ts index dd88791ed0..84fe72a829 100644 --- a/packages/misskey-js/src/entities.ts +++ b/packages/misskey-js/src/entities.ts @@ -311,6 +311,14 @@ export type SigninWithPasskeyResponse = { signinResponse: SigninFlowResponse & { finished: true }; }; +export type MiAuthCheckResponse = { + ok: true; + token: string; + user: User; +} | { + ok: false; +}; + type Values> = T[keyof T]; export type PartialRolePolicyOverride = Partial<{[k in keyof RolePolicies]: Omit, 'value'> & { value: RolePolicies[k] }}>; From 96fe7784c39cf2972f2c86fbb11c23b3851d72e1 Mon Sep 17 00:00:00 2001 From: kakkokari-gtyih <67428053+kakkokari-gtyih@users.noreply.github.com> Date: Sun, 3 Nov 2024 16:22:29 +0900 Subject: [PATCH 2/5] Update Changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f87fc3a2bb..fe4d3a32d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ ### Misskey.js - Fix: Stream初期化時、別途WebSocketを指定する場合の型定義を修正 +- Fix: `/miauth/{sessionId}/check` の型を追加 ## 2024.10.1 From b328c15bea88ea8da135ed734393787fa0b30500 Mon Sep 17 00:00:00 2001 From: kakkokari-gtyih <67428053+kakkokari-gtyih@users.noreply.github.com> Date: Sun, 3 Nov 2024 16:25:15 +0900 Subject: [PATCH 3/5] fix user type --- packages/misskey-js/etc/misskey-js.api.md | 2 +- packages/misskey-js/src/entities.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/misskey-js/etc/misskey-js.api.md b/packages/misskey-js/etc/misskey-js.api.md index a99cefb0aa..8d1624fee6 100644 --- a/packages/misskey-js/etc/misskey-js.api.md +++ b/packages/misskey-js/etc/misskey-js.api.md @@ -2448,7 +2448,7 @@ type MetaResponse = operations['meta']['responses']['200']['content']['applicati type MiAuthCheckResponse = { ok: true; token: string; - user: User; + user: UserDetailedNotMe; } | { ok: false; }; diff --git a/packages/misskey-js/src/entities.ts b/packages/misskey-js/src/entities.ts index 84fe72a829..5d6a139860 100644 --- a/packages/misskey-js/src/entities.ts +++ b/packages/misskey-js/src/entities.ts @@ -314,7 +314,7 @@ export type SigninWithPasskeyResponse = { export type MiAuthCheckResponse = { ok: true; token: string; - user: User; + user: UserDetailedNotMe; } | { ok: false; }; From 576e0bc9db35b193018ef930a0b54d04fa74f881 Mon Sep 17 00:00:00 2001 From: kakkokari-gtyih <67428053+kakkokari-gtyih@users.noreply.github.com> Date: Sun, 3 Nov 2024 16:26:25 +0900 Subject: [PATCH 4/5] Update Changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe4d3a32d1..d853cd25fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,8 +35,8 @@ (Cherry-picked from https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/711) ### Misskey.js +- Enhance: `/miauth/{sessionId}/check` の型を追加 - Fix: Stream初期化時、別途WebSocketを指定する場合の型定義を修正 -- Fix: `/miauth/{sessionId}/check` の型を追加 ## 2024.10.1 From a4e4799613586a3baa3e2af837416b8d5c285e5d Mon Sep 17 00:00:00 2001 From: kakkokari-gtyih <67428053+kakkokari-gtyih@users.noreply.github.com> Date: Thu, 7 Nov 2024 13:51:52 +0900 Subject: [PATCH 5/5] =?UTF-8?q?api.json=E3=81=AB=E5=87=BA=E5=8A=9B?= =?UTF-8?q?=E3=81=95=E3=82=8C=E3=81=AA=E3=81=84=E3=82=A8=E3=83=B3=E3=83=89?= =?UTF-8?q?=E3=83=9D=E3=82=A4=E3=83=B3=E3=83=88=E3=81=AFoverwrite=E3=82=92?= =?UTF-8?q?=E4=BB=8B=E3=81=95=E3=81=AA=E3=81=84=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/misskey-js/etc/misskey-js.api.md | 15 ++--- packages/misskey-js/src/api.types.ts | 74 ++++++++++++----------- 2 files changed, 46 insertions(+), 43 deletions(-) diff --git a/packages/misskey-js/etc/misskey-js.api.md b/packages/misskey-js/etc/misskey-js.api.md index 8d1624fee6..af73af080b 100644 --- a/packages/misskey-js/etc/misskey-js.api.md +++ b/packages/misskey-js/etc/misskey-js.api.md @@ -1160,6 +1160,13 @@ export type Endpoints = Overwrite; + res: AdminRolesCreateResponse; + }; +}> & { 'signup': { req: SignupRequest; res: SignupResponse; @@ -1188,17 +1195,11 @@ export type Endpoints = Overwrite; - res: AdminRolesCreateResponse; - }; [ep: `miauth/${string}/check`]: { req: EmptyRequest; res: MiAuthCheckResponse; }; -}>; +}; // @public (undocumented) type EndpointsResponse = operations['endpoints']['responses']['200']['content']['application/json']; diff --git a/packages/misskey-js/src/api.types.ts b/packages/misskey-js/src/api.types.ts index 7be1b6ce5f..c2cb55189f 100644 --- a/packages/misskey-js/src/api.types.ts +++ b/packages/misskey-js/src/api.types.ts @@ -58,6 +58,7 @@ export type SwitchCaseResponseType; res: AdminRolesCreateResponse; }, - [ep: `miauth/${string}/check`]: { - req: EmptyRequest; - res: MiAuthCheckResponse; - } + // ▲ api.jsonのオーバーライド ▲ } -> +> & { + // ▼ api.jsonに載らないもの ▼ + 'signup': { + req: SignupRequest; + res: SignupResponse; + }, + 'signup-pending': { + req: SignupPendingRequest; + res: SignupPendingResponse; + }, + 'signin-flow': { + req: SigninFlowRequest; + res: SigninFlowResponse; + }, + 'signin-with-passkey': { + req: SigninWithPasskeyRequest; + res: { + $switch: { + $cases: [ + [ + { + context: string; + }, + SigninWithPasskeyResponse, + ], + ]; + $default: SigninWithPasskeyInitResponse; + }, + }, + }, + [ep: `miauth/${string}/check`]: { + req: EmptyRequest; + res: MiAuthCheckResponse; + }, + // ▲ api.jsonに載らないもの ▲ +};