mirror of
https://github.com/misskey-dev/misskey
synced 2024-11-27 22:38:39 +09:00
fix(misskey-js): /signupと/signinの定義を作成してフロントの型エラーを抑制する (#12846)
* fix(misskey-js): /signupと/signinの定義を復活してフロントの型エラーを抑制する * fix ci * fix ci * fix * fix --------- Co-authored-by: osamu <46447427+sam-osamu@users.noreply.github.com>
This commit is contained in:
parent
a9127e3ecd
commit
30311aca18
@ -24,7 +24,7 @@ import type * as misskey from 'misskey-js';
|
||||
|
||||
describe('2要素認証', () => {
|
||||
let app: INestApplicationContext;
|
||||
let alice: misskey.entities.MeSignup;
|
||||
let alice: misskey.entities.SignupResponse;
|
||||
|
||||
const config = loadConfig();
|
||||
const password = 'test';
|
||||
|
@ -37,7 +37,7 @@ describe('アンテナ', () => {
|
||||
// - srcのenumにgroupが残っている
|
||||
// - userGroupIdが残っている, isActiveがない
|
||||
type Antenna = misskey.entities.Antenna | Packed<'Antenna'>;
|
||||
type User = misskey.entities.MeSignup;
|
||||
type User = misskey.entities.SignupResponse;
|
||||
type Note = misskey.entities.Note;
|
||||
|
||||
// アンテナを作成できる最小のパラメタ
|
||||
|
@ -24,15 +24,15 @@ describe('API visibility', () => {
|
||||
describe('Note visibility', () => {
|
||||
//#region vars
|
||||
/** ヒロイン */
|
||||
let alice: misskey.entities.MeSignup;
|
||||
let alice: misskey.entities.SignupResponse;
|
||||
/** フォロワー */
|
||||
let follower: misskey.entities.MeSignup;
|
||||
let follower: misskey.entities.SignupResponse;
|
||||
/** 非フォロワー */
|
||||
let other: misskey.entities.MeSignup;
|
||||
let other: misskey.entities.SignupResponse;
|
||||
/** 非フォロワーでもリプライやメンションをされた人 */
|
||||
let target: misskey.entities.MeSignup;
|
||||
let target: misskey.entities.SignupResponse;
|
||||
/** specified mentionでmentionを飛ばされる人 */
|
||||
let target2: misskey.entities.MeSignup;
|
||||
let target2: misskey.entities.SignupResponse;
|
||||
|
||||
/** public-post */
|
||||
let pub: any;
|
||||
|
@ -13,9 +13,9 @@ import type * as misskey from 'misskey-js';
|
||||
|
||||
describe('API', () => {
|
||||
let app: INestApplicationContext;
|
||||
let alice: misskey.entities.MeSignup;
|
||||
let bob: misskey.entities.MeSignup;
|
||||
let carol: misskey.entities.MeSignup;
|
||||
let alice: misskey.entities.SignupResponse;
|
||||
let bob: misskey.entities.SignupResponse;
|
||||
let carol: misskey.entities.SignupResponse;
|
||||
|
||||
beforeAll(async () => {
|
||||
app = await startServer();
|
||||
|
@ -14,9 +14,9 @@ describe('Block', () => {
|
||||
let app: INestApplicationContext;
|
||||
|
||||
// alice blocks bob
|
||||
let alice: misskey.entities.MeSignup;
|
||||
let bob: misskey.entities.MeSignup;
|
||||
let carol: misskey.entities.MeSignup;
|
||||
let alice: misskey.entities.SignupResponse;
|
||||
let bob: misskey.entities.SignupResponse;
|
||||
let carol: misskey.entities.SignupResponse;
|
||||
|
||||
beforeAll(async () => {
|
||||
app = await startServer();
|
||||
|
@ -17,10 +17,10 @@ import type * as misskey from 'misskey-js';
|
||||
describe('Endpoints', () => {
|
||||
let app: INestApplicationContext;
|
||||
|
||||
let alice: misskey.entities.MeSignup;
|
||||
let bob: misskey.entities.MeSignup;
|
||||
let carol: misskey.entities.MeSignup;
|
||||
let dave: misskey.entities.MeSignup;
|
||||
let alice: misskey.entities.SignupResponse;
|
||||
let bob: misskey.entities.SignupResponse;
|
||||
let carol: misskey.entities.SignupResponse;
|
||||
let dave: misskey.entities.SignupResponse;
|
||||
|
||||
beforeAll(async () => {
|
||||
app = await startServer();
|
||||
|
@ -25,7 +25,7 @@ const JSON_UTF8 = 'application/json; charset=utf-8';
|
||||
describe('Webリソース', () => {
|
||||
let app: INestApplicationContext;
|
||||
|
||||
let alice: misskey.entities.MeSignup;
|
||||
let alice: misskey.entities.SignupResponse;
|
||||
let aliceUploadedFile: any;
|
||||
let alicesPost: any;
|
||||
let alicePage: any;
|
||||
@ -34,7 +34,7 @@ describe('Webリソース', () => {
|
||||
let aliceGalleryPost: any;
|
||||
let aliceChannel: any;
|
||||
|
||||
let bob: misskey.entities.MeSignup;
|
||||
let bob: misskey.entities.SignupResponse;
|
||||
|
||||
type Request = {
|
||||
path: string,
|
||||
|
@ -13,8 +13,8 @@ import type * as misskey from 'misskey-js';
|
||||
describe('FF visibility', () => {
|
||||
let app: INestApplicationContext;
|
||||
|
||||
let alice: misskey.entities.MeSignup;
|
||||
let bob: misskey.entities.MeSignup;
|
||||
let alice: misskey.entities.SignupResponse;
|
||||
let bob: misskey.entities.SignupResponse;
|
||||
|
||||
beforeAll(async () => {
|
||||
app = await startServer();
|
||||
|
@ -20,12 +20,12 @@ describe('Account Move', () => {
|
||||
let url: URL;
|
||||
|
||||
let root: any;
|
||||
let alice: misskey.entities.MeSignup;
|
||||
let bob: misskey.entities.MeSignup;
|
||||
let carol: misskey.entities.MeSignup;
|
||||
let dave: misskey.entities.MeSignup;
|
||||
let eve: misskey.entities.MeSignup;
|
||||
let frank: misskey.entities.MeSignup;
|
||||
let alice: misskey.entities.SignupResponse;
|
||||
let bob: misskey.entities.SignupResponse;
|
||||
let carol: misskey.entities.SignupResponse;
|
||||
let dave: misskey.entities.SignupResponse;
|
||||
let eve: misskey.entities.SignupResponse;
|
||||
let frank: misskey.entities.SignupResponse;
|
||||
|
||||
let Users: UsersRepository;
|
||||
|
||||
|
@ -14,9 +14,9 @@ describe('Mute', () => {
|
||||
let app: INestApplicationContext;
|
||||
|
||||
// alice mutes carol
|
||||
let alice: misskey.entities.MeSignup;
|
||||
let bob: misskey.entities.MeSignup;
|
||||
let carol: misskey.entities.MeSignup;
|
||||
let alice: misskey.entities.SignupResponse;
|
||||
let bob: misskey.entities.SignupResponse;
|
||||
let carol: misskey.entities.SignupResponse;
|
||||
|
||||
beforeAll(async () => {
|
||||
app = await startServer();
|
||||
|
@ -16,8 +16,8 @@ describe('Note', () => {
|
||||
let app: INestApplicationContext;
|
||||
let Notes: any;
|
||||
|
||||
let alice: misskey.entities.MeSignup;
|
||||
let bob: misskey.entities.MeSignup;
|
||||
let alice: misskey.entities.SignupResponse;
|
||||
let bob: misskey.entities.SignupResponse;
|
||||
|
||||
beforeAll(async () => {
|
||||
app = await startServer();
|
||||
|
@ -75,7 +75,7 @@ function getMeta(html: string): { transactionId: string | undefined, clientName:
|
||||
};
|
||||
}
|
||||
|
||||
function fetchDecision(transactionId: string, user: misskey.entities.MeSignup, { cancel }: { cancel?: boolean } = {}): Promise<Response> {
|
||||
function fetchDecision(transactionId: string, user: misskey.entities.SignupResponse, { cancel }: { cancel?: boolean } = {}): Promise<Response> {
|
||||
return fetch(new URL('/oauth/decision', host), {
|
||||
method: 'post',
|
||||
body: new URLSearchParams({
|
||||
@ -90,14 +90,14 @@ function fetchDecision(transactionId: string, user: misskey.entities.MeSignup, {
|
||||
});
|
||||
}
|
||||
|
||||
async function fetchDecisionFromResponse(response: Response, user: misskey.entities.MeSignup, { cancel }: { cancel?: boolean } = {}): Promise<Response> {
|
||||
async function fetchDecisionFromResponse(response: Response, user: misskey.entities.SignupResponse, { cancel }: { cancel?: boolean } = {}): Promise<Response> {
|
||||
const { transactionId } = getMeta(await response.text());
|
||||
assert.ok(transactionId);
|
||||
|
||||
return await fetchDecision(transactionId, user, { cancel });
|
||||
}
|
||||
|
||||
async function fetchAuthorizationCode(user: misskey.entities.MeSignup, scope: string, code_challenge: string): Promise<{ client: AuthorizationCode, code: string }> {
|
||||
async function fetchAuthorizationCode(user: misskey.entities.SignupResponse, scope: string, code_challenge: string): Promise<{ client: AuthorizationCode, code: string }> {
|
||||
const client = new AuthorizationCode(clientConfig);
|
||||
|
||||
const response = await fetch(client.authorizeURL({
|
||||
@ -150,8 +150,8 @@ describe('OAuth', () => {
|
||||
let app: INestApplicationContext;
|
||||
let fastify: FastifyInstance;
|
||||
|
||||
let alice: misskey.entities.MeSignup;
|
||||
let bob: misskey.entities.MeSignup;
|
||||
let alice: misskey.entities.SignupResponse;
|
||||
let bob: misskey.entities.SignupResponse;
|
||||
|
||||
let sender: (reply: FastifyReply) => void;
|
||||
|
||||
|
@ -14,9 +14,9 @@ describe('Renote Mute', () => {
|
||||
let app: INestApplicationContext;
|
||||
|
||||
// alice mutes carol
|
||||
let alice: misskey.entities.MeSignup;
|
||||
let bob: misskey.entities.MeSignup;
|
||||
let carol: misskey.entities.MeSignup;
|
||||
let alice: misskey.entities.SignupResponse;
|
||||
let bob: misskey.entities.SignupResponse;
|
||||
let carol: misskey.entities.SignupResponse;
|
||||
|
||||
beforeAll(async () => {
|
||||
app = await startServer();
|
||||
|
@ -32,15 +32,15 @@ describe('Streaming', () => {
|
||||
|
||||
describe('Streaming', () => {
|
||||
// Local users
|
||||
let ayano: misskey.entities.MeSignup;
|
||||
let kyoko: misskey.entities.MeSignup;
|
||||
let chitose: misskey.entities.MeSignup;
|
||||
let kanako: misskey.entities.MeSignup;
|
||||
let ayano: misskey.entities.SignupResponse;
|
||||
let kyoko: misskey.entities.SignupResponse;
|
||||
let chitose: misskey.entities.SignupResponse;
|
||||
let kanako: misskey.entities.SignupResponse;
|
||||
|
||||
// Remote users
|
||||
let akari: misskey.entities.MeSignup;
|
||||
let chinatsu: misskey.entities.MeSignup;
|
||||
let takumi: misskey.entities.MeSignup;
|
||||
let akari: misskey.entities.SignupResponse;
|
||||
let chinatsu: misskey.entities.SignupResponse;
|
||||
let takumi: misskey.entities.SignupResponse;
|
||||
|
||||
let kyokoNote: any;
|
||||
let kanakoNote: any;
|
||||
|
@ -13,9 +13,9 @@ import type * as misskey from 'misskey-js';
|
||||
describe('Note thread mute', () => {
|
||||
let app: INestApplicationContext;
|
||||
|
||||
let alice: misskey.entities.MeSignup;
|
||||
let bob: misskey.entities.MeSignup;
|
||||
let carol: misskey.entities.MeSignup;
|
||||
let alice: misskey.entities.SignupResponse;
|
||||
let bob: misskey.entities.SignupResponse;
|
||||
let carol: misskey.entities.SignupResponse;
|
||||
|
||||
beforeAll(async () => {
|
||||
app = await startServer();
|
||||
|
@ -13,7 +13,7 @@ import type * as misskey from 'misskey-js';
|
||||
describe('users/notes', () => {
|
||||
let app: INestApplicationContext;
|
||||
|
||||
let alice: misskey.entities.MeSignup;
|
||||
let alice: misskey.entities.SignupResponse;
|
||||
let jpgNote: any;
|
||||
let pngNote: any;
|
||||
let jpgPngNote: any;
|
||||
|
@ -1034,6 +1034,18 @@ export type Endpoints = Overwrite<Endpoints_2, {
|
||||
};
|
||||
};
|
||||
};
|
||||
'signup': {
|
||||
req: SignupRequest;
|
||||
res: SignupResponse;
|
||||
};
|
||||
'signup-pending': {
|
||||
req: SignupPendingRequest;
|
||||
res: SignupPendingResponse;
|
||||
};
|
||||
'signin': {
|
||||
req: SigninRequest;
|
||||
res: SigninResponse;
|
||||
};
|
||||
}>;
|
||||
|
||||
// @public (undocumented)
|
||||
@ -1053,6 +1065,12 @@ declare namespace entities {
|
||||
EmojiUpdated,
|
||||
EmojiDeleted,
|
||||
AnnouncementCreated,
|
||||
SignupRequest,
|
||||
SignupResponse,
|
||||
SignupPendingRequest,
|
||||
SignupPendingResponse,
|
||||
SigninRequest,
|
||||
SigninResponse,
|
||||
EmptyRequest,
|
||||
EmptyResponse,
|
||||
AdminMetaResponse,
|
||||
@ -2615,6 +2633,47 @@ type ServerStatsLog = string[];
|
||||
// @public (undocumented)
|
||||
type Signin = components['schemas']['Signin'];
|
||||
|
||||
// @public (undocumented)
|
||||
type SigninRequest = {
|
||||
username: string;
|
||||
password: string;
|
||||
token?: string;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
type SigninResponse = {
|
||||
id: User['id'];
|
||||
i: string;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
type SignupPendingRequest = {
|
||||
code: string;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
type SignupPendingResponse = {
|
||||
id: User['id'];
|
||||
i: string;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
type SignupRequest = {
|
||||
username: string;
|
||||
password: string;
|
||||
host?: string;
|
||||
invitationCode?: string;
|
||||
emailAddress?: string;
|
||||
'hcaptcha-response'?: string | null;
|
||||
'g-recaptcha-response'?: string | null;
|
||||
'turnstile-response'?: string | null;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
type SignupResponse = MeDetailed & {
|
||||
token: string;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
type StatsResponse = operations['stats']['responses']['200']['content']['application/json'];
|
||||
|
||||
|
@ -1,6 +1,14 @@
|
||||
import { Endpoints as Gen } from './autogen/endpoint';
|
||||
import { UserDetailed } from './autogen/models';
|
||||
import { UsersShowRequest } from './autogen/entities';
|
||||
import {
|
||||
SigninRequest,
|
||||
SigninResponse,
|
||||
SignupPendingRequest,
|
||||
SignupPendingResponse,
|
||||
SignupRequest,
|
||||
SignupResponse,
|
||||
} from './entities';
|
||||
|
||||
type Overwrite<T, U extends { [Key in keyof T]?: unknown }> = Omit<
|
||||
T,
|
||||
@ -55,6 +63,21 @@ export type Endpoints = Overwrite<
|
||||
$default: UserDetailed;
|
||||
};
|
||||
};
|
||||
}
|
||||
},
|
||||
// api.jsonには載せないものなのでここで定義
|
||||
'signup': {
|
||||
req: SignupRequest;
|
||||
res: SignupResponse;
|
||||
},
|
||||
// api.jsonには載せないものなのでここで定義
|
||||
'signup-pending': {
|
||||
req: SignupPendingRequest;
|
||||
res: SignupPendingResponse;
|
||||
},
|
||||
// api.jsonには載せないものなのでここで定義
|
||||
'signin': {
|
||||
req: SigninRequest;
|
||||
res: SigninResponse;
|
||||
},
|
||||
}
|
||||
>
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ModerationLogPayloads } from './consts.js';
|
||||
import { Announcement, EmojiDetailed, Page, User, UserDetailed } from './autogen/models';
|
||||
import { Announcement, EmojiDetailed, MeDetailed, MeDetailedOnly, Page, User, UserDetailed } from './autogen/models';
|
||||
|
||||
export * from './autogen/entities';
|
||||
export * from './autogen/models';
|
||||
@ -183,3 +183,38 @@ export type EmojiDeleted = {
|
||||
export type AnnouncementCreated = {
|
||||
announcement: Announcement;
|
||||
};
|
||||
|
||||
export type SignupRequest = {
|
||||
username: string;
|
||||
password: string;
|
||||
host?: string;
|
||||
invitationCode?: string;
|
||||
emailAddress?: string;
|
||||
'hcaptcha-response'?: string | null;
|
||||
'g-recaptcha-response'?: string | null;
|
||||
'turnstile-response'?: string | null;
|
||||
}
|
||||
|
||||
export type SignupResponse = MeDetailed & {
|
||||
token: string;
|
||||
}
|
||||
|
||||
export type SignupPendingRequest = {
|
||||
code: string;
|
||||
};
|
||||
|
||||
export type SignupPendingResponse = {
|
||||
id: User['id'],
|
||||
i: string,
|
||||
};
|
||||
|
||||
export type SigninRequest = {
|
||||
username: string;
|
||||
password: string;
|
||||
token?: string;
|
||||
};
|
||||
|
||||
export type SigninResponse = {
|
||||
id: User['id'],
|
||||
i: string,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user