Commit 4f8f9c81 authored by nanahira's avatar nanahira

adapt Koishi v4.8

parent d7df8e31
......@@ -14,9 +14,9 @@
"@types/ws": "^8.5.3",
"koa": "^2.13.4",
"koa-bodyparser": "^4.3.0",
"koishi-decorators": "^2.1.7",
"koishi-thirdeye": "^11.0.2",
"lodash": "^4.17.21",
"typed-reflector": "^1.0.10",
"typed-reflector": "^1.0.11",
"ws": "^8.7.0"
},
"devDependencies": {
......@@ -46,7 +46,7 @@
"peerDependencies": {
"@nestjs/common": "^9.0.3 || ^8.0.0",
"@nestjs/core": "^9.0.3 || ^8.0.0",
"koishi": "4.7.6",
"koishi": "^4.8.1",
"rxjs": "^7.5.5"
}
},
......@@ -1180,49 +1180,27 @@
}
},
"node_modules/@koishijs/core": {
"version": "4.7.6",
"resolved": "https://registry.npmjs.org/@koishijs/core/-/core-4.7.6.tgz",
"integrity": "sha512-2F7pY7QwMilwO3B/771eP14jJ5WN5CKH0YAatbKwP97AJ9pGAgijrS17D5F7htH7ZA2C3TqQbysxYy4Z6WIedw==",
"version": "4.8.1",
"resolved": "https://registry.npmjs.org/@koishijs/core/-/core-4.8.1.tgz",
"integrity": "sha512-dHYWOox4RdZu6YwrmazTEbafCP4QmfGKBZoDDKx6cGwJYRcU09RxZ4nNL/1mPGyJBPgqngzpiY0C+4kwD2R4cw==",
"peer": true,
"dependencies": {
"@koishijs/utils": "^5.4.5",
"cordis": "^1.6.0",
"@koishijs/utils": "^6.0.0",
"@satorijs/core": "^1.0.3",
"cordis": "^2.0.6",
"fastest-levenshtein": "^1.0.12",
"minato": "^1.2.1"
"minato": "^1.2.3"
}
},
"node_modules/@koishijs/segment": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@koishijs/segment/-/segment-1.1.1.tgz",
"integrity": "sha512-HmLRKJiIX++U+ow+RP0BVGwgAFzDRqwHusUzjoZcZdcnG8yudTsvB6MXnzBMnBL7k9LBxUlfB5P8ukkM1roZFQ==",
"peer": true
},
"node_modules/@koishijs/utils": {
"version": "5.4.5",
"resolved": "https://registry.npmjs.org/@koishijs/utils/-/utils-5.4.5.tgz",
"integrity": "sha512-tOmhFFcnuhFAudRcG9Bq7OeVmX1yxGvlSsJMbaSBHvb/hUrFzpXjEd2onqnJw4fyx/QLgYYFBeiFcKXDSujoLg==",
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/@koishijs/utils/-/utils-6.0.0.tgz",
"integrity": "sha512-xMwZAkrCnjVXYLmZTSnI8ZYyNU8YcNynyK+njkNKivuQywfU3l/SgwLUqpv2x2uSsqaKIn8ZNXOrPYXMBpPdQg==",
"peer": true,
"dependencies": {
"@koishijs/segment": "^1.1.1",
"cosmokit": "^1.1.2",
"cosmokit": "^1.2.1",
"reggol": "^1.0.3",
"schemastery": "^3.4.3",
"supports-color": "^8.1.1"
}
},
"node_modules/@koishijs/utils/node_modules/supports-color": {
"version": "8.1.1",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz",
"integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==",
"peer": true,
"dependencies": {
"has-flag": "^4.0.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/chalk/supports-color?sponsor=1"
"schemastery": "^3.4.3"
}
},
"node_modules/@nestjs/common": {
......@@ -1491,6 +1469,55 @@
"npm": ">=5.0.0"
}
},
"node_modules/@satorijs/core": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@satorijs/core/-/core-1.0.3.tgz",
"integrity": "sha512-ewAZmkSeWzwzIuIPIzJ9G1xRWq1tL8+2kgmE8nf4zE/uU4xmf9DQSApSGj2ZnNs2gLhIzZW0TKghIA1R1bMUCA==",
"peer": true,
"dependencies": {
"@satorijs/message": "^1.0.1",
"cordis": "^2.0.6",
"cosmokit": "^1.2.1"
}
},
"node_modules/@satorijs/message": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@satorijs/message/-/message-1.0.1.tgz",
"integrity": "sha512-AbWf2xsaCEM5Vu76BEHsLs8bx7SyHjIwSea74phG9mQYE5Qean1LWxClWdPfCmN7AGyosh1zkqm34SCMSPBt+w==",
"peer": true
},
"node_modules/@satorijs/satori": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@satorijs/satori/-/satori-1.0.3.tgz",
"integrity": "sha512-XQCIXtVTGqbBWdsArI87ouwIS5MxCTEzVcNooURE9jQRi1CgXz330IqSaqvR00EY673PEB4RpVdMZvDeDv4u7w==",
"peer": true,
"dependencies": {
"@koa/router": "^10.1.1",
"@satorijs/core": "^1.0.3",
"@types/koa": "*",
"@types/koa__router": "*",
"@types/ws": "^8.5.3",
"axios": "^0.24.0",
"koa": "^2.13.4",
"koa-bodyparser": "^4.3.0",
"parseurl": "^1.3.3",
"path-to-regexp": "^6.2.1",
"portfinder": "^1.0.28",
"proxy-agent": "^5.0.0",
"reggol": "^1.0.3",
"schemastery": "^3.4.3",
"ws": "^8.6.0"
},
"engines": {
"node": ">=12.0.0"
}
},
"node_modules/@satorijs/satori/node_modules/path-to-regexp": {
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.1.tgz",
"integrity": "sha512-JLyh7xT1kizaEvcaXOQwOc2/Yhw6KZOvPf1S8401UyLk86CU79LN3vl7ztXGm/pZ+YjoyAJ4rxmHwbkBXJX+yw==",
"peer": true
},
"node_modules/@sinonjs/commons": {
"version": "1.8.3",
"resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.3.tgz",
......@@ -2294,6 +2321,15 @@
"fastq": "^1.6.1"
}
},
"node_modules/axios": {
"version": "0.24.0",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.24.0.tgz",
"integrity": "sha512-Q6cWsys88HoPgAaFAVUb0WpPk0O8iTeisR9IMqy9G8AbO4NlpVknrnQS03zzF9PGAWgO3cgletO3VjV/P7VztA==",
"peer": true,
"dependencies": {
"follow-redirects": "^1.14.4"
}
},
"node_modules/babel-jest": {
"version": "27.5.1",
"resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-27.5.1.tgz",
......@@ -2799,12 +2835,29 @@
"integrity": "sha512-3DdaFaU/Zf1AnpLiFDeNCD4TOWe3Zl2RZaTzUvWiIk5ERzcCodOE20Vqq4fzCbNoHURFHT4/us/Lfq+S2zyY4w=="
},
"node_modules/cordis": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/cordis/-/cordis-1.6.0.tgz",
"integrity": "sha512-Nt/DOV7sGwlzcxV4QO/RJ4NyTdim36QT03uTG8/KIjCkzYXHPHq7FqXXiRFe8e2qvDDI8D2pYOEDzF7uICxJ1w==",
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/cordis/-/cordis-2.0.6.tgz",
"integrity": "sha512-Q85Y2iY3myX340TiUV97DtTuPTls/pZoYqP2eWHlkLYcIzs7cIBTX3C8FqxaZ2hRgOJ6kMcXSXSIPWsZGcyCHQ==",
"peer": true,
"dependencies": {
"cosmokit": "^1.1.2"
"cosmokit": "^1.2.1"
}
},
"node_modules/cordis-decorators": {
"version": "1.0.16",
"resolved": "https://registry.npmjs.org/cordis-decorators/-/cordis-decorators-1.0.16.tgz",
"integrity": "sha512-S5XULywHemcob+KqSItv3kAo1mNRjbDchmfrKJALYs3wqzp4q4PPZRQftbW5SVuLReSis14hgwTHbgoXNGJVEA==",
"dependencies": {
"lodash": "^4.17.21",
"mustache": "^4.2.0",
"reflect-metadata": "^0.1.13",
"rxjs": "^7.5.6",
"schemastery-gen": "^3.1.14",
"typed-reflector": "^1.0.11"
},
"peerDependencies": {
"cordis": "^2.0.6",
"schemastery": "^3.4.3"
}
},
"node_modules/core-util-is": {
......@@ -3776,10 +3829,13 @@
"dev": true
},
"node_modules/fastest-levenshtein": {
"version": "1.0.12",
"resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.12.tgz",
"integrity": "sha512-On2N+BpYJ15xIC974QNVuYGMOlEVt4s0EOI3wwMqOmK1fdDY+FN/zltPV8vosq4ad4c/gJ1KHScUn/6AWIgiow==",
"peer": true
"version": "1.0.14",
"resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.14.tgz",
"integrity": "sha512-tFfWHjnuUfKE186Tfgr+jtaFc0mZTApEgKDOeyN+FwOqRkO/zK/3h1AiRd8u8CY53owL3CUmGr/oI9p/RdyLTA==",
"peer": true,
"engines": {
"node": ">= 4.9.1"
}
},
"node_modules/fastify": {
"version": "4.2.0",
......@@ -5648,64 +5704,36 @@
}
},
"node_modules/koishi": {
"version": "4.7.6",
"resolved": "https://registry.npmjs.org/koishi/-/koishi-4.7.6.tgz",
"integrity": "sha512-yod72tM399rRcXvpXAveHPZYvcfJDpIwEz2sviTba/6AFMKXc4f8u795hQ2B2IYpMR0vwfpxdG3OwwYuho7B/A==",
"version": "4.8.1",
"resolved": "https://registry.npmjs.org/koishi/-/koishi-4.8.1.tgz",
"integrity": "sha512-4ogJzbSmGWq4ek33rb2eLeFzdcwFM9zi6ZMUzm52tbHWDcJ+c1WqARj/0tc4tQ/7oAj5hNTC+yo3ddFOGgf0Sg==",
"peer": true,
"dependencies": {
"@koa/router": "^10.1.1",
"@koishijs/core": "^4.7.6",
"@koishijs/utils": "^5.4.5",
"@types/koa": "*",
"@types/koa__router": "*",
"@types/ws": "^8.5.3",
"axios": "^0.24.0",
"@koishijs/core": "^4.8.1",
"@koishijs/utils": "^6.0.0",
"@satorijs/satori": "^1.0.3",
"file-type": "^16.5.3",
"koa": "^2.13.4",
"koa-bodyparser": "^4.3.0",
"ns-require": "^1.1.4",
"parseurl": "^1.3.3",
"path-to-regexp": "^6.2.1",
"portfinder": "^1.0.28",
"proxy-agent": "^5.0.0",
"ws": "^8.6.0"
"ns-require": "^1.1.4"
},
"engines": {
"node": ">=12.0.0"
}
},
"node_modules/koishi-decorators": {
"version": "2.1.7",
"resolved": "https://registry.npmjs.org/koishi-decorators/-/koishi-decorators-2.1.7.tgz",
"integrity": "sha512-OoExVOdpVEmv8FywtdjR8JUPQtBz1P2rabkIfmt3SQpp3jrkm67EgdQNH+Nw8+6CfSDukMP3+/xWsA64VE5VEQ==",
"node_modules/koishi-thirdeye": {
"version": "11.0.2",
"resolved": "https://registry.npmjs.org/koishi-thirdeye/-/koishi-thirdeye-11.0.2.tgz",
"integrity": "sha512-0Mk1Nb3OwAaONgVE5YIFpHI4QHGQlQlfMC9r2Am8+FKKyxL0oqivg9eiJJj7eopTpZ8c8WBPdoFlJl9MEDs4PA==",
"dependencies": {
"@types/koa": "^2.13.4",
"@types/koa__router": "^8.0.11",
"lodash": "^4.17.21",
"mustache": "^4.2.0",
"reflect-metadata": "^0.1.13",
"rxjs": "^7.5.5",
"typed-reflector": "^1.0.10"
"minato-decorators": "^2.0.8",
"rxjs": "^7.5.6",
"satori-decorators": "^1.0.8"
},
"peerDependencies": {
"koishi": "^4.7.5"
"koishi": "^4.8.1",
"schemastery": "^3.4.3"
}
},
"node_modules/koishi/node_modules/axios": {
"version": "0.24.0",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.24.0.tgz",
"integrity": "sha512-Q6cWsys88HoPgAaFAVUb0WpPk0O8iTeisR9IMqy9G8AbO4NlpVknrnQS03zzF9PGAWgO3cgletO3VjV/P7VztA==",
"peer": true,
"dependencies": {
"follow-redirects": "^1.14.4"
}
},
"node_modules/koishi/node_modules/path-to-regexp": {
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.1.tgz",
"integrity": "sha512-JLyh7xT1kizaEvcaXOQwOc2/Yhw6KZOvPf1S8401UyLk86CU79LN3vl7ztXGm/pZ+YjoyAJ4rxmHwbkBXJX+yw==",
"peer": true
},
"node_modules/leven": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz",
......@@ -5951,6 +5979,18 @@
"ns-require": "^1.1.4"
}
},
"node_modules/minato-decorators": {
"version": "2.0.8",
"resolved": "https://registry.npmjs.org/minato-decorators/-/minato-decorators-2.0.8.tgz",
"integrity": "sha512-W1fukpqMBwTyE5lBkVmSdwGSl6eLzdRmPqAxyDxbfSJxva0FzXgx9VXQPOdkxLqDyWORa+uj/CQhIqDRVdEWpw==",
"dependencies": {
"lodash": "^4.17.21",
"typed-reflector": "^1.0.10"
},
"peerDependencies": {
"minato": "^1.2.3"
}
},
"node_modules/minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
......@@ -7007,6 +7047,20 @@
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
"node_modules/satori-decorators": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/satori-decorators/-/satori-decorators-1.0.8.tgz",
"integrity": "sha512-9AbhozP7pRc82mtDydOeiQSBfhnKBjM7bzk3sh8TKbI8EWh+58cykpXwYNMKUya8eRkvs3jlKtAdoArBzuOPFw==",
"dependencies": {
"@types/koa": "^2.13.5",
"@types/koa__router": "^8.0.11",
"cordis-decorators": "^1.0.16",
"lodash": "^4.17.21"
},
"peerDependencies": {
"@satorijs/satori": "^1.0.3"
}
},
"node_modules/saxes": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/saxes/-/saxes-5.0.1.tgz",
......@@ -7028,6 +7082,19 @@
"cosmokit": "^1.1.2"
}
},
"node_modules/schemastery-gen": {
"version": "3.1.14",
"resolved": "https://registry.npmjs.org/schemastery-gen/-/schemastery-gen-3.1.14.tgz",
"integrity": "sha512-yc9HVwgRu0tE2LSJpPwPCcTl3CJIm3qFyYNUHplQ1dBJqZqzKROaJUECBz+DCE5b4ttqpiHYOmI+93xEJkG4ow==",
"dependencies": {
"lodash": "^4.17.21",
"reflect-metadata": "^0.1.13",
"typed-reflector": "^1.0.10"
},
"peerDependencies": {
"schemastery": "^3.4.3"
}
},
"node_modules/secure-json-parse": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/secure-json-parse/-/secure-json-parse-2.4.0.tgz",
......@@ -7221,12 +7288,12 @@
}
},
"node_modules/socks": {
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/socks/-/socks-2.6.2.tgz",
"integrity": "sha512-zDZhHhZRY9PxRruRMR7kMhnf3I8hDs4S3f9RecfnGxvcBHQcKcIH/oUcEWffsfl1XxdYlA7nnlGbbTvPz9D8gA==",
"version": "2.7.0",
"resolved": "https://registry.npmjs.org/socks/-/socks-2.7.0.tgz",
"integrity": "sha512-scnOe9y4VuiNUULJN72GrM26BNOjVsfPXI+j+98PkyEfsIXroa5ofyjT+FzGvn/xHs73U2JtoBYAVx9Hl4quSA==",
"peer": true,
"dependencies": {
"ip": "^1.1.5",
"ip": "^2.0.0",
"smart-buffer": "^4.2.0"
},
"engines": {
......@@ -7248,6 +7315,12 @@
"node": ">= 6"
}
},
"node_modules/socks/node_modules/ip": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz",
"integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==",
"peer": true
},
"node_modules/sonic-boom": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-3.0.0.tgz",
......@@ -7830,9 +7903,9 @@
}
},
"node_modules/typed-reflector": {
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/typed-reflector/-/typed-reflector-1.0.10.tgz",
"integrity": "sha512-AqjdFGE/DGzbyFHTJ/xDY6mPHAJJKiVhn3vQ01sXz5eEJvY82jOllPGanFJ/Bo6ObPbLWa2fAZW19kcybiFPNA==",
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/typed-reflector/-/typed-reflector-1.0.11.tgz",
"integrity": "sha512-OhryVYaR+tBEW9Yt2PsPqAniNfbVk1idKbnLxBCBPUSHVRm+Ajik/QxifoJUuGoaXAZDLW9JlJTO6ctXGZX9gQ==",
"dependencies": {
"reflect-metadata": "^0.1.13"
}
......@@ -9147,45 +9220,27 @@
}
},
"@koishijs/core": {
"version": "4.7.6",
"resolved": "https://registry.npmjs.org/@koishijs/core/-/core-4.7.6.tgz",
"integrity": "sha512-2F7pY7QwMilwO3B/771eP14jJ5WN5CKH0YAatbKwP97AJ9pGAgijrS17D5F7htH7ZA2C3TqQbysxYy4Z6WIedw==",
"version": "4.8.1",
"resolved": "https://registry.npmjs.org/@koishijs/core/-/core-4.8.1.tgz",
"integrity": "sha512-dHYWOox4RdZu6YwrmazTEbafCP4QmfGKBZoDDKx6cGwJYRcU09RxZ4nNL/1mPGyJBPgqngzpiY0C+4kwD2R4cw==",
"peer": true,
"requires": {
"@koishijs/utils": "^5.4.5",
"cordis": "^1.6.0",
"@koishijs/utils": "^6.0.0",
"@satorijs/core": "^1.0.3",
"cordis": "^2.0.6",
"fastest-levenshtein": "^1.0.12",
"minato": "^1.2.1"
"minato": "^1.2.3"
}
},
"@koishijs/segment": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@koishijs/segment/-/segment-1.1.1.tgz",
"integrity": "sha512-HmLRKJiIX++U+ow+RP0BVGwgAFzDRqwHusUzjoZcZdcnG8yudTsvB6MXnzBMnBL7k9LBxUlfB5P8ukkM1roZFQ==",
"peer": true
},
"@koishijs/utils": {
"version": "5.4.5",
"resolved": "https://registry.npmjs.org/@koishijs/utils/-/utils-5.4.5.tgz",
"integrity": "sha512-tOmhFFcnuhFAudRcG9Bq7OeVmX1yxGvlSsJMbaSBHvb/hUrFzpXjEd2onqnJw4fyx/QLgYYFBeiFcKXDSujoLg==",
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/@koishijs/utils/-/utils-6.0.0.tgz",
"integrity": "sha512-xMwZAkrCnjVXYLmZTSnI8ZYyNU8YcNynyK+njkNKivuQywfU3l/SgwLUqpv2x2uSsqaKIn8ZNXOrPYXMBpPdQg==",
"peer": true,
"requires": {
"@koishijs/segment": "^1.1.1",
"cosmokit": "^1.1.2",
"cosmokit": "^1.2.1",
"reggol": "^1.0.3",
"schemastery": "^3.4.3",
"supports-color": "^8.1.1"
},
"dependencies": {
"supports-color": {
"version": "8.1.1",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz",
"integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==",
"peer": true,
"requires": {
"has-flag": "^4.0.0"
}
}
"schemastery": "^3.4.3"
}
},
"@nestjs/common": {
......@@ -9315,6 +9370,54 @@
"node-fetch": "^2.6.1"
}
},
"@satorijs/core": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@satorijs/core/-/core-1.0.3.tgz",
"integrity": "sha512-ewAZmkSeWzwzIuIPIzJ9G1xRWq1tL8+2kgmE8nf4zE/uU4xmf9DQSApSGj2ZnNs2gLhIzZW0TKghIA1R1bMUCA==",
"peer": true,
"requires": {
"@satorijs/message": "^1.0.1",
"cordis": "^2.0.6",
"cosmokit": "^1.2.1"
}
},
"@satorijs/message": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@satorijs/message/-/message-1.0.1.tgz",
"integrity": "sha512-AbWf2xsaCEM5Vu76BEHsLs8bx7SyHjIwSea74phG9mQYE5Qean1LWxClWdPfCmN7AGyosh1zkqm34SCMSPBt+w==",
"peer": true
},
"@satorijs/satori": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@satorijs/satori/-/satori-1.0.3.tgz",
"integrity": "sha512-XQCIXtVTGqbBWdsArI87ouwIS5MxCTEzVcNooURE9jQRi1CgXz330IqSaqvR00EY673PEB4RpVdMZvDeDv4u7w==",
"peer": true,
"requires": {
"@koa/router": "^10.1.1",
"@satorijs/core": "^1.0.3",
"@types/koa": "*",
"@types/koa__router": "*",
"@types/ws": "^8.5.3",
"axios": "^0.24.0",
"koa": "^2.13.4",
"koa-bodyparser": "^4.3.0",
"parseurl": "^1.3.3",
"path-to-regexp": "^6.2.1",
"portfinder": "^1.0.28",
"proxy-agent": "^5.0.0",
"reggol": "^1.0.3",
"schemastery": "^3.4.3",
"ws": "^8.6.0"
},
"dependencies": {
"path-to-regexp": {
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.1.tgz",
"integrity": "sha512-JLyh7xT1kizaEvcaXOQwOc2/Yhw6KZOvPf1S8401UyLk86CU79LN3vl7ztXGm/pZ+YjoyAJ4rxmHwbkBXJX+yw==",
"peer": true
}
}
},
"@sinonjs/commons": {
"version": "1.8.3",
"resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.3.tgz",
......@@ -9970,6 +10073,15 @@
"fastq": "^1.6.1"
}
},
"axios": {
"version": "0.24.0",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.24.0.tgz",
"integrity": "sha512-Q6cWsys88HoPgAaFAVUb0WpPk0O8iTeisR9IMqy9G8AbO4NlpVknrnQS03zzF9PGAWgO3cgletO3VjV/P7VztA==",
"peer": true,
"requires": {
"follow-redirects": "^1.14.4"
}
},
"babel-jest": {
"version": "27.5.1",
"resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-27.5.1.tgz",
......@@ -10370,12 +10482,25 @@
"integrity": "sha512-3DdaFaU/Zf1AnpLiFDeNCD4TOWe3Zl2RZaTzUvWiIk5ERzcCodOE20Vqq4fzCbNoHURFHT4/us/Lfq+S2zyY4w=="
},
"cordis": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/cordis/-/cordis-1.6.0.tgz",
"integrity": "sha512-Nt/DOV7sGwlzcxV4QO/RJ4NyTdim36QT03uTG8/KIjCkzYXHPHq7FqXXiRFe8e2qvDDI8D2pYOEDzF7uICxJ1w==",
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/cordis/-/cordis-2.0.6.tgz",
"integrity": "sha512-Q85Y2iY3myX340TiUV97DtTuPTls/pZoYqP2eWHlkLYcIzs7cIBTX3C8FqxaZ2hRgOJ6kMcXSXSIPWsZGcyCHQ==",
"peer": true,
"requires": {
"cosmokit": "^1.1.2"
"cosmokit": "^1.2.1"
}
},
"cordis-decorators": {
"version": "1.0.16",
"resolved": "https://registry.npmjs.org/cordis-decorators/-/cordis-decorators-1.0.16.tgz",
"integrity": "sha512-S5XULywHemcob+KqSItv3kAo1mNRjbDchmfrKJALYs3wqzp4q4PPZRQftbW5SVuLReSis14hgwTHbgoXNGJVEA==",
"requires": {
"lodash": "^4.17.21",
"mustache": "^4.2.0",
"reflect-metadata": "^0.1.13",
"rxjs": "^7.5.6",
"schemastery-gen": "^3.1.14",
"typed-reflector": "^1.0.11"
}
},
"core-util-is": {
......@@ -11131,9 +11256,9 @@
"dev": true
},
"fastest-levenshtein": {
"version": "1.0.12",
"resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.12.tgz",
"integrity": "sha512-On2N+BpYJ15xIC974QNVuYGMOlEVt4s0EOI3wwMqOmK1fdDY+FN/zltPV8vosq4ad4c/gJ1KHScUn/6AWIgiow==",
"version": "1.0.14",
"resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.14.tgz",
"integrity": "sha512-tFfWHjnuUfKE186Tfgr+jtaFc0mZTApEgKDOeyN+FwOqRkO/zK/3h1AiRd8u8CY53owL3CUmGr/oI9p/RdyLTA==",
"peer": true
},
"fastify": {
......@@ -12556,58 +12681,27 @@
}
},
"koishi": {
"version": "4.7.6",
"resolved": "https://registry.npmjs.org/koishi/-/koishi-4.7.6.tgz",
"integrity": "sha512-yod72tM399rRcXvpXAveHPZYvcfJDpIwEz2sviTba/6AFMKXc4f8u795hQ2B2IYpMR0vwfpxdG3OwwYuho7B/A==",
"version": "4.8.1",
"resolved": "https://registry.npmjs.org/koishi/-/koishi-4.8.1.tgz",
"integrity": "sha512-4ogJzbSmGWq4ek33rb2eLeFzdcwFM9zi6ZMUzm52tbHWDcJ+c1WqARj/0tc4tQ/7oAj5hNTC+yo3ddFOGgf0Sg==",
"peer": true,
"requires": {
"@koa/router": "^10.1.1",
"@koishijs/core": "^4.7.6",
"@koishijs/utils": "^5.4.5",
"@types/koa": "*",
"@types/koa__router": "*",
"@types/ws": "^8.5.3",
"axios": "^0.24.0",
"@koishijs/core": "^4.8.1",
"@koishijs/utils": "^6.0.0",
"@satorijs/satori": "^1.0.3",
"file-type": "^16.5.3",
"koa": "^2.13.4",
"koa-bodyparser": "^4.3.0",
"ns-require": "^1.1.4",
"parseurl": "^1.3.3",
"path-to-regexp": "^6.2.1",
"portfinder": "^1.0.28",
"proxy-agent": "^5.0.0",
"ws": "^8.6.0"
},
"dependencies": {
"axios": {
"version": "0.24.0",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.24.0.tgz",
"integrity": "sha512-Q6cWsys88HoPgAaFAVUb0WpPk0O8iTeisR9IMqy9G8AbO4NlpVknrnQS03zzF9PGAWgO3cgletO3VjV/P7VztA==",
"peer": true,
"requires": {
"follow-redirects": "^1.14.4"
}
},
"path-to-regexp": {
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.1.tgz",
"integrity": "sha512-JLyh7xT1kizaEvcaXOQwOc2/Yhw6KZOvPf1S8401UyLk86CU79LN3vl7ztXGm/pZ+YjoyAJ4rxmHwbkBXJX+yw==",
"peer": true
}
"ns-require": "^1.1.4"
}
},
"koishi-decorators": {
"version": "2.1.7",
"resolved": "https://registry.npmjs.org/koishi-decorators/-/koishi-decorators-2.1.7.tgz",
"integrity": "sha512-OoExVOdpVEmv8FywtdjR8JUPQtBz1P2rabkIfmt3SQpp3jrkm67EgdQNH+Nw8+6CfSDukMP3+/xWsA64VE5VEQ==",
"koishi-thirdeye": {
"version": "11.0.2",
"resolved": "https://registry.npmjs.org/koishi-thirdeye/-/koishi-thirdeye-11.0.2.tgz",
"integrity": "sha512-0Mk1Nb3OwAaONgVE5YIFpHI4QHGQlQlfMC9r2Am8+FKKyxL0oqivg9eiJJj7eopTpZ8c8WBPdoFlJl9MEDs4PA==",
"requires": {
"@types/koa": "^2.13.4",
"@types/koa__router": "^8.0.11",
"lodash": "^4.17.21",
"mustache": "^4.2.0",
"reflect-metadata": "^0.1.13",
"rxjs": "^7.5.5",
"typed-reflector": "^1.0.10"
"minato-decorators": "^2.0.8",
"rxjs": "^7.5.6",
"satori-decorators": "^1.0.8"
}
},
"leven": {
......@@ -12810,6 +12904,15 @@
"ns-require": "^1.1.4"
}
},
"minato-decorators": {
"version": "2.0.8",
"resolved": "https://registry.npmjs.org/minato-decorators/-/minato-decorators-2.0.8.tgz",
"integrity": "sha512-W1fukpqMBwTyE5lBkVmSdwGSl6eLzdRmPqAxyDxbfSJxva0FzXgx9VXQPOdkxLqDyWORa+uj/CQhIqDRVdEWpw==",
"requires": {
"lodash": "^4.17.21",
"typed-reflector": "^1.0.10"
}
},
"minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
......@@ -13600,6 +13703,17 @@
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
"satori-decorators": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/satori-decorators/-/satori-decorators-1.0.8.tgz",
"integrity": "sha512-9AbhozP7pRc82mtDydOeiQSBfhnKBjM7bzk3sh8TKbI8EWh+58cykpXwYNMKUya8eRkvs3jlKtAdoArBzuOPFw==",
"requires": {
"@types/koa": "^2.13.5",
"@types/koa__router": "^8.0.11",
"cordis-decorators": "^1.0.16",
"lodash": "^4.17.21"
}
},
"saxes": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/saxes/-/saxes-5.0.1.tgz",
......@@ -13618,6 +13732,16 @@
"cosmokit": "^1.1.2"
}
},
"schemastery-gen": {
"version": "3.1.14",
"resolved": "https://registry.npmjs.org/schemastery-gen/-/schemastery-gen-3.1.14.tgz",
"integrity": "sha512-yc9HVwgRu0tE2LSJpPwPCcTl3CJIm3qFyYNUHplQ1dBJqZqzKROaJUECBz+DCE5b4ttqpiHYOmI+93xEJkG4ow==",
"requires": {
"lodash": "^4.17.21",
"reflect-metadata": "^0.1.13",
"typed-reflector": "^1.0.10"
}
},
"secure-json-parse": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/secure-json-parse/-/secure-json-parse-2.4.0.tgz",
......@@ -13780,13 +13904,21 @@
"peer": true
},
"socks": {
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/socks/-/socks-2.6.2.tgz",
"integrity": "sha512-zDZhHhZRY9PxRruRMR7kMhnf3I8hDs4S3f9RecfnGxvcBHQcKcIH/oUcEWffsfl1XxdYlA7nnlGbbTvPz9D8gA==",
"version": "2.7.0",
"resolved": "https://registry.npmjs.org/socks/-/socks-2.7.0.tgz",
"integrity": "sha512-scnOe9y4VuiNUULJN72GrM26BNOjVsfPXI+j+98PkyEfsIXroa5ofyjT+FzGvn/xHs73U2JtoBYAVx9Hl4quSA==",
"peer": true,
"requires": {
"ip": "^1.1.5",
"ip": "^2.0.0",
"smart-buffer": "^4.2.0"
},
"dependencies": {
"ip": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz",
"integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==",
"peer": true
}
}
},
"socks-proxy-agent": {
......@@ -14227,9 +14359,9 @@
}
},
"typed-reflector": {
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/typed-reflector/-/typed-reflector-1.0.10.tgz",
"integrity": "sha512-AqjdFGE/DGzbyFHTJ/xDY6mPHAJJKiVhn3vQ01sXz5eEJvY82jOllPGanFJ/Bo6ObPbLWa2fAZW19kcybiFPNA==",
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/typed-reflector/-/typed-reflector-1.0.11.tgz",
"integrity": "sha512-OhryVYaR+tBEW9Yt2PsPqAniNfbVk1idKbnLxBCBPUSHVRm+Ajik/QxifoJUuGoaXAZDLW9JlJTO6ctXGZX9gQ==",
"requires": {
"reflect-metadata": "^0.1.13"
}
......
......@@ -33,7 +33,7 @@
"peerDependencies": {
"@nestjs/common": "^9.0.3 || ^8.0.0",
"@nestjs/core": "^9.0.3 || ^8.0.0",
"koishi": "4.7.6",
"koishi": "^4.8.1",
"rxjs": "^7.5.5"
},
"devDependencies": {
......@@ -66,9 +66,9 @@
"@types/ws": "^8.5.3",
"koa": "^2.13.4",
"koa-bodyparser": "^4.3.0",
"koishi-decorators": "^2.1.7",
"koishi-thirdeye": "^11.0.2",
"lodash": "^4.17.21",
"typed-reflector": "^1.0.10",
"typed-reflector": "^1.0.11",
"ws": "^8.7.0"
},
"jest": {
......
import { App, Command } from 'koishi';
import { Command, Context } from 'koishi';
import {
Inject,
Injectable,
......@@ -16,7 +16,6 @@ import { KoishiMetascanService } from './providers/koishi-metascan.service';
import { KOISHI_MODULE_OPTIONS, KoishiIpSym } from './utility/koishi.constants';
import { KoishiLoggerService } from './providers/koishi-logger.service';
import { KoishiHttpDiscoveryService } from './koishi-http-discovery/koishi-http-discovery.service';
import { applySelector } from 'koishi-decorators';
import WebSocket from 'ws';
import { KoishiNestRouter } from './utility/koa-router';
import './utility/koishi.workarounds';
......@@ -24,7 +23,7 @@ import './utility/koishi.declares';
@Injectable()
export class KoishiService
extends App
extends Context
implements OnModuleInit, OnModuleDestroy
{
constructor(
......@@ -57,15 +56,15 @@ export class KoishiService
const httpServer: Server = httpAdapter?.getHttpServer();
if (httpServer && httpServer instanceof Server) {
this.logger('app').info('App using Nest HTTP Server.');
this._httpServer = httpServer;
this.router._http = httpServer;
} else {
this.logger('app').info('No http adapters found from Nest application.');
this._httpServer = createServer(this._nestKoaTmpInstance.callback());
this._wsServer = new WebSocket.Server({
server: this._httpServer,
this.router._http = createServer(this._nestKoaTmpInstance.callback());
this.router._ws = new WebSocket.Server({
server: this.router._http,
});
this._wsServer.on('connection', (socket, request) => {
this.router._ws.on('connection', (socket, request) => {
for (const manager of this.router.wsStack) {
if (manager.accept(socket, request)) return;
}
......@@ -79,8 +78,7 @@ export class KoishiService
this.metascan.preRegisterContext(this.any());
if (this.koishiModuleOptions.usePlugins) {
for (const pluginDef of this.koishiModuleOptions.usePlugins) {
const ctx = applySelector(this, pluginDef);
ctx.plugin(pluginDef.plugin, pluginDef.options);
this.plugin(pluginDef.plugin, pluginDef.options);
}
}
await this.metascan.registerContext(this.any());
......
......@@ -4,9 +4,10 @@ import {
KoishiModuleOptions,
KoishiModuleSelection,
} from '../utility/koishi.interfaces';
import { applySelector, Registrar } from 'koishi-decorators';
import { Context } from 'koishi';
import { Module } from '@nestjs/core/injector/module';
import { selectContext } from 'koishi-thirdeye';
import { koishiRegistrar } from 'koishi-thirdeye/dist/src/registrar';
@Injectable()
export class KoishiContextService {
......@@ -24,7 +25,7 @@ export class KoishiContextService {
getModuleCtx(ctx: Context, module: Module) {
const moduleSelection = this.moduleSelections.get(module.metatype);
if (moduleSelection) {
return applySelector(ctx, moduleSelection);
return selectContext(ctx, moduleSelection);
} else {
return ctx;
}
......@@ -32,11 +33,9 @@ export class KoishiContextService {
getProviderCtx(ctx: Context, ...instances: any[]) {
for (const instance of instances) {
ctx = new Registrar(
instance,
undefined,
this.options.templateParams || {},
).getScopeContext(ctx);
ctx = koishiRegistrar
.aspect(instance, this.options.templateParams || {})
.getScopeContext(ctx);
}
return ctx;
}
......
......@@ -17,9 +17,11 @@ import { KoishiContextService } from './koishi-context.service';
import { Module } from '@nestjs/core/injector/module';
import { KoishiMetadataFetcherService } from '../koishi-metadata-fetcher/koishi-metadata-fetcher.service';
import { KoishiInterceptorManagerService } from '../koishi-interceptor-manager/koishi-interceptor-manager.service';
import { CommandRegisterConfig, Registrar } from 'koishi-decorators';
import { KoishiExceptionHandlerService } from '../koishi-exception-handler/koishi-exception-handler.service';
import { takeFirstValue } from '../utility/take-first-value';
import { registerAtLeastEach } from '../utility/take-first-value';
import { koishiRegistrar } from 'koishi-thirdeye/dist/src/registrar';
import { CommandConfigExtended } from 'koishi-thirdeye/dist/src/def';
import { map } from 'rxjs';
@Injectable()
export class KoishiMetascanService {
......@@ -46,53 +48,6 @@ export class KoishiMetascanService {
return this.intercepterManager.addInterceptors(command, interceptorDefs);
}
private async handleInstanceRegistration(
ctx: Context,
instance: Record<string, any>,
methodKey: string,
) {
const registrar = new Registrar(instance, undefined, this.templateParams);
const scopeContext = registrar.getScopeContext(ctx, methodKey, false);
return takeFirstValue(
registrar.runLayers(
scopeContext,
async (baseContext) => {
const result = registrar.register(baseContext, methodKey, false);
if (!result) {
return;
}
if (result.type === 'command') {
const command = result.result as Command;
const interceptorDefs: KoishiCommandInterceptorRegistration[] =
_.uniq(
this.metaFetcher.getPropertyMetadataArray(
KoishiCommandInterceptorDef,
instance,
methodKey,
),
);
this.addInterceptors(command, interceptorDefs);
if (!(result.data as CommandRegisterConfig).config?.empty) {
command.action(async (argv) => {
try {
return await argv.next();
} catch (e) {
return this.exceptionHandler.handleActionException(e);
}
}, true);
}
} else if (result.type === 'plugin') {
const mayBePromise = result.result as Promise<any>;
if (mayBePromise instanceof Promise) {
await mayBePromise;
}
}
},
methodKey,
),
);
}
private registerOnService(
ctx: Context,
instance: any,
......@@ -178,30 +133,51 @@ export class KoishiMetascanService {
);
}
private mutateCommandRegistration(
instance: any,
key: string,
command: Command,
) {
const interceptorDefs: KoishiCommandInterceptorRegistration[] = _.uniq(
this.metaFetcher.getPropertyMetadataArray(
KoishiCommandInterceptorDef,
instance,
key,
),
);
this.addInterceptors(command, interceptorDefs);
const config = command.config as CommandConfigExtended;
if (!config?.empty) {
command.action(async (argv) => {
try {
return await argv.next();
} catch (e) {
return this.exceptionHandler.handleActionException(e);
}
}, true);
}
}
registerContext(ctx: Context) {
return Promise.all(
this.runForEachProvider(ctx, (providerCtx, instance) => {
this.scanInstanceForProvidingContextService(providerCtx, instance);
const registrar = new Registrar(
instance,
undefined,
this.templateParams,
);
return takeFirstValue(
registrar.runLayers(providerCtx, (providerInnerCtx) => {
registrar.performTopActions(providerInnerCtx);
return Promise.all(
registrar
.getAllFieldsToRegister()
.map((methodKey: string) =>
this.handleInstanceRegistration(
providerInnerCtx,
instance,
methodKey,
),
),
);
}),
const registrar = koishiRegistrar.aspect(instance, this.templateParams);
const allFields = registrar.getAllFieldsToRegister();
return registerAtLeastEach(
registrar.register(providerCtx).pipe(
map((result) => {
if (result.type === 'command') {
this.mutateCommandRegistration(
instance,
result.key,
result.result,
);
}
return result;
}),
),
allFields,
);
}),
);
......
......@@ -20,7 +20,7 @@ export class KoishiWebsocketGateway
afterInit(server: any): any {
// console.log('Init ws server', server, server === this.wsServer);
this.wsServer.path = '__koishi_fallback';
this.koishi._wsServer = this.wsServer;
this.koishi.router._ws = this.wsServer;
}
handleConnection(socket: WebSocket, request: IncomingMessage) {
......
......@@ -20,7 +20,6 @@ import {
ContextScopeTypes,
getContextProvideToken,
} from './koishi-context.factory';
import { CallbackLayer } from 'koishi-decorators';
// Injections
export const InjectContext = () => Inject(KOISHI_CONTEXT);
......@@ -95,8 +94,8 @@ export const ConcatMetadata = <K extends keyof MetadataArrayValueMap>(
// Export all koishi-decorator decorators
export * from 'koishi-decorators/dist/src/decorators';
export { PluginDef } from 'koishi-decorators';
export * from 'koishi-thirdeye/dist/src/decorators/common';
export { PluginDef } from 'koishi-thirdeye';
// Service
......@@ -116,17 +115,11 @@ export function WireContextService(name?: ServiceName): PropertyDecorator {
};
}
export function ProvideContextService(
name: ServiceName,
options: Context.ServiceOptions,
): ClassDecorator {
Context.service(name, options);
export function ProvideContextService(name: ServiceName): ClassDecorator {
Context.service(name);
return AppendMetadata(KoishiServiceProvideSym, name);
}
export const UsingService = (...services: ServiceName[]) =>
CallbackLayer((ctx, cb) => ctx.using(services, cb));
// Command interceptor
export const CommandInterceptors = (
......
import { ModuleMetadata, Provider, Type } from '@nestjs/common';
import { App, Channel, Command, Context, User } from 'koishi';
import { MetadataArrayMap, MetadataMap } from './koishi.constants';
import { ContextSelector, PluginDefinition } from 'koishi-decorators';
import { PluginRegistrar, Selection } from 'koishi-thirdeye';
export * from 'koishi-decorators/dist/src/def/interfaces';
export * from 'koishi-thirdeye/dist/src/def';
export interface KoishiModuleSelection extends ContextSelector {
export interface KoishiModuleSelection extends Selection {
module: Type<any>;
}
......@@ -17,7 +17,7 @@ export interface KoishiModuleTopOptions {
export interface KoishiModuleOptions
extends App.Config,
KoishiModuleTopOptions {
usePlugins?: PluginDefinition<any>[];
usePlugins?: PluginRegistrar.PluginDefinition<any>[];
loggerPrefix?: string;
loggerColor?: number;
moduleSelection?: KoishiModuleSelection[];
......
......@@ -20,6 +20,8 @@ export class IntercepterManagerService {
return this[Context.current] || this.ctx;
}
static methods = ['withInterceptors'];
withInterceptors(
interceptors: KoishiCommandInterceptorRegistration[],
): Context {
......@@ -30,7 +32,4 @@ export class IntercepterManagerService {
}
}
Context.service('$interceptorManager', {
constructor: IntercepterManagerService,
methods: ['withInterceptors'],
});
Context.service('$interceptorManager', IntercepterManagerService);
import { Observable } from 'rxjs';
export function takeFirstValue<T>(obs: Observable<T>): Promise<T> {
export function registerAtLeastEach<T extends { key: string }>(
obs: Observable<T>,
keys: string[],
): Promise<T> {
const remainingKeys = new Set(keys);
return new Promise<T>((resolve, reject) => {
let resolved = false;
let lastValue: T = undefined;
obs.subscribe({
next: (value) => {
if (!resolved) {
lastValue = value;
remainingKeys.delete(value.key);
if (!resolved && remainingKeys.size === 0) {
resolve(value);
resolved = true;
}
......@@ -18,7 +25,7 @@ export function takeFirstValue<T>(obs: Observable<T>): Promise<T> {
},
complete: () => {
if (!resolved) {
resolve(undefined);
resolve(lastValue);
resolved = true;
}
},
......
......@@ -31,13 +31,13 @@ describe('Koishi module in Fastify adapter', () => {
});
it('should register http and ws server', () => {
expect(koishiApp._httpServer).toBeDefined();
expect(koishiApp._wsServer).toBeDefined();
expect(koishiApp.router._http).toBeDefined();
expect(koishiApp.router._ws).toBeDefined();
});
it('should be nest http server', () => {
expect(koishiApp._httpServer).toBeInstanceOf(http.Server);
expect(app.getHttpServer()).toEqual(koishiApp._httpServer);
expect(koishiApp.router._http).toBeInstanceOf(http.Server);
expect(app.getHttpServer()).toEqual(koishiApp.router._http);
});
it('should response to koishi routes', () => {
......
......@@ -2,10 +2,11 @@ import { KoishiService } from '../src/koishi.service';
import { KoishiWsAdapter } from '../src/koishi.ws-adapter';
import http from 'http';
import request from 'supertest';
import { Context, Session } from 'koishi';
import { Context, Events, Session } from 'koishi';
import { testingModule } from './utility/testing-module';
import { NestExpressApplication } from '@nestjs/platform-express';
import { EventName } from 'koishi-decorators';
type EventName = keyof Events;
describe('Koishi in Nest.js', () => {
let app: NestExpressApplication;
......@@ -27,13 +28,13 @@ describe('Koishi in Nest.js', () => {
});
it('should register http and ws server', () => {
expect(koishiApp._httpServer).toBeDefined();
expect(koishiApp._wsServer).toBeDefined();
expect(koishiApp.router._http).toBeDefined();
expect(koishiApp.router._ws).toBeDefined();
});
it('should be nest http server', () => {
expect(koishiApp._httpServer).toBeInstanceOf(http.Server);
expect(app.getHttpServer()).toEqual(koishiApp._httpServer);
expect(koishiApp.router._http).toBeInstanceOf(http.Server);
expect(app.getHttpServer()).toEqual(koishiApp.router._http);
});
it('should response to koishi routes', () => {
......
......@@ -19,6 +19,7 @@ describe('Koishi in Nest.js context', () => {
});
it('should register http service', () => {
expect(koishiApp._httpServer).toBeDefined();
expect(koishiApp.router._http).toBeDefined();
expect(koishiApp.router._ws).toBeDefined();
});
});
......@@ -9,7 +9,7 @@ import {
PutValue,
UseCommand,
UseEvent,
} from 'koishi-decorators';
} from 'koishi-thirdeye';
import {
CommandInterceptors,
UsingService,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment