@theobourgeois/ytdb 0.2.18 → 0.2.19
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 -1
- package/.next/app-path-routes-manifest.json +1 -1
- package/.next/build-manifest.json +2 -2
- package/.next/server/app/[connectionId]/[schema]/[table]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/[connectionId]/diff/page_client-reference-manifest.js +1 -1
- package/.next/server/app/[connectionId]/migrations/[setId]/page.js +1 -1
- package/.next/server/app/[connectionId]/migrations/[setId]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/[connectionId]/migrations/page.js +1 -1
- package/.next/server/app/[connectionId]/migrations/page_client-reference-manifest.js +1 -1
- package/.next/server/app/[connectionId]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/[connectionId]/query/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +2 -2
- package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +3 -3
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +3 -3
- package/.next/server/app/index.segments/_full.segment.rsc +3 -3
- package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +1 -1
- package/.next/server/chunks/5816.js +1 -1
- package/.next/server/chunks/6729.js +1 -1
- package/.next/server/chunks/8842.js +1 -1
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/static/chunks/9243-585cdd3c297cf117.js +1 -0
- package/.next/static/chunks/{9532-d620e60587f422d7.js → 9532-860dc97ac3c3ff31.js} +1 -1
- package/.next/static/chunks/app/[connectionId]/migrations/[setId]/page-86a263e7e4a08d61.js +1 -0
- package/.next/static/chunks/app/[connectionId]/migrations/page-fc5dcf1404df5c65.js +1 -0
- package/.next/static/chunks/f97e080b-58fc9570cf11a0c7.js +1 -0
- package/.next/static/css/ab9c0ea2c2569929.css +1 -0
- package/package.json +1 -1
- package/.next/static/chunks/9243-9f0f2534090c6124.js +0 -1
- package/.next/static/chunks/app/[connectionId]/migrations/[setId]/page-e5120de390d302f1.js +0 -1
- package/.next/static/chunks/app/[connectionId]/migrations/page-b7e1a0568b6704d5.js +0 -1
- package/.next/static/chunks/f97e080b-0509045eeda7ac08.js +0 -1
- package/.next/static/css/54a62baacc492c6d.css +0 -1
- /package/.next/static/{bmRCG7iMkzXVlg-XFxDlO → PPqM7ay-YN8BBp1e_HK15}/_buildManifest.js +0 -0
- /package/.next/static/{bmRCG7iMkzXVlg-XFxDlO → PPqM7ay-YN8BBp1e_HK15}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
globalThis.__BUILD_MANIFEST={polyfillFiles:["static/chunks/polyfills-42372ed130431b0a.js"],devFiles:[],lowPriorityFiles:["static/
|
|
1
|
+
globalThis.__BUILD_MANIFEST={polyfillFiles:["static/chunks/polyfills-42372ed130431b0a.js"],devFiles:[],lowPriorityFiles:["static/PPqM7ay-YN8BBp1e_HK15/_buildManifest.js","static/PPqM7ay-YN8BBp1e_HK15/_ssgManifest.js"],rootMainFiles:["static/chunks/webpack-34eb118f56295776.js","static/chunks/4bd1b696-8a4ab4fdf0ae305a.js","static/chunks/3794-d7cddff008311ab3.js","static/chunks/main-app-f73ec34e89cb8fdd.js"],rootMainFilesTree:{},pages:{"/_app":[]}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html lang="en" class="__variable_246ccd __variable_c29908 dark h-full" data-theme="dark"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" href="/_next/static/media/22a5144ee8d83bca-s.p.woff2" as="font" crossorigin="" type="font/woff2"/><link rel="preload" href="/_next/static/media/7d4881bb7e1bf84d-s.p.woff2" as="font" crossorigin="" type="font/woff2"/><link rel="stylesheet" href="/_next/static/css/e02ab5db9ff2dca2.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/
|
|
1
|
+
<!DOCTYPE html><html lang="en" class="__variable_246ccd __variable_c29908 dark h-full" data-theme="dark"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" href="/_next/static/media/22a5144ee8d83bca-s.p.woff2" as="font" crossorigin="" type="font/woff2"/><link rel="preload" href="/_next/static/media/7d4881bb7e1bf84d-s.p.woff2" as="font" crossorigin="" type="font/woff2"/><link rel="stylesheet" href="/_next/static/css/e02ab5db9ff2dca2.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/ab9c0ea2c2569929.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-34eb118f56295776.js"/><script src="/_next/static/chunks/4bd1b696-8a4ab4fdf0ae305a.js" async=""></script><script src="/_next/static/chunks/3794-d7cddff008311ab3.js" async=""></script><script src="/_next/static/chunks/main-app-f73ec34e89cb8fdd.js" async=""></script><script src="/_next/static/chunks/223-a4fca67d979d899d.js" async=""></script><script src="/_next/static/chunks/app/layout-e3fdecae5544dc60.js" async=""></script><meta name="robots" content="noindex"/><meta name="next-size-adjust" content=""/><title>YTDB</title><meta name="description" content="A database management UI"/><link rel="icon" href="/favicon.ico?603d046c9a6fdfbb" type="image/x-icon" sizes="16x16"/><link rel="icon" href="/icon.svg?38bdd49dcdf01715" type="image/svg+xml" sizes="any"/><script>(function(){try{var allowed=["dark","light","one-dark-pro","nord","dracula","tokyo-night"];var light=["light"];var id="dark";var raw=localStorage.getItem("ytdb:theme")||localStorage.getItem("db-studio:theme");if(raw){var parsed=JSON.parse(raw);var value=parsed&&parsed.state&&parsed.state.theme;if(typeof value==="string"&&allowed.indexOf(value)!==-1)id=value;}var root=document.documentElement;root.setAttribute("data-theme",id);root.classList.toggle("dark",light.indexOf(id)===-1);}catch(e){}})();</script><script src="/_next/static/chunks/polyfills-42372ed130431b0a.js" noModule=""></script></head><body class="flex min-h-full flex-col"><div hidden=""><!--$--><!--/$--></div><main class="grid min-h-dvh place-items-center bg-background px-6 text-foreground"><div class="max-w-lg space-y-4"><p class="font-mono text-xs tracking-[0.22em] text-muted-foreground">YTDB</p><h1 class="text-2xl font-semibold tracking-tight">Connecting to YTDB…</h1></div></main><script src="/_next/static/chunks/webpack-34eb118f56295776.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[72737,[\"223\",\"static/chunks/223-a4fca67d979d899d.js\",\"7177\",\"static/chunks/app/layout-e3fdecae5544dc60.js\"],\"ThemeProvider\"]\n3:I[94821,[\"223\",\"static/chunks/223-a4fca67d979d899d.js\",\"7177\",\"static/chunks/app/layout-e3fdecae5544dc60.js\"],\"ConvexClientProvider\"]\n4:I[48491,[\"223\",\"static/chunks/223-a4fca67d979d899d.js\",\"7177\",\"static/chunks/app/layout-e3fdecae5544dc60.js\"],\"NavigationTracker\"]\n5:I[65377,[\"223\",\"static/chunks/223-a4fca67d979d899d.js\",\"7177\",\"static/chunks/app/layout-e3fdecae5544dc60.js\"],\"LocalBridgeGate\"]\n6:I[57121,[],\"\"]\n7:I[74581,[],\"\"]\n8:I[90484,[],\"OutletBoundary\"]\n9:\"$Sreact.suspense\"\nc:I[90484,[],\"ViewportBoundary\"]\ne:I[90484,[],\"MetadataBoundary\"]\n10:I[27123,[],\"default\",1]\n:HL[\"/_next/static/media/22a5144ee8d83bca-s.p.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n:HL[\"/_next/static/media/7d4881bb7e1bf84d-s.p.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n:HL[\"/_next/static/css/e02ab5db9ff2dca2.css\",\"style\"]\n:HL[\"/_next/static/css/ab9c0ea2c2569929.css\",\"style\"]\nb:X\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"c\":[\"\",\"_not-found\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"_not-found\",{\"children\":[\"__PAGE__\",{},\"$undefined\",\"$undefined\",4608]},\"$undefined\",\"$undefined\",4608]},\"$undefined\",\"$undefined\",4624],[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/e02ab5db9ff2dca2.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}],[\"$\",\"link\",\"1\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/ab9c0ea2c2569929.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"className\":\"__variable_246ccd __variable_c29908 dark h-full\",\"data-theme\":\"dark\",\"suppressHydrationWarning\":true,\"children\":[[\"$\",\"head\",null,{\"children\":[\"$\",\"script\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"(function(){try{var allowed=[\\\"dark\\\",\\\"light\\\",\\\"one-dark-pro\\\",\\\"nord\\\",\\\"dracula\\\",\\\"tokyo-night\\\"];var light=[\\\"light\\\"];var id=\\\"dark\\\";var raw=localStorage.getItem(\\\"ytdb:theme\\\")||localStorage.getItem(\\\"db-studio:theme\\\");if(raw){var parsed=JSON.parse(raw);var value=parsed\u0026\u0026parsed.state\u0026\u0026parsed.state.theme;if(typeof value===\\\"string\\\"\u0026\u0026allowed.indexOf(value)!==-1)id=value;}var root=document.documentElement;root.setAttribute(\\\"data-theme\\\",id);root.classList.toggle(\\\"dark\\\",light.indexOf(id)===-1);}catch(e){}})();\"}}]}],[\"$\",\"body\",null,{\"className\":\"flex min-h-full flex-col\",\"children\":[\"$\",\"$L2\",null,{\"children\":[\"$\",\"$L3\",null,{\"children\":[[\"$\",\"$L4\",null,{}],[\"$\",\"$L5\",null,{\"children\":[\"$\",\"$L6\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L7\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]}]]}]}]}]]}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L6\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L7\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":404}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],null,[\"$\",\"$L8\",null,{\"children\":[\"$\",\"$9\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@a\"}]}]]}],{},null,false,null]},null,false,\"$b\"]},null,false,null],[\"$\",\"$1\",\"h\",{\"children\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],[\"$\",\"$Lc\",null,{\"children\":\"$Ld\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$Le\",null,{\"children\":[\"$\",\"$9\",null,{\"name\":\"Next.Metadata\",\"children\":\"$Lf\"}]}]}],[\"$\",\"meta\",null,{\"name\":\"next-size-adjust\",\"content\":\"\"}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$10\",[]],\"S\":true,\"h\":null,\"r\":\"$undefined\",\"s\":\"$undefined\",\"a\":\"$undefined\",\"l\":\"$undefined\",\"p\":\"$undefined\",\"d\":\"$undefined\",\"b\":\"PPqM7ay-YN8BBp1e_HK15\"}\n"])</script><script>self.__next_f.push([1,"b:C\nd:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n"])</script><script>self.__next_f.push([1,"11:I[86869,[],\"IconMark\"]\na:null\nf:[[\"$\",\"title\",\"0\",{\"children\":\"YTDB\"}],[\"$\",\"meta\",\"1\",{\"name\":\"description\",\"content\":\"A database management UI\"}],[\"$\",\"link\",\"2\",{\"rel\":\"icon\",\"href\":\"/favicon.ico?603d046c9a6fdfbb\",\"type\":\"image/x-icon\",\"sizes\":\"16x16\"}],[\"$\",\"link\",\"3\",{\"rel\":\"icon\",\"href\":\"/icon.svg?38bdd49dcdf01715\",\"type\":\"image/svg+xml\",\"sizes\":\"any\"}],[\"$\",\"$L11\",\"4\",{}]]\n"])</script></body></html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html id="__next_error__"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-34eb118f56295776.js"/><script src="/_next/static/chunks/4bd1b696-8a4ab4fdf0ae305a.js" async=""></script><script src="/_next/static/chunks/3794-d7cddff008311ab3.js" async=""></script><script src="/_next/static/chunks/main-app-f73ec34e89cb8fdd.js" async=""></script><meta name="next-size-adjust" content=""/><title>500: This page couldn’t load</title><style>:root {--next-error-bg: #fff;--next-error-text: #171717;--next-error-title: #171717;--next-error-message: #171717;--next-error-digest: #666666;--next-error-btn-text: #fff;--next-error-btn-bg: #171717;--next-error-btn-border: none;--next-error-btn-secondary-text: #171717;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(0,0,0,0.08);}@media (prefers-color-scheme: dark) {:root {--next-error-bg: #0a0a0a;--next-error-text: #ededed;--next-error-title: #ededed;--next-error-message: #ededed;--next-error-digest: #a0a0a0;--next-error-btn-text: #0a0a0a;--next-error-btn-bg: #ededed;--next-error-btn-border: none;--next-error-btn-secondary-text: #ededed;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(255,255,255,0.14);}}body { margin: 0; color: var(--next-error-text); background: var(--next-error-bg); }</style><script src="/_next/static/chunks/polyfills-42372ed130431b0a.js" noModule=""></script></head><body><div hidden=""><!--$--><!--/$--></div><div style="font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";height:100vh;display:flex;align-items:center;justify-content:center"><div style="margin-top:-32px;max-width:325px;padding:32px 28px;text-align:left"><svg width="32" height="32" viewBox="-0.2 -1.5 32 32" fill="none" style="margin-bottom:24px"><path d="M16.9328 0C18.0839 0.000116771 19.1334 0.658832 19.634 1.69531L31.4299 26.1309C32.0708 27.4588 31.1036 28.9999 29.6291 29H2.00215C0.527541 29 -0.439628 27.4588 0.201371 26.1309L11.9973 1.69531C12.4979 0.658823 13.5474 7.75066e-05 14.6984 0H16.9328ZM3.59493 26H28.0363L16.9328 3H14.6984L3.59493 26ZM15.8156 19C16.9202 19.0001 17.8156 19.8955 17.8156 21C17.8156 22.1045 16.9202 22.9999 15.8156 23C14.7111 23 13.8156 22.1046 13.8156 21C13.8156 19.8954 14.7111 19 15.8156 19ZM17.3156 16.5H14.3156V8.5H17.3156V16.5Z" fill="var(--next-error-title)"></path></svg><h1 style="font-size:24px;font-weight:500;letter-spacing:-0.02em;line-height:32px;margin:0 0 12px 0;color:var(--next-error-title)">This page couldn’t load</h1><p style="font-size:14px;font-weight:400;line-height:21px;margin:0 0 20px 0;color:var(--next-error-message)">A server error occurred. Reload to try again.</p><form style="margin:0"><button type="submit" style="display:inline-flex;align-items:center;justify-content:center;height:32px;padding:0 12px;font-size:14px;font-weight:500;line-height:20px;border-radius:6px;cursor:pointer;color:var(--next-error-btn-text);background:var(--next-error-btn-bg);border:var(--next-error-btn-border)">Reload</button></form></div></div><!--$--><!--/$--><script src="/_next/static/chunks/webpack-34eb118f56295776.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[57121,[],\"\"]\n3:I[74581,[],\"\"]\n4:I[90484,[],\"OutletBoundary\"]\n5:\"$Sreact.suspense\"\n8:I[90484,[],\"ViewportBoundary\"]\na:I[90484,[],\"MetadataBoundary\"]\nc:I[27123,[],\"default\",1]\n7:X\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"c\":[\"\",\"_global-error\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"_global-error\",{\"children\":[\"__PAGE__\",{},\"$undefined\",\"$undefined\",4624]},\"$undefined\",\"$undefined\",4624]},\"$undefined\",\"$undefined\",4624],[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[\"$\",\"html\",null,{\"id\":\"__next_error__\",\"children\":[[\"$\",\"head\",null,{\"children\":[[\"$\",\"title\",null,{\"children\":\"500: This page couldn’t load\"}],[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\":root {--next-error-bg: #fff;--next-error-text: #171717;--next-error-title: #171717;--next-error-message: #171717;--next-error-digest: #666666;--next-error-btn-text: #fff;--next-error-btn-bg: #171717;--next-error-btn-border: none;--next-error-btn-secondary-text: #171717;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(0,0,0,0.08);}@media (prefers-color-scheme: dark) {:root {--next-error-bg: #0a0a0a;--next-error-text: #ededed;--next-error-title: #ededed;--next-error-message: #ededed;--next-error-digest: #a0a0a0;--next-error-btn-text: #0a0a0a;--next-error-btn-bg: #ededed;--next-error-btn-border: none;--next-error-btn-secondary-text: #ededed;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(255,255,255,0.14);}}body { margin: 0; color: var(--next-error-text); background: var(--next-error-bg); }\"}}]]}],[\"$\",\"body\",null,{\"children\":[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"display\":\"flex\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"style\":{\"marginTop\":\"-32px\",\"maxWidth\":\"325px\",\"padding\":\"32px 28px\",\"textAlign\":\"left\"},\"children\":[[\"$\",\"svg\",null,{\"width\":\"32\",\"height\":\"32\",\"viewBox\":\"-0.2 -1.5 32 32\",\"fill\":\"none\",\"style\":{\"marginBottom\":\"24px\"},\"children\":[\"$\",\"path\",null,{\"d\":\"M16.9328 0C18.0839 0.000116771 19.1334 0.658832 19.634 1.69531L31.4299 26.1309C32.0708 27.4588 31.1036 28.9999 29.6291 29H2.00215C0.527541 29 -0.439628 27.4588 0.201371 26.1309L11.9973 1.69531C12.4979 0.658823 13.5474 7.75066e-05 14.6984 0H16.9328ZM3.59493 26H28.0363L16.9328 3H14.6984L3.59493 26ZM15.8156 19C16.9202 19.0001 17.8156 19.8955 17.8156 21C17.8156 22.1045 16.9202 22.9999 15.8156 23C14.7111 23 13.8156 22.1046 13.8156 21C13.8156 19.8954 14.7111 19 15.8156 19ZM17.3156 16.5H14.3156V8.5H17.3156V16.5Z\",\"fill\":\"var(--next-error-title)\"}]}],[\"$\",\"h1\",null,{\"style\":{\"fontSize\":\"24px\",\"fontWeight\":500,\"letterSpacing\":\"-0.02em\",\"lineHeight\":\"32px\",\"margin\":\"0 0 12px 0\",\"color\":\"var(--next-error-title)\"},\"children\":\"This page couldn’t load\"}],[\"$\",\"p\",null,{\"style\":{\"fontSize\":\"14px\",\"fontWeight\":400,\"lineHeight\":\"21px\",\"margin\":\"0 0 20px 0\",\"color\":\"var(--next-error-message)\"},\"children\":\"A server error occurred. Reload to try again.\"}],[\"$\",\"form\",null,{\"style\":{\"margin\":0},\"children\":[\"$\",\"button\",null,{\"type\":\"submit\",\"style\":{\"display\":\"inline-flex\",\"alignItems\":\"center\",\"justifyContent\":\"center\",\"height\":\"32px\",\"padding\":\"0 12px\",\"fontSize\":\"14px\",\"fontWeight\":500,\"lineHeight\":\"20px\",\"borderRadius\":\"6px\",\"cursor\":\"pointer\",\"color\":\"var(--next-error-btn-text)\",\"background\":\"var(--next-error-btn-bg)\",\"border\":\"var(--next-error-btn-border)\"},\"children\":\"Reload\"}]}]]}]}]}]]}],null,[\"$\",\"$L4\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@6\"}]}]]}],{},null,false,null]},null,false,\"$7\"]},null,false,\"$7\"],[\"$\",\"$1\",\"h\",{\"children\":[null,[\"$\",\"$L8\",null,{\"children\":\"$L9\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$La\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.Metadata\",\"children\":\"$Lb\"}]}]}],[\"$\",\"meta\",null,{\"name\":\"next-size-adjust\",\"content\":\"\"}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$c\",[]],\"S\":true,\"h\":null,\"r\":\"$undefined\",\"s\":\"$undefined\",\"a\":\"$undefined\",\"l\":\"$undefined\",\"p\":\"$undefined\",\"d\":\"$undefined\",\"b\":\"
|
|
1
|
+
<!DOCTYPE html><html id="__next_error__"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-34eb118f56295776.js"/><script src="/_next/static/chunks/4bd1b696-8a4ab4fdf0ae305a.js" async=""></script><script src="/_next/static/chunks/3794-d7cddff008311ab3.js" async=""></script><script src="/_next/static/chunks/main-app-f73ec34e89cb8fdd.js" async=""></script><meta name="next-size-adjust" content=""/><title>500: This page couldn’t load</title><style>:root {--next-error-bg: #fff;--next-error-text: #171717;--next-error-title: #171717;--next-error-message: #171717;--next-error-digest: #666666;--next-error-btn-text: #fff;--next-error-btn-bg: #171717;--next-error-btn-border: none;--next-error-btn-secondary-text: #171717;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(0,0,0,0.08);}@media (prefers-color-scheme: dark) {:root {--next-error-bg: #0a0a0a;--next-error-text: #ededed;--next-error-title: #ededed;--next-error-message: #ededed;--next-error-digest: #a0a0a0;--next-error-btn-text: #0a0a0a;--next-error-btn-bg: #ededed;--next-error-btn-border: none;--next-error-btn-secondary-text: #ededed;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(255,255,255,0.14);}}body { margin: 0; color: var(--next-error-text); background: var(--next-error-bg); }</style><script src="/_next/static/chunks/polyfills-42372ed130431b0a.js" noModule=""></script></head><body><div hidden=""><!--$--><!--/$--></div><div style="font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";height:100vh;display:flex;align-items:center;justify-content:center"><div style="margin-top:-32px;max-width:325px;padding:32px 28px;text-align:left"><svg width="32" height="32" viewBox="-0.2 -1.5 32 32" fill="none" style="margin-bottom:24px"><path d="M16.9328 0C18.0839 0.000116771 19.1334 0.658832 19.634 1.69531L31.4299 26.1309C32.0708 27.4588 31.1036 28.9999 29.6291 29H2.00215C0.527541 29 -0.439628 27.4588 0.201371 26.1309L11.9973 1.69531C12.4979 0.658823 13.5474 7.75066e-05 14.6984 0H16.9328ZM3.59493 26H28.0363L16.9328 3H14.6984L3.59493 26ZM15.8156 19C16.9202 19.0001 17.8156 19.8955 17.8156 21C17.8156 22.1045 16.9202 22.9999 15.8156 23C14.7111 23 13.8156 22.1046 13.8156 21C13.8156 19.8954 14.7111 19 15.8156 19ZM17.3156 16.5H14.3156V8.5H17.3156V16.5Z" fill="var(--next-error-title)"></path></svg><h1 style="font-size:24px;font-weight:500;letter-spacing:-0.02em;line-height:32px;margin:0 0 12px 0;color:var(--next-error-title)">This page couldn’t load</h1><p style="font-size:14px;font-weight:400;line-height:21px;margin:0 0 20px 0;color:var(--next-error-message)">A server error occurred. Reload to try again.</p><form style="margin:0"><button type="submit" style="display:inline-flex;align-items:center;justify-content:center;height:32px;padding:0 12px;font-size:14px;font-weight:500;line-height:20px;border-radius:6px;cursor:pointer;color:var(--next-error-btn-text);background:var(--next-error-btn-bg);border:var(--next-error-btn-border)">Reload</button></form></div></div><!--$--><!--/$--><script src="/_next/static/chunks/webpack-34eb118f56295776.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[57121,[],\"\"]\n3:I[74581,[],\"\"]\n4:I[90484,[],\"OutletBoundary\"]\n5:\"$Sreact.suspense\"\n8:I[90484,[],\"ViewportBoundary\"]\na:I[90484,[],\"MetadataBoundary\"]\nc:I[27123,[],\"default\",1]\n7:X\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"c\":[\"\",\"_global-error\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"_global-error\",{\"children\":[\"__PAGE__\",{},\"$undefined\",\"$undefined\",4624]},\"$undefined\",\"$undefined\",4624]},\"$undefined\",\"$undefined\",4624],[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[\"$\",\"html\",null,{\"id\":\"__next_error__\",\"children\":[[\"$\",\"head\",null,{\"children\":[[\"$\",\"title\",null,{\"children\":\"500: This page couldn’t load\"}],[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\":root {--next-error-bg: #fff;--next-error-text: #171717;--next-error-title: #171717;--next-error-message: #171717;--next-error-digest: #666666;--next-error-btn-text: #fff;--next-error-btn-bg: #171717;--next-error-btn-border: none;--next-error-btn-secondary-text: #171717;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(0,0,0,0.08);}@media (prefers-color-scheme: dark) {:root {--next-error-bg: #0a0a0a;--next-error-text: #ededed;--next-error-title: #ededed;--next-error-message: #ededed;--next-error-digest: #a0a0a0;--next-error-btn-text: #0a0a0a;--next-error-btn-bg: #ededed;--next-error-btn-border: none;--next-error-btn-secondary-text: #ededed;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(255,255,255,0.14);}}body { margin: 0; color: var(--next-error-text); background: var(--next-error-bg); }\"}}]]}],[\"$\",\"body\",null,{\"children\":[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"display\":\"flex\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"style\":{\"marginTop\":\"-32px\",\"maxWidth\":\"325px\",\"padding\":\"32px 28px\",\"textAlign\":\"left\"},\"children\":[[\"$\",\"svg\",null,{\"width\":\"32\",\"height\":\"32\",\"viewBox\":\"-0.2 -1.5 32 32\",\"fill\":\"none\",\"style\":{\"marginBottom\":\"24px\"},\"children\":[\"$\",\"path\",null,{\"d\":\"M16.9328 0C18.0839 0.000116771 19.1334 0.658832 19.634 1.69531L31.4299 26.1309C32.0708 27.4588 31.1036 28.9999 29.6291 29H2.00215C0.527541 29 -0.439628 27.4588 0.201371 26.1309L11.9973 1.69531C12.4979 0.658823 13.5474 7.75066e-05 14.6984 0H16.9328ZM3.59493 26H28.0363L16.9328 3H14.6984L3.59493 26ZM15.8156 19C16.9202 19.0001 17.8156 19.8955 17.8156 21C17.8156 22.1045 16.9202 22.9999 15.8156 23C14.7111 23 13.8156 22.1046 13.8156 21C13.8156 19.8954 14.7111 19 15.8156 19ZM17.3156 16.5H14.3156V8.5H17.3156V16.5Z\",\"fill\":\"var(--next-error-title)\"}]}],[\"$\",\"h1\",null,{\"style\":{\"fontSize\":\"24px\",\"fontWeight\":500,\"letterSpacing\":\"-0.02em\",\"lineHeight\":\"32px\",\"margin\":\"0 0 12px 0\",\"color\":\"var(--next-error-title)\"},\"children\":\"This page couldn’t load\"}],[\"$\",\"p\",null,{\"style\":{\"fontSize\":\"14px\",\"fontWeight\":400,\"lineHeight\":\"21px\",\"margin\":\"0 0 20px 0\",\"color\":\"var(--next-error-message)\"},\"children\":\"A server error occurred. Reload to try again.\"}],[\"$\",\"form\",null,{\"style\":{\"margin\":0},\"children\":[\"$\",\"button\",null,{\"type\":\"submit\",\"style\":{\"display\":\"inline-flex\",\"alignItems\":\"center\",\"justifyContent\":\"center\",\"height\":\"32px\",\"padding\":\"0 12px\",\"fontSize\":\"14px\",\"fontWeight\":500,\"lineHeight\":\"20px\",\"borderRadius\":\"6px\",\"cursor\":\"pointer\",\"color\":\"var(--next-error-btn-text)\",\"background\":\"var(--next-error-btn-bg)\",\"border\":\"var(--next-error-btn-border)\"},\"children\":\"Reload\"}]}]]}]}]}]]}],null,[\"$\",\"$L4\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@6\"}]}]]}],{},null,false,null]},null,false,\"$7\"]},null,false,\"$7\"],[\"$\",\"$1\",\"h\",{\"children\":[null,[\"$\",\"$L8\",null,{\"children\":\"$L9\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$La\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.Metadata\",\"children\":\"$Lb\"}]}]}],[\"$\",\"meta\",null,{\"name\":\"next-size-adjust\",\"content\":\"\"}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$c\",[]],\"S\":true,\"h\":null,\"r\":\"$undefined\",\"s\":\"$undefined\",\"a\":\"$undefined\",\"l\":\"$undefined\",\"p\":\"$undefined\",\"d\":\"$undefined\",\"b\":\"PPqM7ay-YN8BBp1e_HK15\"}\n"])</script><script>self.__next_f.push([1,"7:C\n9:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n"])</script><script>self.__next_f.push([1,"6:null\nb:[]\n"])</script></body></html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9243],{25:(e,t,r)=>{r.d(t,{Ol:()=>l,TA:()=>d,qb:()=>u});let n=/^[ \t]*--+[ \t]*ytdb:[ \t]*no-?transaction\b/im,i=new Set(["begin","start"]),s=new Set(["commit","end"]),a=new Set(["rollback"]);function o(e){return void 0!==e&&(e>="A"&&e<="Z"||e>="a"&&e<="z"||"_"===e)||void 0!==e&&e>="0"&&e<="9"}function l(e){if(n.test(e))return{mode:"unwrapped",sql:e,atomic:!1};let t=function(e){let t=[],r=0,n=0,i=n=>{let i=function(e,t){let r=t;for(;r<e.length;){let t=e[r];if(" "===t||" "===t||"\n"===t||"\r"===t){r+=1;continue}if("-"===t&&"-"===e[r+1]){for(;r<e.length&&"\n"!==e[r];)r+=1;continue}if("/"===t&&"*"===e[r+1]){let t=e.indexOf("*/",r+2);r=-1===t?e.length:t+2;continue}break}return r}(e,r);if(i>=n)return;let s=i;for(;s<e.length&&o(e[s]);)s+=1;t.push({at:i,end:n,keyword:e.slice(i,s).toLowerCase()})};for(;n<e.length;){let t=e[n];if("-"===t&&"-"===e[n+1]){for(;n<e.length&&"\n"!==e[n];)n+=1;continue}if("/"===t&&"*"===e[n+1]){let t=e.indexOf("*/",n+2);n=-1===t?e.length:t+2;continue}if("'"===t||'"'===t){n=function(e,t,r){let n=t+1;for(;n<e.length;){if(e[n]===r){if(e[n+1]===r){n+=2;continue}return n+1}n+=1}return n}(e,n,t);continue}if("$"===t){let t=function(e,t){if("$"!==e[t])return null;let r=t+1;for(;r<e.length&&o(e[r]);)r+=1;return"$"!==e[r]?null:e.slice(t,r+1)}(e,n);if(t){let r=e.indexOf(t,n+t.length);n=-1===r?e.length:r+t.length;continue}}if(";"===t){i(n+1),n+=1,r=n;continue}n+=1}return i(e.length),t}(e),r=t.filter(e=>i.has(e.keyword)||s.has(e.keyword)||a.has(e.keyword));if(0===r.length)return{mode:"wrapped-by-ytdb",sql:e,atomic:!0};let l=t[0],d=t[t.length-1];return 2===r.length&&r[0]===l&&r[1]===d&&i.has(l.keyword)&&s.has(d.keyword)?{mode:"self-wrapped",sql:e.slice(0,l.at)+e.slice(l.end,d.at)+e.slice(d.end),atomic:!0}:{mode:"self-managed",sql:e,atomic:!1}}function d(e){switch(e){case"unwrapped":return"Marked `-- ytdb:no-transaction`, so it runs with no transaction. A failure partway leaves the statements before it applied.";case"self-managed":return"This file commits more than once, so YTDB runs it as written and records it afterwards. A failure partway can leave it half applied and unrecorded.";default:return null}}function u(e){return"unwrapped"===e?"no transaction":"self-managed"===e?"self-managed":null}},20642:(e,t,r)=>{r.d(t,{Ai:()=>m,Nz:()=>h,Zy:()=>c,mj:()=>g,wQ:()=>y});var n=r(40980),i=r(25);let s=new Set(["apply","up","forward"]),a=new Set(["revert","down","rollback","undo"]),o=[".up",".apply",".forward","_up","_apply","-up","-apply"],l=[".down",".revert",".rollback",".undo","_down","_revert","_rollback","_undo","-down","-revert","-rollback","-undo"];function d(e){return e.split("/").filter(e=>e.length>0)}function u(e){let t=/^[Vv](\d+(?:[._]\d+)*)__(.*)$/.exec(e);if(t)return{version:t[1].replace(/_/g,"."),name:p(t[2])};let r=/^(\d+(?:[-.]\d+)*)(?:[-_.\s]+(.*))?$/.exec(e);return r?{version:r[1],name:p(r[2]??"")}:{version:e,name:p(e)}}function p(e){return e.replace(/[-_]+/g," ").trim()}function c(e,t){let r=/(\d+)|(\D+)/g,n=e.match(r)??[],i=t.match(r)??[],s=Math.min(n.length,i.length);for(let e=0;e<s;e+=1){let t=n[e],r=i[e],s=/^\d+$/.test(t)&&/^\d+$/.test(r)?Number(t)-Number(r):t.localeCompare(r);if(0!==s)return s}return n.length-i.length}function f(e){let t=e.replace(/\r\n/g,"\n").trim(),r=0x811c9dc5,n=0x1000193;for(let e=0;e<t.length;e+=1){let i=t.charCodeAt(e);r=Math.imul(r^i,0x1000193)>>>0,n=Math.imul(n+i,0x85ebca6b)>>>0}return`${r.toString(16).padStart(8,"0")}${n.toString(16).padStart(8,"0")}`}function h(e){let t={applies:new Map,reverts:new Map,skipped:[],errors:[]},r=e.filter(e=>{var t;let r=d(t=e.path).at(-1)??t;return!r.startsWith(".")&&/\.sql$/i.test(r)});if(0===r.length)return t.errors.push("No .sql files in there."),t;let n=r.reduce((e,t)=>e+t.text.length,0);if(n>4e6)return t.errors.push(`That is ${b(n)} of SQL, over the ${b(4e6)} limit.`),t;let i=[];for(let e of r){if(e.text.length>5e5){t.skipped.push(`${e.path} — over ${b(5e5)}`);continue}if(e.text.includes("\0")){t.skipped.push(`${e.path} — not text`);continue}if(!e.text.trim()){t.skipped.push(`${e.path} — empty`);continue}i.push({file:e,...function(e){let t=d(e),r=(t.at(-1)??e).replace(/\.sql$/i,"");for(let e of t.slice(0,-1)){let t=e.toLowerCase();if(a.has(t))return{direction:"revert",stem:r};if(s.has(t))return{direction:"apply",stem:r}}let n=r.toLowerCase();for(let e of l)if(n.endsWith(e))return{direction:"revert",stem:r.slice(0,-e.length)};for(let e of o)if(n.endsWith(e))return{direction:"apply",stem:r.slice(0,-e.length)};return{direction:"apply",stem:r}}(e.path)})}let c=new Set,f=!1;for(let{direction:e,stem:t}of i){if("apply"!==e)continue;let{version:r}=u(t);c.has(r)&&(f=!0),c.add(r)}for(let{file:e,direction:r,stem:n}of i){let{version:i,name:s}=f?{version:n,name:p(n)}:u(n),a=("apply"===r?t.applies:t.reverts).get(i);if(a){t.skipped.push(`${e.path} — ${a.path} is already version ${i}`);continue}"apply"===r?t.applies.set(i,{path:e.path,sql:e.text,name:s}):t.reverts.set(i,{path:e.path,sql:e.text})}return 0===t.applies.size&&0===t.reverts.size&&t.errors.push("None of those .sql files could be read as a migration."),t}function m(e,t){let r=new Map(e.map(e=>[e.version,{...e}])),n=[...t.skipped],s=0,a=0,o=0;for(let[e,o]of t.applies){let t=r.get(e);if(t){t.applySql!==o.sql&&(a+=1),t.name=o.name||t.name,t.applyPath=o.path,t.applySql=o.sql,t.checksum=f(o.sql),t.transaction=(0,i.Ol)(o.sql).mode;continue}if(r.size>=500){n.push(`${o.path} — over 500 migrations`);continue}r.set(e,{version:e,name:o.name||e,applyPath:o.path,applySql:o.sql,checksum:f(o.sql),transaction:(0,i.Ol)(o.sql).mode}),s+=1}for(let[e,i]of t.reverts){let t=r.get(e);if(!t){n.push(`${i.path} — no migration ${e} to revert`);continue}t.revertPath=i.path,t.revertSql=i.sql,o+=1}return{steps:[...r.values()].sort((e,t)=>c(e.version,t.version)),added:s,updated:a,reverts:o,skipped:n}}function g(e){return{id:(0,n.z)(),name:v(e),importedAt:Date.now(),steps:[],skipped:[]}}function v(e){return e.trim().replace(/\s+/g," ").slice(0,80)||"Migrations"}function b(e){return e<1024?`${e} B`:e<1048576?`${Math.round(e/1024)} KB`:`${(e/1048576).toFixed(1)} MB`}function y(e,t){let r=[],s=[];for(let e of[...t].sort((e,t)=>c(e.version,t.version))){if(!e.applySql){r.push(e.version);continue}s.push({version:e.version,name:e.name||e.version,applyPath:`${e.version} (from the ledger)`,applySql:e.applySql,checksum:f(e.applySql),revertPath:e.revertSql?`${e.version} revert (from the ledger)`:void 0,revertSql:e.revertSql,transaction:(0,i.Ol)(e.applySql).mode})}return{set:{id:(0,n.z)(),name:v(e),importedAt:Date.now(),steps:s,skipped:[]},missing:r}}},48861:(e,t,r)=>{r.d(t,{Q:()=>d});var n=r(73321),i=r(12115),s=r(69586),a=r(79668),o=r(88263),l=r(20185);function d(e){let t,r,d=(0,n.useRouter)(),u=(0,o.c)(e=>e.entries),p=(0,o.c)(e=>e.index),c=(t=(0,s.Z)(e=>e.connections),r=(0,a.jV)(e=>e.sets),(0,i.useCallback)((e,n)=>{let i=e=>t.find(t=>t.id===e)?.name??e,s="connectionId"in e&&e.connectionId!==n?` \xb7 ${i(e.connectionId)}`:"";switch(e.kind){case"home":return"Connections";case"connection":return i(e.connectionId);case"query":return`SQL query${s}`;case"diff":return`Compare schema${s}`;case"migrations":return`Migrations${s}`;case"migration":return`${r.find(t=>t.id===e.setId)?.name??"Migration"}${s}`;case"table":return`${e.table.name}${s}`}},[t,r]));return(0,i.useMemo)(()=>{let t=t=>{let r=u[t];if(void 0===r)return null;let n=(0,l.ZG)(r);return{href:r,route:n,label:c(n,e)}},r=t(p-1),n=t(p+1);return{back:r,forward:n,goBack:()=>{r&&d.back()},goForward:()=>{n&&d.forward()}}},[u,p,c,e,d])}},56012:(e,t,r)=>{r.d(t,{R9:()=>i,XG:()=>a,aC:()=>n,hD:()=>s,km:()=>o});let n="maintenance",i="ytdb_migrations";function s(e){return"string"==typeof e&&e.length>0&&e.length<=63&&/^[A-Za-z_][A-Za-z0-9_$]*$/.test(e)}let a=2e4;function o(e){return e.startsWith("repo:")}},79668:(e,t,r)=>{r.d(t,{Ss:()=>f,ec:()=>m,jV:()=>c,kG:()=>h,ox:()=>g});var n=r(12115),i=r(1934),s=r(31692),a=r(42256),o=r(20642),l=r(56012),d=r(40980),u=r(69586);let p={query:"",status:"all"},c=(0,i.v)()((0,s.Zr)((e,t)=>({sets:[],history:[],ledgerSchema:l.aC,setLedgerSchema:t=>{(0,l.hD)(t)&&e({ledgerSchema:t})},listFilters:{},setListFilter:(t,r)=>e(e=>({listFilters:{...e.listFilters,[t]:{...e.listFilters[t]??p,...r}}})),repoRoots:{},setRepoRoot:(t,r)=>e(e=>{let n={...e.repoRoots},i=r?.trim();i?n[t]=i:delete n[t],(0,a.L)("migrations.folder",{set:!!i});let s={...e.repoCheckouts};return delete s[t],{repoRoots:n,repoCheckouts:s}}),repoCheckouts:{},setRepoCheckout:(t,r)=>e(e=>{let n={...e.repoCheckouts};return r?n[t]=r:delete n[t],(0,a.L)("migrations.checkout",{set:!!r}),{repoCheckouts:n}}),createSet:t=>{let r=(0,o.mj)(t);return e(e=>({sets:[...e.sets,r]})),r.id},addFiles:(r,n)=>{let i=t().sets.find(e=>e.id===r),s=(0,o.Nz)(n),l=(0,o.Ai)(i?.steps??[],s);return i&&e(e=>({sets:e.sets.map(e=>e.id===r?{...e,steps:l.steps,skipped:l.skipped,importedAt:Date.now()}:e)})),(0,a.L)("migrations.import",{name:i?.name,added:l.added,updated:l.updated,reverts:l.reverts,skipped:l.skipped.length}),l},adoptSet:t=>(e(e=>({sets:[...e.sets,t]})),(0,a.L)("migrations.import",{name:t.name,migrations:t.steps.length,source:"ledger"}),t.id),renameSet:(t,r)=>{let n=r.trim().replace(/\s+/g," ").slice(0,80);n&&e(e=>({sets:e.sets.map(e=>e.id===t?{...e,name:n}:e)}))},setNote:(t,r)=>{let n=r.trim().slice(0,l.XG)||void 0;e(e=>({sets:e.sets.map(e=>e.id===t?{...e,note:n}:e)}))},removeStep:(t,r)=>e(e=>({sets:e.sets.map(e=>e.id===t?{...e,steps:e.steps.filter(e=>e.version!==r)}:e)})),removeSet:r=>{let n=t().sets.find(e=>e.id===r);e(e=>({sets:e.sets.filter(e=>e.id!==r)})),(0,a.L)("migrations.remove",{name:n?.name})},record:t=>e(e=>({history:[{...t,id:(0,d.z)(),ranAt:Date.now()},...e.history].slice(0,300)})),clearHistory:t=>e(e=>({history:t?e.history.filter(e=>e.setId!==t):[]}))}),{name:"ytdb:migrations"}));function f(e){return c(t=>t.sets.find(t=>t.id===e)??null)}function h(e){return c(t=>t.listFilters[e]??p)}function m(){return(0,n.useSyncExternalStore)(e=>c.persist.onFinishHydration(e),()=>c.persist.hasHydrated(),()=>!1)}function g(e){let t=(0,u.Z)(t=>t.connections.find(t=>t.id===e)?.layoutGroup??e),r=c(e=>e.repoRoots[t]??null),n=c(e=>e.repoCheckouts[t]??null);return{scope:t,root:r,checkout:n}}},89239:(e,t,r)=>{r.d(t,{$:()=>l,r:()=>o});var n=r(95155),i=r(35684),s=r(18460),a=r(40980);let o=(0,s.F)("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function l({className:e,variant:t="default",size:r="default",...s}){return(0,n.jsx)(i.$,{"data-slot":"button",className:(0,a.cn)(o({variant:t,size:r,className:e})),...s})}}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9532],{7412:(e,t,n)=>{n.d(t,{L:()=>i});var r=n(95155),s=n(13267),a=n(40980);function i({trailing:e,className:t,...n}){return(0,r.jsxs)("div",{className:(0,a.cn)("flex h-8 items-center gap-1.5 rounded-lg px-2 text-muted-foreground transition-colors focus-within:bg-muted/60 hover:bg-muted/60",t),children:[(0,r.jsx)(s.TfF,{className:"size-3.5 shrink-0"}),(0,r.jsx)("input",{type:"text",spellCheck:!1,autoComplete:"off",...n,className:"h-full min-w-0 flex-1 bg-transparent text-[0.8rem] text-foreground outline-none placeholder:text-muted-foreground"}),e]})}},9385:(e,t,n)=>{function r(e){let t=Date.parse(e);return Number.isNaN(t)?0:t}function s(e,t){let n=new Map(e.map(e=>[e.connection.id,e])),s=t.filter(e=>n.has(e.connectionId)).map(e=>({id:e.id,runId:e.runId,connectionId:e.connectionId,connectionName:e.connectionName,version:e.version,name:e.name,at:e.ranAt,kind:"failed"===e.status?"failed":e.recorded?"apply"===e.direction?"marked":"unmarked":"apply"===e.direction?"applied":"reverted",durationMs:e.durationMs,error:e.error,setName:e.setName,fromLedger:!1})),a=new Map;for(let e of s){let t=`${e.connectionId}:${e.setName??""}:${e.version}`,n=a.get(t);(!n||e.at>n.at)&&a.set(t,e)}let i=[...s];for(let t of e)for(let e of t.ledger?.entries??[]){let n=`${t.connection.id}:${e.setName}:${e.version}`,s=a.get(n);if(s&&("applied"===s.kind||"marked"===s.kind)&&2e3>Math.abs(s.at-(r(e.appliedAt)+(e.durationMs??0)))){s.appliedBy=e.appliedBy;continue}i.push({id:`ledger:${t.connection.id}:${e.setName}:${e.version}`,connectionId:t.connection.id,connectionName:t.connection.name,version:e.version,name:e.name||e.version,at:r(e.appliedAt),kind:"applied",durationMs:e.durationMs,setName:e.setName,appliedBy:e.appliedBy,fromLedger:!0})}return i.sort((e,t)=>t.at-e.at)}n.d(t,{x:()=>s})},17021:(e,t,n)=>{n.d(t,{H:()=>N});var r=n(95155),s=n(12115),a=n(13267),i=n(72194),l=n(40891),o=n(89239),d=n(72264),c=n(30374),u=n(7412),m=n(87364),h=n(27529);let p=["applied","reverted","marked","unmarked","failed","uncertain","legacy"];var x=n(79668),f=n(40980),g=n(28335);function v({connection:e,ledgerSchema:t,event:n,step:i,onResolved:l,onRetry:d}){let c,u,p=(0,m.Y)(`reconcile:${e.id}:${t}:${n.id}`,r=>h.F.reconcile(e.url,t,n.id,r)),[x,g]=(0,s.useState)(null),[j,b]=(0,s.useState)(null);async function k(r,s=!1){g(r),b(null);try{await h.F.resolve(e.url,t,{eventId:n.id,outcome:r,checksum:i?.checksum}),l(r),s&&d?.()}catch(e){b(e instanceof Error?e.message:String(e))}finally{g(null)}}if(p.error)return(0,r.jsxs)("div",{className:"flex items-center gap-2 border-b p-3 text-xs text-destructive",role:"alert",children:[(0,r.jsx)("span",{className:"min-w-0 flex-1 break-words",children:p.error}),(0,r.jsx)(o.$,{size:"xs",variant:"ghost",onClick:p.reload,children:"Retry"})]});if(!p.data)return(0,r.jsxs)("p",{className:"flex items-center gap-2 border-b p-3 text-xs text-muted-foreground",children:[(0,r.jsx)(a.gnh,{className:"size-3.5 animate-spin"}),"Checking ",e.name,"…"]});let{running:y,detection:N}=p.data,w="revert"===n.direction,$=N?.evidence??[],S=$.filter(e=>e.satisfied).length;return y?(c=`Still running on ${e.name}${y.since?` since ${new Date(y.since).toLocaleTimeString()}`:""}. Leave it be; the timeline updates when it finishes.`,u=null):n.atomic?(c=`This ran in one transaction that never committed, so nothing from it is on ${e.name}.`,u="lost"):N&&"unknown"!==N.verdict?"applied"===N.verdict?(c=`Everything it ${w?"removes is gone from":"creates or changes is on"} ${e.name}.`,u="landed"):"pending"===N.verdict?(c=`Nothing it ${w?"removes is gone from":"creates or changes is on"} ${e.name}.`,u="lost"):(c=`Some of what it does is on ${e.name} and some is not. Finish or undo the rest by hand in the query editor before settling it.`,u=null):(c=`This SQL leaves no trace in the schema — data changes, seeds, grants — so ${e.name} cannot say whether it ran. Check by hand before settling it.`,u=null),(0,r.jsxs)("div",{className:"border-b",children:[(0,r.jsxs)("div",{className:"flex items-start gap-2 px-3 py-2",children:[(0,r.jsx)("p",{className:"min-w-0 flex-1 text-xs",children:c}),(0,r.jsx)(o.$,{size:"icon-xs",variant:"ghost","aria-label":"Check again",title:"Check again",disabled:p.loading,onClick:p.reload,children:(0,r.jsx)(a.oS8,{className:(0,f.cn)("size-3.5",p.loading&&"animate-spin")})})]}),$.length>0&&(0,r.jsxs)("div",{className:"mx-3 mb-2 max-h-40 overflow-y-auto rounded-md border bg-muted/25",children:[(0,r.jsxs)("p",{className:"border-b px-2 py-1 text-[11px] text-muted-foreground",children:[S," of ",$.length," ",1===$.length?"thing":"things"," it would leave behind ",1===S?"is":"are"," there"]}),$.map(e=>(0,r.jsxs)("p",{className:"flex items-center gap-1.5 px-2 py-0.5 font-mono text-[11px]",children:[e.satisfied?(0,r.jsx)(a.wiW,{className:"size-3 shrink-0 text-emerald-600 dark:text-emerald-400"}):(0,r.jsx)(a.yBK,{className:"size-3 shrink-0 text-muted-foreground/60"}),(0,r.jsx)("span",{className:"min-w-0 truncate",title:e.note?`${e.description} — ${e.note}`:e.description,children:e.description})]},e.description))]}),j&&(0,r.jsx)("p",{className:"mx-3 mb-2 rounded-md border border-destructive/25 bg-destructive/5 px-2 py-1 font-mono text-[11px] whitespace-pre-wrap text-destructive",children:j}),!y&&(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 px-3 pb-2",children:[(0,r.jsx)(o.$,{size:"xs",variant:"landed"===u?"default":"outline",disabled:null!==x,title:"Writes the ledger row this run would have written. No SQL runs.",onClick:()=>void k("landed"),children:"landed"===x?"Marking…":w?"Mark as reverted":"Mark as applied"}),(0,r.jsx)(o.$,{size:"xs",variant:"lost"===u?"default":"outline",disabled:null!==x,title:"Closes this run as failed. The ledger is left as it is.",onClick:()=>void k("lost"),children:"lost"===x?"Marking…":"Mark as failed"}),d&&!w&&(0,r.jsx)(o.$,{size:"xs",variant:"ghost",disabled:null!==x,title:"Closes this run as failed and runs the migration again.",onClick:()=>void k("lost",!0),children:"Retry"})]})]})}let j={applied:"Applied",reverted:"Reverted",marked:"Marked as applied",unmarked:"Marked as not applied",failed:"Failed",uncertain:"Unconfirmed",legacy:"Previously recorded"};function b({kind:e}){let t="size-3.5 shrink-0";switch(e){case"failed":return(0,r.jsx)(a.yBK,{className:(0,f.cn)(t,"text-destructive")});case"uncertain":return(0,r.jsx)(a.e5t,{className:(0,f.cn)(t,"text-amber-600 dark:text-amber-400")});case"reverted":return(0,r.jsx)(a.ij9,{className:(0,f.cn)(t,"text-amber-600 dark:text-amber-400")});case"marked":return(0,r.jsx)(a.nXx,{className:(0,f.cn)(t,"text-muted-foreground")});case"unmarked":return(0,r.jsx)(a.fJ4,{className:(0,f.cn)(t,"text-muted-foreground")});case"legacy":return(0,r.jsx)(a.A01,{className:(0,f.cn)(t,"text-muted-foreground")});default:return(0,r.jsx)(a.wiW,{className:(0,f.cn)(t,"text-emerald-600 dark:text-emerald-400")})}}function k({event:e,schema:t}){let[n,i]=(0,s.useState)("sql"),d=(0,m.Y)(`timeline:${e.connection.id}:${t}:${e.shared.id}`,n=>h.F.timelineDetail(e.connection.url,t,e.shared.id,n));if(d.error)return(0,r.jsxs)("div",{className:"flex items-center gap-2 p-3 text-xs text-destructive",role:"alert",children:[(0,r.jsx)("span",{className:"min-w-0 flex-1 break-words",children:d.error}),(0,r.jsx)(o.$,{size:"xs",variant:"ghost",onClick:d.reload,children:"Retry"})]});if(!d.data)return(0,r.jsxs)("p",{className:"flex items-center gap-2 p-3 text-xs text-muted-foreground",children:[(0,r.jsx)(a.gnh,{className:"size-3.5 animate-spin"}),"Loading…"]});let u=d.data,p="revert"===n?u.revertSql:u.sql,x=[{value:"sql",label:"SQL"}];return null!==u.previousSql&&null!==u.sql&&x.push({value:"changes",label:"Changes"}),null!==u.revertSql&&x.push({value:"revert",label:"Rollback"}),(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 border-b px-3 py-1.5",children:[(0,r.jsx)(c.x,{label:"Saved migration SQL",value:n,options:x,onChange:i}),"changes"===n&&u.previousAt&&(0,r.jsxs)("span",{className:"text-[11px] text-muted-foreground",children:["Since ",new Date(u.previousAt).toLocaleString()]})]}),"changes"===n?u.previousSql===u.sql?(0,r.jsx)("p",{className:"p-3 text-xs text-muted-foreground",children:"Unchanged since the last successful run."}):(0,r.jsx)(g.u,{before:u.previousSql??"",after:u.sql??"",className:"max-h-96 py-2"}):p?(0,r.jsx)("div",{className:"flex max-h-96 min-h-0 flex-col",children:(0,r.jsx)(l.iX,{sql:p,loading:!1,error:null})}):(0,r.jsx)("p",{className:"p-3 text-xs text-muted-foreground",children:"No SQL saved."})]})}function y({event:e,settling:t}){var n;let l,[o,d]=(0,s.useState)(!1),c=`timeline-${e.connection.id}-${e.id}`,u=t.ledgerSchema,m=t.findStep?.(e.setName??"",e.version)??null,h="failed"===e.kind||"uncertain"===e.kind?"bg-destructive/5 text-destructive":"bg-muted/30 text-muted-foreground";return(0,r.jsxs)("div",{className:"relative pl-9 before:absolute before:top-0 before:bottom-0 before:left-[11px] before:border-l last:before:bottom-6",children:[(0,r.jsx)("span",{className:"absolute top-3 left-0 flex size-6 items-center justify-center rounded-full border bg-background",children:(0,r.jsx)(b,{kind:e.kind})}),(0,r.jsxs)("button",{type:"button","aria-expanded":o,"aria-controls":c,onClick:()=>d(!o),className:"group flex w-full min-w-0 cursor-pointer items-start gap-2 rounded-lg px-2 py-3 text-left transition-colors hover:bg-muted/50 focus-visible:outline-2 focus-visible:outline-ring",children:[(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-xs",children:[(0,r.jsx)("span",{title:(l=[],("marked"===e.kind||"unmarked"===e.kind)&&l.push("No SQL ran. Only the migration record changed."),"legacy"===e.kind&&l.push("Preserved from the earlier ledger, which did not distinguish running from marking."),"uncertain"===e.kind&&l.push("No confirmed outcome: it may still be running, or it was interrupted. Open it to see what the database says."),"failed"===e.kind&&e.shared?.atomic&&l.push("The transaction was rolled back."),e.shared&&!e.shared.atomic&&"legacy"!==e.kind&&l.push("This SQL manages its own transactions, so a failure can leave changes applied."),"browser"===e.source&&l.push("Stored in this browser only."),l.join(" ")||void 0),className:(0,f.cn)("font-medium","failed"===e.kind&&"text-destructive","uncertain"===e.kind&&"text-amber-600 dark:text-amber-400"),children:j[e.kind]}),(0,r.jsx)("span",{className:"font-mono text-muted-foreground",children:e.version}),(0,r.jsx)("span",{className:"min-w-0 truncate font-medium",title:e.name,children:e.name})]}),(0,r.jsxs)("div",{className:"mt-1.5 flex flex-wrap items-center gap-x-2 gap-y-1 text-[11px] text-muted-foreground",children:[(0,r.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,r.jsx)(i.F,{connection:e.connection,className:"size-1.5"}),e.connection.name]}),e.setName&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{"aria-hidden":"true",children:"\xb7"}),(0,r.jsx)("span",{className:"max-w-48 truncate",children:e.setName})]}),e.appliedBy&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{"aria-hidden":"true",children:"\xb7"}),(0,r.jsx)("span",{title:"PostgreSQL role",children:e.appliedBy})]}),null!==e.durationMs&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{"aria-hidden":"true",children:"\xb7"}),(0,r.jsx)("span",{children:null===(n=e.durationMs)?null:n<1e3?`${n} ms`:`${(n/1e3).toFixed(1)} s`})]}),"browser"===e.source&&(0,r.jsx)("span",{className:"rounded bg-muted px-1.5 py-0.5",children:"This browser"})]})]}),(0,r.jsx)("time",{dateTime:new Date(e.at).toISOString(),title:new Date(e.at).toLocaleString(),className:"shrink-0 text-[11px] text-muted-foreground tabular-nums",children:new Date(e.at).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}),(0,r.jsx)(a.nNJ,{className:(0,f.cn)("size-3.5 shrink-0 text-muted-foreground transition-transform",o&&"rotate-90")})]}),o&&(0,r.jsxs)("div",{id:c,className:"mb-3 overflow-hidden rounded-lg border bg-background",children:["uncertain"===e.kind&&e.shared&&(0,r.jsx)(v,{connection:e.connection,ledgerSchema:u,event:e.shared,step:m,onResolved:t.onResolved,onRetry:t.onRetry&&m&&"apply"===e.shared.direction?()=>t.onRetry?.(m):void 0}),e.error&&(0,r.jsx)("pre",{className:(0,f.cn)("max-h-48 overflow-auto border-b p-3 font-mono text-[11px] whitespace-pre-wrap break-words",h),children:e.error}),e.shared?(0,r.jsx)(k,{event:e,schema:u}):(0,r.jsx)("p",{className:"p-3 text-xs text-muted-foreground",children:"No saved SQL."})]})]})}function N({events:e,connections:t,loading:n,ledgerSchema:l,setName:c,findStep:m,onLedgerChange:g,onRetry:v}){let b=(0,x.jV)(e=>e.clearHistory),[k,w]=(0,s.useState)(""),[$,S]=(0,s.useState)("all"),[C,z]=(0,s.useState)("all"),M=(0,s.useMemo)(()=>t.filter(e=>"all"===$||e.id===$),[t,$]),L=(0,s.useMemo)(()=>({setName:c,query:k.trim(),kind:"all"===C?void 0:C}),[c,k,C]),R=function(e,t,n){let[r,a]=(0,s.useState)({}),[i,l]=(0,s.useState)(!0),o=(0,s.useRef)(r),d=(0,s.useRef)(!1),c=(0,s.useRef)(null),u=JSON.stringify([e.map(e=>[e.id,e.url]),t,n]),m=(0,s.useRef)(u),p=(0,s.useCallback)(async(r=!1)=>{if(d.current)return;d.current=!0,l(!0);let s=new AbortController;c.current=s;let i={...o.current};await Promise.all(e.map(async e=>{let a=o.current[e.id]?.page;if(!r||a?.nextCursor)try{let l=await h.F.timeline(e.url,t,{...n,before:r?a?.nextCursor??void 0:void 0},s.signal);if(a&&l.initialized){let e=new Set(l.events.map(e=>e.id)),t=l.events.some(e=>a.events.some(t=>t.id===e.id));(r||t)&&(l.events=[...l.events,...a.events.filter(t=>!e.has(t.id))].sort((e,t)=>BigInt(e.sequence)>BigInt(t.sequence)?-1:1),r||(l.nextCursor=a.nextCursor))}i[e.id]={page:l}}catch(t){i[e.id]={page:a,error:t instanceof Error?t.message:String(t)}}})),s.signal.aborted||(o.current=i,a(i),l(!1),d.current=!1)},[e,t,n]);return(0,s.useEffect)(()=>{d.current=!1,m.current!==u&&(m.current=u,o.current={});let e=()=>{"visible"===document.visibilityState&&p()},t=window.setTimeout(()=>void p(),200),n=window.setInterval(e,1e4);return window.addEventListener("focus",e),()=>{window.clearTimeout(t),window.clearInterval(n),window.removeEventListener("focus",e),c.current?.abort()}},[p,u]),{reads:r,loading:i,refresh:()=>void p(),loadMore:()=>void p(!0),hasMore:Object.values(r).some(e=>!!e.page?.nextCursor)}}(M,l,L),D={ledgerSchema:l,findStep:m,onRetry:v,onResolved:e=>{R.refresh(),"landed"===e&&g?.()}},q=[];for(let t of M){let n=R.reads[t.id]?.page,r=n?.events??[];for(let e of r)q.push({id:`${t.id}:${e.id}`,connection:t,name:e.name,version:e.version,setName:e.setName,at:Date.parse(e.startedAt),kind:e.kind,durationMs:e.durationMs,appliedBy:e.appliedBy,error:e.error,shared:e,source:"shared"});for(let s of e.filter(e=>e.connectionId===t.id)){if(n?.initialized&&s.fromLedger||r.some(e=>e.id===s.runId||!s.runId&&"legacy"===e.kind&&e.setName===s.setName&&e.version===s.version&&("applied"===s.kind||"marked"===s.kind)&&2e3>Math.abs(Date.parse(e.startedAt)+(e.durationMs??0)-s.at)))continue;let e=s.fromLedger?"legacy":s.kind;(!L.kind||L.kind===e)&&(!L.query||[s.name,s.version,s.setName,s.appliedBy].join(" ").toLowerCase().includes(L.query.toLowerCase()))&&q.push({...s,kind:e,connection:t,source:s.fromLedger?"ledger":"browser"})}}q.sort((e,t)=>t.at-e.at||e.id.localeCompare(t.id));let B=new Map;for(let e of q){let t=function(e){let t=new Date(e),n=new Date;return t.toDateString()===n.toDateString()?"Today":(n.setDate(n.getDate()-1),t.toDateString()===n.toDateString())?"Yesterday":t.toLocaleDateString(void 0,{month:"long",day:"numeric",year:"numeric"})}(e.at);B.set(t,[...B.get(t)??[],e])}let F=M.filter(e=>R.reads[e.id]?.error),I=e.some(e=>!e.fromLedger),A="all"!==$||"all"!==C,T=A?[t.find(e=>e.id===$)?.name,"all"===C?void 0:j[C]].filter(Boolean).join(" \xb7 "):"All";return(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsxs)("div",{className:"sticky top-0 z-10 flex items-center gap-1 border-b bg-background px-2 py-1",children:[(0,r.jsx)(u.L,{"aria-label":"Search timeline",placeholder:"Search timeline",value:k,maxLength:200,onChange:e=>w(e.target.value),className:"min-w-0 flex-1",trailing:k?(0,r.jsx)("button",{type:"button","aria-label":"Clear search",className:"cursor-pointer rounded p-0.5 hover:text-foreground",onClick:()=>w(""),children:(0,r.jsx)(a.yBK,{className:"size-3.5"})}):null}),(0,r.jsxs)(d.rI,{children:[(0,r.jsxs)(d.ty,{render:(0,r.jsx)(o.$,{size:"sm",variant:A?"outline":"ghost"}),className:"max-w-56 cursor-pointer",children:[(0,r.jsx)("span",{className:"truncate",children:T}),(0,r.jsx)(a.RQe,{"data-icon":"inline-end"})]}),(0,r.jsxs)(d.SQ,{align:"end",className:"min-w-48",children:[t.length>1&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(d.I,{children:[(0,r.jsx)(d.lp,{children:"Environment"}),(0,r.jsxs)(d.Hr,{value:$,onValueChange:e=>S(e),children:[(0,r.jsx)(d.Ht,{value:"all",children:"All environments"}),t.map(e=>(0,r.jsxs)(d.Ht,{value:e.id,children:[(0,r.jsx)(i.F,{connection:e,className:"size-1.5"}),e.name]},e.id))]})]}),(0,r.jsx)(d.mB,{})]}),(0,r.jsxs)(d.I,{children:[(0,r.jsx)(d.lp,{children:"Outcome"}),(0,r.jsxs)(d.Hr,{value:C,onValueChange:e=>z(e),children:[(0,r.jsx)(d.Ht,{value:"all",children:"All outcomes"}),p.map(e=>(0,r.jsx)(d.Ht,{value:e,children:j[e]},e))]})]})]})]}),(0,r.jsx)(o.$,{variant:"ghost",size:"icon-sm",onClick:R.refresh,disabled:R.loading,"aria-label":"Refresh timeline",title:"Refresh timeline",children:(0,r.jsx)(a.oS8,{className:(0,f.cn)("size-3.5",R.loading&&"animate-spin")})}),I&&(0,r.jsx)(o.$,{variant:"ghost",size:"icon-sm",onClick:()=>b(),"aria-label":"Clear local log",title:"Clears this browser's log. The databases' ledgers and timelines are untouched.",children:(0,r.jsx)(a.GVO,{className:"size-3.5"})})]}),F.map(e=>(0,r.jsxs)("p",{role:"alert",title:R.reads[e.id].error,className:"truncate px-4 pt-2 text-[11px] text-destructive",children:[e.name,": ",R.reads[e.id].error]},e.id)),0===q.length?(0,r.jsx)("p",{className:"px-4 py-6 text-sm text-muted-foreground",children:R.loading||n?"Reading timeline…":k.trim()||A?"No matching events.":"Nothing has run yet."}):(0,r.jsxs)("div",{className:"px-4 pb-4",children:[[...B].map(([e,t])=>(0,r.jsxs)("section",{"aria-label":e,children:[(0,r.jsx)("h3",{className:"pt-4 pb-2 text-[11px] font-medium text-muted-foreground",children:e}),t.map(e=>(0,r.jsx)(y,{event:e,settling:D},e.id))]},e)),R.hasMore&&(0,r.jsx)("div",{className:"flex justify-center pt-4",children:(0,r.jsx)(o.$,{variant:"ghost",size:"sm",onClick:R.loadMore,disabled:R.loading,children:R.loading?"Loading…":"Load older"})})]})]})}},27013:(e,t,n)=>{n.d(t,{K:()=>o});var r=n(95155),s=n(12115),a=n(89239),i=n(42763),l=n(60529);function o(e){return(0,r.jsx)(i.lG,{open:e.open,onOpenChange:e.onOpenChange,children:(0,r.jsx)(i.Cf,{className:"sm:max-w-sm",showCloseButton:!1,children:e.open&&(0,r.jsx)(d,{...e})})})}function d({title:e,initial:t="",submitLabel:n,onOpenChange:o,onSubmit:c}){let[u,m]=(0,s.useState)(t),h=u.trim();return(0,r.jsxs)("form",{onSubmit:function(e){e.preventDefault(),h&&(c(h),o(!1))},className:"flex flex-col gap-4",children:[(0,r.jsx)(i.c7,{children:(0,r.jsx)(i.L3,{children:e})}),(0,r.jsx)(l.p,{autoFocus:!0,"aria-label":"Migration name",value:u,placeholder:"add_users_table",onChange:e=>m(e.target.value),onFocus:e=>e.currentTarget.select()}),(0,r.jsxs)(i.Es,{children:[(0,r.jsx)(a.$,{type:"button",variant:"ghost",onClick:()=>o(!1),children:"Cancel"}),(0,r.jsx)(a.$,{type:"submit",disabled:!h,children:n})]})]})}},28335:(e,t,n)=>{n.d(t,{u:()=>o});var r=n(95155),s=n(12115);function a(e){let t=e.replace(/\r\n?/g,"\n").replace(/\s+$/,"");return t?t.split("\n"):[]}var i=n(40980);let l={same:" ",add:"+",remove:"-"};function o({before:e,after:t,className:n}){let c=(0,s.useMemo)(()=>(function(e,t=3){let n=[];e.forEach((r,s)=>{if("same"===r.kind)return;let a=Math.max(0,s-t),i=Math.min(e.length-1,s+t),l=n.at(-1);l&&a<=l[1]+1?l[1]=Math.max(l[1],i):n.push([a,i])});let r=[],s=[],a=0,i=0;for(let t of e)r.push(a),s.push(i),"add"!==t.kind&&(a+=1),"remove"!==t.kind&&(i+=1);return n.map(([t,n])=>{let a=e.slice(t,n+1),i=a.filter(e=>"add"!==e.kind).length,l=a.filter(e=>"remove"!==e.kind).length,o=r[t]+ +(0!==i),d=s[t]+ +(0!==l);return{header:`@@ -${o},${i} +${d},${l} @@`,lines:a}})})(function(e,t){let n=a(e),r=a(t),s=0;for(;s<n.length&&s<r.length&&n[s]===r[s];)s+=1;let i=0;for(;i<n.length-s&&i<r.length-s&&n[n.length-1-i]===r[r.length-1-i];)i+=1;let l=n.slice(s,n.length-i),o=r.slice(s,r.length-i),d=function(e,t){let n=e.length,r=t.length,s=n+r,a=s+1,i=new Int32Array(2*s+3),l=[],o=!1;for(let d=0;d<=s&&!o;d+=1){if((l.length+1)*i.length>2e7)return null;l.push(i.slice());for(let s=-d;s<=d;s+=2){let l=s===-d||s!==d&&i[a+s-1]<i[a+s+1]?i[a+s+1]:i[a+s-1]+1,c=l-s;for(;l<n&&c<r&&e[l]===t[c];)l+=1,c+=1;if(i[a+s]=l,l>=n&&c>=r){o=!0;break}}}let d=[],c=n,u=r;for(let n=l.length-1;n>=0;n-=1){let r=l[n],s=c-u,i=s===-n||s!==n&&r[a+s-1]<r[a+s+1]?s+1:s-1,o=r[a+i],m=o-i;for(;c>o&&u>m;)d.push({kind:"same",text:e[c-1]}),c-=1,u-=1;n>0&&(c===o?d.push({kind:"add",text:t[u-1]}):d.push({kind:"remove",text:e[c-1]})),c=o,u=m}return d.reverse()}(l,o)??[...l.map(e=>({kind:"remove",text:e})),...o.map(e=>({kind:"add",text:e}))],c=[...n.slice(0,s).map(e=>({kind:"same",text:e})),...d,...n.slice(n.length-i).map(e=>({kind:"same",text:e}))],u=0,m=0;return c.map(e=>"same"===e.kind?(u+=1,m+=1,{...e,oldNo:u,newNo:m}):"remove"===e.kind?(u+=1,{...e,oldNo:u,newNo:null}):(m+=1,{...e,oldNo:null,newNo:m}))}(e,t)),[e,t]);return 0===c.length?(0,r.jsx)("p",{className:(0,i.cn)("text-xs text-muted-foreground",n),children:"Only whitespace at the end of the file differs."}):(0,r.jsx)("div",{className:(0,i.cn)("overflow-auto font-mono text-[11px] leading-5",n),children:(0,r.jsx)("table",{className:"w-full border-collapse",children:c.map(e=>(0,r.jsxs)("tbody",{children:[(0,r.jsx)("tr",{children:(0,r.jsx)("td",{colSpan:3,className:"bg-muted/60 px-3 text-muted-foreground select-none",children:e.header})}),e.lines.map((e,t)=>(0,r.jsxs)("tr",{className:(0,i.cn)("add"===e.kind&&"bg-emerald-500/12","remove"===e.kind&&"bg-red-500/12"),children:[(0,r.jsx)(d,{value:e.oldNo}),(0,r.jsx)(d,{value:e.newNo}),(0,r.jsxs)("td",{className:"pr-3 whitespace-pre",children:[(0,r.jsx)("span",{className:(0,i.cn)("inline-block w-4 pl-1 select-none","add"===e.kind&&"text-emerald-600 dark:text-emerald-400","remove"===e.kind&&"text-red-600 dark:text-red-400"),children:l[e.kind]}),e.text]})]},t))]},e.header))})})}function d({value:e}){return(0,r.jsx)("td",{className:"w-10 min-w-10 pr-2 text-right text-muted-foreground/50 tabular-nums select-none",children:e??""})}},33807:(e,t,n)=>{n.d(t,{J:()=>a});var r=n(95155);n(12115);var s=n(40980);function a({className:e,...t}){return(0,r.jsx)("label",{"data-slot":"label",className:(0,s.cn)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...t})}},35942:(e,t,n)=>{n.d(t,{F:()=>c});var r=n(95155);n(12115);var s=n(76166),a=n(90839),i=n(84588),l=n(66784),o=n(64084),d=n(40980);function c({className:e,children:t,...n}){return(0,r.jsxs)(s.V,{"data-slot":"scroll-area",className:(0,d.cn)("relative",e),...n,children:[(0,r.jsx)(a.B,{"data-slot":"scroll-area-viewport",className:"size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1",children:t}),(0,r.jsx)(u,{}),(0,r.jsx)(i.I,{})]})}function u({className:e,orientation:t="vertical",...n}){return(0,r.jsx)(l.V,{"data-slot":"scroll-area-scrollbar","data-orientation":t,orientation:t,className:(0,d.cn)("flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent",e),...n,children:(0,r.jsx)(o.l,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-full bg-border"})})}},41069:(e,t,n)=>{n.d(t,{l:()=>a});var r=n(95155),s=n(30374);function a({caption:e,pane:t,onPaneChange:n,migrationsLabel:i="Migrations"}){return(0,r.jsxs)("footer",{className:"flex shrink-0 items-center gap-2 border-t px-4 py-1.5 text-xs text-muted-foreground",children:[(0,r.jsx)("span",{className:"min-w-0 truncate",children:e}),(0,r.jsx)("div",{className:"ml-auto",children:(0,r.jsx)(s.x,{label:"Migrations pane",value:t,onChange:n,options:[{value:"migrations",label:i},{value:"history",label:"Timeline"}]})})]})}},59221:(e,t,n)=>{n.d(t,{o:()=>b});var r=n(95155),s=n(12115),a=n(40980);let i=/^ {0,3}(`{3,}|~{3,})/,l=/^ {0,3}(#{1,6})\s+(.*?)\s*#*\s*$/,o=/^ {0,3}([-*_])(?:\s*\1){2,}\s*$/,d=/^( {0,3})([-*+])(\s+|$)/,c=/^( {0,3})(\d{1,9})[.)](\s+|$)/,u=/^ {0,3}>\s?/,m=/^\[([ xX])\]\s+/;function h(e){return""===e.trim()}function p(e){return i.test(e)||l.test(e)||o.test(e)||d.test(e)||c.test(e)||u.test(e)}function x(e){return e.length-e.trimStart().length}let f=/\\([\\`*_[\]()#>~-])|(`+)([\s\S]*?[^`])\2(?!`)|\*\*(.+?)\*\*|(?<!\w)__(.+?)__(?!\w)|\*(?=\S)(.+?)(?<=\S)\*|(?<!\w)_(?=\S)(.+?)(?<=\S)_(?!\w)|~~(.+?)~~|\[([^\]]+)\]\(([^)\s]+)\)|(https?:\/\/[^\s<]+[^\s<.,:;"')\]!?])|\n/g;function g(e){let t=[],n=0,s=0;for(let a of e.matchAll(f)){let i=a.index??0;i>n&&t.push(e.slice(n,i)),n=i+a[0].length;let[l,o,,d,c,u,m,h,p,x,f,b]=a;void 0!==o?t.push(o):void 0!==d?t.push((0,r.jsx)(v,{children:d.trim()},s++)):void 0!==c||void 0!==u?t.push((0,r.jsx)("strong",{className:"font-medium text-foreground",children:g(c??u)},s++)):void 0!==m||void 0!==h?t.push((0,r.jsx)("em",{children:g(m??h)},s++)):void 0!==p?t.push((0,r.jsx)("s",{children:g(p)},s++)):void 0!==x?t.push((0,r.jsx)(j,{href:f,children:g(x)},s++)):void 0!==b?t.push((0,r.jsx)(j,{href:b,children:b},s++)):"\n"===l&&t.push((0,r.jsx)("br",{},s++))}return n<e.length&&t.push(e.slice(n)),t}function v({children:e}){return(0,r.jsx)("code",{className:"rounded bg-muted px-1 py-px font-mono text-[0.92em]",children:e})}function j({href:e,children:t}){let n=/^(https?:|mailto:)/i.test(e);return(0,r.jsx)("a",{href:n?e:void 0,target:"_blank",rel:"noreferrer",className:"underline decoration-muted-foreground/50 underline-offset-2 hover:decoration-foreground",children:t})}function b({text:e,className:t}){let n=function e(t){let n=[],r=0;for(;r<t.length;){let s=t[r];if(h(s)){r+=1;continue}let a=i.exec(s);if(a){let e=RegExp(`^ {0,3}${a[1][0]}{${a[1].length},}\\s*$`),s=[];for(r+=1;r<t.length&&!e.test(t[r]);)s.push(t[r]),r+=1;r+=1,n.push({type:"code",code:s.join("\n")});continue}let f=l.exec(s);if(f){n.push({type:"heading",level:f[1].length,text:f[2]}),r+=1;continue}if(o.test(s)){n.push({type:"rule"}),r+=1;continue}if(u.test(s)){let s=[];for(;r<t.length&&u.test(t[r]);)s.push(t[r].replace(u,"")),r+=1;n.push({type:"quote",blocks:e(s)});continue}let g=d.exec(s)??c.exec(s);if(g){let a=c.test(s),i=a?Number(g[2]):1,l=[];for(;r<t.length;){let n=(a?c:d).exec(t[r]);if(!n)break;let s=n[0].length,i=[t[r].slice(s)];for(r+=1;r<t.length;){let e=t[r];if(h(e)){let e=t[r+1];if(void 0!==e&&x(e)>=2){i.push(""),r+=1;continue}break}if(x(e)>=2){i.push(e.slice(Math.min(s,x(e)))),r+=1;continue}if(!p(e)&&""!==i[i.length-1]){i.push(e),r+=1;continue}break}let o=m.exec(i[0]);for(o&&(i[0]=i[0].replace(m,"")),l.push({checked:o?" "!==o[1]:null,blocks:e(i)});r<t.length&&h(t[r])&&void 0!==t[r+1];)if((a?c:d).test(t[r+1]))r+=1;else break}n.push({type:"list",ordered:a,start:i,items:l});continue}let v=[s];for(r+=1;r<t.length&&!h(t[r])&&!p(t[r]);)v.push(t[r]),r+=1;n.push({type:"paragraph",text:v.join("\n")})}return n}(e.replace(/\r\n?/g,"\n").split("\n"));return(0,r.jsx)("div",{className:(0,a.cn)("space-y-2 break-words",t),children:function e(t,n){return t.map((t,i)=>{switch(t.type){case"heading":return(0,r.jsx)("p",{className:(0,a.cn)("font-medium text-foreground",t.level<=2?"text-[1.1em]":""),children:g(t.text)},i);case"paragraph":return n?(0,r.jsx)(s.Fragment,{children:g(t.text)},i):(0,r.jsx)("p",{children:g(t.text)},i);case"quote":return(0,r.jsx)("blockquote",{className:"space-y-2 border-l-2 pl-3 text-muted-foreground",children:e(t.blocks,!1)},i);case"code":return(0,r.jsx)("pre",{className:"overflow-x-auto rounded-md border bg-muted/40 px-2.5 py-2 font-mono text-[0.92em] leading-relaxed",children:t.code},i);case"rule":return(0,r.jsx)("hr",{className:"border-border"},i);case"list":{let n=t.ordered?"ol":"ul",s=t.items.some(e=>null!==e.checked);return(0,r.jsx)(n,{start:t.ordered?t.start:void 0,className:(0,a.cn)("space-y-0.5",s?"list-none pl-0":t.ordered?"list-decimal pl-5":"list-disc pl-5"),children:t.items.map((t,n)=>{let s=1===t.blocks.length&&"paragraph"===t.blocks[0].type;return(0,r.jsxs)("li",{className:(0,a.cn)(null!==t.checked&&"flex items-start gap-2"),children:[null!==t.checked&&(0,r.jsx)("span",{"aria-hidden":!0,className:(0,a.cn)("mt-[0.3em] inline-flex size-[0.85em] shrink-0 items-center justify-center rounded-[3px] border",t.checked?"border-foreground bg-foreground text-background":"border-muted-foreground/60"),children:t.checked&&(0,r.jsx)("svg",{viewBox:"0 0 12 12",className:"size-[0.7em]",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,r.jsx)("path",{d:"M2.5 6.5 5 9l4.5-6",strokeLinecap:"round",strokeLinejoin:"round"})})}),(0,r.jsx)("span",{className:(0,a.cn)("min-w-0",!s&&"block space-y-1.5",t.checked&&"text-muted-foreground line-through"),children:e(t.blocks,s)})]},n)})},i)}}})}(n,!1)})}},62417:(e,t,n)=>{n.d(t,{DM:()=>h,FY:()=>o,Gf:()=>a,ay:()=>l,e:()=>m,eh:()=>d,gj:()=>u,kB:()=>x,lF:()=>g,n9:()=>p,nb:()=>c,nj:()=>f,yy:()=>v});var r=n(20642);let s={steps:[],blockedBy:null};function a(e,t){return e?{...e,entries:e.entries.filter(e=>e.setName===t)}:null}function i(e){let t=new Map;for(let n of e?.entries??[])t.set(n.version,n);return t}function l(e,t){return t?t.entries.find(t=>t.version===e.version)??null:null}function o(e,t){if(!t)return"unknown";let n=l(e,t);return n?n.checksum&&n.checksum!==e.checksum?"drifted":"applied":"pending"}function d(e,t){let n={total:e?.steps.length??0,applied:0,drifted:0,pending:0,foreign:0};if(!e)return n;let r=a(t,e.name);for(let t of e.steps){let e=o(t,r);"applied"===e?n.applied+=1:"drifted"===e?n.drifted+=1:"pending"===e&&(n.pending+=1)}return n.foreign=c(e,r).length,n}function c(e,t){if(!t)return[];let n=new Set((e?.steps??[]).map(e=>e.version));return t.entries.filter(e=>!n.has(e.version)).sort((e,t)=>(0,r.Zy)(e.version,t.version))}function u(e,t,n){if(!e||!t)return s;let r=[];for(let s of e.steps)if("pending"===o(s,t)&&r.push(s),void 0!==n&&s.version===n)break;return{steps:r,blockedBy:null}}function m(e,t,n){if(!e||!t)return s;let a=i(t),l=[];for(let t of[...e.steps].reverse()){if(void 0!==n&&0>(0,r.Zy)(t.version,n))break;if(a.has(t.version)){if(!t.revertSql)return{steps:l,blockedBy:t};l.push(t)}}return{steps:l,blockedBy:null}}function h(e,t,n){return e&&t?{steps:e.steps.filter(e=>n.has(e.version)&&"pending"===o(e,t)),blockedBy:null}:s}function p(e,t,n){if(!e||!t)return s;let r=i(t),a=[];for(let t of[...e.steps].reverse())if(n.has(t.version)&&r.has(t.version)){if(!t.revertSql)return{steps:a,blockedBy:t};a.push(t)}return{steps:a,blockedBy:null}}function x(e,t){if(!e||!t)return null;let n=i(t);for(let t of[...e.steps].reverse())if(n.has(t.version))return t;return null}function f(e,t){if(!e||0===e.entries.length)return null;let n=e.entries[0].version;for(let t of e.entries)(0,r.Zy)(t.version,n)>0&&(n=t.version);let s=t.filter(e=>0>(0,r.Zy)(e.version,n));return s.length>0?{steps:s,after:n}:null}function g(e,t){let n=new Set(t.map(e=>e.toLowerCase())),s=new Map;for(let t of e)for(let e of t.ledger?.entries??[]){let r=e.setName.trim();if(!r||n.has(r.toLowerCase()))continue;let a=s.get(r)??new Map,i=a.get(t.connection.id)??new Set;i.add(e.version),a.set(t.connection.id,i),s.set(r,a)}return[...s.entries()].map(([t,n])=>{let s=new Set;for(let e of n.values())for(let t of e)s.add(t);return{name:t,versions:[...s].sort(r.Zy),total:s.size,applied:e.map(e=>({connectionId:e.connection.id,connectionName:e.connection.name,count:n.get(e.connection.id)?.size??0}))}}).sort((e,t)=>e.name.localeCompare(t.name))}function v(e,t,n){let r=n.query.trim().toLowerCase();if(r&&![e.name,...e.steps.flatMap(e=>[e.version,e.name])].join("\n").toLowerCase().includes(r))return!1;let{status:s}=n;if("all"===s)return!0;if(s.startsWith("pending:")){let e=t.find(e=>e.connectionId===s.slice(8));return!e||!e.read||e.summary.pending>0||e.summary.drifted>0}return"pending"===s?t.some(e=>!e.read||e.summary.pending>0||e.summary.drifted>0):"untouched"===s?t.every(e=>!e.read||0===e.summary.applied&&0===e.summary.drifted):"complete"!==s||e.steps.length>0&&t.every(e=>e.read&&0===e.summary.pending&&0===e.summary.drifted)}},71612:(e,t,n)=>{n.d(t,{y:()=>a});var r=n(87364),s=n(27529);function a(e,t){return(0,r.Y)(`repo:${e??""}:${t??""}`,async n=>e?s.F.repo(e,t,n):null)}},72194:(e,t,n)=>{n.d(t,{F:()=>i});var r=n(95155),s=n(40980),a=n(32538);function i({connection:e,className:t}){return(0,r.jsx)("span",{"aria-hidden":!0,className:(0,s.cn)("size-2.5 shrink-0 rounded-full",t),style:{background:(0,a.Mq)(e)}})}},77649:(e,t,n)=>{n.d(t,{k:()=>h,$:()=>m});var r=n(95155),s=n(12115),a=n(13267),i=n(89239);function l(e){let t=e.createReader?.();return t?new Promise((e,n)=>{let r=[],s=()=>{t.readEntries(t=>{0===t.length||r.length>=2e3?e(r):(r.push(...t),s())},n)};s()}):Promise.resolve([])}async function o(e,t,n,r){if(r.length>=2e3||n>6||e.name.startsWith("."))return;let s=t?`${t}/${e.name}`:e.name;if(e.isFile){if(!/\.sql$/i.test(e.name))return;let t=await new Promise((t,n)=>{e.file?e.file(t,n):n(Error(`Could not read ${e.name}`))});r.push({path:s,text:await t.text()});return}if(e.isDirectory)for(let t of(await l(e)))await o(t,s,n+1,r)}async function d(e){let t=[];for(let n of Array.from(e.items)){if("file"!==n.kind)continue;let e=n.webkitGetAsEntry?.();e&&t.push(e)}if(0===t.length){let t=Array.from(e.files).filter(e=>/\.sql$/i.test(e.name));return 0===t.length?null:{name:"Migrations",files:await Promise.all(t.map(async e=>({path:e.name,text:await e.text()})))}}let n=1===t.length&&t[0].isDirectory?t[0]:null,r=[];if(n){for(let e of(await l(n)))await o(e,"",1,r);return{name:n.name,files:r}}for(let e of t)await o(e,"",0,r);return r.length>0?{name:"Migrations",files:r}:null}async function c(e){let t,n=Array.from(e).filter(e=>/\.sql$/i.test(e.name));if(0===n.length)return null;let r=new Set(n.map(e=>(e.webkitRelativePath||e.name).split("/")[0])),s=1===r.size&&((t=n[0]).webkitRelativePath||t.name).includes("/")?[...r][0]:null;return{name:s??"Migrations",files:await Promise.all(n.slice(0,2e3).map(async e=>{let t=e.webkitRelativePath||e.name;return{path:s?t.slice(s.length+1):t,text:await e.text()}}))}}var u=n(40980);function m(e){let[t,n]=(0,s.useState)(!1),[r,a]=(0,s.useState)(null);return{importFrom:(0,s.useCallback)(async t=>{n(!0),a(null);try{let n=t instanceof FileList?await c(t):await d(t);if(!n||0===n.files.length)return void a("No .sql files in there.");e(n)}catch(e){a(e instanceof Error?e.message:"Couldn’t read that folder.")}finally{n(!1)}},[e]),busy:t,error:r,clearError:()=>a(null)}}function h({onFiles:e,className:t,compact:n=!1}){let{importFrom:l,busy:o,error:d}=m(e),[c,p]=(0,s.useState)(!1),x=(0,s.useRef)(null),f=(0,s.useRef)(null);return(0,s.useEffect)(()=>{x.current?.setAttribute("webkitdirectory",""),x.current?.setAttribute("directory","")},[]),(0,r.jsxs)("div",{onDragOver:e=>{e.preventDefault(),p(!0)},onDragLeave:()=>p(!1),onDrop:e=>{e.preventDefault(),p(!1),l(e.dataTransfer)},className:(0,u.cn)("flex items-center justify-center rounded-lg border border-dashed text-center transition-colors",n?"flex-wrap gap-x-3 gap-y-2 px-4 py-3":"flex-col gap-4 px-6 py-10",c?"border-primary bg-primary/5":"border-border",t),children:[o?(0,r.jsx)(a.gnh,{className:"size-4 shrink-0 animate-spin text-muted-foreground"}):(0,r.jsx)(a.FeY,{className:(0,u.cn)("shrink-0 text-muted-foreground",n?"size-4":"size-5")}),n?(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:"Drop a folder of .sql files"}):(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)("p",{className:"text-sm font-medium",children:"Drop a migration folder"}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:".sql files, optionally split into apply/ and revert/"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsxs)(i.$,{size:n?"xs":"sm",variant:n?"ghost":"outline",disabled:o,onClick:()=>x.current?.click(),children:[(0,r.jsx)(a.WzY,{"data-icon":"inline-start"}),"Choose folder"]}),(0,r.jsx)(i.$,{size:n?"xs":"sm",variant:"ghost",disabled:o,onClick:()=>f.current?.click(),children:"Choose files"})]}),d&&(0,r.jsx)("p",{className:"w-full text-xs text-destructive",children:d}),(0,r.jsx)("input",{ref:x,type:"file",multiple:!0,className:"sr-only",onChange:e=>{let{files:t}=e.target;t&&t.length>0&&l(t),e.target.value=""}}),(0,r.jsx)("input",{ref:f,type:"file",multiple:!0,accept:".sql",className:"sr-only",onChange:e=>{let{files:t}=e.target;t&&t.length>0&&l(t),e.target.value=""}})]})}},83504:(e,t,n)=>{n.d(t,{I:()=>u,p:()=>d});var r=n(95155),s=n(13267),a=n(59221),i=n(72194),l=n(89239),o=n(42763);function d(e){try{let t=new URL(e),n=t.username?`${decodeURIComponent(t.username)}@`:"",r=t.port?`:${t.port}`:"";return`${n}${t.hostname}${r}${t.pathname}`}catch{return"this connection"}}function c({status:e}){switch(e){case"running":return(0,r.jsx)(s.gnh,{className:"size-3.5 shrink-0 animate-spin text-primary"});case"ok":return(0,r.jsx)(s.wiW,{className:"size-3.5 shrink-0 text-emerald-600 dark:text-emerald-400"});case"failed":return(0,r.jsx)(s.yBK,{className:"size-3.5 shrink-0 text-destructive"});case"skipped":return(0,r.jsx)(s.uPM,{className:"size-3.5 shrink-0 text-muted-foreground/60"});default:return(0,r.jsx)(s.Rzr,{className:"size-3.5 shrink-0 text-muted-foreground/60"})}}function u({open:e,direction:t,connection:n,steps:m,blockedBy:h,progress:p,running:x,recordOnly:f,note:g,outOfOrder:v,rehearsal:j,onRun:b,onRehearse:k,onStop:y,onClose:N}){let w=f?"apply"===t?"Mark as applied":"Mark as not applied":"apply"===t?"Apply":"Revert",$=f?"Marked":"apply"===t?"Applied":"Reverted",S=m.length,C=m.filter(e=>{var t;return"wrapped-by-ytdb"!==(t=e.transaction)&&"self-wrapped"!==t}),z=p?.find(e=>"failed"===e.status)??null,M=null!==p&&!x,L=p?.filter(e=>"ok"===e.status).length??0,R=!p||j&&M,D=v?.steps??[],q=p??m.map(e=>({version:e.version,name:e.name,status:"waiting"}));return(0,r.jsx)(o.lG,{open:e,onOpenChange:e=>!e&&!x&&N(),children:(0,r.jsxs)(o.Cf,{className:"sm:max-w-lg",children:[(0,r.jsxs)(o.c7,{children:[(0,r.jsx)(o.L3,{children:0===S&&h?"Nothing here can be reverted":j&&p?x?`Dry run of ${S} migration${1===S?"":"s"}…`:z?`Dry run failed at ${L+1} of ${S}`:`Dry run passed: ${S} migration${1===S?"":"s"}`:M?z?`${w} stopped after ${L} of ${S}`:`${$} ${L} migration${1===L?"":"s"}`:f?`${"Mark as applied"===w?"Mark":"Unmark"} ${S} migration${1===S?"":"s"} on ${n.name}?`:`${w} ${S} migration${1===S?"":"s"}?`}),(0,r.jsx)(o.rr,{children:(0,r.jsxs)("span",{className:"flex flex-wrap items-center gap-1.5",children:[(0,r.jsx)("span",{children:f?M?"Recorded on":"Records on":j&&p?"Tried against, without keeping anything on":M?"Ran against":"Runs against"}),(0,r.jsx)(i.F,{connection:n}),(0,r.jsx)("span",{className:"font-medium text-foreground",children:n.name}),(0,r.jsx)("span",{className:"font-mono text-[11px]",children:d(n.url)})]})})]}),R&&g&&(0,r.jsxs)("div",{className:"flex max-h-40 gap-2 overflow-y-auto rounded-md border bg-muted/30 px-3 py-2 text-xs",children:[(0,r.jsx)(s.UA_,{className:"mt-px size-3.5 shrink-0 text-muted-foreground"}),(0,r.jsx)(a.o,{text:g,className:"min-w-0 flex-1"})]}),q.length>0&&(0,r.jsx)("div",{className:"max-h-64 overflow-y-auto rounded-md border",children:q.map(e=>(0,r.jsxs)("div",{className:"flex items-center gap-2 border-b px-3 py-1.5 text-xs last:border-b-0",children:[(0,r.jsx)(c,{status:e.status}),(0,r.jsx)("span",{className:"shrink-0 font-mono text-muted-foreground",children:e.version}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e.name}),void 0!==e.durationMs&&(0,r.jsxs)("span",{className:"shrink-0 tabular-nums text-muted-foreground",children:[e.durationMs," ms"]})]},e.version))}),z?.error&&(0,r.jsx)("p",{className:"max-h-32 overflow-auto rounded-md border border-destructive/25 bg-destructive/5 px-3 py-2 font-mono text-[11px] whitespace-pre-wrap text-destructive",children:z.error}),R&&h&&(0,r.jsxs)("p",{className:"flex gap-2 text-xs text-muted-foreground",children:[(0,r.jsx)(s.e5t,{className:"mt-px size-3.5 shrink-0 text-amber-600 dark:text-amber-400"}),(0,r.jsx)("span",{children:0===S?`${h.version} ${h.name} is the newest one applied and has no revert file, so nothing below it can be reached.`:`Stops at ${h.version} ${h.name}, which has no revert file.`})]}),R&&f&&(0,r.jsxs)("p",{className:"rounded-md border border-amber-600/25 bg-amber-500/8 px-3 py-2 text-xs",children:[(0,r.jsx)("span",{className:"font-medium",children:"No SQL runs."})," Only the ledger on ",n.name," ","changes."]}),R&&!f&&"apply"===t&&D.length>0&&(0,r.jsxs)("p",{className:"flex gap-2 text-xs text-muted-foreground",children:[(0,r.jsx)(s.e5t,{className:"mt-px size-3.5 shrink-0 text-amber-600 dark:text-amber-400"}),(0,r.jsxs)("span",{children:[1===D.length?`${D[0].version} is older than ${v?.after}, which is already applied here.`:`${D.map(e=>e.version).join(", ")} are older than ${v?.after}, which is already applied here.`," ",1===D.length?"It was":"They were"," probably merged after it ran, so check"," ",1===D.length?"it does":"they do"," not depend on going first."]})]}),R&&!f&&C.length>0&&(0,r.jsxs)("p",{className:"flex gap-2 text-xs text-muted-foreground",children:[(0,r.jsx)(s.e5t,{className:"mt-px size-3.5 shrink-0 text-amber-600 dark:text-amber-400"}),(0,r.jsx)("span",{children:1===C.length?`${C[0].version} runs outside a transaction, so a failure partway leaves it half applied.`:`${C.length} of these run outside a transaction, so a failure partway leaves them half applied.`})]}),R&&!f&&"revert"===t&&(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:"Reverting runs newest first and can drop data the migrations created."}),(0,r.jsx)(o.Es,{children:x?j?(0,r.jsx)(l.$,{variant:"outline",disabled:!0,children:"Trying…"}):(0,r.jsx)(l.$,{variant:"outline",onClick:y,children:"Stop after this one"}):M&&!j?(0,r.jsx)(l.$,{onClick:N,children:"Close"}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(l.$,{variant:"outline",onClick:N,children:0===S?"Close":"Cancel"}),S>0&&k&&!f&&(0,r.jsxs)(l.$,{variant:"outline",onClick:k,title:"Runs every step in one transaction and rolls it back, so you see whether it would go through without changing anything.",children:[(0,r.jsx)(s.DPG,{"data-icon":"inline-start"}),j&&M?"Dry run again":"Dry run"]}),S>0&&(0,r.jsx)(l.$,{variant:f||"revert"!==t?"default":"destructive",onClick:b,children:f?`${w} (${S})`:`${w} ${1===S?"migration":`${S} migrations`}`})]})})]})})}}}]);
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9532],{7412:(e,t,n)=>{n.d(t,{L:()=>i});var r=n(95155),s=n(13267),a=n(40980);function i({trailing:e,className:t,...n}){return(0,r.jsxs)("div",{className:(0,a.cn)("flex h-8 items-center gap-1.5 rounded-lg px-2 text-muted-foreground transition-colors focus-within:bg-muted/60 hover:bg-muted/60",t),children:[(0,r.jsx)(s.TfF,{className:"size-3.5 shrink-0"}),(0,r.jsx)("input",{type:"text",spellCheck:!1,autoComplete:"off",...n,className:"h-full min-w-0 flex-1 bg-transparent text-[0.8rem] text-foreground outline-none placeholder:text-muted-foreground"}),e]})}},9385:(e,t,n)=>{function r(e){let t=Date.parse(e);return Number.isNaN(t)?0:t}function s(e,t){let n=new Map(e.map(e=>[e.connection.id,e])),s=t.filter(e=>n.has(e.connectionId)).map(e=>({id:e.id,runId:e.runId,connectionId:e.connectionId,connectionName:e.connectionName,version:e.version,name:e.name,at:e.ranAt,kind:"failed"===e.status?"failed":e.recorded?"apply"===e.direction?"marked":"unmarked":"apply"===e.direction?"applied":"reverted",durationMs:e.durationMs,error:e.error,setName:e.setName,fromLedger:!1})),a=new Map;for(let e of s){let t=`${e.connectionId}:${e.setName??""}:${e.version}`,n=a.get(t);(!n||e.at>n.at)&&a.set(t,e)}let i=[...s];for(let t of e)for(let e of t.ledger?.entries??[]){let n=`${t.connection.id}:${e.setName}:${e.version}`,s=a.get(n);if(s&&("applied"===s.kind||"marked"===s.kind)&&2e3>Math.abs(s.at-(r(e.appliedAt)+(e.durationMs??0)))){s.appliedBy=e.appliedBy;continue}i.push({id:`ledger:${t.connection.id}:${e.setName}:${e.version}`,connectionId:t.connection.id,connectionName:t.connection.name,version:e.version,name:e.name||e.version,at:r(e.appliedAt),kind:"applied",durationMs:e.durationMs,setName:e.setName,appliedBy:e.appliedBy,fromLedger:!0})}return i.sort((e,t)=>t.at-e.at)}n.d(t,{x:()=>s})},17021:(e,t,n)=>{n.d(t,{H:()=>N});var r=n(95155),s=n(12115),a=n(13267),i=n(72194),l=n(40891),o=n(89239),d=n(72264),c=n(30374),u=n(7412),m=n(87364),h=n(27529);let p=["applied","reverted","marked","unmarked","failed","uncertain","legacy"];var x=n(79668),f=n(40980),g=n(28335);function v({connection:e,ledgerSchema:t,event:n,step:i,onResolved:l,onRetry:d}){let c,u,p=(0,m.Y)(`reconcile:${e.id}:${t}:${n.id}`,r=>h.F.reconcile(e.url,t,n.id,r)),[x,g]=(0,s.useState)(null),[j,b]=(0,s.useState)(null);async function k(r,s=!1){g(r),b(null);try{await h.F.resolve(e.url,t,{eventId:n.id,outcome:r,checksum:i?.checksum}),l(r),s&&d?.()}catch(e){b(e instanceof Error?e.message:String(e))}finally{g(null)}}if(p.error)return(0,r.jsxs)("div",{className:"flex items-center gap-2 border-b p-3 text-xs text-destructive",role:"alert",children:[(0,r.jsx)("span",{className:"min-w-0 flex-1 break-words",children:p.error}),(0,r.jsx)(o.$,{size:"xs",variant:"ghost",onClick:p.reload,children:"Retry"})]});if(!p.data)return(0,r.jsxs)("p",{className:"flex items-center gap-2 border-b p-3 text-xs text-muted-foreground",children:[(0,r.jsx)(a.gnh,{className:"size-3.5 animate-spin"}),"Checking ",e.name,"…"]});let{running:y,detection:N}=p.data,w="revert"===n.direction,$=N?.evidence??[],S=$.filter(e=>e.satisfied).length;return y?(c=`Still running on ${e.name}${y.since?` since ${new Date(y.since).toLocaleTimeString()}`:""}. Leave it be; the timeline updates when it finishes.`,u=null):n.atomic?(c=`This ran in one transaction that never committed, so nothing from it is on ${e.name}.`,u="lost"):N&&"unknown"!==N.verdict?"applied"===N.verdict?(c=`Everything it ${w?"removes is gone from":"creates or changes is on"} ${e.name}.`,u="landed"):"pending"===N.verdict?(c=`Nothing it ${w?"removes is gone from":"creates or changes is on"} ${e.name}.`,u="lost"):(c=`Some of what it does is on ${e.name} and some is not. Finish or undo the rest by hand in the query editor before settling it.`,u=null):(c=`This SQL leaves no trace in the schema — data changes, seeds, grants — so ${e.name} cannot say whether it ran. Check by hand before settling it.`,u=null),(0,r.jsxs)("div",{className:"border-b",children:[(0,r.jsxs)("div",{className:"flex items-start gap-2 px-3 py-2",children:[(0,r.jsx)("p",{className:"min-w-0 flex-1 text-xs",children:c}),(0,r.jsx)(o.$,{size:"icon-xs",variant:"ghost","aria-label":"Check again",title:"Check again",disabled:p.loading,onClick:p.reload,children:(0,r.jsx)(a.oS8,{className:(0,f.cn)("size-3.5",p.loading&&"animate-spin")})})]}),$.length>0&&(0,r.jsxs)("div",{className:"mx-3 mb-2 max-h-40 overflow-y-auto rounded-md border bg-muted/25",children:[(0,r.jsxs)("p",{className:"border-b px-2 py-1 text-[11px] text-muted-foreground",children:[S," of ",$.length," ",1===$.length?"thing":"things"," it would leave behind ",1===S?"is":"are"," there"]}),$.map(e=>(0,r.jsxs)("p",{className:"flex items-center gap-1.5 px-2 py-0.5 font-mono text-[11px]",children:[e.satisfied?(0,r.jsx)(a.wiW,{className:"size-3 shrink-0 text-emerald-600 dark:text-emerald-400"}):(0,r.jsx)(a.yBK,{className:"size-3 shrink-0 text-muted-foreground/60"}),(0,r.jsx)("span",{className:"min-w-0 truncate",title:e.note?`${e.description} — ${e.note}`:e.description,children:e.description})]},e.description))]}),j&&(0,r.jsx)("p",{className:"mx-3 mb-2 rounded-md border border-destructive/25 bg-destructive/5 px-2 py-1 font-mono text-[11px] whitespace-pre-wrap text-destructive",children:j}),!y&&(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 px-3 pb-2",children:[(0,r.jsx)(o.$,{size:"xs",variant:"landed"===u?"default":"outline",disabled:null!==x,title:"Writes the ledger row this run would have written. No SQL runs.",onClick:()=>void k("landed"),children:"landed"===x?"Marking…":w?"Mark as reverted":"Mark as applied"}),(0,r.jsx)(o.$,{size:"xs",variant:"lost"===u?"default":"outline",disabled:null!==x,title:"Closes this run as failed. The ledger is left as it is.",onClick:()=>void k("lost"),children:"lost"===x?"Marking…":"Mark as failed"}),d&&!w&&(0,r.jsx)(o.$,{size:"xs",variant:"ghost",disabled:null!==x,title:"Closes this run as failed and runs the migration again.",onClick:()=>void k("lost",!0),children:"Retry"})]})]})}let j={applied:"Applied",reverted:"Reverted",marked:"Marked as applied",unmarked:"Marked as not applied",failed:"Failed",uncertain:"Unconfirmed",legacy:"Previously recorded"};function b({kind:e}){let t="size-3.5 shrink-0";switch(e){case"failed":return(0,r.jsx)(a.yBK,{className:(0,f.cn)(t,"text-destructive")});case"uncertain":return(0,r.jsx)(a.e5t,{className:(0,f.cn)(t,"text-amber-600 dark:text-amber-400")});case"reverted":return(0,r.jsx)(a.ij9,{className:(0,f.cn)(t,"text-amber-600 dark:text-amber-400")});case"marked":return(0,r.jsx)(a.nXx,{className:(0,f.cn)(t,"text-muted-foreground")});case"unmarked":return(0,r.jsx)(a.fJ4,{className:(0,f.cn)(t,"text-muted-foreground")});case"legacy":return(0,r.jsx)(a.A01,{className:(0,f.cn)(t,"text-muted-foreground")});default:return(0,r.jsx)(a.wiW,{className:(0,f.cn)(t,"text-emerald-600 dark:text-emerald-400")})}}function k({event:e,schema:t}){let[n,i]=(0,s.useState)("sql"),d=(0,m.Y)(`timeline:${e.connection.id}:${t}:${e.shared.id}`,n=>h.F.timelineDetail(e.connection.url,t,e.shared.id,n));if(d.error)return(0,r.jsxs)("div",{className:"flex items-center gap-2 p-3 text-xs text-destructive",role:"alert",children:[(0,r.jsx)("span",{className:"min-w-0 flex-1 break-words",children:d.error}),(0,r.jsx)(o.$,{size:"xs",variant:"ghost",onClick:d.reload,children:"Retry"})]});if(!d.data)return(0,r.jsxs)("p",{className:"flex items-center gap-2 p-3 text-xs text-muted-foreground",children:[(0,r.jsx)(a.gnh,{className:"size-3.5 animate-spin"}),"Loading…"]});let u=d.data,p="revert"===n?u.revertSql:u.sql,x=[{value:"sql",label:"SQL"}];return null!==u.previousSql&&null!==u.sql&&x.push({value:"changes",label:"Changes"}),null!==u.revertSql&&x.push({value:"revert",label:"Rollback"}),(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 border-b px-3 py-1.5",children:[(0,r.jsx)(c.x,{label:"Saved migration SQL",value:n,options:x,onChange:i}),"changes"===n&&u.previousAt&&(0,r.jsxs)("span",{className:"text-[11px] text-muted-foreground",children:["Since ",new Date(u.previousAt).toLocaleString()]})]}),"changes"===n?u.previousSql===u.sql?(0,r.jsx)("p",{className:"p-3 text-xs text-muted-foreground",children:"Unchanged since the last successful run."}):(0,r.jsx)(g.u,{before:u.previousSql??"",after:u.sql??"",className:"max-h-96 py-2"}):p?(0,r.jsx)("div",{className:"flex max-h-96 min-h-0 flex-col",children:(0,r.jsx)(l.iX,{sql:p,loading:!1,error:null})}):(0,r.jsx)("p",{className:"p-3 text-xs text-muted-foreground",children:"No SQL saved."})]})}function y({event:e,settling:t}){var n;let l,[o,d]=(0,s.useState)(!1),c=`timeline-${e.connection.id}-${e.id}`,u=t.ledgerSchema,m=t.findStep?.(e.setName??"",e.version)??null,h="failed"===e.kind||"uncertain"===e.kind?"bg-destructive/5 text-destructive":"bg-muted/30 text-muted-foreground";return(0,r.jsxs)("div",{className:"relative pl-9 before:absolute before:top-0 before:bottom-0 before:left-[11px] before:border-l last:before:bottom-6",children:[(0,r.jsx)("span",{className:"absolute top-3 left-0 flex size-6 items-center justify-center rounded-full border bg-background",children:(0,r.jsx)(b,{kind:e.kind})}),(0,r.jsxs)("button",{type:"button","aria-expanded":o,"aria-controls":c,onClick:()=>d(!o),className:"group flex w-full min-w-0 cursor-pointer items-start gap-2 rounded-lg px-2 py-3 text-left transition-colors hover:bg-muted/50 focus-visible:outline-2 focus-visible:outline-ring",children:[(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-xs",children:[(0,r.jsx)("span",{title:(l=[],("marked"===e.kind||"unmarked"===e.kind)&&l.push("No SQL ran. Only the migration record changed."),"legacy"===e.kind&&l.push("Preserved from the earlier ledger, which did not distinguish running from marking."),"uncertain"===e.kind&&l.push("No confirmed outcome: it may still be running, or it was interrupted. Open it to see what the database says."),"failed"===e.kind&&e.shared?.atomic&&l.push("The transaction was rolled back."),e.shared&&!e.shared.atomic&&"legacy"!==e.kind&&l.push("This SQL manages its own transactions, so a failure can leave changes applied."),"browser"===e.source&&l.push("Stored in this browser only."),l.join(" ")||void 0),className:(0,f.cn)("font-medium","failed"===e.kind&&"text-destructive","uncertain"===e.kind&&"text-amber-600 dark:text-amber-400"),children:j[e.kind]}),(0,r.jsx)("span",{className:"font-mono text-muted-foreground",children:e.version}),(0,r.jsx)("span",{className:"min-w-0 truncate font-medium",title:e.name,children:e.name})]}),(0,r.jsxs)("div",{className:"mt-1.5 flex flex-wrap items-center gap-x-2 gap-y-1 text-[11px] text-muted-foreground",children:[(0,r.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,r.jsx)(i.F,{connection:e.connection,className:"size-1.5"}),e.connection.name]}),e.setName&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{"aria-hidden":"true",children:"\xb7"}),(0,r.jsx)("span",{className:"max-w-48 truncate",children:e.setName})]}),e.appliedBy&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{"aria-hidden":"true",children:"\xb7"}),(0,r.jsx)("span",{title:"PostgreSQL role",children:e.appliedBy})]}),null!==e.durationMs&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{"aria-hidden":"true",children:"\xb7"}),(0,r.jsx)("span",{children:null===(n=e.durationMs)?null:n<1e3?`${n} ms`:`${(n/1e3).toFixed(1)} s`})]}),"browser"===e.source&&(0,r.jsx)("span",{className:"rounded bg-muted px-1.5 py-0.5",children:"This browser"})]})]}),(0,r.jsx)("time",{dateTime:new Date(e.at).toISOString(),title:new Date(e.at).toLocaleString(),className:"shrink-0 text-[11px] text-muted-foreground tabular-nums",children:new Date(e.at).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}),(0,r.jsx)(a.nNJ,{className:(0,f.cn)("size-3.5 shrink-0 text-muted-foreground transition-transform",o&&"rotate-90")})]}),o&&(0,r.jsxs)("div",{id:c,className:"mb-3 overflow-hidden rounded-lg border bg-background",children:["uncertain"===e.kind&&e.shared&&(0,r.jsx)(v,{connection:e.connection,ledgerSchema:u,event:e.shared,step:m,onResolved:t.onResolved,onRetry:t.onRetry&&m&&"apply"===e.shared.direction?()=>t.onRetry?.(m):void 0}),e.error&&(0,r.jsx)("pre",{className:(0,f.cn)("max-h-48 overflow-auto border-b p-3 font-mono text-[11px] whitespace-pre-wrap break-words",h),children:e.error}),e.shared?(0,r.jsx)(k,{event:e,schema:u}):(0,r.jsx)("p",{className:"p-3 text-xs text-muted-foreground",children:"No saved SQL."})]})]})}function N({events:e,connections:t,loading:n,ledgerSchema:l,setName:c,findStep:m,onLedgerChange:g,onRetry:v}){let b=(0,x.jV)(e=>e.clearHistory),[k,w]=(0,s.useState)(""),[$,S]=(0,s.useState)("all"),[C,z]=(0,s.useState)("all"),M=(0,s.useMemo)(()=>t.filter(e=>"all"===$||e.id===$),[t,$]),L=(0,s.useMemo)(()=>({setName:c,query:k.trim(),kind:"all"===C?void 0:C}),[c,k,C]),R=function(e,t,n){let[r,a]=(0,s.useState)({}),[i,l]=(0,s.useState)(!0),o=(0,s.useRef)(r),d=(0,s.useRef)(!1),c=(0,s.useRef)(null),u=JSON.stringify([e.map(e=>[e.id,e.url]),t,n]),m=(0,s.useRef)(u),p=(0,s.useCallback)(async(r=!1)=>{if(d.current)return;d.current=!0,l(!0);let s=new AbortController;c.current=s;let i={...o.current};await Promise.all(e.map(async e=>{let a=o.current[e.id]?.page;if(!r||a?.nextCursor)try{let l=await h.F.timeline(e.url,t,{...n,before:r?a?.nextCursor??void 0:void 0},s.signal);if(a&&l.initialized){let e=new Set(l.events.map(e=>e.id)),t=l.events.some(e=>a.events.some(t=>t.id===e.id));(r||t)&&(l.events=[...l.events,...a.events.filter(t=>!e.has(t.id))].sort((e,t)=>BigInt(e.sequence)>BigInt(t.sequence)?-1:1),r||(l.nextCursor=a.nextCursor))}i[e.id]={page:l}}catch(t){i[e.id]={page:a,error:t instanceof Error?t.message:String(t)}}})),s.signal.aborted||(o.current=i,a(i),l(!1),d.current=!1)},[e,t,n]);return(0,s.useEffect)(()=>{d.current=!1,m.current!==u&&(m.current=u,o.current={});let e=()=>{"visible"===document.visibilityState&&p()},t=window.setTimeout(()=>void p(),200),n=window.setInterval(e,1e4);return window.addEventListener("focus",e),()=>{window.clearTimeout(t),window.clearInterval(n),window.removeEventListener("focus",e),c.current?.abort()}},[p,u]),{reads:r,loading:i,refresh:()=>void p(),loadMore:()=>void p(!0),hasMore:Object.values(r).some(e=>!!e.page?.nextCursor)}}(M,l,L),D={ledgerSchema:l,findStep:m,onRetry:v,onResolved:e=>{R.refresh(),"landed"===e&&g?.()}},q=[];for(let t of M){let n=R.reads[t.id]?.page,r=n?.events??[];for(let e of r)q.push({id:`${t.id}:${e.id}`,connection:t,name:e.name,version:e.version,setName:e.setName,at:Date.parse(e.startedAt),kind:e.kind,durationMs:e.durationMs,appliedBy:e.appliedBy,error:e.error,shared:e,source:"shared"});for(let s of e.filter(e=>e.connectionId===t.id)){if(n?.initialized&&s.fromLedger||r.some(e=>e.id===s.runId||!s.runId&&"legacy"===e.kind&&e.setName===s.setName&&e.version===s.version&&("applied"===s.kind||"marked"===s.kind)&&2e3>Math.abs(Date.parse(e.startedAt)+(e.durationMs??0)-s.at)))continue;let e=s.fromLedger?"legacy":s.kind;(!L.kind||L.kind===e)&&(!L.query||[s.name,s.version,s.setName,s.appliedBy].join(" ").toLowerCase().includes(L.query.toLowerCase()))&&q.push({...s,kind:e,connection:t,source:s.fromLedger?"ledger":"browser"})}}q.sort((e,t)=>t.at-e.at||e.id.localeCompare(t.id));let B=new Map;for(let e of q){let t=function(e){let t=new Date(e),n=new Date;return t.toDateString()===n.toDateString()?"Today":(n.setDate(n.getDate()-1),t.toDateString()===n.toDateString())?"Yesterday":t.toLocaleDateString(void 0,{month:"long",day:"numeric",year:"numeric"})}(e.at);B.set(t,[...B.get(t)??[],e])}let F=M.filter(e=>R.reads[e.id]?.error),I=e.some(e=>!e.fromLedger),A="all"!==$||"all"!==C,T=A?[t.find(e=>e.id===$)?.name,"all"===C?void 0:j[C]].filter(Boolean).join(" \xb7 "):"All";return(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsxs)("div",{className:"sticky top-0 z-10 flex items-center gap-1 border-b bg-background px-2 py-1",children:[(0,r.jsx)(u.L,{"aria-label":"Search timeline",placeholder:"Search timeline",value:k,maxLength:200,onChange:e=>w(e.target.value),className:"min-w-0 flex-1",trailing:k?(0,r.jsx)("button",{type:"button","aria-label":"Clear search",className:"cursor-pointer rounded p-0.5 hover:text-foreground",onClick:()=>w(""),children:(0,r.jsx)(a.yBK,{className:"size-3.5"})}):null}),(0,r.jsxs)(d.rI,{children:[(0,r.jsxs)(d.ty,{render:(0,r.jsx)(o.$,{size:"sm",variant:A?"outline":"ghost"}),className:"max-w-56 cursor-pointer",children:[(0,r.jsx)("span",{className:"truncate",children:T}),(0,r.jsx)(a.RQe,{"data-icon":"inline-end"})]}),(0,r.jsxs)(d.SQ,{align:"end",className:"min-w-48",children:[t.length>1&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(d.I,{children:[(0,r.jsx)(d.lp,{children:"Environment"}),(0,r.jsxs)(d.Hr,{value:$,onValueChange:e=>S(e),children:[(0,r.jsx)(d.Ht,{value:"all",children:"All environments"}),t.map(e=>(0,r.jsxs)(d.Ht,{value:e.id,children:[(0,r.jsx)(i.F,{connection:e,className:"size-1.5"}),e.name]},e.id))]})]}),(0,r.jsx)(d.mB,{})]}),(0,r.jsxs)(d.I,{children:[(0,r.jsx)(d.lp,{children:"Outcome"}),(0,r.jsxs)(d.Hr,{value:C,onValueChange:e=>z(e),children:[(0,r.jsx)(d.Ht,{value:"all",children:"All outcomes"}),p.map(e=>(0,r.jsx)(d.Ht,{value:e,children:j[e]},e))]})]})]})]}),(0,r.jsx)(o.$,{variant:"ghost",size:"icon-sm",onClick:R.refresh,disabled:R.loading,"aria-label":"Refresh timeline",title:"Refresh timeline",children:(0,r.jsx)(a.oS8,{className:(0,f.cn)("size-3.5",R.loading&&"animate-spin")})}),I&&(0,r.jsx)(o.$,{variant:"ghost",size:"icon-sm",onClick:()=>b(),"aria-label":"Clear local log",title:"Clears this browser's log. The databases' ledgers and timelines are untouched.",children:(0,r.jsx)(a.GVO,{className:"size-3.5"})})]}),F.map(e=>(0,r.jsxs)("p",{role:"alert",title:R.reads[e.id].error,className:"truncate px-4 pt-2 text-[11px] text-destructive",children:[e.name,": ",R.reads[e.id].error]},e.id)),0===q.length?(0,r.jsx)("p",{className:"px-4 py-6 text-sm text-muted-foreground",children:R.loading||n?"Reading timeline…":k.trim()||A?"No matching events.":"Nothing has run yet."}):(0,r.jsxs)("div",{className:"px-4 pb-4",children:[[...B].map(([e,t])=>(0,r.jsxs)("section",{"aria-label":e,children:[(0,r.jsx)("h3",{className:"pt-4 pb-2 text-[11px] font-medium text-muted-foreground",children:e}),t.map(e=>(0,r.jsx)(y,{event:e,settling:D},e.id))]},e)),R.hasMore&&(0,r.jsx)("div",{className:"flex justify-center pt-4",children:(0,r.jsx)(o.$,{variant:"ghost",size:"sm",onClick:R.loadMore,disabled:R.loading,children:R.loading?"Loading…":"Load older"})})]})]})}},27013:(e,t,n)=>{n.d(t,{K:()=>o});var r=n(95155),s=n(12115),a=n(89239),i=n(42763),l=n(60529);function o(e){return(0,r.jsx)(i.lG,{open:e.open,onOpenChange:e.onOpenChange,children:(0,r.jsx)(i.Cf,{className:"sm:max-w-sm",showCloseButton:!1,children:e.open&&(0,r.jsx)(d,{...e})})})}function d({title:e,initial:t="",submitLabel:n,onOpenChange:o,onSubmit:c}){let[u,m]=(0,s.useState)(t),h=u.trim();return(0,r.jsxs)("form",{onSubmit:function(e){e.preventDefault(),h&&(c(h),o(!1))},className:"flex flex-col gap-4",children:[(0,r.jsx)(i.c7,{children:(0,r.jsx)(i.L3,{children:e})}),(0,r.jsx)(l.p,{autoFocus:!0,"aria-label":"Migration name",value:u,placeholder:"add_users_table",onChange:e=>m(e.target.value),onFocus:e=>e.currentTarget.select()}),(0,r.jsxs)(i.Es,{children:[(0,r.jsx)(a.$,{type:"button",variant:"ghost",onClick:()=>o(!1),children:"Cancel"}),(0,r.jsx)(a.$,{type:"submit",disabled:!h,children:n})]})]})}},28335:(e,t,n)=>{n.d(t,{u:()=>o});var r=n(95155),s=n(12115);function a(e){let t=e.replace(/\r\n?/g,"\n").replace(/\s+$/,"");return t?t.split("\n"):[]}var i=n(40980);let l={same:" ",add:"+",remove:"-"};function o({before:e,after:t,className:n}){let c=(0,s.useMemo)(()=>(function(e,t=3){let n=[];e.forEach((r,s)=>{if("same"===r.kind)return;let a=Math.max(0,s-t),i=Math.min(e.length-1,s+t),l=n.at(-1);l&&a<=l[1]+1?l[1]=Math.max(l[1],i):n.push([a,i])});let r=[],s=[],a=0,i=0;for(let t of e)r.push(a),s.push(i),"add"!==t.kind&&(a+=1),"remove"!==t.kind&&(i+=1);return n.map(([t,n])=>{let a=e.slice(t,n+1),i=a.filter(e=>"add"!==e.kind).length,l=a.filter(e=>"remove"!==e.kind).length,o=r[t]+ +(0!==i),d=s[t]+ +(0!==l);return{header:`@@ -${o},${i} +${d},${l} @@`,lines:a}})})(function(e,t){let n=a(e),r=a(t),s=0;for(;s<n.length&&s<r.length&&n[s]===r[s];)s+=1;let i=0;for(;i<n.length-s&&i<r.length-s&&n[n.length-1-i]===r[r.length-1-i];)i+=1;let l=n.slice(s,n.length-i),o=r.slice(s,r.length-i),d=function(e,t){let n=e.length,r=t.length,s=n+r,a=s+1,i=new Int32Array(2*s+3),l=[],o=!1;for(let d=0;d<=s&&!o;d+=1){if((l.length+1)*i.length>2e7)return null;l.push(i.slice());for(let s=-d;s<=d;s+=2){let l=s===-d||s!==d&&i[a+s-1]<i[a+s+1]?i[a+s+1]:i[a+s-1]+1,c=l-s;for(;l<n&&c<r&&e[l]===t[c];)l+=1,c+=1;if(i[a+s]=l,l>=n&&c>=r){o=!0;break}}}let d=[],c=n,u=r;for(let n=l.length-1;n>=0;n-=1){let r=l[n],s=c-u,i=s===-n||s!==n&&r[a+s-1]<r[a+s+1]?s+1:s-1,o=r[a+i],m=o-i;for(;c>o&&u>m;)d.push({kind:"same",text:e[c-1]}),c-=1,u-=1;n>0&&(c===o?d.push({kind:"add",text:t[u-1]}):d.push({kind:"remove",text:e[c-1]})),c=o,u=m}return d.reverse()}(l,o)??[...l.map(e=>({kind:"remove",text:e})),...o.map(e=>({kind:"add",text:e}))],c=[...n.slice(0,s).map(e=>({kind:"same",text:e})),...d,...n.slice(n.length-i).map(e=>({kind:"same",text:e}))],u=0,m=0;return c.map(e=>"same"===e.kind?(u+=1,m+=1,{...e,oldNo:u,newNo:m}):"remove"===e.kind?(u+=1,{...e,oldNo:u,newNo:null}):(m+=1,{...e,oldNo:null,newNo:m}))}(e,t)),[e,t]);return 0===c.length?(0,r.jsx)("p",{className:(0,i.cn)("text-xs text-muted-foreground",n),children:"Only whitespace at the end of the file differs."}):(0,r.jsx)("div",{className:(0,i.cn)("overflow-auto font-mono text-[11px] leading-5",n),children:(0,r.jsx)("table",{className:"w-full border-collapse",children:c.map(e=>(0,r.jsxs)("tbody",{children:[(0,r.jsx)("tr",{children:(0,r.jsx)("td",{colSpan:3,className:"bg-muted/60 px-3 text-muted-foreground select-none",children:e.header})}),e.lines.map((e,t)=>(0,r.jsxs)("tr",{className:(0,i.cn)("add"===e.kind&&"bg-emerald-500/12","remove"===e.kind&&"bg-red-500/12"),children:[(0,r.jsx)(d,{value:e.oldNo}),(0,r.jsx)(d,{value:e.newNo}),(0,r.jsxs)("td",{className:"pr-3 whitespace-pre",children:[(0,r.jsx)("span",{className:(0,i.cn)("inline-block w-4 pl-1 select-none","add"===e.kind&&"text-emerald-600 dark:text-emerald-400","remove"===e.kind&&"text-red-600 dark:text-red-400"),children:l[e.kind]}),e.text]})]},t))]},e.header))})})}function d({value:e}){return(0,r.jsx)("td",{className:"w-10 min-w-10 pr-2 text-right text-muted-foreground/50 tabular-nums select-none",children:e??""})}},33807:(e,t,n)=>{n.d(t,{J:()=>a});var r=n(95155);n(12115);var s=n(40980);function a({className:e,...t}){return(0,r.jsx)("label",{"data-slot":"label",className:(0,s.cn)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...t})}},35942:(e,t,n)=>{n.d(t,{F:()=>c});var r=n(95155);n(12115);var s=n(76166),a=n(90839),i=n(84588),l=n(66784),o=n(64084),d=n(40980);function c({className:e,children:t,...n}){return(0,r.jsxs)(s.V,{"data-slot":"scroll-area",className:(0,d.cn)("relative",e),...n,children:[(0,r.jsx)(a.B,{"data-slot":"scroll-area-viewport",className:"size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1",children:t}),(0,r.jsx)(u,{}),(0,r.jsx)(i.I,{})]})}function u({className:e,orientation:t="vertical",...n}){return(0,r.jsx)(l.V,{"data-slot":"scroll-area-scrollbar","data-orientation":t,orientation:t,className:(0,d.cn)("flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent",e),...n,children:(0,r.jsx)(o.l,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-full bg-border"})})}},41069:(e,t,n)=>{n.d(t,{l:()=>a});var r=n(95155),s=n(30374);function a({caption:e,pane:t,onPaneChange:n,migrationsLabel:i="Migrations",showSchema:l=!1}){return(0,r.jsxs)("footer",{className:"flex shrink-0 items-center gap-2 border-t px-4 py-1.5 text-xs text-muted-foreground",children:[(0,r.jsx)("span",{className:"min-w-0 truncate",children:e}),(0,r.jsx)("div",{className:"ml-auto",children:(0,r.jsx)(s.x,{label:"Migrations pane",value:t,onChange:n,options:[{value:"migrations",label:i},...l?[{value:"schema",label:"Schema"}]:[],{value:"history",label:"Timeline"}]})})]})}},59221:(e,t,n)=>{n.d(t,{o:()=>b});var r=n(95155),s=n(12115),a=n(40980);let i=/^ {0,3}(`{3,}|~{3,})/,l=/^ {0,3}(#{1,6})\s+(.*?)\s*#*\s*$/,o=/^ {0,3}([-*_])(?:\s*\1){2,}\s*$/,d=/^( {0,3})([-*+])(\s+|$)/,c=/^( {0,3})(\d{1,9})[.)](\s+|$)/,u=/^ {0,3}>\s?/,m=/^\[([ xX])\]\s+/;function h(e){return""===e.trim()}function p(e){return i.test(e)||l.test(e)||o.test(e)||d.test(e)||c.test(e)||u.test(e)}function x(e){return e.length-e.trimStart().length}let f=/\\([\\`*_[\]()#>~-])|(`+)([\s\S]*?[^`])\2(?!`)|\*\*(.+?)\*\*|(?<!\w)__(.+?)__(?!\w)|\*(?=\S)(.+?)(?<=\S)\*|(?<!\w)_(?=\S)(.+?)(?<=\S)_(?!\w)|~~(.+?)~~|\[([^\]]+)\]\(([^)\s]+)\)|(https?:\/\/[^\s<]+[^\s<.,:;"')\]!?])|\n/g;function g(e){let t=[],n=0,s=0;for(let a of e.matchAll(f)){let i=a.index??0;i>n&&t.push(e.slice(n,i)),n=i+a[0].length;let[l,o,,d,c,u,m,h,p,x,f,b]=a;void 0!==o?t.push(o):void 0!==d?t.push((0,r.jsx)(v,{children:d.trim()},s++)):void 0!==c||void 0!==u?t.push((0,r.jsx)("strong",{className:"font-medium text-foreground",children:g(c??u)},s++)):void 0!==m||void 0!==h?t.push((0,r.jsx)("em",{children:g(m??h)},s++)):void 0!==p?t.push((0,r.jsx)("s",{children:g(p)},s++)):void 0!==x?t.push((0,r.jsx)(j,{href:f,children:g(x)},s++)):void 0!==b?t.push((0,r.jsx)(j,{href:b,children:b},s++)):"\n"===l&&t.push((0,r.jsx)("br",{},s++))}return n<e.length&&t.push(e.slice(n)),t}function v({children:e}){return(0,r.jsx)("code",{className:"rounded bg-muted px-1 py-px font-mono text-[0.92em]",children:e})}function j({href:e,children:t}){let n=/^(https?:|mailto:)/i.test(e);return(0,r.jsx)("a",{href:n?e:void 0,target:"_blank",rel:"noreferrer",className:"underline decoration-muted-foreground/50 underline-offset-2 hover:decoration-foreground",children:t})}function b({text:e,className:t}){let n=function e(t){let n=[],r=0;for(;r<t.length;){let s=t[r];if(h(s)){r+=1;continue}let a=i.exec(s);if(a){let e=RegExp(`^ {0,3}${a[1][0]}{${a[1].length},}\\s*$`),s=[];for(r+=1;r<t.length&&!e.test(t[r]);)s.push(t[r]),r+=1;r+=1,n.push({type:"code",code:s.join("\n")});continue}let f=l.exec(s);if(f){n.push({type:"heading",level:f[1].length,text:f[2]}),r+=1;continue}if(o.test(s)){n.push({type:"rule"}),r+=1;continue}if(u.test(s)){let s=[];for(;r<t.length&&u.test(t[r]);)s.push(t[r].replace(u,"")),r+=1;n.push({type:"quote",blocks:e(s)});continue}let g=d.exec(s)??c.exec(s);if(g){let a=c.test(s),i=a?Number(g[2]):1,l=[];for(;r<t.length;){let n=(a?c:d).exec(t[r]);if(!n)break;let s=n[0].length,i=[t[r].slice(s)];for(r+=1;r<t.length;){let e=t[r];if(h(e)){let e=t[r+1];if(void 0!==e&&x(e)>=2){i.push(""),r+=1;continue}break}if(x(e)>=2){i.push(e.slice(Math.min(s,x(e)))),r+=1;continue}if(!p(e)&&""!==i[i.length-1]){i.push(e),r+=1;continue}break}let o=m.exec(i[0]);for(o&&(i[0]=i[0].replace(m,"")),l.push({checked:o?" "!==o[1]:null,blocks:e(i)});r<t.length&&h(t[r])&&void 0!==t[r+1];)if((a?c:d).test(t[r+1]))r+=1;else break}n.push({type:"list",ordered:a,start:i,items:l});continue}let v=[s];for(r+=1;r<t.length&&!h(t[r])&&!p(t[r]);)v.push(t[r]),r+=1;n.push({type:"paragraph",text:v.join("\n")})}return n}(e.replace(/\r\n?/g,"\n").split("\n"));return(0,r.jsx)("div",{className:(0,a.cn)("space-y-2 break-words",t),children:function e(t,n){return t.map((t,i)=>{switch(t.type){case"heading":return(0,r.jsx)("p",{className:(0,a.cn)("font-medium text-foreground",t.level<=2?"text-[1.1em]":""),children:g(t.text)},i);case"paragraph":return n?(0,r.jsx)(s.Fragment,{children:g(t.text)},i):(0,r.jsx)("p",{children:g(t.text)},i);case"quote":return(0,r.jsx)("blockquote",{className:"space-y-2 border-l-2 pl-3 text-muted-foreground",children:e(t.blocks,!1)},i);case"code":return(0,r.jsx)("pre",{className:"overflow-x-auto rounded-md border bg-muted/40 px-2.5 py-2 font-mono text-[0.92em] leading-relaxed",children:t.code},i);case"rule":return(0,r.jsx)("hr",{className:"border-border"},i);case"list":{let n=t.ordered?"ol":"ul",s=t.items.some(e=>null!==e.checked);return(0,r.jsx)(n,{start:t.ordered?t.start:void 0,className:(0,a.cn)("space-y-0.5",s?"list-none pl-0":t.ordered?"list-decimal pl-5":"list-disc pl-5"),children:t.items.map((t,n)=>{let s=1===t.blocks.length&&"paragraph"===t.blocks[0].type;return(0,r.jsxs)("li",{className:(0,a.cn)(null!==t.checked&&"flex items-start gap-2"),children:[null!==t.checked&&(0,r.jsx)("span",{"aria-hidden":!0,className:(0,a.cn)("mt-[0.3em] inline-flex size-[0.85em] shrink-0 items-center justify-center rounded-[3px] border",t.checked?"border-foreground bg-foreground text-background":"border-muted-foreground/60"),children:t.checked&&(0,r.jsx)("svg",{viewBox:"0 0 12 12",className:"size-[0.7em]",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,r.jsx)("path",{d:"M2.5 6.5 5 9l4.5-6",strokeLinecap:"round",strokeLinejoin:"round"})})}),(0,r.jsx)("span",{className:(0,a.cn)("min-w-0",!s&&"block space-y-1.5",t.checked&&"text-muted-foreground line-through"),children:e(t.blocks,s)})]},n)})},i)}}})}(n,!1)})}},62417:(e,t,n)=>{n.d(t,{DM:()=>h,FY:()=>o,Gf:()=>a,ay:()=>l,e:()=>m,eh:()=>d,gj:()=>u,kB:()=>x,lF:()=>g,n9:()=>p,nb:()=>c,nj:()=>f,yy:()=>v});var r=n(20642);let s={steps:[],blockedBy:null};function a(e,t){return e?{...e,entries:e.entries.filter(e=>e.setName===t)}:null}function i(e){let t=new Map;for(let n of e?.entries??[])t.set(n.version,n);return t}function l(e,t){return t?t.entries.find(t=>t.version===e.version)??null:null}function o(e,t){if(!t)return"unknown";let n=l(e,t);return n?n.checksum&&n.checksum!==e.checksum?"drifted":"applied":"pending"}function d(e,t){let n={total:e?.steps.length??0,applied:0,drifted:0,pending:0,foreign:0};if(!e)return n;let r=a(t,e.name);for(let t of e.steps){let e=o(t,r);"applied"===e?n.applied+=1:"drifted"===e?n.drifted+=1:"pending"===e&&(n.pending+=1)}return n.foreign=c(e,r).length,n}function c(e,t){if(!t)return[];let n=new Set((e?.steps??[]).map(e=>e.version));return t.entries.filter(e=>!n.has(e.version)).sort((e,t)=>(0,r.Zy)(e.version,t.version))}function u(e,t,n){if(!e||!t)return s;let r=[];for(let s of e.steps)if("pending"===o(s,t)&&r.push(s),void 0!==n&&s.version===n)break;return{steps:r,blockedBy:null}}function m(e,t,n){if(!e||!t)return s;let a=i(t),l=[];for(let t of[...e.steps].reverse()){if(void 0!==n&&0>(0,r.Zy)(t.version,n))break;if(a.has(t.version)){if(!t.revertSql)return{steps:l,blockedBy:t};l.push(t)}}return{steps:l,blockedBy:null}}function h(e,t,n){return e&&t?{steps:e.steps.filter(e=>n.has(e.version)&&"pending"===o(e,t)),blockedBy:null}:s}function p(e,t,n){if(!e||!t)return s;let r=i(t),a=[];for(let t of[...e.steps].reverse())if(n.has(t.version)&&r.has(t.version)){if(!t.revertSql)return{steps:a,blockedBy:t};a.push(t)}return{steps:a,blockedBy:null}}function x(e,t){if(!e||!t)return null;let n=i(t);for(let t of[...e.steps].reverse())if(n.has(t.version))return t;return null}function f(e,t){if(!e||0===e.entries.length)return null;let n=e.entries[0].version;for(let t of e.entries)(0,r.Zy)(t.version,n)>0&&(n=t.version);let s=t.filter(e=>0>(0,r.Zy)(e.version,n));return s.length>0?{steps:s,after:n}:null}function g(e,t){let n=new Set(t.map(e=>e.toLowerCase())),s=new Map;for(let t of e)for(let e of t.ledger?.entries??[]){let r=e.setName.trim();if(!r||n.has(r.toLowerCase()))continue;let a=s.get(r)??new Map,i=a.get(t.connection.id)??new Set;i.add(e.version),a.set(t.connection.id,i),s.set(r,a)}return[...s.entries()].map(([t,n])=>{let s=new Set;for(let e of n.values())for(let t of e)s.add(t);return{name:t,versions:[...s].sort(r.Zy),total:s.size,applied:e.map(e=>({connectionId:e.connection.id,connectionName:e.connection.name,count:n.get(e.connection.id)?.size??0}))}}).sort((e,t)=>e.name.localeCompare(t.name))}function v(e,t,n){let r=n.query.trim().toLowerCase();if(r&&![e.name,...e.steps.flatMap(e=>[e.version,e.name])].join("\n").toLowerCase().includes(r))return!1;let{status:s}=n;if("all"===s)return!0;if(s.startsWith("pending:")){let e=t.find(e=>e.connectionId===s.slice(8));return!e||!e.read||e.summary.pending>0||e.summary.drifted>0}return"pending"===s?t.some(e=>!e.read||e.summary.pending>0||e.summary.drifted>0):"untouched"===s?t.every(e=>!e.read||0===e.summary.applied&&0===e.summary.drifted):"complete"!==s||e.steps.length>0&&t.every(e=>e.read&&0===e.summary.pending&&0===e.summary.drifted)}},71612:(e,t,n)=>{n.d(t,{y:()=>a});var r=n(87364),s=n(27529);function a(e,t){return(0,r.Y)(`repo:${e??""}:${t??""}`,async n=>e?s.F.repo(e,t,n):null)}},72194:(e,t,n)=>{n.d(t,{F:()=>i});var r=n(95155),s=n(40980),a=n(32538);function i({connection:e,className:t}){return(0,r.jsx)("span",{"aria-hidden":!0,className:(0,s.cn)("size-2.5 shrink-0 rounded-full",t),style:{background:(0,a.Mq)(e)}})}},77649:(e,t,n)=>{n.d(t,{k:()=>h,$:()=>m});var r=n(95155),s=n(12115),a=n(13267),i=n(89239);function l(e){let t=e.createReader?.();return t?new Promise((e,n)=>{let r=[],s=()=>{t.readEntries(t=>{0===t.length||r.length>=2e3?e(r):(r.push(...t),s())},n)};s()}):Promise.resolve([])}async function o(e,t,n,r){if(r.length>=2e3||n>6||e.name.startsWith("."))return;let s=t?`${t}/${e.name}`:e.name;if(e.isFile){if(!/\.sql$/i.test(e.name))return;let t=await new Promise((t,n)=>{e.file?e.file(t,n):n(Error(`Could not read ${e.name}`))});r.push({path:s,text:await t.text()});return}if(e.isDirectory)for(let t of(await l(e)))await o(t,s,n+1,r)}async function d(e){let t=[];for(let n of Array.from(e.items)){if("file"!==n.kind)continue;let e=n.webkitGetAsEntry?.();e&&t.push(e)}if(0===t.length){let t=Array.from(e.files).filter(e=>/\.sql$/i.test(e.name));return 0===t.length?null:{name:"Migrations",files:await Promise.all(t.map(async e=>({path:e.name,text:await e.text()})))}}let n=1===t.length&&t[0].isDirectory?t[0]:null,r=[];if(n){for(let e of(await l(n)))await o(e,"",1,r);return{name:n.name,files:r}}for(let e of t)await o(e,"",0,r);return r.length>0?{name:"Migrations",files:r}:null}async function c(e){let t,n=Array.from(e).filter(e=>/\.sql$/i.test(e.name));if(0===n.length)return null;let r=new Set(n.map(e=>(e.webkitRelativePath||e.name).split("/")[0])),s=1===r.size&&((t=n[0]).webkitRelativePath||t.name).includes("/")?[...r][0]:null;return{name:s??"Migrations",files:await Promise.all(n.slice(0,2e3).map(async e=>{let t=e.webkitRelativePath||e.name;return{path:s?t.slice(s.length+1):t,text:await e.text()}}))}}var u=n(40980);function m(e){let[t,n]=(0,s.useState)(!1),[r,a]=(0,s.useState)(null);return{importFrom:(0,s.useCallback)(async t=>{n(!0),a(null);try{let n=t instanceof FileList?await c(t):await d(t);if(!n||0===n.files.length)return void a("No .sql files in there.");e(n)}catch(e){a(e instanceof Error?e.message:"Couldn’t read that folder.")}finally{n(!1)}},[e]),busy:t,error:r,clearError:()=>a(null)}}function h({onFiles:e,className:t,compact:n=!1}){let{importFrom:l,busy:o,error:d}=m(e),[c,p]=(0,s.useState)(!1),x=(0,s.useRef)(null),f=(0,s.useRef)(null);return(0,s.useEffect)(()=>{x.current?.setAttribute("webkitdirectory",""),x.current?.setAttribute("directory","")},[]),(0,r.jsxs)("div",{onDragOver:e=>{e.preventDefault(),p(!0)},onDragLeave:()=>p(!1),onDrop:e=>{e.preventDefault(),p(!1),l(e.dataTransfer)},className:(0,u.cn)("flex items-center justify-center rounded-lg border border-dashed text-center transition-colors",n?"flex-wrap gap-x-3 gap-y-2 px-4 py-3":"flex-col gap-4 px-6 py-10",c?"border-primary bg-primary/5":"border-border",t),children:[o?(0,r.jsx)(a.gnh,{className:"size-4 shrink-0 animate-spin text-muted-foreground"}):(0,r.jsx)(a.FeY,{className:(0,u.cn)("shrink-0 text-muted-foreground",n?"size-4":"size-5")}),n?(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:"Drop a folder of .sql files"}):(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)("p",{className:"text-sm font-medium",children:"Drop a migration folder"}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:".sql files, optionally split into apply/ and revert/"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsxs)(i.$,{size:n?"xs":"sm",variant:n?"ghost":"outline",disabled:o,onClick:()=>x.current?.click(),children:[(0,r.jsx)(a.WzY,{"data-icon":"inline-start"}),"Choose folder"]}),(0,r.jsx)(i.$,{size:n?"xs":"sm",variant:"ghost",disabled:o,onClick:()=>f.current?.click(),children:"Choose files"})]}),d&&(0,r.jsx)("p",{className:"w-full text-xs text-destructive",children:d}),(0,r.jsx)("input",{ref:x,type:"file",multiple:!0,className:"sr-only",onChange:e=>{let{files:t}=e.target;t&&t.length>0&&l(t),e.target.value=""}}),(0,r.jsx)("input",{ref:f,type:"file",multiple:!0,accept:".sql",className:"sr-only",onChange:e=>{let{files:t}=e.target;t&&t.length>0&&l(t),e.target.value=""}})]})}},83504:(e,t,n)=>{n.d(t,{I:()=>u,p:()=>d});var r=n(95155),s=n(13267),a=n(59221),i=n(72194),l=n(89239),o=n(42763);function d(e){try{let t=new URL(e),n=t.username?`${decodeURIComponent(t.username)}@`:"",r=t.port?`:${t.port}`:"";return`${n}${t.hostname}${r}${t.pathname}`}catch{return"this connection"}}function c({status:e}){switch(e){case"running":return(0,r.jsx)(s.gnh,{className:"size-3.5 shrink-0 animate-spin text-primary"});case"ok":return(0,r.jsx)(s.wiW,{className:"size-3.5 shrink-0 text-emerald-600 dark:text-emerald-400"});case"failed":return(0,r.jsx)(s.yBK,{className:"size-3.5 shrink-0 text-destructive"});case"skipped":return(0,r.jsx)(s.uPM,{className:"size-3.5 shrink-0 text-muted-foreground/60"});default:return(0,r.jsx)(s.Rzr,{className:"size-3.5 shrink-0 text-muted-foreground/60"})}}function u({open:e,direction:t,connection:n,steps:m,blockedBy:h,progress:p,running:x,recordOnly:f,note:g,outOfOrder:v,rehearsal:j,onRun:b,onRehearse:k,onStop:y,onClose:N}){let w=f?"apply"===t?"Mark as applied":"Mark as not applied":"apply"===t?"Apply":"Revert",$=f?"Marked":"apply"===t?"Applied":"Reverted",S=m.length,C=m.filter(e=>{var t;return"wrapped-by-ytdb"!==(t=e.transaction)&&"self-wrapped"!==t}),z=p?.find(e=>"failed"===e.status)??null,M=null!==p&&!x,L=p?.filter(e=>"ok"===e.status).length??0,R=!p||j&&M,D=v?.steps??[],q=p??m.map(e=>({version:e.version,name:e.name,status:"waiting"}));return(0,r.jsx)(o.lG,{open:e,onOpenChange:e=>!e&&!x&&N(),children:(0,r.jsxs)(o.Cf,{className:"sm:max-w-lg",children:[(0,r.jsxs)(o.c7,{children:[(0,r.jsx)(o.L3,{children:0===S&&h?"Nothing here can be reverted":j&&p?x?`Dry run of ${S} migration${1===S?"":"s"}…`:z?`Dry run failed at ${L+1} of ${S}`:`Dry run passed: ${S} migration${1===S?"":"s"}`:M?z?`${w} stopped after ${L} of ${S}`:`${$} ${L} migration${1===L?"":"s"}`:f?`${"Mark as applied"===w?"Mark":"Unmark"} ${S} migration${1===S?"":"s"} on ${n.name}?`:`${w} ${S} migration${1===S?"":"s"}?`}),(0,r.jsx)(o.rr,{children:(0,r.jsxs)("span",{className:"flex flex-wrap items-center gap-1.5",children:[(0,r.jsx)("span",{children:f?M?"Recorded on":"Records on":j&&p?"Tried against, without keeping anything on":M?"Ran against":"Runs against"}),(0,r.jsx)(i.F,{connection:n}),(0,r.jsx)("span",{className:"font-medium text-foreground",children:n.name}),(0,r.jsx)("span",{className:"font-mono text-[11px]",children:d(n.url)})]})})]}),R&&g&&(0,r.jsxs)("div",{className:"flex max-h-40 gap-2 overflow-y-auto rounded-md border bg-muted/30 px-3 py-2 text-xs",children:[(0,r.jsx)(s.UA_,{className:"mt-px size-3.5 shrink-0 text-muted-foreground"}),(0,r.jsx)(a.o,{text:g,className:"min-w-0 flex-1"})]}),q.length>0&&(0,r.jsx)("div",{className:"max-h-64 overflow-y-auto rounded-md border",children:q.map(e=>(0,r.jsxs)("div",{className:"flex items-center gap-2 border-b px-3 py-1.5 text-xs last:border-b-0",children:[(0,r.jsx)(c,{status:e.status}),(0,r.jsx)("span",{className:"shrink-0 font-mono text-muted-foreground",children:e.version}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e.name}),void 0!==e.durationMs&&(0,r.jsxs)("span",{className:"shrink-0 tabular-nums text-muted-foreground",children:[e.durationMs," ms"]})]},e.version))}),z?.error&&(0,r.jsx)("p",{className:"max-h-32 overflow-auto rounded-md border border-destructive/25 bg-destructive/5 px-3 py-2 font-mono text-[11px] whitespace-pre-wrap text-destructive",children:z.error}),R&&h&&(0,r.jsxs)("p",{className:"flex gap-2 text-xs text-muted-foreground",children:[(0,r.jsx)(s.e5t,{className:"mt-px size-3.5 shrink-0 text-amber-600 dark:text-amber-400"}),(0,r.jsx)("span",{children:0===S?`${h.version} ${h.name} is the newest one applied and has no revert file, so nothing below it can be reached.`:`Stops at ${h.version} ${h.name}, which has no revert file.`})]}),R&&f&&(0,r.jsxs)("p",{className:"rounded-md border border-amber-600/25 bg-amber-500/8 px-3 py-2 text-xs",children:[(0,r.jsx)("span",{className:"font-medium",children:"No SQL runs."})," Only the ledger on ",n.name," ","changes."]}),R&&!f&&"apply"===t&&D.length>0&&(0,r.jsxs)("p",{className:"flex gap-2 text-xs text-muted-foreground",children:[(0,r.jsx)(s.e5t,{className:"mt-px size-3.5 shrink-0 text-amber-600 dark:text-amber-400"}),(0,r.jsxs)("span",{children:[1===D.length?`${D[0].version} is older than ${v?.after}, which is already applied here.`:`${D.map(e=>e.version).join(", ")} are older than ${v?.after}, which is already applied here.`," ",1===D.length?"It was":"They were"," probably merged after it ran, so check"," ",1===D.length?"it does":"they do"," not depend on going first."]})]}),R&&!f&&C.length>0&&(0,r.jsxs)("p",{className:"flex gap-2 text-xs text-muted-foreground",children:[(0,r.jsx)(s.e5t,{className:"mt-px size-3.5 shrink-0 text-amber-600 dark:text-amber-400"}),(0,r.jsx)("span",{children:1===C.length?`${C[0].version} runs outside a transaction, so a failure partway leaves it half applied.`:`${C.length} of these run outside a transaction, so a failure partway leaves them half applied.`})]}),R&&!f&&"revert"===t&&(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:"Reverting runs newest first and can drop data the migrations created."}),(0,r.jsx)(o.Es,{children:x?j?(0,r.jsx)(l.$,{variant:"outline",disabled:!0,children:"Trying…"}):(0,r.jsx)(l.$,{variant:"outline",onClick:y,children:"Stop after this one"}):M&&!j?(0,r.jsx)(l.$,{onClick:N,children:"Close"}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(l.$,{variant:"outline",onClick:N,children:0===S?"Close":"Cancel"}),S>0&&k&&!f&&(0,r.jsxs)(l.$,{variant:"outline",onClick:k,title:"Runs every step in one transaction and rolls it back, so you see whether it would go through without changing anything.",children:[(0,r.jsx)(s.DPG,{"data-icon":"inline-start"}),j&&M?"Dry run again":"Dry run"]}),S>0&&(0,r.jsx)(l.$,{variant:f||"revert"!==t?"default":"destructive",onClick:b,children:f?`${w} (${S})`:`${w} ${1===S?"migration":`${S} migrations`}`})]})})]})})}}}]);
|