- Fixed a possible
TypeError: null is not an object
error inclient.login()
if called from a database with an incomplete login attempt.
- No longer generates
number | string
instead ofstring
forint64
types in output positions (the input int64 is stillnumber | string
). - Better detection of
prebuilt-tdlib
: can now use TDLib commit and version fromprebuilt-tdlib/package.json
instead of always extracting the commit hash from the library file. The--prebuilt-tdlib
option is replaced with theprebuilt-tdlib
argument (--prebuilt-tdlib
is deprecated).
- In bun (instead of Node.js), fixed updates/responses stop being received if
none of those have been received in the last 10 (
receiveTimeout
) seconds. - In bun, fixed the old tdjson interface exiting the process instantly.
This is related to bun < v1.1.14 only.
- The compatibility with
tdl-tdlib-addon
is removed. TheClient
constructor is no longer exported. The non-deprecated API mostly remains the same. - TDLib < v1.8.0 is no longer supported.
- Node.js < v16.0.0 is no longer supported.
- The new tdjson interface is now used by default. The
useNewTdjsonInterface
option intdl.configure
is removed;useOldTdjsonInterface
is added instead. - Added
client.iterUpdates()
to receive updates via async iterators as an alternative toclient.on('update', ...)
. Example:for await (const update of client.iterUpdates()) { if (update._ === 'updateOption' && update.name === 'my_id') { console.log(`My ID is ${update.value.value}!`) break } }
client.login()
can now accept the object directly besides a function returning the object.- The TDLib errors are now wrapped in a new
TDLibError
class;TdlError
is removed and replaced withUnknownError
. - Changed the default verbosity level from 2 to 1.
- Added
client.isClosed()
. - Pre-built node addons now support aarch64 GNU/Linux.
- Removed deprecated client options:
receiveTimeout
,useDefaultVerbosityLevel
,disableAuth
,useMutableRename
,verbosityLevel
. - Removed the
bare
client option.tdl.createBareClient(): Client
is added instead. - Removed deprecated client methods:
destroy
,pause
,resume
,connect
,connectAndLogin
,getBackendName
,setLogFatalErrorCallback
. - Removed deprecated exports:
TDL
,Tdl
. - Removed deprecated events:
response
,auth-needed
,auth-not-needed
. Thedestroy
event is renamed toclose
. client.off
now returnsboolean
instead ofvoid
; theonce
parameter is removed. (Theeventemitter3
dependency is also dropped.)- The old tdjson interface should work in multiple threads of
node:worker_threads
now. - Now published with
--provenance
. - Internal: The
tdl
client code was rewritten in TypeScript.
- Added a
--github-repo
CLI option. - Added
-h
and--version
aliases. - The generator now indicates that the
bytes
parameters are base64. - The version of
tdl-install-types
is now included in the header of the generated files. - No longer generates
null
for return types ofExecute
. - Functions not marked as synchronous are no longer generated in
Execute
. - Added some special types:
$Function
,$FunctionResultByName
,$FunctionInputByName
,$FunctionName
,$SyncFunctionName
.Invoke
andExecute
are implemented in terms of these types and may be somewhat faster now (in typecheck time).
- Fixed a race condition (first reported when used in bun). This was publised as
tdl@7.4.1-beta.0
on 2023-11-07.
- Added
tdl.setLogMessageCallback
that allows to pass a callback to thetd_set_log_message_callback
TDLib function using Node-API's thread-safe functions. (TDLib v1.8.0+ only) tdl.configure
: Added an experimental optionuseNewTdjsonInterface
that enables the use oftd_create_client_id
/td_send
/td_receive
/td_execute
interface with a client manager and global receive loop, though the old interface still works well. (TDLib v1.7.0+ only)- Changed the implementation of the old tdjson interface bindings so that the
limitation of max
UV_THREADPOOL_SIZE
clients is lifted. tdl.configure
: Added areceiveTimeout
advanced option.tdl.createClient
:receiveTimeout
in the client options is deprecated.tdl.createClient
: Deprecated theuseMutableRename
advanced option.
Initial release of a new cli utility that is now recommended to use instead of
installing the tdlib-types
package. It can generate a tdlib-types.d.ts
file
when given a shared library / tdlib git ref / td_api.tl file and can be called
via npx
. (See the "Types" section in the README for more information.) Changes
were also made to the generator to make the autocompletion faster.
- Fixed
Symbol not found: node_register_module_v…
errors on some platforms. - Fixed passing falsy values to
tdl.configure
.
This update introduces some significant and long-planned changes to the interface, while retaining backward compatiblity.
- No longer need to separately install
tdl
andtdl-tdlib-addon
; just installtdl
.tdl-tdlib-addon
is deprecated. The library is mostly focused to Node.js only now, deno support can be added later as a separate library. This simplifies tdl. - To better reflect the distinction between TDLib-global and instance-specific
functions, TDLib-global options are now passed in the special
configure
function, andexecute
is decoupled from clients. As an example:The full documentation for theconst tdl = require('tdl') tdl.configure({ tdjson: 'libtdjson.dylib', libdir: '/usr/local/lib', verbosityLevel: 3 /* the default is 2 */ }) tdl.execute({ _: 'setLogStream', /* ... */ }) const client = tdl.createClient({ apiId: /* your api id */, apiHash: /* your api hash */ }) await client.login()
configure
function is available in the TypeScript typings. The oldnew Client
approach is still supported but deprecated. - The
verbosityLevel
client option is deprecated (moved totdl.configure
). - Added pre-built binaries for the node addon using
prebuildify
andnode-gyp-build
. - Updated README to be somewhat more user-friendly. Aside of documentation changes, the library also should be simpler to use now.
- The packages
tdl-tdlib-wasm
andtdl-shared
are deprecated. Any webassembly support is removed. - Deprecated
Client#getBackendName
.
Old code:
const { Client } = require('tdl')
const { TDLib } = require('tdl-tdlib-addon')
const client = new Client(new TDLib('path/to/libtdjson'), {
apiId,
apiHash,
verbosityLevel: 0,
// ...
})
New code:
const tdl = require('tdl')
tdl.configure({ tdjson: 'path/to/libtdjson', verbosityLevel: 0 })
const client = tdl.createClient({
apiId,
apiHash,
// ...
})
If the default values of tdjson
and verbosityLevel
are used, then calling
configure
is optional.
- Fixed freeing unallocated memory on app shutdown if callbacks were set.
- Updated dependencies.
- It is no longer needed to call
client.connect
orclient.connectAndLogin
, these functions are deprecated. - Added a
client.loginAsBot
function. - Added documentation to the
.d.ts
declaration file. - Deprecated
client.setLogFatalErrorCallback
andclient.destroy
. - Deprecated the
useDefaultVerbosityLevel
advanced option, it is replaced withverbosityLevel: 'default'
. - Renamed the
disableAuth
advanced option tobare
,disableAuth
is now deprecated.
- Added support for TDLib >= v1.8.6.
- New functions in
LoginDetails
:getEmailAddress
,getEmailCode
,confirmOnAnotherDevice
. - Added a
client.getVersion(): string
function, undocumented in the README for now.
- On Linux,
dlopen
withRTLD_DEEPBIND
(if available) is now used instead ofdlmopen
.dlmopen
was not stable enough. This fixes some segmentation faults on GNU/Linux.
- Exports the
defaultLibraryFile
string. It can be imported usingconst { defaultLibraryFile } = require('tdl-tdlib-addon')
. - On GNU/Linux with glibc,
dlmopen
is used instead ofdlopen
to prevent OpenSSL compatibility issues.
- Fixes
Check failed: result.second
errors on Node.js v16+ (and sometimes v14). This changes the representation of theclient
.
- Fixes node-gyp's error log output when installing using npm v7.
- Important: TypeScript and Flow users now need to install
tdlib-types
for the TDLib typings to work. It is now possible to install the typings for other TDLib versions. client.pause()
andclient.resume()
are now deprecated.- Removed deprecated
client.invokeFuture
. - Added a
client.getBackendName(): string
function. - Dropped support for TDLib v1.4.0. TDLib v1.5.0 or newer is required now.
- Requires
tdl-shared@0.10.0
. - Multiple documentation improvements.
- Internal:
-
- Updated Flow to v0.138.0.
- This is the first release of
tdlib-types
, see its README. - The TDLib typings have been split from the
tdl
package into this package. - The generator now parses "may be null" comments.
- Added typings for TDLib v1.7.0.
- Removed deprecated
setLogFilePath
,setLogMaxFileSize
, andsetLogVerbosityLevel
. - New method:
getName(): string
. create()
now doesn't need to return a promise.
- Fixed not building on Windows.
- New method:
client.close()
, returns a promise. client.invokeFuture
is deprecated.tdl-tdlib-addon
is now recommended instead oftdl-tdlib-ffi
. Note that the libraryFile extension in tdl-tdlib-addon is mandatory (ffi-napi automatically appends the extension).- Documentation improvements.
- Other improvements.
- Uses dlopen instead of rpath.
- Added support for
td_set_log_fatal_error_callback
. - Major improvements.
- Minor improvements.
- ffi-napi updated to v3. This adds support for Node.js v14 and drops support for Node.js older than v10.
- Adds full support for TDLib v1.6.0:
-
- TDLib typings are updated to TDLib v1.6.0.
-
- Registration in the
login
function now works with TDLib v1.5.0+ (and doesn't support tdlib <1.5.0). PR: #71.
- Registration in the
- Several improvements to the documentation.
- Internal:
-
- Moved the
tdlib-typings
project into this repository.
- Moved the
- Fixed renaming of objects in an array (see #48).
- Important: Allowed recovery from invalid phone numbers (see #33).
loginDetails.phoneNumber
/loginDetails.token
field replaced withloginDetails.getPhoneNumber
/loginDetails.getToken
function. - Important:
new Client(options)
->new Client(tdlibInstance, options)
- Splitted
tdl
into two packages:tdl
andtdl-tdlib-ffi
. Users should manually install both. - Now the
tdl
core package can work in browser. - Added the
tdl-tdlib-wasm
package. - (very unstable) Added the
tdl-tdlib-addon
package. - Removed static method
Client.fromTDLib
. - Changed behaviour of
client.on('update')
andclient.on('error')
. client.login()
(andclient.connectAndLogin()
) argument is optional now.- Added
client.off
(alias ofclient.removeListener
) andclient.addListener
(alias ofclient.on
).Rx.fromEvent
from RxJS 6 can now work withtdl
out of the box. Example:Rx.fromEvent(client, 'update')
. - Removed
client.setLogFilePath
,client.setLogMaxFileSize
,client.setLogVerbosityLevel
methods, which are deprecated in TDLib. - Added the
disableAuth
advanced option. - Many documentation improvements.
- Added basic contributing guidelines.
- TDLib typings for TS/Flow:
-
- Updated to tdlib v1.4.0.
-
- Changed names of "input" kind of types:
xxxOptional
->xxx$Input
- Changed names of "input" kind of types:
-
- Properties of input types are read-only now.
-
- Flow: Now all types are exact. Previously, only input types were exact.
-
- Flow: Now non-input types are subtypes of input.
- Other minor improvements.
- Added
client.connectAndLogin
method. - File
types/tdlib.ts
renamed totypes/tdlib.d.ts
(see #31).
- Added
client.pause()
andclient.resume()
functions, which allow you to pause update receiving.
- Fixed #24.
- Important: The
client.connect
function is now splitted into two functions:client.connect
andclient.login
. RemovedbeforeAuth
argument fromclient.connect
function. RemovedloginDetails
option fromClient
constructor; nowclient.login
accepts a function that returnsLoginDetails
. - Added OS detection. Now
tdl
searches fortdjson
on Windows and forlibtdjson
on other OSes. - Added
response
event that allows reading pure updates (i.e. "events" or "responses") that come from tdlibclient_receive()
. - Removed
logFilePath
option.client.setLogFilePath()
method can be used instead. tdlib.send
now returnsundefined
instead ofnull
.- Added
databaseEncryptionKey
option. - Added
useDefaultVerbosityLevel
option for advanced users. When it's set to true,tdl
doesn't invokesetLogVerbosityLevel
duringconnect()
. - TDLib typings updated to TDLib v1.3.0. Documentation comments added to TDLib typings.
- Many documentation improvements.
tdlib.setLogFatalErrorCallback
now acceptsnull
.client.setLogFatalErrorCallback
now acceptsnull
.- Internal:
-
- Added internal package
tdl-shared
with TS / Flow types.
- Added internal package
-
- Added
debug
namespaces:tdl:client:emitter
,tdl:client:response
,tdl:client:request
.
- Added
-
- Many improvements of tests for TS / Flow typings.
- Added
client.removeListener
function. - Internal:
-
- Flow updated to v0.76.0.
- Added
beforeAuth
argument inclient.connect
function. dev
option renamed touseTestDc
.- Added
Client.create
andClient.fromTDLib
static methods. - Added
auth-not-needed
event. - Changed
client.on('error')
signature:(event: 'error', listener: (err: TDError) => void) => Client
to(event: 'error', listener: (err: TDError | Error) => void) => Client
. - Internal:
-
- Now names of private fields start with
_
.
- Now names of private fields start with
-
- Added tests for Flow typings.
- Now errors in
_loop
are correctly handled. See #16.
- Some fixes in TDlib TS typings.
- Added TypeScript typings.
- Minimum Node.js version is
8.6.0
. - Added sign up support. Added
loginDetails.getName
function. - Added support of previously unsupported tdjson functions:
-
- Added
client.setLogMaxFileSize
.
- Added
-
- Added
client.setLogFatalErrorCallback
.
- Added
-
- Added
tdlib.setLogMaxFileSize
.
- Added
- Bugfixes. See #6.
- Internal:
-
- Added
.gitattributes
.
- Added
- Fixed value of
main
field inpackage.json
.
- Some improvements of Flow typings.
src/tdlib-types.js
renamed totypes/tdlib.js
.- Added
tdlib.setLogFatalErrorCallback
method. - Documentation: Added 'typings' and 'examples' section in README.
- Bugfixes.
prepublish
script in package.json replaced withprepare
andprepack
.- Internal:
-
- Added eslint.
-
- Added
.editorconfig
.
- Added
- Added
client.invokeFuture
function. - Added
multiple-accounts.js
andusing-fluture.js
examples. - Added
tdlibIntance
option. - Some documentation improvements.
- Some bugfixes.
- Added event
auth-needed
. - Fixed arrays in TDLib flow typings.
- Added
TDLib_API.md
file. inquirer
replaced withpromptly
.- Added
useMutableRename
option. - Travis activated.
build
badge added to README. - Added
skipOldUpdates
option. - Node.js
events
replaced witheventemitter3
.
- Fixes in TDLib flow typings.
- Internal:
-
- Flow updated to v0.69.0.
…
First release of tdl as a fork of tglib.