diff --git a/CHANGELOG.md b/CHANGELOG.md index 0718150fc4..f3df597e51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -69,6 +69,7 @@ - Fix: リノートミュートが新規投稿通知に対して作用していなかった問題を修正 ### Misskey.js +- Enhance: `/miauth/{sessionId}/check` の型を追加 - Fix: Stream初期化時、別途WebSocketを指定する場合の型定義を修正 ## 2024.10.1 diff --git a/packages/misskey-js/etc/misskey-js.api.md b/packages/misskey-js/etc/misskey-js.api.md index 01a3dbbb30..2061025c02 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,13 +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']; @@ -1223,6 +1228,7 @@ declare namespace entities { SigninWithPasskeyRequest, SigninWithPasskeyInitResponse, SigninWithPasskeyResponse, + MiAuthCheckResponse, PartialRolePolicyOverride, EmptyRequest, EmptyResponse, @@ -2447,6 +2453,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: UserDetailedNotMe; +} | { + 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..c2cb55189f 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< @@ -57,6 +58,7 @@ export type SwitchCaseResponseType; res: AdminRolesCreateResponse; - } + }, + // ▲ 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に載らないもの ▲ +}; diff --git a/packages/misskey-js/src/entities.ts b/packages/misskey-js/src/entities.ts index dd88791ed0..5d6a139860 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: UserDetailedNotMe; +} | { + ok: false; +}; + type Values> = T[keyof T]; export type PartialRolePolicyOverride = Partial<{[k in keyof RolePolicies]: Omit, 'value'> & { value: RolePolicies[k] }}>;