@kyro-cms/core 0.13.5 → 0.13.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (325) hide show
  1. package/dist/api-handler-graphql.cjs +1 -1
  2. package/dist/api-handler-graphql.js +2 -2
  3. package/dist/api-handler-trpc.cjs +1 -1
  4. package/dist/api-handler-trpc.js +2 -2
  5. package/dist/api-handler.cjs +1 -1
  6. package/dist/api-handler.js +1 -1
  7. package/dist/auth-session-4WJUKESW.js +1 -0
  8. package/dist/auth-session-VHUHDBCL.cjs +1 -0
  9. package/dist/bootstrap-JYAUQ52D.cjs +1 -0
  10. package/dist/bootstrap-TTMLNQM3.js +1 -0
  11. package/dist/chunk-23RSKVJP.cjs +1 -0
  12. package/dist/chunk-24W5I6SJ.cjs +2 -0
  13. package/dist/{chunk-CH4TZZI5.js → chunk-2I2AXTKY.cjs} +38 -39
  14. package/dist/chunk-34LCWI5X.cjs +1 -0
  15. package/dist/chunk-3A5UO6OQ.cjs +114 -0
  16. package/dist/chunk-3N34WXBS.js +2 -0
  17. package/dist/chunk-3RIGRHON.js +109 -0
  18. package/dist/chunk-5BUAWCU6.js +91 -0
  19. package/dist/{chunk-7NKNSRCB.cjs → chunk-5I3BM5TV.js} +33 -32
  20. package/dist/chunk-5RBGM5N5.js +3 -0
  21. package/dist/chunk-7EY3GXRA.js +2 -0
  22. package/dist/chunk-7KTPBTH5.cjs +1 -0
  23. package/dist/chunk-A7763NCF.cjs +19 -0
  24. package/dist/chunk-AQWTJGML.cjs +1 -0
  25. package/dist/chunk-DCFOVCJX.cjs +1 -0
  26. package/dist/chunk-DCKJT247.cjs +1 -0
  27. package/dist/chunk-EG4SRTYS.cjs +2 -0
  28. package/dist/chunk-FAG2645P.js +2 -0
  29. package/dist/chunk-FIVTKI25.cjs +3 -0
  30. package/dist/chunk-FU76HURF.cjs +1 -0
  31. package/dist/chunk-GS4CMYKS.cjs +1 -0
  32. package/dist/chunk-GTAKGVUY.js +2 -0
  33. package/dist/chunk-GWUHIIPO.cjs +132 -0
  34. package/dist/chunk-H2IJDTA2.cjs +1 -0
  35. package/dist/chunk-HCM2G674.cjs +20 -0
  36. package/dist/chunk-I22MSXGL.js +2 -0
  37. package/dist/chunk-IIPSXKNV.js +115 -0
  38. package/dist/{chunk-WNU76M2C.js → chunk-IIVBEZC2.js} +6 -6
  39. package/dist/chunk-JHFD3IAU.cjs +1 -0
  40. package/dist/chunk-JJY2F6NL.cjs +3 -0
  41. package/dist/chunk-JQ4V2MGJ.cjs +2 -0
  42. package/dist/chunk-JXJTFBHG.js +3 -0
  43. package/dist/chunk-KOSR7235.cjs +1 -0
  44. package/dist/chunk-KUY4QDAL.js +2 -0
  45. package/dist/chunk-LGUHXOEW.js +3 -0
  46. package/dist/chunk-LXTVMP5F.cjs +6 -0
  47. package/dist/chunk-MCK2QRAU.cjs +4 -0
  48. package/dist/chunk-N2BMGZIX.cjs +90 -0
  49. package/dist/chunk-N7CDHWQH.cjs +2 -0
  50. package/dist/chunk-NGNXOXI5.js +2 -0
  51. package/dist/chunk-O2SA56P2.cjs +108 -0
  52. package/dist/chunk-O4PPZOVI.cjs +1 -0
  53. package/dist/chunk-O4RKZQYQ.js +2 -0
  54. package/dist/chunk-O6I26T6A.js +3 -0
  55. package/dist/chunk-OJBL4CXK.cjs +2 -0
  56. package/dist/chunk-OPKZYQV7.js +3 -0
  57. package/dist/chunk-OXEJCIOA.cjs +1 -0
  58. package/dist/chunk-OXH6CANN.js +2 -0
  59. package/dist/chunk-PPGZHOYR.cjs +1 -0
  60. package/dist/{chunk-EQN3HDES.cjs → chunk-PW6Y5MQL.cjs} +5 -5
  61. package/dist/chunk-RLW6AQF2.js +2 -0
  62. package/dist/chunk-SBFVITY2.js +7 -0
  63. package/dist/chunk-SEJ7LMYY.js +4 -0
  64. package/dist/chunk-SYE3OS5T.js +5 -0
  65. package/dist/chunk-SZY25KAE.js +21 -0
  66. package/dist/chunk-TJ6N5ZPZ.js +133 -0
  67. package/dist/chunk-TVWHTVLI.js +2 -0
  68. package/dist/chunk-UE7DTBD7.cjs +1 -0
  69. package/dist/chunk-V2RMDMWN.js +2 -0
  70. package/dist/chunk-V4SR7DU5.js +3 -0
  71. package/dist/chunk-VLFM66BZ.js +4 -0
  72. package/dist/chunk-VPBGZW4P.cjs +1 -0
  73. package/dist/chunk-W5GDZG64.js +2 -0
  74. package/dist/chunk-WLSVS3NC.js +2 -0
  75. package/dist/chunk-XL64URKD.cjs +2 -0
  76. package/dist/chunk-YNBJGPIU.js +2 -0
  77. package/dist/chunk-YNSKDTFG.js +2 -0
  78. package/dist/chunk-YOJOVQIH.cjs +1 -0
  79. package/dist/chunk-ZE2X3FBU.js +20 -0
  80. package/dist/chunk-ZMH35QYG.js +2 -0
  81. package/dist/cli/index.cjs +53 -182
  82. package/dist/cli/index.js +54 -183
  83. package/dist/drizzle/index.cjs +1 -1
  84. package/dist/drizzle/index.js +1 -1
  85. package/dist/fields/index.cjs +1 -1
  86. package/dist/fields/index.js +1 -1
  87. package/dist/graphql/index.cjs +1 -1
  88. package/dist/graphql/index.js +1 -1
  89. package/dist/index-B_39z2jP.d.cts +217 -0
  90. package/dist/index-xqpVL2Zq.d.ts +217 -0
  91. package/dist/index.cjs +30 -30
  92. package/dist/index.d.cts +2 -31
  93. package/dist/index.d.ts +2 -31
  94. package/dist/index.js +31 -31
  95. package/dist/integration.cjs +1 -1
  96. package/dist/integration.js +1 -1
  97. package/dist/local-DKP43BWQ.cjs +1 -0
  98. package/dist/local-TF5ZMHWW.js +1 -0
  99. package/dist/media-M3EIZ4QS.cjs +1 -0
  100. package/dist/media-WYEILC6K.js +1 -0
  101. package/dist/mongo-auth-adapter-22MV3TI3.cjs +1 -0
  102. package/dist/mongo-auth-adapter-66PWVRZW.js +1 -0
  103. package/dist/mongodb/index.cjs +1 -1
  104. package/dist/mongodb/index.d.cts +3 -130
  105. package/dist/mongodb/index.d.ts +3 -130
  106. package/dist/mongodb/index.js +1 -1
  107. package/dist/nodemailer-transport-7F3VLLBW.js +1 -0
  108. package/dist/nodemailer-transport-WAPZD3SJ.cjs +1 -0
  109. package/dist/postgres-auth-adapter-7BCPXNBO.js +1 -0
  110. package/dist/postgres-auth-adapter-HMXFUM5W.cjs +1 -0
  111. package/dist/redis-adapter-2E5AWMMA.cjs +1 -0
  112. package/dist/redis-adapter-GFH74CF4.js +1 -0
  113. package/dist/rest/index.cjs +1 -1
  114. package/dist/rest/index.js +1 -1
  115. package/dist/schema-FNIDQKIJ.cjs +1 -0
  116. package/dist/schema-KD736QFN.js +1 -0
  117. package/dist/sqlite-adapter-HL53RLSN.cjs +1 -0
  118. package/dist/sqlite-adapter-TT6ZASDG.js +1 -0
  119. package/dist/templates/index.cjs +1 -1
  120. package/dist/templates/index.js +1 -1
  121. package/dist/trpc/index.cjs +1 -1
  122. package/dist/trpc/index.js +1 -1
  123. package/dist/ws/index.cjs +1 -1
  124. package/dist/ws/index.js +1 -1
  125. package/package.json +2 -10
  126. package/dist/WebhookService-CGxHtw7E.d.cts +0 -143
  127. package/dist/WebhookService-CNC1lYz7.d.ts +0 -143
  128. package/dist/auth-session-DHVGXHOH.cjs +0 -1
  129. package/dist/auth-session-O7IIH7EP.js +0 -1
  130. package/dist/base-A9AJPCG5.d.ts +0 -219
  131. package/dist/base-C6wyX2nC.d.cts +0 -219
  132. package/dist/bcryptjs-WIQSWJGK.cjs +0 -1
  133. package/dist/bcryptjs-ZEEHSMAG.js +0 -2
  134. package/dist/better-sqlite3-5IISPX34.cjs +0 -1
  135. package/dist/better-sqlite3-B34RIU4C.js +0 -2
  136. package/dist/bootstrap-PG2LGDLB.js +0 -1
  137. package/dist/bootstrap-YD3GLTWX.cjs +0 -1
  138. package/dist/bowser-SB3ZUPO4.js +0 -11
  139. package/dist/bowser-VX6B6ZSE.cjs +0 -10
  140. package/dist/chokidar-5RVQZVHP.cjs +0 -5
  141. package/dist/chokidar-BOYGRT4Q.js +0 -6
  142. package/dist/chunk-262YP5XA.cjs +0 -1
  143. package/dist/chunk-2HA6EKXX.js +0 -24
  144. package/dist/chunk-2SPWRQ5O.js +0 -122
  145. package/dist/chunk-2TYITUOC.js +0 -122
  146. package/dist/chunk-35PGCW3S.cjs +0 -1
  147. package/dist/chunk-3CIMGC2F.cjs +0 -56
  148. package/dist/chunk-3KZXF4US.js +0 -2
  149. package/dist/chunk-3NSZZCOJ.js +0 -2
  150. package/dist/chunk-3TAUNYEM.js +0 -8
  151. package/dist/chunk-3VXEK5ZW.cjs +0 -1
  152. package/dist/chunk-47CXBWMA.js +0 -2
  153. package/dist/chunk-4BMWWGJN.js +0 -384
  154. package/dist/chunk-4NTIK6DF.cjs +0 -2
  155. package/dist/chunk-6E44MQQ5.js +0 -115
  156. package/dist/chunk-6LWF5MPL.js +0 -20
  157. package/dist/chunk-6NBZDW53.js +0 -133
  158. package/dist/chunk-6TPICJ2L.js +0 -7
  159. package/dist/chunk-6YS6XLOD.cjs +0 -121
  160. package/dist/chunk-73D2PNHD.cjs +0 -7
  161. package/dist/chunk-7ACHOBWY.cjs +0 -13
  162. package/dist/chunk-7GGZA5YU.cjs +0 -2
  163. package/dist/chunk-7JWQ2PZP.cjs +0 -1
  164. package/dist/chunk-7KLEANTO.cjs +0 -1
  165. package/dist/chunk-7MNDQU6K.js +0 -8
  166. package/dist/chunk-7NH7H3WA.js +0 -10
  167. package/dist/chunk-7WMMKGEO.cjs +0 -1
  168. package/dist/chunk-ALTU3FDG.js +0 -2
  169. package/dist/chunk-BAVN7VDR.cjs +0 -1
  170. package/dist/chunk-BCEE4NBZ.cjs +0 -2
  171. package/dist/chunk-BUNLC3II.cjs +0 -1
  172. package/dist/chunk-C7QCZX7X.js +0 -2
  173. package/dist/chunk-D6SDGHY6.js +0 -2
  174. package/dist/chunk-DVWYO3KK.cjs +0 -1
  175. package/dist/chunk-EHWUALGH.cjs +0 -1
  176. package/dist/chunk-EML5FDUU.js +0 -2
  177. package/dist/chunk-EN65ZEK2.cjs +0 -2
  178. package/dist/chunk-EW424IBO.cjs +0 -1
  179. package/dist/chunk-EZIDQBXI.cjs +0 -1
  180. package/dist/chunk-F2O4QO5N.cjs +0 -383
  181. package/dist/chunk-F4ITQ6XQ.cjs +0 -3
  182. package/dist/chunk-FK2BG4HU.js +0 -3
  183. package/dist/chunk-FLMUMPDE.js +0 -2
  184. package/dist/chunk-GIS6X43A.cjs +0 -3
  185. package/dist/chunk-GNEVCEJU.cjs +0 -3
  186. package/dist/chunk-GNOSG3PK.cjs +0 -1
  187. package/dist/chunk-GQGFNTDZ.js +0 -2
  188. package/dist/chunk-GTR7JAKP.cjs +0 -3
  189. package/dist/chunk-HPIJI7TM.js +0 -3
  190. package/dist/chunk-HPYH7GTS.cjs +0 -1
  191. package/dist/chunk-HRAY65XH.js +0 -3
  192. package/dist/chunk-HTYVI2HK.cjs +0 -9
  193. package/dist/chunk-IKGVPXMK.js +0 -3
  194. package/dist/chunk-J6V573PE.cjs +0 -1
  195. package/dist/chunk-JA44K75G.js +0 -2
  196. package/dist/chunk-JRUQ5ABB.js +0 -4
  197. package/dist/chunk-JV4HJBXW.js +0 -14
  198. package/dist/chunk-KEITOXIP.js +0 -2
  199. package/dist/chunk-KMFLHGD5.cjs +0 -1
  200. package/dist/chunk-KZHXYXSH.cjs +0 -10
  201. package/dist/chunk-L3Q64RUX.js +0 -3
  202. package/dist/chunk-LEBM6ZSZ.cjs +0 -10
  203. package/dist/chunk-LKRI5X2V.cjs +0 -1
  204. package/dist/chunk-LQ3YZTPU.cjs +0 -15
  205. package/dist/chunk-LVBHOZZF.js +0 -4
  206. package/dist/chunk-LWM4WABU.js +0 -3
  207. package/dist/chunk-LY7N3UHH.cjs +0 -23
  208. package/dist/chunk-MCIZG4A3.cjs +0 -1
  209. package/dist/chunk-MDLJTZLV.cjs +0 -1
  210. package/dist/chunk-N4FXLQE3.cjs +0 -132
  211. package/dist/chunk-N5POANYV.js +0 -2
  212. package/dist/chunk-NGNJSUGL.cjs +0 -1
  213. package/dist/chunk-NRE6VKL6.cjs +0 -121
  214. package/dist/chunk-O4YE57OS.cjs +0 -6
  215. package/dist/chunk-OBYAIJVU.js +0 -11
  216. package/dist/chunk-OLRCZ6E3.js +0 -2
  217. package/dist/chunk-OOVNTOZC.cjs +0 -56
  218. package/dist/chunk-P6JITOFF.js +0 -4
  219. package/dist/chunk-PITMDQYN.cjs +0 -18
  220. package/dist/chunk-PYUWSKKP.js +0 -57
  221. package/dist/chunk-Q5TFO66G.cjs +0 -1
  222. package/dist/chunk-QO5ZWQA3.cjs +0 -74
  223. package/dist/chunk-QYN6C3FZ.cjs +0 -114
  224. package/dist/chunk-REQ622YC.js +0 -3
  225. package/dist/chunk-RPRGGGIW.js +0 -11
  226. package/dist/chunk-RVBSJ4UQ.cjs +0 -7
  227. package/dist/chunk-RYHOWZLK.js +0 -2
  228. package/dist/chunk-RYXLEFS5.js +0 -2
  229. package/dist/chunk-SBNMXQNO.cjs +0 -2
  230. package/dist/chunk-SLMIYECU.js +0 -2
  231. package/dist/chunk-SRIXRJHL.js +0 -4
  232. package/dist/chunk-TBHNE4VV.js +0 -2
  233. package/dist/chunk-TCFL3UWT.cjs +0 -2
  234. package/dist/chunk-TYQYKKWJ.js +0 -16
  235. package/dist/chunk-U6KFONKM.js +0 -2
  236. package/dist/chunk-UNYXWPLZ.cjs +0 -2
  237. package/dist/chunk-UWHWSWDE.js +0 -2
  238. package/dist/chunk-V4FAL7AG.js +0 -2
  239. package/dist/chunk-VQ53TFYA.cjs +0 -1
  240. package/dist/chunk-VRZC4TTF.cjs +0 -1
  241. package/dist/chunk-W45TLOOT.js +0 -2
  242. package/dist/chunk-WAVGRSE6.js +0 -2
  243. package/dist/chunk-WPM6LFCY.js +0 -2
  244. package/dist/chunk-WXT2XW7T.js +0 -13
  245. package/dist/chunk-X473JI7Z.js +0 -75
  246. package/dist/chunk-X6HUA6EF.cjs +0 -20
  247. package/dist/chunk-XDPLVJRO.js +0 -21
  248. package/dist/chunk-XDQVYCIR.cjs +0 -1
  249. package/dist/chunk-XFYSADHV.cjs +0 -2
  250. package/dist/chunk-XOR64WUQ.cjs +0 -19
  251. package/dist/chunk-Y2YAKDEQ.js +0 -2
  252. package/dist/chunk-YENNL5HG.js +0 -2
  253. package/dist/chunk-YGI5W4RS.js +0 -2
  254. package/dist/chunk-YIFKTA5N.js +0 -57
  255. package/dist/chunk-YUUXFD73.js +0 -19
  256. package/dist/chunk-ZAKYTBEN.js +0 -3
  257. package/dist/chunk-ZHA446FA.cjs +0 -1
  258. package/dist/chunk-ZTLGK6R4.cjs +0 -12
  259. package/dist/chunk-ZUBJ6RLQ.cjs +0 -1
  260. package/dist/client.d.cts +0 -1291
  261. package/dist/client.d.ts +0 -1291
  262. package/dist/d1-5ZQJOFDX.cjs +0 -1
  263. package/dist/d1-HPB6B253.js +0 -2
  264. package/dist/dist-es-3SSNUZST.cjs +0 -1
  265. package/dist/dist-es-64F22JL2.js +0 -2
  266. package/dist/dist-es-A5OF2STN.cjs +0 -2
  267. package/dist/dist-es-BOW5V247.cjs +0 -6
  268. package/dist/dist-es-CRIMATLL.cjs +0 -2
  269. package/dist/dist-es-DL3VLVP6.cjs +0 -1
  270. package/dist/dist-es-F2ZR55UK.js +0 -4
  271. package/dist/dist-es-IPSSZNFP.js +0 -1
  272. package/dist/dist-es-M2F7M27Y.js +0 -2
  273. package/dist/dist-es-M66JKZF5.js +0 -7
  274. package/dist/dist-es-OKLLRYI3.js +0 -2
  275. package/dist/dist-es-P25IKLBI.cjs +0 -1
  276. package/dist/dist-es-SRPWSAF4.cjs +0 -1
  277. package/dist/dist-es-SVHZDVUF.js +0 -3
  278. package/dist/dist-es-T2H2W5BX.cjs +0 -3
  279. package/dist/dist-es-WFI55HKT.js +0 -3
  280. package/dist/drizzle-orm-47ELDEM6.cjs +0 -1
  281. package/dist/drizzle-orm-XRTSOQJS.js +0 -1
  282. package/dist/event-streams-7NAWZW2I.js +0 -1
  283. package/dist/event-streams-JBMWCI2O.cjs +0 -1
  284. package/dist/fs-KWBRQ6T6.js +0 -1
  285. package/dist/fs-ZQYOJOIO.cjs +0 -1
  286. package/dist/index-NGnJpSgf.d.ts +0 -105
  287. package/dist/index-Zrg3sZ6R.d.cts +0 -105
  288. package/dist/jsonwebtoken-DFB6ZBZA.cjs +0 -8
  289. package/dist/jsonwebtoken-OD67R5JS.js +0 -9
  290. package/dist/lib-A2D63VXD.cjs +0 -1
  291. package/dist/lib-JQD2JAOO.js +0 -2
  292. package/dist/loadSso-JY4WDQPS.cjs +0 -2
  293. package/dist/loadSso-UQR6545M.js +0 -3
  294. package/dist/local-6UUGBZ4M.js +0 -1
  295. package/dist/local-ZYHV3J2K.cjs +0 -1
  296. package/dist/media-3Z6YW5J4.cjs +0 -1
  297. package/dist/media-E762GEHL.js +0 -1
  298. package/dist/mongo-auth-adapter-2H2AXDRH.cjs +0 -1
  299. package/dist/mongo-auth-adapter-YWMEOC42.js +0 -1
  300. package/dist/nodemailer-IDML4L6W.cjs +0 -53
  301. package/dist/nodemailer-NITB45SS.js +0 -54
  302. package/dist/nodemailer-transport-3VWVUBM5.cjs +0 -1
  303. package/dist/nodemailer-transport-7RHATUKL.js +0 -1
  304. package/dist/postgres-auth-adapter-QKBNXVPT.js +0 -1
  305. package/dist/postgres-auth-adapter-WMLM4UUC.cjs +0 -1
  306. package/dist/postgres-js-7YBZKGXG.cjs +0 -1
  307. package/dist/postgres-js-JLFIWOBH.js +0 -1
  308. package/dist/redis-adapter-EVK2SMKH.cjs +0 -1
  309. package/dist/redis-adapter-LY2NBSAG.js +0 -1
  310. package/dist/schema-RT6WSUYC.cjs +0 -1
  311. package/dist/schema-YFMSJK2P.js +0 -2
  312. package/dist/signin-N3T2KF5Q.js +0 -3
  313. package/dist/signin-VFBLX7EL.cjs +0 -2
  314. package/dist/sqlite-adapter-KPSISY6E.cjs +0 -1
  315. package/dist/sqlite-adapter-PI6SIY7O.js +0 -1
  316. package/dist/src-6LAUXXDM.cjs +0 -1
  317. package/dist/src-QBADSZV4.js +0 -1
  318. package/dist/sso-oidc-54BIRYR6.cjs +0 -2
  319. package/dist/sso-oidc-UB7G4END.js +0 -3
  320. package/dist/sts-WAA6I22C.js +0 -3
  321. package/dist/sts-YLXXIB3X.cjs +0 -2
  322. package/dist/types-BCOhfwHC.d.ts +0 -839
  323. package/dist/types-DxaK39ix.d.cts +0 -330
  324. package/dist/types-DxaK39ix.d.ts +0 -330
  325. package/dist/types-QglJ7PwT.d.cts +0 -839
