Commit f4c422c6 authored by nanahira's avatar nanahira

bump an add http things

parent 6ed2bf93
......@@ -9,15 +9,18 @@
"version": "1.0.1",
"license": "MIT",
"dependencies": {
"cordis-decorators": "^1.0.7",
"cordis-decorators": "^1.0.8",
"lodash": "^4.17.21"
},
"devDependencies": {
"@types/jest": "^28.1.6",
"@types/koa": "^2.13.5",
"@types/koa__router": "^8.0.11",
"@types/lodash": "^4.14.182",
"@types/node": "^18.0.6",
"@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "^4.33.0",
"cordis": "^2.0.6",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^3.4.1",
......@@ -1184,7 +1187,6 @@
"version": "1.3.5",
"resolved": "https://registry.npmjs.org/@types/accepts/-/accepts-1.3.5.tgz",
"integrity": "sha512-jOdnI/3qTpHABjM5cx1Hc0sKsPoYCp+DP/GJRGtDlPd7fiV9oXGGIcjW/ZOxLIvjGz8MA+uMZI9metHlgqbgwQ==",
"peer": true,
"dependencies": {
"@types/node": "*"
}
......@@ -1234,7 +1236,6 @@
"version": "1.19.2",
"resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.2.tgz",
"integrity": "sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==",
"peer": true,
"dependencies": {
"@types/connect": "*",
"@types/node": "*"
......@@ -1244,7 +1245,6 @@
"version": "3.4.35",
"resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz",
"integrity": "sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==",
"peer": true,
"dependencies": {
"@types/node": "*"
}
......@@ -1252,14 +1252,12 @@
"node_modules/@types/content-disposition": {
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/@types/content-disposition/-/content-disposition-0.5.5.tgz",
"integrity": "sha512-v6LCdKfK6BwcqMo+wYW05rLS12S0ZO0Fl4w1h4aaZMD7bqT3gVUns6FvLJKGZHQmYn3SX55JWGpziwJRwVgutA==",
"peer": true
"integrity": "sha512-v6LCdKfK6BwcqMo+wYW05rLS12S0ZO0Fl4w1h4aaZMD7bqT3gVUns6FvLJKGZHQmYn3SX55JWGpziwJRwVgutA=="
},
"node_modules/@types/cookies": {
"version": "0.7.7",
"resolved": "https://registry.npmjs.org/@types/cookies/-/cookies-0.7.7.tgz",
"integrity": "sha512-h7BcvPUogWbKCzBR2lY4oqaZbO3jXZksexYJVFvkrFeLgbZjQkU4x8pRq6eg2MHXQhY0McQdqmmsxRWlVAHooA==",
"peer": true,
"dependencies": {
"@types/connect": "*",
"@types/express": "*",
......@@ -1271,7 +1269,6 @@
"version": "4.17.13",
"resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.13.tgz",
"integrity": "sha512-6bSZTPaTIACxn48l50SR+axgrqm6qXFIxrdAKaG6PaJk3+zuUr35hBlgT7vOmJcum+OEaIBLtHV/qloEAFITeA==",
"peer": true,
"dependencies": {
"@types/body-parser": "*",
"@types/express-serve-static-core": "^4.17.18",
......@@ -1283,7 +1280,6 @@
"version": "4.17.29",
"resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.29.tgz",
"integrity": "sha512-uMd++6dMKS32EOuw1Uli3e3BPgdLIXmezcfHv7N4c1s3gkhikBplORPpMq3fuWkxncZN1reb16d5n8yhQ80x7Q==",
"peer": true,
"dependencies": {
"@types/node": "*",
"@types/qs": "*",
......@@ -1302,14 +1298,12 @@
"node_modules/@types/http-assert": {
"version": "1.5.3",
"resolved": "https://registry.npmjs.org/@types/http-assert/-/http-assert-1.5.3.tgz",
"integrity": "sha512-FyAOrDuQmBi8/or3ns4rwPno7/9tJTijVW6aQQjK02+kOQ8zmoNg2XJtAuQhvQcy1ASJq38wirX5//9J1EqoUA==",
"peer": true
"integrity": "sha512-FyAOrDuQmBi8/or3ns4rwPno7/9tJTijVW6aQQjK02+kOQ8zmoNg2XJtAuQhvQcy1ASJq38wirX5//9J1EqoUA=="
},
"node_modules/@types/http-errors": {
"version": "1.8.2",
"resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-1.8.2.tgz",
"integrity": "sha512-EqX+YQxINb+MeXaIqYDASb6U6FCHbWjkj4a1CKDBks3d/QiB2+PqBLyO72vLDgAO1wUI4O+9gweRcQK11bTL/w==",
"peer": true
"integrity": "sha512-EqX+YQxINb+MeXaIqYDASb6U6FCHbWjkj4a1CKDBks3d/QiB2+PqBLyO72vLDgAO1wUI4O+9gweRcQK11bTL/w=="
},
"node_modules/@types/istanbul-lib-coverage": {
"version": "2.0.4",
......@@ -1354,14 +1348,12 @@
"node_modules/@types/keygrip": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@types/keygrip/-/keygrip-1.0.2.tgz",
"integrity": "sha512-GJhpTepz2udxGexqos8wgaBx4I/zWIDPh/KOGEwAqtuGDkOUJu5eFvwmdBX4AmB8Odsr+9pHCQqiAqDL/yKMKw==",
"peer": true
"integrity": "sha512-GJhpTepz2udxGexqos8wgaBx4I/zWIDPh/KOGEwAqtuGDkOUJu5eFvwmdBX4AmB8Odsr+9pHCQqiAqDL/yKMKw=="
},
"node_modules/@types/koa": {
"version": "2.13.5",
"resolved": "https://registry.npmjs.org/@types/koa/-/koa-2.13.5.tgz",
"integrity": "sha512-HSUOdzKz3by4fnqagwthW/1w/yJspTgppyyalPVbgZf8jQWvdIXcVW5h2DGtw4zYntOaeRGx49r1hxoPWrD4aA==",
"peer": true,
"dependencies": {
"@types/accepts": "*",
"@types/content-disposition": "*",
......@@ -1377,7 +1369,6 @@
"version": "8.0.11",
"resolved": "https://registry.npmjs.org/@types/koa__router/-/koa__router-8.0.11.tgz",
"integrity": "sha512-WXgKWpBsbS14kzmzD9LeFapOIa678h7zvUHxDwXwSx4ETKXhXLVUAToX6jZ/U7EihM7qwyD9W/BZvB0MRu7MTQ==",
"peer": true,
"dependencies": {
"@types/koa": "*"
}
......@@ -1386,7 +1377,6 @@
"version": "3.2.5",
"resolved": "https://registry.npmjs.org/@types/koa-compose/-/koa-compose-3.2.5.tgz",
"integrity": "sha512-B8nG/OoE1ORZqCkBVsup/AKcvjdgoHnfi4pZMn5UwAPCbhk/96xyv284eBYW8JlQbQ7zDmnpFr68I/40mFoIBQ==",
"peer": true,
"dependencies": {
"@types/koa": "*"
}
......@@ -1400,8 +1390,7 @@
"node_modules/@types/mime": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.2.tgz",
"integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw==",
"peer": true
"integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw=="
},
"node_modules/@types/node": {
"version": "18.0.6",
......@@ -1417,20 +1406,17 @@
"node_modules/@types/qs": {
"version": "6.9.7",
"resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz",
"integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==",
"peer": true
"integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw=="
},
"node_modules/@types/range-parser": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.4.tgz",
"integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==",
"peer": true
"integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw=="
},
"node_modules/@types/serve-static": {
"version": "1.13.10",
"resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.13.10.tgz",
"integrity": "sha512-nCkHGI4w7ZgAdNkrEu0bv+4xNV/XDqW+DydknebMOQwkpDGx8G+HTlj7R7ABI8i8nKxVw0wtKPi1D+lPOkh4YQ==",
"peer": true,
"dependencies": {
"@types/mime": "^1",
"@types/node": "*"
......@@ -2254,15 +2240,14 @@
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/cordis/-/cordis-2.0.6.tgz",
"integrity": "sha512-Q85Y2iY3myX340TiUV97DtTuPTls/pZoYqP2eWHlkLYcIzs7cIBTX3C8FqxaZ2hRgOJ6kMcXSXSIPWsZGcyCHQ==",
"peer": true,
"dependencies": {
"cosmokit": "^1.2.1"
}
},
"node_modules/cordis-decorators": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/cordis-decorators/-/cordis-decorators-1.0.7.tgz",
"integrity": "sha512-8EWWWhMbNNLajrKlQN7qr6gtMRU56bXott3Ee0Bve0yumvx/a/1m7sMxh+isZR76SvOEB60eCVxPn3uNYV0ycQ==",
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/cordis-decorators/-/cordis-decorators-1.0.8.tgz",
"integrity": "sha512-VeNNr+1PlUKet3zZajK22tcuPJ56GY7dXfaHahH3XaxblDSr/nIoDbOzhaZYJZbjDs21EjgPWYzFWLv3zajYRQ==",
"dependencies": {
"lodash": "^4.17.21",
"mustache": "^4.2.0",
......@@ -2285,8 +2270,7 @@
"node_modules/cosmokit": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/cosmokit/-/cosmokit-1.2.1.tgz",
"integrity": "sha512-BTn7vRr31WUwX7Tq8Q/r+Qz+LPKTE3vA0d7xzVaYNes2NPvGPmIWiljYP0m/PIrdpqLLtdHpY1zGNr+OwDhA7A==",
"peer": true
"integrity": "sha512-BTn7vRr31WUwX7Tq8Q/r+Qz+LPKTE3vA0d7xzVaYNes2NPvGPmIWiljYP0m/PIrdpqLLtdHpY1zGNr+OwDhA7A=="
},
"node_modules/cross-spawn": {
"version": "7.0.3",
......@@ -7154,7 +7138,6 @@
"version": "1.3.5",
"resolved": "https://registry.npmjs.org/@types/accepts/-/accepts-1.3.5.tgz",
"integrity": "sha512-jOdnI/3qTpHABjM5cx1Hc0sKsPoYCp+DP/GJRGtDlPd7fiV9oXGGIcjW/ZOxLIvjGz8MA+uMZI9metHlgqbgwQ==",
"peer": true,
"requires": {
"@types/node": "*"
}
......@@ -7204,7 +7187,6 @@
"version": "1.19.2",
"resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.2.tgz",
"integrity": "sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==",
"peer": true,
"requires": {
"@types/connect": "*",
"@types/node": "*"
......@@ -7214,7 +7196,6 @@
"version": "3.4.35",
"resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz",
"integrity": "sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==",
"peer": true,
"requires": {
"@types/node": "*"
}
......@@ -7222,14 +7203,12 @@
"@types/content-disposition": {
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/@types/content-disposition/-/content-disposition-0.5.5.tgz",
"integrity": "sha512-v6LCdKfK6BwcqMo+wYW05rLS12S0ZO0Fl4w1h4aaZMD7bqT3gVUns6FvLJKGZHQmYn3SX55JWGpziwJRwVgutA==",
"peer": true
"integrity": "sha512-v6LCdKfK6BwcqMo+wYW05rLS12S0ZO0Fl4w1h4aaZMD7bqT3gVUns6FvLJKGZHQmYn3SX55JWGpziwJRwVgutA=="
},
"@types/cookies": {
"version": "0.7.7",
"resolved": "https://registry.npmjs.org/@types/cookies/-/cookies-0.7.7.tgz",
"integrity": "sha512-h7BcvPUogWbKCzBR2lY4oqaZbO3jXZksexYJVFvkrFeLgbZjQkU4x8pRq6eg2MHXQhY0McQdqmmsxRWlVAHooA==",
"peer": true,
"requires": {
"@types/connect": "*",
"@types/express": "*",
......@@ -7241,7 +7220,6 @@
"version": "4.17.13",
"resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.13.tgz",
"integrity": "sha512-6bSZTPaTIACxn48l50SR+axgrqm6qXFIxrdAKaG6PaJk3+zuUr35hBlgT7vOmJcum+OEaIBLtHV/qloEAFITeA==",
"peer": true,
"requires": {
"@types/body-parser": "*",
"@types/express-serve-static-core": "^4.17.18",
......@@ -7253,7 +7231,6 @@
"version": "4.17.29",
"resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.29.tgz",
"integrity": "sha512-uMd++6dMKS32EOuw1Uli3e3BPgdLIXmezcfHv7N4c1s3gkhikBplORPpMq3fuWkxncZN1reb16d5n8yhQ80x7Q==",
"peer": true,
"requires": {
"@types/node": "*",
"@types/qs": "*",
......@@ -7272,14 +7249,12 @@
"@types/http-assert": {
"version": "1.5.3",
"resolved": "https://registry.npmjs.org/@types/http-assert/-/http-assert-1.5.3.tgz",
"integrity": "sha512-FyAOrDuQmBi8/or3ns4rwPno7/9tJTijVW6aQQjK02+kOQ8zmoNg2XJtAuQhvQcy1ASJq38wirX5//9J1EqoUA==",
"peer": true
"integrity": "sha512-FyAOrDuQmBi8/or3ns4rwPno7/9tJTijVW6aQQjK02+kOQ8zmoNg2XJtAuQhvQcy1ASJq38wirX5//9J1EqoUA=="
},
"@types/http-errors": {
"version": "1.8.2",
"resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-1.8.2.tgz",
"integrity": "sha512-EqX+YQxINb+MeXaIqYDASb6U6FCHbWjkj4a1CKDBks3d/QiB2+PqBLyO72vLDgAO1wUI4O+9gweRcQK11bTL/w==",
"peer": true
"integrity": "sha512-EqX+YQxINb+MeXaIqYDASb6U6FCHbWjkj4a1CKDBks3d/QiB2+PqBLyO72vLDgAO1wUI4O+9gweRcQK11bTL/w=="
},
"@types/istanbul-lib-coverage": {
"version": "2.0.4",
......@@ -7324,14 +7299,12 @@
"@types/keygrip": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@types/keygrip/-/keygrip-1.0.2.tgz",
"integrity": "sha512-GJhpTepz2udxGexqos8wgaBx4I/zWIDPh/KOGEwAqtuGDkOUJu5eFvwmdBX4AmB8Odsr+9pHCQqiAqDL/yKMKw==",
"peer": true
"integrity": "sha512-GJhpTepz2udxGexqos8wgaBx4I/zWIDPh/KOGEwAqtuGDkOUJu5eFvwmdBX4AmB8Odsr+9pHCQqiAqDL/yKMKw=="
},
"@types/koa": {
"version": "2.13.5",
"resolved": "https://registry.npmjs.org/@types/koa/-/koa-2.13.5.tgz",
"integrity": "sha512-HSUOdzKz3by4fnqagwthW/1w/yJspTgppyyalPVbgZf8jQWvdIXcVW5h2DGtw4zYntOaeRGx49r1hxoPWrD4aA==",
"peer": true,
"requires": {
"@types/accepts": "*",
"@types/content-disposition": "*",
......@@ -7347,7 +7320,6 @@
"version": "8.0.11",
"resolved": "https://registry.npmjs.org/@types/koa__router/-/koa__router-8.0.11.tgz",
"integrity": "sha512-WXgKWpBsbS14kzmzD9LeFapOIa678h7zvUHxDwXwSx4ETKXhXLVUAToX6jZ/U7EihM7qwyD9W/BZvB0MRu7MTQ==",
"peer": true,
"requires": {
"@types/koa": "*"
}
......@@ -7356,7 +7328,6 @@
"version": "3.2.5",
"resolved": "https://registry.npmjs.org/@types/koa-compose/-/koa-compose-3.2.5.tgz",
"integrity": "sha512-B8nG/OoE1ORZqCkBVsup/AKcvjdgoHnfi4pZMn5UwAPCbhk/96xyv284eBYW8JlQbQ7zDmnpFr68I/40mFoIBQ==",
"peer": true,
"requires": {
"@types/koa": "*"
}
......@@ -7370,8 +7341,7 @@
"@types/mime": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.2.tgz",
"integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw==",
"peer": true
"integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw=="
},
"@types/node": {
"version": "18.0.6",
......@@ -7387,20 +7357,17 @@
"@types/qs": {
"version": "6.9.7",
"resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz",
"integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==",
"peer": true
"integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw=="
},
"@types/range-parser": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.4.tgz",
"integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==",
"peer": true
"integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw=="
},
"@types/serve-static": {
"version": "1.13.10",
"resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.13.10.tgz",
"integrity": "sha512-nCkHGI4w7ZgAdNkrEu0bv+4xNV/XDqW+DydknebMOQwkpDGx8G+HTlj7R7ABI8i8nKxVw0wtKPi1D+lPOkh4YQ==",
"peer": true,
"requires": {
"@types/mime": "^1",
"@types/node": "*"
......@@ -7991,15 +7958,14 @@
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/cordis/-/cordis-2.0.6.tgz",
"integrity": "sha512-Q85Y2iY3myX340TiUV97DtTuPTls/pZoYqP2eWHlkLYcIzs7cIBTX3C8FqxaZ2hRgOJ6kMcXSXSIPWsZGcyCHQ==",
"peer": true,
"requires": {
"cosmokit": "^1.2.1"
}
},
"cordis-decorators": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/cordis-decorators/-/cordis-decorators-1.0.7.tgz",
"integrity": "sha512-8EWWWhMbNNLajrKlQN7qr6gtMRU56bXott3Ee0Bve0yumvx/a/1m7sMxh+isZR76SvOEB60eCVxPn3uNYV0ycQ==",
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/cordis-decorators/-/cordis-decorators-1.0.8.tgz",
"integrity": "sha512-VeNNr+1PlUKet3zZajK22tcuPJ56GY7dXfaHahH3XaxblDSr/nIoDbOzhaZYJZbjDs21EjgPWYzFWLv3zajYRQ==",
"requires": {
"lodash": "^4.17.21",
"mustache": "^4.2.0",
......@@ -8018,8 +7984,7 @@
"cosmokit": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/cosmokit/-/cosmokit-1.2.1.tgz",
"integrity": "sha512-BTn7vRr31WUwX7Tq8Q/r+Qz+LPKTE3vA0d7xzVaYNes2NPvGPmIWiljYP0m/PIrdpqLLtdHpY1zGNr+OwDhA7A==",
"peer": true
"integrity": "sha512-BTn7vRr31WUwX7Tq8Q/r+Qz+LPKTE3vA0d7xzVaYNes2NPvGPmIWiljYP0m/PIrdpqLLtdHpY1zGNr+OwDhA7A=="
},
"cross-spawn": {
"version": "7.0.3",
......
import { defaultRegistrarS } from './registrar';
import { defaultRegistrarS } from '../registrar';
export const {
OnAnywhere,
......
import { defaultRegistrarS } from '../registrar';
import {
DefaultContext,
DefaultState,
ParameterizedContext,
Next as KoaNext,
} from 'koa';
import { RouterParamContext } from '@koa/router';
export type KoaContext = ParameterizedContext<
DefaultState,
DefaultContext & RouterParamContext<DefaultState, DefaultContext>,
any
>;
const RouterMethod = defaultRegistrarS.decorateMethod(
'route',
(
ctx,
fun: (ctx: KoaContext, Next: KoaNext) => Promise<any>,
method:
| 'get'
| 'post'
| 'put'
| 'delete'
| 'patch'
| 'options'
| 'head'
| 'all',
path: string,
) => {
const _path = path.startsWith('/') ? path : `/${path}`;
return ctx.router[method](_path, (koaCtx, next) => fun(koaCtx, next));
},
);
export const Get = (path: string) => RouterMethod('get', path);
export const Post = (path: string) => RouterMethod('post', path);
export const Put = (path: string) => RouterMethod('put', path);
export const Delete = (path: string) => RouterMethod('delete', path);
export const Patch = (path: string) => RouterMethod('patch', path);
export const Options = (path: string) => RouterMethod('options', path);
export const Head = (path: string) => RouterMethod('head', path);
export const All = (path: string) => RouterMethod('all', path);
export * from './common';
export * from './http';
......@@ -3,24 +3,37 @@ import { Registrar } from 'cordis-decorators';
import { selectContext, Selection } from './utility/select-context';
export class SatoriRegistrar<Ctx extends Context> extends Registrar<Ctx> {
methodDecorators() {
return {
...super.methodDecorators(),
};
}
selectorDecorators() {
return {
OnAnywhere: () => this.decorateTransformer((ctx, r) => ctx.any()),
OnNowhere: () => this.decorateTransformer((ctx, r) => ctx.never()),
OnUser: (...values: string[]) =>
this.decorateTransformer((ctx, r) => ctx.user(...r(values))),
OnSelf: (...values: string[]) =>
this.decorateTransformer((ctx, r) => ctx.self(...r(values))),
OnGuild: (...values: string[]) =>
this.decorateTransformer((ctx, r) => ctx.guild(...r(values))),
OnChannel: (...values: string[]) =>
this.decorateTransformer((ctx, r) => ctx.channel(...r(values))),
OnPlatform: (...values: string[]) =>
this.decorateTransformer((ctx, r) => ctx.platform(...r(values))),
OnPrivate: (...values: string[]) =>
this.decorateTransformer((ctx, r) => ctx.private(...r(values))),
OnSelection: (selection: Selection) =>
this.decorateTransformer((ctx, r) => selectContext(ctx, r(selection))),
OnAnywhere: this.decorateTransformer((ctx) => ctx.any()),
OnNowhere: this.decorateTransformer((ctx) => ctx.never()),
OnUser: this.decorateTransformer((ctx, ...values: string[]) =>
ctx.user(...values),
),
OnSelf: this.decorateTransformer((ctx, ...values: string[]) =>
ctx.self(...values),
),
OnGuild: this.decorateTransformer((ctx, ...values: string[]) =>
ctx.guild(...values),
),
OnChannel: this.decorateTransformer((ctx, ...values: string[]) =>
ctx.channel(...values),
),
OnPlatform: this.decorateTransformer((ctx, ...values: string[]) =>
ctx.platform(...values),
),
OnPrivate: this.decorateTransformer((ctx, ...values: string[]) =>
ctx.private(...values),
),
OnSelection: this.decorateTransformer((ctx, selection: Selection) =>
selectContext(ctx, selection),
),
};
}
......
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