fix(misskey-js): miauth checkの型を追加

This commit is contained in:
kakkokari-gtyih 2024-11-03 16:21:55 +09:00
parent 6718a54f6f
commit 99e74cc53c
3 changed files with 28 additions and 1 deletions

View File

@ -1194,6 +1194,10 @@ export type Endpoints = Overwrite<Endpoints_2, {
}>;
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'];

View File

@ -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<T, U extends { [Key in keyof T]?: unknown }> = Omit<
@ -104,6 +105,10 @@ export type Endpoints = Overwrite<
'admin/roles/create': {
req: Overwrite<AdminRolesCreateRequest, { policies: PartialRolePolicyOverride }>;
res: AdminRolesCreateResponse;
},
[ep: `miauth/${string}/check`]: {
req: EmptyRequest;
res: MiAuthCheckResponse;
}
}
>

View File

@ -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 extends Record<PropertyKey, unknown>> = T[keyof T];
export type PartialRolePolicyOverride = Partial<{[k in keyof RolePolicies]: Omit<Values<Role['policies']>, 'value'> & { value: RolePolicies[k] }}>;