fix(core): update
This commit is contained in:
parent
74794d3212
commit
d3ac393793
@ -12,6 +12,9 @@ stages:
|
||||
- release
|
||||
- metadata
|
||||
|
||||
before_script:
|
||||
- npm install -g @shipzone/npmci
|
||||
|
||||
# ====================
|
||||
# security stage
|
||||
# ====================
|
||||
@ -19,23 +22,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 +66,7 @@ testStable:
|
||||
- npmci npm test
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- priv
|
||||
|
||||
testBuild:
|
||||
stage: test
|
||||
@ -63,9 +77,7 @@ testBuild:
|
||||
- npmci command npm run build
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
release:
|
||||
stage: release
|
||||
@ -85,11 +97,12 @@ release:
|
||||
codequality:
|
||||
stage: metadata
|
||||
allow_failure: true
|
||||
only:
|
||||
- tags
|
||||
script:
|
||||
- npmci command npm install -g tslint typescript
|
||||
- npmci command npm install -g typescript
|
||||
- npmci npm prepare
|
||||
- npmci npm install
|
||||
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
@ -109,11 +122,10 @@ trigger:
|
||||
pages:
|
||||
stage: metadata
|
||||
script:
|
||||
- npmci node install lts
|
||||
- npmci command npm install -g @gitzone/tsdoc
|
||||
- npmci node install stable
|
||||
- npmci npm prepare
|
||||
- npmci npm install
|
||||
- npmci command tsdoc
|
||||
- npmci command npm run buildDocs
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
|
4
.snyk
4
.snyk
@ -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
24
.vscode/launch.json
vendored
@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@ -15,7 +15,7 @@
|
||||
"properties": {
|
||||
"projectType": {
|
||||
"type": "string",
|
||||
"enum": ["website", "element", "service", "npm"]
|
||||
"enum": ["website", "element", "service", "npm", "wcc"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
23061
package-lock.json
generated
23061
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
19
package.json
19
package.json
@ -10,21 +10,22 @@
|
||||
"scripts": {
|
||||
"test": "(tstest test/)",
|
||||
"build": "(tsbuild --web)",
|
||||
"format": "(gitzone format)"
|
||||
"format": "(gitzone format)",
|
||||
"buildDocs": "tsdoc"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.1.29",
|
||||
"@gitzone/tstest": "^1.0.64",
|
||||
"@gitzone/tsbuild": "^2.1.63",
|
||||
"@gitzone/tstest": "^1.0.71",
|
||||
"@pushrocks/qenv": "^4.0.10",
|
||||
"@pushrocks/tapbundle": "^4.0.8",
|
||||
"@types/node": "^17.0.21",
|
||||
"@pushrocks/tapbundle": "^5.0.3",
|
||||
"@types/node": "^18.0.0",
|
||||
"tslint": "^6.1.3",
|
||||
"tslint-config-prettier": "^1.18.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pushrocks/smarthash": "^2.1.10",
|
||||
"@pushrocks/smartlog-interfaces": "^2.0.23",
|
||||
"@pushrocks/smartrequest": "^1.1.56"
|
||||
"@pushrocks/webrequest": "^3.0.7"
|
||||
},
|
||||
"files": [
|
||||
"ts/**/*",
|
||||
@ -37,5 +38,9 @@
|
||||
"cli.js",
|
||||
"npmextra.json",
|
||||
"readme.md"
|
||||
],
|
||||
"type": "module",
|
||||
"browserslist": [
|
||||
"last 1 chrome versions"
|
||||
]
|
||||
}
|
||||
}
|
10
test/test.ts
10
test/test.ts
@ -3,14 +3,14 @@ import { Qenv } from '@pushrocks/qenv';
|
||||
import * as smartlog from '@pushrocks/smartlog';
|
||||
const testQenv = new Qenv('./', './.nogit/');
|
||||
|
||||
import * as smartlogDestinationReceiver from '../ts/index';
|
||||
import * as smartlogDestinationReceiver from '../ts/index.js';
|
||||
|
||||
let testSmartlogReceiver: smartlogDestinationReceiver.SmartlogDestinationReceiver;
|
||||
|
||||
tap.test('should create a valid SmartlogDestinationReceiver', async () => {
|
||||
testSmartlogReceiver = new smartlogDestinationReceiver.SmartlogDestinationReceiver({
|
||||
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',
|
||||
environment: 'local',
|
||||
runtime: 'node',
|
||||
zone: 'gitzone'
|
||||
zone: 'gitzone',
|
||||
},
|
||||
type: 'log',
|
||||
level: 'info',
|
||||
correlation: {
|
||||
id: '123',
|
||||
type: 'none'
|
||||
type: 'none',
|
||||
},
|
||||
message: 'This is a message'
|
||||
message: 'This is a message',
|
||||
});
|
||||
});
|
||||
|
||||
|
8
ts/00_commitinfo_data.ts
Normal file
8
ts/00_commitinfo_data.ts
Normal 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'
|
||||
}
|
11
ts/index.ts
11
ts/index.ts
@ -1,8 +1,8 @@
|
||||
import * as plugins from './smartlog-destination-receiver.plugins';
|
||||
import * as plugins from './smartlog-destination-receiver.plugins.js';
|
||||
import {
|
||||
ILogDestination,
|
||||
ILogPackageAuthenticated,
|
||||
ILogPackage
|
||||
ILogPackage,
|
||||
} from '@pushrocks/smartlog-interfaces';
|
||||
|
||||
export interface ISmartlogDestinationReceiverConstructorOptions {
|
||||
@ -12,17 +12,18 @@ export interface ISmartlogDestinationReceiverConstructorOptions {
|
||||
|
||||
export class SmartlogDestinationReceiver implements ILogDestination {
|
||||
private options: ISmartlogDestinationReceiverConstructorOptions;
|
||||
private webrequest = new plugins.webrequest.WebRequest();
|
||||
|
||||
constructor(optionsArg: ISmartlogDestinationReceiverConstructorOptions) {
|
||||
this.options = optionsArg;
|
||||
}
|
||||
|
||||
public async handleLog(logPackageArg: ILogPackage) {
|
||||
const response = await plugins.smartrequest.postJson(this.options.receiverEndpoint, {
|
||||
const response = await this.webrequest.postJson(this.options.receiverEndpoint, {
|
||||
requestBody: {
|
||||
auth: plugins.smarthash.sha256FromStringSync(this.options.passphrase),
|
||||
logPackage: logPackageArg
|
||||
}
|
||||
logPackage: logPackageArg,
|
||||
},
|
||||
});
|
||||
return response.body;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as smarthash from '@pushrocks/smarthash';
|
||||
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
9
tsconfig.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"experimentalDecorators": true,
|
||||
"useDefineForClassFields": false,
|
||||
"target": "ES2022",
|
||||
"module": "ES2022",
|
||||
"moduleResolution": "nodenext"
|
||||
}
|
||||
}
|
17
tslint.json
17
tslint.json
@ -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"
|
||||
}
|
Loading…
Reference in New Issue
Block a user