@candlerip/shared3 0.0.59 → 0.0.60

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@candlerip/shared3",
3
- "version": "0.0.59",
3
+ "version": "0.0.60",
4
4
  "type": "module",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -1,13 +1,12 @@
1
1
  export declare const ENVIRONMENT_VARIABLES: {
2
- readonly 'api-gateway': readonly ["API_GATEWAY_PORT", "AUTHENTICATION_AUDIENCE", "AUTHENTICATION_DOMAIN", "CACHE_ENABLED", "DATABASE_URL", "FRONTEND_URL", "NODE_ENV", "RABBITMQ_URL", "REDIS_PWD", "REDIS_URL", "S3_IMAGES_BUCKET_NAME"];
3
- readonly backend: readonly ["API_GATEWAY_PORT", "CACHE_SERVICE_PORT", "FRONTEND_PORT", "LOGGER_SERVICE_PORT", "NODE_ENV", "RABBITMQ_PORT", "RABBITMQ_MANAGEMENT_PORT", "REDIS_PORT"];
4
- readonly 'backend-init': readonly ["APP_NAME", "DOMAIN_NAME", "NODE_ENV", "S3_IMAGES_BUCKET_NAME"];
2
+ readonly app: readonly ["DATABASE_URL", "FRONTEND_PORT", "NODE_ENV", "RABBITMQ_URL", "REDIS_PWD", "REDIS_URL", "S3_IMAGES_BUCKET_NAME"];
5
3
  readonly 'cache-service': readonly ["CACHE_ENABLED", "CACHE_SERVICE_PORT", "DATABASE_URL", "NODE_ENV", "RABBITMQ_URL", "REDIS_PWD", "REDIS_URL"];
6
- readonly frontend: readonly ["DATABASE_URL", "FRONTEND_PORT", "NODE_ENV", "RABBITMQ_URL", "REDIS_PWD", "REDIS_URL", "S3_IMAGES_BUCKET_NAME"];
7
4
  readonly images: readonly ["NODE_ENV", "S3_IMAGES_BUCKET_NAME"];
8
5
  readonly 'images-init': readonly ["FRONTEND_URL", "NODE_ENV", "S3_IMAGES_BUCKET_NAME"];
9
6
  readonly 'logger-service': readonly ["DATABASE_URL", "LOGGER_SERVICE_PORT", "NODE_ENV", "RABBITMQ_URL"];
10
7
  readonly nginx: readonly ["FRONTEND_PORT", "NODE_ENV"];
11
8
  readonly rabbitmq: readonly ["RABBITMQ_PORT", "RABBITMQ_MANAGEMENT_PORT", "NODE_ENV", "RABBITMQ_PWD", "RABBITMQ_USER"];
12
9
  readonly redis: readonly ["NODE_ENV", "REDIS_PORT", "REDIS_PWD"];
10
+ readonly server: readonly ["API_GATEWAY_PORT", "CACHE_SERVICE_PORT", "FRONTEND_PORT", "LOGGER_SERVICE_PORT", "NODE_ENV", "RABBITMQ_PORT", "RABBITMQ_MANAGEMENT_PORT", "REDIS_PORT"];
11
+ readonly 'server-init': readonly ["APP_NAME", "DOMAIN_NAME", "NODE_ENV", "S3_IMAGES_BUCKET_NAME"];
13
12
  };
