apeframework 0.0.0-dev.3 → 0.0.0-dev.4

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 (225) hide show
  1. package/README.md +0 -14
  2. package/api/Api.d.ts +28 -0
  3. package/api/Api.js +72 -0
  4. package/api/Api.ts +104 -0
  5. package/api/Endpoint.d.ts +12 -0
  6. package/api/Endpoint.ts +16 -0
  7. package/api/ErrorHandler.d.ts +3 -0
  8. package/api/ErrorHandler.ts +11 -0
  9. package/api/Handler.d.ts +3 -0
  10. package/api/Handler.ts +10 -0
  11. package/api/Method.d.ts +8 -0
  12. package/api/Method.js +11 -0
  13. package/api/Method.ts +11 -0
  14. package/api/Schema.d.ts +9 -0
  15. package/api/Schema.ts +13 -0
  16. package/cipher/Cipher.js +2 -2
  17. package/cipher/Cipher.ts +2 -2
  18. package/cipher/errors/{CipherDecryptError.d.ts → DecryptError.d.ts} +2 -2
  19. package/cipher/errors/{CipherDecryptError.js → DecryptError.js} +3 -3
  20. package/cipher/errors/{CipherDecryptError.ts → DecryptError.ts} +2 -2
  21. package/cipher/errors/SecretLengthError.d.ts +5 -0
  22. package/{jwt/errors/JwtSecretLengthError.js → cipher/errors/SecretLengthError.js} +3 -3
  23. package/{jwt/errors/JwtSecretLengthError.ts → cipher/errors/SecretLengthError.ts} +2 -2
  24. package/cipher/validateSecretLength.js +2 -2
  25. package/cipher/validateSecretLength.ts +2 -2
  26. package/cli/utils/print.d.ts +2 -0
  27. package/cli/utils/{write.js → print.js} +3 -3
  28. package/cli/utils/print.ts +7 -0
  29. package/cli/utils/printLn.d.ts +2 -0
  30. package/cli/utils/{writeLn.js → printLn.js} +3 -3
  31. package/cli/utils/{writeLn.ts → printLn.ts} +2 -2
  32. package/{env/errors/EnvFileReadError.d.ts → config/errors/FileReadError.d.ts} +2 -2
  33. package/{tls/errors/TlsFileReadError.js → config/errors/FileReadError.js} +3 -3
  34. package/{env/errors/EnvFileReadError.ts → config/errors/FileReadError.ts} +2 -2
  35. package/config/errors/PropertyNameError.d.ts +5 -0
  36. package/config/errors/{ConfigPropertyNameError.js → PropertyNameError.js} +3 -3
  37. package/config/errors/{ConfigPropertyNameError.ts → PropertyNameError.ts} +2 -2
  38. package/config/errors/PropertyParseError.d.ts +5 -0
  39. package/config/errors/PropertyParseError.js +10 -0
  40. package/config/errors/PropertyParseError.ts +11 -0
  41. package/config/parseProperty.js +2 -2
  42. package/config/parseProperty.ts +2 -2
  43. package/config/readFile.js +4 -4
  44. package/config/readFile.ts +4 -4
  45. package/config/validatePropertyName.js +2 -2
  46. package/config/validatePropertyName.ts +2 -2
  47. package/{tls/errors/TlsFileReadError.d.ts → env/errors/FileReadError.d.ts} +2 -2
  48. package/env/errors/{EnvFileReadError.js → FileReadError.js} +3 -3
  49. package/{tls/errors/TlsFileReadError.ts → env/errors/FileReadError.ts} +2 -2
  50. package/env/readFile.js +3 -3
  51. package/env/readFile.ts +3 -3
  52. package/jwt/Jwt.d.ts +0 -6
  53. package/jwt/Jwt.js +8 -34
  54. package/jwt/Jwt.ts +8 -51
  55. package/jwt/Payload.d.ts +7 -3
  56. package/jwt/Payload.ts +7 -3
  57. package/jwt/errors/SecretLengthError.d.ts +5 -0
  58. package/{cipher/errors/CipherSecretLengthError.js → jwt/errors/SecretLengthError.js} +3 -3
  59. package/{cipher/errors/CipherSecretLengthError.ts → jwt/errors/SecretLengthError.ts} +2 -2
  60. package/jwt/validateSecretLength.js +2 -2
  61. package/jwt/validateSecretLength.ts +2 -2
  62. package/logger/Level.d.ts +7 -6
  63. package/logger/Level.js +7 -6
  64. package/logger/Level.ts +7 -6
  65. package/logger/Logger.d.ts +9 -9
  66. package/logger/Logger.js +4 -0
  67. package/logger/Logger.ts +15 -9
  68. package/logger/Severity.d.ts +6 -7
  69. package/logger/Severity.js +6 -7
  70. package/logger/Severity.ts +6 -7
  71. package/logger/adapters/file/FileLogger.d.ts +5 -5
  72. package/logger/adapters/file/FileLogger.js +17 -17
  73. package/logger/adapters/file/FileLogger.ts +19 -19
  74. package/logger/adapters/noop/NoopLogger.d.ts +2 -2
  75. package/logger/adapters/noop/NoopLogger.js +2 -1
  76. package/logger/adapters/noop/NoopLogger.ts +2 -2
  77. package/logger/adapters/stdio/StdioLogger.d.ts +5 -5
  78. package/logger/adapters/stdio/StdioLogger.js +19 -17
  79. package/logger/adapters/stdio/StdioLogger.ts +21 -19
  80. package/mailer/Event.d.ts +4 -4
  81. package/mailer/Event.ts +4 -4
  82. package/mailer/{EventLocation.d.ts → Location.d.ts} +2 -2
  83. package/mailer/Location.js +2 -0
  84. package/mailer/{EventLocation.ts → Location.ts} +2 -2
  85. package/mailer/Mailer.d.ts +5 -4
  86. package/mailer/Mailer.js +48 -0
  87. package/mailer/Mailer.ts +63 -4
  88. package/mailer/Method.d.ts +5 -0
  89. package/mailer/Method.js +8 -0
  90. package/mailer/{EventMethod.ts → Method.ts} +2 -2
  91. package/mailer/adapters/noop/NoopMailer.d.ts +3 -3
  92. package/mailer/adapters/noop/NoopMailer.js +3 -2
  93. package/mailer/adapters/noop/NoopMailer.ts +3 -3
  94. package/mailer/adapters/smtp/SmtpMailer.d.ts +3 -3
  95. package/mailer/adapters/smtp/SmtpMailer.js +4 -2
  96. package/mailer/adapters/smtp/SmtpMailer.ts +5 -3
  97. package/mailer/errors/AddressEmailError.d.ts +5 -0
  98. package/mailer/errors/{MailerAddressEmailError.js → AddressEmailError.js} +3 -3
  99. package/mailer/errors/{MailerAddressEmailError.ts → AddressEmailError.ts} +2 -2
  100. package/mailer/errors/EventAttachmentUrlError.d.ts +5 -0
  101. package/mailer/errors/{MailerEventAttachmentUrlError.js → EventAttachmentUrlError.js} +3 -3
  102. package/mailer/errors/{MailerEventAttachmentUrlError.ts → EventAttachmentUrlError.ts} +2 -2
  103. package/mailer/errors/{MailerEventGeolocationError.d.ts → EventGeolocationError.d.ts} +2 -2
  104. package/mailer/errors/{MailerEventGeolocationError.js → EventGeolocationError.js} +3 -3
  105. package/mailer/errors/{MailerEventGeolocationError.ts → EventGeolocationError.ts} +2 -2
  106. package/mailer/errors/EventUrlError.d.ts +5 -0
  107. package/mailer/errors/{MailerEventUrlError.js → EventUrlError.js} +3 -3
  108. package/mailer/errors/{MailerEventUrlError.ts → EventUrlError.ts} +2 -2
  109. package/mailer/errors/{MailerListUrlError.d.ts → ListUrlError.d.ts} +2 -2
  110. package/mailer/errors/{MailerListUrlError.js → ListUrlError.js} +3 -3
  111. package/mailer/errors/{MailerListUrlError.ts → ListUrlError.ts} +2 -2
  112. package/mailer/validateAddressEmail.js +2 -2
  113. package/mailer/validateAddressEmail.ts +2 -2
  114. package/mailer/validateEventAttachmentUrl.js +2 -2
  115. package/mailer/validateEventAttachmentUrl.ts +2 -2
  116. package/mailer/validateEventGeolocation.js +2 -2
  117. package/mailer/validateEventGeolocation.ts +2 -2
  118. package/mailer/validateEventUrl.js +2 -2
  119. package/mailer/validateEventUrl.ts +2 -2
  120. package/mailer/validateListUrl.js +2 -2
  121. package/mailer/validateListUrl.ts +2 -2
  122. package/package.json +1 -1
  123. package/parser/errors/{ParserInputError.d.ts → ParseError.d.ts} +2 -2
  124. package/parser/errors/ParseError.js +10 -0
  125. package/parser/errors/ParseError.ts +11 -0
  126. package/parser/factories/unit/createUnitParser.js +3 -3
  127. package/parser/factories/unit/createUnitParser.ts +3 -3
  128. package/parser/parseBoolean.js +2 -2
  129. package/parser/parseBoolean.ts +2 -2
  130. package/parser/parseInteger.js +3 -3
  131. package/parser/parseInteger.ts +3 -3
  132. package/parser/parseNumber.js +3 -3
  133. package/parser/parseNumber.ts +3 -3
  134. package/parser/parseString.js +2 -2
  135. package/parser/parseString.ts +2 -2
  136. package/pwd/errors/{PwdHashRoundsError.d.ts → HashRoundsError.d.ts} +2 -2
  137. package/pwd/errors/{PwdHashRoundsError.js → HashRoundsError.js} +3 -3
  138. package/pwd/errors/{PwdHashRoundsError.ts → HashRoundsError.ts} +2 -2
  139. package/pwd/validateHashRounds.js +2 -2
  140. package/pwd/validateHashRounds.ts +2 -2
  141. package/{config/errors/ConfigFileReadError.d.ts → tls/errors/FileReadError.d.ts} +2 -2
  142. package/{config/errors/ConfigFileReadError.js → tls/errors/FileReadError.js} +3 -3
  143. package/{config/errors/ConfigFileReadError.ts → tls/errors/FileReadError.ts} +2 -2
  144. package/tls/readFile.js +3 -3
  145. package/tls/readFile.ts +3 -3
  146. package/cipher/errors/CipherSecretLengthError.d.ts +0 -5
  147. package/cli/utils/write.d.ts +0 -2
  148. package/cli/utils/write.ts +0 -7
  149. package/cli/utils/writeLn.d.ts +0 -2
  150. package/config/errors/ConfigParseError.d.ts +0 -5
  151. package/config/errors/ConfigParseError.js +0 -10
  152. package/config/errors/ConfigParseError.ts +0 -11
  153. package/config/errors/ConfigPropertyNameError.d.ts +0 -5
  154. package/db/ColumnBuilder.d.ts +0 -13
  155. package/db/ColumnBuilder.js +0 -42
  156. package/db/ColumnBuilder.ts +0 -61
  157. package/db/Database.d.ts +0 -19
  158. package/db/Database.js +0 -49
  159. package/db/Database.ts +0 -74
  160. package/db/Driver.d.ts +0 -30
  161. package/db/Driver.ts +0 -33
  162. package/db/NullConstraint.d.ts +0 -2
  163. package/db/NullConstraint.ts +0 -5
  164. package/db/ReferentialAction.d.ts +0 -2
  165. package/db/ReferentialAction.ts +0 -5
  166. package/db/TableBuilder.d.ts +0 -49
  167. package/db/TableBuilder.js +0 -234
  168. package/db/TableBuilder.ts +0 -367
  169. package/db/adapters/mysql/createMysqlDatabase.d.ts +0 -12
  170. package/db/adapters/mysql/createMysqlDatabase.js +0 -32
  171. package/db/adapters/mysql/createMysqlDatabase.ts +0 -39
  172. package/db/adapters/mysql/driver.d.ts +0 -3
  173. package/db/adapters/mysql/driver.js +0 -43
  174. package/db/adapters/mysql/driver.ts +0 -45
  175. package/db/adapters/mysql/typeCast.d.ts +0 -2
  176. package/db/adapters/mysql/typeCast.js +0 -17
  177. package/db/adapters/mysql/typeCast.ts +0 -18
  178. package/db/adapters/postgres/driver.d.ts +0 -3
  179. package/db/adapters/postgres/driver.js +0 -43
  180. package/db/adapters/postgres/driver.ts +0 -45
  181. package/db/adapters/sqlite/driver.d.ts +0 -3
  182. package/db/adapters/sqlite/driver.js +0 -43
  183. package/db/adapters/sqlite/driver.ts +0 -45
  184. package/db/errors/DbColumnLengthError.d.ts +0 -5
  185. package/db/errors/DbColumnLengthError.js +0 -10
  186. package/db/errors/DbColumnLengthError.ts +0 -11
  187. package/db/errors/DbColumnMaxLengthError.d.ts +0 -5
  188. package/db/errors/DbColumnMaxLengthError.js +0 -10
  189. package/db/errors/DbColumnMaxLengthError.ts +0 -11
  190. package/db/errors/DbColumnPrecisionError.d.ts +0 -5
  191. package/db/errors/DbColumnPrecisionError.js +0 -10
  192. package/db/errors/DbColumnPrecisionError.ts +0 -11
  193. package/db/errors/DbColumnScaleError.d.ts +0 -5
  194. package/db/errors/DbColumnScaleError.js +0 -10
  195. package/db/errors/DbColumnScaleError.ts +0 -11
  196. package/db/getConstraintName.d.ts +0 -2
  197. package/db/getConstraintName.js +0 -15
  198. package/db/getConstraintName.ts +0 -18
  199. package/db/getReferentialActionSql.d.ts +0 -3
  200. package/db/getReferentialActionSql.js +0 -12
  201. package/db/getReferentialActionSql.ts +0 -17
  202. package/db/setNullConstraint.d.ts +0 -4
  203. package/db/setNullConstraint.js +0 -9
  204. package/db/setNullConstraint.ts +0 -15
  205. package/db/validateColumnLength.d.ts +0 -2
  206. package/db/validateColumnLength.js +0 -10
  207. package/db/validateColumnLength.ts +0 -11
  208. package/db/validateColumnMaxLength.d.ts +0 -2
  209. package/db/validateColumnMaxLength.js +0 -10
  210. package/db/validateColumnMaxLength.ts +0 -11
  211. package/db/validateColumnPrecision.d.ts +0 -2
  212. package/db/validateColumnPrecision.js +0 -14
  213. package/db/validateColumnPrecision.ts +0 -15
  214. package/jwt/errors/JwtSecretLengthError.d.ts +0 -5
  215. package/mailer/EventMethod.d.ts +0 -5
  216. package/mailer/EventMethod.js +0 -8
  217. package/mailer/errors/MailerAddressEmailError.d.ts +0 -5
  218. package/mailer/errors/MailerEventAttachmentUrlError.d.ts +0 -5
  219. package/mailer/errors/MailerEventUrlError.d.ts +0 -5
  220. package/parser/errors/ParserInputError.js +0 -10
  221. package/parser/errors/ParserInputError.ts +0 -11
  222. /package/{db/Driver.js → api/Endpoint.js} +0 -0
  223. /package/{db/NullConstraint.js → api/ErrorHandler.js} +0 -0
  224. /package/{db/ReferentialAction.js → api/Handler.js} +0 -0
  225. /package/{mailer/EventLocation.js → api/Schema.js} +0 -0
