Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@wireapp/commons

Package Overview
Dependencies
Maintainers
0
Versions
290
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wireapp/commons - npm Package Compare versions

Comparing version 5.2.8 to 5.2.9

24

lib/LogFactory.js

@@ -54,2 +54,13 @@ "use strict";

class LogFactory {
static logFilePath = undefined;
static COLOR_STEP = {
B: 97,
G: 79,
R: 31,
};
static COLOR_CODE = {
B: 0,
G: 0,
R: 0,
};
static getColor() {

@@ -93,3 +104,3 @@ LogFactory.COLOR_CODE.R = (LogFactory.COLOR_CODE.R + LogFactory.COLOR_STEP.R) % 256;

};
const config = Object.assign(Object.assign({}, defaults), options);
const config = { ...defaults, ...options };
if (logdown_1.default.transports.length === 0) {

@@ -112,12 +123,1 @@ logdown_1.default.transports.push(LogFactory.addTimestamp.bind({ namespace: config.namespace }));

exports.LogFactory = LogFactory;
LogFactory.logFilePath = undefined;
LogFactory.COLOR_STEP = {
B: 97,
G: 79,
R: 31,
};
LogFactory.COLOR_CODE = {
B: 0,
G: 0,
R: 0,
};

@@ -1,2 +0,1 @@

/// <reference types="node" />
import { EventEmitter } from 'events';

@@ -3,0 +2,0 @@ export declare class TypedEventEmitter<T extends Record<string | symbol, any>> extends EventEmitter {

@@ -21,3 +21,9 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.filterFalsy = exports.flatten = exports.removeDuplicates = exports.getIntersection = exports.getDifference = exports.getDeduplicatedUnion = exports.chunk = void 0;
exports.flatten = void 0;
exports.chunk = chunk;
exports.getDeduplicatedUnion = getDeduplicatedUnion;
exports.getDifference = getDifference;
exports.getIntersection = getIntersection;
exports.removeDuplicates = removeDuplicates;
exports.filterFalsy = filterFalsy;
function chunk(array, chunkSize) {

@@ -30,19 +36,14 @@ const chunks = [];

}
exports.chunk = chunk;
function getDeduplicatedUnion(array1, array2) {
return removeDuplicates(array1.concat(array2));
}
exports.getDeduplicatedUnion = getDeduplicatedUnion;
function getDifference(array1, array2) {
return array1.filter(value => !array2.includes(value));
}
exports.getDifference = getDifference;
function getIntersection(array1, array2) {
return array1.filter(value => array2.includes(value));
}
exports.getIntersection = getIntersection;
function removeDuplicates(array) {
return Array.from(new Set(array));
}
exports.removeDuplicates = removeDuplicates;
const flatten = (arrays) => [].concat(...arrays);

@@ -53,2 +54,1 @@ exports.flatten = flatten;

}
exports.filterFalsy = filterFalsy;

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.isoFormat = void 0;
exports.isoFormat = isoFormat;
/**

@@ -33,2 +33,1 @@ * Converts a date object into two strings of format `YYYY-MM-DD` and `HH:mm:ss`.

}
exports.isoFormat = isoFormat;

@@ -21,10 +21,9 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.randomInt = exports.randomArrayElement = void 0;
exports.randomArrayElement = randomArrayElement;
exports.randomInt = randomInt;
function randomArrayElement(array) {
return array[randomInt(array.length - 1)];
}
exports.randomArrayElement = randomArrayElement;
function randomInt(max) {
return Math.floor(Math.random() * (max + 1));
}
exports.randomInt = randomInt;

@@ -42,4 +42,3 @@ "use strict";

static getOSFamily() {
var _a;
const family = ((_a = Runtime.getOS().family) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || '';
const family = Runtime.getOS().family?.toLowerCase() || '';
if (family.includes('windows')) {

@@ -89,4 +88,82 @@ return OperatingSystem.WINDOWS;

static getOS() {
return Object.assign({ architecture: UNKNOWN_PROPERTY, family: UNKNOWN_PROPERTY, version: UNKNOWN_PROPERTY }, platform_1.default.os);
return {
architecture: UNKNOWN_PROPERTY,
family: UNKNOWN_PROPERTY,
version: UNKNOWN_PROPERTY,
...platform_1.default.os,
};
}
static isSupportingWebSockets = () => {
try {
return 'WebSocket' in window;
}
catch (error) {
return false;
}
};
static isSupportingClipboard = () => {
return !!navigator.clipboard;
};
static isSupportingIndexedDb = () => {
try {
return !!window.indexedDB;
}
catch (error) {
return false;
}
};
static isStagingEnvironment = () => {
return window.location.hostname.includes('staging');
};
static isEdgeEnvironment = () => {
return window.location.hostname.includes('edge');
};
static isSupportingLegacyCalling = () => {
return (Runtime.isSupportingRTCPeerConnection() &&
Runtime.isSupportingRTCDataChannel() &&
Runtime.isSupportingUserMedia() &&
Runtime.isSupportingWebSockets());
};
static isSupportingConferenceCalling = () => {
/*
* The API 'createEncodedVideoStreams' is important for Chrome 83 but got
* deprecated in Chrome 86 in favor of 'createEncodedStreams'. The
* 'createEncodedVideoStreams' API will be completely removed in
* Chrome 88+.
*/
const isSupportingEncodedVideoStreams = RTCRtpSender.prototype.hasOwnProperty('createEncodedVideoStreams');
const isSupportingEncodedStreams = RTCRtpSender.prototype.hasOwnProperty('createEncodedStreams');
return isSupportingEncodedStreams || isSupportingEncodedVideoStreams;
};
static isSupportingRTCPeerConnection = () => {
return 'RTCPeerConnection' in window;
};
static isSupportingRTCDataChannel = () => {
if (!Runtime.isSupportingRTCPeerConnection()) {
return false;
}
return !!(window.RTCPeerConnection.prototype && window.RTCPeerConnection.prototype.createDataChannel);
};
static isSupportingUserMedia = () => {
return 'mediaDevices' in navigator && 'getUserMedia' in navigator.mediaDevices;
};
static isSupportingDisplayMedia = () => {
return 'mediaDevices' in navigator && 'getDisplayMedia' in navigator.mediaDevices;
};
static isSupportingScreensharing = () => {
const hasScreenCaptureAPI = !!window.desktopCapturer ||
(Runtime.isSupportingUserMedia() && Runtime.isSupportingDisplayMedia());
return hasScreenCaptureAPI || Runtime.isFirefox();
};
static isSupportingPermissions = () => {
return !!navigator.permissions;
};
static isSupportingNotifications = () => {
const notificationNotSupported = window.Notification === undefined;
if (notificationNotSupported) {
return false;
}
const requestPermissionNotSupported = window.Notification.requestPermission === undefined;
return requestPermissionNotSupported ? false : document.visibilityState !== undefined;
};
static isChrome() {

@@ -145,75 +222,1 @@ return Runtime.getBrowserName() === CommonConfig_1.BROWSER.CHROME;

exports.Runtime = Runtime;
Runtime.isSupportingWebSockets = () => {
try {
return 'WebSocket' in window;
}
catch (error) {
return false;
}
};
Runtime.isSupportingClipboard = () => {
return !!navigator.clipboard;
};
Runtime.isSupportingIndexedDb = () => {
try {
return !!window.indexedDB;
}
catch (error) {
return false;
}
};
Runtime.isStagingEnvironment = () => {
return window.location.hostname.includes('staging');
};
Runtime.isEdgeEnvironment = () => {
return window.location.hostname.includes('edge');
};
Runtime.isSupportingLegacyCalling = () => {
return (Runtime.isSupportingRTCPeerConnection() &&
Runtime.isSupportingRTCDataChannel() &&
Runtime.isSupportingUserMedia() &&
Runtime.isSupportingWebSockets());
};
Runtime.isSupportingConferenceCalling = () => {
/*
* The API 'createEncodedVideoStreams' is important for Chrome 83 but got
* deprecated in Chrome 86 in favor of 'createEncodedStreams'. The
* 'createEncodedVideoStreams' API will be completely removed in
* Chrome 88+.
*/
const isSupportingEncodedVideoStreams = RTCRtpSender.prototype.hasOwnProperty('createEncodedVideoStreams');
const isSupportingEncodedStreams = RTCRtpSender.prototype.hasOwnProperty('createEncodedStreams');
return isSupportingEncodedStreams || isSupportingEncodedVideoStreams;
};
Runtime.isSupportingRTCPeerConnection = () => {
return 'RTCPeerConnection' in window;
};
Runtime.isSupportingRTCDataChannel = () => {
if (!Runtime.isSupportingRTCPeerConnection()) {
return false;
}
const peerConnection = new RTCPeerConnection(undefined);
return 'createDataChannel' in peerConnection;
};
Runtime.isSupportingUserMedia = () => {
return 'mediaDevices' in navigator && 'getUserMedia' in navigator.mediaDevices;
};
Runtime.isSupportingDisplayMedia = () => {
return 'mediaDevices' in navigator && 'getDisplayMedia' in navigator.mediaDevices;
};
Runtime.isSupportingScreensharing = () => {
const hasScreenCaptureAPI = !!window.desktopCapturer ||
(Runtime.isSupportingUserMedia() && Runtime.isSupportingDisplayMedia());
return hasScreenCaptureAPI || Runtime.isFirefox();
};
Runtime.isSupportingPermissions = () => {
return !!navigator.permissions;
};
Runtime.isSupportingNotifications = () => {
const notificationNotSupported = window.Notification === undefined;
if (notificationNotSupported) {
return false;
}
const requestPermissionNotSupported = window.Notification.requestPermission === undefined;
return requestPermissionNotSupported ? false : document.visibilityState !== undefined;
};

@@ -1,2 +0,1 @@

/// <reference types="node" />
export declare function capitalize(text: string): string;

@@ -3,0 +2,0 @@ export declare function pluralize(text: string, times: number, options?: {

@@ -21,16 +21,16 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.bytesToUUID = exports.uuidToBytes = exports.pluralize = exports.capitalize = void 0;
exports.capitalize = capitalize;
exports.pluralize = pluralize;
exports.uuidToBytes = uuidToBytes;
exports.bytesToUUID = bytesToUUID;
function capitalize(text) {
return text.charAt(0).toUpperCase() + text.slice(1);
}
exports.capitalize = capitalize;
function pluralize(text, times, options) {
const postfix = (options === null || options === void 0 ? void 0 : options.postfix) || 's';
const postfix = options?.postfix || 's';
return `${text}${times === 1 ? '' : postfix}`;
}
exports.pluralize = pluralize;
function uuidToBytes(uuid) {
return Buffer.from(uuid.replace(/-/g, ''), 'hex');
}
exports.uuidToBytes = uuidToBytes;
function bytesToUUID(uuid) {

@@ -40,2 +40,1 @@ const str = uuid.toString('hex');

}
exports.bytesToUUID = bytesToUUID;

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.hasURLParameter = exports.getURLParameterFromAny = exports.getURLParameterFromHash = exports.getURLParameter = exports.paramsToRecord = exports.pathWithParams = void 0;
exports.pathWithParams = pathWithParams;
exports.paramsToRecord = paramsToRecord;
exports.getURLParameter = getURLParameter;
exports.getURLParameterFromHash = getURLParameterFromHash;
exports.getURLParameterFromAny = getURLParameterFromAny;
exports.hasURLParameter = hasURLParameter;
function pathWithParams(path, additionalParams, whitelistParams, search = window.location.search) {

@@ -38,3 +43,2 @@ const params = paramsToRecord(search);

}
exports.pathWithParams = pathWithParams;
function paramsToRecord(params) {

@@ -47,3 +51,2 @@ const records = {};

}
exports.paramsToRecord = paramsToRecord;
/**

@@ -58,3 +61,2 @@ * Looks for a given parameter by name in the query part of the URL of the current window's location.

}
exports.getURLParameter = getURLParameter;
/**

@@ -73,3 +75,2 @@ * Looks for a given parameter by name in the hash part of the URL of the current window's location.

}
exports.getURLParameterFromHash = getURLParameterFromHash;
/**

@@ -96,6 +97,4 @@ * Looks for a given parameter by name in the hash and query part of the URL of the current window's location.

}
exports.getURLParameterFromAny = getURLParameterFromAny;
function hasURLParameter(parameterName, search = window.location.search) {
return !!new URLSearchParams(search).has(parameterName);
}
exports.hasURLParameter = hasURLParameter;

@@ -21,3 +21,7 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.getNewPasswordPattern = exports.DEFAULT_PASSWORD_MAX_LENGTH = exports.DEFAULT_PASSWORD_MIN_LENGTH = exports.isValidHandle = exports.isValidEmail = exports.isUUIDv4 = exports.PATTERN = void 0;
exports.DEFAULT_PASSWORD_MAX_LENGTH = exports.DEFAULT_PASSWORD_MIN_LENGTH = exports.PATTERN = void 0;
exports.isUUIDv4 = isUUIDv4;
exports.isValidEmail = isValidEmail;
exports.isValidHandle = isValidHandle;
exports.getNewPasswordPattern = getNewPasswordPattern;
exports.PATTERN = {

@@ -31,3 +35,2 @@ EMAIL: '(([^<>\\(\\)\\[\\]\\\\.,;:\\s@"]+(\\.[^<>\\(\\)\\[\\]\\\\.,;:\\s@"]+)*)|(".+"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))',

}
exports.isUUIDv4 = isUUIDv4;
function isValidEmail(email) {

@@ -37,7 +40,5 @@ const regExp = new RegExp(`^${exports.PATTERN.EMAIL}$`, 'i');

}
exports.isValidEmail = isValidEmail;
function isValidHandle(handle) {
return /^[a-z_0-9.-]{2,256}$/.test(handle);
}
exports.isValidHandle = isValidHandle;
exports.DEFAULT_PASSWORD_MIN_LENGTH = 8;

@@ -48,2 +49,1 @@ exports.DEFAULT_PASSWORD_MAX_LENGTH = 120;

}
exports.getNewPasswordPattern = getNewPasswordPattern;

@@ -39,4 +39,4 @@ {

},
"version": "5.2.8",
"gitHead": "feef5c17cee44152998a3f0a61272d1a86b00e86"
"version": "5.2.9",
"gitHead": "6dd7c585f42be7424b9f0d09cd62167880d74818"
}

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