fix(misskey-js): add mahjong streaming types

This commit is contained in:
zyoshoka 2025-04-18 23:16:37 +09:00
parent ccb6007d32
commit dc55fba800
No known key found for this signature in database
4 changed files with 106 additions and 3 deletions

View File

@ -307,7 +307,7 @@ const $i = ensureSignin();
const props = defineProps<{
room: Misskey.entities.MahjongRoomDetailed;
connection?: Misskey.ChannelConnection | null;
connection?: Misskey.ChannelConnection<Misskey.Channels['mahjongRoom']> | null;
}>();
const room = ref<Misskey.entities.MahjongRoomDetailed>(deepClone(props.room));

View File

@ -69,7 +69,7 @@ const router = useRouter();
const props = defineProps<{
room: Misskey.entities.MahjongRoomDetailed;
connection: Misskey.ChannelConnection;
connection: Misskey.ChannelConnection<Misskey.Channels['mahjongRoom']>;
}>();
const room = ref<Misskey.entities.MahjongRoomDetailed>(deepClone(props.room));

View File

@ -32,7 +32,7 @@ const props = defineProps<{
}>();
const room = shallowRef<Misskey.entities.MahjongRoomDetailed | null>(null);
const connection = shallowRef<Misskey.ChannelConnection | null>(null);
const connection = shallowRef<Misskey.ChannelConnection<Misskey.Channels['mahjongRoom']> | null>(null);
const shareWhenStart = ref(false);
watch(() => props.roomId, () => {

View File

@ -4,6 +4,7 @@ import {
ChatMessageLite,
DriveFile,
DriveFolder,
MahjongRoomDetailed,
Note,
Notification,
Signin,
@ -32,6 +33,8 @@ type ReversiUpdateSettings<K extends ReversiUpdateKey> = {
value: ReversiGameDetailed[K];
};
type MmjHouse = 'e' | 's' | 'w' | 'n';
export type Channels = {
main: {
params: null;
@ -277,6 +280,106 @@ export type Channels = {
};
};
};
mahjongRoom: {
params: {
roomId: string;
};
events: {
joined: (payload: {
index: number;
user: UserLite | null;
}) => void;
changeReadyStates: (payload: {
user1: boolean;
user2: boolean;
user3: boolean;
user4: boolean;
}) => void;
started: (payload: { room: MahjongRoomDetailed }) => void;
nextKyoku: (payload: { room: MahjongRoomDetailed }) => void;
tsumo: (payload: {
house: MmjHouse;
tile: number;
}) => void;
dahai: (payload: {
house: MmjHouse;
tile: number;
riichi: boolean;
}) => void;
dahaiAndTsumo: (payload: {
dahaiHouse: MmjHouse;
dahaiTile: number;
tsumoTile: number;
riichi: boolean;
}) => void;
ponned: (payload: {
caller: MmjHouse;
callee: MmjHouse;
tiles: readonly [number, number, number];
}) => void;
kanned: (payload: {
caller: MmjHouse;
callee: MmjHouse;
tiles: readonly [number, number, number, number];
rinsyan: number;
}) => void;
ciied: (payload: {
caller: MmjHouse;
callee: MmjHouse;
tiles: readonly [number, number, number];
}) => void;
ronned: (payload: {
callers: MmjHouse[];
callee: MmjHouse;
handTiles: Record<MmjHouse, number[]>;
}) => void;
ryuukyoku: (payload: unknown) => void;
ankanned: (payload: {
house: MmjHouse;
tiles: readonly [number, number, number, number];
rinsyan: number;
}) => void;
kakanned: (payload: {
house: MmjHouse;
tiles: readonly [number, number, number, number];
rinsyan: number;
from: MmjHouse;
}) => void;
tsumoHora: (payload: {
house: MmjHouse;
handTiles: number[];
tsumoTile: number;
}) => void;
};
receives: {
ready: boolean;
updateSettings: {
key: string;
body: unknown;
};
addAi: Record<string, never>;
confirmNextKyoku: Record<string, never>;
dahai: {
tile: number;
riichi?: boolean;
};
tsumoHora: Record<string, never>;
ronHora: Record<string, never>;
pon: Record<string, never>;
cii: {
pattern: string;
};
kan: Record<string, never>;
ankan: {
tile: number;
};
kakan: {
tile: number;
};
nop: Record<string, never>;
claimTimeIsUp: Record<string, never>;
};
};
};
export type NoteUpdatedEvent = { id: Note['id'] } & ({