@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.
- package/CHANGELOG.md +14 -0
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/Application.html +37 -38
- package/docs/classes/ConfigLoader.html +3 -3
- package/docs/classes/Database.html +2 -2
- package/docs/classes/DatabaseCastObject.html +2 -2
- package/docs/classes/DatabaseConnection.html +24 -21
- package/docs/classes/DatabaseQueryError.html +30 -9
- package/docs/classes/DeadLockError.html +30 -9
- package/docs/classes/DiskSpaceError.html +29 -8
- package/docs/classes/DropTemporaryTableQuery.html +7 -7
- package/docs/classes/DuplicateEntryError.html +29 -8
- package/docs/classes/EntityNotFoundError.html +29 -8
- package/docs/classes/ExpiredTokenError.html +29 -8
- package/docs/classes/Handler.html +4 -4
- package/docs/classes/InternalError.html +29 -8
- package/docs/classes/InvalidCredentialsError.html +29 -8
- package/docs/classes/InvalidValueError.html +29 -8
- package/docs/classes/LineString.html +2 -2
- package/docs/classes/LockWaitTimeoutError.html +30 -9
- package/docs/classes/ManagedDatabaseConnection.html +8 -5
- package/docs/classes/Middleware.html +5 -4
- package/docs/classes/MissingConfigError.html +29 -8
- package/docs/classes/MissingParameterError.html +29 -8
- package/docs/classes/MySQLConnection.html +27 -22
- package/docs/classes/MySQLDatabase.html +2 -2
- package/docs/classes/NotImplementedError.html +29 -8
- package/docs/classes/Point.html +2 -2
- package/docs/classes/Polygon.html +2 -2
- package/docs/classes/Query.html +7 -7
- package/docs/classes/RawError.html +29 -8
- package/docs/classes/RawQuery.html +7 -7
- package/docs/classes/Request.html +2 -2
- package/docs/classes/Response.html +2 -2
- package/docs/classes/ResponseData.html +2 -2
- package/docs/classes/ServiceProvider.html +2 -2
- package/docs/classes/ServiceResponse.html +2 -2
- package/docs/classes/SetSessionVariableQuery.html +7 -7
- package/docs/classes/StormError.html +29 -8
- package/docs/classes/TemporaryTableQuery.html +7 -7
- package/docs/classes/TimeoutError.html +29 -8
- package/docs/classes/Token.html +2 -2
- package/docs/classes/TokenManager.html +2 -2
- package/docs/classes/Transaction.html +2 -2
- package/docs/classes/UnauthorizedAccessError.html +29 -8
- package/docs/enums/ErrorCode.html +2 -2
- package/docs/enums/ExitCode.html +2 -2
- package/docs/enums/HTTPMethod.html +2 -2
- package/docs/enums/IsolationLevel.html +2 -2
- package/docs/enums/JWTError.html +2 -2
- package/docs/enums/StatusCode.html +2 -2
- package/docs/enums/TransactionAccessLevel.html +2 -2
- package/docs/functions/getInstance.html +1 -1
- package/docs/hierarchy.html +1 -1
- package/docs/index.html +1 -1
- package/docs/interfaces/IAdditionalErrorDetails.html +1 -1
- package/docs/interfaces/ICloudwatchConfig.html +2 -2
- package/docs/interfaces/ICloudwatchCredentials.html +2 -2
- package/docs/interfaces/ICloudwatchStreamConfig.html +2 -2
- package/docs/interfaces/IConfig.html +2 -2
- package/docs/interfaces/IDatabaseConfig.html +2 -2
- package/docs/interfaces/IDatabaseConnection.html +8 -5
- package/docs/interfaces/IDatabasePosition.html +2 -2
- package/docs/interfaces/IErrorResponse.html +2 -2
- package/docs/interfaces/IFormData.html +2 -2
- package/docs/interfaces/IInsertQueryResult.html +2 -2
- package/docs/interfaces/IJWTVerifyOptions.html +2 -2
- package/docs/interfaces/IOKPacket.html +2 -2
- package/docs/interfaces/IParameterMap.html +1 -1
- package/docs/interfaces/IQueryable.html +2 -2
- package/docs/interfaces/IRequestResponse.html +2 -2
- package/docs/interfaces/ISetSessionVariableQueryInput.html +2 -2
- package/docs/interfaces/IStormCLIArgs.html +2 -2
- package/docs/interfaces/IStormSendable.html +1 -0
- package/docs/interfaces/ITemporaryTableQueryInput.html +2 -2
- package/docs/interfaces/IUpdateQueryResult.html +2 -2
- package/docs/interfaces/formidable.FileJSON.html +1 -1
- package/docs/interfaces/formidable.Part.html +16 -16
- package/docs/types/IDeleteQueryResult.html +1 -1
- package/docs/types/IStoredProcedureResult.html +1 -1
- package/docs/types/SendableData.html +1 -0
- package/docs/types/TCoordinate.html +1 -1
- package/lib/Application.d.ts +2 -3
- package/lib/Application.js +22 -9
- package/lib/Application.js.map +1 -1
- package/lib/DatabaseConnection.d.ts +3 -0
- package/lib/DatabaseConnection.js.map +1 -1
- package/lib/Handler.d.ts +25 -28
- package/lib/Handler.js +18 -4
- package/lib/Handler.js.map +1 -1
- package/lib/IDatabaseConnection.d.ts +3 -0
- package/lib/IRequestResponse.d.ts +2 -2
- package/lib/IRequestResponse.js +1 -1
- package/lib/ManagedDatabaseConnection.d.ts +3 -0
- package/lib/ManagedDatabaseConnection.js +9 -0
- package/lib/ManagedDatabaseConnection.js.map +1 -1
- package/lib/Middleware.d.ts +8 -2
- package/lib/Middleware.js +9 -1
- package/lib/Middleware.js.map +1 -1
- package/lib/MySQLConnection.d.ts +12 -0
- package/lib/MySQLConnection.js +30 -1
- package/lib/MySQLConnection.js.map +1 -1
- package/lib/MySQLDatabase.js +8 -10
- package/lib/MySQLDatabase.js.map +1 -1
- package/lib/Response.d.ts +14 -5
- package/lib/Response.js +4 -3
- package/lib/Response.js.map +1 -1
- package/lib/ServiceProvider.d.ts +6 -6
- package/lib/ServiceProvider.js +8 -5
- package/lib/ServiceProvider.js.map +1 -1
- package/lib/TokenManager.d.ts +2 -1
- package/lib/TokenManager.js.map +1 -1
- package/lib/api.d.ts +2 -6
- package/lib/api.js +2 -6
- package/lib/api.js.map +1 -1
- package/lib/private/ConnectionReplicationWaiter.js +1 -1
- package/lib/private/ConnectionReplicationWaiter.js.map +1 -1
- package/lib/private/GetProcessList.d.ts +15 -0
- package/lib/private/GetProcessList.js +11 -0
- package/lib/private/GetProcessList.js.map +1 -0
- package/package.json +10 -9
- package/src/Application.ts +23 -10
- package/src/DatabaseConnection.ts +6 -0
- package/src/Handler.ts +41 -46
- package/src/IDatabaseConnection.ts +3 -0
- package/src/IRequestResponse.ts +3 -3
- package/src/ManagedDatabaseConnection.ts +12 -0
- package/src/Middleware.ts +14 -2
- package/src/MySQLConnection.ts +34 -1
- package/src/MySQLDatabase.ts +8 -10
- package/src/Response.ts +26 -7
- package/src/ServiceProvider.ts +17 -13
- package/src/TokenManager.ts +2 -1
- package/src/api.ts +2 -6
- package/src/private/ConnectionReplicationWaiter.ts +1 -1
- package/src/private/GetProcessList.ts +20 -0
- package/docs/classes/BackendAuthenticationMiddleware.html +0 -8
- package/docs/classes/CORSMiddleware.html +0 -14
- package/docs/interfaces/IHandler.html +0 -2
- package/docs/interfaces/IServiceHeaders.html +0 -1
- package/docs/types/IHandlerError.html +0 -5
- package/docs/types/IHandlerResponse.html +0 -11
- package/lib/BackendAuthenticationMiddleware.d.ts +0 -18
- package/lib/BackendAuthenticationMiddleware.js +0 -67
- package/lib/BackendAuthenticationMiddleware.js.map +0 -1
- package/lib/CORSMiddleware.d.ts +0 -28
- package/lib/CORSMiddleware.js +0 -81
- package/lib/CORSMiddleware.js.map +0 -1
- package/lib/IHandler.d.ts +0 -5
- package/lib/IHandler.js +0 -18
- package/lib/IHandler.js.map +0 -1
- package/lib/IServiceHeaders.d.ts +0 -3
- package/lib/IServiceHeaders.js +0 -18
- package/lib/IServiceHeaders.js.map +0 -1
- package/src/BackendAuthenticationMiddleware.ts +0 -75
- package/src/CORSMiddleware.ts +0 -90
- package/src/IHandler.ts +0 -22
- package/src/IServiceHeaders.ts +0 -19
package/src/CORSMiddleware.ts
DELETED
|
@@ -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
|
-
}
|
package/src/IServiceHeaders.ts
DELETED
|
@@ -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
|
-
}
|