1
0

merge upstream

This commit is contained in:
Hazelnoot
2025-03-25 16:14:53 -04:00
1065 changed files with 32953 additions and 20092 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
{
"$schema": "https://json.schemastore.org/swcrc",
"$schema": "https://swc.rs/schema.json",
"jsc": {
"parser": {
"syntax": "typescript",
+5 -5
View File
@@ -83,8 +83,8 @@ const mainChannel = stream.useChannel('main');
``` ts
const stream = new Misskey.Stream('https://misskey.test', { token: 'TOKEN' });
const messagingChannel = stream.useChannel('messaging', {
otherparty: 'xxxxxxxxxx',
const chatChannel = stream.useChannel('chat', {
other: 'xxxxxxxxxx',
});
```
@@ -115,11 +115,11 @@ mainChannel.on('notification', notification => {
``` ts
const stream = new Misskey.Stream('https://misskey.test', { token: 'TOKEN' });
const messagingChannel = stream.useChannel('messaging', {
otherparty: 'xxxxxxxxxx',
const chatChannel = stream.useChannel('chat', {
other: 'xxxxxxxxxx',
});
messagingChannel.send('read', {
chatChannel.send('read', {
id: 'xxxxxxxxxx'
});
```
+9 -7
View File
@@ -13,6 +13,11 @@ export default [
'test',
'test-d',
'generator',
'**/lib/',
'**/temp/',
'**/built/',
'**/coverage/',
'**/node_modules/',
],
},
{
@@ -27,12 +32,9 @@ export default [
},
},
{
ignores: [
"**/lib/",
"**/temp/",
"**/built/",
"**/coverage/",
"**/node_modules/",
]
files: ['src/autogen/**/*.ts', 'src/autogen/**/*.tsx'],
rules: {
'@stylistic/indent': 'off',
},
},
];
+214 -208
View File
@@ -7,7 +7,7 @@
import type { AuthenticationResponseJSON } from '@simplewebauthn/types';
import { EventEmitter } from 'eventemitter3';
import { Options } from 'reconnecting-websocket';
import type { PublicKeyCredentialRequestOptionsJSON } from '@simplewebauthn/types';
import type { PublicKeyCredentialRequestOptionsJSON as PublicKeyCredentialRequestOptionsJSON_2 } from '@simplewebauthn/types';
import _ReconnectingWebSocket from 'reconnecting-websocket';
// Warning: (ae-forgotten-export) The symbol "components" needs to be exported by the entry point index.d.ts
@@ -119,9 +119,6 @@ type AdminAnnouncementsListResponse = operations['admin___announcements___list']
// @public (undocumented)
type AdminAnnouncementsUpdateRequest = operations['admin___announcements___update']['requestBody']['content']['application/json'];
// @public (undocumented)
type AdminApproveUserRequest = operations['admin___approve-user']['requestBody']['content']['application/json'];
// @public (undocumented)
type AdminAvatarDecorationsCreateRequest = operations['admin___avatar-decorations___create']['requestBody']['content']['application/json'];
@@ -146,12 +143,6 @@ type AdminCaptchaCurrentResponse = operations['admin___captcha___current']['resp
// @public (undocumented)
type AdminCaptchaSaveRequest = operations['admin___captcha___save']['requestBody']['content']['application/json'];
// @public (undocumented)
type AdminCwUserRequest = operations['admin___cw-user']['requestBody']['content']['application/json'];
// @public (undocumented)
type AdminDeclineUserRequest = operations['admin___decline-user']['requestBody']['content']['application/json'];
// @public (undocumented)
type AdminDeleteAccountRequest = operations['admin___delete-account']['requestBody']['content']['application/json'];
@@ -263,9 +254,6 @@ type AdminInviteListResponse = operations['admin___invite___list']['responses'][
// @public (undocumented)
type AdminMetaResponse = operations['admin___meta']['responses']['200']['content']['application/json'];
// @public (undocumented)
type AdminNsfwUserRequest = operations['admin___nsfw-user']['requestBody']['content']['application/json'];
// @public (undocumented)
type AdminPromoCreateRequest = operations['admin___promo___create']['requestBody']['content']['application/json'];
@@ -281,9 +269,6 @@ type AdminQueuePromoteRequest = operations['admin___queue___promote']['requestBo
// @public (undocumented)
type AdminQueueStatsResponse = operations['admin___queue___stats']['responses']['200']['content']['application/json'];
// @public (undocumented)
type AdminRejectQuotesRequest = operations['admin___reject-quotes']['requestBody']['content']['application/json'];
// @public (undocumented)
type AdminRelaysAddRequest = operations['admin___relays___add']['requestBody']['content']['application/json'];
@@ -365,9 +350,6 @@ type AdminShowUsersRequest = operations['admin___show-users']['requestBody']['co
// @public (undocumented)
type AdminShowUsersResponse = operations['admin___show-users']['responses']['200']['content']['application/json'];
// @public (undocumented)
type AdminSilenceUserRequest = operations['admin___silence-user']['requestBody']['content']['application/json'];
// @public (undocumented)
type AdminSuspendUserRequest = operations['admin___suspend-user']['requestBody']['content']['application/json'];
@@ -401,18 +383,12 @@ type AdminSystemWebhookUpdateRequest = operations['admin___system-webhook___upda
// @public (undocumented)
type AdminSystemWebhookUpdateResponse = operations['admin___system-webhook___update']['responses']['200']['content']['application/json'];
// @public (undocumented)
type AdminUnnsfwUserRequest = operations['admin___unnsfw-user']['requestBody']['content']['application/json'];
// @public (undocumented)
type AdminUnsetUserAvatarRequest = operations['admin___unset-user-avatar']['requestBody']['content']['application/json'];
// @public (undocumented)
type AdminUnsetUserBannerRequest = operations['admin___unset-user-banner']['requestBody']['content']['application/json'];
// @public (undocumented)
type AdminUnsilenceUserRequest = operations['admin___unsilence-user']['requestBody']['content']['application/json'];
// @public (undocumented)
type AdminUnsuspendUserRequest = operations['admin___unsuspend-user']['requestBody']['content']['application/json'];
@@ -422,6 +398,12 @@ type AdminUpdateAbuseUserReportRequest = operations['admin___update-abuse-user-r
// @public (undocumented)
type AdminUpdateMetaRequest = operations['admin___update-meta']['requestBody']['content']['application/json'];
// @public (undocumented)
type AdminUpdateProxyAccountRequest = operations['admin___update-proxy-account']['requestBody']['content']['application/json'];
// @public (undocumented)
type AdminUpdateProxyAccountResponse = operations['admin___update-proxy-account']['responses']['200']['content']['application/json'];
// @public (undocumented)
type AdminUpdateUserNoteRequest = operations['admin___update-user-note']['requestBody']['content']['application/json'];
@@ -637,13 +619,9 @@ export type Channels = {
}) => void;
readAllNotifications: () => void;
unreadNotification: (payload: Notification_2) => void;
unreadMention: (payload: Note['id']) => void;
readAllUnreadMentions: () => void;
notificationFlushed: () => void;
unreadSpecifiedNote: (payload: Note['id']) => void;
readAllUnreadSpecifiedNotes: () => void;
readAllAntennas: () => void;
unreadAntenna: (payload: Antenna) => void;
newChatMessage: (payload: ChatMessage) => void;
readAllAnnouncements: () => void;
myTokenRegenerated: () => void;
signin: (payload: Signin) => void;
@@ -656,7 +634,6 @@ export type Channels = {
readAntenna: (payload: Antenna) => void;
receiveFollowRequest: (payload: User) => void;
announcementCreated: (payload: AnnouncementCreated) => void;
edited: (payload: Note) => void;
};
receives: null;
};
@@ -664,7 +641,6 @@ export type Channels = {
params: {
withRenotes?: boolean;
withFiles?: boolean;
withBots?: boolean;
};
events: {
note: (payload: Note) => void;
@@ -676,7 +652,6 @@ export type Channels = {
withRenotes?: boolean;
withReplies?: boolean;
withFiles?: boolean;
withBots?: boolean;
};
events: {
note: (payload: Note) => void;
@@ -688,7 +663,6 @@ export type Channels = {
withRenotes?: boolean;
withReplies?: boolean;
withFiles?: boolean;
withBots?: boolean;
};
events: {
note: (payload: Note) => void;
@@ -699,18 +673,6 @@ export type Channels = {
params: {
withRenotes?: boolean;
withFiles?: boolean;
withBots?: boolean;
};
events: {
note: (payload: Note) => void;
};
receives: null;
};
bubbleTimeline: {
params: {
withRenotes?: boolean;
withFiles?: boolean;
withBots?: boolean;
};
events: {
note: (payload: Note) => void;
@@ -985,6 +947,153 @@ type ChartsUsersRequest = operations['charts___users']['requestBody']['content']
// @public (undocumented)
type ChartsUsersResponse = operations['charts___users']['responses']['200']['content']['application/json'];
// @public (undocumented)
type ChatHistoryRequest = operations['chat___history']['requestBody']['content']['application/json'];
// @public (undocumented)
type ChatHistoryResponse = operations['chat___history']['responses']['200']['content']['application/json'];
// @public (undocumented)
type ChatMessage = components['schemas']['ChatMessage'];
// @public (undocumented)
type ChatMessageLite = components['schemas']['ChatMessageLite'];
// @public (undocumented)
type ChatMessagesCreateToRoomRequest = operations['chat___messages___create-to-room']['requestBody']['content']['application/json'];
// @public (undocumented)
type ChatMessagesCreateToRoomResponse = operations['chat___messages___create-to-room']['responses']['200']['content']['application/json'];
// @public (undocumented)
type ChatMessagesCreateToUserRequest = operations['chat___messages___create-to-user']['requestBody']['content']['application/json'];
// @public (undocumented)
type ChatMessagesCreateToUserResponse = operations['chat___messages___create-to-user']['responses']['200']['content']['application/json'];
// @public (undocumented)
type ChatMessagesDeleteRequest = operations['chat___messages___delete']['requestBody']['content']['application/json'];
// @public (undocumented)
type ChatMessagesDeleteResponse = operations['chat___messages___delete']['responses']['200']['content']['application/json'];
// @public (undocumented)
type ChatMessagesReactRequest = operations['chat___messages___react']['requestBody']['content']['application/json'];
// @public (undocumented)
type ChatMessagesReactResponse = operations['chat___messages___react']['responses']['200']['content']['application/json'];
// @public (undocumented)
type ChatMessagesRoomTimelineRequest = operations['chat___messages___room-timeline']['requestBody']['content']['application/json'];
// @public (undocumented)
type ChatMessagesRoomTimelineResponse = operations['chat___messages___room-timeline']['responses']['200']['content']['application/json'];
// @public (undocumented)
type ChatMessagesSearchRequest = operations['chat___messages___search']['requestBody']['content']['application/json'];
// @public (undocumented)
type ChatMessagesSearchResponse = operations['chat___messages___search']['responses']['200']['content']['application/json'];
// @public (undocumented)
type ChatMessagesShowRequest = operations['chat___messages___show']['requestBody']['content']['application/json'];
// @public (undocumented)
type ChatMessagesShowResponse = operations['chat___messages___show']['responses']['200']['content']['application/json'];
// @public (undocumented)
type ChatMessagesUserTimelineRequest = operations['chat___messages___user-timeline']['requestBody']['content']['application/json'];
// @public (undocumented)
type ChatMessagesUserTimelineResponse = operations['chat___messages___user-timeline']['responses']['200']['content']['application/json'];
// @public (undocumented)
type ChatRoom = components['schemas']['ChatRoom'];
// @public (undocumented)
type ChatRoomInvitation = components['schemas']['ChatRoomInvitation'];
// @public (undocumented)
type ChatRoomMembership = components['schemas']['ChatRoomMembership'];
// @public (undocumented)
type ChatRoomsCreateRequest = operations['chat___rooms___create']['requestBody']['content']['application/json'];
// @public (undocumented)
type ChatRoomsCreateResponse = operations['chat___rooms___create']['responses']['200']['content']['application/json'];
// @public (undocumented)
type ChatRoomsDeleteRequest = operations['chat___rooms___delete']['requestBody']['content']['application/json'];
// @public (undocumented)
type ChatRoomsDeleteResponse = operations['chat___rooms___delete']['responses']['200']['content']['application/json'];
// @public (undocumented)
type ChatRoomsInvitationsCreateRequest = operations['chat___rooms___invitations___create']['requestBody']['content']['application/json'];
// @public (undocumented)
type ChatRoomsInvitationsCreateResponse = operations['chat___rooms___invitations___create']['responses']['200']['content']['application/json'];
// @public (undocumented)
type ChatRoomsInvitationsIgnoreRequest = operations['chat___rooms___invitations___ignore']['requestBody']['content']['application/json'];
// @public (undocumented)
type ChatRoomsInvitationsIgnoreResponse = operations['chat___rooms___invitations___ignore']['responses']['200']['content']['application/json'];
// @public (undocumented)
type ChatRoomsInvitationsInboxRequest = operations['chat___rooms___invitations___inbox']['requestBody']['content']['application/json'];
// @public (undocumented)
type ChatRoomsInvitationsInboxResponse = operations['chat___rooms___invitations___inbox']['responses']['200']['content']['application/json'];
// @public (undocumented)
type ChatRoomsJoiningRequest = operations['chat___rooms___joining']['requestBody']['content']['application/json'];
// @public (undocumented)
type ChatRoomsJoiningResponse = operations['chat___rooms___joining']['responses']['200']['content']['application/json'];
// @public (undocumented)
type ChatRoomsJoinRequest = operations['chat___rooms___join']['requestBody']['content']['application/json'];
// @public (undocumented)
type ChatRoomsJoinResponse = operations['chat___rooms___join']['responses']['200']['content']['application/json'];
// @public (undocumented)
type ChatRoomsLeaveRequest = operations['chat___rooms___leave']['requestBody']['content']['application/json'];
// @public (undocumented)
type ChatRoomsLeaveResponse = operations['chat___rooms___leave']['responses']['200']['content']['application/json'];
// @public (undocumented)
type ChatRoomsMembersRequest = operations['chat___rooms___members']['requestBody']['content']['application/json'];
// @public (undocumented)
type ChatRoomsMembersResponse = operations['chat___rooms___members']['responses']['200']['content']['application/json'];
// @public (undocumented)
type ChatRoomsMuteRequest = operations['chat___rooms___mute']['requestBody']['content']['application/json'];
// @public (undocumented)
type ChatRoomsMuteResponse = operations['chat___rooms___mute']['responses']['200']['content']['application/json'];
// @public (undocumented)
type ChatRoomsOwnedRequest = operations['chat___rooms___owned']['requestBody']['content']['application/json'];
// @public (undocumented)
type ChatRoomsOwnedResponse = operations['chat___rooms___owned']['responses']['200']['content']['application/json'];
// @public (undocumented)
type ChatRoomsShowRequest = operations['chat___rooms___show']['requestBody']['content']['application/json'];
// @public (undocumented)
type ChatRoomsShowResponse = operations['chat___rooms___show']['responses']['200']['content']['application/json'];
// @public (undocumented)
type ChatRoomsUpdateRequest = operations['chat___rooms___update']['requestBody']['content']['application/json'];
// @public (undocumented)
type ChatRoomsUpdateResponse = operations['chat___rooms___update']['responses']['200']['content']['application/json'];
// @public (undocumented)
type Clip = components['schemas']['Clip'];
@@ -1304,7 +1413,6 @@ declare namespace entities {
AdminAnnouncementsListRequest,
AdminAnnouncementsListResponse,
AdminAnnouncementsUpdateRequest,
AdminApproveUserRequest,
AdminAvatarDecorationsCreateRequest,
AdminAvatarDecorationsCreateResponse,
AdminAvatarDecorationsDeleteRequest,
@@ -1313,8 +1421,6 @@ declare namespace entities {
AdminAvatarDecorationsUpdateRequest,
AdminCaptchaCurrentResponse,
AdminCaptchaSaveRequest,
AdminCwUserRequest,
AdminDeclineUserRequest,
AdminDeleteAccountRequest,
AdminDeleteAllFilesOfAUserRequest,
AdminDriveFilesRequest,
@@ -1352,13 +1458,11 @@ declare namespace entities {
AdminInviteListRequest,
AdminInviteListResponse,
AdminMetaResponse,
AdminNsfwUserRequest,
AdminPromoCreateRequest,
AdminQueueDeliverDelayedResponse,
AdminQueueInboxDelayedResponse,
AdminQueuePromoteRequest,
AdminQueueStatsResponse,
AdminRejectQuotesRequest,
AdminRelaysAddRequest,
AdminRelaysAddResponse,
AdminRelaysListResponse,
@@ -1386,7 +1490,6 @@ declare namespace entities {
AdminShowUserResponse,
AdminShowUsersRequest,
AdminShowUsersResponse,
AdminSilenceUserRequest,
AdminSuspendUserRequest,
AdminSystemWebhookCreateRequest,
AdminSystemWebhookCreateResponse,
@@ -1398,13 +1501,13 @@ declare namespace entities {
AdminSystemWebhookTestRequest,
AdminSystemWebhookUpdateRequest,
AdminSystemWebhookUpdateResponse,
AdminUnnsfwUserRequest,
AdminUnsetUserAvatarRequest,
AdminUnsetUserBannerRequest,
AdminUnsilenceUserRequest,
AdminUnsuspendUserRequest,
AdminUpdateAbuseUserReportRequest,
AdminUpdateMetaRequest,
AdminUpdateProxyAccountRequest,
AdminUpdateProxyAccountResponse,
AdminUpdateUserNoteRequest,
AnnouncementsRequest,
AnnouncementsResponse,
@@ -1488,6 +1591,50 @@ declare namespace entities {
ChartsUserReactionsResponse,
ChartsUsersRequest,
ChartsUsersResponse,
ChatHistoryRequest,
ChatHistoryResponse,
ChatMessagesCreateToRoomRequest,
ChatMessagesCreateToRoomResponse,
ChatMessagesCreateToUserRequest,
ChatMessagesCreateToUserResponse,
ChatMessagesDeleteRequest,
ChatMessagesDeleteResponse,
ChatMessagesReactRequest,
ChatMessagesReactResponse,
ChatMessagesRoomTimelineRequest,
ChatMessagesRoomTimelineResponse,
ChatMessagesSearchRequest,
ChatMessagesSearchResponse,
ChatMessagesShowRequest,
ChatMessagesShowResponse,
ChatMessagesUserTimelineRequest,
ChatMessagesUserTimelineResponse,
ChatRoomsCreateRequest,
ChatRoomsCreateResponse,
ChatRoomsDeleteRequest,
ChatRoomsDeleteResponse,
ChatRoomsInvitationsCreateRequest,
ChatRoomsInvitationsCreateResponse,
ChatRoomsInvitationsIgnoreRequest,
ChatRoomsInvitationsIgnoreResponse,
ChatRoomsInvitationsInboxRequest,
ChatRoomsInvitationsInboxResponse,
ChatRoomsJoinRequest,
ChatRoomsJoinResponse,
ChatRoomsJoiningRequest,
ChatRoomsJoiningResponse,
ChatRoomsLeaveRequest,
ChatRoomsLeaveResponse,
ChatRoomsMembersRequest,
ChatRoomsMembersResponse,
ChatRoomsMuteRequest,
ChatRoomsMuteResponse,
ChatRoomsOwnedRequest,
ChatRoomsOwnedResponse,
ChatRoomsShowRequest,
ChatRoomsShowResponse,
ChatRoomsUpdateRequest,
ChatRoomsUpdateResponse,
ClipsAddNoteRequest,
ClipsCreateRequest,
ClipsCreateResponse,
@@ -1647,7 +1794,6 @@ declare namespace entities {
IImportBlockingRequest,
IImportFollowingRequest,
IImportMutingRequest,
IImportNotesRequest,
IImportUserListsRequest,
IMoveRequest,
IMoveResponse,
@@ -1669,7 +1815,6 @@ declare namespace entities {
IRegistryGetAllResponse,
IRegistryGetDetailRequest,
IRegistryGetDetailResponse,
IRegistryGetUnsecureRequest,
IRegistryKeysRequest,
IRegistryKeysResponse,
IRegistryKeysWithTypeRequest,
@@ -1711,8 +1856,6 @@ declare namespace entities {
MyAppsResponse,
NotesRequest,
NotesResponse,
NotesBubbleTimelineRequest,
NotesBubbleTimelineResponse,
NotesChildrenRequest,
NotesChildrenResponse,
NotesClipsRequest,
@@ -1722,26 +1865,20 @@ declare namespace entities {
NotesCreateRequest,
NotesCreateResponse,
NotesDeleteRequest,
NotesEditRequest,
NotesEditResponse,
NotesFavoritesCreateRequest,
NotesFavoritesDeleteRequest,
NotesFeaturedRequest,
NotesFeaturedResponse,
NotesFollowingRequest,
NotesFollowingResponse,
NotesGlobalTimelineRequest,
NotesGlobalTimelineResponse,
NotesHybridTimelineRequest,
NotesHybridTimelineResponse,
NotesLikeRequest,
NotesLocalTimelineRequest,
NotesLocalTimelineResponse,
NotesMentionsRequest,
NotesMentionsResponse,
NotesPollsRecommendationRequest,
NotesPollsRecommendationResponse,
NotesPollsRefreshRequest,
NotesPollsVoteRequest,
NotesReactionsRequest,
NotesReactionsResponse,
@@ -1751,10 +1888,6 @@ declare namespace entities {
NotesRenotesResponse,
NotesRepliesRequest,
NotesRepliesResponse,
NotesScheduleCreateRequest,
NotesScheduleDeleteRequest,
NotesScheduleListRequest,
NotesScheduleListResponse,
NotesSearchRequest,
NotesSearchResponse,
NotesSearchByTagRequest,
@@ -1772,8 +1905,6 @@ declare namespace entities {
NotesUnrenoteRequest,
NotesUserListTimelineRequest,
NotesUserListTimelineResponse,
NotesVersionsRequest,
NotesVersionsResponse,
NotificationsCreateRequest,
PagePushRequest,
PagesCreateRequest,
@@ -1814,7 +1945,6 @@ declare namespace entities {
RolesUsersRequest,
RolesUsersResponse,
ServerInfoResponse,
SponsorsRequest,
StatsResponse,
SwRegisterRequest,
SwRegisterResponse,
@@ -1937,7 +2067,12 @@ declare namespace entities {
MetaDetailedOnly,
MetaDetailed,
SystemWebhook,
AbuseReportNotificationRecipient
AbuseReportNotificationRecipient,
ChatMessage,
ChatMessageLite,
ChatRoom,
ChatRoomInvitation,
ChatRoomMembership
}
}
export { entities }
@@ -2310,9 +2445,6 @@ type IImportFollowingRequest = operations['i___import-following']['requestBody']
// @public (undocumented)
type IImportMutingRequest = operations['i___import-muting']['requestBody']['content']['application/json'];
// @public (undocumented)
type IImportNotesRequest = operations['i___import-notes']['requestBody']['content']['application/json'];
// @public (undocumented)
type IImportUserListsRequest = operations['i___import-user-lists']['requestBody']['content']['application/json'];
@@ -2394,9 +2526,6 @@ type IRegistryGetRequest = operations['i___registry___get']['requestBody']['cont
// @public (undocumented)
type IRegistryGetResponse = operations['i___registry___get']['responses']['200']['content']['application/json'];
// @public (undocumented)
type IRegistryGetUnsecureRequest = operations['i___registry___get-unsecure']['requestBody']['content']['application/json'];
// @public (undocumented)
type IRegistryKeysRequest = operations['i___registry___keys']['requestBody']['content']['application/json'];
@@ -2548,30 +2677,12 @@ type ModerationLog = {
} & ({
type: 'updateServerSettings';
info: ModerationLogPayloads['updateServerSettings'];
} | {
type: 'approve';
info: ModerationLogPayloads['approve'];
} | {
type: 'decline';
info: ModerationLogPayloads['decline'];
} | {
type: 'suspend';
info: ModerationLogPayloads['suspend'];
} | {
type: 'unsuspend';
info: ModerationLogPayloads['unsuspend'];
} | {
type: 'acceptQuotesUser';
info: ModerationLogPayloads['acceptQuotesUser'];
} | {
type: 'rejectQuotesUser';
info: ModerationLogPayloads['rejectQuotesUser'];
} | {
type: 'acceptQuotesInstance';
info: ModerationLogPayloads['acceptQuotesInstance'];
} | {
type: 'rejectQuotesInstance';
info: ModerationLogPayloads['rejectQuotesInstance'];
} | {
type: 'updateUserNote';
info: ModerationLogPayloads['updateUserNote'];
@@ -2629,15 +2740,6 @@ type ModerationLog = {
} | {
type: 'deleteUserAnnouncement';
info: ModerationLogPayloads['deleteUserAnnouncement'];
} | {
type: 'setMandatoryCW';
info: ModerationLogPayloads['setMandatoryCW'];
} | {
type: 'setRemoteInstanceNSFW';
info: ModerationLogPayloads['setRemoteInstanceNSFW'];
} | {
type: 'unsetRemoteInstanceNSFW';
info: ModerationLogPayloads['unsetRemoteInstanceNSFW'];
} | {
type: 'resetPassword';
info: ModerationLogPayloads['resetPassword'];
@@ -2647,12 +2749,6 @@ type ModerationLog = {
} | {
type: 'unsuspendRemoteInstance';
info: ModerationLogPayloads['unsuspendRemoteInstance'];
} | {
type: 'rejectRemoteInstanceReports';
info: ModerationLogPayloads['rejectRemoteInstanceReports'];
} | {
type: 'acceptRemoteInstanceReports';
info: ModerationLogPayloads['acceptRemoteInstanceReports'];
} | {
type: 'updateRemoteInstanceNote';
info: ModerationLogPayloads['updateRemoteInstanceNote'];
@@ -2728,55 +2824,10 @@ type ModerationLog = {
} | {
type: 'deleteGalleryPost';
info: ModerationLogPayloads['deleteGalleryPost'];
} | {
type: 'clearUserFiles';
info: ModerationLogPayloads['clearUserFiles'];
} | {
type: 'nsfwUser';
info: ModerationLogPayloads['nsfwUser'];
} | {
type: 'unNsfwUser';
info: ModerationLogPayloads['unNsfwUser'];
} | {
type: 'silenceUser';
info: ModerationLogPayloads['silenceUser'];
} | {
type: 'unSilenceUser';
info: ModerationLogPayloads['unSilenceUser'];
} | {
type: 'createAccount';
info: ModerationLogPayloads['createAccount'];
} | {
type: 'clearRemoteFiles';
info: ModerationLogPayloads['clearRemoteFiles'];
} | {
type: 'clearOwnerlessFiles';
info: ModerationLogPayloads['clearOwnerlessFiles'];
} | {
type: 'updateCustomEmojis';
info: ModerationLogPayloads['updateCustomEmojis'];
} | {
type: 'importCustomEmojis';
info: ModerationLogPayloads['importCustomEmojis'];
} | {
type: 'clearInstanceFiles';
info: ModerationLogPayloads['clearInstanceFiles'];
} | {
type: 'severFollowRelations';
info: ModerationLogPayloads['severFollowRelations'];
} | {
type: 'createPromo';
info: ModerationLogPayloads['createPromo'];
} | {
type: 'addRelay';
info: ModerationLogPayloads['addRelay'];
} | {
type: 'removeRelay';
info: ModerationLogPayloads['removeRelay'];
});
// @public (undocumented)
export const moderationLogTypes: readonly ["updateServerSettings", "suspend", "approve", "decline", "unsuspend", "updateUserNote", "addCustomEmoji", "updateCustomEmoji", "deleteCustomEmoji", "assignRole", "unassignRole", "createRole", "updateRole", "deleteRole", "clearQueue", "promoteQueue", "deleteDriveFile", "deleteNote", "createGlobalAnnouncement", "createUserAnnouncement", "updateGlobalAnnouncement", "updateUserAnnouncement", "deleteGlobalAnnouncement", "deleteUserAnnouncement", "resetPassword", "setMandatoryCW", "setRemoteInstanceNSFW", "unsetRemoteInstanceNSFW", "suspendRemoteInstance", "unsuspendRemoteInstance", "rejectRemoteInstanceReports", "acceptRemoteInstanceReports", "updateRemoteInstanceNote", "markSensitiveDriveFile", "unmarkSensitiveDriveFile", "resolveAbuseReport", "forwardAbuseReport", "updateAbuseReportNote", "createInvitation", "createAd", "updateAd", "deleteAd", "createAvatarDecoration", "updateAvatarDecoration", "deleteAvatarDecoration", "unsetUserAvatar", "unsetUserBanner", "createSystemWebhook", "updateSystemWebhook", "deleteSystemWebhook", "createAbuseReportNotificationRecipient", "updateAbuseReportNotificationRecipient", "deleteAbuseReportNotificationRecipient", "deleteAccount", "deletePage", "deleteFlash", "deleteGalleryPost"];
export const moderationLogTypes: readonly ["updateServerSettings", "suspend", "unsuspend", "updateUserNote", "addCustomEmoji", "updateCustomEmoji", "deleteCustomEmoji", "assignRole", "unassignRole", "createRole", "updateRole", "deleteRole", "clearQueue", "promoteQueue", "deleteDriveFile", "deleteNote", "createGlobalAnnouncement", "createUserAnnouncement", "updateGlobalAnnouncement", "updateUserAnnouncement", "deleteGlobalAnnouncement", "deleteUserAnnouncement", "resetPassword", "suspendRemoteInstance", "unsuspendRemoteInstance", "updateRemoteInstanceNote", "markSensitiveDriveFile", "unmarkSensitiveDriveFile", "resolveAbuseReport", "forwardAbuseReport", "updateAbuseReportNote", "createInvitation", "createAd", "updateAd", "deleteAd", "createAvatarDecoration", "updateAvatarDecoration", "deleteAvatarDecoration", "unsetUserAvatar", "unsetUserBanner", "createSystemWebhook", "updateSystemWebhook", "deleteSystemWebhook", "createAbuseReportNotificationRecipient", "updateAbuseReportNotificationRecipient", "deleteAbuseReportNotificationRecipient", "deleteAccount", "deletePage", "deleteFlash", "deleteGalleryPost"];
// @public (undocumented)
type MuteCreateRequest = operations['mute___create']['requestBody']['content']['application/json'];
@@ -2818,12 +2869,6 @@ type NoteFavorite = components['schemas']['NoteFavorite'];
// @public (undocumented)
type NoteReaction = components['schemas']['NoteReaction'];
// @public (undocumented)
type NotesBubbleTimelineRequest = operations['notes___bubble-timeline']['requestBody']['content']['application/json'];
// @public (undocumented)
type NotesBubbleTimelineResponse = operations['notes___bubble-timeline']['responses']['200']['content']['application/json'];
// @public (undocumented)
type NotesChildrenRequest = operations['notes___children']['requestBody']['content']['application/json'];
@@ -2851,12 +2896,6 @@ type NotesCreateResponse = operations['notes___create']['responses']['200']['con
// @public (undocumented)
type NotesDeleteRequest = operations['notes___delete']['requestBody']['content']['application/json'];
// @public (undocumented)
type NotesEditRequest = operations['notes___edit']['requestBody']['content']['application/json'];
// @public (undocumented)
type NotesEditResponse = operations['notes___edit']['responses']['200']['content']['application/json'];
// @public (undocumented)
type NotesFavoritesCreateRequest = operations['notes___favorites___create']['requestBody']['content']['application/json'];
@@ -2869,12 +2908,6 @@ type NotesFeaturedRequest = operations['notes___featured']['requestBody']['conte
// @public (undocumented)
type NotesFeaturedResponse = operations['notes___featured']['responses']['200']['content']['application/json'];
// @public (undocumented)
type NotesFollowingRequest = operations['notes___following']['requestBody']['content']['application/json'];
// @public (undocumented)
type NotesFollowingResponse = operations['notes___following']['responses']['200']['content']['application/json'];
// @public (undocumented)
type NotesGlobalTimelineRequest = operations['notes___global-timeline']['requestBody']['content']['application/json'];
@@ -2887,9 +2920,6 @@ type NotesHybridTimelineRequest = operations['notes___hybrid-timeline']['request
// @public (undocumented)
type NotesHybridTimelineResponse = operations['notes___hybrid-timeline']['responses']['200']['content']['application/json'];
// @public (undocumented)
type NotesLikeRequest = operations['notes___like']['requestBody']['content']['application/json'];
// @public (undocumented)
type NotesLocalTimelineRequest = operations['notes___local-timeline']['requestBody']['content']['application/json'];
@@ -2908,9 +2938,6 @@ type NotesPollsRecommendationRequest = operations['notes___polls___recommendatio
// @public (undocumented)
type NotesPollsRecommendationResponse = operations['notes___polls___recommendation']['responses']['200']['content']['application/json'];
// @public (undocumented)
type NotesPollsRefreshRequest = operations['notes___polls___refresh']['requestBody']['content']['application/json'];
// @public (undocumented)
type NotesPollsVoteRequest = operations['notes___polls___vote']['requestBody']['content']['application/json'];
@@ -2944,18 +2971,6 @@ type NotesRequest = operations['notes']['requestBody']['content']['application/j
// @public (undocumented)
type NotesResponse = operations['notes']['responses']['200']['content']['application/json'];
// @public (undocumented)
type NotesScheduleCreateRequest = operations['notes___schedule___create']['requestBody']['content']['application/json'];
// @public (undocumented)
type NotesScheduleDeleteRequest = operations['notes___schedule___delete']['requestBody']['content']['application/json'];
// @public (undocumented)
type NotesScheduleListRequest = operations['notes___schedule___list']['requestBody']['content']['application/json'];
// @public (undocumented)
type NotesScheduleListResponse = operations['notes___schedule___list']['responses']['200']['content']['application/json'];
// @public (undocumented)
type NotesSearchByTagRequest = operations['notes___search-by-tag']['requestBody']['content']['application/json'];
@@ -3007,12 +3022,6 @@ type NotesUserListTimelineRequest = operations['notes___user-list-timeline']['re
// @public (undocumented)
type NotesUserListTimelineResponse = operations['notes___user-list-timeline']['responses']['200']['content']['application/json'];
// @public (undocumented)
type NotesVersionsRequest = operations['notes___versions']['requestBody']['content']['application/json'];
// @public (undocumented)
type NotesVersionsResponse = operations['notes___versions']['responses']['200']['content']['application/json'];
// @public (undocumented)
export const noteVisibilities: readonly ["public", "home", "followers", "specified"];
@@ -3023,7 +3032,7 @@ type Notification_2 = components['schemas']['Notification'];
type NotificationsCreateRequest = operations['notifications___create']['requestBody']['content']['application/json'];
// @public (undocumented)
export const notificationTypes: readonly ["note", "follow", "mention", "reply", "renote", "quote", "reaction", "pollVote", "pollEnded", "receiveFollowRequest", "followRequestAccepted", "groupInvited", "app", "roleAssigned", "achievementEarned", "edited", "scheduledNoteFailed", "scheduledNotePosted"];
export const notificationTypes: readonly ["note", "follow", "mention", "reply", "renote", "quote", "reaction", "pollVote", "pollEnded", "receiveFollowRequest", "followRequestAccepted", "groupInvited", "app", "roleAssigned", "achievementEarned"];
// @public (undocumented)
export function nyaize(text: string): string;
@@ -3086,7 +3095,7 @@ type PartialRolePolicyOverride = Partial<{
}>;
// @public (undocumented)
export const permissions: readonly ["read:account", "write:account", "read:blocks", "write:blocks", "read:drive", "write:drive", "read:favorites", "write:favorites", "read:following", "write:following", "read:messaging", "write:messaging", "read:mutes", "write:mutes", "write:notes", "read:notes-schedule", "write:notes-schedule", "read:notifications", "write:notifications", "read:reactions", "write:reactions", "write:votes", "read:pages", "write:pages", "write:page-likes", "read:page-likes", "read:user-groups", "write:user-groups", "read:channels", "write:channels", "read:gallery", "write:gallery", "read:gallery-likes", "write:gallery-likes", "read:flash", "write:flash", "read:flash-likes", "write:flash-likes", "read:admin:abuse-user-reports", "write:admin:delete-account", "write:admin:delete-all-files-of-a-user", "read:admin:index-stats", "read:admin:table-stats", "read:admin:user-ips", "read:admin:meta", "write:admin:reset-password", "write:admin:resolve-abuse-user-report", "write:admin:send-email", "read:admin:server-info", "read:admin:show-moderation-log", "read:admin:show-user", "write:admin:suspend-user", "write:admin:approve-user", "write:admin:decline-user", "write:admin:nsfw-user", "write:admin:unnsfw-user", "write:admin:cw-user", "write:admin:silence-user", "write:admin:unsilence-user", "write:admin:unset-user-avatar", "write:admin:unset-user-banner", "write:admin:unsuspend-user", "write:admin:reject-quotes", "write:admin:meta", "write:admin:user-note", "write:admin:roles", "read:admin:roles", "write:admin:relays", "read:admin:relays", "write:admin:invite-codes", "read:admin:invite-codes", "write:admin:announcements", "read:admin:announcements", "write:admin:avatar-decorations", "read:admin:avatar-decorations", "write:admin:federation", "write:admin:account", "read:admin:account", "write:admin:emoji", "read:admin:emoji", "write:admin:queue", "read:admin:queue", "write:admin:promo", "write:admin:drive", "read:admin:drive", "write:admin:ad", "read:admin:ad", "write:invite-codes", "read:invite-codes", "write:clip-favorite", "read:clip-favorite", "read:federation", "write:report-abuse"];
export const permissions: readonly ["read:account", "write:account", "read:blocks", "write:blocks", "read:drive", "write:drive", "read:favorites", "write:favorites", "read:following", "write:following", "read:messaging", "write:messaging", "read:mutes", "write:mutes", "write:notes", "read:notifications", "write:notifications", "read:reactions", "write:reactions", "write:votes", "read:pages", "write:pages", "write:page-likes", "read:page-likes", "read:user-groups", "write:user-groups", "read:channels", "write:channels", "read:gallery", "write:gallery", "read:gallery-likes", "write:gallery-likes", "read:flash", "write:flash", "read:flash-likes", "write:flash-likes", "read:admin:abuse-user-reports", "write:admin:delete-account", "write:admin:delete-all-files-of-a-user", "read:admin:index-stats", "read:admin:table-stats", "read:admin:user-ips", "read:admin:meta", "write:admin:reset-password", "write:admin:resolve-abuse-user-report", "write:admin:send-email", "read:admin:server-info", "read:admin:show-moderation-log", "read:admin:show-user", "write:admin:suspend-user", "write:admin:unset-user-avatar", "write:admin:unset-user-banner", "write:admin:unsuspend-user", "write:admin:meta", "write:admin:user-note", "write:admin:roles", "read:admin:roles", "write:admin:relays", "read:admin:relays", "write:admin:invite-codes", "read:admin:invite-codes", "write:admin:announcements", "read:admin:announcements", "write:admin:avatar-decorations", "read:admin:avatar-decorations", "write:admin:federation", "write:admin:account", "read:admin:account", "write:admin:emoji", "read:admin:emoji", "write:admin:queue", "read:admin:queue", "write:admin:promo", "write:admin:drive", "read:admin:drive", "write:admin:ad", "read:admin:ad", "write:invite-codes", "read:invite-codes", "write:clip-favorite", "read:clip-favorite", "read:federation", "write:report-abuse", "write:chat", "read:chat"];
// @public (undocumented)
type PingResponse = operations['ping']['responses']['200']['content']['application/json'];
@@ -3297,12 +3306,12 @@ type SigninFlowResponse = {
} | {
finished: false;
next: 'passkey';
authRequest: PublicKeyCredentialRequestOptionsJSON;
authRequest: PublicKeyCredentialRequestOptionsJSON_2;
};
// @public (undocumented)
type SigninWithPasskeyInitResponse = {
option: PublicKeyCredentialRequestOptionsJSON;
option: PublicKeyCredentialRequestOptionsJSON_2;
context: string;
};
@@ -3348,9 +3357,6 @@ type SignupResponse = MeDetailed & {
token: string;
};
// @public (undocumented)
type SponsorsRequest = operations['sponsors']['requestBody']['content']['application/json'];
// @public (undocumented)
type StatsResponse = operations['stats']['responses']['200']['content']['application/json'];
@@ -3630,8 +3636,8 @@ type V2AdminEmojiListResponse = operations['v2___admin___emoji___list']['respons
//
// src/entities.ts:50:2 - (ae-forgotten-export) The symbol "ModerationLogPayloads" needs to be exported by the entry point index.d.ts
// src/streaming.ts:57:3 - (ae-forgotten-export) The symbol "ReconnectingWebSocket" needs to be exported by the entry point index.d.ts
// src/streaming.types.ts:236:4 - (ae-forgotten-export) The symbol "ReversiUpdateKey" needs to be exported by the entry point index.d.ts
// src/streaming.types.ts:246:4 - (ae-forgotten-export) The symbol "ReversiUpdateSettings" needs to be exported by the entry point index.d.ts
// src/streaming.types.ts:217:4 - (ae-forgotten-export) The symbol "ReversiUpdateKey" needs to be exported by the entry point index.d.ts
// src/streaming.types.ts:227:4 - (ae-forgotten-export) The symbol "ReversiUpdateSettings" needs to be exported by the entry point index.d.ts
// (No @packageDocumentation comment for this package)
@@ -14,4 +14,10 @@ export default [
},
},
},
{
files: ['built/autogen/**.ts'],
rules: {
'@stylistic/indent': 'off',
},
},
];
+7 -7
View File
@@ -7,16 +7,16 @@
"generate": "tsx src/generator.ts && eslint ./built/**/*.ts --fix --cache"
},
"devDependencies": {
"@readme/openapi-parser": "2.6.0",
"@types/node": "22.9.0",
"@typescript-eslint/eslint-plugin": "7.17.0",
"@typescript-eslint/parser": "7.17.0",
"@readme/openapi-parser": "2.7.0",
"@types/node": "22.13.9",
"@typescript-eslint/eslint-plugin": "8.26.0",
"@typescript-eslint/parser": "8.26.0",
"eslint": "9.14.0",
"openapi-types": "12.1.3",
"openapi-typescript": "6.7.3",
"openapi-typescript": "6.7.6",
"ts-case-convert": "2.1.0",
"tsx": "4.4.0",
"typescript": "5.6.3"
"tsx": "4.19.3",
"typescript": "5.8.2"
},
"files": [
"built"
+29 -6
View File
@@ -1,8 +1,9 @@
import { mkdir, writeFile } from 'fs/promises';
import assert from 'assert';
import { mkdir, readFile, writeFile } from 'fs/promises';
import { OpenAPIV3_1 } from 'openapi-types';
import { toPascal } from 'ts-case-convert';
import OpenAPIParser from '@readme/openapi-parser';
import openapiTS from 'openapi-typescript';
import openapiTS, { OpenAPI3, OperationObject, PathItemObject } from 'openapi-typescript';
async function generateBaseTypes(
openApiDocs: OpenAPIV3_1.Document,
@@ -20,7 +21,29 @@ async function generateBaseTypes(
}
lines.push('');
const generatedTypes = await openapiTS(openApiJsonPath, {
// NOTE: Align `operationId` of GET and POST to avoid duplication of type definitions
const openApi = JSON.parse(await readFile(openApiJsonPath, 'utf8')) as OpenAPI3;
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
for (const [key, item] of Object.entries(openApi.paths!)) {
assert('post' in item);
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
openApi.paths![key] = {
...('get' in item ? {
get: {
...item.get,
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
operationId: ((item as PathItemObject).get as OperationObject).operationId!.replaceAll('get___', ''),
},
} : {}),
post: {
...item.post,
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
operationId: ((item as PathItemObject).post as OperationObject).operationId!.replaceAll('post___', ''),
},
};
}
const generatedTypes = await openapiTS(openApi, {
exportType: true,
transform(schemaObject) {
if ('format' in schemaObject && schemaObject.format === 'binary') {
@@ -78,7 +101,7 @@ async function generateEndpoints(
for (const operation of postPathItems) {
const path = operation._path_;
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const operationId = operation.operationId!;
const operationId = operation.operationId!.replaceAll('get___', '').replaceAll('post___', '');
const endpoint = new Endpoint(path);
endpoints.push(endpoint);
@@ -150,7 +173,7 @@ async function generateEndpoints(
endpointOutputLine.push(
...endpoints.map(it => '\t' + it.toLine()),
);
endpointOutputLine.push('}');
endpointOutputLine.push('};');
endpointOutputLine.push('');
function generateEndpointReqMediaTypesType() {
@@ -195,7 +218,7 @@ async function generateApiClientJSDoc(
for (const operation of postPathItems) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const operationId = operation.operationId!;
const operationId = operation.operationId!.replaceAll('get___', '').replaceAll('post___', '');
if (operation.description) {
endpoints.push({
+1 -1
View File
@@ -3,7 +3,7 @@
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "nodenext",
"moduleResolution": "node16",
"strict": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
+10 -10
View File
@@ -1,7 +1,7 @@
{
"type": "module",
"name": "misskey-js",
"version": "2025.3.0-dev",
"version": "2025.3.2-beta.10",
"description": "Misskey SDK for JavaScript",
"license": "MIT",
"main": "./built/index.js",
@@ -35,29 +35,29 @@
"directory": "packages/misskey-js"
},
"devDependencies": {
"@microsoft/api-extractor": "7.47.11",
"@microsoft/api-extractor": "7.51.1",
"@swc/jest": "0.2.37",
"@types/jest": "29.5.14",
"@types/node": "22.9.0",
"@typescript-eslint/eslint-plugin": "7.17.0",
"@typescript-eslint/parser": "7.17.0",
"@types/node": "22.13.9",
"@typescript-eslint/eslint-plugin": "8.26.0",
"@typescript-eslint/parser": "8.26.0",
"jest": "29.7.0",
"jest-fetch-mock": "3.0.3",
"jest-websocket-mock": "2.5.0",
"mock-socket": "9.3.1",
"ncp": "2.0.0",
"nodemon": "3.1.7",
"nodemon": "3.1.9",
"execa": "8.0.1",
"tsd": "0.31.2",
"typescript": "5.6.3",
"esbuild": "0.24.0",
"glob": "11.0.0"
"typescript": "5.8.2",
"esbuild": "0.25.0",
"glob": "11.0.1"
},
"files": [
"built"
],
"dependencies": {
"@simplewebauthn/types": "11.0.0",
"@simplewebauthn/types": "12.0.0",
"eventemitter3": "5.0.1",
"reconnecting-websocket": "4.4.0"
}
+5 -3
View File
@@ -33,14 +33,15 @@ type IsCaseMatched<E extends keyof Endpoints, P extends Endpoints[E]['req'], C e
Endpoints[E]['res'] extends SwitchCase
// eslint-disable-next-line @typescript-eslint/no-explicit-any
? IsNeverType<StrictExtract<Endpoints[E]['res']['$switch']['$cases'][C], [P, any]>> extends false ? true : false
: false
: false;
type GetCaseResult<E extends keyof Endpoints, P extends Endpoints[E]['req'], C extends number> =
Endpoints[E]['res'] extends SwitchCase
// eslint-disable-next-line @typescript-eslint/no-explicit-any
? StrictExtract<Endpoints[E]['res']['$switch']['$cases'][C], [P, any]>[1]
: never
: never;
/* eslint-disable @stylistic/indent */
export type SwitchCaseResponseType<E extends keyof Endpoints, P extends Endpoints[E]['req']> = Endpoints[E]['res'] extends SwitchCase
? IsCaseMatched<E, P, 0> extends true ? GetCaseResult<E, P, 0> :
IsCaseMatched<E, P, 1> extends true ? GetCaseResult<E, P, 1> :
@@ -53,6 +54,7 @@ export type SwitchCaseResponseType<E extends keyof Endpoints, P extends Endpoint
IsCaseMatched<E, P, 8> extends true ? GetCaseResult<E, P, 8> :
IsCaseMatched<E, P, 9> extends true ? GetCaseResult<E, P, 9> :
Endpoints[E]['res']['$switch']['$default'] : Endpoints[E]['res'];
/* eslint-enable @stylistic/indent */
export type Endpoints = Overwrite<
Gen,
@@ -106,4 +108,4 @@ export type Endpoints = Overwrite<
res: AdminRolesCreateResponse;
}
}
>
>;
+253 -11
View File
@@ -1104,6 +1104,17 @@ declare module '../api.js' {
credential?: string | null,
): Promise<SwitchCaseResponseType<E, P>>;
/**
* No description provided.
*
* **Credential required**: *Yes* / **Permission**: *write:admin:account*
*/
request<E extends 'admin/update-proxy-account', P extends Endpoints[E]['req']>(
endpoint: E,
params: P,
credential?: string | null,
): Promise<SwitchCaseResponseType<E, P>>;
/**
* No description provided.
*
@@ -1622,6 +1633,248 @@ declare module '../api.js' {
credential?: string | null,
): Promise<SwitchCaseResponseType<E, P>>;
/**
* No description provided.
*
* **Credential required**: *Yes* / **Permission**: *read:chat*
*/
request<E extends 'chat/history', P extends Endpoints[E]['req']>(
endpoint: E,
params: P,
credential?: string | null,
): Promise<SwitchCaseResponseType<E, P>>;
/**
* No description provided.
*
* **Credential required**: *Yes* / **Permission**: *write:chat*
*/
request<E extends 'chat/messages/create-to-room', P extends Endpoints[E]['req']>(
endpoint: E,
params: P,
credential?: string | null,
): Promise<SwitchCaseResponseType<E, P>>;
/**
* No description provided.
*
* **Credential required**: *Yes* / **Permission**: *write:chat*
*/
request<E extends 'chat/messages/create-to-user', P extends Endpoints[E]['req']>(
endpoint: E,
params: P,
credential?: string | null,
): Promise<SwitchCaseResponseType<E, P>>;
/**
* No description provided.
*
* **Credential required**: *Yes* / **Permission**: *write:chat*
*/
request<E extends 'chat/messages/delete', P extends Endpoints[E]['req']>(
endpoint: E,
params: P,
credential?: string | null,
): Promise<SwitchCaseResponseType<E, P>>;
/**
* No description provided.
*
* **Credential required**: *Yes* / **Permission**: *write:chat*
*/
request<E extends 'chat/messages/react', P extends Endpoints[E]['req']>(
endpoint: E,
params: P,
credential?: string | null,
): Promise<SwitchCaseResponseType<E, P>>;
/**
* No description provided.
*
* **Credential required**: *Yes* / **Permission**: *read:chat*
*/
request<E extends 'chat/messages/room-timeline', P extends Endpoints[E]['req']>(
endpoint: E,
params: P,
credential?: string | null,
): Promise<SwitchCaseResponseType<E, P>>;
/**
* No description provided.
*
* **Credential required**: *Yes* / **Permission**: *read:chat*
*/
request<E extends 'chat/messages/search', P extends Endpoints[E]['req']>(
endpoint: E,
params: P,
credential?: string | null,
): Promise<SwitchCaseResponseType<E, P>>;
/**
* No description provided.
*
* **Credential required**: *Yes* / **Permission**: *read:chat*
*/
request<E extends 'chat/messages/show', P extends Endpoints[E]['req']>(
endpoint: E,
params: P,
credential?: string | null,
): Promise<SwitchCaseResponseType<E, P>>;
/**
* No description provided.
*
* **Credential required**: *Yes* / **Permission**: *read:chat*
*/
request<E extends 'chat/messages/user-timeline', P extends Endpoints[E]['req']>(
endpoint: E,
params: P,
credential?: string | null,
): Promise<SwitchCaseResponseType<E, P>>;
/**
* No description provided.
*
* **Credential required**: *Yes* / **Permission**: *write:chat*
*/
request<E extends 'chat/rooms/create', P extends Endpoints[E]['req']>(
endpoint: E,
params: P,
credential?: string | null,
): Promise<SwitchCaseResponseType<E, P>>;
/**
* No description provided.
*
* **Credential required**: *Yes* / **Permission**: *write:chat*
*/
request<E extends 'chat/rooms/delete', P extends Endpoints[E]['req']>(
endpoint: E,
params: P,
credential?: string | null,
): Promise<SwitchCaseResponseType<E, P>>;
/**
* No description provided.
*
* **Credential required**: *Yes* / **Permission**: *write:chat*
*/
request<E extends 'chat/rooms/invitations/create', P extends Endpoints[E]['req']>(
endpoint: E,
params: P,
credential?: string | null,
): Promise<SwitchCaseResponseType<E, P>>;
/**
* No description provided.
*
* **Credential required**: *Yes* / **Permission**: *write:chat*
*/
request<E extends 'chat/rooms/invitations/ignore', P extends Endpoints[E]['req']>(
endpoint: E,
params: P,
credential?: string | null,
): Promise<SwitchCaseResponseType<E, P>>;
/**
* No description provided.
*
* **Credential required**: *Yes* / **Permission**: *read:chat*
*/
request<E extends 'chat/rooms/invitations/inbox', P extends Endpoints[E]['req']>(
endpoint: E,
params: P,
credential?: string | null,
): Promise<SwitchCaseResponseType<E, P>>;
/**
* No description provided.
*
* **Credential required**: *Yes* / **Permission**: *write:chat*
*/
request<E extends 'chat/rooms/join', P extends Endpoints[E]['req']>(
endpoint: E,
params: P,
credential?: string | null,
): Promise<SwitchCaseResponseType<E, P>>;
/**
* No description provided.
*
* **Credential required**: *Yes* / **Permission**: *read:chat*
*/
request<E extends 'chat/rooms/joining', P extends Endpoints[E]['req']>(
endpoint: E,
params: P,
credential?: string | null,
): Promise<SwitchCaseResponseType<E, P>>;
/**
* No description provided.
*
* **Credential required**: *Yes* / **Permission**: *write:chat*
*/
request<E extends 'chat/rooms/leave', P extends Endpoints[E]['req']>(
endpoint: E,
params: P,
credential?: string | null,
): Promise<SwitchCaseResponseType<E, P>>;
/**
* No description provided.
*
* **Credential required**: *Yes* / **Permission**: *write:chat*
*/
request<E extends 'chat/rooms/members', P extends Endpoints[E]['req']>(
endpoint: E,
params: P,
credential?: string | null,
): Promise<SwitchCaseResponseType<E, P>>;
/**
* No description provided.
*
* **Credential required**: *Yes* / **Permission**: *write:chat*
*/
request<E extends 'chat/rooms/mute', P extends Endpoints[E]['req']>(
endpoint: E,
params: P,
credential?: string | null,
): Promise<SwitchCaseResponseType<E, P>>;
/**
* No description provided.
*
* **Credential required**: *Yes* / **Permission**: *read:chat*
*/
request<E extends 'chat/rooms/owned', P extends Endpoints[E]['req']>(
endpoint: E,
params: P,
credential?: string | null,
): Promise<SwitchCaseResponseType<E, P>>;
/**
* No description provided.
*
* **Credential required**: *Yes* / **Permission**: *read:chat*
*/
request<E extends 'chat/rooms/show', P extends Endpoints[E]['req']>(
endpoint: E,
params: P,
credential?: string | null,
): Promise<SwitchCaseResponseType<E, P>>;
/**
* No description provided.
*
* **Credential required**: *Yes* / **Permission**: *write:chat*
*/
request<E extends 'chat/rooms/update', P extends Endpoints[E]['req']>(
endpoint: E,
params: P,
credential?: string | null,
): Promise<SwitchCaseResponseType<E, P>>;
/**
* No description provided.
*
@@ -2939,17 +3192,6 @@ declare module '../api.js' {
credential?: string | null,
): Promise<SwitchCaseResponseType<E, P>>;
/**
* No description provided.
*
* **Credential required**: *Yes* / **Permission**: *write:account*
*/
request<E extends 'i/read-all-unread-notes', P extends Endpoints[E]['req']>(
endpoint: E,
params: P,
credential?: string | null,
): Promise<SwitchCaseResponseType<E, P>>;
/**
* No description provided.
*
+70 -2
View File
@@ -130,6 +130,8 @@ import type {
AdminUnsuspendUserRequest,
AdminUpdateAbuseUserReportRequest,
AdminUpdateMetaRequest,
AdminUpdateProxyAccountRequest,
AdminUpdateProxyAccountResponse,
AdminUpdateUserNoteRequest,
AnnouncementsRequest,
AnnouncementsResponse,
@@ -213,6 +215,50 @@ import type {
ChartsUserReactionsResponse,
ChartsUsersRequest,
ChartsUsersResponse,
ChatHistoryRequest,
ChatHistoryResponse,
ChatMessagesCreateToRoomRequest,
ChatMessagesCreateToRoomResponse,
ChatMessagesCreateToUserRequest,
ChatMessagesCreateToUserResponse,
ChatMessagesDeleteRequest,
ChatMessagesDeleteResponse,
ChatMessagesReactRequest,
ChatMessagesReactResponse,
ChatMessagesRoomTimelineRequest,
ChatMessagesRoomTimelineResponse,
ChatMessagesSearchRequest,
ChatMessagesSearchResponse,
ChatMessagesShowRequest,
ChatMessagesShowResponse,
ChatMessagesUserTimelineRequest,
ChatMessagesUserTimelineResponse,
ChatRoomsCreateRequest,
ChatRoomsCreateResponse,
ChatRoomsDeleteRequest,
ChatRoomsDeleteResponse,
ChatRoomsInvitationsCreateRequest,
ChatRoomsInvitationsCreateResponse,
ChatRoomsInvitationsIgnoreRequest,
ChatRoomsInvitationsIgnoreResponse,
ChatRoomsInvitationsInboxRequest,
ChatRoomsInvitationsInboxResponse,
ChatRoomsJoinRequest,
ChatRoomsJoinResponse,
ChatRoomsJoiningRequest,
ChatRoomsJoiningResponse,
ChatRoomsLeaveRequest,
ChatRoomsLeaveResponse,
ChatRoomsMembersRequest,
ChatRoomsMembersResponse,
ChatRoomsMuteRequest,
ChatRoomsMuteResponse,
ChatRoomsOwnedRequest,
ChatRoomsOwnedResponse,
ChatRoomsShowRequest,
ChatRoomsShowResponse,
ChatRoomsUpdateRequest,
ChatRoomsUpdateResponse,
ClipsAddNoteRequest,
ClipsCreateRequest,
ClipsCreateResponse,
@@ -710,6 +756,7 @@ export type Endpoints = {
'admin/unsuspend-user': { req: AdminUnsuspendUserRequest; res: EmptyResponse };
'admin/update-abuse-user-report': { req: AdminUpdateAbuseUserReportRequest; res: EmptyResponse };
'admin/update-meta': { req: AdminUpdateMetaRequest; res: EmptyResponse };
'admin/update-proxy-account': { req: AdminUpdateProxyAccountRequest; res: AdminUpdateProxyAccountResponse };
'admin/update-user-note': { req: AdminUpdateUserNoteRequest; res: EmptyResponse };
'announcements': { req: AnnouncementsRequest; res: AnnouncementsResponse };
'announcements/show': { req: AnnouncementsShowRequest; res: AnnouncementsShowResponse };
@@ -757,6 +804,28 @@ export type Endpoints = {
'charts/user/pv': { req: ChartsUserPvRequest; res: ChartsUserPvResponse };
'charts/user/reactions': { req: ChartsUserReactionsRequest; res: ChartsUserReactionsResponse };
'charts/users': { req: ChartsUsersRequest; res: ChartsUsersResponse };
'chat/history': { req: ChatHistoryRequest; res: ChatHistoryResponse };
'chat/messages/create-to-room': { req: ChatMessagesCreateToRoomRequest; res: ChatMessagesCreateToRoomResponse };
'chat/messages/create-to-user': { req: ChatMessagesCreateToUserRequest; res: ChatMessagesCreateToUserResponse };
'chat/messages/delete': { req: ChatMessagesDeleteRequest; res: ChatMessagesDeleteResponse };
'chat/messages/react': { req: ChatMessagesReactRequest; res: ChatMessagesReactResponse };
'chat/messages/room-timeline': { req: ChatMessagesRoomTimelineRequest; res: ChatMessagesRoomTimelineResponse };
'chat/messages/search': { req: ChatMessagesSearchRequest; res: ChatMessagesSearchResponse };
'chat/messages/show': { req: ChatMessagesShowRequest; res: ChatMessagesShowResponse };
'chat/messages/user-timeline': { req: ChatMessagesUserTimelineRequest; res: ChatMessagesUserTimelineResponse };
'chat/rooms/create': { req: ChatRoomsCreateRequest; res: ChatRoomsCreateResponse };
'chat/rooms/delete': { req: ChatRoomsDeleteRequest; res: ChatRoomsDeleteResponse };
'chat/rooms/invitations/create': { req: ChatRoomsInvitationsCreateRequest; res: ChatRoomsInvitationsCreateResponse };
'chat/rooms/invitations/ignore': { req: ChatRoomsInvitationsIgnoreRequest; res: ChatRoomsInvitationsIgnoreResponse };
'chat/rooms/invitations/inbox': { req: ChatRoomsInvitationsInboxRequest; res: ChatRoomsInvitationsInboxResponse };
'chat/rooms/join': { req: ChatRoomsJoinRequest; res: ChatRoomsJoinResponse };
'chat/rooms/joining': { req: ChatRoomsJoiningRequest; res: ChatRoomsJoiningResponse };
'chat/rooms/leave': { req: ChatRoomsLeaveRequest; res: ChatRoomsLeaveResponse };
'chat/rooms/members': { req: ChatRoomsMembersRequest; res: ChatRoomsMembersResponse };
'chat/rooms/mute': { req: ChatRoomsMuteRequest; res: ChatRoomsMuteResponse };
'chat/rooms/owned': { req: ChatRoomsOwnedRequest; res: ChatRoomsOwnedResponse };
'chat/rooms/show': { req: ChatRoomsShowRequest; res: ChatRoomsShowResponse };
'chat/rooms/update': { req: ChatRoomsUpdateRequest; res: ChatRoomsUpdateResponse };
'clips/add-note': { req: ClipsAddNoteRequest; res: EmptyResponse };
'clips/create': { req: ClipsCreateRequest; res: ClipsCreateResponse };
'clips/delete': { req: ClipsDeleteRequest; res: EmptyResponse };
@@ -874,7 +943,6 @@ export type Endpoints = {
'i/page-likes': { req: IPageLikesRequest; res: IPageLikesResponse };
'i/pages': { req: IPagesRequest; res: IPagesResponse };
'i/pin': { req: IPinRequest; res: IPinResponse };
'i/read-all-unread-notes': { req: EmptyRequest; res: EmptyResponse };
'i/read-announcement': { req: IReadAnnouncementRequest; res: EmptyResponse };
'i/regenerate-token': { req: IRegenerateTokenRequest; res: EmptyResponse };
'i/registry/get': { req: IRegistryGetRequest; res: IRegistryGetResponse };
@@ -1020,7 +1088,7 @@ export type Endpoints = {
'users/show': { req: UsersShowRequest; res: UsersShowResponse };
'users/update-memo': { req: UsersUpdateMemoRequest; res: EmptyResponse };
'v2/admin/emoji/list': { req: V2AdminEmojiListRequest; res: V2AdminEmojiListResponse };
}
};
/**
* NOTE: The content-type for all endpoints not listed here is application/json.
@@ -133,6 +133,8 @@ export type AdminUnsilenceUserRequest = operations['admin___unsilence-user']['re
export type AdminUnsuspendUserRequest = operations['admin___unsuspend-user']['requestBody']['content']['application/json'];
export type AdminUpdateAbuseUserReportRequest = operations['admin___update-abuse-user-report']['requestBody']['content']['application/json'];
export type AdminUpdateMetaRequest = operations['admin___update-meta']['requestBody']['content']['application/json'];
export type AdminUpdateProxyAccountRequest = operations['admin___update-proxy-account']['requestBody']['content']['application/json'];
export type AdminUpdateProxyAccountResponse = operations['admin___update-proxy-account']['responses']['200']['content']['application/json'];
export type AdminUpdateUserNoteRequest = operations['admin___update-user-note']['requestBody']['content']['application/json'];
export type AnnouncementsRequest = operations['announcements']['requestBody']['content']['application/json'];
export type AnnouncementsResponse = operations['announcements']['responses']['200']['content']['application/json'];
@@ -216,6 +218,50 @@ export type ChartsUserReactionsRequest = operations['charts___user___reactions']
export type ChartsUserReactionsResponse = operations['charts___user___reactions']['responses']['200']['content']['application/json'];
export type ChartsUsersRequest = operations['charts___users']['requestBody']['content']['application/json'];
export type ChartsUsersResponse = operations['charts___users']['responses']['200']['content']['application/json'];
export type ChatHistoryRequest = operations['chat___history']['requestBody']['content']['application/json'];
export type ChatHistoryResponse = operations['chat___history']['responses']['200']['content']['application/json'];
export type ChatMessagesCreateToRoomRequest = operations['chat___messages___create-to-room']['requestBody']['content']['application/json'];
export type ChatMessagesCreateToRoomResponse = operations['chat___messages___create-to-room']['responses']['200']['content']['application/json'];
export type ChatMessagesCreateToUserRequest = operations['chat___messages___create-to-user']['requestBody']['content']['application/json'];
export type ChatMessagesCreateToUserResponse = operations['chat___messages___create-to-user']['responses']['200']['content']['application/json'];
export type ChatMessagesDeleteRequest = operations['chat___messages___delete']['requestBody']['content']['application/json'];
export type ChatMessagesDeleteResponse = operations['chat___messages___delete']['responses']['200']['content']['application/json'];
export type ChatMessagesReactRequest = operations['chat___messages___react']['requestBody']['content']['application/json'];
export type ChatMessagesReactResponse = operations['chat___messages___react']['responses']['200']['content']['application/json'];
export type ChatMessagesRoomTimelineRequest = operations['chat___messages___room-timeline']['requestBody']['content']['application/json'];
export type ChatMessagesRoomTimelineResponse = operations['chat___messages___room-timeline']['responses']['200']['content']['application/json'];
export type ChatMessagesSearchRequest = operations['chat___messages___search']['requestBody']['content']['application/json'];
export type ChatMessagesSearchResponse = operations['chat___messages___search']['responses']['200']['content']['application/json'];
export type ChatMessagesShowRequest = operations['chat___messages___show']['requestBody']['content']['application/json'];
export type ChatMessagesShowResponse = operations['chat___messages___show']['responses']['200']['content']['application/json'];
export type ChatMessagesUserTimelineRequest = operations['chat___messages___user-timeline']['requestBody']['content']['application/json'];
export type ChatMessagesUserTimelineResponse = operations['chat___messages___user-timeline']['responses']['200']['content']['application/json'];
export type ChatRoomsCreateRequest = operations['chat___rooms___create']['requestBody']['content']['application/json'];
export type ChatRoomsCreateResponse = operations['chat___rooms___create']['responses']['200']['content']['application/json'];
export type ChatRoomsDeleteRequest = operations['chat___rooms___delete']['requestBody']['content']['application/json'];
export type ChatRoomsDeleteResponse = operations['chat___rooms___delete']['responses']['200']['content']['application/json'];
export type ChatRoomsInvitationsCreateRequest = operations['chat___rooms___invitations___create']['requestBody']['content']['application/json'];
export type ChatRoomsInvitationsCreateResponse = operations['chat___rooms___invitations___create']['responses']['200']['content']['application/json'];
export type ChatRoomsInvitationsIgnoreRequest = operations['chat___rooms___invitations___ignore']['requestBody']['content']['application/json'];
export type ChatRoomsInvitationsIgnoreResponse = operations['chat___rooms___invitations___ignore']['responses']['200']['content']['application/json'];
export type ChatRoomsInvitationsInboxRequest = operations['chat___rooms___invitations___inbox']['requestBody']['content']['application/json'];
export type ChatRoomsInvitationsInboxResponse = operations['chat___rooms___invitations___inbox']['responses']['200']['content']['application/json'];
export type ChatRoomsJoinRequest = operations['chat___rooms___join']['requestBody']['content']['application/json'];
export type ChatRoomsJoinResponse = operations['chat___rooms___join']['responses']['200']['content']['application/json'];
export type ChatRoomsJoiningRequest = operations['chat___rooms___joining']['requestBody']['content']['application/json'];
export type ChatRoomsJoiningResponse = operations['chat___rooms___joining']['responses']['200']['content']['application/json'];
export type ChatRoomsLeaveRequest = operations['chat___rooms___leave']['requestBody']['content']['application/json'];
export type ChatRoomsLeaveResponse = operations['chat___rooms___leave']['responses']['200']['content']['application/json'];
export type ChatRoomsMembersRequest = operations['chat___rooms___members']['requestBody']['content']['application/json'];
export type ChatRoomsMembersResponse = operations['chat___rooms___members']['responses']['200']['content']['application/json'];
export type ChatRoomsMuteRequest = operations['chat___rooms___mute']['requestBody']['content']['application/json'];
export type ChatRoomsMuteResponse = operations['chat___rooms___mute']['responses']['200']['content']['application/json'];
export type ChatRoomsOwnedRequest = operations['chat___rooms___owned']['requestBody']['content']['application/json'];
export type ChatRoomsOwnedResponse = operations['chat___rooms___owned']['responses']['200']['content']['application/json'];
export type ChatRoomsShowRequest = operations['chat___rooms___show']['requestBody']['content']['application/json'];
export type ChatRoomsShowResponse = operations['chat___rooms___show']['responses']['200']['content']['application/json'];
export type ChatRoomsUpdateRequest = operations['chat___rooms___update']['requestBody']['content']['application/json'];
export type ChatRoomsUpdateResponse = operations['chat___rooms___update']['responses']['200']['content']['application/json'];
export type ClipsAddNoteRequest = operations['clips___add-note']['requestBody']['content']['application/json'];
export type ClipsCreateRequest = operations['clips___create']['requestBody']['content']['application/json'];
export type ClipsCreateResponse = operations['clips___create']['responses']['200']['content']['application/json'];
@@ -54,3 +54,8 @@ export type MetaDetailedOnly = components['schemas']['MetaDetailedOnly'];
export type MetaDetailed = components['schemas']['MetaDetailed'];
export type SystemWebhook = components['schemas']['SystemWebhook'];
export type AbuseReportNotificationRecipient = components['schemas']['AbuseReportNotificationRecipient'];
export type ChatMessage = components['schemas']['ChatMessage'];
export type ChatMessageLite = components['schemas']['ChatMessageLite'];
export type ChatRoom = components['schemas']['ChatRoom'];
export type ChatRoomInvitation = components['schemas']['ChatRoomInvitation'];
export type ChatRoomMembership = components['schemas']['ChatRoomMembership'];
File diff suppressed because it is too large Load Diff
+4 -2
View File
@@ -33,8 +33,8 @@ export const permissions = [
'write:favorites',
'read:following',
'write:following',
'read:messaging',
'write:messaging',
'read:messaging', // deprecated
'write:messaging', // deprecated
'read:mutes',
'write:mutes',
'write:notes',
@@ -116,6 +116,8 @@ export const permissions = [
'read:clip-favorite',
'read:federation',
'write:report-abuse',
'write:chat',
'read:chat',
] as const;
export const moderationLogTypes = [
+3 -3
View File
@@ -336,11 +336,11 @@ export type SignupRequest = {
'g-recaptcha-response'?: string | null;
'turnstile-response'?: string | null;
'm-captcha-response'?: string | null;
}
};
export type SignupResponse = MeDetailed & {
token: string;
}
};
export type SignupPendingRequest = {
code: string;
@@ -391,4 +391,4 @@ export type SigninWithPasskeyResponse = {
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] } }>;
+3 -3
View File
@@ -197,9 +197,9 @@ export default class Stream extends EventEmitter<StreamEvents> implements IStrea
* Send a message to connection
* ! JSONで行われます !
*/
public send(typeOrPayload: string): void
public send(typeOrPayload: string, payload: unknown): void
public send(typeOrPayload: Record<string, unknown> | unknown[]): void
public send(typeOrPayload: string): void;
public send(typeOrPayload: string, payload: unknown): void;
public send(typeOrPayload: Record<string, unknown> | unknown[]): void;
public send(typeOrPayload: string | Record<string, unknown> | unknown[], payload?: unknown): void {
if (typeof typeOrPayload === 'string') {
this.stream.send(JSON.stringify({
+2 -5
View File
@@ -1,5 +1,6 @@
import {
Antenna,
ChatMessage,
DriveFile,
DriveFolder,
Note,
@@ -46,13 +47,9 @@ export type Channels = {
urlUploadFinished: (payload: { marker: string; file: DriveFile; }) => void;
readAllNotifications: () => void;
unreadNotification: (payload: Notification) => void;
unreadMention: (payload: Note['id']) => void;
readAllUnreadMentions: () => void;
notificationFlushed: () => void;
unreadSpecifiedNote: (payload: Note['id']) => void;
readAllUnreadSpecifiedNotes: () => void;
readAllAntennas: () => void;
unreadAntenna: (payload: Antenna) => void;
newChatMessage: (payload: ChatMessage) => void;
readAllAnnouncements: () => void;
myTokenRegenerated: () => void;
signin: (payload: Signin) => void;
+19 -19
View File
@@ -42,26 +42,26 @@ describe('Streaming', () => {
test('useChannel with parameters', async () => {
const server = new WS('wss://misskey.test/streaming');
const stream = new Stream('https://misskey.test', { token: 'TOKEN' });
const messagingChannelReceived: any[] = [];
const messaging = stream.useChannel('messaging', { otherparty: 'aaa' });
messaging.on('message', payload => {
messagingChannelReceived.push(payload);
const chatChannelReceived: any[] = [];
const chat = stream.useChannel('chat', { other: 'aaa' });
chat.on('message', payload => {
chatChannelReceived.push(payload);
});
const ws = await server.connected;
expect(new URLSearchParams(new URL(ws.url).search).get('i')).toEqual('TOKEN');
const msg = JSON.parse(await server.nextMessage as string);
const messagingChannelId = msg.body.id;
const chatChannelId = msg.body.id;
expect(msg.type).toEqual('connect');
expect(msg.body.channel).toEqual('messaging');
expect(msg.body.params).toEqual({ otherparty: 'aaa' });
expect(messagingChannelId != null).toEqual(true);
expect(msg.body.channel).toEqual('chat');
expect(msg.body.params).toEqual({ other: 'aaa' });
expect(chatChannelId != null).toEqual(true);
server.send(JSON.stringify({
type: 'channel',
body: {
id: messagingChannelId,
id: chatChannelId,
type: 'message',
body: {
id: 'foo'
@@ -69,7 +69,7 @@ describe('Streaming', () => {
}
}));
expect(messagingChannelReceived[0]).toEqual({
expect(chatChannelReceived[0]).toEqual({
id: 'foo'
});
@@ -81,20 +81,20 @@ describe('Streaming', () => {
const server = new WS('wss://misskey.test/streaming');
const stream = new Stream('https://misskey.test', { token: 'TOKEN' });
stream.useChannel('messaging', { otherparty: 'aaa' });
stream.useChannel('messaging', { otherparty: 'bbb' });
stream.useChannel('chat', { other: 'aaa' });
stream.useChannel('chat', { other: 'bbb' });
const ws = await server.connected;
expect(new URLSearchParams(new URL(ws.url).search).get('i')).toEqual('TOKEN');
const msg = JSON.parse(await server.nextMessage as string);
const messagingChannelId = msg.body.id;
const chatChannelId = msg.body.id;
const msg2 = JSON.parse(await server.nextMessage as string);
const messagingChannelId2 = msg2.body.id;
const chatChannelId2 = msg2.body.id;
expect(messagingChannelId != null).toEqual(true);
expect(messagingChannelId2 != null).toEqual(true);
expect(messagingChannelId).not.toEqual(messagingChannelId2);
expect(chatChannelId != null).toEqual(true);
expect(chatChannelId2 != null).toEqual(true);
expect(chatChannelId).not.toEqual(chatChannelId2);
stream.close();
server.close();
@@ -104,8 +104,8 @@ describe('Streaming', () => {
const server = new WS('wss://misskey.test/streaming');
const stream = new Stream('https://misskey.test', { token: 'TOKEN' });
const messaging = stream.useChannel('messaging', { otherparty: 'aaa' });
messaging.send('read', { id: 'aaa' });
const chat = stream.useChannel('chat', { other: 'aaa' });
chat.send('read', { id: 'aaa' });
const ws = await server.connected;
expect(new URLSearchParams(new URL(ws.url).search).get('i')).toEqual('TOKEN');