feat(tl): updated to 164 layer
This commit is contained in:
parent
6279126439
commit
dbcd3f0911
13 changed files with 38 additions and 29 deletions
|
@ -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",
|
||||
|
|
|
@ -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"
|
||||
},
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
"docs": "typedoc"
|
||||
},
|
||||
"dependencies": {
|
||||
"@mtcute/tl": "workspace:^160.0.0",
|
||||
"@mtcute/tl": "workspace:^164.0.0",
|
||||
"long": "5.2.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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):
|
|||
}
|
||||
}
|
||||
|
||||
if (forIdComputation) {
|
||||
str += '= ' + normalizeType(entry.type)
|
||||
} else {
|
||||
const type = entry.typeModifiers ? stringifyArgumentType(entry.type, entry.typeModifiers) : entry.type
|
||||
|
||||
if (forIdComputation) {
|
||||
str += '= ' + normalizeType(type)
|
||||
} else {
|
||||
str += '= ' + type + ';'
|
||||
}
|
||||
|
||||
|
|
|
@ -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', () => {
|
||||
|
|
|
@ -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
|
@ -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>",
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -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) {
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"paths": {
|
||||
"~scripts/*": ["../../scripts/*"],
|
||||
},
|
||||
},
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": [
|
||||
"./index.d.ts",
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue