@candlerip/shared 0.0.4 → 0.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/devops/docker/publish-to-docker-hub.sh +5 -0
  2. package/devops/environment/create-env-file.sh +11 -15
  3. package/devops/eslint/eslint.base.config.js +26 -0
  4. package/devops/eslint/eslint.sh +4 -4
  5. package/devops/npm/publish-to-npm-registry.sh +11 -0
  6. package/devops/prettier/{config.js → prettier.base.config.js} +1 -1
  7. package/devops/prettier/prettier.sh +4 -4
  8. package/devops/typescript/tsc-build.sh +1 -1
  9. package/devops/typescript/tsc-watch.sh +1 -1
  10. package/devops/typescript/tsconfig.base.json +1 -2
  11. package/package.json +11 -25
  12. package/src/index.d.ts +1 -0
  13. package/src/index.js +1 -0
  14. package/src/service/index.d.ts +1 -0
  15. package/src/service/index.js +1 -0
  16. package/src/service/service-name/constants.d.ts +1 -0
  17. package/src/service/service-name/constants.js +1 -0
  18. package/src/service/service-name/domains.d.ts +2 -0
  19. package/src/service/service-name/index.d.ts +2 -0
  20. package/src/service/service-name/index.js +2 -0
  21. package/devops/npm/publish-to-npm.sh +0 -10
  22. package/devops/publish-package.sh +0 -12
  23. package/dist/backend/environment/env-file/index.d.ts +0 -1
  24. package/dist/backend/environment/env-file/index.js +0 -1
  25. package/dist/backend/environment/env-file/utils/index.d.ts +0 -1
  26. package/dist/backend/environment/env-file/utils/index.js +0 -1
  27. package/dist/backend/environment/env-file/utils/load-env-file/index.d.ts +0 -2
  28. package/dist/backend/environment/env-file/utils/load-env-file/index.js +0 -47
  29. package/dist/backend/environment/env-file/utils/load-env-file/type.d.ts +0 -4
  30. package/dist/backend/environment/env-file/utils/load-env-file/type.js +0 -1
  31. package/dist/backend/environment/index.d.ts +0 -1
  32. package/dist/backend/environment/index.js +0 -1
  33. package/dist/common/environment/environment-mode/configs.d.ts +0 -1
  34. package/dist/common/environment/environment-mode/configs.js +0 -1
  35. package/dist/common/environment/environment-mode/domains.d.ts +0 -2
  36. package/dist/common/environment/environment-mode/index.d.ts +0 -3
  37. package/dist/common/environment/environment-mode/index.js +0 -3
  38. package/dist/common/environment/environment-mode/type-guards/index.d.ts +0 -3
  39. package/dist/common/environment/environment-mode/type-guards/index.js +0 -3
  40. package/dist/common/environment/environment-mode/type-guards/is-development.d.ts +0 -1
  41. package/dist/common/environment/environment-mode/type-guards/is-development.js +0 -1
  42. package/dist/common/environment/environment-mode/type-guards/is-environment-mode.d.ts +0 -2
  43. package/dist/common/environment/environment-mode/type-guards/is-environment-mode.js +0 -2
  44. package/dist/common/environment/environment-mode/type-guards/is-production.d.ts +0 -1
  45. package/dist/common/environment/environment-mode/type-guards/is-production.js +0 -1
  46. package/dist/common/environment/environment-variables/domains.d.ts +0 -18
  47. package/dist/common/environment/environment-variables/domains.js +0 -1
  48. package/dist/common/environment/environment-variables/index.d.ts +0 -2
  49. package/dist/common/environment/environment-variables/index.js +0 -2
  50. package/dist/common/environment/environment-variables/singletons/index.d.ts +0 -8
  51. package/dist/common/environment/environment-variables/singletons/index.js +0 -20
  52. package/dist/common/environment/environment-variables/singletons/type.d.ts +0 -6
  53. package/dist/common/environment/environment-variables/singletons/type.js +0 -1
  54. package/dist/common/environment/index.d.ts +0 -2
  55. package/dist/common/environment/index.js +0 -2
  56. package/dist/common/error/domains.d.ts +0 -13
  57. package/dist/common/error/domains.js +0 -1
  58. package/dist/common/error/index.d.ts +0 -3
  59. package/dist/common/error/index.js +0 -3
  60. package/dist/common/error/utils/compose-error/index.d.ts +0 -2
  61. package/dist/common/error/utils/compose-error/index.js +0 -7
  62. package/dist/common/error/utils/compose-error/type.d.ts +0 -2
  63. package/dist/common/error/utils/compose-error/type.js +0 -1
  64. package/dist/common/error/utils/console-error/index.d.ts +0 -2
  65. package/dist/common/error/utils/console-error/index.js +0 -12
  66. package/dist/common/error/utils/console-error/type.d.ts +0 -2
  67. package/dist/common/error/utils/console-error/type.js +0 -1
  68. package/dist/common/error/utils/index.d.ts +0 -2
  69. package/dist/common/error/utils/index.js +0 -2
  70. package/dist/common/error/workers/index.d.ts +0 -2
  71. package/dist/common/error/workers/index.js +0 -32
  72. package/dist/common/error/workers/type.d.ts +0 -19
  73. package/dist/common/error/workers/type.js +0 -1
  74. package/dist/common/helpers/index.d.ts +0 -2
  75. package/dist/common/helpers/index.js +0 -2
  76. package/dist/common/helpers/reveal-all-object-props/index.d.ts +0 -2
  77. package/dist/common/helpers/reveal-all-object-props/index.js +0 -13
  78. package/dist/common/helpers/reveal-all-object-props/type.d.ts +0 -1
  79. package/dist/common/helpers/reveal-all-object-props/type.js +0 -1
  80. package/dist/common/helpers/stringify/index.d.ts +0 -2
  81. package/dist/common/helpers/stringify/index.js +0 -3
  82. package/dist/common/helpers/stringify/type.d.ts +0 -1
  83. package/dist/common/helpers/stringify/type.js +0 -1
  84. package/dist/common/index.d.ts +0 -5
  85. package/dist/common/index.js +0 -5
  86. package/dist/common/service/index.d.ts +0 -1
  87. package/dist/common/service/index.js +0 -1
  88. package/dist/common/service/singletons/index.d.ts +0 -5
  89. package/dist/common/service/singletons/index.js +0 -11
  90. package/dist/common/service/singletons/type.d.ts +0 -2
  91. package/dist/common/service/singletons/type.js +0 -1
  92. package/dist/common/type/array/index.d.ts +0 -1
  93. package/dist/common/type/array/index.js +0 -1
  94. package/dist/common/type/array/type-guards.d.ts +0 -1
  95. package/dist/common/type/array/type-guards.js +0 -9
  96. package/dist/common/type/index.d.ts +0 -3
  97. package/dist/common/type/index.js +0 -3
  98. package/dist/common/type/null/index.d.ts +0 -1
  99. package/dist/common/type/null/index.js +0 -1
  100. package/dist/common/type/null/type-guards.d.ts +0 -1
  101. package/dist/common/type/null/type-guards.js +0 -1
  102. package/dist/common/type/object/index.d.ts +0 -1
  103. package/dist/common/type/object/index.js +0 -1
  104. package/dist/common/type/object/type-guards.d.ts +0 -1
  105. package/dist/common/type/object/type-guards.js +0 -11
  106. package/dist/devops/eslint/configs.d.ts +0 -2
  107. package/dist/devops/eslint/configs.js +0 -8
  108. package/dist/devops/eslint/index.d.ts +0 -2
  109. package/dist/devops/eslint/index.js +0 -2
  110. package/dist/devops/eslint/utils/compose-eslint-config/index.d.ts +0 -2
  111. package/dist/devops/eslint/utils/compose-eslint-config/index.js +0 -20
  112. package/dist/devops/eslint/utils/compose-eslint-config/type.d.ts +0 -4
  113. package/dist/devops/eslint/utils/compose-eslint-config/type.js +0 -1
  114. package/dist/devops/eslint/utils/index.d.ts +0 -1
  115. package/dist/devops/eslint/utils/index.js +0 -1
  116. package/dist/devops/index.d.ts +0 -1
  117. package/dist/devops/index.js +0 -1
  118. package/src/backend/environment/env-file/index.ts +0 -1
  119. package/src/backend/environment/env-file/utils/index.ts +0 -1
  120. package/src/backend/environment/env-file/utils/load-env-file/index.ts +0 -53
  121. package/src/backend/environment/env-file/utils/load-env-file/type.ts +0 -5
  122. package/src/backend/environment/index.ts +0 -1
  123. package/src/common/environment/environment-mode/configs.ts +0 -1
  124. package/src/common/environment/environment-mode/domains.ts +0 -3
  125. package/src/common/environment/environment-mode/index.ts +0 -5
  126. package/src/common/environment/environment-mode/type-guards/index.ts +0 -5
  127. package/src/common/environment/environment-mode/type-guards/is-development.ts +0 -1
  128. package/src/common/environment/environment-mode/type-guards/is-environment-mode.ts +0 -4
  129. package/src/common/environment/environment-mode/type-guards/is-production.ts +0 -1
  130. package/src/common/environment/environment-variables/domains.ts +0 -19
  131. package/src/common/environment/environment-variables/index.ts +0 -3
  132. package/src/common/environment/environment-variables/singletons/index.ts +0 -29
  133. package/src/common/environment/environment-variables/singletons/type.ts +0 -11
  134. package/src/common/environment/index.ts +0 -3
  135. package/src/common/error/domains.ts +0 -8
  136. package/src/common/error/index.ts +0 -5
  137. package/src/common/error/utils/compose-error/index.ts +0 -9
  138. package/src/common/error/utils/compose-error/type.ts +0 -3
  139. package/src/common/error/utils/console-error/index.ts +0 -18
  140. package/src/common/error/utils/console-error/type.ts +0 -3
  141. package/src/common/error/utils/index.ts +0 -3
  142. package/src/common/error/workers/index.ts +0 -41
  143. package/src/common/error/workers/type.ts +0 -21
  144. package/src/common/helpers/index.ts +0 -3
  145. package/src/common/helpers/reveal-all-object-props/index.ts +0 -16
  146. package/src/common/helpers/reveal-all-object-props/type.ts +0 -1
  147. package/src/common/helpers/stringify/index.ts +0 -5
  148. package/src/common/helpers/stringify/type.ts +0 -1
  149. package/src/common/index.ts +0 -9
  150. package/src/common/service/index.ts +0 -1
  151. package/src/common/service/singletons/index.ts +0 -16
  152. package/src/common/service/singletons/type.ts +0 -3
  153. package/src/common/type/array/index.ts +0 -1
  154. package/src/common/type/array/type-guards.ts +0 -11
  155. package/src/common/type/index.ts +0 -5
  156. package/src/common/type/null/index.ts +0 -1
  157. package/src/common/type/null/type-guards.ts +0 -1
  158. package/src/common/type/object/index.ts +0 -1
  159. package/src/common/type/object/type-guards.ts +0 -12
  160. package/src/devops/eslint/configs.ts +0 -10
  161. package/src/devops/eslint/index.ts +0 -3
  162. package/src/devops/eslint/utils/compose-eslint-config/index.ts +0 -29
  163. package/src/devops/eslint/utils/compose-eslint-config/type.ts +0 -3
  164. package/src/devops/eslint/utils/index.ts +0 -1
  165. package/src/devops/index.ts +0 -1
  166. /package/{dist/common/environment/environment-mode → src/service/service-name}/domains.js +0 -0
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env bash
2
+
3
+ echo "$DOCKER_ACCESS_TOKEN" | docker login -u $DOCKER_USERNAME --password-stdin
4
+ docker build -t reveszimre/$1 .
5
+ docker push reveszimre/$1
@@ -1,22 +1,18 @@
1
- #!/bin/bash
1
+ #!/usr/bin/env bash
2
2
  set -e
