@omer-x/buttler 2.0.0-alpha.6 → 2.0.0-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/drizzle/20261126045852_service_internet_access/migration.sql +1 -0
- package/drizzle/20261126045852_service_internet_access/snapshot.json +581 -0
- package/package.json +1 -1
- package/ui/.next/BUILD_ID +1 -1
- package/ui/.next/build-manifest.json +3 -3
- package/ui/.next/prerender-manifest.json +3 -3
- package/ui/.next/server/app/[locale]/(auth)/install/page/server-reference-manifest.json +16 -16
- package/ui/.next/server/app/[locale]/(auth)/install/page.js +14 -13
- package/ui/.next/server/app/[locale]/(auth)/install/page.js.nft.json +1 -1
- package/ui/.next/server/app/[locale]/(auth)/install/page_client-reference-manifest.js +1 -1
- package/ui/.next/server/app/[locale]/(auth)/login/page.js.nft.json +1 -1
- package/ui/.next/server/app/[locale]/(auth)/login/page_client-reference-manifest.js +1 -1
- package/ui/.next/server/app/[locale]/(base)/page/server-reference-manifest.json +1 -1
- package/ui/.next/server/app/[locale]/(base)/page.js.nft.json +1 -1
- package/ui/.next/server/app/[locale]/(base)/page_client-reference-manifest.js +1 -1
- package/ui/.next/server/app/[locale]/(base)/services/[id]/builds/page/server-reference-manifest.json +37 -27
- package/ui/.next/server/app/[locale]/(base)/services/[id]/builds/page.js +13 -12
- package/ui/.next/server/app/[locale]/(base)/services/[id]/builds/page.js.nft.json +1 -1
- package/ui/.next/server/app/[locale]/(base)/services/[id]/builds/page_client-reference-manifest.js +1 -1
- package/ui/.next/server/app/[locale]/(base)/services/[id]/logs/page/server-reference-manifest.json +37 -27
- package/ui/.next/server/app/[locale]/(base)/services/[id]/logs/page.js +13 -12
- package/ui/.next/server/app/[locale]/(base)/services/[id]/logs/page.js.nft.json +1 -1
- package/ui/.next/server/app/[locale]/(base)/services/[id]/logs/page_client-reference-manifest.js +1 -1
- package/ui/.next/server/app/[locale]/(base)/services/[id]/page/server-reference-manifest.json +37 -27
- package/ui/.next/server/app/[locale]/(base)/services/[id]/page.js +13 -12
- package/ui/.next/server/app/[locale]/(base)/services/[id]/page.js.nft.json +1 -1
- package/ui/.next/server/app/[locale]/(base)/services/[id]/page_client-reference-manifest.js +1 -1
- package/ui/.next/server/app/[locale]/(base)/services/[id]/settings/page/server-reference-manifest.json +44 -34
- package/ui/.next/server/app/[locale]/(base)/services/[id]/settings/page.js +14 -13
- package/ui/.next/server/app/[locale]/(base)/services/[id]/settings/page.js.nft.json +1 -1
- package/ui/.next/server/app/[locale]/(base)/services/[id]/settings/page_client-reference-manifest.js +1 -1
- package/ui/.next/server/app/[locale]/(base)/services/new/page/server-reference-manifest.json +35 -25
- package/ui/.next/server/app/[locale]/(base)/services/new/page.js +10 -9
- package/ui/.next/server/app/[locale]/(base)/services/new/page.js.nft.json +1 -1
- package/ui/.next/server/app/[locale]/(base)/services/new/page_client-reference-manifest.js +1 -1
- package/ui/.next/server/app/[locale]/(base)/services/page/server-reference-manifest.json +3 -3
- package/ui/.next/server/app/[locale]/(base)/services/page.js +6 -5
- package/ui/.next/server/app/[locale]/(base)/services/page.js.nft.json +1 -1
- package/ui/.next/server/app/[locale]/(base)/services/page_client-reference-manifest.js +1 -1
- package/ui/.next/server/app/[locale]/(base)/settings/page/server-reference-manifest.json +19 -19
- package/ui/.next/server/app/[locale]/(base)/settings/page.js +10 -9
- package/ui/.next/server/app/[locale]/(base)/settings/page.js.nft.json +1 -1
- package/ui/.next/server/app/[locale]/(base)/settings/page_client-reference-manifest.js +1 -1
- package/ui/.next/server/app/[locale]/install.meta +2 -2
- package/ui/.next/server/app/[locale]/install.segments/$d$locale/!KGF1dGgp/install/__PAGE__.segment.rsc +4 -4
- package/ui/.next/server/app/[locale]/install.segments/_full.segment.rsc +4 -4
- package/ui/.next/server/app/[locale]/install.segments/_tree.segment.rsc +2 -2
- package/ui/.next/server/app/[locale]/login.meta +2 -2
- package/ui/.next/server/app/[locale]/login.segments/$d$locale/!KGF1dGgp/login/__PAGE__.segment.rsc +3 -3
- package/ui/.next/server/app/[locale]/login.segments/_full.segment.rsc +4 -4
- package/ui/.next/server/app/[locale]/login.segments/_tree.segment.rsc +2 -2
- package/ui/.next/server/app/[locale]/services/[id]/builds.meta +2 -2
- package/ui/.next/server/app/[locale]/services/[id]/builds.segments/$d$locale/!KGJhc2Up/services/$d$id/builds/__PAGE__.segment.rsc +5 -5
- package/ui/.next/server/app/[locale]/services/[id]/builds.segments/_full.segment.rsc +5 -5
- package/ui/.next/server/app/[locale]/services/[id]/builds.segments/_tree.segment.rsc +2 -2
- package/ui/.next/server/app/[locale]/services/[id]/logs.meta +2 -2
- package/ui/.next/server/app/[locale]/services/[id]/logs.segments/$d$locale/!KGJhc2Up/services/$d$id/logs/__PAGE__.segment.rsc +5 -5
- package/ui/.next/server/app/[locale]/services/[id]/logs.segments/_full.segment.rsc +6 -6
- package/ui/.next/server/app/[locale]/services/[id]/logs.segments/_tree.segment.rsc +2 -2
- package/ui/.next/server/app/[locale]/services/[id]/settings.meta +2 -2
- package/ui/.next/server/app/[locale]/services/[id]/settings.segments/$d$locale/!KGJhc2Up/services/$d$id/settings/__PAGE__.segment.rsc +6 -6
- package/ui/.next/server/app/[locale]/services/[id]/settings.segments/_full.segment.rsc +7 -7
- package/ui/.next/server/app/[locale]/services/[id]/settings.segments/_tree.segment.rsc +2 -2
- package/ui/.next/server/app/[locale]/services/[id].meta +2 -2
- package/ui/.next/server/app/[locale]/services/[id].segments/$d$locale/!KGJhc2Up/services/$d$id/__PAGE__.segment.rsc +5 -5
- package/ui/.next/server/app/[locale]/services/[id].segments/_full.segment.rsc +6 -6
- package/ui/.next/server/app/[locale]/services/[id].segments/_tree.segment.rsc +2 -2
- package/ui/.next/server/app/[locale]/services/new.meta +2 -2
- package/ui/.next/server/app/[locale]/services/new.segments/$d$locale/!KGJhc2Up/services/new/__PAGE__.segment.rsc +5 -5
- package/ui/.next/server/app/[locale]/services/new.segments/_full.segment.rsc +5 -5
- package/ui/.next/server/app/[locale]/services/new.segments/_tree.segment.rsc +2 -2
- package/ui/.next/server/app/[locale]/services.meta +2 -2
- package/ui/.next/server/app/[locale]/services.segments/$d$locale/!KGJhc2Up/services/__PAGE__.segment.rsc +5 -5
- package/ui/.next/server/app/[locale]/services.segments/_full.segment.rsc +5 -5
- package/ui/.next/server/app/[locale]/services.segments/_tree.segment.rsc +2 -2
- package/ui/.next/server/app/[locale]/settings.meta +2 -2
- package/ui/.next/server/app/[locale]/settings.segments/$d$locale/!KGJhc2Up/settings/__PAGE__.segment.rsc +4 -4
- package/ui/.next/server/app/[locale]/settings.segments/_full.segment.rsc +5 -5
- package/ui/.next/server/app/[locale]/settings.segments/_tree.segment.rsc +2 -2
- package/ui/.next/server/app/[locale].meta +2 -2
- package/ui/.next/server/app/[locale].segments/$d$locale/!KGJhc2Up/__PAGE__.segment.rsc +4 -4
- package/ui/.next/server/app/[locale].segments/_full.segment.rsc +5 -5
- package/ui/.next/server/app/[locale].segments/_tree.segment.rsc +2 -2
- package/ui/.next/server/app/_global-error.html +1 -1
- package/ui/.next/server/app/_global-error.rsc +1 -1
- package/ui/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/ui/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/ui/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/ui/.next/server/app/_not-found.html +1 -1
- package/ui/.next/server/app/_not-found.rsc +1 -1
- package/ui/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/ui/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/ui/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/ui/.next/server/app/api/services/[id]/logs/stream/route/server-reference-manifest.json +2 -2
- package/ui/.next/server/app/api/services/[id]/logs/stream/route.js +7 -7
- package/ui/.next/server/app/api/services/[id]/logs/stream/route.js.nft.json +1 -1
- package/ui/.next/server/app/api/sources/dockerhub/tags/route.js.nft.json +1 -1
- package/ui/.next/server/app/api/sources/github/branches/route.js.nft.json +1 -1
- package/ui/.next/server/app/api/sources/github/repos/route.js.nft.json +1 -1
- package/ui/.next/server/app/auth/cloudflare/route.js +9 -8
- package/ui/.next/server/app/auth/cloudflare/route.js.nft.json +1 -1
- package/ui/.next/server/app/auth/github/route.js.nft.json +1 -1
- package/ui/.next/server/app/auth/github-install/route.js.nft.json +1 -1
- package/ui/.next/server/app/auth/instance/route.js.nft.json +1 -1
- package/ui/.next/server/app/auth/setup/route.js.nft.json +1 -1
- package/ui/.next/server/app/en/install.html +1 -1
- package/ui/.next/server/app/en/install.meta +1 -1
- package/ui/.next/server/app/en/install.segments/$d$locale/!KGF1dGgp/install/__PAGE__.segment.rsc +2 -2
- package/ui/.next/server/app/en/install.segments/$d$locale.segment.rsc +3 -3
- package/ui/.next/server/app/en/install.segments/_full.segment.rsc +5 -5
- package/ui/.next/server/app/en/install.segments/_tree.segment.rsc +2 -2
- package/ui/.next/server/app/en/login.html +1 -1
- package/ui/.next/server/app/en/login.meta +1 -1
- package/ui/.next/server/app/en/login.segments/$d$locale/!KGF1dGgp/login/__PAGE__.segment.rsc +1 -1
- package/ui/.next/server/app/en/login.segments/$d$locale.segment.rsc +3 -3
- package/ui/.next/server/app/en/login.segments/_full.segment.rsc +4 -4
- package/ui/.next/server/app/en/login.segments/_tree.segment.rsc +2 -2
- package/ui/.next/server/app/en/services/[id]/builds.html +1 -1
- package/ui/.next/server/app/en/services/[id]/builds.meta +1 -1
- package/ui/.next/server/app/en/services/[id]/builds.segments/$d$locale/!KGJhc2Up/services/$d$id/builds/__PAGE__.segment.rsc +4 -4
- package/ui/.next/server/app/en/services/[id]/builds.segments/$d$locale/!KGJhc2Up.segment.rsc +4 -4
- package/ui/.next/server/app/en/services/[id]/builds.segments/$d$locale.segment.rsc +4 -4
- package/ui/.next/server/app/en/services/[id]/builds.segments/_full.segment.rsc +9 -9
- package/ui/.next/server/app/en/services/[id]/builds.segments/_tree.segment.rsc +2 -2
- package/ui/.next/server/app/en/services/[id]/logs.html +1 -1
- package/ui/.next/server/app/en/services/[id]/logs.meta +1 -1
- package/ui/.next/server/app/en/services/[id]/logs.segments/$d$locale/!KGJhc2Up/services/$d$id/logs/__PAGE__.segment.rsc +4 -4
- package/ui/.next/server/app/en/services/[id]/logs.segments/$d$locale/!KGJhc2Up.segment.rsc +4 -4
- package/ui/.next/server/app/en/services/[id]/logs.segments/$d$locale.segment.rsc +4 -4
- package/ui/.next/server/app/en/services/[id]/logs.segments/_full.segment.rsc +9 -9
- package/ui/.next/server/app/en/services/[id]/logs.segments/_tree.segment.rsc +2 -2
- package/ui/.next/server/app/en/services/[id]/settings.html +1 -1
- package/ui/.next/server/app/en/services/[id]/settings.meta +1 -1
- package/ui/.next/server/app/en/services/[id]/settings.segments/$d$locale/!KGJhc2Up/services/$d$id/settings/__PAGE__.segment.rsc +6 -6
- package/ui/.next/server/app/en/services/[id]/settings.segments/$d$locale/!KGJhc2Up.segment.rsc +5 -5
- package/ui/.next/server/app/en/services/[id]/settings.segments/$d$locale.segment.rsc +4 -4
- package/ui/.next/server/app/en/services/[id]/settings.segments/_full.segment.rsc +11 -11
- package/ui/.next/server/app/en/services/[id]/settings.segments/_tree.segment.rsc +2 -2
- package/ui/.next/server/app/en/services/[id].html +1 -1
- package/ui/.next/server/app/en/services/[id].meta +1 -1
- package/ui/.next/server/app/en/services/[id].segments/$d$locale/!KGJhc2Up/services/$d$id/__PAGE__.segment.rsc +4 -4
- package/ui/.next/server/app/en/services/[id].segments/$d$locale/!KGJhc2Up.segment.rsc +4 -4
- package/ui/.next/server/app/en/services/[id].segments/$d$locale.segment.rsc +4 -4
- package/ui/.next/server/app/en/services/[id].segments/_full.segment.rsc +9 -9
- package/ui/.next/server/app/en/services/[id].segments/_tree.segment.rsc +2 -2
- package/ui/.next/server/app/en/services/new.html +1 -1
- package/ui/.next/server/app/en/services/new.meta +1 -1
- package/ui/.next/server/app/en/services/new.segments/$d$locale/!KGJhc2Up/services/new/__PAGE__.segment.rsc +4 -4
- package/ui/.next/server/app/en/services/new.segments/$d$locale/!KGJhc2Up.segment.rsc +4 -4
- package/ui/.next/server/app/en/services/new.segments/$d$locale.segment.rsc +3 -3
- package/ui/.next/server/app/en/services/new.segments/_full.segment.rsc +8 -8
- package/ui/.next/server/app/en/services/new.segments/_tree.segment.rsc +2 -2
- package/ui/.next/server/app/en/services.html +1 -1
- package/ui/.next/server/app/en/services.meta +1 -1
- package/ui/.next/server/app/en/services.segments/$d$locale/!KGJhc2Up/services/__PAGE__.segment.rsc +2 -2
- package/ui/.next/server/app/en/services.segments/$d$locale/!KGJhc2Up.segment.rsc +3 -3
- package/ui/.next/server/app/en/services.segments/$d$locale.segment.rsc +3 -3
- package/ui/.next/server/app/en/services.segments/_full.segment.rsc +6 -6
- package/ui/.next/server/app/en/services.segments/_tree.segment.rsc +2 -2
- package/ui/.next/server/app/en/settings.html +1 -1
- package/ui/.next/server/app/en/settings.meta +1 -1
- package/ui/.next/server/app/en/settings.segments/$d$locale/!KGJhc2Up/settings/__PAGE__.segment.rsc +1 -1
- package/ui/.next/server/app/en/settings.segments/$d$locale/!KGJhc2Up.segment.rsc +3 -3
- package/ui/.next/server/app/en/settings.segments/$d$locale.segment.rsc +3 -3
- package/ui/.next/server/app/en/settings.segments/_full.segment.rsc +6 -6
- package/ui/.next/server/app/en/settings.segments/_tree.segment.rsc +2 -2
- package/ui/.next/server/app/en.html +1 -1
- package/ui/.next/server/app/en.meta +1 -1
- package/ui/.next/server/app/en.segments/$d$locale/!KGJhc2Up/__PAGE__.segment.rsc +1 -1
- package/ui/.next/server/app/en.segments/$d$locale/!KGJhc2Up.segment.rsc +3 -3
- package/ui/.next/server/app/en.segments/$d$locale.segment.rsc +3 -3
- package/ui/.next/server/app/en.segments/_full.segment.rsc +6 -6
- package/ui/.next/server/app/en.segments/_tree.segment.rsc +2 -2
- package/ui/.next/server/app/webhooks/github/route.js +9 -9
- package/ui/.next/server/app/webhooks/github/route.js.nft.json +1 -1
- package/ui/.next/server/chunks/{[root-of-the-server]__1l3jktn1mq9y0._.js → [root-of-the-server]__09oxzse08w2-j._.js} +2 -2
- package/ui/.next/server/chunks/{[root-of-the-server]__1j-z2o01lu5_i._.js → [root-of-the-server]__0g-um21rvbo23._.js} +1 -1
- package/ui/.next/server/chunks/{[root-of-the-server]__20bmml6indb5r._.js → [root-of-the-server]__0hgon_k2l_1kv._.js} +2 -2
- package/ui/.next/server/chunks/{[root-of-the-server]__0m6flex5odxuj._.js → [root-of-the-server]__0ogxzjesrjh02._.js} +1 -1
- package/ui/.next/server/chunks/[root-of-the-server]__0qe_mikj7agcq._.js +3 -0
- package/ui/.next/server/chunks/[root-of-the-server]__1ft_94atr8caf._.js +3 -0
- package/ui/.next/server/chunks/[root-of-the-server]__1w3vh-httwncf._.js +1 -1
- package/ui/.next/server/chunks/_0-08w0j6upuro._.js +1 -1
- package/ui/.next/server/chunks/_0nlsx2mvtyhai._.js +3 -0
- package/ui/.next/server/chunks/_1ddptkvp76c-m._.js +1 -1
- package/ui/.next/server/chunks/_1ux2nt1zdyn0-._.js +1 -1
- package/ui/.next/server/chunks/_1xyz4i2jb2-s2._.js +3 -0
- package/ui/.next/server/chunks/_205giqmll3u97._.js +1 -1
- package/ui/.next/server/chunks/src_1gxoul9hz0c2d._.js +1 -1
- package/ui/.next/server/chunks/src_1wc3qafci1k3-._.js +3 -0
- package/ui/.next/server/chunks/src_core_docker_ingress_ts_0k5y-exk0jujc._.js +1 -1
- package/ui/.next/server/chunks/src_core_docker_tunnel_ts_0a1cq4o2gv4cz._.js +1 -1
- package/ui/.next/server/chunks/src_core_nginx_ts_1bg68o99-jq87._.js +4 -4
- package/ui/.next/server/chunks/src_database_index_ts_1vzqbmlp-k92u._.js +4 -4
- package/ui/.next/server/chunks/ssr/[root-of-the-server]__0ktv4mwammozc._.js +1 -1
- package/ui/.next/server/chunks/ssr/[root-of-the-server]__0ut6xzq29vzgm._.js +3 -0
- package/ui/.next/server/chunks/ssr/[root-of-the-server]__0w741sbi5bld1._.js +4 -0
- package/ui/.next/server/chunks/ssr/[root-of-the-server]__0z8q72dki14gw._.js +3 -0
- package/ui/.next/server/chunks/ssr/{[root-of-the-server]__132clfs6nokf6._.js → [root-of-the-server]__17m7dlhyaf9sl._.js} +1 -1
- package/ui/.next/server/chunks/ssr/[root-of-the-server]__1ahhnj3wnei6e._.js +4 -0
- package/ui/.next/server/chunks/ssr/{[root-of-the-server]__0ai9eb5tkexh4._.js → [root-of-the-server]__1fhe1py6wekjw._.js} +1 -1
- package/ui/.next/server/chunks/ssr/[root-of-the-server]__1uwc7qo6i8tgd._.js +3 -0
- package/ui/.next/server/chunks/ssr/[root-of-the-server]__1w20lhl50jx-7._.js +4 -0
- package/ui/.next/server/chunks/ssr/[root-of-the-server]__20a05rk0-nb4g._.js +3 -0
- package/ui/.next/server/chunks/ssr/_01e3rinj2_l0i._.js +1 -1
- package/ui/.next/server/chunks/ssr/_03mjbc5iu4-0t._.js +1 -1
- package/ui/.next/server/chunks/ssr/_045ukfxgkrnjs._.js +1 -1
- package/ui/.next/server/chunks/ssr/{_20h3ngw2-pijn._.js → _04lfy3e4jplbm._.js} +2 -2
- package/ui/.next/server/chunks/ssr/_08r9mb2mbnczy._.js +3 -3
- package/ui/.next/server/chunks/ssr/_0m-6d7qy7-5rz._.js +3 -0
- package/ui/.next/server/chunks/ssr/{_07p4xpdzi-eb5._.js → _0or_qvojh94dk._.js} +1 -1
- package/ui/.next/server/chunks/ssr/_0q_ty5-s_ojhi._.js +1 -1
- package/ui/.next/server/chunks/ssr/_0sid4-3pb734p._.js +1 -1
- package/ui/.next/server/chunks/ssr/_0ymxsb_ki8zel._.js +3 -3
- package/ui/.next/server/chunks/ssr/_10di_vw2zn99-._.js +4 -0
- package/ui/.next/server/chunks/ssr/_11hffrysj8ccd._.js +1 -1
- package/ui/.next/server/chunks/ssr/_14pr8k-21_dud._.js +1 -1
- package/ui/.next/server/chunks/ssr/_1c9ja4120f5e7._.js +1 -1
- package/ui/.next/server/chunks/ssr/_1cwumh2lem642._.js +2 -2
- package/ui/.next/server/chunks/ssr/_1czfqaem07udj._.js +3 -3
- package/ui/.next/server/chunks/ssr/_1gxrg8g_1z61n._.js +1 -1
- package/ui/.next/server/chunks/ssr/_1jvwyvy2mdunl._.js +1 -1
- package/ui/.next/server/chunks/ssr/_next-internal_server_app_[locale]_(auth)_install_page_actions_0q608mh34etxn.js +1 -1
- package/ui/.next/server/chunks/ssr/dictionaries_en_json_[json]_cjs_1pkm_n6uii6ve._.js +1 -1
- package/ui/.next/server/chunks/ssr/src_05sh4p2uehbos._.js +1 -1
- package/ui/.next/server/chunks/ssr/src_09ctnfzfi7gev._.js +3 -0
- package/ui/.next/server/chunks/ssr/src_10pz-333ne5s9._.js +3 -0
- package/ui/.next/server/chunks/ssr/src_1iyfq6dudriyk._.js +1 -1
- package/ui/.next/server/chunks/ssr/src_1rhxx_vix93j3._.js +3 -0
- package/ui/.next/server/chunks/ssr/src_actions_cloudflare_ts_0fwbybngp80nf._.js +1 -1
- package/ui/.next/server/chunks/ssr/src_actions_service_ts_0leald8wxwln3._.js +1 -1
- package/ui/.next/server/chunks/ssr/src_actions_setup_ts_1j3o9o1z2x8l-._.js +1 -1
- package/ui/.next/server/chunks/ssr/src_actions_user_ts_15o74nrxk2-dn._.js +1 -1
- package/ui/.next/server/chunks/ssr/src_components_0dw7q_n_p1894._.js +1 -1
- package/ui/.next/server/chunks/ssr/{src_components_services_1ckwhi_x497s9._.js → src_components_services_0uvp3xb7qbmur._.js} +2 -2
- package/ui/.next/server/chunks/ssr/src_components_services_InternetAccessChoice_tsx_1kgbpu0tzvndy._.js +3 -0
- package/ui/.next/server/chunks/ssr/{src_core_1muw37nr49lee._.js → src_core_0si925-p9grh3._.js} +1 -1
- package/ui/.next/server/chunks/ssr/src_core_docker_builds_ts_189l3irnv_2va._.js +1 -1
- package/ui/.next/server/chunks/ssr/src_core_docker_ingress_ts_0v7q2dx4d_gfp._.js +1 -1
- package/ui/.next/server/chunks/ssr/src_core_docker_tunnel_ts_1805lsnks1qba._.js +1 -1
- package/ui/.next/server/middleware-build-manifest.js +3 -3
- package/ui/.next/server/pages/404.html +1 -1
- package/ui/.next/server/pages/500.html +1 -1
- package/ui/.next/server/preview-props.json +3 -3
- package/ui/.next/server/server-reference-manifest.js +1 -1
- package/ui/.next/server/server-reference-manifest.json +74 -48
- package/ui/.next/static/chunks/{3pvslh6kify3g.css → 020dlpq6830l8.css} +1 -1
- package/ui/.next/static/chunks/1_ue0_q0j4xt1.js +1 -0
- package/ui/.next/static/chunks/1_zs-121mlws0.js +1 -0
- package/ui/.next/static/chunks/{1t8qsznew0b1b.js → 1hufrz5hz791g.js} +1 -1
- package/ui/.next/static/chunks/{36k4x2md6j_u4.js → 26wyzjexwiq0f.js} +1 -1
- package/ui/.next/static/chunks/{37wkadxks_edv.js → 3litftn1_r-mz.js} +1 -1
- package/ui/drizzle/20261126045852_service_internet_access/migration.sql +1 -0
- package/ui/drizzle/20261126045852_service_internet_access/snapshot.json +581 -0
- package/ui/src/core/build.test.ts +5 -0
- package/ui/src/core/cloudflare/domains.test.ts +1 -1
- package/ui/src/core/docker/ingress.test.ts +6 -6
- package/ui/src/core/docker/ingress.ts +4 -27
- package/ui/src/core/docker/internet.test.ts +88 -0
- package/ui/src/core/docker/internet.ts +59 -0
- package/ui/src/core/docker/networks.ts +41 -0
- package/ui/src/core/docker/status.test.ts +48 -0
- package/ui/src/core/docker/status.ts +14 -2
- package/ui/src/core/docker/tunnel.test.ts +3 -0
- package/ui/src/core/docker/tunnel.ts +2 -1
- package/ui/src/core/docker.ts +0 -26
- package/ui/.next/server/chunks/[root-of-the-server]__0igevkdgl0ipi._.js +0 -3
- package/ui/.next/server/chunks/[root-of-the-server]__12udgfypv-16z._.js +0 -3
- package/ui/.next/server/chunks/_0-5ugvu-oeiw1._.js +0 -3
- package/ui/.next/server/chunks/src_1blp7j39u7nfe._.js +0 -3
- package/ui/.next/server/chunks/src_core_docker_status_ts_0_sv17u6yx63t._.js +0 -3
- package/ui/.next/server/chunks/ssr/[root-of-the-server]__06iet3k3lhjnm._.js +0 -4
- package/ui/.next/server/chunks/ssr/[root-of-the-server]__0qsci72xhefes._.js +0 -4
- package/ui/.next/server/chunks/ssr/[root-of-the-server]__0ugs1_b03dr97._.js +0 -4
- package/ui/.next/server/chunks/ssr/[root-of-the-server]__0xtjyia-9-nzc._.js +0 -4
- package/ui/.next/server/chunks/ssr/[root-of-the-server]__1g6i0yq1cv1j7._.js +0 -3
- package/ui/.next/server/chunks/ssr/[root-of-the-server]__1pb7oi97dnmzg._.js +0 -3
- package/ui/.next/server/chunks/ssr/_1fi0g_feq42jr._.js +0 -4
- package/ui/.next/server/chunks/ssr/_1tcz5rcgonbsu._.js +0 -3
- package/ui/.next/server/chunks/ssr/src_1oiyj5tki7jmf._.js +0 -3
- package/ui/.next/static/chunks/10m4ed4sinix2.js +0 -1
- package/ui/.next/static/chunks/42c4ez0qh-4aq.js +0 -1
- /package/ui/.next/static/{i7F5gbPlYIvqhaTVpaFyi → KTBNYMjTJwi4xNz3oD4bP}/_buildManifest.js +0 -0
- /package/ui/.next/static/{i7F5gbPlYIvqhaTVpaFyi → KTBNYMjTJwi4xNz3oD4bP}/_clientMiddlewareManifest.js +0 -0
- /package/ui/.next/static/{i7F5gbPlYIvqhaTVpaFyi → KTBNYMjTJwi4xNz3oD4bP}/_ssgManifest.js +0 -0
|
@@ -14,6 +14,6 @@ ${i}
|
|
|
14
14
|
const { selection } = this;`),o))a.push(` ${e}`);if(s)if(t){for(let e of(a.push(" const row = rows[0];"),a.push(" if (!row) return undefined;"),l.bodyStmts))a.push(` ${e}`);a.push(` return ${l.literal};`)}else{for(let e of(a.push(" const { length } = rows;"),a.push(" const mapped = new Array(length);"),a.push(" for (let i = 0; i < length; ++i) {"),a.push(" const row = rows[i];"),l.bodyStmts))a.push(` ${e}`);a.push(` mapped[i] = ${l.literal};`),a.push(" }"),a.push(" return mapped;")}else if(l.hasWork)if(t){for(let e of(a.push(" const row = rows[0];"),a.push(" if (!row) return undefined;"),l.bodyStmts))a.push(` ${e}`);a.push(` rows[0] = ${l.literal};`),a.push(" return rows[0];")}else{for(let e of(a.push(" for (let i = 0; i < rows.length; ++i) {"),a.push(" const row = rows[i];"),l.bodyStmts))a.push(` ${e}`);a.push(` rows[i] = ${l.literal};`),a.push(" }"),a.push(" return rows;")}else a.push(t?" return rows[0];":" return rows;");a.push(" //# sourceURL=drizzle:jit-relational-query-mapper");let c=a.join("\n");return Object.assign(new e$("rows",c).bind({selection:e}),{body:`function jitRqbMapper (rows) {
|
|
15
15
|
${c}
|
|
16
16
|
}`})}var tS=class{static [r]="RelationsBuilderTable";static[Symbol.hasInstance](e){return l(e,this)}_;constructor(e,t){this._={name:t,table:e}}},t$=class{static [r]="RelationsBuilderColumn";static[Symbol.hasInstance](e){return l(e,this)}_;constructor(e,t,i){this._={tableName:t,column:e,key:i}}through(e){return new tx(this._.column,this._.tableName,this._.key,e)}},tx=class{static [r]="RelationsBuilderColumn";static[Symbol.hasInstance](e){return l(e,this)}_;constructor(e,t,i,r){this._={tableName:t,column:e,through:r,key:i}}},tq=class{static [r]="RelationsHelperStatic";static[Symbol.hasInstance](e){return l(e,this)}constructor(e){let t={},i={};for(let[r,n]of Object.entries(e))t[r]=t=>new tc(e,n,r,t),i[r]=t=>new tu(e,n,r,t);this.one=t,this.many=i}one;many;aggs={count:()=>new td}};function tQ(e,t){let i=e[p][t],r=D(i);return J(i,r,B.column)?i:new F([e,L["."],K.identifier(J(i,r,B.aliased)?i.fieldAlias:t)])}var tj=class{chunks;separator;static [r]="ConditionsCollector";static[Symbol.hasInstance](e){return l(e,this)}start;count=0;mark=0;conditionStart=0;constructor(e,t){this.chunks=e,this.separator=t,this.start=e.length,e.push(void 0)}open(){this.mark=this.chunks.length,this.count&&this.chunks.push(this.separator),this.conditionStart=this.chunks.length}close(){if(this.chunks.length===this.conditionStart){this.chunks.length=this.mark;return}++this.count}push(e){void 0!==e&&(this.count&&this.chunks.push(this.separator),this.chunks.push(e),++this.count)}pushChunks(e){if(e?.length){this.count&&this.chunks.push(this.separator);for(let t=0;t<e.length;++t)this.chunks.push(e[t]);++this.count}}finish(){return this.count?(this.count>1&&(this.chunks[this.start]=L["(("],this.chunks.push(L["))"])),!0):(this.chunks.length=this.start,!1)}};function tA(e,t,i={},r={},n,s=0,o=[]){if(t===tJ)return{sql:void 0,hasRelationFilters:!1};if(void 0===t)throw Error("Unexpected 'undefined' in filter value. Use 'EmptyFilter' if you want the filter field to be skipped.");let a=Object.entries(t);if(!a.length)return{sql:void 0,hasRelationFilters:!1};let c=new tj(o,L[") and ("]),h=!1,d=t=>{tA(e,t,i,r,n,s,o).hasRelationFilters&&(h=!0)};for(let[t,f]of a)if(f!==tJ){if(void 0===f)throw Error("Unexpected 'undefined' in filter value. Use 'EmptyFilter' if you want the filter field to be skipped.");switch(t){case"RAW":{let t="function"==typeof f?f(e,tf):f.getSQL();if(t===tJ)continue;c.push(t),h=!0;continue}case"OR":case"AND":{if(!f.length)throw Error(`Unexpected empty array in filters' '${t}' section. Omit field or use 'EmptyFilter' if you want filter to be skipped.`);c.open();let e=new tj(o,"OR"===t?L[") or ("]:L[") and ("]);for(let t of f)e.open(),d(t),e.close();e.finish(),c.close();continue}case"NOT":{c.open();let e=o.length;o.push(L["not ("]),d(f),o.length===e+1?o.length=e:o.push(L[")"]),c.close();continue}default:{if(Object.prototype.hasOwnProperty.call(e[p],t)&&e[p][t]){c.open(),function e(t,i,r=[]){if(i===tJ)return;if(void 0===i)throw Error("Unexpected 'undefined' in filter value. Use 'EmptyFilter' if you want the filter field to be skipped.");if("object"!=typeof i||l(i,X))return r.push(eW(t,i)),r;let n=Object.entries(i);if(!n.length)return;let s=new tj(r,L[") and ("]);for(let[i,o]of n)if(o!==tJ){if(void 0===o)throw Error("Unexpected 'undefined' in filter value. Use 'EmptyFilter' if you want the filter field to be skipped.");switch(i){case"NOT":{s.open();let i=r.length;r.push(L["not ("]),e(t,o,r),r.length===i+1?r.length=i:r.push(L[")"]),s.close();continue}case"OR":case"AND":{if(!o.length)throw Error(`Unexpected empty array in filters' '${i}' section. Omit field or use 'EmptyFilter' if you want filter to be skipped.`);s.open();let n=new tj(r,"OR"===i?L[") or ("]:L[") and ("]);for(let i of o)n.open(),e(t,i,r),n.close();n.finish(),s.close();continue}case"isNotNull":case"isNull":if(!o)continue;s.push(tf[i](t));continue;case"in":s.push(tf.inArray(t,o));continue;case"notIn":s.push(tf.notInArray(t,o));continue;default:s.push(tf[i](t,o));continue}}return s.finish()?r:void 0}(tQ(e,t),f,o),c.close();continue}let a=Object.prototype.hasOwnProperty.call(i,t)?i[t]:void 0;if(!a)throw new u({message:`Unknown relational filter field: "${t}"`});n&&(tE(n,a.targetTable),tE(n,a.throughTable));let d=eU(a.targetTable,`f${s}`),m=a.throughTable?eU(a.throughTable,`ft${s}`):void 0,g=r[a.targetTableName],b="boolean"==typeof f;c.open();let y=o.length;o.push(f?L["exists (select * from "]:L["not exists (select * from "]),tD(d,o),m&&(o.push(L[" inner join "]),tD(m,o),o.push(L[" on "]));let{filter:w}=tk(a,e,d,m,[],o);o.push(L[" where "]);let v=new tj(o,L[") and ("]);if(v.pushChunks(w),!b){v.open();let e=tA(d,f,g.relations,r,n,s+1,o);if(v.close(),!e.sql){o.length=y,c.close();continue}}v.finish(),o.push(L[")"]),c.close(),h=!0}}}return{sql:c.finish()?o:void 0,hasRelationFilters:h}}let tC=new Set(["min","max","count","avg","first"]);function tL(e,t){if("string"!=typeof e)throw new u({message:`Invalid order "${t}": expected a string, got ${null===e?"null":typeof e}`});let i=e.split("("),r=i[0];if("asc"!==r&&"desc"!==r)throw new u({message:`Invalid order "${t}": unknown direction "${r}" in "${e}", expected "asc" or "desc"`});if(1===i.length)return{direction:r};if(i.length>2||!i[1].endsWith(")"))throw new u({message:`Invalid order "${t}": malformed value "${e}", expected "${r}" or "${r}(<aggregate>)"`});let n=i[1].slice(0,-1);if(!tC.has(n))throw new u({message:`Invalid order "${t}": unknown aggregate "${n}" in "${e}", expected one of: ${[...tC].join(", ")}`});return{direction:r,aggregate:n}}function tI(e,t,i={},r={},n,s="limit",o=[]){let l=o.length;if("function"==typeof t){let i=t(e,tm);if(!i)return;let r=D(i);if(J(i,r,B.sql))o.push(i);else if(Array.isArray(i))for(let e=0;e<i.length;++e){e&&o.push(L[", "]);let t=i[e];o.push(t),D(t)!==B.sql&&o.push(L[" asc"])}else J(i,r,B.column)&&o.push(i,L[" asc"]);return o.length>l?o:void 0}return!function e(t,i,r,n,s,o,l,a,c=a.length){for(let[h,d]of Object.entries(i)){if(!d)continue;let i=l?`${l.path}.${h}`:h;if(Object.prototype.hasOwnProperty.call(t[p],h)&&t[p][h]){let{direction:e,aggregate:r}=tL(d,i);if(!!r!=!!l?.isAggregated)throw new u({message:`Invalid order "${i}": expected ${l?.isAggregated?'"asc(<aggregate>)" or "desc(<aggregate>)", with aggregate being one of: min, max, count, avg, first':'"asc" or "desc"'}, got "${d}"`});let n=tQ(t,h);if(a.length>c&&a.push(L[", "]),!l){a.push(n,"asc"===e?L[" asc"]:L[" desc"]);continue}let s=!r||"first"===r;a.push(L["(select "]),s?("top"===o&&a.push(L["top(1) "]),a.push(n)):a.push(L[`${r}(`],n,L[")"]),a.push(L[" from "]);for(let e=0;e<l.from.length;++e)a.push(l.from[e]);let f=a.length;a.push(L[" where "]);let m=new tj(a,L[") and ("]);for(let e=0;e<l.filters.length;++e)m.pushChunks(l.filters[e]);m.finish()||(a.length=f),s&&"limit"===o&&a.push(L[" limit 1"]),a.push(L[")"],"asc"===e?L[" asc"]:L[" desc"]);continue}let f=Object.prototype.hasOwnProperty.call(r,h)?r[h]:void 0;if(!f)throw new u({message:`Unknown relational order field: "${i}"`});let m="many"===f.relationType&&"string"==typeof d?tL(d,i):void 0,g=m?.aggregate==="count"?m.direction:void 0;if("object"!=typeof d&&!g)throw new u({message:`Invalid order "${i}": expected an object with fields of relation to order by${"many"===f.relationType?', "asc(count)" or "desc(count)"':""}, got "${d}"`});s&&(tE(s,f.targetTable),tE(s,f.throughTable));let b=l?.depth??0,y=eU(f.targetTable,`o${b}`),w=f.throughTable?eU(f.throughTable,`ot${b}`):void 0,v=l?[...l.from,L[" cross join "]]:[];tD(y,v),w&&(v.push(L[" inner join "]),tD(w,v),v.push(L[" on "]));let{filter:S}=tk(f,t,y,w,[],v),$=l?[...l.filters,S]:[S];if("object"!=typeof d){a.length>c&&a.push(L[", "]),a.push(L["(select count(*) from "]);for(let e=0;e<v.length;++e)a.push(v[e]);let e=a.length;a.push(L[" where "]);let t=new tj(a,L[") and ("]);for(let e=0;e<$.length;++e)t.pushChunks($[e]);t.finish()||(a.length=e),a.push(L[")"],"asc"===g?L[" asc"]:L[" desc"]);continue}e(y,d,n[f.targetTableName]?.relations??{},n,s,o,{from:v,filters:$,isAggregated:!!l?.isAggregated||"many"===f.relationType,depth:b+1,path:i},a,c)}return a}(e,t,i,r,n,s,void 0,o,l),o.length>l?o:void 0}function tN(e,t,i,r,n=[]){let s=n.length,o=[];for(let[l,a]of Object.entries(t)){let t="function"==typeof a?a(e,{sql:tf.sql}):a;if(!t)continue;let c=t.getSQL(),u=i?ej(c):void 0,h=new F(!u||r&&u.jsonSelectIdentifier?[L["("],c,L[") as "],K.identifier(l)]:[i.apply(u,r?"castInJson":"cast",new F([L["("],c,L[")"]])),L[" as "],K.identifier(l)]);h.decoder=c.decoder,n.length>s&&n.push(L[", "]),n.push(h),o.push(!u||r&&u.mapFromJsonValue?{key:l,field:h,fieldType:"SQL"}:{key:l,field:h,fieldType:"SQL",codec:i.get(u,r?"normalizeInJson":"normalize"),arrayDimensions:u.dimensions})}return{sql:n.length>s?n:void 0,selection:o}}function tT({_:{column:e,key:t}}){let i=D(e);return K.identifier(J(e,i,B.column)?e.name:J(e,i,B.aliased)?e.fieldAlias:t)}function t_(e,t,i,r,n,s){e.open(),t.push(i,L["."],tT(r),L[" = "],n,L["."],tT(s)),e.close()}function tk(e,t,i,r,n=[],s=[]){let o=e.isFilterReversed?t:i,l=t[S],a=i[S],c=r?.[S],u=new tj(n,L[") and ("]);if(e.through){let{sourceColumns:t,targetColumns:i,through:{source:r,target:h}}=e;u.open(),tA(o,e.where,{},{},void 0,0,n),u.close();for(let e=0;e<t.length;++e)t_(u,n,l,t[e],c,r[e]);u.finish();let d=new tj(s,L[") and ("]);for(let e=0;e<i.length;++e)t_(d,s,c,h[e],a,i[e]);return d.finish(),{filter:n,joinCondition:s}}let{sourceColumns:h,targetColumns:d}=e;for(let e=0;e<h.length;++e)t_(u,n,l,h[e],a,d[e]);return u.open(),tA(o,e.where,{},{},void 0,0,n),u.close(),u.finish(),{filter:n}}function tO(e,t,i,r,n,s,o=[]){let l=new tj(o,L[") and ("]),a=!1;return t&&"where"in t&&(l.open(),a=tA(e,t.where,i,r,n,0,o).hasRelationFilters,l.close()),l.pushChunks(s),{sql:l.finish()?o:void 0,hasRelationFilters:a}}function tF(e,t,i,r,n,s,o){s?e.push(n.apply(s,o?"castInJson":"cast",new F([t,L["."],K.identifier(i)]))):e.push(t,L["."],K.identifier(i)),e.push(L[" as "],K.identifier(r))}function tB(e,t,i,r,n,s,o,l){let a,c,h,d=D(t);if(J(t,d,B.column)){a=t,h="Column";let{jsonSelectIdentifier:n,dimensions:s}=t,c=r&&n?void 0:o.codecsOf(t)[r?"castInJson":"cast"];if(c||r&&n){let r=new F([e,L["."],K.identifier(t.name)]),o=c?c(r,s):n.call(t,r,K,s);l.push(o,L[" as "],K.identifier(i))}else l.push(e,L["."],K.identifier(t.name),L[" as "],K.identifier(i))}else if(J(t,d,B.sql))a=ej(t),h="SQL",tF(l,e,i,i,o,a,r);else if(J(t,d,B.aliased))a=ej(t),h="SQL.Aliased",tF(l,e,t.fieldAlias,i,o,a,r);else if(J(t,d,B.subquery)){let n=Object.values(t._.selectedFields)[0],s=D(n);J(n,s,B.column)?(a=n,c=n):J(n,s,B.aliased)?(a=ej(n),c=n.sql.decoder):J(n,s,B.sql)&&(a=ej(n),c=n.decoder),h="Subquery",tF(l,e,t._.alias,i,o,a,r)}else if(O(t))a=ej(t),h="SQLWrapper",tF(l,e,i,i,o,a,r);else throw new u({message:void 0===t?`Unknown column: "${s}"."${i}"`:"Views and subqueries with nested selections are not supported by the relational query builder"});n.push(a?{key:i,field:t,fieldType:h,subqueryDecoder:c,codec:r&&a.mapFromJsonValue?void 0:o.get(a,r?"normalizeInJson":"normalize"),arrayDimensions:a.dimensions}:{key:i,field:t,fieldType:h,subqueryDecoder:c})}function tP(e,t,i,r,n,s,o,l){let a,c=o.length;if(!l){for(let l of Object.keys(t))o.length>c&&o.push(L[", "]),tB(e,t[l],l,r,i,n,s,o);return!0}for(let u of Object.keys(l)){let h=l[u];void 0!==h&&(a=a||h,h&&(o.length>c&&o.push(L[", "]),tB(e,t[u],u,r,i,n,s,o)))}if(!1===a)for(let a of Object.keys(t))!1!==l[a]&&(o.length>c&&o.push(L[", "]),tB(e,t[a],a,r,i,n,s,o));return o.length>c}function tE(e,t){let i=D(t);if(void 0!==e.usedTables&&J(t,i,B.table))return void e.usedTables.add(t[w]);if(!J(t,i,B.subquery))return;let r=t._.alias,n=e.subqueries.get(r);if(n&&n._.sql!==t._.sql)throw new u({message:`Different subqueries with the same alias "${r}" are used in a single relational query - make sure every subquery in schema has a unique alias`});e.subqueries.set(r,t)}function tD(e,t=[]){if(!e[v])return t.push(e),t;let i=e[m];return i&&t.push(K.identifier(i),L["."]),t.push(K.identifier(e[b]),L[" as "],e[S]),t}let tJ=Symbol.for("drizzle:EmptyFilter");e.s(["o",0,tP,"L",0,tE,"x",0,function(e,t){let i=Object.fromEntries(Object.entries(e).filter(([e,t])=>l(t,q)||l(t,T)||l(t,_)));var r=t?t(Object.assign(new tq(i),Object.entries(i).reduce((e,[t,i])=>{let r=new tS(i,t),n=Object.entries(i[p]).reduce((e,[i,r])=>(e[i]=new t$(r,t,i),e),{});return e[t]=Object.assign(r,n),e},{}))):{};let n={};for(let[e,t]of Object.entries(i))n[e]={table:t,name:e,relations:r[e]??{}};return function(e,t){for(let t of Object.values(e))for(let[e,i]of Object.entries(t.relations))l(i,ta)&&(i.sourceTable=t.table,i.fieldName=e);for(let[i,r]of Object.entries(e))for(let[n,s]of Object.entries(r.relations)){let o;if(!l(s,ta))continue;let{targetTableName:a,alias:c,sourceColumns:u,targetColumns:h,throughTable:d,sourceTable:f,through:m,where:g}=s,b=`relations -> ${r.name}: { ${n}: r.${l(s,tc)?"one":"many"}.${a}(...) }`;if(Object.prototype.hasOwnProperty.call(r.table[p],n))throw Error(`${b}: relation name collides with column "${n}" of table "${r.name}"`);if("string"==typeof c&&!c)throw Error(`${b}: "alias" cannot be an empty string - omit it if you don't need it`);if(u?.length===0)throw Error(`${b}: "from" cannot be empty`);if(h?.length===0)throw Error(`${b}: "to" cannot be empty`);if(u&&h){if(u.length!==h.length&&!d)throw Error(`${b}: "from" and "to" fields without "through" must have the same length`);for(let{_:{tableName:e}}of u)if(e!==i)throw Error(`${b}: all "from" columns must belong to table "${i}", found column of table "${e}"`);for(let{_:{tableName:e}}of h)if(e!==a)throw Error(`${b}: all "to" columns must belong to table "${a}", found column of table "${e}"`);if(m){if(m.source.length!==u.length||m.target.length!==h.length)throw Error(`${b}: ".through(column)" must be used either on all columns in "from" and "to" or not defined on any of them`);for(let e of m.source)if(t[e._.tableName]!==d)throw Error(`${b}: ".through(column)" must be used on the same table by all columns of the relation`);for(let e of m.target)if(t[e._.tableName]!==d)throw Error(`${b}: ".through(column)" must be used on the same table by all columns of the relation`)}continue}if(u||h)throw Error(`${b}: relation must have either both "from" and "to" defined, or none of them`);let y=e[a];if(!y)throw Error(`${b}: not enough data provided to build the relation - "from"/"to" are not defined, and no reverse relations of table "${a}" were found"`);if(c){let e=Object.values(y.relations).filter(e=>l(e,ta)&&e.alias===c&&e!==s);if(e.length>1)throw Error(`${b}: not enough data provided to build the relation - "from"/"to" are not defined, and multiple relations with alias "${c}" found in table "${a}": ${e.map(e=>`"${e.fieldName}"`).join(", ")}`);if(!(o=e[0]))throw Error(`${b}: not enough data provided to build the relation - "from"/"to" are not defined, and there is no reverse relation of table "${a}" with alias "${c}"`)}else{let e=Object.values(y.relations).filter(e=>l(e,ta)&&e.targetTable===f&&!e.alias&&e!==s);if(e.length>1)throw Error(`${b}: not enough data provided to build the relation - "from"/"to" are not defined, and multiple relations between "${a}" and "${i}" were found.
|
|
17
|
-
Hint: you can specify "alias" on both sides of the relation with the same value`);if(!(o=e[0]))throw Error(`${b}: not enough data provided to build the relation - "from"/"to" are not defined, and no reverse relation of table "${a}" with target table "${i}" was found`)}if(!o.sourceColumns||!o.targetColumns)throw Error(`${b}: not enough data provided to build the relation - "from"/"to" are not defined, and reverse relation "${a}.${o.fieldName}" does not have "from"/"to" defined`);s.sourceColumns=o.targetColumns,s.targetColumns=o.sourceColumns,s.through=o.through?{source:o.through.target,target:o.through.source}:void 0,s.throughTable=o.throughTable,s.isFilterReversed=g===tJ,s.where=g===tJ?o.where:g}return e}(n,i)},"s",0,tD,"J",0,tw,"M",0,tv,"r",0,tN,"F",0,tk,"f",0,tb,"k",0,tg,"p",0,tp,"S",0,tO,"A",0,tI],79822);var tz=class{mode;schema;table;tableConfig;dialect;session;forbidJsonb;builder;static [r]="SQLiteRelationalQueryBuilderV2";static[Symbol.hasInstance](e){return l(e,this)}constructor(e,t,i,r,n,s,o,l=tU){this.mode=e,this.schema=t,this.table=i,this.tableConfig=r,this.dialect=n,this.session=s,this.forbidJsonb=o,this.builder=l}findMany(e){return new this.builder(this.mode,this.schema,this.table,this.tableConfig,this.dialect,this.session,e??!0,"many",this.forbidJsonb)}findFirst(e){return new this.builder(this.mode,this.schema,this.table,this.tableConfig,this.dialect,this.session,e??!0,"first",this.forbidJsonb)}},tU=class{schema;tableConfig;dialect;session;config;forbidJsonb;static [r]="SQLiteRelationalQueryV2";static[Symbol.hasInstance](e){return l(e,this)}mapper;mode;table;resultKind;constructor(e,t,i,r,n,s,o,l,a){this.schema=t,this.tableConfig=r,this.dialect=n,this.session=s,this.config=o,this.forbidJsonb=a,this.resultKind=e,this.mode=l,this.table=i}getSQL(){return this._getQuery().sql}_getQuery(e){let t=this.forbidJsonb?K`json`:K`jsonb`;return this.dialect.buildRelationalQuery({schema:this.schema,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,mode:this.mode,jsonb:t,usedTables:e})}_toSQL(){let e=tp(this.config),t=this._getQuery(e);return{query:t,builtQuery:this.dialect.sqlToQuery(t.sql),usedTables:e}}toSQL(){return this._toSQL().builtQuery}},tV=class extends tU{static [r]="SQLiteAsyncRelationalQueryV2";_prepare(e=!1){let{query:t,builtQuery:i,usedTables:r}=this._toSQL(),n=this.mapper??=this.dialect.mapperGenerators.relationalRows({isFirst:"first"===this.mode,parseJson:!0,parseJsonIfString:!1,rootJsonMappers:!1,selection:t.selection,arrayModeRoot:!0});return this.session.prepareQuery(i,"arrays",e,"all",n,tg(this.config,t.sql,r,this),tb(this.config))}prepare(){return this._prepare(!0)}async execute(e){return this._prepare().execute(e)}},tR=class extends tV{static [r]="SQLiteSyncRelationalQueryV2";sync(e){return this._prepare().execute(e).sync()}};eL(tV,[e_]);var tM=class e{static [r]="SelectionProxyHandler";static[Symbol.hasInstance](e){return l(e,this)}config;constructor(e){this.config={...e}}get(t,i,r){if("_"===i)return{...t._,selectedFields:new Proxy(t._.selectedFields,this)};if(i===I)return{...t[I],selectedFields:new Proxy(t[I].selectedFields,this)};if("symbol"==typeof i)return t[i];let n=D(t),s=(J(t,n,B.subquery)?t._.selectedFields:J(t,n,B.view)?t[I].selectedFields:t)[i];if(void 0===s&&"getSQL"===i){let e=t[i];return"function"!=typeof e?e:e.bind(r??t)}let o=D(s);if(J(s,o,B.aliased)){if("sql"===this.config.sqlAliasedBehavior&&!s.isSelectionField)return s.sql;let e=s.clone();return e.isSelectionField=!0,e.origin=this.config.alias,e}if(J(s,o,B.sql)){if("sql"===this.config.sqlBehavior)return s;throw Error(`You tried to reference "${i}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`)}return J(s,o,B.column)?this.config.alias?new Proxy(s,new eB(new Proxy(s.table,new eE(this.config.alias,this.config.replaceOriginalName??!1,!0)),!0)):s:"object"!=typeof s||null===s?s:new Proxy(s,new e(this.config))}};function tW(e){if(l(e,q))return[e[w]];let t=new Set;return et(e.queryChunks,t),[...t]}var tK=class{static [r]="ColumnBuilder";static[Symbol.hasInstance](e){return l(e,this)}config;constructor(e,t,i){this.config={name:e,keyAsName:""===e,notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:t,columnType:i,generated:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default(e){return this.config.default=e,this.config.hasDefault=!0,this}$defaultFn(e){return this.config.defaultFn=e,this.config.hasDefault=!0,this}$default(e){return this.$defaultFn(e)}$onUpdateFn(e){return this.config.onUpdateFn=e,this.config.hasDefault=!0,this}$onUpdate(e){return this.$onUpdateFn(e)}primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName(e,t){""===this.config.name&&(this.config.name=t(e))}},tH=class{static [r]="SQLiteForeignKeyBuilder";static[Symbol.hasInstance](e){return l(e,this)}reference;_onUpdate;_onDelete;constructor(e,t){this.reference=()=>{let{name:t,columns:i,foreignColumns:r}=e();return{name:t,columns:i,foreignTable:r[0].table,foreignColumns:r}},t&&(this._onUpdate=t.onUpdate,this._onDelete=t.onDelete)}onUpdate(e){return this._onUpdate=e,this}onDelete(e){return this._onDelete=e,this}build(e){return new tG(e,this)}},tG=class{table;static [r]="SQLiteForeignKey";static[Symbol.hasInstance](e){return l(e,this)}reference;onUpdate;onDelete;constructor(e,t){this.table=e,this.reference=t.reference,this.onUpdate=t._onUpdate,this.onDelete=t._onDelete}getName(){let{name:e,columns:t,foreignColumns:i}=this.reference(),r=t.map(e=>e.name),n=i.map(e=>e.name),s=[this.table[f],...r,i[0].table[f],...n];return e??`${s.join("_")}_fk`}isNameExplicit(){return!!this.reference().name}},tY=class extends tK{static [r]="SQLiteColumnBuilder";foreignKeyConfigs=[];references(e,t={}){return this.foreignKeyConfigs.push({ref:e,actions:t}),this}unique(e){return this.config.isUnique=!0,this.config.uniqueName=e,this}generatedAlwaysAs(e,t){return this.config.generated={as:e,type:"always",mode:t?.mode??"virtual"},this}buildForeignKeys(e,t){return this.foreignKeyConfigs.map(({ref:i,actions:r})=>{let n;return n=new tH(()=>({columns:[e],foreignColumns:[i()]})),r.onUpdate&&n.onUpdate(r.onUpdate),r.onDelete&&n.onDelete(r.onDelete),n.build(t)})}},tX=class extends A{static [r]="SQLiteColumn";table;constructor(e,t){super(e,t),this.table=e}},tZ=class extends tY{static [r]="SQLiteBigIntBuilder";constructor(e){super(e,"bigint int64","SQLiteBigInt")}build(e){return new t0(e,this.config)}},t0=class extends tX{static [r]="SQLiteBigInt";codec="blob:bigint";getSQLType(){return"blob"}mapToDriverValue=e=>ef(e.toString())},t1=class extends tY{static [r]="SQLiteBlobJsonBuilder";constructor(e){super(e,"object json","SQLiteBlobJson")}build(e){return new t2(e,this.config)}},t2=class extends tX{static [r]="SQLiteBlobJson";codec="blob:json";getSQLType(){return"blob"}mapToDriverValue=e=>ef(JSON.stringify(e))},t6=class extends tY{static [r]="SQLiteBlobBufferBuilder";constructor(e){super(e,"object buffer","SQLiteBlobBuffer")}build(e){return new t8(e,this.config)}},t8=class extends tX{static [r]="SQLiteBlobBuffer";codec="blob";getSQLType(){return"blob"}};function t4(e,t){let{name:i,config:r}=eT(e,t);return r?.mode==="bigint"?new tZ(i):r?.mode==="buffer"?new t6(i):new t1(i)}var t5=class extends tY{static [r]="SQLiteCustomColumnBuilder";constructor(e,t,i){super(e,"custom","SQLiteCustomColumn"),this.config.fieldConfig=t,this.config.customTypeParams=i}build(e){return new t7(e,this.config)}},t7=class extends tX{static [r]="SQLiteCustomColumn";codec;sqlName;mapFromJsonValue;jsonSelectIdentifier;constructor(e,t){super(e,t),this.sqlName=t.customTypeParams.dataType(t.fieldConfig),this.mapToDriverValue=t.customTypeParams.toDriver??this.mapToDriverValue,this.mapFromDriverValue=t.customTypeParams.fromDriver??this.mapFromDriverValue,this.mapFromJsonValue=t.customTypeParams.fromJson,this.jsonSelectIdentifier=t.customTypeParams.forJsonSelect;let i="string"==typeof t.customTypeParams.codec||void 0===t.customTypeParams.codec?t.customTypeParams.codec:t.customTypeParams.codec(t.fieldConfig);this.codec="string"==typeof i?ec(i):void 0}getSQLType(){return this.sqlName}};function t3(e){return(t,i)=>{let{name:r,config:n}=eT(t,i);return new t5(r,n,e)}}var t9=class extends tY{static [r]="SQLiteBaseIntegerBuilder";constructor(e,t,i){super(e,t,i),this.config.autoIncrement=!1}primaryKey(e){return e?.autoIncrement&&(this.config.autoIncrement=!0),this.config.hasDefault=!0,super.primaryKey()}},ie=class extends tX{static [r]="SQLiteBaseInteger";autoIncrement=this.config.autoIncrement;getSQLType(){return"integer"}},it=class extends t9{static [r]="SQLiteIntegerBuilder";constructor(e){super(e,"number int53","SQLiteInteger")}build(e){return new ii(e,this.config)}},ii=class extends ie{static [r]="SQLiteInteger";codec="integer"},ir=class extends t9{static [r]="SQLiteTimestampBuilder";constructor(e,t){super(e,"object date","SQLiteTimestamp"),this.config.mode=t}defaultNow(){return this.default(K`(cast((julianday('now') - 2440587.5)*86400000 as integer))`)}build(e){return new is(e,this.config)}},is=class extends ie{static [r]="SQLiteTimestamp";codec=`integer:${this.config.mode}`;mode=this.config.mode;mapToDriverValue=e=>{if("number"==typeof e)return e;let t=e.getTime();return"timestamp"===this.config.mode?Math.floor(t/1e3):t}},io=class extends t9{static [r]="SQLiteBooleanBuilder";constructor(e,t){super(e,"boolean","SQLiteBoolean"),this.config.mode=t}build(e){return new il(e,this.config)}},il=class extends ie{static [r]="SQLiteBoolean";codec="integer:boolean";mode=this.config.mode;mapToDriverValue=e=>+!!e};function ia(e,t){let{name:i,config:r}=eT(e,t);return r?.mode==="timestamp"||r?.mode==="timestamp_ms"?new ir(i,r.mode):r?.mode==="boolean"?new io(i,r.mode):new it(i)}e.s(["f",0,ia],37540);var ic=class extends tY{static [r]="SQLiteNumericBuilder";constructor(e){super(e,"string numeric","SQLiteNumeric")}build(e){return new iu(e,this.config)}},iu=class extends tX{static [r]="SQLiteNumeric";codec="numeric";getSQLType(){return"numeric"}},ih=class extends tY{static [r]="SQLiteNumericNumberBuilder";constructor(e){super(e,"number","SQLiteNumericNumber")}build(e){return new id(e,this.config)}},id=class extends tX{static [r]="SQLiteNumericNumber";codec="numeric:number";mapToDriverValue=String;getSQLType(){return"numeric"}},im=class extends tY{static [r]="SQLiteNumericBigIntBuilder";constructor(e){super(e,"bigint int64","SQLiteNumericBigInt")}build(e){return new ip(e,this.config)}},ip=class extends tX{static [r]="SQLiteNumericBigInt";codec="numeric:bigint";mapToDriverValue=String;getSQLType(){return"numeric"}};function ig(e,t){let{name:i,config:r}=eT(e,t),n=r?.mode;return"number"===n?new ih(i):"bigint"===n?new im(i):new ic(i)}var ib=class extends tY{static [r]="SQLiteRealBuilder";constructor(e){super(e,"number double","SQLiteReal")}build(e){return new iy(e,this.config)}},iy=class extends tX{static [r]="SQLiteReal";codec="real";getSQLType(){return"real"}};function iw(e){return new ib(e??"")}var iv=class extends tY{static [r]="SQLiteTextBuilder";constructor(e,t){super(e,t.enum?.length?"string enum":"string","SQLiteText"),this.config.enumValues=t.enum,this.config.length=t.length}build(e){return new iS(e,this.config)}},iS=class extends tX{static [r]="SQLiteText";codec="text";enumValues=this.config.enumValues;constructor(e,t){super(e,t)}getSQLType(){return`text${this.config.length?`(${this.config.length})`:""}`}},i$=class extends tY{static [r]="SQLiteTextJsonBuilder";constructor(e){super(e,"object json","SQLiteTextJson")}build(e){return new ix(e,this.config)}},ix=class extends tX{static [r]="SQLiteTextJson";codec="text:json";getSQLType(){return"text"}mapToDriverValue=e=>JSON.stringify(e)};function iq(e,t={}){let{name:i,config:r}=eT(e,t);return"json"===r.mode?new i$(i):new iv(i,r)}function iQ(e){return(e.replace(/['\u2019]/g,"").match(/[\d\p{Ll}\p{Lo}]+|[\p{Lu}]+(?![\p{Ll}\p{Lo}])|[\p{Lu}][\d\p{Ll}\p{Lo}]+/gu)??[]).map(e=>e.toLowerCase()).join("_")}function ij(e){return(e.replace(/['\u2019]/g,"").match(/[\d\p{Ll}\p{Lo}]+|[\p{Lu}]+(?![\p{Ll}\p{Lo}])|[\p{Lu}][\d\p{Ll}\p{Lo}]+/gu)??[]).reduce((e,t,i)=>e+(0===i?t.toLowerCase():`${t[0].toUpperCase()}${t.slice(1)}`),"")}e.s(["f",0,iq],80568);let iA=Symbol.for("drizzle:SQLiteInlineForeignKeys");var iC=class extends q{static [r]="SQLiteTable";static Symbol=Object.assign({},q.Symbol,{InlineForeignKeys:iA});[q.Symbol.Columns];[iA]=[];[q.Symbol.ExtraConfigBuilder]=void 0};function iL(e,t,i,r,n,s=e){let o="snake_case"===n?iQ:"camelCase"===n?ij:e=>e,l=new iC(e,r,s),a=Object.fromEntries(Object.entries("function"==typeof t?t({blob:t4,customType:t3,integer:ia,numeric:ig,real:iw,text:iq}):t).map(([e,t])=>{t.setName(e,o);let i=t.build(l).postBuild();return l[iA].push(...t.buildForeignKeys(i,l)),[e,i]})),c=Object.assign(l,a);return c[q.Symbol.Columns]=a,c[q.Symbol.ExtraConfigColumns]=a,i&&(c[iC.Symbol.ExtraConfigBuilder]=i),c}function iI(e){return(t,i,r)=>iL(t,i,r,void 0,e)}iI(void 0);var iN=class{table;session;dialect;static [r]="SQLiteDelete";static[Symbol.hasInstance](e){return l(e,this)}config;constructor(e,t,i,r){this.table=e,this.session=t,this.dialect=i,this.config={table:e,withList:r}}where(e){return this.config.where=e,this}orderBy(...e){if("function"==typeof e[0]){let t=e[0](new Proxy(this.config.table[q.Symbol.Columns],new tM({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),i=Array.isArray(t)?t:[t];this.config.orderBy=i}else this.config.orderBy=e;return this}limit(e){return this.config.limit=e,this}returning(e=this.table[iC.Symbol.Columns]){return this.config.returning=eQ(e,void 0,this.dialect.codecs),this}getSQL(e=!1){return this.dialect.buildDeleteQuery(e?{...this.config,useSelectionCastCodecs:!0}:this.config)}toSQL(e=!0){return this.dialect.sqlToQuery(this.getSQL(e))}$dynamic(){return this}},iT=class extends iN{static [r]="SQLiteAsyncDelete";_prepare(e=!1){return this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL(!0)),"arrays",e,this.config.returning?"all":"run",this.config.returning?this.dialect.mapperGenerators.rows(this.config.returning,void 0):void 0,{type:"delete",tables:()=>tW(this.config.table)})}prepare(){return this._prepare(!0)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(e){return this._prepare().execute(e)}};eL(iT,[e_]);var i_=class extends T{static [r]="SQLiteViewBase"},ik=class{static [r]="TypedQueryBuilder";static[Symbol.hasInstance](e){return l(e,this)}getSelectedFields(){return this._.selectedFields}},iO=class{builder;static [r]="SQLiteSelectBuilder";static[Symbol.hasInstance](e){return l(e,this)}fields;session;dialect;withList;distinct;constructor(e,t=iF){this.builder=t,this.fields=e.fields,this.session=e.session,this.dialect=e.dialect,this.withList=e.withList,this.distinct=e.distinct}from(e){let t,i=!!this.fields;return t=this.fields?this.fields:l(e,_)?Object.fromEntries(Object.keys(e._.selectedFields).map(t=>[t,e[t]])):l(e,i_)?e[I].selectedFields:l(e,F)?{}:eI(e),new this.builder({table:e,fields:t,isPartialSelect:i,session:this.session,dialect:this.dialect,withList:this.withList??[],distinct:this.distinct})}},iF=class extends ik{static [r]="SQLiteSelectQueryBuilder";_;config;joinsNotNullableMap;tableName;isPartialSelect;session;dialect;cacheConfig=void 0;constructor({table:e,fields:t,isPartialSelect:i,session:r,dialect:n,withList:s,distinct:o}){super(),this.config={withList:s,table:e,fields:{...t},distinct:o,setOperators:[]},this.isPartialSelect=i,this.session=r,this.dialect=n,this._={selectedFields:t,config:this.config},this.tableName=eN(e),this.joinsNotNullableMap="string"==typeof this.tableName?{[this.tableName]:!0}:{}}getUsedTables(e=this.getSQL()){return tW(e)}createJoin(e){return(t,i)=>{let r=this.tableName,n=eN(t);if("string"==typeof n&&this.config.joins?.some(e=>e.alias===n))throw Error(`Alias "${n}" is already used in this query`);if(this.config.fieldsFlat=void 0,this.config.mapper=void 0,!this.isPartialSelect&&(1===Object.keys(this.joinsNotNullableMap).length&&"string"==typeof r&&(this.config.fields={[r]:this.config.fields}),"string"==typeof n&&!l(t,F))){let e=l(t,_)?t._.selectedFields:l(t,T)?t[I].selectedFields:t[q.Symbol.Columns];this.config.fields[n]=e}if("function"==typeof i&&(i=i(new Proxy(this.config.fields,new tM({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.joins||(this.config.joins=[]),this.config.joins.push({on:i,table:t,joinType:e,alias:n}),"string"==typeof n)switch(e){case"left":this.joinsNotNullableMap[n]=!1;break;case"right":this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([e])=>[e,!1])),this.joinsNotNullableMap[n]=!0;break;case"cross":case"inner":this.joinsNotNullableMap[n]=!0;break;case"full":this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([e])=>[e,!1])),this.joinsNotNullableMap[n]=!1}return this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");crossJoin=this.createJoin("cross");createSetOperator(e,t){return i=>{let r="function"==typeof i?i(iP()):i;if(!eA(this.getSelectedFields(),r.getSelectedFields()))throw Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return this.config.setOperators.push({type:e,isAll:t,rightSelect:r}),this}}union=this.createSetOperator("union",!1);unionAll=this.createSetOperator("union",!0);intersect=this.createSetOperator("intersect",!1);except=this.createSetOperator("except",!1);addSetOperators(e){return this.config.setOperators.push(...e),this}where(e){return"function"==typeof e&&(e=e(new Proxy(this.config.fields,new tM({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.where=e,this}having(e){return"function"==typeof e&&(e=e(new Proxy(this.config.fields,new tM({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.having=e,this}groupBy(...e){if("function"==typeof e[0]){let t=e[0](new Proxy(this.config.fields,new tM({sqlAliasedBehavior:"alias",sqlBehavior:"sql"})));this.config.groupBy=Array.isArray(t)?t:[t]}else this.config.groupBy=e;return this}orderBy(...e){if("function"==typeof e[0]){let t=e[0](new Proxy(this.config.fields,new tM({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),i=Array.isArray(t)?t:[t];this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=i:this.config.orderBy=i}else this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=e:this.config.orderBy=e;return this}limit(e){return this.config.setOperators.length>0?this.config.setOperators.at(-1).limit=e:this.config.limit=e,this}offset(e){return this.config.setOperators.length>0?this.config.setOperators.at(-1).offset=e:this.config.offset=e,this}$withCache(e){return this.cacheConfig=void 0===e?{config:{},enabled:!0,autoInvalidate:!0}:!1===e?{enabled:!1}:{enabled:!0,autoInvalidate:!0,...e},this}getSQL(e=!1){return this.config.fieldsFlat??=eQ(this.config.fields,void 0,this.dialect.codecs),this.dialect.buildSelectQuery(e?{...this.config,useSelectionCastCodecs:!0}:this.config)}toSQL(e=!0){return this.dialect.sqlToQuery(this.getSQL(e))}as(e){return new Proxy(new _(this.getSQL(),this.config.fields,e),new tM({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}getSelectedFields(){return new Proxy(this.config.fields,new tM({alias:this.tableName,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}$dynamic(){return this}};function iB(e,t){return(i,r,...n)=>{let s=[r,...n].map(i=>({type:e,isAll:t,rightSelect:i}));for(let e of s)if(!eA(i.getSelectedFields(),e.rightSelect.getSelectedFields()))throw Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return i.addSetOperators(s)}}let iP=()=>({union:iE,unionAll:iD,intersect:iJ,except:iz}),iE=iB("union",!1),iD=iB("union",!0),iJ=iB("intersect",!1),iz=iB("except",!1),iU=function(e,t=4096){let i=new Map;return r=>{let n=i.get(r);return void 0===n&&(i.size>=t&&i.clear(),n=e(r),i.set(r,n)),n}}(e=>`"${e.replace(/"/g,'""')}"`),iV={json:new C("json"),object:new C("_object("),groupArray:new C("_group_array(json_object("),groupArrayClose:new C("))"),relationFrom:new C(' as "r" from ('),relationClose:new C(') as "t") as ')};var iR=class{static [r]="SQLiteDialect";static[Symbol.hasInstance](e){return l(e,this)}codecs;mapperGenerators;constructor(e){this.codecs=new el(ec,e?.codecs),this.mapperGenerators=e?.useJitMappers?{rows:ex,relationalRows:tv}:{rows:eq,relationalRows:tw}}escapeName(e){return iU(e)}escapeParam(e){return"?"}escapeString(e){return`'${e.replace(/'/g,"''")}'`}buildWithCTE(e){if(!e?.length)return;let t=e.length,i=Array(t+1),r=0;i[r++]=L["with "];for(let n=0;n<t;++n){let s=e[n];i[r++]=n<t-1?K`${K.identifier(s._.alias)} as (${s._.sql}), `:K`${K.identifier(s._.alias)} as (${s._.sql}) `}return new F(i)}buildDeleteQuery({table:e,where:t,returning:i,withList:r,limit:n,orderBy:s,useSelectionCastCodecs:o}){let l=this.buildWithCTE(r),a=i?K` returning ${this.buildSelection(i,{isSingleTable:!0,ignoreCastCodecs:!o,table:e})}`:void 0,c=t?K` where ${t}`:void 0,u=this.buildOrderBy(s),h=this.buildLimit(n);return K`${l}delete from ${e}${c}${a}${u}${h}`}buildUpdateSet(e,t){let i=e[q.Symbol.Columns],r=Object.keys(i).filter(e=>void 0!==t[e]||i[e]?.onUpdateFn!==void 0),n=r.length,s=Array(n);for(let e=0;e<r.length;++e){let o,a=r[e],c=i[a];if(void 0!==t[a])o=t[a];else{let e=c.onUpdateFn?.();o=l(e,F)?e:K.param(e,c)}s[e]=e<n-1?K`${K.identifier(c.name)} = ${o}, `:K`${K.identifier(c.name)} = ${o}`}return new F(s)}buildUpdateQuery({table:e,set:t,where:i,returning:r,withList:n,joins:s,from:o,limit:l,orderBy:a,useSelectionCastCodecs:c}){let u=this.buildWithCTE(n),h=this.buildUpdateSet(e,t),d=o&&new F([L[" from "],this.buildFromTable(o)]),f=this.buildJoins(s),m=r?K` returning ${this.buildSelection(r,{isSingleTable:!0,ignoreCastCodecs:!c,table:e})}`:void 0,p=i?K` where ${i}`:void 0,g=this.buildOrderBy(a),b=this.buildLimit(l);return K`${u}update ${e} set ${h}${d}${f}${p}${m}${g}${b}`}buildSelection(e,{isSingleTable:t=!1,ignoreCastCodecs:i=!1,table:r}={}){let{length:n}=e,s=[],o=D(r),a=r?J(r,o,B.sql)||J(r,o,B.subquery)?void 0:r[q.Symbol.IsAlias]||void 0===r[q.Symbol.Schema]?r[q.Symbol.Name]:`${r[q.Symbol.Schema]}.${r[q.Symbol.Name]}`:void 0;for(let r=0;r<n;++r){let{field:o,codecOverride:c,column:u,fieldType:h}=e[r];switch(h){case"Column":{let e;e=t?o.isAlias?K.identifier(o[Q]().name):K.identifier(o.name):o.isAlias?o[Q]():o;let r=i?e:this.codecs.apply(o,"cast",e,c);s.push(o.isAlias?K`${r} as ${o}`:r);break}case"SQL.Aliased":if(o.isSelectionField){let e=t||void 0===o.origin?K.identifier(o.fieldAlias):K`${K.identifier(o.origin)}.${K.identifier(o.fieldAlias)}`;u&&!i?s.push(this.codecs.apply(u,"cast",e,c)):s.push(e)}else{if(t&&void 0!==a){let{queryChunks:e}=o.sql,t=Array(e.length),r=!1;for(let i=0;i<e.length;++i){let n=e[i];if(l(n,A)){let{table:e}=n;if((e[q.Symbol.IsAlias]||void 0===e[q.Symbol.Schema]?e[q.Symbol.Name]:`${e[q.Symbol.Schema]}.${e[q.Symbol.Name]}`)!==a){r=!0;break}t[i]=K.identifier(n.name)}else t[i]=n}if(r)s.push(u&&!i?this.codecs.apply(u,"cast",o.sql,c):o.sql);else{let e=new F(t);o.sql.shouldInlineParams&&e.inlineParams(),s.push(u&&!i?this.codecs.apply(u,"cast",e,c):e)}}else s.push(u&&!i?this.codecs.apply(u,"cast",o.sql,c):o.sql);s.push(K` as ${K.identifier(o.fieldAlias)}`)}break;case"SQL":if(t&&void 0!==a){let{queryChunks:e}=o,t=Array(e.length),r=!1;for(let i=0;i<e.length;++i){let n=e[i];if(l(n,A)){let{table:e}=n;if((e[q.Symbol.IsAlias]||void 0===e[q.Symbol.Schema]?e[q.Symbol.Name]:`${e[q.Symbol.Schema]}.${e[q.Symbol.Name]}`)!==a){r=!0;break}t[i]=K.identifier(n.name)}else t[i]=n}if(r)s.push(u&&!i?this.codecs.apply(u,"cast",o,c):o);else{let e=new F(t);o.shouldInlineParams&&e.inlineParams(),s.push(u&&!i?this.codecs.apply(u,"cast",e,c):e)}}else s.push(u&&!i?this.codecs.apply(u,"cast",o,c):o);break;case"Subquery":if(o._.isWith)s.push(u&&!i?this.codecs.apply(u,"cast",o,c):o);else{let e=K`(${o._.sql})`;s.push(K`${u&&!i?this.codecs.apply(u,"cast",e,c):e} ${K.identifier(o._.alias)}`)}}r<n-1&&s.push(L[", "])}return new F(s)}buildJoins(e){if(!e||0===e.length)return;let t=[];if(e)for(let[i,r]of e.entries()){0===i&&t.push(L[" "]);let n=r.table,s=r.on?K` on ${r.on}`:void 0;l(n,iC)?t.push(K`${new C(r.joinType)} join ${n[q.Symbol.IsAlias]?eV(n):n}${s}`):t.push(K`${new C(r.joinType)} join ${n}${s}`),i<e.length-1&&t.push(L[" "])}return new F(t)}buildLimit(e){return"object"==typeof e||"number"==typeof e?K` limit ${e}`:void 0}buildOrderBy(e){let t=[];if(e)for(let[i,r]of e.entries())t.push(r),i<e.length-1&&t.push(L[", "]);return t.length>0?K` order by ${K.join(t)}`:void 0}buildFromTable(e){if(l(e,q)&&e[q.Symbol.IsAlias])return eV(e);if(l(e,T)&&e[I].isAlias){let t=K`${K.identifier(e[I].originalName)}`;return e[I].schema&&(t=K`${K.identifier(e[I].schema)}.${t}`),K`${t} ${K.identifier(e[I].name)}`}return e}buildSelectQuery({withList:e,fields:t,fieldsFlat:i,where:r,having:n,table:s,joins:o,orderBy:a,groupBy:c,limit:u,offset:h,distinct:d,setOperators:m,useSelectionCastCodecs:p}){let g=i??eQ(t,void 0,this.codecs),b=D(s),y=J(s,b,B.subquery)?s._.alias:J(s,b,B.view)?s[I].name:J(s,b,B.sql)?void 0:s[f];for(let e of g){let t;if(l(e.field,A)&&e.field.table[f]!==y&&(t=e.field.table,!o?.some(({alias:e})=>e===(t[q.Symbol.IsAlias]?t[f]:t[q.Symbol.BaseName])))){let t=e.field.table[f];throw Error(`Your "${e.path.join("->")}" field references a column "${t}"."${e.field.name}", but the table "${t}" is not part of the query! Did you forget to join it?`)}}let w=!o||0===o.length,v=this.buildWithCTE(e),S=d?K` distinct`:void 0,$=this.buildSelection(g,{isSingleTable:w,table:s,ignoreCastCodecs:!p||m.length>0}),x=this.buildFromTable(s),Q=this.buildJoins(o),j=r?K` where ${r}`:void 0,C=n?K` having ${n}`:void 0,N=[];if(c)for(let[e,t]of c.entries())N.push(t),e<c.length-1&&N.push(L[", "]);let T=N.length>0?K` group by ${K.join(N)}`:void 0,_=this.buildOrderBy(a),k=this.buildLimit(u),O=h?K` offset ${h}`:void 0,F=K`${v}select${S} ${$} from ${x}${Q}${j}${T}${C}${_}${k}${O}`;return m.length>0?this.buildSetOperations(F,g,p,m):F}buildSetOperations(e,t,i,r){for(let i=0;i<r.length;++i){let n=r[i];e=this.buildSetOperationQuery({leftSelect:e,setOperator:n});let s=eQ(n.rightSelect.getSelectedFields());for(let e=0;e<t.length;++e){let i=t[e],r=i.path.join("."),n=s.find(e=>e.path.join(".")===r),o=i.codecOverride??i.column?.codec,l=n.codecOverride??n.column?.codec;i.codecOverride=o&&l?eb[o]?.[l]:o}}for(let e=0;e<t.length;++e){let i=t[e];i.codec=i.codecOverride?this.codecs.get(i.column,"normalize",i.codecOverride):i.codec}return i?K`select ${this.buildSelection(t.map(e=>{if("SQL.Aliased"===e.fieldType){let t=e.field.clone();return t.isSelectionField=!0,{...e,field:t,fieldType:"SQL.Aliased"}}if("Column"===e.fieldType&&e.field.isAlias){let t=new F.Aliased(K`${K.identifier(e.field.name)}`,e.field.name);return t.isSelectionField=!0,{...e,field:t,fieldType:"SQL.Aliased"}}if("Subquery"===e.fieldType){let t=new F.Aliased(K`${e.field.getSQL()}`,e.field._.alias);return t.isSelectionField=!0,{...e,field:t,fieldType:"SQL.Aliased"}}return e}),{isSingleTable:!0,ignoreCastCodecs:!i})} from (${e}) ${K.identifier("drizzle_union")}`:e}buildSetOperationQuery({leftSelect:e,setOperator:{type:t,isAll:i,rightSelect:r,limit:n,orderBy:s,offset:o}}){let a,c=K`${e.getSQL()} `,u=K`${r.getSQL()}`;if(s&&s.length>0){let e=[];for(let t of s)l(t,tX)?e.push(K.identifier(t.name)):l(t,F)?e.push(K`${Z(t)}`):e.push(K`${t}`);a=K` order by ${K.join(e,L[", "])}`}let h="object"==typeof n||"number"==typeof n&&n>=0?K` limit ${n}`:void 0,d=new C(`${t} ${i?"all ":""}`),f=o?K` offset ${o}`:void 0;return K`${c}${d}${u}${a}${h}${f}`}buildInsertQuery({table:e,values:t,onConflict:i,returning:r,withList:n,select:s,columnList:o,useSelectionCastCodecs:a}){let c,u=e[q.Symbol.Columns],h=o?o.map(e=>[e,u[e]]):Object.entries(u),d=s&&!l(t,F)?Object.keys(t.getSelectedFields()).map(e=>[e,u[e]]):h.filter(([e,t])=>!t.shouldDisableInsert()),f=Array(2*d.length+1),m=0;f[m++]=L["("];for(let e=0;e<d.length;++e){let[,{name:t}]=d[e];f[m++]=K.identifier(t),e<d.length-1&&(f[m++]=L[", "])}f[m++]=L[")"];let p=new F(f);if(s)c=[t.getSQL()];else{let e=Array(t.length*d.length),i=0;for(let r=0;r<t.length;++r){let n=t[r];for(let t=0;t<d.length;++t){let[r,s]=d[t],o=n[r];void 0===o?void 0!==s.defaultFn?e[i++]=s.defaultFn():null!==s.default&&void 0!==s.default?e[i++]=s.default:void 0!==s.onUpdateFn?e[i++]=s.onUpdateFn():e[i++]=L.null:e[i++]=o}}c=[L["values "],new W(e,d.map(([,e])=>e))]}let g=this.buildWithCTE(n),b=new F(c),y=r?K` returning ${this.buildSelection(r,{isSingleTable:!0,ignoreCastCodecs:!a,table:e})}`:void 0,w=i?.length?K.join(i):void 0;return K`${g}insert into ${e} ${p} ${b}${w}${y}`}sqlToQuery(e,t){return e.toQuery({escapeName:this.escapeName,escapeParam:this.escapeParam,escapeString:this.escapeString,codecs:this.codecs,invokeSource:t})}buildRelationalQuery(e){let t=[],i=this.collectRelationalQuery(e,t);return{sql:new F(t),selection:i}}collectRelationalQuery({schema:e,table:t,tableConfig:i,queryConfig:r,relationWhere:n,mode:s,nested:o,errorPath:l,depth:a,through:c,jsonb:h,withSubqueries:d,usedTables:f},m){let g=[],b=!0===r?void 0:r,y=l??"",w=a??0,v=d??{subqueries:new Map,usedTables:f};w||(tE(v,t),t=eU(t,`d${w}`));let $=t[S],x="first"===s?1:b?.limit,q=b?.offset,{sql:Q}=tO(t,b,i.relations,e,v,n),j=b?.orderBy?tI(t,b.orderBy,i.relations,e,v):void 0,A=b?b.with:void 0,I=[];if(A)for(let e of Object.keys(A))A[e]&&I.push(e);let N=w?-1:m.length;w||m.push(void 0),m.push(L["select "]);let T=+!!tP($,i.table[p],g,!!o,i.name,this.codecs,m,b?.columns);if(b?.extras){let e=m.length;T&&m.push(L[", "]);let i=tN(t,b.extras,this.codecs,!!o,m);g.push(...i.selection),i.sql?++T:m.length=e}if(!T&&!I.length)throw new u({message:`No fields selected for table "${i.name}"${y?` ("${y}")`:""}`});for(let r of I){let n=A[r],s=i.relations[r];if(!s)throw new u({message:`Unknown relation "${i.name}" -> "${r}"`});let l="one"===s.relationType;tE(v,s.targetTable),tE(v,s.throughTable);let a=eU(s.targetTable,`d${w+1}`),c=s.throughTable?eU(s.throughTable,`tr${w}`):void 0,{filter:d,joinCondition:f}=tk(s,t,a,c);T++&&m.push(L[", "]);let p=m.length;m.push(void 0,iV.relationFrom);let b=this.collectRelationalQuery({table:a,mode:l?"first":"many",schema:e,queryConfig:n,tableConfig:e[s.targetTableName],relationWhere:d,nested:!0,errorPath:`${y.length?`${y}.`:""}${r}`,depth:w+1,withSubqueries:v,through:c?{table:c,condition:f}:void 0,jsonb:h},m);m.push(iV.relationClose,K.identifier(r));let S=[L["(select "],o?h:iV.json,l?iV.object:iV.groupArray];for(let e=0;e<b.length;++e){let t=b[e];e&&S.push(L[", "]),S.push(new C(this.escapeString(t.key)),L[", "]),t.selection?S.push(h,L["("],K.identifier(t.key),L[")"]):S.push(K.identifier(t.key))}S.push(l?L[")"]:iV.groupArrayClose),m[p]=new F(S),g.push({field:a,fieldType:"Nested",key:r,selection:b,isArray:!l,isOptional:(s.optional??!1)||!0!==n&&!!n.where})}return m.push(L[" from "]),tD(t,m),c&&(m.push(L[" inner join "]),tD(c.table,m),m.push(L[" on "],...c.condition)),Q&&m.push(L[" where "],...Q),j&&m.push(L[" order by "],...j),void 0!==x&&m.push(L[" limit "],x),void 0!==q&&m.push(L[" offset "],q),-1!==N&&(m[N]=this.buildWithCTE([...v.subqueries.values()])),g}},iM=class{static [r]="SQLiteQueryBuilder";static[Symbol.hasInstance](e){return l(e,this)}dialect;dialectConfig;constructor(e){this.dialect=l(e,iR)?e:void 0,this.dialectConfig=l(e,iR)?void 0:e}$with=(e,t)=>{let i=this;return{as:r=>("function"==typeof r&&(r=r(i)),new Proxy(new k(r.getSQL(),t??("getSelectedFields"in r?r.getSelectedFields()??{}:{}),e,!0),new tM({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"})))}};with(...e){let t=this;return{select:function(i){return new iO({fields:i??void 0,session:void 0,dialect:t.getDialect(),withList:e})},selectDistinct:function(i){return new iO({fields:i??void 0,session:void 0,dialect:t.getDialect(),withList:e,distinct:!0})}}}select(e){return new iO({fields:e??void 0,session:void 0,dialect:this.getDialect()})}selectDistinct(e){return new iO({fields:e??void 0,session:void 0,dialect:this.getDialect(),distinct:!0})}getDialect(){return this.dialect||(this.dialect=new iR(this.dialectConfig)),this.dialect}},iW=class{table;session;dialect;withList;columnList;builder;static [r]="SQLiteInsertBuilder";static[Symbol.hasInstance](e){return l(e,this)}constructor(e,t,i,r,n,s=iK){this.table=e,this.session=t,this.dialect=i,this.withList=r,this.columnList=n,this.builder=s}values(e){if(0===(e=Array.isArray(e)?e:[e]).length)throw Error("values() must be called with at least one value");return new this.builder(this.table,e,this.session,this.dialect,this.withList,!1,this.columnList)}select(e){let t="function"==typeof e?e(new iM):e;if(!l(t,F)){let e=Object.keys(this.table[q.Symbol.Columns]);for(let i of Object.keys(t._.selectedFields))if(!e.includes(i))throw Error(`Insert select error: column "${i}" does not exist in table "${this.table[q.Symbol.Name]}"`)}return new this.builder(this.table,t,this.session,this.dialect,this.withList,!0,this.columnList)}},iK=class{session;dialect;static [r]="SQLiteInsert";static[Symbol.hasInstance](e){return l(e,this)}config;constructor(e,t,i,r,n,s,o){this.session=i,this.dialect=r,this.config={table:e,values:t,withList:n,select:s,columnList:o}}returning(e=this.config.table[iC.Symbol.Columns]){return this.config.returning=eQ(e,void 0,this.dialect.codecs),this}onConflictDoNothing(e={}){if(this.config.onConflict||(this.config.onConflict=[]),void 0===e.target)this.config.onConflict.push(K` on conflict do nothing`);else{let t=Array.isArray(e.target)?K`${e.target}`:K`${[e.target]}`,i=e.where?K` where ${e.where}`:K``;this.config.onConflict.push(K` on conflict ${t} do nothing${i}`)}return this}onConflictDoUpdate(e){if(e.where&&(e.targetWhere||e.setWhere))throw Error('You cannot use both "where" and "targetWhere"/"setWhere" at the same time - "where" is deprecated, use "targetWhere" or "setWhere" instead.');this.config.onConflict||(this.config.onConflict=[]);let t=e.where?K` where ${e.where}`:void 0,i=e.targetWhere?K` where ${e.targetWhere}`:void 0,r=e.setWhere?K` where ${e.setWhere}`:void 0,n=Array.isArray(e.target)?K`${e.target}`:K`${[e.target]}`,s=this.dialect.buildUpdateSet(this.config.table,eC(this.config.table,e.set));return this.config.onConflict.push(K` on conflict ${n}${i} do update set ${s}${t}${r}`),this}getSQL(e=!1){return this.dialect.buildInsertQuery(e?{...this.config,useSelectionCastCodecs:!0}:this.config)}toSQL(e=!0){return this.dialect.sqlToQuery(this.getSQL(e))}$dynamic(){return this}},iH=class extends iK{static [r]="SQLiteAsyncInsert";_prepare(e=!1){return this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL(!0)),"arrays",e,this.config.returning?"all":"run",this.config.returning?this.dialect.mapperGenerators.rows(this.config.returning,void 0):void 0,{type:"insert",tables:()=>tW(this.config.table)})}prepare(){return this._prepare(!0)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(){return this._prepare().execute()}};eL(iH,[e_]);var iG=class{prepared;sql;query;static [r]="SQLiteRaw";static[Symbol.hasInstance](e){return l(e,this)}constructor(e,t,i){this.prepared=e,this.sql=t,this.query=i}getSQL(){return this.sql}getQuery(){return this.query}_prepare(){return this.prepared}},iY=class extends iG{static [r]="SQLiteAsyncRaw";constructor(e,t,i){super(e,t,i)}execute(e){return this.prepared.execute(e)}};eL(iY,[e_]);var iX=class extends iF{static [r]="SQLiteAsyncSelect";_prepare(e=!1){let t=this.getSQL(!0),i=this.dialect.sqlToQuery(t),r=this.config.fieldsFlat,n=this.config.mapper??=this.dialect.mapperGenerators.rows(r,function(e,t){if(!t)return;let i=new Map,r=[],n=new Set;for(let{path:t,field:s,fieldType:o}of e){if(t.length<2)continue;let e=t[0];if(n.has(e)||(n.add(e),r.push(e)),"Column"!==o)continue;let l=s.table[f],a=i.get(e);void 0===a?i.set(e,l):!1!==a&&a!==l&&i.set(e,!1)}let s=[];for(let e of r){let r=i.get(e);"string"!=typeof r||t[r]||s.push(e)}return s}(r,this.joinsNotNullableMap));return this.session.prepareQuery(i,"arrays",e,"all",n,{type:"select",tables:()=>this.getUsedTables(t)},this.cacheConfig)}prepare(){return this._prepare(!0)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(){return this._prepare().execute()}};eL(iX,[e_]);var iZ=class{table;session;dialect;withList;builder;static [r]="SQLiteUpdateBuilder";static[Symbol.hasInstance](e){return l(e,this)}constructor(e,t,i,r,n=i0){this.table=e,this.session=t,this.dialect=i,this.withList=r,this.builder=n}set(e){return new this.builder(this.table,eC(this.table,e),this.session,this.dialect,this.withList)}},i0=class{session;dialect;static [r]="SQLiteUpdate";static[Symbol.hasInstance](e){return l(e,this)}config;constructor(e,t,i,r,n){this.session=i,this.dialect=r,this.config={set:t,table:e,withList:n,joins:[]}}from(e){return this.config.from=e,this}createJoin(e){return(t,i)=>{let r=eN(t);if("string"==typeof r&&this.config.joins.some(e=>e.alias===r))throw Error(`Alias "${r}" is already used in this query`);if("function"==typeof i){let e=this.config.from?l(t,iC)?t[q.Symbol.Columns]:l(t,_)?t._.selectedFields:l(t,i_)?t[I].selectedFields:void 0:void 0;i=i(new Proxy(this.config.table[q.Symbol.Columns],new tM({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})),e&&new Proxy(e,new tM({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))}return this.config.joins.push({on:i,table:t,joinType:e,alias:r}),this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");where(e){return this.config.where=e,this}orderBy(...e){if("function"==typeof e[0]){let t=e[0](new Proxy(this.config.table[q.Symbol.Columns],new tM({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),i=Array.isArray(t)?t:[t];this.config.orderBy=i}else this.config.orderBy=e;return this}limit(e){return this.config.limit=e,this}returning(e=this.config.table[iC.Symbol.Columns]){return this.config.returning=eQ(e,void 0,this.dialect.codecs),this}getSQL(e=!1){return this.dialect.buildUpdateQuery(e?{...this.config,useSelectionCastCodecs:!0}:this.config)}toSQL(e=!0){return this.dialect.sqlToQuery(this.getSQL(e))}$dynamic(){return this}},i1=class extends i0{static [r]="SQLiteAsyncUpdate";_prepare(e=!1){return this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL(!0)),"arrays",e,this.config.returning?"all":"run",this.config.returning?this.dialect.mapperGenerators.rows(this.config.returning,void 0):void 0,{type:"update",tables:()=>tW(this.config.table)})}prepare(){return this._prepare(!0)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(){return this.config.returning?this.all():this.run()}};eL(i1,[e_]);var i2=class{resultKind;dialect;session;forbidJsonb;static [r]="BaseSQLiteDatabase";static[Symbol.hasInstance](e){return l(e,this)}query;constructor(e,t,i,r,n){for(let[s,o]of(this.resultKind=e,this.dialect=t,this.session=i,this.forbidJsonb=n,this._={relations:r,session:i,resultKind:e},this.query={},Object.entries(r)))this.query[s]=new tz(e,r,r[o.name].table,o,t,i,n,"sync"===e?tR:tV);this.$cache={invalidate:async e=>{}}}$with=(e,t)=>{let i=this;return{as:r=>("function"==typeof r&&(r=r(new iM(i.dialect))),new Proxy(new k(r.getSQL(),t??("getSelectedFields"in r?r.getSelectedFields()??{}:{}),e,!0),new tM({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"})))}};$count(e,t){return"async"===this.resultKind?new eO({source:e,filters:t,session:this.session,dialect:this.dialect}):new eF({source:e,filters:t,session:this.session,dialect:this.dialect})}with(...e){let t=this;return{select:function(i){return new iO({fields:i??void 0,session:t.session,dialect:t.dialect,withList:e},iX)},selectDistinct:function(i){return new iO({fields:i??void 0,session:t.session,dialect:t.dialect,withList:e,distinct:!0},iX)},update:function(i){return new iZ(i,t.session,t.dialect,e,i1)},insert:function(i,...r){return new iW(i,t.session,t.dialect,e,r.length?r:void 0,iH)},delete:function(i){return new iT(i,t.session,t.dialect,e)}}}select(e){return new iO({fields:e??void 0,session:this.session,dialect:this.dialect},iX)}selectDistinct(e){return new iO({fields:e??void 0,session:this.session,dialect:this.dialect,distinct:!0},iX)}update(e){return new iZ(e,this.session,this.dialect,void 0,i1)}$cache;insert(e,...t){return new iW(e,this.session,this.dialect,void 0,t.length?t:void 0,iH)}delete(e){return new iT(e,this.session,this.dialect)}run(e){let t="string"==typeof e?K.raw(e):e.getSQL(),i=this.dialect.sqlToQuery(t),r=this.session.prepareQuery(i,"raw",!1,"run");return"async"===this.resultKind?new iY(r,t,i):this.session.run(t)}all(e,t){let i="string"==typeof e?K.raw(e):e.getSQL(),r=this.dialect.sqlToQuery(i),n=this.session.prepareQuery(r,t??"objects",!1,"all");return"async"===this.resultKind?new iY(n,i,r):"arrays"===t?this.session.arrays(i):this.session.objects(i)}get(e,t){let i="string"==typeof e?K.raw(e):e.getSQL(),r=this.dialect.sqlToQuery(i),n=this.session.prepareQuery(r,t??"objects",!1,"get");return"async"===this.resultKind?new iY(n,i,r):"arrays"===t?this.session.array(i):this.session.object(i)}values(e){let t="string"==typeof e?K.raw(e):e.getSQL(),i=this.dialect.sqlToQuery(t),r=this.session.prepareQuery(i,"arrays",!1,"values");return"async"===this.resultKind?new iY(r,t,i):this.session.arrays(t)}transaction(e,t){return this.session.transaction(e,t)}},i6=class{static [r]="Cache";static[Symbol.hasInstance](e){return l(e,this)}},i8=class extends i6{static [r]="NoopCache";strategy(){return"all"}async get(e){}async put(e,t,i,r){}async onMutate(e){}};let i4=async(e,t,i,r)=>{if(!i)return{type:"skip"};let{type:n}=i;if("insert"===n||"update"===n||"delete"===n){let e=i.tables();return e.length>0?{type:"invalidate",tables:e}:{type:"skip"}}return r&&r.enabled&&"select"===n?{type:"try",key:r.tag??await ri(e,t),isTag:void 0!==r.tag,autoInvalidate:r.autoInvalidate,tables:i.tables(),config:r.config}:{type:"skip"}},i5=new Uint32Array([0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,0xe49b69c1,0xefbe4786,0xfc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x6ca6351,0x14292967,0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2]);function i7(e,t){return e>>>t|e<<32-t}let i3=(()=>{let e=Array(256);for(let t=0;t<256;t++)e[t]=t.toString(16).padStart(2,"0");return e})(),i9=(()=>{let e=new Uint8Array(512);for(let t=0;t<256;t++)e[2*t]=i3[t].charCodeAt(0),e[2*t+1]=i3[t].charCodeAt(1);return e})();function re(e){if(e.length>65536)return function(e){let t=new Uint8Array(2*e.length);for(let i=0,r=0;i<e.length;i++,r+=2){let n=2*e[i];t[r]=i9[n],t[r+1]=i9[n+1]}let i=[];for(let e=0;e<t.length;e+=16384)i.push(String.fromCharCode.apply(null,t.subarray(e,e+16384)));return i.join("")}(e);let t="";for(let i=0;i<e.length;i++)t+=i3[e[i]];return t}let rt={Uint8Array:"",Int8Array:"i8",Uint8ClampedArray:"u8c",Int16Array:"i16",Uint16Array:"u16",Int32Array:"i32",Uint32Array:"u32",Float16Array:"f16",Float32Array:"f32",Float64Array:"f64",BigInt64Array:"i64",BigUint64Array:"u64",DataView:"dv"};async function ri(e,r){let n=`${e}-${function e(t){switch(typeof t){case"undefined":return"u";case"string":return"s"+JSON.stringify(t);case"number":return"d"+String(t);case"bigint":return"b"+t.toString();case"boolean":return t?"t":"f";case"object":{if(null===t)return"n";if(Array.isArray(t))return"a["+t.map(e).join(",")+"]";if(ArrayBuffer.isView(t)){let e=Object.prototype.toString.call(t).slice(8,-1);return"y"+(rt[e]??e)+":"+re(new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}if("function"==typeof t.toJSON)return"J"+e(t.toJSON());let i=Object.keys(t),r="o{";for(let n=0;n<i.length;n++){let s=i[n];r+=(n?",":"")+JSON.stringify(s)+":"+e(t[s])}return r+"}"}default:return"x"+String(t)}}(r)}`,s=function(){let e;if(void 0!==t)return t;try{let t=globalThis.process?.getBuiltinModule?.("node:crypto");e="function"==typeof t?.createHash?t.createHash:null}catch{e=null}return t=e}();if(s)return s("sha256").update(n).digest("hex");let o=(i??=new TextEncoder).encode(n),l=void 0!==globalThis.crypto?globalThis.crypto.subtle:void 0;return re(l?new Uint8Array(await l.digest("SHA-256",o)):function(e){let t=new Uint32Array([0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19]),i=e.length,r=new Uint8Array(64*Math.ceil((i+9)/64));r.set(e),r[i]=128;let n=new DataView(r.buffer),s=8*i;n.setUint32(r.length-8,Math.floor(s/0x100000000)),n.setUint32(r.length-4,s>>>0);let o=new Uint32Array(64);for(let e=0;e<r.length;e+=64){for(let t=0;t<16;t++)o[t]=n.getUint32(e+4*t);for(let e=16;e<64;e++){let t=o[e-15],i=o[e-2],r=i7(t,7)^i7(t,18)^t>>>3,n=i7(i,17)^i7(i,19)^i>>>10;o[e]=o[e-16]+r+o[e-7]+n>>>0}let i=t[0],r=t[1],s=t[2],l=t[3],a=t[4],c=t[5],u=t[6],h=t[7];for(let e=0;e<64;e++){let t=h+(i7(a,6)^i7(a,11)^i7(a,25))+(a&c^~a&u)+i5[e]+o[e]>>>0,n=(i7(i,2)^i7(i,13)^i7(i,22))+(i&r^i&s^r&s)>>>0;h=u,u=c,c=a,a=l+t>>>0,l=s,s=r,r=i,i=t+n>>>0}t[0]=t[0]+i,t[1]=t[1]+r,t[2]=t[2]+s,t[3]=t[3]+l,t[4]=t[4]+a,t[5]=t[5]+c,t[6]=t[6]+u,t[7]=t[7]+h}let l=new Uint8Array(32),a=new DataView(l.buffer);for(let e=0;e<8;e++)a.setUint32(4*e,t[e]);return l}(o))}var rr=class{query;mode;static [r]="SQLiteBasePreparedQuery";static[Symbol.hasInstance](e){return l(e,this)}mapper;executeMethod;constructor(e,t,i,r){this.query=t,this.mode=r,this.mapper=i,this.executeMethod=e}getQuery(){return this.query}},rn=class{dialect;static [r]="SQLiteSession";static[Symbol.hasInstance](e){return l(e,this)}constructor(e){this.dialect=e}},rs=class extends e_{resultCb;static [r]="ExecuteResultSync";constructor(e){super(),this.resultCb=e}async execute(){return this.resultCb()}sync(){return this.resultCb()}},ro=class extends rr{resultKind;executors;logger;cache;queryMetadata;cacheConfig;paramsInErrors;static [r]="SQLiteAsyncPreparedQuery";fastPath;constructor(e,t="all",i,r,n,s,o,a,c,u,h){super(t,r,n,s),this.resultKind=e,this.executors=i,this.logger=o,this.cache=a,this.queryMetadata=c,this.cacheConfig=u,this.paramsInErrors=h,a&&"all"===a.strategy()&&void 0===u&&(this.cacheConfig={enabled:!0,autoInvalidate:!0}),this.cacheConfig?.enabled||(this.cacheConfig=void 0),this.fastPath=void 0===u&&(void 0===a||l(a,i8))}async queryWithCache(e,t,i,r){let n=void 0===this.cache||l(this.cache,i8)?{type:"skip"}:await i4(e,t,this.queryMetadata,this.cacheConfig);if("skip"===n.type)return r().catch(i=>{throw new h(e,this.paramsInErrors?t:void 0,i)});let s=this.cache;if("invalidate"===n.type)return r().then(async e=>(await s.onMutate({tables:n.tables}),e)).catch(i=>{throw new h(e,this.paramsInErrors?t:void 0,i)});if("try"===n.type){let{tables:o,key:l,isTag:a,autoInvalidate:c,config:u}=n,d=`${i}_${l}`,f=await s.get(d,o,a,c);if(void 0===f){let i=await r().catch(i=>{throw new h(e,this.paramsInErrors?t:void 0,i)});return await s.put(d,i,c?o:[],a,u),i}return f}throw Error("Didn't expect to get here")}run(e={}){let{query:t,logger:i,executors:r,fastPath:n,resultKind:s}=this,o=t._sql?t._sql.join(" "):t.sql,l=0===t.params.length?t.params:ee(t.params,e);if(i.logQuery(o,l),"sync"===s)try{return r.run(l)}catch(e){throw new h(o,this.paramsInErrors?l:void 0,e)}return n?r.run(l).catch(e=>{throw new h(o,this.paramsInErrors?l:void 0,e)}):this.queryWithCache(o,l,"run",()=>r.run(l))}all(e={}){let{query:t,logger:i,executors:r,mapper:n,fastPath:s,resultKind:o}=this,l=t._sql?t._sql.join(" "):t.sql,a=0===t.params.length?t.params:ee(t.params,e);if(i.logQuery(l,a),"sync"===o){let e;try{e=r.all(a)}catch(e){throw new h(l,this.paramsInErrors?a:void 0,e)}return n?n(e):e}let c=s?r.all(a).catch(e=>{throw new h(l,this.paramsInErrors?a:void 0,e)}):this.queryWithCache(l,a,"all",()=>r.all(a));return n?c.then(e=>n(e)):c}get(e={}){let{query:t,logger:i,executors:r,mapper:n,fastPath:s,resultKind:o}=this,l=t._sql?t._sql.join(" "):t.sql,a=0===t.params.length?t.params:ee(t.params,e);if(i.logQuery(l,a),"sync"===o){let e;try{e=r.get(a)}catch(e){throw new h(l,this.paramsInErrors?a:void 0,e)}return e?n?n([e])[0]:e:void 0}let c=s?r.get(a).catch(e=>{throw new h(l,this.paramsInErrors?a:void 0,e)}):this.queryWithCache(l,a,"get",()=>r.get(a));return n?c.then(e=>e?n([e])[0]:void 0):c.then(e=>e||void 0)}values(e={}){let{query:t,logger:i,executors:r,fastPath:n,resultKind:s}=this,o=t._sql?t._sql.join(" "):t.sql,l=0===t.params.length?t.params:ee(t.params,e);if(i.logQuery(o,l),"sync"===s)try{return r.all(l)}catch(e){throw new h(o,this.paramsInErrors?l:void 0,e)}return n?r.all(l).catch(e=>{throw new h(o,this.paramsInErrors?l:void 0,e)}):this.queryWithCache(o,l,"values",()=>r.all(l))}execute(e){return"async"===this.resultKind?this[this.executeMethod](e):new rs(()=>this[this.executeMethod](e))}},rl=class extends rn{resultKind;static [r]="SQLiteAsyncSession";constructor(e,t){super(e),this.resultKind=t}run(e){return this.prepareQuery(this.dialect.sqlToQuery(e),"raw",!1).run()}objects(e){return this.prepareQuery(this.dialect.sqlToQuery(e),"objects",!1).all()}object(e){return this.prepareQuery(this.dialect.sqlToQuery(e),"objects",!1).get()}arrays(e){return this.prepareQuery(this.dialect.sqlToQuery(e),"arrays",!1).all()}array(e){return this.prepareQuery(this.dialect.sqlToQuery(e),"arrays",!1).get()}},ra=class extends i2{nestedIndex;static [r]="SQLiteAsyncTransaction";constructor(e,t,i,r,n=0,s){super(e,t,i,r,s),this.nestedIndex=n}rollback(){throw new d}},rc=class extends rl{client;relations;options;static [r]="SQLJsSession";logger;constructor(e,t,i,r={}){super(t,"sync"),this.client=e,this.relations=i,this.options=r,this.logger=r.logger??new eS}prepareQuery(e,t,i,r,n,s){let o;try{o=this.client.prepare(e.sql)}catch(t){throw new h(e.sql,this.options.paramsInErrors?e.params:void 0,t)}return new ro("sync",r,{all:e=>{o.setReturnArrays("arrays"===t);let i=o.all(...e);return"objects"===t?i.map(e=>({...e})):i},get:e=>{o.setReturnArrays("arrays"===t);let i=o.get(...e);return i&&"objects"===t?{...i}:i},run:e=>(o.setReturnArrays(!1),o.run(...e))},e,n,t,this.logger,void 0,s,void 0,this.options.paramsInErrors)}transaction(e,t={}){if(t?.behavior==="concurrent")throw Error("Concurrent transactions are not supported by driver");let i=new ru("sync",this.dialect,this,this.relations);this.run(K.raw(`begin${t.behavior?` ${t.behavior}`:""}`));try{let t=e(i);return this.run(K`commit`),t}catch(e){try{this.run(K`rollback`)}catch{}throw e}}},ru=class e extends ra{static [r]="SQLJsTransaction";transaction(t){let i=`sp${this.nestedIndex+1}`,r=new e("sync",this.dialect,this.session,this._.relations,this.nestedIndex+1);r.run(K.raw(`savepoint ${i}`));try{let e=t(r);return r.run(K.raw(`release savepoint ${i}`)),e}catch(e){try{r.run(K.raw(`rollback to savepoint ${i}`))}catch{}throw e}}},rh=e.x("node:sqlite",()=>require("node:sqlite"),!0),rd=class extends i2{static [r]="NodeSQLiteDatabase"};function rf(e,t={}){let i,r=new iR({codecs:t.codecs??ey,useJitMappers:function(e){if(!e)return!1;try{let e=new e$("input",'"use strict"; return input;')(!0);return!0!==e&&(console.warn("Unable to use jit mappers due to incompatibility: corrupted jit function output.\nFalling back to premade mappers.\nError details:"),console.error(`Expected to receive \`true\`, got: ${e}`)),!0}catch(e){return console.warn("Unable to use jit mappers due to incompatibility.\nFalling back to premade mappers.\nError details:"),console.error(e),!1}}(t.jit)});!0===t.logger?i=new ev:!1!==t.logger&&(i=t.logger);let n=t.relations??{},s=new rd("sync",r,new rc(e,r,n,{logger:i,paramsInErrors:t.paramsInErrors}),n);return s.$client=e,s}function rm(...e){if(void 0===e[0]||"string"==typeof e[0])return rf(new rh.DatabaseSync(void 0===e[0]?":memory:":e[0]),e[1]);let{connection:t,client:i,...r}=e[0];if(i)return rf(i,r);if("object"==typeof t){let{path:e,...i}=t;return rf(new rh.DatabaseSync(e??":memory:",i),r)}return rf(new rh.DatabaseSync(t??":memory:"),r)}(rm||(rm={})).mock=function(e){return rf({},e)},e.s(["f",0,rm],60944);var rp=class{name;static [r]="SQLiteViewBuilderCore";static[Symbol.hasInstance](e){return l(e,this)}constructor(e){this.name=e}config={}},rg=class extends rp{static [r]="SQLiteViewBuilder";as(e){"function"==typeof e&&(e=e(new iM));let t=new tM({alias:this.name,sqlBehavior:"error",sqlAliasedBehavior:"alias",replaceOriginalName:!0}),i=e.getSelectedFields();return new Proxy(new ry({config:{name:this.name,schema:void 0,selectedFields:i,query:e.getSQL().inlineParams()}}),t)}},rb=class extends rp{static [r]="SQLiteManualViewBuilder";columns;constructor(e,t,i){super(e),this.columns=eI(iL(e,t,void 0,void 0,i))}existing(){return new Proxy(new ry({config:{name:this.name,schema:void 0,selectedFields:this.columns,query:void 0}}),new tM({alias:this.name,sqlBehavior:"error",sqlAliasedBehavior:"alias",replaceOriginalName:!0}))}as(e){return new Proxy(new ry({config:{name:this.name,schema:void 0,selectedFields:this.columns,query:e.inlineParams()}}),new tM({alias:this.name,sqlBehavior:"error",sqlAliasedBehavior:"alias",replaceOriginalName:!0}))}},ry=class extends i_{static [r]="SQLiteView";constructor({config:e}){super(e)}};function rw(e){return(t,i)=>i?new rb(t,i,e):new rg(t)}rw(void 0);let rv={table:iI("snake_case"),view:rw("snake_case")};iI("camelCase"),rw("camelCase"),e.s(["f",0,rv],14036);let rS=rv.table("dns_records",{hostname:iq().primaryKey(),zoneId:iq(),recordId:iq(),tunnelId:iq(),failure:iq({enum:["unreachable","connection_lost","no_zone","taken","rejected"]}),failureDetails:iq()});e.s(["dnsRecords",0,rS],98456);let r$=rv.table("services",{id:iq().primaryKey().$defaultFn(()=>crypto.randomUUID()),name:iq().notNull(),type:iq({enum:["github","dockerhub","system"]}).notNull(),repository:iq(),branch:iq(),createdAt:iq().notNull().default(K`(CURRENT_TIMESTAMP)`),updatedAt:iq().notNull().default(K`(CURRENT_TIMESTAMP)`).$onUpdate(()=>K`(CURRENT_TIMESTAMP)`)});e.s(["services",0,r$],22317);let rx=rv.table("domains",{hostname:iq().primaryKey(),serviceId:iq().notNull().references(()=>r$.id,{onDelete:"cascade",onUpdate:"restrict"}),port:ia({mode:"number"}).notNull(),createdAt:iq().notNull().default(K`(CURRENT_TIMESTAMP)`)});e.s(["domains",0,rx],58456);var rq=class{static [r]="SQLitePrimaryKeyBuilder";static[Symbol.hasInstance](e){return l(e,this)}columns;name;constructor(e,t){this.columns=e,this.name=t}build(e){return new rQ(e,this.columns,this.name)}},rQ=class{table;static [r]="SQLitePrimaryKey";static[Symbol.hasInstance](e){return l(e,this)}columns;name;isNameExplicit;constructor(e,t,i){this.table=e,this.columns=t,this.name=i,this.isNameExplicit=!!i}getName(){return this.name??`${this.table[iC.Symbol.Name]}_${this.columns.map(e=>e.name).join("_")}_pk`}};e.s(["f",0,function(...e){return e[0].columns?new rq(e[0].columns,e[0].name):new rq(e)}],1440)},61721,e=>{"use strict";function t({scope:e}){return"build"===e||"both"===e}function i(e){return Object.fromEntries(e.map(({key:e,value:t})=>[e,t]))}e.s(["E",0,["build","runtime","both"],"F",0,function(e=[]){return i(e.filter(e=>t(e)&&!e.isSecret))},"l",0,function(e=[]){return i(e.filter(e=>t(e)&&e.isSecret))},"w",0,function(e=[]){return i(e.filter(({scope:e})=>"runtime"===e||"both"===e))}])},82291,57156,87516,e=>{"use strict";var t=e.i(2157),i=e.i(60526),r=e.i(50227),n=e.x("node:sqlite",()=>require("node:sqlite"),!0),s=e.i(60944),o=e.i(79822),l=e.i(98456),a=e.i(58456),c=e.i(37540),u=e.i(1440),h=e.i(14036),d=e.i(80568),f=e.i(61721),m=e.i(22317);let p=h.f.table("environment_variables",{serviceId:(0,d.f)().notNull().references(()=>m.services.id,{onDelete:"cascade",onUpdate:"restrict"}),key:(0,d.f)().notNull(),value:(0,d.f)().notNull(),scope:(0,d.f)({enum:f.E}).notNull().default("runtime"),isSecret:(0,c.f)({mode:"boolean"}).notNull().default(!1)},e=>[(0,u.f)({columns:[e.serviceId,e.key]})]);e.s(["environmentVariables",0,p],37214);let g=h.f.table("ports",{serviceId:(0,d.f)().notNull().references(()=>m.services.id,{onDelete:"cascade",onUpdate:"restrict"}),external:(0,c.f)({mode:"number"}).notNull(),internal:(0,c.f)({mode:"number"}).notNull()},e=>[(0,u.f)({columns:[e.serviceId,e.external]})]);e.s(["ports",0,g],57536);var b=e.i(18899);let y=h.f.table("settings",{key:(0,d.f)().primaryKey(),value:(0,d.f)().notNull(),createdAt:(0,d.f)().notNull().default(b.B`(CURRENT_TIMESTAMP)`),updatedAt:(0,d.f)().notNull().default(b.B`(CURRENT_TIMESTAMP)`).$onUpdate(()=>b.B`(CURRENT_TIMESTAMP)`)});e.s(["settings",0,y],57156);var w=e.i(44988),v=class{name;unique;static [w.h]="SQLiteIndexBuilderOn";static[Symbol.hasInstance](e){return(0,w.f)(e,this)}constructor(e,t){this.name=e,this.unique=t}on(...e){return new S(this.name,e,this.unique)}},S=class{static [w.h]="SQLiteIndexBuilder";static[Symbol.hasInstance](e){return(0,w.f)(e,this)}config;constructor(e,t,i){this.config={name:e,columns:t,unique:i,where:void 0}}where(e){return this.config.where=e,this}build(e){return new $(this.config,e)}},$=class{static [w.h]="SQLiteIndex";static[Symbol.hasInstance](e){return(0,w.f)(e,this)}config;isNameExplicit;constructor(e,t){this.config={...e,table:t},this.isNameExplicit=!!e.name}};let x=h.f.table("users",{id:(0,c.f)({mode:"number"}).primaryKey(),login:(0,d.f)().notNull(),avatar:(0,d.f)().notNull(),role:(0,d.f)({enum:["admin","member"]}).notNull(),createdAt:(0,d.f)().notNull().default(b.B`(CURRENT_TIMESTAMP)`)},e=>[new v("users_single_admin",!0).on(e.role).where(b.B`role = 'admin'`)]);e.s(["users",0,x],87516);let q=h.f.table("volumes",{id:(0,d.f)().primaryKey().$defaultFn(()=>crypto.randomUUID()),serviceId:(0,d.f)().notNull().references(()=>m.services.id,{onDelete:"cascade",onUpdate:"restrict"}),name:(0,d.f)().notNull(),containerPath:(0,d.f)().notNull()});e.s(["volumes",0,q],84),e.i(37214),e.i(57536),e.i(57156),e.i(87516),e.i(84),e.s(["dnsRecords",()=>l.dnsRecords,"domains",()=>a.domains,"environmentVariables",0,p,"ports",0,g,"services",()=>m.services,"settings",0,y,"users",0,x,"volumes",0,q],54298);var Q=e.i(54298);let j=(0,o.x)(Q,e=>({services:{volumes:e.many.volumes(),ports:e.many.ports(),environmentVariables:e.many.environmentVariables(),domains:e.many.domains()},volumes:{service:e.one.services({from:e.volumes.serviceId,to:e.services.id})},ports:{service:e.one.services({from:e.ports.serviceId,to:e.services.id})},domains:{service:e.one.services({from:e.domains.serviceId,to:e.services.id})},environmentVariables:{service:e.one.services({from:e.environmentVariables.serviceId,to:e.services.id})}})),A=new n.DatabaseSync(function(){if(process.env.BUTTLER_DB_PATH)return process.env.BUTTLER_DB_PATH;let e=r.default.resolve((0,i.homedir)(),".buttler");return t.default.existsSync(e)||t.default.mkdirSync(e,{recursive:!0}),r.default.resolve(e,"database.sqlite")}()),C=(0,s.f)({client:A,relations:j});e.s(["f",0,C],82291)}];
|
|
17
|
+
Hint: you can specify "alias" on both sides of the relation with the same value`);if(!(o=e[0]))throw Error(`${b}: not enough data provided to build the relation - "from"/"to" are not defined, and no reverse relation of table "${a}" with target table "${i}" was found`)}if(!o.sourceColumns||!o.targetColumns)throw Error(`${b}: not enough data provided to build the relation - "from"/"to" are not defined, and reverse relation "${a}.${o.fieldName}" does not have "from"/"to" defined`);s.sourceColumns=o.targetColumns,s.targetColumns=o.sourceColumns,s.through=o.through?{source:o.through.target,target:o.through.source}:void 0,s.throughTable=o.throughTable,s.isFilterReversed=g===tJ,s.where=g===tJ?o.where:g}return e}(n,i)},"s",0,tD,"J",0,tw,"M",0,tv,"r",0,tN,"F",0,tk,"f",0,tb,"k",0,tg,"p",0,tp,"S",0,tO,"A",0,tI],79822);var tz=class{mode;schema;table;tableConfig;dialect;session;forbidJsonb;builder;static [r]="SQLiteRelationalQueryBuilderV2";static[Symbol.hasInstance](e){return l(e,this)}constructor(e,t,i,r,n,s,o,l=tU){this.mode=e,this.schema=t,this.table=i,this.tableConfig=r,this.dialect=n,this.session=s,this.forbidJsonb=o,this.builder=l}findMany(e){return new this.builder(this.mode,this.schema,this.table,this.tableConfig,this.dialect,this.session,e??!0,"many",this.forbidJsonb)}findFirst(e){return new this.builder(this.mode,this.schema,this.table,this.tableConfig,this.dialect,this.session,e??!0,"first",this.forbidJsonb)}},tU=class{schema;tableConfig;dialect;session;config;forbidJsonb;static [r]="SQLiteRelationalQueryV2";static[Symbol.hasInstance](e){return l(e,this)}mapper;mode;table;resultKind;constructor(e,t,i,r,n,s,o,l,a){this.schema=t,this.tableConfig=r,this.dialect=n,this.session=s,this.config=o,this.forbidJsonb=a,this.resultKind=e,this.mode=l,this.table=i}getSQL(){return this._getQuery().sql}_getQuery(e){let t=this.forbidJsonb?K`json`:K`jsonb`;return this.dialect.buildRelationalQuery({schema:this.schema,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,mode:this.mode,jsonb:t,usedTables:e})}_toSQL(){let e=tp(this.config),t=this._getQuery(e);return{query:t,builtQuery:this.dialect.sqlToQuery(t.sql),usedTables:e}}toSQL(){return this._toSQL().builtQuery}},tV=class extends tU{static [r]="SQLiteAsyncRelationalQueryV2";_prepare(e=!1){let{query:t,builtQuery:i,usedTables:r}=this._toSQL(),n=this.mapper??=this.dialect.mapperGenerators.relationalRows({isFirst:"first"===this.mode,parseJson:!0,parseJsonIfString:!1,rootJsonMappers:!1,selection:t.selection,arrayModeRoot:!0});return this.session.prepareQuery(i,"arrays",e,"all",n,tg(this.config,t.sql,r,this),tb(this.config))}prepare(){return this._prepare(!0)}async execute(e){return this._prepare().execute(e)}},tR=class extends tV{static [r]="SQLiteSyncRelationalQueryV2";sync(e){return this._prepare().execute(e).sync()}};eL(tV,[e_]);var tM=class e{static [r]="SelectionProxyHandler";static[Symbol.hasInstance](e){return l(e,this)}config;constructor(e){this.config={...e}}get(t,i,r){if("_"===i)return{...t._,selectedFields:new Proxy(t._.selectedFields,this)};if(i===I)return{...t[I],selectedFields:new Proxy(t[I].selectedFields,this)};if("symbol"==typeof i)return t[i];let n=D(t),s=(J(t,n,B.subquery)?t._.selectedFields:J(t,n,B.view)?t[I].selectedFields:t)[i];if(void 0===s&&"getSQL"===i){let e=t[i];return"function"!=typeof e?e:e.bind(r??t)}let o=D(s);if(J(s,o,B.aliased)){if("sql"===this.config.sqlAliasedBehavior&&!s.isSelectionField)return s.sql;let e=s.clone();return e.isSelectionField=!0,e.origin=this.config.alias,e}if(J(s,o,B.sql)){if("sql"===this.config.sqlBehavior)return s;throw Error(`You tried to reference "${i}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`)}return J(s,o,B.column)?this.config.alias?new Proxy(s,new eB(new Proxy(s.table,new eE(this.config.alias,this.config.replaceOriginalName??!1,!0)),!0)):s:"object"!=typeof s||null===s?s:new Proxy(s,new e(this.config))}};function tW(e){if(l(e,q))return[e[w]];let t=new Set;return et(e.queryChunks,t),[...t]}var tK=class{static [r]="ColumnBuilder";static[Symbol.hasInstance](e){return l(e,this)}config;constructor(e,t,i){this.config={name:e,keyAsName:""===e,notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:t,columnType:i,generated:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default(e){return this.config.default=e,this.config.hasDefault=!0,this}$defaultFn(e){return this.config.defaultFn=e,this.config.hasDefault=!0,this}$default(e){return this.$defaultFn(e)}$onUpdateFn(e){return this.config.onUpdateFn=e,this.config.hasDefault=!0,this}$onUpdate(e){return this.$onUpdateFn(e)}primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName(e,t){""===this.config.name&&(this.config.name=t(e))}},tH=class{static [r]="SQLiteForeignKeyBuilder";static[Symbol.hasInstance](e){return l(e,this)}reference;_onUpdate;_onDelete;constructor(e,t){this.reference=()=>{let{name:t,columns:i,foreignColumns:r}=e();return{name:t,columns:i,foreignTable:r[0].table,foreignColumns:r}},t&&(this._onUpdate=t.onUpdate,this._onDelete=t.onDelete)}onUpdate(e){return this._onUpdate=e,this}onDelete(e){return this._onDelete=e,this}build(e){return new tG(e,this)}},tG=class{table;static [r]="SQLiteForeignKey";static[Symbol.hasInstance](e){return l(e,this)}reference;onUpdate;onDelete;constructor(e,t){this.table=e,this.reference=t.reference,this.onUpdate=t._onUpdate,this.onDelete=t._onDelete}getName(){let{name:e,columns:t,foreignColumns:i}=this.reference(),r=t.map(e=>e.name),n=i.map(e=>e.name),s=[this.table[f],...r,i[0].table[f],...n];return e??`${s.join("_")}_fk`}isNameExplicit(){return!!this.reference().name}},tY=class extends tK{static [r]="SQLiteColumnBuilder";foreignKeyConfigs=[];references(e,t={}){return this.foreignKeyConfigs.push({ref:e,actions:t}),this}unique(e){return this.config.isUnique=!0,this.config.uniqueName=e,this}generatedAlwaysAs(e,t){return this.config.generated={as:e,type:"always",mode:t?.mode??"virtual"},this}buildForeignKeys(e,t){return this.foreignKeyConfigs.map(({ref:i,actions:r})=>{let n;return n=new tH(()=>({columns:[e],foreignColumns:[i()]})),r.onUpdate&&n.onUpdate(r.onUpdate),r.onDelete&&n.onDelete(r.onDelete),n.build(t)})}},tX=class extends A{static [r]="SQLiteColumn";table;constructor(e,t){super(e,t),this.table=e}},tZ=class extends tY{static [r]="SQLiteBigIntBuilder";constructor(e){super(e,"bigint int64","SQLiteBigInt")}build(e){return new t0(e,this.config)}},t0=class extends tX{static [r]="SQLiteBigInt";codec="blob:bigint";getSQLType(){return"blob"}mapToDriverValue=e=>ef(e.toString())},t1=class extends tY{static [r]="SQLiteBlobJsonBuilder";constructor(e){super(e,"object json","SQLiteBlobJson")}build(e){return new t2(e,this.config)}},t2=class extends tX{static [r]="SQLiteBlobJson";codec="blob:json";getSQLType(){return"blob"}mapToDriverValue=e=>ef(JSON.stringify(e))},t6=class extends tY{static [r]="SQLiteBlobBufferBuilder";constructor(e){super(e,"object buffer","SQLiteBlobBuffer")}build(e){return new t8(e,this.config)}},t8=class extends tX{static [r]="SQLiteBlobBuffer";codec="blob";getSQLType(){return"blob"}};function t4(e,t){let{name:i,config:r}=eT(e,t);return r?.mode==="bigint"?new tZ(i):r?.mode==="buffer"?new t6(i):new t1(i)}var t5=class extends tY{static [r]="SQLiteCustomColumnBuilder";constructor(e,t,i){super(e,"custom","SQLiteCustomColumn"),this.config.fieldConfig=t,this.config.customTypeParams=i}build(e){return new t7(e,this.config)}},t7=class extends tX{static [r]="SQLiteCustomColumn";codec;sqlName;mapFromJsonValue;jsonSelectIdentifier;constructor(e,t){super(e,t),this.sqlName=t.customTypeParams.dataType(t.fieldConfig),this.mapToDriverValue=t.customTypeParams.toDriver??this.mapToDriverValue,this.mapFromDriverValue=t.customTypeParams.fromDriver??this.mapFromDriverValue,this.mapFromJsonValue=t.customTypeParams.fromJson,this.jsonSelectIdentifier=t.customTypeParams.forJsonSelect;let i="string"==typeof t.customTypeParams.codec||void 0===t.customTypeParams.codec?t.customTypeParams.codec:t.customTypeParams.codec(t.fieldConfig);this.codec="string"==typeof i?ec(i):void 0}getSQLType(){return this.sqlName}};function t3(e){return(t,i)=>{let{name:r,config:n}=eT(t,i);return new t5(r,n,e)}}var t9=class extends tY{static [r]="SQLiteBaseIntegerBuilder";constructor(e,t,i){super(e,t,i),this.config.autoIncrement=!1}primaryKey(e){return e?.autoIncrement&&(this.config.autoIncrement=!0),this.config.hasDefault=!0,super.primaryKey()}},ie=class extends tX{static [r]="SQLiteBaseInteger";autoIncrement=this.config.autoIncrement;getSQLType(){return"integer"}},it=class extends t9{static [r]="SQLiteIntegerBuilder";constructor(e){super(e,"number int53","SQLiteInteger")}build(e){return new ii(e,this.config)}},ii=class extends ie{static [r]="SQLiteInteger";codec="integer"},ir=class extends t9{static [r]="SQLiteTimestampBuilder";constructor(e,t){super(e,"object date","SQLiteTimestamp"),this.config.mode=t}defaultNow(){return this.default(K`(cast((julianday('now') - 2440587.5)*86400000 as integer))`)}build(e){return new is(e,this.config)}},is=class extends ie{static [r]="SQLiteTimestamp";codec=`integer:${this.config.mode}`;mode=this.config.mode;mapToDriverValue=e=>{if("number"==typeof e)return e;let t=e.getTime();return"timestamp"===this.config.mode?Math.floor(t/1e3):t}},io=class extends t9{static [r]="SQLiteBooleanBuilder";constructor(e,t){super(e,"boolean","SQLiteBoolean"),this.config.mode=t}build(e){return new il(e,this.config)}},il=class extends ie{static [r]="SQLiteBoolean";codec="integer:boolean";mode=this.config.mode;mapToDriverValue=e=>+!!e};function ia(e,t){let{name:i,config:r}=eT(e,t);return r?.mode==="timestamp"||r?.mode==="timestamp_ms"?new ir(i,r.mode):r?.mode==="boolean"?new io(i,r.mode):new it(i)}e.s(["f",0,ia],37540);var ic=class extends tY{static [r]="SQLiteNumericBuilder";constructor(e){super(e,"string numeric","SQLiteNumeric")}build(e){return new iu(e,this.config)}},iu=class extends tX{static [r]="SQLiteNumeric";codec="numeric";getSQLType(){return"numeric"}},ih=class extends tY{static [r]="SQLiteNumericNumberBuilder";constructor(e){super(e,"number","SQLiteNumericNumber")}build(e){return new id(e,this.config)}},id=class extends tX{static [r]="SQLiteNumericNumber";codec="numeric:number";mapToDriverValue=String;getSQLType(){return"numeric"}},im=class extends tY{static [r]="SQLiteNumericBigIntBuilder";constructor(e){super(e,"bigint int64","SQLiteNumericBigInt")}build(e){return new ip(e,this.config)}},ip=class extends tX{static [r]="SQLiteNumericBigInt";codec="numeric:bigint";mapToDriverValue=String;getSQLType(){return"numeric"}};function ig(e,t){let{name:i,config:r}=eT(e,t),n=r?.mode;return"number"===n?new ih(i):"bigint"===n?new im(i):new ic(i)}var ib=class extends tY{static [r]="SQLiteRealBuilder";constructor(e){super(e,"number double","SQLiteReal")}build(e){return new iy(e,this.config)}},iy=class extends tX{static [r]="SQLiteReal";codec="real";getSQLType(){return"real"}};function iw(e){return new ib(e??"")}var iv=class extends tY{static [r]="SQLiteTextBuilder";constructor(e,t){super(e,t.enum?.length?"string enum":"string","SQLiteText"),this.config.enumValues=t.enum,this.config.length=t.length}build(e){return new iS(e,this.config)}},iS=class extends tX{static [r]="SQLiteText";codec="text";enumValues=this.config.enumValues;constructor(e,t){super(e,t)}getSQLType(){return`text${this.config.length?`(${this.config.length})`:""}`}},i$=class extends tY{static [r]="SQLiteTextJsonBuilder";constructor(e){super(e,"object json","SQLiteTextJson")}build(e){return new ix(e,this.config)}},ix=class extends tX{static [r]="SQLiteTextJson";codec="text:json";getSQLType(){return"text"}mapToDriverValue=e=>JSON.stringify(e)};function iq(e,t={}){let{name:i,config:r}=eT(e,t);return"json"===r.mode?new i$(i):new iv(i,r)}function iQ(e){return(e.replace(/['\u2019]/g,"").match(/[\d\p{Ll}\p{Lo}]+|[\p{Lu}]+(?![\p{Ll}\p{Lo}])|[\p{Lu}][\d\p{Ll}\p{Lo}]+/gu)??[]).map(e=>e.toLowerCase()).join("_")}function ij(e){return(e.replace(/['\u2019]/g,"").match(/[\d\p{Ll}\p{Lo}]+|[\p{Lu}]+(?![\p{Ll}\p{Lo}])|[\p{Lu}][\d\p{Ll}\p{Lo}]+/gu)??[]).reduce((e,t,i)=>e+(0===i?t.toLowerCase():`${t[0].toUpperCase()}${t.slice(1)}`),"")}e.s(["f",0,iq],80568);let iA=Symbol.for("drizzle:SQLiteInlineForeignKeys");var iC=class extends q{static [r]="SQLiteTable";static Symbol=Object.assign({},q.Symbol,{InlineForeignKeys:iA});[q.Symbol.Columns];[iA]=[];[q.Symbol.ExtraConfigBuilder]=void 0};function iL(e,t,i,r,n,s=e){let o="snake_case"===n?iQ:"camelCase"===n?ij:e=>e,l=new iC(e,r,s),a=Object.fromEntries(Object.entries("function"==typeof t?t({blob:t4,customType:t3,integer:ia,numeric:ig,real:iw,text:iq}):t).map(([e,t])=>{t.setName(e,o);let i=t.build(l).postBuild();return l[iA].push(...t.buildForeignKeys(i,l)),[e,i]})),c=Object.assign(l,a);return c[q.Symbol.Columns]=a,c[q.Symbol.ExtraConfigColumns]=a,i&&(c[iC.Symbol.ExtraConfigBuilder]=i),c}function iI(e){return(t,i,r)=>iL(t,i,r,void 0,e)}iI(void 0);var iN=class{table;session;dialect;static [r]="SQLiteDelete";static[Symbol.hasInstance](e){return l(e,this)}config;constructor(e,t,i,r){this.table=e,this.session=t,this.dialect=i,this.config={table:e,withList:r}}where(e){return this.config.where=e,this}orderBy(...e){if("function"==typeof e[0]){let t=e[0](new Proxy(this.config.table[q.Symbol.Columns],new tM({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),i=Array.isArray(t)?t:[t];this.config.orderBy=i}else this.config.orderBy=e;return this}limit(e){return this.config.limit=e,this}returning(e=this.table[iC.Symbol.Columns]){return this.config.returning=eQ(e,void 0,this.dialect.codecs),this}getSQL(e=!1){return this.dialect.buildDeleteQuery(e?{...this.config,useSelectionCastCodecs:!0}:this.config)}toSQL(e=!0){return this.dialect.sqlToQuery(this.getSQL(e))}$dynamic(){return this}},iT=class extends iN{static [r]="SQLiteAsyncDelete";_prepare(e=!1){return this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL(!0)),"arrays",e,this.config.returning?"all":"run",this.config.returning?this.dialect.mapperGenerators.rows(this.config.returning,void 0):void 0,{type:"delete",tables:()=>tW(this.config.table)})}prepare(){return this._prepare(!0)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(e){return this._prepare().execute(e)}};eL(iT,[e_]);var i_=class extends T{static [r]="SQLiteViewBase"},ik=class{static [r]="TypedQueryBuilder";static[Symbol.hasInstance](e){return l(e,this)}getSelectedFields(){return this._.selectedFields}},iO=class{builder;static [r]="SQLiteSelectBuilder";static[Symbol.hasInstance](e){return l(e,this)}fields;session;dialect;withList;distinct;constructor(e,t=iF){this.builder=t,this.fields=e.fields,this.session=e.session,this.dialect=e.dialect,this.withList=e.withList,this.distinct=e.distinct}from(e){let t,i=!!this.fields;return t=this.fields?this.fields:l(e,_)?Object.fromEntries(Object.keys(e._.selectedFields).map(t=>[t,e[t]])):l(e,i_)?e[I].selectedFields:l(e,F)?{}:eI(e),new this.builder({table:e,fields:t,isPartialSelect:i,session:this.session,dialect:this.dialect,withList:this.withList??[],distinct:this.distinct})}},iF=class extends ik{static [r]="SQLiteSelectQueryBuilder";_;config;joinsNotNullableMap;tableName;isPartialSelect;session;dialect;cacheConfig=void 0;constructor({table:e,fields:t,isPartialSelect:i,session:r,dialect:n,withList:s,distinct:o}){super(),this.config={withList:s,table:e,fields:{...t},distinct:o,setOperators:[]},this.isPartialSelect=i,this.session=r,this.dialect=n,this._={selectedFields:t,config:this.config},this.tableName=eN(e),this.joinsNotNullableMap="string"==typeof this.tableName?{[this.tableName]:!0}:{}}getUsedTables(e=this.getSQL()){return tW(e)}createJoin(e){return(t,i)=>{let r=this.tableName,n=eN(t);if("string"==typeof n&&this.config.joins?.some(e=>e.alias===n))throw Error(`Alias "${n}" is already used in this query`);if(this.config.fieldsFlat=void 0,this.config.mapper=void 0,!this.isPartialSelect&&(1===Object.keys(this.joinsNotNullableMap).length&&"string"==typeof r&&(this.config.fields={[r]:this.config.fields}),"string"==typeof n&&!l(t,F))){let e=l(t,_)?t._.selectedFields:l(t,T)?t[I].selectedFields:t[q.Symbol.Columns];this.config.fields[n]=e}if("function"==typeof i&&(i=i(new Proxy(this.config.fields,new tM({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.joins||(this.config.joins=[]),this.config.joins.push({on:i,table:t,joinType:e,alias:n}),"string"==typeof n)switch(e){case"left":this.joinsNotNullableMap[n]=!1;break;case"right":this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([e])=>[e,!1])),this.joinsNotNullableMap[n]=!0;break;case"cross":case"inner":this.joinsNotNullableMap[n]=!0;break;case"full":this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([e])=>[e,!1])),this.joinsNotNullableMap[n]=!1}return this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");crossJoin=this.createJoin("cross");createSetOperator(e,t){return i=>{let r="function"==typeof i?i(iP()):i;if(!eA(this.getSelectedFields(),r.getSelectedFields()))throw Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return this.config.setOperators.push({type:e,isAll:t,rightSelect:r}),this}}union=this.createSetOperator("union",!1);unionAll=this.createSetOperator("union",!0);intersect=this.createSetOperator("intersect",!1);except=this.createSetOperator("except",!1);addSetOperators(e){return this.config.setOperators.push(...e),this}where(e){return"function"==typeof e&&(e=e(new Proxy(this.config.fields,new tM({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.where=e,this}having(e){return"function"==typeof e&&(e=e(new Proxy(this.config.fields,new tM({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.having=e,this}groupBy(...e){if("function"==typeof e[0]){let t=e[0](new Proxy(this.config.fields,new tM({sqlAliasedBehavior:"alias",sqlBehavior:"sql"})));this.config.groupBy=Array.isArray(t)?t:[t]}else this.config.groupBy=e;return this}orderBy(...e){if("function"==typeof e[0]){let t=e[0](new Proxy(this.config.fields,new tM({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),i=Array.isArray(t)?t:[t];this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=i:this.config.orderBy=i}else this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=e:this.config.orderBy=e;return this}limit(e){return this.config.setOperators.length>0?this.config.setOperators.at(-1).limit=e:this.config.limit=e,this}offset(e){return this.config.setOperators.length>0?this.config.setOperators.at(-1).offset=e:this.config.offset=e,this}$withCache(e){return this.cacheConfig=void 0===e?{config:{},enabled:!0,autoInvalidate:!0}:!1===e?{enabled:!1}:{enabled:!0,autoInvalidate:!0,...e},this}getSQL(e=!1){return this.config.fieldsFlat??=eQ(this.config.fields,void 0,this.dialect.codecs),this.dialect.buildSelectQuery(e?{...this.config,useSelectionCastCodecs:!0}:this.config)}toSQL(e=!0){return this.dialect.sqlToQuery(this.getSQL(e))}as(e){return new Proxy(new _(this.getSQL(),this.config.fields,e),new tM({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}getSelectedFields(){return new Proxy(this.config.fields,new tM({alias:this.tableName,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}$dynamic(){return this}};function iB(e,t){return(i,r,...n)=>{let s=[r,...n].map(i=>({type:e,isAll:t,rightSelect:i}));for(let e of s)if(!eA(i.getSelectedFields(),e.rightSelect.getSelectedFields()))throw Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return i.addSetOperators(s)}}let iP=()=>({union:iE,unionAll:iD,intersect:iJ,except:iz}),iE=iB("union",!1),iD=iB("union",!0),iJ=iB("intersect",!1),iz=iB("except",!1),iU=function(e,t=4096){let i=new Map;return r=>{let n=i.get(r);return void 0===n&&(i.size>=t&&i.clear(),n=e(r),i.set(r,n)),n}}(e=>`"${e.replace(/"/g,'""')}"`),iV={json:new C("json"),object:new C("_object("),groupArray:new C("_group_array(json_object("),groupArrayClose:new C("))"),relationFrom:new C(' as "r" from ('),relationClose:new C(') as "t") as ')};var iR=class{static [r]="SQLiteDialect";static[Symbol.hasInstance](e){return l(e,this)}codecs;mapperGenerators;constructor(e){this.codecs=new el(ec,e?.codecs),this.mapperGenerators=e?.useJitMappers?{rows:ex,relationalRows:tv}:{rows:eq,relationalRows:tw}}escapeName(e){return iU(e)}escapeParam(e){return"?"}escapeString(e){return`'${e.replace(/'/g,"''")}'`}buildWithCTE(e){if(!e?.length)return;let t=e.length,i=Array(t+1),r=0;i[r++]=L["with "];for(let n=0;n<t;++n){let s=e[n];i[r++]=n<t-1?K`${K.identifier(s._.alias)} as (${s._.sql}), `:K`${K.identifier(s._.alias)} as (${s._.sql}) `}return new F(i)}buildDeleteQuery({table:e,where:t,returning:i,withList:r,limit:n,orderBy:s,useSelectionCastCodecs:o}){let l=this.buildWithCTE(r),a=i?K` returning ${this.buildSelection(i,{isSingleTable:!0,ignoreCastCodecs:!o,table:e})}`:void 0,c=t?K` where ${t}`:void 0,u=this.buildOrderBy(s),h=this.buildLimit(n);return K`${l}delete from ${e}${c}${a}${u}${h}`}buildUpdateSet(e,t){let i=e[q.Symbol.Columns],r=Object.keys(i).filter(e=>void 0!==t[e]||i[e]?.onUpdateFn!==void 0),n=r.length,s=Array(n);for(let e=0;e<r.length;++e){let o,a=r[e],c=i[a];if(void 0!==t[a])o=t[a];else{let e=c.onUpdateFn?.();o=l(e,F)?e:K.param(e,c)}s[e]=e<n-1?K`${K.identifier(c.name)} = ${o}, `:K`${K.identifier(c.name)} = ${o}`}return new F(s)}buildUpdateQuery({table:e,set:t,where:i,returning:r,withList:n,joins:s,from:o,limit:l,orderBy:a,useSelectionCastCodecs:c}){let u=this.buildWithCTE(n),h=this.buildUpdateSet(e,t),d=o&&new F([L[" from "],this.buildFromTable(o)]),f=this.buildJoins(s),m=r?K` returning ${this.buildSelection(r,{isSingleTable:!0,ignoreCastCodecs:!c,table:e})}`:void 0,p=i?K` where ${i}`:void 0,g=this.buildOrderBy(a),b=this.buildLimit(l);return K`${u}update ${e} set ${h}${d}${f}${p}${m}${g}${b}`}buildSelection(e,{isSingleTable:t=!1,ignoreCastCodecs:i=!1,table:r}={}){let{length:n}=e,s=[],o=D(r),a=r?J(r,o,B.sql)||J(r,o,B.subquery)?void 0:r[q.Symbol.IsAlias]||void 0===r[q.Symbol.Schema]?r[q.Symbol.Name]:`${r[q.Symbol.Schema]}.${r[q.Symbol.Name]}`:void 0;for(let r=0;r<n;++r){let{field:o,codecOverride:c,column:u,fieldType:h}=e[r];switch(h){case"Column":{let e;e=t?o.isAlias?K.identifier(o[Q]().name):K.identifier(o.name):o.isAlias?o[Q]():o;let r=i?e:this.codecs.apply(o,"cast",e,c);s.push(o.isAlias?K`${r} as ${o}`:r);break}case"SQL.Aliased":if(o.isSelectionField){let e=t||void 0===o.origin?K.identifier(o.fieldAlias):K`${K.identifier(o.origin)}.${K.identifier(o.fieldAlias)}`;u&&!i?s.push(this.codecs.apply(u,"cast",e,c)):s.push(e)}else{if(t&&void 0!==a){let{queryChunks:e}=o.sql,t=Array(e.length),r=!1;for(let i=0;i<e.length;++i){let n=e[i];if(l(n,A)){let{table:e}=n;if((e[q.Symbol.IsAlias]||void 0===e[q.Symbol.Schema]?e[q.Symbol.Name]:`${e[q.Symbol.Schema]}.${e[q.Symbol.Name]}`)!==a){r=!0;break}t[i]=K.identifier(n.name)}else t[i]=n}if(r)s.push(u&&!i?this.codecs.apply(u,"cast",o.sql,c):o.sql);else{let e=new F(t);o.sql.shouldInlineParams&&e.inlineParams(),s.push(u&&!i?this.codecs.apply(u,"cast",e,c):e)}}else s.push(u&&!i?this.codecs.apply(u,"cast",o.sql,c):o.sql);s.push(K` as ${K.identifier(o.fieldAlias)}`)}break;case"SQL":if(t&&void 0!==a){let{queryChunks:e}=o,t=Array(e.length),r=!1;for(let i=0;i<e.length;++i){let n=e[i];if(l(n,A)){let{table:e}=n;if((e[q.Symbol.IsAlias]||void 0===e[q.Symbol.Schema]?e[q.Symbol.Name]:`${e[q.Symbol.Schema]}.${e[q.Symbol.Name]}`)!==a){r=!0;break}t[i]=K.identifier(n.name)}else t[i]=n}if(r)s.push(u&&!i?this.codecs.apply(u,"cast",o,c):o);else{let e=new F(t);o.shouldInlineParams&&e.inlineParams(),s.push(u&&!i?this.codecs.apply(u,"cast",e,c):e)}}else s.push(u&&!i?this.codecs.apply(u,"cast",o,c):o);break;case"Subquery":if(o._.isWith)s.push(u&&!i?this.codecs.apply(u,"cast",o,c):o);else{let e=K`(${o._.sql})`;s.push(K`${u&&!i?this.codecs.apply(u,"cast",e,c):e} ${K.identifier(o._.alias)}`)}}r<n-1&&s.push(L[", "])}return new F(s)}buildJoins(e){if(!e||0===e.length)return;let t=[];if(e)for(let[i,r]of e.entries()){0===i&&t.push(L[" "]);let n=r.table,s=r.on?K` on ${r.on}`:void 0;l(n,iC)?t.push(K`${new C(r.joinType)} join ${n[q.Symbol.IsAlias]?eV(n):n}${s}`):t.push(K`${new C(r.joinType)} join ${n}${s}`),i<e.length-1&&t.push(L[" "])}return new F(t)}buildLimit(e){return"object"==typeof e||"number"==typeof e?K` limit ${e}`:void 0}buildOrderBy(e){let t=[];if(e)for(let[i,r]of e.entries())t.push(r),i<e.length-1&&t.push(L[", "]);return t.length>0?K` order by ${K.join(t)}`:void 0}buildFromTable(e){if(l(e,q)&&e[q.Symbol.IsAlias])return eV(e);if(l(e,T)&&e[I].isAlias){let t=K`${K.identifier(e[I].originalName)}`;return e[I].schema&&(t=K`${K.identifier(e[I].schema)}.${t}`),K`${t} ${K.identifier(e[I].name)}`}return e}buildSelectQuery({withList:e,fields:t,fieldsFlat:i,where:r,having:n,table:s,joins:o,orderBy:a,groupBy:c,limit:u,offset:h,distinct:d,setOperators:m,useSelectionCastCodecs:p}){let g=i??eQ(t,void 0,this.codecs),b=D(s),y=J(s,b,B.subquery)?s._.alias:J(s,b,B.view)?s[I].name:J(s,b,B.sql)?void 0:s[f];for(let e of g){let t;if(l(e.field,A)&&e.field.table[f]!==y&&(t=e.field.table,!o?.some(({alias:e})=>e===(t[q.Symbol.IsAlias]?t[f]:t[q.Symbol.BaseName])))){let t=e.field.table[f];throw Error(`Your "${e.path.join("->")}" field references a column "${t}"."${e.field.name}", but the table "${t}" is not part of the query! Did you forget to join it?`)}}let w=!o||0===o.length,v=this.buildWithCTE(e),S=d?K` distinct`:void 0,$=this.buildSelection(g,{isSingleTable:w,table:s,ignoreCastCodecs:!p||m.length>0}),x=this.buildFromTable(s),Q=this.buildJoins(o),j=r?K` where ${r}`:void 0,C=n?K` having ${n}`:void 0,N=[];if(c)for(let[e,t]of c.entries())N.push(t),e<c.length-1&&N.push(L[", "]);let T=N.length>0?K` group by ${K.join(N)}`:void 0,_=this.buildOrderBy(a),k=this.buildLimit(u),O=h?K` offset ${h}`:void 0,F=K`${v}select${S} ${$} from ${x}${Q}${j}${T}${C}${_}${k}${O}`;return m.length>0?this.buildSetOperations(F,g,p,m):F}buildSetOperations(e,t,i,r){for(let i=0;i<r.length;++i){let n=r[i];e=this.buildSetOperationQuery({leftSelect:e,setOperator:n});let s=eQ(n.rightSelect.getSelectedFields());for(let e=0;e<t.length;++e){let i=t[e],r=i.path.join("."),n=s.find(e=>e.path.join(".")===r),o=i.codecOverride??i.column?.codec,l=n.codecOverride??n.column?.codec;i.codecOverride=o&&l?eb[o]?.[l]:o}}for(let e=0;e<t.length;++e){let i=t[e];i.codec=i.codecOverride?this.codecs.get(i.column,"normalize",i.codecOverride):i.codec}return i?K`select ${this.buildSelection(t.map(e=>{if("SQL.Aliased"===e.fieldType){let t=e.field.clone();return t.isSelectionField=!0,{...e,field:t,fieldType:"SQL.Aliased"}}if("Column"===e.fieldType&&e.field.isAlias){let t=new F.Aliased(K`${K.identifier(e.field.name)}`,e.field.name);return t.isSelectionField=!0,{...e,field:t,fieldType:"SQL.Aliased"}}if("Subquery"===e.fieldType){let t=new F.Aliased(K`${e.field.getSQL()}`,e.field._.alias);return t.isSelectionField=!0,{...e,field:t,fieldType:"SQL.Aliased"}}return e}),{isSingleTable:!0,ignoreCastCodecs:!i})} from (${e}) ${K.identifier("drizzle_union")}`:e}buildSetOperationQuery({leftSelect:e,setOperator:{type:t,isAll:i,rightSelect:r,limit:n,orderBy:s,offset:o}}){let a,c=K`${e.getSQL()} `,u=K`${r.getSQL()}`;if(s&&s.length>0){let e=[];for(let t of s)l(t,tX)?e.push(K.identifier(t.name)):l(t,F)?e.push(K`${Z(t)}`):e.push(K`${t}`);a=K` order by ${K.join(e,L[", "])}`}let h="object"==typeof n||"number"==typeof n&&n>=0?K` limit ${n}`:void 0,d=new C(`${t} ${i?"all ":""}`),f=o?K` offset ${o}`:void 0;return K`${c}${d}${u}${a}${h}${f}`}buildInsertQuery({table:e,values:t,onConflict:i,returning:r,withList:n,select:s,columnList:o,useSelectionCastCodecs:a}){let c,u=e[q.Symbol.Columns],h=o?o.map(e=>[e,u[e]]):Object.entries(u),d=s&&!l(t,F)?Object.keys(t.getSelectedFields()).map(e=>[e,u[e]]):h.filter(([e,t])=>!t.shouldDisableInsert()),f=Array(2*d.length+1),m=0;f[m++]=L["("];for(let e=0;e<d.length;++e){let[,{name:t}]=d[e];f[m++]=K.identifier(t),e<d.length-1&&(f[m++]=L[", "])}f[m++]=L[")"];let p=new F(f);if(s)c=[t.getSQL()];else{let e=Array(t.length*d.length),i=0;for(let r=0;r<t.length;++r){let n=t[r];for(let t=0;t<d.length;++t){let[r,s]=d[t],o=n[r];void 0===o?void 0!==s.defaultFn?e[i++]=s.defaultFn():null!==s.default&&void 0!==s.default?e[i++]=s.default:void 0!==s.onUpdateFn?e[i++]=s.onUpdateFn():e[i++]=L.null:e[i++]=o}}c=[L["values "],new W(e,d.map(([,e])=>e))]}let g=this.buildWithCTE(n),b=new F(c),y=r?K` returning ${this.buildSelection(r,{isSingleTable:!0,ignoreCastCodecs:!a,table:e})}`:void 0,w=i?.length?K.join(i):void 0;return K`${g}insert into ${e} ${p} ${b}${w}${y}`}sqlToQuery(e,t){return e.toQuery({escapeName:this.escapeName,escapeParam:this.escapeParam,escapeString:this.escapeString,codecs:this.codecs,invokeSource:t})}buildRelationalQuery(e){let t=[],i=this.collectRelationalQuery(e,t);return{sql:new F(t),selection:i}}collectRelationalQuery({schema:e,table:t,tableConfig:i,queryConfig:r,relationWhere:n,mode:s,nested:o,errorPath:l,depth:a,through:c,jsonb:h,withSubqueries:d,usedTables:f},m){let g=[],b=!0===r?void 0:r,y=l??"",w=a??0,v=d??{subqueries:new Map,usedTables:f};w||(tE(v,t),t=eU(t,`d${w}`));let $=t[S],x="first"===s?1:b?.limit,q=b?.offset,{sql:Q}=tO(t,b,i.relations,e,v,n),j=b?.orderBy?tI(t,b.orderBy,i.relations,e,v):void 0,A=b?b.with:void 0,I=[];if(A)for(let e of Object.keys(A))A[e]&&I.push(e);let N=w?-1:m.length;w||m.push(void 0),m.push(L["select "]);let T=+!!tP($,i.table[p],g,!!o,i.name,this.codecs,m,b?.columns);if(b?.extras){let e=m.length;T&&m.push(L[", "]);let i=tN(t,b.extras,this.codecs,!!o,m);g.push(...i.selection),i.sql?++T:m.length=e}if(!T&&!I.length)throw new u({message:`No fields selected for table "${i.name}"${y?` ("${y}")`:""}`});for(let r of I){let n=A[r],s=i.relations[r];if(!s)throw new u({message:`Unknown relation "${i.name}" -> "${r}"`});let l="one"===s.relationType;tE(v,s.targetTable),tE(v,s.throughTable);let a=eU(s.targetTable,`d${w+1}`),c=s.throughTable?eU(s.throughTable,`tr${w}`):void 0,{filter:d,joinCondition:f}=tk(s,t,a,c);T++&&m.push(L[", "]);let p=m.length;m.push(void 0,iV.relationFrom);let b=this.collectRelationalQuery({table:a,mode:l?"first":"many",schema:e,queryConfig:n,tableConfig:e[s.targetTableName],relationWhere:d,nested:!0,errorPath:`${y.length?`${y}.`:""}${r}`,depth:w+1,withSubqueries:v,through:c?{table:c,condition:f}:void 0,jsonb:h},m);m.push(iV.relationClose,K.identifier(r));let S=[L["(select "],o?h:iV.json,l?iV.object:iV.groupArray];for(let e=0;e<b.length;++e){let t=b[e];e&&S.push(L[", "]),S.push(new C(this.escapeString(t.key)),L[", "]),t.selection?S.push(h,L["("],K.identifier(t.key),L[")"]):S.push(K.identifier(t.key))}S.push(l?L[")"]:iV.groupArrayClose),m[p]=new F(S),g.push({field:a,fieldType:"Nested",key:r,selection:b,isArray:!l,isOptional:(s.optional??!1)||!0!==n&&!!n.where})}return m.push(L[" from "]),tD(t,m),c&&(m.push(L[" inner join "]),tD(c.table,m),m.push(L[" on "],...c.condition)),Q&&m.push(L[" where "],...Q),j&&m.push(L[" order by "],...j),void 0!==x&&m.push(L[" limit "],x),void 0!==q&&m.push(L[" offset "],q),-1!==N&&(m[N]=this.buildWithCTE([...v.subqueries.values()])),g}},iM=class{static [r]="SQLiteQueryBuilder";static[Symbol.hasInstance](e){return l(e,this)}dialect;dialectConfig;constructor(e){this.dialect=l(e,iR)?e:void 0,this.dialectConfig=l(e,iR)?void 0:e}$with=(e,t)=>{let i=this;return{as:r=>("function"==typeof r&&(r=r(i)),new Proxy(new k(r.getSQL(),t??("getSelectedFields"in r?r.getSelectedFields()??{}:{}),e,!0),new tM({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"})))}};with(...e){let t=this;return{select:function(i){return new iO({fields:i??void 0,session:void 0,dialect:t.getDialect(),withList:e})},selectDistinct:function(i){return new iO({fields:i??void 0,session:void 0,dialect:t.getDialect(),withList:e,distinct:!0})}}}select(e){return new iO({fields:e??void 0,session:void 0,dialect:this.getDialect()})}selectDistinct(e){return new iO({fields:e??void 0,session:void 0,dialect:this.getDialect(),distinct:!0})}getDialect(){return this.dialect||(this.dialect=new iR(this.dialectConfig)),this.dialect}},iW=class{table;session;dialect;withList;columnList;builder;static [r]="SQLiteInsertBuilder";static[Symbol.hasInstance](e){return l(e,this)}constructor(e,t,i,r,n,s=iK){this.table=e,this.session=t,this.dialect=i,this.withList=r,this.columnList=n,this.builder=s}values(e){if(0===(e=Array.isArray(e)?e:[e]).length)throw Error("values() must be called with at least one value");return new this.builder(this.table,e,this.session,this.dialect,this.withList,!1,this.columnList)}select(e){let t="function"==typeof e?e(new iM):e;if(!l(t,F)){let e=Object.keys(this.table[q.Symbol.Columns]);for(let i of Object.keys(t._.selectedFields))if(!e.includes(i))throw Error(`Insert select error: column "${i}" does not exist in table "${this.table[q.Symbol.Name]}"`)}return new this.builder(this.table,t,this.session,this.dialect,this.withList,!0,this.columnList)}},iK=class{session;dialect;static [r]="SQLiteInsert";static[Symbol.hasInstance](e){return l(e,this)}config;constructor(e,t,i,r,n,s,o){this.session=i,this.dialect=r,this.config={table:e,values:t,withList:n,select:s,columnList:o}}returning(e=this.config.table[iC.Symbol.Columns]){return this.config.returning=eQ(e,void 0,this.dialect.codecs),this}onConflictDoNothing(e={}){if(this.config.onConflict||(this.config.onConflict=[]),void 0===e.target)this.config.onConflict.push(K` on conflict do nothing`);else{let t=Array.isArray(e.target)?K`${e.target}`:K`${[e.target]}`,i=e.where?K` where ${e.where}`:K``;this.config.onConflict.push(K` on conflict ${t} do nothing${i}`)}return this}onConflictDoUpdate(e){if(e.where&&(e.targetWhere||e.setWhere))throw Error('You cannot use both "where" and "targetWhere"/"setWhere" at the same time - "where" is deprecated, use "targetWhere" or "setWhere" instead.');this.config.onConflict||(this.config.onConflict=[]);let t=e.where?K` where ${e.where}`:void 0,i=e.targetWhere?K` where ${e.targetWhere}`:void 0,r=e.setWhere?K` where ${e.setWhere}`:void 0,n=Array.isArray(e.target)?K`${e.target}`:K`${[e.target]}`,s=this.dialect.buildUpdateSet(this.config.table,eC(this.config.table,e.set));return this.config.onConflict.push(K` on conflict ${n}${i} do update set ${s}${t}${r}`),this}getSQL(e=!1){return this.dialect.buildInsertQuery(e?{...this.config,useSelectionCastCodecs:!0}:this.config)}toSQL(e=!0){return this.dialect.sqlToQuery(this.getSQL(e))}$dynamic(){return this}},iH=class extends iK{static [r]="SQLiteAsyncInsert";_prepare(e=!1){return this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL(!0)),"arrays",e,this.config.returning?"all":"run",this.config.returning?this.dialect.mapperGenerators.rows(this.config.returning,void 0):void 0,{type:"insert",tables:()=>tW(this.config.table)})}prepare(){return this._prepare(!0)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(){return this._prepare().execute()}};eL(iH,[e_]);var iG=class{prepared;sql;query;static [r]="SQLiteRaw";static[Symbol.hasInstance](e){return l(e,this)}constructor(e,t,i){this.prepared=e,this.sql=t,this.query=i}getSQL(){return this.sql}getQuery(){return this.query}_prepare(){return this.prepared}},iY=class extends iG{static [r]="SQLiteAsyncRaw";constructor(e,t,i){super(e,t,i)}execute(e){return this.prepared.execute(e)}};eL(iY,[e_]);var iX=class extends iF{static [r]="SQLiteAsyncSelect";_prepare(e=!1){let t=this.getSQL(!0),i=this.dialect.sqlToQuery(t),r=this.config.fieldsFlat,n=this.config.mapper??=this.dialect.mapperGenerators.rows(r,function(e,t){if(!t)return;let i=new Map,r=[],n=new Set;for(let{path:t,field:s,fieldType:o}of e){if(t.length<2)continue;let e=t[0];if(n.has(e)||(n.add(e),r.push(e)),"Column"!==o)continue;let l=s.table[f],a=i.get(e);void 0===a?i.set(e,l):!1!==a&&a!==l&&i.set(e,!1)}let s=[];for(let e of r){let r=i.get(e);"string"!=typeof r||t[r]||s.push(e)}return s}(r,this.joinsNotNullableMap));return this.session.prepareQuery(i,"arrays",e,"all",n,{type:"select",tables:()=>this.getUsedTables(t)},this.cacheConfig)}prepare(){return this._prepare(!0)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(){return this._prepare().execute()}};eL(iX,[e_]);var iZ=class{table;session;dialect;withList;builder;static [r]="SQLiteUpdateBuilder";static[Symbol.hasInstance](e){return l(e,this)}constructor(e,t,i,r,n=i0){this.table=e,this.session=t,this.dialect=i,this.withList=r,this.builder=n}set(e){return new this.builder(this.table,eC(this.table,e),this.session,this.dialect,this.withList)}},i0=class{session;dialect;static [r]="SQLiteUpdate";static[Symbol.hasInstance](e){return l(e,this)}config;constructor(e,t,i,r,n){this.session=i,this.dialect=r,this.config={set:t,table:e,withList:n,joins:[]}}from(e){return this.config.from=e,this}createJoin(e){return(t,i)=>{let r=eN(t);if("string"==typeof r&&this.config.joins.some(e=>e.alias===r))throw Error(`Alias "${r}" is already used in this query`);if("function"==typeof i){let e=this.config.from?l(t,iC)?t[q.Symbol.Columns]:l(t,_)?t._.selectedFields:l(t,i_)?t[I].selectedFields:void 0:void 0;i=i(new Proxy(this.config.table[q.Symbol.Columns],new tM({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})),e&&new Proxy(e,new tM({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))}return this.config.joins.push({on:i,table:t,joinType:e,alias:r}),this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");where(e){return this.config.where=e,this}orderBy(...e){if("function"==typeof e[0]){let t=e[0](new Proxy(this.config.table[q.Symbol.Columns],new tM({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),i=Array.isArray(t)?t:[t];this.config.orderBy=i}else this.config.orderBy=e;return this}limit(e){return this.config.limit=e,this}returning(e=this.config.table[iC.Symbol.Columns]){return this.config.returning=eQ(e,void 0,this.dialect.codecs),this}getSQL(e=!1){return this.dialect.buildUpdateQuery(e?{...this.config,useSelectionCastCodecs:!0}:this.config)}toSQL(e=!0){return this.dialect.sqlToQuery(this.getSQL(e))}$dynamic(){return this}},i1=class extends i0{static [r]="SQLiteAsyncUpdate";_prepare(e=!1){return this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL(!0)),"arrays",e,this.config.returning?"all":"run",this.config.returning?this.dialect.mapperGenerators.rows(this.config.returning,void 0):void 0,{type:"update",tables:()=>tW(this.config.table)})}prepare(){return this._prepare(!0)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(){return this.config.returning?this.all():this.run()}};eL(i1,[e_]);var i2=class{resultKind;dialect;session;forbidJsonb;static [r]="BaseSQLiteDatabase";static[Symbol.hasInstance](e){return l(e,this)}query;constructor(e,t,i,r,n){for(let[s,o]of(this.resultKind=e,this.dialect=t,this.session=i,this.forbidJsonb=n,this._={relations:r,session:i,resultKind:e},this.query={},Object.entries(r)))this.query[s]=new tz(e,r,r[o.name].table,o,t,i,n,"sync"===e?tR:tV);this.$cache={invalidate:async e=>{}}}$with=(e,t)=>{let i=this;return{as:r=>("function"==typeof r&&(r=r(new iM(i.dialect))),new Proxy(new k(r.getSQL(),t??("getSelectedFields"in r?r.getSelectedFields()??{}:{}),e,!0),new tM({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"})))}};$count(e,t){return"async"===this.resultKind?new eO({source:e,filters:t,session:this.session,dialect:this.dialect}):new eF({source:e,filters:t,session:this.session,dialect:this.dialect})}with(...e){let t=this;return{select:function(i){return new iO({fields:i??void 0,session:t.session,dialect:t.dialect,withList:e},iX)},selectDistinct:function(i){return new iO({fields:i??void 0,session:t.session,dialect:t.dialect,withList:e,distinct:!0},iX)},update:function(i){return new iZ(i,t.session,t.dialect,e,i1)},insert:function(i,...r){return new iW(i,t.session,t.dialect,e,r.length?r:void 0,iH)},delete:function(i){return new iT(i,t.session,t.dialect,e)}}}select(e){return new iO({fields:e??void 0,session:this.session,dialect:this.dialect},iX)}selectDistinct(e){return new iO({fields:e??void 0,session:this.session,dialect:this.dialect,distinct:!0},iX)}update(e){return new iZ(e,this.session,this.dialect,void 0,i1)}$cache;insert(e,...t){return new iW(e,this.session,this.dialect,void 0,t.length?t:void 0,iH)}delete(e){return new iT(e,this.session,this.dialect)}run(e){let t="string"==typeof e?K.raw(e):e.getSQL(),i=this.dialect.sqlToQuery(t),r=this.session.prepareQuery(i,"raw",!1,"run");return"async"===this.resultKind?new iY(r,t,i):this.session.run(t)}all(e,t){let i="string"==typeof e?K.raw(e):e.getSQL(),r=this.dialect.sqlToQuery(i),n=this.session.prepareQuery(r,t??"objects",!1,"all");return"async"===this.resultKind?new iY(n,i,r):"arrays"===t?this.session.arrays(i):this.session.objects(i)}get(e,t){let i="string"==typeof e?K.raw(e):e.getSQL(),r=this.dialect.sqlToQuery(i),n=this.session.prepareQuery(r,t??"objects",!1,"get");return"async"===this.resultKind?new iY(n,i,r):"arrays"===t?this.session.array(i):this.session.object(i)}values(e){let t="string"==typeof e?K.raw(e):e.getSQL(),i=this.dialect.sqlToQuery(t),r=this.session.prepareQuery(i,"arrays",!1,"values");return"async"===this.resultKind?new iY(r,t,i):this.session.arrays(t)}transaction(e,t){return this.session.transaction(e,t)}},i6=class{static [r]="Cache";static[Symbol.hasInstance](e){return l(e,this)}},i8=class extends i6{static [r]="NoopCache";strategy(){return"all"}async get(e){}async put(e,t,i,r){}async onMutate(e){}};let i4=async(e,t,i,r)=>{if(!i)return{type:"skip"};let{type:n}=i;if("insert"===n||"update"===n||"delete"===n){let e=i.tables();return e.length>0?{type:"invalidate",tables:e}:{type:"skip"}}return r&&r.enabled&&"select"===n?{type:"try",key:r.tag??await ri(e,t),isTag:void 0!==r.tag,autoInvalidate:r.autoInvalidate,tables:i.tables(),config:r.config}:{type:"skip"}},i5=new Uint32Array([0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,0xe49b69c1,0xefbe4786,0xfc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x6ca6351,0x14292967,0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2]);function i7(e,t){return e>>>t|e<<32-t}let i3=(()=>{let e=Array(256);for(let t=0;t<256;t++)e[t]=t.toString(16).padStart(2,"0");return e})(),i9=(()=>{let e=new Uint8Array(512);for(let t=0;t<256;t++)e[2*t]=i3[t].charCodeAt(0),e[2*t+1]=i3[t].charCodeAt(1);return e})();function re(e){if(e.length>65536)return function(e){let t=new Uint8Array(2*e.length);for(let i=0,r=0;i<e.length;i++,r+=2){let n=2*e[i];t[r]=i9[n],t[r+1]=i9[n+1]}let i=[];for(let e=0;e<t.length;e+=16384)i.push(String.fromCharCode.apply(null,t.subarray(e,e+16384)));return i.join("")}(e);let t="";for(let i=0;i<e.length;i++)t+=i3[e[i]];return t}let rt={Uint8Array:"",Int8Array:"i8",Uint8ClampedArray:"u8c",Int16Array:"i16",Uint16Array:"u16",Int32Array:"i32",Uint32Array:"u32",Float16Array:"f16",Float32Array:"f32",Float64Array:"f64",BigInt64Array:"i64",BigUint64Array:"u64",DataView:"dv"};async function ri(e,r){let n=`${e}-${function e(t){switch(typeof t){case"undefined":return"u";case"string":return"s"+JSON.stringify(t);case"number":return"d"+String(t);case"bigint":return"b"+t.toString();case"boolean":return t?"t":"f";case"object":{if(null===t)return"n";if(Array.isArray(t))return"a["+t.map(e).join(",")+"]";if(ArrayBuffer.isView(t)){let e=Object.prototype.toString.call(t).slice(8,-1);return"y"+(rt[e]??e)+":"+re(new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}if("function"==typeof t.toJSON)return"J"+e(t.toJSON());let i=Object.keys(t),r="o{";for(let n=0;n<i.length;n++){let s=i[n];r+=(n?",":"")+JSON.stringify(s)+":"+e(t[s])}return r+"}"}default:return"x"+String(t)}}(r)}`,s=function(){let e;if(void 0!==t)return t;try{let t=globalThis.process?.getBuiltinModule?.("node:crypto");e="function"==typeof t?.createHash?t.createHash:null}catch{e=null}return t=e}();if(s)return s("sha256").update(n).digest("hex");let o=(i??=new TextEncoder).encode(n),l=void 0!==globalThis.crypto?globalThis.crypto.subtle:void 0;return re(l?new Uint8Array(await l.digest("SHA-256",o)):function(e){let t=new Uint32Array([0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19]),i=e.length,r=new Uint8Array(64*Math.ceil((i+9)/64));r.set(e),r[i]=128;let n=new DataView(r.buffer),s=8*i;n.setUint32(r.length-8,Math.floor(s/0x100000000)),n.setUint32(r.length-4,s>>>0);let o=new Uint32Array(64);for(let e=0;e<r.length;e+=64){for(let t=0;t<16;t++)o[t]=n.getUint32(e+4*t);for(let e=16;e<64;e++){let t=o[e-15],i=o[e-2],r=i7(t,7)^i7(t,18)^t>>>3,n=i7(i,17)^i7(i,19)^i>>>10;o[e]=o[e-16]+r+o[e-7]+n>>>0}let i=t[0],r=t[1],s=t[2],l=t[3],a=t[4],c=t[5],u=t[6],h=t[7];for(let e=0;e<64;e++){let t=h+(i7(a,6)^i7(a,11)^i7(a,25))+(a&c^~a&u)+i5[e]+o[e]>>>0,n=(i7(i,2)^i7(i,13)^i7(i,22))+(i&r^i&s^r&s)>>>0;h=u,u=c,c=a,a=l+t>>>0,l=s,s=r,r=i,i=t+n>>>0}t[0]=t[0]+i,t[1]=t[1]+r,t[2]=t[2]+s,t[3]=t[3]+l,t[4]=t[4]+a,t[5]=t[5]+c,t[6]=t[6]+u,t[7]=t[7]+h}let l=new Uint8Array(32),a=new DataView(l.buffer);for(let e=0;e<8;e++)a.setUint32(4*e,t[e]);return l}(o))}var rr=class{query;mode;static [r]="SQLiteBasePreparedQuery";static[Symbol.hasInstance](e){return l(e,this)}mapper;executeMethod;constructor(e,t,i,r){this.query=t,this.mode=r,this.mapper=i,this.executeMethod=e}getQuery(){return this.query}},rn=class{dialect;static [r]="SQLiteSession";static[Symbol.hasInstance](e){return l(e,this)}constructor(e){this.dialect=e}},rs=class extends e_{resultCb;static [r]="ExecuteResultSync";constructor(e){super(),this.resultCb=e}async execute(){return this.resultCb()}sync(){return this.resultCb()}},ro=class extends rr{resultKind;executors;logger;cache;queryMetadata;cacheConfig;paramsInErrors;static [r]="SQLiteAsyncPreparedQuery";fastPath;constructor(e,t="all",i,r,n,s,o,a,c,u,h){super(t,r,n,s),this.resultKind=e,this.executors=i,this.logger=o,this.cache=a,this.queryMetadata=c,this.cacheConfig=u,this.paramsInErrors=h,a&&"all"===a.strategy()&&void 0===u&&(this.cacheConfig={enabled:!0,autoInvalidate:!0}),this.cacheConfig?.enabled||(this.cacheConfig=void 0),this.fastPath=void 0===u&&(void 0===a||l(a,i8))}async queryWithCache(e,t,i,r){let n=void 0===this.cache||l(this.cache,i8)?{type:"skip"}:await i4(e,t,this.queryMetadata,this.cacheConfig);if("skip"===n.type)return r().catch(i=>{throw new h(e,this.paramsInErrors?t:void 0,i)});let s=this.cache;if("invalidate"===n.type)return r().then(async e=>(await s.onMutate({tables:n.tables}),e)).catch(i=>{throw new h(e,this.paramsInErrors?t:void 0,i)});if("try"===n.type){let{tables:o,key:l,isTag:a,autoInvalidate:c,config:u}=n,d=`${i}_${l}`,f=await s.get(d,o,a,c);if(void 0===f){let i=await r().catch(i=>{throw new h(e,this.paramsInErrors?t:void 0,i)});return await s.put(d,i,c?o:[],a,u),i}return f}throw Error("Didn't expect to get here")}run(e={}){let{query:t,logger:i,executors:r,fastPath:n,resultKind:s}=this,o=t._sql?t._sql.join(" "):t.sql,l=0===t.params.length?t.params:ee(t.params,e);if(i.logQuery(o,l),"sync"===s)try{return r.run(l)}catch(e){throw new h(o,this.paramsInErrors?l:void 0,e)}return n?r.run(l).catch(e=>{throw new h(o,this.paramsInErrors?l:void 0,e)}):this.queryWithCache(o,l,"run",()=>r.run(l))}all(e={}){let{query:t,logger:i,executors:r,mapper:n,fastPath:s,resultKind:o}=this,l=t._sql?t._sql.join(" "):t.sql,a=0===t.params.length?t.params:ee(t.params,e);if(i.logQuery(l,a),"sync"===o){let e;try{e=r.all(a)}catch(e){throw new h(l,this.paramsInErrors?a:void 0,e)}return n?n(e):e}let c=s?r.all(a).catch(e=>{throw new h(l,this.paramsInErrors?a:void 0,e)}):this.queryWithCache(l,a,"all",()=>r.all(a));return n?c.then(e=>n(e)):c}get(e={}){let{query:t,logger:i,executors:r,mapper:n,fastPath:s,resultKind:o}=this,l=t._sql?t._sql.join(" "):t.sql,a=0===t.params.length?t.params:ee(t.params,e);if(i.logQuery(l,a),"sync"===o){let e;try{e=r.get(a)}catch(e){throw new h(l,this.paramsInErrors?a:void 0,e)}return e?n?n([e])[0]:e:void 0}let c=s?r.get(a).catch(e=>{throw new h(l,this.paramsInErrors?a:void 0,e)}):this.queryWithCache(l,a,"get",()=>r.get(a));return n?c.then(e=>e?n([e])[0]:void 0):c.then(e=>e||void 0)}values(e={}){let{query:t,logger:i,executors:r,fastPath:n,resultKind:s}=this,o=t._sql?t._sql.join(" "):t.sql,l=0===t.params.length?t.params:ee(t.params,e);if(i.logQuery(o,l),"sync"===s)try{return r.all(l)}catch(e){throw new h(o,this.paramsInErrors?l:void 0,e)}return n?r.all(l).catch(e=>{throw new h(o,this.paramsInErrors?l:void 0,e)}):this.queryWithCache(o,l,"values",()=>r.all(l))}execute(e){return"async"===this.resultKind?this[this.executeMethod](e):new rs(()=>this[this.executeMethod](e))}},rl=class extends rn{resultKind;static [r]="SQLiteAsyncSession";constructor(e,t){super(e),this.resultKind=t}run(e){return this.prepareQuery(this.dialect.sqlToQuery(e),"raw",!1).run()}objects(e){return this.prepareQuery(this.dialect.sqlToQuery(e),"objects",!1).all()}object(e){return this.prepareQuery(this.dialect.sqlToQuery(e),"objects",!1).get()}arrays(e){return this.prepareQuery(this.dialect.sqlToQuery(e),"arrays",!1).all()}array(e){return this.prepareQuery(this.dialect.sqlToQuery(e),"arrays",!1).get()}},ra=class extends i2{nestedIndex;static [r]="SQLiteAsyncTransaction";constructor(e,t,i,r,n=0,s){super(e,t,i,r,s),this.nestedIndex=n}rollback(){throw new d}},rc=class extends rl{client;relations;options;static [r]="SQLJsSession";logger;constructor(e,t,i,r={}){super(t,"sync"),this.client=e,this.relations=i,this.options=r,this.logger=r.logger??new eS}prepareQuery(e,t,i,r,n,s){let o;try{o=this.client.prepare(e.sql)}catch(t){throw new h(e.sql,this.options.paramsInErrors?e.params:void 0,t)}return new ro("sync",r,{all:e=>{o.setReturnArrays("arrays"===t);let i=o.all(...e);return"objects"===t?i.map(e=>({...e})):i},get:e=>{o.setReturnArrays("arrays"===t);let i=o.get(...e);return i&&"objects"===t?{...i}:i},run:e=>(o.setReturnArrays(!1),o.run(...e))},e,n,t,this.logger,void 0,s,void 0,this.options.paramsInErrors)}transaction(e,t={}){if(t?.behavior==="concurrent")throw Error("Concurrent transactions are not supported by driver");let i=new ru("sync",this.dialect,this,this.relations);this.run(K.raw(`begin${t.behavior?` ${t.behavior}`:""}`));try{let t=e(i);return this.run(K`commit`),t}catch(e){try{this.run(K`rollback`)}catch{}throw e}}},ru=class e extends ra{static [r]="SQLJsTransaction";transaction(t){let i=`sp${this.nestedIndex+1}`,r=new e("sync",this.dialect,this.session,this._.relations,this.nestedIndex+1);r.run(K.raw(`savepoint ${i}`));try{let e=t(r);return r.run(K.raw(`release savepoint ${i}`)),e}catch(e){try{r.run(K.raw(`rollback to savepoint ${i}`))}catch{}throw e}}},rh=e.x("node:sqlite",()=>require("node:sqlite"),!0),rd=class extends i2{static [r]="NodeSQLiteDatabase"};function rf(e,t={}){let i,r=new iR({codecs:t.codecs??ey,useJitMappers:function(e){if(!e)return!1;try{let e=new e$("input",'"use strict"; return input;')(!0);return!0!==e&&(console.warn("Unable to use jit mappers due to incompatibility: corrupted jit function output.\nFalling back to premade mappers.\nError details:"),console.error(`Expected to receive \`true\`, got: ${e}`)),!0}catch(e){return console.warn("Unable to use jit mappers due to incompatibility.\nFalling back to premade mappers.\nError details:"),console.error(e),!1}}(t.jit)});!0===t.logger?i=new ev:!1!==t.logger&&(i=t.logger);let n=t.relations??{},s=new rd("sync",r,new rc(e,r,n,{logger:i,paramsInErrors:t.paramsInErrors}),n);return s.$client=e,s}function rm(...e){if(void 0===e[0]||"string"==typeof e[0])return rf(new rh.DatabaseSync(void 0===e[0]?":memory:":e[0]),e[1]);let{connection:t,client:i,...r}=e[0];if(i)return rf(i,r);if("object"==typeof t){let{path:e,...i}=t;return rf(new rh.DatabaseSync(e??":memory:",i),r)}return rf(new rh.DatabaseSync(t??":memory:"),r)}(rm||(rm={})).mock=function(e){return rf({},e)},e.s(["f",0,rm],60944);var rp=class{name;static [r]="SQLiteViewBuilderCore";static[Symbol.hasInstance](e){return l(e,this)}constructor(e){this.name=e}config={}},rg=class extends rp{static [r]="SQLiteViewBuilder";as(e){"function"==typeof e&&(e=e(new iM));let t=new tM({alias:this.name,sqlBehavior:"error",sqlAliasedBehavior:"alias",replaceOriginalName:!0}),i=e.getSelectedFields();return new Proxy(new ry({config:{name:this.name,schema:void 0,selectedFields:i,query:e.getSQL().inlineParams()}}),t)}},rb=class extends rp{static [r]="SQLiteManualViewBuilder";columns;constructor(e,t,i){super(e),this.columns=eI(iL(e,t,void 0,void 0,i))}existing(){return new Proxy(new ry({config:{name:this.name,schema:void 0,selectedFields:this.columns,query:void 0}}),new tM({alias:this.name,sqlBehavior:"error",sqlAliasedBehavior:"alias",replaceOriginalName:!0}))}as(e){return new Proxy(new ry({config:{name:this.name,schema:void 0,selectedFields:this.columns,query:e.inlineParams()}}),new tM({alias:this.name,sqlBehavior:"error",sqlAliasedBehavior:"alias",replaceOriginalName:!0}))}},ry=class extends i_{static [r]="SQLiteView";constructor({config:e}){super(e)}};function rw(e){return(t,i)=>i?new rb(t,i,e):new rg(t)}rw(void 0);let rv={table:iI("snake_case"),view:rw("snake_case")};iI("camelCase"),rw("camelCase"),e.s(["f",0,rv],14036);let rS=rv.table("dns_records",{hostname:iq().primaryKey(),zoneId:iq(),recordId:iq(),tunnelId:iq(),failure:iq({enum:["unreachable","connection_lost","no_zone","taken","rejected"]}),failureDetails:iq()});e.s(["dnsRecords",0,rS],98456);let r$=rv.table("services",{id:iq().primaryKey().$defaultFn(()=>crypto.randomUUID()),name:iq().notNull(),type:iq({enum:["github","dockerhub","system"]}).notNull(),repository:iq(),branch:iq(),internetAccess:ia({mode:"boolean"}).notNull().default(!0),createdAt:iq().notNull().default(K`(CURRENT_TIMESTAMP)`),updatedAt:iq().notNull().default(K`(CURRENT_TIMESTAMP)`).$onUpdate(()=>K`(CURRENT_TIMESTAMP)`)});e.s(["services",0,r$],22317);let rx=rv.table("domains",{hostname:iq().primaryKey(),serviceId:iq().notNull().references(()=>r$.id,{onDelete:"cascade",onUpdate:"restrict"}),port:ia({mode:"number"}).notNull(),createdAt:iq().notNull().default(K`(CURRENT_TIMESTAMP)`)});e.s(["domains",0,rx],58456);var rq=class{static [r]="SQLitePrimaryKeyBuilder";static[Symbol.hasInstance](e){return l(e,this)}columns;name;constructor(e,t){this.columns=e,this.name=t}build(e){return new rQ(e,this.columns,this.name)}},rQ=class{table;static [r]="SQLitePrimaryKey";static[Symbol.hasInstance](e){return l(e,this)}columns;name;isNameExplicit;constructor(e,t,i){this.table=e,this.columns=t,this.name=i,this.isNameExplicit=!!i}getName(){return this.name??`${this.table[iC.Symbol.Name]}_${this.columns.map(e=>e.name).join("_")}_pk`}};e.s(["f",0,function(...e){return e[0].columns?new rq(e[0].columns,e[0].name):new rq(e)}],1440)},61721,e=>{"use strict";function t({scope:e}){return"build"===e||"both"===e}function i(e){return Object.fromEntries(e.map(({key:e,value:t})=>[e,t]))}e.s(["E",0,["build","runtime","both"],"F",0,function(e=[]){return i(e.filter(e=>t(e)&&!e.isSecret))},"l",0,function(e=[]){return i(e.filter(e=>t(e)&&e.isSecret))},"w",0,function(e=[]){return i(e.filter(({scope:e})=>"runtime"===e||"both"===e))}])},82291,57156,87516,e=>{"use strict";var t=e.i(2157),i=e.i(60526),r=e.i(50227),n=e.x("node:sqlite",()=>require("node:sqlite"),!0),s=e.i(60944),o=e.i(79822),l=e.i(98456),a=e.i(58456),c=e.i(37540),u=e.i(1440),h=e.i(14036),d=e.i(80568),f=e.i(61721),m=e.i(22317);let p=h.f.table("environment_variables",{serviceId:(0,d.f)().notNull().references(()=>m.services.id,{onDelete:"cascade",onUpdate:"restrict"}),key:(0,d.f)().notNull(),value:(0,d.f)().notNull(),scope:(0,d.f)({enum:f.E}).notNull().default("runtime"),isSecret:(0,c.f)({mode:"boolean"}).notNull().default(!1)},e=>[(0,u.f)({columns:[e.serviceId,e.key]})]);e.s(["environmentVariables",0,p],37214);let g=h.f.table("ports",{serviceId:(0,d.f)().notNull().references(()=>m.services.id,{onDelete:"cascade",onUpdate:"restrict"}),external:(0,c.f)({mode:"number"}).notNull(),internal:(0,c.f)({mode:"number"}).notNull()},e=>[(0,u.f)({columns:[e.serviceId,e.external]})]);e.s(["ports",0,g],57536);var b=e.i(18899);let y=h.f.table("settings",{key:(0,d.f)().primaryKey(),value:(0,d.f)().notNull(),createdAt:(0,d.f)().notNull().default(b.B`(CURRENT_TIMESTAMP)`),updatedAt:(0,d.f)().notNull().default(b.B`(CURRENT_TIMESTAMP)`).$onUpdate(()=>b.B`(CURRENT_TIMESTAMP)`)});e.s(["settings",0,y],57156);var w=e.i(44988),v=class{name;unique;static [w.h]="SQLiteIndexBuilderOn";static[Symbol.hasInstance](e){return(0,w.f)(e,this)}constructor(e,t){this.name=e,this.unique=t}on(...e){return new S(this.name,e,this.unique)}},S=class{static [w.h]="SQLiteIndexBuilder";static[Symbol.hasInstance](e){return(0,w.f)(e,this)}config;constructor(e,t,i){this.config={name:e,columns:t,unique:i,where:void 0}}where(e){return this.config.where=e,this}build(e){return new $(this.config,e)}},$=class{static [w.h]="SQLiteIndex";static[Symbol.hasInstance](e){return(0,w.f)(e,this)}config;isNameExplicit;constructor(e,t){this.config={...e,table:t},this.isNameExplicit=!!e.name}};let x=h.f.table("users",{id:(0,c.f)({mode:"number"}).primaryKey(),login:(0,d.f)().notNull(),avatar:(0,d.f)().notNull(),role:(0,d.f)({enum:["admin","member"]}).notNull(),createdAt:(0,d.f)().notNull().default(b.B`(CURRENT_TIMESTAMP)`)},e=>[new v("users_single_admin",!0).on(e.role).where(b.B`role = 'admin'`)]);e.s(["users",0,x],87516);let q=h.f.table("volumes",{id:(0,d.f)().primaryKey().$defaultFn(()=>crypto.randomUUID()),serviceId:(0,d.f)().notNull().references(()=>m.services.id,{onDelete:"cascade",onUpdate:"restrict"}),name:(0,d.f)().notNull(),containerPath:(0,d.f)().notNull()});e.s(["volumes",0,q],84),e.i(37214),e.i(57536),e.i(57156),e.i(87516),e.i(84),e.s(["dnsRecords",()=>l.dnsRecords,"domains",()=>a.domains,"environmentVariables",0,p,"ports",0,g,"services",()=>m.services,"settings",0,y,"users",0,x,"volumes",0,q],54298);var Q=e.i(54298);let j=(0,o.x)(Q,e=>({services:{volumes:e.many.volumes(),ports:e.many.ports(),environmentVariables:e.many.environmentVariables(),domains:e.many.domains()},volumes:{service:e.one.services({from:e.volumes.serviceId,to:e.services.id})},ports:{service:e.one.services({from:e.ports.serviceId,to:e.services.id})},domains:{service:e.one.services({from:e.domains.serviceId,to:e.services.id})},environmentVariables:{service:e.one.services({from:e.environmentVariables.serviceId,to:e.services.id})}})),A=new n.DatabaseSync(function(){if(process.env.BUTTLER_DB_PATH)return process.env.BUTTLER_DB_PATH;let e=r.default.resolve((0,i.homedir)(),".buttler");return t.default.existsSync(e)||t.default.mkdirSync(e,{recursive:!0}),r.default.resolve(e,"database.sqlite")}()),C=(0,s.f)({client:A,relations:j});e.s(["f",0,C],82291)}];
|
|
18
18
|
|
|
19
19
|
//# sourceMappingURL=_0-08w0j6upuro._.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
module.exports=[31846,(t,e,r)=>{"use strict";function n(t){return null!==t&&"object"==typeof t&&"then"in t&&"function"==typeof t.then}Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"isThenable",{enumerable:!0,get:function(){return n}})},37571,50273,t=>{"use strict";let e="buttler.service-id";t.s(["P",0,"buttler.branch","Q",0,"buttler.built-at","C",0,"buttler.commit","B",0,"buttler.network","v",0,e,"r",0,"buttler.tunnel-id"],50273),t.s(["A",0,"buttler-nginx","G",0,function(t,r){return t.Labels[e]===r||t.Names.includes(`/buttler-service-${r}`)}],37571)},48701,t=>{"use strict";async function e(t,...r){try{await t}catch(e){let{statusCode:t}=e;if(!t||!r.includes(t))throw e}}t.s(["y",0,403,"g",0,404,"r",0,304,"W",0,e])},49158,t=>{"use strict";var e=t.i(60526),r=t.i(63400),n=t.i(16497),u=t.i(61095);function i(t){let[e,r]=t.split("/");if(!(0,u.isIPv4)(e))return null;let n=2**(32-Number(r)),i=e.split(".").reduce((t,e)=>256*t+Number(e),0),l=i-i%n;return{first:l,last:l+n-1}}let l="10.213.0.0/16",o=(0,n.f)("network-subnet-queue");async function s(){let t=await r.docker.listNetworks(),n=Object.values(e.default.networkInterfaces()).flatMap(t=>t??[]);return[...t.flatMap(t=>t.IPAM?.Config??[]).map(t=>t.Subnet),...n.map(t=>t.cidr)].filter(t=>"string"==typeof t)}t.s(["f",0,function(t){return o(async()=>{let e=function(t,e){let r=i(t);if(!r)return null;let n=e.map(i).filter(t=>null!==t);for(let t=r.first;t+8-1<=r.last;t+=8){let e=t+8-1;if(!n.some(r=>r.first<=e&&r.last>=t))return`${function(t){return[24,16,8,0].map(e=>Math.floor(t/2**e)%256).join(".")}(t)}/29`}return null}(l,await s());if(!e)throw Error(`No free subnet left in ${l} for ${t.Name}`);return r.docker.createNetwork({...t,IPAM:{Driver:"default",Config:[{Subnet:e}]}})})}],49158)},16497,t=>{"use strict";var e=t.i(81988);t.s(["f",0,function(t){let r=(0,e.f)(t,()=>({tail:Promise.resolve()}));return t=>{let e=r.tail.then(t);return r.tail=e.then(()=>void 0,()=>void 0),e}}])},81988,t=>{"use strict";t.s(["f",0,function(t,e){let r=Symbol.for(`buttler.${t}`),n=globalThis;return n[r]??=e()}])}];
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=_0nlsx2mvtyhai._.js.map
|