apeframework 0.0.0-dev.20 → 0.0.0-dev.21

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 (210) hide show
  1. package/LICENSE +1 -1
  2. package/cipher/Algorithm.js +2 -4
  3. package/cipher/Cipher.js +9 -15
  4. package/cipher/errors/DecryptError.js +3 -6
  5. package/cipher/errors/SecretLengthError.js +3 -6
  6. package/cipher/validateSecretLength.js +7 -10
  7. package/cli/Args.js +1 -2
  8. package/cli/Command.js +1 -2
  9. package/cli/getArgs.js +3 -6
  10. package/cli/parseArgs.js +3 -9
  11. package/cli/utils/exit.js +1 -4
  12. package/cli/utils/formatList.js +3 -6
  13. package/cli/utils/formatTable.js +3 -6
  14. package/cli/utils/formatText.js +3 -6
  15. package/cli/utils/print.js +1 -4
  16. package/cli/utils/printLn.js +3 -6
  17. package/config/Config.js +1 -2
  18. package/config/Properties.js +1 -2
  19. package/config/errors/FileReadError.js +3 -6
  20. package/config/errors/PropertyNameError.js +3 -6
  21. package/config/errors/PropertyParseError.js +3 -6
  22. package/config/getConfig.js +8 -11
  23. package/config/getPropertyEnvVar.js +1 -4
  24. package/config/parseProperty.js +3 -6
  25. package/config/readFile.js +8 -14
  26. package/config/validatePropertyName.js +3 -6
  27. package/env/Env.js +1 -2
  28. package/env/errors/FileReadError.js +3 -6
  29. package/env/getEnv.js +3 -6
  30. package/env/readFile.js +8 -14
  31. package/error/BaseError.js +1 -4
  32. package/jwt/Algorithm.js +2 -4
  33. package/jwt/Jwt.js +6 -9
  34. package/jwt/Payload.js +1 -2
  35. package/jwt/errors/SecretLengthError.js +3 -6
  36. package/jwt/validateSecretLength.js +7 -10
  37. package/logger/Level.js +2 -4
  38. package/logger/Logger.js +1 -4
  39. package/logger/Severity.js +2 -4
  40. package/logger/adapters/file/FileLogger.js +11 -17
  41. package/logger/adapters/file/errors/FileInitError.js +3 -6
  42. package/logger/adapters/file/initFile.js +6 -12
  43. package/logger/adapters/noop/NoopLogger.js +3 -6
  44. package/logger/adapters/stdio/StdioLogger.js +11 -17
  45. package/mailer/Address.js +1 -2
  46. package/mailer/Attachment.js +1 -2
  47. package/mailer/Event.js +1 -2
  48. package/mailer/List.js +1 -2
  49. package/mailer/Location.js +1 -2
  50. package/mailer/Mail.js +1 -2
  51. package/mailer/Mailer.js +16 -19
  52. package/mailer/Method.js +2 -4
  53. package/mailer/adapters/noop/NoopMailer.js +5 -8
  54. package/mailer/adapters/smtp/SmtpMailer.js +19 -25
  55. package/mailer/adapters/smtp/getAddress.js +1 -4
  56. package/mailer/adapters/smtp/getAddresses.js +3 -6
  57. package/mailer/adapters/smtp/getAttachments.js +1 -4
  58. package/mailer/errors/AddressEmailError.js +3 -6
  59. package/mailer/errors/EventAttachmentUrlError.js +3 -6
  60. package/mailer/errors/EventGeolocationError.js +3 -6
  61. package/mailer/errors/EventUrlError.js +3 -6
  62. package/mailer/errors/ListUrlError.js +3 -6
  63. package/mailer/getIcalendar.js +3 -6
  64. package/mailer/validateAddressEmail.js +5 -8
  65. package/mailer/validateEventAttachmentUrl.js +5 -8
  66. package/mailer/validateEventGeolocation.js +5 -8
  67. package/mailer/validateEventUrl.js +5 -8
  68. package/mailer/validateListUrl.js +5 -8
  69. package/package.json +2 -4
  70. package/parser/Parser.js +1 -2
  71. package/parser/errors/ParseError.js +3 -6
  72. package/parser/factories/enum/createEnumParser.js +3 -6
  73. package/parser/factories/unit/Unit.js +1 -2
  74. package/parser/factories/unit/createUnitParser.js +8 -11
  75. package/parser/parseBoolean.js +3 -6
  76. package/parser/parseBytes.js +3 -6
  77. package/parser/parseInteger.js +6 -9
  78. package/parser/parseMilliseconds.js +3 -6
  79. package/parser/parseNumber.js +4 -7
  80. package/parser/parseString.js +3 -6
  81. package/pwd/Pwd.js +6 -12
  82. package/pwd/errors/HashRoundsError.js +3 -6
  83. package/pwd/validateHashRounds.js +3 -6
  84. package/server/ErrorHandler.js +1 -2
  85. package/server/Format.js +1 -2
  86. package/server/Handler.js +1 -2
  87. package/server/Method.js +2 -4
  88. package/server/OpenApiFormat.js +2 -4
  89. package/server/Route.js +1 -2
  90. package/server/Schema.js +1 -2
  91. package/server/Server.js +15 -21
  92. package/server/getAjv.js +5 -11
  93. package/tls/Tls.js +1 -2
  94. package/tls/errors/FileReadError.js +3 -6
  95. package/tls/getTls.js +5 -8
  96. package/tls/readFile.js +7 -13
  97. package/utils/getRandomHexString.js +3 -6
  98. package/utils/getTimestamp.js +1 -4
  99. package/utils/isValidEmail.js +1 -4
  100. package/utils/isValidGeolocation.js +1 -4
  101. package/utils/isValidHexString.js +1 -4
  102. package/utils/isValidIsoDate.js +1 -4
  103. package/utils/isValidJwtToken.js +1 -4
  104. package/utils/isValidUrl.js +1 -4
  105. package/utils/isValidUuid.js +1 -4
  106. package/utils/wait.js +1 -4
  107. package/cipher/Algorithm.ts +0 -9
  108. package/cipher/Cipher.ts +0 -46
  109. package/cipher/errors/DecryptError.ts +0 -11
  110. package/cipher/errors/SecretLengthError.ts +0 -11
  111. package/cipher/validateSecretLength.ts +0 -18
  112. package/cli/Args.ts +0 -8
  113. package/cli/Command.ts +0 -7
  114. package/cli/getArgs.ts +0 -10
  115. package/cli/parseArgs.ts +0 -34
  116. package/cli/utils/exit.ts +0 -7
  117. package/cli/utils/formatList.ts +0 -11
  118. package/cli/utils/formatTable.ts +0 -25
  119. package/cli/utils/formatText.ts +0 -9
  120. package/cli/utils/print.ts +0 -7
  121. package/cli/utils/printLn.ts +0 -9
  122. package/config/Config.ts +0 -5
  123. package/config/Properties.ts +0 -12
  124. package/config/errors/FileReadError.ts +0 -11
  125. package/config/errors/PropertyNameError.ts +0 -11
  126. package/config/errors/PropertyParseError.ts +0 -11
  127. package/config/getConfig.ts +0 -47
  128. package/config/getPropertyEnvVar.ts +0 -15
  129. package/config/parseProperty.ts +0 -47
  130. package/config/readFile.ts +0 -34
  131. package/config/validatePropertyName.ts +0 -13
  132. package/env/Env.ts +0 -5
  133. package/env/errors/FileReadError.ts +0 -11
  134. package/env/getEnv.ts +0 -24
  135. package/env/readFile.ts +0 -24
  136. package/error/BaseError.ts +0 -12
  137. package/jwt/Algorithm.ts +0 -9
  138. package/jwt/Jwt.ts +0 -49
  139. package/jwt/Payload.ts +0 -14
  140. package/jwt/errors/SecretLengthError.ts +0 -11
  141. package/jwt/validateSecretLength.ts +0 -18
  142. package/logger/Level.ts +0 -13
  143. package/logger/Logger.ts +0 -19
  144. package/logger/Severity.ts +0 -12
  145. package/logger/adapters/file/FileLogger.ts +0 -87
  146. package/logger/adapters/file/errors/FileInitError.ts +0 -11
  147. package/logger/adapters/file/initFile.ts +0 -18
  148. package/logger/adapters/noop/NoopLogger.ts +0 -21
  149. package/logger/adapters/stdio/StdioLogger.ts +0 -89
  150. package/mailer/Address.ts +0 -8
  151. package/mailer/Attachment.ts +0 -11
  152. package/mailer/Event.ts +0 -20
  153. package/mailer/List.ts +0 -10
  154. package/mailer/Location.ts +0 -12
  155. package/mailer/Mail.ts +0 -23
  156. package/mailer/Mailer.ts +0 -69
  157. package/mailer/Method.ts +0 -8
  158. package/mailer/adapters/noop/NoopMailer.ts +0 -15
  159. package/mailer/adapters/smtp/SmtpMailer.ts +0 -74
  160. package/mailer/adapters/smtp/getAddress.ts +0 -15
  161. package/mailer/adapters/smtp/getAddresses.ts +0 -17
  162. package/mailer/adapters/smtp/getAttachments.ts +0 -20
  163. package/mailer/errors/AddressEmailError.ts +0 -11
  164. package/mailer/errors/EventAttachmentUrlError.ts +0 -11
  165. package/mailer/errors/EventGeolocationError.ts +0 -11
  166. package/mailer/errors/EventUrlError.ts +0 -11
  167. package/mailer/errors/ListUrlError.ts +0 -11
  168. package/mailer/getIcalendar.ts +0 -39
  169. package/mailer/validateAddressEmail.ts +0 -12
  170. package/mailer/validateEventAttachmentUrl.ts +0 -12
  171. package/mailer/validateEventGeolocation.ts +0 -15
  172. package/mailer/validateEventUrl.ts +0 -12
  173. package/mailer/validateListUrl.ts +0 -12
  174. package/parser/Parser.ts +0 -5
  175. package/parser/errors/ParseError.ts +0 -11
  176. package/parser/factories/enum/createEnumParser.ts +0 -21
  177. package/parser/factories/unit/Unit.ts +0 -8
  178. package/parser/factories/unit/createUnitParser.ts +0 -50
  179. package/parser/parseBoolean.ts +0 -33
  180. package/parser/parseBytes.ts +0 -55
  181. package/parser/parseInteger.ts +0 -23
  182. package/parser/parseMilliseconds.ts +0 -31
  183. package/parser/parseNumber.ts +0 -22
  184. package/parser/parseString.ts +0 -16
  185. package/pwd/Pwd.ts +0 -31
  186. package/pwd/errors/HashRoundsError.ts +0 -11
  187. package/pwd/validateHashRounds.ts +0 -11
  188. package/server/ErrorHandler.ts +0 -11
  189. package/server/Format.ts +0 -15
  190. package/server/Handler.ts +0 -10
  191. package/server/Method.ts +0 -11
  192. package/server/OpenApiFormat.ts +0 -8
  193. package/server/Route.ts +0 -16
  194. package/server/Schema.ts +0 -13
  195. package/server/Server.ts +0 -134
  196. package/server/getAjv.ts +0 -26
  197. package/tls/Tls.ts +0 -10
  198. package/tls/errors/FileReadError.ts +0 -11
  199. package/tls/getTls.ts +0 -24
  200. package/tls/readFile.ts +0 -18
  201. package/utils/getRandomHexString.ts +0 -9
  202. package/utils/getTimestamp.ts +0 -7
  203. package/utils/isValidEmail.ts +0 -9
  204. package/utils/isValidGeolocation.ts +0 -10
  205. package/utils/isValidHexString.ts +0 -9
  206. package/utils/isValidIsoDate.ts +0 -9
  207. package/utils/isValidJwtToken.ts +0 -9
  208. package/utils/isValidUrl.ts +0 -21
  209. package/utils/isValidUuid.ts +0 -10
  210. package/utils/wait.ts +0 -9
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Severity = void 0;
4
1
  var Severity;
5
2
  (function (Severity) {
6
3
  Severity[Severity["TRACE"] = 10] = "TRACE";
@@ -9,4 +6,5 @@ var Severity;
9
6
  Severity[Severity["WARN"] = 40] = "WARN";
10
7
  Severity[Severity["ERROR"] = 50] = "ERROR";
11
8
  Severity[Severity["FATAL"] = 60] = "FATAL";
12
- })(Severity || (exports.Severity = Severity = {}));
9
+ })(Severity || (Severity = {}));
10
+ export { Severity, };
@@ -1,23 +1,17 @@
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.FileLogger = void 0;
7
- const pino_1 = __importDefault(require("pino"));
8
- const Level_1 = require("../../Level");
9
- const Logger_1 = require("../../Logger");
10
- const initFile_1 = require("./initFile");
11
- class FileLogger extends Logger_1.Logger {
1
+ import pino from 'pino';
2
+ import { Level } from '../../Level';
3
+ import { Logger } from '../../Logger';
4
+ import { initFile } from './initFile';
5
+ class FileLogger extends Logger {
12
6
  logger;
13
7
  context;
14
8
  constructor(params) {
15
9
  super();
16
- (0, initFile_1.initFile)(params.path);
17
- const stream = pino_1.default.destination(params.path);
18
- this.logger = (0, pino_1.default)({
19
- enabled: params.level !== Level_1.Level.OFF,
20
- level: params.level ?? Level_1.Level.INFO,
10
+ initFile(params.path);
11
+ const stream = pino.destination(params.path);
12
+ this.logger = pino({
13
+ enabled: params.level !== Level.OFF,
14
+ level: params.level ?? Level.INFO,
21
15
  messageKey: 'message',
22
16
  formatters: {
23
17
  level(label, number) {
@@ -67,4 +61,4 @@ class FileLogger extends Logger_1.Logger {
67
61
  };
68
62
  }
69
63
  }
70
- exports.FileLogger = FileLogger;
64
+ export { FileLogger, };
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FileInitError = void 0;
4
- const BaseError_1 = require("../../../../error/BaseError");
5
- class FileInitError extends BaseError_1.BaseError {
1
+ import { BaseError } from '../../../../error/BaseError';
2
+ class FileInitError extends BaseError {
6
3
  constructor(path, message) {
7
4
  super(`failed initializing file "${path}": ${message}`);
8
5
  }
9
6
  }
10
- exports.FileInitError = FileInitError;
7
+ export { FileInitError, };
@@ -1,20 +1,14 @@
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.initFile = void 0;
7
- const fs_extra_1 = __importDefault(require("fs-extra"));
8
- const FileInitError_1 = require("./errors/FileInitError");
1
+ import fs from 'fs-extra';
2
+ import { FileInitError } from './errors/FileInitError';
9
3
  const initFile = (path) => {
10
4
  if (path === '') {
11
- throw new FileInitError_1.FileInitError('', 'empty path');
5
+ throw new FileInitError('', 'empty path');
12
6
  }
13
7
  try {
14
- fs_extra_1.default.ensureFileSync(path);
8
+ fs.ensureFileSync(path);
15
9
  }
16
10
  catch (error) {
17
- throw new FileInitError_1.FileInitError(path, error.message);
11
+ throw new FileInitError(path, error.message);
18
12
  }
19
13
  };
20
- exports.initFile = initFile;
14
+ export { initFile, };
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NoopLogger = void 0;
4
- const Logger_1 = require("../../Logger");
5
- class NoopLogger extends Logger_1.Logger {
1
+ import { Logger } from '../../Logger';
2
+ class NoopLogger extends Logger {
6
3
  trace() { }
7
4
  debug() { }
8
5
  info() { }
@@ -11,4 +8,4 @@ class NoopLogger extends Logger_1.Logger {
11
8
  fatal() { }
12
9
  async close() { }
13
10
  }
14
- exports.NoopLogger = NoopLogger;
11
+ export { NoopLogger, };
@@ -1,24 +1,18 @@
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.StdioLogger = void 0;
7
- const pino_1 = __importDefault(require("pino"));
8
- const pino_pretty_1 = __importDefault(require("pino-pretty"));
9
- const Level_1 = require("../../Level");
10
- const Logger_1 = require("../../Logger");
11
- class StdioLogger extends Logger_1.Logger {
1
+ import pino from 'pino';
2
+ import pretty from 'pino-pretty';
3
+ import { Level } from '../../Level';
4
+ import { Logger } from '../../Logger';
5
+ class StdioLogger extends Logger {
12
6
  logger;
13
7
  context;
14
8
  constructor(params) {
15
9
  super();
16
10
  const stream = params?.pretty
17
- ? (0, pino_pretty_1.default)()
18
- : pino_1.default.destination(process.stdout.fd);
19
- this.logger = (0, pino_1.default)({
20
- enabled: params?.level !== Level_1.Level.OFF,
21
- level: params?.level ?? Level_1.Level.INFO,
11
+ ? pretty()
12
+ : pino.destination(process.stdout.fd);
13
+ this.logger = pino({
14
+ enabled: params?.level !== Level.OFF,
15
+ level: params?.level ?? Level.INFO,
22
16
  messageKey: 'message',
23
17
  formatters: {
24
18
  level(label, number) {
@@ -70,4 +64,4 @@ class StdioLogger extends Logger_1.Logger {
70
64
  };
71
65
  }
72
66
  }
73
- exports.StdioLogger = StdioLogger;
67
+ export { StdioLogger, };
package/mailer/Address.js CHANGED
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
package/mailer/Event.js CHANGED
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
package/mailer/List.js CHANGED
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
package/mailer/Mail.js CHANGED
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
package/mailer/Mailer.js CHANGED
@@ -1,50 +1,47 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Mailer = void 0;
4
- const validateAddressEmail_1 = require("./validateAddressEmail");
5
- const validateEventAttachmentUrl_1 = require("./validateEventAttachmentUrl");
6
- const validateEventGeolocation_1 = require("./validateEventGeolocation");
7
- const validateEventUrl_1 = require("./validateEventUrl");
8
- const validateListUrl_1 = require("./validateListUrl");
1
+ import { validateAddressEmail } from './validateAddressEmail';
2
+ import { validateEventAttachmentUrl } from './validateEventAttachmentUrl';
3
+ import { validateEventGeolocation } from './validateEventGeolocation';
4
+ import { validateEventUrl } from './validateEventUrl';
5
+ import { validateListUrl } from './validateListUrl';
9
6
  class Mailer {
10
7
  async send(mail) {
11
- (0, validateAddressEmail_1.validateAddressEmail)(mail.from.email);
8
+ validateAddressEmail(mail.from.email);
12
9
  if (mail.sender) {
13
- (0, validateAddressEmail_1.validateAddressEmail)(mail.sender.email);
10
+ validateAddressEmail(mail.sender.email);
14
11
  }
15
12
  if (mail.replyTo) {
16
- (0, validateAddressEmail_1.validateAddressEmail)(mail.replyTo.email);
13
+ validateAddressEmail(mail.replyTo.email);
17
14
  }
18
15
  mail.to.forEach((address) => {
19
- (0, validateAddressEmail_1.validateAddressEmail)(address.email);
16
+ validateAddressEmail(address.email);
20
17
  });
21
18
  if (mail.cc) {
22
19
  mail.cc.forEach((address) => {
23
- (0, validateAddressEmail_1.validateAddressEmail)(address.email);
20
+ validateAddressEmail(address.email);
24
21
  });
25
22
  }
26
23
  if (mail.bcc) {
27
24
  mail.bcc.forEach((address) => {
28
- (0, validateAddressEmail_1.validateAddressEmail)(address.email);
25
+ validateAddressEmail(address.email);
29
26
  });
30
27
  }
31
28
  if (mail.event?.url) {
32
- (0, validateEventUrl_1.validateEventUrl)(mail.event.url);
29
+ validateEventUrl(mail.event.url);
33
30
  }
34
31
  if (mail.event?.location?.geo) {
35
- (0, validateEventGeolocation_1.validateEventGeolocation)(mail.event.location.geo.latitude, mail.event.location.geo.longitude);
32
+ validateEventGeolocation(mail.event.location.geo.latitude, mail.event.location.geo.longitude);
36
33
  }
37
34
  if (mail.event?.attachments) {
38
35
  mail.event.attachments.forEach((attachment) => {
39
- (0, validateEventAttachmentUrl_1.validateEventAttachmentUrl)(attachment);
36
+ validateEventAttachmentUrl(attachment);
40
37
  });
41
38
  }
42
39
  if (mail.list) {
43
40
  Object.entries(mail.list).forEach(([property, url]) => {
44
- (0, validateListUrl_1.validateListUrl)(property, url);
41
+ validateListUrl(property, url);
45
42
  });
46
43
  }
47
44
  return this.sendMail(mail);
48
45
  }
49
46
  }
50
- exports.Mailer = Mailer;
47
+ export { Mailer, };
package/mailer/Method.js CHANGED
@@ -1,8 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Method = void 0;
4
1
  var Method;
5
2
  (function (Method) {
6
3
  Method["PUBLISH"] = "PUBLISH";
7
4
  Method["CANCEL"] = "CANCEL";
8
- })(Method || (exports.Method = Method = {}));
5
+ })(Method || (Method = {}));
6
+ export { Method, };
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NoopMailer = void 0;
4
- const crypto_1 = require("crypto");
5
- const Mailer_1 = require("../../Mailer");
6
- class NoopMailer extends Mailer_1.Mailer {
1
+ import { randomUUID } from 'crypto';
2
+ import { Mailer } from '../../Mailer';
3
+ class NoopMailer extends Mailer {
7
4
  async sendMail(mail) {
8
- return `${(0, crypto_1.randomUUID)()}@${mail.from.email.split('@')[1]}`;
5
+ return `${randomUUID()}@${mail.from.email.split('@')[1]}`;
9
6
  }
10
7
  async close() { }
11
8
  }
12
- exports.NoopMailer = NoopMailer;
9
+ export { NoopMailer, };
@@ -1,25 +1,19 @@
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.SmtpMailer = void 0;
7
- const nodemailer_1 = __importDefault(require("nodemailer"));
8
- const getTls_1 = require("../../../tls/getTls");
9
- const Mailer_1 = require("../../Mailer");
10
- const getIcalendar_1 = require("../../getIcalendar");
11
- const getAddress_1 = require("./getAddress");
12
- const getAddresses_1 = require("./getAddresses");
13
- const getAttachments_1 = require("./getAttachments");
14
- class SmtpMailer extends Mailer_1.Mailer {
1
+ import nodemailer from 'nodemailer';
2
+ import { getTls } from '../../../tls/getTls';
3
+ import { Mailer } from '../../Mailer';
4
+ import { getIcalendar } from '../../getIcalendar';
5
+ import { getAddress } from './getAddress';
6
+ import { getAddresses } from './getAddresses';
7
+ import { getAttachments } from './getAttachments';
8
+ class SmtpMailer extends Mailer {
15
9
  transporter;
16
10
  constructor(params) {
17
11
  super();
18
- this.transporter = nodemailer_1.default.createTransport({
12
+ this.transporter = nodemailer.createTransport({
19
13
  host: params.host,
20
14
  port: params.port,
21
15
  secure: params.secure ?? false,
22
- tls: (0, getTls_1.getTls)(params.tls),
16
+ tls: getTls(params.tls),
23
17
  auth: params.user || params.password
24
18
  ? {
25
19
  user: params.user,
@@ -32,21 +26,21 @@ class SmtpMailer extends Mailer_1.Mailer {
32
26
  }
33
27
  async sendMail(mail) {
34
28
  const result = await this.transporter.sendMail({
35
- from: (0, getAddress_1.getAddress)(mail.from),
36
- sender: (0, getAddress_1.getAddress)(mail.sender),
37
- replyTo: (0, getAddress_1.getAddress)(mail.replyTo),
38
- to: (0, getAddresses_1.getAddresses)(mail.to),
39
- cc: (0, getAddresses_1.getAddresses)(mail.cc),
40
- bcc: (0, getAddresses_1.getAddresses)(mail.bcc),
29
+ from: getAddress(mail.from),
30
+ sender: getAddress(mail.sender),
31
+ replyTo: getAddress(mail.replyTo),
32
+ to: getAddresses(mail.to),
33
+ cc: getAddresses(mail.cc),
34
+ bcc: getAddresses(mail.bcc),
41
35
  subject: mail.subject,
42
36
  text: mail.text,
43
37
  html: mail.html,
44
- attachments: (0, getAttachments_1.getAttachments)(mail.attachments),
38
+ attachments: getAttachments(mail.attachments),
45
39
  icalEvent: mail.event
46
40
  ? {
47
41
  filename: mail.event.fileName ?? 'event.ics',
48
42
  method: mail.event.method,
49
- content: (0, getIcalendar_1.getIcalendar)(mail.event),
43
+ content: getIcalendar(mail.event),
50
44
  }
51
45
  : undefined,
52
46
  list: { ...mail.list },
@@ -57,4 +51,4 @@ class SmtpMailer extends Mailer_1.Mailer {
57
51
  this.transporter.close();
58
52
  }
59
53
  }
60
- exports.SmtpMailer = SmtpMailer;
54
+ export { SmtpMailer, };
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAddress = void 0;
4
1
  const getAddress = (address) => {
5
2
  return address
6
3
  ? {
@@ -9,4 +6,4 @@ const getAddress = (address) => {
9
6
  }
10
7
  : undefined;
11
8
  };
12
- exports.getAddress = getAddress;
9
+ export { getAddress, };
@@ -1,14 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAddresses = void 0;
4
- const getAddress_1 = require("./getAddress");
1
+ import { getAddress } from './getAddress';
5
2
  const getAddresses = (addresses) => {
6
3
  return addresses
7
4
  ? addresses
8
- .map(getAddress_1.getAddress)
5
+ .map(getAddress)
9
6
  .filter((address) => {
10
7
  return address !== undefined;
11
8
  })
12
9
  : [];
13
10
  };
14
- exports.getAddresses = getAddresses;
11
+ export { getAddresses, };
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAttachments = void 0;
4
1
  const getAttachments = (attachments) => {
5
2
  return attachments
6
3
  ? attachments
@@ -14,4 +11,4 @@ const getAttachments = (attachments) => {
14
11
  })
15
12
  : [];
16
13
  };
17
- exports.getAttachments = getAttachments;
14
+ export { getAttachments, };
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AddressEmailError = void 0;
4
- const BaseError_1 = require("../../error/BaseError");
5
- class AddressEmailError extends BaseError_1.BaseError {
1
+ import { BaseError } from '../../error/BaseError';
2
+ class AddressEmailError extends BaseError {
6
3
  constructor(email) {
7
4
  super(`invalid address email "${email}"`);
8
5
  }
9
6
  }
10
- exports.AddressEmailError = AddressEmailError;
7
+ export { AddressEmailError, };
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EventAttachmentUrlError = void 0;
4
- const BaseError_1 = require("../../error/BaseError");
5
- class EventAttachmentUrlError extends BaseError_1.BaseError {
1
+ import { BaseError } from '../../error/BaseError';
2
+ class EventAttachmentUrlError extends BaseError {
6
3
  constructor(url) {
7
4
  super(`invalid event attachment url "${url}"`);
8
5
  }
9
6
  }
10
- exports.EventAttachmentUrlError = EventAttachmentUrlError;
7
+ export { EventAttachmentUrlError, };
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EventGeolocationError = void 0;
4
- const BaseError_1 = require("../../error/BaseError");
5
- class EventGeolocationError extends BaseError_1.BaseError {
1
+ import { BaseError } from '../../error/BaseError';
2
+ class EventGeolocationError extends BaseError {
6
3
  constructor(latitude, longitude) {
7
4
  super(`invalid event geolocation "${latitude}, ${longitude}"`);
8
5
  }
9
6
  }
10
- exports.EventGeolocationError = EventGeolocationError;
7
+ export { EventGeolocationError, };
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EventUrlError = void 0;
4
- const BaseError_1 = require("../../error/BaseError");
5
- class EventUrlError extends BaseError_1.BaseError {
1
+ import { BaseError } from '../../error/BaseError';
2
+ class EventUrlError extends BaseError {
6
3
  constructor(url) {
7
4
  super(`invalid event url "${url}"`);
8
5
  }
9
6
  }
10
- exports.EventUrlError = EventUrlError;
7
+ export { EventUrlError, };
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ListUrlError = void 0;
4
- const BaseError_1 = require("../../error/BaseError");
5
- class ListUrlError extends BaseError_1.BaseError {
1
+ import { BaseError } from '../../error/BaseError';
2
+ class ListUrlError extends BaseError {
6
3
  constructor(property, url) {
7
4
  super(`invalid list ${property} url "${url}"`);
8
5
  }
9
6
  }
10
- exports.ListUrlError = ListUrlError;
7
+ export { ListUrlError, };
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getIcalendar = void 0;
4
- const ical_generator_1 = require("ical-generator");
1
+ import { ICalCalendar } from 'ical-generator';
5
2
  const getIcalendar = (event) => {
6
- const calendar = new ical_generator_1.ICalCalendar({
3
+ const calendar = new ICalCalendar({
7
4
  method: event.method,
8
5
  events: [
9
6
  {
@@ -32,4 +29,4 @@ const getIcalendar = (event) => {
32
29
  });
33
30
  return calendar.toString();
34
31
  };
35
- exports.getIcalendar = getIcalendar;
32
+ export { getIcalendar, };
@@ -1,11 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateAddressEmail = void 0;
4
- const isValidEmail_1 = require("utils/isValidEmail");
5
- const AddressEmailError_1 = require("./errors/AddressEmailError");
1
+ import { isValidEmail } from 'utils/isValidEmail';
2
+ import { AddressEmailError } from './errors/AddressEmailError';
6
3
  const validateAddressEmail = (email) => {
7
- if (!(0, isValidEmail_1.isValidEmail)(email)) {
8
- throw new AddressEmailError_1.AddressEmailError(email);
4
+ if (!isValidEmail(email)) {
5
+ throw new AddressEmailError(email);
9
6
  }
10
7
  };
11
- exports.validateAddressEmail = validateAddressEmail;
8
+ export { validateAddressEmail, };
@@ -1,11 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateEventAttachmentUrl = void 0;
4
- const isValidUrl_1 = require("utils/isValidUrl");
5
- const EventAttachmentUrlError_1 = require("./errors/EventAttachmentUrlError");
1
+ import { isValidUrl } from 'utils/isValidUrl';
2
+ import { EventAttachmentUrlError } from './errors/EventAttachmentUrlError';
6
3
  const validateEventAttachmentUrl = (url) => {
7
- if (!(0, isValidUrl_1.isValidUrl)(url)) {
8
- throw new EventAttachmentUrlError_1.EventAttachmentUrlError(url);
4
+ if (!isValidUrl(url)) {
5
+ throw new EventAttachmentUrlError(url);
9
6
  }
10
7
  };
11
- exports.validateEventAttachmentUrl = validateEventAttachmentUrl;
8
+ export { validateEventAttachmentUrl, };
@@ -1,11 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateEventGeolocation = void 0;
4
- const isValidGeolocation_1 = require("utils/isValidGeolocation");
5
- const EventGeolocationError_1 = require("./errors/EventGeolocationError");
1
+ import { isValidGeolocation } from 'utils/isValidGeolocation';
2
+ import { EventGeolocationError } from './errors/EventGeolocationError';
6
3
  const validateEventGeolocation = (latitude, longitude) => {
7
- if (!(0, isValidGeolocation_1.isValidGeolocation)(latitude, longitude)) {
8
- throw new EventGeolocationError_1.EventGeolocationError(latitude, longitude);
4
+ if (!isValidGeolocation(latitude, longitude)) {
5
+ throw new EventGeolocationError(latitude, longitude);
9
6
  }
10
7
  };
11
- exports.validateEventGeolocation = validateEventGeolocation;
8
+ export { validateEventGeolocation, };
@@ -1,11 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateEventUrl = void 0;
4
- const isValidUrl_1 = require("utils/isValidUrl");
5
- const EventUrlError_1 = require("./errors/EventUrlError");
1
+ import { isValidUrl } from 'utils/isValidUrl';
2
+ import { EventUrlError } from './errors/EventUrlError';
6
3
  const validateEventUrl = (url) => {
7
- if (!(0, isValidUrl_1.isValidUrl)(url)) {
8
- throw new EventUrlError_1.EventUrlError(url);
4
+ if (!isValidUrl(url)) {
5
+ throw new EventUrlError(url);
9
6
  }
10
7
  };
11
- exports.validateEventUrl = validateEventUrl;
8
+ export { validateEventUrl, };
@@ -1,11 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateListUrl = void 0;
4
- const isValidUrl_1 = require("utils/isValidUrl");
5
- const ListUrlError_1 = require("./errors/ListUrlError");
1
+ import { isValidUrl } from 'utils/isValidUrl';
2
+ import { ListUrlError } from './errors/ListUrlError';
6
3
  const validateListUrl = (property, url) => {
7
- if (!(0, isValidUrl_1.isValidUrl)(url)) {
8
- throw new ListUrlError_1.ListUrlError(property, url);
4
+ if (!isValidUrl(url)) {
5
+ throw new ListUrlError(property, url);
9
6
  }
10
7
  };
11
- exports.validateListUrl = validateListUrl;
8
+ export { validateListUrl, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apeframework",
3
- "version": "0.0.0-dev.20",
3
+ "version": "0.0.0-dev.21",
4
4
  "license": "MIT",
5
5
  "author": "Matthieu Symoens",
6
6
  "description": "Node.js app framework",
@@ -16,8 +16,7 @@
16
16
  "publishConfig": {
17
17
  "access": "public"
18
18
  },
19
- "main": "index.js",
20
- "types": "index.d.ts",
19
+ "type": "module",
21
20
  "engines": {
22
21
  "node": "^22"
23
22
  },
@@ -48,7 +47,6 @@
48
47
  },
49
48
  "peerDependencies": {
50
49
  "@types/node": "^22.10",
51
- "ts-node": "^10.9",
52
50
  "typescript": "^5.7"
53
51
  }
54
52
  }
package/parser/Parser.js CHANGED
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,10 +1,7 @@
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 {
1
+ import { BaseError } from '../../error/BaseError';
2
+ class ParseError extends BaseError {
6
3
  constructor(type) {
7
4
  super(`failed parsing ${type}`);
8
5
  }
9
6
  }
10
- exports.ParseError = ParseError;
7
+ export { ParseError, };