tl: updated to layer 140
This commit is contained in:
parent
2289cc690d
commit
a1ea1315df
13 changed files with 70 additions and 25 deletions
|
@ -14,7 +14,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/long": "^4.0.1",
|
"@types/long": "^4.0.1",
|
||||||
"@types/node": "^15.12.1",
|
"@types/node": "^15.12.1",
|
||||||
"@mtcute/tl": "workspace:139.0",
|
"@mtcute/tl": "workspace:140.0.0",
|
||||||
"@mtcute/core": "workspace:^1.0.0",
|
"@mtcute/core": "workspace:^1.0.0",
|
||||||
"@mtcute/file-id": "workspace:^1.0.0",
|
"@mtcute/file-id": "workspace:^1.0.0",
|
||||||
"eager-async-pool": "^1.0.0",
|
"eager-async-pool": "^1.0.0",
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/node": "^15.12.1",
|
"@types/node": "^15.12.1",
|
||||||
"@types/events": "^3.0.0",
|
"@types/events": "^3.0.0",
|
||||||
"@mtcute/tl": "workspace:139.0",
|
"@mtcute/tl": "workspace:140.0.0",
|
||||||
"@mtcute/tl-runtime": "workspace:^1.0.0",
|
"@mtcute/tl-runtime": "workspace:^1.0.0",
|
||||||
"big-integer": "1.6.48",
|
"big-integer": "1.6.48",
|
||||||
"long": "^4.0.0",
|
"long": "^4.0.0",
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
"build": "tsc"
|
"build": "tsc"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@mtcute/tl": "workspace:139.0",
|
"@mtcute/tl": "workspace:140.0.0",
|
||||||
"@mtcute/core": "workspace:^1.0.0",
|
"@mtcute/core": "workspace:^1.0.0",
|
||||||
"@mtcute/client": "workspace:^1.0.0",
|
"@mtcute/client": "workspace:^1.0.0",
|
||||||
"events": "^3.2.0"
|
"events": "^3.2.0"
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
"build": "tsc"
|
"build": "tsc"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@mtcute/tl": "workspace:139.0",
|
"@mtcute/tl": "workspace:140.0.0",
|
||||||
"@mtcute/tl-runtime": "workspace:^1.0.0",
|
"@mtcute/tl-runtime": "workspace:^1.0.0",
|
||||||
"@mtcute/core": "workspace:^1.0.0",
|
"@mtcute/core": "workspace:^1.0.0",
|
||||||
"long": "^4.0.0"
|
"long": "^4.0.0"
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
"docs": "npx typedoc"
|
"docs": "npx typedoc"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@mtcute/tl": "workspace:~139.0",
|
"@mtcute/tl": "workspace:140.0.0",
|
||||||
"htmlparser2": "^6.0.1",
|
"htmlparser2": "^6.0.1",
|
||||||
"long": "^4.0.0"
|
"long": "^4.0.0"
|
||||||
},
|
},
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
"docs": "npx typedoc"
|
"docs": "npx typedoc"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@mtcute/tl": "workspace:139.0",
|
"@mtcute/tl": "workspace:140.0.0",
|
||||||
"long": "^4.0.0"
|
"long": "^4.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
> TL schema and related utils used for MTCute.
|
> TL schema and related utils used for MTCute.
|
||||||
|
|
||||||
Generated from TL layer **139** (last updated on 23.03.2022).
|
Generated from TL layer **140** (last updated on 28.04.2022).
|
||||||
|
|
||||||
## About
|
## About
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -6,6 +6,7 @@
|
||||||
"When contributing, please maintain alphabetical key ordering"
|
"When contributing, please maintain alphabetical key ordering"
|
||||||
],
|
],
|
||||||
"class": {
|
"class": {
|
||||||
|
"attachMenuBot": ["bot_id"],
|
||||||
"botInfo": ["user_id"],
|
"botInfo": ["user_id"],
|
||||||
"channel": ["id"],
|
"channel": ["id"],
|
||||||
"channelAdminLogEvent": ["user_id"],
|
"channelAdminLogEvent": ["user_id"],
|
||||||
|
@ -85,6 +86,7 @@
|
||||||
"updateBotCommands": ["bot_id"],
|
"updateBotCommands": ["bot_id"],
|
||||||
"updateBotInlineQuery": ["user_id"],
|
"updateBotInlineQuery": ["user_id"],
|
||||||
"updateBotInlineSend": ["user_id"],
|
"updateBotInlineSend": ["user_id"],
|
||||||
|
"updateBotMenuButton": ["bot_id"],
|
||||||
"updateBotPrecheckoutQuery": ["user_id"],
|
"updateBotPrecheckoutQuery": ["user_id"],
|
||||||
"updateBotShippingQuery": ["user_id"],
|
"updateBotShippingQuery": ["user_id"],
|
||||||
"updateBotStopped": ["user_id"],
|
"updateBotStopped": ["user_id"],
|
||||||
|
@ -119,6 +121,7 @@
|
||||||
"updateUserPhoto": ["user_id"],
|
"updateUserPhoto": ["user_id"],
|
||||||
"updateUserStatus": ["user_id"],
|
"updateUserStatus": ["user_id"],
|
||||||
"updateUserTyping": ["user_id"],
|
"updateUserTyping": ["user_id"],
|
||||||
|
"updateWebViewResultSent": ["bot_id"],
|
||||||
"user": ["id"],
|
"user": ["id"],
|
||||||
"userEmpty": ["id"],
|
"userEmpty": ["id"],
|
||||||
"userFull": ["id"],
|
"userFull": ["id"],
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@mtcute/tl",
|
"name": "@mtcute/tl",
|
||||||
"version": "139.0.0",
|
"version": "140.0.0",
|
||||||
"description": "TL schema used for MTCute",
|
"description": "TL schema used for MTCute",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"author": "Alisa Sireneva <me@tei.su>",
|
"author": "Alisa Sireneva <me@tei.su>",
|
||||||
|
|
|
@ -261,7 +261,7 @@ export async function getCachedDocumentation(): Promise<CachedDocumentation | nu
|
||||||
try {
|
try {
|
||||||
const file = await readFile(DOC_CACHE_FILE, 'utf8')
|
const file = await readFile(DOC_CACHE_FILE, 'utf8')
|
||||||
return JSON.parse(file)
|
return JSON.parse(file)
|
||||||
} catch (e) {
|
} catch (e: any) {
|
||||||
if (e.code === 'ENOENT') {
|
if (e.code === 'ENOENT') {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,14 +8,18 @@ import { parseTlToEntries } from '@mtcute/tl-utils/src/parse'
|
||||||
import { parseFullTlSchema } from '@mtcute/tl-utils/src/schema'
|
import { parseFullTlSchema } from '@mtcute/tl-utils/src/schema'
|
||||||
import { mergeTlEntries, mergeTlSchemas } from '@mtcute/tl-utils/src/merge'
|
import { mergeTlEntries, mergeTlSchemas } from '@mtcute/tl-utils/src/merge'
|
||||||
import { TlEntry, TlFullSchema } from '@mtcute/tl-utils/src/types'
|
import { TlEntry, TlFullSchema } from '@mtcute/tl-utils/src/types'
|
||||||
import { readFile, writeFile } from 'fs/promises'
|
import { readdir, readFile, writeFile } from 'fs/promises'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
import cheerio from 'cheerio'
|
import cheerio from 'cheerio'
|
||||||
import fetch from 'node-fetch'
|
import fetch from 'node-fetch'
|
||||||
import readline from 'readline'
|
import readline from 'readline'
|
||||||
import { writeTlEntryToString } from '@mtcute/tl-utils/src/stringify'
|
import { writeTlEntryToString } from '@mtcute/tl-utils/src/stringify'
|
||||||
import {
|
import {
|
||||||
CORE_DOMAIN, API_SCHEMA_JSON_FILE, TDESKTOP_SCHEMA, TDLIB_SCHEMA, COREFORK_DOMAIN
|
CORE_DOMAIN,
|
||||||
|
API_SCHEMA_JSON_FILE,
|
||||||
|
TDESKTOP_SCHEMA,
|
||||||
|
TDLIB_SCHEMA,
|
||||||
|
COREFORK_DOMAIN,
|
||||||
} from './constants'
|
} from './constants'
|
||||||
import { fetchRetry } from './utils'
|
import { fetchRetry } from './utils'
|
||||||
import {
|
import {
|
||||||
|
@ -27,6 +31,7 @@ import { packTlSchema } from './schema'
|
||||||
|
|
||||||
const README_MD_FILE = join(__dirname, '../README.md')
|
const README_MD_FILE = join(__dirname, '../README.md')
|
||||||
const PACKAGE_JSON_FILE = join(__dirname, '../package.json')
|
const PACKAGE_JSON_FILE = join(__dirname, '../package.json')
|
||||||
|
const PACKAGES_DIR = join(__dirname, '../../')
|
||||||
|
|
||||||
function tlToFullSchema(tl: string): TlFullSchema {
|
function tlToFullSchema(tl: string): TlFullSchema {
|
||||||
return parseFullTlSchema(parseTlToEntries(tl))
|
return parseFullTlSchema(parseTlToEntries(tl))
|
||||||
|
@ -66,7 +71,10 @@ async function fetchTdesktopSchema(): Promise<Schema> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchCoreSchema(domain = CORE_DOMAIN, name = 'Core'): Promise<Schema> {
|
async function fetchCoreSchema(
|
||||||
|
domain = CORE_DOMAIN,
|
||||||
|
name = 'Core'
|
||||||
|
): Promise<Schema> {
|
||||||
const html = await fetchRetry(`${domain}/schema`)
|
const html = await fetchRetry(`${domain}/schema`)
|
||||||
const $ = cheerio.load(html)
|
const $ = cheerio.load(html)
|
||||||
// cheerio doesn't always unescape them
|
// cheerio doesn't always unescape them
|
||||||
|
@ -115,9 +123,7 @@ async function updatePackageVersion(
|
||||||
) {
|
) {
|
||||||
const packageJson = JSON.parse(await readFile(PACKAGE_JSON_FILE, 'utf8'))
|
const packageJson = JSON.parse(await readFile(PACKAGE_JSON_FILE, 'utf8'))
|
||||||
const version: string = packageJson.version
|
const version: string = packageJson.version
|
||||||
let [major, minor, patch] = version.split('.').map((i) => parseInt(i))
|
let [major, minor] = version.split('.').map((i) => parseInt(i))
|
||||||
|
|
||||||
patch = 0
|
|
||||||
|
|
||||||
if (major === currentLayer) {
|
if (major === currentLayer) {
|
||||||
console.log('Current version: %s. Bump minor version?', version)
|
console.log('Current version: %s. Bump minor version?', version)
|
||||||
|
@ -132,8 +138,40 @@ async function updatePackageVersion(
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('Updating package version...')
|
console.log('Updating package version...')
|
||||||
packageJson.version = `${major}.${minor}.${patch}`
|
const versionStr = `${major}.${minor}.0`
|
||||||
|
packageJson.version = versionStr
|
||||||
await writeFile(PACKAGE_JSON_FILE, JSON.stringify(packageJson, null, 4))
|
await writeFile(PACKAGE_JSON_FILE, JSON.stringify(packageJson, null, 4))
|
||||||
|
|
||||||
|
console.log('Updating dependant packages...')
|
||||||
|
|
||||||
|
for (const dir of await readdir(PACKAGES_DIR, { withFileTypes: true })) {
|
||||||
|
if (!dir.isDirectory()) continue
|
||||||
|
|
||||||
|
const pkgFile = join(PACKAGES_DIR, dir.name, 'package.json')
|
||||||
|
|
||||||
|
let pkg
|
||||||
|
try {
|
||||||
|
pkg = JSON.parse(await readFile(pkgFile, 'utf8'))
|
||||||
|
} catch (e: any) {
|
||||||
|
if (e.code === 'ENOENT') continue
|
||||||
|
throw e
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pkg.dependencies && '@mtcute/tl' in pkg.dependencies) {
|
||||||
|
pkg.dependencies['@mtcute/tl'] = 'workspace:' + versionStr
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pkg.devDependencies && '@mtcute/tl' in pkg.devDependencies) {
|
||||||
|
pkg.devDependencies['@mtcute/tl'] = 'workspace:' + versionStr
|
||||||
|
}
|
||||||
|
|
||||||
|
await writeFile(pkgFile, JSON.stringify(pkg, null, 4) + '\n')
|
||||||
|
}
|
||||||
|
|
||||||
|
// because i am fucking dumb and have adhd and always forget it lol
|
||||||
|
console.log(
|
||||||
|
'Done! Please make sure packages compile before committing and pushing'
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function overrideInt53(schema: TlFullSchema): Promise<void> {
|
async function overrideInt53(schema: TlFullSchema): Promise<void> {
|
||||||
|
@ -150,7 +188,9 @@ async function overrideInt53(schema: TlFullSchema): Promise<void> {
|
||||||
overrides.forEach((argName) => {
|
overrides.forEach((argName) => {
|
||||||
const arg = entry.arguments.find((it) => it.name === argName)
|
const arg = entry.arguments.find((it) => it.name === argName)
|
||||||
if (!arg) {
|
if (!arg) {
|
||||||
console.log(`[warn] Cannot override ${entry.name}#${argName}: argument does not exist`)
|
console.log(
|
||||||
|
`[warn] Cannot override ${entry.name}#${argName}: argument does not exist`
|
||||||
|
)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,7 +199,9 @@ async function overrideInt53(schema: TlFullSchema): Promise<void> {
|
||||||
} else if (arg.type.toLowerCase() === 'vector<long>') {
|
} else if (arg.type.toLowerCase() === 'vector<long>') {
|
||||||
arg.type = 'vector<int53>'
|
arg.type = 'vector<int53>'
|
||||||
} else {
|
} else {
|
||||||
console.log(`[warn] Cannot override ${entry.name}#${argName}: argument is not long (${arg.type})`)
|
console.log(
|
||||||
|
`[warn] Cannot override ${entry.name}#${argName}: argument is not long (${arg.type})`
|
||||||
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -51,7 +51,7 @@ importers:
|
||||||
specifiers:
|
specifiers:
|
||||||
'@mtcute/core': workspace:^1.0.0
|
'@mtcute/core': workspace:^1.0.0
|
||||||
'@mtcute/file-id': workspace:^1.0.0
|
'@mtcute/file-id': workspace:^1.0.0
|
||||||
'@mtcute/tl': workspace:139.0
|
'@mtcute/tl': workspace:140.0.0
|
||||||
'@types/long': ^4.0.1
|
'@types/long': ^4.0.1
|
||||||
'@types/node': ^15.12.1
|
'@types/node': ^15.12.1
|
||||||
eager-async-pool: ^1.0.0
|
eager-async-pool: ^1.0.0
|
||||||
|
@ -69,7 +69,7 @@ importers:
|
||||||
|
|
||||||
packages/core:
|
packages/core:
|
||||||
specifiers:
|
specifiers:
|
||||||
'@mtcute/tl': workspace:139.0
|
'@mtcute/tl': workspace:140.0.0
|
||||||
'@mtcute/tl-runtime': workspace:^1.0.0
|
'@mtcute/tl-runtime': workspace:^1.0.0
|
||||||
'@types/events': ^3.0.0
|
'@types/events': ^3.0.0
|
||||||
'@types/node': ^15.12.1
|
'@types/node': ^15.12.1
|
||||||
|
@ -103,7 +103,7 @@ importers:
|
||||||
specifiers:
|
specifiers:
|
||||||
'@mtcute/client': workspace:^1.0.0
|
'@mtcute/client': workspace:^1.0.0
|
||||||
'@mtcute/core': workspace:^1.0.0
|
'@mtcute/core': workspace:^1.0.0
|
||||||
'@mtcute/tl': workspace:139.0
|
'@mtcute/tl': workspace:140.0.0
|
||||||
events: ^3.2.0
|
events: ^3.2.0
|
||||||
dependencies:
|
dependencies:
|
||||||
'@mtcute/client': link:../client
|
'@mtcute/client': link:../client
|
||||||
|
@ -114,7 +114,7 @@ importers:
|
||||||
packages/file-id:
|
packages/file-id:
|
||||||
specifiers:
|
specifiers:
|
||||||
'@mtcute/core': workspace:^1.0.0
|
'@mtcute/core': workspace:^1.0.0
|
||||||
'@mtcute/tl': workspace:139.0
|
'@mtcute/tl': workspace:140.0.0
|
||||||
'@mtcute/tl-runtime': workspace:^1.0.0
|
'@mtcute/tl-runtime': workspace:^1.0.0
|
||||||
'@types/long': ^4.0.1
|
'@types/long': ^4.0.1
|
||||||
long: ^4.0.0
|
long: ^4.0.0
|
||||||
|
@ -129,7 +129,7 @@ importers:
|
||||||
packages/html-parser:
|
packages/html-parser:
|
||||||
specifiers:
|
specifiers:
|
||||||
'@mtcute/client': ^1.0.0
|
'@mtcute/client': ^1.0.0
|
||||||
'@mtcute/tl': workspace:~139.0
|
'@mtcute/tl': workspace:140.0.0
|
||||||
'@types/long': ^4.0.1
|
'@types/long': ^4.0.1
|
||||||
htmlparser2: ^6.0.1
|
htmlparser2: ^6.0.1
|
||||||
long: ^4.0.0
|
long: ^4.0.0
|
||||||
|
@ -150,7 +150,7 @@ importers:
|
||||||
packages/markdown-parser:
|
packages/markdown-parser:
|
||||||
specifiers:
|
specifiers:
|
||||||
'@mtcute/client': workspace:^1.0.0
|
'@mtcute/client': workspace:^1.0.0
|
||||||
'@mtcute/tl': workspace:139.0
|
'@mtcute/tl': workspace:140.0.0
|
||||||
'@types/long': ^4.0.1
|
'@types/long': ^4.0.1
|
||||||
long: ^4.0.0
|
long: ^4.0.0
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|
Loading…
Reference in a new issue