@breautek/storm 4.1.0 → 4.2.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 +8 -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 +8 -8
- package/docs/classes/DiskSpaceError.md +8 -8
- package/docs/classes/DropTemporaryTableQuery.md +14 -8
- package/docs/classes/DumpStream.md +1 -1
- package/docs/classes/DuplicateEntryError.md +8 -8
- package/docs/classes/EntityNotFoundError.md +8 -8
- package/docs/classes/ExpiredTokenError.md +8 -8
- package/docs/classes/Handler.md +22 -22
- package/docs/classes/InternalError.md +8 -8
- package/docs/classes/InvalidCredentialsError.md +8 -8
- package/docs/classes/InvalidValueError.md +8 -8
- package/docs/classes/ManagedDatabaseConnection.md +19 -19
- package/docs/classes/Middleware.md +3 -3
- package/docs/classes/MissingConfigError.md +8 -8
- package/docs/classes/MissingParameterError.md +8 -8
- package/docs/classes/MySQLConnection.md +20 -20
- package/docs/classes/MySQLDatabase.md +13 -13
- package/docs/classes/NotImplementedError.md +301 -0
- package/docs/classes/Query.md +14 -8
- package/docs/classes/RawError.md +313 -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 +12 -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 +8 -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 +4 -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.js +16 -0
- package/lib/DatabaseQueryError.js.map +1 -1
- package/lib/DiskSpaceError.js +15 -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.js +15 -0
- package/lib/DuplicateEntryError.js.map +1 -1
- package/lib/EntityNotFoundError.js +15 -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.js +16 -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.js +16 -0
- package/lib/InternalError.js.map +1 -1
- package/lib/InvalidConfigError.js +15 -0
- package/lib/InvalidConfigError.js.map +1 -1
- package/lib/InvalidCredentialsError.js +16 -0
- package/lib/InvalidCredentialsError.js.map +1 -1
- package/lib/InvalidValueError.js +16 -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.js +15 -0
- package/lib/MissingConfigError.js.map +1 -1
- package/lib/MissingParameterError.js +15 -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 +14 -0
- package/lib/NotImplementedError.js +40 -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 +7 -0
- package/lib/StormError.js +22 -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.js +15 -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/Handler.ts +10 -9
- package/src/NotImplementedError.ts +45 -0
- package/src/Query.ts +8 -0
- package/src/RawError.ts +39 -0
- package/src/api.ts +2 -0
- package/tsconfig.json +0 -1
|
@@ -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.ManagedDatabaseConnection = void 0;
|
|
4
19
|
const instance_1 = require("./instance");
|
|
@@ -9,9 +24,17 @@ class ManagedDatabaseConnection {
|
|
|
9
24
|
this.$requiresWrite = requiresWrite;
|
|
10
25
|
this.$instantionStack = new Error().stack;
|
|
11
26
|
}
|
|
27
|
+
// TODO(Breaking): Turn this API into async
|
|
12
28
|
setConnection(connection) {
|
|
13
29
|
if (this.$connection) {
|
|
30
|
+
// Store original connection because of async,
|
|
31
|
+
// but we don't really need to wait for the async operations
|
|
32
|
+
// to complete to set the new connection object.
|
|
14
33
|
let oldConnection = this.$connection;
|
|
34
|
+
/**
|
|
35
|
+
* If the old connection has a transaction, only care about it
|
|
36
|
+
* if this particular instance of managed connections has write access.
|
|
37
|
+
*/
|
|
15
38
|
if (this.$requiresWrite && oldConnection.isTransaction()) {
|
|
16
39
|
(0, instance_1.getInstance)().getLogger().warn(TAG, 'Rolling back a transaction because setConnection was called on a ManagedDatabaseConnection in a transaction in progress.');
|
|
17
40
|
(0, instance_1.getInstance)().getLogger().trace(TAG, new Error('Stacktrace'));
|
|
@@ -70,6 +93,7 @@ class ManagedDatabaseConnection {
|
|
|
70
93
|
return true;
|
|
71
94
|
}
|
|
72
95
|
}
|
|
96
|
+
// TODO: Turn this into a promise -- but the public interface also needs to change
|
|
73
97
|
setTimeout(timeout) {
|
|
74
98
|
this.$getConnection().then((connection) => {
|
|
75
99
|
connection.setTimeout(timeout);
|
|
@@ -83,6 +107,7 @@ class ManagedDatabaseConnection {
|
|
|
83
107
|
return null;
|
|
84
108
|
}
|
|
85
109
|
}
|
|
110
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
86
111
|
query(query, params) {
|
|
87
112
|
return new Promise((resolve, reject) => {
|
|
88
113
|
this.$getConnection().then((connection) => {
|
|
@@ -90,6 +115,7 @@ class ManagedDatabaseConnection {
|
|
|
90
115
|
}).catch(reject);
|
|
91
116
|
});
|
|
92
117
|
}
|
|
118
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
93
119
|
stream(query, params, streamOptions) {
|
|
94
120
|
throw new Error('stream is not supported on Managed Connections');
|
|
95
121
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ManagedDatabaseConnection.js","sourceRoot":"","sources":["../src/ManagedDatabaseConnection.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"ManagedDatabaseConnection.js","sourceRoot":"","sources":["../src/ManagedDatabaseConnection.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;EAcE;;;AAGF,yCAAuC;AAIvC,MAAM,GAAG,GAAW,2BAA2B,CAAC;AAEhD,MAAa,yBAAyB;IAalC,YAAmB,gBAAyB,KAAK;QAC7C,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;QACpC,IAAI,CAAC,gBAAgB,GAAG,IAAI,KAAK,EAAE,CAAC,KAAK,CAAC;IAC9C,CAAC;IAED,2CAA2C;IACpC,aAAa,CAAC,UAA+B;QAChD,IAAI,IAAI,CAAC,WAAW,EAAE;YAClB,8CAA8C;YAC9C,4DAA4D;YAC5D,gDAAgD;YAChD,IAAI,aAAa,GAAwB,IAAI,CAAC,WAAW,CAAC;YAE1D;;;eAGG;YACH,IAAI,IAAI,CAAC,cAAc,IAAI,aAAa,CAAC,aAAa,EAAE,EAAE;gBACtD,IAAA,sBAAW,GAAE,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,0HAA0H,CAAC,CAAC;gBAChK,IAAA,sBAAW,GAAE,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;gBAC9D,aAAa,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;oBAC/B,aAAa,CAAC,KAAK,EAAE,CAAC;gBAC1B,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAU,EAAE,EAAE;oBACpB,IAAA,sBAAW,GAAE,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;oBAC5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 -1,7 +1,23 @@
|
|
|
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.Middleware = void 0;
|
|
4
19
|
class Middleware {
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
5
21
|
constructor() { }
|
|
6
22
|
execute(request, response) {
|
|
7
23
|
return this._execute(request, response);
|
package/lib/Middleware.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Middleware.js","sourceRoot":"","sources":["../src/Middleware.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"Middleware.js","sourceRoot":"","sources":["../src/Middleware.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;EAcE;;;AAMF,MAAsB,UAAU;IAC5B,gEAAgE;IAChE,gBAAsB,CAAC;IAIhB,OAAO,CAAC,OAAgB,EAAE,QAAkB;QAC/C,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAC5C,CAAC;CACJ;AATD,gCASC"}
|
|
@@ -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.MissingConfigError = void 0;
|
|
4
19
|
const StormError_1 = require("./StormError");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MissingConfigError.js","sourceRoot":"","sources":["../src/MissingConfigError.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"MissingConfigError.js","sourceRoot":"","sources":["../src/MissingConfigError.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;EAcE;;;AAEF,6CAAwC;AAExC,6CAAwC;AACxC,yCAAsC;AAMtC,MAAa,kBAAmB,SAAQ,uBAAsC;IAC1E,YAAmB,IAAY;QAC3B,KAAK,CAAC;YACF,IAAI;SACP,CAAC,CAAC;IACP,CAAC;IAEM,UAAU;QACb,OAAO,+BAA+B,IAAI,CAAC,iBAAiB,EAAE,CAAC,IAAI,EAAE,CAAC;IAC1E,CAAC;IAEM,OAAO;QACV,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,WAAW;QACd,OAAO,uBAAU,CAAC,cAAc,CAAC;IACrC,CAAC;IAEM,WAAW;QACd,OAAO,mBAAQ,CAAC,cAAc,CAAC;IACnC,CAAC;CACJ;AAtBD,gDAsBC"}
|
|
@@ -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.MissingParameterError = void 0;
|
|
4
19
|
const StormError_1 = require("./StormError");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MissingParameterError.js","sourceRoot":"","sources":["../src/MissingParameterError.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"MissingParameterError.js","sourceRoot":"","sources":["../src/MissingParameterError.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;EAcE;;;AAEF,6CAAwC;AACxC,2CAAsC;AACtC,6CAAwC;AAExC,MAAa,qBAAsB,SAAQ,uBAAU;IACjD,YAAmB,SAAiB;QAChC,KAAK,CAAC,EAAC,SAAS,EAAE,SAAS,EAAC,CAAC,CAAC;IAClC,CAAC;IAEM,UAAU;QACb,OAAO,sBAAsB,IAAI,CAAC,iBAAiB,EAAE,CAAC,SAAS,IAAI,CAAC;IACxE,CAAC;IAEM,OAAO;QACV,OAAO,qBAAS,CAAC,iBAAiB,CAAC;IACvC,CAAC;IAEM,WAAW;QACd,OAAO,uBAAU,CAAC,eAAe,CAAC;IACtC,CAAC;CACJ;AAhBD,sDAgBC"}
|
package/lib/MySQLConnection.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.MySQLConnection = void 0;
|
|
4
19
|
const DatabaseConnection_1 = require("./DatabaseConnection");
|
|
@@ -9,7 +24,7 @@ const CommitQuery_1 = require("./private/CommitQuery");
|
|
|
9
24
|
const RollbackQuery_1 = require("./private/RollbackQuery");
|
|
10
25
|
const SQLFormatter = require("sql-formatter");
|
|
11
26
|
const logger_1 = require("@arashi/logger");
|
|
12
|
-
const DEFAULT_HIGH_WATERMARK = 512;
|
|
27
|
+
const DEFAULT_HIGH_WATERMARK = 512; // in number of result objects
|
|
13
28
|
const TAG = 'MySQLConnection';
|
|
14
29
|
const SQL_FORMATTING_OPTIONS = {
|
|
15
30
|
language: 'mysql',
|
|
@@ -28,6 +43,7 @@ class MySQLConnection extends DatabaseConnection_1.DatabaseConnection {
|
|
|
28
43
|
if (!values)
|
|
29
44
|
return query;
|
|
30
45
|
return query.replace(/:(\w+)/g, function (txt, key) {
|
|
46
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
31
47
|
if (values.hasOwnProperty(key)) {
|
|
32
48
|
return this.escape(values[key]);
|
|
33
49
|
}
|
|
@@ -41,6 +57,7 @@ class MySQLConnection extends DatabaseConnection_1.DatabaseConnection {
|
|
|
41
57
|
isOpen() {
|
|
42
58
|
return this.$opened;
|
|
43
59
|
}
|
|
60
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
44
61
|
_query(query, params) {
|
|
45
62
|
let logger = (0, instance_1.getInstance)().getLogger();
|
|
46
63
|
return new Promise((resolve, reject) => {
|
|
@@ -50,8 +67,12 @@ class MySQLConnection extends DatabaseConnection_1.DatabaseConnection {
|
|
|
50
67
|
}, params, (error, results) => {
|
|
51
68
|
if (error) {
|
|
52
69
|
let sql = queryObject.sql;
|
|
70
|
+
// Formatting queries can be an expensive task, so only do it if the log level is actually silly.
|
|
53
71
|
if (logger.getLogLevel() === logger_1.LogLevel.SILLY) {
|
|
54
72
|
try {
|
|
73
|
+
// SQLFormatter doesn't understand all MySQL syntaxes, so this is to prevent
|
|
74
|
+
// potentially valid queries from becoming errors simply because we couldn't
|
|
75
|
+
// log them.
|
|
55
76
|
sql = SQLFormatter.format(queryObject.sql, SQL_FORMATTING_OPTIONS);
|
|
56
77
|
}
|
|
57
78
|
catch (ex) {
|
|
@@ -63,6 +84,7 @@ class MySQLConnection extends DatabaseConnection_1.DatabaseConnection {
|
|
|
63
84
|
}
|
|
64
85
|
return resolve(results);
|
|
65
86
|
});
|
|
87
|
+
// Formatting queries can be an expensive task, so only do it if the log level is actually silly.
|
|
66
88
|
let sql = queryObject.sql;
|
|
67
89
|
if (logger.getLogLevel() === logger_1.LogLevel.SILLY) {
|
|
68
90
|
sql = SQLFormatter.format(queryObject.sql, SQL_FORMATTING_OPTIONS);
|
|
@@ -70,6 +92,7 @@ class MySQLConnection extends DatabaseConnection_1.DatabaseConnection {
|
|
|
70
92
|
(0, instance_1.getInstance)().getLogger().trace(TAG, sql);
|
|
71
93
|
});
|
|
72
94
|
}
|
|
95
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
73
96
|
_stream(query, params, streamOptions) {
|
|
74
97
|
if (!streamOptions) {
|
|
75
98
|
streamOptions = {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MySQLConnection.js","sourceRoot":"","sources":["../src/MySQLConnection.ts"],"names":[],"mappings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OAAO,EAAE,CAAC;gBACxB,OAAO,EAAE,CAAC;YACd,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAU,EAAE,EAAE;gBACpB,IAAA,sBAAW,GAAE,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;gBAC5C,IAAI,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,CAAC;gBACxB,OAAO,EAAE,CAAC;YACd,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAnLD,0CAmLC"}
|
package/lib/MySQLDatabase.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.MySQLDatabase = void 0;
|
|
4
19
|
const Database_1 = require("./Database");
|
|
@@ -9,6 +24,7 @@ const TAG = 'MySQLDatabase';
|
|
|
9
24
|
class MySQLDatabase extends Database_1.Database {
|
|
10
25
|
constructor() {
|
|
11
26
|
super();
|
|
27
|
+
// TODO: Maybe one day this may be exposed via a bt config setting.
|
|
12
28
|
this.$cluster = MySQL.createPoolCluster({
|
|
13
29
|
removeNodeErrorCount: Infinity,
|
|
14
30
|
restoreNodeTimeout: 1000
|
|
@@ -17,9 +33,11 @@ class MySQLDatabase extends Database_1.Database {
|
|
|
17
33
|
(0, instance_1.getInstance)().getLogger().warn(TAG, 'Waiting for available connection...');
|
|
18
34
|
});
|
|
19
35
|
}
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
20
37
|
escape(value) {
|
|
21
38
|
return MySQLDatabase.escape(value);
|
|
22
39
|
}
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
23
41
|
static escape(value) {
|
|
24
42
|
return MySQL.escape(value);
|
|
25
43
|
}
|
package/lib/MySQLDatabase.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MySQLDatabase.js","sourceRoot":"","sources":["../src/MySQLDatabase.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"MySQLDatabase.js","sourceRoot":"","sources":["../src/MySQLDatabase.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;EAcE;;;AAEF,yCAAoC;AACpC,uDAAkD;AAClD,+BAA+B;AAC/B,yCAAuC;AAEvC,MAAM,GAAG,GAAW,eAAe,CAAC;AAEpC,MAAa,aAAc,SAAQ,mBAAgD;IAG/E;QACI,KAAK,EAAE,CAAC;QACR,mEAAmE;QACnE,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,iBAAiB,CAAC;YACpC,oBAAoB,EAAE,QAAQ;YAC9B,kBAAkB,EAAE,IAAI;SAC3B,CAAC,CAAC;QACH,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE;YAC7B,IAAA,sBAAW,GAAE,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,qCAAqC,CAAC,CAAC;QAC/E,CAAC,CAAC,CAAC;IACP,CAAC;IAED,6EAA6E;IACtE,MAAM,CAAC,KAAU;QACpB,OAAO,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;IAED,6EAA6E;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AAE;oBACP,MAAM,CAAC,KAAK,CAAC,CAAC;oBACd,OAAO;iBACV;gBAED,OAAO,CAAC,IAAI,iCAAe,CAAC,UAAU,EAAE,iBAAiB,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC;YACrF,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AA9DD,sCA8DC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { StormError } from './StormError';
|
|
2
|
+
import { ErrorCode } from './ErrorCode';
|
|
3
|
+
import { StatusCode } from './StatusCode';
|
|
4
|
+
import { HTTPMethod } from './HTTPMethod';
|
|
5
|
+
interface INotImplementedErrorOptions {
|
|
6
|
+
method: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class NotImplementedError extends StormError<INotImplementedErrorOptions> {
|
|
9
|
+
constructor(method: HTTPMethod);
|
|
10
|
+
getMessage(): string;
|
|
11
|
+
getCode(): ErrorCode;
|
|
12
|
+
getHTTPCode(): StatusCode;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.NotImplementedError = void 0;
|
|
19
|
+
const StormError_1 = require("./StormError");
|
|
20
|
+
const ErrorCode_1 = require("./ErrorCode");
|
|
21
|
+
const StatusCode_1 = require("./StatusCode");
|
|
22
|
+
class NotImplementedError extends StormError_1.StormError {
|
|
23
|
+
constructor(method) {
|
|
24
|
+
super({
|
|
25
|
+
method
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
getMessage() {
|
|
29
|
+
let details = this.getPrivateDetails();
|
|
30
|
+
return `Handler does not implement "${details.method}".`;
|
|
31
|
+
}
|
|
32
|
+
getCode() {
|
|
33
|
+
return ErrorCode_1.ErrorCode.INTERNAL;
|
|
34
|
+
}
|
|
35
|
+
getHTTPCode() {
|
|
36
|
+
return StatusCode_1.StatusCode.INTERNAL_NOT_IMPLEMENTED;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.NotImplementedError = NotImplementedError;
|
|
40
|
+
//# sourceMappingURL=NotImplementedError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotImplementedError.js","sourceRoot":"","sources":["../src/NotImplementedError.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;EAcE;;;AAEF,6CAAwC;AACxC,2CAAsC;AACtC,6CAAwC;AAOxC,MAAa,mBAAoB,SAAQ,uBAAuC;IAC5E,YAAmB,MAAkB;QACjC,KAAK,CAAC;YACF,MAAM;SACT,CAAC,CAAC;IACP,CAAC;IAEM,UAAU;QACb,IAAI,OAAO,GAAgC,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACpE,OAAO,+BAA+B,OAAO,CAAC,MAAM,IAAI,CAAC;IAC7D,CAAC;IAEM,OAAO;QACV,OAAO,qBAAS,CAAC,QAAQ,CAAC;IAC9B,CAAC;IAEM,WAAW;QACd,OAAO,uBAAU,CAAC,wBAAwB,CAAC;IAC/C,CAAC;CACJ;AAnBD,kDAmBC"}
|
package/lib/Query.d.ts
CHANGED
|
@@ -2,11 +2,32 @@ import { IDatabaseConnection } from './IDatabaseConnection';
|
|
|
2
2
|
export declare abstract class Query<TQueryParameters = any, TQueryResultSet = any, TQueryPostProcessedResultSet = TQueryResultSet> {
|
|
3
3
|
private $params;
|
|
4
4
|
constructor(parameters?: TQueryParameters);
|
|
5
|
+
/**
|
|
6
|
+
* @returns parameters that was passed into the constructor.
|
|
7
|
+
*/
|
|
5
8
|
getParameters(): TQueryParameters;
|
|
9
|
+
/**
|
|
10
|
+
* Query implementations may override this API to augment the parameters.
|
|
11
|
+
*
|
|
12
|
+
* @returns parameters that will be used when this query is ran.
|
|
13
|
+
*/
|
|
6
14
|
getParametersForQuery(): Record<any, any>;
|
|
7
15
|
protected abstract _getQuery(connection: IDatabaseConnection): string;
|
|
8
16
|
getQuery(connection: IDatabaseConnection): string;
|
|
17
|
+
/**
|
|
18
|
+
* Overridable to execute statements before the main query.
|
|
19
|
+
* Can be used to set session variables or create temporary tables, etc.
|
|
20
|
+
*
|
|
21
|
+
* @param connection
|
|
22
|
+
* @returns
|
|
23
|
+
*/
|
|
9
24
|
onPreQuery(connection: IDatabaseConnection): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Override to augment/manipulate the returned result set.
|
|
27
|
+
*
|
|
28
|
+
* @param connection The connection object used for this query execution. Useful if further queries are required.
|
|
29
|
+
* @param resultset The original result set
|
|
30
|
+
*/
|
|
10
31
|
onPostProcess(connection: IDatabaseConnection, resultSet: TQueryResultSet): Promise<TQueryPostProcessedResultSet>;
|
|
11
32
|
execute(connection: IDatabaseConnection): Promise<TQueryPostProcessedResultSet>;
|
|
12
33
|
}
|
package/lib/Query.js
CHANGED
|
@@ -1,23 +1,60 @@
|
|
|
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.Query = void 0;
|
|
4
19
|
class Query {
|
|
5
20
|
constructor(parameters) {
|
|
6
21
|
this.$params = parameters;
|
|
7
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* @returns parameters that was passed into the constructor.
|
|
25
|
+
*/
|
|
8
26
|
getParameters() {
|
|
9
27
|
return this.$params;
|
|
10
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Query implementations may override this API to augment the parameters.
|
|
31
|
+
*
|
|
32
|
+
* @returns parameters that will be used when this query is ran.
|
|
33
|
+
*/
|
|
11
34
|
getParametersForQuery() {
|
|
12
35
|
return this.$params;
|
|
13
36
|
}
|
|
14
37
|
getQuery(connection) {
|
|
15
38
|
return this._getQuery(connection);
|
|
16
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Overridable to execute statements before the main query.
|
|
42
|
+
* Can be used to set session variables or create temporary tables, etc.
|
|
43
|
+
*
|
|
44
|
+
* @param connection
|
|
45
|
+
* @returns
|
|
46
|
+
*/
|
|
17
47
|
onPreQuery(connection) {
|
|
18
48
|
return Promise.resolve();
|
|
19
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Override to augment/manipulate the returned result set.
|
|
52
|
+
*
|
|
53
|
+
* @param connection The connection object used for this query execution. Useful if further queries are required.
|
|
54
|
+
* @param resultset The original result set
|
|
55
|
+
*/
|
|
20
56
|
async onPostProcess(connection, resultSet) {
|
|
57
|
+
// By default, simply return the result set without any post processing.
|
|
21
58
|
return Promise.resolve(resultSet);
|
|
22
59
|
}
|
|
23
60
|
async execute(connection) {
|
package/lib/Query.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Query.js","sourceRoot":"","sources":["../src/Query.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"Query.js","sourceRoot":"","sources":["../src/Query.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;EAcE;;;AAIF,MAAsB,KAAK;IAGvB,YAAmB,UAA6B;QAC5C,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC;IAC9B,CAAC;IAED;;OAEG;IACI,aAAa;QAChB,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACI,qBAAqB;QACxB,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAIM,QAAQ,CAAC,UAA+B;QAC3C,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IACtC,CAAC;IAED;;;;;;OAMG;IACI,UAAU,CAAC,UAA+B;QAC7C,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,aAAa,CAAC,UAA+B,EAAE,SAA0B;QAClF,wEAAwE;QACxE,OAAO,OAAO,CAAC,OAAO,CAAM,SAAS,CAAC,CAAC;IAC3C,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,UAA+B;QAChD,OAAO,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;CACJ;AAtDD,sBAsDC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { StormError } from './StormError';
|
|
2
|
+
/**
|
|
3
|
+
* A concrete error that accepts any arbitrary message string and optionally a code.
|
|
4
|
+
* It's not recommended to use this class as it will be hard to differentiate errors by
|
|
5
|
+
* tag name.
|
|
6
|
+
*/
|
|
7
|
+
export declare class RawError extends StormError<{
|
|
8
|
+
message: string;
|
|
9
|
+
code?: number;
|
|
10
|
+
}> {
|
|
11
|
+
constructor(message: string, code?: number);
|
|
12
|
+
getCode(): number;
|
|
13
|
+
getMessage(): string;
|
|
14
|
+
}
|
package/lib/RawError.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright 2017-2022 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
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.RawError = void 0;
|
|
19
|
+
const StormError_1 = require("./StormError");
|
|
20
|
+
/**
|
|
21
|
+
* A concrete error that accepts any arbitrary message string and optionally a code.
|
|
22
|
+
* It's not recommended to use this class as it will be hard to differentiate errors by
|
|
23
|
+
* tag name.
|
|
24
|
+
*/
|
|
25
|
+
class RawError extends StormError_1.StormError {
|
|
26
|
+
constructor(message, code) {
|
|
27
|
+
super({
|
|
28
|
+
message,
|
|
29
|
+
code: code || 0
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
getCode() {
|
|
33
|
+
return this.getPrivateDetails().code;
|
|
34
|
+
}
|
|
35
|
+
getMessage() {
|
|
36
|
+
return this.getPrivateDetails().message;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.RawError = RawError;
|
|
40
|
+
//# sourceMappingURL=RawError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RawError.js","sourceRoot":"","sources":["../src/RawError.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;EAcE;;;AAEF,6CAA0C;AAE1C;;;;GAIG;AACH,MAAa,QAAS,SAAQ,uBAA4C;IACtE,YAAmB,OAAe,EAAE,IAAa;QAC7C,KAAK,CAAC;YACF,OAAO;YACP,IAAI,EAAE,IAAI,IAAI,CAAC;SAClB,CAAC,CAAC;IACP,CAAC;IAEM,OAAO;QACV,OAAO,IAAI,CAAC,iBAAiB,EAAE,CAAC,IAAI,CAAC;IACzC,CAAC;IAEM,UAAU;QACb,OAAO,IAAI,CAAC,iBAAiB,EAAE,CAAC,OAAO,CAAC;IAC5C,CAAC;CACJ;AAfD,4BAeC"}
|
package/lib/RawQuery.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.RawQuery = void 0;
|
|
4
19
|
const Query_1 = require("./Query");
|
package/lib/RawQuery.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RawQuery.js","sourceRoot":"","sources":["../src/RawQuery.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"RawQuery.js","sourceRoot":"","sources":["../src/RawQuery.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;EAcE;;;AAEF,mCAA8B;AAE9B,MAAa,QAAwG,SAAQ,aAAsE;IAG/L,YAAmB,KAAa,EAAE,UAA6B;QAC3D,KAAK,CAAC,UAAU,CAAC,CAAC;QAClB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACxB,CAAC;IAES,SAAS;QACf,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;CACJ;AAXD,4BAWC"}
|
package/lib/Request.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.Request = void 0;
|
|
4
19
|
const formidable = require("formidable");
|
package/lib/Request.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Request.js","sourceRoot":"","sources":["../src/Request.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"Request.js","sourceRoot":"","sources":["../src/Request.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;EAcE;;;AASF,yCAA0C;AAG1C,yCAAyC;AACzC,mCAAgC;AAChC,yCAAsC;AACtC,iDAA8C;AAC9C,6CAAwC;AACxC,mDAAgD;AAOhD,MAAa,OAAO;IAGhB,YAAmB,OAAwB;QACvC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC5B,CAAC;IAEM,OAA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C,WAAW;wBACrB,KAAK,GAAG,IAAI,2BAAY,CAAC,uBAAU,CAAC,gBAAgB,EAAE;4BAClD,IAAI,EAAE,EAAE,CAAC,IAAI;4BACb,MAAM,EAAE,EAAE,CAAC,OAAO;yBACrB,CAAC,CAAC;wBACH,MAAM;oBACV,KAAK,mBAAQ,CAAC,WAAW;wBACrB,KAAK,GAAG,IAAI,2BAAY,CAAC,uBAAU,CAAC,gBAAgB,EAAE;4BAClD,IAAI,EAAE,EAAE,CAAC,IAAI;4BACb,MAAM,EAAG,EAAE,CAAC,OAAO;yBACtB,CAAC,CAAC;wBACH,MAAM;iBACb;aACJ;YAED,IAAI,KAAK,KAAK,IAAI,EAAE;gBAChB,IAAI,EAAE,GAAkB,IAAI,6BAAa,CAAC,EAAE,CAAC,CAAC;gBAC9C,KAAK,GAAG,IAAI,2BAAY,CAAC,EAAE,CAAC,WAAW,EAAE,EAAE;oBACvC,IAAI,EAAE,EAAE,CAAC,OAAO,EAAE;oBAClB,MAAM,EAAE,EAAE,CAAC,UAAU,EAAE;iBAC1B,CAAC,CAAC;aACN;YAED,MAAM,KAAK,CAAC;SACf;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ;AAnID,0BAmIC"}
|
package/lib/Response.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.Response = void 0;
|
|
4
19
|
const StatusCode_1 = require("./StatusCode");
|
|
@@ -96,6 +111,8 @@ class Response {
|
|
|
96
111
|
for (let header of headers) {
|
|
97
112
|
this.setHeader(header[0], header[1]);
|
|
98
113
|
}
|
|
114
|
+
// If it was not ResponseData<TResponse> then
|
|
115
|
+
// the method signature should have caught it
|
|
99
116
|
this.send(error);
|
|
100
117
|
}
|
|
101
118
|
else {
|