fix(core): update

This commit is contained in:
Philipp Kunz 2022-06-26 09:27:01 +02:00
parent 74794d3212
commit d3ac393793
12 changed files with 3289 additions and 19918 deletions

View File

@ -12,6 +12,9 @@ stages:
- release - release
- metadata - metadata
before_script:
- npm install -g @shipzone/npmci
# ==================== # ====================
# security stage # security stage
# ==================== # ====================
@ -19,23 +22,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 +66,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 +77,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,11 +97,12 @@ 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 typescript
- npmci npm prepare - npmci npm prepare
- npmci npm install - npmci npm install
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
tags: tags:
- lossless - lossless
- docker - docker
@ -109,11 +122,10 @@ trigger:
pages: pages:
stage: metadata stage: metadata
script: script:
- npmci node install lts - npmci node install stable
- npmci command npm install -g @gitzone/tsdoc
- npmci npm prepare - npmci npm prepare
- npmci npm install - npmci npm install
- npmci command tsdoc - npmci command npm run buildDocs
tags: tags:
- lossless - lossless
- docker - docker

4
.snyk
View File

@ -1,4 +0,0 @@
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
version: v1.13.1
ignore: {}
patch: {}

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"]
} }
} }
} }

23043
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -10,21 +10,22 @@
"scripts": { "scripts": {
"test": "(tstest test/)", "test": "(tstest test/)",
"build": "(tsbuild --web)", "build": "(tsbuild --web)",
"format": "(gitzone format)" "format": "(gitzone format)",
"buildDocs": "tsdoc"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.29", "@gitzone/tsbuild": "^2.1.63",
"@gitzone/tstest": "^1.0.64", "@gitzone/tstest": "^1.0.71",
"@pushrocks/qenv": "^4.0.10", "@pushrocks/qenv": "^4.0.10",
"@pushrocks/tapbundle": "^4.0.8", "@pushrocks/tapbundle": "^5.0.3",
"@types/node": "^17.0.21", "@types/node": "^18.0.0",
"tslint": "^6.1.3", "tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0" "tslint-config-prettier": "^1.18.0"
}, },
"dependencies": { "dependencies": {
"@pushrocks/smarthash": "^2.1.10", "@pushrocks/smarthash": "^2.1.10",
"@pushrocks/smartlog-interfaces": "^2.0.23", "@pushrocks/smartlog-interfaces": "^2.0.23",
"@pushrocks/smartrequest": "^1.1.56" "@pushrocks/webrequest": "^3.0.7"
}, },
"files": [ "files": [
"ts/**/*", "ts/**/*",
@ -37,5 +38,9 @@
"cli.js", "cli.js",
"npmextra.json", "npmextra.json",
"readme.md" "readme.md"
],
"type": "module",
"browserslist": [
"last 1 chrome versions"
] ]
} }

View File

@ -3,14 +3,14 @@ import { Qenv } from '@pushrocks/qenv';
import * as smartlog from '@pushrocks/smartlog'; import * as smartlog from '@pushrocks/smartlog';
const testQenv = new Qenv('./', './.nogit/'); const testQenv = new Qenv('./', './.nogit/');
import * as smartlogDestinationReceiver from '../ts/index'; import * as smartlogDestinationReceiver from '../ts/index.js';
let testSmartlogReceiver: smartlogDestinationReceiver.SmartlogDestinationReceiver; let testSmartlogReceiver: smartlogDestinationReceiver.SmartlogDestinationReceiver;
tap.test('should create a valid SmartlogDestinationReceiver', async () => { tap.test('should create a valid SmartlogDestinationReceiver', async () => {
testSmartlogReceiver = new smartlogDestinationReceiver.SmartlogDestinationReceiver({ testSmartlogReceiver = new smartlogDestinationReceiver.SmartlogDestinationReceiver({
receiverEndpoint: testQenv.getEnvVarOnDemand('RECEIVER_ENDPOINT'), receiverEndpoint: testQenv.getEnvVarOnDemand('RECEIVER_ENDPOINT'),
passphrase: testQenv.getEnvVarOnDemand('PASSPHRASE') passphrase: testQenv.getEnvVarOnDemand('PASSPHRASE'),
}); });
}); });
@ -23,15 +23,15 @@ tap.test('should send a valid message', async () => {
containerName: 'tapbundle-test', containerName: 'tapbundle-test',
environment: 'local', environment: 'local',
runtime: 'node', runtime: 'node',
zone: 'gitzone' zone: 'gitzone',
}, },
type: 'log', type: 'log',
level: 'info', level: 'info',
correlation: { correlation: {
id: '123', id: '123',
type: 'none' type: 'none',
}, },
message: 'This is a message' message: 'This is a message',
}); });
}); });