@@ -1,18 +1,13 @@
1
1
  export const ENVIRONMENT_VARIABLES = {
2
- 'api-gateway': [
3
- 'API_GATEWAY_PORT',
4
- 'AUTHENTICATION_AUDIENCE',
5
- 'AUTHENTICATION_DOMAIN',
6
- 'CACHE_ENABLED',
7
- 'DATABASE_URL',
8
- 'FRONTEND_URL',
9
- 'NODE_ENV',
10
- 'RABBITMQ_URL',
11
- 'REDIS_PWD',
12
- 'REDIS_URL',
13
- 'S3_IMAGES_BUCKET_NAME',
14
- ],
15
- backend: [
2
+ app: ['DATABASE_URL', 'FRONTEND_PORT', 'NODE_ENV', 'RABBITMQ_URL', 'REDIS_PWD', 'REDIS_URL', 'S3_IMAGES_BUCKET_NAME'],
3
+ 'cache-service': ['CACHE_ENABLED', 'CACHE_SERVICE_PORT', 'DATABASE_URL', 'NODE_ENV', 'RABBITMQ_URL', 'REDIS_PWD', 'REDIS_URL'],
4
+ images: ['NODE_ENV', 'S3_IMAGES_BUCKET_NAME'],
5
+ 'images-init': ['FRONTEND_URL', 'NODE_ENV', 'S3_IMAGES_BUCKET_NAME'],
6
+ 'logger-service': ['DATABASE_URL', 'LOGGER_SERVICE_PORT', 'NODE_ENV', 'RABBITMQ_URL'],
7
+ nginx: ['FRONTEND_PORT', 'NODE_ENV'],
8
+ rabbitmq: ['RABBITMQ_PORT', 'RABBITMQ_MANAGEMENT_PORT', 'NODE_ENV', 'RABBITMQ_PWD', 'RABBITMQ_USER'],
9
+ redis: ['NODE_ENV', 'REDIS_PORT', 'REDIS_PWD'],
10
+ server: [
16
11
  'API_GATEWAY_PORT',
17
12
  'CACHE_SERVICE_PORT',
18
13
  'FRONTEND_PORT',
@@ -22,15 +17,7 @@ export const ENVIRONMENT_VARIABLES = {
22
17
  'RABBITMQ_MANAGEMENT_PORT',
23
18
  'REDIS_PORT',
24
19
  ],
25
- 'backend-init': ['APP_NAME', 'DOMAIN_NAME', 'NODE_ENV', 'S3_IMAGES_BUCKET_NAME'],
26
- 'cache-service': ['CACHE_ENABLED', 'CACHE_SERVICE_PORT', 'DATABASE_URL', 'NODE_ENV', 'RABBITMQ_URL', 'REDIS_PWD', 'REDIS_URL'],
27
- frontend: ['DATABASE_URL', 'FRONTEND_PORT', 'NODE_ENV', 'RABBITMQ_URL', 'REDIS_PWD', 'REDIS_URL', 'S3_IMAGES_BUCKET_NAME'],
28
- images: ['NODE_ENV', 'S3_IMAGES_BUCKET_NAME'],
29
- 'images-init': ['FRONTEND_URL', 'NODE_ENV', 'S3_IMAGES_BUCKET_NAME'],
30
- 'logger-service': ['DATABASE_URL', 'LOGGER_SERVICE_PORT', 'NODE_ENV', 'RABBITMQ_URL'],
31
- nginx: ['FRONTEND_PORT', 'NODE_ENV'],
32
- rabbitmq: ['RABBITMQ_PORT', 'RABBITMQ_MANAGEMENT_PORT', 'NODE_ENV', 'RABBITMQ_PWD', 'RABBITMQ_USER'],
33
- redis: ['NODE_ENV', 'REDIS_PORT', 'REDIS_PWD'],
20
+ 'server-init': ['APP_NAME', 'DOMAIN_NAME', 'NODE_ENV', 'S3_IMAGES_BUCKET_NAME'],
34
21
  };
35
22
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
36
23
  const CHECK = ENVIRONMENT_VARIABLES;
@@ -1,18 +1,24 @@
1
1
  import { ProjectSingleton } from '../../../../project/index.js';
2
- export const customErrorWorker = (infoInput) => {
3
- let info = infoInput;
4
- const addInfo = (infoInput) => {
5
- info = {
6
- ...info,
7
- ...infoInput,
2
+ export const customErrorWorker = (info) => {
3
+ let _info = info;
4
+ const serializeInfo = (info) => {
5
+ if (info?.err) {
6
+ info.err = JSON.stringify(info.err);
7
+ }
8
+ return info;
9
+ };
10
+ const addInfo = (info) => {
11
+ _info = {
12
+ ..._info,
13
+ ...serializeInfo(info),
8
14
  };
9
15
  };
10
- const composeCustomError = (message, infoInput) => ({
16
+ const composeCustomError = (message, info) => ({
11
17
  customError: {
12
18
  id: Math.random().toString(16).slice(2).toUpperCase(),
13
19
  info: {
14
- ...info,
15
- ...infoInput,
20
+ ..._info,
21
+ ...serializeInfo(info),
16
22
  },
17
23
  message,
18
24
  projectName: ProjectSingleton.getProjectName(),
@@ -8,3 +8,4 @@ export type AddInfo = (props: CustomError['info']) => void;
8
8
  export type ComposeCustomError = (message: CustomError['message'], info?: CustomError['info']) => {
9
9
  customError: CustomError;
10
10
  };
11
+ export type SerializeInfo = (info: CustomError['info']) => CustomError['info'];
@@ -1 +1 @@
1
- export declare const PROJECT_NAMES: readonly ["api-gateway", "backend", "backend-init", "cache-service", "config", "frontend", "images", "images-init", "logger-service", "nginx", "rabbitmq", "redis", "shared", "shared-aws", "shared-backend"];
1
+ export declare const PROJECT_NAMES: readonly ["app", "cache-service", "config", "images", "images-init", "logger-service", "nginx", "rabbitmq", "redis", "server", "server-init", "shared", "shared-aws", "shared-backend"];
@@ -1,16 +1,15 @@
1
1
  export const PROJECT_NAMES = [
2
- 'api-gateway',
3
- 'backend',
4
- 'backend-init',
2
+ 'app',
5
3
  'cache-service',
6
4
  'config',
7
- 'frontend',
8
5
  'images',
9
6
  'images-init',
10
7
  'logger-service',
11
8
  'nginx',
12
9
  'rabbitmq',
13
10
  'redis',
11
+ 'server',
12
+ 'server-init',
14
13
  'shared',
15
14
  'shared-aws',
16
15
  'shared-backend',