diff --git a/package.json b/package.json index 2fc9d41..4167119 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,6 @@ "resend": "^0.17.2", "sharp": "^0.32.4", "superjson": "1.13.1", - "trpc-openapi": "^1.2.0", "zod": "^3.21.4" }, "devDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6d11031..0f46d0a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -89,9 +89,6 @@ dependencies: superjson: specifier: 1.13.1 version: 1.13.1 - trpc-openapi: - specifier: ^1.2.0 - version: 1.2.0(@trpc/server@10.37.1)(zod@3.21.4) zod: specifier: ^3.21.4 version: 3.21.4 @@ -1906,14 +1903,6 @@ packages: - utf-8-validate dev: false - /accepts@1.3.8: - resolution: {integrity: sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==} - engines: {node: '>= 0.6'} - dependencies: - mime-types: 2.1.35 - negotiator: 0.6.3 - dev: false - /acorn-jsx@5.3.2(acorn@8.10.0): resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} peerDependencies: @@ -2252,11 +2241,6 @@ packages: streamsearch: 1.1.0 dev: false - /bytes@3.1.2: - resolution: {integrity: sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==} - engines: {node: '>= 0.8'} - dev: false - /cacheable-lookup@5.0.4: resolution: {integrity: sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA==} engines: {node: '>=10.6.0'} @@ -2280,6 +2264,7 @@ packages: dependencies: function-bind: 1.1.1 get-intrinsic: 1.2.1 + dev: true /callsites@3.1.0: resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} @@ -2396,15 +2381,6 @@ packages: engines: {node: '>=0.8'} dev: false - /co-body@6.1.0: - resolution: {integrity: sha512-m7pOT6CdLN7FuXUcpuz/8lfQ/L77x8SchHCF4G0RBTJO20Wzmhn5Sp4/5WsKy8OSpifBSUrmg83qEqaDHdyFuQ==} - dependencies: - inflation: 2.0.0 - qs: 6.11.2 - raw-body: 2.5.2 - type-is: 1.6.18 - dev: false - /color-convert@1.9.3: resolution: {integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==} dependencies: @@ -2499,17 +2475,6 @@ packages: proto-list: 1.2.4 dev: false - /content-disposition@0.5.4: - resolution: {integrity: sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==} - engines: {node: '>= 0.6'} - dependencies: - safe-buffer: 5.2.1 - dev: false - - /cookie-es@1.0.0: - resolution: {integrity: sha512-mWYvfOLrfEc996hlKcdABeIiPHUPC6DM2QYZdGGOvhOTbA3tjm2eBwqlJpoFdjC89NI4Qt6h0Pu06Mp+1Pj5OQ==} - dev: false - /cookie@0.5.0: resolution: {integrity: sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==} engines: {node: '>= 0.6'} @@ -2658,25 +2623,11 @@ packages: resolution: {integrity: sha512-hsBd2qSVCRE+5PmNdHt1uzyrFu5d3RwmFDKzyNZMFq/EwDNJF7Ee5+D5oEKF0hU6LhtoUF1macFvOe4AskQC1Q==} dev: false - /defu@6.1.2: - resolution: {integrity: sha512-+uO4+qr7msjNNWKYPHqN/3+Dx3NFkmIzayk2L1MyZQlvgZb/J1A0fo410dpKrN2SnqFjt8n4JL8fDJE0wIgjFQ==} - dev: false - /delayed-stream@1.0.0: resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} engines: {node: '>=0.4.0'} dev: false - /depd@1.1.2: - resolution: {integrity: sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==} - engines: {node: '>= 0.6'} - dev: false - - /depd@2.0.0: - resolution: {integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==} - engines: {node: '>= 0.8'} - dev: false - /deprecation@2.3.1: resolution: {integrity: sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==} dev: false @@ -2686,10 +2637,6 @@ packages: engines: {node: '>=6'} dev: true - /destr@2.0.1: - resolution: {integrity: sha512-M1Ob1zPSIvlARiJUkKqvAZ3VAqQY6Jcuth/pBKQ2b1dX/Qx0OnJ8Vux6J2H5PTMQeRzWrrbTu70VxBfv/OPDJA==} - dev: false - /detect-libc@2.0.2: resolution: {integrity: sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==} engines: {node: '>=8'} @@ -3590,11 +3537,6 @@ packages: resolution: {integrity: sha512-MhLuK+2gUcnZe8ZHlaaINnQLl0xRIGRfcGk2yl8xoQAfHrSsL3rYu6FCmBdkdbhc9EPlwyGHewaRsvwRMJtAlA==} dev: false - /fresh@0.5.2: - resolution: {integrity: sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==} - engines: {node: '>= 0.6'} - dev: false - /fs-constants@1.0.0: resolution: {integrity: sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==} dev: false @@ -3661,6 +3603,7 @@ packages: has: 1.0.3 has-proto: 1.0.1 has-symbols: 1.0.3 + dev: true /get-stream@5.2.0: resolution: {integrity: sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==} @@ -3816,18 +3759,6 @@ packages: resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==} dev: true - /h3@1.7.1: - resolution: {integrity: sha512-A9V2NEDNHet7v1gCg7CMwerSigLi0SRbhTy7C3lGb0N4YKIpPmLDjedTUopqp4dnn7COHfqUjjaz3zbtz4QduA==} - dependencies: - cookie-es: 1.0.0 - defu: 6.1.2 - destr: 2.0.1 - iron-webcrypto: 0.7.1 - radix3: 1.0.1 - ufo: 1.2.0 - uncrypto: 0.1.3 - dev: false - /hanji@0.0.5: resolution: {integrity: sha512-Abxw1Lq+TnYiL4BueXqMau222fPSPMFtya8HdpWsz/xVAhifXou71mPh/kY2+08RgFcVccjG3uZHs6K5HAe3zw==} dependencies: @@ -3857,10 +3788,12 @@ packages: /has-proto@1.0.1: resolution: {integrity: sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==} engines: {node: '>= 0.4'} + dev: true /has-symbols@1.0.3: resolution: {integrity: sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==} engines: {node: '>= 0.4'} + dev: true /has-tostringtag@1.0.0: resolution: {integrity: sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==} @@ -3935,17 +3868,6 @@ packages: resolution: {integrity: sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==} dev: false - /http-errors@2.0.0: - resolution: {integrity: sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==} - engines: {node: '>= 0.8'} - dependencies: - depd: 2.0.0 - inherits: 2.0.4 - setprototypeof: 1.2.0 - statuses: 2.0.1 - toidentifier: 1.0.1 - dev: false - /http2-wrapper@1.0.3: resolution: {integrity: sha512-V+23sDMr12Wnz7iTcDeJr3O6AIxlnvT/bmaAAAP/Xda35C90p9599p0F1eHR/N1KILWSoWVAiOMFjBBXaXSMxg==} engines: {node: '>=10.19.0'} @@ -3959,13 +3881,6 @@ packages: engines: {node: '>=10.17.0'} dev: false - /iconv-lite@0.4.24: - resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==} - engines: {node: '>=0.10.0'} - dependencies: - safer-buffer: 2.1.2 - dev: false - /ieee754@1.2.1: resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} dev: false @@ -3987,11 +3902,6 @@ packages: engines: {node: '>=0.8.19'} dev: true - /inflation@2.0.0: - resolution: {integrity: sha512-m3xv4hJYR2oXw4o4Y5l6P5P16WYmazYof+el6Al3f+YlggGj6qT9kImBAnzDelRALnP5d3h4jGBPKzYCizjZZw==} - engines: {node: '>= 0.8.0'} - dev: false - /inflight@1.0.6: resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} dependencies: @@ -4023,10 +3933,6 @@ packages: engines: {node: '>= 0.10'} dev: false - /iron-webcrypto@0.7.1: - resolution: {integrity: sha512-K/UmlEhPCPXEHV5hAtH5C0tI5JnFuOrv4yO/j7ODPl3HaiiHBLbOLTde+ieUaAyfCATe4LoAnclyF+hmSCOVmQ==} - dev: false - /is-array-buffer@3.0.2: resolution: {integrity: sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w==} dependencies: @@ -4384,10 +4290,6 @@ packages: p-locate: 5.0.0 dev: true - /lodash.clonedeep@4.5.0: - resolution: {integrity: sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ==} - dev: false - /lodash.get@4.4.2: resolution: {integrity: sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==} dev: false @@ -4442,11 +4344,6 @@ packages: engines: {node: '>=8'} dev: false - /media-typer@0.3.0: - resolution: {integrity: sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==} - engines: {node: '>= 0.6'} - dev: false - /memoizee@0.4.15: resolution: {integrity: sha512-UBWmJpLZd5STPm7PMUlOw/TSy972M+z8gcyQ5veOnSDRREz/0bmpyTfKt3/51DhEBqCZQn1udM/5flcSPYhkdQ==} dependencies: @@ -4460,10 +4357,6 @@ packages: timers-ext: 0.1.7 dev: true - /merge-descriptors@1.0.1: - resolution: {integrity: sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==} - dev: false - /merge-stream@2.0.0: resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==} dev: false @@ -4472,11 +4365,6 @@ packages: resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} engines: {node: '>= 8'} - /methods@1.1.2: - resolution: {integrity: sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==} - engines: {node: '>= 0.6'} - dev: false - /micromatch@4.0.5: resolution: {integrity: sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==} engines: {node: '>=8.6'} @@ -4496,12 +4384,6 @@ packages: mime-db: 1.52.0 dev: false - /mime@1.6.0: - resolution: {integrity: sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==} - engines: {node: '>=4'} - hasBin: true - dev: false - /mimic-fn@2.1.0: resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==} engines: {node: '>=6'} @@ -4589,11 +4471,6 @@ packages: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} dev: true - /negotiator@0.6.3: - resolution: {integrity: sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==} - engines: {node: '>= 0.6'} - dev: false - /next-tick@1.1.0: resolution: {integrity: sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==} dev: true @@ -4681,22 +4558,6 @@ packages: whatwg-url: 5.0.0 dev: false - /node-mocks-http@1.12.2: - resolution: {integrity: sha512-xhWwC0dh35R9rf0j3bRZXuISXdHxxtMx0ywZQBwjrg3yl7KpRETzogfeCamUIjltpn0Fxvs/ZhGJul1vPLrdJQ==} - engines: {node: '>=0.6'} - dependencies: - accepts: 1.3.8 - content-disposition: 0.5.4 - depd: 1.1.2 - fresh: 0.5.2 - merge-descriptors: 1.0.1 - methods: 1.1.2 - mime: 1.6.0 - parseurl: 1.3.3 - range-parser: 1.2.1 - type-is: 1.6.18 - dev: false - /node-releases@2.0.13: resolution: {integrity: sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==} dev: false @@ -4749,6 +4610,7 @@ packages: /object-inspect@1.12.3: resolution: {integrity: sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==} + dev: true /object-keys@1.1.1: resolution: {integrity: sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==} @@ -4820,10 +4682,6 @@ packages: mimic-fn: 2.1.0 dev: false - /openapi-types@12.1.3: - resolution: {integrity: sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw==} - dev: false - /optionator@0.9.3: resolution: {integrity: sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==} engines: {node: '>= 0.8.0'} @@ -4913,11 +4771,6 @@ packages: peberminta: 0.8.0 dev: false - /parseurl@1.3.3: - resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==} - engines: {node: '>= 0.8'} - dev: false - /path-exists@4.0.0: resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} engines: {node: '>=8'} @@ -5192,13 +5045,6 @@ packages: engines: {node: '>=6.0.0'} dev: false - /qs@6.11.2: - resolution: {integrity: sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==} - engines: {node: '>=0.6'} - dependencies: - side-channel: 1.0.4 - dev: false - /queue-microtask@1.2.3: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} @@ -5216,25 +5062,6 @@ packages: engines: {node: '>=10'} dev: false - /radix3@1.0.1: - resolution: {integrity: sha512-y+AcwZ3HcUIGc9zGsNVf5+BY/LxL+z+4h4J3/pp8jxSmy1STaCocPS3qrj4tA5ehUSzqtqK+0Aygvz/r/8vy4g==} - dev: false - - /range-parser@1.2.1: - resolution: {integrity: sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==} - engines: {node: '>= 0.6'} - dev: false - - /raw-body@2.5.2: - resolution: {integrity: sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==} - engines: {node: '>= 0.8'} - dependencies: - bytes: 3.1.2 - http-errors: 2.0.0 - iconv-lite: 0.4.24 - unpipe: 1.0.0 - dev: false - /rc@1.2.8: resolution: {integrity: sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==} hasBin: true @@ -5485,10 +5312,6 @@ packages: is-regex: 1.1.4 dev: true - /safer-buffer@2.1.2: - resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} - dev: false - /scheduler@0.23.0: resolution: {integrity: sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==} dependencies: @@ -5522,10 +5345,6 @@ packages: resolution: {integrity: sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==} dev: false - /setprototypeof@1.2.0: - resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==} - dev: false - /sharp@0.32.4: resolution: {integrity: sha512-exUnZewqVZC6UXqXuQ8fyJJv0M968feBi04jb9GcUHrWtkRoAKnbJt8IfwT4NJs7FskArbJ14JAFGVuooszoGg==} engines: {node: '>=14.15.0'} @@ -5567,6 +5386,7 @@ packages: call-bind: 1.0.2 get-intrinsic: 1.2.1 object-inspect: 1.12.3 + dev: true /signal-exit@3.0.7: resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} @@ -5664,11 +5484,6 @@ packages: resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==} dev: false - /statuses@2.0.1: - resolution: {integrity: sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==} - engines: {node: '>= 0.8'} - dev: false - /streamsearch@1.1.0: resolution: {integrity: sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==} engines: {node: '>=10.0.0'} @@ -5987,11 +5802,6 @@ packages: resolution: {integrity: sha512-zks18/TWT1iHO3v0vFp5qLKOG27m67ycq/Y7a7cTiRuUNlc4gf3HGnkRgMv0NyhnfTamtkYBJl+YeD1/j07gBQ==} dev: false - /toidentifier@1.0.1: - resolution: {integrity: sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==} - engines: {node: '>=0.6'} - dev: false - /tr46@0.0.3: resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} dev: false @@ -6009,22 +5819,6 @@ packages: pretty-bytes: 5.6.0 dev: false - /trpc-openapi@1.2.0(@trpc/server@10.37.1)(zod@3.21.4): - resolution: {integrity: sha512-pfYoCd/3KYXWXvUPZBKJw455OOwngKN/6SIcj7Yit19OMLJ+8yVZkEvGEeg5wUSwfsiTdRsKuvqkRPXVSwV7ew==} - peerDependencies: - '@trpc/server': ^10.0.0 - zod: ^3.14.4 - dependencies: - '@trpc/server': 10.37.1 - co-body: 6.1.0 - h3: 1.7.1 - lodash.clonedeep: 4.5.0 - node-mocks-http: 1.12.2 - openapi-types: 12.1.3 - zod: 3.21.4 - zod-to-json-schema: 3.21.4(zod@3.21.4) - dev: false - /ts-api-utils@1.0.1(typescript@5.1.6): resolution: {integrity: sha512-lC/RGlPmwdrIBFTX59wwNzqh7aR2otPNPR/5brHZm/XKFYKsfqxihXUe9pU3JI+3vGkl+vyCoNNnPhJn3aLK1A==} engines: {node: '>=16.13.0'} @@ -6099,14 +5893,6 @@ packages: engines: {node: '>=14.16'} dev: false - /type-is@1.6.18: - resolution: {integrity: sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==} - engines: {node: '>= 0.6'} - dependencies: - media-typer: 0.3.0 - mime-types: 2.1.35 - dev: false - /type@1.2.0: resolution: {integrity: sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==} dev: true @@ -6159,10 +5945,6 @@ packages: hasBin: true dev: true - /ufo@1.2.0: - resolution: {integrity: sha512-RsPyTbqORDNDxqAdQPQBpgqhWle1VcTSou/FraClYlHf6TZnQcGslpLcAphNR+sQW4q5lLWLbOsRlh9j24baQg==} - dev: false - /unbox-primitive@1.0.2: resolution: {integrity: sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==} dependencies: @@ -6172,10 +5954,6 @@ packages: which-boxed-primitive: 1.0.2 dev: true - /uncrypto@0.1.3: - resolution: {integrity: sha512-Ql87qFHB3s/De2ClA9e0gsnS6zXG27SkTiSJwjCc9MebbfapQfuPzumMIUMi38ezPZVNFcHI9sUIepeQfw8J8Q==} - dev: false - /universal-user-agent@6.0.0: resolution: {integrity: sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w==} dev: false @@ -6190,11 +5968,6 @@ packages: engines: {node: '>= 10.0.0'} dev: false - /unpipe@1.0.0: - resolution: {integrity: sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==} - engines: {node: '>= 0.8'} - dev: false - /unzipper@0.10.14: resolution: {integrity: sha512-ti4wZj+0bQTiX2KmKWuwj7lhV+2n//uXEotUmGuQqrbVZSEGFMbI68+c6JCQ8aAmUWYvtHEz2A8K6wXvueR/6g==} dependencies: @@ -6361,13 +6134,5 @@ packages: engines: {node: '>=10'} dev: true - /zod-to-json-schema@3.21.4(zod@3.21.4): - resolution: {integrity: sha512-fjUZh4nQ1s6HMccgIeE0VP4QG/YRGPmyjO9sAh890aQKPEk3nqbfUXhMFaC+Dr5KvYBm8BCyvfpZf2jY9aGSsw==} - peerDependencies: - zod: ^3.21.4 - dependencies: - zod: 3.21.4 - dev: false - /zod@3.21.4: resolution: {integrity: sha512-m46AKbrzKVzOzs/DZgVnG5H55N1sv1M8qZU3A8RIKbs3mrACDNeIOeilDymVb2HdmP8uwshOCF4uJ8uM9rCqJw==} diff --git a/src/pages/api/[...trpc].ts b/src/pages/api/[...trpc].ts index 18ec82f..ffeb038 100644 --- a/src/pages/api/[...trpc].ts +++ b/src/pages/api/[...trpc].ts @@ -1,19 +1,8 @@ -import type { NextApiRequest, NextApiResponse } from "next"; -import { createOpenApiNextHandler } from "trpc-openapi"; -import cors from "nextjs-cors"; - import { appRouter } from "~/server/api/root"; import { createTRPCContext } from "~/server/api/trpc"; +import { createNextApiHandler } from "@trpc/server/adapters/next"; -const handler = async (req: NextApiRequest, res: NextApiResponse) => { - // Setup CORS - await cors(req, res); - - // Handle incoming OpenAPI requests - return createOpenApiNextHandler({ - router: appRouter, - createContext: createTRPCContext, - })(req, res); -}; - -export default handler; +export default createNextApiHandler({ + router: appRouter, + createContext: createTRPCContext, +}); diff --git a/src/pages/api/openapi.json.ts b/src/pages/api/openapi.json.ts deleted file mode 100644 index 1a0eab7..0000000 --- a/src/pages/api/openapi.json.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { NextApiRequest, NextApiResponse } from "next"; - -import { openApiDocument } from "../../server/openapi"; - -// Respond with our OpenAPI schema -const handler = (req: NextApiRequest, res: NextApiResponse) => { - res.status(200).send(openApiDocument); -}; - -export default handler; diff --git a/src/pages/api/webhooks/onUserDelete.ts b/src/pages/api/webhooks/onUserDelete.ts new file mode 100644 index 0000000..cfc1bde --- /dev/null +++ b/src/pages/api/webhooks/onUserDelete.ts @@ -0,0 +1,26 @@ +import type { NextApiRequest, NextApiResponse } from "next"; +import { validateApiKey } from "~/server/unkey"; + +export default async function handler( + req: NextApiRequest, + res: NextApiResponse +) { + let isValidKey: boolean = false; + + // Get the auth bearer token if it exists + if (req.headers.authorization) { + const key = req.headers.authorization.split("Bearer ").at(1); + if (key) { + isValidKey = await validateApiKey(key); + } + } + + // Error if the key is not valid + if (!isValidKey) { + res.status(403).json({ error: "UNAUTHORIZED" }); + } + + console.log(req.body); + + res.status(200).json({ result: "AUTHORIZED" }); +} diff --git a/src/server/api/root.ts b/src/server/api/root.ts index b331d52..46b8d53 100644 --- a/src/server/api/root.ts +++ b/src/server/api/root.ts @@ -1,8 +1,6 @@ import { roomRouter } from "~/server/api/routers/room"; import { createTRPCRouter } from "~/server/api/trpc"; import { voteRouter } from "./routers/vote"; -import { restRouter } from "./routers/rest"; -import { webhookRouter } from "./routers/webhook"; /** * This is the primary router for your server. @@ -12,8 +10,6 @@ import { webhookRouter } from "./routers/webhook"; export const appRouter = createTRPCRouter({ room: roomRouter, vote: voteRouter, - rest: restRouter, - webhook: webhookRouter, }); // export type definition of API diff --git a/src/server/api/routers/rest.ts b/src/server/api/routers/rest.ts deleted file mode 100644 index 12e1bb3..0000000 --- a/src/server/api/routers/rest.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { z } from "zod"; - -import { createTRPCRouter, publicProcedure } from "~/server/api/trpc"; -import { fetchCache, setCache } from "~/server/redis"; -import { sql } from "drizzle-orm"; -import { rooms, votes } from "~/server/schema"; - -export const restRouter = createTRPCRouter({ - voteCount: publicProcedure - .meta({ openapi: { method: "GET", path: "/rest/votes/count" } }) - .input(z.void()) - .output(z.number()) - .query(async ({ ctx }) => { - const cachedResult = await fetchCache(`kv_votecount`); - - if (cachedResult) { - return cachedResult; - } else { - const votesResult = ( - await ctx.db.select({ count: sql`count(*)` }).from(votes) - )[0]; - - const votesCount = votesResult ? Number(votesResult.count) : 0; - - await setCache(`kv_votecount`, votesCount); - - return votesCount; - } - }), - - roomCount: publicProcedure - .meta({ openapi: { method: "GET", path: "/rest/rooms/count" } }) - .input(z.void()) - .output(z.number()) - .query(async ({ ctx }) => { - const cachedResult = await fetchCache(`kv_roomcount`); - - if (cachedResult) { - return cachedResult; - } else { - const roomsResult = ( - await ctx.db.select({ count: sql`count(*)` }).from(rooms) - )[0]; - - const roomsCount = roomsResult ? Number(roomsResult.count) : 0; - - await setCache(`kv_roomcount`, roomsCount); - - return roomsCount; - } - }), -}); diff --git a/src/server/api/routers/webhook.ts b/src/server/api/routers/webhook.ts deleted file mode 100644 index c2e60dc..0000000 --- a/src/server/api/routers/webhook.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { z } from "zod"; - -import { createTRPCRouter, keyProtectedProcedure } from "~/server/api/trpc"; - -export const webhookRouter = createTRPCRouter({ - onUserDelete: keyProtectedProcedure - .meta({ openapi: { method: "POST", path: "/webhook/user/delete" } }) - .input( - z.object({ - data: z.object({ - deleted: z.boolean(), - id: z.string(), - object: z.string(), - }), - object: z.string(), - type: z.string(), - }) - ) - .output(z.string()) - .query(({ input }) => { - console.log(input.data.deleted); - return `Deleted: ${input.data.deleted}`; - }), -}); diff --git a/src/server/api/trpc.ts b/src/server/api/trpc.ts index 6baa90f..32e3ae8 100644 --- a/src/server/api/trpc.ts +++ b/src/server/api/trpc.ts @@ -25,9 +25,8 @@ import type { import { db } from "../db"; -interface ContextType { +interface AuthContext { auth: SignedInAuthObject | SignedOutAuthObject; - key: string | null; } /** * This helper generates the "internals" for a tRPC context. If you need to use @@ -38,9 +37,8 @@ interface ContextType { * - trpc's `createSSGHelpers` where we don't have req/res * @see https://create.t3.gg/en/usage/trpc#-servertrpccontextts */ -const createInnerTRPCContext = ({ auth, key }: ContextType) => { +const createInnerTRPCContext = ({ auth }: AuthContext) => { return { - key, auth, db, }; @@ -51,19 +49,8 @@ const createInnerTRPCContext = ({ auth, key }: ContextType) => { * process every request that goes through your tRPC endpoint * @link https://trpc.io/docs/context */ -export const createTRPCContext = async (opts: CreateNextContextOptions) => { - let keyValue: string | null = null; - - if (opts.req.headers.authorization) { - const key = opts.req.headers.authorization.split("Bearer ").at(1); - if (key) { - const isValidKey = await validateApiKey(key); - if (isValidKey) { - keyValue = key; - } - } - } - return createInnerTRPCContext({ auth: getAuth(opts.req), key: keyValue }); +export const createTRPCContext = (opts: CreateNextContextOptions) => { + return createInnerTRPCContext({ auth: getAuth(opts.req) }); }; /** @@ -74,18 +61,13 @@ export const createTRPCContext = async (opts: CreateNextContextOptions) => { */ import { initTRPC, TRPCError } from "@trpc/server"; import superjson from "superjson"; -import type { OpenApiMeta } from "trpc-openapi"; -import { validateApiKey } from "../unkey"; -const t = initTRPC - .context() - .meta() - .create({ - transformer: superjson, - errorFormatter({ shape }) { - return shape; - }, - }); +const t = initTRPC.context().create({ + transformer: superjson, + errorFormatter({ shape }) { + return shape; + }, +}); // check if the user is signed in, otherwise through a UNAUTHORIZED CODE const isAuthed = t.middleware(({ next, ctx }) => { @@ -99,18 +81,6 @@ const isAuthed = t.middleware(({ next, ctx }) => { }, }); }); - -const isKeyAuthed = t.middleware(({ next, ctx }) => { - if (!ctx.key) { - throw new TRPCError({ code: "UNAUTHORIZED" }); - } - - return next({ - ctx: { - key: ctx.key, - }, - }); -}); /** * 3. ROUTER & PROCEDURE (THE IMPORTANT BIT) * @@ -133,4 +103,3 @@ export const createTRPCRouter = t.router; */ export const publicProcedure = t.procedure; export const protectedProcedure = t.procedure.use(isAuthed); -export const keyProtectedProcedure = t.procedure.use(isKeyAuthed); diff --git a/src/server/openapi.ts b/src/server/openapi.ts deleted file mode 100644 index f0ee72f..0000000 --- a/src/server/openapi.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { generateOpenApiDocument } from 'trpc-openapi'; - -import { appRouter } from './api/root'; - -// Generate OpenAPI schema document -export const openApiDocument = generateOpenApiDocument(appRouter, { - title: 'Example CRUD API', - description: 'OpenAPI compliant REST API built using tRPC with Next.js', - version: '1.0.0', - baseUrl: 'http://localhost:3000/api', - docsUrl: 'https://github.com/jlalmes/trpc-openapi', -}); \ No newline at end of file