@candlerip/shared3 0.0.30 → 0.0.31
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/src/environment/env-file/utils/load-env-file/index.js +8 -6
- package/src/environment/env-file/utils/load-env-file/types.d.ts +1 -3
- package/src/environment/environment-variable-name/domains/index.d.ts +2 -0
- package/src/environment/environment-variable-name/index.d.ts +1 -0
- package/src/environment/environment-variable-name/index.js +1 -0
- package/src/environment/environment-variables/configs/environment-variables/index.d.ts +15 -0
- package/src/environment/environment-variables/configs/environment-variables/index.js +15 -0
- package/src/environment/environment-variables/configs/index.d.ts +2 -0
- package/src/environment/environment-variables/configs/index.js +2 -0
- package/src/environment/environment-variables/configs/number-environment-variables/index.d.ts +1 -0
- package/src/environment/environment-variables/configs/number-environment-variables/index.js +2 -0
- package/src/environment/environment-variables/domains/index.d.ts +6 -15
- package/src/environment/environment-variables/workers/environment-variables-worker/index.js +2 -2
- package/src/environment/environment-variables/workers/environment-variables-worker/types.d.ts +1 -1
- package/src/environment/index.d.ts +1 -0
- package/src/environment/index.js +1 -0
- package/src/project/project-config/configs/backend-init-project-config-names/index.d.ts +1 -0
- package/src/project/project-config/configs/backend-init-project-config-names/index.js +1 -0
- package/src/project/project-config/configs/backend-project-config-names/index.d.ts +1 -0
- package/src/project/project-config/configs/backend-project-config-names/index.js +7 -0
- package/src/project/project-config/configs/cache-service-project-config-names/index.d.ts +1 -0
- package/src/project/project-config/configs/cache-service-project-config-names/index.js +1 -0
- package/src/project/project-config/configs/dictionary-service-project-config-names/index.d.ts +1 -0
- package/src/project/project-config/configs/dictionary-service-project-config-names/index.js +1 -0
- package/src/project/project-config/configs/images-init-project-config-names/index.d.ts +1 -0
- package/src/project/project-config/configs/images-init-project-config-names/index.js +1 -0
- package/src/project/project-config/configs/images-project-config-names/index.d.ts +1 -0
- package/src/project/project-config/configs/images-project-config-names/index.js +1 -0
- package/src/project/project-config/configs/index.d.ts +9 -0
- package/src/project/project-config/configs/index.js +9 -0
- package/src/project/project-config/configs/logger-service-project-config-names/index.d.ts +1 -0
- package/src/project/project-config/configs/logger-service-project-config-names/index.js +1 -0
- package/src/project/project-config/configs/rabbitmq-project-config-names/index.d.ts +1 -0
- package/src/project/project-config/configs/rabbitmq-project-config-names/index.js +1 -0
- package/src/project/project-config/configs/redis-project-config-names/index.d.ts +1 -0
- package/src/project/project-config/configs/redis-project-config-names/index.js +1 -0
- package/src/project/project-config/domains/backend-init-project-config/index.d.ts +2 -1
- package/src/project/project-config/domains/backend-project-config/index.d.ts +2 -1
- package/src/project/project-config/domains/cache-service-project-config/index.d.ts +2 -1
- package/src/project/project-config/domains/dictionary-service-poject-config/index.d.ts +2 -1
- package/src/project/project-config/domains/images-init-project-config/index.d.ts +2 -1
- package/src/project/project-config/domains/images-project-config/index.d.ts +2 -1
- package/src/project/project-config/domains/index.d.ts +2 -1
- package/src/project/project-config/domains/index.js +2 -1
- package/src/project/project-config/domains/logger-service-project-config/index.d.ts +2 -1
- package/src/project/project-config/domains/rabbitmq-project-config/index.d.ts +2 -1
- package/src/project/project-config/domains/redis-project-config/index.d.ts +2 -1
- package/src/project/project-config/index.d.ts +1 -0
- package/src/project/project-config/index.js +1 -0
- package/src/type/domains/index.d.ts +5 -0
- package/src/type/domains/index.js +1 -0
- package/src/type/index.d.ts +1 -0
- package/src/type/index.js +1 -0
- package/src/project/project-config/domains/project-config-map/index.d.ts +0 -20
- /package/src/{project/project-config/domains/project-config-map → environment/environment-variable-name/domains}/index.js +0 -0
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import * as dotenv from 'dotenv';
|
2
|
-
|
3
|
-
|
4
|
-
const
|
2
|
+
import { NUMBER_ENVIRONMENT_VARIABLES } from '../../../environment-variables/configs/number-environment-variables/index.js';
|
3
|
+
export const loadEnvFile = (environmentMode) => {
|
4
|
+
const props = { environmentMode };
|
5
5
|
const fileName = `.env.${environmentMode}`;
|
6
6
|
const envFile = dotenv.config({ path: `./${fileName}` });
|
7
7
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
@@ -17,9 +17,11 @@ export const loadEnvFile = (environmentMode, options) => {
|
|
17
17
|
},
|
18
18
|
};
|
19
19
|
}
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
NUMBER_ENVIRONMENT_VARIABLES.forEach((it) => {
|
21
|
+
if (parsed[it]) {
|
22
|
+
parsed[it] = parseInt(parsed[it]);
|
23
|
+
}
|
24
|
+
});
|
23
25
|
return {
|
24
26
|
data: parsed,
|
25
27
|
};
|
@@ -1,8 +1,6 @@
|
|
1
1
|
import { CustomError } from '../../../../error/index.js';
|
2
2
|
import { EnvironmentMode } from '../../../environment-mode/index.js';
|
3
|
-
export type LoadEnvFile = <T extends Record<string, unknown>>(environmentMode: EnvironmentMode
|
4
|
-
integers?: string[];
|
5
|
-
}) => {
|
3
|
+
export type LoadEnvFile = <T extends Record<string, unknown>>(environmentMode: EnvironmentMode) => {
|
6
4
|
data: T;
|
7
5
|
} | {
|
8
6
|
customError: CustomError;
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './domains/index.js';
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './domains/index.js';
|
@@ -0,0 +1,15 @@
|
|
1
|
+
export declare const ENVIRONMENT_VARIABLES: {
|
2
|
+
readonly APP_NAME: "string";
|
3
|
+
readonly CACHE_SERVICE_PORT: "number";
|
4
|
+
readonly DATABASE_URL: "string";
|
5
|
+
readonly DICTIONARY_SERVICE_PORT: "number";
|
6
|
+
readonly DOMAIN_NAME: "string";
|
7
|
+
readonly FRONTEND_URL: "string";
|
8
|
+
readonly LOGGER_SERVICE_PORT: "number";
|
9
|
+
readonly RABBITMQ_PORT: "number";
|
10
|
+
readonly RABBITMQ_MANAGEMENT_PORT: "number";
|
11
|
+
readonly REDIS_PORT: "number";
|
12
|
+
readonly REDIS_PWD: "string";
|
13
|
+
readonly REDIS_URL: "string";
|
14
|
+
readonly S3_IMAGES_BUCKET_NAME: "string";
|
15
|
+
};
|
@@ -0,0 +1,15 @@
|
|
1
|
+
export const ENVIRONMENT_VARIABLES = {
|
2
|
+
APP_NAME: 'string',
|
3
|
+
CACHE_SERVICE_PORT: 'number',
|
4
|
+
DATABASE_URL: 'string',
|
5
|
+
DICTIONARY_SERVICE_PORT: 'number',
|
6
|
+
DOMAIN_NAME: 'string',
|
7
|
+
FRONTEND_URL: 'string',
|
8
|
+
LOGGER_SERVICE_PORT: 'number',
|
9
|
+
RABBITMQ_PORT: 'number',
|
10
|
+
RABBITMQ_MANAGEMENT_PORT: 'number',
|
11
|
+
REDIS_PORT: 'number',
|
12
|
+
REDIS_PWD: 'string',
|
13
|
+
REDIS_URL: 'string',
|
14
|
+
S3_IMAGES_BUCKET_NAME: 'string',
|
15
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const NUMBER_ENVIRONMENT_VARIABLES: ("APP_NAME" | "CACHE_SERVICE_PORT" | "DATABASE_URL" | "DICTIONARY_SERVICE_PORT" | "DOMAIN_NAME" | "FRONTEND_URL" | "LOGGER_SERVICE_PORT" | "RABBITMQ_PORT" | "RABBITMQ_MANAGEMENT_PORT" | "REDIS_PORT" | "REDIS_PWD" | "REDIS_URL" | "S3_IMAGES_BUCKET_NAME")[];
|
@@ -1,15 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
FRONTEND_URL: string;
|
8
|
-
LOGGER_SERVICE_PORT: number;
|
9
|
-
RABBITMQ_PORT: number;
|
10
|
-
RABBITMQ_MANAGEMENT_PORT: number;
|
11
|
-
REDIS_PORT: number;
|
12
|
-
REDIS_PWD: string;
|
13
|
-
REDIS_URL: string;
|
14
|
-
S3_IMAGES_BUCKET_NAME: string;
|
15
|
-
}
|
1
|
+
import { TypeMap } from '../../../type/index.js';
|
2
|
+
import { EnvironmentVariableName } from '../../environment-variable-name/domains/index.js';
|
3
|
+
import { ENVIRONMENT_VARIABLES } from '../configs/index.js';
|
4
|
+
export type EnvironmentVariables = {
|
5
|
+
[key in EnvironmentVariableName]: TypeMap[(typeof ENVIRONMENT_VARIABLES)[key]];
|
6
|
+
};
|
@@ -2,9 +2,9 @@ import { loadEnvFile } from '../../../env-file/index.js';
|
|
2
2
|
export const EnvironmentVariablesWorker = (() => {
|
3
3
|
let envs;
|
4
4
|
const get = () => envs;
|
5
|
-
const init = (
|
5
|
+
const init = () => {
|
6
6
|
const ENVIRONMENT_MODE = process.env.ENVIRONMENT_MODE;
|
7
|
-
const resp = loadEnvFile(ENVIRONMENT_MODE
|
7
|
+
const resp = loadEnvFile(ENVIRONMENT_MODE);
|
8
8
|
if ('customError' in resp) {
|
9
9
|
return resp;
|
10
10
|
}
|
package/src/environment/index.js
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
export declare const BACKEND_INIT_PROJECT_CONFIG_NAMES: readonly ["APP_NAME", "DOMAIN_NAME", "S3_IMAGES_BUCKET_NAME"];
|
@@ -0,0 +1 @@
|
|
1
|
+
export const BACKEND_INIT_PROJECT_CONFIG_NAMES = ['APP_NAME', 'DOMAIN_NAME', 'S3_IMAGES_BUCKET_NAME'];
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const BACKEND_PROJECT_CONFIG_NAMES: readonly ["CACHE_SERVICE_PORT", "LOGGER_SERVICE_PORT", "RABBITMQ_PORT", "RABBITMQ_MANAGEMENT_PORT", "REDIS_PORT"];
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const CACHE_SERVICE_PROJECT_CONFIG_NAMES: readonly ["CACHE_SERVICE_PORT", "DATABASE_URL", "REDIS_PWD", "REDIS_URL"];
|
@@ -0,0 +1 @@
|
|
1
|
+
export const CACHE_SERVICE_PROJECT_CONFIG_NAMES = ['CACHE_SERVICE_PORT', 'DATABASE_URL', 'REDIS_PWD', 'REDIS_URL'];
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const DICTIONARY_SERVICE_PROJECT_CONFIG_NAMES: readonly ["DICTIONARY_SERVICE_PORT"];
|
@@ -0,0 +1 @@
|
|
1
|
+
export const DICTIONARY_SERVICE_PROJECT_CONFIG_NAMES = ['DICTIONARY_SERVICE_PORT'];
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const IMAGES_INIT_PROJECT_CONFIG_NAMES: readonly ["FRONTEND_URL", "S3_IMAGES_BUCKET_NAME"];
|
@@ -0,0 +1 @@
|
|
1
|
+
export const IMAGES_INIT_PROJECT_CONFIG_NAMES = ['FRONTEND_URL', 'S3_IMAGES_BUCKET_NAME'];
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const IMAGES_PROJECT_CONFIG_NAMES: readonly ["S3_IMAGES_BUCKET_NAME"];
|
@@ -0,0 +1 @@
|
|
1
|
+
export const IMAGES_PROJECT_CONFIG_NAMES = ['S3_IMAGES_BUCKET_NAME'];
|
@@ -0,0 +1,9 @@
|
|
1
|
+
export * from './backend-init-project-config-names/index.js';
|
2
|
+
export * from './backend-project-config-names/index.js';
|
3
|
+
export * from './cache-service-project-config-names/index.js';
|
4
|
+
export * from './dictionary-service-project-config-names/index.js';
|
5
|
+
export * from './images-init-project-config-names/index.js';
|
6
|
+
export * from './images-project-config-names/index.js';
|
7
|
+
export * from './logger-service-project-config-names/index.js';
|
8
|
+
export * from './rabbitmq-project-config-names/index.js';
|
9
|
+
export * from './redis-project-config-names/index.js';
|
@@ -0,0 +1,9 @@
|
|
1
|
+
export * from './backend-init-project-config-names/index.js';
|
2
|
+
export * from './backend-project-config-names/index.js';
|
3
|
+
export * from './cache-service-project-config-names/index.js';
|
4
|
+
export * from './dictionary-service-project-config-names/index.js';
|
5
|
+
export * from './images-init-project-config-names/index.js';
|
6
|
+
export * from './images-project-config-names/index.js';
|
7
|
+
export * from './logger-service-project-config-names/index.js';
|
8
|
+
export * from './rabbitmq-project-config-names/index.js';
|
9
|
+
export * from './redis-project-config-names/index.js';
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const LOGGER_SERVICE_PROJECT_CONFIG_NAMES: readonly ["DATABASE_URL", "LOGGER_SERVICE_PORT"];
|
@@ -0,0 +1 @@
|
|
1
|
+
export const LOGGER_SERVICE_PROJECT_CONFIG_NAMES = ['DATABASE_URL', 'LOGGER_SERVICE_PORT'];
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const RABBITMQ_PROJECT_CONFIG_NAMES: readonly ["RABBITMQ_PORT", "RABBITMQ_MANAGEMENT_PORT"];
|
@@ -0,0 +1 @@
|
|
1
|
+
export const RABBITMQ_PROJECT_CONFIG_NAMES = ['RABBITMQ_PORT', 'RABBITMQ_MANAGEMENT_PORT'];
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const REDIS_PROJECT_CONFIG_NAMES: readonly ["REDIS_PORT", "REDIS_PWD"];
|
@@ -0,0 +1 @@
|
|
1
|
+
export const REDIS_PROJECT_CONFIG_NAMES = ['REDIS_PORT', 'REDIS_PWD'];
|
@@ -1,2 +1,3 @@
|
|
1
1
|
import { EnvironmentVariables } from '../../../../environment/index.js';
|
2
|
-
|
2
|
+
import { BACKEND_INIT_PROJECT_CONFIG_NAMES } from '../../configs/index.js';
|
3
|
+
export type BackendInitProjectConfig = Pick<EnvironmentVariables, (typeof BACKEND_INIT_PROJECT_CONFIG_NAMES)[number]>;
|
@@ -1,2 +1,3 @@
|
|
1
1
|
import { EnvironmentVariables } from '../../../../environment/index.js';
|
2
|
-
|
2
|
+
import { BACKEND_PROJECT_CONFIG_NAMES } from '../../configs/index.js';
|
3
|
+
export type BackendProjectConfig = Pick<EnvironmentVariables, (typeof BACKEND_PROJECT_CONFIG_NAMES)[number]>;
|
@@ -1,2 +1,3 @@
|
|
1
1
|
import { EnvironmentVariables } from '../../../../environment/index.js';
|
2
|
-
|
2
|
+
import { CACHE_SERVICE_PROJECT_CONFIG_NAMES } from '../../configs/index.js';
|
3
|
+
export type CacheServiceProjectConfig = Pick<EnvironmentVariables, (typeof CACHE_SERVICE_PROJECT_CONFIG_NAMES)[number]>;
|
@@ -1,2 +1,3 @@
|
|
1
1
|
import { EnvironmentVariables } from '../../../../environment/index.js';
|
2
|
-
|
2
|
+
import { DICTIONARY_SERVICE_PROJECT_CONFIG_NAMES } from '../../configs/index.js';
|
3
|
+
export type DictionaryServiceProjectConfig = Pick<EnvironmentVariables, (typeof DICTIONARY_SERVICE_PROJECT_CONFIG_NAMES)[number]>;
|
@@ -1,2 +1,3 @@
|
|
1
1
|
import { EnvironmentVariables } from '../../../../environment/index.js';
|
2
|
-
|
2
|
+
import { IMAGES_INIT_PROJECT_CONFIG_NAMES } from '../../configs/index.js';
|
3
|
+
export type ImagesInitProjectConfig = Pick<EnvironmentVariables, (typeof IMAGES_INIT_PROJECT_CONFIG_NAMES)[number]>;
|
@@ -1,2 +1,3 @@
|
|
1
1
|
import { EnvironmentVariables } from '../../../../environment/index.js';
|
2
|
-
|
2
|
+
import { IMAGES_PROJECT_CONFIG_NAMES } from '../../configs/index.js';
|
3
|
+
export type ImagesProjectConfig = Pick<EnvironmentVariables, (typeof IMAGES_PROJECT_CONFIG_NAMES)[number]>;
|
@@ -2,7 +2,8 @@ export * from './backend-project-config/index.js';
|
|
2
2
|
export * from './backend-init-project-config/index.js';
|
3
3
|
export * from './cache-service-project-config/index.js';
|
4
4
|
export * from './dictionary-service-poject-config/index.js';
|
5
|
+
export * from './images-project-config/index.js';
|
6
|
+
export * from './images-init-project-config/index.js';
|
5
7
|
export * from './logger-service-project-config/index.js';
|
6
|
-
export * from './project-config-map/index.js';
|
7
8
|
export * from './rabbitmq-project-config/index.js';
|
8
9
|
export * from './redis-project-config/index.js';
|
@@ -2,7 +2,8 @@ export * from './backend-project-config/index.js';
|
|
2
2
|
export * from './backend-init-project-config/index.js';
|
3
3
|
export * from './cache-service-project-config/index.js';
|
4
4
|
export * from './dictionary-service-poject-config/index.js';
|
5
|
+
export * from './images-project-config/index.js';
|
6
|
+
export * from './images-init-project-config/index.js';
|
5
7
|
export * from './logger-service-project-config/index.js';
|
6
|
-
export * from './project-config-map/index.js';
|
7
8
|
export * from './rabbitmq-project-config/index.js';
|
8
9
|
export * from './redis-project-config/index.js';
|
@@ -1,2 +1,3 @@
|
|
1
1
|
import { EnvironmentVariables } from '../../../../environment/index.js';
|
2
|
-
|
2
|
+
import { LOGGER_SERVICE_PROJECT_CONFIG_NAMES } from '../../configs/index.js';
|
3
|
+
export type LoggerServiceProjectConfig = Pick<EnvironmentVariables, (typeof LOGGER_SERVICE_PROJECT_CONFIG_NAMES)[number]>;
|
@@ -1,2 +1,3 @@
|
|
1
1
|
import { EnvironmentVariables } from '../../../../environment/index.js';
|
2
|
-
|
2
|
+
import { RABBITMQ_PROJECT_CONFIG_NAMES } from '../../configs/index.js';
|
3
|
+
export type RabbitmqProjectConfig = Pick<EnvironmentVariables, (typeof RABBITMQ_PROJECT_CONFIG_NAMES)[number]>;
|
@@ -1,2 +1,3 @@
|
|
1
1
|
import { EnvironmentVariables } from '../../../../environment/index.js';
|
2
|
-
|
2
|
+
import { REDIS_PROJECT_CONFIG_NAMES } from '../../configs/index.js';
|
3
|
+
export type RedisProjectConfig = Pick<EnvironmentVariables, (typeof REDIS_PROJECT_CONFIG_NAMES)[number]>;
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
package/src/type/index.d.ts
CHANGED
package/src/type/index.js
CHANGED
@@ -1,20 +0,0 @@
|
|
1
|
-
import { BackendInitProjectConfig } from '../backend-init-project-config/index.js';
|
2
|
-
import { BackendProjectConfig } from '../backend-project-config/index.js';
|
3
|
-
import { CacheServiceProjectConfig } from '../cache-service-project-config/index.js';
|
4
|
-
import { DictionaryServiceProjectConfig } from '../dictionary-service-poject-config/index.js';
|
5
|
-
import { ImagesInitProjectConfig } from '../images-init-project-config/index.js';
|
6
|
-
import { ImagesProjectConfig } from '../images-project-config/index.js';
|
7
|
-
import { LoggerServiceProjectConfig } from '../logger-service-project-config/index.js';
|
8
|
-
import { RabbitmqProjectConfig } from '../rabbitmq-project-config/index.js';
|
9
|
-
import { RedisProjectConfig } from '../redis-project-config/index.js';
|
10
|
-
export type ProjectConfigMap = {
|
11
|
-
'backend-project-config': BackendProjectConfig;
|
12
|
-
'backend-init-project-config': BackendInitProjectConfig;
|
13
|
-
'cache-service-project-config': CacheServiceProjectConfig;
|
14
|
-
'dictionary-service-project-config': DictionaryServiceProjectConfig;
|
15
|
-
'images-project-config': ImagesProjectConfig;
|
16
|
-
'images-init-project-config': ImagesInitProjectConfig;
|
17
|
-
'logger-service-project-config': LoggerServiceProjectConfig;
|
18
|
-
'rabbitmq-project-config': RabbitmqProjectConfig;
|
19
|
-
'redis-project-config': RedisProjectConfig;
|
20
|
-
};
|