diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..ae8d398
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,30 @@
+# Version control
+.git
+.gitignore
+
+# Dependencies
+node_modules
+bun.lockb
+
+# Environment variables
+.env
+.env.*
+
+# Development files
+*.log
+.vscode
+.idea
+*.md
+
+# Build artifacts
+dist
+build
+
+# Docker
+Dockerfile
+docker-compose.yml
+.dockerignore
+
+# System files
+.DS_Store
+Thumbs.db
\ No newline at end of file
diff --git a/.drone.yml b/.drone.yml
deleted file mode 100644
index 7efbdd9..0000000
--- a/.drone.yml
+++ /dev/null
@@ -1,175 +0,0 @@
----
-kind: secret
-name: docker_username
-get:
- path: odit-registry-builder
- name: username
-
----
-kind: secret
-name: docker_password
-get:
- path: odit-registry-builder
- name: password
-
----
-kind: secret
-name: git_ssh
-get:
- path: odit-git-bot
- name: sshkey
-
----
-kind: pipeline
-type: kubernetes
-name: tests:node_latest
-clone:
- disable: true
-steps:
- - name: checkout pr
- image: alpine/git
- commands:
- - git clone $DRONE_REMOTE_URL .
- - git checkout $DRONE_SOURCE_BRANCH
- - name: run tests
- image: node:latest
- commands:
- - yarn
- - yarn test:ci
-trigger:
- event:
- - pull_request
-
----
-kind: pipeline
-type: kubernetes
-name: build:dev
-clone:
- disable: true
-
-steps:
- - name: clone
- image: alpine/git
- commands:
- - git clone $DRONE_REMOTE_URL .
- - git checkout dev
- - name: build dev
- image: plugins/docker
- depends_on: [clone]
- settings:
- username:
- from_secret: docker_username
- password:
- from_secret: docker_password
- repo: registry.odit.services/lfk/mailer
- tags:
- - dev
- registry: registry.odit.services
- mtu: 1000
- - name: run changelog export
- depends_on: ["clone"]
- image: node:latest
- commands:
- - npx auto-changelog --commit-limit false -p -u --hide-credit
- - name: push new changelog to repo
- depends_on: ["run changelog export"]
- image: appleboy/drone-git-push
- settings:
- branch: dev
- commit: true
- commit_message: 🧾New changelog file version [CI SKIP] [skip ci]
- author_email: bot@odit.services
- remote: git@git.odit.services:lfk/mailer.git
- ssh_key:
- from_secret: git_ssh
- - name: run full license export
- depends_on: ["clone"]
- image: node:14.15.1-alpine3.12
- commands:
- - yarn
- - yarn licenses:export
- - name: push new licenses file to repo
- depends_on: ["run full license export"]
- image: appleboy/drone-git-push
- settings:
- branch: dev
- commit: true
- commit_message: 📖New license file version [CI SKIP] [skip ci]
- author_email: bot@odit.services
- remote: git@git.odit.services:lfk/mailer.git
- skip_verify: true
- ssh_key:
- from_secret: git_ssh
-
-trigger:
- branch:
- - dev
- event:
- - push
-
----
-kind: pipeline
-type: kubernetes
-name: build:latest
-clone:
- disable: true
-
-steps:
- - name: clone
- image: alpine/git
- commands:
- - git clone $DRONE_REMOTE_URL .
- - git checkout dev
- - git merge main
- - git checkout main
- - name: build latest
- depends_on: ["clone"]
- image: plugins/docker
- settings:
- username:
- from_secret: docker_username
- password:
- from_secret: docker_password
- repo: registry.odit.services/lfk/mailer
- tags:
- - latest
- registry: registry.odit.services
- mtu: 1000
- - name: push merge to repo
- depends_on: ["clone"]
- image: appleboy/drone-git-push
- settings:
- branch: dev
- commit: false
- remote: git@git.odit.services:lfk/mailer.git
- ssh_key:
- from_secret: git_ssh
-
-trigger:
- branch:
- - main
- event:
- - push
-
----
-kind: pipeline
-type: kubernetes
-name: build:tags
-
-steps:
- - name: build $DRONE_TAG
- image: plugins/docker
- depends_on: [clone]
- settings:
- username:
- from_secret: docker_username
- password:
- from_secret: docker_password
- repo: registry.odit.services/lfk/mailer
- tags:
- - '${DRONE_TAG}'
- registry: registry.odit.services
- mtu: 1000
-trigger:
- event:
- - tag
\ No newline at end of file
diff --git a/.env.example b/.env.example
new file mode 100644
index 0000000..38cebe6
--- /dev/null
+++ b/.env.example
@@ -0,0 +1,11 @@
+SMTP_HOST=localhost
+SMTP_PORT=587
+SMTP_USER="project.1"
+SMTP_PASS="secret.1"
+EMAIL_FROM="noreply@lauf-fuer-kaya.de"
+EMAIL_REPLYTO="info@lauf-fuer-kaya.de"
+REDIS_URL=redis://localhost:6379
+FRONTEND_URL="https://run.lauf-fuer-kaya.de"
+AUTHKEY=""
+EVENT_DATE="23.05.2025"
+EVENT_NAME="Lauf für Kaya! 2025"
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index ce593e3..37d7e73 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,140 +1,2 @@
-# ---> VisualStudioCode
-.vscode/*
-!.vscode/settings.json
-!.vscode/tasks.json
-!.vscode/launch.json
-!.vscode/extensions.json
-!/.vscode/*.yml
-*.code-workspace
-
-# Local History for Visual Studio Code
-.history/
-
-# ---> Node
-# Logs
-logs
-*.log
-npm-debug.log*
-yarn-debug.log*
-yarn-error.log*
-lerna-debug.log*
-
-# Diagnostic reports (https://nodejs.org/api/report.html)
-report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
-
-# Runtime data
-pids
-*.pid
-*.seed
-*.pid.lock
-
-# Directory for instrumented libs generated by jscoverage/JSCover
-lib-cov
-
-# Coverage directory used by tools like istanbul
-coverage
-*.lcov
-
-# nyc test coverage
-.nyc_output
-
-# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
-.grunt
-
-# Bower dependency directory (https://bower.io/)
-bower_components
-
-# node-waf configuration
-.lock-wscript
-
-# Compiled binary addons (https://nodejs.org/api/addons.html)
-build/Release
-
-# Dependency directories
-node_modules/
-jspm_packages/
-
-# Snowpack dependency directory (https://snowpack.dev/)
-web_modules/
-
-# TypeScript cache
-*.tsbuildinfo
-
-# Optional npm cache directory
-.npm
-
-# Optional eslint cache
-.eslintcache
-
-# Microbundle cache
-.rpt2_cache/
-.rts2_cache_cjs/
-.rts2_cache_es/
-.rts2_cache_umd/
-
-# Optional REPL history
-.node_repl_history
-
-# Output of 'npm pack'
-*.tgz
-
-# Yarn Integrity file
-.yarn-integrity
-
-# dotenv environment variables file
+node_modules
.env
-.env.test
-
-# parcel-bundler cache (https://parceljs.org/)
-.cache
-.parcel-cache
-
-# Next.js build output
-.next
-out
-
-# Nuxt.js build / generate output
-.nuxt
-dist
-
-# Gatsby files
-.cache/
-# Comment in the public line in if your project uses Gatsby and not Next.js
-# https://nextjs.org/blog/next-9-1#public-directory-support
-# public
-
-# vuepress build output
-.vuepress/dist
-
-# Serverless directories
-.serverless/
-
-# FuseBox cache
-.fusebox/
-
-# DynamoDB Local files
-.dynamodb/
-
-# TernJS port file
-.tern-port
-
-# Stores VSCode versions used for testing VSCode extensions
-.vscode-test
-
-# yarn v2
-.yarn/cache
-.yarn/unplugged
-.yarn/build-state.yml
-.yarn/install-state.gz
-.pnp.*
-
-yarn.lock
-package-lock.json
-build
-
-*.sqlite
-*.sqlite-jurnal
-/docs
-lib
-/oss-attribution
-*.tmp
diff --git a/.vscode/extensions.json b/.vscode/extensions.json
deleted file mode 100644
index 1c8e087..0000000
--- a/.vscode/extensions.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "recommendations": [
- "2gua.rainbow-brackets",
- "christian-kohler.npm-intellisense",
- "remimarsal.prettier-now",
- "lokalise.i18n-ally",
- ],
- "unwantedRecommendations": [
- "antfu.i18n-ally"
- ]
-}
\ No newline at end of file
diff --git a/.vscode/i18n-ally-custom-framework.yml b/.vscode/i18n-ally-custom-framework.yml
deleted file mode 100644
index 612faa9..0000000
--- a/.vscode/i18n-ally-custom-framework.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-languageIds:
- - javascript
- - html
- - typescript
- - plaintext
-keyMatchReg:
- - '\{\{__ "([a-zA-Z0-9_-]+)"\}\}'
-monopoly: false
-refactorTemplates:
- - '{{__ "$1"}}'
\ No newline at end of file
diff --git a/.vscode/settings.json b/.vscode/settings.json
deleted file mode 100644
index 1c434ae..0000000
--- a/.vscode/settings.json
+++ /dev/null
@@ -1,31 +0,0 @@
-{
- "editor.formatOnSave": true,
- "typescript.format.enable": true,
- "typescript.preferences.quoteStyle": "single",
- "[json]": {
- "editor.defaultFormatter": "vscode.json-language-features"
- },
- "[html]": {
- "editor.defaultFormatter": "vscode.json-language-features",
- "editor.formatOnSave": false
- },
- "[typescript]": {
- "editor.defaultFormatter": "vscode.typescript-language-features",
- "editor.codeActionsOnSave": {
- "source.organizeImports": true,
- // "source.fixAll": true
- }
- },
- "javascript.preferences.quoteStyle": "single",
- "javascript.preferences.importModuleSpecifierEnding": "minimal",
- "typescript.preferences.importModuleSpecifierEnding": "minimal",
- "typescript.preferences.includePackageJsonAutoImports": "on",
- "i18n-ally.localesPaths": "src/locales",
- "i18n-ally.keystyle": "nested",
- "i18n-ally.extract.keygenStrategy":"slug",
- "i18n-ally.enabledFrameworks": [
- "custom"
- ],
- "i18n-ally.sourceLanguage": "en"
-
-}
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
deleted file mode 100644
index f4b59b6..0000000
--- a/CHANGELOG.md
+++ /dev/null
@@ -1,137 +0,0 @@
-### Changelog
-
-All notable changes to this project will be documented in this file. Dates are displayed in UTC.
-
-#### [v0.1.2](https://git.odit.services/lfk/mailer/compare/v0.1.2...v0.1.2)
-
-- update runner-welcome mail template [`#15`](https://git.odit.services/lfk/mailer/issues/15)
-- 🧾New changelog file version [CI SKIP] [skip ci] [`e713ef5`](https://git.odit.services/lfk/mailer/commit/e713ef54ef39d4759832ada073cea825b4ef26dc)
-
-#### [v0.1.2](https://git.odit.services/lfk/mailer/compare/v0.1.1...v0.1.2)
-
-> 15 April 2021
-
-- Merge pull request 'Release 0.1.2' (#14) from dev into main [`15b98e8`](https://git.odit.services/lfk/mailer/commit/15b98e83098906005e0f3f0b24313f9cab6ec1af)
-- Fixed typos and added missing translations🌎 [`8099d2f`](https://git.odit.services/lfk/mailer/commit/8099d2fdbaa8fea6e4fd6a993ac1cfb09e01d14d)
-- 🧾New changelog file version [CI SKIP] [skip ci] [`c8378b6`](https://git.odit.services/lfk/mailer/commit/c8378b66ba512a90ca4386d5a3570f4bb8bea049)
-- 🧾New changelog file version [CI SKIP] [skip ci] [`fbc95be`](https://git.odit.services/lfk/mailer/commit/fbc95be3455eed0d97a124f7df277d0f902e76c9)
-- 🚀Bumped version to v0.1.2 [`d550059`](https://git.odit.services/lfk/mailer/commit/d5500594945b99e428ac1651afd1fe8a8eeba192)
-
-#### [v0.1.1](https://git.odit.services/lfk/mailer/compare/v0.1.0...v0.1.1)
-
-> 31 March 2021
-
-- Merge pull request 'Release 0.1.1' (#13) from dev into main [`b47660a`](https://git.odit.services/lfk/mailer/commit/b47660af65362d773911e99fa9ebf99340d1a368)
-- Added mail templates for forgotten selfservice links [`56c3dec`](https://git.odit.services/lfk/mailer/commit/56c3deca574fc4501cc9b51128b4f3b0467d24c9)
-- Applied Docker MTU fix 🛠 [`f6c03c7`](https://git.odit.services/lfk/mailer/commit/f6c03c7ae218faf8bcdc4108e809ef121b87ef92)
-- 🧾New changelog file version [CI SKIP] [skip ci] [`00e7837`](https://git.odit.services/lfk/mailer/commit/00e78371f3d875460596c24f3544d4e94a896f3c)
-- Added tests [`91f9a8c`](https://git.odit.services/lfk/mailer/commit/91f9a8cbdecf74a74e68b80f3aec675de59e46d4)
-- Added translation keys [`1d4d1d1`](https://git.odit.services/lfk/mailer/commit/1d4d1d18d85349b6f877fa5f1df82fe0d9dafe79)
-- Sorted locales [`9ba4b40`](https://git.odit.services/lfk/mailer/commit/9ba4b4001d35afa49e4eb3232a21784ed443c52e)
-- 📖New license file version [CI SKIP] [skip ci] [`ab0e41f`](https://git.odit.services/lfk/mailer/commit/ab0e41f73be5ad281d5909d6d8baa4dd882c7cc3)
-- Updated ci with new kubernetes secrets 🚀🚀🚀 [`7842a3c`](https://git.odit.services/lfk/mailer/commit/7842a3c437a7d028df9e610257f7ccc0c3d8a871)
-- Added new mailer function [`8da7c55`](https://git.odit.services/lfk/mailer/commit/8da7c55deb5c0b4fccb7f18688613d06dd92df45)
-- Adjusted tests for mail types [`8271014`](https://git.odit.services/lfk/mailer/commit/8271014a101439ea46233099182eb78da9fdc11c)
-- Added MailTypes to responses [`0fa94fc`](https://git.odit.services/lfk/mailer/commit/0fa94fc8679b45aa702068ad96097fe18b385a50)
-- Revert "Now using more images powered by us 🚀🚀🚀" [`d5f2910`](https://git.odit.services/lfk/mailer/commit/d5f29108c479e641db91b2f48ab3cf5da16e9d14)
-- Now using more images powered by us 🚀🚀🚀 [`c1d8b78`](https://git.odit.services/lfk/mailer/commit/c1d8b781a62ebedafa7f1fa598eab966e91d8b64)
-- Added endpoint [`9807e61`](https://git.odit.services/lfk/mailer/commit/9807e61fa81a5790fc09f9920905c683ea1c3a79)
-- 🧾New changelog file version [CI SKIP] [skip ci] [`07aeaf6`](https://git.odit.services/lfk/mailer/commit/07aeaf6d6ba46d0bde62141a7ab0f47c9afde565)
-- 🧾New changelog file version [CI SKIP] [skip ci] [`416be79`](https://git.odit.services/lfk/mailer/commit/416be7920cc551bfd2da2ddfc2fdc25367cafc99)
-- Added translation keys to txt [`44972e4`](https://git.odit.services/lfk/mailer/commit/44972e4a93204aa9f6acbbf29f3012aa8213af77)
-- 🧾New changelog file version [CI SKIP] [skip ci] [`d996d2e`](https://git.odit.services/lfk/mailer/commit/d996d2e85f24c9e3723913bafc8078a13732fc04)
-- 🧾New changelog file version [CI SKIP] [skip ci] [`8996aef`](https://git.odit.services/lfk/mailer/commit/8996aef1523e079aec83b63df99c44173f3a43cc)
-- 🚀Bumped version to v0.1.1 [`34e0c72`](https://git.odit.services/lfk/mailer/commit/34e0c729b542b026b997f25a33165383ff879222)
-- Merge pull request 'Now base64-encoding the selfservice tokens👀' (#12) from bugfix/11-selfservice_profile_link into dev [`5ff6f77`](https://git.odit.services/lfk/mailer/commit/5ff6f77dafa6a3a67615fae6d228c31cb8eac6b9)
-- Changed ci pipeline type to kubernetes [`18c8600`](https://git.odit.services/lfk/mailer/commit/18c8600563c4369321a0e9ba51a09a2fa95198b5)
-- Dockerfile with cached images 🔥 [`f554718`](https://git.odit.services/lfk/mailer/commit/f55471825ef6833600780cb229148d7b7d122150)
-- Now base64-encoding the selfservice tokens👀 [`1f58165`](https://git.odit.services/lfk/mailer/commit/1f581650c5164b6b6d6a6fce5e86e64074c1bdf9)
-- Merge pull request 'Selfservice link forgotten mails feature/5-registration_forgot_mails' (#10) from feature/5-registration_forgot_mails into dev [`f011659`](https://git.odit.services/lfk/mailer/commit/f011659469bd62dffc17e440a6ed42d1fbe7956e)
-- Added new mailtype enum [`015b25a`](https://git.odit.services/lfk/mailer/commit/015b25a2056fe3537fb8e88539c25c2c9e6ba618)
-- Fixed typo [`577f321`](https://git.odit.services/lfk/mailer/commit/577f321b3ffcea666eaaa529e86e532702432635)
-- Renamed templates [`34e30d6`](https://git.odit.services/lfk/mailer/commit/34e30d64929ca7555cee62c4da86d07050b94ff5)
-
-#### v0.1.0
-
-> 4 March 2021
-
-- Merge pull request 'Alpha release 0.1.0' (#9) from dev into main [`e60360c`](https://git.odit.services/lfk/mailer/commit/e60360ccd4f5d6d01b7f20b12e60edc4adb1f75d)
-- 📖New license file version [CI SKIP] [skip ci] [`10b1312`](https://git.odit.services/lfk/mailer/commit/10b13127aa48f65641d1295b77556a6f74a94625)
-- Added basic welcome mails [`b3f61f5`](https://git.odit.services/lfk/mailer/commit/b3f61f51e367c10e102e1d53e6c41c8280f6c0c3)
-- 🚀Bumped version to v0.1.0 [`5e7cfff`](https://git.odit.services/lfk/mailer/commit/5e7cfff41eaf14bf17319319534c7713d9bbf3b9)
-- Added drone file [`3f21503`](https://git.odit.services/lfk/mailer/commit/3f21503848b14c5f8f2066ab3fd8fe114bf1de41)
-- 📖New license file version [CI SKIP] [skip ci] [`f11137e`](https://git.odit.services/lfk/mailer/commit/f11137e0c2140cd226d418c284387bc6a9532030)
-- Added welcome mail tests [`ce87e1f`](https://git.odit.services/lfk/mailer/commit/ce87e1fc03340922c412a431d9595c740a78f42b)
-- Added reset mail valid tests [`4624250`](https://git.odit.services/lfk/mailer/commit/46242509637e05e6b258b406d0a2a76e5db9ca03)
-- Added all missing config vars/interpolations [`4994cb0`](https://git.odit.services/lfk/mailer/commit/4994cb0489b168ecc9f18103fdea5e578bb9ef74)
-- Sorted translations [`1862013`](https://git.odit.services/lfk/mailer/commit/18620133b92baa81272ee084385129b2fb60d234)
-- Added more info to the readme [`9cb100c`](https://git.odit.services/lfk/mailer/commit/9cb100c7c43b082263f4f58c82554c85d7be8494)
-- Moved models to their own files [`9ce86eb`](https://git.odit.services/lfk/mailer/commit/9ce86ebef7d11ed0fb674dcf77f1b6dacd934aa4)
-- Fixed typo [`4b5e24f`](https://git.odit.services/lfk/mailer/commit/4b5e24f3e30db94cf46d6d6362be519343c71a83)
-- Added test mail tests [`bf9652d`](https://git.odit.services/lfk/mailer/commit/bf9652dcfed3667f9d2e8cfd933963935a621a88)
-- Added + sorted translations [`6e99ad5`](https://git.odit.services/lfk/mailer/commit/6e99ad5c1ca3a4853a38acae6f0526c0fa54180c)
-- Added german translations [`e2237d3`](https://git.odit.services/lfk/mailer/commit/e2237d34d39ccaef5600a6eb5d4c555531cb5941)
-- Added jest config and first tests [`ec939e6`](https://git.odit.services/lfk/mailer/commit/ec939e6c1142e825cdb21555e03d9e026e7cdf3c)
-- Added langauge keys for pw reset [`7595235`](https://git.odit.services/lfk/mailer/commit/7595235491694e95b11043f2d5e1fa20c65cd43c)
-- Locales as enums [`d450ecb`](https://git.odit.services/lfk/mailer/commit/d450ecbf7cf8e0b97c46e1f1f57cfcd6f7c30dce)
-- Added dockerfile and docker-compose [`c0c8046`](https://git.odit.services/lfk/mailer/commit/c0c8046031aeb19b3da5cd292316af54462c0978)
-- Updated api doc tests to listen on the right endpoint [`f6a53cc`](https://git.odit.services/lfk/mailer/commit/f6a53cc3e47308e84cde13640cb3f614642fd4ca)
-- Added drone pipeline for automagic tests [`3501a4b`](https://git.odit.services/lfk/mailer/commit/3501a4bef1b6ec73ea0be643e1b4e95ee9874ff9)
-- Added env var docs to readme [`5314100`](https://git.odit.services/lfk/mailer/commit/5314100065f24cb0902c1ba207b880016abd300e)
-- Added missing translations [`1ec95a1`](https://git.odit.services/lfk/mailer/commit/1ec95a1fda13bdfdc9c056a4f73578045c77d964)
-- 📖New license file version [CI SKIP] [skip ci] [`4cde30e`](https://git.odit.services/lfk/mailer/commit/4cde30ef98370069dfad748e12bd720c1b84ad3e)
-- Merge pull request 'Welcome mails feature/2-welcome_mails' (#7) from feature/2-welcome_mails into dev [`0b96dc8`](https://git.odit.services/lfk/mailer/commit/0b96dc8ba519b42922f1464853d694fc2984cbc0)
-- Merge pull request 'Added real information to the README feature/3-readme' (#8) from feature/3-readme into dev [`aed676c`](https://git.odit.services/lfk/mailer/commit/aed676c04b6223916b638340b04677fc34c5b6ae)
-- Added registration mail endpoint [`b3952c3`](https://git.odit.services/lfk/mailer/commit/b3952c39e5f52412c955d6a9cb96f81396e06d82)
-- Added request class [`056b74c`](https://git.odit.services/lfk/mailer/commit/056b74ce2268185d39554a7d7afeaaf75c4e17a2)
-- Added reset mail request model [`5812a48`](https://git.odit.services/lfk/mailer/commit/5812a485ee2e23e8d0bb15bedbebdf7734817865)
-- Now accepting reset mail class [`7445223`](https://git.odit.services/lfk/mailer/commit/7445223f1e6782536157d09cddcad9c942b72e7d)
-- Added ci status [`e48f830`](https://git.odit.services/lfk/mailer/commit/e48f830c08900a9c9e4451d16a25f3ef3d9485e4)
-- Merge pull request 'Added tests for the mail endpoints feature/4-tests' (#6) from feature/4-tests into dev [`7473931`](https://git.odit.services/lfk/mailer/commit/7473931f2705bbdff7a15b74f8d1f39228694697)
-- Merge pull request 'Initial release 0.0.1' (#1) from dev into main [`1d3901a`](https://git.odit.services/lfk/mailer/commit/1d3901ae8f9a0c4675cacd7d0c44c547a06985d4)
-- Added basic loaders/files/dirs [`4e80aa8`](https://git.odit.services/lfk/mailer/commit/4e80aa8a32911ca9697e411f82e8923977ae8216)
-- Added the old mail templates [`c5f2532`](https://git.odit.services/lfk/mailer/commit/c5f2532504768ee26c170e4f4d84bc25a87c63cc)
-- Initial commit [`907b989`](https://git.odit.services/lfk/mailer/commit/907b989d534dab098cc6013f5954203bc9a37510)
-- Added language keys for test mails [`8ab80fd`](https://git.odit.services/lfk/mailer/commit/8ab80fd7ed19f90c51a3f15f90d23e33c451df8e)
-- Added basic files and depedencies [`4e5d5ae`](https://git.odit.services/lfk/mailer/commit/4e5d5ae31171a9b60e684694e04b840a92abbe50)
-- Added basic mailer that can send pw reset mails [`279a9ca`](https://git.odit.services/lfk/mailer/commit/279a9ca946ec028e7003df4f3f78ce80f5e455b4)
-- Added basic config [`9c2f465`](https://git.odit.services/lfk/mailer/commit/9c2f465b99b8610047b5f5b4b8d6707e6d6ee8bd)
-- Now generateing api key via eng_gen script [`17f5876`](https://git.odit.services/lfk/mailer/commit/17f5876d738bcc461f7b4fac907cb8bb9bc13aa5)
-- Added function for sending test mail [`602600d`](https://git.odit.services/lfk/mailer/commit/602600db895a01ca72182e3e2d6094a5e20d4b85)
-- Added basic apispec generator [`124c7a5`](https://git.odit.services/lfk/mailer/commit/124c7a5d1544686dc4fd6e2eaf50e519c2fe0a49)
-- Added app startup file [`53daae9`](https://git.odit.services/lfk/mailer/commit/53daae956da47008312e45a49d445f5674c33551)
-- Added basic mail controller [`972b09d`](https://git.odit.services/lfk/mailer/commit/972b09d8ca4cf250e308340a4ba59f741de77801)
-- Added ans sorted translations [`3f5b77d`](https://git.odit.services/lfk/mailer/commit/3f5b77dc8e085fc25b4b5cc9ffa054ee8ec5bd6b)
-- Added the usual middlewares [`e0523db`](https://git.odit.services/lfk/mailer/commit/e0523db739f772166c0bf895d0d40435848f4600)
-- Added function for generateing test envs [`fc37d14`](https://git.odit.services/lfk/mailer/commit/fc37d146209f6561cc1642774f1ef3a9cadb39f8)
-- Added ans sorted translations [`aedcbd5`](https://git.odit.services/lfk/mailer/commit/aedcbd5f56692c522c356c9c05cd6b5e13c87b3a)
-- Sorted translations [`a84500c`](https://git.odit.services/lfk/mailer/commit/a84500ca1b240c72a69d47f9b35adea7a288c23a)
-- Added success response [`895e346`](https://git.odit.services/lfk/mailer/commit/895e346e599a93ac32c90318197a890fd0599513)
-- Added status controller [`aa28601`](https://git.odit.services/lfk/mailer/commit/aa286013a146fe2ad11c1601bef529ad956a9fed)
-- Fixed broken formatting [`dc3bab3`](https://git.odit.services/lfk/mailer/commit/dc3bab324704005490aaffcd62f18e660c4315c8)
-- Added mail errors [`c5fe167`](https://git.odit.services/lfk/mailer/commit/c5fe1671a2e1325740a29c93f2fe2dbb76579391)
-- Added basic jest packages and scripts [`fa9d0e5`](https://git.odit.services/lfk/mailer/commit/fa9d0e5790a6d7ba9d4490bc016e0f9afde49ec8)
-- Updated comments [`d77670f`](https://git.odit.services/lfk/mailer/commit/d77670fb7023aae86b7039684a6b059ee91bf17d)
-- Added custom i18n ally framework [`264af07`](https://git.odit.services/lfk/mailer/commit/264af075f306675e4247fbcadebfcdab8fa0ba3b)
-- Added stuff to gitignore [`21fab5d`](https://git.odit.services/lfk/mailer/commit/21fab5d53a7f228fa4ef64e53c64fe5324b0ec17)
-- Fixed json [`a1fbabd`](https://git.odit.services/lfk/mailer/commit/a1fbabdee8f414498c5efd95d5d87f41ef3cc28e)
-- 🧾New changelog file version [CI SKIP] [skip ci] [`7c16dd1`](https://git.odit.services/lfk/mailer/commit/7c16dd1b447369c87f2e3a487ec2a3f1fc8451c5)
-- Disabled html autoformatting [`6c5996e`](https://git.odit.services/lfk/mailer/commit/6c5996e1e514ad9b2294316088c34e44255ae895)
-- Added nodemailer dependencies [`87d7175`](https://git.odit.services/lfk/mailer/commit/87d7175f962e8810c98fc72a9bb0fc19ef9e2c22)
-- Added initial translation [`48aa076`](https://git.odit.services/lfk/mailer/commit/48aa076e08b7c32bf53b86c942b129d7f366d93b)
-- Updated consola [`9323cec`](https://git.odit.services/lfk/mailer/commit/9323cecf944dde0b5c187059ded0fe576a0e6758)
-- Added eventname to config [`a62f9c6`](https://git.odit.services/lfk/mailer/commit/a62f9c683dd09303af47e2ed4e8df60bb2df3121)
-- Added test watch mode [`38cffc2`](https://git.odit.services/lfk/mailer/commit/38cffc20490fe10b4e4bc4d88a8377562cd1545a)
-- Added email address verification [`9b5c0b8`](https://git.odit.services/lfk/mailer/commit/9b5c0b8f0630ddaeb78e0d319692985d91a6db76)
-- Fixed argument bug [`6a803c0`](https://git.odit.services/lfk/mailer/commit/6a803c04ab2065db60a13b1aa3333fdfe252f1ab)
-- Added env generation script [`01f5001`](https://git.odit.services/lfk/mailer/commit/01f500135518a628cca9f2a51e25f9ef94b99fa2)
-- Not ignoring i18n ally framework any more [`92494ea`](https://git.odit.services/lfk/mailer/commit/92494eaf6cea490a2c87ebc8f4d14e52d7d9ed0c)
-- Added copyright owner to config [`806cc81`](https://git.odit.services/lfk/mailer/commit/806cc814c39fbe9e09eda87660e076eade1c8b01)
-- Adjusted mail title [`314ceac`](https://git.odit.services/lfk/mailer/commit/314ceaca9d1ff8423c027a9457e6c8d8520272a4)
-- Fixed inerpolation [`f8b9b18`](https://git.odit.services/lfk/mailer/commit/f8b9b188ae47adbc2a11a68274e9d2db3eb6b692)
-- Changed wording [`940acab`](https://git.odit.services/lfk/mailer/commit/940acab77015eced94e5273d4d0a824653665098)
-- Updated interpolations [`0926f31`](https://git.odit.services/lfk/mailer/commit/0926f31fac183a7064aac1679babc57f3b3681c8)
-- Added empty locale files [`0438df3`](https://git.odit.services/lfk/mailer/commit/0438df3bd18c4c424d0db4c269f3ce9f40eb97e5)
-- Removed eventname from config [`691d61b`](https://git.odit.services/lfk/mailer/commit/691d61bd3c40ded3d617a8569dab51e7728ee8ce)
-- Added eventname to config [`9bdb307`](https://git.odit.services/lfk/mailer/commit/9bdb3072aa318f5621443b839c6d1067d80b3580)
-- Moved scripts to own scripts folder [`22195c1`](https://git.odit.services/lfk/mailer/commit/22195c11dd825f83d8415445e2ee82aaa53a83cd)
diff --git a/Dockerfile b/Dockerfile
index 41b7e99..91367a3 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,16 +1,21 @@
-# Typescript Build
-FROM registry.odit.services/hub/library/node:14.15.1-alpine3.12
+FROM oven/bun:1.1.36-slim
+# FROM oven/bun:1.0.25
+
WORKDIR /app
-COPY package.json ./
-RUN npm i -g pnpm
-RUN pnpm i
-COPY tsconfig.json ./
-COPY src ./src
-RUN pnpm run build
-# final image
-FROM registry.odit.services/hub/library/node:14.15.1-alpine3.12
-COPY package.json ./
-RUN npm i -g pnpm
-RUN pnpm i --prod
-COPY --from=0 /app/dist dist
-ENTRYPOINT ["node", "dist/app.js"]
\ No newline at end of file
+
+# Copy package files
+
+# Install dependencies
+COPY package.json .
+RUN bun i
+# COPY package.json bun.lockb ./
+# RUN bun install --frozen-lockfile
+
+# Copy source code
+COPY . .
+
+# Expose the application port
+EXPOSE 3000
+
+# Start the application
+CMD ["bun", "run", "start"]
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index 5797ceb..0000000
--- a/LICENSE
+++ /dev/null
@@ -1,362 +0,0 @@
-Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Creative
-Commons Corporation ("Creative Commons") is not a law firm and does not provide
-legal services or legal advice. Distribution of Creative Commons public licenses
-does not create a lawyer-client or other relationship. Creative Commons makes
-its licenses and related information available on an "as-is" basis. Creative
-Commons gives no warranties regarding its licenses, any material licensed
-under their terms and conditions, or any related information. Creative Commons
-disclaims all liability for damages resulting from their use to the fullest
-extent possible.
-
-Using Creative Commons Public Licenses
-
-Creative Commons public licenses provide a standard set of terms and conditions
-that creators and other rights holders may use to share original works of
-authorship and other material subject to copyright and certain other rights
-specified in the public license below. The following considerations are for
-informational purposes only, are not exhaustive, and do not form part of our
-licenses.
-
-Considerations for licensors: Our public licenses are intended for use by
-those authorized to give the public permission to use material in ways otherwise
-restricted by copyright and certain other rights. Our licenses are irrevocable.
-Licensors should read and understand the terms and conditions of the license
-they choose before applying it. Licensors should also secure all rights necessary
-before applying our licenses so that the public can reuse the material as
-expected. Licensors should clearly mark any material not subject to the license.
-This includes other CC-licensed material, or material used under an exception
-or limitation to copyright. More considerations for licensors : wiki.creativecommons.org/Considerations_for_licensors
-
-Considerations for the public: By using one of our public licenses, a licensor
-grants the public permission to use the licensed material under specified
-terms and conditions. If the licensor's permission is not necessary for any
-reason–for example, because of any applicable exception or limitation to copyright–then
-that use is not regulated by the license. Our licenses grant only permissions
-under copyright and certain other rights that a licensor has authority to
-grant. Use of the licensed material may still be restricted for other reasons,
-including because others have copyright or other rights in the material. A
-licensor may make special requests, such as asking that all changes be marked
-or described. Although not required by our licenses, you are encouraged to
-respect those requests where reasonable. More considerations for the public
-: wiki.creativecommons.org/Considerations_for_licensees
-
-Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public
-License
-
-By exercising the Licensed Rights (defined below), You accept and agree to
-be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial-ShareAlike
-4.0 International Public License ("Public License"). To the extent this Public
-License may be interpreted as a contract, You are granted the Licensed Rights
-in consideration of Your acceptance of these terms and conditions, and the
-Licensor grants You such rights in consideration of benefits the Licensor
-receives from making the Licensed Material available under these terms and
-conditions.
-
-Section 1 – Definitions.
-
-a. Adapted Material means material subject to Copyright and Similar Rights
-that is derived from or based upon the Licensed Material and in which the
-Licensed Material is translated, altered, arranged, transformed, or otherwise
-modified in a manner requiring permission under the Copyright and Similar
-Rights held by the Licensor. For purposes of this Public License, where the
-Licensed Material is a musical work, performance, or sound recording, Adapted
-Material is always produced where the Licensed Material is synched in timed
-relation with a moving image.
-
-b. Adapter's License means the license You apply to Your Copyright and Similar
-Rights in Your contributions to Adapted Material in accordance with the terms
-and conditions of this Public License.
-
-c. BY-NC-SA Compatible License means a license listed at creativecommons.org/compatiblelicenses,
-approved by Creative Commons as essentially the equivalent of this Public
-License.
-
-d. Copyright and Similar Rights means copyright and/or similar rights closely
-related to copyright including, without limitation, performance, broadcast,
-sound recording, and Sui Generis Database Rights, without regard to how the
-rights are labeled or categorized. For purposes of this Public License, the
-rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
-
-e. Effective Technological Measures means those measures that, in the absence
-of proper authority, may not be circumvented under laws fulfilling obligations
-under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996,
-and/or similar international agreements.
-
-f. Exceptions and Limitations means fair use, fair dealing, and/or any other
-exception or limitation to Copyright and Similar Rights that applies to Your
-use of the Licensed Material.
-
-g. License Elements means the license attributes listed in the name of a Creative
-Commons Public License. The License Elements of this Public License are Attribution,
-NonCommercial, and ShareAlike.
-
-h. Licensed Material means the artistic or literary work, database, or other
-material to which the Licensor applied this Public License.
-
-i. Licensed Rights means the rights granted to You subject to the terms and
-conditions of this Public License, which are limited to all Copyright and
-Similar Rights that apply to Your use of the Licensed Material and that the
-Licensor has authority to license.
-
-j. Licensor means the individual(s) or entity(ies) granting rights under this
-Public License.
-
-k. NonCommercial means not primarily intended for or directed towards commercial
-advantage or monetary compensation. For purposes of this Public License, the
-exchange of the Licensed Material for other material subject to Copyright
-and Similar Rights by digital file-sharing or similar means is NonCommercial
-provided there is no payment of monetary compensation in connection with the
-exchange.
-
-l. Share means to provide material to the public by any means or process that
-requires permission under the Licensed Rights, such as reproduction, public
-display, public performance, distribution, dissemination, communication, or
-importation, and to make material available to the public including in ways
-that members of the public may access the material from a place and at a time
-individually chosen by them.
-
-m. Sui Generis Database Rights means rights other than copyright resulting
-from Directive 96/9/EC of the European Parliament and of the Council of 11
-March 1996 on the legal protection of databases, as amended and/or succeeded,
-as well as other essentially equivalent rights anywhere in the world.
-
-n. You means the individual or entity exercising the Licensed Rights under
-this Public License. Your has a corresponding meaning.
-
-Section 2 – Scope.
-
- a. License grant.
-
-1. Subject to the terms and conditions of this Public License, the Licensor
-hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive,
-irrevocable license to exercise the Licensed Rights in the Licensed Material
-to:
-
-A. reproduce and Share the Licensed Material, in whole or in part, for NonCommercial
-purposes only; and
-
-B. produce, reproduce, and Share Adapted Material for NonCommercial purposes
-only.
-
-2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions
-and Limitations apply to Your use, this Public License does not apply, and
-You do not need to comply with its terms and conditions.
-
- 3. Term. The term of this Public License is specified in Section 6(a).
-
-4. Media and formats; technical modifications allowed. The Licensor authorizes
-You to exercise the Licensed Rights in all media and formats whether now known
-or hereafter created, and to make technical modifications necessary to do
-so. The Licensor waives and/or agrees not to assert any right or authority
-to forbid You from making technical modifications necessary to exercise the
-Licensed Rights, including technical modifications necessary to circumvent
-Effective Technological Measures. For purposes of this Public License, simply
-making modifications authorized by this Section 2(a)(4) never produces Adapted
-Material.
-
- 5. Downstream recipients.
-
-A. Offer from the Licensor – Licensed Material. Every recipient of the Licensed
-Material automatically receives an offer from the Licensor to exercise the
-Licensed Rights under the terms and conditions of this Public License.
-
-B. Additional offer from the Licensor – Adapted Material. Every recipient
-of Adapted Material from You automatically receives an offer from the Licensor
-to exercise the Licensed Rights in the Adapted Material under the conditions
-of the Adapter's License You apply.
-
-C. No downstream restrictions. You may not offer or impose any additional
-or different terms or conditions on, or apply any Effective Technological
-Measures to, the Licensed Material if doing so restricts exercise of the Licensed
-Rights by any recipient of the Licensed Material.
-
-6. No endorsement. Nothing in this Public License constitutes or may be construed
-as permission to assert or imply that You are, or that Your use of the Licensed
-Material is, connected with, or sponsored, endorsed, or granted official status
-by, the Licensor or others designated to receive attribution as provided in
-Section 3(a)(1)(A)(i).
-
- b. Other rights.
-
-1. Moral rights, such as the right of integrity, are not licensed under this
-Public License, nor are publicity, privacy, and/or other similar personality
-rights; however, to the extent possible, the Licensor waives and/or agrees
-not to assert any such rights held by the Licensor to the limited extent necessary
-to allow You to exercise the Licensed Rights, but not otherwise.
-
-2. Patent and trademark rights are not licensed under this Public License.
-
-3. To the extent possible, the Licensor waives any right to collect royalties
-from You for the exercise of the Licensed Rights, whether directly or through
-a collecting society under any voluntary or waivable statutory or compulsory
-licensing scheme. In all other cases the Licensor expressly reserves any right
-to collect such royalties, including when the Licensed Material is used other
-than for NonCommercial purposes.
-
-Section 3 – License Conditions.
-
-Your exercise of the Licensed Rights is expressly made subject to the following
-conditions.
-
- a. Attribution.
-
-1. If You Share the Licensed Material (including in modified form), You must:
-
-A. retain the following if it is supplied by the Licensor with the Licensed
-Material:
-
-i. identification of the creator(s) of the Licensed Material and any others
-designated to receive attribution, in any reasonable manner requested by the
-Licensor (including by pseudonym if designated);
-
- ii. a copyright notice;
-
- iii. a notice that refers to this Public License;
-
- iv. a notice that refers to the disclaimer of warranties;
-
-
-
-v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
-
-B. indicate if You modified the Licensed Material and retain an indication
-of any previous modifications; and
-
-C. indicate the Licensed Material is licensed under this Public License, and
-include the text of, or the URI or hyperlink to, this Public License.
-
-2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner
-based on the medium, means, and context in which You Share the Licensed Material.
-For example, it may be reasonable to satisfy the conditions by providing a
-URI or hyperlink to a resource that includes the required information.
-
-3. If requested by the Licensor, You must remove any of the information required
-by Section 3(a)(1)(A) to the extent reasonably practicable.
-
-b. ShareAlike.In addition to the conditions in Section 3(a), if You Share
-Adapted Material You produce, the following conditions also apply.
-
-1. The Adapter's License You apply must be a Creative Commons license with
-the same License Elements, this version or later, or a BY-NC-SA Compatible
-License.
-
-2. You must include the text of, or the URI or hyperlink to, the Adapter's
-License You apply. You may satisfy this condition in any reasonable manner
-based on the medium, means, and context in which You Share Adapted Material.
-
-3. You may not offer or impose any additional or different terms or conditions
-on, or apply any Effective Technological Measures to, Adapted Material that
-restrict exercise of the rights granted under the Adapter's License You apply.
-
-Section 4 – Sui Generis Database Rights.
-
-Where the Licensed Rights include Sui Generis Database Rights that apply to
-Your use of the Licensed Material:
-
-a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract,
-reuse, reproduce, and Share all or a substantial portion of the contents of
-the database for NonCommercial purposes only;
-
-b. if You include all or a substantial portion of the database contents in
-a database in which You have Sui Generis Database Rights, then the database
-in which You have Sui Generis Database Rights (but not its individual contents)
-is Adapted Material, including for purposes of Section 3(b); and
-
-c. You must comply with the conditions in Section 3(a) if You Share all or
-a substantial portion of the contents of the database.
-
-For the avoidance of doubt, this Section 4 supplements and does not replace
-Your obligations under this Public License where the Licensed Rights include
-other Copyright and Similar Rights.
-
-Section 5 – Disclaimer of Warranties and Limitation of Liability.
-
-a. Unless otherwise separately undertaken by the Licensor, to the extent possible,
-the Licensor offers the Licensed Material as-is and as-available, and makes
-no representations or warranties of any kind concerning the Licensed Material,
-whether express, implied, statutory, or other. This includes, without limitation,
-warranties of title, merchantability, fitness for a particular purpose, non-infringement,
-absence of latent or other defects, accuracy, or the presence or absence of
-errors, whether or not known or discoverable. Where disclaimers of warranties
-are not allowed in full or in part, this disclaimer may not apply to You.
-
-b. To the extent possible, in no event will the Licensor be liable to You
-on any legal theory (including, without limitation, negligence) or otherwise
-for any direct, special, indirect, incidental, consequential, punitive, exemplary,
-or other losses, costs, expenses, or damages arising out of this Public License
-or use of the Licensed Material, even if the Licensor has been advised of
-the possibility of such losses, costs, expenses, or damages. Where a limitation
-of liability is not allowed in full or in part, this limitation may not apply
-to You.
-
-c. The disclaimer of warranties and limitation of liability provided above
-shall be interpreted in a manner that, to the extent possible, most closely
-approximates an absolute disclaimer and waiver of all liability.
-
-Section 6 – Term and Termination.
-
-a. This Public License applies for the term of the Copyright and Similar Rights
-licensed here. However, if You fail to comply with this Public License, then
-Your rights under this Public License terminate automatically.
-
-b. Where Your right to use the Licensed Material has terminated under Section
-6(a), it reinstates:
-
-1. automatically as of the date the violation is cured, provided it is cured
-within 30 days of Your discovery of the violation; or
-
- 2. upon express reinstatement by the Licensor.
-
-For the avoidance of doubt, this Section 6(b) does not affect any right the
-Licensor may have to seek remedies for Your violations of this Public License.
-
-c. For the avoidance of doubt, the Licensor may also offer the Licensed Material
-under separate terms or conditions or stop distributing the Licensed Material
-at any time; however, doing so will not terminate this Public License.
-
- d. Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
-
-Section 7 – Other Terms and Conditions.
-
-a. The Licensor shall not be bound by any additional or different terms or
-conditions communicated by You unless expressly agreed.
-
-b. Any arrangements, understandings, or agreements regarding the Licensed
-Material not stated herein are separate from and independent of the terms
-and conditions of this Public License.
-
-Section 8 – Interpretation.
-
-a. For the avoidance of doubt, this Public License does not, and shall not
-be interpreted to, reduce, limit, restrict, or impose conditions on any use
-of the Licensed Material that could lawfully be made without permission under
-this Public License.
-
-b. To the extent possible, if any provision of this Public License is deemed
-unenforceable, it shall be automatically reformed to the minimum extent necessary
-to make it enforceable. If the provision cannot be reformed, it shall be severed
-from this Public License without affecting the enforceability of the remaining
-terms and conditions.
-
-c. No term or condition of this Public License will be waived and no failure
-to comply consented to unless expressly agreed to by the Licensor.
-
-d. Nothing in this Public License constitutes or may be interpreted as a limitation
-upon, or waiver of, any privileges and immunities that apply to the Licensor
-or You, including from the legal processes of any jurisdiction or authority.
-
-Creative Commons is not a party to its public licenses. Notwithstanding, Creative
-Commons may elect to apply one of its public licenses to material it publishes
-and in those instances will be considered the "Licensor." The text of the
-Creative Commons public licenses is dedicated to the public domain under the
-CC0 Public Domain Dedication. Except for the limited purpose of indicating
-that material is shared under a Creative Commons public license or as otherwise
-permitted by the Creative Commons policies published at creativecommons.org/policies,
-Creative Commons does not authorize the use of the trademark "Creative Commons"
-or any other trademark or logo of Creative Commons without its prior written
-consent including, without limitation, in connection with any unauthorized
-modifications to any of its public licenses or any other arrangements, understandings,
-or agreements concerning use of licensed material. For the avoidance of doubt,
-this paragraph does not form part of the public licenses.
-
-Creative Commons may be contacted at creativecommons.org.
diff --git a/README.md b/README.md
index 6c6ca2c..b4f98e8 100644
--- a/README.md
+++ b/README.md
@@ -1,74 +1,102 @@
-# @lfk/mailer
-[](https://ci.odit.services/lfk/mailer)
+# 📧 Email Microservice
-Handles mail generation and sending (pw reset, welcome mail, etc)
+A modern email microservice built with Hono and TypeScript, supporting multiple languages and HTML/Text email templates.
-## Dev Setup 🛠
-> Local dev setup
+## ✨ Features
-1. Rename the .env.example file to .env (you can adjust app port and other settings, if needed) or generate a example env with `yarn && yarn test:generate_env`.
-2. Install Dependencies
- ```bash
- yarn
- ```
-3. Start the server
- ```bash
- yarn dev
- ```
+- 🌐 Multi-language support (English & German)
+- 📝 HTML and Text email templates
+- 📚 OpenAPI/Swagger documentation
+- ⚡ High-performance with Bun runtime
+- 🔄 Queue-based email processing
+- 🎨 Handlebars templating
-## Templates
-> The mailer uses html and plaintext templates to generate various mails.
-> The templates are stored in src/templates by default.
+## 🚀 Quick Start
-We provide a set of default templates that we use for the ["Lauf für Kaya!" charity run](https://lauf-fuer-kaya.de).
-We use handlebars for templateing utilizing i18next for translation - the i18n string format in the templates is : `{{__ "string"}}`
-You can provide your own templates by replacing the ones we provided before compiling the project or by simply mounting your custom templates into the docker container.
+```bash
+# Install dependencies
+bun install
-The server currently needs the following templates to work:
-* pw-reset.html
-* pw-reset.txt
-* test.html
-* test.txt
-* welcome_runner.html
-* welcome_runner.txt
+# Start development server
+bun dev
+```
-| Name | Type | Default | Description
-| - | - | - | -
-| APP_PORT | Number | 4010 | The port the backend server listens on. Is optional.
-| NODE_ENV | String | dev | The apps env - influences debug info.
-| API_KEY | String(min length: 64) | Random generated string | The api key you want to use for auth (query-param `key`), has to be at least 64 chars long.
-| API_URL | String(url) | "http://localhost:8080" | The URL ponting to the base (root) of the lfk runner system.
-| MAIL_SERVER | String(FQDN) | None | The mailserver (smtp) used to send mails via nodemailer.
-| MAIL_PORT | Number | 25 | The mailserver's port (smtp).
-| MAIL_USER | String | None | The username used to authenticate against the mailserver.
-| MAIL_PASSWORD | String | None | The password used to authenticate against the mailserver.
-| MAIL_FROM | String | None | The mail address that mails get sent from.
-| PRIVACY_URL | String | "/privacy" | The url path that get's attached to the app url to link to the privacy page.
-| IMPRINT_URL | String | "/imprint" | The url path that get's attached to the app url to link to the imprint page.
-| COPYRIGHT_OWNER | String | "LfK!" | Text that gets inserted as the "copyright by" owner in the mails.
-| EVENT_NAME | String | "Testing 4 Kaya" | The event's name - used to generate the mail text.
-| CONTACT_MAIL | String(email) | MAIL_FROM | Contact mail address listed at the bottom of some mail templates.
+## 📖 API Documentation
-## Recommended Editor
+Swagger UI is available at: `/swagger`
-[Visual Studio Code](https://code.visualstudio.com/)
+## 🔍 Example API Calls
-### Recommended Extensions
+### Send Welcome Email
-* will be automatically recommended via ./vscode/extensions.json
-* we also provide a config for i18n-ally in the .vscode folder
+```bash
+curl -X POST http://localhost:3000/api/v1/email \
+ -H "Content-Type: application/json" \
+ -d '{
+ "to": "user@example.com",
+ "templateName": "welcome",
+ "language": "en",
+ "data": {
+ "name": "John Doe",
+ "barcode_content": "0123456789",
+ "link": "https://portal.lauf-fuer-kaya.de/"
+ }
+ }'
+```
-## Staging
-### Branches & Tags
-* vX.Y.Z: Release tags created from the main branch
- * The version numbers follow the semver standard
- * A new release tag automaticly triggers the release ci pipeline
-* main: Protected "release" branch
- * The latest tag of the docker image get's build from this
- * New releases get created as tags from this
-* dev: Current dev branch for merging the different feature branches and bugfixes
- * The dev tag of the docker image get's build from this
- * Only push minor changes to this branch!
- * To merge a feature branch into this please create a pull request
-* feature/xyz: Feature branches - nameing scheme: `feature/issueid-title`
-* bugfix/xyz: Branches for bugfixes - nameing scheme:`bugfix/issueid-title`
\ No newline at end of file
+### Send Password Reset Email
+
+```bash
+curl -X POST http://localhost:3000/api/v1/email \
+ -H "Content-Type: application/json" \
+ -d '{
+ "to": "user@example.com",
+ "templateName": "password-reset",
+ "language": "de",
+ "data": {
+ "token": "123465789"
+ }
+ }'
+```
+
+### Check Queue Status
+
+```bash
+curl http://localhost:3000/api/v1/email/status
+```
+
+## 📝 Environment Variables
+
+```env
+SMTP_HOST=localhost
+SMTP_PORT=587
+SMTP_USER="project.1"
+SMTP_PASS="secret.1"
+EMAIL_FROM="noreply@lauf-fuer-kaya.de"
+EMAIL_REPLYTO="info@lauf-fuer-kaya.de"
+REDIS_URL=redis://localhost:6379
+FRONTEND_URL="https://run.lauf-fuer-kaya.de"
+AUTHKEY=""
+EVENT_DATE="23.05.2025"
+EVENT_NAME="Lauf für Kaya! 2025"
+```
+
+## 🛠️ Development
+
+The project uses:
+- 🏃♂️ Bun for runtime and package management
+- 🌐 Hono for the web framework
+- 📚 Zod for validation
+- 📧 Nodemailer for email sending
+- 📑 Handlebars for templating
+- 📊 BullMQ for queue management
+
+## 📦 Available Templates
+
+### Welcome Email
+- Languages: 🇬🇧 English, 🇩🇪 German
+- Variables: `name`, `link`, `barcode_content`
+
+### Password Reset
+- Languages: 🇬🇧 English, 🇩🇪 German
+- Variables: `name`, `resetLink`, `expiresIn`
\ No newline at end of file
diff --git a/bun.lockb b/bun.lockb
new file mode 100644
index 0000000..22a33a5
Binary files /dev/null and b/bun.lockb differ
diff --git a/docker-compose.yml b/docker-compose.yml
index 7d76559..b971510 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,9 +1,33 @@
-version: "3"
+version: '3.8'
+
services:
- mailer:
+ app:
build: .
ports:
- - 4010:4010
+ - "3000:3000"
environment:
- APP_PORT: 4010
- NODE_ENV: production
\ No newline at end of file
+ - NODE_ENV=production
+ - REDIS_URL=redis://redis:6379
+ - SMTP_HOST=localhost
+ - SMTP_PORT=587
+ - SMTP_USER="project.1"
+ - SMTP_PASS="secret.1"
+ - EMAIL_FROM="noreply@lauf-fuer-kaya.de"
+ - EMAIL_REPLYTO="info@lauf-fuer-kaya.de"
+ - FRONTEND_URL="https://run.lauf-fuer-kaya.de"
+ - AUTHKEY=""
+ - EVENT_DATE="23.05.2025"
+ - EVENT_NAME="Lauf für Kaya! 2025"
+ depends_on:
+ - redis
+
+ redis:
+ image: redis:7-alpine
+ ports:
+ - "6379:6379"
+ volumes:
+ - redis_data:/data
+ command: redis-server --appendonly yes
+
+volumes:
+ redis_data:
\ No newline at end of file
diff --git a/jest.config.js b/jest.config.js
deleted file mode 100644
index 91a2d2c..0000000
--- a/jest.config.js
+++ /dev/null
@@ -1,4 +0,0 @@
-module.exports = {
- preset: 'ts-jest',
- testEnvironment: 'node',
-};
\ No newline at end of file
diff --git a/licenses.md b/licenses.md
deleted file mode 100644
index 65efca2..0000000
--- a/licenses.md
+++ /dev/null
@@ -1,833 +0,0 @@
-# @odit/class-validator-jsonschema
-**Author**: Aleksi Pekkala
-**Repo**: git@github.com:epiphone/class-validator-jsonschema.git
-**License**: MIT
-**Description**: Convert class-validator-decorated classes into JSON schema
-## License Text
-MIT License
-
-Copyright (c) 2017 Aleksi Pekkala
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
-
-# class-transformer
-**Author**: [object Object]
-**Repo**: https://github.com/typestack/class-transformer.git
-**License**: MIT
-**Description**: Proper decorator-based transformation / serialization / deserialization of plain javascript objects to class constructors
-## License Text
-The MIT License
-
-Copyright (c) 2015-2020 Umed Khudoiberdiev
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
-# class-validator
-**Author**: TypeStack contributors
-**Repo**: https://github.com/typestack/class-validator.git
-**License**: MIT
-**Description**: Decorator-based property validation for classes.
-## License Text
-
-The MIT License
-
-Copyright (c) 2015-2020 TypeStack
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
-# consola
-**Author**: undefined
-**Repo**: nuxt/consola
-**License**: MIT
-**Description**: Elegant Console Logger for Node.js and Browser
-## License Text
-
-
-# cors
-**Author**: Troy Goode (https://github.com/troygoode/)
-**Repo**: expressjs/cors
-**License**: MIT
-**Description**: Node.js CORS middleware
-## License Text
-(The MIT License)
-
-Copyright (c) 2013 Troy Goode
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-'Software'), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
-# dotenv
-**Author**: undefined
-**Repo**: git://github.com/motdotla/dotenv.git
-**License**: BSD-2-Clause
-**Description**: Loads environment variables from .env file
-## License Text
-Copyright (c) 2015, Scott Motte
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-# express
-**Author**: TJ Holowaychuk
-**Repo**: expressjs/express
-**License**: MIT
-**Description**: Fast, unopinionated, minimalist web framework
-## License Text
-(The MIT License)
-
-Copyright (c) 2009-2014 TJ Holowaychuk
-Copyright (c) 2013-2014 Roman Shtylman
-Copyright (c) 2014-2015 Douglas Christopher Wilson
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-'Software'), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
-# handlebars
-**Author**: Yehuda Katz
-**Repo**: https://github.com/wycats/handlebars.js.git
-**License**: MIT
-**Description**: Handlebars provides the power necessary to let you build semantic templates effectively with no frustration
-## License Text
-Copyright (C) 2011-2019 by Yehuda Katz
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
-
-# i18next
-**Author**: Jan Mühlemann (https://github.com/jamuhl)
-**Repo**: https://github.com/i18next/i18next.git
-**License**: MIT
-**Description**: i18next internationalization framework
-## License Text
-The MIT License (MIT)
-
-Copyright (c) 2017 i18next
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
-
-# i18next-fs-backend
-**Author**: undefined
-**Repo**: git@github.com:i18next/i18next-fs-backend.git
-**License**: MIT
-**Description**: i18next-fs-backend is a backend layer for i18next using in Node.js and for Deno to load translations from the filesystem.
-## License Text
-
-
-# nodemailer
-**Author**: Andris Reinman
-**Repo**: https://github.com/nodemailer/nodemailer.git
-**License**: MIT
-**Description**: Easy as cake e-mail sending from your Node.js applications
-## License Text
-Copyright (c) 2011-2019 Andris Reinman
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
-
-# reflect-metadata
-**Author**: [object Object]
-**Repo**: https://github.com/rbuckton/reflect-metadata.git
-**License**: Apache-2.0
-**Description**: Polyfill for Metadata Reflection API
-## License Text
-Apache License
-
-Version 2.0, January 2004
-
-http://www.apache.org/licenses/
-
-TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-1. Definitions.
-
-"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
-
-"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
-
-"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
-
-"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
-
-"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
-
-"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
-
-"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
-
-"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
-
-"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
-
-"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
-
-2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
-
-3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
-
-4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
-
-You must give any other recipients of the Work or Derivative Works a copy of this License; and
-
-You must cause any modified files to carry prominent notices stating that You changed the files; and
-
-You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
-
-If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
-
-5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
-
-6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
-
-7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
-
-8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
-
-9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
-
-END OF TERMS AND CONDITIONS
-
-# routing-controllers
-**Author**: [object Object]
-**Repo**: https://github.com/typestack/routing-controllers.git
-**License**: MIT
-**Description**: Create structured, declarative and beautifully organized class-based controllers with heavy decorators usage for Express / Koa using TypeScript.
-## License Text
-
-
-# routing-controllers-openapi
-**Author**: Aleksi Pekkala
-**Repo**: git@github.com:epiphone/routing-controllers-openapi
-**License**: MIT
-**Description**: Runtime OpenAPI v3 spec generation for routing-controllers
-## License Text
-MIT License
-
-Copyright (c) 2017 Aleksi Pekkala
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
-
-# @odit/license-exporter
-**Author**: ODIT.Services
-**Repo**: https://git.odit.services/odit/license-exporter
-**License**: MIT
-**Description**: A simple license crawler for crediting open source work
-## License Text
-MIT License Copyright (c) 2020 ODIT.Services (info@odit.services)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is furnished
-to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
-OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
-OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
-# @types/express
-**Author**: undefined
-**Repo**: https://github.com/DefinitelyTyped/DefinitelyTyped.git
-**License**: MIT
-**Description**: TypeScript definitions for Express
-## License Text
- MIT License
-
- Copyright (c) Microsoft Corporation.
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE
-
-
-# @types/jest
-**Author**: undefined
-**Repo**: https://github.com/DefinitelyTyped/DefinitelyTyped.git
-**License**: MIT
-**Description**: TypeScript definitions for Jest
-## License Text
- MIT License
-
- Copyright (c) Microsoft Corporation.
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE
-
-
-# @types/node
-**Author**: undefined
-**Repo**: https://github.com/DefinitelyTyped/DefinitelyTyped.git
-**License**: MIT
-**Description**: TypeScript definitions for Node.js
-## License Text
- MIT License
-
- Copyright (c) Microsoft Corporation.
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE
-
-
-# @types/nodemailer
-**Author**: undefined
-**Repo**: https://github.com/DefinitelyTyped/DefinitelyTyped.git
-**License**: MIT
-**Description**: TypeScript definitions for Nodemailer
-## License Text
- MIT License
-
- Copyright (c) Microsoft Corporation.
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE
-
-
-# axios
-**Author**: Matt Zabriskie
-**Repo**: https://github.com/axios/axios.git
-**License**: MIT
-**Description**: Promise based HTTP client for the browser and node.js
-## License Text
-Copyright (c) 2014-present Matt Zabriskie
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
-
-# cp-cli
-**Author**: undefined
-**Repo**: git+https://github.com/screendriver/cp-cli.git
-**License**: MIT
-**Description**: A 'cp' CLI util for Node.js
-## License Text
-The MIT License (MIT)
-
-Copyright (c) 2016 Christian Rackerseder
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
-
-# jest
-**Author**: undefined
-**Repo**: https://github.com/facebook/jest
-**License**: MIT
-**Description**: Delightful JavaScript Testing.
-## License Text
-MIT License
-
-Copyright (c) Facebook, Inc. and its affiliates.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
-
-# nodemon
-**Author**: [object Object]
-**Repo**: https://github.com/remy/nodemon.git
-**License**: MIT
-**Description**: Simple monitor script for use during development of a Node.js app.
-## License Text
-MIT License
-
-Copyright (c) 2010 - present, Remy Sharp, https://remysharp.com
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
-
-# release-it
-**Author**: [object Object]
-**Repo**: https://github.com/release-it/release-it.git
-**License**: MIT
-**Description**: Generic CLI tool to automate versioning and package publishing related tasks.
-## License Text
-MIT License
-
-Copyright (c) 2018 Lars Kappert
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
-
-# rimraf
-**Author**: Isaac Z. Schlueter (http://blog.izs.me/)
-**Repo**: git://github.com/isaacs/rimraf.git
-**License**: ISC
-**Description**: A deep deletion module for node (like `rm -rf`)
-## License Text
-The ISC License
-
-Copyright (c) Isaac Z. Schlueter and Contributors
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-
-# start-server-and-test
-**Author**: Gleb Bahmutov
-**Repo**: https://github.com/bahmutov/start-server-and-test.git
-**License**: MIT
-**Description**: Starts server, waits for URL, then runs test command; when the tests end, shuts down server
-## License Text
-MIT License
-
-Copyright (c) 2022 bahmutov
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
-
-# ts-jest
-**Author**: Kulshekhar Kabra (https://github.com/kulshekhar)
-**Repo**: git+https://github.com/kulshekhar/ts-jest.git
-**License**: MIT
-**Description**: A preprocessor with source maps support to help use TypeScript with Jest
-## License Text
-MIT License
-
-Copyright (c) 2016-2018
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
-
-# ts-node
-**Author**: [object Object]
-**Repo**: git://github.com/TypeStrong/ts-node.git
-**License**: MIT
-**Description**: TypeScript execution environment and REPL for node.js, with source map support
-## License Text
-The MIT License (MIT)
-
-Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
-
-# typescript
-**Author**: Microsoft Corp.
-**Repo**: https://github.com/Microsoft/TypeScript.git
-**License**: Apache-2.0
-**Description**: TypeScript is a language for application scale JavaScript development
-## License Text
-Apache License
-
-Version 2.0, January 2004
-
-http://www.apache.org/licenses/
-
-TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-1. Definitions.
-
-"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
-
-"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
-
-"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
-
-"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
-
-"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
-
-"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
-
-"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
-
-"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
-
-"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
-
-"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
-
-2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
-
-3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
-
-4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
-
-You must give any other recipients of the Work or Derivative Works a copy of this License; and
-
-You must cause any modified files to carry prominent notices stating that You changed the files; and
-
-You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
-
-If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
-
-5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
-
-6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
-
-7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
-
-8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
-
-9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
-
-END OF TERMS AND CONDITIONS
-
-
diff --git a/package.json b/package.json
index 9a98b15..79288bb 100644
--- a/package.json
+++ b/package.json
@@ -1,92 +1,28 @@
-{
- "name": "@odit/lfk-mailer",
- "version": "0.1.2",
- "description": "The document mailer for the LfK! runner system. This generates and sends mails (password reset, welcome, ...)",
- "main": "src/app.ts",
- "scripts": {
- "dev": "nodemon src/app.ts",
- "build": "rimraf ./dist && tsc && cp-cli ./src/templates ./dist/templates && cp-cli ./src/locales ./dist/locales",
- "licenses:export": "license-exporter --markdown",
- "release": "release-it --only-version",
- "translations:sort": "node ./scripts/sort_translations.js",
- "test": "jest",
- "test:watch": "jest --watchAll",
- "test:generate_env": "ts-node ./scripts/create_testenv.ts",
- "test:ci": "npm run test:generate_env && npm run test:ci:run",
- "test:ci:run": "start-server-and-test dev http://localhost:4010/docs/openapi.json test"
- },
- "repository": {
- "type": "git",
- "url": "git@git.odit.services:lfk/mailer.git"
- },
- "keywords": [
- "odit",
- "lfk",
- "mail",
- "node"
- ],
- "author": {
- "name": "ODIT.Services",
- "email": "info@odit.services",
- "url": "https://odit.services"
- },
- "contributors": [
- {
- "name": "Philipp Dormann",
- "email": "philipp@philippdormann.de",
- "url": "https://philippdormann.de"
- },
- {
- "name": "Nicolai Ort",
- "email": "info@nicolai-ort.com",
- "url": "https://nicolai-ort.com"
- }
- ],
- "license": "CC-BY-NC-SA-4.0",
- "dependencies": {
- "@odit/class-validator-jsonschema": "^2.1.1",
- "class-transformer": "0.3.1",
- "class-validator": "^0.13.1",
- "consola": "^2.15.3",
- "cors": "^2.8.5",
- "dotenv": "^8.2.0",
- "express": "^4.17.1",
- "handlebars": "^4.7.6",
- "i18next": "^19.8.7",
- "i18next-fs-backend": "^1.0.8",
- "nodemailer": "^6.5.0",
- "reflect-metadata": "^0.1.13",
- "routing-controllers": "0.9.0-alpha.6",
- "routing-controllers-openapi": "2.2.0"
- },
- "devDependencies": {
- "@odit/license-exporter": "^0.0.10",
- "@types/express": "^4.17.11",
- "@types/jest": "^26.0.20",
- "@types/node": "^14.14.22",
- "@types/nodemailer": "^6.4.0",
- "axios": "^0.21.1",
- "cp-cli": "^2.0.0",
- "jest": "^26.6.3",
- "nodemon": "^2.0.7",
- "release-it": "^14.2.2",
- "rimraf": "^3.0.2",
- "start-server-and-test": "^1.12.0",
- "ts-jest": "^26.5.2",
- "ts-node": "^9.1.1",
- "typescript": "^4.1.3"
- },
- "release-it": {
- "git": {
- "commit": true,
- "requireCleanWorkingDir": false,
- "commitMessage": "🚀Bumped version to v${version}",
- "requireBranch": "dev",
- "push": false,
- "tag": false
- },
- "npm": {
- "publish": false
- }
- }
-}
+{
+ "name": "@odit/lfk-mailer",
+ "version": "1.0.0",
+ "private": true,
+ "type": "module",
+ "scripts": {
+ "dev": "bun --watch src/index.ts",
+ "start": "bun src/index.ts"
+ },
+ "dependencies": {
+ "@hono/node-server": "1.13.7",
+ "@hono/swagger-ui": "0.5.0",
+ "@hono/zod-openapi": "0.18.3",
+ "@hono/zod-validator": "0.4.1",
+ "bullmq": "5.34.0",
+ "bwip-js": "4.5.1",
+ "handlebars": "4.7.8",
+ "hono": "4.6.13",
+ "ioredis": "5.4.1",
+ "nodemailer": "6.9.16",
+ "zod": "3.24.1"
+ },
+ "devDependencies": {
+ "@types/node": "22.10.2",
+ "@types/nodemailer": "6.4.17",
+ "bun-types": "1.1.38"
+ }
+}
diff --git a/scripts/create_testenv.ts b/scripts/create_testenv.ts
deleted file mode 100644
index 0381281..0000000
--- a/scripts/create_testenv.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-import consola from "consola";
-import fs from "fs";
-import nodemailer from "nodemailer";
-
-
-nodemailer.createTestAccount((err, account) => {
- if (err) {
- console.error('Failed to create a testing account. ' + err.message);
- return process.exit(1);
- }
- let apikey = '';
- const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
- const charactersLength = characters.length;
- for (var i = 0; i < 64; i++) {
- apikey += characters.charAt(Math.floor(Math.random() * charactersLength));
- }
- const env = `
-NODE_ENV=dev
-MAIL_SERVER=${account.smtp.host}
-MAIL_PORT=${account.smtp.port}
-MAIL_USER=${account.user}
-MAIL_PASSWORD=${account.pass}
-MAIL_FROM=${account.user}
-API_KEY=${apikey}
-`
-
- try {
- fs.writeFileSync("./.env", env, { encoding: "utf-8" });
- consola.success("Exported ci env to .env");
- } catch (error) {
- consola.error("Couldn't export the ci env");
- }
-
-});
\ No newline at end of file
diff --git a/scripts/sort_translations.js b/scripts/sort_translations.js
deleted file mode 100644
index 1120c86..0000000
--- a/scripts/sort_translations.js
+++ /dev/null
@@ -1,16 +0,0 @@
-const fs = require('fs');
-// get all language files
-const files = fs.readdirSync('./src/locales/');
-files.forEach((f) => {
- // read file as object
- const unordered = JSON.parse(fs.readFileSync(`src/locales/${f}`));
- // order object by keys alpabetically A-Z
- const ordered = Object.keys(unordered).sort().reduce((obj, key) => {
- obj[key] = unordered[key];
- return obj;
- }, {});
- // format output as json for commit diff compatibility
- const out = JSON.stringify(ordered, 0, 4);
- // write output file
- fs.writeFileSync(`src/locales/${f}`, out);
-});
diff --git a/src/Mailer.ts b/src/Mailer.ts
deleted file mode 100644
index fb2195f..0000000
--- a/src/Mailer.ts
+++ /dev/null
@@ -1,198 +0,0 @@
-import fs from "fs";
-import Handlebars from 'handlebars';
-import i18next from "i18next";
-import Backend from 'i18next-fs-backend';
-import nodemailer from 'nodemailer';
-import { MailOptions } from 'nodemailer/lib/json-transport';
-import Mail from 'nodemailer/lib/mailer';
-import path from 'path';
-import { config } from './config';
-import { MailServerConfigError } from './errors/MailErrors';
-
-
-/**
- * This class is responsible for all mail sending.
- * This uses the html and plaintext templates from src/templates.
- */
-export class Mailer {
- private transport: Mail;
- private static interpolations = { copyright_owner: config.copyright_owner, event_name: config.event_name, contact_mail: config.contact_mail }
-
- /**
- * Main constructor.
- * Initializes i18n(ext), Handlebars and puppeteer.
- */
- constructor() {
- this.init();
- }
-
- /**
- * Main constructor.
- * Initializes i18n(ext), Handlebars and puppeteer.
- */
- public async init() {
- await i18next
- .use(Backend)
- .init({
- fallbackLng: 'en',
- lng: 'en',
- backend: {
- loadPath: path.join(__dirname, '/locales/{{lng}}.json')
- }
- });
- await Handlebars.registerHelper('__',
- function (str) {
- return i18next.t(str, Mailer.interpolations).toString();
- }
- );
- this.transport = nodemailer.createTransport({
- host: config.mail_server,
- port: config.mail_port,
- auth: {
- user: config.mail_user,
- pass: config.mail_password
- }
- });
-
- this.transport.verify(function (error, success) {
- if (error) {
- throw new MailServerConfigError();
- }
- });
- }
-
- /**
- * Function for sending a reset mail from the reset mail template.
- * @param to_address The address the mail will be sent to. Should always get pulled from a user object.
- * @param token The requested password reset token - will be combined with the app_url to generate a password reset link.
- */
- public async sendResetMail(to_address: string, token: string, locale: string = "en") {
- await i18next.changeLanguage(locale);
-
- const replacements = {
- recipient_mail: to_address,
- copyright_owner: config.copyright_owner,
- link_imprint: `${config.app_url}/imprint`,
- link_privacy: `${config.app_url}/privacy`,
- reset_link: `${config.app_url}/reset/${(Buffer.from(token)).toString("base64")}`
- }
-
- const template_html = Handlebars.compile(fs.readFileSync(__dirname + '/templates/pw-reset.html', { encoding: 'utf8' }));
- const template_txt = Handlebars.compile(fs.readFileSync(__dirname + '/templates/pw-reset.txt', { encoding: 'utf8' }));
- const body_html = template_html(replacements);
- const body_txt = template_txt(replacements);
-
- const mail: MailOptions = {
- to: to_address,
- subject: i18next.t("lfk-password-reset", Mailer.interpolations).toString(),
- text: body_txt,
- html: body_html
- };
- await this.sendMail(mail);
- }
-
- /**
- * Function for sending a test mail from the test mail template.
- * @param to_address The address the mail will be sent to - usually the FROM address.
- */
- public async sendTestMail(locale: string = "en") {
- await i18next.changeLanguage(locale);
- const to_address: string = config.mail_from;
- const replacements = {
- recipient_mail: to_address,
- copyright_owner: config.copyright_owner,
- link_imprint: `${config.app_url}/imprint`,
- link_privacy: `${config.app_url}/privacy`
- }
-
- const template_html = Handlebars.compile(fs.readFileSync(__dirname + '/templates/test.html', { encoding: 'utf8' }));
- const template_txt = Handlebars.compile(fs.readFileSync(__dirname + '/templates/test.txt', { encoding: 'utf8' }));
- const body_html = template_html(replacements);
- const body_txt = template_txt(replacements);
-
- const mail: MailOptions = {
- to: to_address,
- subject: i18next.t("test-mail", Mailer.interpolations).toString(),
- text: body_txt,
- html: body_html
- };
- await this.sendMail(mail);
- }
-
- /**
- * Function for sending a reset mail from the reset mail template.
- * @param to_address The address the mail will be sent to. Should always get pulled from a runner object.
- * @param token The runner's selfservice token - will be combined with the app_url to generate a selfservice profile link.
- */
- public async sendWelcomeMail(to_address: string, token: string, locale: string = "en") {
- await i18next.changeLanguage(locale);
- token = Buffer.from(token).toString("base64");
-
- const replacements = {
- recipient_mail: to_address,
- copyright_owner: config.copyright_owner,
- link_imprint: `${config.app_url}/imprint`,
- link_privacy: `${config.app_url}/privacy`,
- selfservice_link: `${config.app_url}/selfservice/profile/${token}`,
- forgot_link: `${config.app_url}/selfservice/`,
- contact_mail: config.contact_mail,
- event_name: config.event_name
- }
-
- const template_html = Handlebars.compile(fs.readFileSync(__dirname + '/templates/welcome_runner.html', { encoding: 'utf8' }));
- const template_txt = Handlebars.compile(fs.readFileSync(__dirname + '/templates/welcome_runner.txt', { encoding: 'utf8' }));
- const body_html = template_html(replacements);
- const body_txt = template_txt(replacements);
-
- const mail: MailOptions = {
- to: to_address,
- subject: i18next.t("event_name-registration", Mailer.interpolations).toString(),
- text: body_txt,
- html: body_html
- };
- await this.sendMail(mail);
- }
-
- /**
- * Function for sending a selfservice link forgotten mail from the runner_forgot template.
- * @param to_address The address the mail will be sent to. Should always get pulled from a runner object.
- * @param token The runner's selfservice token - will be combined with the app_url to generate a selfservice profile link.
- */
- public async sendSelfserviceForgottenMail(to_address: string, token: string, locale: string = "en") {
- await i18next.changeLanguage(locale);
- token = Buffer.from(token).toString("base64");
-
- const replacements = {
- recipient_mail: to_address,
- copyright_owner: config.copyright_owner,
- link_imprint: `${config.app_url}/imprint`,
- link_privacy: `${config.app_url}/privacy`,
- selfservice_link: `${config.app_url}/selfservice/profile/${token}`,
- forgot_link: `${config.app_url}/selfservice/`,
- contact_mail: config.contact_mail,
- event_name: config.event_name
- }
-
- const template_html = Handlebars.compile(fs.readFileSync(__dirname + '/templates/runner_forgot.html', { encoding: 'utf8' }));
- const template_txt = Handlebars.compile(fs.readFileSync(__dirname + '/templates/runner_forgot.txt', { encoding: 'utf8' }));
- const body_html = template_html(replacements);
- const body_txt = template_txt(replacements);
-
- const mail: MailOptions = {
- to: to_address,
- subject: i18next.t("your-event_name-profile", Mailer.interpolations).toString(),
- text: body_txt,
- html: body_html
- };
- await this.sendMail(mail);
- }
-
- /**
- * Wrapper function for sending a mail via this object's transporter.
- * @param mail MailOptions object containing the
- */
- public async sendMail(mail: MailOptions) {
- mail.from = config.mail_from;
- await this.transport.sendMail(mail);
- }
-}
\ No newline at end of file
diff --git a/src/apispec.ts b/src/apispec.ts
deleted file mode 100644
index d6d4b7f..0000000
--- a/src/apispec.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-import { MetadataArgsStorage } from 'routing-controllers';
-import { routingControllersToSpec } from 'routing-controllers-openapi';
-import { config } from './config';
-
-/**
- * This function generates a the openapi spec from route metadata and type schemas.
- * @param storage MetadataArgsStorage object generated by routing-controllers.
- * @param schemas MetadataArgsStorage object generated by class-validator-jsonschema.
- */
-export function generateSpec(storage: MetadataArgsStorage, schemas) {
- return routingControllersToSpec(
- storage,
- {},
- {
- components: {
- schemas,
- "securitySchemes": {
- "AuthToken": {
- "type": "apiKey",
- "in": "query",
- "name": "key",
- description: "A simple api key. See the README's env section for more details."
- }
- }
- },
- info: {
- description: "The the API for the LfK! mailer.",
- title: "LfK! mailer API",
- version: config.version
- },
- }
- );
-}
\ No newline at end of file
diff --git a/src/app.ts b/src/app.ts
deleted file mode 100644
index 78846f3..0000000
--- a/src/app.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import consola from "consola";
-import "reflect-metadata";
-import { createExpressServer } from "routing-controllers";
-import { config, e as errors } from './config';
-import loaders from "./loaders/index";
-import AuthChecker from './middlewares/AuthChecker';
-import { ErrorHandler } from './middlewares/ErrorHandler';
-
-const CONTROLLERS_FILE_EXTENSION = process.env.NODE_ENV === 'production' ? 'js' : 'ts';
-const app = createExpressServer({
- middlewares: [ErrorHandler],
- authorizationChecker: AuthChecker,
- development: config.development,
- cors: true,
- controllers: [`${__dirname}/controllers/*.${CONTROLLERS_FILE_EXTENSION}`],
-});
-
-async function main() {
- await loaders(app);
- app.listen(config.internal_port, () => {
- consola.success(
- `⚡️[server]: Server is running at http://localhost:${config.internal_port}`
- );
- });
-}
-if (errors === 0) {
- main();
-} else {
- consola.error("error");
- // something's wrong
-}
diff --git a/src/config.ts b/src/config.ts
deleted file mode 100644
index 2464181..0000000
--- a/src/config.ts
+++ /dev/null
@@ -1,49 +0,0 @@
-import consola from "consola";
-import { config as configDotenv } from 'dotenv';
-
-configDotenv();
-export const config = {
- internal_port: parseInt(process.env.APP_PORT) || 4010,
- development: process.env.NODE_ENV === "production",
- version: process.env.VERSION || require('../package.json').version,
- api_key: getApiKey(),
- app_url: process.env.APP_URL || "http://localhost:8080",
- mail_server: process.env.MAIL_SERVER,
- mail_port: Number(process.env.MAIL_PORT) || 25,
- mail_user: process.env.MAIL_USER,
- mail_password: process.env.MAIL_PASSWORD,
- mail_from: process.env.MAIL_FROM,
- privacy_url: process.env.PRIVACY_URL || "/privacy",
- imprint_url: process.env.IMPRINT_URL || "/imprint",
- copyright_owner: process.env.COPYRIGHT_OWNER || "LfK!",
- event_name: process.env.EVENT_NAME || "Testing 4 Kaya!",
- contact_mail: process.env.CONTACT_MAIL || process.env.MAIL_FROM,
-}
-let errors = 0
-if (typeof config.internal_port !== "number") {
- errors++
-}
-if (typeof config.development !== "boolean") {
- errors++
-}
-
-function getApiKey(): string {
- const key = process.env.API_KEY;
- if (!key) {
- consola.info("No API key set - generating a random one...");
- let result = '';
- const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
- const charactersLength = characters.length;
- for (var i = 0; i < 64; i++) {
- result += characters.charAt(Math.floor(Math.random() * charactersLength));
- }
- consola.info(`API KEY: ${result}`)
- return result;
- }
- if (key.length < 64) {
- consola.error(`API key is too short - minimum: 64, current: ${key.length}`)
- throw new Error("API_KEY too short.")
- }
- return key
-}
-export let e = errors
\ No newline at end of file
diff --git a/src/config/env.ts b/src/config/env.ts
new file mode 100644
index 0000000..4572a29
--- /dev/null
+++ b/src/config/env.ts
@@ -0,0 +1,15 @@
+export const config = {
+ smtp: {
+ host: process.env.SMTP_HOST || 'smtp.mailtrap.io',
+ port: Number(process.env.SMTP_PORT) || 2525,
+ user: process.env.SMTP_USER || '',
+ pass: process.env.SMTP_PASS || ''
+ },
+ email: {
+ from: process.env.EMAIL_FROM || 'noreply@example.com',
+ replyTo: process.env.EMAIL_REPLYTO || 'noreply@example.com',
+ },
+ redis: {
+ url: process.env.REDIS_URL || 'redis://localhost:6379'
+ }
+}
\ No newline at end of file
diff --git a/src/controllers/MailController.ts b/src/controllers/MailController.ts
deleted file mode 100644
index 69e8d6c..0000000
--- a/src/controllers/MailController.ts
+++ /dev/null
@@ -1,82 +0,0 @@
-import { Authorized, Body, JsonController, Post, QueryParam } from 'routing-controllers';
-import { OpenAPI } from 'routing-controllers-openapi';
-import { Mailer } from '../Mailer';
-import { locales } from '../models/LocaleEnum';
-import { MailTypes } from '../models/MailTypeEnum';
-import { ResetMail } from '../models/ResetMail';
-import { SuccessResponse } from '../models/SuccessResponse';
-import { WelcomeMail } from '../models/WelcomeMail';
-
-/**
- * The mail controller handels all endpoints concerning Mail sending.
- */
-@JsonController()
-@Authorized()
-@OpenAPI({ security: [{ "AuthToken": [] }] })
-export class MailController {
- private mailer: Mailer = new Mailer();
- private initialized: boolean = false;
-
- @Post('/reset')
- @OpenAPI({ description: "Sends reset mails", parameters: [{ in: "query", name: "locale", schema: { type: "string", enum: ["de", "en"] } }] })
- async sendReset(@Body({ validate: true }) mailOptions: ResetMail, @QueryParam("locale") locale: locales) {
- if (!this.initialized) {
- await this.mailer.init();
- this.initialized = true;
- }
- try {
- this.mailer.sendResetMail(mailOptions.address, mailOptions.resetKey, locale?.toString())
- } catch (error) {
- throw error;
- }
- return new SuccessResponse(MailTypes.PASSWORD_RESET, locale);
- }
-
- @Post('/test')
- @OpenAPI({ description: "Sends test mails", parameters: [{ in: "query", name: "locale", schema: { type: "string", enum: ["de", "en"] } }] })
- async sendTest(@QueryParam("locale") locale: locales) {
- if (!this.initialized) {
- await this.mailer.init();
- this.initialized = true;
- }
- try {
- this.mailer.sendTestMail(locale?.toString())
- } catch (error) {
- console.log(error)
- throw error;
- }
- return new SuccessResponse(MailTypes.TEST, locale);
- }
-
- @Post('/registration')
- @OpenAPI({ description: "Sends registration welcome mails", parameters: [{ in: "query", name: "locale", schema: { type: "string", enum: ["de", "en"] } }] })
- async sendRegistrationWelcome(@Body({ validate: true }) mailOptions: WelcomeMail, @QueryParam("locale") locale: locales) {
- if (!this.initialized) {
- await this.mailer.init();
- this.initialized = true;
- }
- try {
- this.mailer.sendWelcomeMail(mailOptions.address, mailOptions.selfserviceToken, locale?.toString())
- } catch (error) {
- console.log(error)
- throw error;
- }
- return new SuccessResponse(MailTypes.RUNNER_WELCOME, locale);
- }
-
- @Post('/registration_forgot')
- @OpenAPI({ description: "Sends selfservice link forgotten mails", parameters: [{ in: "query", name: "locale", schema: { type: "string", enum: ["de", "en"] } }] })
- async sendSelfserviceForgotten(@Body({ validate: true }) mailOptions: WelcomeMail, @QueryParam("locale") locale: locales) {
- if (!this.initialized) {
- await this.mailer.init();
- this.initialized = true;
- }
- try {
- this.mailer.sendSelfserviceForgottenMail(mailOptions.address, mailOptions.selfserviceToken, locale?.toString())
- } catch (error) {
- console.log(error)
- throw error;
- }
- return new SuccessResponse(MailTypes.RUNNER_FORGOT, locale);
- }
-}
diff --git a/src/controllers/StatusController.ts b/src/controllers/StatusController.ts
deleted file mode 100644
index 9578169..0000000
--- a/src/controllers/StatusController.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import { Get, JsonController } from 'routing-controllers';
-import { OpenAPI } from 'routing-controllers-openapi';
-import { config } from '../config';
-
-/**
- * The statuscontroller provides simple endpoints concerning basic information about the server.
- */
-@JsonController()
-export class StatusController {
- @Get('/version')
- @OpenAPI({ description: "A very basic endpoint that just returns the curent package version." })
- getVersion() {
- return {
- "version": config.version
- }
- }
-}
\ No newline at end of file
diff --git a/src/errors/MailErrors.ts b/src/errors/MailErrors.ts
deleted file mode 100644
index 7772ca9..0000000
--- a/src/errors/MailErrors.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-import { IsString } from 'class-validator'
-
-/**
- * Error to throw when a permission couldn't be found.
- */
-export class MailServerConfigError extends Error {
- @IsString()
- name = "MailServerConfigError"
-
- @IsString()
- message = "The SMTP server you provided couldn't be reached!"
-}
\ No newline at end of file
diff --git a/src/index.ts b/src/index.ts
new file mode 100644
index 0000000..af629b3
--- /dev/null
+++ b/src/index.ts
@@ -0,0 +1,26 @@
+import { Hono } from 'hono'
+import { logger } from 'hono/logger'
+import { prettyJSON } from 'hono/pretty-json'
+import { emailRouter } from './routes/email'
+import { createSwaggerUI } from './swagger'
+
+const app = new Hono()
+
+app.use('*', logger())
+app.use('*', prettyJSON())
+
+if ((process.env.AUTHKEY || "") === "") {
+ console.warn("process.env.AUTHKEY was not provided!");
+}
+
+app.route('/api/v1/email', emailRouter)
+app.get('/docs', createSwaggerUI())
+app.get('/swagger', createSwaggerUI())
+
+const port = process.env.PORT || 3000
+console.log(`Server is running on port ${port}`)
+
+export default {
+ port,
+ fetch: app.fetch
+}
\ No newline at end of file
diff --git a/src/loaders/express.ts b/src/loaders/express.ts
deleted file mode 100644
index 985e931..0000000
--- a/src/loaders/express.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import { Application } from "express";
-/**
- * Loader for express related configurations.
- * Configures proxy trusts, globally used middlewares and other express features.
- */
-export default async (app: Application) => {
- app.enable('trust proxy');
- app.disable('x-powered-by');
- app.disable('x-served-by');
- return app;
-};
diff --git a/src/loaders/index.ts b/src/loaders/index.ts
deleted file mode 100644
index 3e30a21..0000000
--- a/src/loaders/index.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-import { Application } from "express";
-import expressLoader from "./express";
-import openapiLoader from "./openapi";
-
-/**
- * Index Loader that executes the other loaders in the right order.
- * This basicly exists for abstraction and a overall better dev experience.
- */
-export default async (app: Application) => {
- await openapiLoader(app);
- await expressLoader(app);
- return app;
-};
diff --git a/src/loaders/openapi.ts b/src/loaders/openapi.ts
deleted file mode 100644
index b12871b..0000000
--- a/src/loaders/openapi.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-import { validationMetadatasToSchemas } from "@odit/class-validator-jsonschema";
-import express, { Application } from "express";
-import path from 'path';
-import { getMetadataArgsStorage } from "routing-controllers";
-import { generateSpec } from '../apispec';
-
-/**
- * Loader for everything openapi related - from creating the schema to serving it via a static route and swaggerUiExpress.
- * All auth schema related stuff also has to be configured here
- */
-export default async (app: Application) => {
- const storage = getMetadataArgsStorage();
- const schemas = validationMetadatasToSchemas({
- refPointerPrefix: "#/components/schemas/",
- });
-
- //Spec creation based on the previously created schemas
- const spec = generateSpec(storage, schemas);
- app.get(["/docs/openapi.json", "/docs/swagger.json"], (req, res) => {
- res.json(spec);
- });
- app.use('/docs', express.static(path.join(__dirname, '../static/docs'), { index: "index.html", extensions: ['html'] }));
- return app;
-};
diff --git a/src/locales/de.json b/src/locales/de.json
deleted file mode 100644
index cf75257..0000000
--- a/src/locales/de.json
+++ /dev/null
@@ -1,31 +0,0 @@
-{
- "a-password-reset-for-your-account-got-requested": "Ein Passwort Reset wurde für dein Konto beantragt.",
- "all-rights-reserved": "Alle Rechte vorbehalten",
- "event_name-registration": "{{event_name}} Registrierung",
- "if-you-didnt-register-yourself-you-should-contact-us-to-get-your-data-removed-from-our-systems": "Solltest du dich nicht selbst registriert haben, sende uns bitte eine Mail und wir entfernen deine Daten aus unserem System: ",
- "if-you-didnt-request-the-reset-please-ignore-this-mail": "Solltest du den Reset nicht beantragt haben kannst du diese Mail einfach ignorieren.",
- "if-you-ever-loose-the-link-you-can-request-a-new-one-by-visiting-our-website": "Auf unserer Website kannst du jederzeit einen neuen Login-Link beantragen:",
- "imprint": "Impressum",
- "lfk-mail-test": "{{copyright_owner}} - Mail test",
- "lfk-password-reset": "{{copyright_owner}} - Passwort zurücksetzen",
- "password-reset": "Passwort zurücksetzen",
- "privacy": "Datenschutz",
- "reset-password": "Passwort zurücksetzen",
- "test-mail": "Test mail",
- "thank-you-for-requesting-a-new-link-to-your-event_name-runner-profile": "Danke, dass du einen neuen Profillink für das {{event_name}} Läuferstem beantragt hast.",
- "thanks-for-registering-and-welcome-to-the-event_name": "Vielen Dank für die Registrierung beim {{event_name}}",
- "the-only-thing-you-have-to-do-now-is-to-bring-your-registration-code-with-you": "Bitte bringe deinen Registrierungscode zum Lauf am 21.04.2023 mit.",
- "this-is-a-test-mail-triggered-by-an-admin-in-the-lfk-backend": "Das ist eine Testmail, die von einem Admin im LfK! Backend erzeugt wurde.",
- "this-mail-was-sent-to-recipient_mail-because-someone-request-a-mail-test-for-this-mail-address": "Du bekommst diese Mail, weil jemand eine Testmail für deine Mail-Adresse angefragt hat.",
- "this-mail-was-sent-to-you-because-someone-request-a-password-reset-for-a-account-linked-to-the-mail-address": "Du bekommst diese E-Mail, weil jemand einen Passwort-Reset für deinen Account beantragt hat.",
- "this-mail-was-sent-to-you-because-someone-requested-a-new-link-to-access-your-profile-for-the-event_name": "Diese E-Mail wurde an dich gesendet, weil jemand einen neuen Link angefordert hat, um auf dein {{event_name}} Profil zuzugreifen.",
- "this-mail-was-sent-to-you-because-someone-used-your-mail-address-to-register-themselfes-for-the-event_name": "Du bekommst diese Mail, weil jemand deine E-Mail-Adresse verwendet hat, um sich beim {{event_name}} zu registrieren.",
- "to-prevent-spam-you-can-only-request-a-new-link-every-24hrs": "Um Spam zu vermeiden, kannst du nur alle 24 Stunden einen neuen Link anfordern.",
- "view-my-data": "Meine Daten",
- "we-successfully-processed-your-registration": "Wir haben deine Registrierung erfolgreich verarbeitet.",
- "welcome": "Willkommen",
- "you-can-view-your-registration-code-lap-times-and-much-more-by-visiting-our-selfservice": "Deinen Registrierungscode, Rundenzeiten und vieles mehr kannst du im Selfservice einsehen:",
- "your-event_name-profile": "Dein {{event_name}} Profil",
- "your-password-wont-be-changed-until-you-click-the-reset-link-below-and-set-a-new-one": "Dein Passwort wird erst zurückgesetzt, wenn du den Reset-Link öffnest und ein neues Passwort setzt.",
- "your-profile": "Dein Profil"
-}
\ No newline at end of file
diff --git a/src/locales/en.json b/src/locales/en.json
deleted file mode 100644
index 6a9f8a1..0000000
--- a/src/locales/en.json
+++ /dev/null
@@ -1,31 +0,0 @@
-{
- "a-password-reset-for-your-account-got-requested": "A password reset for your account got requested.",
- "all-rights-reserved": "All rights reserved.",
- "event_name-registration": "{{event_name}} Registration",
- "if-you-didnt-register-yourself-you-should-contact-us-to-get-your-data-removed-from-our-systems": "If you didn't register yourself you should contact us to get your data removed from our systems:",
- "if-you-didnt-request-the-reset-please-ignore-this-mail": "If you didn't request the reset please ignore this mail.",
- "if-you-ever-loose-the-link-you-can-request-a-new-one-by-visiting-our-website": "If you ever loose the link you can request a new one by visiting our website:",
- "imprint": "Imprint",
- "lfk-mail-test": "{{copyright_owner}} - Mail test",
- "lfk-password-reset": "{{copyright_owner}} - Password reset",
- "password-reset": "Password reset",
- "privacy": "Privacy",
- "reset-password": "Reset password",
- "test-mail": "Test mail",
- "thank-you-for-requesting-a-new-link-to-your-event_name-runner-profile": "Thank you for requesting a new link to your {{event_name}} runner profile.",
- "thanks-for-registering-and-welcome-to-the-event_name": "Thanks for registering and welcome to the {{event_name}}!",
- "the-only-thing-you-have-to-do-now-is-to-bring-your-registration-code-with-you": "The only thing you have to do now is to bring your registration code with you.",
- "this-is-a-test-mail-triggered-by-an-admin-in-the-lfk-backend": "This is a test mail triggered by an admin in the LfK! backend.",
- "this-mail-was-sent-to-recipient_mail-because-someone-request-a-mail-test-for-this-mail-address": "This mail was sent to you because someone request a mail test for this mail address.",
- "this-mail-was-sent-to-you-because-someone-request-a-password-reset-for-a-account-linked-to-the-mail-address": "This mail was sent to you because someone request a password reset for a account linked to the mail address.",
- "this-mail-was-sent-to-you-because-someone-requested-a-new-link-to-access-your-profile-for-the-event_name": "This mail was sent to you, because someone requested a new link to access your profile for the {{event_name}}.",
- "this-mail-was-sent-to-you-because-someone-used-your-mail-address-to-register-themselfes-for-the-event_name": "This mail was sent to you, because someone used your mail address to register themselves for the {{event_name}}",
- "to-prevent-spam-you-can-only-request-a-new-link-every-24hrs": "To prevent spam you can only request a new link every 24hrs.",
- "view-my-data": "View my data",
- "we-successfully-processed-your-registration": "We successfully processed your registration.",
- "welcome": "Welcome",
- "you-can-view-your-registration-code-lap-times-and-much-more-by-visiting-our-selfservice": "You can view your registration code, lap times and much more by visiting our selfservice:",
- "your-event_name-profile": "Your {{event_name}} profile",
- "your-password-wont-be-changed-until-you-click-the-reset-link-below-and-set-a-new-one": "Your password won't be changed until you click the reset link below and set a new one.",
- "your-profile": "Your profile"
-}
\ No newline at end of file
diff --git a/src/middlewares/AuthChecker.ts b/src/middlewares/AuthChecker.ts
deleted file mode 100644
index e4ede50..0000000
--- a/src/middlewares/AuthChecker.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-import { Action } from "routing-controllers";
-import { config } from '../config';
-
-/**
- * Handles authentication via jwt's (Bearer authorization header) for all api endpoints using the @Authorized decorator.
- * @param action Routing-Controllers action object that provides request and response objects among other stuff.
- * @param permissions The permissions that the endpoint using @Authorized requires.
- */
-const AuthChecker = async (action: Action) => {
- const provided_token = action.request.query.key;
- return provided_token == config.api_key;
-}
-
-export default AuthChecker
\ No newline at end of file
diff --git a/src/middlewares/ErrorHandler.ts b/src/middlewares/ErrorHandler.ts
deleted file mode 100644
index 71ef2db..0000000
--- a/src/middlewares/ErrorHandler.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-import { ExpressErrorMiddlewareInterface, Middleware } from "routing-controllers";
-
-/**
- * Our Error handling middlware that returns our custom httperrors to the user.
- */
-@Middleware({ type: "after" })
-export class ErrorHandler implements ExpressErrorMiddlewareInterface {
- public error(error: any, request: any, response: any, next: (err: any) => any) {
- if (response.headersSent) {
- return;
- }
- response.json(error);
- }
-}
diff --git a/src/models/LocaleEnum.ts b/src/models/LocaleEnum.ts
deleted file mode 100644
index b132d6f..0000000
--- a/src/models/LocaleEnum.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export enum locales {
- de = "de",
- en = "en"
-}
\ No newline at end of file
diff --git a/src/models/MailTypeEnum.ts b/src/models/MailTypeEnum.ts
deleted file mode 100644
index 338f52c..0000000
--- a/src/models/MailTypeEnum.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-export enum MailTypes {
- PASSWORD_RESET = "PASSWORD_RESET",
- RUNNER_FORGOT = "RUNNER_FORGOT",
- RUNNER_WELCOME = "RUNNER_WELCOME",
- TEST = "TEST"
-}
\ No newline at end of file
diff --git a/src/models/ResetMail.ts b/src/models/ResetMail.ts
deleted file mode 100644
index e665b73..0000000
--- a/src/models/ResetMail.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-import { IsEmail, IsNotEmpty, IsString } from 'class-validator';
-
-/**
- * Simple reset mail request class for validation and easier handling.
- */
-export class ResetMail {
-
- @IsString()
- @IsEmail()
- @IsNotEmpty()
- address: string;
-
- @IsString()
- @IsNotEmpty()
- resetKey: string;
-}
\ No newline at end of file
diff --git a/src/models/SuccessResponse.ts b/src/models/SuccessResponse.ts
deleted file mode 100644
index 48cc43e..0000000
--- a/src/models/SuccessResponse.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-import { IsBoolean, IsString } from 'class-validator';
-import { locales } from './LocaleEnum';
-import { MailTypes } from './MailTypeEnum';
-
-/**
- * Simple success response class to make everyone happy :)
- */
-export class SuccessResponse {
-
- @IsBoolean()
- success: boolean = true;
-
- @IsString()
- message: string = "Sent!"
-
- @IsString()
- locale: locales;
-
- @IsString()
- type: MailTypes;
-
- constructor(type: MailTypes, locale?: locales) {
- this.type = type;
- this.locale = locale || locales.en;
- }
-}
\ No newline at end of file
diff --git a/src/models/WelcomeMail.ts b/src/models/WelcomeMail.ts
deleted file mode 100644
index 78cd928..0000000
--- a/src/models/WelcomeMail.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-import { IsEmail, IsNotEmpty, IsString } from 'class-validator';
-
-/**
- * Simple welcome mail request class for validation and easier handling.
- */
-export class WelcomeMail {
-
- @IsString()
- @IsEmail()
- @IsNotEmpty()
- address: string;
-
- @IsString()
- @IsNotEmpty()
- selfserviceToken: string;
-}
\ No newline at end of file
diff --git a/src/queues/email.queue.ts b/src/queues/email.queue.ts
new file mode 100644
index 0000000..d82970b
--- /dev/null
+++ b/src/queues/email.queue.ts
@@ -0,0 +1,78 @@
+import { createTransport } from "nodemailer";
+import { Queue, Worker, QueueEvents } from "bullmq";
+import { config } from "../config/env";
+import Redis from "ioredis";
+
+interface EmailJob {
+ to: string;
+ subject: string;
+ html: string;
+ text: string;
+}
+
+export const QUEUE_NAME = "{lfkmailqueue}";
+
+const connection = new Redis(config.redis.url, {
+ maxRetriesPerRequest: null,
+});
+
+export const emailQueue = new Queue(QUEUE_NAME, {
+ connection,
+ defaultJobOptions: {
+ attempts: 3,
+ backoff: {
+ type: "exponential",
+ delay: 1000,
+ },
+ },
+});
+
+const transporter = createTransport({
+ host: config.smtp.host,
+ port: config.smtp.port,
+ auth: {
+ user: config.smtp.user,
+ pass: config.smtp.pass,
+ },
+});
+
+const worker = new Worker(
+ QUEUE_NAME,
+ async (job) => {
+ await transporter.sendMail({
+ from: config.email.from,
+ replyTo: config.email.replyTo,
+ to: job.data.to,
+ subject: job.data.subject,
+ text: job.data.text,
+ html: job.data.html,
+ });
+ },
+ {
+ connection,
+ concurrency: 5,
+ limiter: {
+ max: 250,
+ duration: 1000 * 60, // 250 emails per minute
+ },
+ }
+);
+
+const queueEvents = new QueueEvents(QUEUE_NAME, { connection });
+
+worker.on("completed", (job) => {
+ console.log(`Email job ${job.id} completed`);
+});
+
+worker.on("failed", (job, error) => {
+ console.error(`Email job ${job?.id} failed:`, error);
+});
+
+queueEvents.on("waiting", ({ jobId }) => {
+ console.log(`Job ${jobId} is waiting`);
+});
+
+process.on("SIGTERM", async () => {
+ await worker.close();
+ await connection.quit();
+});
diff --git a/src/routes/email.ts b/src/routes/email.ts
new file mode 100644
index 0000000..33b7c93
--- /dev/null
+++ b/src/routes/email.ts
@@ -0,0 +1,82 @@
+import { Hono } from 'hono'
+import { bearerAuth } from 'hono/bearer-auth'
+import { zValidator } from '@hono/zod-validator'
+import { z } from 'zod'
+import { EmailService } from '../services/email'
+import { getEmailTemplate } from '../templates'
+import { Language } from '../types'
+import { toBuffer } from 'bwip-js/node'
+
+const emailRouter = new Hono()
+const emailService = new EmailService()
+
+const sendEmailSchema = z.object({
+ to: z.string().email(),
+ templateName: z.string(),
+ language: z.enum(['en', 'de']),
+ data: z.record(z.any())
+})
+
+async function generateBarcodeDataURL(data) {
+ const buffer = await toBuffer({
+ bcid: 'code128',
+ text: data,
+ scale: 3,
+ height: 10,
+ includetext: true,
+ textxalign: 'center',
+ });
+
+ const base64Data = buffer.toString('base64');
+ const dataURL = `data:image/png;base64,${base64Data}`;
+
+ return dataURL;
+}
+
+emailRouter.post('/', bearerAuth({ token: process.env.AUTHKEY }), zValidator('json', sendEmailSchema), async (c) => {
+ let { to, templateName, language, data } = c.req.valid('json')
+
+ try {
+ const template = getEmailTemplate(templateName, language as Language)
+ if (templateName === "welcome") {
+ if (data.name && data.link && data.barcode_content) {
+ const dataURL = await generateBarcodeDataURL(data.barcode_content);
+ data.barcode_url = dataURL;
+ } else {
+ return c.json({ success: false, error: "required params 'data.name', 'data.link', 'data.barcode_content' not provided" }, 406)
+ }
+ }
+ if (templateName === "password-reset") {
+ if (data.token) {
+ console.log(data);
+ data.reset_link = `${process.env.FRONTEND_URL}/reset/${(Buffer.from(data.token)).toString("base64")}`
+ } else {
+ return c.json({ success: false, error: "'data.token' not provided" }, 406)
+ }
+ }
+ data.event_date = process.env.EVENT_DATE
+ data.event_name = process.env.EVENT_NAME
+ await emailService.sendEmail({
+ to,
+ subject: template.subject(data),
+ html: template.html(data),
+ text: template.text(data)
+ })
+
+ return c.json({ success: true })
+ } catch (error) {
+ return c.json({ success: false, error: (error as Error).message }, 400)
+ }
+})
+
+// Add queue status endpoint
+emailRouter.get('/status', bearerAuth({ token: process.env.AUTHKEY }), async (c) => {
+ try {
+ const status = await emailService.getQueueStatus()
+ return c.json(status)
+ } catch (error) {
+ return c.json({ error: (error as Error).message }, 500)
+ }
+})
+
+export { emailRouter }
\ No newline at end of file
diff --git a/src/services/email.ts b/src/services/email.ts
new file mode 100644
index 0000000..3353087
--- /dev/null
+++ b/src/services/email.ts
@@ -0,0 +1,40 @@
+import { emailQueue } from '../queues/email.queue'
+import { config } from '../config/env'
+
+interface EmailOptions {
+ to: string
+ subject: string
+ html: string
+ text: string
+}
+
+export class EmailService {
+ async sendEmail(options: EmailOptions): Promise {
+ const email = {
+ from: config.email.from,
+ ...options
+ }
+
+ // Add to queue instead of sending directly
+ await emailQueue.add('send-email', email, {
+ removeOnComplete: true,
+ // removeOnFail: 1000
+ })
+ }
+
+ async getQueueStatus() {
+ const [waiting, active, completed, failed] = await Promise.all([
+ emailQueue.getWaitingCount(),
+ emailQueue.getActiveCount(),
+ emailQueue.getCompletedCount(),
+ emailQueue.getFailedCount()
+ ])
+
+ return {
+ waiting,
+ active,
+ completed,
+ failed
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/static/docs/index.html b/src/static/docs/index.html
deleted file mode 100644
index 2870cac..0000000
--- a/src/static/docs/index.html
+++ /dev/null
@@ -1,156 +0,0 @@
-
-
-
-
-
-
- API Docs
-
-
-
-
-
-
-
API Docs
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/static/docs/rapidoc-min.js b/src/static/docs/rapidoc-min.js
deleted file mode 100644
index be2f2d8..0000000
--- a/src/static/docs/rapidoc-min.js
+++ /dev/null
@@ -1,220 +0,0 @@
-/*!
- * RapiDoc 8.4.3 - WebComponent to View OpenAPI docs
- * License: MIT
- * Repo : https://github.com/mrin9/RapiDoc
- * Author : Mrinmoy Majumdar
- */!function(e){var t=window.webpackHotUpdate;window.webpackHotUpdate=function(e,n){!function(e,t){if(!w[e]||!x[e])return;for(var n in x[e]=!1,t)Object.prototype.hasOwnProperty.call(t,n)&&(h[n]=t[n]);0==--g&&0===y&&A()}(e,n),t&&t(e,n)};var n,r=!0,o="b7be87fff176cf5e55c8",i={},a=[],s=[];function c(e){var t=T[e];if(!t)return C;var r=function(r){return t.hot.active?(T[r]?-1===T[r].parents.indexOf(e)&&T[r].parents.push(e):(a=[e],n=r),-1===t.children.indexOf(r)&&t.children.push(r)):(console.warn("[HMR] unexpected require("+r+") from disposed module "+e),a=[]),C(r)},o=function(e){return{configurable:!0,enumerable:!0,get:function(){return C[e]},set:function(t){C[e]=t}}};for(var i in C)Object.prototype.hasOwnProperty.call(C,i)&&"e"!==i&&"t"!==i&&Object.defineProperty(r,i,o(i));return r.e=function(e){return"ready"===p&&f("prepare"),y++,C.e(e).then(t,(function(e){throw t(),e}));function t(){y--,"prepare"===p&&(b[e]||O(e),0===y&&0===g&&A())}},r.t=function(e,t){return 1&t&&(e=r(e)),C.t(e,-2&t)},r}function l(t){var r={_acceptedDependencies:{},_declinedDependencies:{},_selfAccepted:!1,_selfDeclined:!1,_selfInvalidated:!1,_disposeHandlers:[],_main:n!==t,active:!0,accept:function(e,t){if(void 0===e)r._selfAccepted=!0;else if("function"==typeof e)r._selfAccepted=e;else if("object"==typeof e)for(var n=0;n=0&&r._disposeHandlers.splice(t,1)},invalidate:function(){switch(this._selfInvalidated=!0,p){case"idle":(h={})[t]=e[t],f("ready");break;case"ready":j(t);break;case"prepare":case"check":case"dispose":case"apply":(m=m||[]).push(t)}},check:S,apply:E,status:function(e){if(!e)return p;u.push(e)},addStatusHandler:function(e){u.push(e)},removeStatusHandler:function(e){var t=u.indexOf(e);t>=0&&u.splice(t,1)},data:i[t]};return n=void 0,r}var u=[],p="idle";function f(e){p=e;for(var t=0;t0;){var o=r.pop(),i=o.id,a=o.chain;if((u=T[i])&&(!u.hot._selfAccepted||u.hot._selfInvalidated)){if(u.hot._selfDeclined)return{type:"self-declined",chain:a,moduleId:i};if(u.hot._main)return{type:"unaccepted",chain:a,moduleId:i};for(var s=0;s ")),A.type){case"self-declined":r.onDeclined&&r.onDeclined(A),r.ignoreDeclined||(E=new Error("Aborted because of self decline: "+A.moduleId+P));break;case"declined":r.onDeclined&&r.onDeclined(A),r.ignoreDeclined||(E=new Error("Aborted because of declined dependency: "+A.moduleId+" in "+A.parentId+P));break;case"unaccepted":r.onUnaccepted&&r.onUnaccepted(A),r.ignoreUnaccepted||(E=new Error("Aborted because "+p+" is not accepted"+P));break;case"accepted":r.onAccepted&&r.onAccepted(A),j=!0;break;case"disposed":r.onDisposed&&r.onDisposed(A),I=!0;break;default:throw new Error("Unexception type "+A.type)}if(E)return f("abort"),Promise.reject(E);if(j)for(p in x[p]=h[p],g(b,A.outdatedModules),A.outdatedDependencies)Object.prototype.hasOwnProperty.call(A.outdatedDependencies,p)&&(y[p]||(y[p]=[]),g(y[p],A.outdatedDependencies[p]));I&&(g(b,[A.moduleId]),x[p]=S)}var R,L=[];for(c=0;c0;)if(p=B.pop(),u=T[p]){var D={},q=u.hot._disposeHandlers;for(l=0;l=0&&F.parents.splice(R,1))}}for(p in y)if(Object.prototype.hasOwnProperty.call(y,p)&&(u=T[p]))for(M=y[p],l=0;l=0&&u.children.splice(R,1);f("apply"),void 0!==v&&(o=v,v=void 0);for(p in h=void 0,x)Object.prototype.hasOwnProperty.call(x,p)&&(e[p]=x[p]);var z=null;for(p in y)if(Object.prototype.hasOwnProperty.call(y,p)&&(u=T[p])){M=y[p];var U=[];for(c=0;ce.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,o,i=!0,a=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return i=e.done,e},e:function(e){a=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(a)throw o}}}}n.d(t,"a",(function(){return A})),n.d(t,"b",(function(){return L})),n.d(t,"c",(function(){return F})),n.d(t,"d",(function(){return R})),n.d(t,"e",(function(){return E})),n.d(t,"f",(function(){return D})),n.d(t,"g",(function(){return O})),n.d(t,"h",(function(){return r})),n.d(t,"i",(function(){return a})),n.d(t,"j",(function(){return o})),n.d(t,"k",(function(){return _})),n.d(t,"l",(function(){return s})),n.d(t,"m",(function(){return q})),n.d(t,"n",(function(){return B})),n.d(t,"o",(function(){return y})),n.d(t,"p",(function(){return N})),n.d(t,"q",(function(){return c})),n.d(t,"r",(function(){return m})),n.d(t,"s",(function(){return g})),n.d(t,"t",(function(){return l})),n.d(t,"u",(function(){return j})),n.d(t,"v",(function(){return M})),n.d(t,"w",(function(){return h})),n.d(t,"x",(function(){return b})),n.d(t,"y",(function(){return v}));var A={ANCHOR:"&",COMMENT:"#",TAG:"!",DIRECTIVES_END:"-",DOCUMENT_END:"."},E={ALIAS:"ALIAS",BLANK_LINE:"BLANK_LINE",BLOCK_FOLDED:"BLOCK_FOLDED",BLOCK_LITERAL:"BLOCK_LITERAL",COMMENT:"COMMENT",DIRECTIVE:"DIRECTIVE",DOCUMENT:"DOCUMENT",FLOW_MAP:"FLOW_MAP",FLOW_SEQ:"FLOW_SEQ",MAP:"MAP",MAP_KEY:"MAP_KEY",MAP_VALUE:"MAP_VALUE",PLAIN:"PLAIN",QUOTE_DOUBLE:"QUOTE_DOUBLE",QUOTE_SINGLE:"QUOTE_SINGLE",SEQ:"SEQ",SEQ_ITEM:"SEQ_ITEM"},_="tag:yaml.org,2002:",j={MAP:"tag:yaml.org,2002:map",SEQ:"tag:yaml.org,2002:seq",STR:"tag:yaml.org,2002:str"};function T(e){for(var t=[0],n=e.indexOf("\n");-1!==n;)n+=1,t.push(n),n=e.indexOf("\n",n);return t}function C(e){var t,n;return"string"==typeof e?(t=T(e),n=e):(Array.isArray(e)&&(e=e[0]),e&&e.context&&(e.lineStarts||(e.lineStarts=T(e.context.src)),t=e.lineStarts,n=e.context.src)),{lineStarts:t,src:n}}function I(e,t){if("number"!=typeof e||e<0)return null;var n=C(t),r=n.lineStarts,o=n.src;if(!r||!o||e>o.length)return null;for(var i=0;i=1)||e>r.length)return null;for(var i=r[e-1],a=r[e];a&&a>i&&"\n"===o[a-1];)--a;return o.slice(i,a)}var R=function(){function e(t,n){o(this,e),this.start=t,this.end=n||t}return a(e,null,[{key:"copy",value:function(t){return new e(t.start,t.end)}}]),a(e,[{key:"isEmpty",value:function(){return"number"!=typeof this.start||!this.end||this.end<=this.start}},{key:"setOrigRange",value:function(e,t){var n=this.start,r=this.end;if(0===e.length||r<=e[0])return this.origStart=n,this.origEnd=r,t;for(var o=t;on);)++o;this.origStart=n+o;for(var i=o;o=r);)++o;return this.origEnd=r+o,i}}]),e}(),L=function(){function e(t,n,r){o(this,e),Object.defineProperty(this,"context",{value:r||null,writable:!0}),this.error=null,this.range=null,this.valueRange=null,this.props=n||[],this.type=t,this.value=null}return a(e,null,[{key:"addStringTerminator",value:function(t,n,r){if("\n"===r[r.length-1])return r;var o=e.endOfWhiteSpace(t,n);return o>=t.length||"\n"===t[o]?r+"\n":r}},{key:"atDocumentBoundary",value:function(e,t,n){var r=e[t];if(!r)return!0;var o=e[t-1];if(o&&"\n"!==o)return!1;if(n){if(r!==n)return!1}else if(r!==A.DIRECTIVES_END&&r!==A.DOCUMENT_END)return!1;var i=e[t+1],a=e[t+2];if(i!==r||a!==r)return!1;var s=e[t+3];return!s||"\n"===s||"\t"===s||" "===s}},{key:"endOfIdentifier",value:function(e,t){for(var n=e[t],r="<"===n,o=r?["\n","\t"," ",">"]:["\n","\t"," ","[","]","{","}",","];n&&-1===o.indexOf(n);)n=e[t+=1];return r&&">"===n&&(t+=1),t}},{key:"endOfIndent",value:function(e,t){for(var n=e[t];" "===n;)n=e[t+=1];return t}},{key:"endOfLine",value:function(e,t){for(var n=e[t];n&&"\n"!==n;)n=e[t+=1];return t}},{key:"endOfWhiteSpace",value:function(e,t){for(var n=e[t];"\t"===n||" "===n;)n=e[t+=1];return t}},{key:"startOfLine",value:function(e,t){var n=e[t-1];if("\n"===n)return t;for(;n&&"\n"!==n;)n=e[t-=1];return t+1}},{key:"endOfBlockIndent",value:function(t,n,r){var o=e.endOfIndent(t,r);if(o>r+n)return o;var i=e.endOfWhiteSpace(t,o),a=t[i];return a&&"\n"!==a?null:i}},{key:"atBlank",value:function(e,t,n){var r=e[t];return"\n"===r||"\t"===r||" "===r||n&&!r}},{key:"nextNodeIsIndented",value:function(e,t,n){return!(!e||t<0)&&(t>0||n&&"-"===e)}},{key:"normalizeOffset",value:function(t,n){var r=t[n];return r?"\n"!==r&&"\n"===t[n-1]?n-1:e.endOfWhiteSpace(t,n):n}},{key:"foldNewline",value:function(t,n,r){for(var o=0,i=!1,a="",s=t[n+1];" "===s||"\t"===s||"\n"===s;){switch(s){case"\n":o=0,n+=1,a+="\n";break;case"\t":o<=r&&(i=!0),n=e.endOfWhiteSpace(t,n+2)-1;break;case" ":o+=1,n+=1}s=t[n+1]}return a||(a=" "),s&&o<=r&&(i=!0),{fold:a,offset:n,error:i}}}]),a(e,[{key:"getPropValue",value:function(e,t,n){if(!this.context)return null;var r=this.context.src,o=this.props[e];return o&&r[o.start]===t?r.slice(o.start+(n?1:0),o.end):null}},{key:"commentHasRequiredWhitespace",value:function(t){var n=this.context.src;if(this.header&&t===this.header.end)return!1;if(!this.valueRange)return!1;var r=this.valueRange.end;return t!==r||e.atBlank(n,r-1)}},{key:"parseComment",value:function(t){var n=this.context.src;if(n[t]===A.COMMENT){var r=e.endOfLine(n,t+1),o=new R(t,r);return this.props.push(o),r}return t}},{key:"setOrigRanges",value:function(e,t){return this.range&&(t=this.range.setOrigRange(e,t)),this.valueRange&&this.valueRange.setOrigRange(e,t),this.props.forEach((function(n){return n.setOrigRange(e,t)})),t}},{key:"toString",value:function(){var t=this.context.src,n=this.range,r=this.value;if(null!=r)return r;var o=t.slice(n.start,n.end);return e.addStringTerminator(t,n.end,o)}},{key:"anchor",get:function(){for(var e=0;e0?e.join("\n"):null}},{key:"hasComment",get:function(){if(this.context)for(var e=this.context.src,t=0;t2&&void 0!==arguments[2]?arguments[2]:80,i=P(n.line,t);if(!i)return null;var a=n.col;if(i.length>o)if(a<=o-10)i=i.substr(0,o-1)+"…";else{var s=Math.round(o/2);i.length>a+s&&(i=i.substr(0,a+s-1)+"…"),a-=i.length-o,i="…"+i.substr(1-o)}var c=1,l="";r&&(r.line===n.line&&a+(r.col-n.col)<=o+1?c=r.col-n.col:(c=Math.min(i.length+1,o)-a,l="…"));var u=a>1?" ".repeat(a-1):"",p="^".repeat(c);return"".concat(i,"\n").concat(u).concat(p).concat(l)}(this.linePos,e);a&&(this.message+=":\n\n".concat(a,"\n"))}delete this.source}}}]),n}(d(Error)),M=function(e){c(n,e);var t=m(n);function n(e,r){return o(this,n),t.call(this,"YAMLReferenceError",e,r)}return n}(N),B=function(e){c(n,e);var t=m(n);function n(e,r){return o(this,n),t.call(this,"YAMLSemanticError",e,r)}return n}(N),D=function(e){c(n,e);var t=m(n);function n(e,r){return o(this,n),t.call(this,"YAMLSyntaxError",e,r)}return n}(N),q=function(e){c(n,e);var t=m(n);function n(e,r){return o(this,n),t.call(this,"YAMLWarning",e,r)}return n}(N),F=function(e){c(n,e);var t=m(n);function n(){return o(this,n),t.apply(this,arguments)}return a(n,[{key:"parseBlockValue",value:function(e){for(var t=this.context,r=t.indent,o=t.inFlow,i=t.src,a=e,s=e,c=i[a];"\n"===c&&!L.atDocumentBoundary(i,a+1);c=i[a]){var l=L.endOfBlockIndent(i,r,a+1);if(null===l||"#"===i[l])break;a="\n"===i[l]?l:s=n.endOfLine(i,l,o)}return this.valueRange.isEmpty()&&(this.valueRange.start=e),this.valueRange.end=s,s}},{key:"parse",value:function(e,t){this.context=e;var r=e.inFlow,o=e.src,i=t,a=o[i];return a&&"#"!==a&&"\n"!==a&&(i=n.endOfLine(o,t,r)),this.valueRange=new R(t,i),i=L.endOfWhiteSpace(o,i),i=this.parseComment(i),this.hasComment&&!this.valueRange.isEmpty()||(i=this.parseBlockValue(i)),i}},{key:"strValue",get:function(){if(!this.valueRange||!this.context)return null;for(var e=this.valueRange,t=e.start,n=e.end,r=this.context.src,o=r[n-1];tl?r.slice(l,a+1):s)}else i+=s}var p=r[t];switch(p){case"\t":return{errors:[new B(this,"Plain value cannot start with a tab character")],str:i};case"@":case"`":var f="Plain value cannot start with reserved character ".concat(p);return{errors:[new B(this,f)],str:i};default:return i}}}],[{key:"endOfLine",value:function(e,t,n){for(var r=e[t],o=t;r&&"\n"!==r&&(!n||"["!==r&&"]"!==r&&"{"!==r&&"}"!==r&&","!==r);){var i=e[o+1];if(":"===r&&(!i||"\n"===i||"\t"===i||" "===i||n&&","===i))break;if((" "===r||"\t"===r)&&"#"===i)break;o+=1,r=i}return o}}]),n}(L)},function(e,t,n){"use strict";n.d(t,"a",(function(){return v})),n.d(t,"b",(function(){return u})),n.d(t,"c",(function(){return y})),n.d(t,"d",(function(){return i})),n.d(t,"e",(function(){return d})),n.d(t,"f",(function(){return s})),n.d(t,"g",(function(){return f})),n.d(t,"h",(function(){return x})),n.d(t,"i",(function(){return b})),n.d(t,"j",(function(){return P})),n.d(t,"k",(function(){return g})),n.d(t,"l",(function(){return l})),n.d(t,"m",(function(){return o})),n.d(t,"n",(function(){return H})),n.d(t,"o",(function(){return V})),n.d(t,"p",(function(){return w})),n.d(t,"q",(function(){return D})),n.d(t,"r",(function(){return R})),n.d(t,"s",(function(){return m})),n.d(t,"t",(function(){return k})),n.d(t,"u",(function(){return $})),n.d(t,"v",(function(){return S})),n.d(t,"w",(function(){return a}));var r=n(0);function o(e,t,n){return n?-1===n.indexOf("\n")?"".concat(e," #").concat(n):"".concat(e,"\n")+n.replace(/^/gm,"".concat(t||"","#")):e}var i=function e(){Object(r.j)(this,e)};function a(e,t,n){if(Array.isArray(e))return e.map((function(e,t){return a(e,String(t),n)}));if(e&&"function"==typeof e.toJSON){var r=n&&n.anchors&&n.anchors.get(e);r&&(n.onCreate=function(e){r.res=e,delete n.onCreate});var o=e.toJSON(t,n);return r&&n.onCreate&&n.onCreate(o),o}return n&&n.keep||"bigint"!=typeof e?e:Number(e)}var s=function(e){Object(r.q)(n,e);var t=Object(r.r)(n);function n(e){var o;return Object(r.j)(this,n),(o=t.call(this)).value=e,o}return Object(r.i)(n,[{key:"toJSON",value:function(e,t){return t&&t.keep?this.value:a(this.value,e,t)}},{key:"toString",value:function(){return String(this.value)}}]),n}(i);function c(e,t,n){for(var r=n,o=t.length-1;o>=0;--o){var i=t[o],a=Number.isInteger(i)&&i>=0?[]:{};a[i]=r,r=a}return e.createNode(r,!1)}var l=function(e){return null==e||"object"===Object(r.h)(e)&&e[Symbol.iterator]().next().done},u=function(e){Object(r.q)(n,e);var t=Object(r.r)(n);function n(e){var o;return Object(r.j)(this,n),o=t.call(this),Object(r.l)(Object(r.w)(o),"items",[]),o.schema=e,o}return Object(r.i)(n,[{key:"addIn",value:function(e,t){if(l(e))this.add(t);else{var o=Object(r.x)(e),i=o[0],a=o.slice(1),s=this.get(i,!0);if(s instanceof n)s.addIn(a,t);else{if(void 0!==s||!this.schema)throw new Error("Expected YAML collection at ".concat(i,". Remaining path: ").concat(a));this.set(i,c(this.schema,a,t))}}}},{key:"deleteIn",value:function(e){var t=Object(r.x)(e),o=t[0],i=t.slice(1);if(0===i.length)return this.delete(o);var a=this.get(o,!0);if(a instanceof n)return a.deleteIn(i);throw new Error("Expected YAML collection at ".concat(o,". Remaining path: ").concat(i))}},{key:"getIn",value:function(e,t){var o=Object(r.x)(e),i=o[0],a=o.slice(1),c=this.get(i,!0);return 0===a.length?!t&&c instanceof s?c.value:c:c instanceof n?c.getIn(a,t):void 0}},{key:"hasAllNullValues",value:function(){return this.items.every((function(e){if(!e||"PAIR"!==e.type)return!1;var t=e.value;return null==t||t instanceof s&&null==t.value&&!t.commentBefore&&!t.comment&&!t.tag}))}},{key:"hasIn",value:function(e){var t=Object(r.x)(e),o=t[0],i=t.slice(1);if(0===i.length)return this.has(o);var a=this.get(o,!0);return a instanceof n&&a.hasIn(i)}},{key:"setIn",value:function(e,t){var o=Object(r.x)(e),i=o[0],a=o.slice(1);if(0===a.length)this.set(i,t);else{var s=this.get(i,!0);if(s instanceof n)s.setIn(a,t);else{if(void 0!==s||!this.schema)throw new Error("Expected YAML collection at ".concat(i,". Remaining path: ").concat(a));this.set(i,c(this.schema,a,t))}}}},{key:"toJSON",value:function(){return null}},{key:"toString",value:function(e,t,i,a){var s=this,c=t.blockItem,l=t.flowChars,u=t.isMap,p=t.itemIndent,f=e,d=f.indent,h=f.indentStep,v=f.stringify,m=this.type===r.e.FLOW_MAP||this.type===r.e.FLOW_SEQ||e.inFlow;m&&(p+=h);var g=u&&this.hasAllNullValues();e=Object.assign({},e,{allNullValues:g,indent:p,inFlow:m,type:null});var y,b=!1,x=!1,w=this.items.reduce((function(t,n,r){var i;n&&(!b&&n.spaceBefore&&t.push({type:"comment",str:""}),n.commentBefore&&n.commentBefore.match(/^.*$/gm).forEach((function(e){t.push({type:"comment",str:"#".concat(e)})})),n.comment&&(i=n.comment),m&&(!b&&n.spaceBefore||n.commentBefore||n.comment||n.key&&(n.key.commentBefore||n.key.comment)||n.value&&(n.value.commentBefore||n.value.comment))&&(x=!0)),b=!1;var a=v(n,e,(function(){return i=null}),(function(){return b=!0}));return m&&!x&&a.includes("\n")&&(x=!0),m&&rn.maxFlowStringSingleLineLength){y=k;var A,E=Object(r.g)(O);try{for(E.s();!(A=E.n()).done;){var _=A.value;y+=_?"\n".concat(h).concat(d).concat(_):"\n"}}catch(e){E.e(e)}finally{E.f()}y+="\n".concat(d).concat(S)}else y="".concat(k," ").concat(O.join(" ")," ").concat(S)}else{var j=w.map(c);y=j.shift();var T,C=Object(r.g)(j);try{for(C.s();!(T=C.n()).done;){var I=T.value;y+=I?"\n".concat(d).concat(I):"\n"}}catch(e){C.e(e)}finally{C.f()}}return this.comment?(y+="\n"+this.comment.replace(/^/gm,"".concat(d,"#")),i&&i()):b&&a&&a(),y}}]),n}(i);function p(e){var t=e instanceof s?e.value:e;return t&&"string"==typeof t&&(t=Number(t)),Number.isInteger(t)&&t>=0?t:null}Object(r.l)(u,"maxFlowStringSingleLineLength",60);var f=function(e){Object(r.q)(n,e);var t=Object(r.r)(n);function n(){return Object(r.j)(this,n),t.apply(this,arguments)}return Object(r.i)(n,[{key:"add",value:function(e){this.items.push(e)}},{key:"delete",value:function(e){var t=p(e);return"number"==typeof t&&this.items.splice(t,1).length>0}},{key:"get",value:function(e,t){var n=p(e);if("number"==typeof n){var r=this.items[n];return!t&&r instanceof s?r.value:r}}},{key:"has",value:function(e){var t=p(e);return"number"==typeof t&&t1&&void 0!==arguments[1]?arguments[1]:null;return Object(r.j)(this,n),(o=t.call(this)).key=e,o.value=i,o.type=n.Type.PAIR,o}return Object(r.i)(n,[{key:"addToJSMap",value:function(e,t){var n=a(this.key,"",e);if(t instanceof Map){var o=a(this.value,n,e);t.set(n,o)}else if(t instanceof Set)t.add(n);else{var s=function(e,t,n){return null===t?"":"object"!==Object(r.h)(t)?String(t):e instanceof i&&n&&n.doc?e.toString({anchors:{},doc:n.doc,indent:"",indentStep:n.indentStep,inFlow:!0,inStringifyKey:!0,stringify:n.stringify}):JSON.stringify(t)}(this.key,n,e);t[s]=a(this.value,s,e)}return t}},{key:"toJSON",value:function(e,t){var n=t&&t.mapAsMap?new Map:{};return this.addToJSMap(t,n)}},{key:"toString",value:function(e,t,n){if(!e||!e.doc)return JSON.stringify(this);var a=e.doc.options,c=a.indent,l=a.indentSeq,p=a.simpleKeys,d=this.key,h=this.value,v=d instanceof i&&d.comment;if(p){if(v)throw new Error("With simple keys, key nodes cannot have comments");if(d instanceof u){throw new Error("With simple keys, collection cannot be used as a key value")}}var m=!p&&(!d||v||d instanceof u||d.type===r.e.BLOCK_FOLDED||d.type===r.e.BLOCK_LITERAL),g=e,y=g.doc,b=g.indent,x=g.indentStep,w=g.stringify;e=Object.assign({},e,{implicitKey:!m,indent:b+x});var k=!1,S=w(d,e,(function(){return v=null}),(function(){return k=!0}));if(S=o(S,e.indent,v),e.allNullValues&&!p)return this.comment?(S=o(S,e.indent,this.comment),t&&t()):k&&!v&&n&&n(),e.inFlow?S:"? ".concat(S);S=m?"? ".concat(S,"\n").concat(b,":"):"".concat(S,":"),this.comment&&(S=o(S,e.indent,this.comment),t&&t());var O="",A=null;if(h instanceof i){if(h.spaceBefore&&(O="\n"),h.commentBefore){var E=h.commentBefore.replace(/^/gm,"".concat(e.indent,"#"));O+="\n".concat(E)}A=h.comment}else h&&"object"===Object(r.h)(h)&&(h=y.schema.createNode(h,!0));e.implicitKey=!1,!m&&!this.comment&&h instanceof s&&(e.indentAtStart=S.length+1),k=!1,!l&&c>=2&&!e.inFlow&&!m&&h instanceof f&&h.type!==r.e.FLOW_SEQ&&!h.tag&&!y.anchors.getName(h)&&(e.indent=e.indent.substr(2));var _=w(h,e,(function(){return A=null}),(function(){return k=!0})),j=" ";if(O||this.comment)j="".concat(O,"\n").concat(e.indent);else if(!m&&h instanceof u){("["===_[0]||"{"===_[0])&&!_.includes("\n")||(j="\n".concat(e.indent))}return k&&!A&&n&&n(),o(S+j+_,e.indent,A)}},{key:"commentBefore",get:function(){return this.key instanceof i?this.key.commentBefore:void 0},set:function(e){if(null==this.key&&(this.key=new s(null)),!(this.key instanceof i)){throw new Error("Pair.commentBefore is an alias for Pair.key.commentBefore. To set it, the key must be a Node.")}this.key.commentBefore=e}}]),n}(i);Object(r.l)(d,"Type",{PAIR:"PAIR",MERGE_PAIR:"MERGE_PAIR"});var h=function e(t,n){if(t instanceof v){var o=n.get(t.source);return o.count*o.aliasCount}if(t instanceof u){var i,a=0,s=Object(r.g)(t.items);try{for(s.s();!(i=s.n()).done;){var c=e(i.value,n);c>a&&(a=c)}}catch(e){s.e(e)}finally{s.f()}return a}if(t instanceof d){var l=e(t.key,n),p=e(t.value,n);return Math.max(l,p)}return 1},v=function(e){Object(r.q)(n,e);var t=Object(r.r)(n);function n(e){var o;return Object(r.j)(this,n),(o=t.call(this)).source=e,o.type=r.e.ALIAS,o}return Object(r.i)(n,null,[{key:"stringify",value:function(e,t){var n=e.range,r=e.source,o=t.anchors,i=t.doc,a=t.implicitKey,s=t.inStringifyKey,c=Object.keys(o).find((function(e){return o[e]===r}));if(!c&&s&&(c=i.anchors.getName(r)||i.anchors.newName()),c)return"*".concat(c).concat(a?" ":"");var l=i.anchors.getName(r)?"Alias node must be after source node":"Source node not found for alias node";throw new Error("".concat(l," [").concat(n,"]"))}}]),Object(r.i)(n,[{key:"toJSON",value:function(e,t){if(!t)return a(this.source,e,t);var n=t.anchors,o=t.maxAliasCount,i=n.get(this.source);if(!i||void 0===i.res){var s="This should not happen: Alias anchor was not resolved?";throw this.cstNode?new r.v(this.cstNode,s):new ReferenceError(s)}if(o>=0&&(i.count+=1,0===i.aliasCount&&(i.aliasCount=h(this.source,n)),i.count*i.aliasCount>o)){var c="Excessive alias count indicates a resource exhaustion attack";throw this.cstNode?new r.v(this.cstNode,c):new ReferenceError(c)}return i.res}},{key:"toString",value:function(e){return n.stringify(this,e)}},{key:"tag",set:function(e){throw new Error("Alias nodes cannot have tags")}}]),n}(i);function m(e,t){var n,o=t instanceof s?t.value:t,i=Object(r.g)(e);try{for(i.s();!(n=i.n()).done;){var a=n.value;if(a instanceof d){if(a.key===t||a.key===o)return a;if(a.key&&a.key.value===o)return a}}}catch(e){i.e(e)}finally{i.f()}}Object(r.l)(v,"default",!0);var g=function(e){Object(r.q)(n,e);var t=Object(r.r)(n);function n(){return Object(r.j)(this,n),t.apply(this,arguments)}return Object(r.i)(n,[{key:"add",value:function(e,t){e?e instanceof d||(e=new d(e.key||e,e.value)):e=new d(e);var n=m(this.items,e.key),r=this.schema&&this.schema.sortMapEntries;if(n){if(!t)throw new Error("Key ".concat(e.key," already set"));n.value=e.value}else if(r){var o=this.items.findIndex((function(t){return r(e,t)<0}));-1===o?this.items.push(e):this.items.splice(o,0,e)}else this.items.push(e)}},{key:"delete",value:function(e){var t=m(this.items,e);return!!t&&this.items.splice(this.items.indexOf(t),1).length>0}},{key:"get",value:function(e,t){var n=m(this.items,e),r=n&&n.value;return!t&&r instanceof s?r.value:r}},{key:"has",value:function(e){return!!m(this.items,e)}},{key:"set",value:function(e,t){this.add(new d(e,t),!0)}},{key:"toJSON",value:function(e,t,n){var o=n?new n:t&&t.mapAsMap?new Map:{};t&&t.onCreate&&t.onCreate(o);var i,a=Object(r.g)(this.items);try{for(a.s();!(i=a.n()).done;){i.value.addToJSMap(t,o)}}catch(e){a.e(e)}finally{a.f()}return o}},{key:"toString",value:function(e,t,o){if(!e)return JSON.stringify(this);var i,a=Object(r.g)(this.items);try{for(a.s();!(i=a.n()).done;){var s=i.value;if(!(s instanceof d))throw new Error("Map items must all be pairs; found ".concat(JSON.stringify(s)," instead"))}}catch(e){a.e(e)}finally{a.f()}return Object(r.s)(Object(r.t)(n.prototype),"toString",this).call(this,e,{blockItem:function(e){return e.str},flowChars:{start:"{",end:"}"},isMap:!0,itemIndent:e.indent||""},t,o)}}]),n}(u),y=function(e){Object(r.q)(n,e);var t=Object(r.r)(n);function n(e){var o;if(Object(r.j)(this,n),e instanceof d){var i=e.value;i instanceof f||((i=new f).items.push(e.value),i.range=e.value.range),(o=t.call(this,e.key,i)).range=e.range}else o=t.call(this,new s("<<"),new f);return o.type=d.Type.MERGE_PAIR,Object(r.y)(o)}return Object(r.i)(n,[{key:"addToJSMap",value:function(e,t){var n,o=Object(r.g)(this.value.items);try{for(o.s();!(n=o.n()).done;){var i=n.value.source;if(!(i instanceof g))throw new Error("Merge sources must be maps");var a,s=i.toJSON(null,e,Map),c=Object(r.g)(s);try{for(c.s();!(a=c.n()).done;){var l=Object(r.o)(a.value,2),u=l[0],p=l[1];t instanceof Map?t.has(u)||t.set(u,p):t instanceof Set?t.add(u):Object.prototype.hasOwnProperty.call(t,u)||(t[u]=p)}}catch(e){c.e(e)}finally{c.f()}}}catch(e){o.e(e)}finally{o.f()}return t}},{key:"toString",value:function(e,t){var o=this.value;if(o.items.length>1)return Object(r.s)(Object(r.t)(n.prototype),"toString",this).call(this,e,t);this.value=o.items[0];var i=Object(r.s)(Object(r.t)(n.prototype),"toString",this).call(this,e,t);return this.value=o,i}}]),n}(d),b={defaultType:r.e.BLOCK_LITERAL,lineWidth:76},x={trueStr:"true",falseStr:"false"},w={asBigInt:!1},k={nullStr:"null"},S={defaultType:r.e.PLAIN,doubleQuoted:{jsonEncoding:!1,minMultiLineLength:40},fold:{lineWidth:80,minContentWidth:20}};function O(e,t,n){var o,i=Object(r.g)(t);try{for(i.s();!(o=i.n()).done;){var a=o.value,c=a.format,l=a.test,u=a.resolve;if(l){var p=e.match(l);if(p){var f=u.apply(null,p);return f instanceof s||(f=new s(f)),c&&(f.format=c),f}}}}catch(e){i.e(e)}finally{i.f()}return n&&(e=n(e)),new s(e)}var A=function(e,t){for(var n=e[t+1];" "===n||"\t"===n;){do{n=e[t+=1]}while(n&&"\n"!==n);n=e[t+1]}return t};function E(e,t,n,r){var o=r.indentAtStart,i=r.lineWidth,a=void 0===i?80:i,s=r.minContentWidth,c=void 0===s?20:s,l=r.onFold,u=r.onOverflow;if(!a||a<0)return e;var p=Math.max(1+c,1+a-t.length);if(e.length<=p)return e;var f,d=[],h={},v=a-("number"==typeof o?o:t.length),m=void 0,g=void 0,y=!1,b=-1;for("block"===n&&-1!==(b=A(e,b))&&(v=b+p);f=e[b+=1];){if("quoted"===n&&"\\"===f)switch(e[b+1]){case"x":b+=3;break;case"u":b+=5;break;case"U":b+=9;break;default:b+=1}if("\n"===f)"block"===n&&(b=A(e,b)),v=b+p,m=void 0;else{if(" "===f&&g&&" "!==g&&"\n"!==g&&"\t"!==g){var x=e[b+1];x&&" "!==x&&"\n"!==x&&"\t"!==x&&(m=b)}if(b>=v)if(m)d.push(m),v=m+p,m=void 0;else if("quoted"===n){for(;" "===g||"\t"===g;)g=f,f=e[b+=1],y=!0;d.push(b-2),h[b-2]=!0,v=b-2+p,m=void 0}else y=!0}g=f}if(y&&u&&u(),0===d.length)return e;l&&l();for(var w=e.slice(0,d[0]),k=0;kt)return!0;if(n-(o=r+1)<=t)return!1}return!0}(s,S.fold.lineWidth-c.length)),p=u?"|":">";if(!s)return p+"\n";var f="",d="";if(s=s.replace(/[\n\t ]*$/,(function(e){var t=e.indexOf("\n");return-1===t?p+="-":s!==e&&t===e.length-1||(p+="+",o&&o()),d=e.replace(/\n$/,""),""})).replace(/^[\n ]*/,(function(e){-1!==e.indexOf(" ")&&(p+=l);var t=e.match(/ +$/);return t?(f=e.slice(0,-t[0].length),t[0]):(f=e,"")})),d&&(d=d.replace(/\n+(?!\n|$)/g,"$&".concat(c))),f&&(f=f.replace(/\n+/g,"$&".concat(c))),i&&(p+=" #"+i.replace(/ ?[\r\n]+/g," "),n&&n()),!s)return"".concat(p).concat(l,"\n").concat(c).concat(d);if(u)return s=s.replace(/\n+/g,"$&".concat(c)),"".concat(p,"\n").concat(c).concat(f).concat(s).concat(d);s=s.replace(/\n+/g,"\n$&").replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,"$&".concat(c));var h=E("".concat(f).concat(s).concat(d),c,"block",S.fold);return"".concat(p,"\n").concat(c).concat(h)}function P(e,t,n,o){var i=S.defaultType,a=t.implicitKey,s=t.inFlow,c=e,l=c.type,u=c.value;"string"!=typeof u&&(u=String(u),e=Object.assign({},e,{value:u}));var p=function(i){switch(i){case r.e.BLOCK_FOLDED:case r.e.BLOCK_LITERAL:return I(e,t,n,o);case r.e.QUOTE_DOUBLE:return T(u,t);case r.e.QUOTE_SINGLE:return C(u,t);case r.e.PLAIN:return function(e,t,n,o){var i=e.comment,a=e.type,s=e.value,c=t.actualString,l=t.implicitKey,u=t.indent,p=t.inFlow;if(l&&/[\n[\]{},]/.test(s)||p&&/[[\]{},]/.test(s))return T(s,t);if(!s||/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(s))return l||p||-1===s.indexOf("\n")?-1!==s.indexOf('"')&&-1===s.indexOf("'")?C(s,t):T(s,t):I(e,t,n,o);if(!l&&!p&&a!==r.e.PLAIN&&-1!==s.indexOf("\n"))return I(e,t,n,o);if(""===u&&j(s))return t.forceBlockIndent=!0,I(e,t,n,o);var f=s.replace(/\n+/g,"$&\n".concat(u));if(c){var d=t.doc.schema.tags;if("string"!=typeof O(f,d,d.scalarFallback).value)return T(s,t)}var h=l?f:E(f,u,"flow",_(t));return!i||p||-1===h.indexOf("\n")&&-1===i.indexOf("\n")?h:(n&&n(),function(e,t,n){if(!n)return e;var r=n.replace(/[\s\S]^/gm,"$&".concat(t,"#"));return"#".concat(r,"\n").concat(t).concat(e)}(h,u,i))}(e,t,n,o);default:return null}};l!==r.e.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f]/.test(u)?l=r.e.QUOTE_DOUBLE:!a&&!s||l!==r.e.BLOCK_FOLDED&&l!==r.e.BLOCK_LITERAL||(l=r.e.QUOTE_DOUBLE);var f=p(l);if(null===f&&null===(f=p(i)))throw new Error("Unsupported default string type ".concat(i));return f}function R(e){var t=e.format,n=e.minFractionDigits,r=e.tag,o=e.value;if("bigint"==typeof o)return String(o);if(!isFinite(o))return isNaN(o)?".nan":o<0?"-.inf":".inf";var i=JSON.stringify(o);if(!t&&n&&(!r||"tag:yaml.org,2002:float"===r)&&/^\d/.test(i)){var a=i.indexOf(".");a<0&&(a=i.length,i+=".");for(var s=n-(i.length-a-1);s-- >0;)i+="0"}return i}function L(e,t){var n,o,i;switch(t.type){case r.e.FLOW_MAP:n="}",o="flow map";break;case r.e.FLOW_SEQ:n="]",o="flow sequence";break;default:return void e.push(new r.n(t,"Not a flow collection!?"))}for(var a=t.items.length-1;a>=0;--a){var s=t.items[a];if(!s||s.type!==r.e.COMMENT){i=s;break}}if(i&&i.char!==n){var c,l="Expected ".concat(o," to end with ").concat(n);"number"==typeof i.offset?(c=new r.n(t,l)).offset=i.offset+1:(c=new r.n(i,l),i.range&&i.range.end&&(c.offset=i.range.end-i.range.start)),e.push(c)}}function N(e,t){var n=t.context.src[t.range.start-1];if("\n"!==n&&"\t"!==n&&" "!==n){e.push(new r.n(t,"Comments must be separated from other tokens by white space characters"))}}function M(e,t){var n=String(t),o=n.substr(0,8)+"..."+n.substr(-8);return new r.n(e,'The "'.concat(o,'" key is too long'))}function B(e,t){var n,o=Object(r.g)(t);try{for(o.s();!(n=o.n()).done;){var i=n.value,a=i.afterKey,s=i.before,c=i.comment,l=e.items[s];l?(a&&l.value&&(l=l.value),void 0===c?!a&&l.commentBefore||(l.spaceBefore=!0):l.commentBefore?l.commentBefore+="\n"+c:l.commentBefore=c):void 0!==c&&(e.comment?e.comment+="\n"+c:e.comment=c)}}catch(e){o.e(e)}finally{o.f()}}function D(e,t){var n=t.strValue;return n?"string"==typeof n?n:(n.errors.forEach((function(n){n.source||(n.source=t),e.errors.push(n)})),n.str):""}function q(e,t){var n=t.tag,o=t.type,i=!1;if(n){var a=n.handle,s=n.suffix,c=n.verbatim;if(c){if("!"!==c&&"!!"!==c)return c;var l="Verbatim tags aren't resolved, so ".concat(c," is invalid.");e.errors.push(new r.n(t,l))}else if("!"!==a||s)try{return function(e,t){var n=t.tag,o=n.handle,i=n.suffix,a=e.tagPrefixes.find((function(e){return e.handle===o}));if(!a){var s=e.getDefaults().tagPrefixes;if(s&&(a=s.find((function(e){return e.handle===o}))),!a)throw new r.n(t,"The ".concat(o," tag handle is non-default and was not declared."))}if(!i)throw new r.n(t,"The ".concat(o," tag has no suffix."));if("!"===o&&"1.0"===(e.version||e.options.version)){if("^"===i[0])return e.warnings.push(new r.m(t,"YAML 1.0 ^ tag expansion is not supported")),i;if(/[:/]/.test(i)){var c=i.match(/^([a-z0-9-]+)\/(.*)/i);return c?"tag:".concat(c[1],".yaml.org,2002:").concat(c[2]):"tag:".concat(i)}}return a.prefix+decodeURIComponent(i)}(e,t)}catch(t){e.errors.push(t)}else i=!0}switch(o){case r.e.BLOCK_FOLDED:case r.e.BLOCK_LITERAL:case r.e.QUOTE_DOUBLE:case r.e.QUOTE_SINGLE:return r.u.STR;case r.e.FLOW_MAP:case r.e.MAP:return r.u.MAP;case r.e.FLOW_SEQ:case r.e.SEQ:return r.u.SEQ;case r.e.PLAIN:return i?r.u.STR:null;default:return null}}function F(e,t,n){var o,i=e.schema.tags,a=[],c=Object(r.g)(i);try{for(c.s();!(o=c.n()).done;){var l=o.value;if(l.tag===n){if(!l.test){var p=l.resolve(e,t);return p instanceof u?p:new s(p)}a.push(l)}}}catch(e){c.e(e)}finally{c.f()}var f=D(e,t);return"string"==typeof f&&a.length>0?O(f,a,i.scalarFallback):null}function z(e,t,n){try{var o=F(e,t,n);if(o)return n&&t.tag&&(o.tag=n),o}catch(n){return n.source||(n.source=t),e.errors.push(n),null}try{var i=function(e){switch(e.type){case r.e.FLOW_MAP:case r.e.MAP:return r.u.MAP;case r.e.FLOW_SEQ:case r.e.SEQ:return r.u.SEQ;default:return r.u.STR}}(t);if(!i)throw new Error("The tag ".concat(n," is unavailable"));var a="The tag ".concat(n," is unavailable, falling back to ").concat(i);e.warnings.push(new r.m(t,a));var s=F(e,t,i);return s.tag=n,s}catch(n){var c=new r.v(t,n.message);return c.stack=n.stack,e.errors.push(c),null}}function U(e,t){var n,o={before:[],after:[]},i=!1,a=!1,s=function(e){if(!e)return!1;var t=e.type;return t===r.e.MAP_KEY||t===r.e.MAP_VALUE||t===r.e.SEQ_ITEM}(t.context.parent)?t.context.parent.props.concat(t.props):t.props,c=Object(r.g)(s);try{for(c.s();!(n=c.n()).done;){var l=n.value,u=l.start,p=l.end;switch(t.context.src[u]){case r.a.COMMENT:if(!t.commentHasRequiredWhitespace(u)){e.push(new r.n(t,"Comments must be separated from other tokens by white space characters"))}var f=t.header,d=t.valueRange;(d&&(u>d.start||f&&u>f.start)?o.after:o.before).push(t.context.src.slice(u+1,p));break;case r.a.ANCHOR:if(i){e.push(new r.n(t,"A node can have at most one anchor"))}i=!0;break;case r.a.TAG:if(a){e.push(new r.n(t,"A node can have at most one tag"))}a=!0}}}catch(e){c.e(e)}finally{c.f()}return{comments:o,hasAnchor:i,hasTag:a}}function $(e,t){if(!t)return null;t.error&&e.errors.push(t.error);var n=U(e.errors,t),o=n.comments,i=n.hasAnchor,a=n.hasTag;if(i){var s=e.anchors,c=t.anchor,l=s.getNode(c);l&&(s.map[s.newName(c)]=l),s.map[c]=t}if(t.type===r.e.ALIAS&&(i||a)){e.errors.push(new r.n(t,"An alias node must not specify any properties"))}var u=function(e,t){var n=e.anchors,o=e.errors,i=e.schema;if(t.type===r.e.ALIAS){var a=t.rawValue,s=n.getNode(a);if(!s){var c="Aliased anchor not found: ".concat(a);return o.push(new r.v(t,c)),null}var l=new v(s);return n._cstAliases.push(l),l}var u=q(e,t);if(u)return z(e,t,u);if(t.type!==r.e.PLAIN){var p="Failed to resolve ".concat(t.type," node here");return o.push(new r.f(t,p)),null}try{return O(D(e,t),i.tags,i.tags.scalarFallback)}catch(e){return e.source||(e.source=t),o.push(e),null}}(e,t);if(u){u.range=[t.range.start,t.range.end],e.options.keepCstNodes&&(u.cstNode=t),e.options.keepNodeTypes&&(u.type=t.type);var p=o.before.join("\n");p&&(u.commentBefore=u.commentBefore?"".concat(u.commentBefore,"\n").concat(p):p);var f=o.after.join("\n");f&&(u.comment=u.comment?"".concat(u.comment,"\n").concat(f):f)}return t.resolved=u}function H(e,t){if(t.type!==r.e.MAP&&t.type!==r.e.FLOW_MAP){var n="A ".concat(t.type," node cannot be resolved as a mapping");return e.errors.push(new r.f(t,n)),null}var o=t.type===r.e.FLOW_MAP?function(e,t){for(var n=[],o=[],i=void 0,a=!1,s="{",c=0;c0){(l=new r.c(r.e.PLAIN,[])).context={parent:c,src:c.context.src};var u=c.range.start+1;if(l.range={start:u,end:u},l.valueRange={start:u,end:u},"number"==typeof c.range.origStart){var p=c.range.origStart+1;l.range.origStart=l.range.origEnd=p,l.valueRange.origStart=l.valueRange.origEnd=p}}var f=new d(i,$(e,l));W(c,f),o.push(f),i&&"number"==typeof a&&c.range.start>a+1024&&e.errors.push(M(t,i)),i=void 0,a=null;break;default:void 0!==i&&o.push(new d(i)),i=$(e,c),a=c.range.start,c.error&&e.errors.push(c.error);e:for(var h=s+1;;++h){var v=t.items[h];switch(v&&v.type){case r.e.BLANK_LINE:case r.e.COMMENT:continue e;case r.e.MAP_VALUE:break e;default:e.errors.push(new r.n(c,"Implicit map keys need to be followed by map values"));break e}}if(c.valueRangeContainsNewline){e.errors.push(new r.n(c,"Implicit map keys need to be on a single line"))}}}void 0!==i&&o.push(new d(i));return{comments:n,items:o}}(e,t),i=o.comments,a=o.items,s=new g;s.items=a,B(s,i);for(var c=!1,l=0;lo.valueRange.start)return!1;if(i[s]!==r.a.COMMENT)return!1;for(var c=n;cs+1024&&e.errors.push(M(t,a));for(var g=l.context.src,y=s;ye.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(r=e[Symbol.iterator]()).next.bind(r)}var r=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e){function t(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}e.exports={defaults:{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1},getDefaults:t,changeDefaults:function(t){e.exports.defaults=t}}})),o=(r.defaults,r.getDefaults,r.changeDefaults,/[&<>"']/),i=/[&<>"']/g,a=/[<>"']|&(?!#?\w+;)/,s=/[<>"']|&(?!#?\w+;)/g,c={"&":"&","<":"<",">":">",'"':""","'":"'"},l=function(e){return c[e]},u=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function p(e){return e.replace(u,(function(e,t){return"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""}))}var f=/(^|[^\[])\^/g,d=/[^\w:]/g,h=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i,v={},m=/^[^:]+:\/*[^/]*$/,g=/^([^:]+:)[\s\S]*$/,y=/^([^:]+:\/*[^/]*)[\s\S]*$/;function b(e,t){v[" "+e]||(m.test(e)?v[" "+e]=e+"/":v[" "+e]=x(e,"/",!0));var n=-1===(e=v[" "+e]).indexOf(":");return"//"===t.substring(0,2)?n?t:e.replace(g,"$1")+t:"/"===t.charAt(0)?n?t:e.replace(y,"$1")+t:e+t}function x(e,t,n){var r=e.length;if(0===r)return"";for(var o=0;o=0&&"\\"===n[o];)r=!r;return r?"|":" |"})).split(/ \|/),r=0;if(n.length>t)n.splice(t);else for(;n.length1;)1&t&&(n+=e),t>>=1,e+=e;return n+e},P=r.defaults,R=j,L=_,N=w,M=T;function B(e,t,n){var r=t.href,o=t.title?N(t.title):null,i=e[1].replace(/\\([\[\]])/g,"$1");return"!"!==e[0].charAt(0)?{type:"link",raw:n,href:r,title:o,text:i}:{type:"image",raw:n,href:r,title:o,text:N(i)}}var D=function(){function e(e){this.options=e||P}var t=e.prototype;return t.space=function(e){var t=this.rules.block.newline.exec(e);if(t)return t[0].length>1?{type:"space",raw:t[0]}:{raw:"\n"}},t.code=function(e,t){var n=this.rules.block.code.exec(e);if(n){var r=t[t.length-1];if(r&&"paragraph"===r.type)return{raw:n[0],text:n[0].trimRight()};var o=n[0].replace(/^ {4}/gm,"");return{type:"code",raw:n[0],codeBlockStyle:"indented",text:this.options.pedantic?o:R(o,"\n")}}},t.fences=function(e){var t=this.rules.block.fences.exec(e);if(t){var n=t[0],r=function(e,t){var n=e.match(/^(\s+)(?:```)/);if(null===n)return t;var r=n[1];return t.split("\n").map((function(e){var t=e.match(/^\s+/);return null===t?e:t[0].length>=r.length?e.slice(r.length):e})).join("\n")}(n,t[3]||"");return{type:"code",raw:n,lang:t[2]?t[2].trim():t[2],text:r}}},t.heading=function(e){var t=this.rules.block.heading.exec(e);if(t){var n=t[2].trim();if(/#$/.test(n)){var r=R(n,"#");this.options.pedantic?n=r.trim():r&&!/ $/.test(r)||(n=r.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n}}},t.nptable=function(e){var t=this.rules.block.nptable.exec(e);if(t){var n={type:"table",header:L(t[1].replace(/^ *| *\| *$/g,"")),align:t[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:t[3]?t[3].replace(/\n$/,"").split("\n"):[],raw:t[0]};if(n.header.length===n.align.length){var r,o=n.align.length;for(r=0;r ?/gm,"");return{type:"blockquote",raw:t[0],text:n}}},t.list=function(e){var t=this.rules.block.list.exec(e);if(t){var n,r,o,i,a,s,c,l,u=t[0],p=t[2],f=p.length>1,d={type:"list",raw:u,ordered:f,start:f?+p.slice(0,-1):"",loose:!1,items:[]},h=t[0].match(this.rules.block.item),v=!1,m=h.length;o=this.rules.block.listItemStart.exec(h[0]);for(var g=0;go[0].length||i[1].length>3){h.splice(g,2,h[g]+"\n"+h[g+1]),g--,m--;continue}(!this.options.pedantic||this.options.smartLists?i[2][i[2].length-1]!==p[p.length-1]:f===(1===i[2].length))&&(a=h.slice(g+1).join("\n"),d.raw=d.raw.substring(0,d.raw.length-a.length),g=m-1),o=i}r=n.length,~(n=n.replace(/^ *([*+-]|\d+[.)]) ?/,"")).indexOf("\n ")&&(r-=n.length,n=this.options.pedantic?n.replace(/^ {1,4}/gm,""):n.replace(new RegExp("^ {1,"+r+"}","gm"),"")),s=v||/\n\n(?!\s*$)/.test(n),g!==m-1&&(v="\n"===n.charAt(n.length-1),s||(s=v)),s&&(d.loose=!0),this.options.gfm&&(l=void 0,(c=/^\[[ xX]\] /.test(n))&&(l=" "!==n[1],n=n.replace(/^\[[ xX]\] +/,""))),d.items.push({type:"list_item",raw:u,task:c,checked:l,loose:s,text:n})}return d}},t.html=function(e){var t=this.rules.block.html.exec(e);if(t)return{type:this.options.sanitize?"paragraph":"html",raw:t[0],pre:!this.options.sanitizer&&("pre"===t[1]||"script"===t[1]||"style"===t[1]),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(t[0]):N(t[0]):t[0]}},t.def=function(e){var t=this.rules.block.def.exec(e);if(t)return t[3]&&(t[3]=t[3].substring(1,t[3].length-1)),{tag:t[1].toLowerCase().replace(/\s+/g," "),raw:t[0],href:t[2],title:t[3]}},t.table=function(e){var t=this.rules.block.table.exec(e);if(t){var n={type:"table",header:L(t[1].replace(/^ *| *\| *$/g,"")),align:t[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:t[3]?t[3].replace(/\n$/,"").split("\n"):[]};if(n.header.length===n.align.length){n.raw=t[0];var r,o=n.align.length;for(r=0;r/i.test(r[0])&&(t=!1),!n&&/^<(pre|code|kbd|script)(\s|>)/i.test(r[0])?n=!0:n&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(r[0])&&(n=!1),{type:this.options.sanitize?"text":"html",raw:r[0],inLink:t,inRawBlock:n,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(r[0]):N(r[0]):r[0]}},t.link=function(e){var t=this.rules.inline.link.exec(e);if(t){var n=t[2].trim();if(!this.options.pedantic&&/^$/.test(n))return;var r=R(n.slice(0,-1),"\\");if((n.length-r.length)%2==0)return}else{var o=M(t[2],"()");if(o>-1){var i=(0===t[0].indexOf("!")?5:4)+t[1].length+o;t[2]=t[2].substring(0,o),t[0]=t[0].substring(0,i).trim(),t[3]=""}}var a=t[2],s="";if(this.options.pedantic){var c=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(a);c&&(a=c[1],s=c[3])}else s=t[3]?t[3].slice(1,-1):"";return a=a.trim(),/^$/.test(n)?a.slice(1):a.slice(1,-1)),B(t,{href:a?a.replace(this.rules.inline._escapes,"$1"):a,title:s?s.replace(this.rules.inline._escapes,"$1"):s},t[0])}},t.reflink=function(e,t){var n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){var r=(n[2]||n[1]).replace(/\s+/g," ");if(!(r=t[r.toLowerCase()])||!r.href){var o=n[0].charAt(0);return{type:"text",raw:o,text:o}}return B(n,r,n[0])}},t.strong=function(e,t,n){void 0===n&&(n="");var r=this.rules.inline.strong.start.exec(e);if(r&&(!r[1]||r[1]&&(""===n||this.rules.inline.punctuation.exec(n)))){t=t.slice(-1*e.length);var o,i="**"===r[0]?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;for(i.lastIndex=0;null!=(r=i.exec(t));)if(o=this.rules.inline.strong.middle.exec(t.slice(0,r.index+3)))return{type:"strong",raw:e.slice(0,o[0].length),text:e.slice(2,o[0].length-2)}}},t.em=function(e,t,n){void 0===n&&(n="");var r=this.rules.inline.em.start.exec(e);if(r&&(!r[1]||r[1]&&(""===n||this.rules.inline.punctuation.exec(n)))){t=t.slice(-1*e.length);var o,i="*"===r[0]?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;for(i.lastIndex=0;null!=(r=i.exec(t));)if(o=this.rules.inline.em.middle.exec(t.slice(0,r.index+2)))return{type:"em",raw:e.slice(0,o[0].length),text:e.slice(1,o[0].length-1)}}},t.codespan=function(e){var t=this.rules.inline.code.exec(e);if(t){var n=t[2].replace(/\n/g," "),r=/[^ ]/.test(n),o=/^ /.test(n)&&/ $/.test(n);return r&&o&&(n=n.substring(1,n.length-1)),n=N(n,!0),{type:"codespan",raw:t[0],text:n}}},t.br=function(e){var t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}},t.del=function(e){var t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2]}},t.autolink=function(e,t){var n,r,o=this.rules.inline.autolink.exec(e);if(o)return r="@"===o[2]?"mailto:"+(n=N(this.options.mangle?t(o[1]):o[1])):n=N(o[1]),{type:"link",raw:o[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}},t.url=function(e,t){var n;if(n=this.rules.inline.url.exec(e)){var r,o;if("@"===n[2])o="mailto:"+(r=N(this.options.mangle?t(n[0]):n[0]));else{var i;do{i=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])[0]}while(i!==n[0]);r=N(n[0]),o="www."===n[1]?"http://"+r:r}return{type:"link",raw:n[0],text:r,href:o,tokens:[{type:"text",raw:r,text:r}]}}},t.inlineText=function(e,t,n){var r,o=this.rules.inline.text.exec(e);if(o)return r=t?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(o[0]):N(o[0]):o[0]:N(this.options.smartypants?n(o[0]):o[0]),{type:"text",raw:o[0],text:r}},e}(),q=A,F=S,z=E,U={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?! {0,3}bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:q,table:q,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/};U.def=F(U.def).replace("label",U._label).replace("title",U._title).getRegex(),U.bullet=/(?:[*+-]|\d{1,9}[.)])/,U.item=/^( *)(bull) ?[^\n]*(?:\n(?! *bull ?)[^\n]*)*/,U.item=F(U.item,"gm").replace(/bull/g,U.bullet).getRegex(),U.listItemStart=F(/^( *)(bull)/).replace("bull",U.bullet).getRegex(),U.list=F(U.list).replace(/bull/g,U.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+U.def.source+")").getRegex(),U._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",U._comment=/|$)/,U.html=F(U.html,"i").replace("comment",U._comment).replace("tag",U._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),U.paragraph=F(U._paragraph).replace("hr",U.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",U._tag).getRegex(),U.blockquote=F(U.blockquote).replace("paragraph",U.paragraph).getRegex(),U.normal=z({},U),U.gfm=z({},U.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n {0,3}([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n {0,3}\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),U.gfm.nptable=F(U.gfm.nptable).replace("hr",U.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",U._tag).getRegex(),U.gfm.table=F(U.gfm.table).replace("hr",U.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",U._tag).getRegex(),U.pedantic=z({},U.normal,{html:F("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?\\1> *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",U._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:q,paragraph:F(U.normal._paragraph).replace("hr",U.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",U.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var $={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:q,tag:"^comment|^[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation_\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation*\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation_\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation*\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:q,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~"};$.punctuation=F($.punctuation).replace(/punctuation/g,$._punctuation).getRegex(),$._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",$._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",$._comment=F(U._comment).replace("(?:--\x3e|$)","--\x3e").getRegex(),$.em.start=F($.em.start).replace(/punctuation/g,$._punctuation).getRegex(),$.em.middle=F($.em.middle).replace(/punctuation/g,$._punctuation).replace(/overlapSkip/g,$._overlapSkip).getRegex(),$.em.endAst=F($.em.endAst,"g").replace(/punctuation/g,$._punctuation).getRegex(),$.em.endUnd=F($.em.endUnd,"g").replace(/punctuation/g,$._punctuation).getRegex(),$.strong.start=F($.strong.start).replace(/punctuation/g,$._punctuation).getRegex(),$.strong.middle=F($.strong.middle).replace(/punctuation/g,$._punctuation).replace(/overlapSkip/g,$._overlapSkip).getRegex(),$.strong.endAst=F($.strong.endAst,"g").replace(/punctuation/g,$._punctuation).getRegex(),$.strong.endUnd=F($.strong.endUnd,"g").replace(/punctuation/g,$._punctuation).getRegex(),$.blockSkip=F($._blockSkip,"g").getRegex(),$.overlapSkip=F($._overlapSkip,"g").getRegex(),$._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,$._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,$._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,$.autolink=F($.autolink).replace("scheme",$._scheme).replace("email",$._email).getRegex(),$._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,$.tag=F($.tag).replace("comment",$._comment).replace("attribute",$._attribute).getRegex(),$._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,$._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,$._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,$.link=F($.link).replace("label",$._label).replace("href",$._href).replace("title",$._title).getRegex(),$.reflink=F($.reflink).replace("label",$._label).getRegex(),$.reflinkSearch=F($.reflinkSearch,"g").replace("reflink",$.reflink).replace("nolink",$.nolink).getRegex(),$.normal=z({},$),$.pedantic=z({},$.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:F(/^!?\[(label)\]\((.*?)\)/).replace("label",$._label).getRegex(),reflink:F(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",$._label).getRegex()}),$.gfm=z({},$.normal,{escape:F($.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\.5&&(n="x"+n.toString(16)),r+=""+n+";";return r}var Q=function(){function t(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||W,this.options.tokenizer=this.options.tokenizer||new D,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var t={block:V.normal,inline:Y.normal};this.options.pedantic?(t.block=V.pedantic,t.inline=Y.pedantic):this.options.gfm&&(t.block=V.gfm,this.options.breaks?t.inline=Y.breaks:t.inline=Y.gfm),this.tokenizer.rules=t}t.lex=function(e,n){return new t(n).lex(e)},t.lexInline=function(e,n){return new t(n).inlineTokens(e)};var n,r,o,i=t.prototype;return i.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," "),this.blockTokens(e,this.tokens,!0),this.inline(this.tokens),this.tokens},i.blockTokens=function(e,t,n){var r,o,i,a;for(void 0===t&&(t=[]),void 0===n&&(n=!0),e=e.replace(/^ +$/gm,"");e;)if(r=this.tokenizer.space(e))e=e.substring(r.raw.length),r.type&&t.push(r);else if(r=this.tokenizer.code(e,t))e=e.substring(r.raw.length),r.type?t.push(r):((a=t[t.length-1]).raw+="\n"+r.raw,a.text+="\n"+r.text);else if(r=this.tokenizer.fences(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.heading(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.nptable(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.hr(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.blockquote(e))e=e.substring(r.raw.length),r.tokens=this.blockTokens(r.text,[],n),t.push(r);else if(r=this.tokenizer.list(e)){for(e=e.substring(r.raw.length),i=r.items.length,o=0;o0)for(;null!=(i=this.tokenizer.rules.inline.reflinkSearch.exec(c));)l.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(c=c.slice(0,i.index)+"["+K("a",i[0].length-2)+"]"+c.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(i=this.tokenizer.rules.inline.blockSkip.exec(c));)c=c.slice(0,i.index)+"["+K("a",i[0].length-2)+"]"+c.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;e;)if(a||(s=""),a=!1,o=this.tokenizer.escape(e))e=e.substring(o.raw.length),t.push(o);else if(o=this.tokenizer.tag(e,n,r))e=e.substring(o.raw.length),n=o.inLink,r=o.inRawBlock,t.push(o);else if(o=this.tokenizer.link(e))e=e.substring(o.raw.length),"link"===o.type&&(o.tokens=this.inlineTokens(o.text,[],!0,r)),t.push(o);else if(o=this.tokenizer.reflink(e,this.tokens.links))e=e.substring(o.raw.length),"link"===o.type&&(o.tokens=this.inlineTokens(o.text,[],!0,r)),t.push(o);else if(o=this.tokenizer.strong(e,c,s))e=e.substring(o.raw.length),o.tokens=this.inlineTokens(o.text,[],n,r),t.push(o);else if(o=this.tokenizer.em(e,c,s))e=e.substring(o.raw.length),o.tokens=this.inlineTokens(o.text,[],n,r),t.push(o);else if(o=this.tokenizer.codespan(e))e=e.substring(o.raw.length),t.push(o);else if(o=this.tokenizer.br(e))e=e.substring(o.raw.length),t.push(o);else if(o=this.tokenizer.del(e))e=e.substring(o.raw.length),o.tokens=this.inlineTokens(o.text,[],n,r),t.push(o);else if(o=this.tokenizer.autolink(e,J))e=e.substring(o.raw.length),t.push(o);else if(n||!(o=this.tokenizer.url(e,J))){if(o=this.tokenizer.inlineText(e,r,G))e=e.substring(o.raw.length),s=o.raw.slice(-1),a=!0,t.push(o);else if(e){var u="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(u);break}throw new Error(u)}}else e=e.substring(o.raw.length),t.push(o);return t},n=t,o=[{key:"rules",get:function(){return{block:V,inline:Y}}}],(r=null)&&e(n.prototype,r),o&&e(n,o),t}(),X=r.defaults,Z=O,ee=w,te=function(){function e(e){this.options=e||X}var t=e.prototype;return t.code=function(e,t,n){var r=(t||"").match(/\S*/)[0];if(this.options.highlight){var o=this.options.highlight(e,r);null!=o&&o!==e&&(n=!0,e=o)}return r?'