8
ts/00_commitinfo_data.ts Normal file
View File

@ -0,0 +1,8 @@
/**
* autocreated commitinfo by @pushrocks/commitinfo
*/
export const commitinfo = {
name: '@pushrocks/smartlog-destination-receiver',
version: '1.0.10',
description: 'a smartlog destination for smartlog-receiver'
}

View File

@ -1,8 +1,8 @@
import * as plugins from './smartlog-destination-receiver.plugins'; import * as plugins from './smartlog-destination-receiver.plugins.js';
import { import {
ILogDestination, ILogDestination,
ILogPackageAuthenticated, ILogPackageAuthenticated,
ILogPackage ILogPackage,
} from '@pushrocks/smartlog-interfaces'; } from '@pushrocks/smartlog-interfaces';
export interface ISmartlogDestinationReceiverConstructorOptions { export interface ISmartlogDestinationReceiverConstructorOptions {
@ -12,17 +12,18 @@ export interface ISmartlogDestinationReceiverConstructorOptions {
export class SmartlogDestinationReceiver implements ILogDestination { export class SmartlogDestinationReceiver implements ILogDestination {
private options: ISmartlogDestinationReceiverConstructorOptions; private options: ISmartlogDestinationReceiverConstructorOptions;
private webrequest = new plugins.webrequest.WebRequest();
constructor(optionsArg: ISmartlogDestinationReceiverConstructorOptions) { constructor(optionsArg: ISmartlogDestinationReceiverConstructorOptions) {
this.options = optionsArg; this.options = optionsArg;
} }
public async handleLog(logPackageArg: ILogPackage) { public async handleLog(logPackageArg: ILogPackage) {
const response = await plugins.smartrequest.postJson(this.options.receiverEndpoint, { const response = await this.webrequest.postJson(this.options.receiverEndpoint, {
requestBody: { requestBody: {
auth: plugins.smarthash.sha256FromStringSync(this.options.passphrase), auth: plugins.smarthash.sha256FromStringSync(this.options.passphrase),
logPackage: logPackageArg logPackage: logPackageArg,
} },
}); });
return response.body; return response.body;
} }

View File

@ -1,5 +1,5 @@
import * as smarthash from '@pushrocks/smarthash'; import * as smarthash from '@pushrocks/smarthash';
import * as smartlogInterfaces from '@pushrocks/smartlog-interfaces'; import * as smartlogInterfaces from '@pushrocks/smartlog-interfaces';
import * as smartrequest from '@pushrocks/smartrequest'; import * as webrequest from '@pushrocks/webrequest';
export { smarthash, smartlogInterfaces, smartrequest }; export { smarthash, smartlogInterfaces, webrequest };

9
tsconfig.json Normal file
View File

@ -0,0 +1,9 @@
{
"compilerOptions": {
"experimentalDecorators": true,
"useDefineForClassFields": false,
"target": "ES2022",
"module": "ES2022",
"moduleResolution": "nodenext"
}
}

View File

@ -1,17 +0,0 @@
{
"extends": ["tslint:latest", "tslint-config-prettier"],
"rules": {
"semicolon": [true, "always"],
"no-console": false,
"ordered-imports": false,
"object-literal-sort-keys": false,
"member-ordering": {
"options":{
"order": [
"static-method"
]
}
}
},
"defaultSeverity": "warning"
}