@composer-js/core
Advanced tools
Comparing version 1.3.0 to 1.4.0
@@ -13,3 +13,3 @@ "use strict"; | ||
/////////////////////////////////////////////////////////////////////////////// | ||
// Copyright (C) 2018 AcceleratXR, Inc. All rights reserved. | ||
// Copyright (C) AcceleratXR, Inc. All rights reserved. | ||
/////////////////////////////////////////////////////////////////////////////// | ||
@@ -16,0 +16,0 @@ const fs = require("fs"); |
@@ -13,3 +13,3 @@ "use strict"; | ||
/////////////////////////////////////////////////////////////////////////////// | ||
// Copyright (C) 2018 AcceleratXR, Inc. All rights reserved. | ||
// Copyright (C) AcceleratXR, Inc. All rights reserved. | ||
/////////////////////////////////////////////////////////////////////////////// | ||
@@ -16,0 +16,0 @@ const child_process = require("child_process"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/////////////////////////////////////////////////////////////////////////////// | ||
// Copyright (C) 2018 AcceleratXR, Inc. All rights reserved. | ||
// Copyright (C) AcceleratXR, Inc. All rights reserved. | ||
/////////////////////////////////////////////////////////////////////////////// | ||
@@ -6,0 +6,0 @@ const crypto = require("crypto"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/////////////////////////////////////////////////////////////////////////////// | ||
// Copyright (C) 2018 AcceleratXR, Inc. All rights reserved. | ||
// Copyright (C) AcceleratXR, Inc. All rights reserved. | ||
/////////////////////////////////////////////////////////////////////////////// | ||
@@ -6,0 +6,0 @@ const winston = require("winston"); |
@@ -13,3 +13,3 @@ "use strict"; | ||
/////////////////////////////////////////////////////////////////////////////// | ||
// Copyright (C) 2018 AcceleratXR, Inc. All rights reserved. | ||
// Copyright (C) AcceleratXR, Inc. All rights reserved. | ||
/////////////////////////////////////////////////////////////////////////////// | ||
@@ -16,0 +16,0 @@ const fs = require("fs"); |
"use strict"; | ||
/////////////////////////////////////////////////////////////////////////////// | ||
// Copyright (C) 2018 AcceleratXR, Inc. All rights reserved. | ||
// Copyright (C) AcceleratXR, Inc. All rights reserved. | ||
/////////////////////////////////////////////////////////////////////////////// | ||
@@ -5,0 +5,0 @@ Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -5,2 +5,4 @@ "use strict"; | ||
exports.ThreadPool = ThreadPool_1.default; | ||
var ThreadWinstonTransport_1 = require("./ThreadWinstonTransport"); | ||
exports.ThreadWinstonTransport = ThreadWinstonTransport_1.default; | ||
//# sourceMappingURL=index.js.map |
@@ -13,5 +13,6 @@ "use strict"; | ||
/////////////////////////////////////////////////////////////////////////////// | ||
// Copyright (C) 2019 AcceleratXR, Inc. All rights reserved. | ||
// Copyright (C) AcceleratXR, Inc. All rights reserved. | ||
/////////////////////////////////////////////////////////////////////////////// | ||
const worker_threads_1 = require("worker_threads"); | ||
const { LEVEL, MESSAGE } = require('triple-beam'); | ||
const os = require("os"); | ||
@@ -30,4 +31,5 @@ /** | ||
* @param restartOnExit Set to `true` to restart a worker thread on exit, otherwise set to `false`. Default is `true`. | ||
* @param logger The Winston logger instance to forward all worker thread logs to. | ||
*/ | ||
constructor(max = 0, restartOnExit = true) { | ||
constructor(max = 0, restartOnExit = true, logger) { | ||
if (max <= 0) { | ||
@@ -38,2 +40,3 @@ max = os.cpus().length; | ||
this.lastThread = 0; | ||
this.logger = logger; | ||
this.restartOnExit = restartOnExit; | ||
@@ -86,7 +89,12 @@ this.callbacks = new Map(); | ||
})); | ||
worker.on("message", (...args) => { | ||
const listeners = this.callbacks.get("message"); | ||
if (listeners) { | ||
for (const callback of listeners) { | ||
callback(...args); | ||
worker.on("message", (value) => { | ||
if (value && value.type === "winston-log") { | ||
this.logger.log(value.info[LEVEL], value.info[MESSAGE]); | ||
} | ||
else { | ||
const listeners = this.callbacks.get("message"); | ||
if (listeners) { | ||
for (const callback of listeners) { | ||
callback(value); | ||
} | ||
} | ||
@@ -93,0 +101,0 @@ } |
"use strict"; | ||
/////////////////////////////////////////////////////////////////////////////// | ||
// Copyright (C) 2019 AcceleratXR, Inc. All rights reserved. | ||
// Copyright (C) AcceleratXR, Inc. All rights reserved. | ||
/////////////////////////////////////////////////////////////////////////////// | ||
@@ -5,0 +5,0 @@ Object.defineProperty(exports, "__esModule", { value: true }); |
export { default as ThreadPool } from "./ThreadPool"; | ||
export { default as ThreadWinstonTransport } from "./ThreadWinstonTransport"; |
@@ -14,2 +14,4 @@ /// <reference types="node" /> | ||
private lastThread; | ||
/** The instance of Winston logger to forward thread logs to. */ | ||
private logger; | ||
/** The maximum number of threads allowed. */ | ||
@@ -36,4 +38,5 @@ private maxThreads; | ||
* @param restartOnExit Set to `true` to restart a worker thread on exit, otherwise set to `false`. Default is `true`. | ||
* @param logger The Winston logger instance to forward all worker thread logs to. | ||
*/ | ||
constructor(max?: number, restartOnExit?: boolean); | ||
constructor(max?: number, restartOnExit?: boolean, logger?: any); | ||
private createWorker; | ||
@@ -40,0 +43,0 @@ /** |
{ | ||
"name": "@composer-js/core", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "A collection of common utilities and core functionality for composerjs applications.", | ||
@@ -20,3 +20,3 @@ "author": "AcceleratXR, Inc. <info@acceleratxr.com>", | ||
"build": "tsc", | ||
"docs": "typedoc --plugin typedoc-plugin-markdown --out docs --target esnext --mode file src", | ||
"docs": "typedoc --out docs/reference --target es6 --theme markdown --mode file src", | ||
"test": "jest --coverage", | ||
@@ -124,4 +124,5 @@ "test:watch": "jest --coverage --watch", | ||
"jsonwebtoken": "^8.5.0", | ||
"uuid": "^3.3.3" | ||
"uuid": "^3.3.3", | ||
"winston-transport": "^4.4.0" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# Composer: core | ||
# Composer: Core Library | ||
@@ -3,0 +3,0 @@ [![pipeline status](https://gitlab.com/AcceleratXR/composerjs/composer-core/badges/master/pipeline.svg)](https://gitlab.com/AcceleratXR/composerjs/composer-core/-/commits/master) |
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
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
101438
36
1619
7
+ Addedwinston-transport@^4.4.0
+ Added@colors/colors@1.6.0(transitive)
+ Added@types/triple-beam@1.3.5(transitive)
+ Addedfecha@4.2.3(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedlogform@2.7.0(transitive)
+ Addedreadable-stream@3.6.2(transitive)
+ Addedsafe-stable-stringify@2.5.0(transitive)
+ Addedstring_decoder@1.3.0(transitive)
+ Addedtriple-beam@1.4.1(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addedwinston-transport@4.9.0(transitive)