diff --git a/.gitignore b/.gitignore index 8f4d2f7..3b97d9c 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,6 @@ dist .turbo https-cert.pem -https-key.pem \ No newline at end of file +https-key.pem + +.pnpm-store \ No newline at end of file diff --git a/package.json b/package.json index 364123a..e330d05 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/package", "name": "@kevisual/router", - "version": "0.0.53", + "version": "0.0.54", "description": "", "type": "module", "main": "./dist/router.js", @@ -29,8 +29,8 @@ "@rollup/plugin-commonjs": "29.0.0", "@rollup/plugin-node-resolve": "^16.0.3", "@rollup/plugin-typescript": "^12.3.0", - "@types/bun": "^1.3.5", - "@types/node": "^25.0.7", + "@types/bun": "^1.3.6", + "@types/node": "^25.0.8", "@types/send": "^1.2.1", "@types/ws": "^8.18.1", "@types/xml2js": "^0.4.14", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ba2e694..0a4abf6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -7,20 +7,10 @@ settings: importers: .: - dependencies: + devDependencies: '@kevisual/js-filter': specifier: ^0.0.4 version: 0.0.4 - path-to-regexp: - specifier: ^8.3.0 - version: 8.3.0 - selfsigned: - specifier: ^5.5.0 - version: 5.5.0 - send: - specifier: ^1.2.1 - version: 1.2.1 - devDependencies: '@kevisual/local-proxy': specifier: ^0.0.8 version: 0.0.8 @@ -40,11 +30,11 @@ importers: specifier: ^12.3.0 version: 12.3.0(rollup@4.55.1)(tslib@2.8.1)(typescript@5.9.3) '@types/bun': - specifier: ^1.3.5 - version: 1.3.5 + specifier: ^1.3.6 + version: 1.3.6 '@types/node': - specifier: ^25.0.7 - version: 25.0.7 + specifier: ^25.0.8 + version: 25.0.8 '@types/send': specifier: ^1.2.1 version: 1.2.1 @@ -60,18 +50,24 @@ importers: nanoid: specifier: ^5.1.6 version: 5.1.6 + path-to-regexp: + specifier: ^8.3.0 + version: 8.3.0 rollup: specifier: ^4.55.1 version: 4.55.1 rollup-plugin-dts: specifier: ^6.3.0 version: 6.3.0(rollup@4.55.1)(typescript@5.9.3) + send: + specifier: ^1.2.1 + version: 1.2.1 ts-loader: specifier: ^9.5.4 version: 9.5.4(typescript@5.9.3)(webpack@5.104.1) ts-node: specifier: ^10.9.2 - version: 10.9.2(@types/node@25.0.7)(typescript@5.9.3) + version: 10.9.2(@types/node@25.0.8)(typescript@5.9.3) tslib: specifier: ^2.8.1 version: 2.8.1 @@ -102,7 +98,7 @@ importers: version: 1.1.1 ts-node: specifier: ^10.9.2 - version: 10.9.2(@types/node@25.0.7)(typescript@5.9.3) + version: 10.9.2(@types/node@25.0.8)(typescript@5.9.3) typescript: specifier: ^5.5.4 version: 5.9.3 @@ -309,44 +305,6 @@ packages: resolution: {integrity: sha512-jlFxSlXUEz93cFW+UYT5BXv/rFVgiMQnIfqRYZ0gj1hSP8PMGRqMqUoHSLfKvfRRS4jseLSvTTeEKSQpZJtURg==} engines: {node: '>=10.0.0'} - '@noble/hashes@1.4.0': - resolution: {integrity: sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==} - engines: {node: '>= 16'} - - '@peculiar/asn1-cms@2.6.0': - resolution: {integrity: sha512-2uZqP+ggSncESeUF/9Su8rWqGclEfEiz1SyU02WX5fUONFfkjzS2Z/F1Li0ofSmf4JqYXIOdCAZqIXAIBAT1OA==} - - '@peculiar/asn1-csr@2.6.0': - resolution: {integrity: sha512-BeWIu5VpTIhfRysfEp73SGbwjjoLL/JWXhJ/9mo4vXnz3tRGm+NGm3KNcRzQ9VMVqwYS2RHlolz21svzRXIHPQ==} - - '@peculiar/asn1-ecc@2.6.0': - resolution: {integrity: sha512-FF3LMGq6SfAOwUG2sKpPXblibn6XnEIKa+SryvUl5Pik+WR9rmRA3OCiwz8R3lVXnYnyRkSZsSLdml8H3UiOcw==} - - '@peculiar/asn1-pfx@2.6.0': - resolution: {integrity: sha512-rtUvtf+tyKGgokHHmZzeUojRZJYPxoD/jaN1+VAB4kKR7tXrnDCA/RAWXAIhMJJC+7W27IIRGe9djvxKgsldCQ==} - - '@peculiar/asn1-pkcs8@2.6.0': - resolution: {integrity: sha512-KyQ4D8G/NrS7Fw3XCJrngxmjwO/3htnA0lL9gDICvEQ+GJ+EPFqldcJQTwPIdvx98Tua+WjkdKHSC0/Km7T+lA==} - - '@peculiar/asn1-pkcs9@2.6.0': - resolution: {integrity: sha512-b78OQ6OciW0aqZxdzliXGYHASeCvvw5caqidbpQRYW2mBtXIX2WhofNXTEe7NyxTb0P6J62kAAWLwn0HuMF1Fw==} - - '@peculiar/asn1-rsa@2.6.0': - resolution: {integrity: sha512-Nu4C19tsrTsCp9fDrH+sdcOKoVfdfoQQ7S3VqjJU6vedR7tY3RLkQ5oguOIB3zFW33USDUuYZnPEQYySlgha4w==} - - '@peculiar/asn1-schema@2.6.0': - resolution: {integrity: sha512-xNLYLBFTBKkCzEZIw842BxytQQATQv+lDTCEMZ8C196iJcJJMBUZxrhSTxLaohMyKK8QlzRNTRkUmanucnDSqg==} - - '@peculiar/asn1-x509-attr@2.6.0': - resolution: {integrity: sha512-MuIAXFX3/dc8gmoZBkwJWxUWOSvG4MMDntXhrOZpJVMkYX+MYc/rUAU2uJOved9iJEoiUx7//3D8oG83a78UJA==} - - '@peculiar/asn1-x509@2.6.0': - resolution: {integrity: sha512-uzYbPEpoQiBoTq0/+jZtpM6Gq6zADBx+JNFP3yqRgziWBxQ/Dt/HcuvRfm9zJTPdRcBqPNdaRHTVwpyiq6iNMA==} - - '@peculiar/x509@1.14.2': - resolution: {integrity: sha512-r2w1Hg6pODDs0zfAKHkSS5HLkOLSeburtcgwvlLLWWCixw+MmW3U6kD5ddyvc2Y2YdbGuVwCF2S2ASoU1cFAag==} - engines: {node: '>=22.0.0'} - '@rollup/plugin-alias@6.0.0': resolution: {integrity: sha512-tPCzJOtS7uuVZd+xPhoy5W4vThe6KWXNmsFCNktaAh5RTqcLiSfT4huPQIXkgJ6YCOjJHvecOAzQxLFhPxKr+g==} engines: {node: '>=20.19.0'} @@ -533,8 +491,8 @@ packages: '@tsconfig/node16@1.0.4': resolution: {integrity: sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==} - '@types/bun@1.3.5': - resolution: {integrity: sha512-RnygCqNrd3srIPEWBd5LFeUYG7plCoH2Yw9WaZGyNmdTEei+gWaHqydbaIRkIkcbXwhBT94q78QljxN0Sk838w==} + '@types/bun@1.3.6': + resolution: {integrity: sha512-uWCv6FO/8LcpREhenN1d1b6fcspAB+cefwD7uti8C8VffIv0Um08TKMn98FynpTiU38+y2dUO55T11NgDt8VAA==} '@types/eslint-scope@3.7.7': resolution: {integrity: sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==} @@ -548,8 +506,8 @@ packages: '@types/json-schema@7.0.15': resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} - '@types/node@25.0.7': - resolution: {integrity: sha512-C/er7DlIZgRJO7WtTdYovjIFzGsz0I95UlMyR9anTb4aCpBSRWe5Jc1/RvLKUfzmOxHPGjSE5+63HgLtndxU4w==} + '@types/node@25.0.8': + resolution: {integrity: sha512-powIePYMmC3ibL0UJ2i2s0WIbq6cg6UyVFQxSCpaPxxzAaziRfimGivjdF943sSGV6RADVbk0Nvlm5P/FB44Zg==} '@types/resolve@1.20.2': resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==} @@ -652,10 +610,6 @@ packages: arg@4.1.3: resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==} - asn1js@3.0.7: - resolution: {integrity: sha512-uLvq6KJu04qoQM6gvBfKFjlh6Gl0vOKQuR5cJMDHQkmwfMOQeN3F3SHCv9SNYSL+CRoHvOGFfllDlVz03GQjvQ==} - engines: {node: '>=12.0.0'} - baseline-browser-mapping@2.9.11: resolution: {integrity: sha512-Sg0xJUNDU1sJNGdfGWhVHX0kkZ+HWcvmVymJbj6NSgZZmW/8S9Y2HQ5euytnIgakgxN6papOAWiwDo1ctFDcoQ==} hasBin: true @@ -672,12 +626,8 @@ packages: buffer-from@1.1.2: resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} - bun-types@1.3.5: - resolution: {integrity: sha512-inmAYe2PFLs0SUbFOWSVD24sg1jFlMPxOjOSSCYqUgn4Hsc3rDc7dFvfVYjFPNHtov6kgUeulV4SxbuIV/stPw==} - - bytestreamjs@2.0.1: - resolution: {integrity: sha512-U1Z/ob71V/bXfVABvNr/Kumf5VyeQRBEm6Txb0PQ6S7V5GpBM3w4Cbqz/xPDicR5tN0uvDifng8C+5qECeGwyQ==} - engines: {node: '>=6.0.0'} + bun-types@1.3.6: + resolution: {integrity: sha512-OlFwHcnNV99r//9v5IIOgQ9Uk37gZqrNMCcqEaExdkVq3Avwqok1bJFmvGMCkCE0FqzdY8VMOZpfpR3lwI+CsQ==} caniuse-lite@1.0.30001761: resolution: {integrity: sha512-JF9ptu1vP2coz98+5051jZ4PwQgd2ni8A+gYSN7EA7dPKIMf0pDlSUxhdmVOaV3/fYK5uWBkgSXJaRLr4+3A6g==} @@ -940,17 +890,6 @@ packages: resolution: {integrity: sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==} engines: {node: '>=12'} - pkijs@3.3.3: - resolution: {integrity: sha512-+KD8hJtqQMYoTuL1bbGOqxb4z+nZkTAwVdNtWwe8Tc2xNbEmdJYIYoc6Qt0uF55e6YW6KuTHw1DjQ18gMhzepw==} - engines: {node: '>=16.0.0'} - - pvtsutils@1.3.6: - resolution: {integrity: sha512-PLgQXQ6H2FWCaeRak8vvk1GW462lMxB5s3Jm673N82zI4vqtVUPuZdffdZbPDFRoU8kAhItWFtPCWiPpp4/EDg==} - - pvutils@1.1.5: - resolution: {integrity: sha512-KTqnxsgGiQ6ZAzZCVlJH5eOjSnvlyEgx1m8bkRJfOhmGRqfo5KLvmAlACQkrjEtOQ4B7wF9TdSLIs9O90MX9xA==} - engines: {node: '>=16.0.0'} - randombytes@2.1.0: resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==} @@ -958,9 +897,6 @@ packages: resolution: {integrity: sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==} engines: {node: '>= 0.6'} - reflect-metadata@0.2.2: - resolution: {integrity: sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==} - require-from-string@2.0.2: resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==} engines: {node: '>=0.10.0'} @@ -995,10 +931,6 @@ packages: resolution: {integrity: sha512-eflK8wEtyOE6+hsaRVPxvUKYCpRgzLqDTb8krvAsRIwOGlHoSgYLgBXoubGgLd2fT41/OUYdb48v4k4WWHQurA==} engines: {node: '>= 10.13.0'} - selfsigned@5.5.0: - resolution: {integrity: sha512-ftnu3TW4+3eBfLRFnDEkzGxSF/10BJBkaLJuBHZX0kiPS7bRdlpZGu6YGt4KngMkdTwJE6MbjavFpqHvqVt+Ew==} - engines: {node: '>=18'} - semver@7.7.3: resolution: {integrity: sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==} engines: {node: '>=10'} @@ -1095,9 +1027,6 @@ packages: '@swc/wasm': optional: true - tslib@1.14.1: - resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==} - tslib@2.8.1: resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} @@ -1106,10 +1035,6 @@ packages: engines: {node: '>=18.0.0'} hasBin: true - tsyringe@4.10.0: - resolution: {integrity: sha512-axr3IdNuVIxnaK5XGEUFTu3YmAQ6lllgrvqfEoR16g/HGnYY/6We4oWENtAnzK6/LpJ2ur9PAb80RBt7/U4ugw==} - engines: {node: '>= 6.0.0'} - typescript@5.9.3: resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==} engines: {node: '>=14.17'} @@ -1288,98 +1213,6 @@ snapshots: '@kevisual/ws@8.0.0': {} - '@noble/hashes@1.4.0': {} - - '@peculiar/asn1-cms@2.6.0': - dependencies: - '@peculiar/asn1-schema': 2.6.0 - '@peculiar/asn1-x509': 2.6.0 - '@peculiar/asn1-x509-attr': 2.6.0 - asn1js: 3.0.7 - tslib: 2.8.1 - - '@peculiar/asn1-csr@2.6.0': - dependencies: - '@peculiar/asn1-schema': 2.6.0 - '@peculiar/asn1-x509': 2.6.0 - asn1js: 3.0.7 - tslib: 2.8.1 - - '@peculiar/asn1-ecc@2.6.0': - dependencies: - '@peculiar/asn1-schema': 2.6.0 - '@peculiar/asn1-x509': 2.6.0 - asn1js: 3.0.7 - tslib: 2.8.1 - - '@peculiar/asn1-pfx@2.6.0': - dependencies: - '@peculiar/asn1-cms': 2.6.0 - '@peculiar/asn1-pkcs8': 2.6.0 - '@peculiar/asn1-rsa': 2.6.0 - '@peculiar/asn1-schema': 2.6.0 - asn1js: 3.0.7 - tslib: 2.8.1 - - '@peculiar/asn1-pkcs8@2.6.0': - dependencies: - '@peculiar/asn1-schema': 2.6.0 - '@peculiar/asn1-x509': 2.6.0 - asn1js: 3.0.7 - tslib: 2.8.1 - - '@peculiar/asn1-pkcs9@2.6.0': - dependencies: - '@peculiar/asn1-cms': 2.6.0 - '@peculiar/asn1-pfx': 2.6.0 - '@peculiar/asn1-pkcs8': 2.6.0 - '@peculiar/asn1-schema': 2.6.0 - '@peculiar/asn1-x509': 2.6.0 - '@peculiar/asn1-x509-attr': 2.6.0 - asn1js: 3.0.7 - tslib: 2.8.1 - - '@peculiar/asn1-rsa@2.6.0': - dependencies: - '@peculiar/asn1-schema': 2.6.0 - '@peculiar/asn1-x509': 2.6.0 - asn1js: 3.0.7 - tslib: 2.8.1 - - '@peculiar/asn1-schema@2.6.0': - dependencies: - asn1js: 3.0.7 - pvtsutils: 1.3.6 - tslib: 2.8.1 - - '@peculiar/asn1-x509-attr@2.6.0': - dependencies: - '@peculiar/asn1-schema': 2.6.0 - '@peculiar/asn1-x509': 2.6.0 - asn1js: 3.0.7 - tslib: 2.8.1 - - '@peculiar/asn1-x509@2.6.0': - dependencies: - '@peculiar/asn1-schema': 2.6.0 - asn1js: 3.0.7 - pvtsutils: 1.3.6 - tslib: 2.8.1 - - '@peculiar/x509@1.14.2': - dependencies: - '@peculiar/asn1-cms': 2.6.0 - '@peculiar/asn1-csr': 2.6.0 - '@peculiar/asn1-ecc': 2.6.0 - '@peculiar/asn1-pkcs9': 2.6.0 - '@peculiar/asn1-rsa': 2.6.0 - '@peculiar/asn1-schema': 2.6.0 - '@peculiar/asn1-x509': 2.6.0 - pvtsutils: 1.3.6 - reflect-metadata: 0.2.2 - tslib: 2.8.1 - tsyringe: 4.10.0 - '@rollup/plugin-alias@6.0.0(rollup@4.55.1)': optionalDependencies: rollup: 4.55.1 @@ -1506,9 +1339,9 @@ snapshots: '@tsconfig/node16@1.0.4': {} - '@types/bun@1.3.5': + '@types/bun@1.3.6': dependencies: - bun-types: 1.3.5 + bun-types: 1.3.6 '@types/eslint-scope@3.7.7': dependencies: @@ -1524,7 +1357,7 @@ snapshots: '@types/json-schema@7.0.15': {} - '@types/node@25.0.7': + '@types/node@25.0.8': dependencies: undici-types: 7.16.0 @@ -1532,15 +1365,15 @@ snapshots: '@types/send@1.2.1': dependencies: - '@types/node': 25.0.7 + '@types/node': 25.0.8 '@types/ws@8.18.1': dependencies: - '@types/node': 25.0.7 + '@types/node': 25.0.8 '@types/xml2js@0.4.14': dependencies: - '@types/node': 25.0.7 + '@types/node': 25.0.8 '@webassemblyjs/ast@1.14.1': dependencies: @@ -1654,12 +1487,6 @@ snapshots: arg@4.1.3: {} - asn1js@3.0.7: - dependencies: - pvtsutils: 1.3.6 - pvutils: 1.1.5 - tslib: 2.8.1 - baseline-browser-mapping@2.9.11: {} braces@3.0.3: @@ -1676,11 +1503,9 @@ snapshots: buffer-from@1.1.2: {} - bun-types@1.3.5: + bun-types@1.3.6: dependencies: - '@types/node': 25.0.7 - - bytestreamjs@2.0.1: {} + '@types/node': 25.0.8 caniuse-lite@1.0.30001761: {} @@ -1839,7 +1664,7 @@ snapshots: jest-worker@27.5.1: dependencies: - '@types/node': 25.0.7 + '@types/node': 25.0.8 merge-stream: 2.0.0 supports-color: 8.1.1 @@ -1899,29 +1724,12 @@ snapshots: picomatch@4.0.3: {} - pkijs@3.3.3: - dependencies: - '@noble/hashes': 1.4.0 - asn1js: 3.0.7 - bytestreamjs: 2.0.1 - pvtsutils: 1.3.6 - pvutils: 1.1.5 - tslib: 2.8.1 - - pvtsutils@1.3.6: - dependencies: - tslib: 2.8.1 - - pvutils@1.1.5: {} - randombytes@2.1.0: dependencies: safe-buffer: 5.2.1 range-parser@1.2.1: {} - reflect-metadata@0.2.2: {} - require-from-string@2.0.2: {} resolve-pkg-maps@1.0.0: {} @@ -1982,11 +1790,6 @@ snapshots: ajv-formats: 2.1.1(ajv@8.17.1) ajv-keywords: 5.1.0(ajv@8.17.1) - selfsigned@5.5.0: - dependencies: - '@peculiar/x509': 1.14.2 - pkijs: 3.3.3 - semver@7.7.3: {} send@1.2.1: @@ -2066,14 +1869,14 @@ snapshots: typescript: 5.9.3 webpack: 5.104.1 - ts-node@10.9.2(@types/node@25.0.7)(typescript@5.9.3): + ts-node@10.9.2(@types/node@25.0.8)(typescript@5.9.3): dependencies: '@cspotcode/source-map-support': 0.8.1 '@tsconfig/node10': 1.0.12 '@tsconfig/node12': 1.0.11 '@tsconfig/node14': 1.0.3 '@tsconfig/node16': 1.0.4 - '@types/node': 25.0.7 + '@types/node': 25.0.8 acorn: 8.15.0 acorn-walk: 8.3.4 arg: 4.1.3 @@ -2084,8 +1887,6 @@ snapshots: v8-compile-cache-lib: 3.0.1 yn: 3.1.1 - tslib@1.14.1: {} - tslib@2.8.1: {} tsx@4.21.0: @@ -2095,10 +1896,6 @@ snapshots: optionalDependencies: fsevents: 2.3.3 - tsyringe@4.10.0: - dependencies: - tslib: 1.14.1 - typescript@5.9.3: {} undici-types@7.16.0: {} diff --git a/src/browser.ts b/src/browser.ts index 748444e..d3ad86c 100644 --- a/src/browser.ts +++ b/src/browser.ts @@ -6,10 +6,10 @@ export { createSchema } from './validator/index.ts'; export type { RouteContext, RouteOpts } from './route.ts'; -export type { Run } from './route.ts'; +export type { Run, Skill } from './route.ts'; + +export { createSkill } from './route.ts'; export { CustomError } from './result/error.ts'; -export * from './server/parse-body.ts'; - export * from './router-define.ts'; diff --git a/src/index.ts b/src/index.ts index 66fd676..3b6f8e9 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,24 +1,22 @@ export { Route, QueryRouter, QueryRouterServer, Mini } from './route.ts'; -export { Connect, QueryConnect } from './connect.ts'; - -export type { RouteContext, RouteOpts, RouteMiddleware } from './route.ts'; - -export type { Run } from './route.ts'; - -export { ServerNode, handleServer } from './server/index.ts'; -/** - * 自定义错误 - */ -export { CustomError } from './result/error.ts'; - -export { createSchema } from './validator/index.ts'; export type { Rule, Schema, } from './validator/index.ts'; -export { App } from './app.ts'; +export { createSchema } from './validator/index.ts'; + +export type { RouteContext, RouteOpts, RouteMiddleware } from './route.ts'; + +export type { Run, Skill } from './route.ts'; + +export { createSkill } from './route.ts'; + +export { CustomError } from './result/error.ts'; export * from './router-define.ts'; +export { ServerNode, handleServer } from './server/index.ts'; + +export { App } from './app.ts'; export type { RouterReq, diff --git a/src/connect.ts b/src/modules/connect.ts similarity index 97% rename from src/connect.ts rename to src/modules/connect.ts index 56f4cff..321d7cd 100644 --- a/src/connect.ts +++ b/src/modules/connect.ts @@ -1,5 +1,5 @@ import { nanoid } from 'nanoid'; -import { RouteContext } from './route.ts'; +import { RouteContext } from '../route.ts'; export class Connect { path: string; diff --git a/src/route.ts b/src/route.ts index 24c2060..9d271b0 100644 --- a/src/route.ts +++ b/src/route.ts @@ -2,6 +2,8 @@ import { nanoid } from 'nanoid'; import { CustomError } from './result/error.ts'; import { pick } from './utils/pick.ts'; import { listenProcess } from './utils/listen-process.ts'; +import { z } from 'zod'; +import { filter } from '@kevisual/js-filter' export type RouterContextT = { code?: number;[key: string]: any }; export type RouteContext = { @@ -90,6 +92,22 @@ export type RouteOpts = { }; export type DefineRouteOpts = Omit; const pickValue = ['path', 'key', 'id', 'description', 'type', 'middleware', 'metadata'] as const; + + +export type Skill = { + skill: string; + title: string; + summary?: string; + args?: z.ZodTypeAny; +} & T +/** */ +export const createSkill = (skill: Skill): Skill => { + return { + args: {}, + ...skill + }; +} + export type RouteInfo = Pick; export class Route { /**