@candlerip/shared3 0.0.45 → 0.0.47
Sign up to get free protection for your applications and to get access to all the features.
- package/_devops/eslint/eslint.config.js +19 -17
- package/package.json +1 -1
- package/src/environment/environment-variable-name/configs/boolean-environment-variable-names/index.d.ts +1 -1
- package/src/environment/environment-variable-name/configs/number-environment-variable-names/index.d.ts +1 -1
- package/src/environment/environment-variables/configs/index.d.ts +1 -0
- package/src/environment/environment-variables/configs/index.js +1 -0
- package/src/environment/environment-variables/workers/environment-variables-worker/index.js +9 -1
- package/src/environment/environment-variables/workers/environment-variables-worker/types.d.ts +7 -1
- package/src/error/custom-error/utils/console-custom-error/index.js +3 -1
- package/src/project/project-config/configs/project-config/index.d.ts +9 -3
- package/src/project/project-config/configs/project-config/index.js +9 -1
- package/src/project/project-name/configs/index.d.ts +1 -1
- package/src/project/project-name/configs/index.js +3 -0
@@ -2,23 +2,25 @@ import js from '@eslint/js';
|
|
2
2
|
import ts from 'typescript-eslint';
|
3
3
|
import globals from 'globals';
|
4
4
|
|
5
|
-
export default
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
5
|
+
export default (projectConfig) =>
|
6
|
+
ts.config(
|
7
|
+
js.configs.recommended,
|
8
|
+
...ts.configs.recommended,
|
9
|
+
{
|
10
|
+
ignores: ['temp'],
|
11
|
+
},
|
12
|
+
{
|
13
|
+
languageOptions: {
|
14
|
+
globals: {
|
15
|
+
...globals.browser,
|
16
|
+
...globals.node,
|
17
|
+
},
|
16
18
|
},
|
17
19
|
},
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
20
|
+
{
|
21
|
+
rules: {
|
22
|
+
'no-console': [2, { allow: ['error', 'info'] }],
|
23
|
+
},
|
22
24
|
},
|
23
|
-
|
24
|
-
);
|
25
|
+
projectConfig ?? [],
|
26
|
+
);
|
package/package.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export declare const BOOLEAN_ENVIRONMENT_VARIABLE_NAMES: ("API_GATEWAY_PORT" | "AUTHENTICATION_AUDIENCE" | "AUTHENTICATION_DOMAIN" | "CACHE_ENABLED" | "DATABASE_URL" | "FRONTEND_URL" | "REDIS_PWD" | "REDIS_URL" | "S3_IMAGES_BUCKET_NAME" | "CACHE_SERVICE_PORT" | "LOGGER_SERVICE_PORT" | "RABBITMQ_PORT" | "RABBITMQ_MANAGEMENT_PORT" | "REDIS_PORT" | "APP_NAME" | "DOMAIN_NAME" | "
|
1
|
+
export declare const BOOLEAN_ENVIRONMENT_VARIABLE_NAMES: ("API_GATEWAY_PORT" | "AUTHENTICATION_AUDIENCE" | "AUTHENTICATION_DOMAIN" | "CACHE_ENABLED" | "DATABASE_URL" | "FRONTEND_URL" | "RABBITMQ_URL" | "REDIS_PWD" | "REDIS_URL" | "S3_IMAGES_BUCKET_NAME" | "CACHE_SERVICE_PORT" | "FRONTEND_PORT" | "LOGGER_SERVICE_PORT" | "RABBITMQ_PORT" | "RABBITMQ_MANAGEMENT_PORT" | "REDIS_PORT" | "APP_NAME" | "DOMAIN_NAME" | "DICTIONARY_SERVICE_PORT" | "RABBITMQ_PWD" | "RABBITMQ_USER")[];
|
@@ -1 +1 @@
|
|
1
|
-
export declare const NUMBER_ENVIRONMENT_VARIABLE_NAMES: ("API_GATEWAY_PORT" | "AUTHENTICATION_AUDIENCE" | "AUTHENTICATION_DOMAIN" | "CACHE_ENABLED" | "DATABASE_URL" | "FRONTEND_URL" | "REDIS_PWD" | "REDIS_URL" | "S3_IMAGES_BUCKET_NAME" | "CACHE_SERVICE_PORT" | "LOGGER_SERVICE_PORT" | "RABBITMQ_PORT" | "RABBITMQ_MANAGEMENT_PORT" | "REDIS_PORT" | "APP_NAME" | "DOMAIN_NAME" | "
|
1
|
+
export declare const NUMBER_ENVIRONMENT_VARIABLE_NAMES: ("API_GATEWAY_PORT" | "AUTHENTICATION_AUDIENCE" | "AUTHENTICATION_DOMAIN" | "CACHE_ENABLED" | "DATABASE_URL" | "FRONTEND_URL" | "RABBITMQ_URL" | "REDIS_PWD" | "REDIS_URL" | "S3_IMAGES_BUCKET_NAME" | "CACHE_SERVICE_PORT" | "FRONTEND_PORT" | "LOGGER_SERVICE_PORT" | "RABBITMQ_PORT" | "RABBITMQ_MANAGEMENT_PORT" | "REDIS_PORT" | "APP_NAME" | "DOMAIN_NAME" | "DICTIONARY_SERVICE_PORT" | "RABBITMQ_PWD" | "RABBITMQ_USER")[];
|
@@ -8,6 +8,7 @@ export declare const ENVIRONMENT_VARIABLES: {
|
|
8
8
|
readonly DATABASE_URL: "string";
|
9
9
|
readonly DICTIONARY_SERVICE_PORT: "number";
|
10
10
|
readonly DOMAIN_NAME: "string";
|
11
|
+
readonly FRONTEND_PORT: "number";
|
11
12
|
readonly FRONTEND_URL: "string";
|
12
13
|
readonly LOGGER_SERVICE_PORT: "number";
|
13
14
|
readonly RABBITMQ_MANAGEMENT_PORT: "number";
|
@@ -1,9 +1,10 @@
|
|
1
|
+
import { isDevelopment as isDev, isProduction as isProd } from '../../../environment-mode/index.js';
|
1
2
|
import { loadEnvFile } from '../../../env-file/index.js';
|
2
3
|
export const EnvironmentVariablesWorker = (() => {
|
4
|
+
const ENVIRONMENT_MODE = process.env.ENVIRONMENT_MODE;
|
3
5
|
let envs;
|
4
6
|
const get = () => envs;
|
5
7
|
const init = () => {
|
6
|
-
const ENVIRONMENT_MODE = process.env.ENVIRONMENT_MODE;
|
7
8
|
const resp = loadEnvFile(ENVIRONMENT_MODE);
|
8
9
|
if ('customError' in resp) {
|
9
10
|
return resp;
|
@@ -12,9 +13,16 @@ export const EnvironmentVariablesWorker = (() => {
|
|
12
13
|
...resp.data,
|
13
14
|
ENVIRONMENT_MODE,
|
14
15
|
};
|
16
|
+
return {
|
17
|
+
data: envs,
|
18
|
+
};
|
15
19
|
};
|
20
|
+
const isDevelopment = () => isDev(ENVIRONMENT_MODE);
|
21
|
+
const isProduction = () => isProd(ENVIRONMENT_MODE);
|
16
22
|
return {
|
17
23
|
get,
|
18
24
|
init,
|
25
|
+
isDevelopment,
|
26
|
+
isProduction,
|
19
27
|
};
|
20
28
|
})();
|
package/src/environment/environment-variables/workers/environment-variables-worker/types.d.ts
CHANGED
@@ -2,8 +2,14 @@ import { CustomError } from '../../../../error/index.js';
|
|
2
2
|
export type IEnvironmentVariablesWorker = {
|
3
3
|
get: Get;
|
4
4
|
init: Init;
|
5
|
+
isDevelopment: IsDevelopment;
|
6
|
+
isProduction: IsProduction;
|
5
7
|
};
|
6
8
|
export type Get = <T = never>() => T;
|
7
|
-
export type Init = () =>
|
9
|
+
export type Init = <T = never>() => {
|
10
|
+
data: T;
|
11
|
+
} | {
|
8
12
|
customError: CustomError;
|
9
13
|
};
|
14
|
+
export type IsDevelopment = () => boolean;
|
15
|
+
export type IsProduction = () => boolean;
|
@@ -1,7 +1,9 @@
|
|
1
1
|
export const consoleCustomError = (customError) => {
|
2
2
|
console.error('***ERROR***:', customError.message);
|
3
3
|
console.error('ID:', customError.id);
|
4
|
-
|
4
|
+
if (customError.projectName) {
|
5
|
+
console.error('PROJECT_NAME:', customError.projectName);
|
6
|
+
}
|
5
7
|
if (customError.info) {
|
6
8
|
console.error('INFO:', customError.info);
|
7
9
|
}
|
@@ -1,19 +1,22 @@
|
|
1
1
|
export declare const PROJECT_CONFIG: {
|
2
2
|
readonly 'api-gateway-project-config': {
|
3
|
-
readonly environmentVariableNames: readonly ["API_GATEWAY_PORT", "AUTHENTICATION_AUDIENCE", "AUTHENTICATION_DOMAIN", "CACHE_ENABLED", "DATABASE_URL", "FRONTEND_URL", "REDIS_PWD", "REDIS_URL", "S3_IMAGES_BUCKET_NAME"];
|
3
|
+
readonly environmentVariableNames: readonly ["API_GATEWAY_PORT", "AUTHENTICATION_AUDIENCE", "AUTHENTICATION_DOMAIN", "CACHE_ENABLED", "DATABASE_URL", "FRONTEND_URL", "RABBITMQ_URL", "REDIS_PWD", "REDIS_URL", "S3_IMAGES_BUCKET_NAME"];
|
4
4
|
};
|
5
5
|
readonly 'backend-project-config': {
|
6
|
-
readonly environmentVariableNames: readonly ["API_GATEWAY_PORT", "CACHE_SERVICE_PORT", "LOGGER_SERVICE_PORT", "RABBITMQ_PORT", "RABBITMQ_MANAGEMENT_PORT", "REDIS_PORT"];
|
6
|
+
readonly environmentVariableNames: readonly ["API_GATEWAY_PORT", "CACHE_SERVICE_PORT", "FRONTEND_PORT", "LOGGER_SERVICE_PORT", "RABBITMQ_PORT", "RABBITMQ_MANAGEMENT_PORT", "REDIS_PORT"];
|
7
7
|
};
|
8
8
|
readonly 'backend-init-project-config': {
|
9
9
|
readonly environmentVariableNames: readonly ["APP_NAME", "DOMAIN_NAME", "S3_IMAGES_BUCKET_NAME"];
|
10
10
|
};
|
11
11
|
readonly 'cache-service-project-config': {
|
12
|
-
readonly environmentVariableNames: readonly ["CACHE_SERVICE_PORT", "DATABASE_URL", "RABBITMQ_URL", "REDIS_PWD", "REDIS_URL"];
|
12
|
+
readonly environmentVariableNames: readonly ["CACHE_ENABLED", "CACHE_SERVICE_PORT", "DATABASE_URL", "RABBITMQ_URL", "REDIS_PWD", "REDIS_URL"];
|
13
13
|
};
|
14
14
|
readonly 'dictionary-service-project-config': {
|
15
15
|
readonly environmentVariableNames: readonly ["DICTIONARY_SERVICE_PORT"];
|
16
16
|
};
|
17
|
+
readonly 'frontend-project-config': {
|
18
|
+
readonly environmentVariableNames: readonly ["FRONTEND_PORT"];
|
19
|
+
};
|
17
20
|
readonly 'images-project-config': {
|
18
21
|
readonly environmentVariableNames: readonly ["S3_IMAGES_BUCKET_NAME"];
|
19
22
|
};
|
@@ -23,6 +26,9 @@ export declare const PROJECT_CONFIG: {
|
|
23
26
|
readonly 'logger-service-project-config': {
|
24
27
|
readonly environmentVariableNames: readonly ["DATABASE_URL", "LOGGER_SERVICE_PORT", "RABBITMQ_URL"];
|
25
28
|
};
|
29
|
+
readonly 'nginx-project-config': {
|
30
|
+
readonly environmentVariableNames: readonly ["API_GATEWAY_PORT"];
|
31
|
+
};
|
26
32
|
readonly 'rabbitmq-project-config': {
|
27
33
|
readonly environmentVariableNames: readonly ["RABBITMQ_PORT", "RABBITMQ_MANAGEMENT_PORT", "RABBITMQ_PWD", "RABBITMQ_USER"];
|
28
34
|
};
|
@@ -7,6 +7,7 @@ export const PROJECT_CONFIG = {
|
|
7
7
|
'CACHE_ENABLED',
|
8
8
|
'DATABASE_URL',
|
9
9
|
'FRONTEND_URL',
|
10
|
+
'RABBITMQ_URL',
|
10
11
|
'REDIS_PWD',
|
11
12
|
'REDIS_URL',
|
12
13
|
'S3_IMAGES_BUCKET_NAME',
|
@@ -16,6 +17,7 @@ export const PROJECT_CONFIG = {
|
|
16
17
|
environmentVariableNames: [
|
17
18
|
'API_GATEWAY_PORT',
|
18
19
|
'CACHE_SERVICE_PORT',
|
20
|
+
'FRONTEND_PORT',
|
19
21
|
'LOGGER_SERVICE_PORT',
|
20
22
|
'RABBITMQ_PORT',
|
21
23
|
'RABBITMQ_MANAGEMENT_PORT',
|
@@ -26,11 +28,14 @@ export const PROJECT_CONFIG = {
|
|
26
28
|
environmentVariableNames: ['APP_NAME', 'DOMAIN_NAME', 'S3_IMAGES_BUCKET_NAME'],
|
27
29
|
},
|
28
30
|
'cache-service-project-config': {
|
29
|
-
environmentVariableNames: ['CACHE_SERVICE_PORT', 'DATABASE_URL', 'RABBITMQ_URL', 'REDIS_PWD', 'REDIS_URL'],
|
31
|
+
environmentVariableNames: ['CACHE_ENABLED', 'CACHE_SERVICE_PORT', 'DATABASE_URL', 'RABBITMQ_URL', 'REDIS_PWD', 'REDIS_URL'],
|
30
32
|
},
|
31
33
|
'dictionary-service-project-config': {
|
32
34
|
environmentVariableNames: ['DICTIONARY_SERVICE_PORT'],
|
33
35
|
},
|
36
|
+
'frontend-project-config': {
|
37
|
+
environmentVariableNames: ['FRONTEND_PORT'],
|
38
|
+
},
|
34
39
|
'images-project-config': {
|
35
40
|
environmentVariableNames: ['S3_IMAGES_BUCKET_NAME'],
|
36
41
|
},
|
@@ -40,6 +45,9 @@ export const PROJECT_CONFIG = {
|
|
40
45
|
'logger-service-project-config': {
|
41
46
|
environmentVariableNames: ['DATABASE_URL', 'LOGGER_SERVICE_PORT', 'RABBITMQ_URL'],
|
42
47
|
},
|
48
|
+
'nginx-project-config': {
|
49
|
+
environmentVariableNames: ['API_GATEWAY_PORT'],
|
50
|
+
},
|
43
51
|
'rabbitmq-project-config': {
|
44
52
|
environmentVariableNames: ['RABBITMQ_PORT', 'RABBITMQ_MANAGEMENT_PORT', 'RABBITMQ_PWD', 'RABBITMQ_USER'],
|
45
53
|
},
|
@@ -1 +1 @@
|
|
1
|
-
export declare const PROJECT_NAMES: readonly ["backend", "backend-init", "cache-service", "dictionary-service", "config", "images", "images-init", "logger-service", "rabbitmq", "redis", "shared", "shared-aws", "shared-backend"];
|
1
|
+
export declare const PROJECT_NAMES: readonly ["api-gateway", "backend", "backend-init", "cache-service", "dictionary-service", "config", "frontend", "images", "images-init", "logger-service", "nginx", "rabbitmq", "redis", "shared", "shared-aws", "shared-backend"];
|
@@ -1,12 +1,15 @@
|
|
1
1
|
export const PROJECT_NAMES = [
|
2
|
+
'api-gateway',
|
2
3
|
'backend',
|
3
4
|
'backend-init',
|
4
5
|
'cache-service',
|
5
6
|
'dictionary-service',
|
6
7
|
'config',
|
8
|
+
'frontend',
|
7
9
|
'images',
|
8
10
|
'images-init',
|
9
11
|
'logger-service',
|
12
|
+
'nginx',
|
10
13
|
'rabbitmq',
|
11
14
|
'redis',
|
12
15
|
'shared',
|