Commit a9dd493e authored by nanahira's avatar nanahira

bump koishi

parent 99b28e90
......@@ -11,13 +11,13 @@
"dependencies": {
"@nestjs/platform-ws": "^8.1.2",
"@nestjs/websockets": "^8.1.2",
"@types/ws": "^8.2.0",
"koa": "^2.13.3",
"@types/ws": "^8.5.3",
"koa": "^2.13.4",
"koa-bodyparser": "^4.3.0",
"koishi-decorators": "^2.0.0",
"koishi-decorators": "^2.1.0",
"lodash": "^4.17.21",
"typed-reflector": "^1.0.10",
"ws": "^8.2.3"
"ws": "^8.6.0"
},
"devDependencies": {
"@nestjs/platform-express": "^8.2.3",
......@@ -36,7 +36,7 @@
"eslint-plugin-prettier": "^3.4.1",
"express": "^4.17.1",
"jest": "^27.4.4",
"koishi": "4.6.0",
"koishi": "4.7.1",
"prettier": "^2.4.1",
"rimraf": "^3.0.2",
"supertest": "^6.1.6",
......@@ -46,7 +46,7 @@
"peerDependencies": {
"@nestjs/common": "^8.2.6",
"@nestjs/core": "^8.2.6",
"koishi": "^4.6.0",
"koishi": "^4.7.1",
"reflect-metadata": "^0.1.13",
"rxjs": "^7.5.4"
}
......@@ -1050,33 +1050,49 @@
"integrity": "sha512-f66KywYG6+43afgE/8j/GoiNyygk/bnoCbps++3ErRKsIYkGGupyv07R2Ok5m9i67Iqc+T2g1eAUGUPzWhYTyg=="
},
"node_modules/@koishijs/core": {
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/@koishijs/core/-/core-4.6.0.tgz",
"integrity": "sha512-m+K2h/Oqmpcw39dQhJ/D9MBmwnWNUf9uFqymJ94+nP4CR7rcM1DTWNiaMGshGUqNu+s4q0ildoEDlQrE4hVuWA==",
"version": "4.7.1",
"resolved": "https://registry.npmjs.org/@koishijs/core/-/core-4.7.1.tgz",
"integrity": "sha512-vSd2BgyhDrTW/C7Ju1wDr5Z3vp7Qdyk7LgSpGI/b3QtDEfEkhdYKQ9J9LdHIVdUOFL0L0WeRgImW4ZMBtdVlfg==",
"dependencies": {
"@koishijs/utils": "^5.4.0",
"cosmotype": "^1.0.3",
"@koishijs/utils": "^5.4.5",
"cordis": "^1.1.1",
"fastest-levenshtein": "^1.0.12",
"ns-require": "^1.1.0"
"minato": "^1.1.0"
},
"engines": {
"node": ">=12.0.0"
}
},
"node_modules/@koishijs/plugin-help": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@koishijs/plugin-help/-/plugin-help-1.0.0.tgz",
"integrity": "sha512-SvOZiSmtysQxnhOUG0He+/Ftxr+IuIbTApsK6KypRpQ4a1q7OuJWmKb2e+f62zS3GhMYBJ8qT0wRMU+TFPP3AQ==",
"peerDependencies": {
"koishi": "^4.7.1"
}
},
"node_modules/@koishijs/plugin-suggest": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@koishijs/plugin-suggest/-/plugin-suggest-1.0.0.tgz",
"integrity": "sha512-6jmhymcygID59Z3UblAARGXflJoH0+Tj/qi20GNQO0bxrKkoW4qjxJhlmZe2uv+D1hvTO0q2Yv98iEMDhKyXxw==",
"peerDependencies": {
"koishi": "^4.7.1"
}
},
"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=="
},
"node_modules/@koishijs/utils": {
"version": "5.4.0",
"resolved": "https://registry.npmjs.org/@koishijs/utils/-/utils-5.4.0.tgz",
"integrity": "sha512-w5SHArw032cXVtxp5nXkc5jzP6Fn3LrF7FQTanPnOgmjGv/AIOAKfJ6bqaOUsSg+ttcK3iO8xs65W6XsNz3g7g==",
"version": "5.4.5",
"resolved": "https://registry.npmjs.org/@koishijs/utils/-/utils-5.4.5.tgz",
"integrity": "sha512-tOmhFFcnuhFAudRcG9Bq7OeVmX1yxGvlSsJMbaSBHvb/hUrFzpXjEd2onqnJw4fyx/QLgYYFBeiFcKXDSujoLg==",
"dependencies": {
"@koishijs/segment": "^1.1.1",
"cosmokit": "^1.1.1",
"reggol": "^1.0.1",
"schemastery": "^3.3.2",
"cosmokit": "^1.1.2",
"reggol": "^1.0.3",
"schemastery": "^3.4.3",
"supports-color": "^8.1.1"
}
},
......@@ -2106,6 +2122,14 @@
"node": ">=8"
}
},
"node_modules/async": {
"version": "2.6.4",
"resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz",
"integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==",
"dependencies": {
"lodash": "^4.17.14"
}
},
"node_modules/asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
......@@ -2741,6 +2765,14 @@
"resolved": "https://registry.npmjs.org/copy-to/-/copy-to-2.0.1.tgz",
"integrity": "sha1-JoD7uAaKSNCGVrYJgJK9r8kG9KU="
},
"node_modules/cordis": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/cordis/-/cordis-1.1.1.tgz",
"integrity": "sha512-l1tYxBqy+oEb3EKEvQAlH1g5BICDdnTdcIre1MuCY/qWO4bsrh97qd7jQe2Rq/+tg5HRqs7K6RgP5N/85c57xw==",
"dependencies": {
"cosmokit": "^1.1.2"
}
},
"node_modules/core-util-is": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
......@@ -2760,18 +2792,9 @@
}
},
"node_modules/cosmokit": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/cosmokit/-/cosmokit-1.1.1.tgz",
"integrity": "sha512-+f8x9pFGIc7I6HTObS90dq2K5YsI4U3Me4l9OminU9woVtF9Sv3CAHb5vKbFZ93XpTFctAQ6qAVSGjkGvGI9iw=="
},
"node_modules/cosmotype": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/cosmotype/-/cosmotype-1.0.3.tgz",
"integrity": "sha512-JykvyDjyjaDjycm8CcK8GD4Xt6/Glu4pJU9uJ5lsDuE5B5bdmAykiTPMHfs+Is8QUsNaDKpsHfxtxCUBDPYgdw==",
"dependencies": {
"cosmokit": "^1.1.1",
"ns-require": "^1.1.0"
}
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/cosmokit/-/cosmokit-1.1.2.tgz",
"integrity": "sha512-cSNrcyxZ3GT+tjSlUzWIzMiK7Wndq1Nm/2tlRhT65RXltSIcH5zaHdmnz1TnIhLuOViaO9qfSdnRPzxNkxMv0g=="
},
"node_modules/cross-spawn": {
"version": "7.0.3",
......@@ -5541,13 +5564,15 @@
}
},
"node_modules/koishi": {
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/koishi/-/koishi-4.6.0.tgz",
"integrity": "sha512-QhjFWTGhrFnYfpVg4dNNxgHER38zSij3nyM/RB3YrLTM4VwImVk5unpgg0QryViwWxSYM4zJ0YUoys4A9jgG6A==",
"version": "4.7.1",
"resolved": "https://registry.npmjs.org/koishi/-/koishi-4.7.1.tgz",
"integrity": "sha512-WtY2ZujFMP4/ySKCc08oXLe2dYlZsdZP7f2eUck1w3cdvOh3eAgndckBP7xpkICAL0l6BYxrbzurIYh32Qck6g==",
"dependencies": {
"@koa/router": "^10.1.1",
"@koishijs/core": "^4.6.0",
"@koishijs/utils": "^5.4.0",
"@koishijs/core": "^4.7.1",
"@koishijs/plugin-help": "^1.0.0",
"@koishijs/plugin-suggest": "^1.0.0",
"@koishijs/utils": "^5.4.5",
"@types/koa": "*",
"@types/koa__router": "*",
"@types/ws": "^8.5.3",
......@@ -5555,28 +5580,31 @@
"file-type": "^16.5.3",
"koa": "^2.13.4",
"koa-bodyparser": "^4.3.0",
"ns-require": "^1.1.2",
"parseurl": "^1.3.3",
"path-to-regexp": "^6.2.0",
"portfinder": "^1.0.28",
"proxy-agent": "^5.0.0",
"ws": "^8.5.0"
"ws": "^8.6.0"
},
"engines": {
"node": ">=12.0.0"
}
},
"node_modules/koishi-decorators": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/koishi-decorators/-/koishi-decorators-2.0.0.tgz",
"integrity": "sha512-YAbjOLdBxJU0DnBM7vqH+UNfSqMrejlcTEc+m++ZvuMbkUA4tHZ5iciwJFV2iPZUKSZy7GbmImNbXDmmjowF5w==",
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/koishi-decorators/-/koishi-decorators-2.1.0.tgz",
"integrity": "sha512-b0opV0YfWXH7/sJ7ecBjPWhz9PsL4esQ1J8EUfymTcZE5jhiTjKhvp+TEdlEC+bDTM49LwMSnohGMU8nZxaD+g==",
"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",
"typed-reflector": "^1.0.10"
},
"peerDependencies": {
"koishi": "^4.6.0"
"koishi": "^4.7.1"
}
},
"node_modules/koishi/node_modules/path-to-regexp": {
......@@ -5842,6 +5870,15 @@
"node": ">=6"
}
},
"node_modules/minato": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/minato/-/minato-1.1.0.tgz",
"integrity": "sha512-by1KMWxWlzq0iDV7tMkqS3thDRzYNQoS2ECfX5HRpMGaPQJqSgm5aY9IAky7knwAMoW3cMxQ/IhpvEShQqyj6A==",
"dependencies": {
"cosmokit": "^1.1.2",
"ns-require": "^1.1.2"
}
},
"node_modules/minimatch": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
......@@ -5857,14 +5894,12 @@
"node_modules/minimist": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
"devOptional": true
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
},
"node_modules/mkdirp": {
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
"integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
"devOptional": true,
"dependencies": {
"minimist": "^1.2.5"
},
......@@ -5896,6 +5931,14 @@
"node": ">= 0.10.0"
}
},
"node_modules/mustache": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/mustache/-/mustache-4.2.0.tgz",
"integrity": "sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==",
"bin": {
"mustache": "bin/mustache"
}
},
"node_modules/natural-compare": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
......@@ -5964,9 +6007,9 @@
}
},
"node_modules/ns-require": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/ns-require/-/ns-require-1.1.0.tgz",
"integrity": "sha512-Iw349zwWNgkGZjYJtruf+BXUe8YHOiMZE0iUNffvpt/A1yTSabTnpBMQ0zNl65G1LhpzwCo1KMCqjmJF0z8O6g=="
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/ns-require/-/ns-require-1.1.2.tgz",
"integrity": "sha512-GUF6I1hWDsGx1cA9FW27KIRAlkMel2UZagR39dVNPAPBgwWK1Ez0XB96WEz2OFcwHsCORI9h75dEZueHqZ/1pA=="
},
"node_modules/nwsapi": {
"version": "2.2.0",
......@@ -6278,6 +6321,27 @@
"node": ">=8"
}
},
"node_modules/portfinder": {
"version": "1.0.28",
"resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.28.tgz",
"integrity": "sha512-Se+2isanIcEqf2XMHjyUKskczxbPH7dQnlMjXX6+dybayyHvAf/TCgyMRlzf/B6QDhAEFOGes0pzRo3by4AbMA==",
"dependencies": {
"async": "^2.6.2",
"debug": "^3.1.1",
"mkdirp": "^0.5.5"
},
"engines": {
"node": ">= 0.12.0"
}
},
"node_modules/portfinder/node_modules/debug": {
"version": "3.2.7",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
"dependencies": {
"ms": "^2.1.1"
}
},
"node_modules/prelude-ls": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
......@@ -6609,11 +6673,11 @@
}
},
"node_modules/reggol": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/reggol/-/reggol-1.0.1.tgz",
"integrity": "sha512-ZMOp3rZG6YQFVp/DC+BgFZaXSQcxHDayCmo7cL/kGujsSEoUzee0VJq1KCe9sgNt0qsM6JzkuSlj/+5SmmoO7Q==",
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/reggol/-/reggol-1.0.3.tgz",
"integrity": "sha512-91bFsIEaw3IKoMt7JQz703yuEgdcbbKBTJbeVyFMrZwA93wCU/ByDvhwDfvVWXjvLqwRuFOfhV1pkxvAgdkVZQ==",
"dependencies": {
"cosmokit": "^1.1.0",
"cosmokit": "^1.1.2",
"supports-color": "^8.1.1"
}
},
......@@ -6811,11 +6875,11 @@
}
},
"node_modules/schemastery": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/schemastery/-/schemastery-3.3.2.tgz",
"integrity": "sha512-Z1C850OPtNEBs+D4QBPdC+Wu1t6Fn1BrOJILRHs2b+I/u61hUKP2vIPMAXFLvmmONnwqAW8ksPdCD6Zz9n8zhg==",
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/schemastery/-/schemastery-3.4.3.tgz",
"integrity": "sha512-Ui9sPoxOVaKa2EzR6GS08qB/nIMJUczUtkaLfWjeE44kjYZ+GLUFNVE3TpbXRdxjnbIIExwG+paMd0+M7YimqQ==",
"dependencies": {
"cosmokit": "^1.1.0"
"cosmokit": "^1.1.2"
}
},
"node_modules/secure-json-parse": {
......@@ -7865,9 +7929,9 @@
}
},
"node_modules/ws": {
"version": "8.5.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz",
"integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==",
"version": "8.6.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.6.0.tgz",
"integrity": "sha512-AzmM3aH3gk0aX7/rZLYvjdvZooofDu3fFOzGqcSnQ1tOcTWwhM/o+q++E8mAyVVIyUdajrkzWUGftaVSDLn1bw==",
"engines": {
"node": ">=10.0.0"
},
......@@ -8749,30 +8813,42 @@
}
},
"@koishijs/core": {
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/@koishijs/core/-/core-4.6.0.tgz",
"integrity": "sha512-m+K2h/Oqmpcw39dQhJ/D9MBmwnWNUf9uFqymJ94+nP4CR7rcM1DTWNiaMGshGUqNu+s4q0ildoEDlQrE4hVuWA==",
"version": "4.7.1",
"resolved": "https://registry.npmjs.org/@koishijs/core/-/core-4.7.1.tgz",
"integrity": "sha512-vSd2BgyhDrTW/C7Ju1wDr5Z3vp7Qdyk7LgSpGI/b3QtDEfEkhdYKQ9J9LdHIVdUOFL0L0WeRgImW4ZMBtdVlfg==",
"requires": {
"@koishijs/utils": "^5.4.0",
"cosmotype": "^1.0.3",
"@koishijs/utils": "^5.4.5",
"cordis": "^1.1.1",
"fastest-levenshtein": "^1.0.12",
"ns-require": "^1.1.0"
"minato": "^1.1.0"
}
},
"@koishijs/plugin-help": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@koishijs/plugin-help/-/plugin-help-1.0.0.tgz",
"integrity": "sha512-SvOZiSmtysQxnhOUG0He+/Ftxr+IuIbTApsK6KypRpQ4a1q7OuJWmKb2e+f62zS3GhMYBJ8qT0wRMU+TFPP3AQ==",
"requires": {}
},
"@koishijs/plugin-suggest": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@koishijs/plugin-suggest/-/plugin-suggest-1.0.0.tgz",
"integrity": "sha512-6jmhymcygID59Z3UblAARGXflJoH0+Tj/qi20GNQO0bxrKkoW4qjxJhlmZe2uv+D1hvTO0q2Yv98iEMDhKyXxw==",
"requires": {}
},
"@koishijs/segment": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@koishijs/segment/-/segment-1.1.1.tgz",
"integrity": "sha512-HmLRKJiIX++U+ow+RP0BVGwgAFzDRqwHusUzjoZcZdcnG8yudTsvB6MXnzBMnBL7k9LBxUlfB5P8ukkM1roZFQ=="
},
"@koishijs/utils": {
"version": "5.4.0",
"resolved": "https://registry.npmjs.org/@koishijs/utils/-/utils-5.4.0.tgz",
"integrity": "sha512-w5SHArw032cXVtxp5nXkc5jzP6Fn3LrF7FQTanPnOgmjGv/AIOAKfJ6bqaOUsSg+ttcK3iO8xs65W6XsNz3g7g==",
"version": "5.4.5",
"resolved": "https://registry.npmjs.org/@koishijs/utils/-/utils-5.4.5.tgz",
"integrity": "sha512-tOmhFFcnuhFAudRcG9Bq7OeVmX1yxGvlSsJMbaSBHvb/hUrFzpXjEd2onqnJw4fyx/QLgYYFBeiFcKXDSujoLg==",
"requires": {
"@koishijs/segment": "^1.1.1",
"cosmokit": "^1.1.1",
"reggol": "^1.0.1",
"schemastery": "^3.3.2",
"cosmokit": "^1.1.2",
"reggol": "^1.0.3",
"schemastery": "^3.4.3",
"supports-color": "^8.1.1"
},
"dependencies": {
......@@ -9551,6 +9627,14 @@
"integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==",
"dev": true
},
"async": {
"version": "2.6.4",
"resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz",
"integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==",
"requires": {
"lodash": "^4.17.14"
}
},
"asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
......@@ -10077,6 +10161,14 @@
"resolved": "https://registry.npmjs.org/copy-to/-/copy-to-2.0.1.tgz",
"integrity": "sha1-JoD7uAaKSNCGVrYJgJK9r8kG9KU="
},
"cordis": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/cordis/-/cordis-1.1.1.tgz",
"integrity": "sha512-l1tYxBqy+oEb3EKEvQAlH1g5BICDdnTdcIre1MuCY/qWO4bsrh97qd7jQe2Rq/+tg5HRqs7K6RgP5N/85c57xw==",
"requires": {
"cosmokit": "^1.1.2"
}
},
"core-util-is": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
......@@ -10093,18 +10185,9 @@
}
},
"cosmokit": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/cosmokit/-/cosmokit-1.1.1.tgz",
"integrity": "sha512-+f8x9pFGIc7I6HTObS90dq2K5YsI4U3Me4l9OminU9woVtF9Sv3CAHb5vKbFZ93XpTFctAQ6qAVSGjkGvGI9iw=="
},
"cosmotype": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/cosmotype/-/cosmotype-1.0.3.tgz",
"integrity": "sha512-JykvyDjyjaDjycm8CcK8GD4Xt6/Glu4pJU9uJ5lsDuE5B5bdmAykiTPMHfs+Is8QUsNaDKpsHfxtxCUBDPYgdw==",
"requires": {
"cosmokit": "^1.1.1",
"ns-require": "^1.1.0"
}
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/cosmokit/-/cosmokit-1.1.2.tgz",
"integrity": "sha512-cSNrcyxZ3GT+tjSlUzWIzMiK7Wndq1Nm/2tlRhT65RXltSIcH5zaHdmnz1TnIhLuOViaO9qfSdnRPzxNkxMv0g=="
},
"cross-spawn": {
"version": "7.0.3",
......@@ -12210,13 +12293,15 @@
}
},
"koishi": {
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/koishi/-/koishi-4.6.0.tgz",
"integrity": "sha512-QhjFWTGhrFnYfpVg4dNNxgHER38zSij3nyM/RB3YrLTM4VwImVk5unpgg0QryViwWxSYM4zJ0YUoys4A9jgG6A==",
"version": "4.7.1",
"resolved": "https://registry.npmjs.org/koishi/-/koishi-4.7.1.tgz",
"integrity": "sha512-WtY2ZujFMP4/ySKCc08oXLe2dYlZsdZP7f2eUck1w3cdvOh3eAgndckBP7xpkICAL0l6BYxrbzurIYh32Qck6g==",
"requires": {
"@koa/router": "^10.1.1",
"@koishijs/core": "^4.6.0",
"@koishijs/utils": "^5.4.0",
"@koishijs/core": "^4.7.1",
"@koishijs/plugin-help": "^1.0.0",
"@koishijs/plugin-suggest": "^1.0.0",
"@koishijs/utils": "^5.4.5",
"@types/koa": "*",
"@types/koa__router": "*",
"@types/ws": "^8.5.3",
......@@ -12224,10 +12309,12 @@
"file-type": "^16.5.3",
"koa": "^2.13.4",
"koa-bodyparser": "^4.3.0",
"ns-require": "^1.1.2",
"parseurl": "^1.3.3",
"path-to-regexp": "^6.2.0",
"portfinder": "^1.0.28",
"proxy-agent": "^5.0.0",
"ws": "^8.5.0"
"ws": "^8.6.0"
},
"dependencies": {
"path-to-regexp": {
......@@ -12238,13 +12325,14 @@
}
},
"koishi-decorators": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/koishi-decorators/-/koishi-decorators-2.0.0.tgz",
"integrity": "sha512-YAbjOLdBxJU0DnBM7vqH+UNfSqMrejlcTEc+m++ZvuMbkUA4tHZ5iciwJFV2iPZUKSZy7GbmImNbXDmmjowF5w==",
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/koishi-decorators/-/koishi-decorators-2.1.0.tgz",
"integrity": "sha512-b0opV0YfWXH7/sJ7ecBjPWhz9PsL4esQ1J8EUfymTcZE5jhiTjKhvp+TEdlEC+bDTM49LwMSnohGMU8nZxaD+g==",
"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",
"typed-reflector": "^1.0.10"
}
......@@ -12458,6 +12546,15 @@
"integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==",
"dev": true
},
"minato": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/minato/-/minato-1.1.0.tgz",
"integrity": "sha512-by1KMWxWlzq0iDV7tMkqS3thDRzYNQoS2ECfX5HRpMGaPQJqSgm5aY9IAky7knwAMoW3cMxQ/IhpvEShQqyj6A==",
"requires": {
"cosmokit": "^1.1.2",
"ns-require": "^1.1.2"
}
},
"minimatch": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
......@@ -12470,14 +12567,12 @@
"minimist": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
"devOptional": true
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
},
"mkdirp": {
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
"integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
"devOptional": true,
"requires": {
"minimist": "^1.2.5"
}
......@@ -12503,6 +12598,11 @@
"xtend": "^4.0.0"
}
},
"mustache": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/mustache/-/mustache-4.2.0.tgz",
"integrity": "sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ=="
},
"natural-compare": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
......@@ -12556,9 +12656,9 @@
}
},
"ns-require": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/ns-require/-/ns-require-1.1.0.tgz",
"integrity": "sha512-Iw349zwWNgkGZjYJtruf+BXUe8YHOiMZE0iUNffvpt/A1yTSabTnpBMQ0zNl65G1LhpzwCo1KMCqjmJF0z8O6g=="
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/ns-require/-/ns-require-1.1.2.tgz",
"integrity": "sha512-GUF6I1hWDsGx1cA9FW27KIRAlkMel2UZagR39dVNPAPBgwWK1Ez0XB96WEz2OFcwHsCORI9h75dEZueHqZ/1pA=="
},
"nwsapi": {
"version": "2.2.0",
......@@ -12791,6 +12891,26 @@
"find-up": "^4.0.0"
}
},
"portfinder": {
"version": "1.0.28",
"resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.28.tgz",
"integrity": "sha512-Se+2isanIcEqf2XMHjyUKskczxbPH7dQnlMjXX6+dybayyHvAf/TCgyMRlzf/B6QDhAEFOGes0pzRo3by4AbMA==",
"requires": {
"async": "^2.6.2",
"debug": "^3.1.1",
"mkdirp": "^0.5.5"
},
"dependencies": {
"debug": {
"version": "3.2.7",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
"requires": {
"ms": "^2.1.1"
}
}
}
},
"prelude-ls": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
......@@ -13035,11 +13155,11 @@
"dev": true
},
"reggol": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/reggol/-/reggol-1.0.1.tgz",
"integrity": "sha512-ZMOp3rZG6YQFVp/DC+BgFZaXSQcxHDayCmo7cL/kGujsSEoUzee0VJq1KCe9sgNt0qsM6JzkuSlj/+5SmmoO7Q==",
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/reggol/-/reggol-1.0.3.tgz",
"integrity": "sha512-91bFsIEaw3IKoMt7JQz703yuEgdcbbKBTJbeVyFMrZwA93wCU/ByDvhwDfvVWXjvLqwRuFOfhV1pkxvAgdkVZQ==",
"requires": {
"cosmokit": "^1.1.0",
"cosmokit": "^1.1.2",
"supports-color": "^8.1.1"
},
"dependencies": {
......@@ -13186,11 +13306,11 @@
}
},
"schemastery": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/schemastery/-/schemastery-3.3.2.tgz",
"integrity": "sha512-Z1C850OPtNEBs+D4QBPdC+Wu1t6Fn1BrOJILRHs2b+I/u61hUKP2vIPMAXFLvmmONnwqAW8ksPdCD6Zz9n8zhg==",
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/schemastery/-/schemastery-3.4.3.tgz",
"integrity": "sha512-Ui9sPoxOVaKa2EzR6GS08qB/nIMJUczUtkaLfWjeE44kjYZ+GLUFNVE3TpbXRdxjnbIIExwG+paMd0+M7YimqQ==",
"requires": {
"cosmokit": "^1.1.0"
"cosmokit": "^1.1.2"
}
},
"secure-json-parse": {
......@@ -13988,9 +14108,9 @@
}
},
"ws": {
"version": "8.5.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz",
"integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==",
"version": "8.6.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.6.0.tgz",
"integrity": "sha512-AzmM3aH3gk0aX7/rZLYvjdvZooofDu3fFOzGqcSnQ1tOcTWwhM/o+q++E8mAyVVIyUdajrkzWUGftaVSDLn1bw==",
"requires": {}
},
"xml-name-validator": {
......
......@@ -33,7 +33,7 @@
"peerDependencies": {
"@nestjs/common": "^8.2.6",
"@nestjs/core": "^8.2.6",
"koishi": "^4.6.0",
"koishi": "^4.7.1",
"reflect-metadata": "^0.1.13",
"rxjs": "^7.5.4"
},
......@@ -54,7 +54,7 @@
"eslint-plugin-prettier": "^3.4.1",
"express": "^4.17.1",
"jest": "^27.4.4",
"koishi": "4.6.0",
"koishi": "4.7.1",
"prettier": "^2.4.1",
"rimraf": "^3.0.2",
"supertest": "^6.1.6",
......@@ -64,13 +64,13 @@
"dependencies": {
"@nestjs/platform-ws": "^8.1.2",
"@nestjs/websockets": "^8.1.2",
"@types/ws": "^8.2.0",
"koa": "^2.13.3",
"@types/ws": "^8.5.3",
"koa": "^2.13.4",
"koa-bodyparser": "^4.3.0",
"koishi-decorators": "^2.0.0",
"koishi-decorators": "^2.1.0",
"lodash": "^4.17.21",
"typed-reflector": "^1.0.10",
"ws": "^8.2.3"
"ws": "^8.6.0"
},
"jest": {
"moduleFileExtensions": [
......
......@@ -9,7 +9,9 @@ describe('KoishiExceptionHandlerService', () => {
providers: [KoishiExceptionHandlerService],
}).compile();
service = module.get<KoishiExceptionHandlerService>(KoishiExceptionHandlerService);
service = module.get<KoishiExceptionHandlerService>(
KoishiExceptionHandlerService,
);
});
it('should be defined', () => {
......
import { App, Argv, Command, Context, Router } from 'koishi';
import { App, Command, Context, Plugin } from 'koishi';
import {
Inject,
Injectable,
OnApplicationBootstrap,
OnModuleDestroy,
OnModuleInit,
} from '@nestjs/common';
......@@ -20,16 +19,15 @@ import { KoishiHttpDiscoveryService } from './koishi-http-discovery/koishi-http-
import { Filter, ReplacedContext } from './utility/replaced-context';
import { applySelector } from 'koishi-decorators';
import WebSocket from 'ws';
// eslint-disable-next-line @typescript-eslint/no-empty-function
Router.prepare = () => {};
import { KoishiNestRouter } from './utility/koa-router';
import './utility/commander-with-interceptor';
@Injectable()
export class KoishiService
extends App
implements OnModuleInit, OnModuleDestroy
{
private readonly globalInterceptors: KoishiCommandInterceptorRegistration[];
private readonly _interceptors: KoishiCommandInterceptorRegistration[];
constructor(
@Inject(KOISHI_MODULE_OPTIONS)
private readonly koishiModuleOptions: KoishiModuleOptions,
......@@ -42,8 +40,8 @@ export class KoishiService
port: 0,
});
this.baseDir ??= process.cwd();
this.globalInterceptors = this.koishiModuleOptions.globalInterceptors || [];
this.router = new Router();
this._interceptors = this.koishiModuleOptions.globalInterceptors || [];
this.router = new KoishiNestRouter();
this._nestKoaTmpInstance.use((ctx, next) => {
ctx.request.ip = ctx.req[KoishiIpSym];
return next();
......@@ -103,58 +101,20 @@ export class KoishiService
private cloneContext(
filter: Filter,
interceptors: KoishiCommandInterceptorRegistration[] = [],
plugin: Plugin,
interceptors: KoishiCommandInterceptorRegistration[],
): Context {
return new ReplacedContext(filter, this, null, [
...this.globalInterceptors,
...interceptors,
]);
return new ReplacedContext(filter, this, plugin, interceptors);
}
withInterceptors(interceptors: KoishiCommandInterceptorRegistration[]) {
return this.cloneContext(() => true, interceptors);
}
override any() {
return this.cloneContext(() => true);
}
override never() {
return this.cloneContext(() => false);
}
override union(arg: Filter | Context) {
const filter = typeof arg === 'function' ? arg : arg.filter;
return this.cloneContext((s) => this.filter(s) || filter(s));
}
override intersect(arg: Filter | Context) {
const filter = typeof arg === 'function' ? arg : arg.filter;
return this.cloneContext((s) => this.filter(s) && filter(s));
}
override except(arg: Filter | Context) {
const filter = typeof arg === 'function' ? arg : arg.filter;
return this.cloneContext((s) => this.filter(s) && !filter(s));
return this.cloneContext(this.filter, this.plugin, [
...this._interceptors,
...interceptors,
]);
}
override command<D extends string>(
def: D,
config?: Command.Config,
): Command<never, never, Argv.ArgumentType<D>>;
override command<D extends string>(
def: D,
desc: string,
config?: Command.Config,
): Command<never, never, Argv.ArgumentType<D>>;
override command(
def: string,
...args: [Command.Config?] | [string, Command.Config?]
) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const cmd = super.command(def, ...args);
this.addInterceptors(cmd, this.globalInterceptors);
return cmd;
override fork(filter: Filter, _plugin: Plugin) {
return this.cloneContext(filter, _plugin, this._interceptors);
}
}
......@@ -80,7 +80,7 @@ export class KoishiMetascanService {
ctx: Context,
instance: any,
property: string,
name: keyof Context.Services,
name: keyof Context,
) {
Object.defineProperty(instance, property, {
enumerable: true,
......@@ -89,6 +89,8 @@ export class KoishiMetascanService {
return ctx[name];
},
set(val: any) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
ctx[name] = val;
},
});
......@@ -114,7 +116,7 @@ export class KoishiMetascanService {
return;
}
for (const property of properties) {
const serviceName: keyof Context.Services = Reflect.getMetadata(
const serviceName: keyof Context = Reflect.getMetadata(
KoishiServiceWireProperty,
instanceClass,
property,
......
import { Command, Commander } from 'koishi';
import { ReplacedContext } from './replaced-context';
import { KoishiService } from '../koishi.service';
const oldCommand = Commander.prototype.command;
Commander.prototype.command = function (this: Commander, ...args: any[]) {
const command: Command = oldCommand.call(this, ...args);
const ctx = this.caller;
const interceptors = (ctx as ReplacedContext)._interceptors;
if (interceptors?.length) {
(ctx.app as KoishiService).addInterceptors(command, interceptors);
}
return command;
};
import KoaRouter from '@koa/router';
import { Context, MaybeArray, remove, WebSocketLayer } from 'koishi';
import { IncomingMessage } from 'http';
import WebSocket from 'ws';
export class KoishiNestRouter extends KoaRouter {
wsStack: WebSocketLayer[] = [];
/**
* hack into router methods to make sure that koa middlewares are disposable
*/
override register(...args: Parameters<KoaRouter['register']>) {
const layer = super.register(...args);
const context: Context = this[Context.current];
context?.state.disposables.push(() => {
remove(this.stack, layer);
});
return layer;
}
ws(
path: MaybeArray<string | RegExp>,
callback?: (socket: WebSocket, request: IncomingMessage) => void,
) {
const layer = new WebSocketLayer(this, path, callback);
this.wsStack.push(layer);
const context: Context = this[Context.current];
context?.state.disposables.push(() => layer.close());
return layer;
}
}
......@@ -15,7 +15,7 @@ export const KoishiServiceProvideSym = 'KoishiServiceProvideSym';
// metadata map
export interface MetadataArrayMap {
KoishiServiceProvideSym: keyof Context.Services;
KoishiServiceProvideSym: keyof Context;
KoishiCommandInterceptorDef: KoishiCommandInterceptorRegistration;
}
......
......@@ -98,9 +98,7 @@ export { PluginDef } from 'koishi-decorators';
// Service
export function WireContextService(
name?: keyof Context.Services,
): PropertyDecorator {
export function WireContextService(name?: keyof Context): PropertyDecorator {
return (obj, key) => {
const objClass = obj.constructor;
const properties: string[] =
......@@ -116,9 +114,7 @@ export function WireContextService(
};
}
export function ProvideContextService(
name: keyof Context.Services,
): ClassDecorator {
export function ProvideContextService(name: keyof Context): ClassDecorator {
Context.service(name);
return AppendMetadata(KoishiServiceProvideSym, name);
}
......
......@@ -2,6 +2,7 @@ import { ModuleMetadata, Provider, Type } from '@nestjs/common';
import { App, Channel, Command, User } from 'koishi';
import { MetadataArrayMap, MetadataMap } from './koishi.constants';
import { ContextSelector, PluginDefinition } from 'koishi-decorators';
export * from 'koishi-decorators/dist/src/def/interfaces';
export interface KoishiModuleSelection extends ContextSelector {
......
import { Argv, Command, Context, Plugin, Session } from 'koishi';
import { Context, Plugin, Session } from 'koishi';
import { KoishiService } from '../koishi.service';
import { KoishiCommandInterceptorRegistration } from './koishi.interfaces';
......@@ -16,58 +16,20 @@ export class ReplacedContext extends Context {
private cloneContext(
filter: Filter,
interceptors: KoishiCommandInterceptorRegistration[] = [],
plugin: Plugin,
interceptors: KoishiCommandInterceptorRegistration[],
): Context {
return new ReplacedContext(filter, this._app, this.__plugin, [
...this._interceptors,
...interceptors,
]);
return new ReplacedContext(filter, this._app, plugin, interceptors);
}
withInterceptors(interceptors: KoishiCommandInterceptorRegistration[]) {
return this.cloneContext(this.filter, interceptors);
}
override any() {
return this.cloneContext(() => true);
}
override never() {
return this.cloneContext(() => false);
}
override union(arg: Filter | Context) {
const filter = typeof arg === 'function' ? arg : arg.filter;
return this.cloneContext((s) => this.filter(s) || filter(s));
}
override intersect(arg: Filter | Context) {
const filter = typeof arg === 'function' ? arg : arg.filter;
return this.cloneContext((s) => this.filter(s) && filter(s));
}
override except(arg: Filter | Context) {
const filter = typeof arg === 'function' ? arg : arg.filter;
return this.cloneContext((s) => this.filter(s) && !filter(s));
return this.cloneContext(this.filter, this.plugin, [
...this._interceptors,
...interceptors,
]);
}
override command<D extends string>(
def: D,
config?: Command.Config,
): Command<never, never, Argv.ArgumentType<D>>;
override command<D extends string>(
def: D,
desc: string,
config?: Command.Config,
): Command<never, never, Argv.ArgumentType<D>>;
override command(
def: string,
...args: [Command.Config?] | [string, Command.Config?]
) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const cmd = super.command(def, ...args);
this._app.addInterceptors(cmd, this._interceptors);
return cmd;
override fork(filter: Filter, _plugin: Plugin) {
return this.cloneContext(filter, _plugin, this._interceptors);
}
}
......@@ -6,7 +6,6 @@ import { KoishiService } from '../src/koishi.service';
import { testingModule } from './utility/testing-module';
import { KoishiWsAdapter } from '../src/koishi.ws-adapter';
import http from 'http';
import request from 'supertest';
describe('Koishi module in Fastify adapter', () => {
let app: NestFastifyApplication;
......
......@@ -79,7 +79,7 @@ describe('Koishi in Nest.js', () => {
platform: 'telegram',
} as Session;
const methodCtx = command.context;
const methodCtx = command.ctx;
expect(methodCtx.filter(correctSession)).toBe(true);
expect(methodCtx.filter(wrongSession1)).toBe(false);
expect(methodCtx.filter(wrongSession2)).toBe(false);
......
import { Injectable, NotFoundException } from '@nestjs/common';
import { KoishiCommandInterceptor } from '../../src/utility/koishi.interfaces';
import { Argv, Context } from 'koishi';
import { Argv } from 'koishi';
import {
CommandUsage,
OnGuild,
OnPlatform,
PluginDef,
PutOption,
UseCommand,
} from 'koishi-decorators';
......
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