@breautek/storm 8.6.0 → 9.0.1

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 (160) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/docs/assets/hierarchy.js +1 -1
  3. package/docs/assets/navigation.js +1 -1
  4. package/docs/assets/search.js +1 -1
  5. package/docs/classes/Application.html +37 -38
  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 +24 -21
  10. package/docs/classes/DatabaseQueryError.html +30 -9
  11. package/docs/classes/DeadLockError.html +30 -9
  12. package/docs/classes/DiskSpaceError.html +29 -8
  13. package/docs/classes/DropTemporaryTableQuery.html +7 -7
  14. package/docs/classes/DuplicateEntryError.html +29 -8
  15. package/docs/classes/EntityNotFoundError.html +29 -8
  16. package/docs/classes/ExpiredTokenError.html +29 -8
  17. package/docs/classes/Handler.html +4 -4
  18. package/docs/classes/InternalError.html +29 -8
  19. package/docs/classes/InvalidCredentialsError.html +29 -8
  20. package/docs/classes/InvalidValueError.html +29 -8
  21. package/docs/classes/LineString.html +2 -2
  22. package/docs/classes/LockWaitTimeoutError.html +30 -9
  23. package/docs/classes/ManagedDatabaseConnection.html +8 -5
  24. package/docs/classes/Middleware.html +5 -4
  25. package/docs/classes/MissingConfigError.html +29 -8
  26. package/docs/classes/MissingParameterError.html +29 -8
  27. package/docs/classes/MySQLConnection.html +27 -22
  28. package/docs/classes/MySQLDatabase.html +2 -2
  29. package/docs/classes/NotImplementedError.html +29 -8
  30. package/docs/classes/Point.html +2 -2
  31. package/docs/classes/Polygon.html +2 -2
  32. package/docs/classes/Query.html +7 -7
  33. package/docs/classes/RawError.html +29 -8
  34. package/docs/classes/RawQuery.html +7 -7
  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 +7 -7
  41. package/docs/classes/StormError.html +29 -8
  42. package/docs/classes/TemporaryTableQuery.html +7 -7
  43. package/docs/classes/TimeoutError.html +29 -8
  44. package/docs/classes/Token.html +2 -2
  45. package/docs/classes/TokenManager.html +2 -2
  46. package/docs/classes/Transaction.html +2 -2
  47. package/docs/classes/UnauthorizedAccessError.html +29 -8
  48. package/docs/enums/ErrorCode.html +2 -2
  49. package/docs/enums/ExitCode.html +2 -2
  50. package/docs/enums/HTTPMethod.html +2 -2
  51. package/docs/enums/IsolationLevel.html +2 -2
  52. package/docs/enums/JWTError.html +2 -2
  53. package/docs/enums/StatusCode.html +2 -2
  54. package/docs/enums/TransactionAccessLevel.html +2 -2
  55. package/docs/functions/getInstance.html +1 -1
  56. package/docs/hierarchy.html +1 -1
  57. package/docs/index.html +1 -1
  58. package/docs/interfaces/IAdditionalErrorDetails.html +1 -1
  59. package/docs/interfaces/ICloudwatchConfig.html +2 -2
  60. package/docs/interfaces/ICloudwatchCredentials.html +2 -2
  61. package/docs/interfaces/ICloudwatchStreamConfig.html +2 -2
  62. package/docs/interfaces/IConfig.html +2 -2
  63. package/docs/interfaces/IDatabaseConfig.html +2 -2
  64. package/docs/interfaces/IDatabaseConnection.html +8 -5
  65. package/docs/interfaces/IDatabasePosition.html +2 -2
  66. package/docs/interfaces/IErrorResponse.html +2 -2
  67. package/docs/interfaces/IFormData.html +2 -2
  68. package/docs/interfaces/IInsertQueryResult.html +2 -2
  69. package/docs/interfaces/IJWTVerifyOptions.html +2 -2
  70. package/docs/interfaces/IOKPacket.html +2 -2
  71. package/docs/interfaces/IParameterMap.html +1 -1
  72. package/docs/interfaces/IQueryable.html +2 -2
  73. package/docs/interfaces/IRequestResponse.html +2 -2
  74. package/docs/interfaces/ISetSessionVariableQueryInput.html +2 -2
  75. package/docs/interfaces/IStormCLIArgs.html +2 -2
  76. package/docs/interfaces/IStormSendable.html +1 -0
  77. package/docs/interfaces/ITemporaryTableQueryInput.html +2 -2
  78. package/docs/interfaces/IUpdateQueryResult.html +2 -2
  79. package/docs/interfaces/formidable.FileJSON.html +1 -1
  80. package/docs/interfaces/formidable.Part.html +16 -16
  81. package/docs/types/IDeleteQueryResult.html +1 -1
  82. package/docs/types/IStoredProcedureResult.html +1 -1
  83. package/docs/types/SendableData.html +1 -0
  84. package/docs/types/TCoordinate.html +1 -1
  85. package/lib/Application.d.ts +2 -3
  86. package/lib/Application.js +22 -9
  87. package/lib/Application.js.map +1 -1
  88. package/lib/DatabaseConnection.d.ts +3 -0
  89. package/lib/DatabaseConnection.js.map +1 -1
  90. package/lib/Handler.d.ts +25 -28
  91. package/lib/Handler.js +18 -4
  92. package/lib/Handler.js.map +1 -1
  93. package/lib/IDatabaseConnection.d.ts +3 -0
  94. package/lib/IRequestResponse.d.ts +2 -2
  95. package/lib/IRequestResponse.js +1 -1
  96. package/lib/ManagedDatabaseConnection.d.ts +3 -0
  97. package/lib/ManagedDatabaseConnection.js +9 -0
  98. package/lib/ManagedDatabaseConnection.js.map +1 -1
  99. package/lib/Middleware.d.ts +8 -2
  100. package/lib/Middleware.js +9 -1
  101. package/lib/Middleware.js.map +1 -1
  102. package/lib/MySQLConnection.d.ts +12 -0
  103. package/lib/MySQLConnection.js +30 -1
  104. package/lib/MySQLConnection.js.map +1 -1
  105. package/lib/MySQLDatabase.js +8 -10
  106. package/lib/MySQLDatabase.js.map +1 -1
  107. package/lib/Response.d.ts +14 -5
  108. package/lib/Response.js +4 -3
  109. package/lib/Response.js.map +1 -1
  110. package/lib/ServiceProvider.d.ts +6 -6
  111. package/lib/ServiceProvider.js +8 -5
  112. package/lib/ServiceProvider.js.map +1 -1
  113. package/lib/TokenManager.d.ts +2 -1
  114. package/lib/TokenManager.js.map +1 -1
  115. package/lib/api.d.ts +2 -6
  116. package/lib/api.js +2 -6
  117. package/lib/api.js.map +1 -1
  118. package/lib/private/ConnectionReplicationWaiter.js +1 -1
  119. package/lib/private/ConnectionReplicationWaiter.js.map +1 -1
  120. package/lib/private/GetProcessList.d.ts +15 -0
  121. package/lib/private/GetProcessList.js +11 -0
  122. package/lib/private/GetProcessList.js.map +1 -0
  123. package/package.json +10 -9
  124. package/src/Application.ts +23 -10
  125. package/src/DatabaseConnection.ts +6 -0
  126. package/src/Handler.ts +41 -46
  127. package/src/IDatabaseConnection.ts +3 -0
  128. package/src/IRequestResponse.ts +3 -3
  129. package/src/ManagedDatabaseConnection.ts +12 -0
  130. package/src/Middleware.ts +14 -2
  131. package/src/MySQLConnection.ts +34 -1
  132. package/src/MySQLDatabase.ts +8 -10
  133. package/src/Response.ts +26 -7
  134. package/src/ServiceProvider.ts +17 -13
  135. package/src/TokenManager.ts +2 -1
  136. package/src/api.ts +2 -6
  137. package/src/private/ConnectionReplicationWaiter.ts +1 -1
  138. package/src/private/GetProcessList.ts +20 -0
  139. package/docs/classes/BackendAuthenticationMiddleware.html +0 -8
  140. package/docs/classes/CORSMiddleware.html +0 -14
  141. package/docs/interfaces/IHandler.html +0 -2
  142. package/docs/interfaces/IServiceHeaders.html +0 -1
  143. package/docs/types/IHandlerError.html +0 -5
  144. package/docs/types/IHandlerResponse.html +0 -11
  145. package/lib/BackendAuthenticationMiddleware.d.ts +0 -18
  146. package/lib/BackendAuthenticationMiddleware.js +0 -67
  147. package/lib/BackendAuthenticationMiddleware.js.map +0 -1
  148. package/lib/CORSMiddleware.d.ts +0 -28
  149. package/lib/CORSMiddleware.js +0 -81
  150. package/lib/CORSMiddleware.js.map +0 -1
  151. package/lib/IHandler.d.ts +0 -5
  152. package/lib/IHandler.js +0 -18
  153. package/lib/IHandler.js.map +0 -1
  154. package/lib/IServiceHeaders.d.ts +0 -3
  155. package/lib/IServiceHeaders.js +0 -18
  156. package/lib/IServiceHeaders.js.map +0 -1
  157. package/src/BackendAuthenticationMiddleware.ts +0 -75
  158. package/src/CORSMiddleware.ts +0 -90
  159. package/src/IHandler.ts +0 -22
  160. package/src/IServiceHeaders.ts +0 -19
