feat(tl): updated to 164 layer

This commit is contained in:
alina 🌸 2023-09-24 19:56:13 +03:00
parent 6279126439
commit dbcd3f0911
Signed by: teidesu
SSH key fingerprint: SHA256:uNeCpw6aTSU4aIObXLvHfLkDa82HWH9EiOj9AXOIRpI
13 changed files with 38 additions and 29 deletions

View file

@ -18,7 +18,7 @@
"./storage/json-file.js": false
},
"dependencies": {
"@mtcute/tl": "workspace:^160.0.0",
"@mtcute/tl": "workspace:^164.0.0",
"@mtcute/tl-runtime": "workspace:^1.0.0",
"@types/events": "3.0.0",
"@types/node": "18.16.0",
@ -32,4 +32,4 @@
"exit-hook": "^4.0.0",
"ws": "8.13.0"
}
}
}

View file

@ -13,7 +13,7 @@
"docs": "typedoc"
},
"dependencies": {
"@mtcute/tl": "workspace:^160.0.0",
"@mtcute/tl": "workspace:^164.0.0",
"htmlparser2": "^6.0.1",
"long": "5.2.3"
},

View file

@ -13,7 +13,7 @@
"docs": "typedoc"
},
"dependencies": {
"@mtcute/tl": "workspace:^160.0.0",
"@mtcute/tl": "workspace:^164.0.0",
"long": "5.2.3"
},
"devDependencies": {

View file

@ -53,14 +53,10 @@ export function mergeTlEntries(entries: TlEntry[]): TlEntry | string {
const ctorId = computeConstructorIdFromEntry(entry)
// check if basic fields match
if (
result.kind !== entry.kind ||
result.name !== entry.name ||
result.type !== entry.type ||
result.id !== ctorId
) {
return 'basic info mismatch'
}
if (result.kind !== entry.kind) return 'basic info mismatch - kind'
if (result.name !== entry.name) return 'basic info mismatch - name'
if (result.type !== entry.type) return 'basic info mismatch - type'
if (result.id !== ctorId) return 'basic info mismatch - id'
// since we re-calculated id manually, we can skip checking
// generics and arguments, and get straight to merging

View file

@ -3,7 +3,7 @@ import { stringifyArgumentType } from './utils'
function normalizeType(s: string): string {
return s
.replace(/^bytes/, 'string')
.replace(/(?<=^|\?)bytes/, 'string')
.replace(/</g, ' ')
.replace(/>/g, '')
.replace('int53', 'long')
@ -52,10 +52,11 @@ export function writeTlEntryToString(entry: TlEntry, forIdComputation = false):
}
}
const type = entry.typeModifiers ? stringifyArgumentType(entry.type, entry.typeModifiers) : entry.type
if (forIdComputation) {
str += '= ' + normalizeType(entry.type)
str += '= ' + normalizeType(type)
} else {
const type = entry.typeModifiers ? stringifyArgumentType(entry.type, entry.typeModifiers) : entry.type
str += '= ' + type + ';'
}

View file

@ -22,19 +22,19 @@ describe('mergeTlEntries', () => {
}
it('fails on conflicting kinds', () => {
test('test = Test;\n---functions---\ntest = Test;', 'basic info mismatch')
test('test = Test;\n---functions---\ntest = Test;', 'basic info mismatch - kind')
})
it('fails on conflicting names', () => {
test('test1 = Test;\ntest2 = Test;', 'basic info mismatch')
test('test1 = Test;\ntest2 = Test;', 'basic info mismatch - name')
})
it('fails on conflicting types', () => {
test('test = Test1;\ntest = Test2;', 'basic info mismatch')
test('test = Test1;\ntest = Test2;', 'basic info mismatch - type')
})
it('fails on conflicting ids', () => {
test('test = Test;\ntest foo:int = Test;', 'basic info mismatch')
test('test = Test;\ntest foo:int = Test;', 'basic info mismatch - id')
})
it('merges true flags', () => {

View file

@ -2,7 +2,7 @@
> TL schema and related utils used for mtcute.
Generated from TL layer **160** (last updated on 20.07.2023).
Generated from TL layer **164** (last updated on 24.09.2023).
## About

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,6 @@
{
"name": "@mtcute/tl",
"version": "160.0.0",
"version": "164.0.0",
"description": "TL schema used for mtcute",
"main": "index.js",
"author": "Alina Sireneva <alina@tei.su>",
@ -29,4 +29,4 @@
"typedoc": {
"entryPoint": "index.d.ts"
}
}
}

File diff suppressed because one or more lines are too long

View file

@ -220,6 +220,7 @@ async function main() {
}))
let chooseOptions: ConflictOption[] = []
let mergeError = ''
const customEntry = options[options.length - 1]
@ -240,15 +241,21 @@ async function main() {
if (typeof mergedEntry === 'string') {
// merge failed, so there is in fact some conflict
chooseOptions = fromLastSchema
mergeError = mergedEntry
} else return mergedEntry
}
const nonEmptyOptions = chooseOptions.filter(hasPresentKey('entry'))
console.log('Conflict detected at %s %s:', nonEmptyOptions[0].entry.kind, nonEmptyOptions[0].entry.name)
console.log(
'Conflict detected (%s) at %s %s:',
mergeError,
nonEmptyOptions[0].entry.kind,
nonEmptyOptions[0].entry.name,
)
console.log('0. Remove')
nonEmptyOptions.forEach((opt, idx) => {
console.log(`${idx + 1}. ${opt.schema.name}: ${writeTlEntryToString(opt.entry)}`)
console.log(`${idx + 1}. ${opt.schema.name}: (${opt.entry.kind}) ${writeTlEntryToString(opt.entry)}`)
})
while (true) {

View file

@ -1,4 +1,9 @@
{
"compilerOptions": {
"paths": {
"~scripts/*": ["../../scripts/*"],
},
},
"extends": "../../tsconfig.json",
"include": [
"./index.d.ts",

View file

@ -127,7 +127,7 @@ importers:
packages/core:
dependencies:
'@mtcute/tl':
specifier: workspace:^160.0.0
specifier: workspace:^164.0.0
version: link:../tl
'@mtcute/tl-runtime':
specifier: workspace:^1.0.0
@ -196,7 +196,7 @@ importers:
packages/html-parser:
dependencies:
'@mtcute/tl':
specifier: workspace:^160.0.0
specifier: workspace:^164.0.0
version: link:../tl
htmlparser2:
specifier: ^6.0.1
@ -224,7 +224,7 @@ importers:
packages/markdown-parser:
dependencies:
'@mtcute/tl':
specifier: workspace:^160.0.0
specifier: workspace:^164.0.0
version: link:../tl
long:
specifier: 5.2.3