update tsconfig

This commit is contained in:
Philipp Kunz 2024-04-14 17:54:11 +02:00
parent 8200ce601e
commit 5a4e4eb744
4 changed files with 146 additions and 32 deletions

View File

@ -9,12 +9,24 @@
"githost": "code.foss.global", "githost": "code.foss.global",
"gitscope": "push.rocks", "gitscope": "push.rocks",
"gitrepo": "smartlog-receiver", "gitrepo": "smartlog-receiver",
"description": "a receiver for smartlog-destination-receiver", "description": "A package that acts as a receiver for smartlog-destination-receiver, utilizing plugins for functionality.",
"npmPackagename": "@push.rocks/smartlog-receiver", "npmPackagename": "@push.rocks/smartlog-receiver",
"license": "MIT" "license": "MIT",
"keywords": [
"logging",
"receiver",
"smartlog",
"authentication",
"validation",
"typescript",
"plugins",
"smartlog integration",
"log management",
"security"
]
} }
}, },
"tsdocs": { "tsdoc": {
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n" "legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
} }
} }

View File

@ -2,7 +2,7 @@
"name": "@push.rocks/smartlog-receiver", "name": "@push.rocks/smartlog-receiver",
"version": "2.0.0", "version": "2.0.0",
"private": false, "private": false,
"description": "a receiver for smartlog-destination-receiver", "description": "A package that acts as a receiver for smartlog-destination-receiver, utilizing plugins for functionality.",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts", "typings": "dist_ts/index.d.ts",
"author": "Lossless GmbH", "author": "Lossless GmbH",
@ -38,5 +38,17 @@
"browserslist": [ "browserslist": [
"last 1 chrome versions" "last 1 chrome versions"
], ],
"type": "module" "type": "module",
"keywords": [
"logging",
"receiver",
"smartlog",
"authentication",
"validation",
"typescript",
"plugins",
"smartlog integration",
"log management",
"security"
]
} }

1
readme.hints.md Normal file
View File

@ -0,0 +1 @@

143
readme.md
View File

@ -1,39 +1,128 @@
# @pushrocks/smartlog-receiver # @push.rocks/smartlog-receiver
a receiver for smartlog-destination-receiver a receiver for smartlog-destination-receiver
## Availabililty and Links ## Install
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartlog-receiver)
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartlog-receiver)
* [github.com (source mirror)](https://github.com/pushrocks/smartlog-receiver)
* [docs (typedoc)](https://pushrocks.gitlab.io/smartlog-receiver/)
## Status for master To install `@push.rocks/smartlog-receiver`, use the following command with npm:
Status Category | Status Badge ```bash
-- | -- npm install @push.rocks/smartlog-receiver --save
GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/smartlog-receiver/badges/master/pipeline.svg)](https://lossless.cloud) ```
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/smartlog-receiver/badges/master/coverage.svg)](https://lossless.cloud)
npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/smartlog-receiver)](https://lossless.cloud) or with yarn:
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/smartlog-receiver)](https://lossless.cloud)
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud) ```bash
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/) yarn add @push.rocks/smartlog-receiver
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud) ```
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@pushrocks/smartlog-receiver)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/smartlog-receiver)](https://lossless.cloud) Ensure that you have TypeScript and Node.js installed in your development environment as this module leverages TypeScript for type definitions.
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/smartlog-receiver)](https://lossless.cloud)
Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](https://lossless.cloud)
## Usage ## Usage
Use TypeScript for best in class intellisense. The `@push.rocks/smartlog-receiver` module is designed to receive log messages sent from applications using the `smartlog` logging system. It allows for centralized logging by receiving, validating, and processing log messages in a secure and controlled manner. Below, we'll go through how to set up and use `smartlog-receiver` in your project.
## Contribution ### Setting up SmartlogReceiver
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :) First, make sure to import `SmartlogReceiver` from the package, along with the types it depends on if necessary.
For further information read the linked docs at the top of this readme. ```typescript
import { SmartlogReceiver, ISmartlogReceiverOptions } from '@push.rocks/smartlog-receiver';
import { Smartlog } from '@pushrocks/smartlog';
```
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) `SmartlogReceiver` requires an instance of `Smartlog` for logging internal messages and potentially logging the received log messages. Ensure you initialize `Smartlog` first:
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com) ```typescript
const smartlogInstance = new Smartlog({
logContext: {
company: 'YourCompany',
companyunit: 'YourUnit',
environment: 'production',
runtime: 'node',
version: '1.0.0'
},
minimumLogLevel: 'info',
});
smartlogInstance.enableConsole(); // Enabling console output for demonstration purposes
```
Now, instantiate the `SmartlogReceiver` with the necessary options. You need to provide a passphrase for authentication and a validator function that decides whether to accept or reject incoming messages based on your criteria.
```typescript
const smartlogReceiver = new SmartlogReceiver({
smartlogInstance: smartlogInstance,
passphrase: 'yourSecretPassphrase',
validatorFunction: async (logPackage) => {
// Example validation: accept only if message contains 'accepted'
return logPackage.message.includes('accepted');
},
});
```
### Handling Log Messages
To handle authenticated log messages, you'd typically have an endpoint in your application that receives log packages. Here, we'll simulate receiving a log package.
```typescript
import { ILogPackageAuthenticated } from '@pushrocks/smartlog-interfaces';
import * as smarthash from '@pushrocks/smarthash';
// Simulated received log message
const receivedLogPackage: ILogPackageAuthenticated = {
auth: smarthash.sha256FromStringSync('yourSecretPassphrase'), // Generate hash of your passphrase for authentication
logPackage: {
timestamp: Date.now(),
context: {
company: 'YourCompany',
companyunit: 'YourUnit',
environment: 'production',
runtime: 'node',
version: '1.0.0'
},
level: 'info',
type: 'log',
message: 'This is an accepted log message',
correlation: {
id: 'unique-correlation-id',
type: 'transaction'
}
}
};
// Handler function to process received log packages
async function handleReceivedLog(logPackage: ILogPackageAuthenticated) {
const result = await smartlogReceiver.handleAuthenticatedLog(logPackage);
console.log(result); // Should output { status: 'ok' } for successfully processed messages
}
handleReceivedLog(receivedLogPackage);
```
Ensure your validation and handling logic fits the security and architectural needs of your application.
### Advanced Usage
- **Batch Processing:** `SmartlogReceiver` also supports processing batches of logs efficiently through the method `handleManyAuthenticatedLogs`, facilitating bulk log management.
- **Customizing Smartlog:** Since `SmartlogReceiver` uses `Smartlog` for its operations, you can harness the full power of `Smartlog` for detailed customization, such as setting up different log destinations, filtering log levels, and more.
By setting up `@push.rocks/smartlog-receiver`, you're enabling a robust and flexible system to manage your application's logging infrastructure, making it easier to monitor and debug with centralized logs.
## License and Legal Information
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
### Trademarks
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
### Company Information
Task Venture Capital GmbH
Registered at District court Bremen HRB 35230 HB, Germany
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.