@@ -1,2 +0,0 @@
1
- import {g}from'./chunk-Y2YAKDEQ.js';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
2
- g();var h={minLength:12,requireUppercase:true,requireLowercase:true,requireNumbers:true,requireSpecialChars:true,preventReuse:5,maxLength:128},l=class{config;constructor(t={}){this.config={...h,...t};}validate(t){let e=[];return this.config.maxLength&&t.length>this.config.maxLength&&e.push(`Password must not exceed ${this.config.maxLength} characters`),t.length<this.config.minLength&&e.push(`Password must be at least ${this.config.minLength} characters`),this.config.requireUppercase&&!/[A-Z]/.test(t)&&e.push("Password must contain at least one uppercase letter"),this.config.requireLowercase&&!/[a-z]/.test(t)&&e.push("Password must contain at least one lowercase letter"),this.config.requireNumbers&&!/[0-9]/.test(t)&&e.push("Password must contain at least one number"),this.config.requireSpecialChars&&!/[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/.test(t)&&e.push("Password must contain at least one special character"),["password","123456","12345678","qwerty","abc123","monkey","1234567","letmein","trustno1","dragon","baseball","iloveyou","master","sunshine","ashley","football","password1","shadow","123123","654321"].includes(t.toLowerCase())&&e.push("This password is too common. Please choose a more secure password"),(/^[a-zA-Z]+$/.test(t)||/^[0-9]+$/.test(t))&&e.push("Password must contain a mix of letters, numbers, and/or special characters"),/(.)\1{2,}/.test(t)&&e.push("Password must not contain more than 2 consecutive identical characters"),/^(012|123|234|345|456|567|678|789|890|098|987|876|765|654|543|432|321|210)+$/i.test(t)&&e.push("Password must not contain sequential numbers or letters"),{valid:e.length===0,errors:e}}async checkReuse(t,e,s){return {valid:true,errors:[]}}async isInHistory(t,e,s){for(let n of e)if(await s(t,n))return true;return false}generatePassword(t=16){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZ",s="abcdefghijklmnopqrstuvwxyz",n="0123456789",r="!@#$%^&*()_+-=[]{}|;:,.<>?",i="";i+=e[Math.floor(Math.random()*e.length)],i+=s[Math.floor(Math.random()*s.length)],i+=n[Math.floor(Math.random()*n.length)],i+=r[Math.floor(Math.random()*r.length)];let o=e+s+n+r;for(let a=i.length;a<t;a++)i+=o[Math.floor(Math.random()*o.length)];return i.split("").sort(()=>Math.random()-.5).join("")}getStrength(t){let e=0,s=[];t.length>=8&&(e+=1),t.length>=12&&(e+=1),t.length>=16&&(e+=1),/[a-z]/.test(t)&&(e+=1),/[A-Z]/.test(t)&&(e+=1),/[0-9]/.test(t)&&(e+=1),/[!@#$%^&*()_+\-=\[\]{}|;:,.<>?]/.test(t)&&(e+=1),t.length>8&&(e+=1),t.length>12&&(e+=1);let n=new Set(t).size;n>6&&(e+=1),n>10&&(e+=1);let r;return e<=3?(r="Weak",s.push("Add more characters"),s.push("Include uppercase and lowercase letters")):e<=5?(r="Fair",s.push("Add special characters"),s.push("Consider making it longer")):e<=7?(r="Good",s.push("Consider making it longer for extra security")):r="Strong",{score:e,label:r,feedback:s}}setConfig(t){this.config={...this.config,...t};}getConfig(){return {...this.config}}};export{l as a};
@@ -1,2 +0,0 @@
1
- import {g as g$1}from'./chunk-Y2YAKDEQ.js';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
2
- g$1();var i=Symbol.for("drizzle:entityKind"),Er=Symbol.for("drizzle:hasOwnEntityKind");function g(t,e){if(!t||typeof t!="object")return false;if(t instanceof e)return true;if(!Object.prototype.hasOwnProperty.call(e,i))throw new Error(`Class "${e.name??"<unknown>"}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);let r=Object.getPrototypeOf(t).constructor;if(r)for(;r;){if(i in r&&r[i]===e[i])return true;r=Object.getPrototypeOf(r);}return false}g$1();var T=class{constructor(e,r){this.table=e,this.config=r,this.name=r.name,this.keyAsName=r.keyAsName,this.notNull=r.notNull,this.default=r.default,this.defaultFn=r.defaultFn,this.onUpdateFn=r.onUpdateFn,this.hasDefault=r.hasDefault,this.primary=r.primaryKey,this.isUnique=r.isUnique,this.uniqueName=r.uniqueName,this.uniqueType=r.uniqueType,this.dataType=r.dataType,this.columnType=r.columnType,this.generated=r.generated,this.generatedIdentity=r.generatedIdentity;}static[i]="Column";name;keyAsName;primary;notNull;default;defaultFn;onUpdateFn;hasDefault;isUnique;uniqueName;uniqueType;dataType;columnType;enumValues=void 0;generated=void 0;generatedIdentity=void 0;config;mapFromDriverValue(e){return e}mapToDriverValue(e){return e}shouldDisableInsert(){return this.config.generated!==void 0&&this.config.generated.type!=="byDefault"}};g$1();var O=class{static[i]="ColumnBuilder";config;constructor(e,r,n){this.config={name:e,keyAsName:e==="",notNull:false,default:void 0,hasDefault:false,primaryKey:false,isUnique:false,uniqueName:void 0,uniqueType:void 0,dataType:r,columnType:n,generated:void 0};}$type(){return this}notNull(){return this.config.notNull=true,this}default(e){return this.config.default=e,this.config.hasDefault=true,this}$defaultFn(e){return this.config.defaultFn=e,this.config.hasDefault=true,this}$default=this.$defaultFn;$onUpdateFn(e){return this.config.onUpdateFn=e,this.config.hasDefault=true,this}$onUpdate=this.$onUpdateFn;primaryKey(){return this.config.primaryKey=true,this.config.notNull=true,this}setName(e){this.config.name===""&&(this.config.name=e);}};g$1();var z=class{static[i]="Subquery";constructor(e,r,n,u=false,c=[]){this._={brand:"Subquery",sql:e,selectedFields:r,alias:n,isWith:u,usedTables:c};}},Kt=class extends z{static[i]="WithSubquery"};g$1();var D=Symbol.for("drizzle:ViewBaseConfig");g$1();g$1();var N=Symbol.for("drizzle:Name");var I=Symbol.for("drizzle:Schema"),qt=Symbol.for("drizzle:Columns"),$t=Symbol.for("drizzle:ExtraConfigColumns"),_=Symbol.for("drizzle:OriginalName"),R=Symbol.for("drizzle:BaseName"),q=Symbol.for("drizzle:IsAlias"),jt=Symbol.for("drizzle:ExtraConfigBuilder"),Ot=Symbol.for("drizzle:IsDrizzleTable"),d=class{static[i]="Table";static Symbol={Name:N,Schema:I,OriginalName:_,Columns:qt,ExtraConfigColumns:$t,BaseName:R,IsAlias:q,ExtraConfigBuilder:jt};[N];[_];[I];[qt];[$t];[R];[q]=false;[Ot]=true;[jt]=void 0;constructor(e,r,n){this[N]=this[_]=e,this[I]=r,this[R]=n;}};function on(t){return typeof t=="object"&&t!==null&&Ot in t}function J(t){return t[N]}function un(t){return `${t[I]??"public"}.${t[N]}`}g$1();g$1();g$1();g$1();var E=class{static[i]="PgForeignKeyBuilder";reference;_onUpdate="no action";_onDelete="no action";constructor(e,r){this.reference=()=>{let{name:n,columns:u,foreignColumns:c}=e();return {name:n,columns:u,foreignTable:c[0].table,foreignColumns:c}},r&&(this._onUpdate=r.onUpdate,this._onDelete=r.onDelete);}onUpdate(e){return this._onUpdate=e===void 0?"no action":e,this}onDelete(e){return this._onDelete=e===void 0?"no action":e,this}build(e){return new W(e,this)}},W=class{constructor(e,r){this.table=e,this.reference=r.reference,this.onUpdate=r._onUpdate,this.onDelete=r._onDelete;}static[i]="PgForeignKey";reference;onUpdate;onDelete;getName(){let{name:e,columns:r,foreignColumns:n}=this.reference(),u=r.map(y=>y.name),c=n.map(y=>y.name),h=[this.table[N],...u,n[0].table[N],...c];return e??`${h.join("_")}_fk`}};g$1();function U(t,...e){return t(...e)}g$1();function H(t,e){return `${t[N]}_${e.join("_")}_unique`}g$1();function Et(t,e,r){for(let n=e;n<t.length;n++){let u=t[n];if(u==="\\"){n++;continue}if(u==='"')return [t.slice(e,n).replace(/\\/g,""),n+1];if(!r&&(u===","||u==="}"))return [t.slice(e,n).replace(/\\/g,""),n]}return [t.slice(e).replace(/\\/g,""),t.length]}function Ut(t,e=0){let r=[],n=e,u=false;for(;n<t.length;){let c=t[n];if(c===","){(u||n===e)&&r.push(""),u=true,n++;continue}if(u=false,c==="\\"){n+=2;continue}if(c==='"'){let[w,x]=Et(t,n+1,true);r.push(w),n=x;continue}if(c==="}")return [r,n+1];if(c==="{"){let[w,x]=Ut(t,n+1);r.push(w),n=x;continue}let[h,y]=Et(t,n,false);r.push(h),n=y;}return [r,n]}function _t(t){let[e]=Ut(t,1);return e}function X(t){return `{${t.map(e=>Array.isArray(e)?X(e):typeof e=="string"?`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:`${e}`).join(",")}}`}var m=class extends O{foreignKeyConfigs=[];static[i]="PgColumnBuilder";array(e){return new Z(this.config.name,this,e)}references(e,r={}){return this.foreignKeyConfigs.push({ref:e,actions:r}),this}unique(e,r){return this.config.isUnique=true,this.config.uniqueName=e,this.config.uniqueType=r?.nulls,this}generatedAlwaysAs(e){return this.config.generated={as:e,type:"always",mode:"stored"},this}buildForeignKeys(e,r){return this.foreignKeyConfigs.map(({ref:n,actions:u})=>U((c,h)=>{let y=new E(()=>{let w=c();return {columns:[e],foreignColumns:[w]}});return h.onUpdate&&y.onUpdate(h.onUpdate),h.onDelete&&y.onDelete(h.onDelete),y.build(r)},n,u))}buildExtraConfigColumn(e){return new Y(e,this.config)}},o=class extends T{constructor(e,r){r.uniqueName||(r.uniqueName=H(e,[r.name])),super(e,r),this.table=e;}static[i]="PgColumn"},Y=class extends o{static[i]="ExtraConfigColumn";getSQLType(){return this.getSQLType()}indexConfig={order:this.config.order??"asc",nulls:this.config.nulls??"last",opClass:this.config.opClass};defaultConfig={order:"asc",nulls:"last",opClass:void 0};asc(){return this.indexConfig.order="asc",this}desc(){return this.indexConfig.order="desc",this}nullsFirst(){return this.indexConfig.nulls="first",this}nullsLast(){return this.indexConfig.nulls="last",this}op(e){return this.indexConfig.opClass=e,this}},Rt=class{static[i]="IndexedColumn";constructor(e,r,n,u){this.name=e,this.keyAsName=r,this.type=n,this.indexConfig=u;}name;keyAsName;type;indexConfig},Z=class extends m{static[i]="PgArrayBuilder";constructor(e,r,n){super(e,"array","PgArray"),this.config.baseBuilder=r,this.config.size=n;}build(e){let r=this.config.baseBuilder.build(e);return new k(e,this.config,r)}},k=class t extends o{constructor(e,r,n,u){super(e,r),this.baseColumn=n,this.range=u,this.size=r.size;}size;static[i]="PgArray";getSQLType(){return `${this.baseColumn.getSQLType()}[${typeof this.size=="number"?this.size:""}]`}mapFromDriverValue(e){return typeof e=="string"&&(e=_t(e)),e.map(r=>this.baseColumn.mapFromDriverValue(r))}mapToDriverValue(e,r=false){let n=e.map(u=>u===null?null:g(this.baseColumn,t)?this.baseColumn.mapToDriverValue(u,true):this.baseColumn.mapToDriverValue(u));return r?n:X(n)}};var Wt=Symbol.for("drizzle:isPgEnum");function Gt(t){return !!t&&typeof t=="function"&&Wt in t&&t[Wt]===true}g$1();g$1();var Xt={startActiveSpan(t,e){return e()}};var Yt=class{static[i]="FakePrimitiveParam"};function $r(t){return t!=null&&typeof t.getSQL=="function"}function jr(t){let e={sql:"",params:[]};for(let r of t)e.sql+=r.sql,e.params.push(...r.params),r.typings?.length&&(e.typings||(e.typings=[]),e.typings.push(...r.typings));return e}var S=class{static[i]="StringChunk";value;constructor(e){this.value=Array.isArray(e)?e:[e];}getSQL(){return new P([this])}},P=class t{constructor(e){this.queryChunks=e;for(let r of e)if(g(r,d)){let n=r[d.Symbol.Schema];this.usedTables.push(n===void 0?r[d.Symbol.Name]:n+"."+r[d.Symbol.Name]);}}static[i]="SQL";decoder=Zt;shouldInlineParams=false;usedTables=[];append(e){return this.queryChunks.push(...e.queryChunks),this}toQuery(e){return Xt.startActiveSpan("drizzle.buildSQL",r=>{let n=this.buildQueryFromSourceParams(this.queryChunks,e);return r?.setAttributes({"drizzle.query.text":n.sql,"drizzle.query.params":JSON.stringify(n.params)}),n})}buildQueryFromSourceParams(e,r){let n=Object.assign({},r,{inlineParams:r.inlineParams||this.shouldInlineParams,paramStartIndex:r.paramStartIndex||{value:0}}),{casing:u,escapeName:c,escapeParam:h,prepareTyping:y,inlineParams:w,paramStartIndex:x}=n;return jr(e.map(a=>{if(g(a,S))return {sql:a.value.join(""),params:[]};if(g(a,L))return {sql:c(a.value),params:[]};if(a===void 0)return {sql:"",params:[]};if(Array.isArray(a)){let b=[new S("(")];for(let[C,V]of a.entries())b.push(V),C<a.length-1&&b.push(new S(", "));return b.push(new S(")")),this.buildQueryFromSourceParams(b,n)}if(g(a,t))return this.buildQueryFromSourceParams(a.queryChunks,{...n,inlineParams:w||a.shouldInlineParams});if(g(a,d)){let b=a[d.Symbol.Schema],C=a[d.Symbol.Name];return {sql:b===void 0||a[q]?c(C):c(b)+"."+c(C),params:[]}}if(g(a,T)){let b=u.getColumnCasing(a);if(r.invokeSource==="indexes")return {sql:c(b),params:[]};let C=a.table[d.Symbol.Schema];return {sql:a.table[q]||C===void 0?c(a.table[d.Symbol.Name])+"."+c(b):c(C)+"."+c(a.table[d.Symbol.Name])+"."+c(b),params:[]}}if(g(a,$)){let b=a[D].schema,C=a[D].name;return {sql:b===void 0||a[D].isAlias?c(C):c(b)+"."+c(C),params:[]}}if(g(a,B)){if(g(a.value,Q))return {sql:h(x.value++,a),params:[a],typings:["none"]};let b=a.value===null?null:a.encoder.mapToDriverValue(a.value);if(g(b,t))return this.buildQueryFromSourceParams([b],n);if(w)return {sql:this.mapInlineParam(b,n),params:[]};let C=["none"];return y&&(C=[y(a.encoder)]),{sql:h(x.value++,b),params:[b],typings:C}}return g(a,Q)?{sql:h(x.value++,a),params:[a],typings:["none"]}:g(a,t.Aliased)&&a.fieldAlias!==void 0?{sql:c(a.fieldAlias),params:[]}:g(a,z)?a._.isWith?{sql:c(a._.alias),params:[]}:this.buildQueryFromSourceParams([new S("("),a._.sql,new S(") "),new L(a._.alias)],n):Gt(a)?a.schema?{sql:c(a.schema)+"."+c(a.enumName),params:[]}:{sql:c(a.enumName),params:[]}:$r(a)?a.shouldOmitSQLParens?.()?this.buildQueryFromSourceParams([a.getSQL()],n):this.buildQueryFromSourceParams([new S("("),a.getSQL(),new S(")")],n):w?{sql:this.mapInlineParam(a,n),params:[]}:{sql:h(x.value++,a),params:[a],typings:["none"]}}))}mapInlineParam(e,{escapeString:r}){if(e===null)return "null";if(typeof e=="number"||typeof e=="boolean")return e.toString();if(typeof e=="string")return r(e);if(typeof e=="object"){let n=e.toString();return r(n==="[object Object]"?JSON.stringify(e):n)}throw new Error("Unexpected param value: "+e)}getSQL(){return this}as(e){return e===void 0?this:new t.Aliased(this,e)}mapWith(e){return this.decoder=typeof e=="function"?{mapFromDriverValue:e}:e,this}inlineParams(){return this.shouldInlineParams=true,this}if(e){return e?this:void 0}},L=class{constructor(e){this.value=e;}static[i]="Name";brand;getSQL(){return new P([this])}};function Gn(t){return new L(t)}function Hn(t){return typeof t=="object"&&t!==null&&"mapToDriverValue"in t&&typeof t.mapToDriverValue=="function"}var Zt={mapFromDriverValue:t=>t},kt={mapToDriverValue:t=>t},Xn={...Zt,...kt},B=class{constructor(e,r=kt){this.value=e,this.encoder=r;}static[i]="Param";brand;getSQL(){return new P([this])}};function Yn(t,e){return new B(t,e)}function A(t,...e){let r=[];(e.length>0||t.length>0&&t[0]!=="")&&r.push(new S(t[0]));for(let[n,u]of e.entries())r.push(u,new S(t[n+1]));return new P(r)}(t=>{function e(){return new P([])}t.empty=e;function r(w){return new P(w)}t.fromList=r;function n(w){return new P([new S(w)])}t.raw=n;function u(w,x){let a=[];for(let[b,C]of w.entries())b>0&&x!==void 0&&a.push(x),a.push(C);return new P(a)}t.join=u;function c(w){return new L(w)}t.identifier=c;function h(w){return new Q(w)}t.placeholder=h;function y(w,x){return new B(w,x)}t.param=y;})(A||(A={}));(t=>{class e{constructor(n,u){this.sql=n,this.fieldAlias=u;}static[i]="SQL.Aliased";isSelectionField=false;getSQL(){return this.sql}clone(){return new e(this.sql,this.fieldAlias)}}t.Aliased=e;})(P||(P={}));var Q=class{constructor(e){this.name=e;}static[i]="Placeholder";getSQL(){return new P([this])}};function Zn(t){return new Q(t)}function kn(t,e){return t.map(r=>{if(g(r,Q)){if(!(r.name in e))throw new Error(`No value for placeholder "${r.name}" was provided`);return e[r.name]}if(g(r,B)&&g(r.value,Q)){if(!(r.value.name in e))throw new Error(`No value for placeholder "${r.value.name}" was provided`);return r.encoder.mapToDriverValue(e[r.value.name])}return r})}var er=Symbol.for("drizzle:IsDrizzleView"),$=class{static[i]="View";[D];[er]=true;constructor({name:e,schema:r,selectedFields:n,query:u}){this[D]={name:e,originalName:e,schema:r,selectedFields:n,query:u,isExisting:!u,isAlias:false};}getSQL(){return new P([this])}};function ei(t){return typeof t=="object"&&t!==null&&er in t}function ti(t){return t[D].name}T.prototype.getSQL=function(){return new P([this])};d.prototype.getSQL=function(){return new P([this])};z.prototype.getSQL=function(){return new P([this])};g$1();function ci(t,e,r){let n={},u=t.reduce((c,{path:h,field:y},w)=>{let x;g(y,T)?x=y:g(y,P)?x=y.decoder:x=y.sql.decoder;let a=c;for(let[b,C]of h.entries())if(b<h.length-1)C in a||(a[C]={}),a=a[C];else {let V=e[w],qr=a[C]=V===null?null:x.mapFromDriverValue(V);if(r&&g(y,T)&&h.length===2){let K=h[0];K in n?typeof n[K]=="string"&&n[K]!==J(y.table)&&(n[K]=false):n[K]=qr===null?J(y.table):false;}}return c},{});if(r&&Object.keys(n).length>0)for(let[c,h]of Object.entries(n))typeof h=="string"&&!r[h]&&(u[c]=null);return u}function tr(t,e){return Object.entries(t).reduce((r,[n,u])=>{if(typeof n!="string")return r;let c=e?[...e,n]:[n];return g(u,T)||g(u,P)||g(u,P.Aliased)?r.push({path:c,field:u}):g(u,d)?r.push(...tr(u[d.Symbol.Columns],c)):r.push(...tr(u,c)),r},[])}function li(t,e){let r=Object.keys(t),n=Object.keys(e);if(r.length!==n.length)return false;for(let[u,c]of r.entries())if(c!==n[u])return false;return true}function fi(t,e){let r=Object.entries(e).filter(([,n])=>n!==void 0).map(([n,u])=>g(u,P)||g(u,T)?[n,u]:[n,new B(u,t[d.Symbol.Columns][n])]);if(r.length===0)throw new Error("No values to set");return Object.fromEntries(r)}function pi(t,e){for(let r of e)for(let n of Object.getOwnPropertyNames(r.prototype))n!=="constructor"&&Object.defineProperty(t.prototype,n,Object.getOwnPropertyDescriptor(r.prototype,n)||Object.create(null));}function gi(t){return t[d.Symbol.Columns]}function di(t){return t[D].selectedFields}function hi(t){return g(t,z)?t._.alias:g(t,$)?t[D].name:g(t,P)?void 0:t[d.Symbol.IsAlias]?t[d.Symbol.Name]:t[d.Symbol.BaseName]}function p(t,e){return {name:typeof t=="string"&&t.length>0?t:"",config:typeof t=="object"?t:e}}function yi(t){if(typeof t!="object"||t===null||t.constructor.name!=="Object")return false;if("logger"in t){let e=typeof t.logger;return !(e!=="boolean"&&(e!=="object"||typeof t.logger.logQuery!="function")&&e!=="undefined")}if("schema"in t){let e=typeof t.schema;return !(e!=="object"&&e!=="undefined")}if("casing"in t){let e=typeof t.casing;return !(e!=="string"&&e!=="undefined")}if("mode"in t)return !(t.mode!=="default"||t.mode!=="planetscale"||t.mode!==void 0);if("connection"in t){let e=typeof t.connection;return !(e!=="string"&&e!=="object"&&e!=="undefined")}if("client"in t){let e=typeof t.client;return !(e!=="object"&&e!=="function"&&e!=="undefined")}return Object.keys(t).length===0}var bi=typeof TextDecoder>"u"?null:new TextDecoder;g$1();g$1();var F=class extends m{static[i]="PgIntColumnBaseBuilder";generatedAlwaysAsIdentity(e){if(e){let{name:r,...n}=e;this.config.generatedIdentity={type:"always",sequenceName:r,sequenceOptions:n};}else this.config.generatedIdentity={type:"always"};return this.config.hasDefault=true,this.config.notNull=true,this}generatedByDefaultAsIdentity(e){if(e){let{name:r,...n}=e;this.config.generatedIdentity={type:"byDefault",sequenceName:r,sequenceOptions:n};}else this.config.generatedIdentity={type:"byDefault"};return this.config.hasDefault=true,this.config.notNull=true,this}};var ie=class extends F{static[i]="PgIntegerBuilder";constructor(e){super(e,"number","PgInteger");}build(e){return new se(e,this.config)}},se=class extends o{static[i]="PgInteger";getSQLType(){return "integer"}mapFromDriverValue(e){return typeof e=="string"?Number.parseInt(e):e}};function rr(t){return new ie(t??"")}g$1();var oe=class extends m{static[i]="PgJsonbBuilder";constructor(e){super(e,"json","PgJsonb");}build(e){return new ue(e,this.config)}},ue=class extends o{static[i]="PgJsonb";constructor(e,r){super(e,r);}getSQLType(){return "jsonb"}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e}};function nr(t){return new oe(t??"")}g$1();var ae=class extends m{static[i]="PgTextBuilder";constructor(e,r){super(e,"string","PgText"),this.config.enumValues=r.enum;}build(e){return new me(e,this.config)}},me=class extends o{static[i]="PgText";enumValues=this.config.enumValues;getSQLType(){return "text"}};function ir(t,e={}){let{name:r,config:n}=p(t,e);return new ae(r,n)}g$1();g$1();var v=class extends m{static[i]="PgDateColumnBaseBuilder";defaultNow(){return this.default(A`now()`)}};var ce=class extends v{static[i]="PgTimestampBuilder";constructor(e,r,n){super(e,"date","PgTimestamp"),this.config.withTimezone=r,this.config.precision=n;}build(e){return new le(e,this.config)}},le=class extends o{static[i]="PgTimestamp";withTimezone;precision;constructor(e,r){super(e,r),this.withTimezone=r.withTimezone,this.precision=r.precision;}getSQLType(){return `timestamp${this.precision===void 0?"":` (${this.precision})`}${this.withTimezone?" with time zone":""}`}mapFromDriverValue=e=>new Date(this.withTimezone?e:e+"+0000");mapToDriverValue=e=>e.toISOString()},fe=class extends v{static[i]="PgTimestampStringBuilder";constructor(e,r,n){super(e,"string","PgTimestampString"),this.config.withTimezone=r,this.config.precision=n;}build(e){return new pe(e,this.config)}},pe=class extends o{static[i]="PgTimestampString";withTimezone;precision;constructor(e,r){super(e,r),this.withTimezone=r.withTimezone,this.precision=r.precision;}getSQLType(){return `timestamp${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}};function sr(t,e={}){let{name:r,config:n}=p(t,e);return n?.mode==="string"?new fe(r,n.withTimezone??false,n.precision):new ce(r,n?.withTimezone??false,n?.precision)}g$1();var ge=class extends m{static[i]="PgUUIDBuilder";constructor(e){super(e,"string","PgUUID");}defaultRandom(){return this.default(A`gen_random_uuid()`)}build(e){return new de(e,this.config)}},de=class extends o{static[i]="PgUUID";getSQLType(){return "uuid"}};function or(t){return new ge(t??"")}g$1();var he=class extends m{static[i]="PgVarcharBuilder";constructor(e,r){super(e,"string","PgVarchar"),this.config.length=r.length,this.config.enumValues=r.enum;}build(e){return new ye(e,this.config)}},ye=class extends o{static[i]="PgVarchar";length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return this.length===void 0?"varchar":`varchar(${this.length})`}};function ur(t,e={}){let{name:r,config:n}=p(t,e);return new he(r,n)}g$1();g$1();g$1();var be=class extends F{static[i]="PgBigInt53Builder";constructor(e){super(e,"number","PgBigInt53");}build(e){return new we(e,this.config)}},we=class extends o{static[i]="PgBigInt53";getSQLType(){return "bigint"}mapFromDriverValue(e){return typeof e=="number"?e:Number(e)}},Ce=class extends F{static[i]="PgBigInt64Builder";constructor(e){super(e,"bigint","PgBigInt64");}build(e){return new xe(e,this.config)}},xe=class extends o{static[i]="PgBigInt64";getSQLType(){return "bigint"}mapFromDriverValue(e){return BigInt(e)}};function ar(t,e){let{name:r,config:n}=p(t,e);return n.mode==="number"?new be(r):new Ce(r)}g$1();var Pe=class extends m{static[i]="PgBigSerial53Builder";constructor(e){super(e,"number","PgBigSerial53"),this.config.hasDefault=true,this.config.notNull=true;}build(e){return new Se(e,this.config)}},Se=class extends o{static[i]="PgBigSerial53";getSQLType(){return "bigserial"}mapFromDriverValue(e){return typeof e=="number"?e:Number(e)}},Te=class extends m{static[i]="PgBigSerial64Builder";constructor(e){super(e,"bigint","PgBigSerial64"),this.config.hasDefault=true;}build(e){return new Ne(e,this.config)}},Ne=class extends o{static[i]="PgBigSerial64";getSQLType(){return "bigserial"}mapFromDriverValue(e){return BigInt(e)}};function mr(t,e){let{name:r,config:n}=p(t,e);return n.mode==="number"?new Pe(r):new Te(r)}g$1();var De=class extends m{static[i]="PgBooleanBuilder";constructor(e){super(e,"boolean","PgBoolean");}build(e){return new ve(e,this.config)}},ve=class extends o{static[i]="PgBoolean";getSQLType(){return "boolean"}};function cr(t){return new De(t??"")}g$1();var Ve=class extends m{static[i]="PgCharBuilder";constructor(e,r){super(e,"string","PgChar"),this.config.length=r.length,this.config.enumValues=r.enum;}build(e){return new Fe(e,this.config)}},Fe=class extends o{static[i]="PgChar";length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return this.length===void 0?"char":`char(${this.length})`}};function lr(t,e={}){let{name:r,config:n}=p(t,e);return new Ve(r,n)}g$1();var ze=class extends m{static[i]="PgCidrBuilder";constructor(e){super(e,"string","PgCidr");}build(e){return new Be(e,this.config)}},Be=class extends o{static[i]="PgCidr";getSQLType(){return "cidr"}};function fr(t){return new ze(t??"")}g$1();var Qe=class extends m{static[i]="PgCustomColumnBuilder";constructor(e,r,n){super(e,"custom","PgCustomColumn"),this.config.fieldConfig=r,this.config.customTypeParams=n;}build(e){return new Le(e,this.config)}},Le=class extends o{static[i]="PgCustomColumn";sqlName;mapTo;mapFrom;constructor(e,r){super(e,r),this.sqlName=r.customTypeParams.dataType(r.fieldConfig),this.mapTo=r.customTypeParams.toDriver,this.mapFrom=r.customTypeParams.fromDriver;}getSQLType(){return this.sqlName}mapFromDriverValue(e){return typeof this.mapFrom=="function"?this.mapFrom(e):e}mapToDriverValue(e){return typeof this.mapTo=="function"?this.mapTo(e):e}};function pr(t){return (e,r)=>{let{name:n,config:u}=p(e,r);return new Qe(n,u,t)}}g$1();var Ae=class extends v{static[i]="PgDateBuilder";constructor(e){super(e,"date","PgDate");}build(e){return new Ke(e,this.config)}},Ke=class extends o{static[i]="PgDate";getSQLType(){return "date"}mapFromDriverValue(e){return new Date(e)}mapToDriverValue(e){return e.toISOString()}},qe=class extends v{static[i]="PgDateStringBuilder";constructor(e){super(e,"string","PgDateString");}build(e){return new $e(e,this.config)}},$e=class extends o{static[i]="PgDateString";getSQLType(){return "date"}};function gr(t,e){let{name:r,config:n}=p(t,e);return n?.mode==="date"?new Ae(r):new qe(r)}g$1();var je=class extends m{static[i]="PgDoublePrecisionBuilder";constructor(e){super(e,"number","PgDoublePrecision");}build(e){return new Oe(e,this.config)}},Oe=class extends o{static[i]="PgDoublePrecision";getSQLType(){return "double precision"}mapFromDriverValue(e){return typeof e=="string"?Number.parseFloat(e):e}};function dr(t){return new je(t??"")}g$1();var Ie=class extends m{static[i]="PgInetBuilder";constructor(e){super(e,"string","PgInet");}build(e){return new Ee(e,this.config)}},Ee=class extends o{static[i]="PgInet";getSQLType(){return "inet"}};function hr(t){return new Ie(t??"")}g$1();var Ue=class extends m{static[i]="PgIntervalBuilder";constructor(e,r){super(e,"string","PgInterval"),this.config.intervalConfig=r;}build(e){return new _e(e,this.config)}},_e=class extends o{static[i]="PgInterval";fields=this.config.intervalConfig.fields;precision=this.config.intervalConfig.precision;getSQLType(){let e=this.fields?` ${this.fields}`:"",r=this.precision?`(${this.precision})`:"";return `interval${e}${r}`}};function yr(t,e={}){let{name:r,config:n}=p(t,e);return new Ue(r,n)}g$1();var Re=class extends m{static[i]="PgJsonBuilder";constructor(e){super(e,"json","PgJson");}build(e){return new Je(e,this.config)}},Je=class extends o{static[i]="PgJson";constructor(e,r){super(e,r);}getSQLType(){return "json"}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e}};function br(t){return new Re(t??"")}g$1();var We=class extends m{static[i]="PgLineBuilder";constructor(e){super(e,"array","PgLine");}build(e){return new Me(e,this.config)}},Me=class extends o{static[i]="PgLine";getSQLType(){return "line"}mapFromDriverValue(e){let[r,n,u]=e.slice(1,-1).split(",");return [Number.parseFloat(r),Number.parseFloat(n),Number.parseFloat(u)]}mapToDriverValue(e){return `{${e[0]},${e[1]},${e[2]}}`}},Ge=class extends m{static[i]="PgLineABCBuilder";constructor(e){super(e,"json","PgLineABC");}build(e){return new He(e,this.config)}},He=class extends o{static[i]="PgLineABC";getSQLType(){return "line"}mapFromDriverValue(e){let[r,n,u]=e.slice(1,-1).split(",");return {a:Number.parseFloat(r),b:Number.parseFloat(n),c:Number.parseFloat(u)}}mapToDriverValue(e){return `{${e.a},${e.b},${e.c}}`}};function wr(t,e){let{name:r,config:n}=p(t,e);return !n?.mode||n.mode==="tuple"?new We(r):new Ge(r)}g$1();var Xe=class extends m{static[i]="PgMacaddrBuilder";constructor(e){super(e,"string","PgMacaddr");}build(e){return new Ye(e,this.config)}},Ye=class extends o{static[i]="PgMacaddr";getSQLType(){return "macaddr"}};function Cr(t){return new Xe(t??"")}g$1();var Ze=class extends m{static[i]="PgMacaddr8Builder";constructor(e){super(e,"string","PgMacaddr8");}build(e){return new ke(e,this.config)}},ke=class extends o{static[i]="PgMacaddr8";getSQLType(){return "macaddr8"}};function xr(t){return new Ze(t??"")}g$1();var et=class extends m{static[i]="PgNumericBuilder";constructor(e,r,n){super(e,"string","PgNumeric"),this.config.precision=r,this.config.scale=n;}build(e){return new tt(e,this.config)}},tt=class extends o{static[i]="PgNumeric";precision;scale;constructor(e,r){super(e,r),this.precision=r.precision,this.scale=r.scale;}mapFromDriverValue(e){return typeof e=="string"?e:String(e)}getSQLType(){return this.precision!==void 0&&this.scale!==void 0?`numeric(${this.precision}, ${this.scale})`:this.precision===void 0?"numeric":`numeric(${this.precision})`}},rt=class extends m{static[i]="PgNumericNumberBuilder";constructor(e,r,n){super(e,"number","PgNumericNumber"),this.config.precision=r,this.config.scale=n;}build(e){return new nt(e,this.config)}},nt=class extends o{static[i]="PgNumericNumber";precision;scale;constructor(e,r){super(e,r),this.precision=r.precision,this.scale=r.scale;}mapFromDriverValue(e){return typeof e=="number"?e:Number(e)}mapToDriverValue=String;getSQLType(){return this.precision!==void 0&&this.scale!==void 0?`numeric(${this.precision}, ${this.scale})`:this.precision===void 0?"numeric":`numeric(${this.precision})`}},it=class extends m{static[i]="PgNumericBigIntBuilder";constructor(e,r,n){super(e,"bigint","PgNumericBigInt"),this.config.precision=r,this.config.scale=n;}build(e){return new st(e,this.config)}},st=class extends o{static[i]="PgNumericBigInt";precision;scale;constructor(e,r){super(e,r),this.precision=r.precision,this.scale=r.scale;}mapFromDriverValue=BigInt;mapToDriverValue=String;getSQLType(){return this.precision!==void 0&&this.scale!==void 0?`numeric(${this.precision}, ${this.scale})`:this.precision===void 0?"numeric":`numeric(${this.precision})`}};function ot(t,e){let{name:r,config:n}=p(t,e),u=n?.mode;return u==="number"?new rt(r,n?.precision,n?.scale):u==="bigint"?new it(r,n?.precision,n?.scale):new et(r,n?.precision,n?.scale)}var xo=ot;g$1();var ut=class extends m{static[i]="PgPointTupleBuilder";constructor(e){super(e,"array","PgPointTuple");}build(e){return new at(e,this.config)}},at=class extends o{static[i]="PgPointTuple";getSQLType(){return "point"}mapFromDriverValue(e){if(typeof e=="string"){let[r,n]=e.slice(1,-1).split(",");return [Number.parseFloat(r),Number.parseFloat(n)]}return [e.x,e.y]}mapToDriverValue(e){return `(${e[0]},${e[1]})`}},mt=class extends m{static[i]="PgPointObjectBuilder";constructor(e){super(e,"json","PgPointObject");}build(e){return new ct(e,this.config)}},ct=class extends o{static[i]="PgPointObject";getSQLType(){return "point"}mapFromDriverValue(e){if(typeof e=="string"){let[r,n]=e.slice(1,-1).split(",");return {x:Number.parseFloat(r),y:Number.parseFloat(n)}}return e}mapToDriverValue(e){return `(${e.x},${e.y})`}};function Pr(t,e){let{name:r,config:n}=p(t,e);return !n?.mode||n.mode==="tuple"?new ut(r):new mt(r)}g$1();g$1();function Or(t){let e=[];for(let r=0;r<t.length;r+=2)e.push(Number.parseInt(t.slice(r,r+2),16));return new Uint8Array(e)}function Sr(t,e){let r=new ArrayBuffer(8),n=new DataView(r);for(let u=0;u<8;u++)n.setUint8(u,t[e+u]);return n.getFloat64(0,true)}function lt(t){let e=Or(t),r=0,n=e[r];r+=1;let u=new DataView(e.buffer),c=u.getUint32(r,n===1);r+=4;if(c&536870912&&(u.getUint32(r,n===1),r+=4),(c&65535)===1){let y=Sr(e,r);r+=8;let w=Sr(e,r);return r+=8,[y,w]}throw new Error("Unsupported geometry type")}var ft=class extends m{static[i]="PgGeometryBuilder";constructor(e){super(e,"array","PgGeometry");}build(e){return new pt(e,this.config)}},pt=class extends o{static[i]="PgGeometry";getSQLType(){return "geometry(point)"}mapFromDriverValue(e){return lt(e)}mapToDriverValue(e){return `point(${e[0]} ${e[1]})`}},gt=class extends m{static[i]="PgGeometryObjectBuilder";constructor(e){super(e,"json","PgGeometryObject");}build(e){return new dt(e,this.config)}},dt=class extends o{static[i]="PgGeometryObject";getSQLType(){return "geometry(point)"}mapFromDriverValue(e){let r=lt(e);return {x:r[0],y:r[1]}}mapToDriverValue(e){return `point(${e.x} ${e.y})`}};function Tr(t,e){let{name:r,config:n}=p(t,e);return !n?.mode||n.mode==="tuple"?new ft(r):new gt(r)}g$1();var ht=class extends m{static[i]="PgRealBuilder";constructor(e,r){super(e,"number","PgReal"),this.config.length=r;}build(e){return new yt(e,this.config)}},yt=class extends o{static[i]="PgReal";constructor(e,r){super(e,r);}getSQLType(){return "real"}mapFromDriverValue=e=>typeof e=="string"?Number.parseFloat(e):e};function Nr(t){return new ht(t??"")}g$1();var bt=class extends m{static[i]="PgSerialBuilder";constructor(e){super(e,"number","PgSerial"),this.config.hasDefault=true,this.config.notNull=true;}build(e){return new wt(e,this.config)}},wt=class extends o{static[i]="PgSerial";getSQLType(){return "serial"}};function Dr(t){return new bt(t??"")}g$1();var Ct=class extends F{static[i]="PgSmallIntBuilder";constructor(e){super(e,"number","PgSmallInt");}build(e){return new xt(e,this.config)}},xt=class extends o{static[i]="PgSmallInt";getSQLType(){return "smallint"}mapFromDriverValue=e=>typeof e=="string"?Number(e):e};function vr(t){return new Ct(t??"")}g$1();var Pt=class extends m{static[i]="PgSmallSerialBuilder";constructor(e){super(e,"number","PgSmallSerial"),this.config.hasDefault=true,this.config.notNull=true;}build(e){return new St(e,this.config)}},St=class extends o{static[i]="PgSmallSerial";getSQLType(){return "smallserial"}};function Vr(t){return new Pt(t??"")}g$1();var Tt=class extends v{constructor(e,r,n){super(e,"string","PgTime"),this.withTimezone=r,this.precision=n,this.config.withTimezone=r,this.config.precision=n;}static[i]="PgTimeBuilder";build(e){return new Nt(e,this.config)}},Nt=class extends o{static[i]="PgTime";withTimezone;precision;constructor(e,r){super(e,r),this.withTimezone=r.withTimezone,this.precision=r.precision;}getSQLType(){return `time${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}};function Fr(t,e={}){let{name:r,config:n}=p(t,e);return new Tt(r,n.withTimezone??false,n.precision)}g$1();var Dt=class extends m{static[i]="PgBinaryVectorBuilder";constructor(e,r){super(e,"string","PgBinaryVector"),this.config.dimensions=r.dimensions;}build(e){return new vt(e,this.config)}},vt=class extends o{static[i]="PgBinaryVector";dimensions=this.config.dimensions;getSQLType(){return `bit(${this.dimensions})`}};function zr(t,e){let{name:r,config:n}=p(t,e);return new Dt(r,n)}g$1();var Vt=class extends m{static[i]="PgHalfVectorBuilder";constructor(e,r){super(e,"array","PgHalfVector"),this.config.dimensions=r.dimensions;}build(e){return new Ft(e,this.config)}},Ft=class extends o{static[i]="PgHalfVector";dimensions=this.config.dimensions;getSQLType(){return `halfvec(${this.dimensions})`}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){return e.slice(1,-1).split(",").map(r=>Number.parseFloat(r))}};function Br(t,e){let{name:r,config:n}=p(t,e);return new Vt(r,n)}g$1();var zt=class extends m{static[i]="PgSparseVectorBuilder";constructor(e,r){super(e,"string","PgSparseVector"),this.config.dimensions=r.dimensions;}build(e){return new Bt(e,this.config)}},Bt=class extends o{static[i]="PgSparseVector";dimensions=this.config.dimensions;getSQLType(){return `sparsevec(${this.dimensions})`}};function Qr(t,e){let{name:r,config:n}=p(t,e);return new zt(r,n)}g$1();var Qt=class extends m{static[i]="PgVectorBuilder";constructor(e,r){super(e,"array","PgVector"),this.config.dimensions=r.dimensions;}build(e){return new Lt(e,this.config)}},Lt=class extends o{static[i]="PgVector";dimensions=this.config.dimensions;getSQLType(){return `vector(${this.dimensions})`}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){return e.slice(1,-1).split(",").map(r=>Number.parseFloat(r))}};function Lr(t,e){let{name:r,config:n}=p(t,e);return new Qt(r,n)}function Ar(){return {bigint:ar,bigserial:mr,boolean:cr,char:lr,cidr:fr,customType:pr,date:gr,doublePrecision:dr,inet:hr,integer:rr,interval:yr,json:br,jsonb:nr,line:wr,macaddr:Cr,macaddr8:xr,numeric:ot,point:Pr,geometry:Tr,real:Nr,serial:Dr,smallint:vr,smallserial:Vr,text:ir,time:Fr,timestamp:sr,uuid:or,varchar:ur,bit:zr,halfvec:Br,sparsevec:Qr,vector:Lr}}var At=Symbol.for("drizzle:PgInlineForeignKeys"),Kr=Symbol.for("drizzle:EnableRLS"),j=class extends d{static[i]="PgTable";static Symbol=Object.assign({},d.Symbol,{InlineForeignKeys:At,EnableRLS:Kr});[At]=[];[Kr]=false;[d.Symbol.ExtraConfigBuilder]=void 0;[d.Symbol.ExtraConfigColumns]={}};function Ir(t,e,r,n,u=t){let c=new j(t,n,u),h=typeof e=="function"?e(Ar()):e,y=Object.fromEntries(Object.entries(h).map(([a,b])=>{let C=b;C.setName(a);let V=C.build(c);return c[At].push(...C.buildForeignKeys(V,c)),[a,V]})),w=Object.fromEntries(Object.entries(h).map(([a,b])=>{let C=b;C.setName(a);let V=C.buildExtraConfigColumn(c);return [a,V]})),x=Object.assign(c,y);return x[d.Symbol.Columns]=y,x[d.Symbol.ExtraConfigColumns]=w,r&&(x[j.Symbol.ExtraConfigBuilder]=r),Object.assign(x,{enableRLS:()=>(x[j.Symbol.EnableRLS]=true,x)})}var ma=(t,e,r)=>Ir(t,e,r,void 0);export{cr as $,P as A,L as B,Gn as C,Hn as D,Zt as E,kt as F,Xn as G,B as H,Yn as I,A as J,Q as K,Zn as L,kn as M,$ as N,ei as O,ti as P,ci as Q,tr as R,li as S,fi as T,pi as U,gi as V,di as W,hi as X,p as Y,yi as Z,bi as _,i as a,Ke as aa,Er as b,$e as ba,g as c,rr as ca,T as d,Je as da,O as e,ue as ea,N as f,nr as fa,o as g,tt as ga,Rt as h,xo as ha,z as i,ir as ia,Kt as j,Nt as ja,Xt as k,le as ka,D as l,pe as la,I as m,sr as ma,qt as n,de as na,$t as o,or as oa,_ as p,ur as pa,R as q,j as qa,q as r,ma as ra,jt as s,d as t,on as u,J as v,un as w,Yt as x,$r as y,S as z};
@@ -1,8 +0,0 @@
1
- import {c,a as a$2,b,d as d$2,e}from'./chunk-N5POANYV.js';import {a as a$1}from'./chunk-2HA6EKXX.js';import {i,$,T,Y,f,R as R$1,h,g as g$2,S as S$1,X as X$1,p,n,P,j,Q,d as d$1,aa as aa$1,k as k$1,l as l$1,Z as Z$1}from'./chunk-HRAY65XH.js';import {U,a,k,R,Z,X,c as c$1,A,i as i$1,N,l,t,S,qa,m,J,g as g$1,d,v,H as H$1,ea,da,ga,ja,ka,la,aa,ba,na,w,M,Q as Q$1,j as j$1,V,T as T$1,n as n$1}from'./chunk-3NSZZCOJ.js';import {g}from'./chunk-Y2YAKDEQ.js';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
2
- g();g();g();g();g();g();g();g();var ee=class extends N{static[a]="PgViewBase"};var H=class{static[a]="PgDialect";casing;constructor(e){this.casing=new b(e?.casing);}async migrate(e,t,i){let s=typeof i=="string"?"__drizzle_migrations":i.migrationsTable??"__drizzle_migrations",n=typeof i=="string"?"drizzle":i.migrationsSchema??"drizzle",o=J`
3
- CREATE TABLE IF NOT EXISTS ${J.identifier(n)}.${J.identifier(s)} (
4
- id SERIAL PRIMARY KEY,
5
- hash text NOT NULL,
6
- created_at bigint
7
- )
8
- `;await t.execute(J`CREATE SCHEMA IF NOT EXISTS ${J.identifier(n)}`),await t.execute(o);let h=(await t.all(J`select id, hash, created_at from ${J.identifier(n)}.${J.identifier(s)} order by created_at desc limit 1`))[0];await t.transaction(async u=>{for await(let d of e)if(!h||Number(h.created_at)<d.folderMillis){for(let w of d.sql)await u.execute(J.raw(w));await u.execute(J`insert into ${J.identifier(n)}.${J.identifier(s)} ("hash", "created_at") values(${d.hash}, ${d.folderMillis})`);}});}escapeName(e){return `"${e}"`}escapeParam(e){return `$${e+1}`}escapeString(e){return `'${e.replace(/'/g,"''")}'`}buildWithCTE(e){if(!e?.length)return;let t=[J`with `];for(let[i,s]of e.entries())t.push(J`${J.identifier(s._.alias)} as (${s._.sql})`),i<e.length-1&&t.push(J`, `);return t.push(J` `),J.join(t)}buildDeleteQuery({table:e,where:t,returning:i,withList:s}){let n=this.buildWithCTE(s),o=i?J` returning ${this.buildSelection(i,{isSingleTable:true})}`:void 0,a=t?J` where ${t}`:void 0;return J`${n}delete from ${e}${a}${o}`}buildUpdateSet(e,t$1){let i=e[t.Symbol.Columns],s=Object.keys(i).filter(o=>t$1[o]!==void 0||i[o]?.onUpdateFn!==void 0),n=s.length;return J.join(s.flatMap((o,a)=>{let h=i[o],u=t$1[o]??J.param(h.onUpdateFn(),h),d=J`${J.identifier(this.casing.getColumnCasing(h))} = ${u}`;return a<n-1?[d,J.raw(", ")]:[d]}))}buildUpdateQuery({table:e,set:t,where:i,returning:s,withList:n,from:o,joins:a}){let h=this.buildWithCTE(n),u=e[qa.Symbol.Name],d=e[qa.Symbol.Schema],w=e[qa.Symbol.OriginalName],$=u===w?void 0:u,x=J`${d?J`${J.identifier(d)}.`:void 0}${J.identifier(w)}${$&&J` ${J.identifier($)}`}`,q=this.buildUpdateSet(e,t),N=o&&J.join([J.raw(" from "),this.buildFromTable(o)]),C=this.buildJoins(a),y=s?J` returning ${this.buildSelection(s,{isSingleTable:!o})}`:void 0,j=i?J` where ${i}`:void 0;return J`${h}update ${x} set ${q}${N}${C}${j}${y}`}buildSelection(e,{isSingleTable:t=false}={}){let i=e.length,s=e.flatMap(({field:n},o)=>{let a=[];if(c$1(n,A.Aliased)&&n.isSelectionField)a.push(J.identifier(n.fieldAlias));else if(c$1(n,A.Aliased)||c$1(n,A)){let h=c$1(n,A.Aliased)?n.sql:n;t?a.push(new A(h.queryChunks.map(u=>c$1(u,g$1)?J.identifier(this.casing.getColumnCasing(u)):u))):a.push(h),c$1(n,A.Aliased)&&a.push(J` as ${J.identifier(n.fieldAlias)}`);}else c$1(n,d)&&(t?a.push(J.identifier(this.casing.getColumnCasing(n))):a.push(n));return o<i-1&&a.push(J`, `),a});return J.join(s)}buildJoins(e){if(!e||e.length===0)return;let t=[];for(let[i,s]of e.entries()){i===0&&t.push(J` `);let n=s.table,o=s.lateral?J` lateral`:void 0,a=s.on?J` on ${s.on}`:void 0;if(c$1(n,qa)){let h=n[qa.Symbol.Name],u=n[qa.Symbol.Schema],d=n[qa.Symbol.OriginalName],w=h===d?void 0:s.alias;t.push(J`${J.raw(s.joinType)} join${o} ${u?J`${J.identifier(u)}.`:void 0}${J.identifier(d)}${w&&J` ${J.identifier(w)}`}${a}`);}else if(c$1(n,N)){let h=n[l].name,u=n[l].schema,d=n[l].originalName,w=h===d?void 0:s.alias;t.push(J`${J.raw(s.joinType)} join${o} ${u?J`${J.identifier(u)}.`:void 0}${J.identifier(d)}${w&&J` ${J.identifier(w)}`}${a}`);}else t.push(J`${J.raw(s.joinType)} join${o} ${n}${a}`);i<e.length-1&&t.push(J` `);}return J.join(t)}buildFromTable(e){if(c$1(e,t)&&e[t.Symbol.IsAlias]){let t$1=J`${J.identifier(e[t.Symbol.OriginalName])}`;return e[t.Symbol.Schema]&&(t$1=J`${J.identifier(e[t.Symbol.Schema])}.${t$1}`),J`${t$1} ${J.identifier(e[t.Symbol.Name])}`}return e}buildSelectQuery({withList:e,fields:t$1,fieldsFlat:i,where:s,having:n,table:o,joins:a,orderBy:h,groupBy:u,limit:d$1,offset:w,lockingClause:$,distinct:x,setOperators:q}){let N=i??R(t$1);for(let B of N)if(c$1(B.field,d)&&v(B.field.table)!==(c$1(o,i$1)?o._.alias:c$1(o,ee)?o[l].name:c$1(o,A)?void 0:v(o))&&!(R=>a?.some(({alias:je})=>je===(R[t.Symbol.IsAlias]?v(R):R[t.Symbol.BaseName])))(B.field.table)){let R=v(B.field.table);throw new Error(`Your "${B.path.join("->")}" field references a column "${R}"."${B.field.name}", but the table "${R}" is not part of the query! Did you forget to join it?`)}let C=!a||a.length===0,y=this.buildWithCTE(e),j;x&&(j=x===true?J` distinct`:J` distinct on (${J.join(x.on,J`, `)})`);let L=this.buildSelection(N,{isSingleTable:C}),Q=this.buildFromTable(o),W=this.buildJoins(a),k=s?J` where ${s}`:void 0,m=n?J` having ${n}`:void 0,p;h&&h.length>0&&(p=J` order by ${J.join(h,J`, `)}`);let M;u&&u.length>0&&(M=J` group by ${J.join(u,J`, `)}`);let he=typeof d$1=="object"||typeof d$1=="number"&&d$1>=0?J` limit ${d$1}`:void 0,Qe=w?J` offset ${w}`:void 0,G=J.empty();if($){let B=J` for ${J.raw($.strength)}`;$.config.of&&B.append(J` of ${J.join(Array.isArray($.config.of)?$.config.of:[$.config.of],J`, `)}`),$.config.noWait?B.append(J` nowait`):$.config.skipLocked&&B.append(J` skip locked`),G.append(B);}let U=J`${y}select${j} ${L} from ${Q}${W}${k}${M}${m}${p}${he}${Qe}${G}`;return q.length>0?this.buildSetOperations(U,q):U}buildSetOperations(e,t){let[i,...s]=t;if(!i)throw new Error("Cannot pass undefined values to any set operator");return s.length===0?this.buildSetOperationQuery({leftSelect:e,setOperator:i}):this.buildSetOperations(this.buildSetOperationQuery({leftSelect:e,setOperator:i}),s)}buildSetOperationQuery({leftSelect:e,setOperator:{type:t,isAll:i,rightSelect:s,limit:n,orderBy:o,offset:a}}){let h=J`(${e.getSQL()}) `,u=J`(${s.getSQL()})`,d;if(o&&o.length>0){let q=[];for(let N of o)if(c$1(N,g$1))q.push(J.identifier(N.name));else if(c$1(N,A)){for(let C=0;C<N.queryChunks.length;C++){let y=N.queryChunks[C];c$1(y,g$1)&&(N.queryChunks[C]=J.identifier(y.name));}q.push(J`${N}`);}else q.push(J`${N}`);d=J` order by ${J.join(q,J`, `)} `;}let w=typeof n=="object"||typeof n=="number"&&n>=0?J` limit ${n}`:void 0,$=J.raw(`${t} ${i?"all ":""}`),x=a?J` offset ${a}`:void 0;return J`${h}${$}${u}${d}${w}${x}`}buildInsertQuery({table:e,values:t$1,onConflict:i,returning:s,withList:n,select:o,overridingSystemValue_:a}){let h=[],u=e[t.Symbol.Columns],d=Object.entries(u).filter(([y,j])=>!j.shouldDisableInsert()),w=d.map(([,y])=>J.identifier(this.casing.getColumnCasing(y)));if(o){let y=t$1;c$1(y,A)?h.push(y):h.push(y.getSQL());}else {let y=t$1;h.push(J.raw("values "));for(let[j,L]of y.entries()){let Q=[];for(let[W,k]of d){let m=L[W];if(m===void 0||c$1(m,H$1)&&m.value===void 0)if(k.defaultFn!==void 0){let p=k.defaultFn(),M=c$1(p,A)?p:J.param(p,k);Q.push(M);}else if(!k.default&&k.onUpdateFn!==void 0){let p=k.onUpdateFn(),M=c$1(p,A)?p:J.param(p,k);Q.push(M);}else Q.push(J`default`);else Q.push(m);}h.push(Q),j<y.length-1&&h.push(J`, `);}}let $=this.buildWithCTE(n),x=J.join(h),q=s?J` returning ${this.buildSelection(s,{isSingleTable:true})}`:void 0,N=i?J` on conflict ${i}`:void 0,C=a===true?J`overriding system value `:void 0;return J`${$}insert into ${e} ${w} ${C}${x}${N}${q}`}buildRefreshMaterializedViewQuery({view:e,concurrently:t,withNoData:i}){let s=t?J` concurrently`:void 0,n=i?J` with no data`:void 0;return J`refresh materialized view${s} ${e}${n}`}prepareTyping(e){return c$1(e,ea)||c$1(e,da)?"json":c$1(e,ga)?"decimal":c$1(e,ja)?"time":c$1(e,ka)||c$1(e,la)?"timestamp":c$1(e,aa)||c$1(e,ba)?"date":c$1(e,na)?"uuid":"none"}sqlToQuery(e,t){return e.toQuery({casing:this.casing,escapeName:this.escapeName,escapeParam:this.escapeParam,escapeString:this.escapeString,prepareTyping:this.prepareTyping,invokeSource:t})}buildRelationalQueryWithoutPK({fullSchema:e,schema:t,tableNamesMap:i,table:s,tableConfig:n$1,queryConfig:o,tableAlias:a,nestedQueryRelation:h$1,joinOn:u}){let d$2=[],w$1,$,x=[],q,N=[];if(o===true)d$2=Object.entries(n$1.columns).map(([j,L])=>({dbKey:L.name,tsKey:j,field:f(L,a),relationTableTsKey:void 0,isJson:false,selection:[]}));else {let y=Object.fromEntries(Object.entries(n$1.columns).map(([m,p])=>[m,f(p,a)]));if(o.where){let m=typeof o.where=="function"?o.where(y,R$1()):o.where;q=m&&h(m,a);}let j=[],L=[];if(o.columns){let m=false;for(let[p,M]of Object.entries(o.columns))M!==void 0&&p in n$1.columns&&(!m&&M===true&&(m=true),L.push(p));L.length>0&&(L=m?L.filter(p=>o.columns?.[p]===true):Object.keys(n$1.columns).filter(p=>!L.includes(p)));}else L=Object.keys(n$1.columns);for(let m of L){let p=n$1.columns[m];j.push({tsKey:m,value:p});}let Q=[];o.with&&(Q=Object.entries(o.with).filter(m=>!!m[1]).map(([m,p])=>({tsKey:m,queryConfig:p,relation:n$1.relations[m]})));let W;if(o.extras){W=typeof o.extras=="function"?o.extras(y,{sql:J}):o.extras;for(let[m,p]of Object.entries(W))j.push({tsKey:m,value:g$2(p,a)});}for(let{tsKey:m,value:p}of j)d$2.push({dbKey:c$1(p,A.Aliased)?p.fieldAlias:n$1.columns[m].name,tsKey:m,field:c$1(p,d)?f(p,a):p,relationTableTsKey:void 0,isJson:false,selection:[]});let k=typeof o.orderBy=="function"?o.orderBy(y,S$1()):o.orderBy??[];Array.isArray(k)||(k=[k]),x=k.map(m=>c$1(m,d)?f(m,a):h(m,a)),w$1=o.limit,$=o.offset;for(let{tsKey:m,queryConfig:p$1,relation:M}of Q){let he=X$1(t,i,M),Qe=w(M.referencedTable),G=i[Qe],U=`${a}_${m}`,B=p(...he.fields.map((bt,wt)=>n(f(he.references[wt],U),f(bt,a)))),R=this.buildRelationalQueryWithoutPK({fullSchema:e,schema:t,tableNamesMap:i,table:e[G],tableConfig:t[G],queryConfig:c$1(M,P)?p$1===true?{limit:1}:{...p$1,limit:1}:p$1,tableAlias:U,joinOn:B,nestedQueryRelation:M}),je=J`${J.identifier(U)}.${J.identifier("data")}`.as(m);N.push({on:J`true`,table:new i$1(R.sql,{},U),alias:U,joinType:"left",lateral:true}),d$2.push({dbKey:m,tsKey:m,field:je,relationTableTsKey:G,isJson:true,selection:R.selection});}}if(d$2.length===0)throw new j({message:`No fields selected for table "${n$1.tsName}" ("${a}")`});let C;if(q=p(u,q),h$1){let y=J`json_build_array(${J.join(d$2.map(({field:Q,tsKey:W,isJson:k})=>k?J`${J.identifier(`${a}_${W}`)}.${J.identifier("data")}`:c$1(Q,A.Aliased)?Q.sql:Q),J`, `)})`;c$1(h$1,Q)&&(y=J`coalesce(json_agg(${y}${x.length>0?J` order by ${J.join(x,J`, `)}`:void 0}), '[]'::json)`);let j=[{dbKey:"data",tsKey:"data",field:y.as("data"),isJson:true,relationTableTsKey:n$1.tsName,selection:d$2}];w$1!==void 0||$!==void 0||x.length>0?(C=this.buildSelectQuery({table:d$1(s,a),fields:{},fieldsFlat:[{path:[],field:J.raw("*")}],where:q,limit:w$1,offset:$,orderBy:x,setOperators:[]}),q=void 0,w$1=void 0,$=void 0,x=[]):C=d$1(s,a),C=this.buildSelectQuery({table:c$1(C,qa)?C:new i$1(C,{},a),fields:{},fieldsFlat:j.map(({field:Q})=>({path:[],field:c$1(Q,d)?f(Q,a):Q})),joins:N,where:q,limit:w$1,offset:$,orderBy:x,setOperators:[]});}else C=this.buildSelectQuery({table:d$1(s,a),fields:{},fieldsFlat:d$2.map(({field:y})=>({path:[],field:c$1(y,d)?f(y,a):y})),joins:N,where:q,limit:w$1,offset:$,orderBy:x,setOperators:[]});return {tableTsKey:n$1.tsName,sql:C,selection:d$2}}};g();var z=class{static[a]="PgSelectBuilder";fields;session;dialect;withList=[];distinct;constructor(e){this.fields=e.fields,this.session=e.session,this.dialect=e.dialect,e.withList&&(this.withList=e.withList),this.distinct=e.distinct;}authToken;setToken(e){return this.authToken=e,this}from(e){let t=!!this.fields,i=e,s;return this.fields?s=this.fields:c$1(i,i$1)?s=Object.fromEntries(Object.keys(i._.selectedFields).map(n=>[n,i[n]])):c$1(i,ee)?s=i[l].selectedFields:c$1(i,A)?s={}:s=V(i),new be({table:i,fields:s,isPartialSelect:t,session:this.session,dialect:this.dialect,withList:this.withList,distinct:this.distinct}).setToken(this.authToken)}},Me=class extends c{static[a]="PgSelectQueryBuilder";_;config;joinsNotNullableMap;tableName;isPartialSelect;session;dialect;cacheConfig=void 0;usedTables=new Set;constructor({table:e,fields:t,isPartialSelect:i,session:s,dialect:n,withList:o,distinct:a}){super(),this.config={withList:o,table:e,fields:{...t},distinct:a,setOperators:[]},this.isPartialSelect=i,this.session=s,this.dialect=n,this._={selectedFields:t,config:this.config},this.tableName=X(e),this.joinsNotNullableMap=typeof this.tableName=="string"?{[this.tableName]:true}:{};for(let h of E(e))this.usedTables.add(h);}getUsedTables(){return [...this.usedTables]}createJoin(e,t$1){return (i,s)=>{let n=this.tableName,o=X(i);for(let a of E(i))this.usedTables.add(a);if(typeof o=="string"&&this.config.joins?.some(a=>a.alias===o))throw new Error(`Alias "${o}" is already used in this query`);if(!this.isPartialSelect&&(Object.keys(this.joinsNotNullableMap).length===1&&typeof n=="string"&&(this.config.fields={[n]:this.config.fields}),typeof o=="string"&&!c$1(i,A))){let a=c$1(i,i$1)?i._.selectedFields:c$1(i,N)?i[l].selectedFields:i[t.Symbol.Columns];this.config.fields[o]=a;}if(typeof s=="function"&&(s=s(new Proxy(this.config.fields,new a$2({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.joins||(this.config.joins=[]),this.config.joins.push({on:s,table:i,joinType:e,alias:o,lateral:t$1}),typeof o=="string")switch(e){case "left":{this.joinsNotNullableMap[o]=false;break}case "right":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([a])=>[a,false])),this.joinsNotNullableMap[o]=true;break}case "cross":case "inner":{this.joinsNotNullableMap[o]=true;break}case "full":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([a])=>[a,false])),this.joinsNotNullableMap[o]=false;break}}return this}}leftJoin=this.createJoin("left",false);leftJoinLateral=this.createJoin("left",true);rightJoin=this.createJoin("right",false);innerJoin=this.createJoin("inner",false);innerJoinLateral=this.createJoin("inner",true);fullJoin=this.createJoin("full",false);crossJoin=this.createJoin("cross",false);crossJoinLateral=this.createJoin("cross",true);createSetOperator(e,t){return i=>{let s=typeof i=="function"?i(St()):i;if(!S(this.getSelectedFields(),s.getSelectedFields()))throw new 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:s}),this}}union=this.createSetOperator("union",false);unionAll=this.createSetOperator("union",true);intersect=this.createSetOperator("intersect",false);intersectAll=this.createSetOperator("intersect",true);except=this.createSetOperator("except",false);exceptAll=this.createSetOperator("except",true);addSetOperators(e){return this.config.setOperators.push(...e),this}where(e){return typeof e=="function"&&(e=e(new Proxy(this.config.fields,new a$2({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.where=e,this}having(e){return typeof e=="function"&&(e=e(new Proxy(this.config.fields,new a$2({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.having=e,this}groupBy(...e){if(typeof e[0]=="function"){let t=e[0](new Proxy(this.config.fields,new a$2({sqlAliasedBehavior:"alias",sqlBehavior:"sql"})));this.config.groupBy=Array.isArray(t)?t:[t];}else this.config.groupBy=e;return this}orderBy(...e){if(typeof e[0]=="function"){let t=e[0](new Proxy(this.config.fields,new a$2({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 {let t=e;this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=t:this.config.orderBy=t;}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}for(e,t={}){return this.config.lockingClause={strength:e,config:t},this}getSQL(){return this.dialect.buildSelectQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}as(e){let t=[];if(t.push(...E(this.config.table)),this.config.joins)for(let i of this.config.joins)t.push(...E(i.table));return new Proxy(new i$1(this.getSQL(),this.config.fields,e,false,[...new Set(t)]),new a$2({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}getSelectedFields(){return new Proxy(this.config.fields,new a$2({alias:this.tableName,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}$dynamic(){return this}$withCache(e){return this.cacheConfig=e===void 0?{config:{},enable:true,autoInvalidate:true}:e===false?{enable:false}:{enable:true,autoInvalidate:true,...e},this}},be=class extends Me{static[a]="PgSelect";_prepare(e){let{session:t,config:i,dialect:s,joinsNotNullableMap:n,authToken:o,cacheConfig:a,usedTables:h}=this;if(!t)throw new Error("Cannot execute a query on a query builder. Please use a database instance instead.");let{fields:u}=i;return k.startActiveSpan("drizzle.prepareQuery",()=>{let d=R(u),w=t.prepareQuery(s.sqlToQuery(this.getSQL()),d,e,true,void 0,{type:"select",tables:[...h]},a);return w.joinsNotNullableMap=n,w.setToken(o)})}prepare(e){return this._prepare(e)}authToken;setToken(e){return this.authToken=e,this}execute=e=>k.startActiveSpan("drizzle.operation",()=>this._prepare().execute(e,this.authToken))};U(be,[i]);function te(c,e){return (t,i,...s)=>{let n=[i,...s].map(o=>({type:c,isAll:e,rightSelect:o}));for(let o of n)if(!S(t.getSelectedFields(),o.rightSelect.getSelectedFields()))throw new Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return t.addSetOperators(n)}}var St=()=>({union:vt,unionAll:$t,intersect:Tt,intersectAll:qt,except:Nt,exceptAll:Ct}),vt=te("union",false),$t=te("union",true),Tt=te("intersect",false),qt=te("intersect",true),Nt=te("except",false),Ct=te("except",true);var ie=class{static[a]="PgQueryBuilder";dialect;dialectConfig;constructor(e){this.dialect=c$1(e,H)?e:void 0,this.dialectConfig=c$1(e,H)?void 0:e;}$with=(e,t)=>{let i=this;return {as:n=>(typeof n=="function"&&(n=n(i)),new Proxy(new j$1(n.getSQL(),t??("getSelectedFields"in n?n.getSelectedFields()??{}:{}),e,true),new a$2({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"})))}};with(...e){let t=this;function i(o){return new z({fields:o??void 0,session:void 0,dialect:t.getDialect(),withList:e})}function s(o){return new z({fields:o??void 0,session:void 0,dialect:t.getDialect(),distinct:true})}function n(o,a){return new z({fields:a??void 0,session:void 0,dialect:t.getDialect(),distinct:{on:o}})}return {select:i,selectDistinct:s,selectDistinctOn:n}}select(e){return new z({fields:e??void 0,session:void 0,dialect:this.getDialect()})}selectDistinct(e){return new z({fields:e??void 0,session:void 0,dialect:this.getDialect(),distinct:true})}selectDistinctOn(e,t){return new z({fields:t??void 0,session:void 0,dialect:this.getDialect(),distinct:{on:e}})}getDialect(){return this.dialect||(this.dialect=new H(this.dialectConfig)),this.dialect}};function E(c){return c$1(c,qa)?[c[m]?`${c[m]}.${c[t.Symbol.BaseName]}`:c[t.Symbol.BaseName]]:c$1(c,i$1)?c._.usedTables??[]:c$1(c,A)?c.usedTables??[]:[]}var oe=class extends i{constructor(e,t,i,s){super(),this.session=t,this.dialect=i,this.config={table:e,withList:s};}static[a]="PgDelete";config;cacheConfig;where(e){return this.config.where=e,this}returning(e=this.config.table[t.Symbol.Columns]){return this.config.returningFields=e,this.config.returning=R(e),this}getSQL(){return this.dialect.buildDeleteQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e){return k.startActiveSpan("drizzle.prepareQuery",()=>this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,e,true,void 0,{type:"delete",tables:E(this.config.table)},this.cacheConfig))}prepare(e){return this._prepare(e)}authToken;setToken(e){return this.authToken=e,this}execute=e=>k.startActiveSpan("drizzle.operation",()=>this._prepare().execute(e,this.authToken));getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new a$2({alias:v(this.config.table),sqlAliasedBehavior:"alias",sqlBehavior:"error"})):void 0}$dynamic(){return this}};g();var ae=class{constructor(e,t,i,s,n){this.table=e,this.session=t,this.dialect=i,this.withList=s,this.overridingSystemValue_=n;}static[a]="PgInsertBuilder";authToken;setToken(e){return this.authToken=e,this}overridingSystemValue(){return this.overridingSystemValue_=true,this}values(e){if(e=Array.isArray(e)?e:[e],e.length===0)throw new Error("values() must be called with at least one value");let t$1=e.map(i=>{let s={},n=this.table[t.Symbol.Columns];for(let o of Object.keys(i)){let a=i[o];s[o]=c$1(a,A)?a:new H$1(a,n[o]);}return s});return new we(this.table,t$1,this.session,this.dialect,this.withList,false,this.overridingSystemValue_).setToken(this.authToken)}select(e){let t=typeof e=="function"?e(new ie):e;if(!c$1(t,A)&&!S(this.table[n$1],t._.selectedFields))throw new Error("Insert select error: selected fields are not the same or are in a different order compared to the table definition");return new we(this.table,t,this.session,this.dialect,this.withList,true)}},we=class extends i{constructor(e,t,i,s,n,o,a){super(),this.session=i,this.dialect=s,this.config={table:e,values:t,withList:n,select:o,overridingSystemValue_:a};}static[a]="PgInsert";config;cacheConfig;returning(e=this.config.table[t.Symbol.Columns]){return this.config.returningFields=e,this.config.returning=R(e),this}onConflictDoNothing(e={}){if(e.target===void 0)this.config.onConflict=J`do nothing`;else {let t="";t=Array.isArray(e.target)?e.target.map(s=>this.dialect.escapeName(this.dialect.casing.getColumnCasing(s))).join(","):this.dialect.escapeName(this.dialect.casing.getColumnCasing(e.target));let i=e.where?J` where ${e.where}`:void 0;this.config.onConflict=J`(${J.raw(t)})${i} do nothing`;}return this}onConflictDoUpdate(e){if(e.where&&(e.targetWhere||e.setWhere))throw new Error('You cannot use both "where" and "targetWhere"/"setWhere" at the same time - "where" is deprecated, use "targetWhere" or "setWhere" instead.');let t=e.where?J` where ${e.where}`:void 0,i=e.targetWhere?J` where ${e.targetWhere}`:void 0,s=e.setWhere?J` where ${e.setWhere}`:void 0,n=this.dialect.buildUpdateSet(this.config.table,T$1(this.config.table,e.set)),o="";return o=Array.isArray(e.target)?e.target.map(a=>this.dialect.escapeName(this.dialect.casing.getColumnCasing(a))).join(","):this.dialect.escapeName(this.dialect.casing.getColumnCasing(e.target)),this.config.onConflict=J`(${J.raw(o)})${i} do update set ${n}${t}${s}`,this}getSQL(){return this.dialect.buildInsertQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e){return k.startActiveSpan("drizzle.prepareQuery",()=>this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,e,true,void 0,{type:"insert",tables:E(this.config.table)},this.cacheConfig))}prepare(e){return this._prepare(e)}authToken;setToken(e){return this.authToken=e,this}execute=e=>k.startActiveSpan("drizzle.operation",()=>this._prepare().execute(e,this.authToken));getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new a$2({alias:v(this.config.table),sqlAliasedBehavior:"alias",sqlBehavior:"error"})):void 0}$dynamic(){return this}};g();var Se=class extends i{constructor(e,t,i){super(),this.session=t,this.dialect=i,this.config={view:e};}static[a]="PgRefreshMaterializedView";config;concurrently(){if(this.config.withNoData!==void 0)throw new Error("Cannot use concurrently and withNoData together");return this.config.concurrently=true,this}withNoData(){if(this.config.concurrently!==void 0)throw new Error("Cannot use concurrently and withNoData together");return this.config.withNoData=true,this}getSQL(){return this.dialect.buildRefreshMaterializedViewQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e){return k.startActiveSpan("drizzle.prepareQuery",()=>this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),void 0,e,true))}prepare(e){return this._prepare(e)}authToken;setToken(e){return this.authToken=e,this}execute=e=>k.startActiveSpan("drizzle.operation",()=>this._prepare().execute(e,this.authToken))};g();var le=class{constructor(e,t,i,s){this.table=e,this.session=t,this.dialect=i,this.withList=s;}static[a]="PgUpdateBuilder";authToken;setToken(e){return this.authToken=e,this}set(e){return new Ae(this.table,T$1(this.table,e),this.session,this.dialect,this.withList).setToken(this.authToken)}},Ae=class extends i{constructor(e,t,i,s,n){super(),this.session=i,this.dialect=s,this.config={set:t,table:e,withList:n,joins:[]},this.tableName=X(e),this.joinsNotNullableMap=typeof this.tableName=="string"?{[this.tableName]:true}:{};}static[a]="PgUpdate";config;tableName;joinsNotNullableMap;cacheConfig;from(e){let t=e,i=X(t);return typeof i=="string"&&(this.joinsNotNullableMap[i]=true),this.config.from=t,this}getTableLikeFields(e){return c$1(e,qa)?e[t.Symbol.Columns]:c$1(e,i$1)?e._.selectedFields:e[l].selectedFields}createJoin(e){return (t$1,i)=>{let s=X(t$1);if(typeof s=="string"&&this.config.joins.some(n=>n.alias===s))throw new Error(`Alias "${s}" is already used in this query`);if(typeof i=="function"){let n=this.config.from&&!c$1(this.config.from,A)?this.getTableLikeFields(this.config.from):void 0;i=i(new Proxy(this.config.table[t.Symbol.Columns],new a$2({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})),n&&new Proxy(n,new a$2({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));}if(this.config.joins.push({on:i,table:t$1,joinType:e,alias:s}),typeof s=="string")switch(e){case "left":{this.joinsNotNullableMap[s]=false;break}case "right":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([n])=>[n,false])),this.joinsNotNullableMap[s]=true;break}case "inner":{this.joinsNotNullableMap[s]=true;break}case "full":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([n])=>[n,false])),this.joinsNotNullableMap[s]=false;break}}return 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}returning(e){if(!e&&(e=Object.assign({},this.config.table[t.Symbol.Columns]),this.config.from)){let t=X(this.config.from);if(typeof t=="string"&&this.config.from&&!c$1(this.config.from,A)){let i=this.getTableLikeFields(this.config.from);e[t]=i;}for(let i of this.config.joins){let s=X(i.table);if(typeof s=="string"&&!c$1(i.table,A)){let n=this.getTableLikeFields(i.table);e[s]=n;}}}return this.config.returningFields=e,this.config.returning=R(e),this}getSQL(){return this.dialect.buildUpdateQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e){let t=this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,e,true,void 0,{type:"insert",tables:E(this.config.table)},this.cacheConfig);return t.joinsNotNullableMap=this.joinsNotNullableMap,t}prepare(e){return this._prepare(e)}authToken;setToken(e){return this.authToken=e,this}execute=e=>this._prepare().execute(e,this.authToken);getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new a$2({alias:v(this.config.table),sqlAliasedBehavior:"alias",sqlBehavior:"error"})):void 0}$dynamic(){return this}};g();var ve=class c extends A{constructor(e){super(c.buildEmbeddedCount(e.source,e.filters).queryChunks),this.params=e,this.mapWith(Number),this.session=e.session,this.sql=c.buildCount(e.source,e.filters);}sql;token;static[a]="PgCountBuilder";[Symbol.toStringTag]="PgCountBuilder";session;static buildEmbeddedCount(e,t){return J`(select count(*) from ${e}${J.raw(" where ").if(t)}${t})`}static buildCount(e,t){return J`select count(*) as count from ${e}${J.raw(" where ").if(t)}${t};`}setToken(e){return this.token=e,this}then(e,t){return Promise.resolve(this.session.count(this.sql,this.token)).then(e,t)}catch(e){return this.then(void 0,e)}finally(e){return this.then(t=>(e?.(),t),t=>{throw e?.(),t})}};g();var $e=class{constructor(e,t,i,s,n,o,a){this.fullSchema=e,this.schema=t,this.tableNamesMap=i,this.table=s,this.tableConfig=n,this.dialect=o,this.session=a;}static[a]="PgRelationalQueryBuilder";findMany(e){return new Te(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e||{},"many")}findFirst(e){return new Te(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e?{...e,limit:1}:{limit:1},"first")}},Te=class extends i{constructor(e,t,i,s,n,o,a,h,u){super(),this.fullSchema=e,this.schema=t,this.tableNamesMap=i,this.table=s,this.tableConfig=n,this.dialect=o,this.session=a,this.config=h,this.mode=u;}static[a]="PgRelationalQuery";_prepare(e){return k.startActiveSpan("drizzle.prepareQuery",()=>{let{query:t,builtQuery:i}=this._toSQL();return this.session.prepareQuery(i,void 0,e,true,(s,n)=>{let o=s.map(a=>Z$1(this.schema,this.tableConfig,a,t.selection,n));return this.mode==="first"?o[0]:o})})}prepare(e){return this._prepare(e)}_getQuery(){return this.dialect.buildRelationalQueryWithoutPK({fullSchema:this.fullSchema,schema:this.schema,tableNamesMap:this.tableNamesMap,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,tableAlias:this.tableConfig.tsName})}getSQL(){return this._getQuery().sql}_toSQL(){let e=this._getQuery(),t=this.dialect.sqlToQuery(e.sql);return {query:e,builtQuery:t}}toSQL(){return this._toSQL().builtQuery}authToken;setToken(e){return this.authToken=e,this}execute(){return k.startActiveSpan("drizzle.operation",()=>this._prepare().execute(void 0,this.authToken))}};g();var qe=class extends i{constructor(e,t,i,s){super(),this.execute=e,this.sql=t,this.query=i,this.mapBatchResult=s;}static[a]="PgRaw";getSQL(){return this.sql}getQuery(){return this.query}mapResult(e,t){return t?this.mapBatchResult(e):e}_prepare(){return this}isResponseInArrayMode(){return false}};var se=class{constructor(e,t,i){if(this.dialect=e,this.session=t,this._=i?{schema:i.schema,fullSchema:i.fullSchema,tableNamesMap:i.tableNamesMap,session:t}:{schema:void 0,fullSchema:{},tableNamesMap:{},session:t},this.query={},this._.schema)for(let[s,n]of Object.entries(this._.schema))this.query[s]=new $e(i.fullSchema,this._.schema,this._.tableNamesMap,i.fullSchema[s],n,e,t);this.$cache={invalidate:async s=>{}};}static[a]="PgDatabase";query;$with=(e,t)=>{let i=this;return {as:n=>(typeof n=="function"&&(n=n(new ie(i.dialect))),new Proxy(new j$1(n.getSQL(),t??("getSelectedFields"in n?n.getSelectedFields()??{}:{}),e,true),new a$2({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"})))}};$count(e,t){return new ve({source:e,filters:t,session:this.session})}$cache;with(...e){let t=this;function i(u){return new z({fields:u??void 0,session:t.session,dialect:t.dialect,withList:e})}function s(u){return new z({fields:u??void 0,session:t.session,dialect:t.dialect,withList:e,distinct:true})}function n(u,d){return new z({fields:d??void 0,session:t.session,dialect:t.dialect,withList:e,distinct:{on:u}})}function o(u){return new le(u,t.session,t.dialect,e)}function a(u){return new ae(u,t.session,t.dialect,e)}function h(u){return new oe(u,t.session,t.dialect,e)}return {select:i,selectDistinct:s,selectDistinctOn:n,update:o,insert:a,delete:h}}select(e){return new z({fields:e??void 0,session:this.session,dialect:this.dialect})}selectDistinct(e){return new z({fields:e??void 0,session:this.session,dialect:this.dialect,distinct:true})}selectDistinctOn(e,t){return new z({fields:t??void 0,session:this.session,dialect:this.dialect,distinct:{on:e}})}update(e){return new le(e,this.session,this.dialect)}insert(e){return new ae(e,this.session,this.dialect)}delete(e){return new oe(e,this.session,this.dialect)}refreshMaterializedView(e){return new Se(e,this.session,this.dialect)}authToken;execute(e){let t=typeof e=="string"?J.raw(e):e.getSQL(),i=this.dialect.sqlToQuery(t),s=this.session.prepareQuery(i,void 0,void 0,false);return new qe(()=>s.execute(void 0,this.authToken),t,i,n=>s.mapResult(n,true))}transaction(e,t){return this.session.transaction(e,t)}};g();g();var Ne=class{constructor(e,t,i,s){this.query=e,this.cache=t,this.queryMetadata=i,this.cacheConfig=s,t&&t.strategy()==="all"&&s===void 0&&(this.cacheConfig={enable:true,autoInvalidate:true}),this.cacheConfig?.enable||(this.cacheConfig=void 0);}authToken;getQuery(){return this.query}mapResult(e,t){return e}setToken(e){return this.authToken=e,this}static[a]="PgPreparedQuery";joinsNotNullableMap;async queryWithCache(e$1,t,i){if(this.cache===void 0||c$1(this.cache,d$2)||this.queryMetadata===void 0)try{return await i()}catch(s){throw new k$1(e$1,t,s)}if(this.cacheConfig&&!this.cacheConfig.enable)try{return await i()}catch(s){throw new k$1(e$1,t,s)}if((this.queryMetadata.type==="insert"||this.queryMetadata.type==="update"||this.queryMetadata.type==="delete")&&this.queryMetadata.tables.length>0)try{let[s]=await Promise.all([i(),this.cache.onMutate({tables:this.queryMetadata.tables})]);return s}catch(s){throw new k$1(e$1,t,s)}if(!this.cacheConfig)try{return await i()}catch(s){throw new k$1(e$1,t,s)}if(this.queryMetadata.type==="select"){let s=await this.cache.get(this.cacheConfig.tag??await e(e$1,t),this.queryMetadata.tables,this.cacheConfig.tag!==void 0,this.cacheConfig.autoInvalidate);if(s===void 0){let n;try{n=await i();}catch(o){throw new k$1(e$1,t,o)}return await this.cache.put(this.cacheConfig.tag??await e(e$1,t),n,this.cacheConfig.autoInvalidate?this.queryMetadata.tables:[],this.cacheConfig.tag!==void 0,this.cacheConfig.config),n}return s}try{return await i()}catch(s){throw new k$1(e$1,t,s)}}},Ce=class{constructor(e){this.dialect=e;}static[a]="PgSession";execute(e,t){return k.startActiveSpan("drizzle.operation",()=>k.startActiveSpan("drizzle.prepareQuery",()=>this.prepareQuery(this.dialect.sqlToQuery(e),void 0,void 0,false)).setToken(t).execute(void 0,t))}all(e){return this.prepareQuery(this.dialect.sqlToQuery(e),void 0,void 0,false).all()}async count(e,t){let i=await this.execute(e,t);return Number(i[0].count)}},xe=class extends se{constructor(e,t,i,s=0){super(e,t,i),this.schema=i,this.nestedIndex=s;}static[a]="PgTransaction";rollback(){throw new l$1}getTransactionConfigSQL(e){let t=[];return e.isolationLevel&&t.push(`isolation level ${e.isolationLevel}`),e.accessMode&&t.push(e.accessMode),typeof e.deferrable=="boolean"&&t.push(e.deferrable?"deferrable":"not deferrable"),J.raw(t.join(" "))}setTransaction(e){return this.session.execute(J`set transaction ${this.getTransactionConfigSQL(e)}`)}};var Be=class extends Ne{constructor(e,t,i,s,n,o,a,h,u,d){super({sql:t,params:i},n,o,a),this.client=e,this.queryString=t,this.params=i,this.logger=s,this.fields=h,this._isResponseInArrayMode=u,this.customResultMapper=d;}static[a]="PostgresJsPreparedQuery";async execute(e={}){return k.startActiveSpan("drizzle.execute",async t=>{let i=M(this.params,e);t?.setAttributes({"drizzle.query.text":this.queryString,"drizzle.query.params":JSON.stringify(i)}),this.logger.logQuery(this.queryString,i);let{fields:s,queryString:n,client:o,joinsNotNullableMap:a,customResultMapper:h}=this;if(!s&&!h)return k.startActiveSpan("drizzle.driver.execute",()=>this.queryWithCache(n,i,async()=>await o.unsafe(n,i)));let u=await k.startActiveSpan("drizzle.driver.execute",()=>(t?.setAttributes({"drizzle.query.text":n,"drizzle.query.params":JSON.stringify(i)}),this.queryWithCache(n,i,async()=>await o.unsafe(n,i).values())));return k.startActiveSpan("drizzle.mapResponse",()=>h?h(u):u.map(d=>Q$1(s,d,a)))})}all(e={}){return k.startActiveSpan("drizzle.execute",async t=>{let i=M(this.params,e);return t?.setAttributes({"drizzle.query.text":this.queryString,"drizzle.query.params":JSON.stringify(i)}),this.logger.logQuery(this.queryString,i),k.startActiveSpan("drizzle.driver.execute",()=>(t?.setAttributes({"drizzle.query.text":this.queryString,"drizzle.query.params":JSON.stringify(i)}),this.queryWithCache(this.queryString,i,async()=>this.client.unsafe(this.queryString,i))))})}isResponseInArrayMode(){return this._isResponseInArrayMode}},ce=class c extends Ce{constructor(e,t,i,s={}){super(t),this.client=e,this.schema=i,this.options=s,this.logger=s.logger??new aa$1,this.cache=s.cache??new d$2;}static[a]="PostgresJsSession";logger;cache;prepareQuery(e,t,i,s,n,o,a){return new Be(this.client,e.sql,e.params,this.logger,this.cache,o,a,t,s,n)}query(e,t){return this.logger.logQuery(e,t),this.client.unsafe(e,t).values()}queryObjects(e,t){return this.client.unsafe(e,t)}transaction(e,t){return this.client.begin(async i=>{let s=new c(i,this.dialect,this.schema,this.options),n=new _e(this.dialect,s,this.schema);return t&&await n.setTransaction(t),e(n)})}},_e=class c extends xe{constructor(e,t,i,s=0){super(e,t,i,s),this.session=t;}static[a]="PostgresJsTransaction";transaction(e){return this.session.client.savepoint(t=>{let i=new ce(t,this.dialect,this.schema,this.session.options),s=new c(this.dialect,i,this.schema);return e(s)})}};var Fe=class extends se{static[a]="PostgresJsDatabase"};function re(c,e={}){let t=h=>h;for(let h of ["1184","1082","1083","1114","1182","1185","1115","1231"])c.options.parsers[h]=t,c.options.serializers[h]=t;c.options.serializers[114]=t,c.options.serializers[3802]=t;let i=new H({casing:e.casing}),s;e.logger===true?s=new $:e.logger!==false&&(s=e.logger);let n;if(e.schema){let h=T(e.schema,Y);n={fullSchema:e.schema,schema:h.tables,tableNamesMap:h.tableNamesMap};}let o=new ce(c,i,n,{logger:s,cache:e.cache}),a=new Fe(i,o,n);return a.$client=c,a.$cache=e.cache,a.$cache&&(a.$cache.invalidate=e.cache?.onMutate),a}function yt(...c){if(typeof c[0]=="string"){let e=a$1(c[0]);return re(e,c[1])}if(Z(c[0])){let{connection:e,client:t,...i}=c[0];if(t)return re(t,i);if(typeof e=="object"&&e.url!==void 0){let{url:n,...o}=e,a=a$1(n,o);return re(a,i)}let s=a$1(e);return re(s,i)}return re(c[0],c[1])}(c=>{function e(t){return re({options:{parsers:{},serializers:{}}},t)}c.mock=e;})(yt||(yt={}));export{H as a,Be as b,ce as c,_e as d,Fe as e,yt as f};
@@ -1 +0,0 @@
1
- 'use strict';var chunkEZIDQBXI_cjs=require('./chunk-EZIDQBXI.cjs'),chunkLQ3YZTPU_cjs=require('./chunk-LQ3YZTPU.cjs'),chunkBUNLC3II_cjs=require('./chunk-BUNLC3II.cjs'),stream=require('stream');chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();var I=class n{bytes;constructor(e){if(this.bytes=e,e.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>9223372036854776e3||e<-9223372036854776e3)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);let t=new Uint8Array(8);for(let r=7,s=Math.abs(Math.round(e));r>-1&&s>0;r--,s/=256)t[r]=s;return e<0&&Q(t),new n(t)}valueOf(){let e=this.bytes.slice(0),t=e[0]&128;return t&&Q(e),parseInt(chunkLQ3YZTPU_cjs.t(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}};function Q(n){for(let e=0;e<8;e++)n[e]^=255;for(let e=7;e>-1&&(n[e]++,n[e]===0);e--);}var C=class{toUtf8;fromUtf8;constructor(e,t){this.toUtf8=e,this.fromUtf8=t;}format(e){let t=[];for(let a of Object.keys(e)){let c=this.fromUtf8(a);t.push(Uint8Array.from([c.byteLength]),c,this.formatHeaderValue(e[a]));}let r=new Uint8Array(t.reduce((a,c)=>a+c.byteLength,0)),s=0;for(let a of t)r.set(a,s),s+=a.byteLength;return r}formatHeaderValue(e){switch(e.type){case "boolean":return Uint8Array.from([e.value?y.boolTrue:y.boolFalse]);case "byte":return Uint8Array.from([y.byte,e.value]);case "short":let t=new DataView(new ArrayBuffer(3));return t.setUint8(0,y.short),t.setInt16(1,e.value,false),new Uint8Array(t.buffer);case "integer":let r=new DataView(new ArrayBuffer(5));return r.setUint8(0,y.integer),r.setInt32(1,e.value,false),new Uint8Array(r.buffer);case "long":let s=new Uint8Array(9);return s[0]=y.long,s.set(e.value.bytes,1),s;case "binary":let a=new DataView(new ArrayBuffer(3+e.value.byteLength));a.setUint8(0,y.byteArray),a.setUint16(1,e.value.byteLength,false);let c=new Uint8Array(a.buffer);return c.set(e.value,3),c;case "string":let o=this.fromUtf8(e.value),f=new DataView(new ArrayBuffer(3+o.byteLength));f.setUint8(0,y.string),f.setUint16(1,o.byteLength,false);let b=new Uint8Array(f.buffer);return b.set(o,3),b;case "timestamp":let g=new Uint8Array(9);return g[0]=y.timestamp,g.set(I.fromNumber(e.value.valueOf()).bytes,1),g;case "uuid":if(!ne.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);let l=new Uint8Array(17);return l[0]=y.uuid,l.set(chunkLQ3YZTPU_cjs.s(e.value.replace(/-/g,"")),1),l}}parse(e){let t={},r=0;for(;r<e.byteLength;){let s=e.getUint8(r++),a=this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+r,s));switch(r+=s,e.getUint8(r++)){case y.boolTrue:t[a]={type:R,value:true};break;case y.boolFalse:t[a]={type:R,value:false};break;case y.byte:t[a]={type:H,value:e.getInt8(r++)};break;case y.short:t[a]={type:V,value:e.getInt16(r,false)},r+=2;break;case y.integer:t[a]={type:E,value:e.getInt32(r,false)},r+=4;break;case y.long:t[a]={type:_,value:new I(new Uint8Array(e.buffer,e.byteOffset+r,8))},r+=8;break;case y.byteArray:let c=e.getUint16(r,false);r+=2,t[a]={type:Y,value:new Uint8Array(e.buffer,e.byteOffset+r,c)},r+=c;break;case y.string:let o=e.getUint16(r,false);r+=2,t[a]={type:ee,value:this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+r,o))},r+=o;break;case y.timestamp:t[a]={type:te,value:new Date(new I(new Uint8Array(e.buffer,e.byteOffset+r,8)).valueOf())},r+=8;break;case y.uuid:let f=new Uint8Array(e.buffer,e.byteOffset+r,16);r+=16,t[a]={type:re,value:`${chunkLQ3YZTPU_cjs.t(f.subarray(0,4))}-${chunkLQ3YZTPU_cjs.t(f.subarray(4,6))}-${chunkLQ3YZTPU_cjs.t(f.subarray(6,8))}-${chunkLQ3YZTPU_cjs.t(f.subarray(8,10))}-${chunkLQ3YZTPU_cjs.t(f.subarray(10))}`};break;default:throw new Error("Unrecognized header type tag")}}return t}},y;(function(n){n[n.boolTrue=0]="boolTrue",n[n.boolFalse=1]="boolFalse",n[n.byte=2]="byte",n[n.short=3]="short",n[n.integer=4]="integer",n[n.long=5]="long",n[n.byteArray=6]="byteArray",n[n.string=7]="string",n[n.timestamp=8]="timestamp",n[n.uuid=9]="uuid";})(y||(y={}));var R="boolean",H="byte",V="short",E="integer",_="long",Y="binary",ee="string",te="timestamp",re="uuid",ne=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;chunkBUNLC3II_cjs.h();var X=4,x=X*2,k=4,se=x+k*2;function Z({byteLength:n,byteOffset:e,buffer:t}){if(n<se)throw new Error("Provided message too short to accommodate event stream message overhead");let r=new DataView(t,e,n),s=r.getUint32(0,false);if(n!==s)throw new Error("Reported message length does not match received message length");let a=r.getUint32(X,false),c=r.getUint32(x,false),o=r.getUint32(n-k,false),f=new chunkEZIDQBXI_cjs.c;if(f.update(new Uint8Array(t,e,x)),c!==f.digestSync())throw new Error(`The prelude checksum specified in the message (${c}) does not match the calculated CRC32 checksum (${f.digestSync()})`);if(f.update(new Uint8Array(t,e+x,n-(x+k))),o!==f.digestSync())throw new Error(`The message checksum (${f.digestSync()}) did not match the expected value of ${o}`);return {headers:new DataView(t,e+x+k,a),body:new Uint8Array(t,e+x+k+a,s-a-(x+k+k))}}var z=class{headerMarshaller;messageBuffer;isEndOfStream;constructor(e,t){this.headerMarshaller=new C(e,t),this.messageBuffer=[],this.isEndOfStream=false;}feed(e){this.messageBuffer.push(this.decode(e));}endOfStream(){this.isEndOfStream=true;}getMessage(){let e=this.messageBuffer.pop(),t=this.isEndOfStream;return {getMessage(){return e},isEndOfStream(){return t}}}getAvailableMessages(){let e=this.messageBuffer;this.messageBuffer=[];let t=this.isEndOfStream;return {getMessages(){return e},isEndOfStream(){return t}}}encode({headers:e,body:t}){let r=this.headerMarshaller.format(e),s=r.byteLength+t.byteLength+16,a=new Uint8Array(s),c=new DataView(a.buffer,a.byteOffset,a.byteLength),o=new chunkEZIDQBXI_cjs.c;return c.setUint32(0,s,false),c.setUint32(4,r.byteLength,false),o.update(a.subarray(0,8)),c.setUint32(8,o.digestSync(),false),a.set(r,12),a.set(t,r.byteLength+12),o.update(a.subarray(8,s-4)),c.setUint32(s-4,o.digestSync(),false),a}decode(e){let{headers:t,body:r}=Z(e);return {headers:this.headerMarshaller.parse(t),body:r}}formatHeaders(e){return this.headerMarshaller.format(e)}};chunkBUNLC3II_cjs.h();var O=class{options;constructor(e){this.options=e;}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.inputStream)yield this.options.decoder.decode(e);}};chunkBUNLC3II_cjs.h();var N=class{options;constructor(e){this.options=e;}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.messageStream)yield this.options.encoder.encode(e);this.options.includeEndFrame&&(yield new Uint8Array(0));}};chunkBUNLC3II_cjs.h();var G=class{options;constructor(e){this.options=e;}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.messageStream){let t=await this.options.deserializer(e);t!==void 0&&(yield t);}}};chunkBUNLC3II_cjs.h();var $=class{options;constructor(e){this.options=e;}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.inputStream)yield this.options.serializer(e);}};chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();function j(n){let e=0,t=0,r=null,s=null,a=o=>{if(typeof o!="number")throw new Error("Attempted to allocate an event message where size was not a number: "+o);e=o,t=4,r=new Uint8Array(o),new DataView(r.buffer).setUint32(0,o,false);},c=async function*(){let o=n[Symbol.asyncIterator]();for(;;){let{value:f,done:b}=await o.next();if(b){if(e)if(e===t)yield r;else throw new Error("Truncated event message received.");else return;return}let g=f.length,l=0;for(;l<g;){if(!r){let m=g-l;s||(s=new Uint8Array(4));let d=Math.min(4-t,m);if(s.set(f.slice(l,l+d),t),t+=d,l+=d,t<4)break;a(new DataView(s.buffer).getUint32(0,false)),s=null;}let u=Math.min(e-t,g-l);r.set(f.slice(l,l+u),t),t+=u,l+=u,e&&e===t&&(yield r,r=null,e=0,t=0);}}};return {[Symbol.asyncIterator]:c}}chunkBUNLC3II_cjs.h();function ae(n,e){let t=L(e.deserializer,e.toUtf8);return {[Symbol.asyncIterator]:async function*(){for await(let r of n){let s=e.eventStreamCodec.decode(r),a=await t(s);a!==void 0&&(yield a);}}}}function L(n,e){return async function(t){let{value:r}=t.headers[":message-type"];if(r==="error"){let s=new Error(t.headers[":error-message"].value||"UnknownError");throw s.name=t.headers[":error-code"].value,s}else if(r==="exception"){let s=t.headers[":exception-type"].value,a={[s]:t},c=await n(a);if(c.$unknown){let o=new Error(e(t.body));throw o.name=s,o}throw c[s]}else if(r==="event"){let s={[t.headers[":event-type"].value]:t},a=await n(s);return a.$unknown?void 0:a}else throw Error(`Unrecognizable event type: ${t.headers[":event-type"].value}`)}}var T=class{eventStreamCodec;utfEncoder;constructor({utf8Encoder:e,utf8Decoder:t}){this.eventStreamCodec=new z(e,t),this.utfEncoder=e;}deserialize(e,t){let r=j(e);return new G({messageStream:new O({inputStream:r,decoder:this.eventStreamCodec}),deserializer:L(t,this.utfEncoder)})}serialize(e,t){return new N({messageStream:new $({inputStream:e,serializer:t}),encoder:this.eventStreamCodec,includeEndFrame:true})}},oe=n=>new T(n);var F=class{universalMarshaller;constructor({utf8Encoder:e,utf8Decoder:t}){this.universalMarshaller=new T({utf8Decoder:t,utf8Encoder:e});}deserialize(e,t){let r=typeof e[Symbol.asyncIterator]=="function"?e:le(e);return this.universalMarshaller.deserialize(r,t)}serialize(e,t){return stream.Readable.from(this.universalMarshaller.serialize(e,t))}},ce=n=>new F(n);async function*le(n){let e=false,t=false,r=new Array;for(n.on("error",s=>{if(e||(e=true),s)throw s}),n.on("data",s=>{r.push(s);}),n.on("end",()=>{e=true;});!t;){let s=await new Promise(a=>setTimeout(()=>a(r.shift()),0));s&&(yield s),t=e&&r.length===0;}}chunkBUNLC3II_cjs.h();var fe=n=>({[Symbol.asyncIterator]:async function*(){let e=n.getReader();try{for(;;){let{done:t,value:r}=await e.read();if(t)return;yield r;}}finally{e.releaseLock();}}}),ue=n=>{let e=n[Symbol.asyncIterator]();return new ReadableStream({async pull(t){let{done:r,value:s}=await e.next();if(r)return t.close();t.enqueue(s);}})};chunkBUNLC3II_cjs.h();var me=n=>Object.assign(n,{eventStreamMarshaller:n.eventStreamSerdeProvider(n)});chunkBUNLC3II_cjs.h();var K=class{marshaller;serializer;deserializer;serdeContext;defaultContentType;constructor({marshaller:e,serializer:t,deserializer:r,serdeContext:s,defaultContentType:a}){this.marshaller=e,this.serializer=t,this.deserializer=r,this.serdeContext=s,this.defaultContentType=a;}async serializeEventStream({eventStream:e,requestSchema:t,initialRequest:r}){let s=this.marshaller,a=t.getEventStreamMember(),c=t.getMemberSchema(a),o=this.serializer,f=this.defaultContentType,b=Symbol("initialRequestMarker"),g={async*[Symbol.asyncIterator](){if(r){let l={":event-type":{type:"string",value:"initial-request"},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:f}};o.write(t,r);let u=o.flush();yield {[b]:true,headers:l,body:u};}for await(let l of e)yield l;}};return s.serialize(g,l=>{if(l[b])return {headers:l.headers,body:l.body};let u="";for(let h in l)if(h!=="__type"){u=h;break}let{additionalHeaders:m,body:d,eventType:w,explicitPayloadContentType:S}=this.writeEventBody(u,c,l);return {headers:{":event-type":{type:"string",value:w},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:S??f},...m},body:d}})}async deserializeEventStream({response:e,responseSchema:t,initialResponseContainer:r}){let s=this.marshaller,a=t.getEventStreamMember(),o=t.getMemberSchema(a).getMemberSchemas(),f=Symbol("initialResponseMarker"),b=s.deserialize(e.body,async u=>{let m="";for(let w in u)if(w!=="__type"){m=w;break}let d=u[m].body;if(m==="initial-response"){let w=await this.deserializer.read(t,d);return delete w[a],{[f]:true,...w}}else if(m in o){let w=o[m];if(w.isStructSchema()){let S={},v=false;for(let[h,B]of w.structIterator()){let{eventHeader:q,eventPayload:P}=B.getMergedTraits();if(v=v||!!(q||P),P)B.isBlobSchema()?S[h]=d:B.isStringSchema()?S[h]=(this.serdeContext?.utf8Encoder??chunkLQ3YZTPU_cjs.e)(d):B.isStructSchema()&&(S[h]=await this.deserializer.read(B,d));else if(q){let M=u[m].headers[h]?.value;M!=null&&(B.isNumericSchema()?M&&typeof M=="object"&&"bytes"in M?S[h]=BigInt(M.toString()):S[h]=Number(M):S[h]=M);}}if(v)return {[m]:S};if(d.byteLength===0)return {[m]:{}}}return {[m]:await this.deserializer.read(w,d)}}else return {$unknown:u}}),g=b[Symbol.asyncIterator](),l=await g.next();if(l.done)return b;if(l.value?.[f]){if(!t)throw new Error("@smithy::core/protocols - initial-response event encountered in event stream but no response schema given.");for(let u in l.value)r[u]=l.value[u];}return {async*[Symbol.asyncIterator](){for(l?.value?.[f]||(yield l.value);;){let{done:u,value:m}=await g.next();if(u)break;yield m;}}}}writeEventBody(e,t,r){let s=this.serializer,a=e,c=null,o,f=t.getSchema()[4].includes(e),b={};if(f){let u=t.getMemberSchema(e);if(u.isStructSchema()){for(let[m,d]of u.structIterator()){let{eventHeader:w,eventPayload:S}=d.getMergedTraits();if(S)c=m;else if(w){let v=r[e][m],h="binary";d.isNumericSchema()?(-2)**31<=v&&v<=2**31-1?h="integer":h="long":d.isTimestampSchema()?h="timestamp":d.isStringSchema()?h="string":d.isBooleanSchema()&&(h="boolean"),v!=null&&(b[m]={type:h,value:v},delete r[e][m]);}}if(c!==null){let m=u.getMemberSchema(c);m.isBlobSchema()?o="application/octet-stream":m.isStringSchema()&&(o="text/plain"),s.write(m,r[e][c]);}else s.write(u,r[e]);}else if(u.isUnitSchema())s.write(u,{});else throw new Error("@smithy/core/event-streams - non-struct member not supported in event stream union.")}else {let[u,m]=r[e];a=u,s.write(15,m);}let g=s.flush()??new Uint8Array;return {body:typeof g=="string"?(this.serdeContext?.utf8Decoder??chunkLQ3YZTPU_cjs.c)(g):g,eventType:a,explicitPayloadContentType:o,additionalHeaders:b}}};exports.a=I;exports.b=C;exports.c=z;exports.d=O;exports.e=N;exports.f=G;exports.g=$;exports.h=j;exports.i=ae;exports.j=L;exports.k=T;exports.l=oe;exports.m=F;exports.n=ce;exports.o=fe;exports.p=ue;exports.q=me;exports.r=K;
@@ -1,2 +0,0 @@
1
- import {b,a}from'./chunk-FLMUMPDE.js';import {ra,ma,fa,ca,$ as $$1,pa,oa,ia}from'./chunk-3NSZZCOJ.js';import {g as g$1}from'./chunk-Y2YAKDEQ.js';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
2
- g$1();var d=ra("users",{id:oa("id").primaryKey().defaultRandom(),name:pa("name",{length:255}),email:pa("email",{length:255}).notNull(),passwordHash:pa("password_hash",{length:255}),role:pa("role",{length:50}).notNull().default("customer"),tenantId:oa("tenant_id"),emailVerified:$$1("email_verified").default(false),avatar:pa("avatar",{length:255}),locked:$$1("locked").default(false),lastLogin:ma("last_login"),failedLoginAttempts:ca("failed_login_attempts").default(0),metadata:fa("metadata").$type(),createdAt:ma("created_at").defaultNow().notNull(),updatedAt:ma("updated_at").defaultNow().notNull()},e=>[b("users_email_idx").on(e.email),a("users_tenant_idx").on(e.tenantId),a("users_role_idx").on(e.role)]),_=ra("roles",{id:oa("id").primaryKey().defaultRandom(),name:pa("name",{length:100}).notNull().unique(),level:ca("level").notNull().default(0),inherits:ia("inherits").array(),description:ia("description"),permissions:fa("permissions").$type().default([]),isSystem:$$1("is_system").default(false),createdAt:ma("created_at").defaultNow().notNull(),updatedAt:ma("updated_at").defaultNow().notNull()},e=>[a("roles_level_idx").on(e.level)]),x=ra("permissions",{id:oa("id").primaryKey().defaultRandom(),roleId:oa("role_id").references(()=>_.id,{onDelete:"cascade"}),resource:pa("resource",{length:100}).notNull(),action:pa("action",{length:50}).notNull(),conditions:fa("conditions").$type(),createdAt:ma("created_at").defaultNow().notNull()},e=>[a("permissions_role_idx").on(e.roleId),a("permissions_resource_idx").on(e.resource)]),g=ra("sessions",{id:oa("id").primaryKey().defaultRandom(),userId:oa("user_id").notNull().references(()=>d.id,{onDelete:"cascade"}),token:pa("token",{length:512}).notNull().unique(),refreshToken:pa("refresh_token",{length:512}),ipAddress:pa("ip_address",{length:45}),userAgent:ia("user_agent"),expiresAt:ma("expires_at").notNull(),createdAt:ma("created_at").defaultNow().notNull()},e=>[a("sessions_user_idx").on(e.userId),a("sessions_token_idx").on(e.token),a("sessions_expires_idx").on(e.expiresAt)]),N=ra("audit_logs",{id:oa("id").primaryKey().defaultRandom(),action:pa("action",{length:100}).notNull(),userId:oa("user_id").references(()=>d.id,{onDelete:"set null"}),userEmail:pa("user_email",{length:255}),role:pa("role",{length:50}),resource:pa("resource",{length:100}).notNull(),resourceId:pa("resource_id",{length:255}),changes:fa("changes").$type(),ipAddress:pa("ip_address",{length:45}),userAgent:ia("user_agent"),success:$$1("success").notNull().default(true),error:ia("error"),metadata:fa("metadata").$type(),timestamp:ma("timestamp").defaultNow().notNull()},e=>[a("audit_logs_user_idx").on(e.userId),a("audit_logs_action_idx").on(e.action),a("audit_logs_resource_idx").on(e.resource),a("audit_logs_timestamp_idx").on(e.timestamp)]),h=ra("tenants",{id:oa("id").primaryKey().defaultRandom(),name:pa("name",{length:255}).notNull(),slug:pa("slug",{length:100}).notNull().unique(),settings:fa("settings").$type().default({}),isActive:$$1("is_active").default(true),createdAt:ma("created_at").defaultNow().notNull(),updatedAt:ma("updated_at").defaultNow().notNull()},e=>[b("tenants_slug_idx").on(e.slug)]),A=ra("api_keys",{id:oa("id").primaryKey().defaultRandom(),userId:oa("user_id").notNull().references(()=>d.id,{onDelete:"cascade"}),name:pa("name",{length:255}).notNull(),key:pa("key",{length:64}).notNull().unique(),keyPrefix:pa("key_prefix",{length:8}).notNull(),permissions:fa("permissions").$type().default([]),lastUsedAt:ma("last_used_at"),expiresAt:ma("expires_at"),createdAt:ma("created_at").defaultNow().notNull()},e=>[a("api_keys_user_idx").on(e.userId),a("api_keys_key_idx").on(e.key)]),k=ra("email_verifications",{id:oa("id").primaryKey().defaultRandom(),userId:oa("user_id").notNull().references(()=>d.id,{onDelete:"cascade"}),token:pa("token",{length:64}).notNull().unique(),expiresAt:ma("expires_at").notNull(),createdAt:ma("created_at").defaultNow().notNull()},e=>[a("email_verifications_token_idx").on(e.token),a("email_verifications_user_idx").on(e.userId)]),w=ra("password_resets",{id:oa("id").primaryKey().defaultRandom(),userId:oa("user_id").notNull().references(()=>d.id,{onDelete:"cascade"}),token:pa("token",{length:64}).notNull().unique(),expiresAt:ma("expires_at").notNull(),usedAt:ma("used_at"),createdAt:ma("created_at").defaultNow().notNull()},e=>[a("password_resets_token_idx").on(e.token),a("password_resets_user_idx").on(e.userId)]),I=ra("password_history",{id:oa("id").primaryKey().defaultRandom(),userId:oa("user_id").notNull().references(()=>d.id,{onDelete:"cascade"}),passwordHash:pa("password_hash",{length:255}).notNull(),createdAt:ma("created_at").defaultNow().notNull()},e=>[a("password_history_user_idx").on(e.userId)]),$=ra("lockouts",{id:oa("id").primaryKey().defaultRandom(),userId:oa("user_id").notNull().references(()=>d.id,{onDelete:"cascade"}),ipAddress:pa("ip_address",{length:45}),reason:pa("reason",{length:255}),lockedUntil:ma("locked_until").notNull(),releasedAt:ma("released_at"),createdAt:ma("created_at").defaultNow().notNull()},e=>[a("lockouts_user_idx").on(e.userId),a("lockouts_ip_idx").on(e.ipAddress),a("lockouts_locked_until_idx").on(e.lockedUntil)]);export{d as a,_ as b,x as c,g as d,N as e,h as f,A as g,k as h,w as i,I as j,$ as k};