@@ -1,90 +0,0 @@
1
- /*
2
- Copyright 2017-2021 Norman Breau
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- */
16
-
17
- import {Middleware} from './Middleware';
18
- import {Request} from './Request';
19
- import {Response} from './Response';
20
- import {IRequestResponse} from './IRequestResponse';
21
- import {getInstance} from './instance';
22
-
23
- /**
24
- * CORSMiddleware is used to enable CORS on APIs.
25
- * It will automatically add the necessary headers necessary to
26
- * communicate with CORS enabled clients.
27
- */
28
- export class CORSMiddleware extends Middleware {
29
- private $allowedOrigin: string;
30
- private $allowedHeaders: string[];
31
- private $allowedMethods: string[];
32
-
33
- /**
34
- * @constructor
35
- * @param allowedOrigin The allowed origin. By default it will use the request origin.
36
- * @param allowedHeaders Array of allowed headers.
37
- * @param allowedMethods Array of allowed HTTP methods.
38
- */
39
- public constructor(allowedOrigin?: string, allowedHeaders?: string[], allowedMethods?: string[]) {
40
- super();
41
-
42
- this.$allowedOrigin = (!allowedOrigin) ? this.getDefaultAllowedOrigin() : allowedOrigin;
43
- this.$allowedHeaders = (!allowedHeaders) ? this.getDefaultAllowedHeaders() : allowedHeaders;
44
- this.$allowedMethods = (!allowedMethods) ? this.getDefaultAllowedMethods() : allowedMethods;
45
- }
46
-
47
- /**
48
- * Sets the allowed origin. By default,
49
- */
50
- public getDefaultAllowedOrigin(): string {
51
- return null;
52
- }
53
-
54
- public getDefaultAllowedHeaders(): string[] {
55
- return [
56
- 'Accept',
57
- getInstance().getConfig().authentication_header,
58
- 'X-Requested-With',
59
- 'Content-Type',
60
- 'Access-Control-Allow-Origin'
61
- ];
62
- }
63
-
64
- public getDefaultAllowedMethods(): string[] {
65
- return [
66
- 'GET',
67
- 'POST',
68
- 'HEAD',
69
- 'OPTIONS',
70
- 'DELETE',
71
- 'PUT'
72
- ];
73
- }
74
-
75
- protected _execute(request: Request, response: Response): Promise<IRequestResponse> {
76
- if (this.$allowedOrigin) {
77
- response.setHeader('Access-Control-Allow-Origin', this.$allowedOrigin);
78
- }
79
- else {
80
- response.setHeader('Access-Control-Allow-Origin', request.getHeader('Origin'));
81
- }
82
- response.setHeader('Access-Control-Allow-Headers', this.$allowedHeaders.join(', '));
83
- response.setHeader('Access-Control-Allow-Methods', this.$allowedMethods.join(', '));
84
- response.setHeader('Vary', 'Origin');
85
- return Promise.resolve({
86
- request: request,
87
- response: response
88
- });
89
- }
90
- }
package/src/IHandler.ts DELETED
@@ -1,22 +0,0 @@
1
- /*
2
- Copyright 2017-2021 Norman Breau
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- */
16
-
17
- import {Application} from './Application';
18
- import {Handler} from './Handler';
19
-
20
- export interface IHandler<TApplication extends Application = Application> {
21
- new (app: TApplication): Handler;
22
- }
@@ -1,19 +0,0 @@
1
- /*
2
- Copyright 2017-2021 Norman Breau
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- */
16
-
17
- export interface IServiceHeaders {
18
- [key: string]: string;
19
- }