package/README.md CHANGED
@@ -11,17 +11,3 @@ GitHub repository: [ApeFramework/apeframework](https://github.com/ApeFramework/a
11
11
  ```
12
12
  npm install apeframework
13
13
  ```
14
-
15
- ## Development
16
-
17
- Deploy dev stack:
18
-
19
- ```
20
- docker compose up
21
- ```
22
-
23
- Get a shell from the Node.js container:
24
-
25
- ```
26
- docker compose exec node bash
27
- ```
package/api/Api.d.ts ADDED
@@ -0,0 +1,28 @@
1
+ import type { Endpoint } from './Endpoint';
2
+ import type { ErrorHandler } from './ErrorHandler';
3
+ import type { Handler } from './Handler';
4
+ declare class Api {
5
+ private readonly host;
6
+ private readonly port;
7
+ private readonly server;
8
+ constructor(params: {
9
+ host: string;
10
+ port?: number;
11
+ endpoints: Endpoint[];
12
+ onRequest?: Handler;
13
+ onResponse?: Handler;
14
+ onNotFound?: Handler;
15
+ onError?: ErrorHandler;
16
+ openapi?: {
17
+ title?: string;
18
+ version?: string;
19
+ };
20
+ cors?: {
21
+ enable?: boolean;
22
+ origin?: string[];
23
+ };
24
+ responseValidation?: boolean;
25
+ });
26
+ start(): Promise<string>;
27
+ }
28
+ export { Api, };
package/api/Api.js ADDED
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Api = void 0;
7
+ const cors_1 = __importDefault(require("@fastify/cors"));
8
+ const response_validation_1 = __importDefault(require("@fastify/response-validation"));
9
+ const swagger_1 = __importDefault(require("@fastify/swagger"));
10
+ const fastify_1 = __importDefault(require("fastify"));
11
+ class Api {
12
+ host;
13
+ port;
14
+ server;
15
+ constructor(params) {
16
+ this.host = params.host;
17
+ this.port = params.port;
18
+ this.server = (0, fastify_1.default)();
19
+ if (params.onRequest) {
20
+ this.server.addHook('onRequest', params.onRequest);
21
+ }
22
+ if (params.onResponse) {
23
+ this.server.addHook('onResponse', params.onResponse);
24
+ }
25
+ if (params.onNotFound) {
26
+ this.server.setNotFoundHandler(params.onNotFound);
27
+ }
28
+ if (params.onError) {
29
+ this.server.setErrorHandler(params.onError);
30
+ }
31
+ this.server.register(swagger_1.default, {
32
+ openapi: {
33
+ openapi: '3.1.0',
34
+ info: {
35
+ title: params.openapi?.title ?? '',
36
+ version: params.openapi?.version ?? '',
37
+ },
38
+ },
39
+ });
40
+ if (params.cors?.enable) {
41
+ this.server.register(cors_1.default, {
42
+ origin: params.cors.origin,
43
+ });
44
+ }
45
+ if (params.responseValidation) {
46
+ this.server.register(response_validation_1.default);
47
+ }
48
+ params.endpoints.forEach((e) => {
49
+ this.server.route({
50
+ url: e.path,
51
+ method: e.method,
52
+ schema: {
53
+ summary: e.name ?? e.path,
54
+ description: e.description,
55
+ ...e.schema.params ? { params: e.schema.params } : {},
56
+ ...e.schema.query ? { query: e.schema.query } : {},
57
+ ...e.schema.headers ? { headers: e.schema.headers } : {},
58
+ ...e.schema.body ? { body: e.schema.body } : {},
59
+ ...e.schema.response ? { response: e.schema.response } : {},
60
+ },
61
+ handler: e.handler,
62
+ });
63
+ });
64
+ }
65
+ async start() {
66
+ return this.server.listen({
67
+ host: this.host,
68
+ port: this.port,
69
+ });
70
+ }
71
+ }
72
+ exports.Api = Api;
package/api/Api.ts ADDED
@@ -0,0 +1,104 @@
1
+ import cors from '@fastify/cors'
2
+ import responseValidation from '@fastify/response-validation'
3
+ import swagger from '@fastify/swagger'
4
+ import fastify from 'fastify'
5
+ import type { Endpoint } from './Endpoint'
6
+ import type { ErrorHandler } from './ErrorHandler'
7
+ import type { Handler } from './Handler'
8
+ import type { FastifyInstance } from 'fastify'
9
+
10
+ class Api {
11
+ private readonly host: string
12
+
13
+ private readonly port: number | undefined
14
+
15
+ private readonly server: FastifyInstance
16
+
17
+ public constructor(params: {
18
+ host: string,
19
+ port?: number,
20
+ endpoints: Endpoint[],
21
+ onRequest?: Handler,
22
+ onResponse?: Handler,
23
+ onNotFound?: Handler,
24
+ onError?: ErrorHandler,
25
+ openapi?: {
26
+ title?: string,
27
+ version?: string,
28
+ },
29
+ cors?: {
30
+ enable?: boolean,
31
+ origin?: string[],
32
+ },
33
+ responseValidation?: boolean,
34
+ }) {
35
+ this.host = params.host
36
+ this.port = params.port
37
+
38
+ this.server = fastify()
39
+
40
+ if (params.onRequest) {
41
+ this.server.addHook('onRequest', params.onRequest)
42
+ }
43
+
44
+ if (params.onResponse) {
45
+ this.server.addHook('onResponse', params.onResponse)
46
+ }
47
+
48
+ if (params.onNotFound) {
49
+ this.server.setNotFoundHandler(params.onNotFound)
50
+ }
51
+
52
+ if (params.onError) {
53
+ this.server.setErrorHandler(params.onError)
54
+ }
55
+
56
+ this.server.register(swagger, {
57
+ openapi: {
58
+ openapi: '3.1.0',
59
+ info: {
60
+ title: params.openapi?.title ?? '',
61
+ version: params.openapi?.version ?? '',
62
+ },
63
+ },
64
+ })
65
+
66
+ if (params.cors?.enable) {
67
+ this.server.register(cors, {
68
+ origin: params.cors.origin,
69
+ })
70
+ }
71
+
72
+ if (params.responseValidation) {
73
+ this.server.register(responseValidation)
74
+ }
75
+
76
+ params.endpoints.forEach((e) => {
77
+ this.server.route({
78
+ url: e.path,
79
+ method: e.method,
80
+ schema: {
81
+ summary: e.name ?? e.path,
82
+ description: e.description,
83
+ ...e.schema.params ? { params: e.schema.params } : {},
84
+ ...e.schema.query ? { query: e.schema.query } : {},
85
+ ...e.schema.headers ? { headers: e.schema.headers } : {},
86
+ ...e.schema.body ? { body: e.schema.body } : {},
87
+ ...e.schema.response ? { response: e.schema.response } : {},
88
+ },
89
+ handler: e.handler,
90
+ })
91
+ })
92
+ }
93
+
94
+ public async start(): Promise<string> {
95
+ return this.server.listen({
96
+ host: this.host,
97
+ port: this.port,
98
+ })
99
+ }
100
+ }
101
+
102
+ export {
103
+ Api,
104
+ }
@@ -0,0 +1,12 @@
1
+ import type { Handler } from './Handler';
2
+ import type { Method } from './Method';
3
+ import type { Schema } from './Schema';
4
+ interface Endpoint {
5
+ path: string;
6
+ method: Method;
7
+ name?: string;
8
+ description?: string;
9
+ schema: Schema;
10
+ handler: Handler;
11
+ }
12
+ export { type Endpoint, };
@@ -0,0 +1,16 @@
1
+ import type { Handler } from './Handler'
2
+ import type { Method } from './Method'
3
+ import type { Schema } from './Schema'
4
+
5
+ interface Endpoint {
6
+ path: string,
7
+ method: Method,
8
+ name?: string,
9
+ description?: string,
10
+ schema: Schema,
11
+ handler: Handler,
12
+ }
13
+
14
+ export {
15
+ type Endpoint,
16
+ }
@@ -0,0 +1,3 @@
1
+ import type { FastifyError, FastifyReply, FastifyRequest } from 'fastify';
2
+ type ErrorHandler = (error: FastifyError, request: FastifyRequest, response: FastifyReply) => Promise<void>;
3
+ export { type ErrorHandler, };
@@ -0,0 +1,11 @@
1
+ import type { FastifyError, FastifyReply, FastifyRequest } from 'fastify'
2
+
3
+ type ErrorHandler = (
4
+ error: FastifyError,
5
+ request: FastifyRequest,
6
+ response: FastifyReply,
7
+ ) => Promise<void>
8
+
9
+ export {
10
+ type ErrorHandler,
11
+ }
@@ -0,0 +1,3 @@
1
+ import type { FastifyReply, FastifyRequest } from 'fastify';
2
+ type Handler = (request: FastifyRequest, response: FastifyReply) => Promise<void>;
3
+ export { type Handler, };
package/api/Handler.ts ADDED
@@ -0,0 +1,10 @@
1
+ import type { FastifyReply, FastifyRequest } from 'fastify'
2
+
3
+ type Handler = (
4
+ request: FastifyRequest,
5
+ response: FastifyReply,
6
+ ) => Promise<void>
7
+
8
+ export {
9
+ type Handler,
10
+ }
@@ -0,0 +1,8 @@
1
+ declare enum Method {
2
+ DELETE = "DELETE",
3
+ GET = "GET",
4
+ PATCH = "PATCH",
5
+ POST = "POST",
6
+ PUT = "PUT"
7
+ }
8
+ export { Method, };
package/api/Method.js ADDED
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Method = void 0;
4
+ var Method;
5
+ (function (Method) {
6
+ Method["DELETE"] = "DELETE";
7
+ Method["GET"] = "GET";
8
+ Method["PATCH"] = "PATCH";
9
+ Method["POST"] = "POST";
10
+ Method["PUT"] = "PUT";
11
+ })(Method || (exports.Method = Method = {}));
package/api/Method.ts ADDED
@@ -0,0 +1,11 @@
1
+ enum Method {
2
+ DELETE = 'DELETE',
3
+ GET = 'GET',
4
+ PATCH = 'PATCH',
5
+ POST = 'POST',
6
+ PUT = 'PUT',
7
+ }
8
+
9
+ export {
10
+ Method,
11
+ }
@@ -0,0 +1,9 @@
1
+ import type { OpenAPIV3 } from 'openapi-types';
2
+ interface Schema {
3
+ params?: OpenAPIV3.SchemaObject;
4
+ query?: OpenAPIV3.SchemaObject;
5
+ headers?: OpenAPIV3.SchemaObject;
6
+ body?: OpenAPIV3.SchemaObject;
7
+ response?: Record<number, OpenAPIV3.SchemaObject>;
8
+ }
9
+ export { type Schema, };
package/api/Schema.ts ADDED
@@ -0,0 +1,13 @@
1
+ import type { OpenAPIV3 } from 'openapi-types'
2
+
3
+ interface Schema {
4
+ params?: OpenAPIV3.SchemaObject,
5
+ query?: OpenAPIV3.SchemaObject,
6
+ headers?: OpenAPIV3.SchemaObject,
7
+ body?: OpenAPIV3.SchemaObject,
8
+ response?: Record<number, OpenAPIV3.SchemaObject>,
9
+ }
10
+
11
+ export {
12
+ type Schema,
13
+ }
package/cipher/Cipher.js CHANGED
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.Cipher = void 0;
7
7
  const crypto_1 = __importDefault(require("crypto"));
8
- const CipherDecryptError_1 = require("./errors/CipherDecryptError");
8
+ const DecryptError_1 = require("./errors/DecryptError");
9
9
  const validateSecretLength_1 = require("./validateSecretLength");
10
10
  class Cipher {
11
11
  algorithm;
@@ -31,7 +31,7 @@ class Cipher {
31
31
  + decipher.final('utf8');
32
32
  }
33
33
  catch (error) {
34
- throw new CipherDecryptError_1.CipherDecryptError(error.message);
34
+ throw new DecryptError_1.DecryptError(error.message);
35
35
  }
36
36
  }
37
37
  }
