@breautek/storm 4.4.1 → 4.5.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.
Files changed (87) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/docs/README.md +19 -4
  3. package/docs/classes/Application.md +26 -26
  4. package/docs/classes/BackendAuthenticationMiddleware.md +2 -2
  5. package/docs/classes/CORSMiddleware.md +6 -6
  6. package/docs/classes/ConfigLoader.md +1 -1
  7. package/docs/classes/Database.md +12 -12
  8. package/docs/classes/DatabaseCastObject.md +79 -0
  9. package/docs/classes/DatabaseConnection.md +19 -19
  10. package/docs/classes/DatabaseQueryError.md +10 -10
  11. package/docs/classes/DeadLockError.md +10 -10
  12. package/docs/classes/DiskSpaceError.md +10 -10
  13. package/docs/classes/DropTemporaryTableQuery.md +8 -8
  14. package/docs/classes/DumpStream.md +1 -1
  15. package/docs/classes/DuplicateEntryError.md +10 -10
  16. package/docs/classes/EntityNotFoundError.md +10 -10
  17. package/docs/classes/ExpiredTokenError.md +10 -10
  18. package/docs/classes/Handler.md +14 -14
  19. package/docs/classes/InternalError.md +10 -10
  20. package/docs/classes/InvalidCredentialsError.md +10 -10
  21. package/docs/classes/InvalidValueError.md +10 -10
  22. package/docs/classes/LineString.md +101 -0
  23. package/docs/classes/ManagedDatabaseConnection.md +19 -19
  24. package/docs/classes/Middleware.md +3 -3
  25. package/docs/classes/MissingConfigError.md +10 -10
  26. package/docs/classes/MissingParameterError.md +10 -10
  27. package/docs/classes/MySQLConnection.md +20 -20
  28. package/docs/classes/MySQLDatabase.md +13 -13
  29. package/docs/classes/NotImplementedError.md +10 -10
  30. package/docs/classes/Point.md +102 -0
  31. package/docs/classes/Polygon.md +101 -0
  32. package/docs/classes/Query.md +8 -8
  33. package/docs/classes/RawError.md +10 -10
  34. package/docs/classes/RawQuery.md +8 -8
  35. package/docs/classes/Request.md +18 -18
  36. package/docs/classes/Response.md +11 -11
  37. package/docs/classes/ResponseData.md +7 -7
  38. package/docs/classes/ServiceProvider.md +15 -15
  39. package/docs/classes/ServiceResponse.md +4 -4
  40. package/docs/classes/SetSessionVariableQuery.md +8 -8
  41. package/docs/classes/StormError.md +10 -10
  42. package/docs/classes/TemporaryTableQuery.md +8 -8
  43. package/docs/classes/Token.md +2 -2
  44. package/docs/classes/TokenManager.md +4 -4
  45. package/docs/classes/UnauthorizedAccessError.md +10 -10
  46. package/docs/enums/ErrorCode.md +9 -9
  47. package/docs/enums/ExitCode.md +2 -2
  48. package/docs/enums/HTTPMethod.md +4 -4
  49. package/docs/enums/JWTError.md +2 -2
  50. package/docs/enums/StatusCode.md +48 -48
  51. package/docs/interfaces/IConfig.md +8 -8
  52. package/docs/interfaces/IDatabaseConfig.md +6 -6
  53. package/docs/interfaces/IDatabaseConnection.md +14 -14
  54. package/docs/interfaces/IErrorResponse.md +5 -5
  55. package/docs/interfaces/IFormData.md +2 -2
  56. package/docs/interfaces/IHandler.md +1 -1
  57. package/docs/interfaces/IInsertQueryResult.md +3 -3
  58. package/docs/interfaces/IJWTVerifyOptions.md +1 -1
  59. package/docs/interfaces/IRequestResponse.md +2 -2
  60. package/docs/interfaces/ISetSessionVariableQueryInput.md +2 -2
  61. package/docs/interfaces/ITemporaryTableQueryInput.md +2 -2
  62. package/docs/interfaces/IUpdateQueryResult.md +2 -2
  63. package/lib/DatabaseCastObject.d.ts +5 -0
  64. package/lib/DatabaseCastObject.js +29 -0
  65. package/lib/DatabaseCastObject.js.map +1 -0
  66. package/lib/LineString.d.ts +7 -0
  67. package/lib/LineString.js +41 -0
  68. package/lib/LineString.js.map +1 -0
  69. package/lib/Point.d.ts +7 -0
  70. package/lib/Point.js +31 -0
  71. package/lib/Point.js.map +1 -0
  72. package/lib/Polygon.d.ts +7 -0
  73. package/lib/Polygon.js +52 -0
  74. package/lib/Polygon.js.map +1 -0
  75. package/lib/TCoordinate.d.ts +1 -0
  76. package/lib/TCoordinate.js +18 -0
  77. package/lib/TCoordinate.js.map +1 -0
  78. package/lib/api.d.ts +5 -0
  79. package/lib/api.js +9 -1
  80. package/lib/api.js.map +1 -1
  81. package/package.json +1 -1
  82. package/src/DatabaseCastObject.ts +29 -0
  83. package/src/LineString.ts +47 -0
  84. package/src/Point.ts +33 -0
  85. package/src/Polygon.ts +60 -0
  86. package/src/TCoordinate.ts +17 -0
  87. package/src/api.ts +7 -0
