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
|
"./storage/json-file.js": false
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@mtcute/tl": "workspace:^160.0.0",
|
"@mtcute/tl": "workspace:^164.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": "18.16.0",
|
"@types/node": "18.16.0",
|
||||||
|
@ -32,4 +32,4 @@
|
||||||
"exit-hook": "^4.0.0",
|
"exit-hook": "^4.0.0",
|
||||||
"ws": "8.13.0"
|
"ws": "8.13.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -13,7 +13,7 @@
|
||||||
"docs": "typedoc"
|
"docs": "typedoc"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@mtcute/tl": "workspace:^160.0.0",
|
"@mtcute/tl": "workspace:^164.0.0",
|
||||||
"htmlparser2": "^6.0.1",
|
"htmlparser2": "^6.0.1",
|
||||||
"long": "5.2.3"
|
"long": "5.2.3"
|
||||||
},
|
},
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
"docs": "typedoc"
|
"docs": "typedoc"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@mtcute/tl": "workspace:^160.0.0",
|
"@mtcute/tl": "workspace:^164.0.0",
|
||||||
"long": "5.2.3"
|
"long": "5.2.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
@ -53,14 +53,10 @@ export function mergeTlEntries(entries: TlEntry[]): TlEntry | string {
|
||||||
const ctorId = computeConstructorIdFromEntry(entry)
|
const ctorId = computeConstructorIdFromEntry(entry)
|
||||||
|
|
||||||
// check if basic fields match
|
// check if basic fields match
|
||||||
if (
|
if (result.kind !== entry.kind) return 'basic info mismatch - kind'
|
||||||
result.kind !== entry.kind ||
|
if (result.name !== entry.name) return 'basic info mismatch - name'
|
||||||
result.name !== entry.name ||
|
if (result.type !== entry.type) return 'basic info mismatch - type'
|
||||||
result.type !== entry.type ||
|
if (result.id !== ctorId) return 'basic info mismatch - id'
|
||||||
result.id !== ctorId
|
|
||||||
) {
|
|
||||||
return 'basic info mismatch'
|
|
||||||
}
|
|
||||||
|
|
||||||
// since we re-calculated id manually, we can skip checking
|
// since we re-calculated id manually, we can skip checking
|
||||||
// generics and arguments, and get straight to merging
|
// generics and arguments, and get straight to merging
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { stringifyArgumentType } from './utils'
|
||||||
|
|
||||||
function normalizeType(s: string): string {
|
function normalizeType(s: string): string {
|
||||||
return s
|
return s
|
||||||
.replace(/^bytes/, 'string')
|
.replace(/(?<=^|\?)bytes/, 'string')
|
||||||
.replace(/</g, ' ')
|
.replace(/</g, ' ')
|
||||||
.replace(/>/g, '')
|
.replace(/>/g, '')
|
||||||
.replace('int53', 'long')
|
.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) {
|
if (forIdComputation) {
|
||||||
str += '= ' + normalizeType(entry.type)
|
str += '= ' + normalizeType(type)
|
||||||
} else {
|
} else {
|
||||||
const type = entry.typeModifiers ? stringifyArgumentType(entry.type, entry.typeModifiers) : entry.type
|
|
||||||
str += '= ' + type + ';'
|
str += '= ' + type + ';'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,19 +22,19 @@ describe('mergeTlEntries', () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
it('fails on conflicting kinds', () => {
|
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', () => {
|
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', () => {
|
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', () => {
|
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', () => {
|
it('merges true flags', () => {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
> TL schema and related utils used for mtcute.
|
> 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
|
## About
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@mtcute/tl",
|
"name": "@mtcute/tl",
|
||||||
"version": "160.0.0",
|
"version": "164.0.0",
|
||||||
"description": "TL schema used for mtcute",
|
"description": "TL schema used for mtcute",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"author": "Alina Sireneva <alina@tei.su>",
|
"author": "Alina Sireneva <alina@tei.su>",
|
||||||
|
@ -29,4 +29,4 @@
|
||||||
"typedoc": {
|
"typedoc": {
|
||||||
"entryPoint": "index.d.ts"
|
"entryPoint": "index.d.ts"
|
||||||
}
|
}
|
||||||
}
|
}
|
File diff suppressed because one or more lines are too long
|
@ -220,6 +220,7 @@ async function main() {
|
||||||
}))
|
}))
|
||||||
|
|
||||||
let chooseOptions: ConflictOption[] = []
|
let chooseOptions: ConflictOption[] = []
|
||||||
|
let mergeError = ''
|
||||||
|
|
||||||
const customEntry = options[options.length - 1]
|
const customEntry = options[options.length - 1]
|
||||||
|
|
||||||
|
@ -240,15 +241,21 @@ async function main() {
|
||||||
if (typeof mergedEntry === 'string') {
|
if (typeof mergedEntry === 'string') {
|
||||||
// merge failed, so there is in fact some conflict
|
// merge failed, so there is in fact some conflict
|
||||||
chooseOptions = fromLastSchema
|
chooseOptions = fromLastSchema
|
||||||
|
mergeError = mergedEntry
|
||||||
} else return mergedEntry
|
} else return mergedEntry
|
||||||
}
|
}
|
||||||
|
|
||||||
const nonEmptyOptions = chooseOptions.filter(hasPresentKey('entry'))
|
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')
|
console.log('0. Remove')
|
||||||
nonEmptyOptions.forEach((opt, idx) => {
|
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) {
|
while (true) {
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
{
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"paths": {
|
||||||
|
"~scripts/*": ["../../scripts/*"],
|
||||||
|
},
|
||||||
|
},
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.json",
|
||||||
"include": [
|
"include": [
|
||||||
"./index.d.ts",
|
"./index.d.ts",
|
||||||
|
|
|
@ -127,7 +127,7 @@ importers:
|
||||||
packages/core:
|
packages/core:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@mtcute/tl':
|
'@mtcute/tl':
|
||||||
specifier: workspace:^160.0.0
|
specifier: workspace:^164.0.0
|
||||||
version: link:../tl
|
version: link:../tl
|
||||||
'@mtcute/tl-runtime':
|
'@mtcute/tl-runtime':
|
||||||
specifier: workspace:^1.0.0
|
specifier: workspace:^1.0.0
|
||||||
|
@ -196,7 +196,7 @@ importers:
|
||||||
packages/html-parser:
|
packages/html-parser:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@mtcute/tl':
|
'@mtcute/tl':
|
||||||
specifier: workspace:^160.0.0
|
specifier: workspace:^164.0.0
|
||||||
version: link:../tl
|
version: link:../tl
|
||||||
htmlparser2:
|
htmlparser2:
|
||||||
specifier: ^6.0.1
|
specifier: ^6.0.1
|
||||||
|
@ -224,7 +224,7 @@ importers:
|
||||||
packages/markdown-parser:
|
packages/markdown-parser:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@mtcute/tl':
|
'@mtcute/tl':
|
||||||
specifier: workspace:^160.0.0
|
specifier: workspace:^164.0.0
|
||||||
version: link:../tl
|
version: link:../tl
|
||||||
long:
|
long:
|
||||||
specifier: 5.2.3
|
specifier: 5.2.3
|
||||||
|
|
Loading…
Reference in a new issue