diff --git a/cloud/app/index.ts b/cloud/app/index.ts index 8f2ccbf553..c24e0402da 100644 --- a/cloud/app/index.ts +++ b/cloud/app/index.ts @@ -306,3 +306,13 @@ new aws.route53.Record("uploadRecord", { "8.9.31.18" ] }) + +new aws.route53.Record("accountRecord", { + name: "account.hc.engineering", + zoneId: zoneId, + type: "A", + ttl: 300, + records: [ + "8.9.31.18" + ] +}) diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 0b9249441a..9056670789 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -2,6 +2,7 @@ lockfileVersion: 5.3 specifiers: '@elastic/elasticsearch': ^7.14.0 + '@koa/cors': ~3.1.0 '@microsoft/api-extractor': ^7.18.4 '@rush-temp/account': file:./projects/account.tgz '@rush-temp/chunter': file:./projects/chunter.tgz @@ -40,6 +41,7 @@ specifiers: '@rush-temp/mongo': file:./projects/mongo.tgz '@rush-temp/platform': file:./projects/platform.tgz '@rush-temp/platform-rig': file:./projects/platform-rig.tgz + '@rush-temp/pod-account': file:./projects/pod-account.tgz '@rush-temp/presentation': file:./projects/presentation.tgz '@rush-temp/prod': file:./projects/prod.tgz '@rush-temp/query': file:./projects/query.tgz @@ -78,6 +80,9 @@ specifiers: '@types/express': ^4.17.13 '@types/express-fileupload': ^1.1.7 '@types/heft-jest': ^1.0.2 + '@types/koa-bodyparser': ~4.3.3 + '@types/koa-router': ~7.4.4 + '@types/koa__cors': ~3.0.3 '@types/minio': ^7.0.10 '@types/toposort': ^2.0.3 '@types/uuid': ^8.3.1 @@ -100,6 +105,9 @@ specifiers: express-fileupload: ^1.2.1 file-loader: ^6.2.0 intl-messageformat: ^9.7.1 + koa: ~2.13.1 + koa-bodyparser: ~4.3.0 + koa-router: ~10.1.1 mini-css-extract-plugin: ^2.2.0 minio: ^7.0.19 node-html-parser: ^4.1.3 @@ -123,6 +131,7 @@ specifiers: dependencies: '@elastic/elasticsearch': 7.14.0 + '@koa/cors': 3.1.0 '@microsoft/api-extractor': 7.18.4 '@rush-temp/account': file:projects/account.tgz_6c259fadfeb3a4b20890aefe87070b8b '@rush-temp/chunter': file:projects/chunter.tgz_6c259fadfeb3a4b20890aefe87070b8b @@ -161,6 +170,7 @@ dependencies: '@rush-temp/mongo': file:projects/mongo.tgz_6c259fadfeb3a4b20890aefe87070b8b '@rush-temp/platform': file:projects/platform.tgz_6c259fadfeb3a4b20890aefe87070b8b '@rush-temp/platform-rig': file:projects/platform-rig.tgz_6ab28797e7a22071465f7d680ae81ae5 + '@rush-temp/pod-account': file:projects/pod-account.tgz_6c259fadfeb3a4b20890aefe87070b8b '@rush-temp/presentation': file:projects/presentation.tgz_c38cf1a7a413db8918b0b4754c21e4c5 '@rush-temp/prod': file:projects/prod.tgz_sass@1.37.5+typescript@4.3.5 '@rush-temp/query': file:projects/query.tgz_6c259fadfeb3a4b20890aefe87070b8b @@ -199,6 +209,9 @@ dependencies: '@types/express': 4.17.13 '@types/express-fileupload': 1.1.7 '@types/heft-jest': 1.0.2 + '@types/koa-bodyparser': 4.3.3 + '@types/koa-router': 7.4.4 + '@types/koa__cors': 3.0.3 '@types/minio': 7.0.10 '@types/toposort': 2.0.3 '@types/uuid': 8.3.1 @@ -221,6 +234,9 @@ dependencies: express-fileupload: 1.2.1 file-loader: 6.2.0_webpack@5.48.0 intl-messageformat: 9.8.1 + koa: 2.13.1 + koa-bodyparser: 4.3.0 + koa-router: 10.1.1 mini-css-extract-plugin: 2.2.0_webpack@5.48.0 minio: 7.0.19 node-html-parser: 4.1.3 @@ -913,6 +929,13 @@ packages: chalk: 4.1.2 dev: false + /@koa/cors/3.1.0: + resolution: {integrity: sha512-7ulRC1da/rBa6kj6P4g2aJfnET3z8Uf3SWu60cjbtxTA5g8lxRdX/Bd2P92EagGwwAhANeNw8T8if99rJliR6Q==} + engines: {node: '>= 8.0.0'} + dependencies: + vary: 1.1.2 + dev: false + /@microsoft/api-extractor-model/7.13.4: resolution: {integrity: sha512-NYaR3hJinh089/Gkee8fvmEFf9zKkoUvNxgkqUlKBCDXH2+Ou4tNDuL8G6zjhKBPicHkp2VcL8l7q9H6txUkjQ==} dependencies: @@ -1344,6 +1367,12 @@ packages: resolution: {integrity: sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==} dev: false + /@types/accepts/1.3.5: + resolution: {integrity: sha512-jOdnI/3qTpHABjM5cx1Hc0sKsPoYCp+DP/GJRGtDlPd7fiV9oXGGIcjW/ZOxLIvjGz8MA+uMZI9metHlgqbgwQ==} + dependencies: + '@types/node': 16.7.5 + dev: false + /@types/argparse/1.0.38: resolution: {integrity: sha512-ebDJ9b0e702Yr7pWgB0jzm+CX4Srzz8RcXtLJDJB+BSccqMa36uyH/zUsSYao5+BD1ytv3k3rPYCq4mAE1hsXA==} dev: false @@ -1390,6 +1419,19 @@ packages: '@types/node': 16.7.5 dev: false + /@types/content-disposition/0.5.4: + resolution: {integrity: sha512-0mPF08jn9zYI0n0Q/Pnz7C4kThdSt+6LD4amsrYDDpgBfrVWa3TcCOxKX1zkGgYniGagRv8heN2cbh+CAn+uuQ==} + dev: false + + /@types/cookies/0.7.7: + resolution: {integrity: sha512-h7BcvPUogWbKCzBR2lY4oqaZbO3jXZksexYJVFvkrFeLgbZjQkU4x8pRq6eg2MHXQhY0McQdqmmsxRWlVAHooA==} + dependencies: + '@types/connect': 3.4.35 + '@types/express': 4.17.13 + '@types/keygrip': 1.0.2 + '@types/node': 16.7.5 + dev: false + /@types/cors/2.8.12: resolution: {integrity: sha512-vt+kDhq/M2ayberEtJcIN/hxXy1Pk+59g2FV/ZQceeaTyCtCucjL2Q7FXlFjtWn4n15KCr1NE2lNNFhp0lEThw==} dev: false @@ -1458,6 +1500,14 @@ packages: '@types/jest': 26.0.24 dev: false + /@types/http-assert/1.5.3: + resolution: {integrity: sha512-FyAOrDuQmBi8/or3ns4rwPno7/9tJTijVW6aQQjK02+kOQ8zmoNg2XJtAuQhvQcy1ASJq38wirX5//9J1EqoUA==} + dev: false + + /@types/http-errors/1.8.1: + resolution: {integrity: sha512-e+2rjEwK6KDaNOm5Aa9wNGgyS9oSZU/4pfSMMPYNOfjvFI0WVXm29+ITRFr6aKDvvKo7uU1jV68MW4ScsfDi7Q==} + dev: false + /@types/istanbul-lib-coverage/2.0.3: resolution: {integrity: sha512-sz7iLqvVUg1gIedBOvlkxPlc8/uVzyS5OwGz1cKjXzkl3FpL3al0crU8YGU1WoHkxn0Wxbw5tyi6hvzJKNzFsw==} dev: false @@ -1492,6 +1542,47 @@ packages: resolution: {integrity: sha512-YSBPTLTVm2e2OoQIDYx8HaeWJ5tTToLH67kXR7zYNGupXMEHa2++G8k+DczX2cFVgalypqtyZIcU19AFcmOpmg==} dev: false + /@types/keygrip/1.0.2: + resolution: {integrity: sha512-GJhpTepz2udxGexqos8wgaBx4I/zWIDPh/KOGEwAqtuGDkOUJu5eFvwmdBX4AmB8Odsr+9pHCQqiAqDL/yKMKw==} + dev: false + + /@types/koa-bodyparser/4.3.3: + resolution: {integrity: sha512-/ileIpXsy1fFEzgZhZ07eZH8rAVL7jwuk/kaoVEfauO6s80g2LIDIJKEyDbuAL9S/BWflKzEC0PHD6aXkmaSbw==} + dependencies: + '@types/koa': 2.13.4 + dev: false + + /@types/koa-compose/3.2.5: + resolution: {integrity: sha512-B8nG/OoE1ORZqCkBVsup/AKcvjdgoHnfi4pZMn5UwAPCbhk/96xyv284eBYW8JlQbQ7zDmnpFr68I/40mFoIBQ==} + dependencies: + '@types/koa': 2.13.4 + dev: false + + /@types/koa-router/7.4.4: + resolution: {integrity: sha512-3dHlZ6CkhgcWeF6wafEUvyyqjWYfKmev3vy1PtOmr0mBc3wpXPU5E8fBBd4YQo5bRpHPfmwC5yDaX7s4jhIN6A==} + dependencies: + '@types/koa': 2.13.4 + dev: false + + /@types/koa/2.13.4: + resolution: {integrity: sha512-dfHYMfU+z/vKtQB7NUrthdAEiSvnLebvBjwHtfFmpZmB7em2N3WVQdHgnFq+xvyVgxW5jKDmjWfLD3lw4g4uTw==} + dependencies: + '@types/accepts': 1.3.5 + '@types/content-disposition': 0.5.4 + '@types/cookies': 0.7.7 + '@types/http-assert': 1.5.3 + '@types/http-errors': 1.8.1 + '@types/keygrip': 1.0.2 + '@types/koa-compose': 3.2.5 + '@types/node': 16.7.5 + dev: false + + /@types/koa__cors/3.0.3: + resolution: {integrity: sha512-74Xb4hJOPGKlrQ4PRBk1A/p0gfLpgbnpT0o67OMVbwyeMXvlBN+ZCRztAAmkKZs+8hKbgMutUlZVbA52Hr/0IA==} + dependencies: + '@types/koa': 2.13.4 + dev: false + /@types/mime/1.3.2: resolution: {integrity: sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw==} dev: false @@ -2099,6 +2190,10 @@ packages: color-convert: 2.0.1 dev: false + /any-promise/1.3.0: + resolution: {integrity: sha1-q8av7tzqUugJzcA3au0845Y10X8=} + dev: false + /anymatch/2.0.0: resolution: {integrity: sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==} dependencies: @@ -2576,6 +2671,14 @@ packages: unset-value: 1.0.0 dev: false + /cache-content-type/1.0.1: + resolution: {integrity: sha512-IKufZ1o4Ut42YUrZSo8+qnMTrFuKkvyoLXUywKz9GJ5BrhOFGhLdkx9sG4KAnVvbY6kEcSFjLQul+DVmBm2bgA==} + engines: {node: '>= 6.0.0'} + dependencies: + mime-types: 2.1.32 + ylru: 1.2.1 + dev: false + /call-bind/1.0.2: resolution: {integrity: sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==} dependencies: @@ -2711,6 +2814,15 @@ packages: shallow-clone: 3.0.1 dev: false + /co-body/6.1.0: + resolution: {integrity: sha512-m7pOT6CdLN7FuXUcpuz/8lfQ/L77x8SchHCF4G0RBTJO20Wzmhn5Sp4/5WsKy8OSpifBSUrmg83qEqaDHdyFuQ==} + dependencies: + inflation: 2.0.0 + qs: 6.7.0 + raw-body: 2.4.0 + type-is: 1.6.18 + dev: false + /co/4.6.0: resolution: {integrity: sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=} engines: {iojs: '>= 1.0.0', node: '>= 0.12.0'} @@ -2877,11 +2989,23 @@ packages: engines: {node: '>= 0.6'} dev: false + /cookies/0.8.0: + resolution: {integrity: sha512-8aPsApQfebXnuI+537McwYsDtjVxGm8gTIzQI3FDW6t5t/DAhERxtnbEPN/8RX+uZthoz4eCOgloXaE5cYyNow==} + engines: {node: '>= 0.8'} + dependencies: + depd: 2.0.0 + keygrip: 1.1.0 + dev: false + /copy-descriptor/0.1.1: resolution: {integrity: sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=} engines: {node: '>=0.10.0'} dev: false + /copy-to/2.0.1: + resolution: {integrity: sha1-JoD7uAaKSNCGVrYJgJK9r8kG9KU=} + dev: false + /core-util-is/1.0.2: resolution: {integrity: sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=} dev: false @@ -3034,6 +3158,12 @@ packages: ms: 2.0.0 dev: false + /debug/3.1.0: + resolution: {integrity: sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==} + dependencies: + ms: 2.0.0 + dev: false + /debug/3.2.7: resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==} dependencies: @@ -3075,6 +3205,10 @@ packages: engines: {node: '>=0.10'} dev: false + /deep-equal/1.0.1: + resolution: {integrity: sha1-9dJgKStmDghO/0zbyfCK0yR0SLU=} + dev: false + /deep-equal/1.1.1: resolution: {integrity: sha512-yd9c5AdiqVcR+JjcwUQb9DkhJc8ngNr0MahEBGvDiJw8puWab2yZlh+nkasOnZP+EGTAP6rRp2JzJhJZzvNF8g==} dependencies: @@ -3176,6 +3310,10 @@ packages: engines: {node: '>=0.4.0'} dev: false + /delegates/1.0.0: + resolution: {integrity: sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=} + dev: false + /denque/1.5.1: resolution: {integrity: sha512-XwE+iZ4D6ZUB7mfYRMb5wByE8L74HCn30FBN7sWnXksWc1LO1bPDl67pBR9o/kC4z/xSNAwkMYcGgqDV3BE3Hw==} engines: {node: '>=0.10'} @@ -4466,6 +4604,14 @@ packages: resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==} dev: false + /http-assert/1.5.0: + resolution: {integrity: sha512-uPpH7OKX4H25hBmU6G1jWNaqJGpTXxey+YOUizJUAgu0AjLUeC8D73hTrhvDS5D+GJN1DN1+hhc/eF/wpxtp0w==} + engines: {node: '>= 0.8'} + dependencies: + deep-equal: 1.0.1 + http-errors: 1.8.0 + dev: false + /http-deceiver/1.2.7: resolution: {integrity: sha1-+nFolEq5pRnTN8sL7HKE3D5yPYc=} dev: false @@ -4502,6 +4648,17 @@ packages: toidentifier: 1.0.0 dev: false + /http-errors/1.8.0: + resolution: {integrity: sha512-4I8r0C5JDhT5VkvI47QktDW75rNlGVsUf/8hzjCC/wkWI/jdTRmBb9aI7erSG82r1bjKY3F6k28WnsVxB1C73A==} + engines: {node: '>= 0.6'} + dependencies: + depd: 1.1.2 + inherits: 2.0.4 + setprototypeof: 1.2.0 + statuses: 1.5.0 + toidentifier: 1.0.0 + dev: false + /http-parser-js/0.5.3: resolution: {integrity: sha512-t7hjvef/5HEK7RWTdUzVUhl8zkEu+LlaE0IYzdMuvbSDipxBRpOn4Uhw8ZyECEa808iVT8XCjzo6xmYt4CiLZg==} dev: false @@ -4628,6 +4785,11 @@ packages: engines: {node: '>=0.8.19'} dev: false + /inflation/2.0.0: + resolution: {integrity: sha1-i0F+R8KPklpFEz2RTKH9OJEH8w8=} + engines: {node: '>= 0.8.0'} + dev: false + /inflight/1.0.6: resolution: {integrity: sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=} dependencies: @@ -5657,6 +5819,13 @@ packages: engines: {node: '>= 0.4.0'} dev: false + /keygrip/1.1.0: + resolution: {integrity: sha512-iYSchDJ+liQ8iwbSI2QqsQOvqv58eJCEanyJPJi+Khyu8smkcKSFUCbPwzFcL7YVtZ6eONjqRX/38caJ7QjRAQ==} + engines: {node: '>= 0.6'} + dependencies: + tsscmp: 1.0.6 + dev: false + /killable/1.0.1: resolution: {integrity: sha512-LzqtLKlUwirEUyl/nicirVmNiPvYs7l5n8wOPP7fyJVpUPkvCnW/vuiXGpylGUlnPDnB7311rARzAt3Mhswpjg==} dev: false @@ -5690,6 +5859,74 @@ packages: engines: {node: '>= 8'} dev: false + /koa-bodyparser/4.3.0: + resolution: {integrity: sha512-uyV8G29KAGwZc4q/0WUAjH+Tsmuv9ImfBUF2oZVyZtaeo0husInagyn/JH85xMSxM0hEk/mbCII5ubLDuqW/Rw==} + engines: {node: '>=8.0.0'} + dependencies: + co-body: 6.1.0 + copy-to: 2.0.1 + dev: false + + /koa-compose/3.2.1: + resolution: {integrity: sha1-qFzLQLfZhtjlo0Wzoazo6rz1Tec=} + dependencies: + any-promise: 1.3.0 + dev: false + + /koa-compose/4.1.0: + resolution: {integrity: sha512-8ODW8TrDuMYvXRwra/Kh7/rJo9BtOfPc6qO8eAfC80CnCvSjSl0bkRM24X6/XBBEyj0v1nRUQ1LyOy3dbqOWXw==} + dev: false + + /koa-convert/1.2.0: + resolution: {integrity: sha1-2kCHXfSd4FOQmNFwC1CCDOvNIdA=} + engines: {node: '>= 4'} + dependencies: + co: 4.6.0 + koa-compose: 3.2.1 + dev: false + + /koa-router/10.1.1: + resolution: {integrity: sha512-z/OzxVjf5NyuNO3t9nJpx7e1oR3FSBAauiwXtMQu4ppcnuNZzTaQ4p21P8A6r2Es8uJJM339oc4oVW+qX7SqnQ==} + engines: {node: '>= 8.0.0'} + dependencies: + debug: 4.3.2 + http-errors: 1.8.0 + koa-compose: 4.1.0 + methods: 1.1.2 + path-to-regexp: 6.2.0 + transitivePeerDependencies: + - supports-color + dev: false + + /koa/2.13.1: + resolution: {integrity: sha512-Lb2Dloc72auj5vK4X4qqL7B5jyDPQaZucc9sR/71byg7ryoD1NCaCm63CShk9ID9quQvDEi1bGR/iGjCG7As3w==} + engines: {node: ^4.8.4 || ^6.10.1 || ^7.10.1 || >= 8.1.4} + dependencies: + accepts: 1.3.7 + cache-content-type: 1.0.1 + content-disposition: 0.5.3 + content-type: 1.0.4 + cookies: 0.8.0 + debug: 3.1.0 + delegates: 1.0.0 + depd: 2.0.0 + destroy: 1.0.4 + encodeurl: 1.0.2 + escape-html: 1.0.3 + fresh: 0.5.2 + http-assert: 1.5.0 + http-errors: 1.8.0 + is-generator-function: 1.0.10 + koa-compose: 4.1.0 + koa-convert: 1.2.0 + on-finished: 2.3.0 + only: 0.0.2 + parseurl: 1.3.3 + statuses: 1.5.0 + type-is: 1.6.18 + vary: 1.1.2 + dev: false + /kuler/2.0.0: resolution: {integrity: sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A==} dev: false @@ -6315,6 +6552,10 @@ packages: mimic-fn: 2.1.0 dev: false + /only/0.0.2: + resolution: {integrity: sha1-Kv3oTQPlC5qO3EROMGEKcCle37Q=} + dev: false + /opener/1.5.2: resolution: {integrity: sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==} hasBin: true @@ -6526,6 +6767,10 @@ packages: isarray: 0.0.1 dev: false + /path-to-regexp/6.2.0: + resolution: {integrity: sha512-f66KywYG6+43afgE/8j/GoiNyygk/bnoCbps++3ErRKsIYkGGupyv07R2Ok5m9i67Iqc+T2g1eAUGUPzWhYTyg==} + dev: false + /path-type/3.0.0: resolution: {integrity: sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==} engines: {node: '>=4'} @@ -7454,6 +7699,10 @@ packages: resolution: {integrity: sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==} dev: false + /setprototypeof/1.2.0: + resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==} + dev: false + /shallow-clone/3.0.1: resolution: {integrity: sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==} engines: {node: '>=8'} @@ -8336,6 +8585,11 @@ packages: resolution: {integrity: sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg==} dev: false + /tsscmp/1.0.6: + resolution: {integrity: sha512-LxhtAkPDTkVCMQjt2h6eBVY28KCjikZqZfMcC15YBeNjkgUpdCfBu5HoiOTDu86v6smE8yOjyEktJ8hlbANHQA==} + engines: {node: '>=0.6.x'} + dev: false + /tsutils/3.21.0_typescript@4.3.5: resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==} engines: {node: '>= 6'} @@ -9078,6 +9332,11 @@ packages: yargs-parser: 18.1.3 dev: false + /ylru/1.2.1: + resolution: {integrity: sha512-faQrqNMzcPCHGVC2aaOINk13K+aaBDUPjGWl0teOXywElLjyVAB6Oe2jj62jHYtwsU49jXhScYbvPENK+6zAvQ==} + engines: {node: '>= 4.0.0'} + dev: false + /yn/3.1.1: resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==} engines: {node: '>=6'} @@ -9776,6 +10035,35 @@ packages: - typescript dev: false + file:projects/pod-account.tgz_6c259fadfeb3a4b20890aefe87070b8b: + resolution: {integrity: sha512-LslRQA1JvP/7ifMS9HlLquIlDd1zYoWnm6kA+H4ZTrFySfZ70JVvSTlFffN1cH6IsAPRaEmG0wPX9JrQkSfOCw==, tarball: file:projects/pod-account.tgz} + id: file:projects/pod-account.tgz + name: '@rush-temp/pod-account' + version: 0.0.0 + dependencies: + '@koa/cors': 3.1.0 + '@types/heft-jest': 1.0.2 + '@types/koa': 2.13.4 + '@types/koa__cors': 3.0.3 + '@types/koa-bodyparser': 4.3.3 + '@types/koa-router': 7.4.4 + '@types/node': 16.7.5 + '@typescript-eslint/eslint-plugin': 4.28.5_a8e83fcad666e1ba86be4b2e27a20aea + esbuild: 0.12.26 + eslint: 7.32.0 + eslint-plugin-import: 2.23.4_eslint@7.32.0 + eslint-plugin-node: 11.1.0_eslint@7.32.0 + eslint-plugin-promise: 4.3.1 + koa: 2.13.1 + koa-bodyparser: 4.3.0 + koa-router: 10.1.1 + mongodb: 4.1.1 + transitivePeerDependencies: + - '@typescript-eslint/parser' + - supports-color + - typescript + dev: false + file:projects/presentation.tgz_c38cf1a7a413db8918b0b4754c21e4c5: resolution: {integrity: sha512-40ahmahal+a+1hgyBS7oEkNiw/KUOxVlUjK/lT3isHWjdrjkU81GiX6Bs1MQqpptXh+HImYoJ8TLCRPryCztJA==, tarball: file:projects/presentation.tgz} id: file:projects/presentation.tgz diff --git a/dev/tool/src/index.ts b/dev/tool/src/index.ts index 4a15f9bac1..aee0cee143 100644 --- a/dev/tool/src/index.ts +++ b/dev/tool/src/index.ts @@ -16,7 +16,7 @@ import { program } from 'commander' import { MongoClient, Db } from 'mongodb' -import { getAccount, createAccount, assignWorkspace, createWorkspace } from '@anticrm/account' +import { getAccount, createAccount, assignWorkspace, createWorkspace, ACCOUNT_DB } from '@anticrm/account' import { createContributingClient } from '@anticrm/contrib' import core, { TxOperations } from '@anticrm/core' import { encode } from 'jwt-simple' @@ -67,7 +67,7 @@ async function withDatabase (uri: string, f: (db: Db) => Promise): Promise< console.log(`connecting to database '${uri}'...`) const client = await MongoClient.connect(uri) - await f(client.db('account')) + await f(client.db(ACCOUNT_DB)) await client.close() } diff --git a/pods/account/.eslintrc.js b/pods/account/.eslintrc.js new file mode 100644 index 0000000000..89f8151bd4 --- /dev/null +++ b/pods/account/.eslintrc.js @@ -0,0 +1,6 @@ +module.exports = { + extends: ['./node_modules/@anticrm/platform-rig/profiles/default/config/eslint.config.json'], + parserOptions: { + project: './tsconfig.json' + } +} \ No newline at end of file diff --git a/pods/account/.npmignore b/pods/account/.npmignore new file mode 100644 index 0000000000..e3ec093c38 --- /dev/null +++ b/pods/account/.npmignore @@ -0,0 +1,4 @@ +* +!/lib/** +!CHANGELOG.md +/lib/**/__tests__/ diff --git a/pods/account/Dockerfile b/pods/account/Dockerfile new file mode 100644 index 0000000000..6d8f2a9573 --- /dev/null +++ b/pods/account/Dockerfile @@ -0,0 +1,9 @@ + +FROM node + +WORKDIR /usr/src/app + +COPY bundle.js ./ + +EXPOSE 3000 +CMD [ "node", "bundle.js" ] diff --git a/pods/account/build.sh b/pods/account/build.sh new file mode 100755 index 0000000000..0301e46926 --- /dev/null +++ b/pods/account/build.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# +# Copyright © 2020, 2021 Anticrm Platform Contributors. +# Copyright © 2021 Hardcore Engineering Inc. +# +# Licensed under the Eclipse Public License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. You may +# obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# +# See the License for the specific language governing permissions and +# limitations under the License. +# + +rushx bundle +rushx docker:build +rushx docker:push diff --git a/pods/account/config/rig.json b/pods/account/config/rig.json new file mode 100644 index 0000000000..af1257a896 --- /dev/null +++ b/pods/account/config/rig.json @@ -0,0 +1,18 @@ +// The "rig.json" file directs tools to look for their config files in an external package. +// Documentation for this system: https://www.npmjs.com/package/@rushstack/rig-package +{ + "$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json", + + /** + * (Required) The name of the rig package to inherit from. + * It should be an NPM package name with the "-rig" suffix. + */ + "rigPackageName": "@anticrm/platform-rig" + + /** + * (Optional) Selects a config profile from the rig package. The name must consist of + * lowercase alphanumeric words separated by hyphens, for example "sample-profile". + * If omitted, then the "default" profile will be used." + */ + // "rigProfile": "your-profile-name" +} diff --git a/pods/account/kube/deployment.yml b/pods/account/kube/deployment.yml new file mode 100644 index 0000000000..bf1929c952 --- /dev/null +++ b/pods/account/kube/deployment.yml @@ -0,0 +1,23 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: account +spec: + replicas: 1 + selector: + matchLabels: + app: account + template: + metadata: + labels: + app: account + spec: + containers: + - name: app + image: anticrm/account + ports: + - containerPort: 3000 + imagePullPolicy: Always + env: + - name: MONGO_URL + value: mongodb://root:WZCwnHRazX@mng-mongodb:27017/ diff --git a/pods/account/kube/ingress.yml b/pods/account/kube/ingress.yml new file mode 100644 index 0000000000..eb47a360fa --- /dev/null +++ b/pods/account/kube/ingress.yml @@ -0,0 +1,23 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + annotations: + kubernetes.io/ingress.class: "nginx" + cert-manager.io/issuer: "letsencrypt-prod" + name: account-ingress +spec: + tls: + - hosts: + - account.hc.engineering + secretName: account-tls + rules: + - host: account.hc.engineering + http: + paths: + - backend: + service: + name: account + port: + number: 80 + path: / + pathType: Prefix diff --git a/pods/account/kube/service.yml b/pods/account/kube/service.yml new file mode 100644 index 0000000000..20d8ad19b5 --- /dev/null +++ b/pods/account/kube/service.yml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: Service +metadata: + name: account +spec: + selector: + app: account + ports: + - port: 80 + targetPort: 3000 diff --git a/pods/account/package.json b/pods/account/package.json new file mode 100644 index 0000000000..da66127eaf --- /dev/null +++ b/pods/account/package.json @@ -0,0 +1,39 @@ +{ + "name": "@anticrm/pod-account", + "version": "0.6.0", + "main": "lib/index.js", + "author": "Anticrm Platform Contributors", + "license": "EPL-2.0", + "scripts": { + "start": "ts-node src/index.ts", + "build": "heft build", + "lint:fix": "eslint --fix src", + "bundle": "esbuild src/index.ts --bundle --minify --platform=node > bundle.js", + "docker:build": "docker build -t anticrm/account .", + "docker:push": "docker push anticrm/account" + }, + "devDependencies": { + "@anticrm/platform-rig":"~0.6.0", + "@types/heft-jest":"^1.0.2", + "@types/node": "^16.4.10", + "@typescript-eslint/eslint-plugin":"4", + "eslint-plugin-import":"2", + "eslint-plugin-promise":"4", + "eslint-plugin-node":"11", + "eslint":"^7.32.0", + "esbuild":"^0.12.24", + "@types/koa-bodyparser":"^4.3.3", + "@types/koa-router":"^7.4.4", + "@types/koa":"^2.13.4", + "@types/koa__cors":"^3.0.3" + }, + "dependencies": { + "@anticrm/account":"~0.6.0", + "@anticrm/platform":"~0.6.5", + "mongodb":"^4.1.1", + "koa":"^2.13.1", + "koa-router":"^10.1.1", + "koa-bodyparser":"^4.3.0", + "@koa/cors":"^3.1.0" + } +} diff --git a/pods/account/src/index.ts b/pods/account/src/index.ts new file mode 100644 index 0000000000..14c23a912f --- /dev/null +++ b/pods/account/src/index.ts @@ -0,0 +1,60 @@ +// +// Copyright © 2020, 2021 Anticrm Platform Contributors. +// Copyright © 2021 Hardcore Engineering Inc. +// +// Licensed under the Eclipse Public License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. You may +// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import { ACCOUNT_DB, methods } from '@anticrm/account' +import platform, { Response, Request, serialize, Status, Severity } from '@anticrm/platform' +import { MongoClient, Db } from 'mongodb' + +import Koa from 'koa' +import Router from 'koa-router' + +import bodyParser from 'koa-bodyparser' +import cors from '@koa/cors' + +const dbUri = process.env.MONGO_URL ?? 'mongodb://localhost:27017' +let client: MongoClient + +const app = new Koa() +const router = new Router() + +router.post('rpc', '/', async (ctx) => { + const request = ctx.request.body + const method = (methods as { [key: string]: (db: Db, request: Request) => Response })[request.method] + if (method === undefined) { + const response: Response = { + id: request.id, + error: new Status(Severity.ERROR, platform.status.UnknownMethod, { method: request.method }) + } + + ctx.body = serialize(response) + } + + if (client === undefined) { + client = await MongoClient.connect(dbUri) + } + const db = client.db(ACCOUNT_DB) + const result = await method(db, request) + console.log(result) + ctx.body = result +}) + +app.use(cors()) +app.use(bodyParser()) +app.use(router.routes()).use(router.allowedMethods()) + +app.listen(3000, () => { + console.log('server started on port 3000') +}) diff --git a/pods/account/tsconfig.json b/pods/account/tsconfig.json new file mode 100644 index 0000000000..fffbf4c341 --- /dev/null +++ b/pods/account/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "./node_modules/@anticrm/platform-rig/profiles/default/tsconfig.json", + + "compilerOptions": { + "rootDir": "./src", + "outDir": "./lib", + "esModuleInterop": true + } +} \ No newline at end of file diff --git a/rush.json b/rush.json index f8df376852..4d31f81df1 100644 --- a/rush.json +++ b/rush.json @@ -756,5 +756,10 @@ "projectFolder": "dev/tool", "shouldPublish": false }, + { + "packageName": "@anticrm/pod-account", + "projectFolder": "pods/account", + "shouldPublish": false + }, ] } diff --git a/server/account/src/index.ts b/server/account/src/index.ts index 48405e782f..05fed154ef 100644 --- a/server/account/src/index.ts +++ b/server/account/src/index.ts @@ -26,6 +26,11 @@ const ACCOUNT_COLLECTION = 'account' const endpoint = 'wss://transactor.hc.engineering/' const secret = 'secret' +/** + * @public + */ +export const ACCOUNT_DB = 'account' + /** * @public */