docs: updated typedoc, added ci, fixed some docs

This commit is contained in:
alina 🌸 2023-10-27 14:25:21 +03:00
parent 528cc4dc92
commit 9791f8faae
Signed by: teidesu
SSH key fingerprint: SHA256:uNeCpw6aTSU4aIObXLvHfLkDa82HWH9EiOj9AXOIRpI
57 changed files with 338 additions and 244 deletions

37
.github/workflows/docs.yaml vendored Normal file
View file

@ -0,0 +1,37 @@
name: Docs
on:
push:
branches:
- master
workflow_dispatch:
jobs:
build-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: "18"
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- run: pnpm install --frozen-lockfile
- name: 'TL codegen'
run: pnpm -C packages/tl run gen-code
- name: Build
run: pnpm run -r build
- name: Build docs
run: |
pnpm run docs
touch docs/.nojekyll
echo "ref.mtcute.dev" > docs/CNAME
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4.4.1
with:
branch: gh-pages
folder: docs

6
.gitignore vendored
View file

@ -7,9 +7,7 @@ private/
.vscode .vscode
*.log *.log
# Docs are generated and deployed in gh-pages branch. # docs are generated in ci
docs
docs/*
!docs/.nojekyll
*.tsbuildinfo *.tsbuildinfo

View file

@ -18,7 +18,7 @@
"lint:fix": "eslint --fix .", "lint:fix": "eslint --fix .",
"format": "prettier --write \"packages/**/*.ts\"", "format": "prettier --write \"packages/**/*.ts\"",
"publish-all": "node scripts/publish.js all", "publish-all": "node scripts/publish.js all",
"docs": "pnpm run -r docs", "docs": "typedoc",
"build-package": "node scripts/build-package.js" "build-package": "node scripts/build-package.js"
}, },
"dependencies": { "dependencies": {

View file

@ -61,6 +61,7 @@ export type ReplyMarkup =
*/ */
// eslint-disable-next-line @typescript-eslint/no-namespace // eslint-disable-next-line @typescript-eslint/no-namespace
export namespace BotKeyboard { export namespace BotKeyboard {
/** Create a keyboard builder */
export function builder(maxRowWidth?: number | null): BotKeyboardBuilder { export function builder(maxRowWidth?: number | null): BotKeyboardBuilder {
return new BotKeyboardBuilder(maxRowWidth) return new BotKeyboardBuilder(maxRowWidth)
} }

View file

@ -9,14 +9,17 @@ import { RawDocument } from './document.js'
* An audio file * An audio file
*/ */
export class Audio extends RawDocument { export class Audio extends RawDocument {
/** Type of the media (for use in a tagged union) */
readonly type = 'audio' as const readonly type = 'audio' as const
/** Type of the file for File ID generation */
protected _fileIdType(): tdFileId.FileType { protected _fileIdType(): tdFileId.FileType {
return tdFileId.FileType.Audio return tdFileId.FileType.Audio
} }
constructor( constructor(
doc: tl.RawDocument, doc: tl.RawDocument,
/** TL object describing the audio */
readonly attr: tl.RawDocumentAttributeAudio, readonly attr: tl.RawDocumentAttributeAudio,
) { ) {
super(doc) super(doc)

View file

@ -12,6 +12,7 @@ import { Thumbnail } from './thumbnail.js'
* This also includes audios, videos, voices etc. * This also includes audios, videos, voices etc.
*/ */
export abstract class RawDocument extends FileLocation { export abstract class RawDocument extends FileLocation {
/** Type of the media (for use in a tagged union) */
abstract type: string abstract type: string
constructor(readonly raw: tl.RawDocument) { constructor(readonly raw: tl.RawDocument) {

View file

@ -598,6 +598,7 @@ export type InputMediaLike =
// eslint-disable-next-line @typescript-eslint/no-namespace // eslint-disable-next-line @typescript-eslint/no-namespace
export namespace InputMedia { export namespace InputMedia {
/** Omit `type` and `file` from the given type */
export type OmitTypeAndFile<T extends InputMediaLike, K extends keyof T = never> = Omit<T, 'type' | 'file' | K> export type OmitTypeAndFile<T extends InputMediaLike, K extends keyof T = never> = Omit<T, 'type' | 'file' | K>
/** /**

View file

@ -4,12 +4,12 @@ import { MaybeArray, tl } from '@mtcute/core'
import { InputPeerLike } from '../peers/index.js' import { InputPeerLike } from '../peers/index.js'
interface InputPrivacyRuleUsers { export interface InputPrivacyRuleUsers {
allow: boolean allow: boolean
users: InputPeerLike[] users: InputPeerLike[]
} }
interface InputPrivacyRuleChatParticipants { export interface InputPrivacyRuleChatParticipants {
allow: boolean allow: boolean
chats: InputPeerLike[] chats: InputPeerLike[]
} }

View file

@ -7,7 +7,7 @@ import { User } from '../user.js'
import { _actionFromTl, ChatAction } from './actions.js' import { _actionFromTl, ChatAction } from './actions.js'
export * from './actions.js' export * from './actions.js'
export { InputChatEventFilters } from './filters.js' export { ChatEventFilters, InputChatEventFilters } from './filters.js'
export class ChatEvent { export class ChatEvent {
constructor( constructor(

View file

@ -12,8 +12,12 @@ import { StoriesStealthMode } from './stealth-mode.js'
* Returned by {@link TelegramClient.getAllStories} * Returned by {@link TelegramClient.getAllStories}
*/ */
export class AllStories { export class AllStories {
constructor(readonly raw: tl.stories.RawAllStories) {} constructor(
/** Raw TL object */
readonly raw: tl.stories.RawAllStories,
) {}
/** Peers index */
readonly _peers = PeersIndex.from(this.raw) readonly _peers = PeersIndex.from(this.raw)
/** Whether there are more stories to fetch */ /** Whether there are more stories to fetch */

View file

@ -5,6 +5,7 @@ import { StoryInteractiveReaction } from './reaction.js'
import { StoryInteractiveVenue } from './venue.js' import { StoryInteractiveVenue } from './venue.js'
export * from './input.js' export * from './input.js'
export { StoryInteractiveLocation, StoryInteractiveReaction, StoryInteractiveVenue }
export type StoryInteractiveElement = StoryInteractiveReaction | StoryInteractiveLocation | StoryInteractiveVenue export type StoryInteractiveElement = StoryInteractiveReaction | StoryInteractiveLocation | StoryInteractiveVenue

View file

@ -0,0 +1,8 @@
module.exports = {
extends: ['../../typedoc.base.cjs'],
entryPoints: [
'./src/index.ts',
'./src/utils/index.ts',
],
entryPointStrategy: 'expand',
}

View file

@ -1,16 +0,0 @@
const path = require('path')
module.exports = {
...require('../../typedoc.js'),
out: path.join(
__dirname,
'../../docs/packages/' +
require('./package.json').name.replace(/^@.+\//, ''),
),
entryPoints: ['./src/index.ts'],
excludeExternals: true,
externalPattern: [
'../tl/**/*',
'**/*/node_modules/**/*',
],
}

View file

@ -9,8 +9,7 @@
"type": "module", "type": "module",
"scripts": { "scripts": {
"test": "mocha \"tests/**/*.spec.ts\"", "test": "mocha \"tests/**/*.spec.ts\"",
"build": "pnpm run -w build-package core", "build": "pnpm run -w build-package core"
"docs": "typedoc"
}, },
"browser": { "browser": {
"./cjs/utils/platform/crypto.js": "./cjs/utils/platform/crypto.web.js", "./cjs/utils/platform/crypto.js": "./cjs/utils/platform/crypto.web.js",

View file

@ -30,6 +30,7 @@ import {
writeStringSession, writeStringSession,
} from './utils/index.js' } from './utils/index.js'
/** Options for {@link BaseTelegramClient} */
export interface BaseTelegramClientOptions { export interface BaseTelegramClientOptions {
/** /**
* API ID from my.telegram.org * API ID from my.telegram.org
@ -193,6 +194,10 @@ export interface BaseTelegramClientOptions {
writerMap?: TlWriterMap writerMap?: TlWriterMap
} }
/**
* Basic Telegram client that only implements the bare minimum
* to make RPC calls and receive low-level updates.
*/
export class BaseTelegramClient extends EventEmitter { export class BaseTelegramClient extends EventEmitter {
/** /**
* Crypto provider taken from {@link BaseTelegramClientOptions.crypto} * Crypto provider taken from {@link BaseTelegramClientOptions.crypto}
@ -226,13 +231,17 @@ export class BaseTelegramClient extends EventEmitter {
protected _defaultDcs: ITelegramStorage.DcOptions protected _defaultDcs: ITelegramStorage.DcOptions
private _niceStacks: boolean private _niceStacks: boolean
/** TL layer used by the client */
readonly _layer: number readonly _layer: number
/** TL readers map used by the client */
readonly _readerMap: TlReaderMap readonly _readerMap: TlReaderMap
/** TL writers map used by the client */
readonly _writerMap: TlWriterMap readonly _writerMap: TlWriterMap
/** Unix timestamp when the last update was received */
protected _lastUpdateTime = 0 protected _lastUpdateTime = 0
protected _config = new ConfigManager(() => this.call({ _: 'help.getConfig' })) readonly _config = new ConfigManager(() => this.call({ _: 'help.getConfig' }))
// not really connected, but rather "connect() was called" // not really connected, but rather "connect() was called"
private _connected: ControllablePromise<void> | boolean = false private _connected: ControllablePromise<void> | boolean = false

View file

@ -1,5 +1,11 @@
import { tl } from '@mtcute/tl' import { tl } from '@mtcute/tl'
/**
* Config manager is responsible for keeping
* the current server configuration up-to-date
* and providing methods to find the best DC
* option for the current session.
*/
export class ConfigManager { export class ConfigManager {
constructor(private _update: () => Promise<tl.RawConfig>) {} constructor(private _update: () => Promise<tl.RawConfig>) {}

View file

@ -96,6 +96,7 @@ export interface NetworkManagerExtraParams {
inactivityTimeout?: number inactivityTimeout?: number
} }
/** Options that can be customized when making an RPC call */
export interface RpcCallOptions { export interface RpcCallOptions {
/** /**
* If the call results in a `FLOOD_WAIT_X` error, * If the call results in a `FLOOD_WAIT_X` error,
@ -146,6 +147,9 @@ export interface RpcCallOptions {
abortSignal?: AbortSignal abortSignal?: AbortSignal
} }
/**
* Wrapper over all connection pools for a single DC.
*/
export class DcConnectionManager { export class DcConnectionManager {
private __baseConnectionParams = (): SessionConnectionParams => ({ private __baseConnectionParams = (): SessionConnectionParams => ({
crypto: this.manager.params.crypto, crypto: this.manager.params.crypto,
@ -167,8 +171,10 @@ export class DcConnectionManager {
private _log = this.manager._log.create('dc-manager') private _log = this.manager._log.create('dc-manager')
/** Main connection pool */
main: MultiSessionConnection main: MultiSessionConnection
/** Upload connection pool */
upload = new MultiSessionConnection( upload = new MultiSessionConnection(
this.__baseConnectionParams(), this.__baseConnectionParams(),
this.manager._connectionCount('upload', this.dcId, this.manager.params.isPremium), this.manager._connectionCount('upload', this.dcId, this.manager.params.isPremium),
@ -176,6 +182,7 @@ export class DcConnectionManager {
'UPLOAD', 'UPLOAD',
) )
/** Download connection pool */
download = new MultiSessionConnection( download = new MultiSessionConnection(
this.__baseConnectionParams(), this.__baseConnectionParams(),
this.manager._connectionCount('download', this.dcId, this.manager.params.isPremium), this.manager._connectionCount('download', this.dcId, this.manager.params.isPremium),
@ -183,6 +190,7 @@ export class DcConnectionManager {
'DOWNLOAD', 'DOWNLOAD',
) )
/** Download connection pool (for small files) */
downloadSmall = new MultiSessionConnection( downloadSmall = new MultiSessionConnection(
this.__baseConnectionParams(), this.__baseConnectionParams(),
this.manager._connectionCount('downloadSmall', this.dcId, this.manager.params.isPremium), this.manager._connectionCount('downloadSmall', this.dcId, this.manager.params.isPremium),
@ -197,9 +205,13 @@ export class DcConnectionManager {
} }
constructor( constructor(
/** Network manager instance */
readonly manager: NetworkManager, readonly manager: NetworkManager,
/** DC ID */
readonly dcId: number, readonly dcId: number,
/** DC options to use */
readonly _dcs: ITelegramStorage.DcOptions, readonly _dcs: ITelegramStorage.DcOptions,
/** Whether this DC is the primary one */
public isPrimary = false, public isPrimary = false,
) { ) {
this._log.prefix = `[DC ${dcId}] ` this._log.prefix = `[DC ${dcId}] `
@ -349,6 +361,9 @@ export class DcConnectionManager {
} }
} }
/**
* Class that manages all connections to Telegram servers.
*/
export class NetworkManager { export class NetworkManager {
readonly _log = this.params.log.create('network') readonly _log = this.params.log.create('network')
readonly _storage = this.params.storage readonly _storage = this.params.storage

View file

@ -5,6 +5,7 @@ import { tl } from '@mtcute/tl'
import { MaybeAsync } from '../../types/index.js' import { MaybeAsync } from '../../types/index.js'
import { ICryptoProvider, Logger } from '../../utils/index.js' import { ICryptoProvider, Logger } from '../../utils/index.js'
/** Current state of the transport */
export enum TransportState { export enum TransportState {
/** /**
* Transport has no active connections nor trying to connect to anything * Transport has no active connections nor trying to connect to anything

View file

@ -6,24 +6,36 @@ import { Logger } from '../utils/index.js'
// eslint-disable-next-line @typescript-eslint/no-namespace // eslint-disable-next-line @typescript-eslint/no-namespace
export namespace ITelegramStorage { export namespace ITelegramStorage {
/** Information about a cached peer */
export interface PeerInfo { export interface PeerInfo {
// marked id /** Peer marked ID */
id: number id: number
/** Peer access hash */
accessHash: tl.Long accessHash: tl.Long
/** Peer type */
type: BasicPeerType type: BasicPeerType
/** Peer username, if any */
username?: string username?: string
/** Peer phone number, if available */
phone?: string phone?: string
/** Full TL object with the cached entity */
full: tl.TypeUser | tl.TypeChat full: tl.TypeUser | tl.TypeChat
} }
/** Information about currently logged in user */
export interface SelfInfo { export interface SelfInfo {
/** Whether this is a bot */
isBot: boolean isBot: boolean
/** Current user's ID */
userId: number userId: number
} }
/** Information about preferred DC-s for the user */
export interface DcOptions { export interface DcOptions {
/** Main DC */
main: tl.RawDcOption main: tl.RawDcOption
/** Media DC. Can be the same as main */
media: tl.RawDcOption media: tl.RawDcOption
} }
} }

View file

@ -13,19 +13,5 @@
"references": [ "references": [
{ "path": "../tl" }, { "path": "../tl" },
{ "path": "../tl-runtime" }, { "path": "../tl-runtime" },
], ]
"typedocOptions": {
"name": "@mtcute/core",
"includeVersion": true,
"out": "../../docs/packages/core",
"validation": {
"notExported": true,
"invalidLink": true,
"notDocumented": false
},
"excludePrivate": true,
"entryPoints": [
"./src/index.ts"
]
}
} }

12
packages/core/typedoc.cjs Normal file
View file

@ -0,0 +1,12 @@
module.exports = {
extends: ['../../typedoc.base.cjs'],
entryPoints: [
'./src/index.ts',
'./src/utils/index.ts',
'./src/utils/crypto/node-crypto.ts',
'./src/utils/crypto/subtle.ts',
'./src/network/transports/tcp.ts',
'./src/network/transports/websocket.ts',
],
entryPointStrategy: 'expand',
}

View file

@ -1,17 +0,0 @@
const path = require('path')
module.exports = {
...require('../../typedoc.js'),
out: path.join(
__dirname,
'../../docs/packages/' +
require('./package.json').name.replace(/^@.+\//, ''),
),
entryPoints: ['./src/index.ts'],
excludeExternals: true,
externalPattern: [
// '../client/**/*',
'../tl/**/*',
'**/*/node_modules/**/*',
],
}

View file

@ -0,0 +1,4 @@
module.exports = {
extends: ['../../typedoc.base.cjs'],
entryPoints: ['./src/index.ts'],
}

View file

@ -1,11 +0,0 @@
const path = require('path')
module.exports = {
...require('../../typedoc.js'),
out: path.join(
__dirname,
'../../docs/packages/' +
require('./package.json').name.replace(/^@.+\//, ''),
),
entryPoints: ['./src/index.ts'],
}

View file

@ -72,7 +72,7 @@ export interface DispatcherParams {
/** /**
* If this dispatcher can be used as a scene, its unique name. * If this dispatcher can be used as a scene, its unique name.
* *
* Should not be set manually, use {@link Dispatcher#scene} instead * Should not be set manually, use {@link Dispatcher.scene} instead
*/ */
sceneName?: string sceneName?: string

View file

@ -0,0 +1,4 @@
module.exports = {
extends: ['../../typedoc.base.cjs'],
entryPoints: ['./src/index.ts'],
}

View file

@ -1,11 +0,0 @@
const path = require('path')
module.exports = {
...require('../../typedoc.js'),
out: path.join(
__dirname,
'../../docs/packages/' +
require('./package.json').name.replace(/^@.+\//, ''),
),
entryPoints: ['./src/index.ts'],
}

View file

@ -0,0 +1,4 @@
module.exports = {
extends: ['../../typedoc.base.cjs'],
entryPoints: ['./src/index.ts'],
}

View file

@ -1,11 +0,0 @@
const path = require('path')
module.exports = {
...require('../../typedoc.js'),
out: path.join(
__dirname,
'../../docs/packages/' +
require('./package.json').name.replace(/^@.+\//, ''),
),
entryPoints: ['./src/index.ts'],
}

View file

@ -0,0 +1,4 @@
module.exports = {
extends: ['../../typedoc.base.cjs'],
entryPoints: ['./src/index.ts'],
}

View file

@ -1,11 +0,0 @@
const path = require('path')
module.exports = {
...require('../../typedoc.js'),
out: path.join(
__dirname,
'../../docs/packages/' +
require('./package.json').name.replace(/^@.+\//, ''),
),
entryPoints: ['./src/index.ts'],
}

View file

@ -156,7 +156,7 @@ export abstract class BaseHttpProxyTcpTransport extends BaseTcpTransport {
/** /**
* HTTP(s) TCP transport using an intermediate packet codec. * HTTP(s) TCP transport using an intermediate packet codec.
* *
* Should be the one passed as `transport` to {@link TelegramClient} constructor * Should be the one passed as `transport` to `TelegramClient` constructor
* (unless you want to use a custom codec). * (unless you want to use a custom codec).
*/ */
export class HttpProxyTcpTransport extends BaseHttpProxyTcpTransport { export class HttpProxyTcpTransport extends BaseHttpProxyTcpTransport {

View file

@ -0,0 +1,4 @@
module.exports = {
extends: ['../../typedoc.base.cjs'],
entryPoints: ['./index.ts'],
}

View file

@ -1,11 +0,0 @@
const path = require('path')
module.exports = {
...require('../../typedoc.js'),
out: path.join(
__dirname,
'../../docs/packages/' +
require('./package.json').name.replace(/^@.+\//, ''),
),
entryPoints: ['./index.ts'],
}

View file

@ -18,6 +18,10 @@
".": { ".": {
"import": "./esm/index.js", "import": "./esm/index.js",
"require": "./cjs/index.js" "require": "./cjs/index.js"
},
"./plurals/*.js": {
"import": "./esm/plurals/*.js",
"require": "./cjs/plurals/*.js"
} }
} }
}, },

View file

@ -0,0 +1,7 @@
module.exports = {
extends: ['../../typedoc.base.cjs'],
entryPoints: [
'./src/index.ts',
'./src/plurals/*.ts',
],
}

View file

@ -1,15 +0,0 @@
const path = require('path')
module.exports = {
...require('../../typedoc.js'),
out: path.join(
__dirname,
'../../docs/packages/' +
require('./package.json').name.replace(/^@.+\//, ''),
),
entryPoints: [
'./src/index.ts',
'./src/plurals/english.ts',
'./src/plurals/russian.ts',
],
}

View file

@ -0,0 +1,4 @@
module.exports = {
extends: ['../../typedoc.base.cjs'],
entryPoints: ['./src/index.ts'],
}

View file

@ -1,11 +0,0 @@
const path = require('path')
module.exports = {
...require('../../typedoc.js'),
out: path.join(
__dirname,
'../../docs/packages/' +
require('./package.json').name.replace(/^@.+\//, ''),
),
entryPoints: ['./src/index.ts'],
}

View file

@ -0,0 +1,4 @@
module.exports = {
extends: ['../../typedoc.base.cjs'],
entryPoints: ['./index.ts'],
}

View file

@ -1,11 +0,0 @@
const path = require('path')
module.exports = {
...require('../../typedoc.js'),
out: path.join(
__dirname,
'../../docs/packages/' +
require('./package.json').name.replace(/^@.+\//, ''),
),
entryPoints: ['./index.ts'],
}

11
packages/node/typedoc.cjs Normal file
View file

@ -0,0 +1,11 @@
module.exports = {
extends: ['../../typedoc.base.cjs'],
entryPoints: ['./index.ts'],
externalPattern: [
'../client/**',
'../core/**',
'../html-parser/**',
'../markdown-parser/**',
'../sqlite/**',
],
}

View file

@ -1,22 +0,0 @@
const path = require('path')
module.exports = {
...require('../../typedoc.js'),
out: path.join(
__dirname,
'../../docs/packages/' +
require('./package.json').name.replace(/^@.+\//, ''),
),
entryPoints: ['./index.ts'],
excludeExternals: true,
externalPattern: [
'../client/**/*',
'../dispatcher/**/*',
'../tl/**/*',
'../html-parser/**/*',
'../markdown-parser/**/*',
'../core/**/*',
'../sqlite/**/*',
'**/*/node_modules/**/*',
],
}

View file

@ -413,7 +413,7 @@ export abstract class BaseSocksTcpTransport extends BaseTcpTransport {
/** /**
* Socks TCP transport using an intermediate packet codec. * Socks TCP transport using an intermediate packet codec.
* *
* Should be the one passed as `transport` to {@link TelegramClient} constructor * Should be the one passed as `transport` to `TelegramClient` constructor
* (unless you want to use a custom codec). * (unless you want to use a custom codec).
*/ */
export class SocksTcpTransport extends BaseSocksTcpTransport { export class SocksTcpTransport extends BaseSocksTcpTransport {

View file

@ -0,0 +1,4 @@
module.exports = {
extends: ['../../typedoc.base.cjs'],
entryPoints: ['./index.ts'],
}

View file

@ -1,11 +0,0 @@
const path = require('path')
module.exports = {
...require('../../typedoc.js'),
out: path.join(
__dirname,
'../../docs/packages/' +
require('./package.json').name.replace(/^@.+\//, ''),
),
entryPoints: ['./index.ts'],
}

View file

@ -0,0 +1,4 @@
module.exports = {
extends: ['../../typedoc.base.cjs'],
entryPoints: ['./index.ts'],
}

View file

@ -1,11 +0,0 @@
const path = require('path')
module.exports = {
...require('../../typedoc.js'),
out: path.join(
__dirname,
'../../docs/packages/' +
require('./package.json').name.replace(/^@.+\//, ''),
),
entryPoints: ['./index.ts'],
}

View file

@ -0,0 +1,4 @@
module.exports = {
extends: ['../../typedoc.base.cjs'],
entryPoints: ['./src'],
}

View file

@ -1,12 +0,0 @@
const path = require('path')
module.exports = {
...require('../../typedoc.js'),
out: path.join(
__dirname,
'../../docs/packages/' +
require('./package.json').name.replace(/^@.+\//, ''),
),
entryPoints: ['./src'],
entryPointStrategy: 'expand',
}

View file

@ -0,0 +1,4 @@
module.exports = {
extends: ['../../typedoc.base.cjs'],
entryPoints: ['./src/index.ts'],
}

View file

@ -1,11 +0,0 @@
const path = require('path')
module.exports = {
...require('../../typedoc.js'),
out: path.join(
__dirname,
'../../docs/packages/' +
require('./package.json').name.replace(/^@.+\//, ''),
),
entryPoints: ['./src/index.ts'],
}

View file

@ -309,7 +309,7 @@ importers:
version: 5.2.3 version: 5.2.3
ts-node: ts-node:
specifier: 10.9.1 specifier: 10.9.1
version: 10.9.1(@types/node@18.16.0)(typescript@5.0.4) version: 10.9.1(@types/node@20.8.9)(typescript@5.2.2)
devDependencies: devDependencies:
'@mtcute/core': '@mtcute/core':
specifier: workspace:^1.0.0 specifier: workspace:^1.0.0
@ -982,6 +982,12 @@ packages:
/@types/node@18.16.0: /@types/node@18.16.0:
resolution: {integrity: sha512-BsAaKhB+7X+H4GnSjGhJG9Qi8Tw+inU9nJDwmD5CgOmBLEI6ArdhikpLX7DjbjDRDTbqZzU2LSQNZg8WGPiSZQ==} resolution: {integrity: sha512-BsAaKhB+7X+H4GnSjGhJG9Qi8Tw+inU9nJDwmD5CgOmBLEI6ArdhikpLX7DjbjDRDTbqZzU2LSQNZg8WGPiSZQ==}
/@types/node@20.8.9:
resolution: {integrity: sha512-UzykFsT3FhHb1h7yD4CA4YhBHq545JC0YnEz41xkipN88eKQtL6rSgocL5tbAP6Ola9Izm/Aw4Ora8He4x0BHg==}
dependencies:
undici-types: 5.26.5
dev: false
/@types/normalize-package-data@2.4.1: /@types/normalize-package-data@2.4.1:
resolution: {integrity: sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==} resolution: {integrity: sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==}
dev: true dev: true
@ -1645,7 +1651,7 @@ packages:
normalize-path: 3.0.0 normalize-path: 3.0.0
readdirp: 3.6.0 readdirp: 3.6.0
optionalDependencies: optionalDependencies:
fsevents: 2.3.2 fsevents: 2.3.3
dev: true dev: true
/chownr@1.1.4: /chownr@1.1.4:
@ -2705,8 +2711,8 @@ packages:
/fs.realpath@1.0.0: /fs.realpath@1.0.0:
resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==}
/fsevents@2.3.2: /fsevents@2.3.3:
resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==} resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==}
engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
os: [darwin] os: [darwin]
requiresBuild: true requiresBuild: true
@ -5237,6 +5243,38 @@ packages:
typescript: 5.0.4 typescript: 5.0.4
v8-compile-cache-lib: 3.0.1 v8-compile-cache-lib: 3.0.1
yn: 3.1.1 yn: 3.1.1
dev: true
/ts-node@10.9.1(@types/node@20.8.9)(typescript@5.2.2):
resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==}
hasBin: true
peerDependencies:
'@swc/core': '>=1.2.50'
'@swc/wasm': '>=1.2.50'
'@types/node': '*'
typescript: '>=2.7'
peerDependenciesMeta:
'@swc/core':
optional: true
'@swc/wasm':
optional: true
dependencies:
'@cspotcode/source-map-support': 0.8.1
'@tsconfig/node10': 1.0.8
'@tsconfig/node12': 1.0.9
'@tsconfig/node14': 1.0.1
'@tsconfig/node16': 1.0.2
'@types/node': 20.8.9
acorn: 8.10.0
acorn-walk: 8.2.0
arg: 4.1.3
create-require: 1.1.1
diff: 4.0.2
make-error: 1.3.6
typescript: 5.2.2
v8-compile-cache-lib: 3.0.1
yn: 3.1.1
dev: false
/tsconfig-paths@3.14.2: /tsconfig-paths@3.14.2:
resolution: {integrity: sha512-o/9iXgCYc5L/JxCHPe3Hvh8Q/2xm5Z+p18PESBU6Ff33695QnCHBEjcytY2q19ua7Mbl/DavtBOLq+oG0RCL+g==} resolution: {integrity: sha512-o/9iXgCYc5L/JxCHPe3Hvh8Q/2xm5Z+p18PESBU6Ff33695QnCHBEjcytY2q19ua7Mbl/DavtBOLq+oG0RCL+g==}
@ -5333,12 +5371,12 @@ packages:
resolution: {integrity: sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==} resolution: {integrity: sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==}
engines: {node: '>=12.20'} engines: {node: '>=12.20'}
hasBin: true hasBin: true
dev: true
/typescript@5.2.2: /typescript@5.2.2:
resolution: {integrity: sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==} resolution: {integrity: sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==}
engines: {node: '>=14.17'} engines: {node: '>=14.17'}
hasBin: true hasBin: true
dev: true
/uglify-js@3.17.4: /uglify-js@3.17.4:
resolution: {integrity: sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==} resolution: {integrity: sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==}
@ -5357,6 +5395,10 @@ packages:
which-boxed-primitive: 1.0.2 which-boxed-primitive: 1.0.2
dev: true dev: true
/undici-types@5.26.5:
resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==}
dev: false
/unique-filename@1.1.1: /unique-filename@1.1.1:
resolution: {integrity: sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ==} resolution: {integrity: sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ==}
dependencies: dependencies:

View file

@ -0,0 +1,67 @@
function load(app) {
app.converter.addUnknownSymbolResolver((declaration) => {
const symbol = declaration.symbolReference?.path?.map((path) => path.path).join('.')
if (symbol === 'Long' || symbol === 'tl.Long') {
return {
target: 'https://github.com/dcodeIO/long.js',
caption: symbol,
}
}
if (symbol === 'BigInteger') {
return {
target: 'https://github.com/peterolson/BigInteger.js',
caption: symbol,
}
}
if (symbol.startsWith('tl.')) {
let [ns, name] = symbol.slice(3).split('.')
if (!name) {
name = ns
ns = null
}
let kind
if (name.startsWith('Type')) {
kind = 'union'
name = name.slice(4)
} else if (name.startsWith('Raw')) {
name = name[3].toLowerCase() + name.slice(4)
if (name.endsWith('Method')) {
kind = 'method'
name = name.slice(0, -6)
} else {
kind = 'class'
}
}
name = (ns ? ns + '.' : '') + name
let url
switch (kind) {
case 'union':
url = `https://core.telegram.org/type/${name}`
break
case 'method':
url = `https://core.telegram.org/method/${name}`
break
case 'class':
url = `https://core.telegram.org/constructor/${name}`
break
}
return {
target: url,
caption: symbol,
}
}
})
}
module.exports = { load }

19
typedoc.base.cjs Normal file
View file

@ -0,0 +1,19 @@
module.exports = {
includeVersion: true,
validation: {
notExported: true,
invalidLink: false,
notDocumented: false,
},
excludePrivate: true,
excludeExternals: true,
excludeInternal: true,
exclude: [
'**/*/dist',
'**/*/node_modules',
'./packages/tl/**/*',
],
plugin: [
'./scripts/typedoc-external-links.cjs',
],
}

14
typedoc.cjs Normal file
View file

@ -0,0 +1,14 @@
const fs = require('fs')
const path = require('path')
module.exports = {
...require('./typedoc.base.cjs'),
name: 'mtcute',
out: './docs',
entryPoints: fs
.readdirSync(path.join(__dirname, 'packages'))
.filter((it) => !['crypto', 'tl', 'create-bot'].includes(it))
.map((it) => `packages/${it}`),
entryPointStrategy: 'packages',
// logLevel: 'Verbose',
}

View file

@ -1,16 +0,0 @@
const path = require('path')
module.exports = {
includeVersion: true,
validation: {
notExported: true,
invalidLink: true,
notDocumented: true,
},
excludePrivate: true,
excludeExternals: true,
exclude: ['**/*/dist', '**/*/node_modules'],
plugin: [
path.join(__dirname, 'scripts/totally-great-typedoc-plugin.js'),
],
}