3
3
 
4
- ARRAY=(${1//,/ })
5
-
6
- NAMES_ARRAY[0]="${ARRAY[@]:0:10}"
7
- NAMES_ARRAY[1]="${ARRAY[@]:10:20}"
8
- NAMES_ARRAY[2]="${ARRAY[@]:20:30}"
4
+ PARAM_NAMES=(${1//,/ })
9
5
 
10
6
  ENVS=()
11
- for NAMES in "${NAMES_ARRAY[@]}"
12
- do
13
- if [ -n "$NAMES" ]; then
14
- PARAMS=$(aws ssm get-parameters --names $NAMES --output text --query "Parameters[*].{Name:Name,Value:Value}" --with-decryption | sed -E 's/\s+/=/g')
15
- PARAMS1="${PARAMS[@]//_DEVELOPMENT/}"
16
- PARAMS2="${PARAMS1[@]//_PRODUCTION/}"
17
- PARAMS3="${PARAMS2[@]//AMAZONWEBSERVICES/AWS}"
18
- ENVS+=("$PARAMS3")
19
- fi
7
+ for ((i=0; i<${#PARAM_NAMES[@]}; i+=10)); do
8
+ chunk=("${PARAM_NAMES[@]:i:10}")
9
+
10
+ PARAMS=$(aws ssm get-parameters --names "${chunk[@]}" --output text --query "Parameters[*].{Name:Name,Value:Value}" --with-decryption | sed -E 's/\s+/=/g')
11
+
12
+ PARAMS1="${PARAMS[@]//_DEVELOPMENT/}"
13
+ PARAMS2="${PARAMS1[@]//_PRODUCTION/}"
14
+ PARAMS3="${PARAMS2[@]//AMAZONWEBSERVICES/AWS}"
15
+ ENVS+=("$PARAMS3")
20
16
  done
21
17
 
22
18
  if [[ $2 ]]
@@ -0,0 +1,26 @@
1
+ import js from '@eslint/js';
2
+ import ts from 'typescript-eslint';
3
+ import globals from 'globals';
4
+
5
+ export default (projectConfig) =>
6
+ ts.config(
7
+ js.configs.recommended,
8
+ ...ts.configs.recommended,
9
+ {
10
+ ignores: ['.next', 'cdk.out', 'dist', 'temp'],
11
+ },
12
+ {
13
+ languageOptions: {
14
+ globals: {
15
+ ...globals.browser,
16
+ ...globals.node,
17
+ },
18
+ },
19
+ },
20
+ {
21
+ rules: {
22
+ 'no-console': [2, { allow: ['error', 'info'] }],
23
+ },
24
+ },
25
+ ...(projectConfig ?? []),
26
+ );
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env sh
2
- set -e
3
-
4
- npx eslint .
1
+ #!/usr/bin/env bash
2
+ set -e
3
+
4
+ npx eslint .
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env bash
2
+ set -e
3
+
4
+ npm config set //registry.npmjs.org/:_authToken $NPM_ACCESS_TOKEN
5
+
6
+ if [ -d "devops" ]; then
7
+ cp -r devops dist
8
+ fi
9
+ cp package.json dist
10
+
11
+ npm publish ./dist --access=public
@@ -1,4 +1,4 @@
1
- export const PRETTIER_CONFIG = {
1
+ export default {
2
2
  semi: true,
3
3
  printWidth: 150,
4
4
  singleQuote: true,
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env sh
2
- set -e
3
-
4
- npx prettier . --write
1
+ #!/usr/bin/env bash
2
+ set -e
3
+
4
+ npx prettier . --write
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env sh
1
+ #!/usr/bin/env bash
2
2
  set -e
3
3
 
4
4
  rm -rf dist
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env sh
1
+ #!/usr/bin/env bash
2
2
  set -e
3
3
 
4
4
  rm -rf dist
@@ -13,6 +13,5 @@
13
13
  "tsc-alias": {
14
14
  "verbose": false,
15
15
  "resolveFullPaths": true
16
- },
17
- "include": ["${configDir}/src/**/*"]
16
+ }
18
17
  }
package/package.json CHANGED
@@ -1,43 +1,29 @@
1
1
  {
2
2
  "name": "@candlerip/shared",
3
- "version": "0.0.4",
3
+ "version": "0.0.17",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": "=22.19.0"
7
7
  },
8
- "files": [
9
- "devops",
10
- "dist",
11
- "src",
12
- "package-lock.json",
13
- "package.json"
14
- ],
8
+ "main": "src/index.js",
15
9
  "bin": {
10
+ "crs-create-env-file": "devops/environment/create-env-file.sh",
11
+ "crs-publish-to-docker-hub": "./devops/docker/publish-to-docker-hub.sh",
16
12
  "crs-eslint": "devops/eslint/eslint.sh",
13
+ "crs-publish-to-npm-registry": "devops/npm/publish-to-npm-registry.sh",
17
14
  "crs-prettier": "devops/prettier/prettier.sh",
18
15
  "crs-tsc-build": "devops/typescript/tsc-build.sh",
19
16
  "crs-tsc-watch": "devops/typescript/tsc-watch.sh"
20
17
  },
21
- "exports": {
22
- "./backend/environment": "./dist/backend/environment/index.js",
23
- "./common": "./dist/common/index.js",
24
- "./devops": "./dist/devops/index.js"
25
- },
26
18
  "scripts": {
27
- "build": "sh ./devops/typescript/tsc-build.sh",
28
- "publish-package": "sh ./devops/publish-package.sh",
29
- "start": "sh ./devops/typescript/tsc-watch.sh"
19
+ "dev": "sh ./devops/typescript/tsc-watch.sh"
30
20
  },
31
21
  "dependencies": {
32
- "eslint": "^9.35.0",
33
- "globals": "^16.4.0",
34
- "jiti": "^2.5.1",
35
- "prettier": "^3.6.2",
22
+ "eslint": "^9.28.0",
23
+ "globals": "^16.2.0",
24
+ "prettier": "^3.5.3",
36
25
  "tsc-alias": "^1.8.16",
37
- "typescript": "^5.9.2",
38
- "typescript-eslint": "^8.43.0"
39
- },
40
- "devDependencies": {
41
- "@types/node": "^24.3.1"
26
+ "typescript": "^5.8.3",
27
+ "typescript-eslint": "^8.33.1"
42
28
  }
43
29
  }
package/src/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './service/index.js';
package/src/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from './service/index.js';
@@ -0,0 +1 @@
1
+ export * from './service-name/index.js';
@@ -0,0 +1 @@
1
+ export * from './service-name/index.js';
@@ -0,0 +1 @@
1
+ export declare const SERVICE_NAMES: readonly ["cache-service", "environment-service"];
@@ -0,0 +1 @@
1
+ export const SERVICE_NAMES = ['cache-service', 'environment-service'];
@@ -0,0 +1,2 @@
1
+ import { SERVICE_NAMES } from './constants.js';
2
+ export type ServiceName = (typeof SERVICE_NAMES)[number];
@@ -0,0 +1,2 @@
1
+ export * from './constants.js';
2
+ export * from './domains.js';
@@ -0,0 +1,2 @@
1
+ export * from './constants.js';
2
+ export * from './domains.js';
@@ -1,10 +0,0 @@
1
- #!/bin/bash
2
- set -e
3
-
4
- ./devops/environment/create-env-file.sh NPM_ACCESS_TOKEN
5
-
6
- source .env
7
-
8
- npm config set //registry.npmjs.org/:_authToken ${NPM_ACCESS_TOKEN}
9
-
10
- npm publish . --access=public
@@ -1,12 +0,0 @@
1
- #!/bin/bash
2
- set -e
3
-
4
- ./devops/prettier/prettier.sh
5
-
6
- ./devops/eslint/eslint.sh
7
-
8
- ./devops/typescript/tsc-build.sh
9
-
10
- git-push.sh
11
-
12
- ./devops/npm/publish-to-npm.sh
@@ -1 +0,0 @@
1
- export * from './utils/index.js';
@@ -1 +0,0 @@
1
- export * from './utils/index.js';
@@ -1 +0,0 @@
1
- export * from './load-env-file/index.js';
@@ -1 +0,0 @@
1
- export * from './load-env-file/index.js';
@@ -1,2 +0,0 @@
1
- import { LoadEnvFile } from './type.js';
2
- export declare const loadEnvFile: LoadEnvFile;
@@ -1,47 +0,0 @@
1
- import fs from 'fs';
2
- import { ErrorWorker } from '../../../../../common/index.js';
3
- export const loadEnvFile = (environmentMode) => {
4
- const { composeError } = ErrorWorker({ info: { environmentMode } });
5
- let fileName = '.env';
6
- if (environmentMode) {
7
- fileName += `.${environmentMode}`;
8
- }
9
- const parsed = {};
10
- try {
11
- const file = fs.readFileSync(fileName, 'utf-8');
12
- file.split('\n').forEach((fileLine) => {
13
- if (fileLine.length === 0) {
14
- return;
15
- }
16
- const envVar = fileLine.split('=');
17
- parsed[`${envVar[0]}`] = envVar[1];
18
- });
19
- }
20
- catch (err) {
21
- return {
22
- error: composeError(`Error loading ${fileName}`, {
23
- info: {
24
- err,
25
- fileName,
26
- },
27
- }),
28
- };
29
- }
30
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
31
- const data = {};
32
- Object.keys(parsed).forEach((key) => {
33
- const parsedItem = parsed[key];
34
- if (['false', 'true'].includes(parsedItem)) {
35
- data[key] = Boolean(parsedItem === 'true');
36
- }
37
- else if (!Number.isNaN(parseInt(parsedItem))) {
38
- data[key] = parseInt(parsedItem);
39
- }
40
- else {
41
- data[key] = parsedItem;
42
- }
43
- });
44
- return {
45
- data,
46
- };
47
- };
@@ -1,4 +0,0 @@
1
- import { EnvironmentMode, EnvironmentVariables, TError } from '../../../../../common/index.js';
2
- export type LoadEnvFile = <T extends Array<keyof EnvironmentVariables> = never>(environmentMode?: EnvironmentMode) => TError<{
3
- [K in T[number]]: EnvironmentVariables[K];
4
- }>;
@@ -1 +0,0 @@
1
- export * from './env-file/index.js';
@@ -1 +0,0 @@
1
- export * from './env-file/index.js';
@@ -1 +0,0 @@
1
- export declare const ENVIRONMENT_MODES: readonly ["development", "production"];
@@ -1 +0,0 @@
1
- export const ENVIRONMENT_MODES = ['development', 'production'];
@@ -1,2 +0,0 @@
1
- import { ENVIRONMENT_MODES } from './configs.js';
2
- export type EnvironmentMode = (typeof ENVIRONMENT_MODES)[number];
@@ -1,3 +0,0 @@
1
- export * from './configs.js';
2
- export * from './domains.js';
3
- export * from './type-guards/index.js';
@@ -1,3 +0,0 @@
1
- export * from './configs.js';
2
- export * from './domains.js';
3
- export * from './type-guards/index.js';
@@ -1,3 +0,0 @@
1
- export * from './is-development.js';
2
- export * from './is-environment-mode.js';
3
- export * from './is-production.js';
@@ -1,3 +0,0 @@
1
- export * from './is-development.js';
2
- export * from './is-environment-mode.js';
3
- export * from './is-production.js';
@@ -1 +0,0 @@
1
- export declare const isDevelopment: (data?: unknown) => data is "development";
@@ -1 +0,0 @@
1
- export const isDevelopment = (data) => data === 'development';
@@ -1,2 +0,0 @@
1
- import { EnvironmentMode } from '../domains.js';
2
- export declare const isEnvironmentMode: (data?: unknown) => data is EnvironmentMode;
@@ -1,2 +0,0 @@
1
- import { ENVIRONMENT_MODES } from '../configs.js';
2
- export const isEnvironmentMode = (data) => ENVIRONMENT_MODES.some((it) => data === it);
@@ -1 +0,0 @@
1
- export declare const isProduction: (data?: unknown) => data is "production";
@@ -1 +0,0 @@
1
- export const isProduction = (data) => data === 'production';
@@ -1,18 +0,0 @@
1
- import { EnvironmentMode } from '../environment-mode/index.js';
2
- export type EnvironmentVariables = {
3
- APP_NAME: string;
4
- AWS_REGION: string;
5
- AWS_S3_IMAGES_BUCKET_NAME: string;
6
- CACHE_SERVICE_PORT: string;
7
- CACHE_ENABLED: boolean;
8
- DATABASE_URL: string;
9
- DOMAIN_NAME: string;
10
- FRONTEND_URL: string;
11
- LOGGER_SERVICE_PORT: string;
12
- MOBILE_APP_URL: string;
13
- NODE_ENV: EnvironmentMode;
14
- RABBITMQ_URL: string;
15
- REDIS_PWD: string;
16
- REDIS_URL: string;
17
- REDIS_URL_APP: string;
18
- };
@@ -1,2 +0,0 @@
1
- export * from './domains.js';
2
- export * from './singletons/index.js';
@@ -1,2 +0,0 @@
1
- export * from './domains.js';
2
- export * from './singletons/index.js';
@@ -1,8 +0,0 @@
1
- import { GetEnv, GetEnvs, Init, IsDevelopment, IsProduction } from './type.js';
2
- export declare const EnvironmentVariablesSingleton: {
3
- getEnv: GetEnv;
4
- getEnvs: GetEnvs;
5
- init: Init;
6
- isDevelopment: IsDevelopment;
7
- isProduction: IsProduction;
8
- };
@@ -1,20 +0,0 @@
1
- import { isDevelopment as isDev, isProduction as isProd } from '../../environment-mode/index.js';
2
- export const EnvironmentVariablesSingleton = (() => {
3
- let _envs;
4
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
5
- const getEnv = (name) => _envs[name];
6
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
- const getEnvs = (names) => names.reduce((acc, curr) => ({ ...acc, [`${curr}`]: _envs[curr] }), {});
8
- const init = (envs) => {
9
- _envs = envs;
10
- };
11
- const isDevelopment = () => isDev(_envs.NODE_ENV);
12
- const isProduction = () => isProd(_envs.NODE_ENV);
13
- return {
14
- getEnv,
15
- getEnvs,
16
- init,
17
- isDevelopment,
18
- isProduction,
19
- };
20
- })();
@@ -1,6 +0,0 @@
1
- import { EnvironmentVariables } from '../domains.js';
2
- export type GetEnv = <T extends keyof EnvironmentVariables = never>(name: T) => EnvironmentVariables[T];
3
- export type GetEnvs = <T extends keyof EnvironmentVariables = never>(names: T[]) => Pick<EnvironmentVariables, T>;
4
- export type Init = (envs: Partial<EnvironmentVariables>) => void;
5
- export type IsDevelopment = () => boolean;
6
- export type IsProduction = () => boolean;
@@ -1,2 +0,0 @@
1
- export * from './environment-mode/index.js';
2
- export * from './environment-variables/index.js';
@@ -1,2 +0,0 @@
1
- export * from './environment-mode/index.js';
2
- export * from './environment-variables/index.js';
@@ -1,13 +0,0 @@
1
- export interface Error {
2
- id: string;
3
- info?: Record<string, unknown>;
4
- message: string;
5
- serviceName?: string;
6
- }
7
- export type TError<T = never> = {
8
- data: T;
9
- error?: never;
10
- } | {
11
- error: Error;
12
- data?: never;
13
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,3 +0,0 @@
1
- export * from './domains.js';
2
- export * from './utils/index.js';
3
- export * from './workers/index.js';
@@ -1,3 +0,0 @@
1
- export * from './domains.js';
2
- export * from './utils/index.js';
3
- export * from './workers/index.js';
@@ -1,2 +0,0 @@
1
- import { ComposeError } from './type.js';
2
- export declare const composeError: ComposeError;
@@ -1,7 +0,0 @@
1
- import { ServiceSingleton } from '../../../service/index.js';
2
- export const composeError = (message, info) => ({
3
- id: Math.random().toString(16).slice(2).toUpperCase(),
4
- info,
5
- message: message ?? '',
6
- serviceName: ServiceSingleton.getServiceName(),
7
- });
@@ -1,2 +0,0 @@
1
- import { Error } from '../../domains.js';
2
- export type ComposeError = (message?: string, info?: Record<string, unknown>) => Error;
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- import { ConsoleError } from './type.js';
2
- export declare const consoleError: ConsoleError;
@@ -1,12 +0,0 @@
1
- import { stringify } from '../../../helpers/index.js';
2
- export const consoleError = (error) => {
3
- const { id, info, message, serviceName } = error;
4
- let msg = `ERROR: ${message} (ID) ${id}`;
5
- if (serviceName) {
6
- msg += ` (SERVICE-NAME) ${serviceName}`;
7
- }
8
- if (info) {
9
- msg += ` (INFO) ${stringify(info)}`;
10
- }
11
- console.error(msg);
12
- };
@@ -1,2 +0,0 @@
1
- import { Error } from '../../domains.js';
2
- export type ConsoleError = (error: Error) => void;
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- export * from './compose-error/index.js';
2
- export * from './console-error/index.js';
@@ -1,2 +0,0 @@
1
- export * from './compose-error/index.js';
2
- export * from './console-error/index.js';
@@ -1,2 +0,0 @@
1
- import { ErrorWorkerType } from './type.js';
2
- export declare const ErrorWorker: ErrorWorkerType;
@@ -1,32 +0,0 @@
1
- import { composeError as composeErrorFunc } from '../utils/index.js';
2
- export const ErrorWorker = (props) => {
3
- let _error = props ? composeErrorFunc(props.message, props.info) : undefined;
4
- const _composeInfo = (info) => {
5
- if (_error) {
6
- _error.info = {
7
- ..._error.info,
8
- ...info,
9
- };
10
- return;
11
- }
12
- _error = composeErrorFunc(undefined, info);
13
- };
14
- const addErrorInfo = (info) => {
15
- _composeInfo(info);
16
- };
17
- const addErrorMessage = (message) => {
18
- _error = composeErrorFunc(message);
19
- };
20
- const composeError = (message, info) => composeErrorFunc(message, info ?? _error?.info);
21
- const getError = () => (_error ? { error: _error } : undefined);
22
- const resetError = () => {
23
- _error = undefined;
24
- };
25
- return {
26
- addErrorInfo,
27
- addErrorMessage,
28
- composeError,
29
- getError,
30
- resetError,
31
- };
32
- };
@@ -1,19 +0,0 @@
1
- import { Error } from '../domains.js';
2
- export type ErrorWorkerType = (props?: {
3
- message?: string;
4
- info?: Record<string, unknown>;
5
- }) => {
6
- addErrorInfo: AddErrorInfo;
7
- addErrorMessage: AddErrorMessage;
8
- composeError: ComposeError;
9
- getError: GetError;
10
- resetError: ResetError;
11
- };
12
- export type _ComposeInfo = (info?: Record<string, unknown>) => void;
13
- export type AddErrorInfo = (info: Record<string, unknown>) => void;
14
- export type AddErrorMessage = (message: string) => void;
15
- export type ComposeError = (message: string, info?: Record<string, unknown>) => Error;
16
- export type GetError = () => {
17
- error: Error;
18
- } | undefined;
19
- export type ResetError = () => void;
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- export * from './reveal-all-object-props/index.js';
2
- export * from './stringify/index.js';
@@ -1,2 +0,0 @@
1
- export * from './reveal-all-object-props/index.js';
2
- export * from './stringify/index.js';
@@ -1,2 +0,0 @@
1
- import { RevealAllObjectProps } from './type.js';
2
- export declare const revealAllObjectProps: RevealAllObjectProps;