@ubs-platform/nest-microservice-setup-util 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 UBS Platform
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,5 @@
1
1
  # nest-microservice-setup-util
2
2
 
3
- # NOTICE: Not ready for production usage and builds. I'm working for get runnable.
3
+ Nest Microservice Setup Util (For MONA Platform)
4
+
5
+ That readme file will be documented well soon
package/package.json CHANGED
@@ -1,10 +1,17 @@
1
1
  {
2
2
  "name": "@ubs-platform/nest-microservice-setup-util",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "private": false,
5
+ "main": "dist/index.js",
6
+ "author": "Unlimited Bundle Systems",
7
+ "homepage": "https://github.com/ubs-platform/nest-microservice-setup-util",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/ubs-platform/nest-microservice-setup-util"
11
+ },
5
12
  "scripts": {
6
13
  "build": "tsc",
7
- "publish": "npm run build && echo 'not yet'"
14
+ "publish": "npm run build && npm publish"
8
15
  },
9
16
  "peerDependencies": {
10
17
  "@nestjs/microservices": "^10.3.3"
package/tsconfig.json CHANGED
@@ -1,16 +1,27 @@
1
1
  {
2
- "extends": "../../tsconfig.base.json",
2
+ "compileOnSave": false,
3
3
  "compilerOptions": {
4
- "module": "commonjs"
4
+ "rootDir": ".",
5
+ "sourceMap": true,
6
+ "moduleResolution": "node",
7
+ "emitDecoratorMetadata": true,
8
+ "experimentalDecorators": true,
9
+ "importHelpers": true,
10
+ "target": "es2015",
11
+ "module": "commonjs",
12
+ "outDir": "./dist",
13
+ "lib": ["es2020", "dom"],
14
+ "skipLibCheck": true,
15
+ "skipDefaultLibCheck": true,
16
+ "declaration": true,
17
+ "types": ["node"]
5
18
  },
6
- "files": [],
7
- "include": [],
8
- "references": [
9
- {
10
- "path": "./tsconfig.lib.json"
11
- },
12
- {
13
- "path": "./tsconfig.spec.json"
14
- }
15
- ]
19
+ "exclude": [
20
+ "node_modules",
21
+ "tmp",
22
+ "jest.config.ts",
23
+ "src/**/*.spec.ts",
24
+ "src/**/*.test.ts"
25
+ ],
26
+ "include": ["src/**/*.ts"]
16
27
  }
package/project.json DELETED
@@ -1,24 +0,0 @@
1
- {
2
- "name": "nest-microservice-setup-util",
3
- "$schema": "../../node_modules/nx/schemas/project-schema.json",
4
- "sourceRoot": "libs/nest-microservice-setup-util/src",
5
- "projectType": "library",
6
- "targets": {
7
- "build": {
8
- "executor": "@nx/js:tsc",
9
- "outputs": ["{options.outputPath}"],
10
- "options": {
11
- "outputPath": "dist/libs/nest-microservice-setup-util",
12
- "tsConfig": "libs/nest-microservice-setup-util/tsconfig.lib.json",
13
- "packageJson": "libs/nest-microservice-setup-util/package.json",
14
- "main": "libs/nest-microservice-setup-util/src/index.ts",
15
- "assets": ["libs/nest-microservice-setup-util/*.md"]
16
- }
17
- },
18
- "publish": {
19
- "command": "node tools/scripts/publish.mjs nest-microservice-setup-util {args.ver} {args.tag}",
20
- "dependsOn": ["build"]
21
- }
22
- },
23
- "tags": []
24
- }
package/src/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from './lib/nest-microservice-setup-util';
@@ -1,56 +0,0 @@
1
- import { Transport } from '@nestjs/microservices';
2
- import { randomUUID } from 'crypto';
3
- export const getMicroserviceConnection = (groupName) => {
4
- const type = process.env['NX_MICROSERVICE_TYPE'] as 'KAFKA' | 'TCP' | 'RMQ';
5
-
6
- let microservice: Object | null = null;
7
- if (type == 'KAFKA') {
8
- microservice = {
9
- transport: Transport.KAFKA,
10
- options: {
11
- client: {
12
- clientId: 'users',
13
- brokers: [`${process.env['NX_KAFKA_URL']}`],
14
- },
15
- consumer: {
16
- groupId: 'tk' + randomUUID(),
17
- },
18
- },
19
- };
20
- } else if (type == 'RMQ') {
21
- microservice = {
22
- transport: Transport.RMQ,
23
- options: {
24
- urls: [process.env['NX_RMQ_URL']],
25
- queue: 'cats_queue',
26
- queueOptions: {
27
- durable: false,
28
- },
29
- },
30
- };
31
- } else {
32
- microservice = {
33
- transport: Transport.TCP,
34
- options: {
35
- host: process.env['NX_TCP_HOST'],
36
- port: process.env['NX_TCP_PORT'],
37
- },
38
- };
39
- }
40
-
41
- // return {
42
- // transport: Transport.TCP,
43
- // options: {
44
- // host: 'localhost',
45
- // port: 7177,
46
- // },
47
- // };
48
- if (microservice == null) {
49
- throw 'Microservice type not recognized';
50
- }
51
- return microservice;
52
- };
53
- // export const UserMicroserviceCommunication =
54
-
55
- // // More 2 3 kafka clients are needed, comes replication invalid shit error
56
- // export const UserMicroserviceCommunication =
package/tsconfig.lib.json DELETED
@@ -1,11 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "module": "commonjs",
5
- "outDir": "../../dist/out-tsc",
6
- "declaration": true,
7
- "types": ["node"]
8
- },
9
- "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"],
10
- "include": ["src/**/*.ts"]
11
- }