apeframework 0.0.0-dev.22 → 0.0.0-dev.24

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 (106) hide show
  1. package/dist/cipher/Cipher.d.ts +1 -1
  2. package/dist/cipher/Cipher.js +6 -6
  3. package/dist/cipher/errors/DecryptError.d.ts +1 -1
  4. package/dist/cipher/errors/DecryptError.js +1 -1
  5. package/dist/cipher/errors/SecretLengthError.d.ts +1 -1
  6. package/dist/cipher/errors/SecretLengthError.js +1 -1
  7. package/dist/cipher/validateSecretLength.d.ts +1 -1
  8. package/dist/cipher/validateSecretLength.js +2 -2
  9. package/dist/cli/Command.d.ts +1 -1
  10. package/dist/cli/getArgs.d.ts +1 -1
  11. package/dist/cli/getArgs.js +1 -1
  12. package/dist/cli/parseArgs.d.ts +1 -1
  13. package/dist/config/Properties.d.ts +1 -1
  14. package/dist/config/errors/FileReadError.d.ts +1 -1
  15. package/dist/config/errors/FileReadError.js +1 -1
  16. package/dist/config/errors/PropertyNameError.d.ts +1 -1
  17. package/dist/config/errors/PropertyNameError.js +1 -1
  18. package/dist/config/errors/PropertyParseError.d.ts +1 -1
  19. package/dist/config/errors/PropertyParseError.js +1 -1
  20. package/dist/config/getConfig.d.ts +4 -4
  21. package/dist/config/getConfig.js +4 -4
  22. package/dist/config/parseProperty.d.ts +1 -1
  23. package/dist/config/parseProperty.js +1 -1
  24. package/dist/config/readFile.js +1 -1
  25. package/dist/config/validatePropertyName.js +1 -1
  26. package/dist/env/errors/FileReadError.d.ts +1 -1
  27. package/dist/env/errors/FileReadError.js +1 -1
  28. package/dist/env/getEnv.d.ts +1 -1
  29. package/dist/env/getEnv.js +1 -1
  30. package/dist/env/readFile.d.ts +1 -1
  31. package/dist/env/readFile.js +1 -1
  32. package/dist/jwt/Jwt.d.ts +2 -2
  33. package/dist/jwt/Jwt.js +2 -2
  34. package/dist/jwt/errors/SecretLengthError.d.ts +1 -1
  35. package/dist/jwt/errors/SecretLengthError.js +1 -1
  36. package/dist/jwt/validateSecretLength.d.ts +1 -1
  37. package/dist/jwt/validateSecretLength.js +2 -2
  38. package/dist/logger/adapters/file/FileLogger.d.ts +2 -2
  39. package/dist/logger/adapters/file/FileLogger.js +4 -4
  40. package/dist/logger/adapters/file/errors/FileInitError.d.ts +1 -1
  41. package/dist/logger/adapters/file/errors/FileInitError.js +1 -1
  42. package/dist/logger/adapters/file/initFile.js +1 -1
  43. package/dist/logger/adapters/noop/NoopLogger.d.ts +1 -1
  44. package/dist/logger/adapters/noop/NoopLogger.js +1 -1
  45. package/dist/logger/adapters/stdio/StdioLogger.d.ts +2 -2
  46. package/dist/logger/adapters/stdio/StdioLogger.js +3 -3
  47. package/dist/mailer/Event.d.ts +2 -2
  48. package/dist/mailer/Mail.d.ts +4 -4
  49. package/dist/mailer/Mailer.d.ts +1 -1
  50. package/dist/mailer/Mailer.js +5 -5
  51. package/dist/mailer/adapters/noop/NoopMailer.d.ts +2 -2
  52. package/dist/mailer/adapters/noop/NoopMailer.js +1 -1
  53. package/dist/mailer/adapters/smtp/SmtpMailer.d.ts +3 -3
  54. package/dist/mailer/adapters/smtp/SmtpMailer.js +6 -6
  55. package/dist/mailer/adapters/smtp/getAddress.d.ts +5 -2
  56. package/dist/mailer/adapters/smtp/getAddresses.d.ts +5 -2
  57. package/dist/mailer/adapters/smtp/getAddresses.js +1 -1
  58. package/dist/mailer/adapters/smtp/getAttachments.d.ts +8 -2
  59. package/dist/mailer/errors/AddressEmailError.d.ts +1 -1
  60. package/dist/mailer/errors/AddressEmailError.js +1 -1
  61. package/dist/mailer/errors/EventAttachmentUrlError.d.ts +1 -1
  62. package/dist/mailer/errors/EventAttachmentUrlError.js +1 -1
  63. package/dist/mailer/errors/EventGeolocationError.d.ts +1 -1
  64. package/dist/mailer/errors/EventGeolocationError.js +1 -1
  65. package/dist/mailer/errors/EventUrlError.d.ts +1 -1
  66. package/dist/mailer/errors/EventUrlError.js +1 -1
  67. package/dist/mailer/errors/ListUrlError.d.ts +1 -1
  68. package/dist/mailer/errors/ListUrlError.js +1 -1
  69. package/dist/mailer/getIcalendar.d.ts +1 -1
  70. package/dist/mailer/validateAddressEmail.js +2 -2
  71. package/dist/mailer/validateEventAttachmentUrl.js +2 -2
  72. package/dist/mailer/validateEventGeolocation.js +2 -2
  73. package/dist/mailer/validateEventUrl.js +2 -2
  74. package/dist/mailer/validateListUrl.js +2 -2
  75. package/dist/parser/errors/ParseError.d.ts +1 -1
  76. package/dist/parser/errors/ParseError.js +1 -1
  77. package/dist/parser/factories/enum/createEnumParser.d.ts +4 -4
  78. package/dist/parser/factories/enum/createEnumParser.js +1 -1
  79. package/dist/parser/factories/unit/createUnitParser.d.ts +2 -2
  80. package/dist/parser/factories/unit/createUnitParser.js +3 -3
  81. package/dist/parser/parseBoolean.d.ts +1 -1
  82. package/dist/parser/parseBoolean.js +1 -1
  83. package/dist/parser/parseBytes.d.ts +1 -1
  84. package/dist/parser/parseBytes.js +1 -1
  85. package/dist/parser/parseInteger.d.ts +1 -1
  86. package/dist/parser/parseInteger.js +2 -2
  87. package/dist/parser/parseMilliseconds.d.ts +1 -1
  88. package/dist/parser/parseMilliseconds.js +1 -1
  89. package/dist/parser/parseNumber.d.ts +1 -1
  90. package/dist/parser/parseNumber.js +1 -1
  91. package/dist/parser/parseString.d.ts +1 -1
  92. package/dist/parser/parseString.js +1 -1
  93. package/dist/pwd/Pwd.js +1 -1
  94. package/dist/pwd/errors/HashRoundsError.d.ts +1 -1
  95. package/dist/pwd/errors/HashRoundsError.js +1 -1
  96. package/dist/pwd/validateHashRounds.js +1 -1
  97. package/dist/server/Route.d.ts +3 -3
  98. package/dist/server/Server.d.ts +6 -5
  99. package/dist/server/Server.js +5 -2
  100. package/dist/server/getAjv.d.ts +1 -1
  101. package/dist/tls/errors/FileReadError.d.ts +1 -1
  102. package/dist/tls/errors/FileReadError.js +1 -1
  103. package/dist/tls/getTls.d.ts +1 -1
  104. package/dist/tls/getTls.js +1 -1
  105. package/dist/tls/readFile.js +1 -1
  106. package/package.json +32 -33
@@ -1,4 +1,4 @@
1
- import type { Algorithm } from './Algorithm';
1
+ import type { Algorithm } from './Algorithm.js';
2
2
  declare class Cipher {
3
3
  private readonly algorithm;
4
4
  private readonly secret;
@@ -1,6 +1,6 @@
1
- import crypto from 'crypto';
2
- import { DecryptError } from './errors/DecryptError';
3
- import { validateSecretLength } from './validateSecretLength';
1
+ import { createCipheriv, createDecipheriv, randomBytes } from 'crypto';
2
+ import { DecryptError } from './errors/DecryptError.js';
3
+ import { validateSecretLength } from './validateSecretLength.js';
4
4
  class Cipher {
5
5
  algorithm;
6
6
  secret;
@@ -10,8 +10,8 @@ class Cipher {
10
10
  this.secret = Buffer.from(params.secret, 'utf8');
11
11
  }
12
12
  encrypt(string) {
13
- const iv = crypto.randomBytes(16);
14
- const cipher = crypto.createCipheriv(this.algorithm, this.secret, iv);
13
+ const iv = randomBytes(16);
14
+ const cipher = createCipheriv(this.algorithm, this.secret, iv);
15
15
  return iv.toString('hex')
16
16
  + cipher.update(string, 'utf8', 'hex')
17
17
  + cipher.final('hex');
@@ -19,7 +19,7 @@ class Cipher {
19
19
  decrypt(string) {
20
20
  const buffer = Buffer.from(string, 'hex');
21
21
  const iv = buffer.subarray(0, 16);
22
- const decipher = crypto.createDecipheriv(this.algorithm, this.secret, iv);
22
+ const decipher = createDecipheriv(this.algorithm, this.secret, iv);
23
23
  try {
24
24
  return decipher.update(buffer.subarray(16), undefined, 'utf8')
25
25
  + decipher.final('utf8');
@@ -1,4 +1,4 @@
1
- import { BaseError } from '../../error/BaseError';
1
+ import { BaseError } from '../../error/BaseError.js';
2
2
  declare class DecryptError extends BaseError {
3
3
  constructor(message: string);
4
4
  }
@@ -1,4 +1,4 @@
1
- import { BaseError } from '../../error/BaseError';
1
+ import { BaseError } from '../../error/BaseError.js';
2
2
  class DecryptError extends BaseError {
3
3
  constructor(message) {
4
4
  super(`failed decrypting string: ${message}`);
@@ -1,4 +1,4 @@
1
- import { BaseError } from '../../error/BaseError';
1
+ import { BaseError } from '../../error/BaseError.js';
2
2
  declare class SecretLengthError extends BaseError {
3
3
  constructor();
4
4
  }
@@ -1,4 +1,4 @@
1
- import { BaseError } from '../../error/BaseError';
1
+ import { BaseError } from '../../error/BaseError.js';
2
2
  class SecretLengthError extends BaseError {
3
3
  constructor() {
4
4
  super('invalid secret length');
@@ -1,3 +1,3 @@
1
- import { Algorithm } from './Algorithm';
1
+ import { Algorithm } from './Algorithm.js';
2
2
  declare const validateSecretLength: (algorithm: Algorithm, secret: string) => void;
3
3
  export { validateSecretLength, };
@@ -1,5 +1,5 @@
1
- import { Algorithm } from './Algorithm';
2
- import { SecretLengthError } from './errors/SecretLengthError';
1
+ import { Algorithm } from './Algorithm.js';
2
+ import { SecretLengthError } from './errors/SecretLengthError.js';
3
3
  const secretLength = {
4
4
  [Algorithm.AES128]: 16,
5
5
  [Algorithm.AES192]: 24,
@@ -1,3 +1,3 @@
1
- import type { Args } from './Args';
1
+ import type { Args } from './Args.js';
2
2
  type Command = (args: Args) => Promise<void>;
3
3
  export { type Command, };
@@ -1,3 +1,3 @@
1
- import type { Args } from './Args';
1
+ import type { Args } from './Args.js';
2
2
  declare const getArgs: () => Args;
3
3
  export { getArgs, };
@@ -1,4 +1,4 @@
1
- import { parseArgs } from './parseArgs';
1
+ import { parseArgs } from './parseArgs.js';
2
2
  const getArgs = () => {
3
3
  return parseArgs(process.argv.slice(2));
4
4
  };
@@ -1,3 +1,3 @@
1
- import type { Args } from './Args';
1
+ import type { Args } from './Args.js';
2
2
  declare const parseArgs: (args: string[]) => Args;
3
3
  export { parseArgs, };
@@ -1,4 +1,4 @@
1
- import type { Parser } from '../parser/Parser';
1
+ import type { Parser } from '../parser/Parser.js';
2
2
  type Properties<Type> = {
3
3
  [Property in keyof Type]: {
4
4
  parser: Parser<Type[Property]>;
@@ -1,4 +1,4 @@
1
- import { BaseError } from '../../error/BaseError';
1
+ import { BaseError } from '../../error/BaseError.js';
2
2
  declare class FileReadError extends BaseError {
3
3
  constructor(path: string, message: string);
4
4
  }
@@ -1,4 +1,4 @@
1
- import { BaseError } from '../../error/BaseError';
1
+ import { BaseError } from '../../error/BaseError.js';
2
2
  class FileReadError extends BaseError {
3
3
  constructor(path, message) {
4
4
  super(`failed reading file "${path}": ${message}`);
@@ -1,4 +1,4 @@
1
- import { BaseError } from '../../error/BaseError';
1
+ import { BaseError } from '../../error/BaseError.js';
2
2
  declare class PropertyNameError extends BaseError {
3
3
  constructor(name: string);
4
4
  }
@@ -1,4 +1,4 @@
1
- import { BaseError } from '../../error/BaseError';
1
+ import { BaseError } from '../../error/BaseError.js';
2
2
  class PropertyNameError extends BaseError {
3
3
  constructor(name) {
4
4
  super(`invalid property name "${name}"`);
@@ -1,4 +1,4 @@
1
- import { BaseError } from '../../error/BaseError';
1
+ import { BaseError } from '../../error/BaseError.js';
2
2
  declare class PropertyParseError extends BaseError {
3
3
  constructor(name: string, source: string, message: string);
4
4
  }
@@ -1,4 +1,4 @@
1
- import { BaseError } from '../../error/BaseError';
1
+ import { BaseError } from '../../error/BaseError.js';
2
2
  class PropertyParseError extends BaseError {
3
3
  constructor(name, source, message) {
4
4
  super(`failed parsing property "${name}" from ${source}: ${message}`);
@@ -1,7 +1,7 @@
1
- import type { Config } from './Config';
2
- import type { Properties } from './Properties';
3
- import type { Args } from '../cli/Args';
4
- import type { Env } from '../env/Env';
1
+ import type { Config } from './Config.js';
2
+ import type { Properties } from './Properties.js';
3
+ import type { Args } from '../cli/Args.js';
4
+ import type { Env } from '../env/Env.js';
5
5
  declare const getConfig: <Type extends Config>(params: {
6
6
  properties: Properties<Type>;
7
7
  file?: {
@@ -1,7 +1,7 @@
1
- import { getPropertyEnvVar } from './getPropertyEnvVar';
2
- import { parseProperty } from './parseProperty';
3
- import { readFile } from './readFile';
4
- import { validatePropertyName } from './validatePropertyName';
1
+ import { getPropertyEnvVar } from './getPropertyEnvVar.js';
2
+ import { parseProperty } from './parseProperty.js';
3
+ import { readFile } from './readFile.js';
4
+ import { validatePropertyName } from './validatePropertyName.js';
5
5
  const getConfig = (params) => {
6
6
  const file = params.file
7
7
  ? readFile(params.file.path, params.file.required)
@@ -1,3 +1,3 @@
1
- import type { Parser } from '../parser/Parser';
1
+ import type { Parser } from '../parser/Parser.js';
2
2
  declare const parseProperty: <Type>(name: string, parser: Parser<Type>, defaultValue: any, fileValue: any, envValue: any, argsValue: any) => Type;
3
3
  export { parseProperty, };
@@ -1,4 +1,4 @@
1
- import { PropertyParseError } from './errors/PropertyParseError';
1
+ import { PropertyParseError } from './errors/PropertyParseError.js';
2
2
  const parseProperty = (name, parser, defaultValue, fileValue, envValue, argsValue) => {
3
3
  const sources = [
4
4
  {
@@ -1,5 +1,5 @@
1
1
  import fs from 'fs-extra';
2
- import { FileReadError } from './errors/FileReadError';
2
+ import { FileReadError } from './errors/FileReadError.js';
3
3
  const readFile = (path, required = false) => {
4
4
  let json = {};
5
5
  let fileExists;
@@ -1,4 +1,4 @@
1
- import { PropertyNameError } from './errors/PropertyNameError';
1
+ import { PropertyNameError } from './errors/PropertyNameError.js';
2
2
  const propertyNameRegex = /^[a-z](?:[0-9A-Za-z])*$/u;
3
3
  const validatePropertyName = (name) => {
4
4
  if (!propertyNameRegex.test(name)) {
@@ -1,4 +1,4 @@
1
- import { BaseError } from '../../error/BaseError';
1
+ import { BaseError } from '../../error/BaseError.js';
2
2
  declare class FileReadError extends BaseError {
3
3
  constructor(path: string, message: string);
4
4
  }
@@ -1,4 +1,4 @@
1
- import { BaseError } from '../../error/BaseError';
1
+ import { BaseError } from '../../error/BaseError.js';
2
2
  class FileReadError extends BaseError {
3
3
  constructor(path, message) {
4
4
  super(`failed reading file "${path}": ${message}`);
@@ -1,4 +1,4 @@
1
- import type { Env } from './Env';
1
+ import type { Env } from './Env.js';
2
2
  declare const getEnv: (params?: {
3
3
  file?: {
4
4
  path: string;
@@ -1,4 +1,4 @@
1
- import { readFile } from './readFile';
1
+ import { readFile } from './readFile.js';
2
2
  const getEnv = (params) => {
3
3
  let file = {};
4
4
  if (params?.file) {
@@ -1,3 +1,3 @@
1
- import type { Env } from './Env';
1
+ import type { Env } from './Env.js';
2
2
  declare const readFile: (path: string, required?: boolean) => Env;
3
3
  export { readFile, };
@@ -1,6 +1,6 @@
1
1
  import dotenv from 'dotenv';
2
2
  import fs from 'fs-extra';
3
- import { FileReadError } from './errors/FileReadError';
3
+ import { FileReadError } from './errors/FileReadError.js';
4
4
  const readFile = (path, required = false) => {
5
5
  try {
6
6
  if (fs.existsSync(path)) {
package/dist/jwt/Jwt.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { Algorithm } from './Algorithm';
2
- import type { Payload } from './Payload';
1
+ import type { Algorithm } from './Algorithm.js';
2
+ import type { Payload } from './Payload.js';
3
3
  declare class Jwt {
4
4
  private readonly algorithm;
5
5
  private readonly secret;
package/dist/jwt/Jwt.js CHANGED
@@ -1,5 +1,5 @@
1
- import { SignJWT, jwtVerify } from 'jose';
2
- import { validateSecretLength } from './validateSecretLength';
1
+ import { jwtVerify, SignJWT } from 'jose';
2
+ import { validateSecretLength } from './validateSecretLength.js';
3
3
  class Jwt {
4
4
  algorithm;
5
5
  secret;
@@ -1,4 +1,4 @@
1
- import { BaseError } from '../../error/BaseError';
1
+ import { BaseError } from '../../error/BaseError.js';
2
2
  declare class SecretLengthError extends BaseError {
3
3
  constructor();
4
4
  }
@@ -1,4 +1,4 @@
1
- import { BaseError } from '../../error/BaseError';
1
+ import { BaseError } from '../../error/BaseError.js';
2
2
  class SecretLengthError extends BaseError {
3
3
  constructor() {
4
4
  super('invalid secret length');
@@ -1,3 +1,3 @@
1
- import { Algorithm } from './Algorithm';
1
+ import { Algorithm } from './Algorithm.js';
2
2
  declare const validateSecretLength: (algorithm: Algorithm, secret: string) => void;
3
3
  export { validateSecretLength, };
@@ -1,5 +1,5 @@
1
- import { Algorithm } from './Algorithm';
2
- import { SecretLengthError } from './errors/SecretLengthError';
1
+ import { Algorithm } from './Algorithm.js';
2
+ import { SecretLengthError } from './errors/SecretLengthError.js';
3
3
  const minSecretLength = {
4
4
  [Algorithm.HS256]: 32,
5
5
  [Algorithm.HS384]: 48,
@@ -1,5 +1,5 @@
1
- import { Level } from '../../Level';
2
- import { Logger } from '../../Logger';
1
+ import { Level } from '../../Level.js';
2
+ import { Logger } from '../../Logger.js';
3
3
  declare class FileLogger extends Logger {
4
4
  private readonly logger;
5
5
  private readonly context;
@@ -1,7 +1,7 @@
1
- import pino from 'pino';
2
- import { Level } from '../../Level';
3
- import { Logger } from '../../Logger';
4
- import { initFile } from './initFile';
1
+ import { pino } from 'pino';
2
+ import { Level } from '../../Level.js';
3
+ import { Logger } from '../../Logger.js';
4
+ import { initFile } from './initFile.js';
5
5
  class FileLogger extends Logger {
6
6
  logger;
7
7
  context;
@@ -1,4 +1,4 @@
1
- import { BaseError } from '../../../../error/BaseError';
1
+ import { BaseError } from '../../../../error/BaseError.js';
2
2
  declare class FileInitError extends BaseError {
3
3
  constructor(path: string, message: string);
4
4
  }
@@ -1,4 +1,4 @@
1
- import { BaseError } from '../../../../error/BaseError';
1
+ import { BaseError } from '../../../../error/BaseError.js';
2
2
  class FileInitError extends BaseError {
3
3
  constructor(path, message) {
4
4
  super(`failed initializing file "${path}": ${message}`);
@@ -1,5 +1,5 @@
1
1
  import fs from 'fs-extra';
2
- import { FileInitError } from './errors/FileInitError';
2
+ import { FileInitError } from './errors/FileInitError.js';
3
3
  const initFile = (path) => {
4
4
  if (path === '') {
5
5
  throw new FileInitError('', 'empty path');
@@ -1,4 +1,4 @@
1
- import { Logger } from '../../Logger';
1
+ import { Logger } from '../../Logger.js';
2
2
  declare class NoopLogger extends Logger {
3
3
  trace(): void;
4
4
  debug(): void;
@@ -1,4 +1,4 @@
1
- import { Logger } from '../../Logger';
1
+ import { Logger } from '../../Logger.js';
2
2
  class NoopLogger extends Logger {
3
3
  trace() { }
4
4
  debug() { }
@@ -1,5 +1,5 @@
1
- import { Level } from '../../Level';
2
- import { Logger } from '../../Logger';
1
+ import { Level } from '../../Level.js';
2
+ import { Logger } from '../../Logger.js';
3
3
  declare class StdioLogger extends Logger {
4
4
  private readonly logger;
5
5
  private readonly context;
@@ -1,7 +1,7 @@
1
- import pino from 'pino';
1
+ import { pino } from 'pino';
2
2
  import pretty from 'pino-pretty';
3
- import { Level } from '../../Level';
4
- import { Logger } from '../../Logger';
3
+ import { Level } from '../../Level.js';
4
+ import { Logger } from '../../Logger.js';
5
5
  class StdioLogger extends Logger {
6
6
  logger;
7
7
  context;
@@ -1,5 +1,5 @@
1
- import type { Location } from './Location';
2
- import type { Method } from './Method';
1
+ import type { Location } from './Location.js';
2
+ import type { Method } from './Method.js';
3
3
  interface Event {
4
4
  fileName?: string;
5
5
  method: Method;
@@ -1,7 +1,7 @@
1
- import type { Address } from './Address';
2
- import type { Attachment } from './Attachment';
3
- import type { Event } from './Event';
4
- import type { List } from './List';
1
+ import type { Address } from './Address.js';
2
+ import type { Attachment } from './Attachment.js';
3
+ import type { Event } from './Event.js';
4
+ import type { List } from './List.js';
5
5
  interface Mail {
6
6
  from: Address;
7
7
  sender?: Address;
@@ -1,4 +1,4 @@
1
- import type { Mail } from './Mail';
1
+ import type { Mail } from './Mail.js';
2
2
  declare abstract class Mailer {
3
3
  send(mail: Mail): Promise<string>;
4
4
  abstract sendMail(mail: Mail): Promise<string>;
@@ -1,8 +1,8 @@
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';
1
+ import { validateAddressEmail } from './validateAddressEmail.js';
2
+ import { validateEventAttachmentUrl } from './validateEventAttachmentUrl.js';
3
+ import { validateEventGeolocation } from './validateEventGeolocation.js';
4
+ import { validateEventUrl } from './validateEventUrl.js';
5
+ import { validateListUrl } from './validateListUrl.js';
6
6
  class Mailer {
7
7
  async send(mail) {
8
8
  validateAddressEmail(mail.from.email);
@@ -1,5 +1,5 @@
1
- import { Mailer } from '../../Mailer';
2
- import type { Mail } from '../../Mail';
1
+ import { Mailer } from '../../Mailer.js';
2
+ import type { Mail } from '../../Mail.js';
3
3
  declare class NoopMailer extends Mailer {
4
4
  sendMail(mail: Mail): Promise<string>;
5
5
  close(): Promise<void>;
@@ -1,5 +1,5 @@
1
1
  import { randomUUID } from 'crypto';
2
- import { Mailer } from '../../Mailer';
2
+ import { Mailer } from '../../Mailer.js';
3
3
  class NoopMailer extends Mailer {
4
4
  async sendMail(mail) {
5
5
  return `${randomUUID()}@${mail.from.email.split('@')[1]}`;
@@ -1,6 +1,6 @@
1
- import { Mailer } from '../../Mailer';
2
- import type { Tls } from '../../../tls/Tls';
3
- import type { Mail } from '../../Mail';
1
+ import { Mailer } from '../../Mailer.js';
2
+ import type { Tls } from '../../../tls/Tls.js';
3
+ import type { Mail } from '../../Mail.js';
4
4
  declare class SmtpMailer extends Mailer {
5
5
  private readonly transporter;
6
6
  constructor(params: {
@@ -1,10 +1,10 @@
1
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';
2
+ import { getTls } from '../../../tls/getTls.js';
3
+ import { getIcalendar } from '../../getIcalendar.js';
4
+ import { Mailer } from '../../Mailer.js';
5
+ import { getAddress } from './getAddress.js';
6
+ import { getAddresses } from './getAddresses.js';
7
+ import { getAttachments } from './getAttachments.js';
8
8
  class SmtpMailer extends Mailer {
9
9
  transporter;
10
10
  constructor(params) {
@@ -1,4 +1,7 @@
1
- import type { Address } from '../../Address';
2
- import type { Address as NodemailerAddress } from 'nodemailer/lib/mailer';
1
+ import type { Address } from '../../Address.js';
2
+ interface NodemailerAddress {
3
+ address: string;
4
+ name: string;
5
+ }
3
6
  declare const getAddress: (address?: Address) => NodemailerAddress | undefined;
4
7
  export { getAddress, };
@@ -1,4 +1,7 @@
1
- import type { Address } from '../../Address';
2
- import type { Address as NodemailerAddress } from 'nodemailer/lib/mailer';
1
+ import type { Address } from '../../Address.js';
2
+ interface NodemailerAddress {
3
+ address: string;
4
+ name: string;
5
+ }
3
6
  declare const getAddresses: (addresses?: Address[]) => NodemailerAddress[];
4
7
  export { getAddresses, };
@@ -1,4 +1,4 @@
1
- import { getAddress } from './getAddress';
1
+ import { getAddress } from './getAddress.js';
2
2
  const getAddresses = (addresses) => {
3
3
  return addresses
4
4
  ? addresses
@@ -1,4 +1,10 @@
1
- import type { Attachment } from '../../Attachment';
2
- import type { Attachment as NodemailerAttachment } from 'nodemailer/lib/mailer';
1
+ import type { Attachment } from '../../Attachment.js';
2
+ import type { Readable } from 'stream';
3
+ interface NodemailerAttachment {
4
+ filename: string;
5
+ cid: string;
6
+ contentType: string | undefined;
7
+ content: Buffer | Readable | string;
8
+ }
3
9
  declare const getAttachments: (attachments?: Attachment[]) => NodemailerAttachment[];
4
10
  export { getAttachments, };
@@ -1,4 +1,4 @@
1
- import { BaseError } from '../../error/BaseError';
1
+ import { BaseError } from '../../error/BaseError.js';
2
2
  declare class AddressEmailError extends BaseError {
3
3
  constructor(email: string);
4
4
  }
@@ -1,4 +1,4 @@
1
- import { BaseError } from '../../error/BaseError';
1
+ import { BaseError } from '../../error/BaseError.js';
2
2
  class AddressEmailError extends BaseError {
3
3
  constructor(email) {
4
4
  super(`invalid address email "${email}"`);
@@ -1,4 +1,4 @@
1
- import { BaseError } from '../../error/BaseError';
1
+ import { BaseError } from '../../error/BaseError.js';
2
2
  declare class EventAttachmentUrlError extends BaseError {
3
3
  constructor(url: string);
4
4
  }
@@ -1,4 +1,4 @@
1
- import { BaseError } from '../../error/BaseError';
1
+ import { BaseError } from '../../error/BaseError.js';
2
2
  class EventAttachmentUrlError extends BaseError {
3
3
  constructor(url) {
4
4
  super(`invalid event attachment url "${url}"`);
@@ -1,4 +1,4 @@
1
- import { BaseError } from '../../error/BaseError';
1
+ import { BaseError } from '../../error/BaseError.js';
2
2
  declare class EventGeolocationError extends BaseError {
3
3
  constructor(latitude: number, longitude: number);
4
4
  }
@@ -1,4 +1,4 @@
1
- import { BaseError } from '../../error/BaseError';
1
+ import { BaseError } from '../../error/BaseError.js';
2
2
  class EventGeolocationError extends BaseError {
3
3
  constructor(latitude, longitude) {
4
4
  super(`invalid event geolocation "${latitude}, ${longitude}"`);
@@ -1,4 +1,4 @@
1
- import { BaseError } from '../../error/BaseError';
1
+ import { BaseError } from '../../error/BaseError.js';
2
2
  declare class EventUrlError extends BaseError {
3
3
  constructor(url: string);
4
4
  }
@@ -1,4 +1,4 @@
1
- import { BaseError } from '../../error/BaseError';
1
+ import { BaseError } from '../../error/BaseError.js';
2
2
  class EventUrlError extends BaseError {
3
3
  constructor(url) {
4
4
  super(`invalid event url "${url}"`);
@@ -1,4 +1,4 @@
1
- import { BaseError } from '../../error/BaseError';
1
+ import { BaseError } from '../../error/BaseError.js';
2
2
  declare class ListUrlError extends BaseError {
3
3
  constructor(property: string, url: string);
4
4
  }
@@ -1,4 +1,4 @@
1
- import { BaseError } from '../../error/BaseError';
1
+ import { BaseError } from '../../error/BaseError.js';
2
2
  class ListUrlError extends BaseError {
3
3
  constructor(property, url) {
4
4
  super(`invalid list ${property} url "${url}"`);
@@ -1,3 +1,3 @@
1
- import type { Event } from './Event';
1
+ import type { Event } from './Event.js';
2
2
  declare const getIcalendar: (event: Event) => string;
3
3
  export { getIcalendar, };
@@ -1,5 +1,5 @@
1
- import { isValidEmail } from 'utils/isValidEmail';
2
- import { AddressEmailError } from './errors/AddressEmailError';
1
+ import { isValidEmail } from '../utils/isValidEmail.js';
2
+ import { AddressEmailError } from './errors/AddressEmailError.js';
3
3
  const validateAddressEmail = (email) => {
4
4
  if (!isValidEmail(email)) {
5
5
  throw new AddressEmailError(email);
@@ -1,5 +1,5 @@
1
- import { isValidUrl } from 'utils/isValidUrl';
2
- import { EventAttachmentUrlError } from './errors/EventAttachmentUrlError';
1
+ import { isValidUrl } from '../utils/isValidUrl.js';
2
+ import { EventAttachmentUrlError } from './errors/EventAttachmentUrlError.js';
3
3
  const validateEventAttachmentUrl = (url) => {
4
4
  if (!isValidUrl(url)) {
5
5
  throw new EventAttachmentUrlError(url);
@@ -1,5 +1,5 @@
1
- import { isValidGeolocation } from 'utils/isValidGeolocation';
2
- import { EventGeolocationError } from './errors/EventGeolocationError';
1
+ import { isValidGeolocation } from '../utils/isValidGeolocation.js';
2
+ import { EventGeolocationError } from './errors/EventGeolocationError.js';
3
3
  const validateEventGeolocation = (latitude, longitude) => {
4
4
  if (!isValidGeolocation(latitude, longitude)) {
5
5
  throw new EventGeolocationError(latitude, longitude);
@@ -1,5 +1,5 @@
1
- import { isValidUrl } from 'utils/isValidUrl';
2
- import { EventUrlError } from './errors/EventUrlError';
1
+ import { isValidUrl } from '../utils/isValidUrl.js';
2
+ import { EventUrlError } from './errors/EventUrlError.js';
3
3
  const validateEventUrl = (url) => {
4
4
  if (!isValidUrl(url)) {
5
5
  throw new EventUrlError(url);
@@ -1,5 +1,5 @@
1
- import { isValidUrl } from 'utils/isValidUrl';
2
- import { ListUrlError } from './errors/ListUrlError';
1
+ import { isValidUrl } from '../utils/isValidUrl.js';
2
+ import { ListUrlError } from './errors/ListUrlError.js';
3
3
  const validateListUrl = (property, url) => {
4
4
  if (!isValidUrl(url)) {
5
5
  throw new ListUrlError(property, url);
@@ -1,4 +1,4 @@
1
- import { BaseError } from '../../error/BaseError';
1
+ import { BaseError } from '../../error/BaseError.js';
2
2
  declare class ParseError extends BaseError {
3
3
  constructor(type: string);
4
4
  }
@@ -1,4 +1,4 @@
1
- import { BaseError } from '../../error/BaseError';
1
+ import { BaseError } from '../../error/BaseError.js';
2
2
  class ParseError extends BaseError {
3
3
  constructor(type) {
4
4
  super(`failed parsing ${type}`);
@@ -1,6 +1,6 @@
1
- import type { Parser } from '../../Parser';
2
- declare const createEnumParser: <Type extends Record<string, string | number>>(params: {
1
+ import type { Parser } from '../../Parser.js';
2
+ declare const createEnumParser: <Enum extends Record<string, string | number>>(params: {
3
3
  type: string;
4
- enum: Type;
5
- }) => Parser<Type[keyof Type]>;
4
+ enum: Enum;
5
+ }) => Parser<Enum[keyof Enum]>;
6
6
  export { createEnumParser, };
@@ -1,4 +1,4 @@
1
- import { ParseError } from '../../errors/ParseError';
1
+ import { ParseError } from '../../errors/ParseError.js';
2
2
  const createEnumParser = (params) => {
3
3
  return (input) => {
4
4
  if (!Object.values(params.enum).includes(input)) {
@@ -1,5 +1,5 @@
1
- import type { Unit } from './Unit';
2
- import type { Parser } from '../../Parser';
1
+ import type { Unit } from './Unit.js';
2
+ import type { Parser } from '../../Parser.js';
3
3
  declare const createUnitParser: (params: {
4
4
  type: string;
5
5
  units: Unit[];
@@ -1,6 +1,6 @@
1
- import { ParseError } from '../../errors/ParseError';
2
- import { parseNumber } from '../../parseNumber';
3
- import { parseString } from '../../parseString';
1
+ import { ParseError } from '../../errors/ParseError.js';
2
+ import { parseNumber } from '../../parseNumber.js';
3
+ import { parseString } from '../../parseString.js';
4
4
  const createUnitParser = (params) => {
5
5
  return (input) => {
6
6
  let string;
@@ -1,3 +1,3 @@
1
- import type { Parser } from './Parser';
1
+ import type { Parser } from './Parser.js';
2
2
  declare const parseBoolean: Parser<boolean>;
3
3
  export { parseBoolean, };
@@ -1,4 +1,4 @@
1
- import { ParseError } from './errors/ParseError';
1
+ import { ParseError } from './errors/ParseError.js';
2
2
  const parseBoolean = (input) => {
3
3
  if ([
4
4
  true,
@@ -1,2 +1,2 @@
1
- declare const parseBytes: import("./Parser").Parser<number>;
1
+ declare const parseBytes: import("./Parser.js").Parser<number>;
2
2
  export { parseBytes, };
@@ -1,4 +1,4 @@
1
- import { createUnitParser } from './factories/unit/createUnitParser';
1
+ import { createUnitParser } from './factories/unit/createUnitParser.js';
2
2
  const parseBytes = createUnitParser({
3
3
  type: 'bytes',
4
4
  units: [
@@ -1,3 +1,3 @@
1
- import type { Parser } from './Parser';
1
+ import type { Parser } from './Parser.js';
2
2
  declare const parseInteger: Parser<number>;
3
3
  export { parseInteger, };
@@ -1,5 +1,5 @@
1
- import { ParseError } from './errors/ParseError';
2
- import { parseNumber } from './parseNumber';
1
+ import { ParseError } from './errors/ParseError.js';
2
+ import { parseNumber } from './parseNumber.js';
3
3
  const parseInteger = (input) => {
4
4
  let number;
5
5
  try {
@@ -1,2 +1,2 @@
1
- declare const parseMilliseconds: import("./Parser").Parser<number>;
1
+ declare const parseMilliseconds: import("./Parser.js").Parser<number>;
2
2
  export { parseMilliseconds, };
@@ -1,4 +1,4 @@
1
- import { createUnitParser } from './factories/unit/createUnitParser';
1
+ import { createUnitParser } from './factories/unit/createUnitParser.js';
2
2
  const parseMilliseconds = createUnitParser({
3
3
  type: 'milliseconds',
4
4
  units: [
@@ -1,3 +1,3 @@
1
- import type { Parser } from './Parser';
1
+ import type { Parser } from './Parser.js';
2
2
  declare const parseNumber: Parser<number>;
3
3
  export { parseNumber, };
@@ -1,4 +1,4 @@
1
- import { ParseError } from './errors/ParseError';
1
+ import { ParseError } from './errors/ParseError.js';
2
2
  const parseNumber = (input) => {
3
3
  if ([undefined, null].includes(input)) {
4
4
  return 0;
@@ -1,3 +1,3 @@
1
- import type { Parser } from './Parser';
1
+ import type { Parser } from './Parser.js';
2
2
  declare const parseString: Parser<string>;
3
3
  export { parseString, };
@@ -1,4 +1,4 @@
1
- import { ParseError } from './errors/ParseError';
1
+ import { ParseError } from './errors/ParseError.js';
2
2
  const parseString = (input) => {
3
3
  if ([undefined, null].includes(input)) {
4
4
  return '';
package/dist/pwd/Pwd.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import bcrypt from 'bcryptjs';
2
- import { validateHashRounds } from './validateHashRounds';
2
+ import { validateHashRounds } from './validateHashRounds.js';
3
3
  class Pwd {
4
4
  hashRounds;
5
5
  constructor(params) {
@@ -1,4 +1,4 @@
1
- import { BaseError } from '../../error/BaseError';
1
+ import { BaseError } from '../../error/BaseError.js';
2
2
  declare class HashRoundsError extends BaseError {
3
3
  constructor(hashRounds: number);
4
4
  }
@@ -1,4 +1,4 @@
1
- import { BaseError } from '../../error/BaseError';
1
+ import { BaseError } from '../../error/BaseError.js';
2
2
  class HashRoundsError extends BaseError {
3
3
  constructor(hashRounds) {
4
4
  super(`invalid hash rounds "${hashRounds}"`);
@@ -1,4 +1,4 @@
1
- import { HashRoundsError } from './errors/HashRoundsError';
1
+ import { HashRoundsError } from './errors/HashRoundsError.js';
2
2
  const validateHashRounds = (hashRounds) => {
3
3
  if (hashRounds < 1) {
4
4
  throw new HashRoundsError(hashRounds);
@@ -1,6 +1,6 @@
1
- import type { Handler } from './Handler';
2
- import type { Method } from './Method';
3
- import type { Schema } from './Schema';
1
+ import type { Handler } from './Handler.js';
2
+ import type { Method } from './Method.js';
3
+ import type { Schema } from './Schema.js';
4
4
  interface Route {
5
5
  path: string;
6
6
  method: Method;
@@ -1,8 +1,8 @@
1
- import { OpenApiFormat } from './OpenApiFormat';
2
- import type { ErrorHandler } from './ErrorHandler';
3
- import type { Format } from './Format';
4
- import type { Handler } from './Handler';
5
- import type { Route } from './Route';
1
+ import { OpenApiFormat } from './OpenApiFormat.js';
2
+ import type { ErrorHandler } from './ErrorHandler.js';
3
+ import type { Format } from './Format.js';
4
+ import type { Handler } from './Handler.js';
5
+ import type { Route } from './Route.js';
6
6
  import type { OpenAPIV3 } from 'openapi-types';
7
7
  declare class Server {
8
8
  private readonly server;
@@ -32,6 +32,7 @@ declare class Server {
32
32
  onError?: ErrorHandler;
33
33
  });
34
34
  start(): Promise<string>;
35
+ close(): Promise<void>;
35
36
  openapi(format: OpenApiFormat): OpenAPIV3.Document;
36
37
  }
37
38
  export { Server, };
@@ -3,8 +3,8 @@ import cors from '@fastify/cors';
3
3
  import responseValidation from '@fastify/response-validation';
4
4
  import swagger from '@fastify/swagger';
5
5
  import fastify from 'fastify';
6
- import { OpenApiFormat } from './OpenApiFormat';
7
- import { getAjv } from './getAjv';
6
+ import { getAjv } from './getAjv.js';
7
+ import { OpenApiFormat } from './OpenApiFormat.js';
8
8
  class Server {
9
9
  server;
10
10
  host;
@@ -77,6 +77,9 @@ class Server {
77
77
  port: this.port,
78
78
  });
79
79
  }
80
+ async close() {
81
+ await this.server.close();
82
+ }
80
83
  openapi(format) {
81
84
  return this.server.swagger({
82
85
  yaml: format === OpenApiFormat.YAML,
@@ -1,4 +1,4 @@
1
1
  import { Ajv } from 'ajv';
2
- import type { Format } from './Format';
2
+ import type { Format } from './Format.js';
3
3
  declare const getAjv: (formats?: Format[]) => Ajv;
4
4
  export { getAjv, };
@@ -1,4 +1,4 @@
1
- import { BaseError } from '../../error/BaseError';
1
+ import { BaseError } from '../../error/BaseError.js';
2
2
  declare class FileReadError extends BaseError {
3
3
  constructor(path: string, message: string);
4
4
  }
@@ -1,4 +1,4 @@
1
- import { BaseError } from '../../error/BaseError';
1
+ import { BaseError } from '../../error/BaseError.js';
2
2
  class FileReadError extends BaseError {
3
3
  constructor(path, message) {
4
4
  super(`failed reading file "${path}": ${message}`);
@@ -1,4 +1,4 @@
1
- import type { Tls } from './Tls';
1
+ import type { Tls } from './Tls.js';
2
2
  declare const getTls: (tls?: Tls) => {
3
3
  key?: string;
4
4
  cert?: string;
@@ -1,4 +1,4 @@
1
- import { readFile } from './readFile';
1
+ import { readFile } from './readFile.js';
2
2
  const getTls = (tls) => {
3
3
  return tls
4
4
  ? {
@@ -1,5 +1,5 @@
1
1
  import fs from 'fs-extra';
2
- import { FileReadError } from './errors/FileReadError';
2
+ import { FileReadError } from './errors/FileReadError.js';
3
3
  const readFile = (path) => {
4
4
  try {
5
5
  if (fs.existsSync(path)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apeframework",
3
- "version": "0.0.0-dev.22",
3
+ "version": "0.0.0-dev.24",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -17,6 +17,37 @@
17
17
  "url": "git+https://github.com/ApeFramework/apeframework.git"
18
18
  },
19
19
  "type": "module",
20
+ "engines": {
21
+ "node": ">=22"
22
+ },
23
+ "dependencies": {
24
+ "@fastify/compress": "^8.0",
25
+ "@fastify/cors": "^11.0",
26
+ "@fastify/response-validation": "^3.0",
27
+ "@fastify/swagger": "^9.4",
28
+ "@types/fs-extra": "^11.0",
29
+ "@types/nodemailer": "^6.4",
30
+ "@types/yargs-parser": "^21.0",
31
+ "ajv": "^8.17",
32
+ "bcryptjs": "^3.0",
33
+ "bullmq": "^5.48",
34
+ "dotenv": "^16.4",
35
+ "fast-uri": "^3.0",
36
+ "fastify": "^5.2",
37
+ "fs-extra": "^11.3",
38
+ "ical-generator": "^8.1",
39
+ "ioredis": "^5.6",
40
+ "jose": "^6.0",
41
+ "nodemailer": "^6.10",
42
+ "openapi-types": "^12.1",
43
+ "pino": "^9.6",
44
+ "pino-pretty": "^13.0",
45
+ "yargs-parser": "^21.1"
46
+ },
47
+ "peerDependencies": {
48
+ "@types/node": "^22.14",
49
+ "typescript": "^5.8"
50
+ },
20
51
  "exports": {
21
52
  "./cipher/Algorithm": {
22
53
  "import": {
@@ -642,37 +673,5 @@
642
673
  "default": "./dist/utils/wait.js"
643
674
  }
644
675
  }
645
- },
646
- "engines": {
647
- "node": ">=22"
648
- },
649
- "dependencies": {
650
- "@fastify/compress": "^8.0",
651
- "@fastify/cors": "^10.0",
652
- "@fastify/response-validation": "^3.0",
653
- "@fastify/swagger": "^9.4",
654
- "@types/bcryptjs": "^2.4",
655
- "@types/fs-extra": "^11.0",
656
- "@types/nodemailer": "^6.4",
657
- "@types/yargs-parser": "^21.0",
658
- "ajv": "^8.17",
659
- "bcryptjs": "^2.4",
660
- "bullmq": "^5.34",
661
- "dotenv": "^16.4",
662
- "fast-uri": "^3.0",
663
- "fastify": "^5.2",
664
- "fs-extra": "^11.2",
665
- "ical-generator": "^8.0",
666
- "ioredis": "^5.4",
667
- "jose": "^5.9",
668
- "nodemailer": "^6.9",
669
- "openapi-types": "^12.1",
670
- "pino": "^9.5",
671
- "pino-pretty": "^13.0",
672
- "yargs-parser": "^21.1"
673
- },
674
- "peerDependencies": {
675
- "@types/node": "^22.10",
676
- "typescript": "^5.7"
677
676
  }
678
677
  }