package/src/Point.ts ADDED
@@ -0,0 +1,33 @@
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 {DatabaseCastObject} from './DatabaseCastObject';
18
+
19
+ export class Point extends DatabaseCastObject {
20
+ private $x: number;
21
+ private $y: number;
22
+
23
+ public constructor(x?: number, y?: number) {
24
+ super();
25
+
26
+ this.$x = x || 0;
27
+ this.$y = y || 0;
28
+ }
29
+
30
+ protected _toSQLString(): string {
31
+ return `POINT(${this.escape(this.$x)}, ${this.escape(this.$y)})`;
32
+ }
33
+ }
package/src/Polygon.ts ADDED
@@ -0,0 +1,60 @@
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 {DatabaseCastObject} from './DatabaseCastObject';
18
+ import {TCoordinate} from './TCoordinate';
19
+
20
+ export class Polygon extends DatabaseCastObject {
21
+ private $rings: Array<Array<TCoordinate>>;
22
+
23
+ public constructor(coordinates?: Array<Array<TCoordinate>>) {
24
+ super();
25
+
26
+ this.$rings = coordinates || [];
27
+ }
28
+
29
+ protected _toSQLString(): string {
30
+ let str: string = 'POLYGON(';
31
+
32
+ for (let i: number = 0; i < this.$rings.length; i++) {
33
+ let ring: Array<TCoordinate> = this.$rings[i];
34
+ let strRing: string = '(';
35
+
36
+ for (let y: number = 0; y < ring.length; y++) {
37
+ let coord: TCoordinate = ring[y];
38
+ if (strRing === '(') {
39
+ strRing += `${this.escape(coord[0])} ${this.escape(coord[1])}`;
40
+ }
41
+ else {
42
+ strRing += `, ${this.escape(coord[0])} ${this.escape(coord[1])}`;
43
+ }
44
+ }
45
+
46
+ strRing += ')';
47
+
48
+ if (str === 'POLYGON(') {
49
+ str += strRing;
50
+ }
51
+ else {
52
+ str += ', ' + strRing;
53
+ }
54
+ }
55
+
56
+ str += ')';
57
+
58
+ return str;
59
+ }
60
+ }
@@ -0,0 +1,17 @@
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
+ export type TCoordinate = [x: number, y: number];
package/src/api.ts CHANGED
@@ -91,6 +91,13 @@ export {TokenManager} from './TokenManager';
91
91
  export {ExitCode} from './ExitCode';
92
92
  export {DumpStream} from './DumpStream';
93
93
 
94
+ // Database Objects
95
+ export {TCoordinate} from './TCoordinate';
96
+ export {DatabaseCastObject} from './DatabaseCastObject';
97
+ export {Point} from './Point';
98
+ export {LineString} from './LineString';
99
+ export {Polygon} from './Polygon';
100
+
94
101
  // Third-party
95
102
  import * as formidable from 'formidable';
96
103
  export {formidable};