"basic-ftp": "^5.0.2",
"chalk": "^4.1.2",
"http-status-codes": "^2.2.0",
+ "just-clone": "^6.2.0",
+ "just-merge": "^3.2.0",
"mnemonist": "^0.39.5",
"moment": "^2.29.4",
"mongodb": "^4.13.0",
}
},
"node_modules/cacheable-request": {
- "version": "10.2.3",
- "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-10.2.3.tgz",
- "integrity": "sha512-6BehRBOs7iurNjAYN9iPazTwFDaMQavJO8W1MEm3s2pH8q/tkPTtLDRUZaweWK87WFGf2Y5wLAlaCJlR5kOz3w==",
+ "version": "10.2.4",
+ "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-10.2.4.tgz",
+ "integrity": "sha512-IWIea8ei1Ht4dBqvlvh7Gs7EYlMyBhlJybLDUB9sadEqHqftmdNieMLIR5ia3vs8gbjj9t8hXLBpUVg3vcQNbg==",
"dev": true,
"dependencies": {
- "@types/http-cache-semantics": "^4.0.1",
"get-stream": "^6.0.1",
"http-cache-semantics": "^4.1.0",
"keyv": "^4.5.2",
"node": ">=0.6.0"
}
},
+ "node_modules/just-clone": {
+ "version": "6.2.0",
+ "resolved": "https://registry.npmjs.org/just-clone/-/just-clone-6.2.0.tgz",
+ "integrity": "sha512-1IynUYEc/HAwxhi3WDpIpxJbZpMCvvrrmZVqvj9EhpvbH8lls7HhdhiByjL7DkAaWlLIzpC0Xc/VPvy/UxLNjA=="
+ },
+ "node_modules/just-merge": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/just-merge/-/just-merge-3.2.0.tgz",
+ "integrity": "sha512-cNh5FWt44hx4SpQS1xZU8Tzr/fQA69pqCdjbwxmaYYIOuRfA8EIg+dn1bGmIW03ZUtR2vkMOCjWKc+jIbpauSw=="
+ },
"node_modules/keyv": {
"version": "4.5.2",
"resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.2.tgz",
"dev": true
},
"cacheable-request": {
- "version": "10.2.3",
- "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-10.2.3.tgz",
- "integrity": "sha512-6BehRBOs7iurNjAYN9iPazTwFDaMQavJO8W1MEm3s2pH8q/tkPTtLDRUZaweWK87WFGf2Y5wLAlaCJlR5kOz3w==",
+ "version": "10.2.4",
+ "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-10.2.4.tgz",
+ "integrity": "sha512-IWIea8ei1Ht4dBqvlvh7Gs7EYlMyBhlJybLDUB9sadEqHqftmdNieMLIR5ia3vs8gbjj9t8hXLBpUVg3vcQNbg==",
"dev": true,
"requires": {
- "@types/http-cache-semantics": "^4.0.1",
"get-stream": "^6.0.1",
"http-cache-semantics": "^4.1.0",
"keyv": "^4.5.2",
"verror": "1.10.0"
}
},
+ "just-clone": {
+ "version": "6.2.0",
+ "resolved": "https://registry.npmjs.org/just-clone/-/just-clone-6.2.0.tgz",
+ "integrity": "sha512-1IynUYEc/HAwxhi3WDpIpxJbZpMCvvrrmZVqvj9EhpvbH8lls7HhdhiByjL7DkAaWlLIzpC0Xc/VPvy/UxLNjA=="
+ },
+ "just-merge": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/just-merge/-/just-merge-3.2.0.tgz",
+ "integrity": "sha512-cNh5FWt44hx4SpQS1xZU8Tzr/fQA69pqCdjbwxmaYYIOuRfA8EIg+dn1bGmIW03ZUtR2vkMOCjWKc+jIbpauSw=="
+ },
"keyv": {
"version": "4.5.2",
"resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.2.tgz",
"basic-ftp": "^5.0.2",
"chalk": "^4.1.2",
"http-status-codes": "^2.2.0",
+ "just-clone": "^6.2.0",
+ "just-merge": "^3.2.0",
"mnemonist": "^0.39.5",
"moment": "^2.29.4",
"mongodb": "^4.13.0",
'fs',
'http',
'http-status-codes',
+ 'just-clone',
+ 'just-merge',
'mnemonist/lru-map-with-delete',
'moment',
'mongodb',
}
private getConfiguredSupervisionUrl(): URL {
- const supervisionUrls = Utils.cloneObject<string | string[]>(
+ const supervisionUrls = (
this.stationInfo.supervisionUrls ?? Configuration.getSupervisionUrls()
- );
+ ).slice();
if (!Utils.isEmptyArray(supervisionUrls)) {
switch (Configuration.getSupervisionUrlDistribution()) {
case SupervisionUrlDistribution.ROUND_ROBIN:
import { fileURLToPath } from 'url';
import chalk from 'chalk';
+import merge from 'just-merge';
import { WorkerChoiceStrategies } from 'poolifier';
import {
},
};
if (Configuration.objectHasOwnProperty(Configuration.getConfig(), 'uiServer')) {
- uiServerConfiguration = Configuration.deepMerge(
+ uiServerConfiguration = Configuration.merge(
uiServerConfiguration,
Configuration.getConfig().uiServer
);
}
}
- private static isObject(item: unknown): boolean {
- return item && typeof item === 'object' && Array.isArray(item) === false;
- }
+ // private static isObject(item: unknown): boolean {
+ // return item && typeof item === 'object' && Array.isArray(item) === false;
+ // }
private static objectHasOwnProperty(object: unknown, property: string): boolean {
return Object.prototype.hasOwnProperty.call(object, property) as boolean;
return typeof obj === 'undefined';
}
- private static deepMerge(target: object, ...sources: object[]): object {
- if (!sources.length) {
- return target;
- }
- const source = sources.shift();
-
- if (Configuration.isObject(target) && Configuration.isObject(source)) {
- for (const key in source) {
- if (Configuration.isObject(source[key])) {
- if (!target[key]) {
- Object.assign(target, { [key]: {} });
- }
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
- Configuration.deepMerge(target[key], source[key]);
- } else {
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
- Object.assign(target, { [key]: source[key] });
- }
- }
- }
- return Configuration.deepMerge(target, ...sources);
+ private static merge(target: object, ...sources: object[]): object {
+ return merge(target, ...sources);
}
private static handleFileException(
import crypto from 'crypto';
+import clone from 'just-clone';
+
import { WebSocketCloseEventStatusString } from '../types/WebSocket';
export default class Utils {
);
}
- public static cloneObject<T>(object: T): T {
- return JSON.parse(JSON.stringify(object)) as T;
+ public static cloneObject<T extends object>(object: T): T {
+ return clone<T>(object);
}
public static isIterable<T>(obj: T): boolean {