@nest-omni/core 1.0.44 → 1.0.46

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 (33) hide show
  1. package/common/utils.js +3 -4
  2. package/decorators/api-page-ok-response.decorator.js +1 -2
  3. package/decorators/auth-user.decorator.js +1 -2
  4. package/decorators/controller.decorator.js +1 -2
  5. package/decorators/field.decorators.js +37 -38
  6. package/decorators/http.decorators.js +1 -2
  7. package/decorators/property.decorators.js +6 -7
  8. package/decorators/swagger.schema.js +1 -2
  9. package/decorators/timestamp-column.decorator.js +1 -2
  10. package/decorators/transform.decorators.js +8 -9
  11. package/decorators/translate.decorator.js +3 -3
  12. package/decorators/use-dto.decorator.js +1 -2
  13. package/decorators/user-check.decorator.js +2 -2
  14. package/decorators/user.decorator.js +2 -2
  15. package/decorators/user_auth.decorator.js +1 -2
  16. package/decorators/validator.decorators.js +7 -8
  17. package/helpers/common.helper.js +3 -3
  18. package/helpers/date.helper.js +6 -7
  19. package/interceptors/language-interceptor.service.js +2 -2
  20. package/interfaces/IFile.d.ts +0 -1
  21. package/package.json +3 -3
  22. package/setup/bootstrap.setup.d.ts +1 -4
  23. package/setup/bootstrap.setup.js +1 -2
  24. package/shared/serviceRegistryModule.js +23 -6
  25. package/shared/services/api-config.service.js +1 -1
  26. package/tsconfig.tsbuildinfo +1 -1
  27. package/validator-json/decorators.js +2 -3
  28. package/validator-json/default.js +3 -3
  29. package/validators/is-exists.validator.js +2 -2
  30. package/validators/is-unique.validator.js +2 -2
  31. package/validators/phone-country-code.validator.js +1 -2
  32. package/validators/same-as.validator.js +1 -2
  33. package/validators/skip-empty.validator.js +1 -2
@@ -6,7 +6,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7
7
  };
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.UseLanguageInterceptor = exports.LanguageInterceptor = void 0;
9
+ exports.LanguageInterceptor = void 0;
10
+ exports.UseLanguageInterceptor = UseLanguageInterceptor;
10
11
  const common_1 = require("@nestjs/common");
11
12
  const constants_1 = require("../constants");
12
13
  const providers_1 = require("../providers");
