@candlerip/shared3 0.0.26 → 0.0.27

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.26",
3
+ "version": "0.0.27",
4
4
  "type": "module",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -1,6 +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> = never>(environmentMode: EnvironmentMode, options?: {
3
+ export type LoadEnvFile = <T extends Record<string, unknown>>(environmentMode: EnvironmentMode, options?: {
4
4
  integers?: string[];
5
5
  }) => {
6
6
  data: T;
@@ -1 +1,2 @@
1
1
  export * from './domains/index.js';
2
+ export * from './workers/index.js';
@@ -1 +1,2 @@
1
1
  export * from './domains/index.js';
2
+ export * from './workers/index.js';
@@ -0,0 +1,2 @@
1
+ import { IEnvironmentVariablesWorker } from './types.js';
2
+ export declare const EnvironmentVariablesWorker: IEnvironmentVariablesWorker;
@@ -0,0 +1,20 @@
1
+ import { loadEnvFile } from '../../../env-file/index.js';
2
+ export const EnvironmentVariablesWorker = (() => {
3
+ let envs;
4
+ const getEnvs = () => envs;
5
+ const init = () => {
6
+ const ENVIRONMENT_MODE = process.env.ENVIRONMENT_MODE;
7
+ const resp = loadEnvFile(ENVIRONMENT_MODE);
8
+ if ('customError' in resp) {
9
+ return resp;
10
+ }
11
+ envs = {
12
+ ...resp.data,
13
+ ENVIRONMENT_MODE,
14
+ };
15
+ };
16
+ return {
17
+ getEnvs,
18
+ init,
19
+ };
20
+ })();
@@ -0,0 +1,9 @@
1
+ import { CustomError } from '../../../../error/index.js';
2
+ export type IEnvironmentVariablesWorker = {
3
+ getEnvs: GetEnvs;
4
+ init: Init;
5
+ };
6
+ export type GetEnvs = <T = never>() => T;
7
+ export type Init = () => undefined | {
8
+ customError: CustomError;
9
+ };
@@ -0,0 +1 @@
1
+ export * from './environment-variables-worker/index.js';
@@ -0,0 +1 @@
1
+ export * from './environment-variables-worker/index.js';