@breautek/storm 6.1.0-beta.2 → 6.1.0-beta.4

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 (86) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/docs/assets/search.js +1 -1
  3. package/docs/classes/Application.html +19 -17
  4. package/docs/classes/BackendAuthenticationMiddleware.html +3 -3
  5. package/docs/classes/CORSMiddleware.html +3 -3
  6. package/docs/classes/ConfigLoader.html +3 -3
  7. package/docs/classes/Database.html +2 -2
  8. package/docs/classes/DatabaseCastObject.html +2 -2
  9. package/docs/classes/DatabaseConnection.html +19 -19
  10. package/docs/classes/DatabaseQueryError.html +5 -5
  11. package/docs/classes/DeadLockError.html +5 -5
  12. package/docs/classes/DiskSpaceError.html +5 -5
  13. package/docs/classes/DropTemporaryTableQuery.html +6 -6
  14. package/docs/classes/DuplicateEntryError.html +5 -5
  15. package/docs/classes/EntityNotFoundError.html +5 -5
  16. package/docs/classes/ExpiredTokenError.html +5 -5
  17. package/docs/classes/Handler.html +2 -2
  18. package/docs/classes/InternalError.html +5 -5
  19. package/docs/classes/InvalidCredentialsError.html +5 -5
  20. package/docs/classes/InvalidValueError.html +5 -5
  21. package/docs/classes/LineString.html +2 -2
  22. package/docs/classes/LockWaitTimeoutError.html +5 -5
  23. package/docs/classes/ManagedDatabaseConnection.html +2 -2
  24. package/docs/classes/Middleware.html +2 -2
  25. package/docs/classes/MissingConfigError.html +5 -5
  26. package/docs/classes/MissingParameterError.html +5 -5
  27. package/docs/classes/MySQLConnection.html +19 -19
  28. package/docs/classes/MySQLDatabase.html +2 -2
  29. package/docs/classes/NotImplementedError.html +5 -5
  30. package/docs/classes/Point.html +2 -2
  31. package/docs/classes/Polygon.html +2 -2
  32. package/docs/classes/Query.html +6 -6
  33. package/docs/classes/RawError.html +5 -5
  34. package/docs/classes/RawQuery.html +6 -6
  35. package/docs/classes/Request.html +2 -2
  36. package/docs/classes/Response.html +2 -2
  37. package/docs/classes/ResponseData.html +2 -2
  38. package/docs/classes/ServiceProvider.html +2 -2
  39. package/docs/classes/ServiceResponse.html +2 -2
  40. package/docs/classes/SetSessionVariableQuery.html +6 -6
  41. package/docs/classes/StormError.html +5 -5
  42. package/docs/classes/TemporaryTableQuery.html +6 -6
  43. package/docs/classes/Token.html +2 -2
  44. package/docs/classes/TokenManager.html +2 -2
  45. package/docs/classes/Transaction.html +2 -2
  46. package/docs/classes/UnauthorizedAccessError.html +5 -5
  47. package/docs/enums/ErrorCode.html +2 -2
  48. package/docs/enums/ExitCode.html +2 -2
  49. package/docs/enums/HTTPMethod.html +2 -2
  50. package/docs/enums/IsolationLevel.html +2 -2
  51. package/docs/enums/JWTError.html +2 -2
  52. package/docs/enums/StatusCode.html +2 -2
  53. package/docs/functions/getInstance.html +1 -1
  54. package/docs/interfaces/IAdditionalErrorDetails.html +1 -1
  55. package/docs/interfaces/ICloudwatchConfig.html +2 -2
  56. package/docs/interfaces/ICloudwatchCredentials.html +2 -2
  57. package/docs/interfaces/ICloudwatchStreamConfig.html +2 -2
  58. package/docs/interfaces/IConfig.html +3 -2
  59. package/docs/interfaces/IDatabaseConfig.html +2 -2
  60. package/docs/interfaces/IDatabaseConnection.html +2 -2
  61. package/docs/interfaces/IErrorResponse.html +2 -2
  62. package/docs/interfaces/IFormData.html +2 -2
  63. package/docs/interfaces/IHandler.html +2 -2
  64. package/docs/interfaces/IInsertQueryResult.html +2 -2
  65. package/docs/interfaces/IJWTVerifyOptions.html +2 -2
  66. package/docs/interfaces/IParameterMap.html +1 -1
  67. package/docs/interfaces/IQueryable.html +2 -2
  68. package/docs/interfaces/IRequestResponse.html +2 -2
  69. package/docs/interfaces/IServiceHeaders.html +1 -1
  70. package/docs/interfaces/ISetSessionVariableQueryInput.html +2 -2
  71. package/docs/interfaces/ITemporaryTableQueryInput.html +2 -2
  72. package/docs/interfaces/IUpdateQueryResult.html +2 -2
  73. package/docs/types/IDeleteQueryResult.html +1 -1
  74. package/docs/types/IHandlerError.html +1 -1
  75. package/docs/types/IHandlerResponse.html +1 -1
  76. package/docs/types/TCoordinate.html +1 -1
  77. package/lib/Application.d.ts +5 -0
  78. package/lib/Application.js +7 -0
  79. package/lib/Application.js.map +1 -1
  80. package/lib/ConfigLoader.js +6 -27
  81. package/lib/ConfigLoader.js.map +1 -1
  82. package/lib/IConfig.d.ts +1 -0
  83. package/package.json +1 -1
  84. package/src/Application.ts +8 -0
  85. package/src/ConfigLoader.ts +10 -41
  86. package/src/IConfig.ts +2 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@breautek/storm",
