Compare commits

...

4 Commits

Author SHA1 Message Date
2adcc249de 1.0.4 2024-02-16 13:41:05 +01:00
543e696bfc fix(core): update 2024-02-16 13:41:04 +01:00
796e0204ca 1.0.3 2024-02-16 13:28:40 +01:00
f5a36ab53a fix(core): update 2024-02-16 13:28:40 +01:00
31 changed files with 1396 additions and 133 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@serve.zone/platformservice",
"version": "1.0.2",
"version": "1.0.4",
"description": "contains the platformservice container with mail, sms, letter, ai services.",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
@ -23,10 +23,23 @@
"dependencies": {
"@api.global/typedrequest": "^3.0.4",
"@api.global/typedserver": "^3.0.20",
"@api.global/typedsocket": "^3.0.0",
"@apiclient.xyz/cloudflare": "^6.0.3",
"@push.rocks/projectinfo": "^5.0.1",
"@push.rocks/qenv": "^6.0.5",
"@push.rocks/smartdata": "^5.0.7",
"@push.rocks/smartfile": "^11.0.4",
"@push.rocks/smartlog": "^3.0.3",
"@push.rocks/smartmail": "^1.0.24",
"@push.rocks/smartpath": "^5.0.5",
"@push.rocks/smartstate": "^2.0.0"
"@push.rocks/smartpromise": "^4.0.3",
"@push.rocks/smartrequest": "^2.0.21",
"@push.rocks/smartrx": "^3.0.7",
"@push.rocks/smartstate": "^2.0.0",
"@serve.zone/interfaces": "^1.0.34",
"@tsclass/tsclass": "^4.0.51",
"mailauth": "^4.6.5",
"mailparser": "^3.6.7",
"uuid": "^9.0.1"
}
}

469
pnpm-lock.yaml generated
View File

