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
@@ -1,7 +1,7 @@
1
+ import { Mailer } from '../../Mailer';
1
2
  import type { Mail } from '../../Mail';
2
- import type { Mailer } from '../../Mailer';
3
- declare class NoopMailer implements Mailer {
4
- send(mail: Mail): Promise<string>;
3
+ declare class NoopMailer extends Mailer {
4
+ sendMail(mail: Mail): Promise<string>;
5
5
  close(): Promise<void>;
6
6
  }
7
7
  export { NoopMailer, };
@@ -2,8 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NoopMailer = void 0;
4
4
  const crypto_1 = require("crypto");
5
- class NoopMailer {
6
- async send(mail) {
5
+ const Mailer_1 = require("../../Mailer");
6
+ class NoopMailer extends Mailer_1.Mailer {
7
+ async sendMail(mail) {
7
8
  return `${(0, crypto_1.randomUUID)()}@${mail.from.email.split('@')[1]}`;
8
9
  }
9
10
  async close() { }
@@ -1,9 +1,9 @@
1
1
  import { randomUUID } from 'crypto'
2
+ import { Mailer } from '../../Mailer'
2
3
  import type { Mail } from '../../Mail'
3
- import type { Mailer } from '../../Mailer'
4
4
 
5
- class NoopMailer implements Mailer {
6
- public async send(mail: Mail): Promise<string> {
5
+ class NoopMailer extends Mailer {
6
+ public async sendMail(mail: Mail): Promise<string> {
7
7
  return `${randomUUID()}@${mail.from.email.split('@')[1]}`
8
8
  }
9
9
 
@@ -1,7 +1,7 @@
1
+ import { Mailer } from '../../Mailer';
1
2
  import type { Tls } from '../../../tls/Tls';
2
3
  import type { Mail } from '../../Mail';
3
- import type { Mailer } from '../../Mailer';
4
- declare class SmtpMailer implements Mailer {
4
+ declare class SmtpMailer extends Mailer {
5
5
  private readonly transporter;
6
6
  constructor(params: {
7
7
  host: string;
@@ -12,7 +12,7 @@ declare class SmtpMailer implements Mailer {
12
12
  password?: string;
13
13
  maxConnections?: number;
14
14
  });
15
- send(mail: Mail): Promise<string>;
15
+ sendMail(mail: Mail): Promise<string>;
16
16
  close(): Promise<void>;
17
17
  }
18
18
  export { SmtpMailer, };
@@ -6,13 +6,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.SmtpMailer = void 0;
7
7
  const nodemailer_1 = __importDefault(require("nodemailer"));
8
8
  const getTls_1 = require("../../../tls/getTls");
9
+ const Mailer_1 = require("../../Mailer");
9
10
  const getIcalendar_1 = require("../../getIcalendar");
10
11
  const getAddress_1 = require("./getAddress");
11
12
  const getAddresses_1 = require("./getAddresses");
12
13
  const getAttachments_1 = require("./getAttachments");
13
- class SmtpMailer {
14
+ class SmtpMailer extends Mailer_1.Mailer {
14
15
  transporter;
15
16
  constructor(params) {
17
+ super();
16
18
  this.transporter = nodemailer_1.default.createTransport({
17
19
  host: params.host,
18
20
  port: params.port,
@@ -28,7 +30,7 @@ class SmtpMailer {
28
30
  maxConnections: params.maxConnections ?? 5,
29
31
  });
30
32
  }
31
- async send(mail) {
33
+ async sendMail(mail) {
32
34
  const result = await this.transporter.sendMail({
33
35
  from: (0, getAddress_1.getAddress)(mail.from),
34
36
  sender: (0, getAddress_1.getAddress)(mail.sender),
@@ -1,15 +1,15 @@
1
1
  import nodemailer from 'nodemailer'
2
2
  import { getTls } from '../../../tls/getTls'
3
+ import { Mailer } from '../../Mailer'
3
4
  import { getIcalendar } from '../../getIcalendar'
4
5
  import { getAddress } from './getAddress'
5
6
  import { getAddresses } from './getAddresses'
6
7
  import { getAttachments } from './getAttachments'
7
8
  import type { Tls } from '../../../tls/Tls'
8
9
  import type { Mail } from '../../Mail'
9
- import type { Mailer } from '../../Mailer'
10
10
  import type { Transporter } from 'nodemailer'
11
11
 
12
- class SmtpMailer implements Mailer {
12
+ class SmtpMailer extends Mailer {
13
13
  private readonly transporter: Transporter
14
14
 
15
15
  public constructor(params: {
@@ -21,6 +21,8 @@ class SmtpMailer implements Mailer {
21
21
  password?: string,
22
22
  maxConnections?: number,
23
23
  }) {
24
+ super()
25
+
24
26
  this.transporter = nodemailer.createTransport({
25
27
  host: params.host,
26
28
  port: params.port,
@@ -37,7 +39,7 @@ class SmtpMailer implements Mailer {
37
39
  })
38
40
  }
39
41
 
40
- public async send(mail: Mail): Promise<string> {
42
+ public async sendMail(mail: Mail): Promise<string> {
41
43
  const result = await this.transporter.sendMail({
42
44
  from: getAddress(mail.from),
43
45
  sender: getAddress(mail.sender),
@@ -0,0 +1,5 @@
1
+ import { BaseError } from '../../error/BaseError';
2
+ declare class AddressEmailError extends BaseError {
3
+ constructor(email: string);
4
+ }
5
+ export { AddressEmailError, };
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MailerAddressEmailError = void 0;
3
+ exports.AddressEmailError = void 0;
4
4
  const BaseError_1 = require("../../error/BaseError");
5
- class MailerAddressEmailError extends BaseError_1.BaseError {
5
+ class AddressEmailError extends BaseError_1.BaseError {
6
6
  constructor(email) {
7
7
  super(`invalid address email "${email}"`);
8
8
  }
9
9
  }
10
- exports.MailerAddressEmailError = MailerAddressEmailError;
10
+ exports.AddressEmailError = AddressEmailError;
@@ -1,11 +1,11 @@
1
1
  import { BaseError } from '../../error/BaseError'
2
2
 
3
- class MailerAddressEmailError extends BaseError {
3
+ class AddressEmailError extends BaseError {
4
4
  public constructor(email: string) {
5
5
  super(`invalid address email "${email}"`)
6
6
  }
7
7
  }
8
8
 
9
9
  export {
10
- MailerAddressEmailError,
10
+ AddressEmailError,
11
11
  }
@@ -0,0 +1,5 @@
1
+ import { BaseError } from '../../error/BaseError';
2
+ declare class EventAttachmentUrlError extends BaseError {
3
+ constructor(url: string);
4
+ }
5
+ export { EventAttachmentUrlError, };
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MailerEventAttachmentUrlError = void 0;
3
+ exports.EventAttachmentUrlError = void 0;
4
4
  const BaseError_1 = require("../../error/BaseError");
5
- class MailerEventAttachmentUrlError extends BaseError_1.BaseError {
5
+ class EventAttachmentUrlError extends BaseError_1.BaseError {
6
6
  constructor(url) {
7
7
  super(`invalid event attachment url "${url}"`);
8
8
  }
9
9
  }
10
- exports.MailerEventAttachmentUrlError = MailerEventAttachmentUrlError;
10
+ exports.EventAttachmentUrlError = EventAttachmentUrlError;
@@ -1,11 +1,11 @@
1
1
  import { BaseError } from '../../error/BaseError'
2
2
 
3
- class MailerEventAttachmentUrlError extends BaseError {
3
+ class EventAttachmentUrlError extends BaseError {
4
4
  public constructor(url: string) {
5
5
  super(`invalid event attachment url "${url}"`)
6
6
  }
7
7
  }
8
8
 
9
9
  export {
10
- MailerEventAttachmentUrlError,
10
+ EventAttachmentUrlError,
11
11
  }
@@ -1,5 +1,5 @@
1
1
  import { BaseError } from '../../error/BaseError';
2
- declare class MailerEventGeolocationError extends BaseError {
2
+ declare class EventGeolocationError extends BaseError {
3
3
  constructor(latitude: number, longitude: number);
4
4
  }
5
- export { MailerEventGeolocationError, };
5
+ export { EventGeolocationError, };
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MailerEventGeolocationError = void 0;
3
+ exports.EventGeolocationError = void 0;
4
4
  const BaseError_1 = require("../../error/BaseError");
5
- class MailerEventGeolocationError extends BaseError_1.BaseError {
5
+ class EventGeolocationError extends BaseError_1.BaseError {
6
6
  constructor(latitude, longitude) {
7
7
  super(`invalid event geolocation "${latitude}, ${longitude}"`);
8
8
  }
9
9
  }
10
- exports.MailerEventGeolocationError = MailerEventGeolocationError;
10
+ exports.EventGeolocationError = EventGeolocationError;
@@ -1,11 +1,11 @@
1
1
  import { BaseError } from '../../error/BaseError'
2
2
 
3
- class MailerEventGeolocationError extends BaseError {
3
+ class EventGeolocationError extends BaseError {
4
4
  public constructor(latitude: number, longitude: number) {
5
5
  super(`invalid event geolocation "${latitude}, ${longitude}"`)
6
6
  }
7
7
  }
8
8
 
9
9
  export {
10
- MailerEventGeolocationError,
10
+ EventGeolocationError,
11
11
  }
@@ -0,0 +1,5 @@
1
+ import { BaseError } from '../../error/BaseError';
2
+ declare class EventUrlError extends BaseError {
3
+ constructor(url: string);
4
+ }
5
+ export { EventUrlError, };
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MailerEventUrlError = void 0;
3
+ exports.EventUrlError = void 0;
4
4
  const BaseError_1 = require("../../error/BaseError");
5
- class MailerEventUrlError extends BaseError_1.BaseError {
5
+ class EventUrlError extends BaseError_1.BaseError {
6
6
  constructor(url) {
7
7
  super(`invalid event url "${url}"`);
8
8
  }
9
9
  }
10
- exports.MailerEventUrlError = MailerEventUrlError;
10
+ exports.EventUrlError = EventUrlError;
@@ -1,11 +1,11 @@
1
1
  import { BaseError } from '../../error/BaseError'
2
2
 
3
- class MailerEventUrlError extends BaseError {
3
+ class EventUrlError extends BaseError {
4
4
  public constructor(url: string) {
5
5
  super(`invalid event url "${url}"`)
6
6
  }
7
7
  }
8
8
 
9
9
  export {
10
- MailerEventUrlError,
10
+ EventUrlError,
11
11
  }
@@ -1,5 +1,5 @@
1
1
  import { BaseError } from '../../error/BaseError';
2
- declare class MailerListUrlError extends BaseError {
2
+ declare class ListUrlError extends BaseError {
3
3
  constructor(property: string, url: string);
4
4
  }
5
- export { MailerListUrlError, };
5
+ export { ListUrlError, };
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MailerListUrlError = void 0;
3
+ exports.ListUrlError = void 0;
4
4
  const BaseError_1 = require("../../error/BaseError");
5
- class MailerListUrlError extends BaseError_1.BaseError {
5
+ class ListUrlError extends BaseError_1.BaseError {
6
6
  constructor(property, url) {
7
7
  super(`invalid list ${property} url "${url}"`);
8
8
  }
9
9
  }
10
- exports.MailerListUrlError = MailerListUrlError;
10
+ exports.ListUrlError = ListUrlError;
@@ -1,11 +1,11 @@
1
1
  import { BaseError } from '../../error/BaseError'
2
2
 
3
- class MailerListUrlError extends BaseError {
3
+ class ListUrlError extends BaseError {
4
4
  public constructor(property: string, url: string) {
5
5
  super(`invalid list ${property} url "${url}"`)
6
6
  }
7
7
  }
8
8
 
9
9
  export {
10
- MailerListUrlError,
10
+ ListUrlError,
11
11
  }
@@ -2,10 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.validateAddressEmail = void 0;
4
4
  const isValidEmail_1 = require("utils/isValidEmail");
5
- const MailerAddressEmailError_1 = require("./errors/MailerAddressEmailError");
5
+ const AddressEmailError_1 = require("./errors/AddressEmailError");
6
6
  const validateAddressEmail = (email) => {
7
7
  if (!(0, isValidEmail_1.isValidEmail)(email)) {
8
- throw new MailerAddressEmailError_1.MailerAddressEmailError(email);
8
+ throw new AddressEmailError_1.AddressEmailError(email);
9
9
  }
10
10
  };
11
11
  exports.validateAddressEmail = validateAddressEmail;
@@ -1,9 +1,9 @@
1
1
  import { isValidEmail } from 'utils/isValidEmail'
2
- import { MailerAddressEmailError } from './errors/MailerAddressEmailError'
2
+ import { AddressEmailError } from './errors/AddressEmailError'
3
3
 
4
4
  const validateAddressEmail = (email: string): void => {
5
5
  if (!isValidEmail(email)) {
6
- throw new MailerAddressEmailError(email)
6
+ throw new AddressEmailError(email)
7
7
  }
8
8
  }
9
9
 
@@ -2,10 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.validateEventAttachmentUrl = void 0;
4
4
  const isValidUrl_1 = require("utils/isValidUrl");
5
- const MailerEventAttachmentUrlError_1 = require("./errors/MailerEventAttachmentUrlError");
5
+ const EventAttachmentUrlError_1 = require("./errors/EventAttachmentUrlError");
6
6
  const validateEventAttachmentUrl = (url) => {
7
7
  if (!(0, isValidUrl_1.isValidUrl)(url)) {
8
- throw new MailerEventAttachmentUrlError_1.MailerEventAttachmentUrlError(url);
8
+ throw new EventAttachmentUrlError_1.EventAttachmentUrlError(url);
9
9
  }
10
10
  };
11
11
  exports.validateEventAttachmentUrl = validateEventAttachmentUrl;
@@ -1,9 +1,9 @@
1
1
  import { isValidUrl } from 'utils/isValidUrl'
2
- import { MailerEventAttachmentUrlError } from './errors/MailerEventAttachmentUrlError'
2
+ import { EventAttachmentUrlError } from './errors/EventAttachmentUrlError'
3
3
 
4
4
  const validateEventAttachmentUrl = (url: string): void => {
5
5
  if (!isValidUrl(url)) {
6
- throw new MailerEventAttachmentUrlError(url)
6
+ throw new EventAttachmentUrlError(url)
7
7
  }
8
8
  }
9
9
 
@@ -2,10 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.validateEventGeolocation = void 0;
4
4
  const isValidGeolocation_1 = require("utils/isValidGeolocation");
5
- const MailerEventGeolocationError_1 = require("./errors/MailerEventGeolocationError");
5
+ const EventGeolocationError_1 = require("./errors/EventGeolocationError");
6
6
  const validateEventGeolocation = (latitude, longitude) => {
7
7
  if (!(0, isValidGeolocation_1.isValidGeolocation)(latitude, longitude)) {
8
- throw new MailerEventGeolocationError_1.MailerEventGeolocationError(latitude, longitude);
8
+ throw new EventGeolocationError_1.EventGeolocationError(latitude, longitude);
9
9
  }
10
10
  };
11
11
  exports.validateEventGeolocation = validateEventGeolocation;
@@ -1,12 +1,12 @@
1
1
  import { isValidGeolocation } from 'utils/isValidGeolocation'
2
- import { MailerEventGeolocationError } from './errors/MailerEventGeolocationError'
2
+ import { EventGeolocationError } from './errors/EventGeolocationError'
3
3
 
4
4
  const validateEventGeolocation = (
5
5
  latitude: number,
6
6
  longitude: number,
7
7
  ): void => {
8
8
  if (!isValidGeolocation(latitude, longitude)) {
9
- throw new MailerEventGeolocationError(latitude, longitude)
9
+ throw new EventGeolocationError(latitude, longitude)
10
10
  }
11
11
  }
12
12
 
@@ -2,10 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.validateEventUrl = void 0;
4
4
  const isValidUrl_1 = require("utils/isValidUrl");
5
- const MailerEventUrlError_1 = require("./errors/MailerEventUrlError");
5
+ const EventUrlError_1 = require("./errors/EventUrlError");
6
6
  const validateEventUrl = (url) => {
7
7
  if (!(0, isValidUrl_1.isValidUrl)(url)) {
8
- throw new MailerEventUrlError_1.MailerEventUrlError(url);
8
+ throw new EventUrlError_1.EventUrlError(url);
9
9
  }
10
10
  };
11
11
  exports.validateEventUrl = validateEventUrl;
@@ -1,9 +1,9 @@
1
1
  import { isValidUrl } from 'utils/isValidUrl'
2
- import { MailerEventUrlError } from './errors/MailerEventUrlError'
2
+ import { EventUrlError } from './errors/EventUrlError'
3
3
 
4
4
  const validateEventUrl = (url: string): void => {
5
5
  if (!isValidUrl(url)) {
6
- throw new MailerEventUrlError(url)
6
+ throw new EventUrlError(url)
7
7
  }
8
8
  }
9
9
 
@@ -2,10 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.validateListUrl = void 0;
4
4
  const isValidUrl_1 = require("utils/isValidUrl");
5
- const MailerListUrlError_1 = require("./errors/MailerListUrlError");
5
+ const ListUrlError_1 = require("./errors/ListUrlError");
6
6
  const validateListUrl = (property, url) => {
7
7
  if (!(0, isValidUrl_1.isValidUrl)(url)) {
8
- throw new MailerListUrlError_1.MailerListUrlError(property, url);
8
+ throw new ListUrlError_1.ListUrlError(property, url);
9
9
  }
10
10
  };
11
11
  exports.validateListUrl = validateListUrl;
@@ -1,9 +1,9 @@
1
1
  import { isValidUrl } from 'utils/isValidUrl'
2
- import { MailerListUrlError } from './errors/MailerListUrlError'
2
+ import { ListUrlError } from './errors/ListUrlError'
3
3
 
4
4
  const validateListUrl = (property: string, url: string): void => {
5
5
  if (!isValidUrl(url)) {
6
- throw new MailerListUrlError(property, url)
6
+ throw new ListUrlError(property, url)
7
7
  }
8
8
  }
9
9
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apeframework",
3
- "version": "0.0.0-dev.3",
3
+ "version": "0.0.0-dev.4",
4
4
  "license": "MIT",
5
5
  "author": "Matthieu Symoens",
6
6
  "description": "Node.js app framework",
@@ -1,5 +1,5 @@
1
1
  import { BaseError } from '../../error/BaseError';
2
- declare class ParserInputError extends BaseError {
2
+ declare class ParseError extends BaseError {
3
3
  constructor(type: string);
4
4
  }
5
- export { ParserInputError, };
5
+ export { ParseError, };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ParseError = void 0;
4
+ const BaseError_1 = require("../../error/BaseError");
5
+ class ParseError extends BaseError_1.BaseError {
6
+ constructor(type) {
7
+ super(`failed parsing ${type}`);
8
+ }
9
+ }
10
+ exports.ParseError = ParseError;
@@ -0,0 +1,11 @@
1
+ import { BaseError } from '../../error/BaseError'
2
+
3
+ class ParseError extends BaseError {
4
+ public constructor(type: string) {
5
+ super(`failed parsing ${type}`)
6
+ }
7
+ }
8
+
9
+ export {
10
+ ParseError,
11
+ }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createUnitParser = void 0;
4
- const ParserInputError_1 = require("../../errors/ParserInputError");
4
+ const ParseError_1 = require("../../errors/ParseError");
5
5
  const parseNumber_1 = require("../../parseNumber");
6
6
  const parseString_1 = require("../../parseString");
7
7
  const createUnitParser = (params) => {
@@ -11,7 +11,7 @@ const createUnitParser = (params) => {
11
11
  string = (0, parseString_1.parseString)(input);
12
12
  }
13
13
  catch (error) {
14
- throw new ParserInputError_1.ParserInputError(params.type);
14
+ throw new ParseError_1.ParseError(params.type);
15
15
  }
16
16
  const units = [];
17
17
  params.units.forEach((u) => {
@@ -28,7 +28,7 @@ const createUnitParser = (params) => {
28
28
  number = (0, parseNumber_1.parseNumber)(string.substring(0, string.length - (unit?.symbol.length ?? 0)));
29
29
  }
30
30
  catch (error) {
31
- throw new ParserInputError_1.ParserInputError(params.type);
31
+ throw new ParseError_1.ParseError(params.type);
32
32
  }
33
33
  return number * (unit?.value ?? 1);
34
34
  };
@@ -1,4 +1,4 @@
1
- import { ParserInputError } from '../../errors/ParserInputError'
1
+ import { ParseError } from '../../errors/ParseError'
2
2
  import { parseNumber } from '../../parseNumber'
3
3
  import { parseString } from '../../parseString'
4
4
  import type { Unit } from './Unit'
@@ -14,7 +14,7 @@ const createUnitParser = (params: {
14
14
  try {
15
15
  string = parseString(input)
16
16
  } catch (error) {
17
- throw new ParserInputError(params.type)
17
+ throw new ParseError(params.type)
18
18
  }
19
19
 
20
20
  const units: Unit[] = []
@@ -38,7 +38,7 @@ const createUnitParser = (params: {
38
38
  string.substring(0, string.length - (unit?.symbol.length ?? 0)),
39
39
  )
40
40
  } catch (error) {
41
- throw new ParserInputError(params.type)
41
+ throw new ParseError(params.type)
42
42
  }
43
43
 
44
44
  return number * (unit?.value ?? 1)
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parseBoolean = void 0;
4
- const ParserInputError_1 = require("./errors/ParserInputError");
4
+ const ParseError_1 = require("./errors/ParseError");
5
5
  const parseBoolean = (input) => {
6
6
  if ([true, 1, BigInt(1), '1'].includes(input)) {
7
7
  return true;
@@ -9,6 +9,6 @@ const parseBoolean = (input) => {
9
9
  else if ([undefined, null, false, 0, BigInt(0), '', '0'].includes(input)) {
10
10
  return false;
11
11
  }
12
- throw new ParserInputError_1.ParserInputError('boolean');
12
+ throw new ParseError_1.ParseError('boolean');
13
13
  };
14
14
  exports.parseBoolean = parseBoolean;
@@ -1,4 +1,4 @@
1
- import { ParserInputError } from './errors/ParserInputError'
1
+ import { ParseError } from './errors/ParseError'
2
2
  import type { Parser } from './Parser'
3
3
 
4
4
  const parseBoolean: Parser<boolean> = (input) => {
@@ -8,7 +8,7 @@ const parseBoolean: Parser<boolean> = (input) => {
8
8
  return false
9
9
  }
10
10
 
11
- throw new ParserInputError('boolean')
11
+ throw new ParseError('boolean')
12
12
  }
13
13
 
14
14
  export {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parseInteger = void 0;
4
- const ParserInputError_1 = require("./errors/ParserInputError");
4
+ const ParseError_1 = require("./errors/ParseError");
5
5
  const parseNumber_1 = require("./parseNumber");
6
6
  const parseInteger = (input) => {
7
7
  let number;
@@ -9,10 +9,10 @@ const parseInteger = (input) => {
9
9
  number = (0, parseNumber_1.parseNumber)(input);
10
10
  }
11
11
  catch (error) {
12
- throw new ParserInputError_1.ParserInputError('integer');
12
+ throw new ParseError_1.ParseError('integer');
13
13
  }
14
14
  if (!Number.isSafeInteger(number)) {
15
- throw new ParserInputError_1.ParserInputError('integer');
15
+ throw new ParseError_1.ParseError('integer');
16
16
  }
17
17
  return number;
18
18
  };
@@ -1,4 +1,4 @@
1
- import { ParserInputError } from './errors/ParserInputError'
1
+ import { ParseError } from './errors/ParseError'
2
2
  import { parseNumber } from './parseNumber'
3
3
  import type { Parser } from './Parser'
4
4
 
@@ -8,11 +8,11 @@ const parseInteger: Parser<number> = (input) => {
8
8
  try {
9
9
  number = parseNumber(input)
10
10
  } catch (error) {
11
- throw new ParserInputError('integer')
11
+ throw new ParseError('integer')
12
12
  }
13
13
 
14
14
  if (!Number.isSafeInteger(number)) {
15
- throw new ParserInputError('integer')
15
+ throw new ParseError('integer')
16
16
  }
17
17
 
18
18
  return number