fix(core): update

This commit is contained in:
Philipp Kunz 2021-09-17 19:21:34 +02:00
parent 185baac511
commit 80b0bdd663
10 changed files with 18882 additions and 2845 deletions

View File

@ -19,23 +19,36 @@ mirror:
stage: security
script:
- npmci git mirror
only:
- tags
tags:
- lossless
- docker
- notpriv
audit:
auditProductionDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install --production --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high --only=prod --production
tags:
- docker
allow_failure: true
auditDevDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high
- npmci command npm audit --audit-level=high --only=dev
tags:
- lossless
- docker
- notpriv
allow_failure: true
# ====================
# test stage
@ -50,9 +63,7 @@ testStable:
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- lossless
- docker
- priv
testBuild:
stage: test
@ -63,9 +74,7 @@ testBuild:
- npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- lossless
- docker
- notpriv
release:
stage: release
@ -85,6 +94,8 @@ release:
codequality:
stage: metadata
allow_failure: true
only:
- tags
script:
- npmci command npm install -g tslint typescript
- npmci npm prepare

24
.vscode/launch.json vendored
View File

@ -2,28 +2,10 @@
"version": "0.2.0",
"configurations": [
{
"name": "current file",
"type": "node",
"command": "npm test",
"name": "Run npm test",
"request": "launch",
"args": [
"${relativeFile}"
],
"runtimeArgs": ["-r", "@gitzone/tsrun"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": "test.ts",
"type": "node",
"request": "launch",
"args": [
"test/test.ts"
],
"runtimeArgs": ["-r", "@gitzone/tsrun"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart"
"type": "node-terminal"
}
]
}

View File

@ -15,7 +15,7 @@
"properties": {
"projectType": {
"type": "string",
"enum": ["website", "element", "service", "npm"]
"enum": ["website", "element", "service", "npm", "wcc"]
}
}
}

21608
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -11,17 +11,17 @@
"build": "(tsbuild --web)"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.24",
"@gitzone/tsbundle": "^1.0.72",
"@gitzone/tstest": "^1.0.43",
"@pushrocks/smartdelay": "^2.0.10",
"@pushrocks/tapbundle": "^3.2.9",
"@types/node": "^14.0.23",
"tslint": "^6.1.2",
"@gitzone/tsbuild": "^2.1.27",
"@gitzone/tsbundle": "^1.0.87",
"@gitzone/tstest": "^1.0.57",
"@pushrocks/smartdelay": "^2.0.13",
"@pushrocks/tapbundle": "^3.2.14",
"@types/node": "^16.9.2",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0"
},
"dependencies": {
"@pushrocks/lik": "^4.0.17",
"@pushrocks/lik": "^4.0.22",
"@pushrocks/smartcls": "^1.0.9",
"@pushrocks/smartunique": "^3.0.3",
"@types/shortid": "0.0.29"
@ -42,4 +42,4 @@
"npmextra.json",
"readme.md"
]
}
}

View File

@ -0,0 +1,3 @@
import { tap, expect } from '@pushrocks/tapbundle';
tap.test('demotask', async () => {});
tap.start();

View File

@ -4,7 +4,7 @@ import * as logcontext from '../ts/index';
let testLogger = new logcontext.Logger('testNamespace');
tap.test('should log for .error()', async () => {
testLogger.error(new Error('first error message'));
testLogger.error('first error message');
});
tap.test('should log for .fatal()', async () => {
@ -14,12 +14,12 @@ tap.test('should log for .fatal()', async () => {
// set up independent log context
tap.testParallel('should create an async LogContext', async (tools) => {
testLogger.scope(async () => {
testLogger.logmap.addData('id1', {
testLogger.logmap.addData('paramName1', {
someData: 'someValue',
});
await tools.delayFor(10).then(async () => {
testLogger.log('hi');
testLogger.error(new Error('custom error message'));
testLogger.error('custom error message');
});
});
});

View File

@ -2,11 +2,10 @@ import * as plugins from './logcontext.plugins';
import { LogMap } from './logcontext.classes.logmap';
export class Logger {
namespaceString: string;
public namespaceString: string;
smartcls: plugins.smartcls.SmartCls;
logmap: LogMap;
thirdPartyLogger: any;
child: any;
public logmap: LogMap;
public thirdPartyLogger: any;
settings = {
enableScope: () => {
this.settingsParams.scope = true;
@ -38,7 +37,7 @@ export class Logger {
}
}
addThirdPartyLogger(thirdPartyLoggerArg) {
addThirdPartyLogger(thirdPartyLoggerArg: any) {
this.thirdPartyLogger = thirdPartyLoggerArg;
}
@ -46,7 +45,7 @@ export class Logger {
* debug
* @param logMessageArg
*/
debug(logMessageArg) {
debug(logMessageArg: string) {
this.routeLog('debug', logMessageArg);
}
@ -54,16 +53,16 @@ export class Logger {
* log
* @param logMessageArg
*/
log(logMessageArg) {
log(logMessageArg: string) {
this.routeLog('log', logMessageArg);
}
/**
* info
* @param logObjectArg
* @param logMessageArg
*/
info(logObjectArg) {
this.routeLog('info', logObjectArg);
info(logMessageArg: string) {
this.routeLog('info', logMessageArg);
}
/**
@ -71,7 +70,7 @@ export class Logger {
* @param logMessageArg
* @param args
*/
error(logMessageArg, ...args) {
error(logMessageArg: string, ...args: any) {
this.routeLog('error', logMessageArg, ...args);
}
@ -80,7 +79,7 @@ export class Logger {
* @param logMessageArg
* @param args
*/
warn(logMessageArg, ...args) {
warn(logMessageArg: string, ...args: any) {
this.routeLog('warn', logMessageArg, ...args);
}
@ -89,7 +88,7 @@ export class Logger {
* @param logMessageArg
* @param args
*/
fatal(logMessageArg, ...args) {
fatal(logMessageArg: string, ...args: any) {
this.routeLog('fatal', logMessageArg, ...args);
}
@ -106,12 +105,12 @@ export class Logger {
/**
* routes the log according to whats available in the environment
* @param {string} logMethod
* @param {any} message
* @param {any} messageArg
* @param {any[]} ...args
*/
private routeLog(logMethod, message, ...args) {
private routeLog(logMethod: string, messageArg: string, ...args: any) {
const logObject = {
message: message,
message: messageArg,
type: logMethod,
logContext: this.logmap.getAllData(),
};

View File

@ -8,7 +8,7 @@ export class LogMap {
this.smartcls = clsNamespaceArg;
}
addData(paramName: string, logData) {
addData(paramName: string, logData: any) {
this.paramMap.addString(paramName);
this.smartcls.set(paramName, logData);
}
@ -22,7 +22,7 @@ export class LogMap {
}
getAllData() {
const returnObject = {};
const returnObject: any = {};
for (const stringArg of this.paramMap.getStringArray()) {
returnObject[stringArg] = this.smartcls.get(stringArg);
}

View File

@ -1,9 +1,7 @@
// native scope
import { AsyncLocalStorage } from 'async_hooks';
export {
AsyncLocalStorage
};
export { AsyncLocalStorage };
// pushrocks scope
import * as lik from '@pushrocks/lik';