update misskey-js to the new templates
This commit is contained in:
parent
b25eb703ea
commit
4e30986cda
32 changed files with 258 additions and 409 deletions
|
|
@ -79,7 +79,7 @@
|
||||||
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
|
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
|
||||||
* DEFAULT VALUE: "<projectFolder>/tsconfig.json"
|
* DEFAULT VALUE: "<projectFolder>/tsconfig.json"
|
||||||
*/
|
*/
|
||||||
"tsconfigFilePath": "<projectFolder>/tsconfig.lib.json",
|
"tsconfigFilePath": "<projectFolder>/src/tsconfig.json",
|
||||||
/**
|
/**
|
||||||
* Provides a compiler configuration that will be used instead of reading the tsconfig.json file from disk.
|
* Provides a compiler configuration that will be used instead of reading the tsconfig.json file from disk.
|
||||||
* The object must conform to the TypeScript tsconfig schema:
|
* The object must conform to the TypeScript tsconfig schema:
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,10 @@ export default [
|
||||||
{
|
{
|
||||||
ignores: [
|
ignores: [
|
||||||
'generator',
|
'generator',
|
||||||
'**/lib/',
|
'temp',
|
||||||
'**/temp/',
|
'built',
|
||||||
'**/built/',
|
'coverage',
|
||||||
'**/coverage/',
|
'node_modules',
|
||||||
'**/node_modules/',
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -20,7 +19,7 @@ export default [
|
||||||
languageOptions: {
|
languageOptions: {
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
parser: tsParser,
|
parser: tsParser,
|
||||||
project: ['./tsconfig.lib.json'],
|
project: ['src/tsconfig.json'],
|
||||||
sourceType: 'module',
|
sourceType: 'module',
|
||||||
tsconfigRootDir: import.meta.dirname,
|
tsconfigRootDir: import.meta.dirname,
|
||||||
},
|
},
|
||||||
|
|
@ -31,7 +30,7 @@ export default [
|
||||||
languageOptions: {
|
languageOptions: {
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
parser: tsParser,
|
parser: tsParser,
|
||||||
projectService: ['./tsconfig.test.json'],
|
projectService: ['test/tsconfig.json'],
|
||||||
sourceType: 'module',
|
sourceType: 'module',
|
||||||
tsconfigRootDir: import.meta.dirname,
|
tsconfigRootDir: import.meta.dirname,
|
||||||
},
|
},
|
||||||
|
|
@ -42,18 +41,18 @@ export default [
|
||||||
languageOptions: {
|
languageOptions: {
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
parser: tsParser,
|
parser: tsParser,
|
||||||
projectService: ['./tsconfig.test-d.json'],
|
projectService: ['test-d/tsconfig.json'],
|
||||||
sourceType: 'module',
|
sourceType: 'module',
|
||||||
tsconfigRootDir: import.meta.dirname,
|
tsconfigRootDir: import.meta.dirname,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
files: ['*.ts', '*.js', 'scripts/**/*'],
|
files: ['*.ts', '*.js', 'scripts/**/*.ts', 'scripts/**/*.js', 'scripts/**/*.mjs', 'scripts/**/*.cjs'],
|
||||||
languageOptions: {
|
languageOptions: {
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
parser: tsParser,
|
parser: tsParser,
|
||||||
project: ['./tsconfig.scripts.json'],
|
project: ['tsconfig.scripts.json'],
|
||||||
sourceType: 'module',
|
sourceType: 'module',
|
||||||
tsconfigRootDir: import.meta.dirname,
|
tsconfigRootDir: import.meta.dirname,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@
|
||||||
|
|
||||||
import type { AuthenticationResponseJSON } from '@simplewebauthn/types';
|
import type { AuthenticationResponseJSON } from '@simplewebauthn/types';
|
||||||
import { EventEmitter } from 'eventemitter3';
|
import { EventEmitter } from 'eventemitter3';
|
||||||
import { Options } from 'reconnecting-websocket';
|
import type { Options } from 'reconnecting-websocket';
|
||||||
import type { PublicKeyCredentialRequestOptionsJSON as PublicKeyCredentialRequestOptionsJSON_2 } from '@simplewebauthn/types';
|
import type { PublicKeyCredentialRequestOptionsJSON } from '@simplewebauthn/types';
|
||||||
import _ReconnectingWebSocket from 'reconnecting-websocket';
|
import _ReconnectingWebSocket from 'reconnecting-websocket';
|
||||||
|
|
||||||
// Warning: (ae-forgotten-export) The symbol "components" needs to be exported by the entry point index.d.ts
|
// Warning: (ae-forgotten-export) The symbol "components" needs to be exported by the entry point index.d.ts
|
||||||
|
|
@ -24,7 +24,7 @@ export type Acct = {
|
||||||
declare namespace acct {
|
declare namespace acct {
|
||||||
export {
|
export {
|
||||||
parse,
|
parse,
|
||||||
toString_2 as toString,
|
toString,
|
||||||
Acct
|
Acct
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -155,21 +155,12 @@ type AdminCaptchaSaveRequest = operations['admin___captcha___save']['requestBody
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type AdminCwInstanceRequest = operations['admin___cw-instance']['requestBody']['content']['application/json'];
|
type AdminCwInstanceRequest = operations['admin___cw-instance']['requestBody']['content']['application/json'];
|
||||||
|
|
||||||
// @public (undocumented)
|
|
||||||
type AdminCwInstanceResponse = operations['admin___cw-instance']['responses']['200']['content']['application/json'];
|
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type AdminCwNoteRequest = operations['admin___cw-note']['requestBody']['content']['application/json'];
|
type AdminCwNoteRequest = operations['admin___cw-note']['requestBody']['content']['application/json'];
|
||||||
|
|
||||||
// @public (undocumented)
|
|
||||||
type AdminCwNoteResponse = operations['admin___cw-note']['responses']['200']['content']['application/json'];
|
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type AdminCwUserRequest = operations['admin___cw-user']['requestBody']['content']['application/json'];
|
type AdminCwUserRequest = operations['admin___cw-user']['requestBody']['content']['application/json'];
|
||||||
|
|
||||||
// @public (undocumented)
|
|
||||||
type AdminCwUserResponse = operations['admin___cw-user']['responses']['200']['content']['application/json'];
|
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type AdminDeclineUserRequest = operations['admin___decline-user']['requestBody']['content']['application/json'];
|
type AdminDeclineUserRequest = operations['admin___decline-user']['requestBody']['content']['application/json'];
|
||||||
|
|
||||||
|
|
@ -568,6 +559,12 @@ class APIClient {
|
||||||
fetch: FetchLike;
|
fetch: FetchLike;
|
||||||
// (undocumented)
|
// (undocumented)
|
||||||
origin: string;
|
origin: string;
|
||||||
|
// Warning: (ae-forgotten-export) The symbol "EndpointsWithOptionalParams" needs to be exported by the entry point index.d.ts
|
||||||
|
//
|
||||||
|
// (undocumented)
|
||||||
|
request<E extends keyof EndpointsWithOptionalParams>(endpoint: E, params?: Record<string, never>, credential?: string | null): Promise<SwitchCaseResponseType<E, EmptyRequest>>;
|
||||||
|
// (undocumented)
|
||||||
|
request<E extends keyof Endpoints, P extends Endpoints[E]['req']>(endpoint: E, params: P, credential?: string | null): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
|
|
@ -685,7 +682,7 @@ export type Channels = {
|
||||||
main: {
|
main: {
|
||||||
params: null;
|
params: null;
|
||||||
events: {
|
events: {
|
||||||
notification: (payload: Notification_2) => void;
|
notification: (payload: Notification) => void;
|
||||||
mention: (payload: Note) => void;
|
mention: (payload: Note) => void;
|
||||||
reply: (payload: Note) => void;
|
reply: (payload: Note) => void;
|
||||||
renote: (payload: Note) => void;
|
renote: (payload: Note) => void;
|
||||||
|
|
@ -699,7 +696,7 @@ export type Channels = {
|
||||||
file: DriveFile;
|
file: DriveFile;
|
||||||
}) => void;
|
}) => void;
|
||||||
readAllNotifications: () => void;
|
readAllNotifications: () => void;
|
||||||
unreadNotification: (payload: Notification_2) => void;
|
unreadNotification: (payload: Notification) => void;
|
||||||
notificationFlushed: () => void;
|
notificationFlushed: () => void;
|
||||||
unreadAntenna: (payload: Antenna) => void;
|
unreadAntenna: (payload: Antenna) => void;
|
||||||
newChatMessage: (payload: ChatMessage) => void;
|
newChatMessage: (payload: ChatMessage) => void;
|
||||||
|
|
@ -1564,11 +1561,8 @@ declare namespace entities {
|
||||||
AdminCaptchaCurrentResponse,
|
AdminCaptchaCurrentResponse,
|
||||||
AdminCaptchaSaveRequest,
|
AdminCaptchaSaveRequest,
|
||||||
AdminCwInstanceRequest,
|
AdminCwInstanceRequest,
|
||||||
AdminCwInstanceResponse,
|
|
||||||
AdminCwNoteRequest,
|
AdminCwNoteRequest,
|
||||||
AdminCwNoteResponse,
|
|
||||||
AdminCwUserRequest,
|
AdminCwUserRequest,
|
||||||
AdminCwUserResponse,
|
|
||||||
AdminDeclineUserRequest,
|
AdminDeclineUserRequest,
|
||||||
AdminDeleteAccountRequest,
|
AdminDeleteAccountRequest,
|
||||||
AdminDeleteAllFilesOfAUserRequest,
|
AdminDeleteAllFilesOfAUserRequest,
|
||||||
|
|
@ -1973,7 +1967,6 @@ declare namespace entities {
|
||||||
IReadAnnouncementRequest,
|
IReadAnnouncementRequest,
|
||||||
IRegenerateTokenRequest,
|
IRegenerateTokenRequest,
|
||||||
IRegistryGetRequest,
|
IRegistryGetRequest,
|
||||||
IRegistryGetResponse,
|
|
||||||
IRegistryGetAllRequest,
|
IRegistryGetAllRequest,
|
||||||
IRegistryGetAllResponse,
|
IRegistryGetAllResponse,
|
||||||
IRegistryGetDetailRequest,
|
IRegistryGetDetailRequest,
|
||||||
|
|
@ -2211,7 +2204,7 @@ declare namespace entities {
|
||||||
Note,
|
Note,
|
||||||
NoteReaction,
|
NoteReaction,
|
||||||
NoteFavorite,
|
NoteFavorite,
|
||||||
Notification_2 as Notification,
|
Notification,
|
||||||
DriveFile,
|
DriveFile,
|
||||||
DriveFolder,
|
DriveFolder,
|
||||||
Following,
|
Following,
|
||||||
|
|
@ -2330,8 +2323,8 @@ type FetchExternalResourcesResponse = operations['fetch-external-resources']['re
|
||||||
type FetchLike = (input: string, init?: {
|
type FetchLike = (input: string, init?: {
|
||||||
method?: string;
|
method?: string;
|
||||||
body?: Blob | FormData | string;
|
body?: Blob | FormData | string;
|
||||||
credentials?: RequestCredentials;
|
credentials?: 'include' | 'omit' | 'same-origin';
|
||||||
cache?: RequestCache;
|
cache?: 'default' | 'force-cache' | 'no-cache' | 'no-store' | 'only-if-cached' | 'reload';
|
||||||
headers: {
|
headers: {
|
||||||
[key in string]: string;
|
[key in string]: string;
|
||||||
};
|
};
|
||||||
|
|
@ -2737,9 +2730,6 @@ type IRegistryGetDetailResponse = operations['i___registry___get-detail']['respo
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type IRegistryGetRequest = operations['i___registry___get']['requestBody']['content']['application/json'];
|
type IRegistryGetRequest = operations['i___registry___get']['requestBody']['content']['application/json'];
|
||||||
|
|
||||||
// @public (undocumented)
|
|
||||||
type IRegistryGetResponse = operations['i___registry___get']['responses']['200']['content']['application/json'];
|
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type IRegistryGetUnsecureRequest = operations['i___registry___get-unsecure']['requestBody']['content']['application/json'];
|
type IRegistryGetUnsecureRequest = operations['i___registry___get-unsecure']['requestBody']['content']['application/json'];
|
||||||
|
|
||||||
|
|
@ -3366,7 +3356,7 @@ type NotesVersionsResponse = operations['notes___versions']['responses']['200'][
|
||||||
export const noteVisibilities: readonly ["public", "home", "followers", "specified"];
|
export const noteVisibilities: readonly ["public", "home", "followers", "specified"];
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type Notification_2 = components['schemas']['Notification'];
|
type Notification = components['schemas']['Notification'];
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type NotificationsCreateRequest = operations['notifications___create']['requestBody']['content']['application/json'];
|
type NotificationsCreateRequest = operations['notifications___create']['requestBody']['content']['application/json'];
|
||||||
|
|
@ -3649,12 +3639,12 @@ type SigninFlowResponse = {
|
||||||
} | {
|
} | {
|
||||||
finished: false;
|
finished: false;
|
||||||
next: 'passkey';
|
next: 'passkey';
|
||||||
authRequest: PublicKeyCredentialRequestOptionsJSON_2;
|
authRequest: PublicKeyCredentialRequestOptionsJSON;
|
||||||
};
|
};
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type SigninWithPasskeyInitResponse = {
|
type SigninWithPasskeyInitResponse = {
|
||||||
option: PublicKeyCredentialRequestOptionsJSON_2;
|
option: PublicKeyCredentialRequestOptionsJSON;
|
||||||
context: string;
|
context: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -3785,7 +3775,7 @@ type TestRequest = operations['test']['requestBody']['content']['application/jso
|
||||||
type TestResponse = operations['test']['responses']['200']['content']['application/json'];
|
type TestResponse = operations['test']['responses']['200']['content']['application/json'];
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
function toString_2(acct: Acct): string;
|
function toString(acct: Acct): string;
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type User = components['schemas']['User'];
|
type User = components['schemas']['User'];
|
||||||
|
|
@ -3982,7 +3972,7 @@ type V2AdminEmojiListResponse = operations['v2___admin___emoji___list']['respons
|
||||||
// Warnings were encountered during analysis:
|
// Warnings were encountered during analysis:
|
||||||
//
|
//
|
||||||
// built/entities.d.ts:32:5 - (ae-forgotten-export) The symbol "ModerationLogPayloads" needs to be exported by the entry point index.d.ts
|
// built/entities.d.ts:32:5 - (ae-forgotten-export) The symbol "ModerationLogPayloads" needs to be exported by the entry point index.d.ts
|
||||||
// built/streaming.d.ts:39:9 - (ae-forgotten-export) The symbol "ReconnectingWebSocket" needs to be exported by the entry point index.d.ts
|
// built/streaming.d.ts:40:9 - (ae-forgotten-export) The symbol "ReconnectingWebSocket" needs to be exported by the entry point index.d.ts
|
||||||
// built/streaming.types.d.ts:219:13 - (ae-forgotten-export) The symbol "ReversiUpdateKey" needs to be exported by the entry point index.d.ts
|
// built/streaming.types.d.ts:219:13 - (ae-forgotten-export) The symbol "ReversiUpdateKey" needs to be exported by the entry point index.d.ts
|
||||||
// built/streaming.types.d.ts:233:13 - (ae-forgotten-export) The symbol "ReversiUpdateSettings" needs to be exported by the entry point index.d.ts
|
// built/streaming.types.d.ts:233:13 - (ae-forgotten-export) The symbol "ReversiUpdateSettings" needs to be exported by the entry point index.d.ts
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ export default [
|
||||||
languageOptions: {
|
languageOptions: {
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
parser: tsParser,
|
parser: tsParser,
|
||||||
project: ['./jsconfig.scripts.json'],
|
project: ['./tsconfig.scripts.json'],
|
||||||
sourceType: 'module',
|
sourceType: 'module',
|
||||||
tsconfigRootDir: import.meta.dirname,
|
tsconfigRootDir: import.meta.dirname,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
{
|
|
||||||
"$schema": "https://json.schemastore.org/tsconfig",
|
|
||||||
"extends": "../../shared/jsconfig.node.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"typeRoots": [
|
|
||||||
"./node_modules/@types"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"include": [
|
|
||||||
"*.js"
|
|
||||||
],
|
|
||||||
"exclude": [
|
|
||||||
"node_modules"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
"typecheck": "pnpm run typecheck:generator && pnpm run typecheck:autogen && pnpm run typecheck:scripts",
|
"typecheck": "pnpm run typecheck:generator && pnpm run typecheck:autogen && pnpm run typecheck:scripts",
|
||||||
"typecheck:generator": "tsc -p tsconfig.generator.json --noEmit",
|
"typecheck:generator": "tsc -p tsconfig.generator.json --noEmit",
|
||||||
"typecheck:autogen": "tsc -p tsconfig.autogen.json --noEmit",
|
"typecheck:autogen": "tsc -p tsconfig.autogen.json --noEmit",
|
||||||
"typecheck:scripts": "tsc -p jsconfig.scripts.json --noEmit",
|
"typecheck:scripts": "tsc -p tsconfig.scripts.json --noEmit",
|
||||||
"lint": "pnpm typecheck && pnpm eslint"
|
"lint": "pnpm typecheck && pnpm eslint"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
{
|
{
|
||||||
"$schema": "https://json.schemastore.org/tsconfig",
|
"$schema": "https://json.schemastore.org/tsconfig",
|
||||||
"extends": "../../shared/tsconfig.web.json",
|
"extends": "../../shared/tsconfig.lib.jsonc",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"noImplicitAny": false,
|
|
||||||
"isolatedModules": false,
|
|
||||||
"rootDirs": [
|
"rootDirs": [
|
||||||
"built",
|
"built",
|
||||||
"../built"
|
"../built"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"$schema": "https://json.schemastore.org/tsconfig",
|
"$schema": "https://json.schemastore.org/tsconfig",
|
||||||
"extends": "../../shared/tsconfig.node.json",
|
"extends": "../../shared/tsconfig.scripts.jsonc",
|
||||||
"include": [
|
"include": [
|
||||||
"src/**/*.ts"
|
"src/**/*.ts"
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,6 @@
|
||||||
"references": [
|
"references": [
|
||||||
{ "path": "./tsconfig.generator.json" },
|
{ "path": "./tsconfig.generator.json" },
|
||||||
{ "path": "./tsconfig.autogen.json" },
|
{ "path": "./tsconfig.autogen.json" },
|
||||||
{ "path": "./jsconfig.scripts.json" }
|
{ "path": "./tsconfig.scripts.json" }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
8
packages/misskey-js/generator/tsconfig.scripts.json
Normal file
8
packages/misskey-js/generator/tsconfig.scripts.json
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://json.schemastore.org/tsconfig",
|
||||||
|
"extends": "../../shared/tsconfig.scripts.jsonc",
|
||||||
|
"include": [
|
||||||
|
"*.js",
|
||||||
|
"*.ts"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
import { createDefaultEsmPreset, type JestConfigWithTsJest } from 'ts-jest';
|
import { createDefaultEsmPreset, type JestConfigWithTsJest } from 'ts-jest';
|
||||||
|
|
||||||
const presetConfig = createDefaultEsmPreset({
|
const presetConfig = createDefaultEsmPreset({
|
||||||
tsconfig: '<rootDir>/tsconfig.lib.json'
|
tsconfig: '<rootDir>/test/tsconfig.json',
|
||||||
});
|
});
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
@ -32,7 +32,7 @@ export default {
|
||||||
collectCoverageFrom: ['src/**/*.ts'],
|
collectCoverageFrom: ['src/**/*.ts'],
|
||||||
|
|
||||||
// The directory where Jest should output its coverage files
|
// The directory where Jest should output its coverage files
|
||||||
coverageDirectory: "coverage",
|
coverageDirectory: 'coverage',
|
||||||
|
|
||||||
// An array of regexp pattern strings used to skip coverage collection
|
// An array of regexp pattern strings used to skip coverage collection
|
||||||
// coveragePathIgnorePatterns: [
|
// coveragePathIgnorePatterns: [
|
||||||
|
|
@ -40,7 +40,7 @@ export default {
|
||||||
// ],
|
// ],
|
||||||
|
|
||||||
// Indicates which provider should be used to instrument code for coverage
|
// Indicates which provider should be used to instrument code for coverage
|
||||||
coverageProvider: "v8",
|
coverageProvider: 'v8',
|
||||||
|
|
||||||
// A list of reporter names that Jest uses when writing coverage reports
|
// A list of reporter names that Jest uses when writing coverage reports
|
||||||
// coverageReporters: [
|
// coverageReporters: [
|
||||||
|
|
@ -90,8 +90,8 @@ export default {
|
||||||
// "node"
|
// "node"
|
||||||
// ],
|
// ],
|
||||||
moduleFileExtensions: [
|
moduleFileExtensions: [
|
||||||
"ts",
|
'ts',
|
||||||
"js"
|
'js',
|
||||||
],
|
],
|
||||||
|
|
||||||
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
|
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
|
||||||
|
|
@ -143,7 +143,7 @@ export default {
|
||||||
|
|
||||||
// A list of paths to directories that Jest should use to search for files in
|
// A list of paths to directories that Jest should use to search for files in
|
||||||
roots: [
|
roots: [
|
||||||
"<rootDir>/test"
|
'<rootDir>/test',
|
||||||
],
|
],
|
||||||
|
|
||||||
// Allows you to use a custom runner instead of Jest's default test runner
|
// Allows you to use a custom runner instead of Jest's default test runner
|
||||||
|
|
@ -162,7 +162,7 @@ export default {
|
||||||
// snapshotSerializers: [],
|
// snapshotSerializers: [],
|
||||||
|
|
||||||
// The test environment that will be used for testing
|
// The test environment that will be used for testing
|
||||||
testEnvironment: "node",
|
testEnvironment: 'node',
|
||||||
|
|
||||||
// Options that will be passed to the testEnvironment
|
// Options that will be passed to the testEnvironment
|
||||||
// testEnvironmentOptions: {},
|
// testEnvironmentOptions: {},
|
||||||
|
|
@ -172,7 +172,7 @@ export default {
|
||||||
|
|
||||||
// The glob patterns Jest uses to detect test files
|
// The glob patterns Jest uses to detect test files
|
||||||
testMatch: [
|
testMatch: [
|
||||||
"<rootDir>/test/**/*.ts"
|
'<rootDir>/test/**/*.ts',
|
||||||
],
|
],
|
||||||
|
|
||||||
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
|
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
|
||||||
|
|
|
||||||
|
|
@ -8,17 +8,17 @@
|
||||||
"types": "./built/index.d.ts",
|
"types": "./built/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"clean": "node scripts/clean.mjs",
|
"clean": "node scripts/clean.mjs",
|
||||||
"build": "tsc -p tsconfig.lib.json && node scripts/post-build.mjs",
|
"build": "tsc -p src/tsconfig.json && node scripts/post-build.mjs",
|
||||||
"rebuild": "pnpm clean && pnpm build",
|
"rebuild": "pnpm run clean && pnpm run build",
|
||||||
"tsd": "tsd --types \"./temp/built/src/index.d.ts\" --files \"./temp/built/test-d/**/*.ts\"",
|
"tsd": "tsd --types \"./temp/built/src/index.d.ts\" --files \"./temp/built/test-d/**/*.ts\"",
|
||||||
"api": "pnpm api-extractor run --local --verbose",
|
"api": "pnpm api-extractor run --local --verbose",
|
||||||
"api-prod": "pnpm api-extractor run --verbose",
|
"api-prod": "pnpm api-extractor run --verbose",
|
||||||
"eslint": "eslint --quiet --cache -c eslint.config.js .",
|
"eslint": "eslint --quiet --cache -c eslint.config.js .",
|
||||||
"typecheck-all": "pnpm run --no-bail typecheck:lib && pnpm run --no-bail typecheck:test && pnpm run --no-bail typecheck:test-d && pnpm run --no-bail typecheck:scripts",
|
"typecheck-all": "pnpm run --no-bail typecheck:lib && pnpm run --no-bail typecheck:test && pnpm run --no-bail typecheck:test-d && pnpm run --no-bail typecheck:scripts",
|
||||||
"typecheck": "pnpm run typecheck:lib && pnpm run typecheck:test && pnpm run typecheck:test-d && pnpm run typecheck:scripts",
|
"typecheck": "pnpm run typecheck:lib && pnpm run typecheck:test && pnpm run typecheck:test-d && pnpm run typecheck:scripts",
|
||||||
"typecheck:lib": "tsc -p tsconfig.lib.json --noEmit",
|
"typecheck:lib": "tsc -p src/tsconfig.json --noEmit",
|
||||||
"typecheck:test": "tsc -p tsconfig.test.json --noEmit",
|
"typecheck:test": "tsc -p test/tsconfig.json --noEmit",
|
||||||
"typecheck:test-d": "tsc -p tsconfig.test-d.json --noEmit",
|
"typecheck:test-d": "tsc -p test-d/tsconfig.json --noEmit",
|
||||||
"typecheck:scripts": "tsc -p tsconfig.scripts.json --noEmit",
|
"typecheck:scripts": "tsc -p tsconfig.scripts.json --noEmit",
|
||||||
"lint": "pnpm typecheck && pnpm eslint",
|
"lint": "pnpm typecheck && pnpm eslint",
|
||||||
"jest": "node --no-experimental-require-module --experimental-vm-modules --experimental-import-meta-resolve node_modules/jest/bin/jest.js --coverage --detectOpenHandles",
|
"jest": "node --no-experimental-require-module --experimental-vm-modules --experimental-import-meta-resolve node_modules/jest/bin/jest.js --coverage --detectOpenHandles",
|
||||||
|
|
|
||||||
|
|
@ -4,14 +4,16 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { libBuild, outDir, testDBuild, testDSource } from './_common.mjs';
|
import { libBuild, outDir, testDBuild, testDSource } from './_common.mjs';
|
||||||
import { rm, cp } from 'fs/promises';
|
import { rm, cp, mkdir } from 'fs/promises';
|
||||||
|
|
||||||
// Always clean the output, because artifacts are cached in the build directory instead.
|
// Always clean the output, because artifacts are cached in the build directory instead.
|
||||||
console.log(`Cleaning output directory ${outDir}...`);
|
console.log(`Cleaning output directory ${outDir}...`);
|
||||||
await rm(outDir, { recursive: true, force: true });
|
await rm(outDir, { recursive: true, force: true });
|
||||||
|
|
||||||
// Copy built lib to output directory.
|
// Copy built lib to output directory.
|
||||||
|
await mkdir(outDir, { recursive: true });
|
||||||
await cp(libBuild, outDir, { recursive: true });
|
await cp(libBuild, outDir, { recursive: true });
|
||||||
|
|
||||||
// Stage test-d sources in the build directory so tsd will work.
|
// Stage test-d sources in the build directory so tsd will work.
|
||||||
|
await mkdir(testDBuild, { recursive: true });
|
||||||
await cp(testDSource, testDBuild, { recursive: true });
|
await cp(testDSource, testDBuild, { recursive: true });
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ export type Acct = {
|
||||||
export function parse(_acct: string): Acct {
|
export function parse(_acct: string): Acct {
|
||||||
let acct = _acct;
|
let acct = _acct;
|
||||||
if (acct.startsWith('@')) acct = acct.substring(1);
|
if (acct.startsWith('@')) acct = acct.substring(1);
|
||||||
const split = acct.split('@', 2);
|
const split = acct.split('@', 2) as [string, ...string[]];
|
||||||
return { username: split[0], host: split[1] || null };
|
return { username: split[0], host: split[1] || null };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import './autogen/apiClientJSDoc.js';
|
|
||||||
|
|
||||||
import { endpointReqTypes } from './autogen/endpoint.js';
|
import { endpointReqTypes } from './autogen/endpoint.js';
|
||||||
import type { SwitchCaseResponseType, Endpoints } from './api.types.js';
|
import type { SwitchCaseResponseType, Endpoints, EndpointsWithOptionalParams } from './api.types.js';
|
||||||
|
import type { EmptyRequest } from './autogen/entities.js';
|
||||||
|
|
||||||
export type {
|
export type {
|
||||||
SwitchCaseResponseType,
|
SwitchCaseResponseType,
|
||||||
|
|
@ -29,8 +28,8 @@ export function isAPIError(reason: unknown): reason is APIError {
|
||||||
export type FetchLike = (input: string, init?: {
|
export type FetchLike = (input: string, init?: {
|
||||||
method?: string;
|
method?: string;
|
||||||
body?: Blob | FormData | string;
|
body?: Blob | FormData | string;
|
||||||
credentials?: RequestCredentials;
|
credentials?: 'include' | 'omit' | 'same-origin';
|
||||||
cache?: RequestCache;
|
cache?: 'default' | 'force-cache' | 'no-cache' | 'no-store' | 'only-if-cached' | 'reload';
|
||||||
headers: { [key in string]: string }
|
headers: { [key in string]: string }
|
||||||
}) => Promise<{
|
}) => Promise<{
|
||||||
status: number;
|
status: number;
|
||||||
|
|
@ -64,7 +63,17 @@ export class APIClient {
|
||||||
return ep in endpointReqTypes;
|
return ep in endpointReqTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public request<E extends keyof Endpoints, P extends Endpoints[E]['req'] & object>(
|
public request<E extends keyof EndpointsWithOptionalParams>(
|
||||||
|
endpoint: E,
|
||||||
|
params?: Record<string, never>,
|
||||||
|
credential?: string | null,
|
||||||
|
): Promise<SwitchCaseResponseType<E, EmptyRequest>>;
|
||||||
|
public request<E extends keyof Endpoints, P extends Endpoints[E]['req']>(
|
||||||
|
endpoint: E,
|
||||||
|
params: P,
|
||||||
|
credential?: string | null,
|
||||||
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
public request<E extends keyof Endpoints, P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P = {} as P,
|
params: P = {} as P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,11 @@
|
||||||
import type { Endpoints as Gen } from './autogen/endpoint.js';
|
import type { Endpoints as Gen } from './autogen/endpoint.js';
|
||||||
import type { UserDetailed } from './autogen/models.js';
|
import type { UserDetailed } from './autogen/models.js';
|
||||||
import type { AdminRolesCreateRequest, AdminRolesCreateResponse, UsersShowRequest } from './autogen/entities.js';
|
import type {
|
||||||
|
AdminRolesCreateRequest,
|
||||||
|
AdminRolesCreateResponse,
|
||||||
|
UsersShowRequest,
|
||||||
|
EmptyRequest,
|
||||||
|
} from './autogen/entities.js';
|
||||||
import type {
|
import type {
|
||||||
PartialRolePolicyOverride,
|
PartialRolePolicyOverride,
|
||||||
SigninFlowRequest,
|
SigninFlowRequest,
|
||||||
|
|
@ -109,3 +114,7 @@ export type Endpoints = Overwrite<
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
>;
|
>;
|
||||||
|
|
||||||
|
export type EndpointsWithOptionalParams = {
|
||||||
|
[E in keyof Endpoints]: EmptyRequest extends Endpoints[E]['req'] ? Endpoints[E] : never;
|
||||||
|
};
|
||||||
|
|
|
||||||
|
|
@ -257,7 +257,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'admin/captcha/current', P extends Endpoints[E]['req']>(
|
request<E extends 'admin/captcha/current', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -356,7 +356,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'admin/drive/cleanup', P extends Endpoints[E]['req']>(
|
request<E extends 'admin/drive/cleanup', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -588,7 +588,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'admin/gen-vapid-keys', P extends Endpoints[E]['req']>(
|
request<E extends 'admin/gen-vapid-keys', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -599,7 +599,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'admin/get-index-stats', P extends Endpoints[E]['req']>(
|
request<E extends 'admin/get-index-stats', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -610,7 +610,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'admin/get-table-stats', P extends Endpoints[E]['req']>(
|
request<E extends 'admin/get-table-stats', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -654,7 +654,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'admin/meta', P extends Endpoints[E]['req']>(
|
request<E extends 'admin/meta', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -698,7 +698,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'admin/queue/deliver-delayed', P extends Endpoints[E]['req']>(
|
request<E extends 'admin/queue/deliver-delayed', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -709,7 +709,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'admin/queue/inbox-delayed', P extends Endpoints[E]['req']>(
|
request<E extends 'admin/queue/inbox-delayed', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -753,7 +753,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'admin/queue/queues', P extends Endpoints[E]['req']>(
|
request<E extends 'admin/queue/queues', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -797,7 +797,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'admin/queue/stats', P extends Endpoints[E]['req']>(
|
request<E extends 'admin/queue/stats', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -830,7 +830,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'admin/relays/list', P extends Endpoints[E]['req']>(
|
request<E extends 'admin/relays/list', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -929,7 +929,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'admin/roles/list', P extends Endpoints[E]['req']>(
|
request<E extends 'admin/roles/list', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -1006,7 +1006,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'admin/server-info', P extends Endpoints[E]['req']>(
|
request<E extends 'admin/server-info', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -1287,7 +1287,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'antennas/list', P extends Endpoints[E]['req']>(
|
request<E extends 'antennas/list', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -1364,7 +1364,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'app/current', P extends Endpoints[E]['req']>(
|
request<E extends 'app/current', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -1508,7 +1508,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'channels/featured', P extends Endpoints[E]['req']>(
|
request<E extends 'channels/featured', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -1541,7 +1541,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'channels/my-favorites', P extends Endpoints[E]['req']>(
|
request<E extends 'channels/my-favorites', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -2069,7 +2069,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'clips/list', P extends Endpoints[E]['req']>(
|
request<E extends 'clips/list', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -2080,7 +2080,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'clips/my-favorites', P extends Endpoints[E]['req']>(
|
request<E extends 'clips/my-favorites', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -2146,7 +2146,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'drive', P extends Endpoints[E]['req']>(
|
request<E extends 'drive', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -2366,7 +2366,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'emojis', P extends Endpoints[E]['req']>(
|
request<E extends 'emojis', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -2388,7 +2388,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'endpoints', P extends Endpoints[E]['req']>(
|
request<E extends 'endpoints', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -2400,7 +2400,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'export-custom-emojis', P extends Endpoints[E]['req']>(
|
request<E extends 'export-custom-emojis', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -2731,7 +2731,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'gallery/popular', P extends Endpoints[E]['req']>(
|
request<E extends 'gallery/popular', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -2819,7 +2819,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'get-avatar-decorations', P extends Endpoints[E]['req']>(
|
request<E extends 'get-avatar-decorations', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -2830,7 +2830,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'get-online-users-count', P extends Endpoints[E]['req']>(
|
request<E extends 'get-online-users-count', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -2874,7 +2874,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'hashtags/trend', P extends Endpoints[E]['req']>(
|
request<E extends 'hashtags/trend', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -2896,7 +2896,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'i', P extends Endpoints[E]['req']>(
|
request<E extends 'i', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -3063,7 +3063,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'i/export-antennas', P extends Endpoints[E]['req']>(
|
request<E extends 'i/export-antennas', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -3075,7 +3075,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'i/export-blocking', P extends Endpoints[E]['req']>(
|
request<E extends 'i/export-blocking', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -3087,7 +3087,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'i/export-clips', P extends Endpoints[E]['req']>(
|
request<E extends 'i/export-clips', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -3099,7 +3099,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'i/export-data', P extends Endpoints[E]['req']>(
|
request<E extends 'i/export-data', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -3111,7 +3111,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'i/export-favorites', P extends Endpoints[E]['req']>(
|
request<E extends 'i/export-favorites', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -3135,7 +3135,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'i/export-mute', P extends Endpoints[E]['req']>(
|
request<E extends 'i/export-mute', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -3147,7 +3147,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'i/export-notes', P extends Endpoints[E]['req']>(
|
request<E extends 'i/export-notes', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -3159,7 +3159,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'i/export-user-lists', P extends Endpoints[E]['req']>(
|
request<E extends 'i/export-user-lists', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -3443,7 +3443,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'i/registry/scopes-with-domain', P extends Endpoints[E]['req']>(
|
request<E extends 'i/registry/scopes-with-domain', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -3569,7 +3569,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'i/webhooks/list', P extends Endpoints[E]['req']>(
|
request<E extends 'i/webhooks/list', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -3614,7 +3614,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'invite/create', P extends Endpoints[E]['req']>(
|
request<E extends 'invite/create', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -3636,7 +3636,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'invite/limit', P extends Endpoints[E]['req']>(
|
request<E extends 'invite/limit', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -4165,7 +4165,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'notifications/flush', P extends Endpoints[E]['req']>(
|
request<E extends 'notifications/flush', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -4176,7 +4176,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'notifications/mark-all-as-read', P extends Endpoints[E]['req']>(
|
request<E extends 'notifications/mark-all-as-read', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -4187,7 +4187,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'notifications/test-notification', P extends Endpoints[E]['req']>(
|
request<E extends 'notifications/test-notification', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -4232,7 +4232,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'pages/featured', P extends Endpoints[E]['req']>(
|
request<E extends 'pages/featured', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -4287,7 +4287,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'ping', P extends Endpoints[E]['req']>(
|
request<E extends 'ping', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -4364,7 +4364,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'reset-db', P extends Endpoints[E]['req']>(
|
request<E extends 'reset-db', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -4386,7 +4386,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'retention', P extends Endpoints[E]['req']>(
|
request<E extends 'retention', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -4419,7 +4419,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'reversi/invitations', P extends Endpoints[E]['req']>(
|
request<E extends 'reversi/invitations', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -4474,7 +4474,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'roles/list', P extends Endpoints[E]['req']>(
|
request<E extends 'roles/list', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -4518,7 +4518,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'server-info', P extends Endpoints[E]['req']>(
|
request<E extends 'server-info', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
@ -4540,7 +4540,7 @@ declare module '../api.js' {
|
||||||
*/
|
*/
|
||||||
request<E extends 'stats', P extends Endpoints[E]['req']>(
|
request<E extends 'stats', P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P,
|
params?: P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): Promise<SwitchCaseResponseType<E, P>>;
|
): Promise<SwitchCaseResponseType<E, P>>;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,11 +39,8 @@ import type {
|
||||||
AdminCaptchaCurrentResponse,
|
AdminCaptchaCurrentResponse,
|
||||||
AdminCaptchaSaveRequest,
|
AdminCaptchaSaveRequest,
|
||||||
AdminCwInstanceRequest,
|
AdminCwInstanceRequest,
|
||||||
AdminCwInstanceResponse,
|
|
||||||
AdminCwNoteRequest,
|
AdminCwNoteRequest,
|
||||||
AdminCwNoteResponse,
|
|
||||||
AdminCwUserRequest,
|
AdminCwUserRequest,
|
||||||
AdminCwUserResponse,
|
|
||||||
AdminDeclineUserRequest,
|
AdminDeclineUserRequest,
|
||||||
AdminDeleteAccountRequest,
|
AdminDeleteAccountRequest,
|
||||||
AdminDeleteAllFilesOfAUserRequest,
|
AdminDeleteAllFilesOfAUserRequest,
|
||||||
|
|
@ -448,7 +445,6 @@ import type {
|
||||||
IReadAnnouncementRequest,
|
IReadAnnouncementRequest,
|
||||||
IRegenerateTokenRequest,
|
IRegenerateTokenRequest,
|
||||||
IRegistryGetRequest,
|
IRegistryGetRequest,
|
||||||
IRegistryGetResponse,
|
|
||||||
IRegistryGetAllRequest,
|
IRegistryGetAllRequest,
|
||||||
IRegistryGetAllResponse,
|
IRegistryGetAllResponse,
|
||||||
IRegistryGetDetailRequest,
|
IRegistryGetDetailRequest,
|
||||||
|
|
@ -700,9 +696,9 @@ export type Endpoints = {
|
||||||
'admin/avatar-decorations/update': { req: AdminAvatarDecorationsUpdateRequest; res: EmptyResponse };
|
'admin/avatar-decorations/update': { req: AdminAvatarDecorationsUpdateRequest; res: EmptyResponse };
|
||||||
'admin/captcha/current': { req: EmptyRequest; res: AdminCaptchaCurrentResponse };
|
'admin/captcha/current': { req: EmptyRequest; res: AdminCaptchaCurrentResponse };
|
||||||
'admin/captcha/save': { req: AdminCaptchaSaveRequest; res: EmptyResponse };
|
'admin/captcha/save': { req: AdminCaptchaSaveRequest; res: EmptyResponse };
|
||||||
'admin/cw-instance': { req: AdminCwInstanceRequest; res: AdminCwInstanceResponse };
|
'admin/cw-instance': { req: AdminCwInstanceRequest; res: EmptyResponse };
|
||||||
'admin/cw-note': { req: AdminCwNoteRequest; res: AdminCwNoteResponse };
|
'admin/cw-note': { req: AdminCwNoteRequest; res: EmptyResponse };
|
||||||
'admin/cw-user': { req: AdminCwUserRequest; res: AdminCwUserResponse };
|
'admin/cw-user': { req: AdminCwUserRequest; res: EmptyResponse };
|
||||||
'admin/decline-user': { req: AdminDeclineUserRequest; res: EmptyResponse };
|
'admin/decline-user': { req: AdminDeclineUserRequest; res: EmptyResponse };
|
||||||
'admin/delete-account': { req: AdminDeleteAccountRequest; res: EmptyResponse };
|
'admin/delete-account': { req: AdminDeleteAccountRequest; res: EmptyResponse };
|
||||||
'admin/delete-all-files-of-a-user': { req: AdminDeleteAllFilesOfAUserRequest; res: EmptyResponse };
|
'admin/delete-all-files-of-a-user': { req: AdminDeleteAllFilesOfAUserRequest; res: EmptyResponse };
|
||||||
|
|
@ -977,7 +973,7 @@ export type Endpoints = {
|
||||||
'i/pin': { req: IPinRequest; res: IPinResponse };
|
'i/pin': { req: IPinRequest; res: IPinResponse };
|
||||||
'i/read-announcement': { req: IReadAnnouncementRequest; res: EmptyResponse };
|
'i/read-announcement': { req: IReadAnnouncementRequest; res: EmptyResponse };
|
||||||
'i/regenerate-token': { req: IRegenerateTokenRequest; res: EmptyResponse };
|
'i/regenerate-token': { req: IRegenerateTokenRequest; res: EmptyResponse };
|
||||||
'i/registry/get': { req: IRegistryGetRequest; res: IRegistryGetResponse };
|
'i/registry/get': { req: IRegistryGetRequest; res: EmptyResponse };
|
||||||
'i/registry/get-all': { req: IRegistryGetAllRequest; res: IRegistryGetAllResponse };
|
'i/registry/get-all': { req: IRegistryGetAllRequest; res: IRegistryGetAllResponse };
|
||||||
'i/registry/get-detail': { req: IRegistryGetDetailRequest; res: IRegistryGetDetailResponse };
|
'i/registry/get-detail': { req: IRegistryGetDetailRequest; res: IRegistryGetDetailResponse };
|
||||||
'i/registry/get-unsecure': { req: IRegistryGetUnsecureRequest; res: EmptyResponse };
|
'i/registry/get-unsecure': { req: IRegistryGetUnsecureRequest; res: EmptyResponse };
|
||||||
|
|
|
||||||
|
|
@ -42,11 +42,8 @@ export type AdminAvatarDecorationsUpdateRequest = operations['admin___avatar-dec
|
||||||
export type AdminCaptchaCurrentResponse = operations['admin___captcha___current']['responses']['200']['content']['application/json'];
|
export type AdminCaptchaCurrentResponse = operations['admin___captcha___current']['responses']['200']['content']['application/json'];
|
||||||
export type AdminCaptchaSaveRequest = operations['admin___captcha___save']['requestBody']['content']['application/json'];
|
export type AdminCaptchaSaveRequest = operations['admin___captcha___save']['requestBody']['content']['application/json'];
|
||||||
export type AdminCwInstanceRequest = operations['admin___cw-instance']['requestBody']['content']['application/json'];
|
export type AdminCwInstanceRequest = operations['admin___cw-instance']['requestBody']['content']['application/json'];
|
||||||
export type AdminCwInstanceResponse = operations['admin___cw-instance']['responses']['200']['content']['application/json'];
|
|
||||||
export type AdminCwNoteRequest = operations['admin___cw-note']['requestBody']['content']['application/json'];
|
export type AdminCwNoteRequest = operations['admin___cw-note']['requestBody']['content']['application/json'];
|
||||||
export type AdminCwNoteResponse = operations['admin___cw-note']['responses']['200']['content']['application/json'];
|
|
||||||
export type AdminCwUserRequest = operations['admin___cw-user']['requestBody']['content']['application/json'];
|
export type AdminCwUserRequest = operations['admin___cw-user']['requestBody']['content']['application/json'];
|
||||||
export type AdminCwUserResponse = operations['admin___cw-user']['responses']['200']['content']['application/json'];
|
|
||||||
export type AdminDeclineUserRequest = operations['admin___decline-user']['requestBody']['content']['application/json'];
|
export type AdminDeclineUserRequest = operations['admin___decline-user']['requestBody']['content']['application/json'];
|
||||||
export type AdminDeleteAccountRequest = operations['admin___delete-account']['requestBody']['content']['application/json'];
|
export type AdminDeleteAccountRequest = operations['admin___delete-account']['requestBody']['content']['application/json'];
|
||||||
export type AdminDeleteAllFilesOfAUserRequest = operations['admin___delete-all-files-of-a-user']['requestBody']['content']['application/json'];
|
export type AdminDeleteAllFilesOfAUserRequest = operations['admin___delete-all-files-of-a-user']['requestBody']['content']['application/json'];
|
||||||
|
|
@ -451,7 +448,6 @@ export type IPinResponse = operations['i___pin']['responses']['200']['content'][
|
||||||
export type IReadAnnouncementRequest = operations['i___read-announcement']['requestBody']['content']['application/json'];
|
export type IReadAnnouncementRequest = operations['i___read-announcement']['requestBody']['content']['application/json'];
|
||||||
export type IRegenerateTokenRequest = operations['i___regenerate-token']['requestBody']['content']['application/json'];
|
export type IRegenerateTokenRequest = operations['i___regenerate-token']['requestBody']['content']['application/json'];
|
||||||
export type IRegistryGetRequest = operations['i___registry___get']['requestBody']['content']['application/json'];
|
export type IRegistryGetRequest = operations['i___registry___get']['requestBody']['content']['application/json'];
|
||||||
export type IRegistryGetResponse = operations['i___registry___get']['responses']['200']['content']['application/json'];
|
|
||||||
export type IRegistryGetAllRequest = operations['i___registry___get-all']['requestBody']['content']['application/json'];
|
export type IRegistryGetAllRequest = operations['i___registry___get-all']['requestBody']['content']['application/json'];
|
||||||
export type IRegistryGetAllResponse = operations['i___registry___get-all']['responses']['200']['content']['application/json'];
|
export type IRegistryGetAllResponse = operations['i___registry___get-all']['responses']['200']['content']['application/json'];
|
||||||
export type IRegistryGetDetailRequest = operations['i___registry___get-detail']['requestBody']['content']['application/json'];
|
export type IRegistryGetDetailRequest = operations['i___registry___get-detail']['requestBody']['content']['application/json'];
|
||||||
|
|
|
||||||
|
|
@ -13595,14 +13595,12 @@ export interface operations {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
responses: {
|
responses: {
|
||||||
/** @description OK (with results) */
|
/** @description OK (without any results) */
|
||||||
200: {
|
204: {
|
||||||
headers: {
|
headers: {
|
||||||
[name: string]: unknown;
|
[name: string]: unknown;
|
||||||
};
|
};
|
||||||
content: {
|
content?: never;
|
||||||
'application/json': unknown;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
/** @description Client error */
|
/** @description Client error */
|
||||||
400: {
|
400: {
|
||||||
|
|
@ -13668,14 +13666,12 @@ export interface operations {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
responses: {
|
responses: {
|
||||||
/** @description OK (with results) */
|
/** @description OK (without any results) */
|
||||||
200: {
|
204: {
|
||||||
headers: {
|
headers: {
|
||||||
[name: string]: unknown;
|
[name: string]: unknown;
|
||||||
};
|
};
|
||||||
content: {
|
content?: never;
|
||||||
'application/json': unknown;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
/** @description Client error */
|
/** @description Client error */
|
||||||
400: {
|
400: {
|
||||||
|
|
@ -13741,14 +13737,12 @@ export interface operations {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
responses: {
|
responses: {
|
||||||
/** @description OK (with results) */
|
/** @description OK (without any results) */
|
||||||
200: {
|
204: {
|
||||||
headers: {
|
headers: {
|
||||||
[name: string]: unknown;
|
[name: string]: unknown;
|
||||||
};
|
};
|
||||||
content: {
|
content?: never;
|
||||||
'application/json': unknown;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
/** @description Client error */
|
/** @description Client error */
|
||||||
400: {
|
400: {
|
||||||
|
|
@ -14242,7 +14236,7 @@ export interface operations {
|
||||||
/** Format: misskey:id */
|
/** Format: misskey:id */
|
||||||
fileId?: string;
|
fileId?: string;
|
||||||
url?: string;
|
url?: string;
|
||||||
} | unknown | unknown;
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
responses: {
|
responses: {
|
||||||
|
|
@ -15275,7 +15269,7 @@ export interface operations {
|
||||||
isSensitive?: boolean;
|
isSensitive?: boolean;
|
||||||
localOnly?: boolean;
|
localOnly?: boolean;
|
||||||
roleIdsThatCanBeUsedThisEmojiAsReaction?: string[];
|
roleIdsThatCanBeUsedThisEmojiAsReaction?: string[];
|
||||||
} | unknown | unknown;
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
responses: {
|
responses: {
|
||||||
|
|
@ -27957,7 +27951,7 @@ export interface operations {
|
||||||
/** Format: misskey:id */
|
/** Format: misskey:id */
|
||||||
fileId?: string;
|
fileId?: string;
|
||||||
url?: string;
|
url?: string;
|
||||||
} | unknown | unknown;
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
responses: {
|
responses: {
|
||||||
|
|
@ -36226,14 +36220,12 @@ export interface operations {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
responses: {
|
responses: {
|
||||||
/** @description OK (with results) */
|
/** @description OK (without any results) */
|
||||||
200: {
|
204: {
|
||||||
headers: {
|
headers: {
|
||||||
[name: string]: unknown;
|
[name: string]: unknown;
|
||||||
};
|
};
|
||||||
content: {
|
content?: never;
|
||||||
'application/json': unknown;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
/** @description Client error */
|
/** @description Client error */
|
||||||
400: {
|
400: {
|
||||||
|
|
@ -36958,7 +36950,7 @@ export interface operations {
|
||||||
/** Format: misskey:id */
|
/** Format: misskey:id */
|
||||||
tokenId?: string;
|
tokenId?: string;
|
||||||
token?: string | null;
|
token?: string | null;
|
||||||
} | unknown | unknown;
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
responses: {
|
responses: {
|
||||||
|
|
@ -37257,145 +37249,25 @@ export interface operations {
|
||||||
chatScope?: 'everyone' | 'followers' | 'following' | 'mutual' | 'none';
|
chatScope?: 'everyone' | 'followers' | 'following' | 'mutual' | 'none';
|
||||||
/** Format: misskey:id */
|
/** Format: misskey:id */
|
||||||
pinnedPageId?: string | null;
|
pinnedPageId?: string | null;
|
||||||
mutedWords?: (string[] | string)[];
|
mutedWords?: unknown[];
|
||||||
hardMutedWords?: (string[] | string)[];
|
hardMutedWords?: unknown[];
|
||||||
mutedInstances?: string[];
|
mutedInstances?: string[];
|
||||||
notificationRecieveConfig?: {
|
notificationRecieveConfig?: {
|
||||||
note?: {
|
note?: Record<string, never>;
|
||||||
/** @enum {string} */
|
follow?: Record<string, never>;
|
||||||
type: 'all' | 'following' | 'follower' | 'mutualFollow' | 'followingOrFollower' | 'never';
|
mention?: Record<string, never>;
|
||||||
} | {
|
reply?: Record<string, never>;
|
||||||
/** @enum {string} */
|
renote?: Record<string, never>;
|
||||||
type: 'list';
|
quote?: Record<string, never>;
|
||||||
/** Format: misskey:id */
|
reaction?: Record<string, never>;
|
||||||
userListId: string;
|
pollEnded?: Record<string, never>;
|
||||||
};
|
receiveFollowRequest?: Record<string, never>;
|
||||||
follow?: {
|
followRequestAccepted?: Record<string, never>;
|
||||||
/** @enum {string} */
|
roleAssigned?: Record<string, never>;
|
||||||
type: 'all' | 'following' | 'follower' | 'mutualFollow' | 'followingOrFollower' | 'never';
|
chatRoomInvitationReceived?: Record<string, never>;
|
||||||
} | {
|
achievementEarned?: Record<string, never>;
|
||||||
/** @enum {string} */
|
app?: Record<string, never>;
|
||||||
type: 'list';
|
test?: Record<string, never>;
|
||||||
/** Format: misskey:id */
|
|
||||||
userListId: string;
|
|
||||||
};
|
|
||||||
mention?: {
|
|
||||||
/** @enum {string} */
|
|
||||||
type: 'all' | 'following' | 'follower' | 'mutualFollow' | 'followingOrFollower' | 'never';
|
|
||||||
} | {
|
|
||||||
/** @enum {string} */
|
|
||||||
type: 'list';
|
|
||||||
/** Format: misskey:id */
|
|
||||||
userListId: string;
|
|
||||||
};
|
|
||||||
reply?: {
|
|
||||||
/** @enum {string} */
|
|
||||||
type: 'all' | 'following' | 'follower' | 'mutualFollow' | 'followingOrFollower' | 'never';
|
|
||||||
} | {
|
|
||||||
/** @enum {string} */
|
|
||||||
type: 'list';
|
|
||||||
/** Format: misskey:id */
|
|
||||||
userListId: string;
|
|
||||||
};
|
|
||||||
renote?: {
|
|
||||||
/** @enum {string} */
|
|
||||||
type: 'all' | 'following' | 'follower' | 'mutualFollow' | 'followingOrFollower' | 'never';
|
|
||||||
} | {
|
|
||||||
/** @enum {string} */
|
|
||||||
type: 'list';
|
|
||||||
/** Format: misskey:id */
|
|
||||||
userListId: string;
|
|
||||||
};
|
|
||||||
quote?: {
|
|
||||||
/** @enum {string} */
|
|
||||||
type: 'all' | 'following' | 'follower' | 'mutualFollow' | 'followingOrFollower' | 'never';
|
|
||||||
} | {
|
|
||||||
/** @enum {string} */
|
|
||||||
type: 'list';
|
|
||||||
/** Format: misskey:id */
|
|
||||||
userListId: string;
|
|
||||||
};
|
|
||||||
reaction?: {
|
|
||||||
/** @enum {string} */
|
|
||||||
type: 'all' | 'following' | 'follower' | 'mutualFollow' | 'followingOrFollower' | 'never';
|
|
||||||
} | {
|
|
||||||
/** @enum {string} */
|
|
||||||
type: 'list';
|
|
||||||
/** Format: misskey:id */
|
|
||||||
userListId: string;
|
|
||||||
};
|
|
||||||
pollEnded?: {
|
|
||||||
/** @enum {string} */
|
|
||||||
type: 'all' | 'following' | 'follower' | 'mutualFollow' | 'followingOrFollower' | 'never';
|
|
||||||
} | {
|
|
||||||
/** @enum {string} */
|
|
||||||
type: 'list';
|
|
||||||
/** Format: misskey:id */
|
|
||||||
userListId: string;
|
|
||||||
};
|
|
||||||
receiveFollowRequest?: {
|
|
||||||
/** @enum {string} */
|
|
||||||
type: 'all' | 'following' | 'follower' | 'mutualFollow' | 'followingOrFollower' | 'never';
|
|
||||||
} | {
|
|
||||||
/** @enum {string} */
|
|
||||||
type: 'list';
|
|
||||||
/** Format: misskey:id */
|
|
||||||
userListId: string;
|
|
||||||
};
|
|
||||||
followRequestAccepted?: {
|
|
||||||
/** @enum {string} */
|
|
||||||
type: 'all' | 'following' | 'follower' | 'mutualFollow' | 'followingOrFollower' | 'never';
|
|
||||||
} | {
|
|
||||||
/** @enum {string} */
|
|
||||||
type: 'list';
|
|
||||||
/** Format: misskey:id */
|
|
||||||
userListId: string;
|
|
||||||
};
|
|
||||||
roleAssigned?: {
|
|
||||||
/** @enum {string} */
|
|
||||||
type: 'all' | 'following' | 'follower' | 'mutualFollow' | 'followingOrFollower' | 'never';
|
|
||||||
} | {
|
|
||||||
/** @enum {string} */
|
|
||||||
type: 'list';
|
|
||||||
/** Format: misskey:id */
|
|
||||||
userListId: string;
|
|
||||||
};
|
|
||||||
chatRoomInvitationReceived?: {
|
|
||||||
/** @enum {string} */
|
|
||||||
type: 'all' | 'following' | 'follower' | 'mutualFollow' | 'followingOrFollower' | 'never';
|
|
||||||
} | {
|
|
||||||
/** @enum {string} */
|
|
||||||
type: 'list';
|
|
||||||
/** Format: misskey:id */
|
|
||||||
userListId: string;
|
|
||||||
};
|
|
||||||
achievementEarned?: {
|
|
||||||
/** @enum {string} */
|
|
||||||
type: 'all' | 'following' | 'follower' | 'mutualFollow' | 'followingOrFollower' | 'never';
|
|
||||||
} | {
|
|
||||||
/** @enum {string} */
|
|
||||||
type: 'list';
|
|
||||||
/** Format: misskey:id */
|
|
||||||
userListId: string;
|
|
||||||
};
|
|
||||||
app?: {
|
|
||||||
/** @enum {string} */
|
|
||||||
type: 'all' | 'following' | 'follower' | 'mutualFollow' | 'followingOrFollower' | 'never';
|
|
||||||
} | {
|
|
||||||
/** @enum {string} */
|
|
||||||
type: 'list';
|
|
||||||
/** Format: misskey:id */
|
|
||||||
userListId: string;
|
|
||||||
};
|
|
||||||
test?: {
|
|
||||||
/** @enum {string} */
|
|
||||||
type: 'all' | 'following' | 'follower' | 'mutualFollow' | 'followingOrFollower' | 'never';
|
|
||||||
} | {
|
|
||||||
/** @enum {string} */
|
|
||||||
type: 'list';
|
|
||||||
/** Format: misskey:id */
|
|
||||||
userListId: string;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
emailNotificationTypes?: string[];
|
emailNotificationTypes?: string[];
|
||||||
alsoKnownAs?: string[];
|
alsoKnownAs?: string[];
|
||||||
|
|
@ -41160,7 +41032,7 @@ export interface operations {
|
||||||
scheduleNote: {
|
scheduleNote: {
|
||||||
scheduledAt?: number;
|
scheduledAt?: number;
|
||||||
};
|
};
|
||||||
} | unknown | unknown | unknown | unknown | unknown;
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
responses: {
|
responses: {
|
||||||
|
|
@ -41545,7 +41417,7 @@ export interface operations {
|
||||||
tag?: string;
|
tag?: string;
|
||||||
/** @description The outer arrays are chained with OR, the inner arrays are chained with AND. */
|
/** @description The outer arrays are chained with OR, the inner arrays are chained with AND. */
|
||||||
query?: string[][];
|
query?: string[][];
|
||||||
} | unknown | unknown;
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
responses: {
|
responses: {
|
||||||
|
|
@ -43110,7 +42982,7 @@ export interface operations {
|
||||||
pageId?: string;
|
pageId?: string;
|
||||||
name?: string;
|
name?: string;
|
||||||
username?: string;
|
username?: string;
|
||||||
} | unknown | unknown;
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
responses: {
|
responses: {
|
||||||
|
|
@ -46301,7 +46173,7 @@ export interface operations {
|
||||||
username?: string;
|
username?: string;
|
||||||
/** @description The local host is represented with `null`. */
|
/** @description The local host is represented with `null`. */
|
||||||
host?: string | null;
|
host?: string | null;
|
||||||
} | unknown | unknown;
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
responses: {
|
responses: {
|
||||||
|
|
@ -46392,7 +46264,7 @@ export interface operations {
|
||||||
/** @description The local host is represented with `null`. */
|
/** @description The local host is represented with `null`. */
|
||||||
host?: string | null;
|
host?: string | null;
|
||||||
birthday?: string | null;
|
birthday?: string | null;
|
||||||
} | unknown | unknown;
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
responses: {
|
responses: {
|
||||||
|
|
@ -48002,7 +47874,7 @@ export interface operations {
|
||||||
requestBody: {
|
requestBody: {
|
||||||
content: {
|
content: {
|
||||||
'application/json': {
|
'application/json': {
|
||||||
userId: string | string[];
|
userId: unknown;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -48285,7 +48157,7 @@ export interface operations {
|
||||||
detail?: boolean;
|
detail?: boolean;
|
||||||
username?: string | null;
|
username?: string | null;
|
||||||
host?: string | null;
|
host?: string | null;
|
||||||
} | unknown | unknown;
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
responses: {
|
responses: {
|
||||||
|
|
@ -48372,7 +48244,7 @@ export interface operations {
|
||||||
host?: string | null;
|
host?: string | null;
|
||||||
/** @default true */
|
/** @default true */
|
||||||
detail?: boolean;
|
detail?: boolean;
|
||||||
} | unknown | unknown | unknown;
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
responses: {
|
responses: {
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ import type {
|
||||||
Role,
|
Role,
|
||||||
ReversiGameDetailed,
|
ReversiGameDetailed,
|
||||||
SystemWebhook,
|
SystemWebhook,
|
||||||
UserLite,
|
|
||||||
ChatRoom,
|
ChatRoom,
|
||||||
} from './autogen/models.js';
|
} from './autogen/models.js';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,8 @@ import ReconnectingWebSocket from 'reconnecting-websocket';
|
||||||
import type { Options } from 'reconnecting-websocket';
|
import type { Options } from 'reconnecting-websocket';
|
||||||
import type { BroadcastEvents, Channels } from './streaming.types.js';
|
import type { BroadcastEvents, Channels } from './streaming.types.js';
|
||||||
|
|
||||||
// // コンストラクタとクラスそのものの定義が上手く解決出来ないため再定義
|
// コンストラクタとクラスそのものの定義が上手く解決出来ないため再定義
|
||||||
// const ReconnectingWebSocketConstructor = _ReconnectingWebSocket.default;
|
const ReconnectingWebSocketConstructor = ReconnectingWebSocket as unknown as typeof ReconnectingWebSocket.default;
|
||||||
// type ReconnectingWebSocket = _ReconnectingWebSocket.default;
|
|
||||||
|
|
||||||
export function urlQuery(obj: Record<string, string | number | boolean | undefined>): string {
|
export function urlQuery(obj: Record<string, string | number | boolean | undefined>): string {
|
||||||
const params = Object.entries(obj)
|
const params = Object.entries(obj)
|
||||||
|
|
@ -46,7 +45,7 @@ export interface IStream extends EventEmitter<StreamEvents> {
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
export default class Stream extends EventEmitter<StreamEvents> implements IStream {
|
export default class Stream extends EventEmitter<StreamEvents> implements IStream {
|
||||||
private stream: ReconnectingWebSocket;
|
private stream: ReconnectingWebSocket.default;
|
||||||
public state: 'initializing' | 'reconnecting' | 'connected' = 'initializing';
|
public state: 'initializing' | 'reconnecting' | 'connected' = 'initializing';
|
||||||
private sharedConnectionPools: Pool[] = [];
|
private sharedConnectionPools: Pool[] = [];
|
||||||
private sharedConnections: SharedConnection[] = [];
|
private sharedConnections: SharedConnection[] = [];
|
||||||
|
|
@ -55,7 +54,7 @@ export default class Stream extends EventEmitter<StreamEvents> implements IStrea
|
||||||
|
|
||||||
constructor(origin: string, user: { token: string; } | null, options?: {
|
constructor(origin: string, user: { token: string; } | null, options?: {
|
||||||
WebSocket?: Options['WebSocket'];
|
WebSocket?: Options['WebSocket'];
|
||||||
binaryType?: ReconnectingWebSocket['binaryType'];
|
binaryType?: 'arraybuffer' | 'blob';
|
||||||
}) {
|
}) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
|
@ -84,7 +83,7 @@ export default class Stream extends EventEmitter<StreamEvents> implements IStrea
|
||||||
|
|
||||||
const wsOrigin = origin.replace('http://', 'ws://').replace('https://', 'wss://');
|
const wsOrigin = origin.replace('http://', 'ws://').replace('https://', 'wss://');
|
||||||
|
|
||||||
this.stream = new ReconnectingWebSocket(`${wsOrigin}/streaming?${query}`, '', {
|
this.stream = new ReconnectingWebSocketConstructor(`${wsOrigin}/streaming?${query}`, '', {
|
||||||
minReconnectionDelay: 1, // https://github.com/pladaria/reconnecting-websocket/issues/91
|
minReconnectionDelay: 1, // https://github.com/pladaria/reconnecting-websocket/issues/91
|
||||||
WebSocket: options.WebSocket,
|
WebSocket: options.WebSocket,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
15
packages/misskey-js/src/tsconfig.json
Normal file
15
packages/misskey-js/src/tsconfig.json
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://json.schemastore.org/tsconfig",
|
||||||
|
"extends": "../../shared/tsconfig.lib.jsonc",
|
||||||
|
"compilerOptions": {
|
||||||
|
// Checking
|
||||||
|
"exactOptionalPropertyTypes": true,
|
||||||
|
|
||||||
|
// Output
|
||||||
|
"outDir": "../temp/built/src",
|
||||||
|
"tsBuildInfoFile": "../temp/built/src/tsconfig.lib.tsbuildinfo"
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"**/*"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -5,7 +5,7 @@ describe('API', () => {
|
||||||
test('success', async () => {
|
test('success', async () => {
|
||||||
const cli = new Misskey.api.APIClient({
|
const cli = new Misskey.api.APIClient({
|
||||||
origin: 'https://misskey.test',
|
origin: 'https://misskey.test',
|
||||||
credential: 'TOKEN'
|
credential: 'TOKEN',
|
||||||
});
|
});
|
||||||
const res = await cli.request('meta', { detail: true });
|
const res = await cli.request('meta', { detail: true });
|
||||||
expectType<Misskey.entities.MetaResponse>(res);
|
expectType<Misskey.entities.MetaResponse>(res);
|
||||||
|
|
@ -14,7 +14,7 @@ describe('API', () => {
|
||||||
test('conditional response type (meta)', async () => {
|
test('conditional response type (meta)', async () => {
|
||||||
const cli = new Misskey.api.APIClient({
|
const cli = new Misskey.api.APIClient({
|
||||||
origin: 'https://misskey.test',
|
origin: 'https://misskey.test',
|
||||||
credential: 'TOKEN'
|
credential: 'TOKEN',
|
||||||
});
|
});
|
||||||
|
|
||||||
const res = await cli.request('meta', { detail: true });
|
const res = await cli.request('meta', { detail: true });
|
||||||
|
|
@ -33,7 +33,7 @@ describe('API', () => {
|
||||||
test('conditional response type (users/show)', async () => {
|
test('conditional response type (users/show)', async () => {
|
||||||
const cli = new Misskey.api.APIClient({
|
const cli = new Misskey.api.APIClient({
|
||||||
origin: 'https://misskey.test',
|
origin: 'https://misskey.test',
|
||||||
credential: 'TOKEN'
|
credential: 'TOKEN',
|
||||||
});
|
});
|
||||||
|
|
||||||
const res = await cli.request('users/show', { userId: 'xxxxxxxx' });
|
const res = await cli.request('users/show', { userId: 'xxxxxxxx' });
|
||||||
|
|
|
||||||
14
packages/misskey-js/test-d/tsconfig.json
Normal file
14
packages/misskey-js/test-d/tsconfig.json
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://json.schemastore.org/tsconfig",
|
||||||
|
"extends": "../../shared/tsconfig.lib.jsonc",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "../temp/built/test-d/",
|
||||||
|
"rootDir": "."
|
||||||
|
},
|
||||||
|
"references": [
|
||||||
|
{ "path": "../src/tsconfig.json" }
|
||||||
|
],
|
||||||
|
"include": [
|
||||||
|
"**/*"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -1,9 +1,12 @@
|
||||||
import fetchMock from 'jest-fetch-mock';
|
import _fetchMock from 'jest-fetch-mock';
|
||||||
import { APIClient, isAPIError } from '../src/api.js';
|
import { APIClient, isAPIError } from '../src/api.js';
|
||||||
|
import type { Endpoints } from '../src/index.js';
|
||||||
|
|
||||||
fetchMock.enableMocks();
|
_fetchMock.enableFetchMocks();
|
||||||
|
const fetchMock = _fetchMock.default;
|
||||||
|
|
||||||
function getFetchCall(call: any[]) {
|
function getFetchCall(call: any[] | undefined) {
|
||||||
|
if (!call) return undefined;
|
||||||
const { body, method } = call[1];
|
const { body, method } = call[1];
|
||||||
const contentType = call[1].headers['Content-Type'];
|
const contentType = call[1].headers['Content-Type'];
|
||||||
if (
|
if (
|
||||||
|
|
@ -25,7 +28,7 @@ describe('API', () => {
|
||||||
test('success', async () => {
|
test('success', async () => {
|
||||||
fetchMock.resetMocks();
|
fetchMock.resetMocks();
|
||||||
fetchMock.mockResponse(async (req) => {
|
fetchMock.mockResponse(async (req) => {
|
||||||
const body = await req.json();
|
const body = await req.json() as Record<string, unknown>;
|
||||||
if (req.method === 'POST' && req.url === 'https://misskey.test/api/i') {
|
if (req.method === 'POST' && req.url === 'https://misskey.test/api/i') {
|
||||||
if (body.i === 'TOKEN') {
|
if (body.i === 'TOKEN') {
|
||||||
return JSON.stringify({ id: 'foo' });
|
return JSON.stringify({ id: 'foo' });
|
||||||
|
|
@ -59,7 +62,7 @@ describe('API', () => {
|
||||||
test('with params', async () => {
|
test('with params', async () => {
|
||||||
fetchMock.resetMocks();
|
fetchMock.resetMocks();
|
||||||
fetchMock.mockResponse(async (req) => {
|
fetchMock.mockResponse(async (req) => {
|
||||||
const body = await req.json();
|
const body = await req.json() as Record<string, unknown>;
|
||||||
if (req.method === 'POST' && req.url === 'https://misskey.test/api/notes/show') {
|
if (req.method === 'POST' && req.url === 'https://misskey.test/api/notes/show') {
|
||||||
if (body.i === 'TOKEN' && body.noteId === 'aaaaa') {
|
if (body.i === 'TOKEN' && body.noteId === 'aaaaa') {
|
||||||
return JSON.stringify({ id: 'foo' });
|
return JSON.stringify({ id: 'foo' });
|
||||||
|
|
@ -161,7 +164,7 @@ describe('API', () => {
|
||||||
test('インスタンスの credential が指定されていても引数で credential が null ならば null としてリクエストされる', async () => {
|
test('インスタンスの credential が指定されていても引数で credential が null ならば null としてリクエストされる', async () => {
|
||||||
fetchMock.resetMocks();
|
fetchMock.resetMocks();
|
||||||
fetchMock.mockResponse(async (req) => {
|
fetchMock.mockResponse(async (req) => {
|
||||||
const body = await req.json();
|
const body = await req.json() as Record<string, unknown>;
|
||||||
if (req.method === 'POST' && req.url === 'https://misskey.test/api/i') {
|
if (req.method === 'POST' && req.url === 'https://misskey.test/api/i') {
|
||||||
if (typeof body.i === 'string') {
|
if (typeof body.i === 'string') {
|
||||||
return JSON.stringify({ id: 'foo' });
|
return JSON.stringify({ id: 'foo' });
|
||||||
|
|
@ -196,7 +199,7 @@ describe('API', () => {
|
||||||
|
|
||||||
test('api error', async () => {
|
test('api error', async () => {
|
||||||
fetchMock.resetMocks();
|
fetchMock.resetMocks();
|
||||||
fetchMock.mockResponse(async (req) => {
|
fetchMock.mockResponse(async () => {
|
||||||
return {
|
return {
|
||||||
status: 500,
|
status: 500,
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
|
|
@ -241,7 +244,7 @@ describe('API', () => {
|
||||||
|
|
||||||
test('json parse error', async () => {
|
test('json parse error', async () => {
|
||||||
fetchMock.resetMocks();
|
fetchMock.resetMocks();
|
||||||
fetchMock.mockResponse(async (req) => {
|
fetchMock.mockResponse(async () => {
|
||||||
return {
|
return {
|
||||||
status: 500,
|
status: 500,
|
||||||
body: '<html>I AM NOT JSON</html>',
|
body: '<html>I AM NOT JSON</html>',
|
||||||
|
|
@ -274,7 +277,7 @@ describe('API', () => {
|
||||||
origin: 'https://misskey.test',
|
origin: 'https://misskey.test',
|
||||||
credential: 'TOKEN',
|
credential: 'TOKEN',
|
||||||
});
|
});
|
||||||
await cli.request('admin/roles/create', {
|
await cli.request<'admin/roles/create', Endpoints['admin/roles/create']['req']>('admin/roles/create', {
|
||||||
name: 'aaa',
|
name: 'aaa',
|
||||||
asBadge: false,
|
asBadge: false,
|
||||||
canEditMembersByModerator: false,
|
canEditMembersByModerator: false,
|
||||||
|
|
|
||||||
17
packages/misskey-js/test/tsconfig.json
Normal file
17
packages/misskey-js/test/tsconfig.json
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://json.schemastore.org/tsconfig",
|
||||||
|
"extends": "../../shared/tsconfig.lib.jsonc",
|
||||||
|
"compilerOptions": {
|
||||||
|
// Checking
|
||||||
|
"rootDir": ".",
|
||||||
|
|
||||||
|
// Output
|
||||||
|
"outDir": "../temp/built/test/"
|
||||||
|
},
|
||||||
|
"references": [
|
||||||
|
{ "path": "../src/tsconfig.json" }
|
||||||
|
],
|
||||||
|
"include": [
|
||||||
|
"**/*"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -3,9 +3,9 @@
|
||||||
"files": [],
|
"files": [],
|
||||||
// WebStorm only reads one tsconfig per directory, so this tricks it into loading both.
|
// WebStorm only reads one tsconfig per directory, so this tricks it into loading both.
|
||||||
"references": [
|
"references": [
|
||||||
{ "path": "./tsconfig.lib.json" },
|
{ "path": "./src/tsconfig.json" },
|
||||||
{ "path": "./tsconfig.test.json" },
|
{ "path": "./test/tsconfig.json" },
|
||||||
{ "path": "./tsconfig.test-d.json" },
|
{ "path": "./test-d/tsconfig.json" },
|
||||||
{ "path": "./tsconfig.scripts.json" }
|
{ "path": "./tsconfig.scripts.json" }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
{
|
|
||||||
"$schema": "https://json.schemastore.org/tsconfig",
|
|
||||||
"extends": "../shared/tsconfig.web.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"declaration": true,
|
|
||||||
"declarationMap": true,
|
|
||||||
"sourceMap": true,
|
|
||||||
"inlineSources": true,
|
|
||||||
"outDir": "./temp/built/",
|
|
||||||
"rootDir": ".",
|
|
||||||
"exactOptionalPropertyTypes": true,
|
|
||||||
"composite": true,
|
|
||||||
"typeRoots": [
|
|
||||||
"./node_modules/@types"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"include": [
|
|
||||||
"src/**/*",
|
|
||||||
"test/**/*",
|
|
||||||
"test-d/**/*"
|
|
||||||
],
|
|
||||||
"exclude": [
|
|
||||||
"node_modules"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
@ -1,15 +1,18 @@
|
||||||
{
|
{
|
||||||
"$schema": "https://json.schemastore.org/tsconfig",
|
"$schema": "https://json.schemastore.org/tsconfig",
|
||||||
"extends": "../shared/tsconfig.node.json",
|
"extends": "../shared/tsconfig.scripts.jsonc",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"noImplicitAny": false
|
"rootDirs": [
|
||||||
|
"./scripts",
|
||||||
|
"."
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"*.ts",
|
"*.ts",
|
||||||
"*.js",
|
"*.js",
|
||||||
"scripts/**/*"
|
"scripts/**/*.ts",
|
||||||
],
|
"scripts/**/*.js",
|
||||||
"exclude": [
|
"scripts/**/*.mjs",
|
||||||
"node_modules"
|
"scripts/**/*.cjs"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
{
|
|
||||||
"$schema": "https://json.schemastore.org/tsconfig",
|
|
||||||
"extends": "./tsconfig.lib.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"composite": false,
|
|
||||||
"declaration": false,
|
|
||||||
"declarationMap": false,
|
|
||||||
"sourceMap": false,
|
|
||||||
"inlineSources": false,
|
|
||||||
"outDir": "./temp/built/test-d/",
|
|
||||||
"rootDir": "."
|
|
||||||
},
|
|
||||||
"references": [
|
|
||||||
{ "path": "./tsconfig.lib.json" }
|
|
||||||
],
|
|
||||||
"include": [
|
|
||||||
"test-d/**/*"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
{
|
|
||||||
"$schema": "https://json.schemastore.org/tsconfig",
|
|
||||||
"extends": "./tsconfig.lib.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"composite": false,
|
|
||||||
"declaration": false,
|
|
||||||
"declarationMap": false,
|
|
||||||
"sourceMap": false,
|
|
||||||
"inlineSources": false,
|
|
||||||
"module": "nodenext",
|
|
||||||
"moduleResolution": "nodenext",
|
|
||||||
"outDir": "./temp/built/test/",
|
|
||||||
"rootDir": "./test/"
|
|
||||||
},
|
|
||||||
"references": [
|
|
||||||
{ "path": "./tsconfig.lib.json" }
|
|
||||||
],
|
|
||||||
"include": [
|
|
||||||
"test/**/*"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue