@theobourgeois/ytdb 0.2.19 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +9 -5
  3. package/.next/build-manifest.json +3 -3
  4. package/.next/prerender-manifest.json +4 -4
  5. package/.next/react-loadable-manifest.json +12 -1
  6. package/.next/routes-manifest.json +35 -0
  7. package/.next/server/app/[connectionId]/[schema]/[table]/page.js +1 -1
  8. package/.next/server/app/[connectionId]/[schema]/[table]/page.js.nft.json +1 -1
  9. package/.next/server/app/[connectionId]/[schema]/[table]/page_client-reference-manifest.js +1 -1
  10. package/.next/server/app/[connectionId]/diff/page.js +3 -3
  11. package/.next/server/app/[connectionId]/diff/page.js.nft.json +1 -1
  12. package/.next/server/app/[connectionId]/diff/page_client-reference-manifest.js +1 -1
  13. package/.next/server/app/[connectionId]/migrations/(index)/page.js +1 -0
  14. package/.next/server/app/[connectionId]/migrations/(index)/page.js.nft.json +1 -0
  15. package/.next/server/app/[connectionId]/migrations/(index)/page_client-reference-manifest.js +1 -0
  16. package/.next/server/app/[connectionId]/migrations/(index)/timeline/page.js +1 -0
  17. package/.next/server/app/[connectionId]/migrations/(index)/timeline/page.js.nft.json +1 -0
  18. package/.next/server/app/[connectionId]/migrations/(index)/timeline/page_client-reference-manifest.js +1 -0
  19. package/.next/server/app/[connectionId]/migrations/[setId]/diagram/page.js +1 -0
  20. package/.next/server/app/[connectionId]/migrations/[setId]/diagram/page.js.nft.json +1 -0
  21. package/.next/server/app/[connectionId]/migrations/[setId]/diagram/page_client-reference-manifest.js +1 -0
  22. package/.next/server/app/[connectionId]/migrations/[setId]/page.js +1 -1
  23. package/.next/server/app/[connectionId]/migrations/[setId]/page.js.nft.json +1 -1
  24. package/.next/server/app/[connectionId]/migrations/[setId]/page_client-reference-manifest.js +1 -1
  25. package/.next/server/app/[connectionId]/migrations/[setId]/schema/page.js +1 -0
  26. package/.next/server/app/[connectionId]/migrations/[setId]/schema/page.js.nft.json +1 -0
  27. package/.next/server/app/[connectionId]/migrations/[setId]/schema/page_client-reference-manifest.js +1 -0
  28. package/.next/server/app/[connectionId]/migrations/[setId]/timeline/page.js +1 -0
  29. package/.next/server/app/[connectionId]/migrations/[setId]/timeline/page.js.nft.json +1 -0
  30. package/.next/server/app/[connectionId]/migrations/[setId]/timeline/page_client-reference-manifest.js +1 -0
  31. package/.next/server/app/[connectionId]/page.js +1 -1
  32. package/.next/server/app/[connectionId]/page.js.nft.json +1 -1
  33. package/.next/server/app/[connectionId]/page_client-reference-manifest.js +1 -1
  34. package/.next/server/app/[connectionId]/query/page.js +1 -1
  35. package/.next/server/app/[connectionId]/query/page.js.nft.json +1 -1
  36. package/.next/server/app/[connectionId]/query/page_client-reference-manifest.js +1 -1
  37. package/.next/server/app/_global-error/page.js +2 -2
  38. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  39. package/.next/server/app/_global-error.html +1 -1
  40. package/.next/server/app/_global-error.rsc +1 -1
  41. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  42. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  43. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  44. package/.next/server/app/_not-found/page.js +1 -1
  45. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  46. package/.next/server/app/_not-found.html +1 -1
  47. package/.next/server/app/_not-found.rsc +7 -7
  48. package/.next/server/app/_not-found.segments/_full.segment.rsc +7 -7
  49. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +7 -7
  50. package/.next/server/app/_not-found.segments/_tree.segment.rsc +3 -3
  51. package/.next/server/app/api/activity/route.js +2 -2
  52. package/.next/server/app/api/adopt/route.js +1 -1
  53. package/.next/server/app/api/cell/route.js +2 -2
  54. package/.next/server/app/api/definition/route.js +2 -2
  55. package/.next/server/app/api/delete-rows/route.js +2 -2
  56. package/.next/server/app/api/detect/route.js +1 -1
  57. package/.next/server/app/api/health/route.js +1 -1
  58. package/.next/server/app/api/insert-row/route.js +2 -2
  59. package/.next/server/app/api/ledger/route.js +1 -1
  60. package/.next/server/app/api/lookup/route.js +2 -2
  61. package/.next/server/app/api/migrate/route.js +1 -1
  62. package/.next/server/app/api/note/route.js +1 -1
  63. package/.next/server/app/api/query/route.js +2 -2
  64. package/.next/server/app/api/reconcile/route.js +2 -2
  65. package/.next/server/app/api/rehearse/route.js +1 -1
  66. package/.next/server/app/api/related/route.js +2 -2
  67. package/.next/server/app/api/repo/route.js +1 -1
  68. package/.next/server/app/api/rows/route.js +2 -2
  69. package/.next/server/app/api/schema/route.js +1 -1
  70. package/.next/server/app/api/tables/route.js +2 -2
  71. package/.next/server/app/api/timeline/route.js +1 -1
  72. package/.next/server/app/api/update-row/route.js +1 -1
  73. package/.next/server/app/favicon.ico/route.js +1 -1
  74. package/.next/server/app/icon.svg/route.js +1 -1
  75. package/.next/server/app/index.html +1 -1
  76. package/.next/server/app/index.rsc +8 -8
  77. package/.next/server/app/index.segments/__PAGE__.segment.rsc +8 -8
  78. package/.next/server/app/index.segments/_full.segment.rsc +8 -8
  79. package/.next/server/app/index.segments/_tree.segment.rsc +3 -3
  80. package/.next/server/app/page.js +2 -2
  81. package/.next/server/app/page.js.nft.json +1 -1
  82. package/.next/server/app/page_client-reference-manifest.js +1 -1
  83. package/.next/server/app-paths-manifest.json +9 -5
  84. package/.next/server/chunks/1421.js +1 -1
  85. package/.next/server/chunks/4809.js +1 -0
  86. package/.next/server/chunks/535.js +1 -0
  87. package/.next/server/chunks/5529.js +1 -0
  88. package/.next/server/chunks/5816.js +1 -1
  89. package/.next/server/chunks/6729.js +1 -1
  90. package/.next/server/chunks/7928.js +1 -1
  91. package/.next/server/middleware-build-manifest.js +1 -1
  92. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  93. package/.next/server/middleware.js +1 -1
  94. package/.next/server/pages/404.html +1 -1
  95. package/.next/server/pages/500.html +1 -1
  96. package/.next/server/server-reference-manifest.json +1 -1
  97. package/.next/static/{PPqM7ay-YN8BBp1e_HK15 → NB4JOC2i3ctixKpjpc7WH}/_buildManifest.js +1 -1
  98. package/.next/static/chunks/1413-1888e486022200cf.js +1 -0
  99. package/.next/static/chunks/1a258343.4407cfad5d6b3688.js +1 -0
  100. package/.next/static/chunks/{223-a4fca67d979d899d.js → 223-ae41c085e76173d8.js} +1 -1
  101. package/.next/static/chunks/228-332e8b6e327f10da.js +1 -0
  102. package/.next/static/chunks/544-624e05bf7e7a38d4.js +1 -0
  103. package/.next/static/chunks/577-d6d889d30c9375d9.js +1 -0
  104. package/.next/static/chunks/6090-97474bba31339e8e.js +1 -0
  105. package/.next/static/chunks/9146.9656b5ec316de71a.js +1 -0
  106. package/.next/static/chunks/91dbc596.26f4ecb79a1f7c01.js +1 -0
  107. package/.next/static/chunks/9406.9203511499c8bf43.js +1 -0
  108. package/.next/static/chunks/app/[connectionId]/[schema]/[table]/page-37b33d781877f0a5.js +1 -0
  109. package/.next/static/chunks/app/[connectionId]/diff/page-215e1f750956eecb.js +10 -0
  110. package/.next/static/chunks/app/[connectionId]/{layout-06d736d4773bd4a8.js → layout-b8ad40b3da6824ed.js} +1 -1
  111. package/.next/static/chunks/app/[connectionId]/migrations/(index)/layout-2635a5499e0b928c.js +1 -0
  112. package/.next/static/chunks/app/[connectionId]/migrations/(index)/page-e85d6ff71aeabe8d.js +1 -0
  113. package/.next/static/chunks/app/[connectionId]/migrations/(index)/timeline/page-e85d6ff71aeabe8d.js +1 -0
  114. package/.next/static/chunks/app/[connectionId]/migrations/[setId]/diagram/page-e85d6ff71aeabe8d.js +1 -0
  115. package/.next/static/chunks/app/[connectionId]/migrations/[setId]/layout-31e703f1a9beebf7.js +1 -0
  116. package/.next/static/chunks/app/[connectionId]/migrations/[setId]/page-e85d6ff71aeabe8d.js +1 -0
  117. package/.next/static/chunks/app/[connectionId]/migrations/[setId]/schema/page-e85d6ff71aeabe8d.js +1 -0
  118. package/.next/static/chunks/app/[connectionId]/migrations/[setId]/timeline/page-e85d6ff71aeabe8d.js +1 -0
  119. package/.next/static/chunks/app/[connectionId]/page-78a06e32a2658d3b.js +1 -0
  120. package/.next/static/chunks/app/[connectionId]/query/page-53c2d6f97a05d957.js +1 -0
  121. package/.next/static/chunks/app/_global-error/page-e85d6ff71aeabe8d.js +1 -0
  122. package/.next/static/chunks/app/api/activity/route-e85d6ff71aeabe8d.js +1 -0
  123. package/.next/static/chunks/app/api/adopt/route-e85d6ff71aeabe8d.js +1 -0
  124. package/.next/static/chunks/app/api/cell/route-e85d6ff71aeabe8d.js +1 -0
  125. package/.next/static/chunks/app/api/definition/route-e85d6ff71aeabe8d.js +1 -0
  126. package/.next/static/chunks/app/api/delete-rows/route-e85d6ff71aeabe8d.js +1 -0
  127. package/.next/static/chunks/app/api/detect/route-e85d6ff71aeabe8d.js +1 -0
  128. package/.next/static/chunks/app/api/health/route-e85d6ff71aeabe8d.js +1 -0
  129. package/.next/static/chunks/app/api/insert-row/route-e85d6ff71aeabe8d.js +1 -0
  130. package/.next/static/chunks/app/api/ledger/route-e85d6ff71aeabe8d.js +1 -0
  131. package/.next/static/chunks/app/api/lookup/route-e85d6ff71aeabe8d.js +1 -0
  132. package/.next/static/chunks/app/api/migrate/route-e85d6ff71aeabe8d.js +1 -0
  133. package/.next/static/chunks/app/api/note/route-e85d6ff71aeabe8d.js +1 -0
  134. package/.next/static/chunks/app/api/query/route-e85d6ff71aeabe8d.js +1 -0
  135. package/.next/static/chunks/app/api/reconcile/route-e85d6ff71aeabe8d.js +1 -0
  136. package/.next/static/chunks/app/api/rehearse/route-e85d6ff71aeabe8d.js +1 -0
  137. package/.next/static/chunks/app/api/related/route-e85d6ff71aeabe8d.js +1 -0
  138. package/.next/static/chunks/app/api/repo/route-e85d6ff71aeabe8d.js +1 -0
  139. package/.next/static/chunks/app/api/rows/route-e85d6ff71aeabe8d.js +1 -0
  140. package/.next/static/chunks/app/api/schema/route-e85d6ff71aeabe8d.js +1 -0
  141. package/.next/static/chunks/app/api/tables/route-e85d6ff71aeabe8d.js +1 -0
  142. package/.next/static/chunks/app/api/timeline/route-e85d6ff71aeabe8d.js +1 -0
  143. package/.next/static/chunks/app/api/update-row/route-e85d6ff71aeabe8d.js +1 -0
  144. package/.next/static/chunks/app/layout-2ed8b1f837adb32a.js +1 -0
  145. package/.next/static/chunks/app/page-52545dcc822c61da.js +2 -0
  146. package/.next/static/chunks/next/dist/client/components/builtin/app-error-e85d6ff71aeabe8d.js +1 -0
  147. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-e85d6ff71aeabe8d.js +1 -0
  148. package/.next/static/chunks/next/dist/client/components/builtin/not-found-e85d6ff71aeabe8d.js +1 -0
  149. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-e85d6ff71aeabe8d.js +1 -0
  150. package/.next/static/chunks/webpack-6451386e3f1b2ec9.js +1 -0
  151. package/.next/static/css/0e3fe8b2c0252430.css +1 -0
  152. package/.next/static/css/{e02ab5db9ff2dca2.css → 5df9ea52964d1443.css} +1 -1
  153. package/.next/static/css/6ada1421df91d770.css +21 -0
  154. package/README.md +5 -351
  155. package/bin/ytdb.mjs +4 -9
  156. package/package.json +3 -1
  157. package/.next/server/app/[connectionId]/migrations/page.js +0 -1
  158. package/.next/server/app/[connectionId]/migrations/page.js.nft.json +0 -1
  159. package/.next/server/app/[connectionId]/migrations/page_client-reference-manifest.js +0 -1
  160. package/.next/server/chunks/7593.js +0 -1
  161. package/.next/static/chunks/1520-1d9fc8b9ea29f3aa.js +0 -1
  162. package/.next/static/chunks/1981-806ce42b1641772f.js +0 -1
  163. package/.next/static/chunks/6782-c8b44f7f0d19d8e4.js +0 -1
  164. package/.next/static/chunks/7709-b2eee040599bab79.js +0 -1
  165. package/.next/static/chunks/9243-585cdd3c297cf117.js +0 -1
  166. package/.next/static/chunks/9532-860dc97ac3c3ff31.js +0 -1
  167. package/.next/static/chunks/app/[connectionId]/[schema]/[table]/page-7bed5765c93ce736.js +0 -1
  168. package/.next/static/chunks/app/[connectionId]/diff/page-e3e50546820ed5d5.js +0 -10
  169. package/.next/static/chunks/app/[connectionId]/migrations/[setId]/page-86a263e7e4a08d61.js +0 -1
  170. package/.next/static/chunks/app/[connectionId]/migrations/page-fc5dcf1404df5c65.js +0 -1
  171. package/.next/static/chunks/app/[connectionId]/page-8f68a2646e2f3eaa.js +0 -1
  172. package/.next/static/chunks/app/[connectionId]/query/page-55618bbb32f70fee.js +0 -1
  173. package/.next/static/chunks/app/_global-error/page-ad3ae203c81de67b.js +0 -1
  174. package/.next/static/chunks/app/api/activity/route-ad3ae203c81de67b.js +0 -1
  175. package/.next/static/chunks/app/api/adopt/route-ad3ae203c81de67b.js +0 -1
  176. package/.next/static/chunks/app/api/cell/route-ad3ae203c81de67b.js +0 -1
  177. package/.next/static/chunks/app/api/definition/route-ad3ae203c81de67b.js +0 -1
  178. package/.next/static/chunks/app/api/delete-rows/route-ad3ae203c81de67b.js +0 -1
  179. package/.next/static/chunks/app/api/detect/route-ad3ae203c81de67b.js +0 -1
  180. package/.next/static/chunks/app/api/health/route-ad3ae203c81de67b.js +0 -1
  181. package/.next/static/chunks/app/api/insert-row/route-ad3ae203c81de67b.js +0 -1
  182. package/.next/static/chunks/app/api/ledger/route-ad3ae203c81de67b.js +0 -1
  183. package/.next/static/chunks/app/api/lookup/route-ad3ae203c81de67b.js +0 -1
  184. package/.next/static/chunks/app/api/migrate/route-ad3ae203c81de67b.js +0 -1
  185. package/.next/static/chunks/app/api/note/route-ad3ae203c81de67b.js +0 -1
  186. package/.next/static/chunks/app/api/query/route-ad3ae203c81de67b.js +0 -1
  187. package/.next/static/chunks/app/api/reconcile/route-ad3ae203c81de67b.js +0 -1
  188. package/.next/static/chunks/app/api/rehearse/route-ad3ae203c81de67b.js +0 -1
  189. package/.next/static/chunks/app/api/related/route-ad3ae203c81de67b.js +0 -1
  190. package/.next/static/chunks/app/api/repo/route-ad3ae203c81de67b.js +0 -1
  191. package/.next/static/chunks/app/api/rows/route-ad3ae203c81de67b.js +0 -1
  192. package/.next/static/chunks/app/api/schema/route-ad3ae203c81de67b.js +0 -1
  193. package/.next/static/chunks/app/api/tables/route-ad3ae203c81de67b.js +0 -1
  194. package/.next/static/chunks/app/api/timeline/route-ad3ae203c81de67b.js +0 -1
  195. package/.next/static/chunks/app/api/update-row/route-ad3ae203c81de67b.js +0 -1
  196. package/.next/static/chunks/app/layout-e3fdecae5544dc60.js +0 -1
  197. package/.next/static/chunks/app/page-957b7639b047ba08.js +0 -2
  198. package/.next/static/chunks/next/dist/client/components/builtin/app-error-ad3ae203c81de67b.js +0 -1
  199. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-ad3ae203c81de67b.js +0 -1
  200. package/.next/static/chunks/next/dist/client/components/builtin/not-found-ad3ae203c81de67b.js +0 -1
  201. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-ad3ae203c81de67b.js +0 -1
  202. package/.next/static/chunks/webpack-34eb118f56295776.js +0 -1
  203. package/.next/static/css/ab9c0ea2c2569929.css +0 -1
  204. package/public/screenshots/ytdb-command-palette.png +0 -0
  205. package/public/screenshots/ytdb-connection.png +0 -0
  206. package/public/screenshots/ytdb-explorer.png +0 -0
  207. /package/.next/static/{PPqM7ay-YN8BBp1e_HK15 → NB4JOC2i3ctixKpjpc7WH}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- "use strict";(()=>{var a={};a.id=4688,a.ids=[4688],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3290:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>j});var e=c(65125),f=c(21010),g=c(84152),h=a([e]);function i(a,b){if(!a||"object"!=typeof a)throw Error(`adopt.entries[${b}] is not an object`);return{setName:(0,g.VW)(a.setName,`adopt.entries[${b}].setName`),version:(0,g.VW)(a.version,`adopt.entries[${b}].version`),name:"string"==typeof a.name?a.name:"",checksum:"string"==typeof a.checksum?a.checksum:"",applySql:"string"==typeof a.applySql?a.applySql:"",revertSql:"string"==typeof a.revertSql?a.revertSql:void 0}}e=(h.then?(await h)():h)[0];let j=(0,g.fx)("adopt",async a=>{let b=(0,g.VW)(a.connectionUrl,"connectionUrl"),c=a.adopt;if(!c||"object"!=typeof c)throw Error("Missing adopt");if(!(0,f.hD)(c.ledgerSchema))throw Error("adopt.ledgerSchema must be a plain schema name");if(!Array.isArray(c.entries)||0===c.entries.length)throw Error("adopt.entries must be a non-empty array");if(c.entries.length>5e3)throw Error("adopt.entries is over 5000 rows");return(0,e.mu)(b,{ledgerSchema:c.ledgerSchema,entries:c.entries.map(i)})});d()}catch(a){d(a)}})},3524:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/adopt/route",pathname:"/api/adopt",filename:"route",bundlePath:"app/api/adopt/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Users/theobourgeois/code/db-studio/src/app/api/adopt/route.ts",nextConfigOutput:"",userland:()=>c(3290),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/adopt/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},51455:a=>{a.exports=require("node:fs/promises")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},64939:a=>{a.exports=import("pg")},76760:a=>{a.exports=require("node:path")},77598:a=>{a.exports=require("node:crypto")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,6433,5125],()=>b(b.s=3524));module.exports=c})();
1
+ "use strict";(()=>{var a={};a.id=4688,a.ids=[4688],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3290:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>j});var e=c(65125),f=c(21010),g=c(84152),h=a([e]);function i(a,b){if(!a||"object"!=typeof a)throw Error(`adopt.entries[${b}] is not an object`);return{setName:(0,g.VW)(a.setName,`adopt.entries[${b}].setName`),version:(0,g.VW)(a.version,`adopt.entries[${b}].version`),name:"string"==typeof a.name?a.name:"",checksum:"string"==typeof a.checksum?a.checksum:"",applySql:"string"==typeof a.applySql?a.applySql:"",revertSql:"string"==typeof a.revertSql?a.revertSql:void 0}}e=(h.then?(await h)():h)[0];let j=(0,g.fx)("adopt",async a=>{let b=(0,g.VW)(a.connectionUrl,"connectionUrl"),c=a.adopt;if(!c||"object"!=typeof c)throw Error("Missing adopt");if(!(0,f.hD)(c.ledgerSchema))throw Error("adopt.ledgerSchema must be a plain schema name");if(!Array.isArray(c.entries)||0===c.entries.length)throw Error("adopt.entries must be a non-empty array");if(c.entries.length>5e3)throw Error("adopt.entries is over 5000 rows");return(0,e.mu)(b,{ledgerSchema:c.ledgerSchema,entries:c.entries.map(i)})});d()}catch(a){d(a)}})},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},11310:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/adopt/route",pathname:"/api/adopt",filename:"route",bundlePath:"app/api/adopt/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Users/theobourgeois/code/db-studio/src/app/api/adopt/route.ts",nextConfigOutput:"",userland:()=>c(3290),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/adopt/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},51455:a=>{a.exports=require("node:fs/promises")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},64939:a=>{a.exports=import("pg")},76760:a=>{a.exports=require("node:path")},77598:a=>{a.exports=require("node:crypto")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,6433,5125],()=>b(b.s=11310));module.exports=c})();
@@ -32,7 +32,7 @@
32
32
  WHERE NOT EXISTS (SELECT 1 FROM pg_inherits i WHERE i.inhparent = tree.oid)
33
33
  ), 0)::bigint AS bytes
34
34
  FROM tree
35
- `,r=new Set(["date","interval","json","jsonb","time","timestamp","timestamptz","timetz"]);function j(a){return null==a?null:"string"==typeof a||"number"==typeof a||"boolean"==typeof a?a:a instanceof Date?a.toISOString():Buffer.isBuffer(a)?`\\x${a.toString("hex")}`:JSON.stringify(a)}function k(a,b){let c=(0,f.v4)(a);return r.has(b)?`${c}::text`:c}async function l(a,b){let c=(0,e.d)(a),d=await c.query(p,[b.table.schema,b.table.name]),i=d.rows.map(a=>a.name);if(0===i.length)throw Error(`Table ${b.table.schema}.${b.table.name} not found`);let l=new Set(i),n=b.filters.filter(a=>(0,g.eK)(a)&&l.has(a.column)),o=(0,f.MC)(n),q=b.search?.trim()??"",r=!1;if(q){let a=d.rows.filter(a=>(0,f.p_)(a.data_type,a.type_category));if(a.length>0){o.params.push(`%${(0,f.q3)(q)}%`);let b=a.map(a=>`${(0,f.v4)(a.name)}::text ILIKE $${o.params.length} ESCAPE '\\'`).join(" OR ");o.sql=o.sql?`${o.sql} AND (${b})`:`WHERE ${b}`,r=!0}}let s=d.rows.filter(a=>a.is_pk).map(a=>a.name),t=b.sort&&l.has(b.sort.column)?b.sort:null,u=t?[`${(0,f.v4)(t.column)} ${"desc"===t.direction?"DESC":"ASC"}`,...s.filter(a=>a!==t.column).map(a=>`${(0,f.v4)(a)} ASC`)]:s.map(a=>`${(0,f.v4)(a)} ASC`),v=u.length?`ORDER BY ${u.join(", ")}`:"",w=(0,f.Z8)(b.table),x=d.rows.map(a=>k(a.name,a.data_type)),y=Math.max(1,Math.min(b.pageSize,500)),z=Math.floor(h.d6/y),A=Math.min(Math.max(0,b.page),z),B=A*y,C=A>=z,[D,E]=await Promise.all([c.query({text:`SELECT ${x.join(", ")} FROM ${w} ${o.sql} ${v} LIMIT ${y+1} OFFSET ${B}`,values:o.params,rowMode:"array"}),m(c,b.table,w,o,r)]),F=D.rows,G=F.length>y,H=G?F.slice(0,y):F;return{columns:i,rows:H.map(a=>a.map(j)),total:E.total,estimated:E.estimated,hasMore:G&&!C,capped:G&&C}}async function m(a,b,c,d,e){var f;if((f=await n(a,b))&&("r"===f.relkind||"p"===f.relkind||"m"===f.relkind)&&f.bytes<=h.Be){let b=await a.query(`SELECT count(*)::bigint AS count FROM ${c} ${d.sql}`,d.params);return{total:Number(b.rows[0]?.count??0),estimated:!1}}if(e)return{total:null,estimated:!0};try{return{total:await o(a,c,d),estimated:!0}}catch{return{total:null,estimated:!0}}}async function n(a,b){let c=(await a.query(q,[b.schema,b.name])).rows[0];return c?.relkind?{relkind:c.relkind,bytes:Number(c.bytes)}:null}async function o(a,b,c){let d=await a.query(`EXPLAIN (FORMAT JSON) SELECT 1 FROM ${b} ${c.sql}`,c.params);return function(a){let b="string"==typeof a?JSON.parse(a):a,c=Array.isArray(b)?b[0]:b;if(!c||"object"!=typeof c)return 0;let d="Plan"in c?c.Plan:null;if(!d||"object"!=typeof d||!("Plan Rows"in d))return 0;let e=Number(d["Plan Rows"]);return Number.isFinite(e)?Math.max(0,Math.round(e)):0}(d.rows[0]?.["QUERY PLAN"])}d()}catch(a){d(a)}})},21446:(a,b,c)=>{c.d(b,{eK:()=>e});let d={eq:{label:"Equals",symbol:"=",hasValue:!0,group:"comparison"},neq:{label:"Not equal",symbol:"<>",hasValue:!0,group:"comparison"},gt:{label:"Greater than",symbol:">",hasValue:!0,group:"comparison"},gte:{label:"Greater or equal",symbol:">=",hasValue:!0,group:"comparison"},lt:{label:"Less than",symbol:"<",hasValue:!0,group:"comparison"},lte:{label:"Less or equal",symbol:"<=",hasValue:!0,group:"comparison"},like:{label:"Like",symbol:"~~",hasValue:!0,group:"pattern"},ilike:{label:"iLike",symbol:"~~*",hasValue:!0,group:"pattern"},is_null:{label:"Is null",symbol:"IS NULL",hasValue:!1,group:"null"},is_not_null:{label:"Is not null",symbol:"IS NOT NULL",hasValue:!1,group:"null"}};function e(a){return!!a.column&&(!d[a.operator].hasValue||a.value.length>0)}Object.keys(d).map(a=>({value:a,label:d[a].label,symbol:d[a].symbol,group:d[a].group}))},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},34006:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>h});var e=c(53760),f=c(84152),g=a([e]);e=(g.then?(await g)():g)[0];let h=(0,f.fx)("cell.update",async a=>{let b=(0,f.VW)(a.connectionUrl,"connectionUrl");if(!a.update)throw Error("Missing update");return(0,e.k)(b,a.update)});d()}catch(a){d(a)}})},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},51455:a=>{a.exports=require("node:fs/promises")},53760:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{k:()=>j});var e=c(82428),f=c(74568),g=c(20967),h=a([e,g]);[e,g]=h.then?(await h)():h;let k=`
35
+ `,r=new Set(["date","interval","json","jsonb","time","timestamp","timestamptz","timetz"]);function j(a){return null==a?null:"string"==typeof a||"number"==typeof a||"boolean"==typeof a?a:a instanceof Date?a.toISOString():Buffer.isBuffer(a)?`\\x${a.toString("hex")}`:JSON.stringify(a)}function k(a,b){let c=(0,f.v4)(a);return r.has(b)?`${c}::text`:c}async function l(a,b){let c=(0,e.d)(a),d=await c.query(p,[b.table.schema,b.table.name]),i=d.rows.map(a=>a.name);if(0===i.length)throw Error(`Table ${b.table.schema}.${b.table.name} not found`);let l=new Set(i),n=b.filters.filter(a=>(0,g.eK)(a)&&l.has(a.column)),o=(0,f.MC)(n),q=b.search?.trim()??"",r=!1;if(q){let a=d.rows.filter(a=>(0,f.p_)(a.data_type,a.type_category));if(a.length>0){o.params.push(`%${(0,f.q3)(q)}%`);let b=a.map(a=>`${(0,f.v4)(a.name)}::text ILIKE $${o.params.length} ESCAPE '\\'`).join(" OR ");o.sql=o.sql?`${o.sql} AND (${b})`:`WHERE ${b}`,r=!0}}let s=d.rows.filter(a=>a.is_pk).map(a=>a.name),t=b.sort&&l.has(b.sort.column)?b.sort:null,u=t?[`${(0,f.v4)(t.column)} ${"desc"===t.direction?"DESC":"ASC"}`,...s.filter(a=>a!==t.column).map(a=>`${(0,f.v4)(a)} ASC`)]:[],v=u.length?`ORDER BY ${u.join(", ")}`:"",w=(0,f.Z8)(b.table),x=d.rows.map(a=>k(a.name,a.data_type)),y=Math.max(1,Math.min(b.pageSize,500)),z=Math.floor(h.d6/y),A=Math.min(Math.max(0,b.page),z),B=A*y,C=A>=z,[D,E]=await Promise.all([c.query({text:`SELECT ${x.join(", ")} FROM ${w} ${o.sql} ${v} LIMIT ${y+1} OFFSET ${B}`,values:o.params,rowMode:"array"}),m(c,b.table,w,o,r)]),F=D.rows,G=F.length>y,H=G?F.slice(0,y):F;return{columns:i,rows:H.map(a=>a.map(j)),total:E.total,estimated:E.estimated,hasMore:G&&!C,capped:G&&C}}async function m(a,b,c,d,e){var f;if((f=await n(a,b))&&("r"===f.relkind||"p"===f.relkind||"m"===f.relkind)&&f.bytes<=h.Be){let b=await a.query(`SELECT count(*)::bigint AS count FROM ${c} ${d.sql}`,d.params);return{total:Number(b.rows[0]?.count??0),estimated:!1}}if(e)return{total:null,estimated:!0};try{return{total:await o(a,c,d),estimated:!0}}catch{return{total:null,estimated:!0}}}async function n(a,b){let c=(await a.query(q,[b.schema,b.name])).rows[0];return c?.relkind?{relkind:c.relkind,bytes:Number(c.bytes)}:null}async function o(a,b,c){let d=await a.query(`EXPLAIN (FORMAT JSON) SELECT 1 FROM ${b} ${c.sql}`,c.params);return function(a){let b="string"==typeof a?JSON.parse(a):a,c=Array.isArray(b)?b[0]:b;if(!c||"object"!=typeof c)return 0;let d="Plan"in c?c.Plan:null;if(!d||"object"!=typeof d||!("Plan Rows"in d))return 0;let e=Number(d["Plan Rows"]);return Number.isFinite(e)?Math.max(0,Math.round(e)):0}(d.rows[0]?.["QUERY PLAN"])}d()}catch(a){d(a)}})},21280:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/cell/route",pathname:"/api/cell",filename:"route",bundlePath:"app/api/cell/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Users/theobourgeois/code/db-studio/src/app/api/cell/route.ts",nextConfigOutput:"",userland:()=>c(34006),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/cell/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},21446:(a,b,c)=>{c.d(b,{eK:()=>e});let d={eq:{label:"Equals",symbol:"=",hasValue:!0,group:"comparison"},neq:{label:"Not equal",symbol:"<>",hasValue:!0,group:"comparison"},gt:{label:"Greater than",symbol:">",hasValue:!0,group:"comparison"},gte:{label:"Greater or equal",symbol:">=",hasValue:!0,group:"comparison"},lt:{label:"Less than",symbol:"<",hasValue:!0,group:"comparison"},lte:{label:"Less or equal",symbol:"<=",hasValue:!0,group:"comparison"},like:{label:"Like",symbol:"~~",hasValue:!0,group:"pattern"},ilike:{label:"iLike",symbol:"~~*",hasValue:!0,group:"pattern"},is_null:{label:"Is null",symbol:"IS NULL",hasValue:!1,group:"null"},is_not_null:{label:"Is not null",symbol:"IS NOT NULL",hasValue:!1,group:"null"}};function e(a){return!!a.column&&(!d[a.operator].hasValue||a.value.length>0)}Object.keys(d).map(a=>({value:a,label:d[a].label,symbol:d[a].symbol,group:d[a].group}))},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},34006:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>h});var e=c(53760),f=c(84152),g=a([e]);e=(g.then?(await g)():g)[0];let h=(0,f.fx)("cell.update",async a=>{let b=(0,f.VW)(a.connectionUrl,"connectionUrl");if(!a.update)throw Error("Missing update");return(0,e.k)(b,a.update)});d()}catch(a){d(a)}})},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},51455:a=>{a.exports=require("node:fs/promises")},53760:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{k:()=>j});var e=c(82428),f=c(74568),g=c(20967),h=a([e,g]);[e,g]=h.then?(await h)():h;let k=`
36
36
  SELECT c.relkind AS relkind,
37
37
  a.attname AS name,
38
38
  COALESCE(base_type.typname, t.typname) AS data_type,
@@ -57,4 +57,4 @@
57
57
  `;function i(a){return null===a||"string"==typeof a||"number"==typeof a||"boolean"==typeof a}async function j(a,b){if(!b?.table||"string"!=typeof b.table.schema||"string"!=typeof b.table.name)throw Error("Missing table");if("string"!=typeof b.column||!b.column)throw Error("Missing column");if(!b.primaryKey||"object"!=typeof b.primaryKey||Array.isArray(b.primaryKey))throw Error("Missing primary key");if(!i(b.value))throw Error("Unsupported cell value");let c=(0,e.d)(a),d=(await c.query(k,[b.table.schema,b.table.name])).rows;if(0===d.length)throw Error(`Table ${b.table.schema}.${b.table.name} not found`);if(!d.every(a=>"r"===a.relkind||"p"===a.relkind))throw Error("Views and foreign tables are read-only");let h=d.find(a=>a.name===b.column);if(!h)throw Error(`Column ${b.column} not found`);if(h.is_generated)throw Error("Generated columns are read-only");if(h.is_identity)throw Error("Identity columns are read-only");let j=d.filter(a=>a.is_pk);if(0===j.length)throw Error("Editing requires a primary key");if(Object.keys(b.primaryKey).length!==j.length||j.some(a=>!Object.prototype.hasOwnProperty.call(b.primaryKey,a.name)))throw Error("The row primary key is incomplete");let l=[b.value],m=j.map((a,c)=>{let d=b.primaryKey[a.name];if(!i(d))throw Error(`Invalid primary key value for ${a.name}`);return l.push(d),`${(0,f.v4)(a.name)} IS NOT DISTINCT FROM $${c+2}`}),n=d.map(a=>(0,g.x)(a.name,a.data_type)).join(", "),o=await c.query({text:`UPDATE ${(0,f.Z8)(b.table)}
58
58
  SET ${(0,f.v4)(h.name)} = $1
59
59
  WHERE ${m.join(" AND ")}
60
- RETURNING ${n}`,values:l,rowMode:"array"});if(1!==o.rowCount)throw Error("The row no longer exists or could not be updated");return{row:o.rows[0].map(g.dm)}}d()}catch(a){d(a)}})},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},64939:a=>{a.exports=import("pg")},67842:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/cell/route",pathname:"/api/cell",filename:"route",bundlePath:"app/api/cell/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Users/theobourgeois/code/db-studio/src/app/api/cell/route.ts",nextConfigOutput:"",userland:()=>c(34006),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/cell/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},76760:a=>{a.exports=require("node:path")},77598:a=>{a.exports=require("node:crypto")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,7605],()=>b(b.s=67842));module.exports=c})();
60
+ RETURNING ${n}`,values:l,rowMode:"array"});if(1!==o.rowCount)throw Error("The row no longer exists or could not be updated");return{row:o.rows[0].map(g.dm)}}d()}catch(a){d(a)}})},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},64939:a=>{a.exports=import("pg")},76760:a=>{a.exports=require("node:path")},77598:a=>{a.exports=require("node:crypto")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,7605],()=>b(b.s=21280));module.exports=c})();
@@ -1,4 +1,4 @@
1
- "use strict";(()=>{var a={};a.id=4909,a.ids=[4909],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},1372:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/definition/route",pathname:"/api/definition",filename:"route",bundlePath:"app/api/definition/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Users/theobourgeois/code/db-studio/src/app/api/definition/route.ts",nextConfigOutput:"",userland:()=>c(86479),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/definition/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},51455:a=>{a.exports=require("node:fs/promises")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},64939:a=>{a.exports=import("pg")},76760:a=>{a.exports=require("node:path")},77598:a=>{a.exports=require("node:crypto")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},86479:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>h});var e=c(90223),f=c(84152),g=a([e]);e=(g.then?(await g)():g)[0];let h=(0,f.fx)("definition",async a=>{let b=(0,f.VW)(a.connectionUrl,"connectionUrl");return(0,e.I)(b,(0,f.ms)(a.table))});d()}catch(a){d(a)}})},90223:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{I:()=>h});var e=c(82428),f=c(74568),g=a([e]);e=(g.then?(await g)():g)[0];let k=`
1
+ "use strict";(()=>{var a={};a.id=4909,a.ids=[4909],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},31206:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/definition/route",pathname:"/api/definition",filename:"route",bundlePath:"app/api/definition/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Users/theobourgeois/code/db-studio/src/app/api/definition/route.ts",nextConfigOutput:"",userland:()=>c(86479),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/definition/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},51455:a=>{a.exports=require("node:fs/promises")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},64939:a=>{a.exports=import("pg")},76760:a=>{a.exports=require("node:path")},77598:a=>{a.exports=require("node:crypto")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},86479:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>h});var e=c(90223),f=c(84152),g=a([e]);e=(g.then?(await g)():g)[0];let h=(0,f.fx)("definition",async a=>{let b=(0,f.VW)(a.connectionUrl,"connectionUrl");return(0,e.I)(b,(0,f.ms)(a.table))});d()}catch(a){d(a)}})},90223:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{I:()=>h});var e=c(82428),f=c(74568),g=a([e]);e=(g.then?(await g)():g)[0];let k=`
2
2
  SELECT c.relkind,
3
3
  c.relpersistence,
4
4
  CASE WHEN c.relkind IN ('v', 'm') THEN pg_get_viewdef(c.oid, true) END AS viewdef,
@@ -85,4 +85,4 @@
85
85
  `;async function h(a,b){var c;let d,g=(0,e.d)(a),h=[b.schema,b.name],[p,q,r,s,t]=await Promise.all([g.query(k,h),g.query(l,h),g.query(m,h),g.query(n,h),g.query(o,h)]),u=p.rows[0];if(!u)throw Error(`Relation ${(0,f.Z8)(b)} not found`);let v=[...s.rows.map(a=>j(a.def)),...t.rows.map(a=>j(a.def))];if("v"===u.relkind||"m"===u.relkind){let a="m"===u.relkind?"MATERIALIZED VIEW":"VIEW",c=u.viewdef?.trim()??"SELECT NULL";return{sql:[`CREATE ${a} ${(0,f.Z8)(b)} AS
86
86
  ${c.replace(/;$/,"")};`,...v].join("\n\n")+"\n"}}let w=[...q.rows.map(i),...r.rows.map(a=>`CONSTRAINT ${(0,f.v4)(a.name)} ${a.def}`)],x=w.map(a=>` ${a}`).join(",\n"),y=function(a,b){let c="u"===b.relpersistence?"UNLOGGED ":"",d=(0,f.Z8)(a);if("f"===b.relkind)return`CREATE FOREIGN TABLE ${d}`;if(b.partition_bound&&b.parent_schema&&b.parent_name){let a=(0,f.Z8)({schema:b.parent_schema,name:b.parent_name});return`CREATE ${c}TABLE ${d} PARTITION OF ${a}`}return`CREATE ${c}TABLE ${d}`}(b,u),z=(c=u,d=[],c.partition_bound&&d.push(` ${c.partition_bound}`),c.partition_by&&d.push(` PARTITION BY ${c.partition_by}`),"f"===c.relkind&&c.foreign_server&&d.push(` SERVER ${(0,f.v4)(c.foreign_server)}`),d.join(""));return{sql:[0===w.length?`${y}${z};`:`${y} (
87
87
  ${x}
88
- )${z};`,...v].join("\n\n")+"\n"}}function i(a){let b=[(0,f.v4)(a.name),a.type];if(a.collation&&b.push("COLLATE",(0,f.v4)(a.collation)),"s"===a.attgenerated||"v"===a.attgenerated){let c=a.default_expr??"NULL";return b.push("GENERATED ALWAYS AS",`(${c})`),"s"===a.attgenerated&&b.push("STORED"),a.nullable||b.push("NOT NULL"),b.join(" ")}return a.nullable||b.push("NOT NULL"),"a"===a.attidentity?b.push("GENERATED ALWAYS AS IDENTITY"):"d"===a.attidentity?b.push("GENERATED BY DEFAULT AS IDENTITY"):a.default_expr&&b.push("DEFAULT",a.default_expr),b.join(" ")}function j(a){let b=a.trim();return b.endsWith(";")?b:`${b};`}d()}catch(a){d(a)}})}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,7605],()=>b(b.s=1372));module.exports=c})();
88
+ )${z};`,...v].join("\n\n")+"\n"}}function i(a){let b=[(0,f.v4)(a.name),a.type];if(a.collation&&b.push("COLLATE",(0,f.v4)(a.collation)),"s"===a.attgenerated||"v"===a.attgenerated){let c=a.default_expr??"NULL";return b.push("GENERATED ALWAYS AS",`(${c})`),"s"===a.attgenerated&&b.push("STORED"),a.nullable||b.push("NOT NULL"),b.join(" ")}return a.nullable||b.push("NOT NULL"),"a"===a.attidentity?b.push("GENERATED ALWAYS AS IDENTITY"):"d"===a.attidentity?b.push("GENERATED BY DEFAULT AS IDENTITY"):a.default_expr&&b.push("DEFAULT",a.default_expr),b.join(" ")}function j(a){let b=a.trim();return b.endsWith(";")?b:`${b};`}d()}catch(a){d(a)}})}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,7605],()=>b(b.s=31206));module.exports=c})();
@@ -1,4 +1,4 @@
1
- "use strict";(()=>{var a={};a.id=3219,a.ids=[3219],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},36198:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/delete-rows/route",pathname:"/api/delete-rows",filename:"route",bundlePath:"app/api/delete-rows/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Users/theobourgeois/code/db-studio/src/app/api/delete-rows/route.ts",nextConfigOutput:"",userland:()=>c(71727),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/delete-rows/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},51455:a=>{a.exports=require("node:fs/promises")},52371:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{p:()=>h});var e=c(82428),f=c(74568),g=a([e]);e=(g.then?(await g)():g)[0];let i=`
1
+ "use strict";(()=>{var a={};a.id=3219,a.ids=[3219],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},51455:a=>{a.exports=require("node:fs/promises")},52371:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{p:()=>h});var e=c(82428),f=c(74568),g=a([e]);e=(g.then?(await g)():g)[0];let i=`
2
2
  SELECT c.relkind AS relkind,
3
3
  a.attname AS name,
4
4
  COALESCE(
@@ -16,4 +16,4 @@
16
16
  AND NOT a.attisdropped
17
17
  ORDER BY a.attnum
18
18
  `;async function h(a,b){if(!b?.table||"string"!=typeof b.table.schema||"string"!=typeof b.table.name)throw Error("Missing table");if(!Array.isArray(b.primaryKeys)||0===b.primaryKeys.length)throw Error("No rows to delete");if(b.primaryKeys.length>500)throw Error("Cannot delete more than 500 rows at once");let c=(0,e.d)(a),d=(await c.query(i,[b.table.schema,b.table.name])).rows;if(0===d.length)throw Error(`Table ${b.table.schema}.${b.table.name} not found`);if(!d.every(a=>"r"===a.relkind||"p"===a.relkind))throw Error("Views and foreign tables are read-only");let g=d.filter(a=>a.is_pk);if(0===g.length)throw Error("Deleting requires a primary key");let h=[],j=b.primaryKeys.map((a,b)=>{if(!a||"object"!=typeof a||Array.isArray(a))throw Error(`Invalid primary key for row ${b+1}`);if(Object.keys(a).length!==g.length||g.some(b=>!Object.prototype.hasOwnProperty.call(a,b.name)))throw Error("The row primary key is incomplete");let c=g.map(b=>{let c=a[b.name];if(null!==c&&"string"!=typeof c&&"number"!=typeof c&&"boolean"!=typeof c)throw Error(`Invalid primary key value for ${b.name}`);return h.push(c),`$${h.length}`});return`(${c.join(", ")})`}),k=g.map(a=>(0,f.v4)(a.name)).join(", ");return{deleted:(await c.query(`DELETE FROM ${(0,f.Z8)(b.table)}
19
- WHERE (${k}) IN (${j.join(", ")})`,h)).rowCount??0}}d()}catch(a){d(a)}})},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},64939:a=>{a.exports=import("pg")},71727:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>h});var e=c(52371),f=c(84152),g=a([e]);e=(g.then?(await g)():g)[0];let h=(0,f.fx)("rows.delete",async a=>{let b=(0,f.VW)(a.connectionUrl,"connectionUrl");if(!a.deletion)throw Error("Missing deletion");return(0,e.p)(b,a.deletion)});d()}catch(a){d(a)}})},76760:a=>{a.exports=require("node:path")},77598:a=>{a.exports=require("node:crypto")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,7605],()=>b(b.s=36198));module.exports=c})();
19
+ WHERE (${k}) IN (${j.join(", ")})`,h)).rowCount??0}}d()}catch(a){d(a)}})},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},64939:a=>{a.exports=import("pg")},71727:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>h});var e=c(52371),f=c(84152),g=a([e]);e=(g.then?(await g)():g)[0];let h=(0,f.fx)("rows.delete",async a=>{let b=(0,f.VW)(a.connectionUrl,"connectionUrl");if(!a.deletion)throw Error("Missing deletion");return(0,e.p)(b,a.deletion)});d()}catch(a){d(a)}})},76760:a=>{a.exports=require("node:path")},77598:a=>{a.exports=require("node:crypto")},78372:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/delete-rows/route",pathname:"/api/delete-rows",filename:"route",bundlePath:"app/api/delete-rows/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Users/theobourgeois/code/db-studio/src/app/api/delete-rows/route.ts",nextConfigOutput:"",userland:()=>c(71727),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/delete-rows/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,7605],()=>b(b.s=78372));module.exports=c})();
@@ -1 +1 @@
1
- "use strict";(()=>{var a={};a.id=4707,a.ids=[4707],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},11304:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/detect/route",pathname:"/api/detect",filename:"route",bundlePath:"app/api/detect/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Users/theobourgeois/code/db-studio/src/app/api/detect/route.ts",nextConfigOutput:"",userland:()=>c(28009),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/detect/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},28009:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>i});var e=c(35417),f=c(84152),g=a([e]);function h(a,b){if(!a||"object"!=typeof a)throw Error(`migrations[${b}] is not an object`);return{setName:(0,f.VW)(a.setName,`migrations[${b}].setName`),version:(0,f.VW)(a.version,`migrations[${b}].version`),sql:"string"==typeof a.sql?a.sql:""}}e=(g.then?(await g)():g)[0];let i=(0,f.fx)("detect",async a=>{let b=(0,f.VW)(a.connectionUrl,"connectionUrl");if(!Array.isArray(a.migrations)||0===a.migrations.length)throw Error("migrations must be a non-empty array");if(a.migrations.length>5e3)throw Error("migrations is over 5000");return{results:await (0,e.D)(b,a.migrations.map(h))}});d()}catch(a){d(a)}})},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},51455:a=>{a.exports=require("node:fs/promises")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},64939:a=>{a.exports=import("pg")},76760:a=>{a.exports=require("node:path")},77598:a=>{a.exports=require("node:crypto")},82428:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{d:()=>h});var e=c(64939),f=c(41834),g=a([e]);e=(g.then?(await g)():g)[0];let i=new Map,j={explorer:f.nc,migration:f.mf};function h(a,b="explorer"){let c=`${b}:${a}`,d=i.get(c);if(!d){let f=j[b];(d=new e.Pool({connectionString:a,max:"migration"===b?2:4,idleTimeoutMillis:3e4,application_name:"ytdb",statement_timeout:f,query_timeout:f,ssl:!function(a){try{let{hostname:b,searchParams:c}=new URL(a);if(c.has("sslmode"))return"disable"!==c.get("sslmode");return!["localhost","127.0.0.1","::1"].includes(b)}catch{return!1}}(a)?void 0:{rejectUnauthorized:!1}})).on("error",()=>i.delete(c)),i.set(c,d)}return d}d()}catch(a){d(a)}})},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,6433,5417],()=>b(b.s=11304));module.exports=c})();
1
+ "use strict";(()=>{var a={};a.id=4707,a.ids=[4707],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},28009:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>i});var e=c(35417),f=c(84152),g=a([e]);function h(a,b){if(!a||"object"!=typeof a)throw Error(`migrations[${b}] is not an object`);return{setName:(0,f.VW)(a.setName,`migrations[${b}].setName`),version:(0,f.VW)(a.version,`migrations[${b}].version`),sql:"string"==typeof a.sql?a.sql:""}}e=(g.then?(await g)():g)[0];let i=(0,f.fx)("detect",async a=>{let b=(0,f.VW)(a.connectionUrl,"connectionUrl");if(!Array.isArray(a.migrations)||0===a.migrations.length)throw Error("migrations must be a non-empty array");if(a.migrations.length>5e3)throw Error("migrations is over 5000");return{results:await (0,e.D)(b,a.migrations.map(h))}});d()}catch(a){d(a)}})},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},51455:a=>{a.exports=require("node:fs/promises")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},64939:a=>{a.exports=import("pg")},76760:a=>{a.exports=require("node:path")},77598:a=>{a.exports=require("node:crypto")},77602:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/detect/route",pathname:"/api/detect",filename:"route",bundlePath:"app/api/detect/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Users/theobourgeois/code/db-studio/src/app/api/detect/route.ts",nextConfigOutput:"",userland:()=>c(28009),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/detect/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},82428:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{d:()=>h});var e=c(64939),f=c(41834),g=a([e]);e=(g.then?(await g)():g)[0];let i=new Map,j={explorer:f.nc,migration:f.mf};function h(a,b="explorer"){let c=`${b}:${a}`,d=i.get(c);if(!d){let f=j[b];(d=new e.Pool({connectionString:a,max:"migration"===b?2:4,idleTimeoutMillis:3e4,application_name:"ytdb",statement_timeout:f,query_timeout:f,ssl:!function(a){try{let{hostname:b,searchParams:c}=new URL(a);if(c.has("sslmode"))return"disable"!==c.get("sslmode");return!["localhost","127.0.0.1","::1"].includes(b)}catch{return!1}}(a)?void 0:{rejectUnauthorized:!1}})).on("error",()=>i.delete(c)),i.set(c,d)}return d}d()}catch(a){d(a)}})},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,6433,5417],()=>b(b.s=77602));module.exports=c})();
@@ -1 +1 @@
1
- (()=>{var a={};a.id=2772,a.ids=[2772],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},19225:(a,b,c)=>{"use strict";a.exports=c(44870)},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},78335:()=>{},85992:(a,b,c)=>{"use strict";function d(){return"1"===process.env.VERCEL?Response.json({error:"Database API is local-only"},{status:404}):Response.json({ok:!0,name:"YTDB"})}c.r(b),c.d(b,{GET:()=>d})},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},92280:(a,b,c)=>{"use strict";Object.defineProperty(b,"I",{enumerable:!0,get:function(){return g}});let d=c(28208),e=c(47617),f=c(62018);async function g(a,b,c,g){if((0,d.isNodeNextResponse)(b)){var h;b.statusCode=c.status,b.statusMessage=c.statusText;let d=["set-cookie","www-authenticate","proxy-authenticate","vary"];null==(h=c.headers)||h.forEach((a,c)=>{if("x-middleware-set-cookie"!==c.toLowerCase())if("set-cookie"===c.toLowerCase())for(let d of(0,f.splitCookiesString)(a))b.appendHeader(c,d);else{let e=void 0!==b.getHeader(c);(d.includes(c.toLowerCase())||!e)&&b.appendHeader(c,a)}});let{originalResponse:i}=b;c.body&&"HEAD"!==a.method?await (0,e.pipeToNodeResponse)(c.body,i,g):i.end()}}},94694:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/health/route",pathname:"/api/health",filename:"route",bundlePath:"app/api/health/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Users/theobourgeois/code/db-studio/src/app/api/health/route.ts",nextConfigOutput:"",userland:()=>c(85992),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/health/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},96487:()=>{}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741],()=>b(b.s=94694));module.exports=c})();
1
+ (()=>{var a={};a.id=2772,a.ids=[2772],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},19225:(a,b,c)=>{"use strict";a.exports=c(44870)},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},55876:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/health/route",pathname:"/api/health",filename:"route",bundlePath:"app/api/health/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Users/theobourgeois/code/db-studio/src/app/api/health/route.ts",nextConfigOutput:"",userland:()=>c(85992),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/health/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},78335:()=>{},85992:(a,b,c)=>{"use strict";function d(){return"1"===process.env.VERCEL?Response.json({error:"Database API is local-only"},{status:404}):Response.json({ok:!0,name:"YTDB"})}c.r(b),c.d(b,{GET:()=>d})},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},92280:(a,b,c)=>{"use strict";Object.defineProperty(b,"I",{enumerable:!0,get:function(){return g}});let d=c(28208),e=c(47617),f=c(62018);async function g(a,b,c,g){if((0,d.isNodeNextResponse)(b)){var h;b.statusCode=c.status,b.statusMessage=c.statusText;let d=["set-cookie","www-authenticate","proxy-authenticate","vary"];null==(h=c.headers)||h.forEach((a,c)=>{if("x-middleware-set-cookie"!==c.toLowerCase())if("set-cookie"===c.toLowerCase())for(let d of(0,f.splitCookiesString)(a))b.appendHeader(c,d);else{let e=void 0!==b.getHeader(c);(d.includes(c.toLowerCase())||!e)&&b.appendHeader(c,a)}});let{originalResponse:i}=b;c.body&&"HEAD"!==a.method?await (0,e.pipeToNodeResponse)(c.body,i,g):i.end()}}},96487:()=>{}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741],()=>b(b.s=55876));module.exports=c})();
@@ -32,7 +32,7 @@
32
32
  WHERE NOT EXISTS (SELECT 1 FROM pg_inherits i WHERE i.inhparent = tree.oid)
33
33
  ), 0)::bigint AS bytes
34
34
  FROM tree
35
- `,r=new Set(["date","interval","json","jsonb","time","timestamp","timestamptz","timetz"]);function j(a){return null==a?null:"string"==typeof a||"number"==typeof a||"boolean"==typeof a?a:a instanceof Date?a.toISOString():Buffer.isBuffer(a)?`\\x${a.toString("hex")}`:JSON.stringify(a)}function k(a,b){let c=(0,f.v4)(a);return r.has(b)?`${c}::text`:c}async function l(a,b){let c=(0,e.d)(a),d=await c.query(p,[b.table.schema,b.table.name]),i=d.rows.map(a=>a.name);if(0===i.length)throw Error(`Table ${b.table.schema}.${b.table.name} not found`);let l=new Set(i),n=b.filters.filter(a=>(0,g.eK)(a)&&l.has(a.column)),o=(0,f.MC)(n),q=b.search?.trim()??"",r=!1;if(q){let a=d.rows.filter(a=>(0,f.p_)(a.data_type,a.type_category));if(a.length>0){o.params.push(`%${(0,f.q3)(q)}%`);let b=a.map(a=>`${(0,f.v4)(a.name)}::text ILIKE $${o.params.length} ESCAPE '\\'`).join(" OR ");o.sql=o.sql?`${o.sql} AND (${b})`:`WHERE ${b}`,r=!0}}let s=d.rows.filter(a=>a.is_pk).map(a=>a.name),t=b.sort&&l.has(b.sort.column)?b.sort:null,u=t?[`${(0,f.v4)(t.column)} ${"desc"===t.direction?"DESC":"ASC"}`,...s.filter(a=>a!==t.column).map(a=>`${(0,f.v4)(a)} ASC`)]:s.map(a=>`${(0,f.v4)(a)} ASC`),v=u.length?`ORDER BY ${u.join(", ")}`:"",w=(0,f.Z8)(b.table),x=d.rows.map(a=>k(a.name,a.data_type)),y=Math.max(1,Math.min(b.pageSize,500)),z=Math.floor(h.d6/y),A=Math.min(Math.max(0,b.page),z),B=A*y,C=A>=z,[D,E]=await Promise.all([c.query({text:`SELECT ${x.join(", ")} FROM ${w} ${o.sql} ${v} LIMIT ${y+1} OFFSET ${B}`,values:o.params,rowMode:"array"}),m(c,b.table,w,o,r)]),F=D.rows,G=F.length>y,H=G?F.slice(0,y):F;return{columns:i,rows:H.map(a=>a.map(j)),total:E.total,estimated:E.estimated,hasMore:G&&!C,capped:G&&C}}async function m(a,b,c,d,e){var f;if((f=await n(a,b))&&("r"===f.relkind||"p"===f.relkind||"m"===f.relkind)&&f.bytes<=h.Be){let b=await a.query(`SELECT count(*)::bigint AS count FROM ${c} ${d.sql}`,d.params);return{total:Number(b.rows[0]?.count??0),estimated:!1}}if(e)return{total:null,estimated:!0};try{return{total:await o(a,c,d),estimated:!0}}catch{return{total:null,estimated:!0}}}async function n(a,b){let c=(await a.query(q,[b.schema,b.name])).rows[0];return c?.relkind?{relkind:c.relkind,bytes:Number(c.bytes)}:null}async function o(a,b,c){let d=await a.query(`EXPLAIN (FORMAT JSON) SELECT 1 FROM ${b} ${c.sql}`,c.params);return function(a){let b="string"==typeof a?JSON.parse(a):a,c=Array.isArray(b)?b[0]:b;if(!c||"object"!=typeof c)return 0;let d="Plan"in c?c.Plan:null;if(!d||"object"!=typeof d||!("Plan Rows"in d))return 0;let e=Number(d["Plan Rows"]);return Number.isFinite(e)?Math.max(0,Math.round(e)):0}(d.rows[0]?.["QUERY PLAN"])}d()}catch(a){d(a)}})},21446:(a,b,c)=>{c.d(b,{eK:()=>e});let d={eq:{label:"Equals",symbol:"=",hasValue:!0,group:"comparison"},neq:{label:"Not equal",symbol:"<>",hasValue:!0,group:"comparison"},gt:{label:"Greater than",symbol:">",hasValue:!0,group:"comparison"},gte:{label:"Greater or equal",symbol:">=",hasValue:!0,group:"comparison"},lt:{label:"Less than",symbol:"<",hasValue:!0,group:"comparison"},lte:{label:"Less or equal",symbol:"<=",hasValue:!0,group:"comparison"},like:{label:"Like",symbol:"~~",hasValue:!0,group:"pattern"},ilike:{label:"iLike",symbol:"~~*",hasValue:!0,group:"pattern"},is_null:{label:"Is null",symbol:"IS NULL",hasValue:!1,group:"null"},is_not_null:{label:"Is not null",symbol:"IS NOT NULL",hasValue:!1,group:"null"}};function e(a){return!!a.column&&(!d[a.operator].hasValue||a.value.length>0)}Object.keys(d).map(a=>({value:a,label:d[a].label,symbol:d[a].symbol,group:d[a].group}))},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},42650:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/insert-row/route",pathname:"/api/insert-row",filename:"route",bundlePath:"app/api/insert-row/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Users/theobourgeois/code/db-studio/src/app/api/insert-row/route.ts",nextConfigOutput:"",userland:()=>c(55494),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/insert-row/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},49226:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{I:()=>i});var e=c(82428),f=c(74568),g=c(20967),h=a([e,g]);[e,g]=h.then?(await h)():h;let j=`
35
+ `,r=new Set(["date","interval","json","jsonb","time","timestamp","timestamptz","timetz"]);function j(a){return null==a?null:"string"==typeof a||"number"==typeof a||"boolean"==typeof a?a:a instanceof Date?a.toISOString():Buffer.isBuffer(a)?`\\x${a.toString("hex")}`:JSON.stringify(a)}function k(a,b){let c=(0,f.v4)(a);return r.has(b)?`${c}::text`:c}async function l(a,b){let c=(0,e.d)(a),d=await c.query(p,[b.table.schema,b.table.name]),i=d.rows.map(a=>a.name);if(0===i.length)throw Error(`Table ${b.table.schema}.${b.table.name} not found`);let l=new Set(i),n=b.filters.filter(a=>(0,g.eK)(a)&&l.has(a.column)),o=(0,f.MC)(n),q=b.search?.trim()??"",r=!1;if(q){let a=d.rows.filter(a=>(0,f.p_)(a.data_type,a.type_category));if(a.length>0){o.params.push(`%${(0,f.q3)(q)}%`);let b=a.map(a=>`${(0,f.v4)(a.name)}::text ILIKE $${o.params.length} ESCAPE '\\'`).join(" OR ");o.sql=o.sql?`${o.sql} AND (${b})`:`WHERE ${b}`,r=!0}}let s=d.rows.filter(a=>a.is_pk).map(a=>a.name),t=b.sort&&l.has(b.sort.column)?b.sort:null,u=t?[`${(0,f.v4)(t.column)} ${"desc"===t.direction?"DESC":"ASC"}`,...s.filter(a=>a!==t.column).map(a=>`${(0,f.v4)(a)} ASC`)]:[],v=u.length?`ORDER BY ${u.join(", ")}`:"",w=(0,f.Z8)(b.table),x=d.rows.map(a=>k(a.name,a.data_type)),y=Math.max(1,Math.min(b.pageSize,500)),z=Math.floor(h.d6/y),A=Math.min(Math.max(0,b.page),z),B=A*y,C=A>=z,[D,E]=await Promise.all([c.query({text:`SELECT ${x.join(", ")} FROM ${w} ${o.sql} ${v} LIMIT ${y+1} OFFSET ${B}`,values:o.params,rowMode:"array"}),m(c,b.table,w,o,r)]),F=D.rows,G=F.length>y,H=G?F.slice(0,y):F;return{columns:i,rows:H.map(a=>a.map(j)),total:E.total,estimated:E.estimated,hasMore:G&&!C,capped:G&&C}}async function m(a,b,c,d,e){var f;if((f=await n(a,b))&&("r"===f.relkind||"p"===f.relkind||"m"===f.relkind)&&f.bytes<=h.Be){let b=await a.query(`SELECT count(*)::bigint AS count FROM ${c} ${d.sql}`,d.params);return{total:Number(b.rows[0]?.count??0),estimated:!1}}if(e)return{total:null,estimated:!0};try{return{total:await o(a,c,d),estimated:!0}}catch{return{total:null,estimated:!0}}}async function n(a,b){let c=(await a.query(q,[b.schema,b.name])).rows[0];return c?.relkind?{relkind:c.relkind,bytes:Number(c.bytes)}:null}async function o(a,b,c){let d=await a.query(`EXPLAIN (FORMAT JSON) SELECT 1 FROM ${b} ${c.sql}`,c.params);return function(a){let b="string"==typeof a?JSON.parse(a):a,c=Array.isArray(b)?b[0]:b;if(!c||"object"!=typeof c)return 0;let d="Plan"in c?c.Plan:null;if(!d||"object"!=typeof d||!("Plan Rows"in d))return 0;let e=Number(d["Plan Rows"]);return Number.isFinite(e)?Math.max(0,Math.round(e)):0}(d.rows[0]?.["QUERY PLAN"])}d()}catch(a){d(a)}})},21446:(a,b,c)=>{c.d(b,{eK:()=>e});let d={eq:{label:"Equals",symbol:"=",hasValue:!0,group:"comparison"},neq:{label:"Not equal",symbol:"<>",hasValue:!0,group:"comparison"},gt:{label:"Greater than",symbol:">",hasValue:!0,group:"comparison"},gte:{label:"Greater or equal",symbol:">=",hasValue:!0,group:"comparison"},lt:{label:"Less than",symbol:"<",hasValue:!0,group:"comparison"},lte:{label:"Less or equal",symbol:"<=",hasValue:!0,group:"comparison"},like:{label:"Like",symbol:"~~",hasValue:!0,group:"pattern"},ilike:{label:"iLike",symbol:"~~*",hasValue:!0,group:"pattern"},is_null:{label:"Is null",symbol:"IS NULL",hasValue:!1,group:"null"},is_not_null:{label:"Is not null",symbol:"IS NOT NULL",hasValue:!1,group:"null"}};function e(a){return!!a.column&&(!d[a.operator].hasValue||a.value.length>0)}Object.keys(d).map(a=>({value:a,label:d[a].label,symbol:d[a].symbol,group:d[a].group}))},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},49226:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{I:()=>i});var e=c(82428),f=c(74568),g=c(20967),h=a([e,g]);[e,g]=h.then?(await h)():h;let j=`
36
36
  SELECT c.relkind AS relkind,
37
37
  a.attname AS name,
38
38
  COALESCE(base_type.typname, t.typname) AS data_type,
@@ -48,4 +48,4 @@
48
48
  AND a.attnum > 0
49
49
  AND NOT a.attisdropped
50
50
  ORDER BY a.attnum
51
- `;async function i(a,b){if(!b?.table||"string"!=typeof b.table.schema||"string"!=typeof b.table.name)throw Error("Missing table");if(!b.values||"object"!=typeof b.values||Array.isArray(b.values))throw Error("Missing values");let c=(0,e.d)(a),d=(await c.query(j,[b.table.schema,b.table.name])).rows;if(0===d.length)throw Error(`Table ${b.table.schema}.${b.table.name} not found`);if(!d.every(a=>"r"===a.relkind||"p"===a.relkind))throw Error("Views and foreign tables are read-only");let h=[],i=[];for(let[a,c]of Object.entries(b.values)){let b=d.find(b=>b.name===a);if(!b)throw Error(`Column ${a} not found`);if(b.is_generated)throw Error(`Column ${a} is generated and cannot be set`);if(b.is_identity)throw Error(`Column ${a} is an identity column and cannot be set`);if(null!==c&&"string"!=typeof c&&"number"!=typeof c&&"boolean"!=typeof c)throw Error(`Unsupported value for ${a}`);h.push(c),i.push((0,f.v4)(a))}let k=d.map(a=>(0,g.x)(a.name,a.data_type)).join(", "),l=0===i.length?"DEFAULT VALUES":`(${i.join(", ")}) VALUES (${h.map((a,b)=>`$${b+1}`).join(", ")})`,m=(await c.query({text:`INSERT INTO ${(0,f.Z8)(b.table)} ${l} RETURNING ${k}`,values:h,rowMode:"array"})).rows[0];if(!m)throw Error("The row was not inserted");return{row:m.map(g.dm)}}d()}catch(a){d(a)}})},51455:a=>{a.exports=require("node:fs/promises")},55494:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>h});var e=c(49226),f=c(84152),g=a([e]);e=(g.then?(await g)():g)[0];let h=(0,f.fx)("rows.insert",async a=>{let b=(0,f.VW)(a.connectionUrl,"connectionUrl");if(!a.insertion)throw Error("Missing insertion");return(0,e.I)(b,a.insertion)});d()}catch(a){d(a)}})},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},64939:a=>{a.exports=import("pg")},76760:a=>{a.exports=require("node:path")},77598:a=>{a.exports=require("node:crypto")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,7605],()=>b(b.s=42650));module.exports=c})();
51
+ `;async function i(a,b){if(!b?.table||"string"!=typeof b.table.schema||"string"!=typeof b.table.name)throw Error("Missing table");if(!b.values||"object"!=typeof b.values||Array.isArray(b.values))throw Error("Missing values");let c=(0,e.d)(a),d=(await c.query(j,[b.table.schema,b.table.name])).rows;if(0===d.length)throw Error(`Table ${b.table.schema}.${b.table.name} not found`);if(!d.every(a=>"r"===a.relkind||"p"===a.relkind))throw Error("Views and foreign tables are read-only");let h=[],i=[];for(let[a,c]of Object.entries(b.values)){let b=d.find(b=>b.name===a);if(!b)throw Error(`Column ${a} not found`);if(b.is_generated)throw Error(`Column ${a} is generated and cannot be set`);if(b.is_identity)throw Error(`Column ${a} is an identity column and cannot be set`);if(null!==c&&"string"!=typeof c&&"number"!=typeof c&&"boolean"!=typeof c)throw Error(`Unsupported value for ${a}`);h.push(c),i.push((0,f.v4)(a))}let k=d.map(a=>(0,g.x)(a.name,a.data_type)).join(", "),l=0===i.length?"DEFAULT VALUES":`(${i.join(", ")}) VALUES (${h.map((a,b)=>`$${b+1}`).join(", ")})`,m=(await c.query({text:`INSERT INTO ${(0,f.Z8)(b.table)} ${l} RETURNING ${k}`,values:h,rowMode:"array"})).rows[0];if(!m)throw Error("The row was not inserted");return{row:m.map(g.dm)}}d()}catch(a){d(a)}})},51455:a=>{a.exports=require("node:fs/promises")},55494:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>h});var e=c(49226),f=c(84152),g=a([e]);e=(g.then?(await g)():g)[0];let h=(0,f.fx)("rows.insert",async a=>{let b=(0,f.VW)(a.connectionUrl,"connectionUrl");if(!a.insertion)throw Error("Missing insertion");return(0,e.I)(b,a.insertion)});d()}catch(a){d(a)}})},58360:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/insert-row/route",pathname:"/api/insert-row",filename:"route",bundlePath:"app/api/insert-row/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Users/theobourgeois/code/db-studio/src/app/api/insert-row/route.ts",nextConfigOutput:"",userland:()=>c(55494),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/insert-row/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},64939:a=>{a.exports=import("pg")},76760:a=>{a.exports=require("node:path")},77598:a=>{a.exports=require("node:crypto")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,7605],()=>b(b.s=58360));module.exports=c})();
@@ -1 +1 @@
1
- "use strict";(()=>{var a={};a.id=7981,a.ids=[7981],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},4155:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>i});var e=c(65125),f=c(21010),g=c(84152),h=a([e]);e=(h.then?(await h)():h)[0];let i=(0,g.fx)("ledger",async a=>{let b=(0,g.VW)(a.connectionUrl,"connectionUrl"),c=(0,f.ZH)(a.ledgerSchema);return!0===a.init?(0,e.yn)(b,c):(0,e.SC)(b,c,!0===a.withSql)});d()}catch(a){d(a)}})},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},51455:a=>{a.exports=require("node:fs/promises")},56184:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/ledger/route",pathname:"/api/ledger",filename:"route",bundlePath:"app/api/ledger/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Users/theobourgeois/code/db-studio/src/app/api/ledger/route.ts",nextConfigOutput:"",userland:()=>c(4155),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/ledger/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},64939:a=>{a.exports=import("pg")},76760:a=>{a.exports=require("node:path")},77598:a=>{a.exports=require("node:crypto")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,6433,5125],()=>b(b.s=56184));module.exports=c})();
1
+ "use strict";(()=>{var a={};a.id=7981,a.ids=[7981],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},4155:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>i});var e=c(65125),f=c(21010),g=c(84152),h=a([e]);e=(h.then?(await h)():h)[0];let i=(0,g.fx)("ledger",async a=>{let b=(0,g.VW)(a.connectionUrl,"connectionUrl"),c=(0,f.ZH)(a.ledgerSchema);return!0===a.init?(0,e.yn)(b,c):(0,e.SC)(b,c,!0===a.withSql)});d()}catch(a){d(a)}})},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},38898:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/ledger/route",pathname:"/api/ledger",filename:"route",bundlePath:"app/api/ledger/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Users/theobourgeois/code/db-studio/src/app/api/ledger/route.ts",nextConfigOutput:"",userland:()=>c(4155),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/ledger/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},51455:a=>{a.exports=require("node:fs/promises")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},64939:a=>{a.exports=import("pg")},76760:a=>{a.exports=require("node:path")},77598:a=>{a.exports=require("node:crypto")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,6433,5125],()=>b(b.s=38898));module.exports=c})();
@@ -32,7 +32,7 @@
32
32
  WHERE NOT EXISTS (SELECT 1 FROM pg_inherits i WHERE i.inhparent = tree.oid)
33
33
  ), 0)::bigint AS bytes
34
34
  FROM tree
35
- `,r=new Set(["date","interval","json","jsonb","time","timestamp","timestamptz","timetz"]);function j(a){return null==a?null:"string"==typeof a||"number"==typeof a||"boolean"==typeof a?a:a instanceof Date?a.toISOString():Buffer.isBuffer(a)?`\\x${a.toString("hex")}`:JSON.stringify(a)}function k(a,b){let c=(0,f.v4)(a);return r.has(b)?`${c}::text`:c}async function l(a,b){let c=(0,e.d)(a),d=await c.query(p,[b.table.schema,b.table.name]),i=d.rows.map(a=>a.name);if(0===i.length)throw Error(`Table ${b.table.schema}.${b.table.name} not found`);let l=new Set(i),n=b.filters.filter(a=>(0,g.eK)(a)&&l.has(a.column)),o=(0,f.MC)(n),q=b.search?.trim()??"",r=!1;if(q){let a=d.rows.filter(a=>(0,f.p_)(a.data_type,a.type_category));if(a.length>0){o.params.push(`%${(0,f.q3)(q)}%`);let b=a.map(a=>`${(0,f.v4)(a.name)}::text ILIKE $${o.params.length} ESCAPE '\\'`).join(" OR ");o.sql=o.sql?`${o.sql} AND (${b})`:`WHERE ${b}`,r=!0}}let s=d.rows.filter(a=>a.is_pk).map(a=>a.name),t=b.sort&&l.has(b.sort.column)?b.sort:null,u=t?[`${(0,f.v4)(t.column)} ${"desc"===t.direction?"DESC":"ASC"}`,...s.filter(a=>a!==t.column).map(a=>`${(0,f.v4)(a)} ASC`)]:s.map(a=>`${(0,f.v4)(a)} ASC`),v=u.length?`ORDER BY ${u.join(", ")}`:"",w=(0,f.Z8)(b.table),x=d.rows.map(a=>k(a.name,a.data_type)),y=Math.max(1,Math.min(b.pageSize,500)),z=Math.floor(h.d6/y),A=Math.min(Math.max(0,b.page),z),B=A*y,C=A>=z,[D,E]=await Promise.all([c.query({text:`SELECT ${x.join(", ")} FROM ${w} ${o.sql} ${v} LIMIT ${y+1} OFFSET ${B}`,values:o.params,rowMode:"array"}),m(c,b.table,w,o,r)]),F=D.rows,G=F.length>y,H=G?F.slice(0,y):F;return{columns:i,rows:H.map(a=>a.map(j)),total:E.total,estimated:E.estimated,hasMore:G&&!C,capped:G&&C}}async function m(a,b,c,d,e){var f;if((f=await n(a,b))&&("r"===f.relkind||"p"===f.relkind||"m"===f.relkind)&&f.bytes<=h.Be){let b=await a.query(`SELECT count(*)::bigint AS count FROM ${c} ${d.sql}`,d.params);return{total:Number(b.rows[0]?.count??0),estimated:!1}}if(e)return{total:null,estimated:!0};try{return{total:await o(a,c,d),estimated:!0}}catch{return{total:null,estimated:!0}}}async function n(a,b){let c=(await a.query(q,[b.schema,b.name])).rows[0];return c?.relkind?{relkind:c.relkind,bytes:Number(c.bytes)}:null}async function o(a,b,c){let d=await a.query(`EXPLAIN (FORMAT JSON) SELECT 1 FROM ${b} ${c.sql}`,c.params);return function(a){let b="string"==typeof a?JSON.parse(a):a,c=Array.isArray(b)?b[0]:b;if(!c||"object"!=typeof c)return 0;let d="Plan"in c?c.Plan:null;if(!d||"object"!=typeof d||!("Plan Rows"in d))return 0;let e=Number(d["Plan Rows"]);return Number.isFinite(e)?Math.max(0,Math.round(e)):0}(d.rows[0]?.["QUERY PLAN"])}d()}catch(a){d(a)}})},21446:(a,b,c)=>{c.d(b,{eK:()=>e});let d={eq:{label:"Equals",symbol:"=",hasValue:!0,group:"comparison"},neq:{label:"Not equal",symbol:"<>",hasValue:!0,group:"comparison"},gt:{label:"Greater than",symbol:">",hasValue:!0,group:"comparison"},gte:{label:"Greater or equal",symbol:">=",hasValue:!0,group:"comparison"},lt:{label:"Less than",symbol:"<",hasValue:!0,group:"comparison"},lte:{label:"Less or equal",symbol:"<=",hasValue:!0,group:"comparison"},like:{label:"Like",symbol:"~~",hasValue:!0,group:"pattern"},ilike:{label:"iLike",symbol:"~~*",hasValue:!0,group:"pattern"},is_null:{label:"Is null",symbol:"IS NULL",hasValue:!1,group:"null"},is_not_null:{label:"Is not null",symbol:"IS NOT NULL",hasValue:!1,group:"null"}};function e(a){return!!a.column&&(!d[a.operator].hasValue||a.value.length>0)}Object.keys(d).map(a=>({value:a,label:d[a].label,symbol:d[a].symbol,group:d[a].group}))},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},36570:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/lookup/route",pathname:"/api/lookup",filename:"route",bundlePath:"app/api/lookup/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Users/theobourgeois/code/db-studio/src/app/api/lookup/route.ts",nextConfigOutput:"",userland:()=>c(3052),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/lookup/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},51455:a=>{a.exports=require("node:fs/promises")},61191:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{o:()=>l,t:()=>n});var e=c(82428),f=c(74568),g=c(20967),h=a([e,g]);[e,g]=h.then?(await h)():h;let o=`
35
+ `,r=new Set(["date","interval","json","jsonb","time","timestamp","timestamptz","timetz"]);function j(a){return null==a?null:"string"==typeof a||"number"==typeof a||"boolean"==typeof a?a:a instanceof Date?a.toISOString():Buffer.isBuffer(a)?`\\x${a.toString("hex")}`:JSON.stringify(a)}function k(a,b){let c=(0,f.v4)(a);return r.has(b)?`${c}::text`:c}async function l(a,b){let c=(0,e.d)(a),d=await c.query(p,[b.table.schema,b.table.name]),i=d.rows.map(a=>a.name);if(0===i.length)throw Error(`Table ${b.table.schema}.${b.table.name} not found`);let l=new Set(i),n=b.filters.filter(a=>(0,g.eK)(a)&&l.has(a.column)),o=(0,f.MC)(n),q=b.search?.trim()??"",r=!1;if(q){let a=d.rows.filter(a=>(0,f.p_)(a.data_type,a.type_category));if(a.length>0){o.params.push(`%${(0,f.q3)(q)}%`);let b=a.map(a=>`${(0,f.v4)(a.name)}::text ILIKE $${o.params.length} ESCAPE '\\'`).join(" OR ");o.sql=o.sql?`${o.sql} AND (${b})`:`WHERE ${b}`,r=!0}}let s=d.rows.filter(a=>a.is_pk).map(a=>a.name),t=b.sort&&l.has(b.sort.column)?b.sort:null,u=t?[`${(0,f.v4)(t.column)} ${"desc"===t.direction?"DESC":"ASC"}`,...s.filter(a=>a!==t.column).map(a=>`${(0,f.v4)(a)} ASC`)]:[],v=u.length?`ORDER BY ${u.join(", ")}`:"",w=(0,f.Z8)(b.table),x=d.rows.map(a=>k(a.name,a.data_type)),y=Math.max(1,Math.min(b.pageSize,500)),z=Math.floor(h.d6/y),A=Math.min(Math.max(0,b.page),z),B=A*y,C=A>=z,[D,E]=await Promise.all([c.query({text:`SELECT ${x.join(", ")} FROM ${w} ${o.sql} ${v} LIMIT ${y+1} OFFSET ${B}`,values:o.params,rowMode:"array"}),m(c,b.table,w,o,r)]),F=D.rows,G=F.length>y,H=G?F.slice(0,y):F;return{columns:i,rows:H.map(a=>a.map(j)),total:E.total,estimated:E.estimated,hasMore:G&&!C,capped:G&&C}}async function m(a,b,c,d,e){var f;if((f=await n(a,b))&&("r"===f.relkind||"p"===f.relkind||"m"===f.relkind)&&f.bytes<=h.Be){let b=await a.query(`SELECT count(*)::bigint AS count FROM ${c} ${d.sql}`,d.params);return{total:Number(b.rows[0]?.count??0),estimated:!1}}if(e)return{total:null,estimated:!0};try{return{total:await o(a,c,d),estimated:!0}}catch{return{total:null,estimated:!0}}}async function n(a,b){let c=(await a.query(q,[b.schema,b.name])).rows[0];return c?.relkind?{relkind:c.relkind,bytes:Number(c.bytes)}:null}async function o(a,b,c){let d=await a.query(`EXPLAIN (FORMAT JSON) SELECT 1 FROM ${b} ${c.sql}`,c.params);return function(a){let b="string"==typeof a?JSON.parse(a):a,c=Array.isArray(b)?b[0]:b;if(!c||"object"!=typeof c)return 0;let d="Plan"in c?c.Plan:null;if(!d||"object"!=typeof d||!("Plan Rows"in d))return 0;let e=Number(d["Plan Rows"]);return Number.isFinite(e)?Math.max(0,Math.round(e)):0}(d.rows[0]?.["QUERY PLAN"])}d()}catch(a){d(a)}})},21446:(a,b,c)=>{c.d(b,{eK:()=>e});let d={eq:{label:"Equals",symbol:"=",hasValue:!0,group:"comparison"},neq:{label:"Not equal",symbol:"<>",hasValue:!0,group:"comparison"},gt:{label:"Greater than",symbol:">",hasValue:!0,group:"comparison"},gte:{label:"Greater or equal",symbol:">=",hasValue:!0,group:"comparison"},lt:{label:"Less than",symbol:"<",hasValue:!0,group:"comparison"},lte:{label:"Less or equal",symbol:"<=",hasValue:!0,group:"comparison"},like:{label:"Like",symbol:"~~",hasValue:!0,group:"pattern"},ilike:{label:"iLike",symbol:"~~*",hasValue:!0,group:"pattern"},is_null:{label:"Is null",symbol:"IS NULL",hasValue:!1,group:"null"},is_not_null:{label:"Is not null",symbol:"IS NOT NULL",hasValue:!1,group:"null"}};function e(a){return!!a.column&&(!d[a.operator].hasValue||a.value.length>0)}Object.keys(d).map(a=>({value:a,label:d[a].label,symbol:d[a].symbol,group:d[a].group}))},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},51455:a=>{a.exports=require("node:fs/promises")},61191:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{o:()=>l,t:()=>n});var e=c(82428),f=c(74568),g=c(20967),h=a([e,g]);[e,g]=h.then?(await h)():h;let o=`
36
36
  SELECT a.attname AS name,