@ -11,6 +11,12 @@ dependencies:
'@api.global/typedserver':
specifier: ^3.0.20
version: 3.0.20
'@api.global/typedsocket':
specifier: ^3.0.0
version: 3.0.0
'@apiclient.xyz/cloudflare':
specifier: ^6.0.3
version: 6.0.3
'@push.rocks/projectinfo':
specifier: ^5.0.1
version: 5.0.2
@ -20,12 +26,45 @@ dependencies:
'@push.rocks/smartdata':
specifier: ^5.0.7
version: 5.0.33
'@push.rocks/smartfile':
specifier: ^11.0.4
version: 11.0.4
'@push.rocks/smartlog':
specifier: ^3.0.3
version: 3.0.3
'@push.rocks/smartmail':
specifier: ^1.0.24
version: 1.0.24
'@push.rocks/smartpath':
specifier: ^5.0.5
version: 5.0.11
'@push.rocks/smartpromise':
specifier: ^4.0.3
version: 4.0.3
'@push.rocks/smartrequest':
specifier: ^2.0.21
version: 2.0.21
'@push.rocks/smartrx':
specifier: ^3.0.7
version: 3.0.7
'@push.rocks/smartstate':
specifier: ^2.0.0
version: 2.0.17
'@serve.zone/interfaces':
specifier: ^1.0.34
version: 1.0.34
'@tsclass/tsclass':
specifier: ^4.0.51
version: 4.0.51
mailauth:
specifier: ^4.6.5
version: 4.6.5
mailparser:
specifier: ^3.6.7
version: 3.6.7
uuid:
specifier: ^9.0.1
version: 9.0.1
devDependencies:
'@git.zone/tsbuild':
@ -92,9 +131,7 @@ packages:
express-force-ssl: 0.3.2
lit: 3.1.2
transitivePeerDependencies:
- bufferutil
- supports-color
- utf-8-validate
/@api.global/typedsocket@3.0.0:
resolution: {integrity: sha512-ui+6MLd99iTN/lC+iC/FKPRjzVyiZ4PrmlU6ptbCtbBj3cSOXHx+RRGF54+be2xHodf4FOgwFv/GZdW8LtO3vg==}
@ -112,6 +149,17 @@ packages:
- supports-color
- utf-8-validate
/@apiclient.xyz/cloudflare@6.0.3:
resolution: {integrity: sha512-NOPHFrKVxfkrRn9lVBLCdo0Ibm08PuaJe3A1K6TmXWxgbeJSqGkgVMGRwLilnol/062v6/1w2ZFO6f3fAxk5Gw==}
dependencies:
'@pushrocks/smartdelay': 3.0.1
'@pushrocks/smartlog': 3.0.2
'@pushrocks/smartpromise': 4.0.2
'@pushrocks/smartrequest': 2.0.15
'@pushrocks/smartstring': 4.0.7
'@tsclass/tsclass': 4.0.51
dev: false
/@apiglobal/typedrequest-interfaces@1.0.20:
resolution: {integrity: sha512-ybsDtavYbzGJYSLodSbkxDvSLYtfMzBTuNZDJpiANt1rZA2MO/GCq8zk5MVLlrUUQIr/7oxPGWqxi1QDwR+RHQ==}
@ -944,6 +992,11 @@ packages:
dev: true
optional: true
/@fastify/busboy@2.1.0:
resolution: {integrity: sha512-+KpH+QxZU7O4675t3mnkQKcZZg56u+K/Ct2K+N2AZYNVK8kyeo/bI18tI8aPm3tvNNRyTWfj6s5tnGNlcbQRsA==}
engines: {node: '>=14'}
dev: false
/@git.zone/tsbuild@2.1.72:
resolution: {integrity: sha512-rVWM98chNjkt8pXdF5knGErZjM3GPnRXZYHVGECptxNvvhTol2DliM1OP8k3p3X5UOwEPV2sQVe//XzXs3BcUw==}
hasBin: true
@ -1045,6 +1098,16 @@ packages:
- supports-color
dev: true
/@hapi/hoek@9.3.0:
resolution: {integrity: sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ==}
dev: false
/@hapi/topo@5.1.0:
resolution: {integrity: sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==}
dependencies:
'@hapi/hoek': 9.3.0
dev: false
/@isaacs/cliui@8.0.2:
resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==}
engines: {node: '>=12'}
@ -1176,12 +1239,47 @@ packages:
- utf-8-validate
dev: true
/@peculiar/asn1-schema@2.3.8:
resolution: {integrity: sha512-ULB1XqHKx1WBU/tTFIA+uARuRoBVZ4pNdOA878RDrRbBfBGcSzi5HBkdScC6ZbHn8z7L8gmKCgPC1LHRrP46tA==}
dependencies:
asn1js: 3.0.5
pvtsutils: 1.3.5
tslib: 2.6.2
dev: false
/@peculiar/asn1-x509-logotype@2.3.8:
resolution: {integrity: sha512-8o3iLl/aQP/HEpaxmU9tGo/7iqSb6XQtSYbJIOd8cXg7Wy5xnBsO5JgCs/njl0pFg+nph37DHFiVqy/R4kmIGQ==}
dependencies:
'@peculiar/asn1-schema': 2.3.8
'@peculiar/asn1-x509': 2.3.8
asn1js: 3.0.5
tslib: 2.6.2
dev: false
/@peculiar/asn1-x509@2.3.8:
resolution: {integrity: sha512-voKxGfDU1c6r9mKiN5ZUsZWh3Dy1BABvTM3cimf0tztNwyMJPhiXY94eRTgsMQe6ViLfT6EoXxkWVzcm3mFAFw==}
dependencies:
'@peculiar/asn1-schema': 2.3.8
asn1js: 3.0.5
ipaddr.js: 2.1.0
pvtsutils: 1.3.5
tslib: 2.6.2
dev: false
/@pkgjs/parseargs@0.11.0:
resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==}
engines: {node: '>=14'}
requiresBuild: true
optional: true
/@postalsys/vmc@1.0.8:
resolution: {integrity: sha512-qIa71QZOJAr7JJJ4I4Zdre7YeBBBZyBqCl3p3gt8NARPFpIsSjrYUo3CpiU4cFWVcTBCAco9zBgazgE64p6pLA==}
dependencies:
'@peculiar/asn1-schema': 2.3.8
'@peculiar/asn1-x509': 2.3.8
'@peculiar/asn1-x509-logotype': 2.3.8
dev: false
/@push.rocks/consolecolor@2.0.1:
resolution: {integrity: sha512-iQx+sjxmvhRXjnv8aMiaZu125ZWfyZKSylCvKUNjVrdhkmP2uPy2VWsvyRBS4UiieYHTY/i+HpQiFv4QZV2/Fg==}
dependencies:
@ -1321,6 +1419,17 @@ packages:
dependencies:
'@push.rocks/smartpromise': 4.0.3
/@push.rocks/smartdns@5.0.4:
resolution: {integrity: sha512-DCeekCzAJEPn8gZOPZLnFGFZdgLKtCqb3YfwJpfkdSfPxwlSXzjs5rYmzmsg0BlQP+7pSR43fuLMERB4DGCn9w==}
dependencies:
'@pushrocks/smartdelay': 2.0.13
'@pushrocks/smartenv': 5.0.5
'@pushrocks/smartpromise': 3.1.10
'@pushrocks/smartrequest': 2.0.15
'@tsclass/tsclass': 4.0.51
dns2: 2.1.0
dev: false
/@push.rocks/smartenv@5.0.12:
resolution: {integrity: sha512-tDEFwywzq0FNzRYc9qY2dRl2pgQuZG0G2/yml2RLWZWSW+Fn1EHshnKOGHz8o77W7zvu4hTgQQX42r/JY5XHTg==}
dependencies:
@ -1425,6 +1534,16 @@ packages:
'@push.rocks/isounique': 1.0.5
'@push.rocks/smartlog-interfaces': 3.0.0
/@push.rocks/smartmail@1.0.24:
resolution: {integrity: sha512-UUIKQmMiCpcnkql4uoPp0kDRDnGl1jV5UbacRkoaKHh6PPd4trkZRVcVQadtpEqteFb6W0B9Z/YtMKpTPxUsxA==}
dependencies:
'@push.rocks/smartdns': 5.0.4
'@push.rocks/smartfile': 10.0.41
'@push.rocks/smartmustache': 3.0.2
'@push.rocks/smartpath': 5.0.11
'@push.rocks/smartrequest': 2.0.21
dev: false
/@push.rocks/smartmanifest@2.0.2:
resolution: {integrity: sha512-QGc5C9vunjfUbYsPGz5bynV/mVmPHkrQDkWp8ZO8VJtK1GZe+njgbrNyxn2SUHR0IhSAbSXl1j4JvBqYf5eTVg==}
@ -1457,6 +1576,12 @@ packages:
- supports-color
dev: false
/@push.rocks/smartmustache@3.0.2:
resolution: {integrity: sha512-G3LyRXoJhyM+iQhkvP/MR/2WYMvC9U7zc2J44JxUM5tPdkQ+o3++FbfRtnZj6rz5X/A7q03//vsxPitVQwoi2Q==}
dependencies:
handlebars: 4.7.8
dev: false
/@push.rocks/smartnetwork@3.0.2:
resolution: {integrity: sha512-s6CNGzQ1n/d/6cOKXbxeW6/tO//dr1woLqI01g7XhqTriw0nsm2G2kWaZh2J0VOguGNWBgQVCIpR0LjdRNWb3g==}
dependencies:
@ -1775,7 +1900,6 @@ packages:
deprecated: This package has been deprecated in favour of the new package at @push.rocks/smartdelay
dependencies:
'@pushrocks/smartpromise': 4.0.2
dev: true
/@pushrocks/smartenv@5.0.5:
resolution: {integrity: sha512-VWON1OJ4qV2/9hzJbgRquRekaO9am3b8W82tgCwgO6LBg23ea2tanfd+gESVMbRFduxHVoFLvlhSBcDGM5zsLA==}
@ -1875,7 +1999,14 @@ packages:
deprecated: This package has been deprecated in favour of the new package at @push.rocks/smartlog-interfaces
dependencies:
'@apiglobal/typedrequest-interfaces': 2.0.1
dev: true
/@pushrocks/smartlog@3.0.2:
resolution: {integrity: sha512-1WPA0LX9HfE54ESKtk32uvsXiYIMu2QX7NUlQ3uHSMmFULnJYo2m/LeKEf6qHH7DJtxZbkWzkrMOkZVPL1MeNg==}
deprecated: This package has been deprecated in favour of the new package at @push.rocks/smartlog
dependencies:
'@pushrocks/isounique': 1.0.5
'@pushrocks/smartlog-interfaces': 3.0.0
dev: false
/@pushrocks/smartmatch@1.0.7:
resolution: {integrity: sha512-D+lK5HIKO4Kj1Jm/ycKvy1VzDJ3V6ucHqmf5DMBFdm18BrMj2Zb6M7wN8HUKtkfHvOI7ig85JMuANSEyO7kAPg==}
@ -1933,6 +2064,16 @@ packages:
form-data: 4.0.0
dev: false
/@pushrocks/smartrequest@2.0.15:
resolution: {integrity: sha512-QDXXKhOwAIp+TNFrDglApBpbCTClHrf8pUM3w81q5+VtrMbqUrLINHhInXt3ZUSgTS7RD9HtJSIVSqAukcJo5A==}
deprecated: This package has been deprecated in favour of the new package at @push.rocks/smartrequest
dependencies:
'@pushrocks/smartpromise': 4.0.2
'@pushrocks/smarturl': 3.0.6
agentkeepalive: 4.5.0
form-data: 4.0.0
dev: false
/@pushrocks/smartrx@2.0.27:
resolution: {integrity: sha512-aFRpGxDZgHH1mpmkRBTFwuIVqFiDxk22n2vX2gW4hntV0nJGlt9M9dixMFFXGUjabwX9hHW7y60QPJm2rKaypA==}
deprecated: This package has been deprecated in favour of the new package at @push.rocks/smartrx
@ -2003,12 +2144,46 @@ packages:
deprecated: This package has been deprecated in favour of the new package at @push.rocks/smarturl
dev: false
/@pushrocks/smarturl@3.0.6:
resolution: {integrity: sha512-YHWnYE1mm8WIJk1usSXg+kNM7s7ByM+PKApO9cgl0T/oGybjzAJiO3clGNDro4ysP0TD+WuvJuiVue02bErEBQ==}
deprecated: This package has been deprecated in favour of the new package at @push.rocks/smarturl
dev: false
/@rkusa/linebreak@1.0.0:
resolution: {integrity: sha512-yCSm87XA1aYMgfcABSxcIkk3JtCw3AihNceHY+DnZGLvVP/g2z3UWZbi0xIoYpZWAJEVPr5Zt3QE37Q80wF1pA==}
dependencies:
unicode-trie: 0.3.1
dev: true
/@selderee/plugin-htmlparser2@0.11.0:
resolution: {integrity: sha512-P33hHGdldxGabLFjPPpaTxVolMrzrcegejx+0GxjrIb9Zv48D8yAIA/QTDR2dFl7Uz7urX8aX6+5bCZslr+gWQ==}
dependencies:
domhandler: 5.0.3
selderee: 0.11.0
dev: false
/@serve.zone/interfaces@1.0.34:
resolution: {integrity: sha512-5G340VReyWT8v4DNMUOfWQtZSDAA+sCnWwhMUaVcGglMSSMpPge6N3G7M7gbRknf87nqN13U/6+ZzVqRz3U52w==}
dependencies:
'@apiglobal/typedrequest-interfaces': 2.0.1
'@push.rocks/smartlog-interfaces': 3.0.0
'@tsclass/tsclass': 4.0.51
dev: false
/@sideway/address@4.1.5:
resolution: {integrity: sha512-IqO/DUQHUkPeixNQ8n0JA6102hT9CmaljNTPmQ1u8MEhBo/R4Q8eKLN/vGZxuebwOroDB4cbpjheD4+/sKFK4Q==}
dependencies:
'@hapi/hoek': 9.3.0
dev: false
/@sideway/formula@3.0.1:
resolution: {integrity: sha512-/poHZJJVjx3L+zVD6g9KgHfYnb443oi7wLu/XKojDviHy6HOEOA6z1Trk5aR1dGcmPenJEgb2sK2I80LeS3MIg==}
dev: false
/@sideway/pinpoint@2.0.0:
resolution: {integrity: sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==}
dev: false
/@sindresorhus/is@5.6.0:
resolution: {integrity: sha512-TV7t8GKYaJWsn00tFDqBw8+Uqmr8A0fRU1tvTQhyZzGv0sJCGRQL3JGMI3ucuKo3XIZdUP+Lx7/gh2t3lewy7g==}
engines: {node: '>=14.16'}
@ -3123,6 +3298,15 @@ packages:
is-shared-array-buffer: 1.0.2
dev: true
/asn1js@3.0.5:
resolution: {integrity: sha512-FVnvrKJwpt9LP2lAMl8qZswRNm3T4q9CON+bxldk2iwk3FFpuwhx2FfinyitizWHsVYyaY+y5JzDR0rCMV5yTQ==}
engines: {node: '>=12.0.0'}
dependencies:
pvtsutils: 1.3.5
pvutils: 1.1.3
tslib: 2.6.2
dev: false
/assertion-error@1.1.0:
resolution: {integrity: sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==}
dev: true
@ -3430,6 +3614,15 @@ packages:
wrap-ansi: 5.1.0
dev: true
/cliui@8.0.1:
resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==}
engines: {node: '>=12'}
dependencies:
string-width: 4.2.3
strip-ansi: 6.0.1
wrap-ansi: 7.0.0
dev: false
/clone@2.1.2:
resolution: {integrity: sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=}
engines: {node: '>=0.8'}
@ -3640,6 +3833,11 @@ packages:
resolution: {integrity: sha1-9dJgKStmDghO/0zbyfCK0yR0SLU=}
dev: true
/deepmerge@4.3.1:
resolution: {integrity: sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==}
engines: {node: '>=0.10.0'}
dev: false
/defer-to-connect@2.0.1:
resolution: {integrity: sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==}
engines: {node: '>=10'}
@ -3731,11 +3929,42 @@ packages:
dns-packet: 5.6.1
dev: true
/dns2@2.1.0:
resolution: {integrity: sha512-m27K11aQalRbmUs7RLaz6aPyceLjAoqjPRNTdE7qUouQpl+PC8Bi67O+i9SuJUPbQC8dxFrczAxfmTPuTKHNkw==}
dev: false
/dom-serializer@2.0.0:
resolution: {integrity: sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==}
dependencies:
domelementtype: 2.3.0
domhandler: 5.0.3
entities: 4.5.0
dev: false
/domelementtype@2.3.0:
resolution: {integrity: sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==}
dev: false
/domexception@1.0.1:
resolution: {integrity: sha512-raigMkn7CJNNo6Ihro1fzG7wr3fHuYVytzquZKX5n0yizGsTcYgzdIUwj1X9pK0VvjeihV+XiclP+DjwbsSKug==}
dependencies:
webidl-conversions: 4.0.2
/domhandler@5.0.3:
resolution: {integrity: sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==}
engines: {node: '>= 4'}
dependencies:
domelementtype: 2.3.0
dev: false
/domutils@3.1.0:
resolution: {integrity: sha512-H78uMmQtI2AhgDJjWeQmHwJJ2bLPD3GMmO7Zja/ZZh84wkm+4ut+IUnUdRa8uCGX88DiVx1j6FRe1XfxEgjEZA==}
dependencies:
dom-serializer: 2.0.0
domelementtype: 2.3.0
domhandler: 5.0.3
dev: false
/eastasianwidth@0.2.0:
resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==}
@ -3756,6 +3985,11 @@ packages:
resolution: {integrity: sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=}
engines: {node: '>= 0.8'}
/encoding-japanese@2.0.0:
resolution: {integrity: sha512-++P0RhebUC8MJAwJOsT93dT+5oc5oPImp1HubZpAuCZ5kTLnhuuBhKHj2jJeO/Gj93idPBWmIuQ9QWMe5rX3pQ==}
engines: {node: '>=8.10.0'}
dev: false
/end-of-stream@1.4.4:
resolution: {integrity: sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==}
dependencies:
@ -3800,6 +4034,11 @@ packages:
/entities@2.2.0:
resolution: {integrity: sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==}
/entities@4.5.0:
resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==}
engines: {node: '>=0.12'}
dev: false
/errorstacks@2.4.1:
resolution: {integrity: sha512-jE4i0SMYevwu/xxAuzhly/KTwtj0xDhbzB6m1xPImxTkw8wcCbgarOQPfCVMi5JKVyW7in29pNJCCJrry3Ynnw==}
dev: true
@ -3918,6 +4157,11 @@ packages:
'@esbuild/win32-x64': 0.19.12
dev: true
/escalade@3.1.2:
resolution: {integrity: sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==}
engines: {node: '>=6'}
dev: false
/escape-html@1.0.3:
resolution: {integrity: sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=}
@ -4230,7 +4474,6 @@ packages:
/get-caller-file@2.0.5:
resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==}
engines: {node: 6.* || 8.* || >= 10.*}
dev: true
/get-func-name@2.0.2:
resolution: {integrity: sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==}
@ -4360,6 +4603,19 @@ packages:
engines: {node: '>=4.x'}
dev: true
/handlebars@4.7.8:
resolution: {integrity: sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==}
engines: {node: '>=0.4.7'}
hasBin: true
dependencies:
minimist: 1.2.8
neo-async: 2.6.2
source-map: 0.6.1
wordwrap: 1.0.0
optionalDependencies:
uglify-js: 3.17.4
dev: false
/has-bigints@1.0.2:
resolution: {integrity: sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==}
dev: true
@ -4403,7 +4659,6 @@ packages:
/he@1.2.0:
resolution: {integrity: sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==}
hasBin: true
dev: true
/html-escaper@2.0.2:
resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==}
@ -4423,6 +4678,26 @@ packages:
uglify-js: 3.17.4
dev: true
/html-to-text@9.0.5:
resolution: {integrity: sha512-qY60FjREgVZL03vJU6IfMV4GDjGBIoOyvuFdpBDIX9yTlDw0TjxVBQp+P8NvpdIXNJvfWBTNul7fsAQJq2FNpg==}
engines: {node: '>=14'}
dependencies:
'@selderee/plugin-htmlparser2': 0.11.0
deepmerge: 4.3.1
dom-serializer: 2.0.0
htmlparser2: 8.0.2
selderee: 0.11.0
dev: false
/htmlparser2@8.0.2:
resolution: {integrity: sha512-GYdjWKDkbRLkZ5geuHs5NY1puJ+PXwP7+fHPRz06Eirsb9ugf6d8kkXav6ADhcODhFFPMIXyxkxSuMf3D6NCFA==}
dependencies:
domelementtype: 2.3.0
domhandler: 5.0.3
domutils: 3.1.0
entities: 4.5.0
dev: false
/http-assert@1.5.0:
resolution: {integrity: sha512-uPpH7OKX4H25hBmU6G1jWNaqJGpTXxey+YOUizJUAgu0AjLUeC8D73hTrhvDS5D+GJN1DN1+hhc/eF/wpxtp0w==}
engines: {node: '>= 0.8'}
@ -4494,6 +4769,13 @@ packages:
dependencies:
safer-buffer: 2.1.2
/iconv-lite@0.6.3:
resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==}
engines: {node: '>=0.10.0'}
dependencies:
safer-buffer: 2.1.2
dev: false
/idb@7.1.1:
resolution: {integrity: sha512-gchesWBzyvGHRO9W8tzUWFDycow5gwjvFKfyV9FF32Y7F50yZMp7mP+T2mJIWFx49zicqyC4uefHM17o6xKIVQ==}
@ -4558,6 +4840,11 @@ packages:
resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==}
engines: {node: '>= 0.10'}
/ipaddr.js@2.1.0:
resolution: {integrity: sha512-LlbxQ7xKzfBusov6UMi4MFpEg0m+mAm9xyNGEduwXMEDuf4WfzB/RZwMVYEd7IKGvh4IUkEXYxtAVu9T3OelJQ==}
engines: {node: '>= 10'}
dev: false
/is-array-buffer@3.0.4:
resolution: {integrity: sha512-wcjaerHw0ydZwfhiKbXJWLDY8A7yV7KhjQOpb83hGgGfId/aQa4TOvwyzn2PuswW2gPCYEL/nEAiSVpdOj1lXw==}
engines: {node: '>= 0.4'}
@ -4788,6 +5075,16 @@ packages:
optionalDependencies:
'@pkgjs/parseargs': 0.11.0
/joi@17.12.1:
resolution: {integrity: sha512-vtxmq+Lsc5SlfqotnfVjlViWfOL9nt/avKNbKYizwf6gsCfq9NYY/ceYRMFD8XDdrjJ9abJyScWmhmIiy+XRtQ==}
dependencies:
'@hapi/hoek': 9.3.0
'@hapi/topo': 5.1.0
'@sideway/address': 4.1.5
'@sideway/formula': 3.0.1
'@sideway/pinpoint': 2.0.0
dev: false
/js-base64@3.7.6:
resolution: {integrity: sha512-NPrWuHFxFUknr1KqJRDgUQPexQF0uIJWjeT+2KjEePhitQxQEx5EJBG1lVn5/hc8aLycTpXrDOgPQ6Zq+EDiTA==}
@ -4922,6 +5219,42 @@ packages:
- supports-color
dev: true
/leac@0.6.0:
resolution: {integrity: sha512-y+SqErxb8h7nE/fiEX07jsbuhrpO9lL8eca7/Y1nuWV2moNlXhyd59iDGcRf6moVyDMbmTNzL40SUyrFU/yDpg==}
dev: false
/libbase64@1.2.1:
resolution: {integrity: sha512-l+nePcPbIG1fNlqMzrh68MLkX/gTxk/+vdvAb388Ssi7UuUN31MI44w4Yf33mM3Cm4xDfw48mdf3rkdHszLNew==}
dev: false
/libmime@5.2.0:
resolution: {integrity: sha512-X2U5Wx0YmK0rXFbk67ASMeqYIkZ6E5vY7pNWRKtnNzqjvdYYG8xtPDpCnuUEnPU9vlgNev+JoSrcaKSUaNvfsw==}
dependencies:
encoding-japanese: 2.0.0
iconv-lite: 0.6.3
libbase64: 1.2.1
libqp: 2.0.1
dev: false
/libmime@5.2.1:
resolution: {integrity: sha512-A0z9O4+5q+ZTj7QwNe/Juy1KARNb4WaviO4mYeFC4b8dBT2EEqK2pkM+GC8MVnkOjqhl5nYQxRgnPYRRTNmuSQ==}
dependencies:
encoding-japanese: 2.0.0
iconv-lite: 0.6.3
libbase64: 1.2.1
libqp: 2.0.1
dev: false
/libqp@2.0.1:
resolution: {integrity: sha512-Ka0eC5LkF3IPNQHJmYBWljJsw0UvM6j+QdKRbWyCdTmYwvIDE6a7bCm0UkTAL/K+3KXK5qXT/ClcInU01OpdLg==}
dev: false
/linkify-it@5.0.0:
resolution: {integrity: sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==}
dependencies:
uc.micro: 2.0.0
dev: false
/lit-element@2.5.1:
resolution: {integrity: sha512-ogu7PiJTA33bEK0xGu1dmaX5vhcRjBXCFexPja0e7P7jqLhTpNKYRPmE+GmiCaRVAbiQKGkUgkh/i6+bh++dPQ==}
dependencies:
@ -5065,6 +5398,46 @@ packages:
dependencies:
yallist: 4.0.0
/mailauth@4.6.5:
resolution: {integrity: sha512-bQFgHrhcmks+LNwcEYTxqX3PZ2lA2LvAUatxSgmfZREbJfDBSwvZ9NX8Nc/l2t/DyUF6dmorPqn+gGdQZjfKCw==}
engines: {node: '>=16.0.0'}
hasBin: true
dependencies:
'@postalsys/vmc': 1.0.8
fast-xml-parser: 4.3.4
ipaddr.js: 2.1.0
joi: 17.12.1
libmime: 5.2.1
nodemailer: 6.9.9
psl: 1.9.0
punycode: 2.3.1
undici: 5.28.2
uuid: 9.0.1
yargs: 17.7.2
dev: false
/mailparser@3.6.7:
resolution: {integrity: sha512-/3x8HW70DNehw+3vdOPKdlLuxOHoWcGB5jfx5vJ5XUbY9/2jUJbrrhda5Si8Dj/3w08U0y5uGAkqs5+SPTPKoA==}
dependencies:
encoding-japanese: 2.0.0
he: 1.2.0
html-to-text: 9.0.5
iconv-lite: 0.6.3
libmime: 5.2.1
linkify-it: 5.0.0
mailsplit: 5.4.0
nodemailer: 6.9.9
tlds: 1.248.0
dev: false
/mailsplit@5.4.0:
resolution: {integrity: sha512-wnYxX5D5qymGIPYLwnp6h8n1+6P6vz/MJn5AzGjZ8pwICWssL+CCQjWBIToOVHASmATot4ktvlLo6CyLfOXWYA==}
dependencies:
libbase64: 1.2.1
libmime: 5.2.0
libqp: 2.0.1
dev: false
/make-dir@3.1.0:
resolution: {integrity: sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==}
engines: {node: '>=8'}
@ -5190,7 +5563,6 @@ packages:
/minimist@1.2.8:
resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==}
dev: true
/minipass@7.0.4:
resolution: {integrity: sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==}
@ -5361,6 +5733,10 @@ packages:
resolution: {integrity: sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==}
engines: {node: '>= 0.6'}
/neo-async@2.6.2:
resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==}
dev: false
/new-find-package-json@2.0.0:
resolution: {integrity: sha512-lDcBsjBSMlj3LXH2v/FW3txlh2pYTjmbOXPYJD93HI5EwuLzI11tdHSIpUMmfq/IOsldj4Ps8M8flhm+pCK4Ew==}
engines: {node: '>=12.22.0'}
@ -5405,6 +5781,11 @@ packages:
whatwg-url: 5.0.0
dev: true
/nodemailer@6.9.9:
resolution: {integrity: sha512-dexTll8zqQoVJEZPwQAKzxxtFn0qTnjdQTchoU6Re9BUUGBJiOy3YMn/0ShTW6J5M0dfQ1NeDeRTTl4oIWgQMA==}
engines: {node: '>=6.0.0'}
dev: false
/normalize-newline@4.1.0:
resolution: {integrity: sha512-ff4jKqMI8Xl50/4Mms/9jPobzAV/UK+kXG2XJ/7AqOmxIx8mqfqTIHYxuAnEgJ2AQeBbLnlbmZ5+38Y9A0w/YA==}
engines: {node: '>=12'}
@ -5560,6 +5941,13 @@ packages:
resolution: {integrity: sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==}
dev: true
/parseley@0.12.1:
resolution: {integrity: sha512-e6qHKe3a9HWr0oMRVDTRhKce+bRO8VGQR3NyVwcjwrbhMmFCX9KszEV35+rn4AdilFAq9VPxP/Fe1wC9Qjd2lw==}
dependencies:
leac: 0.6.0
peberminta: 0.9.0
dev: false
/parseurl@1.3.3:
resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==}
engines: {node: '>= 0.8'}
@ -5632,6 +6020,10 @@ packages:
uuid: 8.3.2
dev: true
/peberminta@0.9.0:
resolution: {integrity: sha512-XIxfHpEuSJbITd1H3EeQwpcZbTLHc+VVr8ANI9t5sit565tsI4/xK3KWTUFE2e6QiangUkh3B0jihzmGnNrRsQ==}
dev: false
/pend@1.2.0:
resolution: {integrity: sha1-elfrVQpng/kRUzH89GY9XI4AelA=}
@ -5682,6 +6074,10 @@ packages:
resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==}
dev: true
/psl@1.9.0:
resolution: {integrity: sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==}
dev: false
/public-ip@6.0.1:
resolution: {integrity: sha512-1/Mxa1MKrAQ4jF5IalECSBtB0W1FAtnG+9c5X16jjvV/Gx9fiRy7xXIrHlBGYjnTlai0zdZkM3LrpmASavmAEg==}
engines: {node: '>=14.16'}
@ -5730,6 +6126,17 @@ packages:
- utf-8-validate
dev: true
/pvtsutils@1.3.5:
resolution: {integrity: sha512-ARvb14YB9Nm2Xi6nBq1ZX6dAM0FsJnuk+31aUp4TrcZEdKUlSqOqsxJHUPJDNE3qiIp+iUPEIeR6Je/tgV7zsA==}
dependencies:
tslib: 2.6.2
dev: false
/pvutils@1.1.3:
resolution: {integrity: sha512-pMpnA0qRdFp32b1sJl1wOJNxZLQ2cbQx+k6tjNtZ8CpvVhNqEPRgivZ2WOUev2YMajecdH7ctUPDvEe87nariQ==}
engines: {node: '>=6.0.0'}
dev: false
/qs@6.11.0:
resolution: {integrity: sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==}
engines: {node: '>=0.6'}
@ -5836,7 +6243,6 @@ packages:
/require-directory@2.1.1:
resolution: {integrity: sha1-jGStX9MNqxyXbiNE/+f3kqam30I=}
engines: {node: '>=0.10.0'}
dev: true
/require-main-filename@2.0.0:
resolution: {integrity: sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==}
@ -5929,6 +6335,12 @@ packages:
/sax@1.3.0:
resolution: {integrity: sha512-0s+oAmw9zLl1V1cS9BtZN7JAd0cW5e0QH4W3LWEK6a4LaLEA2OTpGYWDY+6XasBLtz6wkm3u1xRw95mRuJ59WA==}
/selderee@0.11.0:
resolution: {integrity: sha512-5TF+l7p4+OsnP8BCCvSyZiSPc4x4//p5uPwK8TCnVPJYRmU2aYKMpOXvw8zM5a5JvuuCGN1jmsMwuU2W02ukfA==}
dependencies:
parseley: 0.12.1
dev: false
/semver@5.7.2:
resolution: {integrity: sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==}
hasBin: true
@ -6131,7 +6543,6 @@ packages:
/source-map@0.6.1:
resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==}
engines: {node: '>=0.10.0'}
dev: true
/source-map@0.7.4:
resolution: {integrity: sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==}
@ -6371,6 +6782,11 @@ packages:
esm: 3.2.25
dev: true
/tlds@1.248.0:
resolution: {integrity: sha512-noj0KdpWTBhwsKxMOXk0rN9otg4kTgLm4WohERRHbJ9IY+kSDKr3RmjitaQ3JFzny+DyvBOQKlFZhp0G0qNSfg==}
hasBin: true
dev: false
/to-regex-range@5.0.1:
resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==}
engines: {node: '>=8.0'}
@ -6536,11 +6952,14 @@ packages:
resolution: {integrity: sha512-6FTtyGr8ldU0pfbvW/eOZrEtEkczHRUtduBnA90Jh9kMPCiFNnXIon3vF41N0S4tV1HHQt4Hk1j4srpESziCaA==}
engines: {node: '>=0.1.14'}
/uc.micro@2.0.0:
resolution: {integrity: sha512-DffL94LsNOccVn4hyfRe5rdKa273swqeA5DJpMOeFmEn1wCDc7nAbbB0gXlgBCL7TNzeTv6G7XVWzan7iJtfig==}
dev: false
/uglify-js@3.17.4:
resolution: {integrity: sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==}
engines: {node: '>=0.8.0'}
hasBin: true
dev: true
/unbox-primitive@1.0.2:
resolution: {integrity: sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==}
@ -6561,6 +6980,13 @@ packages:
/undici-types@5.26.5:
resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==}
/undici@5.28.2:
resolution: {integrity: sha512-wh1pHJHnUeQV5Xa8/kyQhO7WFa8M34l026L5P/+2TYiakvGy5Rdc8jWZVyG7ieht/0WgJLEd3kcU5gKx+6GC8w==}
engines: {node: '>=14.0'}
dependencies:
'@fastify/busboy': 2.1.0
dev: false
/unicode-trie@0.3.1:
resolution: {integrity: sha1-1nHd3YkQGgi6w3tqUWEBBgIFIIU=}
dependencies:
@ -6706,6 +7132,10 @@ packages:
string-width: 2.1.1
dev: true
/wordwrap@1.0.0:
resolution: {integrity: sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=}
dev: false
/wrap-ansi@5.1.0:
resolution: {integrity: sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==}
engines: {node: '>=6'}
@ -6819,6 +7249,11 @@ packages:
resolution: {integrity: sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==}
dev: true
/y18n@5.0.8:
resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==}
engines: {node: '>=10'}
dev: false
/yallist@4.0.0:
resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==}
@ -6832,7 +7267,6 @@ packages:
/yargs-parser@21.1.1:
resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==}
engines: {node: '>=12'}
dev: true
/yargs-unparser@1.6.0:
resolution: {integrity: sha512-W9tKgmSn0DpSatfri0nx52Joq5hVXgeLiqR/5G0sZNDoLZFOr/xjBUDcShCOGNsBnEMNo1KAMBkTej1Hm62HTw==}
@ -6858,6 +7292,19 @@ packages:
yargs-parser: 13.1.2
dev: true
/yargs@17.7.2:
resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==}
engines: {node: '>=12'}
dependencies:
cliui: 8.0.1
escalade: 3.1.2
get-caller-file: 2.0.5
require-directory: 2.1.1
string-width: 4.2.3
y18n: 5.0.8
yargs-parser: 21.1.1
dev: false
/yauzl@2.10.0:
resolution: {integrity: sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=}
dependencies:

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@serve.zone/platformservice',
version: '1.0.2',
version: '1.0.4',
description: 'contains the platformservice container with mail, sms, letter, ai services.'
}

