update tsconfig

This commit is contained in:
Philipp Kunz 2024-04-14 18:30:03 +02:00
parent b27c340f7d
commit f7720251ff
4 changed files with 139 additions and 51 deletions

View File

@ -5,17 +5,29 @@
"githost": "code.foss.global",
"gitscope": "push.rocks",
"gitrepo": "smartuniverse",
"description": "messaging service for micro services",
"description": "A messaging service enabling secure, reactive communication between microservices.",
"npmPackagename": "@push.rocks/smartuniverse",
"license": "MIT",
"projectDomain": "push.rocks"
"projectDomain": "push.rocks",
"keywords": [
"microservices",
"messaging",
"reactive programming",
"event-driven",
"channel-based communication",
"client-server architecture",
"message encryption",
"typescript",
"websocket",
"scalability"
]
}
},
"npmci": {
"npmGlobalTools": [],
"npmAccessLevel": "public"
},
"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"
}
}

View File

@ -2,7 +2,7 @@
"name": "@push.rocks/smartuniverse",
"version": "1.0.108",
"private": false,
"description": "messaging service for your micro services",
"description": "A messaging service enabling secure, reactive communication between microservices.",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
"author": "Lossless GmbH",
@ -51,5 +51,17 @@
"browserslist": [
"last 1 chrome versions"
],
"type": "module"
}
"type": "module",
"keywords": [
"microservices",
"messaging",
"reactive programming",
"event-driven",
"channel-based communication",
"client-server architecture",
"message encryption",
"typescript",
"websocket",
"scalability"
]
}

1
readme.hints.md Normal file
View File

@ -0,0 +1 @@

153
readme.md
View File

@ -1,64 +1,127 @@
# @push.rocks/smartuniverse
messaging service for micro services
messaging service for your micro services
## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@push.rocks/smartuniverse)
* [gitlab.com (source)](https://gitlab.com/push.rocks/smartuniverse)
* [github.com (source mirror)](https://github.com/push.rocks/smartuniverse)
* [docs (typedoc)](https://push.rocks.gitlab.io/smartuniverse/)
## Status for master
Status Category | Status Badge
-- | --
GitLab Pipelines | [![pipeline status](https://gitlab.com/push.rocks/smartuniverse/badges/master/pipeline.svg)](https://lossless.cloud)
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/push.rocks/smartuniverse/badges/master/coverage.svg)](https://lossless.cloud)
npm | [![npm downloads per month](https://badgen.net/npm/dy/@push.rocks/smartuniverse)](https://lossless.cloud)
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/push.rocks/smartuniverse)](https://lossless.cloud)
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
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/@push.rocks/smartuniverse)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@push.rocks/smartuniverse)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@push.rocks/smartuniverse)](https://lossless.cloud)
## Install
To install `@push.rocks/smartuniverse`, use the following command with npm:
```bash
npm install @push.rocks/smartuniverse --save
```
This command adds `@push.rocks/smartuniverse` to your project's dependencies.
## Usage
`@push.rocks/smartuniverse` is designed to enable messaging services for microservices, allowing them to communicate in a structured and secure manner. Below are examples and scenarios illustrating how to use `@push.rocks/smartuniverse` for both server (managing messages across services) and client (microservices communicating within the universe) aspects.
Use TypeScript for best in class instellisense.
### Server side setup: Creating your Universe
### What is smartuniverse all about?
Think WhatsApp, but for your microservices architecture. It allows your services to securely talk to each other in **private, shielded channels** without having to expose anything to the outside world. This allows the use of **reactive programming across your entire stack**.
### Server side
every universe has a server that manages messages.
Think Kafka, but without Kafka.
First, you need to set up the server side of your messaging ecosystem, which involves creating a "universe" where channels reside.
```typescript
import * as smartuniverse from '@pushrocks/smartuniverse';
import { Universe } from '@push.rocks/smartuniverse';
const myUniverse = new smartuniverse.Universe({
messageExpiryInMilliseconds: 60000, // the standard time in milliseconds until a message expires
// Initialize a new Universe
const myUniverse = new Universe({
messageExpiryInMilliseconds: 60000, // messages expire after 60 seconds
});
// create as many channels as you like
myUniverse.addChannel('awesomeChannel', 'awesomeChannelPass');
myUniverse.addChannel('awesomeChannel2', 'jhkjhfsdf87eerkjslkfja9');
// Create channels for communication within the universe
// These channels can be thought of as topics or queues that services can subscribe to or post messages to
myUniverse.addChannel('channel-one', 'password1');
myUniverse.addChannel('channel-two', 'password2');
myUniverse.start(8765); // start the server and provide the port on which to listen on
// Start the universe server on a specified port
myUniverse.start(8765);
```
### Client side
By starting the universe, you've established a messaging hub for your microservices. Ensure that the services know the universe's address and the channels and passwords they should use for communication.
All your microservices represents clients in the universe that may talk to each other using the universe server.
### Client side: Microservices joining the Universe
## Contribution
On the client side, your microservices will join the universe, subscribing to channels to listen for messages or post their messages to be consumed by other services.
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). :)
```typescript
import { ClientUniverse, ClientUniverseChannel } from '@push.rocks/smartuniverse';
For further information read the linked docs at the top of this readme.
// Initialize client that connects to the universe server
const clientUniverse = new ClientUniverse({
serverAddress: 'http://your-universe-server:8765',
autoReconnect: true,
});
## Legal
> MIT licensed | **©** [Task Venture Capital GmbH](https://task.vc)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
// Define a channel to subscribe to (the channel must be created in the universe server)
const channel = clientUniverse.addChannel('channel-one', 'password1');
// Start the client to enable communication
clientUniverse.start();
// Posting a message to the channel
channel.postMessage({
messageText: 'Hello, universe!',
payload: { some: 'data' },
});
// Listening for messages from the channel
channel.subscribe((message) => {
console.log('Received message:', message);
});
```
### Reaction Patterns: Request and Response Within the Universe
`@push.rocks/smartuniverse` supports reactive programming. Microservices can emit "reaction requests" and listen for "reaction responses" tied to specific actions or commands.
```typescript
import { ReactionRequest, ReactionResponse } from '@push.rocks/smartuniverse';
// Define a request-response type
interface MyRequestResponse {
method: 'greet';
request: { name: string };
response: { message: string };
};
// Creating a reaction request on client side
const reactionRequest = new ReactionRequest<MyRequestResponse>({ method: 'greet' });
// Emitting a reaction request and handling responses
reactionRequest.fire([channel], { name: 'World' }).then((reactionResult) => {
reactionResult.getFirstResult().then((response) => {
console.log(response.message); // Output: Hello, World!
});
});
// Handling reaction requests on server side or another client
const reactionResponse = new ReactionResponse<MyRequestResponse>({
channels: [myUniverse.getChannel('channel-one')],
funcDef: async (requestData) => {
return { message: `Hello, ${requestData.name}!` };
},
method: 'greet',
});
```
This pattern enables a powerful, flexible communication system where services can asynchronously request information or trigger actions across the microservices architecture without direct coupling.
### Conclusion
`@push.rocks/smartuniverse` provides a robust platform for facilitating communication between microservices. By setting up a universe and defining channels, your services can securely exchange messages, supporting both direct communications and reactive programming patterns. Whether sharing updates, events, or performing request-response interactions, `@push.rocks/smartuniverse` simplifies the process of building a cohesive microservices ecosystem.
For more advanced use cases and configuration options, refer to the complete documentation.
## 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.