@@ -26,4 +27,3 @@ exports.LanguageInterceptor = LanguageInterceptor = __decorate([
26
27
  function UseLanguageInterceptor() {
27
28
  return (0, common_1.UseInterceptors)(LanguageInterceptor);
28
29
  }
29
- exports.UseLanguageInterceptor = UseLanguageInterceptor;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  export interface IFile {
3
2
  encoding: string;
4
3
  buffer: Buffer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nest-omni/core",
3
- "version": "1.0.44",
3
+ "version": "1.0.46",
4
4
  "description": "framework",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -26,7 +26,7 @@
26
26
  "@nestjs/bull": "^10.0.1",
27
27
  "@nestjs/cache-manager": "^2.1.0",
28
28
  "@nestjs/common": "10.2.5",
29
- "@nestjs/config": "^3.1.1",
29
+ "@nestjs/config": "^4.0.0",
30
30
  "@nestjs/core": "10.2.5",
31
31
  "@nestjs/microservices": "^10.2.5",
32
32
  "@nestjs/platform-express": "^10.2.5",
@@ -52,7 +52,7 @@
52
52
  "moment": "^2.29.4",
53
53
  "mysql2": "^3.6.1",
54
54
  "nestjs-cls": "^4.3.0",
55
- "nestjs-i18n": "^10.3.2",
55
+ "nestjs-i18n": "^10.5.0",
56
56
  "nestjs-pino": "^3.4.0",
57
57
  "pino-http": "^8.5.0",
58
58
  "pino-pretty": "^10.2.0",
@@ -1,5 +1,2 @@
1
- /// <reference types="node" />
2
- /// <reference types="node/http" />
3
- /// <reference types="pino-http" />
4
1
  import type { NestExpressApplication } from '@nestjs/platform-express';
5
- export declare function bootstrapSetup(AppModule: any, SetupSwagger: any): Promise<NestExpressApplication<import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>>>;
2
+ export declare function bootstrapSetup(AppModule: any, SetupSwagger: any): Promise<NestExpressApplication<import("http").Server>>;
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.bootstrapSetup = void 0;
12
+ exports.bootstrapSetup = bootstrapSetup;
13
13
  const core_1 = require("@nestjs/core");
14
14
  const typeorm_transactional_1 = require("typeorm-transactional");
15
15
  const skywalking_backend_js_1 = require("skywalking-backend-js");
@@ -111,4 +111,3 @@ function bootstrapSetup(AppModule, SetupSwagger) {
111
111
  return app;
112
112
  });
113
113
  }
114
- exports.bootstrapSetup = bootstrapSetup;
@@ -32,21 +32,38 @@ const nestjs_i18n_1 = require("nestjs-i18n");
32
32
  const health_checker_module_1 = require("../health-checker/health-checker.module");
33
33
  const services_1 = require("./services");
34
34
  const fs_1 = require("fs");
35
+ const path_1 = require("path");
35
36
  const providers = [
36
37
  services_1.ApiConfigService,
37
38
  services_1.ValidatorService,
38
39
  services_1.GeneratorService,
39
40
  services_1.TranslationService,
40
41
  ];
42
+ const isTest = process.env.NODE_ENV === 'test';
41
43
  function findValidRootPath() {
42
44
  const possibleRootPaths = [process.cwd(), __dirname];
43
45
  const envFile = `${process.env.NODE_ENV || ''}.env`;
46
+ let envFilePath = '';
44
47
  for (const rootPath of possibleRootPaths) {
45
- const configPath = path.join(rootPath, 'config');
46
- const baseEnvFilePath = path.join(configPath, 'base.env');
47
- const envFilePath = path.join(configPath, envFile);
48
- if ((0, fs_1.existsSync)(envFilePath)) {
49
- return { rootPath, baseEnvFilePath, envFilePath };
48
+ const configPath = (0, path_1.join)(rootPath, 'config');
49
+ const baseEnvFilePath = (0, path_1.join)(configPath, 'base.env');
50
+ if (isTest) {
51
+ envFilePath = (0, path_1.join)(configPath, 'test.env');
52
+ if ((0, fs_1.existsSync)(envFilePath)) {
53
+ return { rootPath, baseEnvFilePath, envFilePath };
54
+ }
55
+ else {
56
+ envFilePath = (0, path_1.join)(configPath, 'dev.env');
57
+ if ((0, fs_1.existsSync)(envFilePath)) {
58
+ return { rootPath, baseEnvFilePath, envFilePath };
59
+ }
60
+ }
61
+ }
62
+ else {
63
+ envFilePath = (0, path_1.join)(configPath, envFile);
64
+ if ((0, fs_1.existsSync)(envFilePath)) {
65
+ return { rootPath, baseEnvFilePath, envFilePath };
66
+ }
50
67
  }
51
68
  }
52
69
  throw new Error(`No valid .env file: ${envFilePath}`);
@@ -57,7 +74,7 @@ const modules = [
57
74
  config_1.ConfigModule.forRoot({
58
75
  isGlobal: true,
59
76
  cache: true,
60
- expandVariables: true,
77
+ expandVariables: false,
61
78
  envFilePath: [envFilePath, baseEnvFilePath],
62
79
  }),
63
80
  nestjs_sentry_1.SentryModule.forRootAsync({
@@ -104,7 +104,7 @@ let ApiConfigService = ApiConfigService_1 = class ApiConfigService {
104
104
  return {
105
105
  autoLoadEntities: true,
106
106
  keepConnectionAlive: !this.isDev,
107
- dropSchema: this.isTest,
107
+ dropSchema: this.isTest ? this.getBoolean('DB_DROP_SCHEMA') : false,
108
108
  type: 'mysql',
109
109
  host: this.getString('DB_HOST'),
110
110
  port: this.getNumber('DB_PORT'),