3
- "version": "6.1.0-beta.2",
3
+ "version": "6.1.0-beta.4",
4
4
  "description": "Object-Oriented REST API framework",
5
5
  "main": "lib/api.js",
6
6
  "types": "lib/api.d.ts",
@@ -317,6 +317,14 @@ export abstract class Application
317
317
  return this.$program;
318
318
  }
319
319
 
320
+ /**
321
+ * Override this method to map CLI args to customConfig
322
+ * @param args
323
+ */
324
+ public getConfigFromCLIArgs(args: any): Record<string, any> {
325
+ return {};
326
+ }
327
+
320
328
  /**
321
329
  * The maximum size limit for incoming requests that this service needs to handle.
322
330
  */
@@ -65,8 +65,17 @@ export class ConfigLoader<TConfig extends IConfig = IConfig> {
65
65
  }
66
66
 
67
67
  logger.trace(TAG, 'Reading command line arguments...');
68
+
69
+ // This pulls IConfig rules into the base config as expected
68
70
  config = MergeChange.merge(config, this.$getCmdLineArgs());
69
71
 
72
+ if (!config.customConfig) {
73
+ config.customConfig = {};
74
+ }
75
+
76
+ // This will pull all custom configurations into customConfig
77
+ config.customConfig = MergeChange.merge(config.customConfig, this.$app.getConfigFromCLIArgs(this.$app.getCmdLineArgs()));
78
+
70
79
  if (config.log.level === null) {
71
80
  config.log.level = defaults.log.level;
72
81
  }
@@ -87,46 +96,6 @@ export class ConfigLoader<TConfig extends IConfig = IConfig> {
87
96
  public static async load(path: string): Promise<IConfig> {
88
97
  let loader: ConfigLoader = new ConfigLoader<IConfig>(getInstance());
89
98
  return await loader.load(Path.resolve(path, 'bt-config.json'), Path.resolve('bt-local-config.json'));
90
-
91
- // let logger: Logger = ConfigLoader.$getLogger();
92
-
93
- // logger.trace(TAG, 'Configuration loaded.');
94
-
95
- // let config: IConfig = {};
96
-
97
- // let cPath: string = Path.resolve(path, 'bt-config.json');
98
- // let lPath: string = Path.resolve(path, 'bt-local-config.json');
99
-
100
- // let c: IConfig;
101
- // let l: IConfig;
102
- // let defaults: IConfig = this.$getDefaults();
103
-
104
- // logger.trace(TAG, `Main Config Path:\t ${cPath}`);
105
- // logger.trace(TAG, `Local Config Path:\t ${lPath}`);
106
-
107
- // c = this.$getMainConfig(cPath);
108
- // l = this.$getLocalConfig(lPath);
109
-
110
- // if (l) {
111
- // config = MergeChange.merge(defaults, c, l);
112
- // }
113
- // else {
114
- // config = MergeChange.merge(defaults, c);
115
- // }
116
-
117
- // logger.trace(TAG, 'Reading command line arguments...');
118
- // config = MergeChange.merge(config, ConfigLoader.$getCmdLineArgs());
119
-
120
- // if (config.log.level === null) {
121
- // config.log.level = defaults.log.level;
122
- // }
123
-
124
- // logger.trace(TAG, 'Configurations merged.');
125
- // logger.trace(TAG, config);
126
-
127
- // await ConfigLoader.$validateSchema(config);
128
-
129
- // return config;
130
99
  }
131
100
 
132
101
  private $getLocalConfig(path: string): IConfig {
@@ -162,7 +131,7 @@ export class ConfigLoader<TConfig extends IConfig = IConfig> {
162
131
  return require(Path.resolve(__dirname, '../bt-config-defaults.json'));
163
132
  }
164
133
 
165
- private async $validateSchema(config: IConfig): Promise<void> {
134
+ private async $validateSchema(config: Partial<TConfig>): Promise<void> {
166
135
  let ajv: Ajv = new Ajv({
167
136
  allErrors: true
168
137
  });
package/src/IConfig.ts CHANGED
@@ -57,6 +57,7 @@ export interface IConfig {
57
57
  replicationNodes?: IDatabaseConfig[];
58
58
  };
59
59
 
60
-
61
60
  request_size_limit?: number;
61
+
62
+ customConfig?: Record<string, any>;
62
63
  }