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

@ulixee/commons

Package Overview
Dependencies
Maintainers
2
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ulixee/commons - npm Package Compare versions

Comparing version 2.0.0-alpha.8 to 2.0.0-alpha.9

lib/bufferUtils.d.ts

1

config/servers.d.ts

@@ -10,2 +10,3 @@ export default class UlixeeServerConfig {

getVersionHost(version: string): string;
checkLocalVersionHost(version: string, host: string): Promise<string>;
save(): Promise<void>;

@@ -12,0 +13,0 @@ private getData;

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

const VersionUtils_1 = require("../lib/VersionUtils");
const utils_1 = require("../lib/utils");
class UlixeeServerConfig {

@@ -53,2 +54,13 @@ constructor(directoryPath) {

}
async checkLocalVersionHost(version, host) {
if (!host?.startsWith('localhost'))
return host;
if (host?.startsWith('localhost')) {
if (!(await (0, utils_1.isPortInUse)(host.split(':').pop()))) {
await UlixeeServerConfig.global.setVersionHost(version, null);
return null;
}
}
return host;
}
save() {

@@ -55,0 +67,0 @@ return (0, fileUtils_1.safeOverwriteFile)(this.configPath, JSON.stringify(this.getData(), null, 2));

6

lib/hashUtils.d.ts
/// <reference types="node" />
export declare function sha3(data: Buffer | string): Buffer;
export declare function encodeHash(digest: Buffer, prefix: 'scr' | 'dbx'): string;
export declare function sortedJsonStringify<T>(obj: T | null, ignoreProperties?: (keyof T)[]): string;
export declare function hashObject<T>(obj: T, ignoreProperties?: (keyof T)[]): Buffer;
export declare function hashObject<T>(obj: T, options?: {
prefix?: Buffer;
ignoreProperties?: (keyof T)[];
}): Buffer;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.hashObject = exports.sortedJsonStringify = exports.encodeHash = exports.sha3 = void 0;
exports.hashObject = exports.sortedJsonStringify = exports.sha3 = void 0;
const crypto_1 = require("crypto");
const bech32_1 = require("bech32");
const TypeSerializer_1 = require("./TypeSerializer");

@@ -11,7 +10,2 @@ function sha3(data) {

exports.sha3 = sha3;
function encodeHash(digest, prefix) {
const words = bech32_1.bech32m.toWords(digest);
return bech32_1.bech32m.encode(prefix, words);
}
exports.encodeHash = encodeHash;
function sortedJsonStringify(obj, ignoreProperties = []) {

@@ -27,8 +21,11 @@ if (!obj) {

exports.sortedJsonStringify = sortedJsonStringify;
function hashObject(obj, ignoreProperties = []) {
function hashObject(obj, options) {
// sort keys for consistent hash
const json = sortedJsonStringify(obj, ignoreProperties);
return (0, crypto_1.createHash)('sha3-256').update(Buffer.from(json)).digest();
const json = sortedJsonStringify(obj, options?.ignoreProperties);
let buffer = Buffer.from(json);
if (options?.prefix)
buffer = Buffer.concat([options.prefix, buffer]);
return (0, crypto_1.createHash)('sha3-256').update(buffer).digest();
}
exports.hashObject = hashObject;
//# sourceMappingURL=hashUtils.js.map

@@ -108,5 +108,9 @@ "use strict";

}
if (value.toJSON) {
return value.toJSON();
if (value instanceof BigInt || typeof value === 'bigint') {
return `${value.toString()}n`;
}
if (Buffer.isBuffer(value)) {
if (value.length <= 256)
return `0x${value.toString('hex')}`;
}
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {

@@ -117,2 +121,5 @@ return value;

return value;
if (value.toJSON) {
return value.toJSON();
}
if (typeof value === 'object') {

@@ -201,2 +208,4 @@ if (Array.isArray(value)) {

function isEnabled(modulePath) {
if (process.env.ULX_DEBUG === '1' || process.env.ULX_DEBUG === 'true')
return true;
if (modulePath in logFilters.enabledNamesCache)

@@ -203,0 +212,0 @@ return logFilters.enabledNamesCache[modulePath];

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

this.isRegistered = true;
process.once('beforeExit', code => ShutdownHandler.onSignal('beforeExit', code));
process.once('exit', code => ShutdownHandler.onSignal('exit', code));

@@ -17,0 +18,0 @@ process.once('SIGTERM', ShutdownHandler.onSignal.bind(this));

@@ -26,2 +26,3 @@ /// <reference types="node" />

protected queuePendingInsert(record: IRecord): void;
protected objectToInsert(object: T): IRecord;
protected buildInsertStatement(): string;

@@ -28,0 +29,0 @@ private addRecordToPublish;

@@ -52,2 +52,9 @@ "use strict";

}
objectToInsert(object) {
const record = [];
for (const [key] of this.columns) {
record.push(object[key]);
}
return record;
}
buildInsertStatement() {

@@ -54,0 +61,0 @@ const keys = this.columns.map(x => x[0]);

@@ -9,2 +9,3 @@ export default class TypeSerializer {

sortKeys?: boolean;
format?: boolean;
}): string;

@@ -11,0 +12,0 @@ static replace<T>(object: T, options?: {

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

const final = TypeSerializer.replace(object, options);
return JSON.stringify(final);
return JSON.stringify(final, null, options?.format ? 2 : null);
}

@@ -85,2 +85,4 @@ static replace(object, options) {

return value;
if (value === true || value === false)
return value;
if (Number.isNaN(value)) {

@@ -98,3 +100,3 @@ return { __type: Types.NaN };

return value;
if (type === Types.bigint) {
if (type === Types.bigint || value instanceof BigInt) {
return { __type: Types.bigint, value: value.toString() };

@@ -101,0 +103,0 @@ }

import IResolvablePromise from '../interfaces/IResolvablePromise';
import ISourceCodeLocation from '../interfaces/ISourceCodeLocation';
export declare function assert(value: unknown, message?: string, reject?: any): void;
export declare function isPortInUse(port: number | string): Promise<boolean>;
export declare function getCallSite(priorToFilename?: string, endFilename?: string): ISourceCodeLocation[];

@@ -5,0 +6,0 @@ export declare function getCallsite(priorToFilename?: string, endFilename?: string): ISourceCodeLocation[];

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createPromise = exports.bindFunctions = exports.getPrototypeHierarchy = exports.getObjectFunctionProperties = exports.pickRandom = exports.escapeUnescapedChar = exports.getCallsite = exports.getCallSite = exports.assert = void 0;
exports.createPromise = exports.bindFunctions = exports.getPrototypeHierarchy = exports.getObjectFunctionProperties = exports.pickRandom = exports.escapeUnescapedChar = exports.getCallsite = exports.getCallSite = exports.isPortInUse = exports.assert = void 0;
const net = require("net");
const Resolvable_1 = require("./Resolvable");

@@ -17,2 +18,23 @@ function assert(value, message, reject) {

exports.assert = assert;
function isPortInUse(port) {
return new Promise((resolve, reject) => {
const client = new net.Socket();
let isInUse = true;
client.once('error', err => {
if (err.code === 'ECONNREFUSED') {
isInUse = false;
resolve(isInUse);
}
else {
reject(err);
}
client.removeAllListeners().end().destroy().unref();
});
client.connect(Number(port), () => {
resolve(isInUse);
client.removeAllListeners().end().destroy().unref();
});
});
}
exports.isPortInUse = isPortInUse;
// @deprecated - change case... can't remove due to hero dependency

@@ -19,0 +41,0 @@ function getCallSite(priorToFilename, endFilename) {

{
"name": "@ulixee/commons",
"version": "2.0.0-alpha.8",
"version": "2.0.0-alpha.9",
"description": "Common utilities for Ulixee",

@@ -19,3 +19,3 @@ "license": "MIT",

},
"gitHead": "22fdb67ce605a9e81ab0af47904f10fa1aac9e3b"
"gitHead": "67fba1366a0f694d62a47628ee2cbf14dd031a66"
}

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 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