@breautek/storm 4.1.0 → 4.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 +14 -1
- package/docs/README.md +6 -4
- package/docs/classes/Application.md +26 -26
- package/docs/classes/BackendAuthenticationMiddleware.md +2 -2
- package/docs/classes/CORSMiddleware.md +6 -6
- package/docs/classes/ConfigLoader.md +1 -1
- package/docs/classes/Database.md +12 -12
- package/docs/classes/DatabaseConnection.md +19 -19
- package/docs/classes/DatabaseQueryError.md +46 -8
- package/docs/classes/DiskSpaceError.md +46 -8
- package/docs/classes/DropTemporaryTableQuery.md +14 -8
- package/docs/classes/DumpStream.md +1 -1
- package/docs/classes/DuplicateEntryError.md +46 -8
- package/docs/classes/EntityNotFoundError.md +46 -8
- package/docs/classes/ExpiredTokenError.md +46 -8
- package/docs/classes/Handler.md +22 -22
- package/docs/classes/InternalError.md +46 -8
- package/docs/classes/InvalidCredentialsError.md +46 -8
- package/docs/classes/InvalidValueError.md +46 -8
- package/docs/classes/ManagedDatabaseConnection.md +19 -19
- package/docs/classes/Middleware.md +3 -3
- package/docs/classes/MissingConfigError.md +46 -8
- package/docs/classes/MissingParameterError.md +46 -8
- package/docs/classes/MySQLConnection.md +20 -20
- package/docs/classes/MySQLDatabase.md +13 -13
- package/docs/classes/NotImplementedError.md +339 -0
- package/docs/classes/Query.md +14 -8
- package/docs/classes/RawError.md +351 -0
- package/docs/classes/RawQuery.md +14 -8
- package/docs/classes/Request.md +18 -18
- package/docs/classes/Response.md +11 -11
- package/docs/classes/ResponseData.md +7 -7
- package/docs/classes/ServiceProvider.md +15 -15
- package/docs/classes/ServiceResponse.md +4 -4
- package/docs/classes/SetSessionVariableQuery.md +14 -8
- package/docs/classes/StormError.md +42 -8
- package/docs/classes/TemporaryTableQuery.md +14 -8
- package/docs/classes/Token.md +2 -2
- package/docs/classes/TokenManager.md +4 -4
- package/docs/classes/UnauthorizedAccessError.md +46 -8
- package/docs/enums/ErrorCode.md +9 -9
- package/docs/enums/ExitCode.md +2 -2
- package/docs/enums/HTTPMethod.md +4 -4
- package/docs/enums/JWTError.md +2 -2
- package/docs/enums/StatusCode.md +48 -48
- package/docs/interfaces/IConfig.md +8 -8
- package/docs/interfaces/IDatabaseConfig.md +6 -6
- package/docs/interfaces/IDatabaseConnection.md +14 -14
- package/docs/interfaces/IErrorResponse.md +15 -4
- package/docs/interfaces/IFormData.md +2 -2
- package/docs/interfaces/IHandler.md +1 -1
- package/docs/interfaces/IInsertQueryResult.md +3 -3
- package/docs/interfaces/IJWTVerifyOptions.md +1 -1
- package/docs/interfaces/IRequestResponse.md +2 -2
- package/docs/interfaces/ISetSessionVariableQueryInput.md +2 -2
- package/docs/interfaces/ITemporaryTableQueryInput.md +2 -2
- package/docs/interfaces/IUpdateQueryResult.md +2 -2
- package/lib/Application.d.ts +58 -0
- package/lib/Application.js +73 -0
- package/lib/Application.js.map +1 -1
- package/lib/ApplicationEvent.js +15 -0
- package/lib/ApplicationEvent.js.map +1 -1
- package/lib/BackendAuthenticationMiddleware.d.ts +12 -0
- package/lib/BackendAuthenticationMiddleware.js +28 -0
- package/lib/BackendAuthenticationMiddleware.js.map +1 -1
- package/lib/CORSMiddleware.d.ts +14 -0
- package/lib/CORSMiddleware.js +29 -0
- package/lib/CORSMiddleware.js.map +1 -1
- package/lib/ConfigLoader.js +16 -0
- package/lib/ConfigLoader.js.map +1 -1
- package/lib/Database.js +15 -0
- package/lib/Database.js.map +1 -1
- package/lib/DatabaseConnection.d.ts +115 -0
- package/lib/DatabaseConnection.js +71 -0
- package/lib/DatabaseConnection.js.map +1 -1
- package/lib/DatabaseQueryError.d.ts +1 -0
- package/lib/DatabaseQueryError.js +19 -0
- package/lib/DatabaseQueryError.js.map +1 -1
- package/lib/DiskSpaceError.d.ts +1 -0
- package/lib/DiskSpaceError.js +18 -0
- package/lib/DiskSpaceError.js.map +1 -1
- package/lib/DropTemporaryTableQuery.js +15 -0
- package/lib/DropTemporaryTableQuery.js.map +1 -1
- package/lib/DumpStream.js +16 -0
- package/lib/DumpStream.js.map +1 -1
- package/lib/DuplicateEntryError.d.ts +2 -0
- package/lib/DuplicateEntryError.js +26 -0
- package/lib/DuplicateEntryError.js.map +1 -1
- package/lib/EntityNotFoundError.d.ts +2 -0
- package/lib/EntityNotFoundError.js +23 -0
- package/lib/EntityNotFoundError.js.map +1 -1
- package/lib/ErrorCode.js +15 -0
- package/lib/ErrorCode.js.map +1 -1
- package/lib/ExitCode.js +15 -0
- package/lib/ExitCode.js.map +1 -1
- package/lib/ExpiredTokenError.d.ts +1 -0
- package/lib/ExpiredTokenError.js +19 -0
- package/lib/ExpiredTokenError.js.map +1 -1
- package/lib/HTTPMethod.js +15 -0
- package/lib/HTTPMethod.js.map +1 -1
- package/lib/Handler.d.ts +22 -4
- package/lib/Handler.js +22 -6
- package/lib/Handler.js.map +1 -1
- package/lib/IAuthTokenData.js +15 -0
- package/lib/IAuthTokenData.js.map +1 -1
- package/lib/IConfig.js +15 -0
- package/lib/IConfig.js.map +1 -1
- package/lib/IDatabaseConfig.js +15 -0
- package/lib/IDatabaseConfig.js.map +1 -1
- package/lib/IDatabaseConnection.js +15 -0
- package/lib/IDatabaseConnection.js.map +1 -1
- package/lib/IDeleteQueryResult.js +15 -0
- package/lib/IDeleteQueryResult.js.map +1 -1
- package/lib/IFormData.js +15 -0
- package/lib/IFormData.js.map +1 -1
- package/lib/IHandler.js +15 -0
- package/lib/IHandler.js.map +1 -1
- package/lib/IInsertQueryResult.js +15 -0
- package/lib/IInsertQueryResult.js.map +1 -1
- package/lib/IJWTVerifyOptions.js +15 -0
- package/lib/IJWTVerifyOptions.js.map +1 -1
- package/lib/IRequestResponse.js +15 -0
- package/lib/IRequestResponse.js.map +1 -1
- package/lib/IServiceHeaders.js +15 -0
- package/lib/IServiceHeaders.js.map +1 -1
- package/lib/IUpdateQueryResult.js +15 -0
- package/lib/IUpdateQueryResult.js.map +1 -1
- package/lib/InternalError.d.ts +1 -0
- package/lib/InternalError.js +19 -0
- package/lib/InternalError.js.map +1 -1
- package/lib/InvalidConfigError.js +15 -0
- package/lib/InvalidConfigError.js.map +1 -1
- package/lib/InvalidCredentialsError.d.ts +1 -0
- package/lib/InvalidCredentialsError.js +19 -0
- package/lib/InvalidCredentialsError.js.map +1 -1
- package/lib/InvalidValueError.d.ts +2 -0
- package/lib/InvalidValueError.js +27 -0
- package/lib/InvalidValueError.js.map +1 -1
- package/lib/JWTError.js +15 -0
- package/lib/JWTError.js.map +1 -1
- package/lib/JWTVerifyOptionsParser.js +16 -0
- package/lib/JWTVerifyOptionsParser.js.map +1 -1
- package/lib/ManagedDatabaseConnection.d.ts +5 -0
- package/lib/ManagedDatabaseConnection.js +26 -0
- package/lib/ManagedDatabaseConnection.js.map +1 -1
- package/lib/Middleware.js +16 -0
- package/lib/Middleware.js.map +1 -1
- package/lib/MissingConfigError.d.ts +2 -0
- package/lib/MissingConfigError.js +23 -0
- package/lib/MissingConfigError.js.map +1 -1
- package/lib/MissingParameterError.d.ts +2 -0
- package/lib/MissingParameterError.js +23 -0
- package/lib/MissingParameterError.js.map +1 -1
- package/lib/MySQLConnection.js +24 -1
- package/lib/MySQLConnection.js.map +1 -1
- package/lib/MySQLDatabase.js +18 -0
- package/lib/MySQLDatabase.js.map +1 -1
- package/lib/NotImplementedError.d.ts +16 -0
- package/lib/NotImplementedError.js +48 -0
- package/lib/NotImplementedError.js.map +1 -0
- package/lib/Query.d.ts +21 -0
- package/lib/Query.js +37 -0
- package/lib/Query.js.map +1 -1
- package/lib/RawError.d.ts +14 -0
- package/lib/RawError.js +40 -0
- package/lib/RawError.js.map +1 -0
- package/lib/RawQuery.js +15 -0
- package/lib/RawQuery.js.map +1 -1
- package/lib/Request.js +15 -0
- package/lib/Request.js.map +1 -1
- package/lib/Response.js +17 -0
- package/lib/Response.js.map +1 -1
- package/lib/ResponseData.js +15 -0
- package/lib/ResponseData.js.map +1 -1
- package/lib/ServiceProvider.js +20 -0
- package/lib/ServiceProvider.js.map +1 -1
- package/lib/ServiceResponse.js +15 -0
- package/lib/ServiceResponse.js.map +1 -1
- package/lib/SetSessionVariableQuery.js +1 -0
- package/lib/SetSessionVariableQuery.js.map +1 -1
- package/lib/StatusCode.js +15 -0
- package/lib/StatusCode.js.map +1 -1
- package/lib/StormError.d.ts +14 -0
- package/lib/StormError.js +32 -0
- package/lib/StormError.js.map +1 -1
- package/lib/TemporaryTableQuery.js +15 -0
- package/lib/TemporaryTableQuery.js.map +1 -1
- package/lib/Token.js +15 -0
- package/lib/Token.js.map +1 -1
- package/lib/TokenManager.js +17 -0
- package/lib/TokenManager.js.map +1 -1
- package/lib/UnauthorizedAccessError.d.ts +1 -0
- package/lib/UnauthorizedAccessError.js +18 -0
- package/lib/UnauthorizedAccessError.js.map +1 -1
- package/lib/api.d.ts +2 -0
- package/lib/api.js +28 -1
- package/lib/api.js.map +1 -1
- package/lib/instance.js +15 -0
- package/lib/instance.js.map +1 -1
- package/lib/private/CommitQuery.js +15 -0
- package/lib/private/CommitQuery.js.map +1 -1
- package/lib/private/RollbackQuery.js +15 -0
- package/lib/private/RollbackQuery.js.map +1 -1
- package/lib/private/StartTransactionQuery.js +15 -0
- package/lib/private/StartTransactionQuery.js.map +1 -1
- package/package.json +1 -1
- package/src/DatabaseQueryError.ts +4 -0
- package/src/DiskSpaceError.ts +4 -0
- package/src/DuplicateEntryError.ts +13 -0
- package/src/EntityNotFoundError.ts +10 -0
- package/src/ExpiredTokenError.ts +4 -0
- package/src/Handler.ts +10 -9
- package/src/InternalError.ts +4 -0
- package/src/InvalidCredentialsError.ts +4 -0
- package/src/InvalidValueError.ts +13 -0
- package/src/MissingConfigError.ts +10 -0
- package/src/MissingParameterError.ts +10 -0
- package/src/NotImplementedError.ts +55 -0
- package/src/Query.ts +8 -0
- package/src/RawError.ts +39 -0
- package/src/StormError.ts +18 -0
- package/src/UnauthorizedAccessError.ts +4 -0
- package/src/api.ts +2 -0
- package/tsconfig.json +0 -1
package/lib/Token.js
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright 2017-2021 Norman Breau
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
|
16
|
+
*/
|
|
2
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
18
|
exports.Token = void 0;
|
|
4
19
|
class Token {
|
package/lib/Token.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Token.js","sourceRoot":"","sources":["../src/Token.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"Token.js","sourceRoot":"","sources":["../src/Token.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;EAcE;;;AAEF,MAAa,KAAK;IAGd,YAAY,SAAiB;QACzB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAChC,CAAC;IAEM,YAAY;QACf,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;CACJ;AAVD,sBAUC"}
|
package/lib/TokenManager.js
CHANGED
|
@@ -1,10 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright 2017-2021 Norman Breau
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
|
16
|
+
*/
|
|
2
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
18
|
exports.TokenManager = void 0;
|
|
4
19
|
const jwt = require("jsonwebtoken");
|
|
5
20
|
const Token_1 = require("./Token");
|
|
6
21
|
const JWTVerifyOptionsParser_1 = require("./JWTVerifyOptionsParser");
|
|
7
22
|
const crypto_1 = require("crypto");
|
|
23
|
+
// const TAG: string = 'TokenManager';
|
|
8
24
|
class TokenManager {
|
|
9
25
|
constructor(secret) {
|
|
10
26
|
this.$secret = secret;
|
|
@@ -30,6 +46,7 @@ class TokenManager {
|
|
|
30
46
|
}
|
|
31
47
|
verify(token, options) {
|
|
32
48
|
return new Promise((resolve, reject) => {
|
|
49
|
+
// placed inside the promise in the event that a reject would be required.
|
|
33
50
|
if (!options) {
|
|
34
51
|
options = {
|
|
35
52
|
enableExpiration: true
|
package/lib/TokenManager.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TokenManager.js","sourceRoot":"","sources":["../src/TokenManager.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"TokenManager.js","sourceRoot":"","sources":["../src/TokenManager.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;EAcE;;;AAEF,oCAAoC;AACpC,mCAA8B;AAE9B,qEAAgE;AAChE,mCAAmC;AAGnC,sCAAsC;AAEtC,MAAa,YAAY;IAGrB,YAAmB,MAAc;QAC7B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IAC1B,CAAC;IAEM,IAAI,CAAC,OAA6B,EAAE,SAA0B;QACjE,OAAO,IAAI,OAAO,CAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC1C,IAAA,oBAAW,EAAC,EAAE,EAAE,CAAC,GAAU,EAAE,MAAc,EAAE,EAAE;gBAC3C,IAAI,GAAG,EAAE;oBACL,MAAM,CAAC,GAAG,CAAC,CAAC;oBACZ,OAAO;iBACV;gBAED,OAAO,CAAC,UAAU,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;gBAE5C,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE;oBAC5B,SAAS,EAAG,SAAS;iBACxB,EAAE,CAAC,KAAY,EAAE,KAAa,EAAE,EAAE;oBAC/B,IAAI,KAAK,EAAE;wBACP,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;qBACxB;oBAED,OAAO,OAAO,CAAC,IAAI,aAAK,CAAC,KAAK,CAAC,CAAC,CAAC;gBACrC,CAAC,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;IAEM,MAAM,CAAC,KAAY,EAAE,OAA2B;QACnD,OAAO,IAAI,OAAO,CAAM,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACxC,0EAA0E;YAC1E,IAAI,CAAC,OAAO,EAAE;gBACV,OAAO,GAAG;oBACN,gBAAgB,EAAE,IAAI;iBACzB,CAAC;aACL;iBACI,IAAI,OAAO,CAAC,gBAAgB,KAAK,SAAS,EAAE;gBAC7C,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;aACnC;YAED,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,+CAAsB,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAmB,EAAE,EAAE;gBACjH,IAAI,KAAK,EAAE;oBACP,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;iBACxB;gBAED,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC;YAC5B,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;IAEM,MAAM,CAAC,KAAY;QACtB,OAAO,IAAI,OAAO,CAAM,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACxC,IAAI;gBACA,IAAI,OAAO,GAA2B,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC,CAAC;gBACvE,OAAO,CAAC,OAAO,CAAC,CAAC;aACpB;YACD,OAAO,EAAE,EAAE;gBACP,MAAM,CAAC,EAAE,CAAC,CAAC;aACd;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AA/DD,oCA+DC"}
|
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright 2017-2021 Norman Breau
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
|
16
|
+
*/
|
|
2
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
18
|
exports.UnauthorizedAccessError = void 0;
|
|
4
19
|
const StormError_1 = require("./StormError");
|
|
@@ -17,6 +32,9 @@ class UnauthorizedAccessError extends StormError_1.StormError {
|
|
|
17
32
|
getHTTPCode() {
|
|
18
33
|
return StatusCode_1.StatusCode.ERR_FORBIDDEN;
|
|
19
34
|
}
|
|
35
|
+
getLocaleCode() {
|
|
36
|
+
return '@breautek/storm/UnauthorizedAccessError/message';
|
|
37
|
+
}
|
|
20
38
|
}
|
|
21
39
|
exports.UnauthorizedAccessError = UnauthorizedAccessError;
|
|
22
40
|
//# sourceMappingURL=UnauthorizedAccessError.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnauthorizedAccessError.js","sourceRoot":"","sources":["../src/UnauthorizedAccessError.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"UnauthorizedAccessError.js","sourceRoot":"","sources":["../src/UnauthorizedAccessError.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;EAcE;;;AAEF,6CAAwC;AACxC,2CAAsC;AACtC,6CAAwC;AAExC,MAAa,uBAAwB,SAAQ,uBAAU;IACnD,YAAmB,SAAiB;QAChC,KAAK,CAAC,SAAS,CAAC,CAAC;IACrB,CAAC;IAEM,UAAU;QACb,OAAO,gBAAgB,CAAC;IAC5B,CAAC;IAEM,OAAO;QACV,OAAO,qBAAS,CAAC,mBAAmB,CAAC;IACzC,CAAC;IAEM,WAAW;QACd,OAAO,uBAAU,CAAC,aAAa,CAAC;IACpC,CAAC;IAEe,aAAa;QACzB,OAAO,iDAAiD,CAAC;IAC7D,CAAC;CACJ;AApBD,0DAoBC"}
|
package/lib/api.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export { IDeleteQueryResult } from './IDeleteQueryResult';
|
|
|
15
15
|
export { IUpdateQueryResult } from './IUpdateQueryResult';
|
|
16
16
|
export { SetSessionVariableQuery, ISetSessionVariableQueryInput } from './SetSessionVariableQuery';
|
|
17
17
|
export { ErrorCode } from './ErrorCode';
|
|
18
|
+
export { RawError } from './RawError';
|
|
18
19
|
export { StormError, IErrorResponse, IAdditionalErrorDetails } from './StormError';
|
|
19
20
|
export { JWTError } from './JWTError';
|
|
20
21
|
export { MissingParameterError } from './MissingParameterError';
|
|
@@ -28,6 +29,7 @@ export { DiskSpaceError } from './DiskSpaceError';
|
|
|
28
29
|
export { DuplicateEntryError } from './DuplicateEntryError';
|
|
29
30
|
export { MissingConfigError } from './MissingConfigError';
|
|
30
31
|
export { DatabaseQueryError } from './DatabaseQueryError';
|
|
32
|
+
export { NotImplementedError } from './NotImplementedError';
|
|
31
33
|
export { StatusCode } from './StatusCode';
|
|
32
34
|
export { Middleware } from './Middleware';
|
|
33
35
|
export { Request, IParameterMap } from './Request';
|
package/lib/api.js
CHANGED
|
@@ -1,12 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright 2017-2021 Norman Breau
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
|
16
|
+
*/
|
|
2
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.formidable = exports.DumpStream = exports.ExitCode = exports.TokenManager = exports.Token = exports.BackendAuthenticationMiddleware = exports.ServiceResponse = exports.HTTPMethod = exports.ServiceProvider = exports.CORSMiddleware = exports.Handler = exports.ResponseData = exports.Response = exports.Request = exports.Middleware = exports.StatusCode = exports.DatabaseQueryError = exports.MissingConfigError = exports.DuplicateEntryError = exports.DiskSpaceError = exports.EntityNotFoundError = exports.UnauthorizedAccessError = exports.InvalidValueError = exports.ExpiredTokenError = exports.InternalError = exports.InvalidCredentialsError = exports.MissingParameterError = exports.JWTError = exports.StormError = exports.ErrorCode = exports.SetSessionVariableQuery = exports.RawQuery = exports.DropTemporaryTableQuery = exports.TemporaryTableQuery = exports.Query = exports.ManagedDatabaseConnection = exports.MySQLConnection = exports.MySQLDatabase = exports.DatabaseConnection = exports.Database = exports.ConfigLoader = exports.Application = exports.getInstance = void 0;
|
|
18
|
+
exports.formidable = exports.DumpStream = exports.ExitCode = exports.TokenManager = exports.Token = exports.BackendAuthenticationMiddleware = exports.ServiceResponse = exports.HTTPMethod = exports.ServiceProvider = exports.CORSMiddleware = exports.Handler = exports.ResponseData = exports.Response = exports.Request = exports.Middleware = exports.StatusCode = exports.NotImplementedError = exports.DatabaseQueryError = exports.MissingConfigError = exports.DuplicateEntryError = exports.DiskSpaceError = exports.EntityNotFoundError = exports.UnauthorizedAccessError = exports.InvalidValueError = exports.ExpiredTokenError = exports.InternalError = exports.InvalidCredentialsError = exports.MissingParameterError = exports.JWTError = exports.StormError = exports.RawError = exports.ErrorCode = exports.SetSessionVariableQuery = exports.RawQuery = exports.DropTemporaryTableQuery = exports.TemporaryTableQuery = exports.Query = exports.ManagedDatabaseConnection = exports.MySQLConnection = exports.MySQLDatabase = exports.DatabaseConnection = exports.Database = exports.ConfigLoader = exports.Application = exports.getInstance = void 0;
|
|
19
|
+
// Application
|
|
4
20
|
var instance_1 = require("./instance");
|
|
5
21
|
Object.defineProperty(exports, "getInstance", { enumerable: true, get: function () { return instance_1.getInstance; } });
|
|
6
22
|
var Application_1 = require("./Application");
|
|
7
23
|
Object.defineProperty(exports, "Application", { enumerable: true, get: function () { return Application_1.Application; } });
|
|
24
|
+
// Config
|
|
8
25
|
var ConfigLoader_1 = require("./ConfigLoader");
|
|
9
26
|
Object.defineProperty(exports, "ConfigLoader", { enumerable: true, get: function () { return ConfigLoader_1.ConfigLoader; } });
|
|
27
|
+
// Database
|
|
10
28
|
var Database_1 = require("./Database");
|
|
11
29
|
Object.defineProperty(exports, "Database", { enumerable: true, get: function () { return Database_1.Database; } });
|
|
12
30
|
var DatabaseConnection_1 = require("./DatabaseConnection");
|
|
@@ -27,8 +45,11 @@ var RawQuery_1 = require("./RawQuery");
|
|
|
27
45
|
Object.defineProperty(exports, "RawQuery", { enumerable: true, get: function () { return RawQuery_1.RawQuery; } });
|
|
28
46
|
var SetSessionVariableQuery_1 = require("./SetSessionVariableQuery");
|
|
29
47
|
Object.defineProperty(exports, "SetSessionVariableQuery", { enumerable: true, get: function () { return SetSessionVariableQuery_1.SetSessionVariableQuery; } });
|
|
48
|
+
// Errors
|
|
30
49
|
var ErrorCode_1 = require("./ErrorCode");
|
|
31
50
|
Object.defineProperty(exports, "ErrorCode", { enumerable: true, get: function () { return ErrorCode_1.ErrorCode; } });
|
|
51
|
+
var RawError_1 = require("./RawError");
|
|
52
|
+
Object.defineProperty(exports, "RawError", { enumerable: true, get: function () { return RawError_1.RawError; } });
|
|
32
53
|
var StormError_1 = require("./StormError");
|
|
33
54
|
Object.defineProperty(exports, "StormError", { enumerable: true, get: function () { return StormError_1.StormError; } });
|
|
34
55
|
var JWTError_1 = require("./JWTError");
|
|
@@ -55,6 +76,9 @@ var MissingConfigError_1 = require("./MissingConfigError");
|
|
|
55
76
|
Object.defineProperty(exports, "MissingConfigError", { enumerable: true, get: function () { return MissingConfigError_1.MissingConfigError; } });
|
|
56
77
|
var DatabaseQueryError_1 = require("./DatabaseQueryError");
|
|
57
78
|
Object.defineProperty(exports, "DatabaseQueryError", { enumerable: true, get: function () { return DatabaseQueryError_1.DatabaseQueryError; } });
|
|
79
|
+
var NotImplementedError_1 = require("./NotImplementedError");
|
|
80
|
+
Object.defineProperty(exports, "NotImplementedError", { enumerable: true, get: function () { return NotImplementedError_1.NotImplementedError; } });
|
|
81
|
+
// HTTP
|
|
58
82
|
var StatusCode_1 = require("./StatusCode");
|
|
59
83
|
Object.defineProperty(exports, "StatusCode", { enumerable: true, get: function () { return StatusCode_1.StatusCode; } });
|
|
60
84
|
var Middleware_1 = require("./Middleware");
|
|
@@ -77,14 +101,17 @@ var ServiceResponse_1 = require("./ServiceResponse");
|
|
|
77
101
|
Object.defineProperty(exports, "ServiceResponse", { enumerable: true, get: function () { return ServiceResponse_1.ServiceResponse; } });
|
|
78
102
|
var BackendAuthenticationMiddleware_1 = require("./BackendAuthenticationMiddleware");
|
|
79
103
|
Object.defineProperty(exports, "BackendAuthenticationMiddleware", { enumerable: true, get: function () { return BackendAuthenticationMiddleware_1.BackendAuthenticationMiddleware; } });
|
|
104
|
+
// Token
|
|
80
105
|
var Token_1 = require("./Token");
|
|
81
106
|
Object.defineProperty(exports, "Token", { enumerable: true, get: function () { return Token_1.Token; } });
|
|
82
107
|
var TokenManager_1 = require("./TokenManager");
|
|
83
108
|
Object.defineProperty(exports, "TokenManager", { enumerable: true, get: function () { return TokenManager_1.TokenManager; } });
|
|
109
|
+
// Utils
|
|
84
110
|
var ExitCode_1 = require("./ExitCode");
|
|
85
111
|
Object.defineProperty(exports, "ExitCode", { enumerable: true, get: function () { return ExitCode_1.ExitCode; } });
|
|
86
112
|
var DumpStream_1 = require("./DumpStream");
|
|
87
113
|
Object.defineProperty(exports, "DumpStream", { enumerable: true, get: function () { return DumpStream_1.DumpStream; } });
|
|
114
|
+
// Third-party
|
|
88
115
|
const formidable = require("formidable");
|
|
89
116
|
exports.formidable = formidable;
|
|
90
117
|
//# sourceMappingURL=api.js.map
|
package/lib/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;EAcE;;;AAEF,cAAc;AACd,uCAAuC;AAA/B,uGAAA,WAAW,OAAA;AACnB,6CAA0C;AAAlC,0GAAA,WAAW,OAAA;AAEnB,SAAS;AACT,+CAA4C;AAApC,4GAAA,YAAY,OAAA;AAEpB,WAAW;AACX,uCAAoC;AAA5B,oGAAA,QAAQ,OAAA;AAChB,2DAAwD;AAAhD,wHAAA,kBAAkB,OAAA;AAC1B,iDAA8C;AAAtC,8GAAA,aAAa,OAAA;AACrB,qDAAkD;AAA1C,kHAAA,eAAe,OAAA;AACvB,yEAAsE;AAA9D,sIAAA,yBAAyB,OAAA;AACjC,iCAA8B;AAAtB,8FAAA,KAAK,OAAA;AACb,6DAAqF;AAA7E,0HAAA,mBAAmB,OAAA;AAC3B,qEAAkE;AAA1D,kIAAA,uBAAuB,OAAA;AAC/B,uCAAoC;AAA5B,oGAAA,QAAQ,OAAA;AAIhB,qEAAiG;AAAzF,kIAAA,uBAAuB,OAAA;AAE/B,SAAS;AACT,yCAAsC;AAA9B,sGAAA,SAAS,OAAA;AACjB,uCAAoC;AAA5B,oGAAA,QAAQ,OAAA;AAChB,2CAIsB;AAHlB,wGAAA,UAAU,OAAA;AAId,uCAAoC;AAA5B,oGAAA,QAAQ,OAAA;AAChB,iEAA8D;AAAtD,8HAAA,qBAAqB,OAAA;AAC7B,qEAAkE;AAA1D,kIAAA,uBAAuB,OAAA;AAC/B,iDAA8C;AAAtC,8GAAA,aAAa,OAAA;AACrB,yDAAsD;AAA9C,sHAAA,iBAAiB,OAAA;AACzB,yDAAsD;AAA9C,sHAAA,iBAAiB,OAAA;AACzB,qEAAkE;AAA1D,kIAAA,uBAAuB,OAAA;AAC/B,6DAA0D;AAAlD,0HAAA,mBAAmB,OAAA;AAC3B,mDAAgD;AAAxC,gHAAA,cAAc,OAAA;AACtB,6DAA0D;AAAlD,0HAAA,mBAAmB,OAAA;AAC3B,2DAAwD;AAAhD,wHAAA,kBAAkB,OAAA;AAC1B,2DAAwD;AAAhD,wHAAA,kBAAkB,OAAA;AAC1B,6DAA0D;AAAlD,0HAAA,mBAAmB,OAAA;AAE3B,OAAO;AACP,2CAAwC;AAAhC,wGAAA,UAAU,OAAA;AAClB,2CAAwC;AAAhC,wGAAA,UAAU,OAAA;AAClB,qCAAiD;AAAzC,kGAAA,OAAO,OAAA;AACf,uCAAoC;AAA5B,oGAAA,QAAQ,OAAA;AAChB,+CAA4C;AAApC,4GAAA,YAAY,OAAA;AACpB,qCAAmE;AAA3D,kGAAA,OAAO,OAAA;AACf,mDAAgD;AAAxC,gHAAA,cAAc,OAAA;AACtB,qDAAkD;AAA1C,kHAAA,eAAe,OAAA;AACvB,2CAAwC;AAAhC,wGAAA,UAAU,OAAA;AAClB,qDAAkD;AAA1C,kHAAA,eAAe,OAAA;AACvB,qFAAkF;AAA1E,kJAAA,+BAA+B,OAAA;AAavC,QAAQ;AACR,iCAA8B;AAAtB,8FAAA,KAAK,OAAA;AACb,+CAA4C;AAApC,4GAAA,YAAY,OAAA;AAEpB,QAAQ;AACR,uCAAoC;AAA5B,oGAAA,QAAQ,OAAA;AAChB,2CAAwC;AAAhC,wGAAA,UAAU,OAAA;AAElB,cAAc;AACd,yCAAyC;AACjC,gCAAU"}
|
package/lib/instance.js
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright 2017-2021 Norman Breau
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
|
16
|
+
*/
|
|
2
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
18
|
exports.getInstance = exports.setInstance = void 0;
|
|
4
19
|
let instance;
|
package/lib/instance.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instance.js","sourceRoot":"","sources":["../src/instance.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"instance.js","sourceRoot":"","sources":["../src/instance.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;EAcE;;;AAIF,IAAI,QAAqB,CAAC;AAE1B,IAAI,WAAW,GAAG,CAAC,GAAgB,EAAQ,EAAE;IACzC,IAAI,QAAQ,EAAE;QACV,QAAQ,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,qBAAqB,EAAE,uCAAuC,CAAC,CAAC;KAC7F;IACD,QAAQ,GAAG,GAAG,CAAC;AACnB,CAAC,CAAC;AAOE,kCAAW;AALf,IAAI,WAAW,GAAG,GAAgB,EAAE;IAChC,OAAO,QAAQ,CAAC;AACpB,CAAC,CAAC;AAIE,kCAAW"}
|
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright 2017-2021 Norman Breau
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
|
16
|
+
*/
|
|
2
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
18
|
exports.CommitQuery = void 0;
|
|
4
19
|
const Query_1 = require("../Query");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommitQuery.js","sourceRoot":"","sources":["../../src/private/CommitQuery.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"CommitQuery.js","sourceRoot":"","sources":["../../src/private/CommitQuery.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;EAcE;;;AAEF,oCAA+B;AAE/B,MAAa,WAAY,SAAQ,aAAiB;IACpC,SAAS;QACf,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ;AAJD,kCAIC"}
|
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright 2017-2021 Norman Breau
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
|
16
|
+
*/
|
|
2
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
18
|
exports.RollbackQuery = void 0;
|
|
4
19
|
const Query_1 = require("../Query");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RollbackQuery.js","sourceRoot":"","sources":["../../src/private/RollbackQuery.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"RollbackQuery.js","sourceRoot":"","sources":["../../src/private/RollbackQuery.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;EAcE;;;AAEF,oCAA+B;AAE/B,MAAa,aAAc,SAAQ,aAAiB;IACtC,SAAS;QACf,OAAO,UAAU,CAAC;IACtB,CAAC;CACJ;AAJD,sCAIC"}
|
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright 2017-2021 Norman Breau
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
|
16
|
+
*/
|
|
2
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
18
|
exports.StartTransactionQuery = void 0;
|
|
4
19
|
const Query_1 = require("../Query");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StartTransactionQuery.js","sourceRoot":"","sources":["../../src/private/StartTransactionQuery.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"StartTransactionQuery.js","sourceRoot":"","sources":["../../src/private/StartTransactionQuery.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;EAcE;;;AAEF,oCAA+B;AAE/B,MAAa,qBAAsB,SAAQ,aAAiB;IAC9C,SAAS;QACf,OAAO,mBAAmB,CAAC;IAC/B,CAAC;CACJ;AAJD,sDAIC"}
|
package/package.json
CHANGED
package/src/DiskSpaceError.ts
CHANGED
|
@@ -45,4 +45,17 @@ export class DuplicateEntryError extends StormError {
|
|
|
45
45
|
public getHTTPCode(): StatusCode {
|
|
46
46
|
return StatusCode.ERR_BAD_REQUEST;
|
|
47
47
|
}
|
|
48
|
+
|
|
49
|
+
public override getLocaleCode(): string {
|
|
50
|
+
return '@breautek/storm/DuplicateEntryError/message';
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
public override getLocaleParameters(): Record<string, string> {
|
|
54
|
+
let details: IDuplicateEntryErrorOptions = this.getPrivateDetails();
|
|
55
|
+
return {
|
|
56
|
+
entity: details.entity,
|
|
57
|
+
property: details.property,
|
|
58
|
+
name: details.name
|
|
59
|
+
};
|
|
60
|
+
}
|
|
48
61
|
}
|
|
@@ -34,4 +34,14 @@ export class EntityNotFoundError extends StormError {
|
|
|
34
34
|
public getHTTPCode(): StatusCode {
|
|
35
35
|
return StatusCode.ERR_NOT_FOUND;
|
|
36
36
|
}
|
|
37
|
+
|
|
38
|
+
public override getLocaleCode(): string {
|
|
39
|
+
return '@breautek/storm/EntityNotFoundError/message';
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
public override getLocaleParameters(): Record<string, string> {
|
|
43
|
+
return {
|
|
44
|
+
name: this.getPrivateDetails().name
|
|
45
|
+
};
|
|
46
|
+
}
|
|
37
47
|
}
|
package/src/ExpiredTokenError.ts
CHANGED
package/src/Handler.ts
CHANGED
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {StatusCode} from './StatusCode';
|
|
18
17
|
import {Application} from './Application';
|
|
19
18
|
import {getInstance} from './instance';
|
|
20
19
|
import {Request} from './Request';
|
|
@@ -27,6 +26,8 @@ import { IRequestResponse } from './IRequestResponse';
|
|
|
27
26
|
import { Logger } from '@arashi/logger';
|
|
28
27
|
import { ResponseData } from './ResponseData';
|
|
29
28
|
import { ReadStream } from 'fs';
|
|
29
|
+
import { NotImplementedError } from './NotImplementedError';
|
|
30
|
+
import { HTTPMethod } from './HTTPMethod';
|
|
30
31
|
// import { Stream } from 'stream';
|
|
31
32
|
|
|
32
33
|
const TAG: string = 'Handler';
|
|
@@ -199,19 +200,19 @@ export class Handler<
|
|
|
199
200
|
}
|
|
200
201
|
}
|
|
201
202
|
|
|
202
|
-
protected async _get(request: Request<TGetRequest>): Promise<TGetResponse
|
|
203
|
-
|
|
203
|
+
protected async _get(request: Request<TGetRequest>): Promise<TGetResponse> {
|
|
204
|
+
throw new NotImplementedError(HTTPMethod.GET);
|
|
204
205
|
}
|
|
205
206
|
|
|
206
|
-
protected async _post(request: Request<TPostRequest>): Promise<TPostResponse
|
|
207
|
-
|
|
207
|
+
protected async _post(request: Request<TPostRequest>): Promise<TPostResponse> {
|
|
208
|
+
throw new NotImplementedError(HTTPMethod.POST);
|
|
208
209
|
}
|
|
209
210
|
|
|
210
|
-
protected async _put(request: Request<TPutRequest>): Promise<TPutResponse
|
|
211
|
-
|
|
211
|
+
protected async _put(request: Request<TPutRequest>): Promise<TPutResponse> {
|
|
212
|
+
throw new NotImplementedError(HTTPMethod.PUT);
|
|
212
213
|
}
|
|
213
214
|
|
|
214
|
-
protected async _delete(request: Request<TDeleteRequest>): Promise<TDeleteResponse
|
|
215
|
-
|
|
215
|
+
protected async _delete(request: Request<TDeleteRequest>): Promise<TDeleteResponse> {
|
|
216
|
+
throw new NotImplementedError(HTTPMethod.DELETE);
|
|
216
217
|
}
|
|
217
218
|
}
|
package/src/InternalError.ts
CHANGED
|
@@ -35,4 +35,8 @@ export class InvalidCredentialsError extends StormError<any> {
|
|
|
35
35
|
public getHTTPCode(): StatusCode {
|
|
36
36
|
return StatusCode.ERR_UNAUTHORIZED;
|
|
37
37
|
}
|
|
38
|
+
|
|
39
|
+
public override getLocaleCode(): string {
|
|
40
|
+
return '@breautek/storm/InvalidCredentialsError/message';
|
|
41
|
+
}
|
|
38
42
|
}
|
package/src/InvalidValueError.ts
CHANGED
|
@@ -44,4 +44,17 @@ export class InvalidValueError extends StormError<{
|
|
|
44
44
|
public getHTTPCode(): StatusCode {
|
|
45
45
|
return StatusCode.ERR_BAD_REQUEST;
|
|
46
46
|
}
|
|
47
|
+
|
|
48
|
+
public override getLocaleCode(): string {
|
|
49
|
+
return '@breautek/storm/InvalidValueError/message';
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
public override getLocaleParameters(): Record<string, string> {
|
|
53
|
+
let details = this.getPrivateDetails();
|
|
54
|
+
return {
|
|
55
|
+
variable: details.variable,
|
|
56
|
+
expected: details.expected,
|
|
57
|
+
got: details.got
|
|
58
|
+
};
|
|
59
|
+
}
|
|
47
60
|
}
|
|
@@ -45,4 +45,14 @@ export class MissingConfigError extends StormError<IMissingConfigErrorDetails> {
|
|
|
45
45
|
public getExitCode(): ExitCode {
|
|
46
46
|
return ExitCode.MISSING_CONFIG;
|
|
47
47
|
}
|
|
48
|
+
|
|
49
|
+
public override getLocaleCode(): string {
|
|
50
|
+
return '@breautek/storm/MissingConfigError/message';
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
public override getLocaleParameters(): Record<string, string> {
|
|
54
|
+
return {
|
|
55
|
+
path: this.getPrivateDetails().path
|
|
56
|
+
};
|
|
57
|
+
}
|
|
48
58
|
}
|
|
@@ -34,4 +34,14 @@ export class MissingParameterError extends StormError {
|
|
|
34
34
|
public getHTTPCode(): StatusCode {
|
|
35
35
|
return StatusCode.ERR_BAD_REQUEST;
|
|
36
36
|
}
|
|
37
|
+
|
|
38
|
+
public override getLocaleCode(): string {
|
|
39
|
+
return '@breautek/storm/MissingParameterError/message';
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
public override getLocaleParameters(): Record<string, string> {
|
|
43
|
+
return {
|
|
44
|
+
parameter: this.getPrivateDetails().parameter
|
|
45
|
+
};
|
|
46
|
+
}
|
|
37
47
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
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 {StormError} from './StormError';
|
|
18
|
+
import {ErrorCode} from './ErrorCode';
|
|
19
|
+
import {StatusCode} from './StatusCode';
|
|
20
|
+
import {HTTPMethod} from './HTTPMethod';
|
|
21
|
+
|
|
22
|
+
interface INotImplementedErrorOptions {
|
|
23
|
+
method: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export class NotImplementedError extends StormError<INotImplementedErrorOptions> {
|
|
27
|
+
public constructor(method: HTTPMethod) {
|
|
28
|
+
super({
|
|
29
|
+
method
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
public getMessage(): string {
|
|
34
|
+
let details: INotImplementedErrorOptions = this.getPrivateDetails();
|
|
35
|
+
return `Handler does not implement "${details.method}".`;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
public getCode(): ErrorCode {
|
|
39
|
+
return ErrorCode.INTERNAL;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
public getHTTPCode(): StatusCode {
|
|
43
|
+
return StatusCode.INTERNAL_NOT_IMPLEMENTED;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public override getLocaleCode(): string {
|
|
47
|
+
return '@breautek/storm/NotImplementedError/message';
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public override getLocaleParameters(): Record<string, string> {
|
|
51
|
+
return {
|
|
52
|
+
method: this.getPrivateDetails().method
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}
|
package/src/Query.ts
CHANGED
|
@@ -23,10 +23,18 @@ export abstract class Query<TQueryParameters = any, TQueryResultSet = any, TQuer
|
|
|
23
23
|
this.$params = parameters;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* @returns parameters that was passed into the constructor.
|
|
28
|
+
*/
|
|
26
29
|
public getParameters(): TQueryParameters {
|
|
27
30
|
return this.$params;
|
|
28
31
|
}
|
|
29
32
|
|
|
33
|
+
/**
|
|
34
|
+
* Query implementations may override this API to augment the parameters.
|
|
35
|
+
*
|
|
36
|
+
* @returns parameters that will be used when this query is ran.
|
|
37
|
+
*/
|
|
30
38
|
public getParametersForQuery(): Record<any, any> {
|
|
31
39
|
return this.$params;
|
|
32
40
|
}
|
package/src/RawError.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2017-2022 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 { StormError } from './StormError';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A concrete error that accepts any arbitrary message string and optionally a code.
|
|
21
|
+
* It's not recommended to use this class as it will be hard to differentiate errors by
|
|
22
|
+
* tag name.
|
|
23
|
+
*/
|
|
24
|
+
export class RawError extends StormError<{message: string, code?: number}> {
|
|
25
|
+
public constructor(message: string, code?: number) {
|
|
26
|
+
super({
|
|
27
|
+
message,
|
|
28
|
+
code: code || 0
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public getCode(): number {
|
|
33
|
+
return this.getPrivateDetails().code;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public getMessage(): string {
|
|
37
|
+
return this.getPrivateDetails().message;
|
|
38
|
+
}
|
|
39
|
+
}
|