merge: upstream (1)

This commit is contained in:
Marie 2024-01-21 13:11:23 +01:00
commit db012fc8c3
No known key found for this signature in database
GPG key ID: 56569BBE47D2C828
258 changed files with 18802 additions and 7557 deletions

View file

@ -45,7 +45,7 @@
*
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
*/
"mainEntryPointFilePath": "<projectFolder>/built/index.d.ts",
"mainEntryPointFilePath": "<projectFolder>/built/dts/index.d.ts",
/**
* A list of NPM package names whose exports should be treated as part of this package.

View file

@ -1623,6 +1623,16 @@ declare namespace entities {
BubbleGameRegisterResponse,
BubbleGameRankingRequest,
BubbleGameRankingResponse,
ReversiCancelMatchRequest,
ReversiCancelMatchResponse,
ReversiGamesRequest,
ReversiGamesResponse,
ReversiMatchRequest,
ReversiMatchResponse,
ReversiInvitationsResponse,
ReversiShowGameRequest,
ReversiShowGameResponse,
ReversiSurrenderRequest,
Error_2 as Error,
UserLite,
UserDetailedNotMeOnly,
@ -1659,7 +1669,9 @@ declare namespace entities {
Flash,
Signin,
RoleLite,
Role
Role,
ReversiGameLite,
ReversiGameDetailed
}
}
export { entities }
@ -2596,6 +2608,42 @@ type ResetPasswordRequest = operations['reset-password']['requestBody']['content
// @public (undocumented)
type RetentionResponse = operations['retention']['responses']['200']['content']['application/json'];
// @public (undocumented)
type ReversiCancelMatchRequest = operations['reversi/cancel-match']['requestBody']['content']['application/json'];
// @public (undocumented)
type ReversiCancelMatchResponse = operations['reversi/cancel-match']['responses']['200']['content']['application/json'];
// @public (undocumented)
type ReversiGameDetailed = components['schemas']['ReversiGameDetailed'];
// @public (undocumented)
type ReversiGameLite = components['schemas']['ReversiGameLite'];
// @public (undocumented)
type ReversiGamesRequest = operations['reversi/games']['requestBody']['content']['application/json'];
// @public (undocumented)
type ReversiGamesResponse = operations['reversi/games']['responses']['200']['content']['application/json'];
// @public (undocumented)
type ReversiInvitationsResponse = operations['reversi/invitations']['responses']['200']['content']['application/json'];
// @public (undocumented)
type ReversiMatchRequest = operations['reversi/match']['requestBody']['content']['application/json'];
// @public (undocumented)
type ReversiMatchResponse = operations['reversi/match']['responses']['200']['content']['application/json'];
// @public (undocumented)
type ReversiShowGameRequest = operations['reversi/show-game']['requestBody']['content']['application/json'];
// @public (undocumented)
type ReversiShowGameResponse = operations['reversi/show-game']['responses']['200']['content']['application/json'];
// @public (undocumented)
type ReversiSurrenderRequest = operations['reversi/surrender']['requestBody']['content']['application/json'];
// @public (undocumented)
type Role = components['schemas']['Role'];

View file

@ -1,11 +1,23 @@
{
"type": "module",
"name": "misskey-js",
"version": "0.0.16",
"description": "Misskey SDK for JavaScript",
"main": "./built/index.js",
"types": "./built/index.d.ts",
"exports": {
".": {
"import": "./built/esm/index.js",
"types": "./built/dts/index.d.ts"
},
"./*": {
"import": "./built/esm/*",
"types": "./built/dts/*"
}
},
"scripts": {
"build": "tsc",
"build": "npm run ts",
"ts": "npm run ts-esm && npm run ts-dts",
"ts-esm": "tsc --outDir built/esm",
"ts-dts": "tsc --outDir built/dts --declaration true --emitDeclarationOnly true --declarationMap true",
"watch": "nodemon -w src -e ts,js,cjs,mjs,json --exec \"pnpm run build\"",
"tsd": "tsd",
"api": "pnpm api-extractor run --local --verbose",
@ -22,21 +34,21 @@
"url": "git+https://github.com/misskey-dev/misskey.js.git"
},
"devDependencies": {
"@microsoft/api-extractor": "7.38.5",
"@misskey-dev/eslint-plugin": "^1.0.0",
"@swc/jest": "0.2.29",
"@microsoft/api-extractor": "7.39.1",
"@misskey-dev/eslint-plugin": "1.0.0",
"@swc/jest": "0.2.31",
"@types/jest": "29.5.11",
"@types/node": "20.10.5",
"@typescript-eslint/eslint-plugin": "6.14.0",
"@typescript-eslint/parser": "6.14.0",
"@types/node": "20.11.5",
"@typescript-eslint/eslint-plugin": "6.19.0",
"@typescript-eslint/parser": "6.19.0",
"eslint": "8.56.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.0.2",
"tsd": "0.30.0",
"nodemon": "3.0.3",
"tsd": "0.30.4",
"typescript": "5.3.3"
},
"files": [
@ -44,7 +56,7 @@
],
"dependencies": {
"@swc/cli": "0.1.63",
"@swc/core": "1.3.100",
"@swc/core": "1.3.105",
"eventemitter3": "5.0.1",
"reconnecting-websocket": "4.4.0"
}

View file

@ -1,11 +1,11 @@
import './autogen/apiClientJSDoc';
import './autogen/apiClientJSDoc.js';
import { SwitchCaseResponseType } from './api.types';
import type { Endpoints } from './api.types';
import { SwitchCaseResponseType } from './api.types.js';
import type { Endpoints } from './api.types.js';
export {
SwitchCaseResponseType,
} from './api.types';
} from './api.types.js';
const MK_API_ERROR = Symbol();

View file

@ -1,6 +1,6 @@
import { Endpoints as Gen } from './autogen/endpoint';
import { UserDetailed } from './autogen/models';
import { UsersShowRequest } from './autogen/entities';
import { Endpoints as Gen } from './autogen/endpoint.js';
import { UserDetailed } from './autogen/models.js';
import { UsersShowRequest } from './autogen/entities.js';
import {
SigninRequest,
SigninResponse,
@ -8,7 +8,7 @@ import {
SignupPendingResponse,
SignupRequest,
SignupResponse,
} from './entities';
} from './entities.js';
type Overwrite<T, U extends { [Key in keyof T]?: unknown }> = Omit<
T,

View file

@ -1,6 +1,6 @@
/*
* version: 2023.12.2
* generatedAt: 2024-01-13T04:31:38.782Z
* generatedAt: 2024-01-21T01:01:12.332Z
*/
import type { SwitchCaseResponseType } from '../api.js';
@ -4074,5 +4074,71 @@ declare module '../api.js' {
params: P,
credential?: string | null,
): Promise<SwitchCaseResponseType<E, P>>;
/**
* No description provided.
*
* **Credential required**: *Yes* / **Permission**: *write:account*
*/
request<E extends 'reversi/cancel-match', P extends Endpoints[E]['req']>(
endpoint: E,
params: P,
credential?: string | null,
): Promise<SwitchCaseResponseType<E, P>>;
/**
* No description provided.
*
* **Credential required**: *No*
*/
request<E extends 'reversi/games', P extends Endpoints[E]['req']>(
endpoint: E,
params: P,
credential?: string | null,
): Promise<SwitchCaseResponseType<E, P>>;
/**
* No description provided.
*
* **Credential required**: *Yes* / **Permission**: *write:account*
*/
request<E extends 'reversi/match', P extends Endpoints[E]['req']>(
endpoint: E,
params: P,
credential?: string | null,
): Promise<SwitchCaseResponseType<E, P>>;
/**
* No description provided.
*
* **Credential required**: *Yes* / **Permission**: *read:account*
*/
request<E extends 'reversi/invitations', P extends Endpoints[E]['req']>(
endpoint: E,
params: P,
credential?: string | null,
): Promise<SwitchCaseResponseType<E, P>>;
/**
* No description provided.
*
* **Credential required**: *No*
*/
request<E extends 'reversi/show-game', P extends Endpoints[E]['req']>(
endpoint: E,
params: P,
credential?: string | null,
): Promise<SwitchCaseResponseType<E, P>>;
/**
* No description provided.
*
* **Credential required**: *Yes* / **Permission**: *write:account*
*/
request<E extends 'reversi/surrender', P extends Endpoints[E]['req']>(
endpoint: E,
params: P,
credential?: string | null,
): Promise<SwitchCaseResponseType<E, P>>;
}
}

View file

@ -1,6 +1,6 @@
/*
* version: 2023.12.2
* generatedAt: 2024-01-13T04:31:38.778Z
* generatedAt: 2024-01-21T01:01:12.330Z
*/
import type {
@ -559,6 +559,16 @@ import type {
BubbleGameRegisterResponse,
BubbleGameRankingRequest,
BubbleGameRankingResponse,
ReversiCancelMatchRequest,
ReversiCancelMatchResponse,
ReversiGamesRequest,
ReversiGamesResponse,
ReversiMatchRequest,
ReversiMatchResponse,
ReversiInvitationsResponse,
ReversiShowGameRequest,
ReversiShowGameResponse,
ReversiSurrenderRequest,
} from './entities.js';
export type Endpoints = {
@ -935,4 +945,10 @@ export type Endpoints = {
'sponsors': { req: SponsorsRequest; res: EmptyResponse };
'bubble-game/register': { req: BubbleGameRegisterRequest; res: BubbleGameRegisterResponse };
'bubble-game/ranking': { req: BubbleGameRankingRequest; res: BubbleGameRankingResponse };
'reversi/cancel-match': { req: ReversiCancelMatchRequest; res: ReversiCancelMatchResponse };
'reversi/games': { req: ReversiGamesRequest; res: ReversiGamesResponse };
'reversi/match': { req: ReversiMatchRequest; res: ReversiMatchResponse };
'reversi/invitations': { req: EmptyRequest; res: ReversiInvitationsResponse };
'reversi/show-game': { req: ReversiShowGameRequest; res: ReversiShowGameResponse };
'reversi/surrender': { req: ReversiSurrenderRequest; res: EmptyResponse };
}

View file

@ -1,6 +1,6 @@
/*
* version: 2023.12.2
* generatedAt: 2024-01-13T04:31:38.775Z
* generatedAt: 2024-01-21T01:01:12.328Z
*/
import { operations } from './types.js';
@ -561,3 +561,13 @@ export type BubbleGameRegisterRequest = operations['bubble-game/register']['requ
export type BubbleGameRegisterResponse = operations['bubble-game/register']['responses']['200']['content']['application/json'];
export type BubbleGameRankingRequest = operations['bubble-game/ranking']['requestBody']['content']['application/json'];
export type BubbleGameRankingResponse = operations['bubble-game/ranking']['responses']['200']['content']['application/json'];
export type ReversiCancelMatchRequest = operations['reversi/cancel-match']['requestBody']['content']['application/json'];
export type ReversiCancelMatchResponse = operations['reversi/cancel-match']['responses']['200']['content']['application/json'];
export type ReversiGamesRequest = operations['reversi/games']['requestBody']['content']['application/json'];
export type ReversiGamesResponse = operations['reversi/games']['responses']['200']['content']['application/json'];
export type ReversiMatchRequest = operations['reversi/match']['requestBody']['content']['application/json'];
export type ReversiMatchResponse = operations['reversi/match']['responses']['200']['content']['application/json'];
export type ReversiInvitationsResponse = operations['reversi/invitations']['responses']['200']['content']['application/json'];
export type ReversiShowGameRequest = operations['reversi/show-game']['requestBody']['content']['application/json'];
export type ReversiShowGameResponse = operations['reversi/show-game']['responses']['200']['content']['application/json'];
export type ReversiSurrenderRequest = operations['reversi/surrender']['requestBody']['content']['application/json'];

View file

@ -1,6 +1,6 @@
/*
* version: 2023.12.2
* generatedAt: 2024-01-13T04:31:38.773Z
* generatedAt: 2024-01-21T01:01:12.327Z
*/
import { components } from './types.js';
@ -41,3 +41,5 @@ export type Flash = components['schemas']['Flash'];
export type Signin = components['schemas']['Signin'];
export type RoleLite = components['schemas']['RoleLite'];
export type Role = components['schemas']['Role'];
export type ReversiGameLite = components['schemas']['ReversiGameLite'];
export type ReversiGameDetailed = components['schemas']['ReversiGameDetailed'];

View file

@ -3,7 +3,7 @@
/*
* version: 2023.12.2
* generatedAt: 2024-01-13T04:31:38.633Z
* generatedAt: 2024-01-21T01:01:12.246Z
*/
/**
@ -3591,6 +3591,60 @@ export type paths = {
*/
post: operations['bubble-game/ranking'];
};
'/reversi/cancel-match': {
/**
* reversi/cancel-match
* @description No description provided.
*
* **Credential required**: *Yes* / **Permission**: *write:account*
*/
post: operations['reversi/cancel-match'];
};
'/reversi/games': {
/**
* reversi/games
* @description No description provided.
*
* **Credential required**: *No*
*/
post: operations['reversi/games'];
};
'/reversi/match': {
/**
* reversi/match
* @description No description provided.
*
* **Credential required**: *Yes* / **Permission**: *write:account*
*/
post: operations['reversi/match'];
};
'/reversi/invitations': {
/**
* reversi/invitations
* @description No description provided.
*
* **Credential required**: *Yes* / **Permission**: *read:account*
*/
post: operations['reversi/invitations'];
};
'/reversi/show-game': {
/**
* reversi/show-game
* @description No description provided.
*
* **Credential required**: *No*
*/
post: operations['reversi/show-game'];
};
'/reversi/surrender': {
/**
* reversi/surrender
* @description No description provided.
*
* **Credential required**: *Yes* / **Permission**: *write:account*
*/
post: operations['reversi/surrender'];
};
};
export type webhooks = Record<string, never>;
@ -4537,6 +4591,78 @@ export type components = {
};
usersCount: number;
});
ReversiGameLite: {
/** Format: id */
id: string;
/** Format: date-time */
createdAt: string;
/** Format: date-time */
startedAt: string | null;
/** Format: date-time */
endedAt: string | null;
isStarted: boolean;
isEnded: boolean;
form1: Record<string, never> | null;
form2: Record<string, never> | null;
user1Ready: boolean;
user2Ready: boolean;
/** Format: id */
user1Id: string;
/** Format: id */
user2Id: string;
user1: components['schemas']['User'];
user2: components['schemas']['User'];
/** Format: id */
winnerId: string | null;
winner: components['schemas']['User'] | null;
/** Format: id */
surrenderedUserId: string | null;
/** Format: id */
timeoutUserId: string | null;
black: number | null;
bw: string;
isLlotheo: boolean;
canPutEverywhere: boolean;
loopedBoard: boolean;
timeLimitForEachTurn: number;
};
ReversiGameDetailed: {
/** Format: id */
id: string;
/** Format: date-time */
createdAt: string;
/** Format: date-time */
startedAt: string | null;
/** Format: date-time */
endedAt: string | null;
isStarted: boolean;
isEnded: boolean;
form1: Record<string, never> | null;
form2: Record<string, never> | null;
user1Ready: boolean;
user2Ready: boolean;
/** Format: id */
user1Id: string;
/** Format: id */
user2Id: string;
user1: components['schemas']['User'];
user2: components['schemas']['User'];
/** Format: id */
winnerId: string | null;
winner: components['schemas']['User'] | null;
/** Format: id */
surrenderedUserId: string | null;
/** Format: id */
timeoutUserId: string | null;
black: number | null;
bw: string;
isLlotheo: boolean;
canPutEverywhere: boolean;
loopedBoard: boolean;
timeLimitForEachTurn: number;
logs: unknown[][];
map: string[];
};
};
responses: never;
parameters: never;
@ -26429,5 +26555,325 @@ export type operations = {
};
};
};
/**
* reversi/cancel-match
* @description No description provided.
*
* **Credential required**: *Yes* / **Permission**: *write:account*
*/
'reversi/cancel-match': {
requestBody: {
content: {
'application/json': {
/** Format: misskey:id */
userId?: string | null;
};
};
};
responses: {
/** @description OK (with results) */
200: {
content: {
'application/json': unknown;
};
};
/** @description Client error */
400: {
content: {
'application/json': components['schemas']['Error'];
};
};
/** @description Authentication error */
401: {
content: {
'application/json': components['schemas']['Error'];
};
};
/** @description Forbidden error */
403: {
content: {
'application/json': components['schemas']['Error'];
};
};
/** @description I'm Ai */
418: {
content: {
'application/json': components['schemas']['Error'];
};
};
/** @description Internal server error */
500: {
content: {
'application/json': components['schemas']['Error'];
};
};
};
};
/**
* reversi/games
* @description No description provided.
*
* **Credential required**: *No*
*/
'reversi/games': {
requestBody: {
content: {
'application/json': {
/** @default 10 */
limit?: number;
/** Format: misskey:id */
sinceId?: string;
/** Format: misskey:id */
untilId?: string;
/** @default false */
my?: boolean;
};
};
};
responses: {
/** @description OK (with results) */
200: {
content: {
'application/json': components['schemas']['ReversiGameLite'][];
};
};
/** @description Client error */
400: {
content: {
'application/json': components['schemas']['Error'];
};
};
/** @description Authentication error */
401: {
content: {
'application/json': components['schemas']['Error'];
};
};
/** @description Forbidden error */
403: {
content: {
'application/json': components['schemas']['Error'];
};
};
/** @description I'm Ai */
418: {
content: {
'application/json': components['schemas']['Error'];
};
};
/** @description Internal server error */
500: {
content: {
'application/json': components['schemas']['Error'];
};
};
};
};
/**
* reversi/match
* @description No description provided.
*
* **Credential required**: *Yes* / **Permission**: *write:account*
*/
'reversi/match': {
requestBody: {
content: {
'application/json': {
/** Format: misskey:id */
userId?: string | null;
};
};
};
responses: {
/** @description OK (with results) */
200: {
content: {
'application/json': unknown;
};
};
/** @description Client error */
400: {
content: {
'application/json': components['schemas']['Error'];
};
};
/** @description Authentication error */
401: {
content: {
'application/json': components['schemas']['Error'];
};
};
/** @description Forbidden error */
403: {
content: {
'application/json': components['schemas']['Error'];
};
};
/** @description I'm Ai */
418: {
content: {
'application/json': components['schemas']['Error'];
};
};
/** @description Internal server error */
500: {
content: {
'application/json': components['schemas']['Error'];
};
};
};
};
/**
* reversi/invitations
* @description No description provided.
*
* **Credential required**: *Yes* / **Permission**: *read:account*
*/
'reversi/invitations': {
responses: {
/** @description OK (with results) */
200: {
content: {
'application/json': components['schemas']['UserLite'][];
};
};
/** @description Client error */
400: {
content: {
'application/json': components['schemas']['Error'];
};
};
/** @description Authentication error */
401: {
content: {
'application/json': components['schemas']['Error'];
};
};
/** @description Forbidden error */
403: {
content: {
'application/json': components['schemas']['Error'];
};
};
/** @description I'm Ai */
418: {
content: {
'application/json': components['schemas']['Error'];
};
};
/** @description Internal server error */
500: {
content: {
'application/json': components['schemas']['Error'];
};
};
};
};
/**
* reversi/show-game
* @description No description provided.
*
* **Credential required**: *No*
*/
'reversi/show-game': {
requestBody: {
content: {
'application/json': {
/** Format: misskey:id */
gameId: string;
};
};
};
responses: {
/** @description OK (with results) */
200: {
content: {
'application/json': components['schemas']['ReversiGameDetailed'];
};
};
/** @description Client error */
400: {
content: {
'application/json': components['schemas']['Error'];
};
};
/** @description Authentication error */
401: {
content: {
'application/json': components['schemas']['Error'];
};
};
/** @description Forbidden error */
403: {
content: {
'application/json': components['schemas']['Error'];
};
};
/** @description I'm Ai */
418: {
content: {
'application/json': components['schemas']['Error'];
};
};
/** @description Internal server error */
500: {
content: {
'application/json': components['schemas']['Error'];
};
};
};
};
/**
* reversi/surrender
* @description No description provided.
*
* **Credential required**: *Yes* / **Permission**: *write:account*
*/
'reversi/surrender': {
requestBody: {
content: {
'application/json': {
/** Format: misskey:id */
gameId: string;
};
};
};
responses: {
/** @description OK (without any results) */
204: {
content: never;
};
/** @description Client error */
400: {
content: {
'application/json': components['schemas']['Error'];
};
};
/** @description Authentication error */
401: {
content: {
'application/json': components['schemas']['Error'];
};
};
/** @description Forbidden error */
403: {
content: {
'application/json': components['schemas']['Error'];
};
};
/** @description I'm Ai */
418: {
content: {
'application/json': components['schemas']['Error'];
};
};
/** @description Internal server error */
500: {
content: {
'application/json': components['schemas']['Error'];
};
};
};
};
};

View file

@ -1,8 +1,8 @@
import { ModerationLogPayloads } from './consts.js';
import { Announcement, EmojiDetailed, MeDetailed, MeDetailedOnly, Page, User, UserDetailed } from './autogen/models';
import { Announcement, EmojiDetailed, MeDetailed, MeDetailedOnly, Page, User, UserDetailed } from './autogen/models.js';
export * from './autogen/entities';
export * from './autogen/models';
export * from './autogen/entities.js';
export * from './autogen/models.js';
export type ID = string;
export type DateString = string;

View file

@ -1,7 +1,9 @@
import { EventEmitter } from 'eventemitter3';
import ReconnectingWebsocket from 'reconnecting-websocket';
import _ReconnectingWebsocket from 'reconnecting-websocket';
import type { BroadcastEvents, Channels } from './streaming.types.js';
const ReconnectingWebsocket = _ReconnectingWebsocket as unknown as typeof _ReconnectingWebsocket['default'];
export function urlQuery(obj: Record<string, string | number | boolean | undefined>): string {
const params = Object.entries(obj)
.filter(([, v]) => Array.isArray(v) ? v.length : v !== undefined)
@ -24,7 +26,7 @@ type StreamEvents = {
* Misskey stream connection
*/
export default class Stream extends EventEmitter<StreamEvents> {
private stream: ReconnectingWebsocket;
private stream: _ReconnectingWebsocket.default;
public state: 'initializing' | 'reconnecting' | 'connected' = 'initializing';
private sharedConnectionPools: Pool[] = [];
private sharedConnections: SharedConnection[] = [];

View file

@ -1,5 +1,5 @@
import { expectType } from 'tsd';
import * as Misskey from '../src';
import * as Misskey from '../src/index.js';
describe('API', () => {
test('success', async () => {

View file

@ -1,5 +1,5 @@
import { expectType } from 'tsd';
import * as Misskey from '../src';
import * as Misskey from '../src/index.js';
describe('Streaming', () => {
test('emit type', async () => {

View file

@ -1,5 +1,5 @@
import { enableFetchMocks } from 'jest-fetch-mock';
import { APIClient, isAPIError } from '../src/api';
import { APIClient, isAPIError } from '../src/api.js';
enableFetchMocks();

View file

@ -1,5 +1,5 @@
import WS from 'jest-websocket-mock';
import Stream from '../src/streaming';
import Stream from '../src/streaming.js';
describe('Streaming', () => {
test('useChannel', async () => {