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
*/
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
// automock: false,
@ -20,7 +29,7 @@ module.exports = {
// collectCoverage: false,
// 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
coverageDirectory: "coverage",
@ -60,7 +69,8 @@ module.exports = {
// globalTeardown: undefined,
// 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.
// maxWorkers: "50%",
@ -79,6 +89,10 @@ module.exports = {
// "tsx",
// "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
moduleNameMapper: {
@ -103,7 +117,8 @@ module.exports = {
// notifyMode: "failure-change",
// 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
// projects: undefined,
@ -118,17 +133,17 @@ module.exports = {
// resetModules: false,
// A path to a custom resolver
// resolver: undefined,
// resolver: './jest-resolver.cjs',
// Automatically restore mock state between every test
// restoreMocks: false,
restoreMocks: true,
// The root directory that Jest should scan for tests and modules within
// rootDir: undefined,
// A list of paths to directories that Jest should use to search for files in
roots: [
"<rootDir>"
"<rootDir>/test"
],
// 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
testMatch: [
"**/__tests__/**/*.[jt]s?(x)",
"**/?(*.)+(spec|test).[tj]s?(x)",
"<rootDir>/test/**/*"
"<rootDir>/test/**/*.spec.ts"
],
// 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",
// A map from regular expressions to paths to transformers
transform: {
"^.+\\.(t|j)sx?$": ["@swc/jest"],
},
// transform: {
// "^.+\\.(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
// transformIgnorePatterns: [
@ -204,4 +222,17 @@ module.exports = {
// Whether to use watchman for file crawling
// 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",
"type": "module",
"version": "7.0.1",
"private": true,
"description": "Mastodon API client for node.js and browser",
"main": "./lib/src/index.js",
"typings": "./lib/src/index.d.ts",
"scripts": {
"build": "tsc -p ./",
"test": "cross-env NODE_ENV=test jest -u --maxWorkers=3"
"build": "tsc -p tsconfig.json",
"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": {
"node": "^22.0.0"
@ -28,42 +33,23 @@
"bugs": {
"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",
"dependencies": {
"axios": "1.12.2",
"dayjs": "1.11.18",
"form-data": "4.0.4",
"oauth": "0.10.2",
"typescript": "5.9.2"
"oauth": "0.10.2"
},
"devDependencies": {
"@jest/globals": "30.1.2",
"@types/jest": "30.0.0",
"@types/node": "22.18.1",
"@types/oauth": "0.9.6",
"jest": "30.1.3",
"jest-mock": "30.0.5",
"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 { NodeinfoError } from './megalodon'
import axios, { type AxiosRequestConfig } from 'axios'
import { NodeinfoError } from './megalodon.js'
const NODEINFO_10 = 'http://nodeinfo.diaspora.software/ns/schema/1.0'
const NODEINFO_20 = 'http://nodeinfo.diaspora.software/ns/schema/2.0'

View file

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

View file

@ -1,8 +1,6 @@
namespace Entity {
export type Activity = {
week: string
statuses: string
logins: string
registrations: string
}
export interface Activity {
week: string
statuses: string
logins: 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 type Announcement = {
id: string
content: string
starts_at: string | null
ends_at: string | null
published: boolean
all_day: boolean
published_at: string
updated_at: string | null
read: boolean | null
mentions: Array<AnnouncementAccount>
statuses: Array<AnnouncementStatus>
tags: Array<StatusTag>
emojis: Array<Emoji>
reactions: Array<AnnouncementReaction>
}
export type AnnouncementAccount = {
id: string
username: string
url: string
acct: string
}
export type AnnouncementStatus = {
id: string
url: string
}
export type AnnouncementReaction = {
name: string
count: number
me: boolean | null
url: string | null
static_url: string | null
}
export interface Announcement {
id: string
content: string
starts_at: string | null
ends_at: string | null
published: boolean
all_day: boolean
published_at: string
updated_at: string | null
read: boolean | null
mentions: Array<AnnouncementAccount>
statuses: Array<AnnouncementStatus>
tags: Array<StatusTag>
emojis: Array<Emoji>
reactions: Array<AnnouncementReaction>
}
export interface AnnouncementAccount {
id: string
username: string
url: string
acct: string
}
export interface AnnouncementStatus {
id: string
url: string
}
export interface AnnouncementReaction {
name: string
count: number
me: boolean | null
url: string | null
static_url: string | null
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,16 +1,14 @@
/// <reference path="account.ts" />
/// <reference path="status.ts" />
import type { Account } from './account.js';
import type { Status } from './status.js';
namespace Entity {
export type Notification = {
account: Account
created_at: string
id: string
status?: Status
emoji?: string
type: NotificationType
target?: Account
}
export type NotificationType = string
export interface Notification {
account: Account
created_at: string
id: string
status?: Status
emoji?: string
type: NotificationType
target?: Account
}
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 type Poll = {
id: string
expires_at: string | null
expired: boolean
multiple: boolean
votes_count: number
options: Array<PollOption>
voted: boolean
emojis?: []
own_votes?: Array<number>
}
export interface Poll {
id: string
expires_at: string | null
expired: boolean
multiple: boolean
votes_count: number
options: Array<PollOption>
voted: boolean
emojis?: []
own_votes?: Array<number>
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,40 +1,40 @@
/// <reference path="./entities/account.ts" />
/// <reference path="./entities/activity.ts" />
/// <reference path="./entities/announcement.ts" />
/// <reference path="./entities/application.ts" />
/// <reference path="./entities/async_attachment.ts" />
/// <reference path="./entities/attachment.ts" />
/// <reference path="./entities/card.ts" />
/// <reference path="./entities/context.ts" />
/// <reference path="./entities/conversation.ts" />
/// <reference path="./entities/emoji.ts" />
/// <reference path="./entities/featured_tag.ts" />
/// <reference path="./entities/field.ts" />
/// <reference path="./entities/filter.ts" />
/// <reference path="./entities/follow_request.ts" />
/// <reference path="./entities/history.ts" />
/// <reference path="./entities/identity_proof.ts" />
/// <reference path="./entities/instance.ts" />
/// <reference path="./entities/list.ts" />
/// <reference path="./entities/marker.ts" />
/// <reference path="./entities/mention.ts" />
/// <reference path="./entities/notification.ts" />
/// <reference path="./entities/poll.ts" />
/// <reference path="./entities/poll_option.ts" />
/// <reference path="./entities/preferences.ts" />
/// <reference path="./entities/push_subscription.ts" />
/// <reference path="./entities/reaction.ts" />
/// <reference path="./entities/relationship.ts" />
/// <reference path="./entities/report.ts" />
/// <reference path="./entities/results.ts" />
/// <reference path="./entities/scheduled_status.ts" />
/// <reference path="./entities/source.ts" />
/// <reference path="./entities/stats.ts" />
/// <reference path="./entities/status.ts" />
/// <reference path="./entities/status_params.ts" />
/// <reference path="./entities/status_source.ts" />
/// <reference path="./entities/tag.ts" />
/// <reference path="./entities/token.ts" />
/// <reference path="./entities/urls.ts" />
export default Entity
export type * from './entities/account.js';
export type * from './entities/activity.js';
export type * from './entities/announcement.js';
export type * from './entities/application.js';
export type * from './entities/async_attachment.js';
export type * from './entities/attachment.js';
export type * from './entities/card.js';
export type * from './entities/context.js';
export type * from './entities/conversation.js';
export type * from './entities/emoji.js';
export type * from './entities/featured_tag.js';
export type * from './entities/field.js';
export type * from './entities/filter.js';
export type * from './entities/follow_request.js';
export type * from './entities/history.js';
export type * from './entities/identity_proof.js';
export type * from './entities/instance.js';
export type * from './entities/list.js';
export type * from './entities/marker.js';
export type * from './entities/mention.js';
export type * from './entities/notification.js';
export type * from './entities/poll.js';
export type * from './entities/poll_option.js';
export type * from './entities/preferences.js';
export type * from './entities/push_subscription.js';
export type * from './entities/reaction.js';
export type * from './entities/relationship.js';
export type * from './entities/report.js';
export type * from './entities/results.js';
export type * from './entities/role.js';
export type * from './entities/scheduled_status.js';
export type * from './entities/source.js';
export type * from './entities/stats.js';
export type * from './entities/status.js';
export type * from './entities/status_edit.js';
export type * from './entities/status_params.js';
export type * from './entities/status_source.js';
export type * from './entities/tag.js';
export type * from './entities/token.js';
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 Notifications: Entity.FilterContext = 'notifications'
export const Public: Entity.FilterContext = 'public'
export const Thread: Entity.FilterContext = 'thread'
export const Account: Entity.FilterContext = 'account'
}
export default FilterContext
export const Home: Entity.FilterContext = 'home'
export const Notifications: Entity.FilterContext = 'notifications'
export const Public: Entity.FilterContext = 'public'
export const Thread: Entity.FilterContext = 'thread'
export const Account: Entity.FilterContext = 'account'

View file

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

View file

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

View file

@ -1,8 +1,6 @@
namespace MastodonEntity {
export type Activity = {
week: string
statuses: string
logins: string
registrations: string
}
export interface Activity {
week: string
statuses: string
logins: 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 type Announcement = {
id: string
content: string
starts_at: string | null
ends_at: string | null
published: boolean
all_day: boolean
published_at: string
updated_at: string
read: boolean | null
mentions: Array<AnnouncementAccount>
statuses: Array<AnnouncementStatus>
tags: Array<StatusTag>
emojis: Array<Emoji>
reactions: Array<AnnouncementReaction>
}
export type AnnouncementAccount = {
id: string
username: string
url: string
acct: string
}
export type AnnouncementStatus = {
id: string
url: string
}
export type AnnouncementReaction = {
name: string
count: number
me: boolean | null
url: string | null
static_url: string | null
}
export interface Announcement {
id: string
content: string
starts_at: string | null
ends_at: string | null
published: boolean
all_day: boolean
published_at: string
updated_at: string
read: boolean | null
mentions: Array<AnnouncementAccount>
statuses: Array<AnnouncementStatus>
tags: Array<StatusTag>
emojis: Array<Emoji>
reactions: Array<AnnouncementReaction>
}
export interface AnnouncementAccount {
id: string
username: string
url: string
acct: string
}
export interface AnnouncementStatus {
id: string
url: string
}
export interface AnnouncementReaction {
name: string
count: number
me: boolean | null
url: string | null
static_url: string | null
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,14 +1,12 @@
/// <reference path="account.ts" />
/// <reference path="status.ts" />
import type { Account } from './account.js';
import type { Status } from './status.js';
namespace MastodonEntity {
export type Notification = {
account: Account
created_at: string
id: string
status?: Status
type: NotificationType
}
export type NotificationType = string
export interface Notification {
account: Account
created_at: string
id: string
status?: Status
type: NotificationType
}
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 type Poll = {
id: string
expires_at: string | null
expired: boolean
multiple: boolean
votes_count: number
options: Array<PollOption>
voted: boolean
}
export interface Poll {
id: string
expires_at: string | null
expired: boolean
multiple: boolean
votes_count: number
options: Array<PollOption>
voted: boolean
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,11 +1,12 @@
import FormData from 'form-data'
import fs from 'fs';
import MisskeyAPI from './misskey/api_client'
import { DEFAULT_UA } from './default'
import OAuth from './oauth'
import Response from './response'
import { MegalodonInterface, NoImplementedError, ArgumentError, UnexpectedError } from './megalodon'
import { UnknownNotificationTypeError } from './notification'
import * as MisskeyAPI from './misskey/api_client.js'
import { DEFAULT_UA } from './default.js'
import * as OAuth from './oauth.js'
import { type Response } from './response.js'
import * as Entity from './entity.js'
import { type MegalodonInterface, NoImplementedError, ArgumentError, UnexpectedError } from './megalodon.js'
import { UnknownNotificationTypeError } from './notification.js'
export default class Misskey implements MegalodonInterface {
public client: MisskeyAPI.Interface
@ -717,7 +718,7 @@ export default class Misskey implements MegalodonInterface {
/**
* 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 = {
userId,
};

File diff suppressed because it is too large Load diff

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

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