build: fixed build for client and dispatcher packages
This commit is contained in:
parent
bbd738f572
commit
443786a35b
4 changed files with 84 additions and 30 deletions
|
@ -443,7 +443,7 @@ on(name: '${type.typeName}', handler: ((upd: ${type.updateType}) => void)): this
|
||||||
)
|
)
|
||||||
|
|
||||||
for (const name of [origName, ...aliases]) {
|
for (const name of [origName, ...aliases]) {
|
||||||
if (!isPrivate && !hasOverloads) {
|
if (!hasOverloads) {
|
||||||
if (!comment.match(/\/\*\*?\s*\*\//))
|
if (!comment.match(/\/\*\*?\s*\*\//))
|
||||||
// empty comment, no need to write it
|
// empty comment, no need to write it
|
||||||
output.write(comment + '\n')
|
output.write(comment + '\n')
|
||||||
|
@ -455,7 +455,7 @@ on(name: '${type.typeName}', handler: ((upd: ${type.updateType}) => void)): this
|
||||||
|
|
||||||
if (!overload) {
|
if (!overload) {
|
||||||
classContents.push(
|
classContents.push(
|
||||||
`${isPrivate ? 'protected ' : ''}${name} = ${origName}`
|
`${name} = ${origName}`
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -934,6 +934,10 @@ export interface TelegramClient extends BaseTelegramClient {
|
||||||
*/
|
*/
|
||||||
langCode?: string
|
langCode?: string
|
||||||
}): Promise<tl.RawBotCommand[]>
|
}): Promise<tl.RawBotCommand[]>
|
||||||
|
|
||||||
|
_normalizeCommandScope(
|
||||||
|
scope: tl.TypeBotCommandScope | BotCommands.IntermediateScope
|
||||||
|
): Promise<tl.TypeBotCommandScope>
|
||||||
/**
|
/**
|
||||||
* Sets a menu button for the given user.
|
* Sets a menu button for the given user.
|
||||||
*
|
*
|
||||||
|
@ -1597,6 +1601,8 @@ export interface TelegramClient extends BaseTelegramClient {
|
||||||
importContacts(
|
importContacts(
|
||||||
contacts: PartialOnly<Omit<tl.RawInputPhoneContact, '_'>, 'clientId'>[]
|
contacts: PartialOnly<Omit<tl.RawInputPhoneContact, '_'>, 'clientId'>[]
|
||||||
): Promise<tl.contacts.RawImportedContacts>
|
): Promise<tl.contacts.RawImportedContacts>
|
||||||
|
|
||||||
|
_pushConversationMessage(msg: Message, incoming?: boolean): void
|
||||||
/**
|
/**
|
||||||
* Create a folder from given parameters
|
* Create a folder from given parameters
|
||||||
*
|
*
|
||||||
|
@ -1766,6 +1772,10 @@ export interface TelegramClient extends BaseTelegramClient {
|
||||||
* @param peers Peers for which to fetch dialogs.
|
* @param peers Peers for which to fetch dialogs.
|
||||||
*/
|
*/
|
||||||
getPeerDialogs(peers: InputPeerLike[]): Promise<Dialog[]>
|
getPeerDialogs(peers: InputPeerLike[]): Promise<Dialog[]>
|
||||||
|
|
||||||
|
_parseDialogs(
|
||||||
|
res: tl.messages.TypeDialogs | tl.messages.TypePeerDialogs
|
||||||
|
): Dialog[]
|
||||||
/**
|
/**
|
||||||
* Reorder folders
|
* Reorder folders
|
||||||
*
|
*
|
||||||
|
@ -1810,6 +1820,12 @@ export interface TelegramClient extends BaseTelegramClient {
|
||||||
* @param params File download parameters
|
* @param params File download parameters
|
||||||
*/
|
*/
|
||||||
downloadAsStream(params: FileDownloadParameters): Readable
|
downloadAsStream(params: FileDownloadParameters): Readable
|
||||||
|
_normalizeFileToDocument(
|
||||||
|
file: InputFileLike | tl.TypeInputDocument,
|
||||||
|
params: {
|
||||||
|
progressCallback?: (uploaded: number, total: number) => void
|
||||||
|
}
|
||||||
|
): Promise<tl.TypeInputDocument>
|
||||||
/**
|
/**
|
||||||
* Normalize a {@link InputFileLike} to `InputFile`,
|
* Normalize a {@link InputFileLike} to `InputFile`,
|
||||||
* uploading it if needed.
|
* uploading it if needed.
|
||||||
|
@ -2274,6 +2290,8 @@ export interface TelegramClient extends BaseTelegramClient {
|
||||||
progressCallback?: (uploaded: number, total: number) => void
|
progressCallback?: (uploaded: number, total: number) => void
|
||||||
}
|
}
|
||||||
): Promise<Message>
|
): Promise<Message>
|
||||||
|
|
||||||
|
_findMessageInUpdate(res: tl.TypeUpdates, isEdit?: boolean): Message
|
||||||
/**
|
/**
|
||||||
* Forward a single message.
|
* Forward a single message.
|
||||||
*
|
*
|
||||||
|
@ -2459,6 +2477,11 @@ export interface TelegramClient extends BaseTelegramClient {
|
||||||
forbidForwards?: boolean
|
forbidForwards?: boolean
|
||||||
}
|
}
|
||||||
): Promise<MaybeArray<Message>>
|
): Promise<MaybeArray<Message>>
|
||||||
|
|
||||||
|
_getDiscussionMessage(
|
||||||
|
peer: InputPeerLike,
|
||||||
|
message: number
|
||||||
|
): Promise<[tl.TypeInputPeer, number]>
|
||||||
// public version of the same method because why not
|
// public version of the same method because why not
|
||||||
/**
|
/**
|
||||||
* Get discussion message for some channel post.
|
* Get discussion message for some channel post.
|
||||||
|
@ -2707,6 +2730,16 @@ export interface TelegramClient extends BaseTelegramClient {
|
||||||
chatId: InputPeerLike,
|
chatId: InputPeerLike,
|
||||||
messageIds: number[]
|
messageIds: number[]
|
||||||
): Promise<(Message | null)[]>
|
): Promise<(Message | null)[]>
|
||||||
|
|
||||||
|
_normalizeInline(
|
||||||
|
id: string | tl.TypeInputBotInlineMessageID
|
||||||
|
): Promise<[tl.TypeInputBotInlineMessageID, SessionConnection]>
|
||||||
|
|
||||||
|
_parseEntities(
|
||||||
|
text?: string | FormattedString<any>,
|
||||||
|
mode?: string | null,
|
||||||
|
entities?: tl.TypeMessageEntity[]
|
||||||
|
): Promise<[string, tl.TypeMessageEntity[] | undefined]>
|
||||||
/**
|
/**
|
||||||
* Pin a message in a group, supergroup, channel or PM.
|
* Pin a message in a group, supergroup, channel or PM.
|
||||||
*
|
*
|
||||||
|
@ -3723,6 +3756,13 @@ export interface TelegramClient extends BaseTelegramClient {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
getCurrentRpsProcessing(): number
|
getCurrentRpsProcessing(): number
|
||||||
|
/**
|
||||||
|
* Fetch updates state from the server.
|
||||||
|
* Meant to be used right after authorization,
|
||||||
|
* but before force-saving the session.
|
||||||
|
*/
|
||||||
|
_fetchUpdatesState(): Promise<void>
|
||||||
|
_loadStorage(): Promise<void>
|
||||||
/**
|
/**
|
||||||
* **ADVANCED**
|
* **ADVANCED**
|
||||||
*
|
*
|
||||||
|
@ -3737,12 +3777,25 @@ export interface TelegramClient extends BaseTelegramClient {
|
||||||
* Usually done automatically when stopping the client with {@link close}
|
* Usually done automatically when stopping the client with {@link close}
|
||||||
*/
|
*/
|
||||||
stopUpdatesLoop(): void
|
stopUpdatesLoop(): void
|
||||||
|
|
||||||
|
_onStop(): void
|
||||||
|
_saveStorage(afterImport?: boolean): Promise<void>
|
||||||
|
_dispatchUpdate(
|
||||||
|
update: tl.TypeUpdate | tl.TypeMessage,
|
||||||
|
peers: PeersIndex
|
||||||
|
): void
|
||||||
_handleUpdate(update: tl.TypeUpdates, noDispatch?: boolean): void
|
_handleUpdate(update: tl.TypeUpdates, noDispatch?: boolean): void
|
||||||
/**
|
/**
|
||||||
* Catch up with the server by loading missed updates.
|
* Catch up with the server by loading missed updates.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
catchUp(): void
|
catchUp(): void
|
||||||
|
// todo: updateChannelTooLong with catchUpChannels disabled should not trigger getDifference (?)
|
||||||
|
// todo: when min peer or similar use pts_before as base pts for channels
|
||||||
|
|
||||||
|
_updatesLoop(): Promise<void>
|
||||||
|
|
||||||
|
_keepAliveAction(): void
|
||||||
/**
|
/**
|
||||||
* Block a user
|
* Block a user
|
||||||
*
|
*
|
||||||
|
@ -4053,7 +4106,7 @@ export class TelegramClient extends BaseTelegramClient {
|
||||||
getGameHighScores = getGameHighScores
|
getGameHighScores = getGameHighScores
|
||||||
getInlineGameHighScores = getInlineGameHighScores
|
getInlineGameHighScores = getInlineGameHighScores
|
||||||
getMyCommands = getMyCommands
|
getMyCommands = getMyCommands
|
||||||
protected _normalizeCommandScope = _normalizeCommandScope
|
_normalizeCommandScope = _normalizeCommandScope
|
||||||
setBotMenuButton = setBotMenuButton
|
setBotMenuButton = setBotMenuButton
|
||||||
setGameScore = setGameScore
|
setGameScore = setGameScore
|
||||||
setInlineGameScore = setInlineGameScore
|
setInlineGameScore = setInlineGameScore
|
||||||
|
@ -4099,7 +4152,7 @@ export class TelegramClient extends BaseTelegramClient {
|
||||||
deleteContacts = deleteContacts
|
deleteContacts = deleteContacts
|
||||||
getContacts = getContacts
|
getContacts = getContacts
|
||||||
importContacts = importContacts
|
importContacts = importContacts
|
||||||
protected _pushConversationMessage = _pushConversationMessage
|
_pushConversationMessage = _pushConversationMessage
|
||||||
createFolder = createFolder
|
createFolder = createFolder
|
||||||
deleteFolder = deleteFolder
|
deleteFolder = deleteFolder
|
||||||
editFolder = editFolder
|
editFolder = editFolder
|
||||||
|
@ -4107,13 +4160,13 @@ export class TelegramClient extends BaseTelegramClient {
|
||||||
getDialogs = getDialogs
|
getDialogs = getDialogs
|
||||||
getFolders = getFolders
|
getFolders = getFolders
|
||||||
getPeerDialogs = getPeerDialogs
|
getPeerDialogs = getPeerDialogs
|
||||||
protected _parseDialogs = _parseDialogs
|
_parseDialogs = _parseDialogs
|
||||||
setFoldersOrder = setFoldersOrder
|
setFoldersOrder = setFoldersOrder
|
||||||
downloadAsBuffer = downloadAsBuffer
|
downloadAsBuffer = downloadAsBuffer
|
||||||
downloadToFile = downloadToFile
|
downloadToFile = downloadToFile
|
||||||
downloadAsIterable = downloadAsIterable
|
downloadAsIterable = downloadAsIterable
|
||||||
downloadAsStream = downloadAsStream
|
downloadAsStream = downloadAsStream
|
||||||
protected _normalizeFileToDocument = _normalizeFileToDocument
|
_normalizeFileToDocument = _normalizeFileToDocument
|
||||||
_normalizeInputFile = _normalizeInputFile
|
_normalizeInputFile = _normalizeInputFile
|
||||||
_normalizeInputMedia = _normalizeInputMedia
|
_normalizeInputMedia = _normalizeInputMedia
|
||||||
uploadFile = uploadFile
|
uploadFile = uploadFile
|
||||||
|
@ -4133,9 +4186,9 @@ export class TelegramClient extends BaseTelegramClient {
|
||||||
deleteScheduledMessages = deleteScheduledMessages
|
deleteScheduledMessages = deleteScheduledMessages
|
||||||
editInlineMessage = editInlineMessage
|
editInlineMessage = editInlineMessage
|
||||||
editMessage = editMessage
|
editMessage = editMessage
|
||||||
protected _findMessageInUpdate = _findMessageInUpdate
|
_findMessageInUpdate = _findMessageInUpdate
|
||||||
forwardMessages = forwardMessages
|
forwardMessages = forwardMessages
|
||||||
protected _getDiscussionMessage = _getDiscussionMessage
|
_getDiscussionMessage = _getDiscussionMessage
|
||||||
getDiscussionMessage = getDiscussionMessage
|
getDiscussionMessage = getDiscussionMessage
|
||||||
getHistory = getHistory
|
getHistory = getHistory
|
||||||
getMessageGroup = getMessageGroup
|
getMessageGroup = getMessageGroup
|
||||||
|
@ -4144,8 +4197,8 @@ export class TelegramClient extends BaseTelegramClient {
|
||||||
getMessages = getMessages
|
getMessages = getMessages
|
||||||
getReactionUsers = getReactionUsers
|
getReactionUsers = getReactionUsers
|
||||||
getScheduledMessages = getScheduledMessages
|
getScheduledMessages = getScheduledMessages
|
||||||
protected _normalizeInline = _normalizeInline
|
_normalizeInline = _normalizeInline
|
||||||
protected _parseEntities = _parseEntities
|
_parseEntities = _parseEntities
|
||||||
pinMessage = pinMessage
|
pinMessage = pinMessage
|
||||||
readHistory = readHistory
|
readHistory = readHistory
|
||||||
readReactions = readReactions
|
readReactions = readReactions
|
||||||
|
@ -4185,17 +4238,17 @@ export class TelegramClient extends BaseTelegramClient {
|
||||||
enableRps = enableRps
|
enableRps = enableRps
|
||||||
getCurrentRpsIncoming = getCurrentRpsIncoming
|
getCurrentRpsIncoming = getCurrentRpsIncoming
|
||||||
getCurrentRpsProcessing = getCurrentRpsProcessing
|
getCurrentRpsProcessing = getCurrentRpsProcessing
|
||||||
protected _fetchUpdatesState = _fetchUpdatesState
|
_fetchUpdatesState = _fetchUpdatesState
|
||||||
protected _loadStorage = _loadStorage
|
_loadStorage = _loadStorage
|
||||||
startUpdatesLoop = startUpdatesLoop
|
startUpdatesLoop = startUpdatesLoop
|
||||||
stopUpdatesLoop = stopUpdatesLoop
|
stopUpdatesLoop = stopUpdatesLoop
|
||||||
protected _onStop = _onStop
|
_onStop = _onStop
|
||||||
protected _saveStorage = _saveStorage
|
_saveStorage = _saveStorage
|
||||||
protected _dispatchUpdate = _dispatchUpdate
|
_dispatchUpdate = _dispatchUpdate
|
||||||
_handleUpdate = _handleUpdate
|
_handleUpdate = _handleUpdate
|
||||||
catchUp = catchUp
|
catchUp = catchUp
|
||||||
protected _updatesLoop = _updatesLoop
|
_updatesLoop = _updatesLoop
|
||||||
protected _keepAliveAction = _keepAliveAction
|
_keepAliveAction = _keepAliveAction
|
||||||
blockUser = blockUser
|
blockUser = blockUser
|
||||||
deleteProfilePhotos = deleteProfilePhotos
|
deleteProfilePhotos = deleteProfilePhotos
|
||||||
getCommonChats = getCommonChats
|
getCommonChats = getCommonChats
|
||||||
|
|
|
@ -6,3 +6,4 @@
|
||||||
"include": [
|
"include": [
|
||||||
"./src"
|
"./src"
|
||||||
]
|
]
|
||||||
|
}
|
||||||
|
|
|
@ -76,19 +76,19 @@ function publishSinglePackage(name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name === 'client') {
|
if (name === 'client') {
|
||||||
// make TelegramClient a class, not an interface
|
// // make TelegramClient a class, not an interface
|
||||||
const dTsContent = fs.readFileSync(
|
// const dTsContent = fs.readFileSync(
|
||||||
path.join(dir, 'dist/client.d.ts'),
|
// path.join(dir, 'dist/client.d.ts'),
|
||||||
'utf8'
|
// 'utf8'
|
||||||
)
|
// )
|
||||||
|
//
|
||||||
fs.writeFileSync(
|
// fs.writeFileSync(
|
||||||
path.join(dir, 'dist/client.d.ts'),
|
// path.join(dir, 'dist/client.d.ts'),
|
||||||
dTsContent.replace(
|
// dTsContent.replace(
|
||||||
'export interface TelegramClient',
|
// 'export interface TelegramClient',
|
||||||
'export class TelegramClient'
|
// 'export class TelegramClient'
|
||||||
)
|
// )
|
||||||
)
|
// )
|
||||||
|
|
||||||
// make methods prototype methods, not properties
|
// make methods prototype methods, not properties
|
||||||
let jsContent = fs.readFileSync(
|
let jsContent = fs.readFileSync(
|
||||||
|
|
Loading…
Reference in a new issue