package/cipher/Cipher.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import crypto from 'crypto'
2
- import { CipherDecryptError } from './errors/CipherDecryptError'
2
+ import { DecryptError } from './errors/DecryptError'
3
3
  import { validateSecretLength } from './validateSecretLength'
4
4
  import type { Algorithm } from './Algorithm'
5
5
 
@@ -36,7 +36,7 @@ class Cipher {
36
36
  return decipher.update(buffer.subarray(16), undefined, 'utf8')
37
37
  + decipher.final('utf8')
38
38
  } catch (error) {
39
- throw new CipherDecryptError((error as Error).message)
39
+ throw new DecryptError((error as Error).message)
40
40
  }
41
41
  }
42
42
  }
@@ -1,5 +1,5 @@
1
1
  import { BaseError } from '../../error/BaseError';
2
- declare class CipherDecryptError extends BaseError {
2
+ declare class DecryptError extends BaseError {
3
3
  constructor(message: string);
4
4
  }
5
- export { CipherDecryptError, };
5
+ export { DecryptError, };
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CipherDecryptError = void 0;
3
+ exports.DecryptError = void 0;
4
4
  const BaseError_1 = require("../../error/BaseError");
5
- class CipherDecryptError extends BaseError_1.BaseError {
5
+ class DecryptError extends BaseError_1.BaseError {
6
6
  constructor(message) {
7
7
  super(`failed decrypting string: ${message}`);
8
8
  }
9
9
  }
10
- exports.CipherDecryptError = CipherDecryptError;
10
+ exports.DecryptError = DecryptError;
@@ -1,11 +1,11 @@
1
1
  import { BaseError } from '../../error/BaseError'
2
2
 
3
- class CipherDecryptError extends BaseError {
3
+ class DecryptError extends BaseError {
4
4
  public constructor(message: string) {
5
5
  super(`failed decrypting string: ${message}`)
6
6
  }
7
7
  }
8
8
 
9
9
  export {
10
- CipherDecryptError,
10
+ DecryptError,
11
11
  }
@@ -0,0 +1,5 @@
1
+ import { BaseError } from '../../error/BaseError';
2
+ declare class SecretLengthError extends BaseError {
3
+ constructor();
4
+ }
5
+ export { SecretLengthError, };
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.JwtSecretLengthError = void 0;
3
+ exports.SecretLengthError = void 0;
4
4
  const BaseError_1 = require("../../error/BaseError");
5
- class JwtSecretLengthError extends BaseError_1.BaseError {
5
+ class SecretLengthError extends BaseError_1.BaseError {
6
6
  constructor() {
7
7
  super('invalid secret length');
8
8
  }
9
9
  }
10
- exports.JwtSecretLengthError = JwtSecretLengthError;
10
+ exports.SecretLengthError = SecretLengthError;
@@ -1,11 +1,11 @@
1
1
  import { BaseError } from '../../error/BaseError'
2
2
 
3
- class JwtSecretLengthError extends BaseError {
3
+ class SecretLengthError extends BaseError {
4
4
  public constructor() {
5
5
  super('invalid secret length')
6
6
  }
7
7
  }
8
8
 
9
9
  export {
10
- JwtSecretLengthError,
10
+ SecretLengthError,
11
11
  }
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.validateSecretLength = void 0;
4
4
  const Algorithm_1 = require("./Algorithm");
5
- const CipherSecretLengthError_1 = require("./errors/CipherSecretLengthError");
5
+ const SecretLengthError_1 = require("./errors/SecretLengthError");
6
6
  const secretLength = {
7
7
  [Algorithm_1.Algorithm.AES128]: 16,
8
8
  [Algorithm_1.Algorithm.AES192]: 24,
@@ -10,7 +10,7 @@ const secretLength = {
10
10
  };
11
11
  const validateSecretLength = (algorithm, secret) => {
12
12
  if (Buffer.from(secret).length !== secretLength[algorithm]) {
13
- throw new CipherSecretLengthError_1.CipherSecretLengthError();
13
+ throw new SecretLengthError_1.SecretLengthError();
14
14
  }
15
15
  };
16
16
  exports.validateSecretLength = validateSecretLength;
@@ -1,5 +1,5 @@
1
1
  import { Algorithm } from './Algorithm'
2
- import { CipherSecretLengthError } from './errors/CipherSecretLengthError'
2
+ import { SecretLengthError } from './errors/SecretLengthError'
3
3
 
4
4
  const secretLength = {
5
5
  [Algorithm.AES128]: 16,
@@ -9,7 +9,7 @@ const secretLength = {
9
9
 
10
10
  const validateSecretLength = (algorithm: Algorithm, secret: string): void => {
11
11
  if (Buffer.from(secret).length !== secretLength[algorithm]) {
12
- throw new CipherSecretLengthError()
12
+ throw new SecretLengthError()
13
13
  }
14
14
  }
15
15
 
@@ -0,0 +1,2 @@
1
+ declare const print: (s: string) => void;
2
+ export { print, };
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.write = void 0;
4
- const write = (s) => {
3
+ exports.print = void 0;
4
+ const print = (s) => {
5
5
  process.stdout.write(s);
6
6
  };
7
- exports.write = write;
7
+ exports.print = print;
@@ -0,0 +1,7 @@
1
+ const print = (s: string): void => {
2
+ process.stdout.write(s)
3
+ }
4
+
5
+ export {
6
+ print,
7
+ }
@@ -0,0 +1,2 @@
1
+ declare const printLn: (s: string) => void;
2
+ export { printLn, };
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.writeLn = void 0;
3
+ exports.printLn = void 0;
4
4
  const os_1 = require("os");
5
- const writeLn = (s) => {
5
+ const printLn = (s) => {
6
6
  process.stdout.write(`${s}${os_1.EOL}`);
7
7
  };
8
- exports.writeLn = writeLn;
8
+ exports.printLn = printLn;
@@ -1,9 +1,9 @@
1
1
  import { EOL } from 'os'
2
2
 
3
- const writeLn = (s: string): void => {
3
+ const printLn = (s: string): void => {
4
4
  process.stdout.write(`${s}${EOL}`)
5
5
  }
6
6
 
7
7
  export {
8
- writeLn,
8
+ printLn,
9
9
  }
@@ -1,5 +1,5 @@
1
1
  import { BaseError } from '../../error/BaseError';
2
- declare class EnvFileReadError extends BaseError {
2
+ declare class FileReadError extends BaseError {
3
3
  constructor(path: string, message: string);
4
4
  }
5
- export { EnvFileReadError, };
5
+ export { FileReadError, };
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TlsFileReadError = void 0;
3
+ exports.FileReadError = void 0;
4
4
  const BaseError_1 = require("../../error/BaseError");
5
- class TlsFileReadError extends BaseError_1.BaseError {
5
+ class FileReadError extends BaseError_1.BaseError {
6
6
  constructor(path, message) {
7
7
  super(`failed reading file "${path}": ${message}`);
8
8
  }
9
9
  }
10
- exports.TlsFileReadError = TlsFileReadError;
10
+ exports.FileReadError = FileReadError;
@@ -1,11 +1,11 @@
1
1
  import { BaseError } from '../../error/BaseError'
2
2
 
3
- class EnvFileReadError extends BaseError {
3
+ class FileReadError extends BaseError {
4
4
  public constructor(path: string, message: string) {
5
5
  super(`failed reading file "${path}": ${message}`)
6
6
  }
7
7
  }
8
8
 
9
9
  export {
10
- EnvFileReadError,
10
+ FileReadError,
11
11
  }
@@ -0,0 +1,5 @@
1
+ import { BaseError } from '../../error/BaseError';
2
+ declare class PropertyNameError extends BaseError {
3
+ constructor(name: string);
4
+ }
5
+ export { PropertyNameError, };
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ConfigPropertyNameError = void 0;
3
+ exports.PropertyNameError = void 0;
4
4
  const BaseError_1 = require("../../error/BaseError");
5
- class ConfigPropertyNameError extends BaseError_1.BaseError {
5
+ class PropertyNameError extends BaseError_1.BaseError {
6
6
  constructor(name) {
7
7
  super(`invalid property name "${name}"`);
8
8
  }
9
9
  }
10
- exports.ConfigPropertyNameError = ConfigPropertyNameError;
10
+ exports.PropertyNameError = PropertyNameError;
@@ -1,11 +1,11 @@
1
1
  import { BaseError } from '../../error/BaseError'
2
2
 
3
- class ConfigPropertyNameError extends BaseError {
3
+ class PropertyNameError extends BaseError {
4
4
  public constructor(name: string) {
5
5
  super(`invalid property name "${name}"`)
6
6
  }
7
7
  }
8
8
 
9
9
  export {
10
- ConfigPropertyNameError,
10
+ PropertyNameError,
11
11
  }
@@ -0,0 +1,5 @@
1
+ import { BaseError } from '../../error/BaseError';
2
+ declare class PropertyParseError extends BaseError {
3
+ constructor(name: string, source: string, message: string);
4
+ }
5
+ export { PropertyParseError, };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PropertyParseError = void 0;
4
+ const BaseError_1 = require("../../error/BaseError");
5
+ class PropertyParseError extends BaseError_1.BaseError {
6
+ constructor(name, source, message) {
7
+ super(`failed parsing property "${name}" from ${source}: ${message}`);
8
+ }
9
+ }
10
+ exports.PropertyParseError = PropertyParseError;
@@ -0,0 +1,11 @@
1
+ import { BaseError } from '../../error/BaseError'
2
+
3
+ class PropertyParseError extends BaseError {
4
+ public constructor(name: string, source: string, message: string) {
5
+ super(`failed parsing property "${name}" from ${source}: ${message}`)
6
+ }
7
+ }
8
+
9
+ export {
10
+ PropertyParseError,
11
+ }