modernize megalodon to target the same ES and TS standards as the rest of the app

This commit is contained in:
Hazelnoot 2025-10-05 23:55:32 -04:00
parent 169d35885c
commit 0861541b18
124 changed files with 2144 additions and 2463 deletions

View file

@ -3,7 +3,16 @@
* https://jestjs.io/docs/en/configuration.html * https://jestjs.io/docs/en/configuration.html
*/ */
module.exports = { // https://kulshekhar.github.io/ts-jest/docs/getting-started/presets#createdefaultesmpresetoptions
import { createDefaultEsmPreset, type JestConfigWithTsJest } from 'ts-jest';
const presetConfig = createDefaultEsmPreset({
tsconfig: '<rootDir>/tsconfig.json'
});
export default {
...presetConfig,
// All imported modules in your tests should be mocked automatically // All imported modules in your tests should be mocked automatically
// automock: false, // automock: false,
@ -20,7 +29,7 @@ module.exports = {
// collectCoverage: false, // collectCoverage: false,
// An array of glob patterns indicating a set of files for which coverage information should be collected // An array of glob patterns indicating a set of files for which coverage information should be collected
// collectCoverageFrom: undefined, 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",
@ -60,7 +69,8 @@ module.exports = {
// globalTeardown: undefined, // globalTeardown: undefined,
// A set of global variables that need to be available in all test environments // A set of global variables that need to be available in all test environments
// globals: {}, // globals: {
// },
// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers. // The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
// maxWorkers: "50%", // maxWorkers: "50%",
@ -79,6 +89,10 @@ module.exports = {
// "tsx", // "tsx",
// "node" // "node"
// ], // ],
moduleFileExtensions: [
"ts",
"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
moduleNameMapper: { moduleNameMapper: {
@ -103,7 +117,8 @@ module.exports = {
// notifyMode: "failure-change", // notifyMode: "failure-change",
// A preset that is used as a base for Jest's configuration // A preset that is used as a base for Jest's configuration
// preset: undefined, //preset: "ts-jest/presets/js-with-ts-esm",
// "preset": "ts-jest/presets/default",
// Run tests from one or more projects // Run tests from one or more projects
// projects: undefined, // projects: undefined,
@ -118,17 +133,17 @@ module.exports = {
// resetModules: false, // resetModules: false,
// A path to a custom resolver // A path to a custom resolver
// resolver: undefined, // resolver: './jest-resolver.cjs',
// Automatically restore mock state between every test // Automatically restore mock state between every test
// restoreMocks: false, restoreMocks: true,
// The root directory that Jest should scan for tests and modules within // The root directory that Jest should scan for tests and modules within
// rootDir: undefined, // rootDir: undefined,
// 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>" "<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
@ -157,9 +172,7 @@ module.exports = {
// The glob patterns Jest uses to detect test files // The glob patterns Jest uses to detect test files
testMatch: [ testMatch: [
"**/__tests__/**/*.[jt]s?(x)", "<rootDir>/test/**/*.spec.ts"
"**/?(*.)+(spec|test).[tj]s?(x)",
"<rootDir>/test/**/*"
], ],
// 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
@ -183,9 +196,14 @@ module.exports = {
// timers: "real", // timers: "real",
// A map from regular expressions to paths to transformers // A map from regular expressions to paths to transformers
transform: { // transform: {
"^.+\\.(t|j)sx?$": ["@swc/jest"], // "^.+\\.(ts|tsx)$": [
}, // "ts-jest",
// {
// "tsconfig": "tsconfig.json"
// }
// ]
// },
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
// transformIgnorePatterns: [ // transformIgnorePatterns: [
@ -204,4 +222,17 @@ module.exports = {
// Whether to use watchman for file crawling // Whether to use watchman for file crawling
// watchman: true, // watchman: true,
};
// extensionsToTreatAsEsm: ['.ts'],
// testTimeout: 60000,
// // Let Jest kill the test worker whenever it grows too much
// // (It seems there's a known memory leak issue in Node.js' vm.Script used by Jest)
// // https://github.com/facebook/jest/issues/11956
// maxWorkers: 1, // Make it use worker (that can be killed and restarted)
// logHeapUsage: true, // To debug when out-of-memory happens on CI
// workerIdleMemoryLimit: '1GiB', // Limit the worker to 1GB (GitHub Workflows dies at 2GB)
//
// maxConcurrency: 32,
} satisfies JestConfigWithTsJest;

View file

@ -1,12 +1,17 @@
{ {
"name": "megalodon", "name": "megalodon",
"type": "module",
"version": "7.0.1", "version": "7.0.1",
"private": true,
"description": "Mastodon API client for node.js and browser", "description": "Mastodon API client for node.js and browser",
"main": "./lib/src/index.js", "main": "./lib/src/index.js",
"typings": "./lib/src/index.d.ts", "typings": "./lib/src/index.d.ts",
"scripts": { "scripts": {
"build": "tsc -p ./", "build": "tsc -p tsconfig.json",
"test": "cross-env NODE_ENV=test jest -u --maxWorkers=3" "typecheck": "tsc -p tsconfig.json --noEmit",
"lint": "pnpm run typecheck",
"jest": "cross-env NODE_ENV=test node --no-experimental-require-module --experimental-vm-modules --experimental-import-meta-resolve node_modules/jest/bin/jest.js --coverage --detectOpenHandles",
"test": "pnpm run jest"
}, },
"engines": { "engines": {
"node": "^22.0.0" "node": "^22.0.0"
@ -28,42 +33,23 @@
"bugs": { "bugs": {
"url": "https://github.com/h3poteto/megalodon/issues" "url": "https://github.com/h3poteto/megalodon/issues"
}, },
"jest": {
"moduleFileExtensions": [
"ts",
"js"
],
"moduleNameMapper": {
"^@/(.+)": "<rootDir>/src/$1",
"^~/(.+)": "<rootDir>/$1"
},
"testMatch": [
"**/test/**/*.spec.ts"
],
"preset": "ts-jest/presets/default",
"transform": {
"^.+\\.(ts|tsx)$": [
"ts-jest",
{
"tsconfig": "tsconfig.json"
}
]
},
"testEnvironment": "node"
},
"homepage": "https://github.com/h3poteto/megalodon#readme", "homepage": "https://github.com/h3poteto/megalodon#readme",
"dependencies": { "dependencies": {
"axios": "1.12.2", "axios": "1.12.2",
"dayjs": "1.11.18", "dayjs": "1.11.18",
"form-data": "4.0.4", "form-data": "4.0.4",
"oauth": "0.10.2", "oauth": "0.10.2"
"typescript": "5.9.2"
}, },
"devDependencies": { "devDependencies": {
"@jest/globals": "30.1.2",
"@types/jest": "30.0.0", "@types/jest": "30.0.0",
"@types/node": "22.18.1",
"@types/oauth": "0.9.6", "@types/oauth": "0.9.6",
"jest": "30.1.3", "jest": "30.1.3",
"jest-mock": "30.0.5",
"jest-worker": "30.1.0", "jest-worker": "30.1.0",
"ts-jest": "29.4.4" "ts-jest": "29.4.4",
"ts-node": "10.9.2",
"typescript": "5.9.2"
} }
} }

View file

@ -1,3 +1,3 @@
import MisskeyAPI from "./misskey/api_client"; import * as MisskeyAPI from "./misskey/api_client.js";
export default MisskeyAPI.Converter; export default MisskeyAPI.Converter;

View file

@ -1,5 +1,5 @@
import axios, { AxiosRequestConfig } from 'axios' import axios, { type AxiosRequestConfig } from 'axios'
import { NodeinfoError } from './megalodon' import { NodeinfoError } from './megalodon.js'
const NODEINFO_10 = 'http://nodeinfo.diaspora.software/ns/schema/1.0' const NODEINFO_10 = 'http://nodeinfo.diaspora.software/ns/schema/1.0'
const NODEINFO_20 = 'http://nodeinfo.diaspora.software/ns/schema/2.0' const NODEINFO_20 = 'http://nodeinfo.diaspora.software/ns/schema/2.0'

View file

@ -1,36 +1,35 @@
/// <reference path="emoji.ts" /> import type { Emoji } from './emoji.js';
/// <reference path="source.ts" /> import type { Field } from './field.js';
/// <reference path="field.ts" /> import type { Source } from './source.js';
/// <reference path="role.ts" /> import type { Role } from './role.js';
namespace Entity {
export type Account = { export interface Account {
id: string id: string
fqn?: string fqn?: string
username: string username: string
acct: string acct: string
display_name: string display_name: string
locked: boolean locked: boolean
discoverable?: boolean discoverable?: boolean
group?: boolean | null group?: boolean | null
noindex?: boolean | null noindex?: boolean | null
suspended?: boolean | null suspended?: boolean | null
limited?: boolean | null limited?: boolean | null
created_at: string created_at: string
followers_count: number followers_count: number
following_count: number following_count: number
statuses_count: number statuses_count: number
note: string note: string
url: string url: string
avatar: string avatar: string
avatar_static: string avatar_static: string
header: string header: string
header_static: string header_static: string
emojis: Array<Emoji> emojis: Array<Emoji>
moved: Account | null moved: Account | null
fields: Array<Field> fields: Array<Field>
bot: boolean | null bot: boolean | null
source?: Source source?: Source
role?: Role role?: Role
mute_expires_at?: string mute_expires_at?: string
}
} }

View file

@ -1,8 +1,6 @@
namespace Entity { export interface Activity {
export type Activity = { week: string
week: string statuses: string
statuses: string logins: string
logins: string registrations: string
registrations: string
}
} }

View file

@ -1,40 +1,39 @@
/// <reference path="emoji.ts" /> import type { StatusTag } from './status.js';
import type { Emoji } from './emoji.js';
namespace Entity { export interface Announcement {
export type Announcement = { id: string
id: string content: string
content: string starts_at: string | null
starts_at: string | null ends_at: string | null
ends_at: string | null published: boolean
published: boolean all_day: boolean
all_day: boolean published_at: string
published_at: string updated_at: string | null
updated_at: string | null read: boolean | null
read: boolean | null mentions: Array<AnnouncementAccount>
mentions: Array<AnnouncementAccount> statuses: Array<AnnouncementStatus>
statuses: Array<AnnouncementStatus> tags: Array<StatusTag>
tags: Array<StatusTag> emojis: Array<Emoji>
emojis: Array<Emoji> reactions: Array<AnnouncementReaction>
reactions: Array<AnnouncementReaction> }
}
export interface AnnouncementAccount {
export type AnnouncementAccount = { id: string
id: string username: string
username: string url: string
url: string acct: string
acct: string }
}
export interface AnnouncementStatus {
export type AnnouncementStatus = { id: string
id: string url: string
url: string }
}
export interface AnnouncementReaction {
export type AnnouncementReaction = { name: string
name: string count: number
count: number me: boolean | null
me: boolean | null url: string | null
url: string | null static_url: string | null
static_url: string | null
}
} }

View file

@ -1,7 +1,5 @@
namespace Entity { export interface Application {
export type Application = { name: string
name: string website?: string | null
website?: string | null vapid_key?: string | null
vapid_key?: string | null
}
} }

View file

@ -1,14 +1,13 @@
/// <reference path="attachment.ts" /> import type { Meta } from './attachment.js';
namespace Entity {
export type AsyncAttachment = { export interface AsyncAttachment {
id: string id: string
type: 'unknown' | 'image' | 'gifv' | 'video' | 'audio' type: 'unknown' | 'image' | 'gifv' | 'video' | 'audio'
url: string | null url: string | null
remote_url: string | null remote_url: string | null
preview_url: string preview_url: string
text_url: string | null text_url: string | null
meta: Meta | null meta: Meta | null
description: string | null description: string | null
blurhash: string | null blurhash: string | null
}
} }

View file

@ -1,49 +1,47 @@
namespace Entity { export type Sub = {
export type Sub = { // For Image, Gifv, and Video
// For Image, Gifv, and Video width?: number
width?: number height?: number
height?: number size?: string
size?: string aspect?: number
aspect?: number
// For Gifv and Video // For Gifv and Video
frame_rate?: string frame_rate?: string
// For Audio, Gifv, and Video // For Audio, Gifv, and Video
duration?: number duration?: number
bitrate?: number bitrate?: number
} }
export type Focus = { export interface Focus {
x: number x: number
y: number y: number
} }
export type Meta = { export interface Meta {
original?: Sub original?: Sub
small?: Sub small?: Sub
focus?: Focus focus?: Focus
length?: string length?: string
duration?: number duration?: number
fps?: number fps?: number
size?: string size?: string
width?: number width?: number
height?: number height?: number
aspect?: number aspect?: number
audio_encode?: string audio_encode?: string
audio_bitrate?: string audio_bitrate?: string
audio_channel?: string audio_channel?: string
} }
export type Attachment = { export interface Attachment {
id: string id: string
type: 'unknown' | 'image' | 'gifv' | 'video' | 'audio' type: 'unknown' | 'image' | 'gifv' | 'video' | 'audio'
url: string url: string
remote_url: string | null remote_url: string | null
preview_url: string | null preview_url: string | null
text_url: string | null text_url: string | null
meta: Meta | null meta: Meta | null
description: string | null description: string | null
blurhash: string | null blurhash: string | null
}
} }

View file

@ -1,18 +1,16 @@
namespace Entity { export interface Card {
export type Card = { url: string
url: string title: string
title: string description: string
description: string type: 'link' | 'photo' | 'video' | 'rich'
type: 'link' | 'photo' | 'video' | 'rich' image: string | null
image: string | null author_name: string | null
author_name: string | null author_url: string | null
author_url: string | null provider_name: string | null
provider_name: string | null provider_url: string | null
provider_url: string | null html: string | null
html: string | null width: number | null
width: number | null height: number | null
height: number | null embed_url: string | null
embed_url: string | null blurhash: string | null
blurhash: string | null
}
} }

View file

@ -1,8 +1,6 @@
/// <reference path="status.ts" /> import type { Status } from './status.js';
namespace Entity { export interface Context {
export type Context = { ancestors: Array<Status>
ancestors: Array<Status> descendants: Array<Status>
descendants: Array<Status>
}
} }

View file

@ -1,11 +1,9 @@
/// <reference path="account.ts" /> import type { Account } from './account.js';
/// <reference path="status.ts" /> import type { Status } from './status.js';
namespace Entity { export interface Conversation {
export type Conversation = { id: string
id: string accounts: Array<Account>
accounts: Array<Account> last_status: Status | null
last_status: Status | null unread: boolean
unread: boolean
}
} }

View file

@ -1,9 +1,7 @@
namespace Entity { export interface Emoji {
export type Emoji = { shortcode: string
shortcode: string static_url: string
static_url: string url: string
url: string visible_in_picker: boolean
visible_in_picker: boolean category?: string
category?: string
}
} }

View file

@ -1,8 +1,6 @@
namespace Entity { export interface FeaturedTag {
export type FeaturedTag = { id: string
id: string name: string
name: string statuses_count: number
statuses_count: number last_status_at: string
last_status_at: string
}
} }

View file

@ -1,7 +1,5 @@
namespace Entity { export interface Field {
export type Field = { name: string
name: string value: string
value: string verified_at?: string | null
verified_at?: string | null
}
} }

View file

@ -1,12 +1,10 @@
namespace Entity { export interface Filter {
export type Filter = { id: string
id: string phrase: string
phrase: string context: Array<FilterContext>
context: Array<FilterContext> expires_at: string | null
expires_at: string | null irreversible: boolean
irreversible: boolean whole_word: boolean
whole_word: boolean
}
export type FilterContext = string
} }
export type FilterContext = string

View file

@ -1,27 +1,25 @@
/// <reference path="emoji.ts" /> import type { Emoji } from './emoji.js';
/// <reference path="field.ts" /> import type { Field } from './field.js';
namespace Entity { export interface FollowRequest {
export type FollowRequest = { id: number
id: number username: string
username: string acct: string
acct: string display_name: string
display_name: string locked: boolean
locked: boolean bot: boolean
bot: boolean discoverable?: boolean
discoverable?: boolean group: boolean
group: boolean created_at: string
created_at: string note: string
note: string url: string
url: string avatar: string
avatar: string avatar_static: string
avatar_static: string header: string
header: string header_static: string
header_static: string followers_count: number
followers_count: number following_count: number
following_count: number statuses_count: number
statuses_count: number emojis: Array<Emoji>
emojis: Array<Emoji> fields: Array<Field>
fields: Array<Field>
}
} }

View file

@ -1,7 +1,5 @@
namespace Entity { export interface History {
export type History = { day: string
day: string uses: number
uses: number accounts: number
accounts: number
}
} }

View file

@ -1,9 +1,7 @@
namespace Entity { export interface IdentityProof {
export type IdentityProof = { provider: string
provider: string provider_username: string
provider_username: string updated_at: string
updated_at: string proof_url: string
proof_url: string profile_url: string
profile_url: string
}
} }

View file

@ -1,40 +1,38 @@
/// <reference path="account.ts" /> import type { URLs } from './urls.js';
/// <reference path="urls.ts" /> import type { Stats } from './stats.js';
/// <reference path="stats.ts" /> import type { Account } from './account.js';
namespace Entity { export interface Instance {
export type Instance = { uri: string
uri: string title: string
title: string description: string
description: string email: string
email: string version: string
version: string thumbnail: string | null
thumbnail: string | null urls: URLs
urls: URLs stats: Stats
stats: Stats languages: Array<string>
languages: Array<string> registrations: boolean
registrations: boolean approval_required: boolean
approval_required: boolean invites_enabled?: boolean
invites_enabled?: boolean configuration: {
configuration: { statuses: {
statuses: { max_characters: number
max_characters: number max_media_attachments?: number
max_media_attachments?: number characters_reserved_per_url?: number
characters_reserved_per_url?: number }
} polls?: {
polls?: { max_options: number
max_options: number max_characters_per_option: number
max_characters_per_option: number min_expiration: number
min_expiration: number max_expiration: number
max_expiration: number }
} }
} contact_account?: Account
contact_account?: Account rules?: Array<InstanceRule>
rules?: Array<InstanceRule> }
}
export interface InstanceRule {
export type InstanceRule = { id: string
id: string text: string
text: string
}
} }

View file

@ -1,10 +1,8 @@
namespace Entity { export interface List {
export type List = { id: string
id: string title: string
title: string replies_policy?: RepliesPolicy | null
replies_policy?: RepliesPolicy | null exclusive?: RepliesPolicy | null
exclusive?: RepliesPolicy | null
}
export type RepliesPolicy = 'followed' | 'list' | 'none'
} }
export type RepliesPolicy = 'followed' | 'list' | 'none'

View file

@ -1,15 +1,13 @@
namespace Entity { export interface Marker {
export type Marker = { home?: {
home?: { last_read_id: string
last_read_id: string version: number
version: number updated_at: string
updated_at: string }
} notifications?: {
notifications?: { last_read_id: string
last_read_id: string version: number
version: number updated_at: string
updated_at: string unread_count?: number
unread_count?: number }
}
}
} }

View file

@ -1,8 +1,6 @@
namespace Entity { export interface Mention {
export type Mention = { id: string
id: string username: string
username: string url: string
url: string acct: string
acct: string
}
} }

View file

@ -1,16 +1,14 @@
/// <reference path="account.ts" /> import type { Account } from './account.js';
/// <reference path="status.ts" /> import type { Status } from './status.js';
namespace Entity { export interface Notification {
export type Notification = { account: Account
account: Account created_at: string
created_at: string id: string
id: string status?: Status
status?: Status emoji?: string
emoji?: string type: NotificationType
type: NotificationType target?: Account
target?: Account
}
export type NotificationType = string
} }
export type NotificationType = string

View file

@ -1,15 +1,13 @@
/// <reference path="poll_option.ts" /> import type { PollOption } from './poll_option.js';
namespace Entity { export interface Poll {
export type Poll = { id: string
id: string expires_at: string | null
expires_at: string | null expired: boolean
expired: boolean multiple: boolean
multiple: boolean votes_count: number
votes_count: number options: Array<PollOption>
options: Array<PollOption> voted: boolean
voted: boolean emojis?: []
emojis?: [] own_votes?: Array<number>
own_votes?: Array<number>
}
} }

View file

@ -1,6 +1,4 @@
namespace Entity { export interface PollOption {
export type PollOption = { title: string
title: string votes_count: number | null
votes_count: number | null
}
} }

View file

@ -1,9 +1,7 @@
namespace Entity { export interface Preferences {
export type Preferences = { 'posting:default:visibility': 'public' | 'unlisted' | 'private' | 'direct'
'posting:default:visibility': 'public' | 'unlisted' | 'private' | 'direct' 'posting:default:sensitive': boolean
'posting:default:sensitive': boolean 'posting:default:language': string | null
'posting:default:language': string | null 'reading:expand:media': 'default' | 'show_all' | 'hide_all'
'reading:expand:media': 'default' | 'show_all' | 'hide_all' 'reading:expand:spoilers': boolean
'reading:expand:spoilers': boolean
}
} }

View file

@ -1,16 +1,14 @@
namespace Entity { export interface Alerts {
export type Alerts = { follow: boolean
follow: boolean favourite: boolean
favourite: boolean mention: boolean
mention: boolean reblog: boolean
reblog: boolean poll: boolean
poll: boolean }
}
export interface PushSubscription {
export type PushSubscription = { id: string
id: string endpoint: string
endpoint: string server_key: string
server_key: string alerts: Alerts
alerts: Alerts
}
} }

View file

@ -1,12 +1,10 @@
/// <reference path="account.ts" /> import type { Account } from './account.js';
namespace Entity { export type Reaction = {
export type Reaction = { count: number
count: number me: boolean
me: boolean name: string
name: string accounts?: Array<Account>
accounts?: Array<Account> url?: string
url?: string static_url?: string
static_url?: string
}
} }

View file

@ -1,18 +1,16 @@
namespace Entity { export type Relationship = {
export type Relationship = { id: string
id: string following: boolean
following: boolean followed_by: boolean
followed_by: boolean blocking: boolean
blocking: boolean blocked_by: boolean
blocked_by: boolean muting: boolean
muting: boolean muting_notifications: boolean
muting_notifications: boolean requested: boolean
requested: boolean requested_by?: boolean
requested_by?: boolean domain_blocking: boolean
domain_blocking: boolean showing_reblogs: boolean
showing_reblogs: boolean endorsed: boolean
endorsed: boolean notifying: boolean
notifying: boolean note: string | null
note: string | null
}
} }

View file

@ -1,18 +1,16 @@
/// <reference path="account.ts" /> import type { Account } from './account.js';
namespace Entity { export interface Report {
export type Report = { id: string
id: string action_taken: boolean
action_taken: boolean action_taken_at: string | null
action_taken_at: string | null status_ids: Array<string> | null
status_ids: Array<string> | null rule_ids: Array<string> | null
rule_ids: Array<string> | null // These parameters don't exist in Pleroma
// These parameters don't exist in Pleroma category: Category | null
category: Category | null comment: string | null
comment: string | null forwarded: boolean | null
forwarded: boolean | null target_account?: Account | null
target_account?: Account | null
}
export type Category = 'spam' | 'violation' | 'other'
} }
export type Category = 'spam' | 'violation' | 'other'

View file

@ -1,11 +1,9 @@
/// <reference path="account.ts" /> import type { Account } from './account.js';
/// <reference path="status.ts" /> import type { Status } from './status.js';
/// <reference path="tag.ts" /> import type { Tag } from './tag.js';
namespace Entity { export interface Results {
export type Results = { accounts: Array<Account>
accounts: Array<Account> statuses: Array<Status>
statuses: Array<Status> hashtags: Array<Tag>
hashtags: Array<Tag>
}
} }

View file

@ -1,5 +1,3 @@
namespace Entity { export interface Role {
export type Role = { name: string
name: string
}
} }

View file

@ -1,10 +1,9 @@
/// <reference path="attachment.ts" /> import type { StatusParams } from './status_params.js';
/// <reference path="status_params.ts" /> import type { Attachment } from './attachment.js';
namespace Entity {
export type ScheduledStatus = { export interface ScheduledStatus {
id: string id: string
scheduled_at: string scheduled_at: string
params: StatusParams params: StatusParams
media_attachments: Array<Attachment> | null media_attachments: Array<Attachment> | null
}
} }

View file

@ -1,10 +1,9 @@
/// <reference path="field.ts" /> import type { Field } from './field.js';
namespace Entity {
export type Source = { export interface Source {
privacy: string | null privacy: string | null
sensitive: boolean | null sensitive: boolean | null
language: string | null language: string | null
note: string note: string
fields: Array<Field> fields: Array<Field>
}
} }

View file

@ -1,7 +1,5 @@
namespace Entity { export interface Stats {
export type Stats = { user_count: number
user_count: number status_count: number
status_count: number domain_count: number
domain_count: number
}
} }

View file

@ -1,50 +1,48 @@
/// <reference path="account.ts" /> import type { Emoji } from './emoji.js';
/// <reference path="application.ts" /> import type { Account } from './account.js';
/// <reference path="mention.ts" /> import type { Attachment } from './attachment.js';
/// <reference path="attachment.ts" /> import type { Mention } from './mention.js';
/// <reference path="emoji.ts" /> import type { Card } from './card.js';
/// <reference path="card.ts" /> import type { Poll } from './poll.js';
/// <reference path="poll.ts" /> import type { Application } from './application.js';
/// <reference path="reaction.ts" /> import type { Reaction } from './reaction.js';
namespace Entity { export interface Status {
export type Status = { id: string
id: string uri: string
uri: string url: string
url: string account: Account
account: Account in_reply_to_id: string | null
in_reply_to_id: string | null in_reply_to_account_id: string | null
in_reply_to_account_id: string | null reblog: Status | null
reblog: Status | null content: string
content: string plain_content?: string | null
plain_content?: string | null created_at: string
created_at: string edited_at: string | null
edited_at: string | null emojis: Emoji[]
emojis: Emoji[] replies_count: number
replies_count: number reblogs_count: number
reblogs_count: number favourites_count: number
favourites_count: number reblogged: boolean | null
reblogged: boolean | null favourited: boolean | null
favourited: boolean | null muted: boolean | null
muted: boolean | null sensitive: boolean
sensitive: boolean spoiler_text: string
spoiler_text: string visibility: 'public' | 'unlisted' | 'private' | 'direct'
visibility: 'public' | 'unlisted' | 'private' | 'direct' media_attachments: Array<Attachment>
media_attachments: Array<Attachment> mentions: Array<Mention>
mentions: Array<Mention> tags: Array<StatusTag>
tags: Array<StatusTag> card: Card | null
card: Card | null poll: Poll | null
poll: Poll | null application: Application | null
application: Application | null language: string | null
language: string | null pinned: boolean | null
pinned: boolean | null emoji_reactions: Array<Reaction>
emoji_reactions: Array<Reaction> quote: Status | boolean | null
quote: Status | boolean | null bookmarked: boolean
bookmarked: boolean }
}
export interface StatusTag {
export type StatusTag = { name: string
name: string url: string
url: string
}
} }

View file

@ -1,23 +1,16 @@
/// <reference path="account.ts" /> import type { Account } from './account.js';
/// <reference path="application.ts" /> import type { Emoji } from './emoji.js';
/// <reference path="mention.ts" /> import type { Attachment } from './attachment.js';
/// <reference path="tag.ts" /> import type { Poll } from './poll.js';
/// <reference path="attachment.ts" />
/// <reference path="emoji.ts" />
/// <reference path="card.ts" />
/// <reference path="poll.ts" />
/// <reference path="reaction.ts" />
namespace Entity { export interface StatusEdit {
export type StatusEdit = { account: Account;
account: Account; content: string;
content: string; plain_content: string | null;
plain_content: string | null; created_at: string;
created_at: string; emojis: Emoji[];
emojis: Emoji[]; sensitive: boolean;
sensitive: boolean; spoiler_text: string;
spoiler_text: string; media_attachments: Array<Attachment>;
media_attachments: Array<Attachment>; poll: Poll | null;
poll: Poll | null;
};
} }

View file

@ -1,12 +1,10 @@
namespace Entity { export interface StatusParams {
export type StatusParams = { text: string
text: string in_reply_to_id: string | null
in_reply_to_id: string | null media_ids: Array<string> | null
media_ids: Array<string> | null sensitive: boolean | null
sensitive: boolean | null spoiler_text: string | null
spoiler_text: string | null visibility: 'public' | 'unlisted' | 'private' | 'direct' | null
visibility: 'public' | 'unlisted' | 'private' | 'direct' | null scheduled_at: string | null
scheduled_at: string | null application_id: number | null
application_id: number | null
}
} }

View file

@ -1,7 +1,5 @@
namespace Entity { export interface StatusSource {
export type StatusSource = { id: string
id: string text: string
text: string spoiler_text: string
spoiler_text: string
}
} }

View file

@ -1,10 +1,8 @@
/// <reference path="history.ts" /> import type { History } from './history.js';
namespace Entity { export interface Tag {
export type Tag = { name: string
name: string url: string
url: string history: Array<History>
history: Array<History> following?: boolean
following?: boolean
}
} }

View file

@ -1,8 +1,6 @@
namespace Entity { export interface Token {
export type Token = { access_token: string
access_token: string token_type: string
token_type: string scope: string
scope: string created_at: number
created_at: number
}
} }

View file

@ -1,5 +1,3 @@
namespace Entity { export interface URLs {
export type URLs = { streaming_api: string
streaming_api: string
}
} }

View file

@ -1,40 +1,40 @@
/// <reference path="./entities/account.ts" /> export type * from './entities/account.js';
/// <reference path="./entities/activity.ts" /> export type * from './entities/activity.js';
/// <reference path="./entities/announcement.ts" /> export type * from './entities/announcement.js';
/// <reference path="./entities/application.ts" /> export type * from './entities/application.js';
/// <reference path="./entities/async_attachment.ts" /> export type * from './entities/async_attachment.js';
/// <reference path="./entities/attachment.ts" /> export type * from './entities/attachment.js';
/// <reference path="./entities/card.ts" /> export type * from './entities/card.js';
/// <reference path="./entities/context.ts" /> export type * from './entities/context.js';
/// <reference path="./entities/conversation.ts" /> export type * from './entities/conversation.js';
/// <reference path="./entities/emoji.ts" /> export type * from './entities/emoji.js';
/// <reference path="./entities/featured_tag.ts" /> export type * from './entities/featured_tag.js';
/// <reference path="./entities/field.ts" /> export type * from './entities/field.js';
/// <reference path="./entities/filter.ts" /> export type * from './entities/filter.js';
/// <reference path="./entities/follow_request.ts" /> export type * from './entities/follow_request.js';
/// <reference path="./entities/history.ts" /> export type * from './entities/history.js';
/// <reference path="./entities/identity_proof.ts" /> export type * from './entities/identity_proof.js';
/// <reference path="./entities/instance.ts" /> export type * from './entities/instance.js';
/// <reference path="./entities/list.ts" /> export type * from './entities/list.js';
/// <reference path="./entities/marker.ts" /> export type * from './entities/marker.js';
/// <reference path="./entities/mention.ts" /> export type * from './entities/mention.js';
/// <reference path="./entities/notification.ts" /> export type * from './entities/notification.js';
/// <reference path="./entities/poll.ts" /> export type * from './entities/poll.js';
/// <reference path="./entities/poll_option.ts" /> export type * from './entities/poll_option.js';
/// <reference path="./entities/preferences.ts" /> export type * from './entities/preferences.js';
/// <reference path="./entities/push_subscription.ts" /> export type * from './entities/push_subscription.js';
/// <reference path="./entities/reaction.ts" /> export type * from './entities/reaction.js';
/// <reference path="./entities/relationship.ts" /> export type * from './entities/relationship.js';
/// <reference path="./entities/report.ts" /> export type * from './entities/report.js';
/// <reference path="./entities/results.ts" /> export type * from './entities/results.js';
/// <reference path="./entities/scheduled_status.ts" /> export type * from './entities/role.js';
/// <reference path="./entities/source.ts" /> export type * from './entities/scheduled_status.js';
/// <reference path="./entities/stats.ts" /> export type * from './entities/source.js';
/// <reference path="./entities/status.ts" /> export type * from './entities/stats.js';
/// <reference path="./entities/status_params.ts" /> export type * from './entities/status.js';
/// <reference path="./entities/status_source.ts" /> export type * from './entities/status_edit.js';
/// <reference path="./entities/tag.ts" /> export type * from './entities/status_params.js';
/// <reference path="./entities/token.ts" /> export type * from './entities/status_source.js';
/// <reference path="./entities/urls.ts" /> export type * from './entities/tag.js';
export type * from './entities/token.js';
export default Entity export type * from './entities/urls.js';

View file

@ -1,11 +1,7 @@
import Entity from './entity' import type * as Entity from './entity.js'
namespace FilterContext { export const Home: Entity.FilterContext = 'home'
export const Home: Entity.FilterContext = 'home' export const Notifications: Entity.FilterContext = 'notifications'
export const Notifications: Entity.FilterContext = 'notifications' export const Public: Entity.FilterContext = 'public'
export const Public: Entity.FilterContext = 'public' export const Thread: Entity.FilterContext = 'thread'
export const Thread: Entity.FilterContext = 'thread' export const Account: Entity.FilterContext = 'account'
export const Account: Entity.FilterContext = 'account'
}
export default FilterContext

View file

@ -1,15 +1,15 @@
import Response from './response' import { type Response } from './response.js'
import OAuth from './oauth' import * as OAuth from './oauth.js'
import { isCancel, RequestCanceledError } from './cancel' import { isCancel, RequestCanceledError } from './cancel.js'
import { MegalodonInterface } from './megalodon' import { type MegalodonInterface } from './megalodon.js'
import { detector } from './detector' import { detector } from './detector.js'
import Misskey from './misskey' import Misskey from './misskey.js'
import Entity from './entity' import * as Entity from './entity.js'
import * as NotificationType from './notification' import * as NotificationType from './notification.js'
import FilterContext from './filter_context' import * as FilterContext from './filter_context.js'
import Converter from './converter' import Converter from './converter.js'
import MastodonEntity from './mastodon/entity'; import * as MastodonEntity from './mastodon/entity.js';
import MisskeyEntity from './misskey/entity'; import * as MisskeyEntity from './misskey/entity.js';
export { export {
type Response, type Response,

View file

@ -1,35 +1,34 @@
/// <reference path="emoji.ts" /> import type { Emoji } from './emoji.js';
/// <reference path="source.ts" /> import type { Field } from './field.js';
/// <reference path="field.ts" /> import type { Source } from './source.js';
/// <reference path="role.ts" /> import type { Role } from './role.js';
namespace MastodonEntity {
export type Account = { export interface Account {
id: string id: string
username: string username: string
acct: string acct: string
display_name: string display_name: string
locked: boolean locked: boolean
discoverable?: boolean discoverable?: boolean
group: boolean | null group: boolean | null
noindex: boolean | null noindex: boolean | null
suspended: boolean | null suspended: boolean | null
limited: boolean | null limited: boolean | null
created_at: string created_at: string
followers_count: number followers_count: number
following_count: number following_count: number
statuses_count: number statuses_count: number
note: string note: string
url: string url: string
avatar: string avatar: string
avatar_static: string avatar_static: string
header: string header: string
header_static: string header_static: string
emojis: Array<Emoji> emojis: Array<Emoji>
moved: Account | null moved: Account | null
fields: Array<Field> fields: Array<Field>
bot: boolean bot: boolean
source?: Source source?: Source
role?: Role role?: Role
mute_expires_at?: string mute_expires_at?: string
}
} }

View file

@ -1,8 +1,6 @@
namespace MastodonEntity { export interface Activity {
export type Activity = { week: string
week: string statuses: string
statuses: string logins: string
logins: string registrations: string
registrations: string
}
} }

View file

@ -1,40 +1,39 @@
/// <reference path="emoji.ts" /> import type { Emoji } from './emoji.js';
import type { StatusTag } from './status.js';
namespace MastodonEntity { export interface Announcement {
export type Announcement = { id: string
id: string content: string
content: string starts_at: string | null
starts_at: string | null ends_at: string | null
ends_at: string | null published: boolean
published: boolean all_day: boolean
all_day: boolean published_at: string
published_at: string updated_at: string
updated_at: string read: boolean | null
read: boolean | null mentions: Array<AnnouncementAccount>
mentions: Array<AnnouncementAccount> statuses: Array<AnnouncementStatus>
statuses: Array<AnnouncementStatus> tags: Array<StatusTag>
tags: Array<StatusTag> emojis: Array<Emoji>
emojis: Array<Emoji> reactions: Array<AnnouncementReaction>
reactions: Array<AnnouncementReaction> }
}
export interface AnnouncementAccount {
export type AnnouncementAccount = { id: string
id: string username: string
username: string url: string
url: string acct: string
acct: string }
}
export interface AnnouncementStatus {
export type AnnouncementStatus = { id: string
id: string url: string
url: string }
}
export interface AnnouncementReaction {
export type AnnouncementReaction = { name: string
name: string count: number
count: number me: boolean | null
me: boolean | null url: string | null
url: string | null static_url: string | null
static_url: string | null
}
} }

View file

@ -1,10 +1,8 @@
namespace MastodonEntity { export interface Application {
export type Application = { name: string
name: string website?: string | null
website?: string | null vapid_key?: string | null
vapid_key?: string | null scopes: string[]
scopes: string[] redirect_uris: string[]
redirect_uris: string[] redirect_uri?: string
redirect_uri?: string
}
} }

View file

@ -1,14 +1,13 @@
/// <reference path="attachment.ts" /> import type { Meta } from './attachment.js';
namespace MastodonEntity {
export type AsyncAttachment = { export interface AsyncAttachment {
id: string id: string
type: 'unknown' | 'image' | 'gifv' | 'video' | 'audio' type: 'unknown' | 'image' | 'gifv' | 'video' | 'audio'
url: string | null url: string | null
remote_url: string | null remote_url: string | null
preview_url: string preview_url: string
text_url: string | null text_url: string | null
meta: Meta | null meta: Meta | null
description: string | null description: string | null
blurhash: string | null blurhash: string | null
}
} }

View file

@ -1,49 +1,47 @@
namespace MastodonEntity { export type Sub = {
export type Sub = { // For Image, Gifv, and Video
// For Image, Gifv, and Video width?: number
width?: number height?: number
height?: number size?: string
size?: string aspect?: number
aspect?: number
// For Gifv and Video // For Gifv and Video
frame_rate?: string frame_rate?: string
// For Audio, Gifv, and Video // For Audio, Gifv, and Video
duration?: number duration?: number
bitrate?: number bitrate?: number
} }
export type Focus = { export interface Focus {
x: number x: number
y: number y: number
} }
export type Meta = { export interface Meta {
original?: Sub original?: Sub
small?: Sub small?: Sub
focus?: Focus focus?: Focus
length?: string length?: string
duration?: number duration?: number
fps?: number fps?: number
size?: string size?: string
width?: number width?: number
height?: number height?: number
aspect?: number aspect?: number
audio_encode?: string audio_encode?: string
audio_bitrate?: string audio_bitrate?: string
audio_channel?: string audio_channel?: string
} }
export type Attachment = { export interface Attachment {
id: string id: string
type: 'unknown' | 'image' | 'gifv' | 'video' | 'audio' type: 'unknown' | 'image' | 'gifv' | 'video' | 'audio'
url: string url: string
remote_url: string | null remote_url: string | null
preview_url: string | null preview_url: string | null
text_url: string | null text_url: string | null
meta: Meta | null meta: Meta | null
description: string | null description: string | null
blurhash: string | null blurhash: string | null
}
} }

View file

@ -1,18 +1,16 @@
namespace MastodonEntity { export interface Card {
export type Card = { url: string
url: string title: string
title: string description: string
description: string type: 'link' | 'photo' | 'video' | 'rich'
type: 'link' | 'photo' | 'video' | 'rich' image: string | null
image: string | null author_name: string
author_name: string author_url: string
author_url: string provider_name: string
provider_name: string provider_url: string
provider_url: string html: string
html: string width: number
width: number height: number
height: number embed_url: string
embed_url: string blurhash: string | null
blurhash: string | null
}
} }

View file

@ -1,8 +1,6 @@
/// <reference path="status.ts" /> import type { Status } from './status.js';
namespace MastodonEntity { export interface Context {
export type Context = { ancestors: Array<Status>
ancestors: Array<Status> descendants: Array<Status>
descendants: Array<Status>
}
} }

View file

@ -1,11 +1,9 @@
/// <reference path="account.ts" /> import type { Account } from './account.js';
/// <reference path="status.ts" /> import type { Status } from './status.js';
namespace MastodonEntity { export interface Conversation {
export type Conversation = { id: string
id: string accounts: Array<Account>
accounts: Array<Account> last_status: Status | null
last_status: Status | null unread: boolean
unread: boolean
}
} }

View file

@ -1,9 +1,7 @@
namespace MastodonEntity { export interface Emoji {
export type Emoji = { shortcode: string
shortcode: string static_url: string
static_url: string url: string
url: string visible_in_picker: boolean
visible_in_picker: boolean category?: string
category?: string
}
} }

View file

@ -1,8 +1,6 @@
namespace MastodonEntity { export interface FeaturedTag {
export type FeaturedTag = { id: string
id: string name: string
name: string statuses_count: number
statuses_count: number last_status_at: string
last_status_at: string
}
} }

View file

@ -1,7 +1,5 @@
namespace MastodonEntity { export interface Field {
export type Field = { name: string
name: string value: string
value: string verified_at: string | null
verified_at: string | null
}
} }

View file

@ -1,12 +1,10 @@
namespace MastodonEntity { export interface Filter {
export type Filter = { id: string
id: string phrase: string
phrase: string context: Array<FilterContext>
context: Array<FilterContext> expires_at: string | null
expires_at: string | null irreversible: boolean
irreversible: boolean whole_word: boolean
whole_word: boolean
}
export type FilterContext = string
} }
export type FilterContext = string

View file

@ -1,7 +1,5 @@
namespace MastodonEntity { export interface History {
export type History = { day: string
day: string uses: number
uses: number accounts: number
accounts: number
}
} }

View file

@ -1,9 +1,7 @@
namespace MastodonEntity { export interface IdentityProof {
export type IdentityProof = { provider: string
provider: string provider_username: string
provider_username: string updated_at: string
updated_at: string proof_url: string
proof_url: string profile_url: string
profile_url: string
}
} }

View file

@ -1,56 +1,54 @@
/// <reference path="account.ts" /> import type { Account } from './account.js';
/// <reference path="urls.ts" /> import type { URLs } from './urls.js';
/// <reference path="stats.ts" /> import type { Stats } from './stats.js';
namespace MastodonEntity { export type Instance = {
export type Instance = { uri: string
uri: string title: string
title: string description: string
description: string email: string
email: string version: string
version: string thumbnail: string | null
thumbnail: string | null urls: URLs
urls: URLs stats: Stats
stats: Stats languages: Array<string>
languages: Array<string> registrations: boolean
registrations: boolean approval_required: boolean
approval_required: boolean invites_enabled: boolean
invites_enabled: boolean max_toot_chars?: number
max_toot_chars?: number configuration: {
configuration: { statuses: {
statuses: { max_characters: number
max_characters: number max_media_attachments: number
max_media_attachments: number characters_reserved_per_url: number
characters_reserved_per_url: number }
} media_attachments: {
media_attachments: { supported_mime_types: Array<string>
supported_mime_types: Array<string> image_size_limit: number
image_size_limit: number image_matrix_limit: number
image_matrix_limit: number video_size_limit: number
video_size_limit: number video_frame_limit: number
video_frame_limit: number video_matrix_limit: number
video_matrix_limit: number }
} polls: {
polls: { max_options: number
max_options: number max_characters_per_option: number
max_characters_per_option: number min_expiration: number
min_expiration: number max_expiration: number
max_expiration: number }
} accounts: {
accounts: { max_featured_tags: number;
max_featured_tags: number; max_pinned_statuses: number;
max_pinned_statuses: number; }
} reactions: {
reactions: { max_reactions: number,
max_reactions: number, }
} }
} contact_account: Account | null
contact_account: Account | null rules: Array<InstanceRule>
rules: Array<InstanceRule> }
}
export interface InstanceRule {
export type InstanceRule = { id: string
id: string text: string
text: string
}
} }

View file

@ -1,9 +1,7 @@
namespace MastodonEntity { export interface List {
export type List = { id: string
id: string title: string
title: string replies_policy: RepliesPolicy
replies_policy: RepliesPolicy
}
export type RepliesPolicy = 'followed' | 'list' | 'none'
} }
export type RepliesPolicy = 'followed' | 'list' | 'none'

View file

@ -1,14 +1,12 @@
namespace MastodonEntity { export interface Marker {
export type Marker = { home: {
home: { last_read_id: string
last_read_id: string version: number
version: number updated_at: string
updated_at: string }
} notifications: {
notifications: { last_read_id: string
last_read_id: string version: number
version: number updated_at: string
updated_at: string }
}
}
} }

View file

@ -1,8 +1,6 @@
namespace MastodonEntity { export interface Mention {
export type Mention = { id: string
id: string username: string
username: string url: string
url: string acct: string
acct: string
}
} }

View file

@ -1,14 +1,12 @@
/// <reference path="account.ts" /> import type { Account } from './account.js';
/// <reference path="status.ts" /> import type { Status } from './status.js';
namespace MastodonEntity { export interface Notification {
export type Notification = { account: Account
account: Account created_at: string
created_at: string id: string
id: string status?: Status
status?: Status type: NotificationType
type: NotificationType
}
export type NotificationType = string
} }
export type NotificationType = string

View file

@ -1,13 +1,11 @@
/// <reference path="poll_option.ts" /> import type { PollOption } from './poll_option.js';
namespace MastodonEntity { export interface Poll {
export type Poll = { id: string
id: string expires_at: string | null
expires_at: string | null expired: boolean
expired: boolean multiple: boolean
multiple: boolean votes_count: number
votes_count: number options: Array<PollOption>
options: Array<PollOption> voted: boolean
voted: boolean
}
} }

View file

@ -1,6 +1,4 @@
namespace MastodonEntity { export interface PollOption {
export type PollOption = { title: string
title: string votes_count: number | null
votes_count: number | null
}
} }

View file

@ -1,9 +1,7 @@
namespace MastodonEntity { export interface Preferences {
export type Preferences = { 'posting:default:visibility': 'public' | 'unlisted' | 'private' | 'direct'
'posting:default:visibility': 'public' | 'unlisted' | 'private' | 'direct' 'posting:default:sensitive': boolean
'posting:default:sensitive': boolean 'posting:default:language': string | null
'posting:default:language': string | null 'reading:expand:media': 'default' | 'show_all' | 'hide_all'
'reading:expand:media': 'default' | 'show_all' | 'hide_all' 'reading:expand:spoilers': boolean
'reading:expand:spoilers': boolean
}
} }

View file

@ -1,16 +1,14 @@
namespace MastodonEntity { export interface Alerts {
export type Alerts = { follow: boolean
follow: boolean favourite: boolean
favourite: boolean mention: boolean
mention: boolean reblog: boolean
reblog: boolean poll: boolean
poll: boolean }
}
export interface PushSubscription {
export type PushSubscription = { id: string
id: string endpoint: string
endpoint: string server_key: string
server_key: string alerts: Alerts
alerts: Alerts
}
} }

View file

@ -1,16 +1,7 @@
/* export interface Reaction {
* SPDX-FileCopyrightText: hazelnoot and other Sharkey contributors name: string
* SPDX-License-Identifier: AGPL-3.0-only count: number
*/ me?: boolean
url?: string
/// <reference path="account.ts" /> static_url?: string
namespace MastodonEntity {
export type Reaction = {
name: string
count: number
me?: boolean
url?: string
static_url?: string
}
} }

View file

@ -1,19 +1,17 @@
namespace MastodonEntity { export interface Relationship {
export type Relationship = { id: string
id: string following: boolean
following: boolean followed_by: boolean
followed_by: boolean blocking: boolean
blocking: boolean blocked_by: boolean
blocked_by: boolean muting: boolean
muting: boolean muting_notifications: boolean
muting_notifications: boolean requested: boolean
requested: boolean requested_by: boolean
requested_by: boolean domain_blocking: boolean
domain_blocking: boolean showing_reblogs: boolean
showing_reblogs: boolean endorsed: boolean
endorsed: boolean notifying: boolean
notifying: boolean note: string
note: string languages: Array<string>
languages: Array<string>
}
} }

View file

@ -1,17 +1,15 @@
/// <reference path="account.ts" /> import type { Account } from './account.js';
namespace MastodonEntity { export interface Report {
export type Report = { id: string
id: string action_taken: boolean
action_taken: boolean action_taken_at: string | null
action_taken_at: string | null category: Category
category: Category comment: string
comment: string forwarded: boolean
forwarded: boolean status_ids: Array<string> | null
status_ids: Array<string> | null rule_ids: Array<string> | null
rule_ids: Array<string> | null target_account: Account
target_account: Account
}
export type Category = 'spam' | 'violation' | 'other'
} }
export type Category = 'spam' | 'violation' | 'other'

View file

@ -1,11 +1,9 @@
/// <reference path="account.ts" /> import type { Account } from './account.js';
/// <reference path="status.ts" /> import type { Status } from './status.js';
/// <reference path="tag.ts" /> import type { Tag } from './tag.js';
namespace MastodonEntity { export interface Results {
export type Results = { accounts: Array<Account>
accounts: Array<Account> statuses: Array<Status>
statuses: Array<Status> hashtags: Array<Tag>
hashtags: Array<Tag>
}
} }

View file

@ -1,5 +1,3 @@
namespace MastodonEntity { export interface Role {
export type Role = { name: string
name: string
}
} }

View file

@ -1,10 +1,9 @@
/// <reference path="attachment.ts" /> import type { StatusParams } from './status_params.js';
/// <reference path="status_params.ts" /> import type { Attachment } from './attachment.js';
namespace MastodonEntity {
export type ScheduledStatus = { export interface ScheduledStatus {
id: string id: string
scheduled_at: string scheduled_at: string
params: StatusParams params: StatusParams
media_attachments: Array<Attachment> media_attachments: Array<Attachment>
}
} }

View file

@ -1,10 +1,9 @@
/// <reference path="field.ts" /> import type { Field } from './field.js';
namespace MastodonEntity {
export type Source = { export interface Source {
privacy: string | null privacy: string | null
sensitive: boolean | null sensitive: boolean | null
language: string | null language: string | null
note: string note: string
fields: Array<Field> fields: Array<Field>
}
} }

View file

@ -1,7 +1,5 @@
namespace MastodonEntity { export interface Stats {
export type Stats = { user_count: number
user_count: number status_count: number
status_count: number domain_count: number
domain_count: number
}
} }

View file

@ -1,53 +1,50 @@
/// <reference path="account.ts" /> import type { Attachment } from './attachment.js';
/// <reference path="application.ts" /> import type { Mention } from './mention.js';
/// <reference path="mention.ts" /> import type { Card } from './card.js';
/// <reference path="tag.ts" /> import type { Poll } from './poll.js';
/// <reference path="attachment.ts" /> import type { Application } from './application.js';
/// <reference path="emoji.ts" /> import type { Reaction } from './reaction.js';
/// <reference path="card.ts" /> import type { Account } from './account.js';
/// <reference path="poll.ts" /> import type { Emoji } from './emoji.js';
/// <reference path="reaction.ts" />
namespace MastodonEntity { export interface Status {
export type Status = { id: string
id: string uri: string
uri: string url: string
url: string account: Account
account: Account in_reply_to_id: string | null
in_reply_to_id: string | null in_reply_to_account_id: string | null
in_reply_to_account_id: string | null reblog: Status | null
reblog: Status | null content: string
content: string created_at: string
created_at: string edited_at?: string | null
edited_at?: string | null emojis: Emoji[]
emojis: Emoji[] replies_count: number
replies_count: number reblogs_count: number
reblogs_count: number favourites_count: number
favourites_count: number reblogged: boolean | null
reblogged: boolean | null favourited: boolean | null
favourited: boolean | null muted: boolean | null
muted: boolean | null sensitive: boolean
sensitive: boolean spoiler_text: string
spoiler_text: string visibility: 'public' | 'unlisted' | 'private' | 'direct'
visibility: 'public' | 'unlisted' | 'private' | 'direct' media_attachments: Array<Attachment>
media_attachments: Array<Attachment> mentions: Array<Mention>
mentions: Array<Mention> tags: Array<StatusTag>
tags: Array<StatusTag> card: Card | null
card: Card | null poll: Poll | null
poll: Poll | null application: Application | null
application: Application | null language: string | null
language: string | null pinned: boolean | null
pinned: boolean | null bookmarked?: boolean
bookmarked?: boolean // These parameters are unique parameters in fedibird.com for quote.
// These parameters are unique parameters in fedibird.com for quote. quote_id?: string
quote_id?: string quote?: Status | null
quote?: Status | null // These parameters are unique to glitch-soc for emoji reactions.
// These parameters are unique to glitch-soc for emoji reactions. reactions?: Reaction[]
reactions?: Reaction[] }
}
export interface StatusTag {
export type StatusTag = { name: string
name: string url: string
url: string
}
} }

View file

@ -1,12 +1,10 @@
namespace MastodonEntity { export interface StatusParams {
export type StatusParams = { text: string
text: string in_reply_to_id: string | null
in_reply_to_id: string | null media_ids: Array<string> | null
media_ids: Array<string> | null sensitive: boolean | null
sensitive: boolean | null spoiler_text: string | null
spoiler_text: string | null visibility: 'public' | 'unlisted' | 'private' | 'direct' | null
visibility: 'public' | 'unlisted' | 'private' | 'direct' | null scheduled_at: string | null
scheduled_at: string | null application_id: number
application_id: number
}
} }

View file

@ -1,7 +1,5 @@
namespace MastodonEntity { export interface StatusSource {
export type StatusSource = { id: string
id: string text: string
text: string spoiler_text: string
spoiler_text: string
}
} }

View file

@ -1,10 +1,8 @@
/// <reference path="history.ts" /> import type { History } from './history.js';
namespace MastodonEntity { export interface Tag {
export type Tag = { name: string
name: string url: string
url: string history: Array<History>
history: Array<History> following?: boolean
following?: boolean
}
} }

View file

@ -1,8 +1,6 @@
namespace MastodonEntity { export interface Token {
export type Token = { access_token: string
access_token: string token_type: string
token_type: string scope: string
scope: string created_at: number
created_at: number
}
} }

View file

@ -1,5 +1,3 @@
namespace MastodonEntity { export interface URLs {
export type URLs = { streaming_api: string
streaming_api: string
}
} }

View file

@ -1,40 +1,37 @@
/// <reference path="./entities/account.ts" /> export type * from './entities/account.js';
/// <reference path="./entities/activity.ts" /> export type * from './entities/activity.js';
/// <reference path="./entities/announcement.ts" /> export type * from './entities/announcement.js';
/// <reference path="./entities/application.ts" /> export type * from './entities/application.js';
/// <reference path="./entities/async_attachment.ts" /> export type * from './entities/async_attachment.js';
/// <reference path="./entities/attachment.ts" /> export type * from './entities/attachment.js';
/// <reference path="./entities/card.ts" /> export type * from './entities/card.js';
/// <reference path="./entities/context.ts" /> export type * from './entities/context.js';
/// <reference path="./entities/conversation.ts" /> export type * from './entities/conversation.js';
/// <reference path="./entities/emoji.ts" /> export type * from './entities/emoji.js';
/// <reference path="./entities/featured_tag.ts" /> export type * from './entities/featured_tag.js';
/// <reference path="./entities/field.ts" /> export type * from './entities/field.js';
/// <reference path="./entities/filter.ts" /> export type * from './entities/filter.js';
/// <reference path="./entities/history.ts" /> export type * from './entities/history.js';
/// <reference path="./entities/identity_proof.ts" /> export type * from './entities/identity_proof.js';
/// <reference path="./entities/instance.ts" /> export type * from './entities/instance.js';
/// <reference path="./entities/list.ts" /> export type * from './entities/list.js';
/// <reference path="./entities/marker.ts" /> export type * from './entities/marker.js';
/// <reference path="./entities/mention.ts" /> export type * from './entities/mention.js';
/// <reference path="./entities/notification.ts" /> export type * from './entities/notification.js';
/// <reference path="./entities/poll.ts" /> export type * from './entities/poll.js';
/// <reference path="./entities/poll_option.ts" /> export type * from './entities/poll_option.js';
/// <reference path="./entities/preferences.ts" /> export type * from './entities/preferences.js';
/// <reference path="./entities/push_subscription.ts" /> export type * from './entities/push_subscription.js';
/// <reference path="./entities/reaction.ts" /> export type * from './entities/reaction.js';
/// <reference path="./entities/relationship.ts" /> export type * from './entities/relationship.js';
/// <reference path="./entities/report.ts" /> export type * from './entities/report.js';
/// <reference path="./entities/results.ts" /> export type * from './entities/results.js';
/// <reference path="./entities/role.ts" /> export type * from './entities/role.js';
/// <reference path="./entities/scheduled_status.ts" /> export type * from './entities/scheduled_status.js';
/// <reference path="./entities/source.ts" /> export type * from './entities/source.js';
/// <reference path="./entities/stats.ts" /> export type * from './entities/stats.js';
/// <reference path="./entities/status.ts" /> export type * from './entities/status.js';
/// <reference path="./entities/status_params.ts" /> export type * from './entities/status_params.js';
/// <reference path="./entities/status_source.ts" /> export type * from './entities/tag.js';
/// <reference path="./entities/tag.ts" /> export type * from './entities/token.js';
/// <reference path="./entities/token.ts" /> export type * from './entities/urls.js';
/// <reference path="./entities/urls.ts" />
export default MastodonEntity

View file

@ -1,6 +1,6 @@
import Response from './response' import { type Response } from './response.js'
import OAuth from './oauth' import * as OAuth from './oauth.js'
import Entity from './entity' import * as Entity from './entity.js'
export interface MegalodonInterface { export interface MegalodonInterface {
/** /**

View file

@ -1,11 +1,12 @@
import FormData from 'form-data' import FormData from 'form-data'
import fs from 'fs'; import fs from 'fs';
import MisskeyAPI from './misskey/api_client' import * as MisskeyAPI from './misskey/api_client.js'
import { DEFAULT_UA } from './default' import { DEFAULT_UA } from './default.js'
import OAuth from './oauth' import * as OAuth from './oauth.js'
import Response from './response' import { type Response } from './response.js'
import { MegalodonInterface, NoImplementedError, ArgumentError, UnexpectedError } from './megalodon' import * as Entity from './entity.js'
import { UnknownNotificationTypeError } from './notification' import { type MegalodonInterface, NoImplementedError, ArgumentError, UnexpectedError } from './megalodon.js'
import { UnknownNotificationTypeError } from './notification.js'
export default class Misskey implements MegalodonInterface { export default class Misskey implements MegalodonInterface {
public client: MisskeyAPI.Interface public client: MisskeyAPI.Interface
@ -717,7 +718,7 @@ export default class Misskey implements MegalodonInterface {
/** /**
* POST /api/users/reactions * POST /api/users/reactions
*/ */
public async getReactions(userId: string, options?: { limit?: number; max_id?: string; min_id?: string }): Promise<Response<MisskeyEntity.NoteReaction[]>> { public async getReactions(userId: string, options?: { limit?: number; max_id?: string; min_id?: string }): Promise<Response<MisskeyAPI.Entity.NoteReaction[]>> {
let params = { let params = {
userId, userId,
}; };

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,4 @@
namespace MisskeyEntity { export interface GetAll {
export type GetAll = { tutorial: number;
tutorial: number; defaultNoteVisibility: "public" | "home" | "followers" | "specified";
defaultNoteVisibility: "public" | "home" | "followers" | "specified";
};
} }

View file

@ -1,11 +1,9 @@
namespace MisskeyEntity { export interface Announcement {
export type Announcement = { id: string
id: string createdAt: string
createdAt: string updatedAt: string | null
updatedAt: string | null text: string
text: string title: string
title: string imageurl: string | null
imageurl: string | null isRead?: boolean
isRead?: boolean
}
} }

View file

@ -1,9 +1,7 @@
namespace MisskeyEntity { export interface App {
export type App = { id: string
id: string name: string
name: string callbackUrl: string
callbackUrl: string permission: Array<string>
permission: Array<string> secret?: string
secret?: string
}
} }

View file

@ -1,10 +1,8 @@
/// <reference path="userDetail.ts" /> import type { UserDetail } from './userDetail.js';
namespace MisskeyEntity { export interface Blocking {
export type Blocking = { id: string
id: string createdAt: string
createdAt: string blockeeId: string
blockeeId: string blockee: UserDetail
blockee: UserDetail
}
} }

View file

@ -1,7 +1,5 @@
/// <reference path="note.ts" /> import type { Note } from './note.js';
namespace MisskeyEntity { export interface CreatedNote {
export type CreatedNote = { createdNote: Note
createdNote: Note
}
} }

View file

@ -1,8 +1,6 @@
namespace MisskeyEntity { export interface Emoji {
export type Emoji = { name: string
name: string url: string
url: string aliases: Array<string>
aliases: Array<string> category: string
category: string
}
} }

View file

@ -1,10 +1,8 @@
/// <reference path="note.ts" /> import type { Note } from './note.js';
namespace MisskeyEntity { export interface Favorite {
export type Favorite = { id: string
id: string createdAt: string
createdAt: string noteId: string
noteId: string note: Note
note: Note
}
} }

View file

@ -1,8 +1,6 @@
namespace MisskeyEntity { export interface Field {
export type Field = { name: string;
name: string; value: string;
value: string; verified?: string;
verified?: string; verified_at?: string;
verified_at?: string;
};
} }

View file

@ -1,20 +1,18 @@
namespace MisskeyEntity { export interface File {
export type File = { id: string
id: string createdAt: string
createdAt: string name: string
name: string type: string
type: string md5: string
md5: string size: number
size: number isSensitive: boolean
isSensitive: boolean properties: {
properties: { width: number
width: number height: number
height: number avgColor: string
avgColor: string }
} url: string
url: string comment?: string
comment?: string blurhash?: string
blurhash?: string thumbnailUrl: string
thumbnailUrl: string
}
} }

View file

@ -1,9 +1,7 @@
/// <reference path="user.ts" /> import type { User } from './user.js';
namespace MisskeyEntity { export interface FollowRequest {
export type FollowRequest = { id: string
id: string follower: User
follower: User followee: User
followee: User
}
} }

View file

@ -1,11 +1,9 @@
/// <reference path="userDetail.ts" /> import type { UserDetail } from './userDetail.js';
namespace MisskeyEntity { export interface Follower {
export type Follower = { id: string
id: string createdAt: string
createdAt: string followeeId: string
followeeId: string followerId: string
followerId: string follower: UserDetail
follower: UserDetail
}
} }

Some files were not shown because too many files have changed in this diff Show more