simple-skill-manager 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -0
- package/.next/app-build-manifest.json +185 -0
- package/.next/app-path-routes-manifest.json +22 -0
- package/.next/build-manifest.json +33 -0
- package/.next/diagnostics/build-diagnostics.json +6 -0
- package/.next/diagnostics/framework.json +1 -0
- package/.next/export-marker.json +6 -0
- package/.next/images-manifest.json +58 -0
- package/.next/next-minimal-server.js.nft.json +1 -0
- package/.next/next-server.js.nft.json +1 -0
- package/.next/package.json +1 -0
- package/.next/prerender-manifest.json +205 -0
- package/.next/react-loadable-manifest.json +1 -0
- package/.next/required-server-files.json +323 -0
- package/.next/routes-manifest.json +98 -0
- package/.next/server/app/_not-found/page.js +2 -0
- package/.next/server/app/_not-found/page.js.nft.json +1 -0
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -0
- package/.next/server/app/_not-found.html +1 -0
- package/.next/server/app/_not-found.meta +8 -0
- package/.next/server/app/_not-found.rsc +24 -0
- package/.next/server/app/api/agents/route.js +2 -0
- package/.next/server/app/api/agents/route.js.nft.json +1 -0
- package/.next/server/app/api/agents/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/config/route.js +1 -0
- package/.next/server/app/api/config/route.js.nft.json +1 -0
- package/.next/server/app/api/config/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/marketplace/route.js +1 -0
- package/.next/server/app/api/marketplace/route.js.nft.json +1 -0
- package/.next/server/app/api/marketplace/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/mcp/route.js +3 -0
- package/.next/server/app/api/mcp/route.js.nft.json +1 -0
- package/.next/server/app/api/mcp/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/skills/action/route.js +1 -0
- package/.next/server/app/api/skills/action/route.js.nft.json +1 -0
- package/.next/server/app/api/skills/action/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/skills/detail/route.js +1 -0
- package/.next/server/app/api/skills/detail/route.js.nft.json +1 -0
- package/.next/server/app/api/skills/detail/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/skills/dups/route.js +1 -0
- package/.next/server/app/api/skills/dups/route.js.nft.json +1 -0
- package/.next/server/app/api/skills/dups/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/skills/route.js +1 -0
- package/.next/server/app/api/skills/route.js.nft.json +1 -0
- package/.next/server/app/api/skills/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/skills/updates/route.js +1 -0
- package/.next/server/app/api/skills/updates/route.js.nft.json +1 -0
- package/.next/server/app/api/skills/updates/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/sync/route.js +1 -0
- package/.next/server/app/api/sync/route.js.nft.json +1 -0
- package/.next/server/app/api/sync/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/tags/route.js +1 -0
- package/.next/server/app/api/tags/route.js.nft.json +1 -0
- package/.next/server/app/api/tags/route_client-reference-manifest.js +1 -0
- package/.next/server/app/discover/page.js +2 -0
- package/.next/server/app/discover/page.js.nft.json +1 -0
- package/.next/server/app/discover/page_client-reference-manifest.js +1 -0
- package/.next/server/app/discover.html +1 -0
- package/.next/server/app/discover.meta +7 -0
- package/.next/server/app/discover.rsc +28 -0
- package/.next/server/app/index.html +1 -0
- package/.next/server/app/index.meta +9 -0
- package/.next/server/app/index.rsc +25 -0
- package/.next/server/app/library/page.js +2 -0
- package/.next/server/app/library/page.js.nft.json +1 -0
- package/.next/server/app/library/page_client-reference-manifest.js +1 -0
- package/.next/server/app/library.html +1 -0
- package/.next/server/app/library.meta +7 -0
- package/.next/server/app/library.rsc +28 -0
- package/.next/server/app/marketplace/page.js +2 -0
- package/.next/server/app/marketplace/page.js.nft.json +1 -0
- package/.next/server/app/marketplace/page_client-reference-manifest.js +1 -0
- package/.next/server/app/marketplace.html +1 -0
- package/.next/server/app/marketplace.meta +7 -0
- package/.next/server/app/marketplace.rsc +28 -0
- package/.next/server/app/mcp/page.js +2 -0
- package/.next/server/app/mcp/page.js.nft.json +1 -0
- package/.next/server/app/mcp/page_client-reference-manifest.js +1 -0
- package/.next/server/app/mcp.html +1 -0
- package/.next/server/app/mcp.meta +7 -0
- package/.next/server/app/mcp.rsc +28 -0
- package/.next/server/app/page.js +2 -0
- package/.next/server/app/page.js.nft.json +1 -0
- package/.next/server/app/page_client-reference-manifest.js +1 -0
- package/.next/server/app/parking/page.js +2 -0
- package/.next/server/app/parking/page.js.nft.json +1 -0
- package/.next/server/app/parking/page_client-reference-manifest.js +1 -0
- package/.next/server/app/parking.html +1 -0
- package/.next/server/app/parking.meta +9 -0
- package/.next/server/app/parking.rsc +25 -0
- package/.next/server/app/settings/page.js +5 -0
- package/.next/server/app/settings/page.js.nft.json +1 -0
- package/.next/server/app/settings/page_client-reference-manifest.js +1 -0
- package/.next/server/app/settings.html +1 -0
- package/.next/server/app/settings.meta +7 -0
- package/.next/server/app/settings.rsc +28 -0
- package/.next/server/app/workspace/[agentId]/page.js +2 -0
- package/.next/server/app/workspace/[agentId]/page.js.nft.json +1 -0
- package/.next/server/app/workspace/[agentId]/page_client-reference-manifest.js +1 -0
- package/.next/server/app-paths-manifest.json +22 -0
- package/.next/server/chunks/331.js +22 -0
- package/.next/server/chunks/416.js +1 -0
- package/.next/server/chunks/424.js +1 -0
- package/.next/server/chunks/448.js +1 -0
- package/.next/server/chunks/450.js +58 -0
- package/.next/server/chunks/487.js +1 -0
- package/.next/server/chunks/49.js +25 -0
- package/.next/server/chunks/611.js +6 -0
- package/.next/server/chunks/689.js +25 -0
- package/.next/server/chunks/692.js +1 -0
- package/.next/server/chunks/783.js +9 -0
- package/.next/server/edge-runtime-webpack.js +2 -0
- package/.next/server/edge-runtime-webpack.js.map +1 -0
- package/.next/server/functions-config-manifest.json +16 -0
- package/.next/server/interception-route-rewrite-manifest.js +1 -0
- package/.next/server/middleware-build-manifest.js +1 -0
- package/.next/server/middleware-manifest.json +32 -0
- package/.next/server/middleware-react-loadable-manifest.js +1 -0
- package/.next/server/next-font-manifest.js +1 -0
- package/.next/server/next-font-manifest.json +1 -0
- package/.next/server/pages/404.html +1 -0
- package/.next/server/pages/500.html +1 -0
- package/.next/server/pages/_app.js +1 -0
- package/.next/server/pages/_app.js.nft.json +1 -0
- package/.next/server/pages/_document.js +1 -0
- package/.next/server/pages/_document.js.nft.json +1 -0
- package/.next/server/pages/_error.js +19 -0
- package/.next/server/pages/_error.js.nft.json +1 -0
- package/.next/server/pages-manifest.json +6 -0
- package/.next/server/server-reference-manifest.js +1 -0
- package/.next/server/server-reference-manifest.json +1 -0
- package/.next/server/src/middleware.js +14 -0
- package/.next/server/src/middleware.js.map +1 -0
- package/.next/server/webpack-runtime.js +1 -0
- package/.next/static/chunks/229-80088ec0a56bae01.js +1 -0
- package/.next/static/chunks/255-98a0bdaa30757bda.js +1 -0
- package/.next/static/chunks/4bd1b696-c023c6e3521b1417.js +1 -0
- package/.next/static/chunks/554-d480e263fa018d32.js +1 -0
- package/.next/static/chunks/619-ba102abea3e3d0e4.js +1 -0
- package/.next/static/chunks/640-054fa4c37c444bf1.js +1 -0
- package/.next/static/chunks/930-cc10a778360bdc13.js +1 -0
- package/.next/static/chunks/969-cb9152dc8c78f0c1.js +1 -0
- package/.next/static/chunks/app/_not-found/page-a53529e6dd16c74a.js +1 -0
- package/.next/static/chunks/app/api/agents/route-29185e760ce819db.js +1 -0
- package/.next/static/chunks/app/api/config/route-29185e760ce819db.js +1 -0
- package/.next/static/chunks/app/api/marketplace/route-29185e760ce819db.js +1 -0
- package/.next/static/chunks/app/api/mcp/route-29185e760ce819db.js +1 -0
- package/.next/static/chunks/app/api/skills/action/route-29185e760ce819db.js +1 -0
- package/.next/static/chunks/app/api/skills/detail/route-29185e760ce819db.js +1 -0
- package/.next/static/chunks/app/api/skills/dups/route-29185e760ce819db.js +1 -0
- package/.next/static/chunks/app/api/skills/route-29185e760ce819db.js +1 -0
- package/.next/static/chunks/app/api/skills/updates/route-29185e760ce819db.js +1 -0
- package/.next/static/chunks/app/api/sync/route-29185e760ce819db.js +1 -0
- package/.next/static/chunks/app/api/tags/route-29185e760ce819db.js +1 -0
- package/.next/static/chunks/app/discover/page-1c885c8fb390303b.js +1 -0
- package/.next/static/chunks/app/error-12b42e5b1c0976b7.js +1 -0
- package/.next/static/chunks/app/layout-43f8d3b177484c28.js +1 -0
- package/.next/static/chunks/app/library/page-9f36412e45580d79.js +1 -0
- package/.next/static/chunks/app/marketplace/page-432e5bf10f261643.js +1 -0
- package/.next/static/chunks/app/mcp/page-28d0ccbed66b84bf.js +1 -0
- package/.next/static/chunks/app/page-29185e760ce819db.js +1 -0
- package/.next/static/chunks/app/parking/page-29185e760ce819db.js +1 -0
- package/.next/static/chunks/app/settings/page-3f27696f76844720.js +1 -0
- package/.next/static/chunks/app/workspace/[agentId]/page-13efdfaa0dbe480a.js +1 -0
- package/.next/static/chunks/framework-a6e0b7e30f98059a.js +1 -0
- package/.next/static/chunks/main-9c4a9f621ac18d27.js +1 -0
- package/.next/static/chunks/main-app-99c543bad473411d.js +1 -0
- package/.next/static/chunks/pages/_app-7d307437aca18ad4.js +1 -0
- package/.next/static/chunks/pages/_error-5e0018e2ff5b8770.js +1 -0
- package/.next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
- package/.next/static/chunks/webpack-94bcbc314710e256.js +1 -0
- package/.next/static/cr2XlaJXTckSW820Nw36M/_buildManifest.js +1 -0
- package/.next/static/cr2XlaJXTckSW820Nw36M/_ssgManifest.js +1 -0
- package/.next/static/css/80f1dbaf54d7087e.css +1 -0
- package/.next/static/css/b74ab9576f703ea0.css +3 -0
- package/.next/static/css/d5086ad7fdf3aa55.css +1 -0
- package/.next/static/media/014af09217ee0278-s.woff2 +0 -0
- package/.next/static/media/025390dff74c3fdc-s.woff2 +0 -0
- package/.next/static/media/030e15e537bde24c-s.woff2 +0 -0
- package/.next/static/media/03de48839c524ba8-s.woff2 +0 -0
- package/.next/static/media/042045403b28123e-s.woff2 +0 -0
- package/.next/static/media/08426c36a7e307c6-s.woff2 +0 -0
- package/.next/static/media/08e8c99375ab05cb-s.woff2 +0 -0
- package/.next/static/media/0cf2cd6db92e9068-s.woff2 +0 -0
- package/.next/static/media/0d948a7a3f6feae0-s.woff2 +0 -0
- package/.next/static/media/0daf8b93acb78d32-s.woff2 +0 -0
- package/.next/static/media/0eee9acaf21e9fe4-s.woff2 +0 -0
- package/.next/static/media/15cdf923782c87d7-s.woff2 +0 -0
- package/.next/static/media/182425b6bb045120-s.woff2 +0 -0
- package/.next/static/media/1ad50c5de43a9300-s.woff2 +0 -0
- package/.next/static/media/1cd350d5fca802aa-s.woff2 +0 -0
- package/.next/static/media/20a6009fd4276381-s.woff2 +0 -0
- package/.next/static/media/2167bfa77d1179d7-s.woff2 +0 -0
- package/.next/static/media/228aa8c8dd80a8bf-s.woff2 +0 -0
- package/.next/static/media/2921f019da32c9f1-s.woff2 +0 -0
- package/.next/static/media/29588cc61ecb44fd-s.woff2 +0 -0
- package/.next/static/media/2a18fc56c4401bc3-s.woff2 +0 -0
- package/.next/static/media/2b261e659b551a46-s.woff2 +0 -0
- package/.next/static/media/3131c862d4942660-s.woff2 +0 -0
- package/.next/static/media/33718844fb0798ef-s.woff2 +0 -0
- package/.next/static/media/3f4cbe0d03deb618-s.woff2 +0 -0
- package/.next/static/media/42c5d07f8867612a-s.woff2 +0 -0
- package/.next/static/media/49c029ab0f16fb83-s.woff2 +0 -0
- package/.next/static/media/4f45f843b1f557a7-s.woff2 +0 -0
- package/.next/static/media/51e1803f4d82eef9-s.woff2 +0 -0
- package/.next/static/media/590913eea6787df8-s.woff2 +0 -0
- package/.next/static/media/5dc441f2a12530d4-s.woff2 +0 -0
- package/.next/static/media/5e8c82762141c2b3-s.woff2 +0 -0
- package/.next/static/media/5ec6e9c9d97987a7-s.woff2 +0 -0
- package/.next/static/media/5fb10926b4ae7890-s.woff2 +0 -0
- package/.next/static/media/62854b5755ea73b2-s.woff2 +0 -0
- package/.next/static/media/659dc56157cb756c-s.woff2 +0 -0
- package/.next/static/media/69a6642b76e274cd-s.woff2 +0 -0
- package/.next/static/media/6a9c36ea9dc9b36b-s.woff2 +0 -0
- package/.next/static/media/71f33d7efe77f0b8-s.woff2 +0 -0
- package/.next/static/media/7637af4f10f4e9d5-s.woff2 +0 -0
- package/.next/static/media/7b66bc2c1e783782-s.woff2 +0 -0
- package/.next/static/media/7cb4467c9a94c0e4-s.woff2 +0 -0
- package/.next/static/media/8190c755b4f40895-s.woff2 +0 -0
- package/.next/static/media/8199babf11225de0-s.woff2 +0 -0
- package/.next/static/media/868edd7da6924777-s.woff2 +0 -0
- package/.next/static/media/88b4e2d36073058f-s.woff2 +0 -0
- package/.next/static/media/8d5d40d6b86f6852-s.woff2 +0 -0
- package/.next/static/media/8dbf4d3d38cb3dc8-s.woff2 +0 -0
- package/.next/static/media/8ee620fcc254cd2f-s.woff2 +0 -0
- package/.next/static/media/8feb00c7a0a3433e-s.woff2 +0 -0
- package/.next/static/media/913ebfcc6635f8a5-s.woff2 +0 -0
- package/.next/static/media/91a3b75b7ccdf51f-s.woff2 +0 -0
- package/.next/static/media/92c45324344dea6a-s.woff2 +0 -0
- package/.next/static/media/9644308abe0450c9-s.woff2 +0 -0
- package/.next/static/media/96b4b3bc70da457c-s.woff2 +0 -0
- package/.next/static/media/9c35993615b2a4c1-s.woff2 +0 -0
- package/.next/static/media/9e85ee50121d8019-s.woff2 +0 -0
- package/.next/static/media/a28a1e9cdee21412-s.woff2 +0 -0
- package/.next/static/media/a652df653ed9cbf2-s.woff2 +0 -0
- package/.next/static/media/a6610cca791c59c9-s.woff2 +0 -0
- package/.next/static/media/a6be31d2841346a1-s.woff2 +0 -0
- package/.next/static/media/a6e04eaecb47179d-s.woff2 +0 -0
- package/.next/static/media/a709b3f0e9e2575c-s.woff2 +0 -0
- package/.next/static/media/a83f19e07bdbc6c9-s.woff2 +0 -0
- package/.next/static/media/a977e0eec1edf7e6-s.woff2 +0 -0
- package/.next/static/media/abc0681c3caf3185-s.woff2 +0 -0
- package/.next/static/media/abfec168c8990f67-s.woff2 +0 -0
- package/.next/static/media/ad4f01c8bc474394-s.woff2 +0 -0
- package/.next/static/media/b31da9bd80ad22e9-s.woff2 +0 -0
- package/.next/static/media/b465fe72c6993d96-s.woff2 +0 -0
- package/.next/static/media/b53c1142b9136fe1-s.woff2 +0 -0
- package/.next/static/media/b71d9bacf9dff845-s.woff2 +0 -0
- package/.next/static/media/b911ba6d74ed3f89-s.woff2 +0 -0
- package/.next/static/media/bd2405d20e707e28-s.woff2 +0 -0
- package/.next/static/media/be2afef9721bdbc2-s.woff2 +0 -0
- package/.next/static/media/c05d3263514631d5-s.woff2 +0 -0
- package/.next/static/media/c27fdee414a630ac-s.woff2 +0 -0
- package/.next/static/media/c662d9058d0b304f-s.woff2 +0 -0
- package/.next/static/media/c6d60d432101ec18-s.woff2 +0 -0
- package/.next/static/media/c721587ed2835340-s.woff2 +0 -0
- package/.next/static/media/cc3fc13d58c9e8ca-s.woff2 +0 -0
- package/.next/static/media/ce63488d6ad40434-s.woff2 +0 -0
- package/.next/static/media/cf725a8ae48df54c-s.woff2 +0 -0
- package/.next/static/media/cfd80e3a45313785-s.woff2 +0 -0
- package/.next/static/media/d519191908c27654-s.woff2 +0 -0
- package/.next/static/media/ddbe497b6bdb7730-s.woff2 +0 -0
- package/.next/static/media/e1694c6cb47c173f-s.woff2 +0 -0
- package/.next/static/media/e2e9ce5bc8b07138-s.woff2 +0 -0
- package/.next/static/media/e704a099fc8b748e-s.woff2 +0 -0
- package/.next/static/media/e80f1613359a63a8-s.woff2 +0 -0
- package/.next/static/media/e9d7ba2f2e19ba4a-s.woff2 +0 -0
- package/.next/static/media/e9db5222de0e6610-s.woff2 +0 -0
- package/.next/static/media/edef1a271f97a8ec-s.p.woff2 +0 -0
- package/.next/static/media/ee40bb094c99a29a-s.p.woff2 +0 -0
- package/.next/static/media/f07aa0a11b14d610-s.woff2 +0 -0
- package/.next/static/media/f0c9fe70cba4762d-s.woff2 +0 -0
- package/.next/static/media/f592c30243f37849-s.woff2 +0 -0
- package/.next/static/media/f6a19faf021cbe49-s.woff2 +0 -0
- package/.next/static/media/f7efc23e3d14d27c-s.woff2 +0 -0
- package/.next/static/media/f95b22de292be729-s.woff2 +0 -0
- package/.next/static/media/fa8aac51b728ea7b-s.woff2 +0 -0
- package/.next/static/media/fdfb73cffcb1fb8b-s.woff2 +0 -0
- package/.next/static/media/fe697e6a5b784226-s.woff2 +0 -0
- package/.next/static/media/feee9e12ea9450c9-s.woff2 +0 -0
- package/.next/static/media/ff606ab945873cbd-s.woff2 +0 -0
- package/.next/static/media/ffd6b2f548dbe83e-s.woff2 +0 -0
- package/.next/trace +3 -0
- package/.next/types/app/api/agents/route.ts +347 -0
- package/.next/types/app/api/config/route.ts +347 -0
- package/.next/types/app/api/marketplace/route.ts +347 -0
- package/.next/types/app/api/mcp/route.ts +347 -0
- package/.next/types/app/api/skills/action/route.ts +347 -0
- package/.next/types/app/api/skills/detail/route.ts +347 -0
- package/.next/types/app/api/skills/dups/route.ts +347 -0
- package/.next/types/app/api/skills/route.ts +347 -0
- package/.next/types/app/api/skills/updates/route.ts +347 -0
- package/.next/types/app/api/sync/route.ts +347 -0
- package/.next/types/app/api/tags/route.ts +347 -0
- package/.next/types/app/discover/page.ts +84 -0
- package/.next/types/app/library/page.ts +84 -0
- package/.next/types/app/marketplace/page.ts +84 -0
- package/.next/types/app/mcp/page.ts +84 -0
- package/.next/types/app/page.ts +84 -0
- package/.next/types/app/parking/page.ts +84 -0
- package/.next/types/app/settings/page.ts +84 -0
- package/.next/types/app/workspace/[agentId]/page.ts +84 -0
- package/.next/types/cache-life.d.ts +141 -0
- package/.next/types/package.json +1 -0
- package/.next/types/routes.d.ts +90 -0
- package/.next/types/validator.ts +232 -0
- package/LICENSE +21 -0
- package/README.md +116 -0
- package/README.zh-CN.md +120 -0
- package/bin/cli.mjs +128 -0
- package/next.config.mjs +11 -0
- package/package.json +73 -0
- package/public/logos/antigravity-logo.png +0 -0
- package/public/logos/claude-logo.png +0 -0
- package/public/logos/codex-logo.png +0 -0
- package/public/logos/gemini-logo.png +0 -0
- package/public/logos/hermesagent-logo.png +0 -0
- package/public/logos/kimi-logo.png +0 -0
- package/public/logos/openclaw-logo.png +0 -0
- package/scripts/build-sandbox.mjs +117 -0
- package/scripts/prepare.mjs +27 -0
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
// File: /Users/yilialu/Developer/simple-skill-manager-public/src/app/api/sync/route.ts
|
|
2
|
+
import * as entry from '../../../../../src/app/api/sync/route.js'
|
|
3
|
+
import type { NextRequest } from 'next/server.js'
|
|
4
|
+
|
|
5
|
+
type TEntry = typeof import('../../../../../src/app/api/sync/route.js')
|
|
6
|
+
|
|
7
|
+
type SegmentParams<T extends Object = any> = T extends Record<string, any>
|
|
8
|
+
? { [K in keyof T]: T[K] extends string ? string | string[] | undefined : never }
|
|
9
|
+
: T
|
|
10
|
+
|
|
11
|
+
// Check that the entry is a valid entry
|
|
12
|
+
checkFields<Diff<{
|
|
13
|
+
GET?: Function
|
|
14
|
+
HEAD?: Function
|
|
15
|
+
OPTIONS?: Function
|
|
16
|
+
POST?: Function
|
|
17
|
+
PUT?: Function
|
|
18
|
+
DELETE?: Function
|
|
19
|
+
PATCH?: Function
|
|
20
|
+
config?: {}
|
|
21
|
+
generateStaticParams?: Function
|
|
22
|
+
revalidate?: RevalidateRange<TEntry> | false
|
|
23
|
+
dynamic?: 'auto' | 'force-dynamic' | 'error' | 'force-static'
|
|
24
|
+
dynamicParams?: boolean
|
|
25
|
+
fetchCache?: 'auto' | 'force-no-store' | 'only-no-store' | 'default-no-store' | 'default-cache' | 'only-cache' | 'force-cache'
|
|
26
|
+
preferredRegion?: 'auto' | 'global' | 'home' | string | string[]
|
|
27
|
+
runtime?: 'nodejs' | 'experimental-edge' | 'edge'
|
|
28
|
+
maxDuration?: number
|
|
29
|
+
|
|
30
|
+
}, TEntry, ''>>()
|
|
31
|
+
|
|
32
|
+
type RouteContext = { params: Promise<SegmentParams> }
|
|
33
|
+
// Check the prop type of the entry function
|
|
34
|
+
if ('GET' in entry) {
|
|
35
|
+
checkFields<
|
|
36
|
+
Diff<
|
|
37
|
+
ParamCheck<Request | NextRequest>,
|
|
38
|
+
{
|
|
39
|
+
__tag__: 'GET'
|
|
40
|
+
__param_position__: 'first'
|
|
41
|
+
__param_type__: FirstArg<MaybeField<TEntry, 'GET'>>
|
|
42
|
+
},
|
|
43
|
+
'GET'
|
|
44
|
+
>
|
|
45
|
+
>()
|
|
46
|
+
checkFields<
|
|
47
|
+
Diff<
|
|
48
|
+
ParamCheck<RouteContext>,
|
|
49
|
+
{
|
|
50
|
+
__tag__: 'GET'
|
|
51
|
+
__param_position__: 'second'
|
|
52
|
+
__param_type__: SecondArg<MaybeField<TEntry, 'GET'>>
|
|
53
|
+
},
|
|
54
|
+
'GET'
|
|
55
|
+
>
|
|
56
|
+
>()
|
|
57
|
+
|
|
58
|
+
checkFields<
|
|
59
|
+
Diff<
|
|
60
|
+
{
|
|
61
|
+
__tag__: 'GET',
|
|
62
|
+
__return_type__: Response | void | never | Promise<Response | void | never>
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
__tag__: 'GET',
|
|
66
|
+
__return_type__: ReturnType<MaybeField<TEntry, 'GET'>>
|
|
67
|
+
},
|
|
68
|
+
'GET'
|
|
69
|
+
>
|
|
70
|
+
>()
|
|
71
|
+
}
|
|
72
|
+
// Check the prop type of the entry function
|
|
73
|
+
if ('HEAD' in entry) {
|
|
74
|
+
checkFields<
|
|
75
|
+
Diff<
|
|
76
|
+
ParamCheck<Request | NextRequest>,
|
|
77
|
+
{
|
|
78
|
+
__tag__: 'HEAD'
|
|
79
|
+
__param_position__: 'first'
|
|
80
|
+
__param_type__: FirstArg<MaybeField<TEntry, 'HEAD'>>
|
|
81
|
+
},
|
|
82
|
+
'HEAD'
|
|
83
|
+
>
|
|
84
|
+
>()
|
|
85
|
+
checkFields<
|
|
86
|
+
Diff<
|
|
87
|
+
ParamCheck<RouteContext>,
|
|
88
|
+
{
|
|
89
|
+
__tag__: 'HEAD'
|
|
90
|
+
__param_position__: 'second'
|
|
91
|
+
__param_type__: SecondArg<MaybeField<TEntry, 'HEAD'>>
|
|
92
|
+
},
|
|
93
|
+
'HEAD'
|
|
94
|
+
>
|
|
95
|
+
>()
|
|
96
|
+
|
|
97
|
+
checkFields<
|
|
98
|
+
Diff<
|
|
99
|
+
{
|
|
100
|
+
__tag__: 'HEAD',
|
|
101
|
+
__return_type__: Response | void | never | Promise<Response | void | never>
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
__tag__: 'HEAD',
|
|
105
|
+
__return_type__: ReturnType<MaybeField<TEntry, 'HEAD'>>
|
|
106
|
+
},
|
|
107
|
+
'HEAD'
|
|
108
|
+
>
|
|
109
|
+
>()
|
|
110
|
+
}
|
|
111
|
+
// Check the prop type of the entry function
|
|
112
|
+
if ('OPTIONS' in entry) {
|
|
113
|
+
checkFields<
|
|
114
|
+
Diff<
|
|
115
|
+
ParamCheck<Request | NextRequest>,
|
|
116
|
+
{
|
|
117
|
+
__tag__: 'OPTIONS'
|
|
118
|
+
__param_position__: 'first'
|
|
119
|
+
__param_type__: FirstArg<MaybeField<TEntry, 'OPTIONS'>>
|
|
120
|
+
},
|
|
121
|
+
'OPTIONS'
|
|
122
|
+
>
|
|
123
|
+
>()
|
|
124
|
+
checkFields<
|
|
125
|
+
Diff<
|
|
126
|
+
ParamCheck<RouteContext>,
|
|
127
|
+
{
|
|
128
|
+
__tag__: 'OPTIONS'
|
|
129
|
+
__param_position__: 'second'
|
|
130
|
+
__param_type__: SecondArg<MaybeField<TEntry, 'OPTIONS'>>
|
|
131
|
+
},
|
|
132
|
+
'OPTIONS'
|
|
133
|
+
>
|
|
134
|
+
>()
|
|
135
|
+
|
|
136
|
+
checkFields<
|
|
137
|
+
Diff<
|
|
138
|
+
{
|
|
139
|
+
__tag__: 'OPTIONS',
|
|
140
|
+
__return_type__: Response | void | never | Promise<Response | void | never>
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
__tag__: 'OPTIONS',
|
|
144
|
+
__return_type__: ReturnType<MaybeField<TEntry, 'OPTIONS'>>
|
|
145
|
+
},
|
|
146
|
+
'OPTIONS'
|
|
147
|
+
>
|
|
148
|
+
>()
|
|
149
|
+
}
|
|
150
|
+
// Check the prop type of the entry function
|
|
151
|
+
if ('POST' in entry) {
|
|
152
|
+
checkFields<
|
|
153
|
+
Diff<
|
|
154
|
+
ParamCheck<Request | NextRequest>,
|
|
155
|
+
{
|
|
156
|
+
__tag__: 'POST'
|
|
157
|
+
__param_position__: 'first'
|
|
158
|
+
__param_type__: FirstArg<MaybeField<TEntry, 'POST'>>
|
|
159
|
+
},
|
|
160
|
+
'POST'
|
|
161
|
+
>
|
|
162
|
+
>()
|
|
163
|
+
checkFields<
|
|
164
|
+
Diff<
|
|
165
|
+
ParamCheck<RouteContext>,
|
|
166
|
+
{
|
|
167
|
+
__tag__: 'POST'
|
|
168
|
+
__param_position__: 'second'
|
|
169
|
+
__param_type__: SecondArg<MaybeField<TEntry, 'POST'>>
|
|
170
|
+
},
|
|
171
|
+
'POST'
|
|
172
|
+
>
|
|
173
|
+
>()
|
|
174
|
+
|
|
175
|
+
checkFields<
|
|
176
|
+
Diff<
|
|
177
|
+
{
|
|
178
|
+
__tag__: 'POST',
|
|
179
|
+
__return_type__: Response | void | never | Promise<Response | void | never>
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
__tag__: 'POST',
|
|
183
|
+
__return_type__: ReturnType<MaybeField<TEntry, 'POST'>>
|
|
184
|
+
},
|
|
185
|
+
'POST'
|
|
186
|
+
>
|
|
187
|
+
>()
|
|
188
|
+
}
|
|
189
|
+
// Check the prop type of the entry function
|
|
190
|
+
if ('PUT' in entry) {
|
|
191
|
+
checkFields<
|
|
192
|
+
Diff<
|
|
193
|
+
ParamCheck<Request | NextRequest>,
|
|
194
|
+
{
|
|
195
|
+
__tag__: 'PUT'
|
|
196
|
+
__param_position__: 'first'
|
|
197
|
+
__param_type__: FirstArg<MaybeField<TEntry, 'PUT'>>
|
|
198
|
+
},
|
|
199
|
+
'PUT'
|
|
200
|
+
>
|
|
201
|
+
>()
|
|
202
|
+
checkFields<
|
|
203
|
+
Diff<
|
|
204
|
+
ParamCheck<RouteContext>,
|
|
205
|
+
{
|
|
206
|
+
__tag__: 'PUT'
|
|
207
|
+
__param_position__: 'second'
|
|
208
|
+
__param_type__: SecondArg<MaybeField<TEntry, 'PUT'>>
|
|
209
|
+
},
|
|
210
|
+
'PUT'
|
|
211
|
+
>
|
|
212
|
+
>()
|
|
213
|
+
|
|
214
|
+
checkFields<
|
|
215
|
+
Diff<
|
|
216
|
+
{
|
|
217
|
+
__tag__: 'PUT',
|
|
218
|
+
__return_type__: Response | void | never | Promise<Response | void | never>
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
__tag__: 'PUT',
|
|
222
|
+
__return_type__: ReturnType<MaybeField<TEntry, 'PUT'>>
|
|
223
|
+
},
|
|
224
|
+
'PUT'
|
|
225
|
+
>
|
|
226
|
+
>()
|
|
227
|
+
}
|
|
228
|
+
// Check the prop type of the entry function
|
|
229
|
+
if ('DELETE' in entry) {
|
|
230
|
+
checkFields<
|
|
231
|
+
Diff<
|
|
232
|
+
ParamCheck<Request | NextRequest>,
|
|
233
|
+
{
|
|
234
|
+
__tag__: 'DELETE'
|
|
235
|
+
__param_position__: 'first'
|
|
236
|
+
__param_type__: FirstArg<MaybeField<TEntry, 'DELETE'>>
|
|
237
|
+
},
|
|
238
|
+
'DELETE'
|
|
239
|
+
>
|
|
240
|
+
>()
|
|
241
|
+
checkFields<
|
|
242
|
+
Diff<
|
|
243
|
+
ParamCheck<RouteContext>,
|
|
244
|
+
{
|
|
245
|
+
__tag__: 'DELETE'
|
|
246
|
+
__param_position__: 'second'
|
|
247
|
+
__param_type__: SecondArg<MaybeField<TEntry, 'DELETE'>>
|
|
248
|
+
},
|
|
249
|
+
'DELETE'
|
|
250
|
+
>
|
|
251
|
+
>()
|
|
252
|
+
|
|
253
|
+
checkFields<
|
|
254
|
+
Diff<
|
|
255
|
+
{
|
|
256
|
+
__tag__: 'DELETE',
|
|
257
|
+
__return_type__: Response | void | never | Promise<Response | void | never>
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
__tag__: 'DELETE',
|
|
261
|
+
__return_type__: ReturnType<MaybeField<TEntry, 'DELETE'>>
|
|
262
|
+
},
|
|
263
|
+
'DELETE'
|
|
264
|
+
>
|
|
265
|
+
>()
|
|
266
|
+
}
|
|
267
|
+
// Check the prop type of the entry function
|
|
268
|
+
if ('PATCH' in entry) {
|
|
269
|
+
checkFields<
|
|
270
|
+
Diff<
|
|
271
|
+
ParamCheck<Request | NextRequest>,
|
|
272
|
+
{
|
|
273
|
+
__tag__: 'PATCH'
|
|
274
|
+
__param_position__: 'first'
|
|
275
|
+
__param_type__: FirstArg<MaybeField<TEntry, 'PATCH'>>
|
|
276
|
+
},
|
|
277
|
+
'PATCH'
|
|
278
|
+
>
|
|
279
|
+
>()
|
|
280
|
+
checkFields<
|
|
281
|
+
Diff<
|
|
282
|
+
ParamCheck<RouteContext>,
|
|
283
|
+
{
|
|
284
|
+
__tag__: 'PATCH'
|
|
285
|
+
__param_position__: 'second'
|
|
286
|
+
__param_type__: SecondArg<MaybeField<TEntry, 'PATCH'>>
|
|
287
|
+
},
|
|
288
|
+
'PATCH'
|
|
289
|
+
>
|
|
290
|
+
>()
|
|
291
|
+
|
|
292
|
+
checkFields<
|
|
293
|
+
Diff<
|
|
294
|
+
{
|
|
295
|
+
__tag__: 'PATCH',
|
|
296
|
+
__return_type__: Response | void | never | Promise<Response | void | never>
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
__tag__: 'PATCH',
|
|
300
|
+
__return_type__: ReturnType<MaybeField<TEntry, 'PATCH'>>
|
|
301
|
+
},
|
|
302
|
+
'PATCH'
|
|
303
|
+
>
|
|
304
|
+
>()
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// Check the arguments and return type of the generateStaticParams function
|
|
308
|
+
if ('generateStaticParams' in entry) {
|
|
309
|
+
checkFields<Diff<{ params: SegmentParams }, FirstArg<MaybeField<TEntry, 'generateStaticParams'>>, 'generateStaticParams'>>()
|
|
310
|
+
checkFields<Diff<{ __tag__: 'generateStaticParams', __return_type__: any[] | Promise<any[]> }, { __tag__: 'generateStaticParams', __return_type__: ReturnType<MaybeField<TEntry, 'generateStaticParams'>> }>>()
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
export interface PageProps {
|
|
314
|
+
params?: Promise<SegmentParams>
|
|
315
|
+
searchParams?: Promise<any>
|
|
316
|
+
}
|
|
317
|
+
export interface LayoutProps {
|
|
318
|
+
children?: React.ReactNode
|
|
319
|
+
|
|
320
|
+
params?: Promise<SegmentParams>
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
// =============
|
|
324
|
+
// Utility types
|
|
325
|
+
type RevalidateRange<T> = T extends { revalidate: any } ? NonNegative<T['revalidate']> : never
|
|
326
|
+
|
|
327
|
+
// If T is unknown or any, it will be an empty {} type. Otherwise, it will be the same as Omit<T, keyof Base>.
|
|
328
|
+
type OmitWithTag<T, K extends keyof any, _M> = Omit<T, K>
|
|
329
|
+
type Diff<Base, T extends Base, Message extends string = ''> = 0 extends (1 & T) ? {} : OmitWithTag<T, keyof Base, Message>
|
|
330
|
+
|
|
331
|
+
type FirstArg<T extends Function> = T extends (...args: [infer T, any]) => any ? unknown extends T ? any : T : never
|
|
332
|
+
type SecondArg<T extends Function> = T extends (...args: [any, infer T]) => any ? unknown extends T ? any : T : never
|
|
333
|
+
type MaybeField<T, K extends string> = T extends { [k in K]: infer G } ? G extends Function ? G : never : never
|
|
334
|
+
|
|
335
|
+
type ParamCheck<T> = {
|
|
336
|
+
__tag__: string
|
|
337
|
+
__param_position__: string
|
|
338
|
+
__param_type__: T
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
function checkFields<_ extends { [k in keyof any]: never }>() {}
|
|
342
|
+
|
|
343
|
+
// https://github.com/sindresorhus/type-fest
|
|
344
|
+
type Numeric = number | bigint
|
|
345
|
+
type Zero = 0 | 0n
|
|
346
|
+
type Negative<T extends Numeric> = T extends Zero ? never : `${T}` extends `-${string}` ? T : never
|
|
347
|
+
type NonNegative<T extends Numeric> = T extends Zero ? T : Negative<T> extends never ? T : '__invalid_negative_number__'
|
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
// File: /Users/yilialu/Developer/simple-skill-manager-public/src/app/api/tags/route.ts
|
|
2
|
+
import * as entry from '../../../../../src/app/api/tags/route.js'
|
|
3
|
+
import type { NextRequest } from 'next/server.js'
|
|
4
|
+
|
|
5
|
+
type TEntry = typeof import('../../../../../src/app/api/tags/route.js')
|
|
6
|
+
|
|
7
|
+
type SegmentParams<T extends Object = any> = T extends Record<string, any>
|
|
8
|
+
? { [K in keyof T]: T[K] extends string ? string | string[] | undefined : never }
|
|
9
|
+
: T
|
|
10
|
+
|
|
11
|
+
// Check that the entry is a valid entry
|
|
12
|
+
checkFields<Diff<{
|
|
13
|
+
GET?: Function
|
|
14
|
+
HEAD?: Function
|
|
15
|
+
OPTIONS?: Function
|
|
16
|
+
POST?: Function
|
|
17
|
+
PUT?: Function
|
|
18
|
+
DELETE?: Function
|
|
19
|
+
PATCH?: Function
|
|
20
|
+
config?: {}
|
|
21
|
+
generateStaticParams?: Function
|
|
22
|
+
revalidate?: RevalidateRange<TEntry> | false
|
|
23
|
+
dynamic?: 'auto' | 'force-dynamic' | 'error' | 'force-static'
|
|
24
|
+
dynamicParams?: boolean
|
|
25
|
+
fetchCache?: 'auto' | 'force-no-store' | 'only-no-store' | 'default-no-store' | 'default-cache' | 'only-cache' | 'force-cache'
|
|
26
|
+
preferredRegion?: 'auto' | 'global' | 'home' | string | string[]
|
|
27
|
+
runtime?: 'nodejs' | 'experimental-edge' | 'edge'
|
|
28
|
+
maxDuration?: number
|
|
29
|
+
|
|
30
|
+
}, TEntry, ''>>()
|
|
31
|
+
|
|
32
|
+
type RouteContext = { params: Promise<SegmentParams> }
|
|
33
|
+
// Check the prop type of the entry function
|
|
34
|
+
if ('GET' in entry) {
|
|
35
|
+
checkFields<
|
|
36
|
+
Diff<
|
|
37
|
+
ParamCheck<Request | NextRequest>,
|
|
38
|
+
{
|
|
39
|
+
__tag__: 'GET'
|
|
40
|
+
__param_position__: 'first'
|
|
41
|
+
__param_type__: FirstArg<MaybeField<TEntry, 'GET'>>
|
|
42
|
+
},
|
|
43
|
+
'GET'
|
|
44
|
+
>
|
|
45
|
+
>()
|
|
46
|
+
checkFields<
|
|
47
|
+
Diff<
|
|
48
|
+
ParamCheck<RouteContext>,
|
|
49
|
+
{
|
|
50
|
+
__tag__: 'GET'
|
|
51
|
+
__param_position__: 'second'
|
|
52
|
+
__param_type__: SecondArg<MaybeField<TEntry, 'GET'>>
|
|
53
|
+
},
|
|
54
|
+
'GET'
|
|
55
|
+
>
|
|
56
|
+
>()
|
|
57
|
+
|
|
58
|
+
checkFields<
|
|
59
|
+
Diff<
|
|
60
|
+
{
|
|
61
|
+
__tag__: 'GET',
|
|
62
|
+
__return_type__: Response | void | never | Promise<Response | void | never>
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
__tag__: 'GET',
|
|
66
|
+
__return_type__: ReturnType<MaybeField<TEntry, 'GET'>>
|
|
67
|
+
},
|
|
68
|
+
'GET'
|
|
69
|
+
>
|
|
70
|
+
>()
|
|
71
|
+
}
|
|
72
|
+
// Check the prop type of the entry function
|
|
73
|
+
if ('HEAD' in entry) {
|
|
74
|
+
checkFields<
|
|
75
|
+
Diff<
|
|
76
|
+
ParamCheck<Request | NextRequest>,
|
|
77
|
+
{
|
|
78
|
+
__tag__: 'HEAD'
|
|
79
|
+
__param_position__: 'first'
|
|
80
|
+
__param_type__: FirstArg<MaybeField<TEntry, 'HEAD'>>
|
|
81
|
+
},
|
|
82
|
+
'HEAD'
|
|
83
|
+
>
|
|
84
|
+
>()
|
|
85
|
+
checkFields<
|
|
86
|
+
Diff<
|
|
87
|
+
ParamCheck<RouteContext>,
|
|
88
|
+
{
|
|
89
|
+
__tag__: 'HEAD'
|
|
90
|
+
__param_position__: 'second'
|
|
91
|
+
__param_type__: SecondArg<MaybeField<TEntry, 'HEAD'>>
|
|
92
|
+
},
|
|
93
|
+
'HEAD'
|
|
94
|
+
>
|
|
95
|
+
>()
|
|
96
|
+
|
|
97
|
+
checkFields<
|
|
98
|
+
Diff<
|
|
99
|
+
{
|
|
100
|
+
__tag__: 'HEAD',
|
|
101
|
+
__return_type__: Response | void | never | Promise<Response | void | never>
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
__tag__: 'HEAD',
|
|
105
|
+
__return_type__: ReturnType<MaybeField<TEntry, 'HEAD'>>
|
|
106
|
+
},
|
|
107
|
+
'HEAD'
|
|
108
|
+
>
|
|
109
|
+
>()
|
|
110
|
+
}
|
|
111
|
+
// Check the prop type of the entry function
|
|
112
|
+
if ('OPTIONS' in entry) {
|
|
113
|
+
checkFields<
|
|
114
|
+
Diff<
|
|
115
|
+
ParamCheck<Request | NextRequest>,
|
|
116
|
+
{
|
|
117
|
+
__tag__: 'OPTIONS'
|
|
118
|
+
__param_position__: 'first'
|
|
119
|
+
__param_type__: FirstArg<MaybeField<TEntry, 'OPTIONS'>>
|
|
120
|
+
},
|
|
121
|
+
'OPTIONS'
|
|
122
|
+
>
|
|
123
|
+
>()
|
|
124
|
+
checkFields<
|
|
125
|
+
Diff<
|
|
126
|
+
ParamCheck<RouteContext>,
|
|
127
|
+
{
|
|
128
|
+
__tag__: 'OPTIONS'
|
|
129
|
+
__param_position__: 'second'
|
|
130
|
+
__param_type__: SecondArg<MaybeField<TEntry, 'OPTIONS'>>
|
|
131
|
+
},
|
|
132
|
+
'OPTIONS'
|
|
133
|
+
>
|
|
134
|
+
>()
|
|
135
|
+
|
|
136
|
+
checkFields<
|
|
137
|
+
Diff<
|
|
138
|
+
{
|
|
139
|
+
__tag__: 'OPTIONS',
|
|
140
|
+
__return_type__: Response | void | never | Promise<Response | void | never>
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
__tag__: 'OPTIONS',
|
|
144
|
+
__return_type__: ReturnType<MaybeField<TEntry, 'OPTIONS'>>
|
|
145
|
+
},
|
|
146
|
+
'OPTIONS'
|
|
147
|
+
>
|
|
148
|
+
>()
|
|
149
|
+
}
|
|
150
|
+
// Check the prop type of the entry function
|
|
151
|
+
if ('POST' in entry) {
|
|
152
|
+
checkFields<
|
|
153
|
+
Diff<
|
|
154
|
+
ParamCheck<Request | NextRequest>,
|
|
155
|
+
{
|
|
156
|
+
__tag__: 'POST'
|
|
157
|
+
__param_position__: 'first'
|
|
158
|
+
__param_type__: FirstArg<MaybeField<TEntry, 'POST'>>
|
|
159
|
+
},
|
|
160
|
+
'POST'
|
|
161
|
+
>
|
|
162
|
+
>()
|
|
163
|
+
checkFields<
|
|
164
|
+
Diff<
|
|
165
|
+
ParamCheck<RouteContext>,
|
|
166
|
+
{
|
|
167
|
+
__tag__: 'POST'
|
|
168
|
+
__param_position__: 'second'
|
|
169
|
+
__param_type__: SecondArg<MaybeField<TEntry, 'POST'>>
|
|
170
|
+
},
|
|
171
|
+
'POST'
|
|
172
|
+
>
|
|
173
|
+
>()
|
|
174
|
+
|
|
175
|
+
checkFields<
|
|
176
|
+
Diff<
|
|
177
|
+
{
|
|
178
|
+
__tag__: 'POST',
|
|
179
|
+
__return_type__: Response | void | never | Promise<Response | void | never>
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
__tag__: 'POST',
|
|
183
|
+
__return_type__: ReturnType<MaybeField<TEntry, 'POST'>>
|
|
184
|
+
},
|
|
185
|
+
'POST'
|
|
186
|
+
>
|
|
187
|
+
>()
|
|
188
|
+
}
|
|
189
|
+
// Check the prop type of the entry function
|
|
190
|
+
if ('PUT' in entry) {
|
|
191
|
+
checkFields<
|
|
192
|
+
Diff<
|
|
193
|
+
ParamCheck<Request | NextRequest>,
|
|
194
|
+
{
|
|
195
|
+
__tag__: 'PUT'
|
|
196
|
+
__param_position__: 'first'
|
|
197
|
+
__param_type__: FirstArg<MaybeField<TEntry, 'PUT'>>
|
|
198
|
+
},
|
|
199
|
+
'PUT'
|
|
200
|
+
>
|
|
201
|
+
>()
|
|
202
|
+
checkFields<
|
|
203
|
+
Diff<
|
|
204
|
+
ParamCheck<RouteContext>,
|
|
205
|
+
{
|
|
206
|
+
__tag__: 'PUT'
|
|
207
|
+
__param_position__: 'second'
|
|
208
|
+
__param_type__: SecondArg<MaybeField<TEntry, 'PUT'>>
|
|
209
|
+
},
|
|
210
|
+
'PUT'
|
|
211
|
+
>
|
|
212
|
+
>()
|
|
213
|
+
|
|
214
|
+
checkFields<
|
|
215
|
+
Diff<
|
|
216
|
+
{
|
|
217
|
+
__tag__: 'PUT',
|
|
218
|
+
__return_type__: Response | void | never | Promise<Response | void | never>
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
__tag__: 'PUT',
|
|
222
|
+
__return_type__: ReturnType<MaybeField<TEntry, 'PUT'>>
|
|
223
|
+
},
|
|
224
|
+
'PUT'
|
|
225
|
+
>
|
|
226
|
+
>()
|
|
227
|
+
}
|
|
228
|
+
// Check the prop type of the entry function
|
|
229
|
+
if ('DELETE' in entry) {
|
|
230
|
+
checkFields<
|
|
231
|
+
Diff<
|
|
232
|
+
ParamCheck<Request | NextRequest>,
|
|
233
|
+
{
|
|
234
|
+
__tag__: 'DELETE'
|
|
235
|
+
__param_position__: 'first'
|
|
236
|
+
__param_type__: FirstArg<MaybeField<TEntry, 'DELETE'>>
|
|
237
|
+
},
|
|
238
|
+
'DELETE'
|
|
239
|
+
>
|
|
240
|
+
>()
|
|
241
|
+
checkFields<
|
|
242
|
+
Diff<
|
|
243
|
+
ParamCheck<RouteContext>,
|
|
244
|
+
{
|
|
245
|
+
__tag__: 'DELETE'
|
|
246
|
+
__param_position__: 'second'
|
|
247
|
+
__param_type__: SecondArg<MaybeField<TEntry, 'DELETE'>>
|
|
248
|
+
},
|
|
249
|
+
'DELETE'
|
|
250
|
+
>
|
|
251
|
+
>()
|
|
252
|
+
|
|
253
|
+
checkFields<
|
|
254
|
+
Diff<
|
|
255
|
+
{
|
|
256
|
+
__tag__: 'DELETE',
|
|
257
|
+
__return_type__: Response | void | never | Promise<Response | void | never>
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
__tag__: 'DELETE',
|
|
261
|
+
__return_type__: ReturnType<MaybeField<TEntry, 'DELETE'>>
|
|
262
|
+
},
|
|
263
|
+
'DELETE'
|
|
264
|
+
>
|
|
265
|
+
>()
|
|
266
|
+
}
|
|
267
|
+
// Check the prop type of the entry function
|
|
268
|
+
if ('PATCH' in entry) {
|
|
269
|
+
checkFields<
|
|
270
|
+
Diff<
|
|
271
|
+
ParamCheck<Request | NextRequest>,
|
|
272
|
+
{
|
|
273
|
+
__tag__: 'PATCH'
|
|
274
|
+
__param_position__: 'first'
|
|
275
|
+
__param_type__: FirstArg<MaybeField<TEntry, 'PATCH'>>
|
|
276
|
+
},
|
|
277
|
+
'PATCH'
|
|
278
|
+
>
|
|
279
|
+
>()
|
|
280
|
+
checkFields<
|
|
281
|
+
Diff<
|
|
282
|
+
ParamCheck<RouteContext>,
|
|
283
|
+
{
|
|
284
|
+
__tag__: 'PATCH'
|
|
285
|
+
__param_position__: 'second'
|
|
286
|
+
__param_type__: SecondArg<MaybeField<TEntry, 'PATCH'>>
|
|
287
|
+
},
|
|
288
|
+
'PATCH'
|
|
289
|
+
>
|
|
290
|
+
>()
|
|
291
|
+
|
|
292
|
+
checkFields<
|
|
293
|
+
Diff<
|
|
294
|
+
{
|
|
295
|
+
__tag__: 'PATCH',
|
|
296
|
+
__return_type__: Response | void | never | Promise<Response | void | never>
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
__tag__: 'PATCH',
|
|
300
|
+
__return_type__: ReturnType<MaybeField<TEntry, 'PATCH'>>
|
|
301
|
+
},
|
|
302
|
+
'PATCH'
|
|
303
|
+
>
|
|
304
|
+
>()
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// Check the arguments and return type of the generateStaticParams function
|
|
308
|
+
if ('generateStaticParams' in entry) {
|
|
309
|
+
checkFields<Diff<{ params: SegmentParams }, FirstArg<MaybeField<TEntry, 'generateStaticParams'>>, 'generateStaticParams'>>()
|
|
310
|
+
checkFields<Diff<{ __tag__: 'generateStaticParams', __return_type__: any[] | Promise<any[]> }, { __tag__: 'generateStaticParams', __return_type__: ReturnType<MaybeField<TEntry, 'generateStaticParams'>> }>>()
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
export interface PageProps {
|
|
314
|
+
params?: Promise<SegmentParams>
|
|
315
|
+
searchParams?: Promise<any>
|
|
316
|
+
}
|
|
317
|
+
export interface LayoutProps {
|
|
318
|
+
children?: React.ReactNode
|
|
319
|
+
|
|
320
|
+
params?: Promise<SegmentParams>
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
// =============
|
|
324
|
+
// Utility types
|
|
325
|
+
type RevalidateRange<T> = T extends { revalidate: any } ? NonNegative<T['revalidate']> : never
|
|
326
|
+
|
|
327
|
+
// If T is unknown or any, it will be an empty {} type. Otherwise, it will be the same as Omit<T, keyof Base>.
|
|
328
|
+
type OmitWithTag<T, K extends keyof any, _M> = Omit<T, K>
|
|
329
|
+
type Diff<Base, T extends Base, Message extends string = ''> = 0 extends (1 & T) ? {} : OmitWithTag<T, keyof Base, Message>
|
|
330
|
+
|
|
331
|
+
type FirstArg<T extends Function> = T extends (...args: [infer T, any]) => any ? unknown extends T ? any : T : never
|
|
332
|
+
type SecondArg<T extends Function> = T extends (...args: [any, infer T]) => any ? unknown extends T ? any : T : never
|
|
333
|
+
type MaybeField<T, K extends string> = T extends { [k in K]: infer G } ? G extends Function ? G : never : never
|
|
334
|
+
|
|
335
|
+
type ParamCheck<T> = {
|
|
336
|
+
__tag__: string
|
|
337
|
+
__param_position__: string
|
|
338
|
+
__param_type__: T
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
function checkFields<_ extends { [k in keyof any]: never }>() {}
|
|
342
|
+
|
|
343
|
+
// https://github.com/sindresorhus/type-fest
|
|
344
|
+
type Numeric = number | bigint
|
|
345
|
+
type Zero = 0 | 0n
|
|
346
|
+
type Negative<T extends Numeric> = T extends Zero ? never : `${T}` extends `-${string}` ? T : never
|
|
347
|
+
type NonNegative<T extends Numeric> = T extends Zero ? T : Negative<T> extends never ? T : '__invalid_negative_number__'
|