diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2023-07-21 20:36:07 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-21 20:36:07 +0900 |
| commit | e64a81aa1d2801516e8eac8dc69aac540489f20b (patch) | |
| tree | 56accbc0f5f71db864e1e975920135fb0a957291 /packages/misskey-js | |
| parent | Merge pull request #10990 from misskey-dev/develop (diff) | |
| parent | New Crowdin updates (#11336) (diff) | |
| download | misskey-e64a81aa1d2801516e8eac8dc69aac540489f20b.tar.gz misskey-e64a81aa1d2801516e8eac8dc69aac540489f20b.tar.bz2 misskey-e64a81aa1d2801516e8eac8dc69aac540489f20b.zip | |
Merge pull request #11301 from misskey-dev/develop
Release: 13.14.0
Diffstat (limited to 'packages/misskey-js')
| -rw-r--r-- | packages/misskey-js/etc/misskey-js.api.md | 97 | ||||
| -rw-r--r-- | packages/misskey-js/package.json | 20 | ||||
| -rw-r--r-- | packages/misskey-js/src/acct.ts | 2 | ||||
| -rw-r--r-- | packages/misskey-js/src/api.types.ts | 37 | ||||
| -rw-r--r-- | packages/misskey-js/src/entities.ts | 30 | ||||
| -rw-r--r-- | packages/misskey-js/src/streaming.ts | 2 | ||||
| -rw-r--r-- | packages/misskey-js/test-d/streaming.ts | 2 | ||||
| -rw-r--r-- | packages/misskey-js/test/api.ts | 8 | ||||
| -rw-r--r-- | packages/misskey-js/test/streaming.ts | 2 | ||||
| -rw-r--r-- | packages/misskey-js/tsconfig.json | 4 |
10 files changed, 179 insertions, 25 deletions
diff --git a/packages/misskey-js/etc/misskey-js.api.md b/packages/misskey-js/etc/misskey-js.api.md index ca8eee01a1..65d6e2e0b1 100644 --- a/packages/misskey-js/etc/misskey-js.api.md +++ b/packages/misskey-js/etc/misskey-js.api.md @@ -271,6 +271,7 @@ type DetailedInstanceMetadata = LiteInstanceMetadata & { pinnedPages: string[]; pinnedClipId: string | null; cacheRemoteFiles: boolean; + cacheRemoteSensitiveFiles: boolean; requireSetup: boolean; proxyAccountName: string | null; features: Record<string, any>; @@ -327,6 +328,10 @@ export type Endpoints = { req: TODO; res: TODO; }; + 'admin/meta': { + req: TODO; + res: TODO; + }; 'admin/reset-password': { req: TODO; res: TODO; @@ -481,6 +486,14 @@ export type Endpoints = { req: TODO; res: TODO; }; + 'admin/invite/create': { + req: TODO; + res: TODO; + }; + 'admin/invite/list': { + req: TODO; + res: TODO; + }; 'admin/moderators/add': { req: TODO; res: TODO; @@ -960,8 +973,14 @@ export type Endpoints = { res: TODO; }; 'drive/files/create': { - req: TODO; - res: TODO; + req: { + folderId?: string; + name?: string; + comment?: string; + isSentisive?: boolean; + force?: boolean; + }; + res: DriveFile; }; 'drive/files/delete': { req: { @@ -1543,6 +1562,28 @@ export type Endpoints = { req: TODO; res: TODO; }; + 'invite/create': { + req: NoParams; + res: Invite; + }; + 'invite/delete': { + req: { + inviteId: Invite['id']; + }; + res: null; + }; + 'invite/list': { + req: { + limit?: number; + sinceId?: Invite['id']; + untilId?: Invite['id']; + }; + res: Invite[]; + }; + 'invite/limit': { + req: NoParams; + res: InviteLimit; + }; 'messaging/history': { req: { limit?: number; @@ -1942,6 +1983,19 @@ export type Endpoints = { req: TODO; res: TODO; }; + 'signup': { + req: { + username: string; + password: string; + host?: string; + invitationCode?: string; + emailAddress?: string; + 'hcaptcha-response'?: string; + 'g-recaptcha-response'?: string; + 'turnstile-response'?: string; + }; + res: MeSignup | null; + }; 'stats': { req: NoParams; res: Stats; @@ -2159,6 +2213,8 @@ declare namespace entities { UserGroup, UserList, MeDetailed, + MeDetailedWithSecret, + MeSignup, DriveFile, DriveFolder, GalleryPost, @@ -2189,6 +2245,8 @@ declare namespace entities { Blocking, Instance, Signin, + Invite, + InviteLimit, UserSorting, OriginType } @@ -2290,6 +2348,23 @@ type Instance = { type InstanceMetadata = LiteInstanceMetadata | DetailedInstanceMetadata; // @public (undocumented) +type Invite = { + id: ID; + code: string; + expiresAt: DateString | null; + createdAt: DateString; + createdBy: UserLite | null; + usedBy: UserLite | null; + usedAt: DateString | null; + used: boolean; +}; + +// @public (undocumented) +type InviteLimit = { + remaining: number; +}; + +// @public (undocumented) function isAPIError(reason: any): reason is APIError; // @public (undocumented) @@ -2375,6 +2450,22 @@ type MeDetailed = UserDetailed & { }; // @public (undocumented) +type MeDetailedWithSecret = MeDetailed & { + email: string; + emailVerified: boolean; + securityKeysList: { + id: string; + name: string; + lastUsed: string; + }[]; +}; + +// @public (undocumented) +type MeSignup = MeDetailedWithSecret & { + token: string; +}; + +// @public (undocumented) type MessagingMessage = { id: ID; createdAt: DateString; @@ -2719,7 +2810,7 @@ type UserSorting = '+follower' | '-follower' | '+createdAt' | '-createdAt' | '+u // // src/api.types.ts:16:32 - (ae-forgotten-export) The symbol "TODO" needs to be exported by the entry point index.d.ts // src/api.types.ts:18:25 - (ae-forgotten-export) The symbol "NoParams" needs to be exported by the entry point index.d.ts -// src/api.types.ts:596:18 - (ae-forgotten-export) The symbol "ShowUserReq" needs to be exported by the entry point index.d.ts +// src/api.types.ts:629:18 - (ae-forgotten-export) The symbol "ShowUserReq" needs to be exported by the entry point index.d.ts // src/streaming.types.ts:33:4 - (ae-forgotten-export) The symbol "FIXME" needs to be exported by the entry point index.d.ts // (No @packageDocumentation comment for this package) diff --git a/packages/misskey-js/package.json b/packages/misskey-js/package.json index 23836b05f5..c7e6dbd19c 100644 --- a/packages/misskey-js/package.json +++ b/packages/misskey-js/package.json @@ -1,6 +1,6 @@ { "name": "misskey-js", - "version": "0.0.15", + "version": "0.0.16", "description": "Misskey SDK for JavaScript", "main": "./built/index.js", "types": "./built/index.d.ts", @@ -20,26 +20,26 @@ "url": "git+https://github.com/misskey-dev/misskey.js.git" }, "devDependencies": { - "@microsoft/api-extractor": "7.34.7", + "@microsoft/api-extractor": "7.36.2", "@swc/jest": "0.2.26", - "@types/jest": "29.5.1", - "@types/node": "18.16.3", - "@typescript-eslint/eslint-plugin": "5.59.5", - "@typescript-eslint/parser": "5.59.5", - "eslint": "8.40.0", - "jest": "29.5.0", + "@types/jest": "29.5.3", + "@types/node": "20.4.2", + "@typescript-eslint/eslint-plugin": "5.61.0", + "@typescript-eslint/parser": "5.61.0", + "eslint": "8.45.0", + "jest": "29.6.1", "jest-fetch-mock": "3.0.3", "jest-websocket-mock": "2.4.0", "mock-socket": "9.2.1", "tsd": "0.28.1", - "typescript": "5.0.4" + "typescript": "5.1.6" }, "files": [ "built" ], "dependencies": { "@swc/cli": "0.1.62", - "@swc/core": "1.3.56", + "@swc/core": "1.3.69", "eventemitter3": "5.0.1", "reconnecting-websocket": "4.4.0" } diff --git a/packages/misskey-js/src/acct.ts b/packages/misskey-js/src/acct.ts index c32cee86c9..b25bc564ea 100644 --- a/packages/misskey-js/src/acct.ts +++ b/packages/misskey-js/src/acct.ts @@ -4,7 +4,7 @@ export type Acct = { }; export function parse(acct: string): Acct { - if (acct.startsWith('@')) acct = acct.substr(1); + if (acct.startsWith('@')) acct = acct.substring(1); const split = acct.split('@', 2); return { username: split[0], host: split[1] || null }; } diff --git a/packages/misskey-js/src/api.types.ts b/packages/misskey-js/src/api.types.ts index b8c59e7b15..343977f4be 100644 --- a/packages/misskey-js/src/api.types.ts +++ b/packages/misskey-js/src/api.types.ts @@ -2,7 +2,7 @@ import type { Ad, Announcement, Antenna, App, AuthSession, Blocking, Channel, Clip, DateString, DetailedInstanceMetadata, DriveFile, DriveFolder, Following, FollowingFolloweePopulated, FollowingFollowerPopulated, FollowRequest, GalleryPost, Instance, LiteInstanceMetadata, MeDetailed, - Note, NoteFavorite, OriginType, Page, ServerInfo, Stats, User, UserDetailed, UserGroup, UserList, UserSorting, Notification, NoteReaction, Signin, MessagingMessage, + Note, NoteFavorite, OriginType, Page, ServerInfo, Stats, User, UserDetailed, MeSignup, UserGroup, UserList, UserSorting, Notification, NoteReaction, Signin, MessagingMessage, Invite, InviteLimit, } from './entities.js'; type TODO = Record<string, any> | null; @@ -20,6 +20,7 @@ export type Endpoints = { 'admin/get-table-stats': { req: TODO; res: TODO; }; 'admin/invite': { req: TODO; res: TODO; }; 'admin/logs': { req: TODO; res: TODO; }; + 'admin/meta': { req: TODO; res: TODO; }; 'admin/reset-password': { req: TODO; res: TODO; }; 'admin/resolve-abuse-user-report': { req: TODO; res: TODO; }; 'admin/resync-chart': { req: TODO; res: TODO; }; @@ -57,6 +58,8 @@ export type Endpoints = { 'admin/federation/refresh-remote-instance-metadata': { req: TODO; res: TODO; }; 'admin/federation/remove-all-following': { req: TODO; res: TODO; }; 'admin/federation/update-instance': { req: TODO; res: TODO; }; + 'admin/invite/create': { req: TODO; res: TODO; }; + 'admin/invite/list': { req: TODO; res: TODO; }; 'admin/moderators/add': { req: TODO; res: TODO; }; 'admin/moderators/remove': { req: TODO; res: TODO; }; 'admin/promo/create': { req: TODO; res: TODO; }; @@ -262,7 +265,16 @@ export type Endpoints = { 'drive/files': { req: { folderId?: DriveFolder['id'] | null; type?: DriveFile['type'] | null; limit?: number; sinceId?: DriveFile['id']; untilId?: DriveFile['id']; }; res: DriveFile[]; }; 'drive/files/attached-notes': { req: TODO; res: TODO; }; 'drive/files/check-existence': { req: TODO; res: TODO; }; - 'drive/files/create': { req: TODO; res: TODO; }; + 'drive/files/create': { + req: { + folderId?: string, + name?: string, + comment?: string, + isSentisive?: boolean, + force?: boolean, + }; + res: DriveFile; + }; 'drive/files/delete': { req: { fileId: DriveFile['id']; }; res: null; }; 'drive/files/find-by-hash': { req: TODO; res: TODO; }; 'drive/files/find': { req: { name: string; folderId?: DriveFolder['id'] | null; }; res: DriveFile[]; }; @@ -431,6 +443,12 @@ export type Endpoints = { 'i/2fa/remove-key': { req: TODO; res: TODO; }; 'i/2fa/unregister': { req: TODO; res: TODO; }; + // invite + 'invite/create': { req: NoParams; res: Invite; }; + 'invite/delete': { req: { inviteId: Invite['id']; }; res: null; }; + 'invite/list': { req: { limit?: number; sinceId?: Invite['id']; untilId?: Invite['id'] }; res: Invite[]; }; + 'invite/limit': { req: NoParams; res: InviteLimit; }; + // messaging 'messaging/history': { req: { limit?: number; group?: boolean; }; res: MessagingMessage[]; }; 'messaging/messages': { req: { userId?: User['id']; groupId?: UserGroup['id']; limit?: number; sinceId?: MessagingMessage['id']; untilId?: MessagingMessage['id']; markAsRead?: boolean; }; res: MessagingMessage[]; }; @@ -549,6 +567,21 @@ export type Endpoints = { 'room/show': { req: TODO; res: TODO; }; 'room/update': { req: TODO; res: TODO; }; + // signup + 'signup': { + req: { + username: string; + password: string; + host?: string; + invitationCode?: string; + emailAddress?: string; + 'hcaptcha-response'?: string; + 'g-recaptcha-response'?: string; + 'turnstile-response'?: string; + }; + res: MeSignup | null; + }; + // stats 'stats': { req: NoParams; res: Stats; }; diff --git a/packages/misskey-js/src/entities.ts b/packages/misskey-js/src/entities.ts index 383b17f0b9..ea85bedf63 100644 --- a/packages/misskey-js/src/entities.ts +++ b/packages/misskey-js/src/entities.ts @@ -107,6 +107,20 @@ export type MeDetailed = UserDetailed & { [other: string]: any; }; +export type MeDetailedWithSecret = MeDetailed & { + email: string; + emailVerified: boolean; + securityKeysList: { + id: string; + name: string; + lastUsed: string; + }[]; +}; + +export type MeSignup = MeDetailedWithSecret & { + token: string; +}; + export type DriveFile = { id: ID; createdAt: DateString; @@ -324,6 +338,7 @@ export type DetailedInstanceMetadata = LiteInstanceMetadata & { pinnedPages: string[]; pinnedClipId: string | null; cacheRemoteFiles: boolean; + cacheRemoteSensitiveFiles: boolean; requireSetup: boolean; proxyAccountName: string | null; features: Record<string, any>; @@ -502,6 +517,21 @@ export type Signin = { success: boolean; }; +export type Invite = { + id: ID; + code: string; + expiresAt: DateString | null; + createdAt: DateString; + createdBy: UserLite | null; + usedBy: UserLite | null; + usedAt: DateString | null; + used: boolean; +} + +export type InviteLimit = { + remaining: number; +} + export type UserSorting = | '+follower' | '-follower' diff --git a/packages/misskey-js/src/streaming.ts b/packages/misskey-js/src/streaming.ts index 92a220b496..c641706a4b 100644 --- a/packages/misskey-js/src/streaming.ts +++ b/packages/misskey-js/src/streaming.ts @@ -218,7 +218,7 @@ class Pool { this.dec = this.dec.bind(this); this.connect = this.connect.bind(this); this.disconnect = this.disconnect.bind(this); - + this.channel = channel; this.stream = stream; this.id = id; diff --git a/packages/misskey-js/test-d/streaming.ts b/packages/misskey-js/test-d/streaming.ts index 7ff7f95999..853f376e6c 100644 --- a/packages/misskey-js/test-d/streaming.ts +++ b/packages/misskey-js/test-d/streaming.ts @@ -16,7 +16,7 @@ describe('Streaming', () => { // { // otherparty?: User['id'] | null; // group?: UserGroup['id'] | null; - // } + // } // になっている」というテストを行いたいけどtsdでの書き方がわからない const messagingChannel = stream.useChannel('messaging', { otherparty: 'aaa' }); messagingChannel.on('message', message => { diff --git a/packages/misskey-js/test/api.ts b/packages/misskey-js/test/api.ts index 84b1fc0933..6f9e656fef 100644 --- a/packages/misskey-js/test/api.ts +++ b/packages/misskey-js/test/api.ts @@ -137,7 +137,7 @@ describe('API', () => { origin: 'https://misskey.test', credential: 'TOKEN', }); - + await cli.request('i', {}, null); } catch (e) { expect(isAPIError(e)).toEqual(true); @@ -165,7 +165,7 @@ describe('API', () => { origin: 'https://misskey.test', credential: 'TOKEN', }); - + await cli.request('i'); } catch (e: any) { expect(isAPIError(e)).toEqual(true); @@ -182,7 +182,7 @@ describe('API', () => { origin: 'https://misskey.test', credential: 'TOKEN', }); - + await cli.request('i'); } catch (e) { expect(isAPIError(e)).toEqual(false); @@ -203,7 +203,7 @@ describe('API', () => { origin: 'https://misskey.test', credential: 'TOKEN', }); - + await cli.request('i'); } catch (e) { expect(isAPIError(e)).toEqual(false); diff --git a/packages/misskey-js/test/streaming.ts b/packages/misskey-js/test/streaming.ts index 913db8b287..9f6615a8d8 100644 --- a/packages/misskey-js/test/streaming.ts +++ b/packages/misskey-js/test/streaming.ts @@ -131,7 +131,7 @@ describe('Streaming', () => { main.on('meUpdated', payload => { mainChannelReceived.push(payload); }); - + const ws = await server.connected; expect(new URLSearchParams(new URL(ws.url).search).get('i')).toEqual('TOKEN'); diff --git a/packages/misskey-js/tsconfig.json b/packages/misskey-js/tsconfig.json index c679347fea..24e5af4c40 100644 --- a/packages/misskey-js/tsconfig.json +++ b/packages/misskey-js/tsconfig.json @@ -1,9 +1,9 @@ { "$schema": "http://json.schemastore.org/tsconfig", "compilerOptions": { - "target": "es2022", + "target": "ES2022", "module": "ES2020", - "moduleResolution": "node", + "moduleResolution": "node16", "declaration": true, "declarationMap": true, "sourceMap": true, |