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

24
.vscode/launch.json vendored
View File

@ -2,28 +2,10 @@
"version": "0.2.0", "version": "0.2.0",
"configurations": [ "configurations": [
{ {
"name": "current file", "command": "npm test",
"type": "node", "name": "Run npm test",
"request": "launch", "request": "launch",
"args": [ "type": "node-terminal"
"${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"
} }
] ]
} }

View File

@ -15,7 +15,7 @@
"properties": { "properties": {
"projectType": { "projectType": {
"type": "string", "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)" "build": "(tsbuild --web)"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.24", "@gitzone/tsbuild": "^2.1.27",
"@gitzone/tsbundle": "^1.0.72", "@gitzone/tsbundle": "^1.0.87",
"@gitzone/tstest": "^1.0.43", "@gitzone/tstest": "^1.0.57",
"@pushrocks/smartdelay": "^2.0.10", "@pushrocks/smartdelay": "^2.0.13",
"@pushrocks/tapbundle": "^3.2.9", "@pushrocks/tapbundle": "^3.2.14",
"@types/node": "^14.0.23", "@types/node": "^16.9.2",
"tslint": "^6.1.2", "tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0" "tslint-config-prettier": "^1.18.0"
}, },
"dependencies": { "dependencies": {
"@pushrocks/lik": "^4.0.17", "@pushrocks/lik": "^4.0.22",
"@pushrocks/smartcls": "^1.0.9", "@pushrocks/smartcls": "^1.0.9",
"@pushrocks/smartunique": "^3.0.3", "@pushrocks/smartunique": "^3.0.3",
"@types/shortid": "0.0.29" "@types/shortid": "0.0.29"
@ -42,4 +42,4 @@
"npmextra.json", "npmextra.json",
"readme.md" "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'); let testLogger = new logcontext.Logger('testNamespace');
tap.test('should log for .error()', async () => { 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 () => { tap.test('should log for .fatal()', async () => {
@ -14,12 +14,12 @@ tap.test('should log for .fatal()', async () => {
// set up independent log context // set up independent log context
tap.testParallel('should create an async LogContext', async (tools) => { tap.testParallel('should create an async LogContext', async (tools) => {
testLogger.scope(async () => { testLogger.scope(async () => {
testLogger.logmap.addData('id1', { testLogger.logmap.addData('paramName1', {
someData: 'someValue', someData: 'someValue',
}); });
await tools.delayFor(10).then(async () => { await tools.delayFor(10).then(async () => {
testLogger.log('hi'); 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'; import { LogMap } from './logcontext.classes.logmap';
export class Logger { export class Logger {
namespaceString: string; public namespaceString: string;
smartcls: plugins.smartcls.SmartCls; smartcls: plugins.smartcls.SmartCls;
logmap: LogMap; public logmap: LogMap;
thirdPartyLogger: any; public thirdPartyLogger: any;
child: any;
settings = { settings = {
enableScope: () => { enableScope: () => {
this.settingsParams.scope = true; this.settingsParams.scope = true;
@ -38,7 +37,7 @@ export class Logger {
} }
} }
addThirdPartyLogger(thirdPartyLoggerArg) { addThirdPartyLogger(thirdPartyLoggerArg: any) {
this.thirdPartyLogger = thirdPartyLoggerArg; this.thirdPartyLogger = thirdPartyLoggerArg;
} }
@ -46,7 +45,7 @@ export class Logger {
* debug * debug
* @param logMessageArg * @param logMessageArg
*/ */
debug(logMessageArg) { debug(logMessageArg: string) {
this.routeLog('debug', logMessageArg); this.routeLog('debug', logMessageArg);
} }
@ -54,16 +53,16 @@ export class Logger {
* log * log
* @param logMessageArg * @param logMessageArg
*/ */
log(logMessageArg) { log(logMessageArg: string) {
this.routeLog('log', logMessageArg); this.routeLog('log', logMessageArg);
} }
/** /**
* info * info
* @param logObjectArg * @param logMessageArg
*/ */
info(logObjectArg) { info(logMessageArg: string) {
this.routeLog('info', logObjectArg); this.routeLog('info', logMessageArg);
} }
/** /**
@ -71,7 +70,7 @@ export class Logger {
* @param logMessageArg * @param logMessageArg
* @param args * @param args
*/ */
error(logMessageArg, ...args) { error(logMessageArg: string, ...args: any) {
this.routeLog('error', logMessageArg, ...args); this.routeLog('error', logMessageArg, ...args);
} }
@ -80,7 +79,7 @@ export class Logger {
* @param logMessageArg * @param logMessageArg
* @param args * @param args
*/ */
warn(logMessageArg, ...args) { warn(logMessageArg: string, ...args: any) {
this.routeLog('warn', logMessageArg, ...args); this.routeLog('warn', logMessageArg, ...args);
} }
@ -89,7 +88,7 @@ export class Logger {
* @param logMessageArg * @param logMessageArg
* @param args * @param args
*/ */
fatal(logMessageArg, ...args) { fatal(logMessageArg: string, ...args: any) {
this.routeLog('fatal', logMessageArg, ...args); this.routeLog('fatal', logMessageArg, ...args);
} }
@ -106,12 +105,12 @@ export class Logger {
/** /**
* routes the log according to whats available in the environment * routes the log according to whats available in the environment
* @param {string} logMethod * @param {string} logMethod
* @param {any} message * @param {any} messageArg
* @param {any[]} ...args * @param {any[]} ...args
*/ */
private routeLog(logMethod, message, ...args) { private routeLog(logMethod: string, messageArg: string, ...args: any) {
const logObject = { const logObject = {
message: message, message: messageArg,
type: logMethod, type: logMethod,
logContext: this.logmap.getAllData(), logContext: this.logmap.getAllData(),
}; };

View File

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

View File

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