New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@mtcute/core

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mtcute/core - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

cjs/utils/platform/exit-hook.d.ts

2

cjs/network/mtproto-session.js

@@ -108,4 +108,6 @@ "use strict";

this.queuedResendReq.length = 0;
this.queuedCancelReq.length = 0;
this.getStateSchedule.clear();
this.chains.clear();
this.chainsPendingFails.clear();
}

@@ -112,0 +114,0 @@ enqueueRpc(rpc, force) {

2

cjs/network/network-manager.js

@@ -248,3 +248,3 @@ "use strict";

systemVersion: '1.0',
appVersion: '0.3.0',
appVersion: '0.4.0',
systemLangCode: 'en',

@@ -251,0 +251,0 @@ langPack: '',

@@ -76,3 +76,3 @@ import { mtp, tl } from '@mtcute/tl';

*/
reset(withAuthKeys?: boolean): void;
reset(withAuthKeys?: boolean): MaybeAsync<void>;
/**

@@ -79,0 +79,0 @@ * Set default datacenter to use with this session.

@@ -17,3 +17,3 @@ import { JsonMemoryStorage } from './json.js';

private readonly _safe;
private readonly _cleanup;
private readonly _cleanupUnregister?;
constructor(filename: string, params?: {

@@ -41,5 +41,4 @@ /**

save(): Promise<void>;
private _processExitHandled;
private _onProcessExit;
destroy(): void;
}

@@ -29,4 +29,4 @@ "use strict";

const fs = __importStar(require("fs"));
const index_js_1 = require("../utils/index.js");
const json_js_1 = require("./json.js");
const EVENTS = ['exit', 'SIGINT', 'SIGUSR1', 'SIGUSR2', 'uncaughtException', 'SIGTERM'];
/**

@@ -47,9 +47,6 @@ * mtcute storage that stores data in a JSON file.

super();
this._processExitHandled = false;
this._filename = filename;
this._safe = params?.safe ?? true;
this._cleanup = params?.cleanup ?? true;
if (this._cleanup) {
this._onProcessExit = this._onProcessExit.bind(this);
EVENTS.forEach((event) => process.on(event, this._onProcessExit));
if (params?.cleanup !== false) {
this._cleanupUnregister = (0, index_js_1.beforeExit)(() => this._onProcessExit());
}

@@ -83,5 +80,2 @@ }

// on exit handler must be synchronous, thus we use sync methods here
if (this._processExitHandled)
return;
this._processExitHandled = true;
try {

@@ -99,5 +93,3 @@ fs.writeFileSync(this._filename, this._saveJson());

destroy() {
if (this._cleanup) {
EVENTS.forEach((event) => process.off(event, this._onProcessExit));
}
this._cleanupUnregister?.();
}

@@ -104,0 +96,0 @@ }

@@ -19,2 +19,3 @@ export * from './async-lock.js';

export * from './peer-utils.js';
export * from './platform/exit-hook.js';
export * from './sorted-array.js';

@@ -21,0 +22,0 @@ export * from './string-session.js';

@@ -35,2 +35,3 @@ "use strict";

__exportStar(require("./peer-utils.js"), exports);
__exportStar(require("./platform/exit-hook.js"), exports);
__exportStar(require("./sorted-array.js"), exports);

@@ -37,0 +38,0 @@ __exportStar(require("./string-session.js"), exports);

@@ -102,4 +102,6 @@ import Long from 'long';

this.queuedResendReq.length = 0;
this.queuedCancelReq.length = 0;
this.getStateSchedule.clear();
this.chains.clear();
this.chainsPendingFails.clear();
}

@@ -106,0 +108,0 @@ enqueueRpc(rpc, force) {

@@ -244,3 +244,3 @@ import { tl } from '@mtcute/tl';

systemVersion: '1.0',
appVersion: '0.3.0',
appVersion: '0.4.0',
systemLangCode: 'en',

@@ -247,0 +247,0 @@ langPack: '',

@@ -76,3 +76,3 @@ import { mtp, tl } from '@mtcute/tl';

*/
reset(withAuthKeys?: boolean): void;
reset(withAuthKeys?: boolean): MaybeAsync<void>;
/**

@@ -79,0 +79,0 @@ * Set default datacenter to use with this session.

@@ -17,3 +17,3 @@ import { JsonMemoryStorage } from './json.js';

private readonly _safe;
private readonly _cleanup;
private readonly _cleanupUnregister?;
constructor(filename: string, params?: {

@@ -41,5 +41,4 @@ /**

save(): Promise<void>;
private _processExitHandled;
private _onProcessExit;
destroy(): void;
}
// eslint-disable-next-line no-restricted-imports
import * as fs from 'fs';
import { beforeExit } from '../utils/index.js';
import { JsonMemoryStorage } from './json.js';
const EVENTS = ['exit', 'SIGINT', 'SIGUSR1', 'SIGUSR2', 'uncaughtException', 'SIGTERM'];
/**

@@ -20,9 +20,6 @@ * mtcute storage that stores data in a JSON file.

super();
this._processExitHandled = false;
this._filename = filename;
this._safe = params?.safe ?? true;
this._cleanup = params?.cleanup ?? true;
if (this._cleanup) {
this._onProcessExit = this._onProcessExit.bind(this);
EVENTS.forEach((event) => process.on(event, this._onProcessExit));
if (params?.cleanup !== false) {
this._cleanupUnregister = beforeExit(() => this._onProcessExit());
}

@@ -56,5 +53,2 @@ }

// on exit handler must be synchronous, thus we use sync methods here
if (this._processExitHandled)
return;
this._processExitHandled = true;
try {

@@ -72,7 +66,5 @@ fs.writeFileSync(this._filename, this._saveJson());

destroy() {
if (this._cleanup) {
EVENTS.forEach((event) => process.off(event, this._onProcessExit));
}
this._cleanupUnregister?.();
}
}
//# sourceMappingURL=json-file.js.map

@@ -19,2 +19,3 @@ export * from './async-lock.js';

export * from './peer-utils.js';
export * from './platform/exit-hook.js';
export * from './sorted-array.js';

@@ -21,0 +22,0 @@ export * from './string-session.js';

@@ -19,2 +19,3 @@ export * from './async-lock.js';

export * from './peer-utils.js';
export * from './platform/exit-hook.js';
export * from './sorted-array.js';

@@ -21,0 +22,0 @@ export * from './string-session.js';

{
"name": "@mtcute/core",
"version": "0.3.0",
"version": "0.4.0",
"description": "Core functions and base MTProto client",

@@ -19,2 +19,4 @@ "author": "Alina Sireneva <alina@tei.su>",

"./cjs/utils/platform/random.js": "./cjs/utils/platform/random.web.js",
"./esm/utils/platform/exit-hook.js": "./esm/utils/platform/exit-hook.web.js",
"./cjs/utils/platform/exit-hook.js": "./cjs/utils/platform/exit-hook.web.js",
"./esm/storage/json-file.js": false,

@@ -24,5 +26,5 @@ "./cjs/storage/json-file.js": false

"dependencies": {
"@mtcute/tl": "^167.0.1",
"@mtcute/tl-runtime": "^0.3.0",
"@mtcute/wasm": "^0.3.0",
"@mtcute/tl": "^169.0.0",
"@mtcute/tl-runtime": "^0.4.0",
"@mtcute/wasm": "^0.4.0",
"@types/events": "3.0.0",

@@ -29,0 +31,0 @@ "events": "3.2.0",

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc