agent-connect 1.0.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 +26 -0
- package/.next/app-path-routes-manifest.json +1 -0
- package/.next/build-manifest.json +32 -0
- package/.next/export-marker.json +1 -0
- package/.next/images-manifest.json +1 -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.js +1 -0
- package/.next/prerender-manifest.json +1 -0
- package/.next/react-loadable-manifest.json +1 -0
- package/.next/required-server-files.json +1 -0
- package/.next/routes-manifest.json +1 -0
- package/.next/server/app/_not-found/page.js +1 -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 +6 -0
- package/.next/server/app/_not-found.rsc +9 -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/notify/route.js +4 -0
- package/.next/server/app/api/notify/route.js.nft.json +1 -0
- package/.next/server/app/api/proxy/[...path]/route.js +1 -0
- package/.next/server/app/api/proxy/[...path]/route.js.nft.json +1 -0
- package/.next/server/app/api/subscribe/route.js +1 -0
- package/.next/server/app/api/subscribe/route.js.nft.json +1 -0
- package/.next/server/app/api/unsubscribe/route.js +1 -0
- package/.next/server/app/api/unsubscribe/route.js.nft.json +1 -0
- package/.next/server/app/index.html +3 -0
- package/.next/server/app/index.meta +5 -0
- package/.next/server/app/index.rsc +7 -0
- package/.next/server/app/page.js +3 -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-paths-manifest.json +9 -0
- package/.next/server/chunks/471.js +2 -0
- package/.next/server/chunks/682.js +6 -0
- package/.next/server/chunks/948.js +2 -0
- package/.next/server/chunks/972.js +12 -0
- package/.next/server/chunks/font-manifest.json +1 -0
- package/.next/server/font-manifest.json +1 -0
- package/.next/server/functions-config-manifest.json +1 -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 +6 -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 +1 -0
- package/.next/server/pages/_error.js.nft.json +1 -0
- package/.next/server/pages-manifest.json +1 -0
- package/.next/server/server-reference-manifest.js +1 -0
- package/.next/server/server-reference-manifest.json +1 -0
- package/.next/server/webpack-runtime.js +1 -0
- package/.next/static/chunks/23-effea5b940252795.js +2 -0
- package/.next/static/chunks/app/_not-found/page-94c683a891433c6f.js +1 -0
- package/.next/static/chunks/app/layout-9a44cf92d0cc38f4.js +1 -0
- package/.next/static/chunks/app/page-21abf84ee85e2de6.js +1 -0
- package/.next/static/chunks/fd9d1056-62aaf4b921c84028.js +1 -0
- package/.next/static/chunks/framework-f66176bb897dc684.js +33 -0
- package/.next/static/chunks/main-476fa195f30b59a4.js +1 -0
- package/.next/static/chunks/main-app-668219266b78f0b2.js +1 -0
- package/.next/static/chunks/pages/_app-6a626577ffa902a4.js +1 -0
- package/.next/static/chunks/pages/_error-1be831200e60c5c0.js +1 -0
- package/.next/static/chunks/polyfills-78c92fac7aa8fdd8.js +1 -0
- package/.next/static/chunks/webpack-889906d2d9470bce.js +1 -0
- package/.next/static/css/11741012df4dbecf.css +3 -0
- package/.next/static/izMHYLE7eERU7ILgJJ2ug/_buildManifest.js +1 -0
- package/.next/static/izMHYLE7eERU7ILgJJ2ug/_ssgManifest.js +1 -0
- package/.next/types/app/api/config/route.ts +343 -0
- package/.next/types/app/api/notify/route.ts +343 -0
- package/.next/types/app/api/proxy/[...path]/route.ts +343 -0
- package/.next/types/app/api/subscribe/route.ts +343 -0
- package/.next/types/app/api/unsubscribe/route.ts +343 -0
- package/.next/types/app/layout.ts +79 -0
- package/.next/types/app/page.ts +79 -0
- package/.next/types/package.json +1 -0
- package/LICENSE +21 -0
- package/README.md +81 -0
- package/app/api/config/route.ts +24 -0
- package/app/api/notify/route.ts +79 -0
- package/app/api/proxy/[...path]/route.ts +45 -0
- package/app/api/subscribe/route.ts +26 -0
- package/app/api/unsubscribe/route.ts +32 -0
- package/app/globals.css +8 -0
- package/app/layout.tsx +37 -0
- package/app/page.tsx +432 -0
- package/bin/agent-connect.js +199 -0
- package/bin/claude-hook.js +60 -0
- package/bin/config.js +60 -0
- package/bin/setup.js +193 -0
- package/bin/start.js +148 -0
- package/lib/subscriptions.ts +58 -0
- package/lib/webpush.ts +44 -0
- package/next.config.js +14 -0
- package/package.json +77 -0
- package/postcss.config.js +6 -0
- package/public/icon-192.png +0 -0
- package/public/icon-512.png +0 -0
- package/public/manifest.json +24 -0
- package/public/push-sw.js +92 -0
- package/public/sw.js +1 -0
- package/public/workbox-4754cb34.js +1 -0
- package/public/worker-izMHYLE7eERU7ILgJJ2ug.js +1 -0
- package/server-nextjs.js +60 -0
- package/server.js +316 -0
- package/tailwind.config.js +11 -0
- package/tsconfig.json +26 -0
- package/worker/index.js +93 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*
|
|
2
|
+
! tailwindcss v3.4.19 | MIT License | https://tailwindcss.com
|
|
3
|
+
*/*,:after,:before{box-sizing:border-box;border:0 solid #e5e7eb}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.mx-auto{margin-left:auto;margin-right:auto}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.mt-2{margin-top:.5rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.flex{display:flex}.h-3{height:.75rem}.min-h-screen{min-height:100vh}.w-3{width:.75rem}.max-w-2xl{max-width:42rem}.flex-shrink-0{flex-shrink:0}.cursor-pointer{cursor:pointer}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-between{justify-content:space-between}.gap-3{gap:.75rem}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.overflow-x-auto{overflow-x:auto}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.bg-blue-600{--tw-bg-opacity:1;background-color:rgb(37 99 235/var(--tw-bg-opacity,1))}.bg-gray-500{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity,1))}.bg-gray-600{--tw-bg-opacity:1;background-color:rgb(75 85 99/var(--tw-bg-opacity,1))}.bg-gray-700{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.bg-gray-800{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.bg-gray-900{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity,1))}.bg-green-500{--tw-bg-opacity:1;background-color:rgb(34 197 94/var(--tw-bg-opacity,1))}.bg-green-600{--tw-bg-opacity:1;background-color:rgb(22 163 74/var(--tw-bg-opacity,1))}.bg-red-500{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity,1))}.bg-yellow-500{--tw-bg-opacity:1;background-color:rgb(234 179 8/var(--tw-bg-opacity,1))}.p-3{padding:.75rem}.p-6{padding:1.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.text-gray-100{--tw-text-opacity:1;color:rgb(243 244 246/var(--tw-text-opacity,1))}.text-gray-300{--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity,1))}.text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.text-green-400{--tw-text-opacity:1;color:rgb(74 222 128/var(--tw-text-opacity,1))}.text-green-500{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity,1))}.text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity,1))}.text-yellow-400{--tw-text-opacity:1;color:rgb(250 204 21/var(--tw-text-opacity,1))}.text-yellow-500{--tw-text-opacity:1;color:rgb(234 179 8/var(--tw-text-opacity,1))}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}body{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif}.hover\:bg-blue-700:hover{--tw-bg-opacity:1;background-color:rgb(29 78 216/var(--tw-bg-opacity,1))}.hover\:bg-gray-700:hover{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.hover\:bg-green-700:hover{--tw-bg-opacity:1;background-color:rgb(21 128 61/var(--tw-bg-opacity,1))}.hover\:text-white:hover{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
self.__BUILD_MANIFEST={__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/_error":["static/chunks/pages/_error-1be831200e60c5c0.js"],sortedPages:["/_app","/_error"]},self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
self.__SSG_MANIFEST=new Set([]);self.__SSG_MANIFEST_CB&&self.__SSG_MANIFEST_CB()
|
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
// File: /mnt/hdd/matrix/agent-notifier/app/api/config/route.ts
|
|
2
|
+
import * as entry from '../../../../../app/api/config/route.js'
|
|
3
|
+
import type { NextRequest } from 'next/server.js'
|
|
4
|
+
|
|
5
|
+
type TEntry = typeof import('../../../../../app/api/config/route.js')
|
|
6
|
+
|
|
7
|
+
// Check that the entry is a valid entry
|
|
8
|
+
checkFields<Diff<{
|
|
9
|
+
GET?: Function
|
|
10
|
+
HEAD?: Function
|
|
11
|
+
OPTIONS?: Function
|
|
12
|
+
POST?: Function
|
|
13
|
+
PUT?: Function
|
|
14
|
+
DELETE?: Function
|
|
15
|
+
PATCH?: Function
|
|
16
|
+
config?: {}
|
|
17
|
+
generateStaticParams?: Function
|
|
18
|
+
revalidate?: RevalidateRange<TEntry> | false
|
|
19
|
+
dynamic?: 'auto' | 'force-dynamic' | 'error' | 'force-static'
|
|
20
|
+
dynamicParams?: boolean
|
|
21
|
+
fetchCache?: 'auto' | 'force-no-store' | 'only-no-store' | 'default-no-store' | 'default-cache' | 'only-cache' | 'force-cache'
|
|
22
|
+
preferredRegion?: 'auto' | 'global' | 'home' | string | string[]
|
|
23
|
+
runtime?: 'nodejs' | 'experimental-edge' | 'edge'
|
|
24
|
+
maxDuration?: number
|
|
25
|
+
|
|
26
|
+
}, TEntry, ''>>()
|
|
27
|
+
|
|
28
|
+
// Check the prop type of the entry function
|
|
29
|
+
if ('GET' in entry) {
|
|
30
|
+
checkFields<
|
|
31
|
+
Diff<
|
|
32
|
+
ParamCheck<Request | NextRequest>,
|
|
33
|
+
{
|
|
34
|
+
__tag__: 'GET'
|
|
35
|
+
__param_position__: 'first'
|
|
36
|
+
__param_type__: FirstArg<MaybeField<TEntry, 'GET'>>
|
|
37
|
+
},
|
|
38
|
+
'GET'
|
|
39
|
+
>
|
|
40
|
+
>()
|
|
41
|
+
checkFields<
|
|
42
|
+
Diff<
|
|
43
|
+
ParamCheck<PageParams>,
|
|
44
|
+
{
|
|
45
|
+
__tag__: 'GET'
|
|
46
|
+
__param_position__: 'second'
|
|
47
|
+
__param_type__: SecondArg<MaybeField<TEntry, 'GET'>>
|
|
48
|
+
},
|
|
49
|
+
'GET'
|
|
50
|
+
>
|
|
51
|
+
>()
|
|
52
|
+
|
|
53
|
+
checkFields<
|
|
54
|
+
Diff<
|
|
55
|
+
{
|
|
56
|
+
__tag__: 'GET',
|
|
57
|
+
__return_type__: Response | void | never | Promise<Response | void | never>
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
__tag__: 'GET',
|
|
61
|
+
__return_type__: ReturnType<MaybeField<TEntry, 'GET'>>
|
|
62
|
+
},
|
|
63
|
+
'GET'
|
|
64
|
+
>
|
|
65
|
+
>()
|
|
66
|
+
}
|
|
67
|
+
// Check the prop type of the entry function
|
|
68
|
+
if ('HEAD' in entry) {
|
|
69
|
+
checkFields<
|
|
70
|
+
Diff<
|
|
71
|
+
ParamCheck<Request | NextRequest>,
|
|
72
|
+
{
|
|
73
|
+
__tag__: 'HEAD'
|
|
74
|
+
__param_position__: 'first'
|
|
75
|
+
__param_type__: FirstArg<MaybeField<TEntry, 'HEAD'>>
|
|
76
|
+
},
|
|
77
|
+
'HEAD'
|
|
78
|
+
>
|
|
79
|
+
>()
|
|
80
|
+
checkFields<
|
|
81
|
+
Diff<
|
|
82
|
+
ParamCheck<PageParams>,
|
|
83
|
+
{
|
|
84
|
+
__tag__: 'HEAD'
|
|
85
|
+
__param_position__: 'second'
|
|
86
|
+
__param_type__: SecondArg<MaybeField<TEntry, 'HEAD'>>
|
|
87
|
+
},
|
|
88
|
+
'HEAD'
|
|
89
|
+
>
|
|
90
|
+
>()
|
|
91
|
+
|
|
92
|
+
checkFields<
|
|
93
|
+
Diff<
|
|
94
|
+
{
|
|
95
|
+
__tag__: 'HEAD',
|
|
96
|
+
__return_type__: Response | void | never | Promise<Response | void | never>
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
__tag__: 'HEAD',
|
|
100
|
+
__return_type__: ReturnType<MaybeField<TEntry, 'HEAD'>>
|
|
101
|
+
},
|
|
102
|
+
'HEAD'
|
|
103
|
+
>
|
|
104
|
+
>()
|
|
105
|
+
}
|
|
106
|
+
// Check the prop type of the entry function
|
|
107
|
+
if ('OPTIONS' in entry) {
|
|
108
|
+
checkFields<
|
|
109
|
+
Diff<
|
|
110
|
+
ParamCheck<Request | NextRequest>,
|
|
111
|
+
{
|
|
112
|
+
__tag__: 'OPTIONS'
|
|
113
|
+
__param_position__: 'first'
|
|
114
|
+
__param_type__: FirstArg<MaybeField<TEntry, 'OPTIONS'>>
|
|
115
|
+
},
|
|
116
|
+
'OPTIONS'
|
|
117
|
+
>
|
|
118
|
+
>()
|
|
119
|
+
checkFields<
|
|
120
|
+
Diff<
|
|
121
|
+
ParamCheck<PageParams>,
|
|
122
|
+
{
|
|
123
|
+
__tag__: 'OPTIONS'
|
|
124
|
+
__param_position__: 'second'
|
|
125
|
+
__param_type__: SecondArg<MaybeField<TEntry, 'OPTIONS'>>
|
|
126
|
+
},
|
|
127
|
+
'OPTIONS'
|
|
128
|
+
>
|
|
129
|
+
>()
|
|
130
|
+
|
|
131
|
+
checkFields<
|
|
132
|
+
Diff<
|
|
133
|
+
{
|
|
134
|
+
__tag__: 'OPTIONS',
|
|
135
|
+
__return_type__: Response | void | never | Promise<Response | void | never>
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
__tag__: 'OPTIONS',
|
|
139
|
+
__return_type__: ReturnType<MaybeField<TEntry, 'OPTIONS'>>
|
|
140
|
+
},
|
|
141
|
+
'OPTIONS'
|
|
142
|
+
>
|
|
143
|
+
>()
|
|
144
|
+
}
|
|
145
|
+
// Check the prop type of the entry function
|
|
146
|
+
if ('POST' in entry) {
|
|
147
|
+
checkFields<
|
|
148
|
+
Diff<
|
|
149
|
+
ParamCheck<Request | NextRequest>,
|
|
150
|
+
{
|
|
151
|
+
__tag__: 'POST'
|
|
152
|
+
__param_position__: 'first'
|
|
153
|
+
__param_type__: FirstArg<MaybeField<TEntry, 'POST'>>
|
|
154
|
+
},
|
|
155
|
+
'POST'
|
|
156
|
+
>
|
|
157
|
+
>()
|
|
158
|
+
checkFields<
|
|
159
|
+
Diff<
|
|
160
|
+
ParamCheck<PageParams>,
|
|
161
|
+
{
|
|
162
|
+
__tag__: 'POST'
|
|
163
|
+
__param_position__: 'second'
|
|
164
|
+
__param_type__: SecondArg<MaybeField<TEntry, 'POST'>>
|
|
165
|
+
},
|
|
166
|
+
'POST'
|
|
167
|
+
>
|
|
168
|
+
>()
|
|
169
|
+
|
|
170
|
+
checkFields<
|
|
171
|
+
Diff<
|
|
172
|
+
{
|
|
173
|
+
__tag__: 'POST',
|
|
174
|
+
__return_type__: Response | void | never | Promise<Response | void | never>
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
__tag__: 'POST',
|
|
178
|
+
__return_type__: ReturnType<MaybeField<TEntry, 'POST'>>
|
|
179
|
+
},
|
|
180
|
+
'POST'
|
|
181
|
+
>
|
|
182
|
+
>()
|
|
183
|
+
}
|
|
184
|
+
// Check the prop type of the entry function
|
|
185
|
+
if ('PUT' in entry) {
|
|
186
|
+
checkFields<
|
|
187
|
+
Diff<
|
|
188
|
+
ParamCheck<Request | NextRequest>,
|
|
189
|
+
{
|
|
190
|
+
__tag__: 'PUT'
|
|
191
|
+
__param_position__: 'first'
|
|
192
|
+
__param_type__: FirstArg<MaybeField<TEntry, 'PUT'>>
|
|
193
|
+
},
|
|
194
|
+
'PUT'
|
|
195
|
+
>
|
|
196
|
+
>()
|
|
197
|
+
checkFields<
|
|
198
|
+
Diff<
|
|
199
|
+
ParamCheck<PageParams>,
|
|
200
|
+
{
|
|
201
|
+
__tag__: 'PUT'
|
|
202
|
+
__param_position__: 'second'
|
|
203
|
+
__param_type__: SecondArg<MaybeField<TEntry, 'PUT'>>
|
|
204
|
+
},
|
|
205
|
+
'PUT'
|
|
206
|
+
>
|
|
207
|
+
>()
|
|
208
|
+
|
|
209
|
+
checkFields<
|
|
210
|
+
Diff<
|
|
211
|
+
{
|
|
212
|
+
__tag__: 'PUT',
|
|
213
|
+
__return_type__: Response | void | never | Promise<Response | void | never>
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
__tag__: 'PUT',
|
|
217
|
+
__return_type__: ReturnType<MaybeField<TEntry, 'PUT'>>
|
|
218
|
+
},
|
|
219
|
+
'PUT'
|
|
220
|
+
>
|
|
221
|
+
>()
|
|
222
|
+
}
|
|
223
|
+
// Check the prop type of the entry function
|
|
224
|
+
if ('DELETE' in entry) {
|
|
225
|
+
checkFields<
|
|
226
|
+
Diff<
|
|
227
|
+
ParamCheck<Request | NextRequest>,
|
|
228
|
+
{
|
|
229
|
+
__tag__: 'DELETE'
|
|
230
|
+
__param_position__: 'first'
|
|
231
|
+
__param_type__: FirstArg<MaybeField<TEntry, 'DELETE'>>
|
|
232
|
+
},
|
|
233
|
+
'DELETE'
|
|
234
|
+
>
|
|
235
|
+
>()
|
|
236
|
+
checkFields<
|
|
237
|
+
Diff<
|
|
238
|
+
ParamCheck<PageParams>,
|
|
239
|
+
{
|
|
240
|
+
__tag__: 'DELETE'
|
|
241
|
+
__param_position__: 'second'
|
|
242
|
+
__param_type__: SecondArg<MaybeField<TEntry, 'DELETE'>>
|
|
243
|
+
},
|
|
244
|
+
'DELETE'
|
|
245
|
+
>
|
|
246
|
+
>()
|
|
247
|
+
|
|
248
|
+
checkFields<
|
|
249
|
+
Diff<
|
|
250
|
+
{
|
|
251
|
+
__tag__: 'DELETE',
|
|
252
|
+
__return_type__: Response | void | never | Promise<Response | void | never>
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
__tag__: 'DELETE',
|
|
256
|
+
__return_type__: ReturnType<MaybeField<TEntry, 'DELETE'>>
|
|
257
|
+
},
|
|
258
|
+
'DELETE'
|
|
259
|
+
>
|
|
260
|
+
>()
|
|
261
|
+
}
|
|
262
|
+
// Check the prop type of the entry function
|
|
263
|
+
if ('PATCH' in entry) {
|
|
264
|
+
checkFields<
|
|
265
|
+
Diff<
|
|
266
|
+
ParamCheck<Request | NextRequest>,
|
|
267
|
+
{
|
|
268
|
+
__tag__: 'PATCH'
|
|
269
|
+
__param_position__: 'first'
|
|
270
|
+
__param_type__: FirstArg<MaybeField<TEntry, 'PATCH'>>
|
|
271
|
+
},
|
|
272
|
+
'PATCH'
|
|
273
|
+
>
|
|
274
|
+
>()
|
|
275
|
+
checkFields<
|
|
276
|
+
Diff<
|
|
277
|
+
ParamCheck<PageParams>,
|
|
278
|
+
{
|
|
279
|
+
__tag__: 'PATCH'
|
|
280
|
+
__param_position__: 'second'
|
|
281
|
+
__param_type__: SecondArg<MaybeField<TEntry, 'PATCH'>>
|
|
282
|
+
},
|
|
283
|
+
'PATCH'
|
|
284
|
+
>
|
|
285
|
+
>()
|
|
286
|
+
|
|
287
|
+
checkFields<
|
|
288
|
+
Diff<
|
|
289
|
+
{
|
|
290
|
+
__tag__: 'PATCH',
|
|
291
|
+
__return_type__: Response | void | never | Promise<Response | void | never>
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
__tag__: 'PATCH',
|
|
295
|
+
__return_type__: ReturnType<MaybeField<TEntry, 'PATCH'>>
|
|
296
|
+
},
|
|
297
|
+
'PATCH'
|
|
298
|
+
>
|
|
299
|
+
>()
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
// Check the arguments and return type of the generateStaticParams function
|
|
303
|
+
if ('generateStaticParams' in entry) {
|
|
304
|
+
checkFields<Diff<{ params: PageParams }, FirstArg<MaybeField<TEntry, 'generateStaticParams'>>, 'generateStaticParams'>>()
|
|
305
|
+
checkFields<Diff<{ __tag__: 'generateStaticParams', __return_type__: any[] | Promise<any[]> }, { __tag__: 'generateStaticParams', __return_type__: ReturnType<MaybeField<TEntry, 'generateStaticParams'>> }>>()
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
type PageParams = any
|
|
309
|
+
export interface PageProps {
|
|
310
|
+
params?: any
|
|
311
|
+
searchParams?: any
|
|
312
|
+
}
|
|
313
|
+
export interface LayoutProps {
|
|
314
|
+
children?: React.ReactNode
|
|
315
|
+
|
|
316
|
+
params?: any
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// =============
|
|
320
|
+
// Utility types
|
|
321
|
+
type RevalidateRange<T> = T extends { revalidate: any } ? NonNegative<T['revalidate']> : never
|
|
322
|
+
|
|
323
|
+
// If T is unknown or any, it will be an empty {} type. Otherwise, it will be the same as Omit<T, keyof Base>.
|
|
324
|
+
type OmitWithTag<T, K extends keyof any, _M> = Omit<T, K>
|
|
325
|
+
type Diff<Base, T extends Base, Message extends string = ''> = 0 extends (1 & T) ? {} : OmitWithTag<T, keyof Base, Message>
|
|
326
|
+
|
|
327
|
+
type FirstArg<T extends Function> = T extends (...args: [infer T, any]) => any ? unknown extends T ? any : T : never
|
|
328
|
+
type SecondArg<T extends Function> = T extends (...args: [any, infer T]) => any ? unknown extends T ? any : T : never
|
|
329
|
+
type MaybeField<T, K extends string> = T extends { [k in K]: infer G } ? G extends Function ? G : never : never
|
|
330
|
+
|
|
331
|
+
type ParamCheck<T> = {
|
|
332
|
+
__tag__: string
|
|
333
|
+
__param_position__: string
|
|
334
|
+
__param_type__: T
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
function checkFields<_ extends { [k in keyof any]: never }>() {}
|
|
338
|
+
|
|
339
|
+
// https://github.com/sindresorhus/type-fest
|
|
340
|
+
type Numeric = number | bigint
|
|
341
|
+
type Zero = 0 | 0n
|
|
342
|
+
type Negative<T extends Numeric> = T extends Zero ? never : `${T}` extends `-${string}` ? T : never
|
|
343
|
+
type NonNegative<T extends Numeric> = T extends Zero ? T : Negative<T> extends never ? T : '__invalid_negative_number__'
|