@breautek/storm 8.1.4 → 8.3.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 +13 -0
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/main.js +4 -4
- package/docs/assets/search.js +1 -1
- package/docs/assets/style.css +5 -4
- package/docs/classes/Application.html +144 -143
- package/docs/classes/BackendAuthenticationMiddleware.html +5 -5
- package/docs/classes/CORSMiddleware.html +10 -10
- package/docs/classes/ConfigLoader.html +5 -5
- package/docs/classes/Database.html +13 -13
- package/docs/classes/DatabaseCastObject.html +5 -5
- package/docs/classes/DatabaseConnection.html +41 -41
- package/docs/classes/DatabaseQueryError.html +22 -22
- package/docs/classes/DeadLockError.html +23 -23
- package/docs/classes/DiskSpaceError.html +22 -22
- package/docs/classes/DropTemporaryTableQuery.html +19 -13
- package/docs/classes/DuplicateEntryError.html +22 -22
- package/docs/classes/EntityNotFoundError.html +22 -22
- package/docs/classes/ExpiredTokenError.html +22 -22
- package/docs/classes/Handler.html +14 -14
- package/docs/classes/InternalError.html +22 -22
- package/docs/classes/InvalidCredentialsError.html +22 -22
- package/docs/classes/InvalidValueError.html +22 -22
- package/docs/classes/LineString.html +5 -5
- package/docs/classes/LockWaitTimeoutError.html +23 -23
- package/docs/classes/ManagedDatabaseConnection.html +22 -22
- package/docs/classes/Middleware.html +4 -4
- package/docs/classes/MissingConfigError.html +22 -22
- package/docs/classes/MissingParameterError.html +22 -22
- package/docs/classes/MySQLConnection.html +46 -46
- package/docs/classes/MySQLDatabase.html +14 -14
- package/docs/classes/NotImplementedError.html +22 -22
- package/docs/classes/Point.html +5 -5
- package/docs/classes/Polygon.html +5 -5
- package/docs/classes/Query.html +19 -13
- package/docs/classes/RawError.html +23 -23
- package/docs/classes/RawQuery.html +19 -13
- package/docs/classes/Request.html +19 -19
- package/docs/classes/Response.html +12 -12
- package/docs/classes/ResponseData.html +8 -8
- package/docs/classes/ServiceProvider.html +16 -16
- package/docs/classes/ServiceResponse.html +6 -6
- package/docs/classes/SetSessionVariableQuery.html +19 -13
- package/docs/classes/StormError.html +22 -22
- package/docs/classes/TemporaryTableQuery.html +19 -13
- package/docs/classes/TimeoutError.html +23 -23
- package/docs/classes/Token.html +3 -3
- package/docs/classes/TokenManager.html +5 -5
- package/docs/classes/Transaction.html +9 -8
- package/docs/classes/UnauthorizedAccessError.html +22 -22
- package/docs/enums/ErrorCode.html +10 -10
- package/docs/enums/ExitCode.html +3 -3
- package/docs/enums/HTTPMethod.html +5 -5
- package/docs/enums/IsolationLevel.html +5 -5
- package/docs/enums/JWTError.html +3 -3
- package/docs/enums/StatusCode.html +49 -49
- package/docs/functions/getInstance.html +2 -2
- package/docs/hierarchy.html +1 -1
- package/docs/index.html +1 -1
- package/docs/interfaces/IAdditionalErrorDetails.html +1 -1
- package/docs/interfaces/IAuthTokenData.html +4 -4
- package/docs/interfaces/ICloudwatchConfig.html +4 -4
- package/docs/interfaces/ICloudwatchCredentials.html +3 -3
- package/docs/interfaces/ICloudwatchStreamConfig.html +3 -3
- package/docs/interfaces/IConfig.html +10 -10
- package/docs/interfaces/IDatabaseConfig.html +7 -7
- package/docs/interfaces/IDatabaseConnection.html +17 -17
- package/docs/interfaces/IDatabasePosition.html +4 -4
- package/docs/interfaces/IErrorResponse.html +6 -6
- package/docs/interfaces/IFormData.html +3 -3
- package/docs/interfaces/IHandler.html +2 -2
- package/docs/interfaces/IInsertQueryResult.html +4 -4
- package/docs/interfaces/IJWTVerifyOptions.html +2 -2
- package/docs/interfaces/IOKPacket.html +10 -10
- package/docs/interfaces/IParameterMap.html +1 -1
- package/docs/interfaces/IQueryable.html +7 -6
- package/docs/interfaces/IRequestResponse.html +3 -3
- package/docs/interfaces/IServiceHeaders.html +1 -1
- package/docs/interfaces/ISetSessionVariableQueryInput.html +3 -3
- package/docs/interfaces/IStormCLIArgs.html +7 -7
- package/docs/interfaces/ITemporaryTableQueryInput.html +3 -3
- package/docs/interfaces/IUpdateQueryResult.html +3 -3
- package/docs/modules/formidable.html +1 -1
- package/docs/types/IDeleteQueryResult.html +1 -1
- package/docs/types/IHandlerError.html +2 -2
- package/docs/types/IHandlerResponse.html +2 -2
- package/docs/types/IStoredProcedureResult.html +3 -3
- package/docs/types/TCoordinate.html +1 -1
- package/docs/variables/formidable-1.html +1 -1
- package/lib/Application.d.ts +1 -0
- package/lib/Application.js +3 -0
- package/lib/Application.js.map +1 -1
- package/lib/DatabaseConnection.js +14 -2
- package/lib/DatabaseConnection.js.map +1 -1
- package/lib/IQueryable.d.ts +1 -0
- package/lib/Query.d.ts +13 -0
- package/lib/Query.js +15 -0
- package/lib/Query.js.map +1 -1
- package/lib/Transaction.d.ts +1 -0
- package/lib/Transaction.js +1 -0
- package/lib/Transaction.js.map +1 -1
- package/package.json +7 -7
- package/src/Application.ts +4 -0
- package/src/DatabaseConnection.ts +18 -2
- package/src/IQueryable.ts +1 -0
- package/src/Query.ts +16 -0
- package/src/Transaction.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@breautek/storm",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.3.0",
|
|
4
4
|
"description": "Object-Oriented REST API framework",
|
|
5
5
|
"main": "lib/api.js",
|
|
6
6
|
"types": "lib/api.d.ts",
|
|
@@ -51,17 +51,17 @@
|
|
|
51
51
|
"@types/formidable": "3.4.5",
|
|
52
52
|
"@types/jsonwebtoken": "9.0.7",
|
|
53
53
|
"@types/mysql": "2.15.26",
|
|
54
|
-
"@types/node": "22.
|
|
54
|
+
"@types/node": "22.13.4",
|
|
55
55
|
"@types/uuid": "10.0.0",
|
|
56
56
|
"ajv": "8.17.1",
|
|
57
57
|
"body-parser": "1.20.3",
|
|
58
58
|
"commander": "12.1.0",
|
|
59
59
|
"express": "4.21.2",
|
|
60
|
-
"form-data": "4.0.
|
|
60
|
+
"form-data": "4.0.2",
|
|
61
61
|
"formidable": "3.5.2",
|
|
62
62
|
"jsonwebtoken": "9.0.2",
|
|
63
63
|
"mysql": "2.18.1",
|
|
64
|
-
"sql-formatter": "15.4.
|
|
64
|
+
"sql-formatter": "15.4.10",
|
|
65
65
|
"tslib": "2.8.1",
|
|
66
66
|
"uuid": "11.0.3"
|
|
67
67
|
},
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@arashi/interfaces": "1.2.1",
|
|
74
|
-
"@arashi/logger": "4.
|
|
74
|
+
"@arashi/logger": "4.1.3",
|
|
75
75
|
"@totalpave/eslint-plugin": "6.3.2",
|
|
76
76
|
"@types/jest": "29.5.14",
|
|
77
77
|
"@typescript-eslint/eslint-plugin": "7.18.0",
|
|
@@ -82,8 +82,8 @@
|
|
|
82
82
|
"jest-jasmine2": "29.7.0",
|
|
83
83
|
"ts-jest": "29.2.5",
|
|
84
84
|
"ts-node": "10.9.2",
|
|
85
|
-
"typedoc": "0.27.
|
|
86
|
-
"typedoc-plugin-markdown": "4.
|
|
85
|
+
"typedoc": "0.27.7",
|
|
86
|
+
"typedoc-plugin-markdown": "4.4.2",
|
|
87
87
|
"typescript": "5.6.3"
|
|
88
88
|
}
|
|
89
89
|
}
|
package/src/Application.ts
CHANGED
|
@@ -290,6 +290,10 @@ export abstract class Application
|
|
|
290
290
|
return port;
|
|
291
291
|
}
|
|
292
292
|
|
|
293
|
+
public getVersion(): string {
|
|
294
|
+
return this._getVersion();
|
|
295
|
+
}
|
|
296
|
+
|
|
293
297
|
protected _getVersion(): string {
|
|
294
298
|
console.warn(TAG, `_getVersion will be an abstract method in the next major release. Override this method and pass a version string.`);
|
|
295
299
|
return '0.0.0';
|
|
@@ -138,8 +138,24 @@ export abstract class DatabaseConnection<TAPI> implements IDatabaseConnection {
|
|
|
138
138
|
let params: Record<string, any> = query.getParametersForQuery();
|
|
139
139
|
|
|
140
140
|
await query.onPreQuery(this);
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
|
|
142
|
+
let out: TQueryResult = null;
|
|
143
|
+
let e: unknown = null;
|
|
144
|
+
try {
|
|
145
|
+
let results: TQueryResult = await this._query<TQueryResult>(queryStr, params);
|
|
146
|
+
out = await (<any>query.onPostProcess(this, <any>results));
|
|
147
|
+
}
|
|
148
|
+
catch (ex) {
|
|
149
|
+
e = ex;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
await query.onPostQuery(this);
|
|
153
|
+
|
|
154
|
+
if (e !== null) {
|
|
155
|
+
throw e;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return out;
|
|
143
159
|
}
|
|
144
160
|
|
|
145
161
|
/**
|
package/src/IQueryable.ts
CHANGED
|
@@ -18,6 +18,7 @@ import { IDatabaseConnection } from './IDatabaseConnection';
|
|
|
18
18
|
|
|
19
19
|
export interface IQueryable<T> {
|
|
20
20
|
onPreQuery(connection: IDatabaseConnection): Promise<void>;
|
|
21
|
+
onPostQuery(connection: IDatabaseConnection): Promise<void>;
|
|
21
22
|
getQuery(connection: IDatabaseConnection): string;
|
|
22
23
|
execute(connection: IDatabaseConnection): Promise<T>;
|
|
23
24
|
getParametersForQuery(): Record<string, any>;
|
package/src/Query.ts
CHANGED
|
@@ -57,6 +57,22 @@ export abstract class Query<TQueryParameters = any, TQueryResultSet = any, TQuer
|
|
|
57
57
|
return Promise.resolve();
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
/**
|
|
61
|
+
* Overridable to execute statements after the main query.
|
|
62
|
+
* Can be used to clean up session variables or temporary tables, etc
|
|
63
|
+
*
|
|
64
|
+
* Unlike {@link onPostProcess}, this hook does not provide the result set,
|
|
65
|
+
* and will be invoked even if the main query produces an error.
|
|
66
|
+
*
|
|
67
|
+
* @since 8.3.0
|
|
68
|
+
*
|
|
69
|
+
* @param connection
|
|
70
|
+
* @returns {void}
|
|
71
|
+
*/
|
|
72
|
+
public onPostQuery(connection: IDatabaseConnection): Promise<void> {
|
|
73
|
+
return Promise.resolve();
|
|
74
|
+
}
|
|
75
|
+
|
|
60
76
|
/**
|
|
61
77
|
* Override to augment/manipulate the returned result set.
|
|
62
78
|
*
|
package/src/Transaction.ts
CHANGED
|
@@ -60,6 +60,7 @@ export class Transaction implements IQueryable<void> {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
public async onPreQuery(connection: IDatabaseConnection): Promise<void> {}
|
|
63
|
+
public async onPostQuery(connection: IDatabaseConnection): Promise<void> {}
|
|
63
64
|
|
|
64
65
|
public getQuery(connection: IDatabaseConnection): string {
|
|
65
66
|
return null;
|