@mtcute/core 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +8 -0
- package/README.md +26 -0
- package/cjs/base-client.d.ts +297 -0
- package/cjs/base-client.js +324 -0
- package/cjs/base-client.js.map +1 -0
- package/cjs/index.d.ts +10 -0
- package/cjs/index.js +30 -0
- package/cjs/index.js.map +1 -0
- package/cjs/network/auth-key.d.ts +21 -0
- package/cjs/network/auth-key.js +101 -0
- package/cjs/network/auth-key.js.map +1 -0
- package/cjs/network/authorization.d.ts +9 -0
- package/cjs/network/authorization.js +332 -0
- package/cjs/network/authorization.js.map +1 -0
- package/cjs/network/config-manager.d.ts +33 -0
- package/cjs/network/config-manager.js +93 -0
- package/cjs/network/config-manager.js.map +1 -0
- package/cjs/network/index.d.ts +4 -0
- package/cjs/network/index.js +20 -0
- package/cjs/network/index.js.map +1 -0
- package/cjs/network/mtproto-session.d.ts +116 -0
- package/cjs/network/mtproto-session.js +209 -0
- package/cjs/network/mtproto-session.js.map +1 -0
- package/cjs/network/multi-session-connection.d.ts +33 -0
- package/cjs/network/multi-session-connection.js +243 -0
- package/cjs/network/multi-session-connection.js.map +1 -0
- package/cjs/network/network-manager.d.ts +190 -0
- package/cjs/network/network-manager.js +547 -0
- package/cjs/network/network-manager.js.map +1 -0
- package/cjs/network/persistent-connection.d.ts +51 -0
- package/cjs/network/persistent-connection.js +173 -0
- package/cjs/network/persistent-connection.js.map +1 -0
- package/cjs/network/reconnection.d.ts +11 -0
- package/cjs/network/reconnection.js +18 -0
- package/cjs/network/reconnection.js.map +1 -0
- package/cjs/network/session-connection.d.ts +72 -0
- package/cjs/network/session-connection.js +1363 -0
- package/cjs/network/session-connection.js.map +1 -0
- package/cjs/network/transports/abstract.d.ts +99 -0
- package/cjs/network/transports/abstract.js +38 -0
- package/cjs/network/transports/abstract.js.map +1 -0
- package/cjs/network/transports/index.d.ts +8 -0
- package/cjs/network/transports/index.js +26 -0
- package/cjs/network/transports/index.js.map +1 -0
- package/cjs/network/transports/intermediate.d.ts +20 -0
- package/cjs/network/transports/intermediate.js +67 -0
- package/cjs/network/transports/intermediate.js.map +1 -0
- package/cjs/network/transports/obfuscated.d.ts +18 -0
- package/cjs/network/transports/obfuscated.js +83 -0
- package/cjs/network/transports/obfuscated.js.map +1 -0
- package/cjs/network/transports/streamed.d.ts +24 -0
- package/cjs/network/transports/streamed.js +32 -0
- package/cjs/network/transports/streamed.js.map +1 -0
- package/cjs/network/transports/tcp.d.ts +33 -0
- package/cjs/network/transports/tcp.js +130 -0
- package/cjs/network/transports/tcp.js.map +1 -0
- package/cjs/network/transports/websocket.d.ts +47 -0
- package/cjs/network/transports/websocket.js +124 -0
- package/cjs/network/transports/websocket.js.map +1 -0
- package/cjs/network/transports/wrapped.d.ts +11 -0
- package/cjs/network/transports/wrapped.js +26 -0
- package/cjs/network/transports/wrapped.js.map +1 -0
- package/cjs/package.json +3 -0
- package/cjs/storage/abstract.d.ts +174 -0
- package/cjs/storage/abstract.js +3 -0
- package/cjs/storage/abstract.js.map +1 -0
- package/cjs/storage/index.d.ts +5 -0
- package/cjs/storage/index.js +22 -0
- package/cjs/storage/index.js.map +1 -0
- package/cjs/storage/json-file.d.ts +31 -0
- package/cjs/storage/json-file.js +90 -0
- package/cjs/storage/json-file.js.map +1 -0
- package/cjs/storage/json.d.ts +9 -0
- package/cjs/storage/json.js +65 -0
- package/cjs/storage/json.js.map +1 -0
- package/cjs/storage/localstorage.d.ts +7 -0
- package/cjs/storage/localstorage.js +25 -0
- package/cjs/storage/localstorage.js.map +1 -0
- package/cjs/storage/memory.d.ts +98 -0
- package/cjs/storage/memory.js +299 -0
- package/cjs/storage/memory.js.map +1 -0
- package/cjs/types/errors.d.ts +53 -0
- package/cjs/types/errors.js +58 -0
- package/cjs/types/errors.js.map +1 -0
- package/cjs/types/index.d.ts +3 -0
- package/cjs/types/index.js +20 -0
- package/cjs/types/index.js.map +1 -0
- package/cjs/types/peers.d.ts +4 -0
- package/cjs/types/peers.js +3 -0
- package/cjs/types/peers.js.map +1 -0
- package/cjs/types/utils.d.ts +6 -0
- package/cjs/types/utils.js +9 -0
- package/cjs/types/utils.js.map +1 -0
- package/cjs/utils/async-lock.d.ts +10 -0
- package/cjs/utils/async-lock.js +43 -0
- package/cjs/utils/async-lock.js.map +1 -0
- package/cjs/utils/bigint-utils.d.ts +40 -0
- package/cjs/utils/bigint-utils.js +104 -0
- package/cjs/utils/bigint-utils.js.map +1 -0
- package/cjs/utils/binary/asn1-parser.d.ts +17 -0
- package/cjs/utils/binary/asn1-parser.js +121 -0
- package/cjs/utils/binary/asn1-parser.js.map +1 -0
- package/cjs/utils/buffer-utils.d.ts +21 -0
- package/cjs/utils/buffer-utils.js +63 -0
- package/cjs/utils/buffer-utils.js.map +1 -0
- package/cjs/utils/condition-variable.d.ts +9 -0
- package/cjs/utils/condition-variable.js +28 -0
- package/cjs/utils/condition-variable.js.map +1 -0
- package/cjs/utils/controllable-promise.d.ts +16 -0
- package/cjs/utils/controllable-promise.js +25 -0
- package/cjs/utils/controllable-promise.js.map +1 -0
- package/cjs/utils/crypto/abstract.d.ts +23 -0
- package/cjs/utils/crypto/abstract.js +19 -0
- package/cjs/utils/crypto/abstract.js.map +1 -0
- package/cjs/utils/crypto/common.d.ts +12 -0
- package/cjs/utils/crypto/common.js +54 -0
- package/cjs/utils/crypto/common.js.map +1 -0
- package/cjs/utils/crypto/factorization.d.ts +5 -0
- package/cjs/utils/crypto/factorization.js +69 -0
- package/cjs/utils/crypto/factorization.js.map +1 -0
- package/cjs/utils/crypto/index.d.ts +5 -0
- package/cjs/utils/crypto/index.js +23 -0
- package/cjs/utils/crypto/index.js.map +1 -0
- package/cjs/utils/crypto/keys.d.ts +27 -0
- package/cjs/utils/crypto/keys.js +70 -0
- package/cjs/utils/crypto/keys.js.map +1 -0
- package/cjs/utils/crypto/miller-rabin.d.ts +2 -0
- package/cjs/utils/crypto/miller-rabin.js +44 -0
- package/cjs/utils/crypto/miller-rabin.js.map +1 -0
- package/cjs/utils/crypto/mtproto.d.ts +31 -0
- package/cjs/utils/crypto/mtproto.js +66 -0
- package/cjs/utils/crypto/mtproto.js.map +1 -0
- package/cjs/utils/crypto/node-crypto.d.ts +10 -0
- package/cjs/utils/crypto/node-crypto.js +46 -0
- package/cjs/utils/crypto/node-crypto.js.map +1 -0
- package/cjs/utils/crypto/password.d.ts +29 -0
- package/cjs/utils/crypto/password.js +106 -0
- package/cjs/utils/crypto/password.js.map +1 -0
- package/cjs/utils/crypto/subtle.d.ts +12 -0
- package/cjs/utils/crypto/subtle.js +86 -0
- package/cjs/utils/crypto/subtle.js.map +1 -0
- package/cjs/utils/crypto/utils.d.ts +14 -0
- package/cjs/utils/crypto/utils.js +30 -0
- package/cjs/utils/crypto/utils.js.map +1 -0
- package/cjs/utils/default-dcs.d.ts +7 -0
- package/cjs/utils/default-dcs.js +76 -0
- package/cjs/utils/default-dcs.js.map +1 -0
- package/cjs/utils/deque.d.ts +29 -0
- package/cjs/utils/deque.js +210 -0
- package/cjs/utils/deque.js.map +1 -0
- package/cjs/utils/early-timer.d.ts +42 -0
- package/cjs/utils/early-timer.js +79 -0
- package/cjs/utils/early-timer.js.map +1 -0
- package/cjs/utils/flood-control.d.ts +14 -0
- package/cjs/utils/flood-control.js +65 -0
- package/cjs/utils/flood-control.js.map +1 -0
- package/cjs/utils/function-utils.d.ts +13 -0
- package/cjs/utils/function-utils.js +30 -0
- package/cjs/utils/function-utils.js.map +1 -0
- package/cjs/utils/index.d.ts +24 -0
- package/cjs/utils/index.js +41 -0
- package/cjs/utils/index.js.map +1 -0
- package/cjs/utils/linked-list.d.ts +21 -0
- package/cjs/utils/linked-list.js +73 -0
- package/cjs/utils/linked-list.js.map +1 -0
- package/cjs/utils/links/bots.d.ts +71 -0
- package/cjs/utils/links/bots.js +259 -0
- package/cjs/utils/links/bots.js.map +1 -0
- package/cjs/utils/links/bundle.d.ts +7 -0
- package/cjs/utils/links/bundle.js +24 -0
- package/cjs/utils/links/bundle.js.map +1 -0
- package/cjs/utils/links/calls.d.ts +16 -0
- package/cjs/utils/links/calls.js +59 -0
- package/cjs/utils/links/calls.js.map +1 -0
- package/cjs/utils/links/chat.d.ts +46 -0
- package/cjs/utils/links/chat.js +160 -0
- package/cjs/utils/links/chat.js.map +1 -0
- package/cjs/utils/links/common.d.ts +31 -0
- package/cjs/utils/links/common.js +60 -0
- package/cjs/utils/links/common.js.map +1 -0
- package/cjs/utils/links/index.d.ts +2 -0
- package/cjs/utils/links/index.js +29 -0
- package/cjs/utils/links/index.js.map +1 -0
- package/cjs/utils/links/misc.d.ts +19 -0
- package/cjs/utils/links/misc.js +77 -0
- package/cjs/utils/links/misc.js.map +1 -0
- package/cjs/utils/links/proxy.d.ts +17 -0
- package/cjs/utils/links/proxy.js +61 -0
- package/cjs/utils/links/proxy.js.map +1 -0
- package/cjs/utils/links/stickers.d.ts +9 -0
- package/cjs/utils/links/stickers.js +28 -0
- package/cjs/utils/links/stickers.js.map +1 -0
- package/cjs/utils/links/user.d.ts +27 -0
- package/cjs/utils/links/user.js +81 -0
- package/cjs/utils/links/user.js.map +1 -0
- package/cjs/utils/logger.d.ts +54 -0
- package/cjs/utils/logger.js +158 -0
- package/cjs/utils/logger.js.map +1 -0
- package/cjs/utils/long-utils.d.ts +75 -0
- package/cjs/utils/long-utils.js +161 -0
- package/cjs/utils/long-utils.js.map +1 -0
- package/cjs/utils/lru-map.d.ts +21 -0
- package/cjs/utils/lru-map.js +107 -0
- package/cjs/utils/lru-map.js.map +1 -0
- package/cjs/utils/lru-set.d.ts +22 -0
- package/cjs/utils/lru-set.js +48 -0
- package/cjs/utils/lru-set.js.map +1 -0
- package/cjs/utils/misc-utils.d.ts +7 -0
- package/cjs/utils/misc-utils.js +15 -0
- package/cjs/utils/misc-utils.js.map +1 -0
- package/cjs/utils/peer-utils.d.ts +35 -0
- package/cjs/utils/peer-utils.js +188 -0
- package/cjs/utils/peer-utils.js.map +1 -0
- package/cjs/utils/platform/crypto.d.ts +1 -0
- package/cjs/utils/platform/crypto.js +8 -0
- package/cjs/utils/platform/crypto.js.map +1 -0
- package/cjs/utils/platform/crypto.web.d.ts +1 -0
- package/cjs/utils/platform/crypto.web.js +14 -0
- package/cjs/utils/platform/crypto.web.js.map +1 -0
- package/cjs/utils/platform/error-reporting.d.ts +3 -0
- package/cjs/utils/platform/error-reporting.js +22 -0
- package/cjs/utils/platform/error-reporting.js.map +1 -0
- package/cjs/utils/platform/logging.d.ts +1 -0
- package/cjs/utils/platform/logging.js +35 -0
- package/cjs/utils/platform/logging.js.map +1 -0
- package/cjs/utils/platform/logging.web.d.ts +1 -0
- package/cjs/utils/platform/logging.web.js +35 -0
- package/cjs/utils/platform/logging.web.js.map +1 -0
- package/cjs/utils/platform/random.d.ts +1 -0
- package/cjs/utils/platform/random.js +7 -0
- package/cjs/utils/platform/random.js.map +1 -0
- package/cjs/utils/platform/random.web.d.ts +1 -0
- package/cjs/utils/platform/random.web.js +10 -0
- package/cjs/utils/platform/random.web.js.map +1 -0
- package/cjs/utils/platform/transport.d.ts +1 -0
- package/cjs/utils/platform/transport.js +8 -0
- package/cjs/utils/platform/transport.js.map +1 -0
- package/cjs/utils/platform/transport.web.d.ts +1 -0
- package/cjs/utils/platform/transport.web.js +15 -0
- package/cjs/utils/platform/transport.web.js.map +1 -0
- package/cjs/utils/sorted-array.d.ts +17 -0
- package/cjs/utils/sorted-array.js +83 -0
- package/cjs/utils/sorted-array.js.map +1 -0
- package/cjs/utils/string-session.d.ts +11 -0
- package/cjs/utils/string-session.js +73 -0
- package/cjs/utils/string-session.js.map +1 -0
- package/cjs/utils/tl-json.d.ts +13 -0
- package/cjs/utils/tl-json.js +62 -0
- package/cjs/utils/tl-json.js.map +1 -0
- package/cjs/utils/type-assertions.d.ts +37 -0
- package/cjs/utils/type-assertions.js +70 -0
- package/cjs/utils/type-assertions.js.map +1 -0
- package/esm/base-client.d.ts +297 -0
- package/esm/base-client.js +317 -0
- package/esm/base-client.js.map +1 -0
- package/esm/index.d.ts +10 -0
- package/esm/index.js +11 -0
- package/esm/index.js.map +1 -0
- package/esm/network/auth-key.d.ts +21 -0
- package/esm/network/auth-key.js +97 -0
- package/esm/network/auth-key.js.map +1 -0
- package/esm/network/authorization.d.ts +9 -0
- package/esm/network/authorization.js +325 -0
- package/esm/network/authorization.js.map +1 -0
- package/esm/network/config-manager.d.ts +33 -0
- package/esm/network/config-manager.js +89 -0
- package/esm/network/config-manager.js.map +1 -0
- package/esm/network/index.d.ts +4 -0
- package/esm/network/index.js +4 -0
- package/esm/network/index.js.map +1 -0
- package/esm/network/mtproto-session.d.ts +116 -0
- package/esm/network/mtproto-session.js +202 -0
- package/esm/network/mtproto-session.js.map +1 -0
- package/esm/network/multi-session-connection.d.ts +33 -0
- package/esm/network/multi-session-connection.js +236 -0
- package/esm/network/multi-session-connection.js.map +1 -0
- package/esm/network/network-manager.d.ts +190 -0
- package/esm/network/network-manager.js +542 -0
- package/esm/network/network-manager.js.map +1 -0
- package/esm/network/persistent-connection.d.ts +51 -0
- package/esm/network/persistent-connection.js +166 -0
- package/esm/network/persistent-connection.js.map +1 -0
- package/esm/network/reconnection.d.ts +11 -0
- package/esm/network/reconnection.js +14 -0
- package/esm/network/reconnection.js.map +1 -0
- package/esm/network/session-connection.d.ts +72 -0
- package/esm/network/session-connection.js +1356 -0
- package/esm/network/session-connection.js.map +1 -0
- package/esm/network/transports/abstract.d.ts +99 -0
- package/esm/network/transports/abstract.js +34 -0
- package/esm/network/transports/abstract.js.map +1 -0
- package/esm/network/transports/index.d.ts +8 -0
- package/esm/network/transports/index.js +9 -0
- package/esm/network/transports/index.js.map +1 -0
- package/esm/network/transports/intermediate.d.ts +20 -0
- package/esm/network/transports/intermediate.js +62 -0
- package/esm/network/transports/intermediate.js.map +1 -0
- package/esm/network/transports/obfuscated.d.ts +18 -0
- package/esm/network/transports/obfuscated.js +79 -0
- package/esm/network/transports/obfuscated.js.map +1 -0
- package/esm/network/transports/streamed.d.ts +24 -0
- package/esm/network/transports/streamed.js +25 -0
- package/esm/network/transports/streamed.js.map +1 -0
- package/esm/network/transports/tcp.d.ts +33 -0
- package/esm/network/transports/tcp.js +122 -0
- package/esm/network/transports/tcp.js.map +1 -0
- package/esm/network/transports/websocket.d.ts +47 -0
- package/esm/network/transports/websocket.js +116 -0
- package/esm/network/transports/websocket.js.map +1 -0
- package/esm/network/transports/wrapped.d.ts +11 -0
- package/esm/network/transports/wrapped.js +19 -0
- package/esm/network/transports/wrapped.js.map +1 -0
- package/esm/storage/abstract.d.ts +174 -0
- package/esm/storage/abstract.js +2 -0
- package/esm/storage/abstract.js.map +1 -0
- package/esm/storage/index.d.ts +5 -0
- package/esm/storage/index.js +6 -0
- package/esm/storage/index.js.map +1 -0
- package/esm/storage/json-file.d.ts +31 -0
- package/esm/storage/json-file.js +63 -0
- package/esm/storage/json-file.js.map +1 -0
- package/esm/storage/json.d.ts +9 -0
- package/esm/storage/json.js +61 -0
- package/esm/storage/json.js.map +1 -0
- package/esm/storage/localstorage.d.ts +7 -0
- package/esm/storage/localstorage.js +21 -0
- package/esm/storage/localstorage.js.map +1 -0
- package/esm/storage/memory.d.ts +98 -0
- package/esm/storage/memory.js +295 -0
- package/esm/storage/memory.js.map +1 -0
- package/esm/types/errors.d.ts +53 -0
- package/esm/types/errors.js +49 -0
- package/esm/types/errors.js.map +1 -0
- package/esm/types/index.d.ts +3 -0
- package/esm/types/index.js +4 -0
- package/esm/types/index.js.map +1 -0
- package/esm/types/peers.d.ts +4 -0
- package/esm/types/peers.js +2 -0
- package/esm/types/peers.js.map +1 -0
- package/esm/types/utils.d.ts +6 -0
- package/esm/types/utils.js +5 -0
- package/esm/types/utils.js.map +1 -0
- package/esm/utils/async-lock.d.ts +10 -0
- package/esm/utils/async-lock.js +39 -0
- package/esm/utils/async-lock.js.map +1 -0
- package/esm/utils/bigint-utils.d.ts +40 -0
- package/esm/utils/bigint-utils.js +92 -0
- package/esm/utils/bigint-utils.js.map +1 -0
- package/esm/utils/binary/asn1-parser.d.ts +17 -0
- package/esm/utils/binary/asn1-parser.js +116 -0
- package/esm/utils/binary/asn1-parser.js.map +1 -0
- package/esm/utils/buffer-utils.d.ts +21 -0
- package/esm/utils/buffer-utils.js +55 -0
- package/esm/utils/buffer-utils.js.map +1 -0
- package/esm/utils/condition-variable.d.ts +9 -0
- package/esm/utils/condition-variable.js +24 -0
- package/esm/utils/condition-variable.js.map +1 -0
- package/esm/utils/controllable-promise.d.ts +16 -0
- package/esm/utils/controllable-promise.js +20 -0
- package/esm/utils/controllable-promise.js.map +1 -0
- package/esm/utils/crypto/abstract.d.ts +23 -0
- package/esm/utils/crypto/abstract.js +15 -0
- package/esm/utils/crypto/abstract.js.map +1 -0
- package/esm/utils/crypto/common.d.ts +12 -0
- package/esm/utils/crypto/common.js +50 -0
- package/esm/utils/crypto/common.js.map +1 -0
- package/esm/utils/crypto/factorization.d.ts +5 -0
- package/esm/utils/crypto/factorization.js +62 -0
- package/esm/utils/crypto/factorization.js.map +1 -0
- package/esm/utils/crypto/index.d.ts +5 -0
- package/esm/utils/crypto/index.js +6 -0
- package/esm/utils/crypto/index.js.map +1 -0
- package/esm/utils/crypto/keys.d.ts +27 -0
- package/esm/utils/crypto/keys.js +64 -0
- package/esm/utils/crypto/keys.js.map +1 -0
- package/esm/utils/crypto/miller-rabin.d.ts +2 -0
- package/esm/utils/crypto/miller-rabin.js +37 -0
- package/esm/utils/crypto/miller-rabin.js.map +1 -0
- package/esm/utils/crypto/mtproto.d.ts +31 -0
- package/esm/utils/crypto/mtproto.js +60 -0
- package/esm/utils/crypto/mtproto.js.map +1 -0
- package/esm/utils/crypto/node-crypto.d.ts +10 -0
- package/esm/utils/crypto/node-crypto.js +42 -0
- package/esm/utils/crypto/node-crypto.js.map +1 -0
- package/esm/utils/crypto/password.d.ts +29 -0
- package/esm/utils/crypto/password.js +97 -0
- package/esm/utils/crypto/password.js.map +1 -0
- package/esm/utils/crypto/subtle.d.ts +12 -0
- package/esm/utils/crypto/subtle.js +59 -0
- package/esm/utils/crypto/subtle.js.map +1 -0
- package/esm/utils/crypto/utils.d.ts +14 -0
- package/esm/utils/crypto/utils.js +25 -0
- package/esm/utils/crypto/utils.js.map +1 -0
- package/esm/utils/default-dcs.d.ts +7 -0
- package/esm/utils/default-dcs.js +73 -0
- package/esm/utils/default-dcs.js.map +1 -0
- package/esm/utils/deque.d.ts +29 -0
- package/esm/utils/deque.js +206 -0
- package/esm/utils/deque.js.map +1 -0
- package/esm/utils/early-timer.d.ts +42 -0
- package/esm/utils/early-timer.js +75 -0
- package/esm/utils/early-timer.js.map +1 -0
- package/esm/utils/flood-control.d.ts +14 -0
- package/esm/utils/flood-control.js +61 -0
- package/esm/utils/flood-control.js.map +1 -0
- package/esm/utils/function-utils.d.ts +13 -0
- package/esm/utils/function-utils.js +26 -0
- package/esm/utils/function-utils.js.map +1 -0
- package/esm/utils/index.d.ts +24 -0
- package/esm/utils/index.js +25 -0
- package/esm/utils/index.js.map +1 -0
- package/esm/utils/linked-list.d.ts +21 -0
- package/esm/utils/linked-list.js +69 -0
- package/esm/utils/linked-list.js.map +1 -0
- package/esm/utils/links/bots.d.ts +71 -0
- package/esm/utils/links/bots.js +256 -0
- package/esm/utils/links/bots.js.map +1 -0
- package/esm/utils/links/bundle.d.ts +7 -0
- package/esm/utils/links/bundle.js +8 -0
- package/esm/utils/links/bundle.js.map +1 -0
- package/esm/utils/links/calls.d.ts +16 -0
- package/esm/utils/links/calls.js +56 -0
- package/esm/utils/links/calls.js.map +1 -0
- package/esm/utils/links/chat.d.ts +46 -0
- package/esm/utils/links/chat.js +157 -0
- package/esm/utils/links/chat.js.map +1 -0
- package/esm/utils/links/common.d.ts +31 -0
- package/esm/utils/links/common.js +56 -0
- package/esm/utils/links/common.js.map +1 -0
- package/esm/utils/links/index.d.ts +2 -0
- package/esm/utils/links/index.js +3 -0
- package/esm/utils/links/index.js.map +1 -0
- package/esm/utils/links/misc.d.ts +19 -0
- package/esm/utils/links/misc.js +74 -0
- package/esm/utils/links/misc.js.map +1 -0
- package/esm/utils/links/proxy.d.ts +17 -0
- package/esm/utils/links/proxy.js +58 -0
- package/esm/utils/links/proxy.js.map +1 -0
- package/esm/utils/links/stickers.d.ts +9 -0
- package/esm/utils/links/stickers.js +25 -0
- package/esm/utils/links/stickers.js.map +1 -0
- package/esm/utils/links/user.d.ts +27 -0
- package/esm/utils/links/user.js +78 -0
- package/esm/utils/links/user.js.map +1 -0
- package/esm/utils/logger.d.ts +54 -0
- package/esm/utils/logger.js +154 -0
- package/esm/utils/logger.js.map +1 -0
- package/esm/utils/long-utils.d.ts +75 -0
- package/esm/utils/long-utils.js +148 -0
- package/esm/utils/long-utils.js.map +1 -0
- package/esm/utils/lru-map.d.ts +21 -0
- package/esm/utils/lru-map.js +103 -0
- package/esm/utils/lru-map.js.map +1 -0
- package/esm/utils/lru-set.d.ts +22 -0
- package/esm/utils/lru-set.js +44 -0
- package/esm/utils/lru-set.js.map +1 -0
- package/esm/utils/misc-utils.d.ts +7 -0
- package/esm/utils/misc-utils.js +10 -0
- package/esm/utils/misc-utils.js.map +1 -0
- package/esm/utils/peer-utils.d.ts +35 -0
- package/esm/utils/peer-utils.js +179 -0
- package/esm/utils/peer-utils.js.map +1 -0
- package/esm/utils/platform/crypto.d.ts +1 -0
- package/esm/utils/platform/crypto.js +4 -0
- package/esm/utils/platform/crypto.js.map +1 -0
- package/esm/utils/platform/crypto.web.d.ts +1 -0
- package/esm/utils/platform/crypto.web.js +10 -0
- package/esm/utils/platform/crypto.web.js.map +1 -0
- package/esm/utils/platform/error-reporting.d.ts +3 -0
- package/esm/utils/platform/error-reporting.js +18 -0
- package/esm/utils/platform/error-reporting.js.map +1 -0
- package/esm/utils/platform/logging.d.ts +1 -0
- package/esm/utils/platform/logging.js +32 -0
- package/esm/utils/platform/logging.js.map +1 -0
- package/esm/utils/platform/logging.web.d.ts +1 -0
- package/esm/utils/platform/logging.web.js +31 -0
- package/esm/utils/platform/logging.web.js.map +1 -0
- package/esm/utils/platform/random.d.ts +1 -0
- package/esm/utils/platform/random.js +4 -0
- package/esm/utils/platform/random.js.map +1 -0
- package/esm/utils/platform/random.web.d.ts +1 -0
- package/esm/utils/platform/random.web.js +6 -0
- package/esm/utils/platform/random.web.js.map +1 -0
- package/esm/utils/platform/transport.d.ts +1 -0
- package/esm/utils/platform/transport.js +4 -0
- package/esm/utils/platform/transport.js.map +1 -0
- package/esm/utils/platform/transport.web.d.ts +1 -0
- package/esm/utils/platform/transport.web.js +12 -0
- package/esm/utils/platform/transport.web.js.map +1 -0
- package/esm/utils/sorted-array.d.ts +17 -0
- package/esm/utils/sorted-array.js +79 -0
- package/esm/utils/sorted-array.js.map +1 -0
- package/esm/utils/string-session.d.ts +11 -0
- package/esm/utils/string-session.js +68 -0
- package/esm/utils/string-session.js.map +1 -0
- package/esm/utils/tl-json.d.ts +13 -0
- package/esm/utils/tl-json.js +57 -0
- package/esm/utils/tl-json.js.map +1 -0
- package/esm/utils/type-assertions.d.ts +37 -0
- package/esm/utils/type-assertions.js +61 -0
- package/esm/utils/type-assertions.js.map +1 -0
- package/package.json +50 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/** @internal */
|
|
2
|
+
export const defaultProductionDc = {
|
|
3
|
+
main: {
|
|
4
|
+
_: 'dcOption',
|
|
5
|
+
ipAddress: '149.154.167.50',
|
|
6
|
+
port: 443,
|
|
7
|
+
id: 2,
|
|
8
|
+
},
|
|
9
|
+
media: {
|
|
10
|
+
_: 'dcOption',
|
|
11
|
+
ipAddress: '149.154.167.222',
|
|
12
|
+
port: 443,
|
|
13
|
+
id: 2,
|
|
14
|
+
mediaOnly: true,
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
/** @internal */
|
|
18
|
+
export const defaultProductionIpv6Dc = {
|
|
19
|
+
main: {
|
|
20
|
+
_: 'dcOption',
|
|
21
|
+
ipAddress: '2001:067c:04e8:f002:0000:0000:0000:000a',
|
|
22
|
+
ipv6: true,
|
|
23
|
+
port: 443,
|
|
24
|
+
id: 2,
|
|
25
|
+
},
|
|
26
|
+
media: {
|
|
27
|
+
_: 'dcOption',
|
|
28
|
+
ipAddress: '2001:067c:04e8:f002:0000:0000:0000:000b',
|
|
29
|
+
ipv6: true,
|
|
30
|
+
mediaOnly: true,
|
|
31
|
+
port: 443,
|
|
32
|
+
id: 2,
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
/** @internal */
|
|
36
|
+
export const defaultTestDc = {
|
|
37
|
+
main: {
|
|
38
|
+
_: 'dcOption',
|
|
39
|
+
ipAddress: '149.154.167.40',
|
|
40
|
+
port: 443,
|
|
41
|
+
id: 2,
|
|
42
|
+
},
|
|
43
|
+
media: {
|
|
44
|
+
_: 'dcOption',
|
|
45
|
+
ipAddress: '149.154.167.40',
|
|
46
|
+
port: 443,
|
|
47
|
+
id: 2,
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
/** @internal */
|
|
51
|
+
export const defaultTestIpv6Dc = {
|
|
52
|
+
main: {
|
|
53
|
+
_: 'dcOption',
|
|
54
|
+
ipAddress: '2001:67c:4e8:f002::e',
|
|
55
|
+
port: 443,
|
|
56
|
+
ipv6: true,
|
|
57
|
+
id: 2,
|
|
58
|
+
},
|
|
59
|
+
media: {
|
|
60
|
+
_: 'dcOption',
|
|
61
|
+
ipAddress: '2001:67c:4e8:f002::e',
|
|
62
|
+
port: 443,
|
|
63
|
+
ipv6: true,
|
|
64
|
+
id: 2,
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
export const defaultDcs = {
|
|
68
|
+
defaultTestDc,
|
|
69
|
+
defaultTestIpv6Dc,
|
|
70
|
+
defaultProductionDc,
|
|
71
|
+
defaultProductionIpv6Dc,
|
|
72
|
+
};
|
|
73
|
+
//# sourceMappingURL=default-dcs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-dcs.js","sourceRoot":"","sources":["../../../src/utils/default-dcs.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AC,EAAE,UAAU;QACb,SAAS,EAAE,sBAAsB;QACjC,IAAI,EAAE,GAAG;QACT,IAAI,EAAE,IAAI;QACV,EAAE,EAAE,CAAC;KACR;CACJ,CAAA;AAED,MAAM,CAAC,MAAM,UAAU,GAAG;IACtB,aAAa;IACb,iBAAiB;IACjB,mBAAmB;IACnB,uBAAuB;CACjB,CAAA","sourcesContent":["import { ITelegramStorage } from '../storage/abstract.js'\n\n/** @internal */\nexport const defaultProductionDc: ITelegramStorage.DcOptions = {\n main: {\n _: 'dcOption',\n ipAddress: '149.154.167.50',\n port: 443,\n id: 2,\n },\n media: {\n _: 'dcOption',\n ipAddress: '149.154.167.222',\n port: 443,\n id: 2,\n mediaOnly: true,\n },\n}\n\n/** @internal */\nexport const defaultProductionIpv6Dc: ITelegramStorage.DcOptions = {\n main: {\n _: 'dcOption',\n ipAddress: '2001:067c:04e8:f002:0000:0000:0000:000a',\n ipv6: true,\n port: 443,\n id: 2,\n },\n media: {\n _: 'dcOption',\n ipAddress: '2001:067c:04e8:f002:0000:0000:0000:000b',\n ipv6: true,\n mediaOnly: true,\n port: 443,\n id: 2,\n },\n}\n\n/** @internal */\nexport const defaultTestDc: ITelegramStorage.DcOptions = {\n main: {\n _: 'dcOption',\n ipAddress: '149.154.167.40',\n port: 443,\n id: 2,\n },\n media: {\n _: 'dcOption',\n ipAddress: '149.154.167.40',\n port: 443,\n id: 2,\n },\n}\n\n/** @internal */\nexport const defaultTestIpv6Dc: ITelegramStorage.DcOptions = {\n main: {\n _: 'dcOption',\n ipAddress: '2001:67c:4e8:f002::e',\n port: 443,\n ipv6: true,\n id: 2,\n },\n media: {\n _: 'dcOption',\n ipAddress: '2001:67c:4e8:f002::e',\n port: 443,\n ipv6: true,\n id: 2,\n },\n}\n\nexport const defaultDcs = {\n defaultTestDc,\n defaultTestIpv6Dc,\n defaultProductionDc,\n defaultProductionIpv6Dc,\n} as const\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deque implementation.
|
|
3
|
+
* `undefined` values are not allowed
|
|
4
|
+
*
|
|
5
|
+
* Based on Java implementation
|
|
6
|
+
*/
|
|
7
|
+
export declare class Deque<T> {
|
|
8
|
+
readonly maxLength: number;
|
|
9
|
+
protected _elements: (T | undefined)[];
|
|
10
|
+
protected _head: number;
|
|
11
|
+
protected _tail: number;
|
|
12
|
+
protected _capacity: number;
|
|
13
|
+
constructor(minCapacity?: number, maxLength?: number);
|
|
14
|
+
protected _resize(): void;
|
|
15
|
+
pushBack(item: T): void;
|
|
16
|
+
pushFront(item: T): void;
|
|
17
|
+
popFront(): T | undefined;
|
|
18
|
+
popBack(): T | undefined;
|
|
19
|
+
peekFront(): T | undefined;
|
|
20
|
+
peekBack(): T | undefined;
|
|
21
|
+
get length(): number;
|
|
22
|
+
toArray(): T[];
|
|
23
|
+
protected _delete(i: number): void;
|
|
24
|
+
remove(item: T): void;
|
|
25
|
+
removeBy(pred: (it: T) => boolean): void;
|
|
26
|
+
at(idx: number): T | undefined;
|
|
27
|
+
iter(): IterableIterator<T>;
|
|
28
|
+
clear(): void;
|
|
29
|
+
}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
// ^^ because of performance reasons
|
|
2
|
+
const MIN_INITIAL_CAPACITY = 8;
|
|
3
|
+
// System.arraycopy from java
|
|
4
|
+
function arraycopy(src, srcPos, dest, destPos, length) {
|
|
5
|
+
for (let i = 0; i < length; i++) {
|
|
6
|
+
dest[destPos + i] = src[srcPos + i];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Deque implementation.
|
|
11
|
+
* `undefined` values are not allowed
|
|
12
|
+
*
|
|
13
|
+
* Based on Java implementation
|
|
14
|
+
*/
|
|
15
|
+
export class Deque {
|
|
16
|
+
constructor(minCapacity = MIN_INITIAL_CAPACITY, maxLength = Infinity) {
|
|
17
|
+
this.maxLength = maxLength;
|
|
18
|
+
this._head = 0;
|
|
19
|
+
this._tail = 0;
|
|
20
|
+
let capacity = minCapacity;
|
|
21
|
+
if (capacity >= MIN_INITIAL_CAPACITY) {
|
|
22
|
+
// Find the best power of two to hold elements.
|
|
23
|
+
// >= because array can't be full
|
|
24
|
+
capacity |= capacity >>> 1;
|
|
25
|
+
capacity |= capacity >>> 2;
|
|
26
|
+
capacity |= capacity >>> 4;
|
|
27
|
+
capacity |= capacity >>> 8;
|
|
28
|
+
capacity |= capacity >>> 16;
|
|
29
|
+
capacity += 1;
|
|
30
|
+
if (capacity < 0) {
|
|
31
|
+
// too many
|
|
32
|
+
capacity >>>= 1;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
this._elements = new Array(capacity);
|
|
36
|
+
this._capacity = capacity;
|
|
37
|
+
}
|
|
38
|
+
_resize() {
|
|
39
|
+
const p = this._head;
|
|
40
|
+
const n = this._capacity;
|
|
41
|
+
const r = n - p; // number of elements to the right of the head
|
|
42
|
+
const newCapacity = n << 1;
|
|
43
|
+
if (newCapacity < 0)
|
|
44
|
+
throw new Error('Deque is too big');
|
|
45
|
+
const arr = new Array(newCapacity);
|
|
46
|
+
// copy items to the new array
|
|
47
|
+
// copy head till the end of arr
|
|
48
|
+
arraycopy(this._elements, p, arr, 0, r);
|
|
49
|
+
// copy from start to tail
|
|
50
|
+
arraycopy(this._elements, 0, arr, r, p);
|
|
51
|
+
this._elements = arr;
|
|
52
|
+
this._head = 0;
|
|
53
|
+
this._tail = n;
|
|
54
|
+
this._capacity = newCapacity;
|
|
55
|
+
}
|
|
56
|
+
pushBack(item) {
|
|
57
|
+
if (item === undefined)
|
|
58
|
+
throw new Error('item can not be undefined');
|
|
59
|
+
this._elements[this._tail] = item;
|
|
60
|
+
if ((this._tail = (this._tail + 1) & (this._capacity - 1)) === this._head) {
|
|
61
|
+
this._resize();
|
|
62
|
+
}
|
|
63
|
+
if (this.length > this.maxLength) {
|
|
64
|
+
this.popFront();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
pushFront(item) {
|
|
68
|
+
if (item === undefined)
|
|
69
|
+
throw new Error('item can not be undefined');
|
|
70
|
+
this._elements[(this._head = (this._head - 1) & (this._capacity - 1))] = item;
|
|
71
|
+
if (this._head === this._tail) {
|
|
72
|
+
this._resize();
|
|
73
|
+
}
|
|
74
|
+
if (this.length > this.maxLength) {
|
|
75
|
+
this.popBack();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
popFront() {
|
|
79
|
+
const h = this._head;
|
|
80
|
+
const res = this._elements[h];
|
|
81
|
+
if (res === undefined)
|
|
82
|
+
return undefined;
|
|
83
|
+
this._elements[h] = undefined;
|
|
84
|
+
this._head = (h + 1) & (this._capacity - 1);
|
|
85
|
+
return res;
|
|
86
|
+
}
|
|
87
|
+
popBack() {
|
|
88
|
+
const t = (this._tail - 1) & (this._capacity - 1);
|
|
89
|
+
const res = this._elements[t];
|
|
90
|
+
if (res === undefined)
|
|
91
|
+
return undefined;
|
|
92
|
+
this._elements[t] = undefined;
|
|
93
|
+
this._tail = t;
|
|
94
|
+
return res;
|
|
95
|
+
}
|
|
96
|
+
peekFront() {
|
|
97
|
+
return this._elements[this._head];
|
|
98
|
+
}
|
|
99
|
+
peekBack() {
|
|
100
|
+
return this._elements[(this._tail - 1) & (this._capacity - 1)];
|
|
101
|
+
}
|
|
102
|
+
get length() {
|
|
103
|
+
return (this._tail - this._head) & (this._capacity - 1);
|
|
104
|
+
}
|
|
105
|
+
toArray() {
|
|
106
|
+
const sz = this.length;
|
|
107
|
+
const arr = new Array(sz);
|
|
108
|
+
if (this._head < this._tail) {
|
|
109
|
+
// copy as-is, head to tail
|
|
110
|
+
arraycopy(this._elements, this._head, arr, 0, sz);
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
const headPortion = this._capacity - this._head;
|
|
114
|
+
// copy from head to end
|
|
115
|
+
arraycopy(this._elements, this._head, arr, 0, headPortion);
|
|
116
|
+
// copy from start to tail
|
|
117
|
+
arraycopy(this._elements, 0, arr, headPortion, this._tail);
|
|
118
|
+
}
|
|
119
|
+
return arr;
|
|
120
|
+
}
|
|
121
|
+
_delete(i) {
|
|
122
|
+
const els = this._elements;
|
|
123
|
+
const mask = this._capacity - 1;
|
|
124
|
+
const h = this._head;
|
|
125
|
+
const t = this._tail;
|
|
126
|
+
const front = (i - h) & mask;
|
|
127
|
+
const back = (t - i) & mask;
|
|
128
|
+
if (front < back) {
|
|
129
|
+
if (h <= i) {
|
|
130
|
+
arraycopy(els, h, els, h + 1, front);
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
// wrap
|
|
134
|
+
arraycopy(els, 0, els, 1, i);
|
|
135
|
+
els[0] = els[mask];
|
|
136
|
+
arraycopy(els, h, els, h + 1, mask - h);
|
|
137
|
+
}
|
|
138
|
+
els[h] = undefined;
|
|
139
|
+
this._head = (h + 1) & mask;
|
|
140
|
+
}
|
|
141
|
+
else if (i < t) {
|
|
142
|
+
// copy null tail as well
|
|
143
|
+
arraycopy(els, i + 1, els, i, back);
|
|
144
|
+
this._tail = t - 1;
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
// wrap
|
|
148
|
+
arraycopy(els, i + 1, els, i, mask - i);
|
|
149
|
+
els[mask] = els[0];
|
|
150
|
+
arraycopy(els, 1, els, 0, t);
|
|
151
|
+
this._tail = (t - 1) & mask;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
remove(item) {
|
|
155
|
+
const mask = this._capacity - 1;
|
|
156
|
+
let i = this._head;
|
|
157
|
+
let val;
|
|
158
|
+
while ((val = this._elements[i]) !== undefined) {
|
|
159
|
+
if (item === val) {
|
|
160
|
+
this._delete(i);
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
i = (i + 1) & mask;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
removeBy(pred) {
|
|
167
|
+
const mask = this._capacity - 1;
|
|
168
|
+
let i = this._head;
|
|
169
|
+
let val;
|
|
170
|
+
while ((val = this._elements[i]) !== undefined) {
|
|
171
|
+
if (pred(val)) {
|
|
172
|
+
this._delete(i);
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
i = (i + 1) & mask;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
at(idx) {
|
|
179
|
+
return this._elements[(this._head + idx) & (this._capacity - 1)];
|
|
180
|
+
}
|
|
181
|
+
*iter() {
|
|
182
|
+
const sz = this.length;
|
|
183
|
+
if (this._head < this._tail) {
|
|
184
|
+
// head to tail
|
|
185
|
+
for (let i = 0; i < sz; i++) {
|
|
186
|
+
yield this._elements[this._head + i];
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
const headPortion = this._capacity - this._head;
|
|
191
|
+
// head to end
|
|
192
|
+
for (let i = 0; i < headPortion; i++) {
|
|
193
|
+
yield this._elements[this._head + i];
|
|
194
|
+
}
|
|
195
|
+
// start to tail
|
|
196
|
+
for (let i = 0; i < this._tail; i++) {
|
|
197
|
+
yield this._elements[i];
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
clear() {
|
|
202
|
+
this._elements = new Array(this._capacity);
|
|
203
|
+
this._head = this._tail = 0;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
//# sourceMappingURL=deque.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deque.js","sourceRoot":"","sources":["../../../src/utils/deque.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,MAAM,oBAAoB,GAAG,CAAC,CAAA;AAE9B,6BAA6B;AAC7B,SAAS,SAAS,CAAI,GAAQ,EAAE,MAAc,EAAE,IAAS,EAAE,OAAe,EAAE,MAAc;IACtF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE;QAC7B,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;KACtC;AACL,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AK,CAAA;YAE/C,cAAc;YACd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,EAAE,CAAC,EAAE,EAAE;gBAClC,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAE,CAAA;aACxC;YACD,gBAAgB;YAChB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;gBACjC,MAAM,IAAI,CAAC,SAAS,CAAC,CAAC,CAAE,CAAA;aAC3B;SACJ;IACL,CAAC;IAED,KAAK;QACD,IAAI,CAAC,SAAS,GAAG,IAAI,KAAK,CAAgB,IAAI,CAAC,SAAS,CAAC,CAAA;QACzD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,CAAA;IAC/B,CAAC;CACJ","sourcesContent":["// ^^ because of performance reasons\nconst MIN_INITIAL_CAPACITY = 8\n\n// System.arraycopy from java\nfunction arraycopy<T>(src: T[], srcPos: number, dest: T[], destPos: number, length: number) {\n for (let i = 0; i < length; i++) {\n dest[destPos + i] = src[srcPos + i]\n }\n}\n\n/**\n * Deque implementation.\n * `undefined` values are not allowed\n *\n * Based on Java implementation\n */\nexport class Deque<T> {\n // another implementation variant would be to use\n // blocks of fixed size instead of a single array\n // to avoid copying stuff around\n protected _elements: (T | undefined)[]\n protected _head = 0\n protected _tail = 0\n protected _capacity: number\n\n constructor(\n minCapacity = MIN_INITIAL_CAPACITY,\n readonly maxLength = Infinity,\n ) {\n let capacity = minCapacity\n\n if (capacity >= MIN_INITIAL_CAPACITY) {\n // Find the best power of two to hold elements.\n // >= because array can't be full\n capacity |= capacity >>> 1\n capacity |= capacity >>> 2\n capacity |= capacity >>> 4\n capacity |= capacity >>> 8\n capacity |= capacity >>> 16\n capacity += 1\n\n if (capacity < 0) {\n // too many\n capacity >>>= 1\n }\n }\n\n this._elements = new Array<T | undefined>(capacity)\n this._capacity = capacity\n }\n\n protected _resize() {\n const p = this._head\n const n = this._capacity\n const r = n - p // number of elements to the right of the head\n\n const newCapacity = n << 1\n if (newCapacity < 0) throw new Error('Deque is too big')\n\n const arr = new Array<T | undefined>(newCapacity)\n\n // copy items to the new array\n // copy head till the end of arr\n arraycopy(this._elements, p, arr, 0, r)\n // copy from start to tail\n arraycopy(this._elements, 0, arr, r, p)\n\n this._elements = arr\n this._head = 0\n this._tail = n\n this._capacity = newCapacity\n }\n\n pushBack(item: T): void {\n if (item === undefined) throw new Error('item can not be undefined')\n\n this._elements[this._tail] = item\n\n if ((this._tail = (this._tail + 1) & (this._capacity - 1)) === this._head) {\n this._resize()\n }\n\n if (this.length > this.maxLength) {\n this.popFront()\n }\n }\n\n pushFront(item: T): void {\n if (item === undefined) throw new Error('item can not be undefined')\n\n this._elements[(this._head = (this._head - 1) & (this._capacity - 1))] = item\n\n if (this._head === this._tail) {\n this._resize()\n }\n\n if (this.length > this.maxLength) {\n this.popBack()\n }\n }\n\n popFront(): T | undefined {\n const h = this._head\n const res = this._elements[h]\n if (res === undefined) return undefined\n\n this._elements[h] = undefined\n this._head = (h + 1) & (this._capacity - 1)\n\n return res\n }\n\n popBack(): T | undefined {\n const t = (this._tail - 1) & (this._capacity - 1)\n const res = this._elements[t]\n if (res === undefined) return undefined\n\n this._elements[t] = undefined\n this._tail = t\n\n return res\n }\n\n peekFront(): T | undefined {\n return this._elements[this._head]\n }\n\n peekBack(): T | undefined {\n return this._elements[(this._tail - 1) & (this._capacity - 1)]\n }\n\n get length(): number {\n return (this._tail - this._head) & (this._capacity - 1)\n }\n\n toArray(): T[] {\n const sz = this.length\n const arr = new Array(sz)\n\n if (this._head < this._tail) {\n // copy as-is, head to tail\n arraycopy(this._elements, this._head, arr, 0, sz)\n } else {\n const headPortion = this._capacity - this._head\n\n // copy from head to end\n arraycopy(this._elements, this._head, arr, 0, headPortion)\n // copy from start to tail\n arraycopy(this._elements, 0, arr, headPortion, this._tail)\n }\n\n return arr as T[]\n }\n\n protected _delete(i: number): void {\n const els = this._elements\n const mask = this._capacity - 1\n const h = this._head\n const t = this._tail\n const front = (i - h) & mask\n const back = (t - i) & mask\n\n if (front < back) {\n if (h <= i) {\n arraycopy(els, h, els, h + 1, front)\n } else {\n // wrap\n arraycopy(els, 0, els, 1, i)\n els[0] = els[mask]\n arraycopy(els, h, els, h + 1, mask - h)\n }\n els[h] = undefined\n this._head = (h + 1) & mask\n } else if (i < t) {\n // copy null tail as well\n arraycopy(els, i + 1, els, i, back)\n this._tail = t - 1\n } else {\n // wrap\n arraycopy(els, i + 1, els, i, mask - i)\n els[mask] = els[0]\n arraycopy(els, 1, els, 0, t)\n this._tail = (t - 1) & mask\n }\n }\n\n remove(item: T): void {\n const mask = this._capacity - 1\n let i = this._head\n let val: T | undefined\n\n while ((val = this._elements[i]) !== undefined) {\n if (item === val) {\n this._delete(i)\n\n return\n }\n i = (i + 1) & mask\n }\n }\n\n removeBy(pred: (it: T) => boolean): void {\n const mask = this._capacity - 1\n let i = this._head\n let val: T | undefined\n\n while ((val = this._elements[i]) !== undefined) {\n if (pred(val)) {\n this._delete(i)\n\n return\n }\n i = (i + 1) & mask\n }\n }\n\n at(idx: number): T | undefined {\n return this._elements[(this._head + idx) & (this._capacity - 1)]\n }\n\n *iter(): IterableIterator<T> {\n const sz = this.length\n\n if (this._head < this._tail) {\n // head to tail\n for (let i = 0; i < sz; i++) {\n yield this._elements[this._head + i]!\n }\n } else {\n const headPortion = this._capacity - this._head\n\n // head to end\n for (let i = 0; i < headPortion; i++) {\n yield this._elements[this._head + i]!\n }\n // start to tail\n for (let i = 0; i < this._tail; i++) {\n yield this._elements[i]!\n }\n }\n }\n\n clear(): void {\n this._elements = new Array<T | undefined>(this._capacity)\n this._head = this._tail = 0\n }\n}\n"]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wrapper over JS timers that allows re-scheduling them
|
|
3
|
+
* to earlier time
|
|
4
|
+
*/
|
|
5
|
+
export declare class EarlyTimer {
|
|
6
|
+
private _timeout?;
|
|
7
|
+
private _immediate?;
|
|
8
|
+
private _timeoutTs?;
|
|
9
|
+
private _handler;
|
|
10
|
+
constructor();
|
|
11
|
+
/**
|
|
12
|
+
* Emit the timer when the event loop is idle
|
|
13
|
+
* (basically `setImmediate()`)
|
|
14
|
+
*/
|
|
15
|
+
emitWhenIdle(): void;
|
|
16
|
+
/**
|
|
17
|
+
* Emit the timer before the next given milliseconds
|
|
18
|
+
*
|
|
19
|
+
* Shorthand for `emitBefore(Date.now() + ms)`
|
|
20
|
+
*
|
|
21
|
+
* @param ms Milliseconds to schedule for
|
|
22
|
+
*/
|
|
23
|
+
emitBeforeNext(ms: number): void;
|
|
24
|
+
/**
|
|
25
|
+
* Emit the timer before the given time
|
|
26
|
+
*
|
|
27
|
+
* @param ts Unix time in MS
|
|
28
|
+
*/
|
|
29
|
+
emitBefore(ts: number): void;
|
|
30
|
+
/**
|
|
31
|
+
* Emit the timer right now
|
|
32
|
+
*/
|
|
33
|
+
emitNow(): void;
|
|
34
|
+
/**
|
|
35
|
+
* Cancel the timer
|
|
36
|
+
*/
|
|
37
|
+
reset(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Set timeout handler
|
|
40
|
+
*/
|
|
41
|
+
onTimeout(handler: () => void): void;
|
|
42
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wrapper over JS timers that allows re-scheduling them
|
|
3
|
+
* to earlier time
|
|
4
|
+
*/
|
|
5
|
+
export class EarlyTimer {
|
|
6
|
+
constructor() {
|
|
7
|
+
this._handler = () => { };
|
|
8
|
+
this.emitNow = this.emitNow.bind(this);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Emit the timer when the event loop is idle
|
|
12
|
+
* (basically `setImmediate()`)
|
|
13
|
+
*/
|
|
14
|
+
emitWhenIdle() {
|
|
15
|
+
if (this._immediate)
|
|
16
|
+
return;
|
|
17
|
+
clearTimeout(this._timeout);
|
|
18
|
+
this._timeoutTs = Date.now();
|
|
19
|
+
if (typeof setImmediate !== 'undefined') {
|
|
20
|
+
this._immediate = setImmediate(this.emitNow);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
this._timeout = setTimeout(this.emitNow, 0);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Emit the timer before the next given milliseconds
|
|
28
|
+
*
|
|
29
|
+
* Shorthand for `emitBefore(Date.now() + ms)`
|
|
30
|
+
*
|
|
31
|
+
* @param ms Milliseconds to schedule for
|
|
32
|
+
*/
|
|
33
|
+
emitBeforeNext(ms) {
|
|
34
|
+
return this.emitBefore(Date.now() + ms);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Emit the timer before the given time
|
|
38
|
+
*
|
|
39
|
+
* @param ts Unix time in MS
|
|
40
|
+
*/
|
|
41
|
+
emitBefore(ts) {
|
|
42
|
+
if (!this._timeoutTs || ts < this._timeoutTs) {
|
|
43
|
+
this.reset();
|
|
44
|
+
this._timeout = setTimeout(this.emitNow, ts - Date.now());
|
|
45
|
+
this._timeoutTs = ts;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Emit the timer right now
|
|
50
|
+
*/
|
|
51
|
+
emitNow() {
|
|
52
|
+
this.reset();
|
|
53
|
+
this._handler();
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Cancel the timer
|
|
57
|
+
*/
|
|
58
|
+
reset() {
|
|
59
|
+
if (this._immediate) {
|
|
60
|
+
clearImmediate(this._immediate);
|
|
61
|
+
this._immediate = undefined;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
clearTimeout(this._timeout);
|
|
65
|
+
}
|
|
66
|
+
this._timeoutTs = undefined;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Set timeout handler
|
|
70
|
+
*/
|
|
71
|
+
onTimeout(handler) {
|
|
72
|
+
this._handler = handler;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=early-timer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"early-timer.js","sourceRoot":"","sources":["../../../src/utils/early-timer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,OAAO,UAAU;IAOnB;QAFQ,aAAQ,GAAe,GAAG,EAAE,GAAE,CAAC,CAAA;QAGnC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC1C,CAAC;IAED;;;OAGG;IACH,YAAY;QACR,IAAI,IAAI,CAAC,UAAU;YAAE,OAAM;QAE3B,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QAC3B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;QAE5B,IAAI,OAAO,YAAY,KAAK,WAAW,EAAE;YACrC,IAAI,CAAC,UAAU,GAAG,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;SAC/C;aAAM;YACH,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;SAC9C;IACL,CAAC;IAED;;;;;;OAMG;IACH,cAAc,CAAC,EAAU;QACrB,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAA;IAC3C,CAAC;IAED;;;;OAIG;IACH,UAAU,CAAC,EAAU;QACjB,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,EAAE,GAAG,IAAI,CAAC,UAAU,EAAE;YAC1C,IAAI,CAAC,KAAK,EAAE,CAAA;YACZ,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,CAAA;YACzD,IAAI,CAAC,UAAU,GAAG,EAAE,CAAA;SACvB;IACL,CAAC;IAED;;OAEG;IACH,OAAO;QACH,IAAI,CAAC,KAAK,EAAE,CAAA;QACZ,IAAI,CAAC,QAAQ,EAAE,CAAA;IACnB,CAAC;IAED;;OAEG;IACH,KAAK;QACD,IAAI,IAAI,CAAC,UAAU,EAAE;YACjB,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;YAC/B,IAAI,CAAC,UAAU,GAAG,SAAS,CAAA;SAC9B;aAAM;YACH,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;SAC9B;QACD,IAAI,CAAC,UAAU,GAAG,SAAS,CAAA;IAC/B,CAAC;IAED;;OAEG;IACH,SAAS,CAAC,OAAmB;QACzB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAA;IAC3B,CAAC;CACJ","sourcesContent":["/**\n * Wrapper over JS timers that allows re-scheduling them\n * to earlier time\n */\nexport class EarlyTimer {\n private _timeout?: NodeJS.Timeout\n private _immediate?: NodeJS.Immediate\n private _timeoutTs?: number\n\n private _handler: () => void = () => {}\n\n constructor() {\n this.emitNow = this.emitNow.bind(this)\n }\n\n /**\n * Emit the timer when the event loop is idle\n * (basically `setImmediate()`)\n */\n emitWhenIdle(): void {\n if (this._immediate) return\n\n clearTimeout(this._timeout)\n this._timeoutTs = Date.now()\n\n if (typeof setImmediate !== 'undefined') {\n this._immediate = setImmediate(this.emitNow)\n } else {\n this._timeout = setTimeout(this.emitNow, 0)\n }\n }\n\n /**\n * Emit the timer before the next given milliseconds\n *\n * Shorthand for `emitBefore(Date.now() + ms)`\n *\n * @param ms Milliseconds to schedule for\n */\n emitBeforeNext(ms: number): void {\n return this.emitBefore(Date.now() + ms)\n }\n\n /**\n * Emit the timer before the given time\n *\n * @param ts Unix time in MS\n */\n emitBefore(ts: number): void {\n if (!this._timeoutTs || ts < this._timeoutTs) {\n this.reset()\n this._timeout = setTimeout(this.emitNow, ts - Date.now())\n this._timeoutTs = ts\n }\n }\n\n /**\n * Emit the timer right now\n */\n emitNow(): void {\n this.reset()\n this._handler()\n }\n\n /**\n * Cancel the timer\n */\n reset(): void {\n if (this._immediate) {\n clearImmediate(this._immediate)\n this._immediate = undefined\n } else {\n clearTimeout(this._timeout)\n }\n this._timeoutTs = undefined\n }\n\n /**\n * Set timeout handler\n */\n onTimeout(handler: () => void): void {\n this._handler = handler\n }\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flood limiter, based on TDlib
|
|
3
|
+
*/
|
|
4
|
+
export declare class FloodControl {
|
|
5
|
+
private _wakeupAt;
|
|
6
|
+
private _withoutUpdate;
|
|
7
|
+
private _events;
|
|
8
|
+
private _limits;
|
|
9
|
+
addLimit(duration: number, count: number): void;
|
|
10
|
+
addEvent(now: number): void;
|
|
11
|
+
clear(): void;
|
|
12
|
+
get wakeupAt(): number;
|
|
13
|
+
private _update;
|
|
14
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// based on https://github.dev/tdlib/td/blob/master/tdutils/td/utils/FloodControlStrict.h
|
|
2
|
+
/**
|
|
3
|
+
* Flood limiter, based on TDlib
|
|
4
|
+
*/
|
|
5
|
+
export class FloodControl {
|
|
6
|
+
constructor() {
|
|
7
|
+
this._wakeupAt = 1;
|
|
8
|
+
this._withoutUpdate = 0;
|
|
9
|
+
this._events = [];
|
|
10
|
+
// pair: duration, count
|
|
11
|
+
this._limits = [];
|
|
12
|
+
}
|
|
13
|
+
// no more than count in each duration
|
|
14
|
+
addLimit(duration, count) {
|
|
15
|
+
this._limits.push({ duration, count, pos: 0 });
|
|
16
|
+
this._withoutUpdate = 0;
|
|
17
|
+
}
|
|
18
|
+
addEvent(now) {
|
|
19
|
+
this._events.push(now);
|
|
20
|
+
if (this._withoutUpdate > 0) {
|
|
21
|
+
this._withoutUpdate -= 1;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
this._update(now);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
clear() {
|
|
28
|
+
this._events.length = 0;
|
|
29
|
+
this._withoutUpdate = 0;
|
|
30
|
+
this._wakeupAt = 1;
|
|
31
|
+
this._limits.forEach((limit) => (limit.pos = 0));
|
|
32
|
+
}
|
|
33
|
+
get wakeupAt() {
|
|
34
|
+
return this._wakeupAt;
|
|
35
|
+
}
|
|
36
|
+
_update(now) {
|
|
37
|
+
let minPos = this._events.length;
|
|
38
|
+
this._withoutUpdate = Infinity;
|
|
39
|
+
this._limits.forEach((limit) => {
|
|
40
|
+
if (limit.count < this._events.length - limit.pos) {
|
|
41
|
+
limit.pos = this._events.length - limit.count;
|
|
42
|
+
}
|
|
43
|
+
while (limit.pos < this._events.length && this._events[limit.pos] + limit.duration < now) {
|
|
44
|
+
limit.pos += 1;
|
|
45
|
+
}
|
|
46
|
+
if (limit.count + limit.pos < this._events.length) {
|
|
47
|
+
this._wakeupAt = Math.max(this._wakeupAt, this._events[limit.pos] + limit.duration);
|
|
48
|
+
this._withoutUpdate = 0;
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
this._withoutUpdate = Math.min(this._withoutUpdate, limit.count + limit.pos - this._events.length - 1);
|
|
52
|
+
}
|
|
53
|
+
minPos = Math.min(minPos, limit.pos);
|
|
54
|
+
});
|
|
55
|
+
if (minPos * 2 > this._events.length) {
|
|
56
|
+
this._limits.forEach((limit) => (limit.pos -= minPos));
|
|
57
|
+
this._events.splice(0, minPos);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=flood-control.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flood-control.js","sourceRoot":"","sources":["../../../src/utils/flood-control.ts"],"names":[],"mappings":"AAAA,yFAAyF;AAQzF;;GAEG;AACH,MAAM,OAAO,YAAY;IAAzB;QACY,cAAS,GAAG,CAAC,CAAA;QACb,mBAAc,GAAG,CAAC,CAAA;QAClB,YAAO,GAAa,EAAE,CAAA;QAC9B,wBAAw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ration: number\n count: number\n pos: number\n}\n\n/**\n * Flood limiter, based on TDlib\n */\nexport class FloodControl {\n private _wakeupAt = 1\n private _withoutUpdate = 0\n private _events: number[] = []\n // pair: duration, count\n private _limits: FloodControlLimit[] = []\n\n // no more than count in each duration\n addLimit(duration: number, count: number): void {\n this._limits.push({ duration, count, pos: 0 })\n this._withoutUpdate = 0\n }\n\n addEvent(now: number): void {\n this._events.push(now)\n\n if (this._withoutUpdate > 0) {\n this._withoutUpdate -= 1\n } else {\n this._update(now)\n }\n }\n\n clear(): void {\n this._events.length = 0\n this._withoutUpdate = 0\n this._wakeupAt = 1\n this._limits.forEach((limit) => (limit.pos = 0))\n }\n\n get wakeupAt(): number {\n return this._wakeupAt\n }\n\n private _update(now: number): void {\n let minPos = this._events.length\n this._withoutUpdate = Infinity\n\n this._limits.forEach((limit) => {\n if (limit.count < this._events.length - limit.pos) {\n limit.pos = this._events.length - limit.count\n }\n\n while (limit.pos < this._events.length && this._events[limit.pos] + limit.duration < now) {\n limit.pos += 1\n }\n\n if (limit.count + limit.pos < this._events.length) {\n this._wakeupAt = Math.max(this._wakeupAt, this._events[limit.pos] + limit.duration)\n this._withoutUpdate = 0\n } else {\n this._withoutUpdate = Math.min(this._withoutUpdate, limit.count + limit.pos - this._events.length - 1)\n }\n\n minPos = Math.min(minPos, limit.pos)\n })\n\n if (minPos * 2 > this._events.length) {\n this._limits.forEach((limit) => (limit.pos -= minPos))\n this._events.splice(0, minPos)\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Throttle a function with a given delay.
|
|
3
|
+
* Similar to lodash.
|
|
4
|
+
*
|
|
5
|
+
* Throttling `F` for a delay of `D` means that
|
|
6
|
+
* `F` will be called no more than 1 time every `D`.
|
|
7
|
+
* In this implementation, `F` is called after `D`
|
|
8
|
+
* has passed since the previous non-throttled invocation
|
|
9
|
+
*
|
|
10
|
+
* @param func Function to throttle
|
|
11
|
+
* @param delay Throttle delay
|
|
12
|
+
*/
|
|
13
|
+
export declare function throttle(func: () => void, delay: number): () => void;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Throttle a function with a given delay.
|
|
3
|
+
* Similar to lodash.
|
|
4
|
+
*
|
|
5
|
+
* Throttling `F` for a delay of `D` means that
|
|
6
|
+
* `F` will be called no more than 1 time every `D`.
|
|
7
|
+
* In this implementation, `F` is called after `D`
|
|
8
|
+
* has passed since the previous non-throttled invocation
|
|
9
|
+
*
|
|
10
|
+
* @param func Function to throttle
|
|
11
|
+
* @param delay Throttle delay
|
|
12
|
+
*/
|
|
13
|
+
export function throttle(func, delay) {
|
|
14
|
+
let timeout;
|
|
15
|
+
return function () {
|
|
16
|
+
if (timeout) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const later = () => {
|
|
20
|
+
timeout = null;
|
|
21
|
+
func();
|
|
22
|
+
};
|
|
23
|
+
timeout = setTimeout(later, delay);
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=function-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function-utils.js","sourceRoot":"","sources":["../../../src/utils/function-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAgB,EAAE,KAAa;IACpD,IAAI,OAA8B,CAAA;IAElC,OAAO;QACH,IAAI,OAAO,EAAE;YACT,OAAM;SACT;QAED,MAAM,KAAK,GAAG,GAAG,EAAE;YACf,OAAO,GAAG,IAAI,CAAA;YACd,IAAI,EAAE,CAAA;QACV,CAAC,CAAA;QACD,OAAO,GAAG,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;IACtC,CAAC,CAAA;AACL,CAAC","sourcesContent":["/**\n * Throttle a function with a given delay.\n * Similar to lodash.\n *\n * Throttling `F` for a delay of `D` means that\n * `F` will be called no more than 1 time every `D`.\n * In this implementation, `F` is called after `D`\n * has passed since the previous non-throttled invocation\n *\n * @param func Function to throttle\n * @param delay Throttle delay\n */\nexport function throttle(func: () => void, delay: number): () => void {\n let timeout: NodeJS.Timeout | null\n\n return function () {\n if (timeout) {\n return\n }\n\n const later = () => {\n timeout = null\n func()\n }\n timeout = setTimeout(later, delay)\n }\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export * from './async-lock.js';
|
|
2
|
+
export * from './bigint-utils.js';
|
|
3
|
+
export * from './buffer-utils.js';
|
|
4
|
+
export * from './condition-variable.js';
|
|
5
|
+
export * from './controllable-promise.js';
|
|
6
|
+
export * from './crypto/index.js';
|
|
7
|
+
export * from './default-dcs.js';
|
|
8
|
+
export * from './deque.js';
|
|
9
|
+
export * from './early-timer.js';
|
|
10
|
+
export * from './flood-control.js';
|
|
11
|
+
export * from './function-utils.js';
|
|
12
|
+
export * from './linked-list.js';
|
|
13
|
+
export * from './links/index.js';
|
|
14
|
+
export * from './logger.js';
|
|
15
|
+
export * from './long-utils.js';
|
|
16
|
+
export * from './lru-map.js';
|
|
17
|
+
export * from './lru-set.js';
|
|
18
|
+
export * from './misc-utils.js';
|
|
19
|
+
export * from './peer-utils.js';
|
|
20
|
+
export * from './sorted-array.js';
|
|
21
|
+
export * from './string-session.js';
|
|
22
|
+
export * from './tl-json.js';
|
|
23
|
+
export * from './type-assertions.js';
|
|
24
|
+
export * from '@mtcute/tl-runtime';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export * from './async-lock.js';
|
|
2
|
+
export * from './bigint-utils.js';
|
|
3
|
+
export * from './buffer-utils.js';
|
|
4
|
+
export * from './condition-variable.js';
|
|
5
|
+
export * from './controllable-promise.js';
|
|
6
|
+
export * from './crypto/index.js';
|
|
7
|
+
export * from './default-dcs.js';
|
|
8
|
+
export * from './deque.js';
|
|
9
|
+
export * from './early-timer.js';
|
|
10
|
+
export * from './flood-control.js';
|
|
11
|
+
export * from './function-utils.js';
|
|
12
|
+
export * from './linked-list.js';
|
|
13
|
+
export * from './links/index.js';
|
|
14
|
+
export * from './logger.js';
|
|
15
|
+
export * from './long-utils.js';
|
|
16
|
+
export * from './lru-map.js';
|
|
17
|
+
export * from './lru-set.js';
|
|
18
|
+
export * from './misc-utils.js';
|
|
19
|
+
export * from './peer-utils.js';
|
|
20
|
+
export * from './sorted-array.js';
|
|
21
|
+
export * from './string-session.js';
|
|
22
|
+
export * from './tl-json.js';
|
|
23
|
+
export * from './type-assertions.js';
|
|
24
|
+
export * from '@mtcute/tl-runtime';
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,yBAAyB,CAAA;AACvC,cAAc,2BAA2B,CAAA;AACzC,cAAc,mBAAmB,CAAA;AACjC,cAAc,kBAAkB,CAAA;AAChC,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,sBAAsB,CAAA;AACpC,cAAc,oBAAoB,CAAA","sourcesContent":["export * from './async-lock.js'\nexport * from './bigint-utils.js'\nexport * from './buffer-utils.js'\nexport * from './condition-variable.js'\nexport * from './controllable-promise.js'\nexport * from './crypto/index.js'\nexport * from './default-dcs.js'\nexport * from './deque.js'\nexport * from './early-timer.js'\nexport * from './flood-control.js'\nexport * from './function-utils.js'\nexport * from './linked-list.js'\nexport * from './links/index.js'\nexport * from './logger.js'\nexport * from './long-utils.js'\nexport * from './lru-map.js'\nexport * from './lru-set.js'\nexport * from './misc-utils.js'\nexport * from './peer-utils.js'\nexport * from './sorted-array.js'\nexport * from './string-session.js'\nexport * from './tl-json.js'\nexport * from './type-assertions.js'\nexport * from '@mtcute/tl-runtime'\n"]}
|