@breautek/storm 9.3.0 → 9.4.0
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/search.js +1 -1
- package/docs/classes/Application.html +17 -17
- package/docs/classes/Command.html +90 -90
- 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 +21 -21
- package/docs/classes/DatabaseQueryError.html +6 -6
- package/docs/classes/DeadLockError.html +6 -6
- package/docs/classes/DiskSpaceError.html +5 -5
- package/docs/classes/DropTemporaryTableQuery.html +7 -7
- package/docs/classes/DuplicateEntryError.html +5 -5
- package/docs/classes/EntityNotFoundError.html +5 -5
- package/docs/classes/ExpiredTokenError.html +5 -5
- package/docs/classes/ForbiddenError.html +5 -5
- package/docs/classes/GetMySQLVersion.html +7 -7
- package/docs/classes/Handler.html +4 -2
- package/docs/classes/IllegalStateError.html +5 -5
- package/docs/classes/InternalError.html +5 -5
- package/docs/classes/InvalidCredentialsError.html +5 -5
- package/docs/classes/InvalidValueError.html +5 -5
- package/docs/classes/LineString.html +2 -2
- package/docs/classes/LockWaitTimeoutError.html +6 -6
- package/docs/classes/ManagedDatabaseConnection.html +5 -5
- package/docs/classes/MetricStore.html +2 -2
- package/docs/classes/Middleware.html +2 -2
- package/docs/classes/MissingConfigError.html +5 -5
- package/docs/classes/MissingParameterError.html +5 -5
- package/docs/classes/MySQLConnection.html +25 -25
- package/docs/classes/MySQLDatabase.html +2 -2
- package/docs/classes/NotImplementedError.html +5 -5
- 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 +5 -5
- package/docs/classes/RawQuery.html +7 -7
- package/docs/classes/Request.html +3 -3
- package/docs/classes/Response.html +2 -2
- package/docs/classes/ResponseData.html +3 -3
- 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 +5 -5
- package/docs/classes/TemporaryTableQuery.html +7 -7
- package/docs/classes/TimeoutError.html +5 -5
- package/docs/classes/Token.html +2 -2
- package/docs/classes/TokenManager.html +5 -2
- package/docs/classes/Transaction.html +2 -2
- package/docs/classes/UnauthorizedAccessError.html +5 -5
- 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/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 +3 -3
- package/docs/interfaces/IDatabaseConfig.html +2 -2
- package/docs/interfaces/IDatabaseConnection.html +5 -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/IGetMySQLVersionResult.html +2 -2
- package/docs/interfaces/IGetMySQLVersionRow.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/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 +1 -1
- package/docs/types/IDeleteQueryResult.html +1 -1
- package/docs/types/IStoredProcedureResult.html +1 -1
- package/docs/types/TCoordinate.html +1 -1
- package/docs/types/TExpiresIn.html +1 -1
- package/docs/types/TSerializableResponse.html +1 -1
- package/docs/types/TSupportedResponsePrimitives.html +1 -1
- package/docs/types/TSupportedResponseTypes.html +1 -1
- package/lib/DatabaseConnection.js +1 -1
- package/lib/Handler.d.ts +2 -0
- package/lib/Handler.js +18 -4
- package/lib/Handler.js.map +1 -1
- package/lib/Request.d.ts +6 -3
- package/lib/Request.js.map +1 -1
- package/lib/TokenManager.d.ts +13 -0
- package/lib/TokenManager.js +15 -0
- package/lib/TokenManager.js.map +1 -1
- package/package.json +5 -5
- package/src/DatabaseConnection.ts +1 -1
- package/src/Handler.ts +24 -4
- package/src/Request.ts +7 -3
- package/src/TokenManager.ts +16 -0
package/src/Request.ts
CHANGED
|
@@ -34,8 +34,12 @@ import { InternalError } from './InternalError';
|
|
|
34
34
|
import IncomingForm = require('formidable/Formidable');
|
|
35
35
|
import { IDatabasePosition } from './IDatabasePosition';
|
|
36
36
|
|
|
37
|
+
export interface IQueryParams {
|
|
38
|
+
[key: string]: undefined | string | IQueryParams | (string | IQueryParams)[];
|
|
39
|
+
}
|
|
40
|
+
|
|
37
41
|
export interface IParameterMap {
|
|
38
|
-
[key: string]: string;
|
|
42
|
+
[key: string]: string | string[];
|
|
39
43
|
}
|
|
40
44
|
|
|
41
45
|
export class Request<TBody = any, TAuthToken extends IAuthTokenData = IAuthTokenData> {
|
|
@@ -83,7 +87,7 @@ export class Request<TBody = any, TAuthToken extends IAuthTokenData = IAuthToken
|
|
|
83
87
|
}
|
|
84
88
|
}
|
|
85
89
|
|
|
86
|
-
public getQueryVariables():
|
|
90
|
+
public getQueryVariables(): IQueryParams {
|
|
87
91
|
return this.$request.query;
|
|
88
92
|
}
|
|
89
93
|
|
|
@@ -91,7 +95,7 @@ export class Request<TBody = any, TAuthToken extends IAuthTokenData = IAuthToken
|
|
|
91
95
|
return this.$request.params;
|
|
92
96
|
}
|
|
93
97
|
|
|
94
|
-
public getParam(name: string): string {
|
|
98
|
+
public getParam(name: string): string | string[] {
|
|
95
99
|
return this.$request.params[name];
|
|
96
100
|
}
|
|
97
101
|
|
package/src/TokenManager.ts
CHANGED
|
@@ -78,6 +78,22 @@ export class TokenManager<TAuthToken extends IAuthTokenData = IAuthTokenData> {
|
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Decodes the token. Use this method only on verified tokens as this does not verify against tampering
|
|
83
|
+
*
|
|
84
|
+
* @param token
|
|
85
|
+
* @returns
|
|
86
|
+
*/
|
|
87
|
+
public decodeSync(token: Token): TAuthToken {
|
|
88
|
+
return jwt.decode(token.getSignature()) as TAuthToken;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Decodes the token. Use this method only on verified tokens as this does not verify against tampering
|
|
93
|
+
*
|
|
94
|
+
* @param token
|
|
95
|
+
* @returns
|
|
96
|
+
*/
|
|
81
97
|
public decode(token: Token): Promise<TAuthToken> {
|
|
82
98
|
return new Promise<any>((resolve, reject) => {
|
|
83
99
|
try {
|