tdlib-native
Advanced tools
Comparing version 1.2.3 to 1.2.4
@@ -5,3 +5,5 @@ "use strict"; | ||
async = require("./shared/async.js"), | ||
eventBus = require("./event-bus.js"); | ||
eventBus = require("./event-bus.js"), | ||
debug = require("debug"); | ||
const debugJson = debug("tdlib-native:json"); | ||
/** | ||
@@ -91,3 +93,5 @@ * | ||
assignTemporary(parameters, { _: method, "@extra": extra }, (merged) => { | ||
this._adapter.send(this._client, json.serialize(merged)); | ||
const value = json.serialize(merged); | ||
debugJson("Sent %s", value); | ||
this._adapter.send(this._client, value); | ||
}); | ||
@@ -136,5 +140,8 @@ this._requests.set(extra, data); | ||
(merged) => { | ||
return adapter.execute(client ?? null, json.serialize(merged)); | ||
const value = json.serialize(merged); | ||
debugJson("Sent sync %s", value); | ||
return adapter.execute(client ?? null, value); | ||
} | ||
); | ||
debugJson("Received sync %s", value); | ||
if (!value) { | ||
@@ -147,3 +154,3 @@ throw new TDError("Method returned null", { method, parameters }); | ||
if (typeof data !== "object" || !data || !("_" in data)) { | ||
throw new Error("Returned not an object"); | ||
throw new TDError("Returned not an object", { method, parameters }); | ||
} | ||
@@ -184,2 +191,3 @@ } catch { | ||
const value = await this._adapter.receive(this._client, 3000); | ||
debugJson("Received %s", value); | ||
if (!value) { | ||
@@ -186,0 +194,0 @@ continue; |
{ | ||
"name": "tdlib-native", | ||
"version": "1.2.3", | ||
"version": "1.2.4", | ||
"description": "🚀 Telegram TDLib native nodejs wrapper", | ||
@@ -87,2 +87,3 @@ "packageManager": "npm@9.6.2", | ||
"@rollup/plugin-replace": "^5.0.2", | ||
"@types/debug": "^4.1.7", | ||
"@types/jest": "^29.2.3", | ||
@@ -121,4 +122,5 @@ "@types/node": "^18.11.9", | ||
"dependencies": { | ||
"debug": "^4.3.4", | ||
"node-addon-api": "^6.0.0" | ||
} | ||
} |
@@ -6,3 +6,6 @@ import type { TDLib, TDLibClient } from "./shared/client"; | ||
import { EventBus, Observable } from "./event-bus"; | ||
import debug from "debug"; | ||
const debugJson = debug("tdlib-native:json"); | ||
type OmitType<T extends { _: string }> = Omit<T, "_">; | ||
@@ -111,3 +114,5 @@ | ||
assignTemporary(parameters, { _: method, "@extra": extra }, (merged) => { | ||
this._adapter.send(this._client, JSON.serialize(merged)); | ||
const value = JSON.serialize(merged); | ||
debugJson("Sent %s", value); | ||
this._adapter.send(this._client, value); | ||
}); | ||
@@ -167,7 +172,12 @@ | ||
(merged) => { | ||
const value = JSON.serialize(merged); | ||
debugJson("Sent sync %s", value); | ||
// eslint-disable-next-line unicorn/no-null | ||
return adapter.execute(client ?? null, JSON.serialize(merged)); | ||
return adapter.execute(client ?? null, value); | ||
} | ||
); | ||
debugJson("Received sync %s", value); | ||
if (!value) { | ||
@@ -183,3 +193,3 @@ throw new TDError("Method returned null", { method, parameters }); | ||
if (typeof data !== "object" || !data || !("_" in data)) { | ||
throw new Error("Returned not an object"); | ||
throw new TDError("Returned not an object", { method, parameters }); | ||
} | ||
@@ -228,2 +238,3 @@ } catch { | ||
const value = await this._adapter.receive(this._client, 3000); | ||
debugJson("Received %s", value); | ||
@@ -230,0 +241,0 @@ if (!value) { |
export const Meta = { | ||
version: "1.8.13", | ||
commitHash: "eb664b4e9f71945ef3faa802af779e1630fedb8f" | ||
commitHash: "c95598e5e1493881d31211c1329bdbe4630f6136" | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
97825991
178959
2
30
+ Addeddebug@^4.3.4
+ Addeddebug@4.3.7(transitive)
+ Addedms@2.1.3(transitive)