View File

@ -1,5 +1,5 @@
import * as plugins from './platformservice.plugins.js';
import * as paths from './platformservice.paths.js';
import * as plugins from './plugins.js';
import * as paths from './paths.js';
import { PlatformServiceDb } from './classes.platformservicedb.js'
export class SzPlatformService {

View File

@ -1,4 +1,4 @@
import * as plugins from './platformservice.plugins.js';
import * as plugins from './plugins.js';
import { SzPlatformService } from './classes.platformservice.js';

View File

@ -1,17 +1,16 @@
import * as plugins from './email.plugins.js';
import { Email } from './email.classes.email.js';
import { request } from 'http';
import { logger } from './email.logging.js';
import * as plugins from '../plugins.js';
import { EmailService } from './email.classes.emailservice.js';
import { logger } from '../logger.js';
export class ApiManager {
public emailRef: Email;
public emailRef: EmailService;
public typedRouter = new plugins.typedrequest.TypedRouter();
constructor(emailRefArg: Email) {
constructor(emailRefArg: EmailService) {
this.emailRef = emailRefArg;
this.emailRef.mainTypedRouter.addTypedRouter(this.typedRouter);
this.typedRouter.addTypedHandler<plugins.lointEmail.IRequestSendEmail>(
this.emailRef.typedrouter.addTypedRouter(this.typedRouter);
this.typedRouter.addTypedHandler<plugins.servezoneInterfaces.platformservice.mta.IRequest_SendEmail>(
new plugins.typedrequest.TypedHandler('sendEmail', async (requestData) => {
const mailToSend = new plugins.smartmail.Smartmail({
body: requestData.body,
@ -22,7 +21,7 @@ export class ApiManager {
if (requestData.attachments) {
for (const attachment of requestData.attachments) {
mailToSend.addAttachment(
await plugins.smartfile.Smartfile.fromString(
await plugins.smartfile.SmartFile.fromString(
attachment.name,
attachment.binaryAttachmentString,
'binary'

View File

@ -1,11 +1,11 @@
import * as plugins from './email.plugins.js';
import { Email } from './email.classes.email.js';
import { EmailService } from './email.classes.emailservice.js';
export class MailgunConnector {
public emailRef: Email;
public emailRef: EmailService;
public mailgunAccount: plugins.mailgun.MailgunAccount;
constructor(emailRefArg: Email) {
constructor(emailRefArg: EmailService) {
this.emailRef = emailRefArg;
this.mailgunAccount = new plugins.mailgun.MailgunAccount({
apiToken: this.emailRef.qenv.getEnvVarOnDemand('MAILGUN_API_TOKEN'),

View File

@ -1,16 +1,16 @@
import * as plugins from './email.plugins.js';
import * as paths from './email.paths.js';
import * as plugins from '../plugins.js';
import * as paths from '../paths.js';
import { MailgunConnector } from './email.classes.connector.mailgun.js';
import { RuleManager } from './email.classes.rulemanager.js';
import { ApiManager } from './email.classes.apimanager.js';
import { logger } from './email.logging.js';
import { logger } from '../logger.js';
import type { SzPlatformService } from '../classes.platformservice.js';
export class Email {
export class EmailService {
public platformServiceRef: SzPlatformService;
// typedrouter
public mainTypedRouter = new plugins.typedrequest.TypedRouter();
public typedrouter = new plugins.typedrequest.TypedRouter();
// connectors
public mailgunConnector: MailgunConnector;
@ -22,11 +22,12 @@ export class Email {
constructor(platformServiceRefArg: SzPlatformService) {
this.platformServiceRef = platformServiceRefArg;
this.platformServiceRef.typedrouter.addTypedRouter(this.typedrouter);
this.mailgunConnector = new MailgunConnector(this);
this.ruleManager = new RuleManager(this);
this.platformServiceRef.typedserver.server.addRoute(
'/mailgun-notify',
new plugins.loleServiceserver.Handler('POST', async (req, res) => {
new plugins.typedserver.servertools.Handler('POST', async (req, res) => {
console.log('Got a mailgun email notification');
res.status(200);
res.end();

View File

@ -1,14 +1,14 @@
import * as plugins from './email.plugins.js';
import { Email } from './email.classes.email.js';
import { EmailService } from './email.classes.emailservice.js';
import { logger } from './email.logging.js';
export class RuleManager {
public emailRef: Email;
public emailRef: EmailService;
public smartruleInstance = new plugins.smartrule.SmartRule<
plugins.smartmail.Smartmail<plugins.mailgun.IMailgunMessage>
>();
constructor(emailRefArg: Email) {
constructor(emailRefArg: EmailService) {
this.emailRef = emailRefArg;
}

View File

@ -1,13 +0,0 @@
import * as plugins from './email.plugins.js';
import * as paths from './email.paths.js';
const projectInfoNpm = new plugins.projectinfo.ProjectinfoNpm(paths.packageDir);
export const logger = plugins.loleLog.createLoleLogger({
companyUnit: 'lossless.cloud',
containerName: 'email',
containerVersion: projectInfoNpm.version,
sentryAppName: 'email',
sentryDsn: 'https://7037e86f36134ced85ae56a57daa1e5e@o169278.ingest.sentry.io/5280282',
zone: 'servezone',
});

View File

@ -1,6 +0,0 @@
import * as plugins from './email.plugins.js';
export const packageDir = plugins.path.join(
plugins.smartpath.get.dirnameFromImportMetaUrl(import.meta.url),
'../'
);

View File

@ -1,43 +0,0 @@
// native scope
import * as path from 'path';
export { path };
// @losslessone_private scope
import * as loleLog from '@losslessone_private/lole-log';
import * as loleServiceserver from '@losslessone_private/lole-serviceserver';
import * as lointEmail from '@losslessone_private/loint-email';
export { loleLog, loleServiceserver, lointEmail };
// @apiglobal scope
import * as typedrequest from '@apiglobal/typedrequest';
export { typedrequest };
// @mojoio scope
import * as mailgun from '@mojoio/mailgun';
export { mailgun };
// @pushrocks scope
import * as projectinfo from '@pushrocks/projectinfo';
import * as qenv from '@pushrocks/qenv';
import * as smartfile from '@pushrocks/smartfile';
import * as smartmail from '@pushrocks/smartmail';
import * as smartpath from '@pushrocks/smartpath';
import * as smartrequest from '@pushrocks/smartrequest';
import * as smartrule from '@pushrocks/smartrule';
import * as smartvalidator from '@pushrocks/smartvalidator';
export {
projectinfo,
qenv,
smartfile,
smartmail,
smartpath,
smartrequest,
smartrule,
smartvalidator,
};

View File

@ -1,3 +1,3 @@
import { Email } from './email.classes.email.js';
import { EmailService } from './email.classes.emailservice.js';
export { Email };
export { EmailService as Email };

View File

@ -1,4 +1,4 @@
export * from './00_commitinfo_data.js';
import { SzPlatformService } from './classes.platformservice.js'
import { SzPlatformService } from './classes.platformservice.js';
export const runCli = async () => {}

9
ts/logger.ts Normal file
View File

@ -0,0 +1,9 @@
import * as plugins from './plugins.js';
export const logger = new plugins.smartlog.Smartlog({
logContext: {
environment: 'production',
runtime: 'node',
zone: 'serve.zone',
}
});

8
ts/mta/index.ts Normal file
View File

@ -0,0 +1,8 @@
export * from './mta.classes.dkimcreator.js';
export * from './mta.classes.emailsignjob.js';
export * from './mta.classes.dkimverifier.js';
export * from './mta.classes.mta.js';
export * from './mta.classes.smtpserver.js';
export * from './mta.classes.emailsendjob.js';
export * from './mta.classes.mta.js';
export * from './mta.classes.email.js';

View File

@ -0,0 +1,7 @@
import * as plugins from '../plugins.js';
export class ApiManager {
public typedrouter = new plugins.typedrequest.TypedRouter();
}

View File

@ -0,0 +1,119 @@
import * as plugins from '../plugins.js';
import * as paths from '../paths.js';
import { Email } from './mta.classes.email.js';
import type { MTA } from './mta.classes.mta.js';
const readFile = plugins.util.promisify(plugins.fs.readFile);
const writeFile = plugins.util.promisify(plugins.fs.writeFile);
const generateKeyPair = plugins.util.promisify(plugins.crypto.generateKeyPair);
export interface IKeyPaths {
privateKeyPath: string;
publicKeyPath: string;
}
export class DKIMCreator {
private keysDir: string;
constructor(metaRef: MTA, keysDir = paths.keysDir) {
this.keysDir = keysDir;
}
public async getKeyPathsForDomain(domainArg: string): Promise<IKeyPaths> {
return {
privateKeyPath: plugins.path.join(this.keysDir, `${domainArg}-private.pem`),
publicKeyPath: plugins.path.join(this.keysDir, `${domainArg}-public.pem`),
};
}
// Check if a DKIM key is present and creates one and stores it to disk otherwise
public async handleDKIMKeysForDomain(domainArg: string): Promise<void> {
try {
await this.readDKIMKeys(domainArg);
} catch (error) {
console.log(`No DKIM keys found for ${domainArg}. Generating...`);
await this.createAndStoreDKIMKeys(domainArg);
const dnsValue = await this.getDNSRecordForDomain(domainArg);
plugins.smartfile.fs.ensureDirSync(paths.dnsRecordsDir);
plugins.smartfile.memory.toFsSync(JSON.stringify(dnsValue, null, 2), plugins.path.join(paths.dnsRecordsDir, `${domainArg}.dkimrecord.json`));
}
}
public async handleDKIMKeysForEmail(email: Email): Promise<void> {
const domain = email.from.split('@')[1];
await this.handleDKIMKeysForDomain(domain);
}
// Read DKIM keys from disk
public async readDKIMKeys(domainArg: string): Promise<{ privateKey: string; publicKey: string }> {
const keyPaths = await this.getKeyPathsForDomain(domainArg);
const [privateKeyBuffer, publicKeyBuffer] = await Promise.all([
readFile(keyPaths.privateKeyPath),
readFile(keyPaths.publicKeyPath),
]);
// Convert the buffers to strings
const privateKey = privateKeyBuffer.toString();
const publicKey = publicKeyBuffer.toString();
return { privateKey, publicKey };
}
// Create a DKIM key pair
private async createDKIMKeys(): Promise<{ privateKey: string; publicKey: string }> {
const { privateKey, publicKey } = await generateKeyPair('rsa', {
modulusLength: 2048,
publicKeyEncoding: { type: 'spki', format: 'pem' },
privateKeyEncoding: { type: 'pkcs1', format: 'pem' },
});
return { privateKey, publicKey };
}
// Store a DKIM key pair to disk
private async storeDKIMKeys(
privateKey: string,
publicKey: string,
privateKeyPath: string,
publicKeyPath: string
): Promise<void> {
await Promise.all([writeFile(privateKeyPath, privateKey), writeFile(publicKeyPath, publicKey)]);
}
// Create a DKIM key pair and store it to disk
private async createAndStoreDKIMKeys(domain: string): Promise<void> {
const { privateKey, publicKey } = await this.createDKIMKeys();
const keyPaths = await this.getKeyPathsForDomain(domain);
await this.storeDKIMKeys(
privateKey,
publicKey,
keyPaths.privateKeyPath,
keyPaths.publicKeyPath
);
console.log(`DKIM keys for ${domain} created and stored.`);
}
private async getDNSRecordForDomain(domainArg: string): Promise<plugins.tsclass.network.IDnsRecord> {
await this.handleDKIMKeysForDomain(domainArg);
const keys = await this.readDKIMKeys(domainArg);
// Remove the PEM header and footer and newlines
const pemHeader = '-----BEGIN PUBLIC KEY-----';
const pemFooter = '-----END PUBLIC KEY-----';
const keyContents = keys.publicKey
.replace(pemHeader, '')
.replace(pemFooter, '')
.replace(/\n/g, '');
// Now generate the DKIM DNS TXT record
const dnsRecordValue = `v=DKIM1; h=sha256; k=rsa; p=${keyContents}`;
return {
name: `mta._domainkey.${domainArg}`,
type: 'TXT',
dnsSecEnabled: null,
value: dnsRecordValue,
};
}
}

View File

@ -0,0 +1,35 @@
import * as plugins from '../plugins.js';
import { MTA } from './mta.classes.mta.js';
class DKIMVerifier {
public mtaRef: MTA;
constructor(mtaRefArg: MTA) {
this.mtaRef = mtaRefArg;
}
async verify(email: string): Promise<boolean> {
console.log('Trying to verify DKIM now...');
try {
const verification = await plugins.mailauth.authenticate(email, {
/* resolver: (...args) => {
console.log(args);
} */
});
console.log(verification);
if (verification && verification.dkim.results[0].status.result === 'pass') {
console.log('DKIM Verification result: pass');
return true;
} else {
console.error('DKIM Verification failed:', verification?.error || 'Unknown error');
return false;
}
} catch (error) {
console.error('DKIM Verification failed:', error);
return false;
}
}
}
export { DKIMVerifier };

View File

@ -0,0 +1,10 @@
import type { MTA } from './mta.classes.mta.js';
import * as plugins from '../plugins.js';
export class DNSManager {
public mtaRef: MTA;
constructor(mtaRefArg: MTA) {
this.mtaRef = mtaRefArg;
}
}

View File

@ -0,0 +1,36 @@
export interface IAttachment {
filename: string;
content: Buffer;
contentType: string;
}
export interface IEmailOptions {
from: string;
to: string;
subject: string;
text: string;
attachments: IAttachment[];
mightBeSpam?: boolean;
}
export class Email {
from: string;
to: string;
subject: string;
text: string;
attachments: IAttachment[];
mightBeSpam: boolean;
constructor(options: IEmailOptions) {
this.from = options.from;
this.to = options.to;
this.subject = options.subject;
this.text = options.text;
this.attachments = options.attachments;
this.mightBeSpam = options.mightBeSpam || false;
}
public getFromDomain() {
return this.from.split('@')[1]
}
}

View File

@ -0,0 +1,173 @@
import * as plugins from '../plugins.js';
import * as paths from '../paths.js';
import { Email } from './mta.classes.email.js';
import { EmailSignJob } from './mta.classes.emailsignjob.js';
import type { MTA } from './mta.classes.mta.js';
export class EmailSendJob {
mtaRef: MTA;
private email: Email;
private socket: plugins.net.Socket | plugins.tls.TLSSocket = null;
private mxRecord: string = null;
constructor(mtaRef: MTA, emailArg: Email) {
this.email = emailArg;
this.mtaRef = mtaRef;
}
async send(): Promise<void> {
const domain = this.email.to.split('@')[1];
const addresses = await this.resolveMx(domain);
addresses.sort((a, b) => a.priority - b.priority);
this.mxRecord = addresses[0].exchange;
console.log(`Using ${this.mxRecord} as mail server for domain ${domain}`);
this.socket = plugins.net.connect(25, this.mxRecord);
await this.processInitialResponse();
await this.sendCommand(`EHLO ${this.email.from.split('@')[1]}\r\n`, '250');
try {
await this.sendCommand('STARTTLS\r\n', '220');
this.socket = plugins.tls.connect({ socket: this.socket, rejectUnauthorized: false });
await this.processTLSUpgrade(this.email.from.split('@')[1]);
} catch (error) {
console.log('Error sending STARTTLS command:', error);
console.log('Continuing with unencrypted connection...');
}
await this.sendMessage();
}
private resolveMx(domain: string): Promise<plugins.dns.MxRecord[]> {
return new Promise((resolve, reject) => {
plugins.dns.resolveMx(domain, (err, addresses) => {
if (err) {
console.error('Error resolving MX:', err);
reject(err);
} else {
resolve(addresses);
}
});
});
}
private processInitialResponse(): Promise<void> {
return new Promise((resolve, reject) => {
this.socket.once('data', (data) => {
const response = data.toString();
if (!response.startsWith('220')) {
console.error('Unexpected initial server response:', response);
reject(new Error(`Unexpected initial server response: ${response}`));
} else {
console.log('Received initial server response:', response);
console.log('Connected to server, sending EHLO...');
resolve();
}
});
});
}
private processTLSUpgrade(domain: string): Promise<void> {
return new Promise((resolve, reject) => {
this.socket.once('secureConnect', async () => {
console.log('TLS started successfully');
try {
await this.sendCommand(`EHLO ${domain}\r\n`, '250');
resolve();
} catch (err) {
console.error('Error sending EHLO after TLS upgrade:', err);
reject(err);
}
});
});
}
private sendCommand(command: string, expectedResponseCode?: string): Promise<void> {
return new Promise((resolve, reject) => {
this.socket.write(command, (error) => {
if (error) {
reject(error);
return;
}
if (!expectedResponseCode) {
resolve();
return;
}
this.socket.once('data', (data) => {
const response = data.toString();
if (response.startsWith('221')) {
this.socket.destroy();
resolve();
}
if (!response.startsWith(expectedResponseCode)) {
reject(new Error(`Unexpected server response: ${response}`));
} else {
resolve();
}
});
});
});
}
private async sendMessage(): Promise<void> {
console.log('Preparing email message...');
const messageId = `<${plugins.uuid.v4()}@${this.email.from.split('@')[1]}>`;
// Create a boundary for the email parts
const boundary = '----=_NextPart_' + plugins.uuid.v4();
const headers = {
From: this.email.from,
To: this.email.to,
Subject: this.email.subject,
'Content-Type': `multipart/mixed; boundary="${boundary}"`,
};
// Construct the body of the message
let body = `--${boundary}\r\nContent-Type: text/html; charset=utf-8\r\n\r\n${this.email.text}\r\n`;
// Then, the attachments
for (let attachment of this.email.attachments) {
body += `--${boundary}\r\nContent-Type: ${attachment.contentType}; name="${attachment.filename}"\r\n`;
body += 'Content-Transfer-Encoding: base64\r\n';
body += `Content-Disposition: attachment; filename="${attachment.filename}"\r\n\r\n`;
body += attachment.content.toString('base64') + '\r\n';
}
// End of email
body += `--${boundary}--\r\n`;
// Create an instance of DKIMSigner
const dkimSigner = new EmailSignJob(this.mtaRef, {
domain: this.email.getFromDomain(), // Replace with your domain
selector: `mta`, // Replace with your DKIM selector
headers: headers,
body: body,
});
// Construct the message with DKIM-Signature header
let message = `Message-ID: ${messageId}\r\nFrom: ${this.email.from}\r\nTo: ${this.email.to}\r\nSubject: ${this.email.subject}\r\nContent-Type: multipart/mixed; boundary="${boundary}"\r\n\r\n`;
message += body;
let signatureHeader = await dkimSigner.getSignatureHeader(message);
message = `${signatureHeader}${message}`;
plugins.smartfile.fs.ensureDirSync(paths.sentEmailsDir);
plugins.smartfile.memory.toFsSync(message, plugins.path.join(paths.sentEmailsDir, `${Date.now()}.eml`));
// Adding necessary commands before sending the actual email message
await this.sendCommand(`MAIL FROM:<${this.email.from}>\r\n`, '250');
await this.sendCommand(`RCPT TO:<${this.email.to}>\r\n`, '250');
await this.sendCommand(`DATA\r\n`, '354');
// Now send the message content
await this.sendCommand(message);
await this.sendCommand('\r\n.\r\n', '250');
await this.sendCommand('QUIT\r\n', '221');
console.log('Email message sent successfully!');
}
}

View File

@ -0,0 +1,69 @@
import * as plugins from '../plugins.js';
import type { MTA } from './mta.classes.mta.js';
interface Headers {
[key: string]: string;
}
interface IEmailSignJobOptions {
domain: string;
selector: string;
headers: Headers;
body: string;
}
export class EmailSignJob {
mtaRef: MTA;
jobOptions: IEmailSignJobOptions;
constructor(mtaRefArg: MTA, options: IEmailSignJobOptions) {
this.mtaRef = mtaRefArg;
this.jobOptions = options;
}
async loadPrivateKey(): Promise<string> {
return plugins.fs.promises.readFile(
(await this.mtaRef.dkimCreator.getKeyPathsForDomain(this.jobOptions.domain)).privateKeyPath,
'utf-8'
);
}
public async getSignatureHeader(emailMessage: string): Promise<string> {
const signResult = await plugins.dkimSign(emailMessage, {
// Optional, default canonicalization, default is "relaxed/relaxed"
canonicalization: 'relaxed/relaxed', // c=
// Optional, default signing and hashing algorithm
// Mostly useful when you want to use rsa-sha1, otherwise no need to set
algorithm: 'rsa-sha256',
// Optional, default is current time
signTime: new Date(), // t=
// Keys for one or more signatures
// Different signatures can use different algorithms (mostly useful when
// you want to sign a message both with RSA and Ed25519)
signatureData: [
{
signingDomain: this.jobOptions.domain, // d=
selector: this.jobOptions.selector, // s=
// supported key types: RSA, Ed25519
privateKey: await this.loadPrivateKey(), // k=
// Optional algorithm, default is derived from the key.
// Overrides whatever was set in parent object
algorithm: 'rsa-sha256',
// Optional signature specifc canonicalization, overrides whatever was set in parent object
canonicalization: 'relaxed/relaxed', // c=
// Maximum number of canonicalized body bytes to sign (eg. the "l=" tag).
// Do not use though. This is available only for compatibility testing.
// maxBodyLength: 12345
},
],
});
const signature = signResult.signatures;
return signature;
}
}

66
ts/mta/mta.classes.mta.ts Normal file
View File

@ -0,0 +1,66 @@
import * as plugins from '../plugins.js';
import { Email } from './mta.classes.email.js';
import { EmailSendJob } from './mta.classes.emailsendjob.js';
import { DKIMCreator } from './mta.classes.dkimcreator.js';
import { DKIMVerifier } from './mta.classes.dkimverifier.js';
import { SMTPServer } from './mta.classes.smtpserver.js';
import { DNSManager } from './mta.classes.dnsmanager.js';
export class MTA {
public server: SMTPServer;
public dkimCreator: DKIMCreator;
public dkimVerifier: DKIMVerifier;
public dnsManager: DNSManager;
constructor() {
this.dkimCreator = new DKIMCreator(this);
this.dkimVerifier = new DKIMVerifier(this);
this.dnsManager = new DNSManager(this);
}
public async start() {
// lets get the certificate
/**
* gets a certificate for a domain used by a service
* @param serviceNameArg
* @param domainNameArg
*/
const typedrouter = new plugins.typedrequest.TypedRouter();
const typedsocketClient = await plugins.typedsocket.TypedSocket.createClient(
typedrouter,
'https://cloudly.lossless.one:443'
);
const getCertificateForDomainOverHttps = async (domainNameArg: string) => {
const typedCertificateRequest =
typedsocketClient.createTypedRequest<any>('getSslCertificate');
const typedResponse = await typedCertificateRequest.fire({
authToken: '', // do proper auth here
requiredCertName: domainNameArg,
});
return typedResponse.certificate;
};
const certificate = await getCertificateForDomainOverHttps('mta.lossless.one');
await typedsocketClient.stop();
this.server = new SMTPServer(this, {
port: 25,
key: certificate.privateKey,
cert: certificate.publicKey,
});
await this.server.start();
}
public async stop() {
if (!this.server) {
console.error('Server is not running');
return;
}
await this.server.stop();
}
public async send(email: Email): Promise<void> {
await this.dkimCreator.handleDKIMKeysForEmail(email);
const sendJob = new EmailSendJob(this, email);
await sendJob.send();
}
}

View File

@ -0,0 +1,191 @@
import * as plugins from '../plugins.js';
import * as paths from '../paths.js';
import { Email } from './mta.classes.email.js';
import type { MTA } from './mta.classes.mta.js';
export interface ISmtpServerOptions {
port: number;
key: string;
cert: string;
}
export class SMTPServer {
public mtaRef: MTA;
private smtpServerOptions: ISmtpServerOptions;
private server: plugins.net.Server;
private emailBufferStringMap: Map<plugins.net.Socket, string>;
constructor(mtaRefArg: MTA, optionsArg: ISmtpServerOptions) {
console.log('SMTPServer instance is being created...');
this.mtaRef = mtaRefArg;
this.smtpServerOptions = optionsArg;
this.emailBufferStringMap = new Map();
this.server = plugins.net.createServer((socket) => {
console.log('New connection established...');
socket.write('220 mta.lossless.one ESMTP Postfix\r\n');
socket.on('data', (data) => {
this.processData(socket, data);
});
socket.on('end', () => {
console.log('Socket closed. Deleting related emailBuffer...');
socket.destroy();
this.emailBufferStringMap.delete(socket);
});
socket.on('error', () => {
console.error('Socket error occurred. Deleting related emailBuffer...');
socket.destroy();
this.emailBufferStringMap.delete(socket);
});
socket.on('close', () => {
console.log('Connection was closed by the client');
socket.destroy();
this.emailBufferStringMap.delete(socket);
});
});
}
private startTLS(socket: plugins.net.Socket) {
const secureContext = plugins.tls.createSecureContext({
key: this.smtpServerOptions.key,
cert: this.smtpServerOptions.cert,
});
const tlsSocket = new plugins.tls.TLSSocket(socket, {
secureContext: secureContext,
isServer: true,
});
tlsSocket.on('secure', () => {
console.log('Connection secured.');
this.emailBufferStringMap.set(tlsSocket, this.emailBufferStringMap.get(socket) || '');
this.emailBufferStringMap.delete(socket);
});
// Use the same handler for the 'data' event as for the unsecured socket.
tlsSocket.on('data', (data: Buffer) => {
this.processData(tlsSocket, Buffer.from(data));
});
tlsSocket.on('end', () => {
console.log('TLS socket closed. Deleting related emailBuffer...');
this.emailBufferStringMap.delete(tlsSocket);
});
tlsSocket.on('error', (err) => {
console.error('TLS socket error occurred. Deleting related emailBuffer...');
this.emailBufferStringMap.delete(tlsSocket);
});
}
private processData(socket: plugins.net.Socket | plugins.tls.TLSSocket, data: Buffer) {
const dataString = data.toString();
console.log(`Received data:`);
console.log(`${dataString}`)
if (dataString.startsWith('EHLO')) {
socket.write('250-mta.lossless.one Hello\r\n250 STARTTLS\r\n');
} else if (dataString.startsWith('MAIL FROM')) {
socket.write('250 Ok\r\n');
} else if (dataString.startsWith('RCPT TO')) {
socket.write('250 Ok\r\n');
} else if (dataString.startsWith('STARTTLS')) {
socket.write('220 Ready to start TLS\r\n');
this.startTLS(socket);
} else if (dataString.startsWith('DATA')) {
socket.write('354 End data with <CR><LF>.<CR><LF>\r\n');
let emailBuffer = this.emailBufferStringMap.get(socket);
if (!emailBuffer) {
this.emailBufferStringMap.set(socket, '');
}
} else if (dataString.startsWith('QUIT')) {
socket.write('221 Bye\r\n');
console.log('Received QUIT command, closing the socket...');
socket.destroy();
this.parseEmail(socket);
} else {
let emailBuffer = this.emailBufferStringMap.get(socket);
if (typeof emailBuffer === 'string') {
emailBuffer += dataString;
this.emailBufferStringMap.set(socket, emailBuffer);
}
socket.write('250 Ok\r\n');
}
if (dataString.endsWith('\r\n.\r\n') ) { // End of data
console.log('Received end of data.');
}
}
private async parseEmail(socket: plugins.net.Socket | plugins.tls.TLSSocket) {
let emailData = this.emailBufferStringMap.get(socket);
// lets strip the end sequence
emailData = emailData?.replace(/\r\n\.\r\n$/, '');
plugins.smartfile.fs.ensureDirSync(paths.receivedEmailsDir);
plugins.smartfile.memory.toFsSync(emailData, plugins.path.join(paths.receivedEmailsDir, `${Date.now()}.eml`));
if (!emailData) {
console.error('No email data found for socket.');
return;
}
let mightBeSpam = false;
// Verifying the email with DKIM
try {
const isVerified = await this.mtaRef.dkimVerifier.verify(emailData);
mightBeSpam = !isVerified;
} catch (error) {
console.error('Failed to verify DKIM signature:', error);
mightBeSpam = true;
}
const parsedEmail = await plugins.mailparser.simpleParser(emailData);
console.log(parsedEmail)
const email = new Email({
from: parsedEmail.from?.value[0].address || '',
to:
parsedEmail.to instanceof Array
? parsedEmail.to[0].value[0].address
: parsedEmail.to?.value[0].address,
subject: parsedEmail.subject || '',
text: parsedEmail.html || parsedEmail.text,
attachments:
parsedEmail.attachments?.map((attachment) => ({
filename: attachment.filename || '',
content: attachment.content,
contentType: attachment.contentType,
})) || [],
mightBeSpam: mightBeSpam,
});
console.log('mail received!');
console.log(email);
this.emailBufferStringMap.delete(socket);
}
public start() {
this.server.listen(this.smtpServerOptions.port, () => {
console.log(`SMTP Server is now running on port ${this.smtpServerOptions.port}`);
});
}
public stop() {
this.server.getConnections((err, count) => {
if (err) throw err;
console.log('Number of active connections: ', count);
});
this.server.close(() => {
console.log('SMTP Server is now stopped');
});
}
}

12
ts/paths.ts Normal file
View File

@ -0,0 +1,12 @@
import * as plugins from './plugins.js';
export const packageDir = plugins.path.join(
plugins.smartpath.get.dirnameFromImportMetaUrl(import.meta.url),
'../'
);
export const assetsDir = plugins.path.join(packageDir, './assets');
export const keysDir = plugins.path.join(assetsDir, './keys');
export const dnsRecordsDir = plugins.path.join(assetsDir, './dns-records');
export const sentEmailsDir = plugins.path.join(assetsDir, './sent-emails');
export const receivedEmailsDir = plugins.path.join(assetsDir, './received-emails');
plugins.smartfile.fs.ensureDirSync(keysDir);

View File

@ -1,6 +0,0 @@
import * as plugins from './platformservice.plugins.js';
export const packageDir = plugins.path.join(
plugins.smartpath.get.dirnameFromImportMetaUrl(import.meta.url),
'../'
);

View File

@ -1,24 +0,0 @@
// node native
import * as path from 'path';
export {
path
}
// @api.global scope
import * as typedrequest from '@api.global/typedrequest';
import * as typedserver from '@api.global/typedserver';
export {
typedrequest,
typedserver,
}
// pushrocks scope
// pushrocks scope
import * as projectinfo from '@push.rocks/projectinfo';
import * as qenv from '@push.rocks/qenv';
import * as smartdata from '@push.rocks/smartdata';
import * as smartpath from '@push.rocks/smartpath';
export { projectinfo, qenv, smartdata, smartpath };

70
ts/plugins.ts Normal file
View File

@ -0,0 +1,70 @@
// node native
import * as dns from 'dns';
import * as fs from 'fs';
import * as crypto from 'crypto';
import * as net from 'net';
import * as path from 'path';
import * as tls from 'tls';
import * as util from 'util';
export {
dns,
fs,
crypto,
net,
path,
tls,
util,
}
// @serve.zone scope
import * as servezoneInterfaces from '@serve.zone/interfaces';
export {
servezoneInterfaces
}
// @api.global scope
import * as typedrequest from '@api.global/typedrequest';
import * as typedserver from '@api.global/typedserver';
import * as typedsocket from '@api.global/typedsocket';
export {
typedrequest,
typedserver,
typedsocket,
}
// @push.rocks scope
import * as projectinfo from '@push.rocks/projectinfo';
import * as qenv from '@push.rocks/qenv';
import * as smartdata from '@push.rocks/smartdata';
import * as smartfile from '@push.rocks/smartfile';
import * as smartlog from '@push.rocks/smartlog';
import * as smartmail from '@push.rocks/smartmail';
import * as smartpath from '@push.rocks/smartpath';
import * as smartpromise from '@push.rocks/smartpromise';
import * as smartrequest from '@push.rocks/smartrequest';
import * as smartrx from '@push.rocks/smartrx';
export { projectinfo, qenv, smartdata, smartfile, smartlog, smartmail, smartpath, smartpromise, smartrequest, smartrx };
// tsclass scope
import * as tsclass from '@tsclass/tsclass';
export {
tsclass,
}
// third party
import * as mailauth from 'mailauth';
import { dkimSign } from 'mailauth/lib/dkim/sign.js';
import mailparser from 'mailparser';
import * as uuid from 'uuid';
export {
mailauth,
dkimSign,
mailparser,
uuid,
}

1
ts/sms/index.ts Normal file
View File

@ -0,0 +1 @@
export * from './smsservice.js';

89
ts/sms/smsservice.ts Normal file
View File

@ -0,0 +1,89 @@
import * as plugins from '../plugins.js';
import * as paths from '../paths.js';
import { logger } from '../logger.js';
import type { SzPlatformService } from '../classes.platformservice.js';
export interface ISmsConstructorOptions {
apiToken: string;
}
export class SmsService {
public platformServiceRef: SzPlatformService;
public projectinfo: plugins.projectinfo.ProjectInfo;
public typedrouter = new plugins.typedrequest.TypedRouter();
public options: ISmsConstructorOptions;
constructor(platformServiceRefArg: SzPlatformService, optionsArg: ISmsConstructorOptions) {
this.platformServiceRef = platformServiceRefArg;
this.options = optionsArg;
this.platformServiceRef.typedrouter.addTypedRouter(this.typedrouter);
}
/**
* starts the financeflow instance
*/
public async start() {
logger.log('info', `starting sms service`);
this.projectinfo = new plugins.projectinfo.ProjectInfo(paths.packageDir);
this.typedrouter.addTypedHandler(
new plugins.typedrequest.TypedHandler<plugins.servezoneInterfaces.platformservice.sms.IRequest_SendSms>(
'sendSms',
async (reqData) => {
await this.sendSms(reqData.toNumber, reqData.fromName, reqData.messageText);
return {
status: 'ok',
};
}
)
);
this.typedrouter.addTypedHandler(
new plugins.typedrequest.TypedHandler<plugins.servezoneInterfaces.platformservice.sms.IRequest_SendVerificationCode>(
'sendVerificationCode',
async (reqData) => {
const verificationCode = (
await this.sendVerificationCode(reqData.toNumber, reqData.fromName)
).toString();
return {
status: 'ok',
verificationCode,
};
}
)
);
}
public async sendSms(toNumber: number, fromName: string, messageText: string) {
const payload = {
sender: fromName,
message: messageText,
recipients: [{ msisdn: toNumber }],
};
const resp = await plugins.smartrequest.request('https://gatewayapi.com/rest/mtsms', {
method: 'POST',
requestBody: JSON.stringify(payload),
headers: {
Authorization: `Basic ${Buffer.from(`${this.options.apiToken}:`).toString('base64')}`,
'Content-Type': 'application/json',
},
});
const json = await resp.body;
logger.log('info', `sent an sms to ${toNumber} with text '${messageText}'`, {
eventType: 'sentSms',
sms: {
fromName: fromName,
toNumber: toNumber.toString(),
messageText: messageText,
},
});
console.log(JSON.stringify(json, null, 2));
}
public async sendVerificationCode(toNumber: number, fromName: string) {
let verificationCode = Math.floor(100000 + Math.random() * 900000);
await this.sendSms(toNumber, fromName, `Your verification code: ${verificationCode}`);
return verificationCode;
}
public async stop() {}
}