37
37
  COALESCE(base_type.typname, t.typname) AS data_type,
38
38
  COALESCE(base_type.typcategory, t.typcategory) AS type_category,
@@ -51,4 +51,4 @@
51
51
  ORDER BY a.attnum
52
52
  `;function i(a){return null===a?"":String(a)}async function j(a,b){let c=(0,e.d)(a),d=await c.query(o,[b.schema,b.name]);if(0===d.rows.length)throw Error(`Table ${b.schema}.${b.name} not found`);return d.rows}function k(a){return a.map(a=>(0,g.x)(a.name,a.data_type)).join(", ")}async function l(a,b){return Promise.all(b.map(b=>m(a,b)))}async function m(a,b){let c=await j(a,b.table),d=new Map(c.map(a=>[a.name,a])),h=b.keyColumns.filter(a=>d.has(a));if(0===h.length||h.length!==b.keyColumns.length)throw Error("Unknown related key column");let l=new Set,m=[];for(let a of b.keys){if(!Array.isArray(a)||a.length!==h.length||a.some(a=>null!==a&&"string"!=typeof a&&"number"!=typeof a&&"boolean"!=typeof a||null===a))continue;let b=a.map(i),c=JSON.stringify(b);if(!l.has(c)&&(l.add(c),m.push(b),m.length>=500))break}if(0===m.length)return{table:b.table,columns:c.map(a=>a.name),rows:[]};let n=[],o=m.map(a=>{let b=a.map(a=>(n.push(a),`$${n.length}`));return 1===h.length?b[0]:`(${b.join(", ")})`}),p=1===h.length?`${(0,f.v4)(h[0])}::text`:`(${h.map(a=>`${(0,f.v4)(a)}::text`).join(", ")})`,q=(0,e.d)(a),r=await q.query({text:`SELECT ${k(c)} FROM ${(0,f.Z8)(b.table)}
53
53
  WHERE ${p} IN (${o.join(", ")})`,values:n,rowMode:"array"}),s=c.map(a=>a.name),t=h.map(a=>s.indexOf(a));return{table:b.table,columns:s,rows:r.rows.map(a=>{let b=a.map(g.dm);return{key:t.map(a=>b[a]??null),row:b}})}}async function n(a,b){let c=await j(a,b.table),d=Math.max(1,Math.min(b.limit??30,50)),h=c.filter(a=>a.is_pk).map(a=>a.name),i=h.length?`ORDER BY ${h.map(a=>`${(0,f.v4)(a)} ASC`).join(", ")}`:"",l=b.search.trim(),m=[],n="";if(l){let a=c.filter(a=>(0,f.p_)(a.data_type,a.type_category));if(0===a.length)return{columns:c.map(a=>a.name),rows:[],total:0,estimated:!1,hasMore:!1};m.push(`%${(0,f.q3)(l)}%`),n=`WHERE ${a.map(a=>`${(0,f.v4)(a.name)}::text ILIKE $1 ESCAPE '\\'`).join(" OR ")}`}let o=(0,e.d)(a),p=await o.query({text:`SELECT ${k(c)} FROM ${(0,f.Z8)(b.table)}
54
- ${n} ${i} LIMIT ${d}`,values:m,rowMode:"array"});return{columns:c.map(a=>a.name),rows:p.rows.map(a=>a.map(g.dm)),total:p.rowCount??p.rows.length,estimated:!1,hasMore:(p.rowCount??p.rows.length)>=d}}d()}catch(a){d(a)}})},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},64939:a=>{a.exports=import("pg")},76760:a=>{a.exports=require("node:path")},77598:a=>{a.exports=require("node:crypto")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,7605],()=>b(b.s=36570));module.exports=c})();
54
+ ${n} ${i} LIMIT ${d}`,values:m,rowMode:"array"});return{columns:c.map(a=>a.name),rows:p.rows.map(a=>a.map(g.dm)),total:p.rowCount??p.rows.length,estimated:!1,hasMore:(p.rowCount??p.rows.length)>=d}}d()}catch(a){d(a)}})},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},64939:a=>{a.exports=import("pg")},76760:a=>{a.exports=require("node:path")},77598:a=>{a.exports=require("node:crypto")},80984:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/lookup/route",pathname:"/api/lookup",filename:"route",bundlePath:"app/api/lookup/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Users/theobourgeois/code/db-studio/src/app/api/lookup/route.ts",nextConfigOutput:"",userland:()=>c(3052),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/lookup/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,7605],()=>b(b.s=80984));module.exports=c})();