Compare commits

...

6 Commits

Author SHA1 Message Date
かっこかり 2668053119
Merge a4e4799613 into eed45c7915 2024-11-18 04:08:11 +09:00
kakkokari-gtyih a4e4799613 api.jsonに出力されないエンドポイントはoverwriteを介さないように 2024-11-07 13:51:52 +09:00
kakkokari-gtyih 576e0bc9db Update Changelog 2024-11-03 16:26:25 +09:00
kakkokari-gtyih b328c15bea fix user type 2024-11-03 16:25:15 +09:00
kakkokari-gtyih 96fe7784c3 Update Changelog 2024-11-03 16:22:29 +09:00
kakkokari-gtyih 99e74cc53c fix(misskey-js): miauth checkの型を追加 2024-11-03 16:21:55 +09:00
4 changed files with 71 additions and 40 deletions

View File

@ -61,6 +61,7 @@
- Fix: User Webhookテスト機能のMock Payloadを修正 - Fix: User Webhookテスト機能のMock Payloadを修正
### Misskey.js ### Misskey.js
- Enhance: `/miauth/{sessionId}/check` の型を追加
- Fix: Stream初期化時、別途WebSocketを指定する場合の型定義を修正 - Fix: Stream初期化時、別途WebSocketを指定する場合の型定義を修正
## 2024.10.1 ## 2024.10.1

View File

@ -1160,6 +1160,13 @@ export type Endpoints = Overwrite<Endpoints_2, {
}; };
}; };
}; };
'admin/roles/create': {
req: Overwrite<AdminRolesCreateRequest, {
policies: PartialRolePolicyOverride;
}>;
res: AdminRolesCreateResponse;
};
}> & {
'signup': { 'signup': {
req: SignupRequest; req: SignupRequest;
res: SignupResponse; res: SignupResponse;
@ -1188,13 +1195,11 @@ export type Endpoints = Overwrite<Endpoints_2, {
}; };
}; };
}; };
'admin/roles/create': { [ep: `miauth/${string}/check`]: {
req: Overwrite<AdminRolesCreateRequest, { req: EmptyRequest;
policies: PartialRolePolicyOverride; res: MiAuthCheckResponse;
}>; };
res: AdminRolesCreateResponse;
}; };
}>;
// @public (undocumented) // @public (undocumented)
type EndpointsResponse = operations['endpoints']['responses']['200']['content']['application/json']; type EndpointsResponse = operations['endpoints']['responses']['200']['content']['application/json'];
@ -1223,6 +1228,7 @@ declare namespace entities {
SigninWithPasskeyRequest, SigninWithPasskeyRequest,
SigninWithPasskeyInitResponse, SigninWithPasskeyInitResponse,
SigninWithPasskeyResponse, SigninWithPasskeyResponse,
MiAuthCheckResponse,
PartialRolePolicyOverride, PartialRolePolicyOverride,
EmptyRequest, EmptyRequest,
EmptyResponse, EmptyResponse,
@ -2447,6 +2453,15 @@ type MetaRequest = operations['meta']['requestBody']['content']['application/jso
// @public (undocumented) // @public (undocumented)
type MetaResponse = operations['meta']['responses']['200']['content']['application/json']; type MetaResponse = operations['meta']['responses']['200']['content']['application/json'];
// @public (undocumented)
type MiAuthCheckResponse = {
ok: true;
token: string;
user: UserDetailedNotMe;
} | {
ok: false;
};
// @public (undocumented) // @public (undocumented)
type MiauthGenTokenRequest = operations['miauth___gen-token']['requestBody']['content']['application/json']; type MiauthGenTokenRequest = operations['miauth___gen-token']['requestBody']['content']['application/json'];

View File

@ -1,6 +1,6 @@
import { Endpoints as Gen } from './autogen/endpoint.js'; import { Endpoints as Gen } from './autogen/endpoint.js';
import { UserDetailed } from './autogen/models.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 { import {
PartialRolePolicyOverride, PartialRolePolicyOverride,
SigninFlowRequest, SigninFlowRequest,
@ -12,6 +12,7 @@ import {
SignupPendingResponse, SignupPendingResponse,
SignupRequest, SignupRequest,
SignupResponse, SignupResponse,
MiAuthCheckResponse,
} from './entities.js'; } from './entities.js';
type Overwrite<T, U extends { [Key in keyof T]?: unknown }> = Omit< type Overwrite<T, U extends { [Key in keyof T]?: unknown }> = Omit<
@ -57,6 +58,7 @@ export type SwitchCaseResponseType<E extends keyof Endpoints, P extends Endpoint
export type Endpoints = Overwrite< export type Endpoints = Overwrite<
Gen, Gen,
{ {
// ▼ api.jsonのオーバーライド ▼
'users/show': { 'users/show': {
req: UsersShowRequest; req: UsersShowRequest;
res: { res: {
@ -70,17 +72,22 @@ export type Endpoints = Overwrite<
}; };
}; };
}, },
// api.jsonには載せないものなのでここで定義 'admin/roles/create': {
req: Overwrite<AdminRolesCreateRequest, { policies: PartialRolePolicyOverride }>;
res: AdminRolesCreateResponse;
},
// ▲ api.jsonのオーバーライド ▲
}
> & {
// ▼ api.jsonに載らないもの ▼
'signup': { 'signup': {
req: SignupRequest; req: SignupRequest;
res: SignupResponse; res: SignupResponse;
}, },
// api.jsonには載せないものなのでここで定義
'signup-pending': { 'signup-pending': {
req: SignupPendingRequest; req: SignupPendingRequest;
res: SignupPendingResponse; res: SignupPendingResponse;
}, },
// api.jsonには載せないものなのでここで定義
'signin-flow': { 'signin-flow': {
req: SigninFlowRequest; req: SigninFlowRequest;
res: SigninFlowResponse; res: SigninFlowResponse;
@ -101,9 +108,9 @@ export type Endpoints = Overwrite<
}, },
}, },
}, },
'admin/roles/create': { [ep: `miauth/${string}/check`]: {
req: Overwrite<AdminRolesCreateRequest, { policies: PartialRolePolicyOverride }>; req: EmptyRequest;
res: AdminRolesCreateResponse; res: MiAuthCheckResponse;
} },
} // ▲ api.jsonに載らないもの ▲
> };

View File

@ -311,6 +311,14 @@ export type SigninWithPasskeyResponse = {
signinResponse: SigninFlowResponse & { finished: true }; signinResponse: SigninFlowResponse & { finished: true };
}; };
export type MiAuthCheckResponse = {
ok: true;
token: string;
user: UserDetailedNotMe;
} | {
ok: false;
};
type Values<T extends Record<PropertyKey, unknown>> = T[keyof T]; type Values<T extends Record<PropertyKey, unknown>> = T[keyof T];
export type PartialRolePolicyOverride = Partial<{[k in keyof RolePolicies]: Omit<Values<Role['policies']>, 'value'> & { value: RolePolicies[k] }}>; export type PartialRolePolicyOverride = Partial<{[k in keyof RolePolicies]: Omit<Values<Role['policies']>, 'value'> & { value: RolePolicies[k] }}>;