@hiai-gg/docsmint 2.0.4 → 2.1.1

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 (309) hide show
  1. package/README.md +74 -5
  2. package/dist/backend/index.js +94475 -92073
  3. package/dist/backend-account-runtime-cleanup.js +293 -292
  4. package/dist/backend-api-key-facade.js +6 -5
  5. package/dist/backend-pipeline-cancellation.js +287 -286
  6. package/dist/client.d.ts +33 -7
  7. package/dist/client.js +55 -1
  8. package/dist/frontend/CategoryDialog-CVJi5PJu.js +602 -0
  9. package/dist/frontend/{ConfirmDialog-B1MjKlVQ.js → ConfirmDialog-0JwB8mKN.js} +5 -8
  10. package/dist/frontend/{CreateSnapshotDialog-BTMoPFdj.js → CreateSnapshotDialog-BLrtuYs5.js} +63 -68
  11. package/dist/frontend/{DatePicker-Bmjko3X7.js → DatePicker-BwSb8TRv.js} +17 -29
  12. package/dist/frontend/{DeleteDialog-BkfIeKXO.js → DeleteDialog-s7Dr6bXg.js} +51 -56
  13. package/dist/frontend/{FolderNode-Do8pIfyA.js → FolderNode-Y7cV9xeX.js} +105 -106
  14. package/dist/frontend/{FolderTreeSelector-FyxhcHjr.js → FolderTreeSelector-BR3lYmPU.js} +18 -20
  15. package/dist/frontend/HiAiEditor-BQERr-cd.js +3077 -0
  16. package/dist/frontend/{HiaiDocsExtensionProvider-Cc3yzW5I.js → HiaiDocsExtensionProvider-A2nGddUR.js} +2 -3
  17. package/dist/frontend/{Icon-3EYzvNyk.js → Icon-CiHcxcpv.js} +1 -2
  18. package/dist/frontend/SettingsDialog-BvS74JZu.js +978 -0
  19. package/dist/frontend/{ShareDialog-Ddvl7xvb.js → ShareDialog-Bo50h_Oe.js} +23 -25
  20. package/dist/frontend/Sidebar-i0kbanpg.js +2123 -0
  21. package/dist/frontend/{TagCreateDialog-DQmMJe_E.js → TagCreateDialog-DhKfsfv3.js} +78 -86
  22. package/dist/frontend/action_cancel-BdsWzQKU.js +4 -0
  23. package/dist/frontend/action_close-CVhfLPRQ.js +4 -0
  24. package/dist/frontend/action_create-ByaroO1_.js +4 -0
  25. package/dist/frontend/action_delete-SRloglWY.js +4 -0
  26. package/dist/frontend/action_go_to-DO1bicF-.js +4 -0
  27. package/dist/frontend/action_loading-iQ0KsN6i.js +4 -0
  28. package/dist/frontend/action_save-DeqrZQwV.js +4 -0
  29. package/dist/frontend/api/attachments.js +1 -2
  30. package/dist/frontend/api/categories.js +1 -2
  31. package/dist/frontend/api/documents.js +1 -2
  32. package/dist/frontend/api/folders.js +1 -2
  33. package/dist/frontend/api/settings.js +1 -2
  34. package/dist/frontend/api/share.js +1 -2
  35. package/dist/frontend/api/tags.js +1 -2
  36. package/dist/frontend/{api-keys-DIwAdYkg.js → api-keys-B63imiLr.js} +2 -3
  37. package/dist/frontend/app-shell.js +55 -79
  38. package/dist/frontend/{attachments-C225gTA7.js → attachments-Bfly-sam.js} +2 -3
  39. package/dist/frontend/{auth-client-CXR-7mIO.js → auth-client-Dx7d9Tzo.js} +409 -343
  40. package/dist/frontend/{bundle-mjs-CZ3g1Uzr.js → bundle-mjs-clTO1WW-.js} +5 -23
  41. package/dist/frontend/{camera-DtgHzfVI.js → camera-DsdOPOcD.js} +2 -3
  42. package/dist/frontend/{categories-C8AAkhCR.js → categories-CusvHb5Y.js} +3 -4
  43. package/dist/frontend/{categories_update_error-4aSI8PTr.js → categories_update_error-Cn8DBBHv.js} +2 -3
  44. package/dist/frontend/{check-DVx65aSv.js → check-DiMZRkKS.js} +2 -3
  45. package/dist/frontend/{chevron-down-C2tbZ8Ol.js → chevron-down-CxFrMFDJ.js} +2 -3
  46. package/dist/frontend/{circle-check-BAN-D7yg.js → circle-check-B4F_qgPx.js} +2 -3
  47. package/dist/frontend/{client-GbtOH90i.js → client-BDdDd84W.js} +1 -2
  48. package/dist/frontend/{clipboard-Cgzxc0_R.js → clipboard-Dt1oW6nm.js} +1 -2
  49. package/dist/frontend/{clock-ByiB0SwQ.js → clock-dcpueRk-.js} +2 -3
  50. package/dist/frontend/collaboration.js +6 -12
  51. package/dist/frontend/components/category-dialog.js +1 -2
  52. package/dist/frontend/components/create-snapshot-dialog.js +1 -2
  53. package/dist/frontend/components/delete-dialog.js +1 -2
  54. package/dist/frontend/components/editor/compact-editor.js +2 -3
  55. package/dist/frontend/components/editor/document-editor.js +1 -2
  56. package/dist/frontend/components/editor/document-title.js +3 -4
  57. package/dist/frontend/components/editor/docx-serializer.js +123 -167
  58. package/dist/frontend/components/editor/extensions.js +1 -2
  59. package/dist/frontend/components/editor/markdown-toggle.js +5 -6
  60. package/dist/frontend/components/editor/markdown.js +1 -2
  61. package/dist/frontend/components/folder-node.js +1 -2
  62. package/dist/frontend/components/folder-tree-selector.js +1 -2
  63. package/dist/frontend/components/save-as-dialog.js +86 -90
  64. package/dist/frontend/components/settings.js +1 -2
  65. package/dist/frontend/components/share-dialog.js +1 -2
  66. package/dist/frontend/components/sidebar.js +1 -2
  67. package/dist/frontend/components/tag-create-dialog.js +1 -2
  68. package/dist/frontend/components/version-history.js +177 -180
  69. package/dist/frontend/{context-D0zPFXZ4.js → context-BguSRnCt.js} +1 -2
  70. package/dist/frontend/{copy-CRzvfZGb.js → copy-Bag46YaR.js} +2 -3
  71. package/dist/frontend/dashboard.js +666 -690
  72. package/dist/frontend/{db-Dya0HRhS.js → db-B1ZV452J.js} +22 -39
  73. package/dist/frontend/{dialog-a_ZcpEC5.js → dialog-C0Bpok1d.js} +10 -18
  74. package/dist/frontend/{dist-CcHOStsA.js → dist-BlcV_BOY.js} +2 -3
  75. package/dist/frontend/{dist-qd_OnyUC.js → dist-DjId3RKL.js} +8 -21
  76. package/dist/frontend/dist-Dl9qg10h.js +301 -0
  77. package/dist/frontend/{dndzone-CDhrbpTg.js → dndzone-C62yjeG3.js} +38 -53
  78. package/dist/frontend/doc-tabs.js +1 -2
  79. package/dist/frontend/doc_title_label-BOuZzvqv.js +4 -0
  80. package/dist/frontend/doc_title_placeholder-ZxpdWWEn.js +4 -0
  81. package/dist/frontend/{document-drop-coordinator-Da7HcXgv.js → document-drop-coordinator-C_o93kKW.js} +3 -4
  82. package/dist/frontend/document-drop-coordinator.js +1 -2
  83. package/dist/frontend/{documents-CwCs1rA7.js → documents-CDJb8dv-.js} +4 -8
  84. package/dist/frontend/{dropdown-menu-DrHYReIC.js → dropdown-menu-B3nk2aM-.js} +13 -24
  85. package/dist/frontend/{editor-content-sanitizer-CWjqiz0T.js → editor-content-sanitizer-5MjSVPVn.js} +1 -2
  86. package/dist/frontend/editor-preferences.js +1 -2
  87. package/dist/frontend/{editor-preferences.svelte-Bt_A9k7n.js → editor-preferences.svelte-BpTE4mbz.js} +3 -5
  88. package/dist/frontend/{editorExtensions-DPR-CjMu.js → editorExtensions-DbiFj4tn.js} +3 -4
  89. package/dist/frontend/{editor_markdown_placeholder-BIWDUF1E.js → editor_markdown_placeholder-BztIY9Ci.js} +2 -3
  90. package/dist/frontend/{ellipsis-vertical-qxNgoXu-.js → ellipsis-vertical-Oymsv1R4.js} +2 -3
  91. package/dist/frontend/{error_dismiss-Dx_JbRjs.js → error_dismiss-C651ZdWI.js} +2 -3
  92. package/dist/frontend/error_generic-BlWqOE-a.js +4 -0
  93. package/dist/frontend/extension.js +1 -2
  94. package/dist/frontend/{folder-D74E-Kdp.js → folder-BpmB_sAy.js} +3 -5
  95. package/dist/frontend/folder-refresh.js +1 -2
  96. package/dist/frontend/{folders-CC0UWkZH.js → folders-DgKSovXa.js} +2 -3
  97. package/dist/frontend/{folders_rename-BJo4Gipq.js → folders_rename-Cxbg5GIw.js} +2 -3
  98. package/dist/frontend/frontend.css +1 -1
  99. package/dist/frontend/i18n.js +144 -145
  100. package/dist/frontend/{identity-BOA7Jejv.js → identity-B7HeOzDJ.js} +4 -5
  101. package/dist/frontend/{input-Q_7qCfnU.js → input-CbeB9220.js} +2 -3
  102. package/dist/frontend/keyboard.js +1 -2
  103. package/dist/frontend/{keyboard.svelte-CApmX0vl.js → keyboard.svelte-BBUdhTsM.js} +2 -3
  104. package/dist/frontend/{label-Dj8FDEhf.js → label-CfBWf3gI.js} +2 -3
  105. package/dist/frontend/{lib-aUbBbIW2.js → lib-CITdCbKa.js} +176 -365
  106. package/dist/frontend/{loader-circle-D3t5NkvC.js → loader-circle-skKwfRCB.js} +2 -3
  107. package/dist/frontend/markdown-6E9TWC6V.js +11 -0
  108. package/dist/frontend/offline/identity.js +1 -2
  109. package/dist/frontend/{popper-layer-force-mount-CNtiLgbV.js → popper-layer-force-mount-BG0eyrCk.js} +112 -284
  110. package/dist/frontend/{resolve-BG4HgzpN.js → resolve-DbT-KhGZ.js} +2 -3
  111. package/dist/frontend/{rolldown-runtime-DArdT4gl.js → rolldown-runtime-CwxnZyOB.js} +2 -3
  112. package/dist/frontend/{rotate-ccw-B1ybQ8oQ.js → rotate-ccw-DAUX7np7.js} +2 -3
  113. package/dist/frontend/{route-context-DYQlUfzL.js → route-context-6OHiGtfb.js} +2 -4
  114. package/dist/frontend/{runtime-CwWSo6c9.js → runtime-CGUiMzK6.js} +1 -2
  115. package/dist/frontend/{schemas-1Na35n71.js → schemas-YXxhj5o8.js} +850 -880
  116. package/dist/frontend/scroll_to_top_aria-lJc2RSx_.js +4 -0
  117. package/dist/frontend/{search-preferences-B1GdbdUc.js → search-preferences-DuLDczRu.js} +1 -2
  118. package/dist/frontend/search.js +277 -292
  119. package/dist/frontend/{search_title-DOC0cPlQ.js → search_title-BETwQYJq.js} +2 -3
  120. package/dist/frontend/{select-value-BkI1W1bn.js → select-value-BY5Hw6Rl.js} +28 -65
  121. package/dist/frontend/{settings-BRcYFQa_.js → settings-DyePuqjp.js} +3 -4
  122. package/dist/frontend/{share-D5yo0JOh.js → share-3gWTTYvH.js} +2 -3
  123. package/dist/frontend/{share-context-BJ4GF4yT.js → share-context-C2xyVP9M.js} +29 -37
  124. package/dist/frontend/{share_copied-DPxVzfWh.js → share_copied-BuAnmpbz.js} +2 -3
  125. package/dist/frontend/{share_toggle_password-DdxfIjj1.js → share_toggle_password-LEYUeHWr.js} +2 -3
  126. package/dist/frontend/shared-document.js +27 -36
  127. package/dist/frontend/{sidebar_uncategorized-qJ2_Aonf.js → sidebar_uncategorized-C5PGOflV.js} +2 -3
  128. package/dist/frontend/{sort_relevance-DwYX5MO9.js → sort_relevance-DpCVLby_.js} +2 -3
  129. package/dist/frontend/{subfolders-refresh-store.svelte-DxP21a1c.js → subfolders-refresh-store.svelte-CeyqvNpu.js} +1 -2
  130. package/dist/frontend/{tag-qbTBLj-g.js → tag-Wdfe0rKU.js} +3 -5
  131. package/dist/frontend/{tag-store.svelte-ogVCMCbv.js → tag-store.svelte-C9VYWqLQ.js} +2 -3
  132. package/dist/frontend/{tags-CF_cqzSV.js → tags-DlDVothf.js} +3 -4
  133. package/dist/frontend/{tags_load_error-BKjA1pI0.js → tags_load_error-BINNpPPV.js} +2 -3
  134. package/dist/frontend/{tags_new-BiNAJ9Bx.js → tags_new-Dw0Uy43-.js} +2 -3
  135. package/dist/frontend/{textarea-BNK0LFUK.js → textarea-D6emvAwM.js} +2 -3
  136. package/dist/frontend/theme.js +2 -3
  137. package/dist/frontend/{theme.svelte-BRdxXd-B.js → theme.svelte-BiXvrqwh.js} +7 -23
  138. package/dist/frontend/{theme_system-BBNUhYKh.js → theme_system-YIfa_2Xt.js} +2 -3
  139. package/dist/frontend/utils/clipboard.js +1 -2
  140. package/dist/frontend/utils/dndzone.js +1 -2
  141. package/dist/frontend/{utils-BovMJHdA.js → utils-CnAmIMwr.js} +2 -3
  142. package/dist/frontend/utils-DH0uqK40.js +6 -0
  143. package/dist/frontend/utils.js +1 -2
  144. package/dist/frontend/version_create_snapshot-D8xjbuCq.js +4 -0
  145. package/dist/frontend/{version_restored_from-dVRN3Zdk.js → version_restored_from-DYFFSuQj.js} +2 -3
  146. package/dist/frontend/{version_snapshot_label_placeholder-DrMikux0.js → version_snapshot_label_placeholder-BhKq1NQ7.js} +2 -3
  147. package/dist/frontend/{weekday_we-C5H_M-df.js → weekday_we-BxbzNVWR.js} +2 -3
  148. package/dist/frontend/{x-CvSSnrjl.js → x-CBUgPygC.js} +2 -3
  149. package/dist/frontend/{yjs-VUcKqaKW.js → yjs-BbwnvxgY.js} +9 -23
  150. package/dist/frontend-ssr/api/attachments.js +2 -3
  151. package/dist/frontend-ssr/api/categories.js +1 -2
  152. package/dist/frontend-ssr/api/documents.js +1 -2
  153. package/dist/frontend-ssr/api/folders.js +1 -2
  154. package/dist/frontend-ssr/api/settings.js +1 -2
  155. package/dist/frontend-ssr/api/share.js +2 -3
  156. package/dist/frontend-ssr/api/tags.js +1 -2
  157. package/dist/frontend-ssr/app-shell.js +19 -28
  158. package/dist/frontend-ssr/assets/{CategoryDialog-DuZLLlt7.js → CategoryDialog-2CCX508O.js} +17 -20
  159. package/dist/frontend-ssr/assets/{ConfirmDialog-0WVu9BCE.js → ConfirmDialog-Cc6lcY1N.js} +8 -14
  160. package/dist/frontend-ssr/assets/{CreateSnapshotDialog-3vhDTFNu.js → CreateSnapshotDialog-BB8fXF9W.js} +9 -10
  161. package/dist/frontend-ssr/assets/{DatePicker-t12leL2Y.js → DatePicker-CfzKzipR.js} +9 -15
  162. package/dist/frontend-ssr/assets/{DeleteDialog-B0AU1fJR.js → DeleteDialog-DRU4UgOW.js} +4 -5
  163. package/dist/frontend-ssr/assets/{FolderNode-C-B-s8x1.js → FolderNode-Dg_5-orQ.js} +11 -12
  164. package/dist/frontend-ssr/assets/{FolderTreeSelector-DdQuEcj0.js → FolderTreeSelector-D0reTdFS.js} +5 -7
  165. package/dist/frontend-ssr/assets/{HiAiEditor-Bj6tiE97.js → HiAiEditor-DeHWAIj-.js} +44 -69
  166. package/dist/frontend-ssr/assets/{HiaiDocsExtensionProvider-BRKWmcDd.js → HiaiDocsExtensionProvider-D6cGL-9s.js} +2 -3
  167. package/dist/frontend-ssr/assets/{Icon-DE_3EnuF.js → Icon-CrIRbT5O.js} +4 -8
  168. package/dist/frontend-ssr/assets/{SettingsDialog-h4SFwpUa.js → SettingsDialog-BpHY3IMb.js} +29 -40
  169. package/dist/frontend-ssr/assets/{ShareDialog-CpE9zd_f.js → ShareDialog-CY40nWZJ.js} +7 -9
  170. package/dist/frontend-ssr/assets/{Sidebar-BFBpsd3L.js → Sidebar-fpYk5MGO.js} +55 -63
  171. package/dist/frontend-ssr/assets/{TagCreateDialog-DBHO1DPU.js → TagCreateDialog-C2tpdEuj.js} +13 -14
  172. package/dist/frontend-ssr/assets/{action_cancel-OVgQDP5Q.js → action_cancel-CsBbxW0m.js} +2 -3
  173. package/dist/frontend-ssr/assets/{action_close-DagDyMXk.js → action_close-lFKBqBwg.js} +2 -3
  174. package/dist/frontend-ssr/assets/{action_create-hqJWjyqh.js → action_create-BV4ZOcQW.js} +2 -3
  175. package/dist/frontend-ssr/assets/{action_delete-B1-16jSo.js → action_delete-CNmRhKQP.js} +2 -3
  176. package/dist/frontend-ssr/assets/{action_go_to-DQScgw7P.js → action_go_to-tN5I26xM.js} +2 -3
  177. package/dist/frontend-ssr/assets/{action_save-Bx7vlLZI.js → action_save-YCfMiKb4.js} +2 -3
  178. package/dist/frontend-ssr/assets/{api-keys-CHOrbU-Q.js → api-keys-G6oimJIv.js} +2 -3
  179. package/dist/frontend-ssr/assets/{auth-client-BC4hSFKF.js → auth-client-BnnnJDAb.js} +368 -256
  180. package/dist/frontend-ssr/assets/{camera-B6ldo_Js.js → camera-OYNSMvMd.js} +2 -3
  181. package/dist/frontend-ssr/assets/{categories-C_dxFoHi.js → categories-bBPviKjl.js} +2 -3
  182. package/dist/frontend-ssr/assets/{categories_update_error-DkKgsqdD.js → categories_update_error-Bfx5vtvt.js} +11 -21
  183. package/dist/frontend-ssr/assets/{chevron-down-DQcr6JUc.js → chevron-down-DB6YsSbQ.js} +2 -3
  184. package/dist/frontend-ssr/assets/{chevron-right-9szrliZx.js → chevron-right-DOt2uY6b.js} +2 -3
  185. package/dist/frontend-ssr/assets/{circle-check-BgP9MRRv.js → circle-check-DQhTm9YR.js} +2 -3
  186. package/dist/frontend-ssr/assets/{client-rfwQYYHY.js → client-B2AniXwV.js} +1 -2
  187. package/dist/frontend-ssr/assets/{clipboard-CXOaoz2W.js → clipboard-CXKnyYba.js} +1 -2
  188. package/dist/frontend-ssr/assets/{clock-roNtGlT6.js → clock-B08dVWtf.js} +2 -3
  189. package/dist/frontend-ssr/assets/{context-Bi_mO-NS.js → context-C_xxvxnR.js} +1 -2
  190. package/dist/frontend-ssr/assets/{copy-BYqYnBIQ.js → copy-2jsznHar.js} +2 -3
  191. package/dist/frontend-ssr/assets/{db-C3rFdTZa.js → db-BEKLU5Fc.js} +2 -3
  192. package/dist/frontend-ssr/assets/{dialog-SqCnTT43.js → dialog-C6U-DqLr.js} +9 -17
  193. package/dist/frontend-ssr/assets/{dist-CaZQ1FhA.js → dist-DqXTz_zE.js} +9 -12
  194. package/dist/frontend-ssr/assets/{dist-CqxHwOlp.js → dist-ip9bPdma.js} +3 -6
  195. package/dist/frontend-ssr/assets/{dndzone-CnTCMhPd.js → dndzone-Dx3jt_e4.js} +4 -6
  196. package/dist/frontend-ssr/assets/{doc_title_label-Ev_ltlh3.js → doc_title_label-CE_l-Gum.js} +2 -3
  197. package/dist/frontend-ssr/assets/{doc_title_placeholder-DSHpUb7w.js → doc_title_placeholder-7_i7PtG6.js} +2 -3
  198. package/dist/frontend-ssr/assets/{document-drop-coordinator-CEaYACsC.js → document-drop-coordinator-BVytYy2K.js} +1 -2
  199. package/dist/frontend-ssr/assets/{documents-CEuA1V6N.js → documents-B_wpQFTh.js} +2 -3
  200. package/dist/frontend-ssr/assets/{dropdown-menu-CE6U0f1b.js → dropdown-menu-BS5fcN9l.js} +12 -23
  201. package/dist/frontend-ssr/assets/{editor-content-sanitizer-Gjm93iR-.js → editor-content-sanitizer-CIdFjBSC.js} +1 -2
  202. package/dist/frontend-ssr/assets/{editor-preferences.svelte-iI5jJM1x.js → editor-preferences.svelte-CdAXTd-I.js} +2 -4
  203. package/dist/frontend-ssr/assets/{editorExtensions-rhletNji.js → editorExtensions-2O7O2Nhv.js} +2 -3
  204. package/dist/frontend-ssr/assets/{editor_markdown_placeholder-BpezdkOr.js → editor_markdown_placeholder-CAeLJjFT.js} +3 -5
  205. package/dist/frontend-ssr/assets/{editor_toolbar_undo-CKJAOqv2.js → editor_toolbar_undo-CVCfQIS1.js} +29 -57
  206. package/dist/frontend-ssr/assets/{ellipsis-vertical-Cg1MrZsl.js → ellipsis-vertical-IFHt2NM1.js} +2 -3
  207. package/dist/frontend-ssr/assets/{error_generic-DTK0kwxT.js → error_generic-BB80i0Vk.js} +3 -5
  208. package/dist/frontend-ssr/assets/{folder-DHB-CEcQ.js → folder-CXa1_bm5.js} +2 -3
  209. package/dist/frontend-ssr/assets/{folders-BOXeb9hz.js → folders-CTLqWbMm.js} +2 -3
  210. package/dist/frontend-ssr/assets/{folders_rename-DvciOb6K.js → folders_rename-ydbfwQlj.js} +7 -13
  211. package/dist/frontend-ssr/assets/{identity-DNIo1bgc.js → identity-DTz1SQwC.js} +2 -3
  212. package/dist/frontend-ssr/assets/{input-DVrBVPgs.js → input-Bxw9sFF0.js} +2 -3
  213. package/dist/frontend-ssr/assets/{keyboard.svelte-BgF47N3L.js → keyboard.svelte-njehUCm3.js} +1 -2
  214. package/dist/frontend-ssr/assets/{label-vtCK3pTp.js → label-CMWedjs6.js} +2 -3
  215. package/dist/frontend-ssr/assets/{loader-circle-D3NWhCif.js → loader-circle-zbKj9Qb-.js} +2 -3
  216. package/dist/frontend-ssr/assets/{markdown-Co31-Tl2.js → markdown-BmIhDQp7.js} +2 -3
  217. package/dist/frontend-ssr/assets/{popper-layer-force-mount-C4dMMt-f.js → popper-layer-force-mount-CSHZsG2E.js} +78 -156
  218. package/dist/frontend-ssr/assets/{resolve-BqHozBXl.js → resolve-Wqdff4CL.js} +1 -2
  219. package/dist/frontend-ssr/assets/{rotate-ccw-DNf3nwMD.js → rotate-ccw-B7SaTFWf.js} +2 -3
  220. package/dist/frontend-ssr/assets/{route-context-BPRerEtZ.js → route-context-BsqLFt5Y.js} +2 -4
  221. package/dist/frontend-ssr/assets/{runtime-O78RzRqx.js → runtime-BX6-jTn_.js} +1 -2
  222. package/dist/frontend-ssr/assets/{scroll_to_top_aria-BN4ZfOnM.js → scroll_to_top_aria-CAYSiGHO.js} +2 -3
  223. package/dist/frontend-ssr/assets/{search_title-CKUsQDT0.js → search_title-C7NVXXq3.js} +2 -3
  224. package/dist/frontend-ssr/assets/{search_toggle_filters-hS9rvQhC.js → search_toggle_filters-Bq_YVD8s.js} +15 -29
  225. package/dist/frontend-ssr/assets/{select-value-Ce5c_fuA.js → select-value-TgslfiUB.js} +18 -34
  226. package/dist/frontend-ssr/assets/{settings-DWCpfCPj.js → settings-B1MA_FjO.js} +3 -4
  227. package/dist/frontend-ssr/assets/{share-context-B4UpvTSw.js → share-context-RVh8AExX.js} +17 -22
  228. package/dist/frontend-ssr/assets/{share_copied-BxU9rjXG.js → share_copied-CrwEwkb3.js} +31 -61
  229. package/dist/frontend-ssr/assets/{share_toggle_password-C6OmroqR.js → share_toggle_password-Co56z0Ha.js} +11 -21
  230. package/dist/frontend-ssr/assets/{sidebar_uncategorized-Dx-LTd5w.js → sidebar_uncategorized-COWdmZ3d.js} +6 -11
  231. package/dist/frontend-ssr/assets/{subfolders-refresh-store.svelte-CXHxQWKh.js → subfolders-refresh-store.svelte-LxG18U0n.js} +1 -2
  232. package/dist/frontend-ssr/assets/{tag-Cqv0fWVG.js → tag-BGhtDKpP.js} +3 -5
  233. package/dist/frontend-ssr/assets/{tag-store.svelte-QRysvGKe.js → tag-store.svelte-CUUgAaDD.js} +2 -3
  234. package/dist/frontend-ssr/assets/{tags-BBCoFYro.js → tags-C7u-LBsl.js} +2 -3
  235. package/dist/frontend-ssr/assets/{tags_load_error-CPrc6Gzs.js → tags_load_error-DW4FbHvr.js} +19 -37
  236. package/dist/frontend-ssr/assets/{tags_new-VmMr9v2V.js → tags_new-Dr3ByMPZ.js} +4 -7
  237. package/dist/frontend-ssr/assets/{textarea-BdjOJJVb.js → textarea-Bz5Tz4rw.js} +2 -3
  238. package/dist/frontend-ssr/assets/{theme.svelte-D6bbaJ9m.js → theme.svelte-CdHah46l.js} +3 -5
  239. package/dist/frontend-ssr/assets/{theme_system-BucaNntV.js → theme_system-E97FASeq.js} +19 -37
  240. package/dist/frontend-ssr/assets/{utils-DvZnctjz.js → utils-085zSPe5.js} +1 -2
  241. package/dist/frontend-ssr/assets/{utils-D3X7I8nz.js → utils-DF6CmRDX.js} +1 -2
  242. package/dist/frontend-ssr/assets/{version_create_snapshot-COHzwjle.js → version_create_snapshot-DeeYB7bb.js} +2 -3
  243. package/dist/frontend-ssr/assets/{version_restored_from-CertjFDl.js → version_restored_from-CTt2LM4A.js} +13 -25
  244. package/dist/frontend-ssr/assets/{version_snapshot_label_placeholder-Cy_rMCij.js → version_snapshot_label_placeholder-BbGD9YuN.js} +12 -23
  245. package/dist/frontend-ssr/assets/{weekday_we-DrI3U230.js → weekday_we-BzGQ-iFc.js} +22 -43
  246. package/dist/frontend-ssr/collaboration.js +2 -4
  247. package/dist/frontend-ssr/components/category-dialog.js +1 -2
  248. package/dist/frontend-ssr/components/create-snapshot-dialog.js +1 -2
  249. package/dist/frontend-ssr/components/delete-dialog.js +1 -2
  250. package/dist/frontend-ssr/components/editor/compact-editor.js +2 -3
  251. package/dist/frontend-ssr/components/editor/document-editor.js +1 -2
  252. package/dist/frontend-ssr/components/editor/document-title.js +3 -4
  253. package/dist/frontend-ssr/components/editor/docx-serializer.js +1 -2
  254. package/dist/frontend-ssr/components/editor/extensions.js +1 -2
  255. package/dist/frontend-ssr/components/editor/markdown-toggle.js +4 -5
  256. package/dist/frontend-ssr/components/editor/markdown.js +1 -2
  257. package/dist/frontend-ssr/components/folder-node.js +1 -2
  258. package/dist/frontend-ssr/components/folder-tree-selector.js +1 -2
  259. package/dist/frontend-ssr/components/save-as-dialog.js +12 -13
  260. package/dist/frontend-ssr/components/settings.js +1 -2
  261. package/dist/frontend-ssr/components/share-dialog.js +1 -2
  262. package/dist/frontend-ssr/components/sidebar.js +1 -2
  263. package/dist/frontend-ssr/components/tag-create-dialog.js +1 -2
  264. package/dist/frontend-ssr/components/version-history.js +18 -21
  265. package/dist/frontend-ssr/dashboard.js +64 -88
  266. package/dist/frontend-ssr/doc-tabs.js +1 -2
  267. package/dist/frontend-ssr/document-drop-coordinator.js +1 -2
  268. package/dist/frontend-ssr/editor-preferences.js +1 -2
  269. package/dist/frontend-ssr/extension.js +1 -2
  270. package/dist/frontend-ssr/folder-refresh.js +1 -2
  271. package/dist/frontend-ssr/i18n.js +315 -603
  272. package/dist/frontend-ssr/keyboard.js +1 -2
  273. package/dist/frontend-ssr/offline/identity.js +1 -2
  274. package/dist/frontend-ssr/search.js +17 -20
  275. package/dist/frontend-ssr/shared-document.js +5 -8
  276. package/dist/frontend-ssr/theme.js +2 -3
  277. package/dist/frontend-ssr/utils/clipboard.js +1 -2
  278. package/dist/frontend-ssr/utils/dndzone.js +1 -2
  279. package/dist/frontend-ssr/utils.js +1 -2
  280. package/dist/index.d.ts +1 -1
  281. package/dist/index.js +1 -1
  282. package/dist/lifecycle-runtime.js +3998 -17872
  283. package/dist/mcp-cli.js +357 -78
  284. package/dist/mcp-server.d.ts +92 -23
  285. package/dist/mcp-server.js +525 -78
  286. package/dist/types.d.ts +68 -1
  287. package/package.json +5 -5
  288. package/packages/cli/src/index.ts +1 -1
  289. package/packages/db/src/schema.ts +3 -1
  290. package/server.json +2 -2
  291. package/dist/frontend/CategoryDialog-CJeAYxcd.js +0 -630
  292. package/dist/frontend/HiAiEditor-DDpfdQEg.js +0 -3129
  293. package/dist/frontend/SettingsDialog-DzlYW50I.js +0 -991
  294. package/dist/frontend/Sidebar-rFiVen96.js +0 -2149
  295. package/dist/frontend/action_cancel-Cuxsznzz.js +0 -5
  296. package/dist/frontend/action_close-BJm_52wm.js +0 -5
  297. package/dist/frontend/action_create-CtBQrRuj.js +0 -5
  298. package/dist/frontend/action_delete-BXBIzvn0.js +0 -5
  299. package/dist/frontend/action_go_to-VmK5jmEk.js +0 -5
  300. package/dist/frontend/action_loading-BLCGJVA9.js +0 -5
  301. package/dist/frontend/action_save-BRN2Z_GP.js +0 -5
  302. package/dist/frontend/dist-DcHl92QO.js +0 -316
  303. package/dist/frontend/doc_title_label-DS9jSIh2.js +0 -5
  304. package/dist/frontend/doc_title_placeholder-DBQpM1aH.js +0 -5
  305. package/dist/frontend/error_generic-CzNtmBT4.js +0 -5
  306. package/dist/frontend/markdown-O9YJA70S.js +0 -12
  307. package/dist/frontend/scroll_to_top_aria-CvkNF_Hu.js +0 -5
  308. package/dist/frontend/utils-BlHvR6OL.js +0 -7
  309. package/dist/frontend/version_create_snapshot-3bu-0qzH.js +0 -5
@@ -149,10 +149,11 @@ var accounts = pgTable("accounts", {
149
149
  id: uuid("id").primaryKey().defaultRandom(),
150
150
  userId: uuid("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
151
151
  accountId: text("account_id").notNull(),
152
- issuer: text("issuer").notNull(),
152
+ issuer: text("issuer"),
153
153
  providerId: text("provider_id").notNull(),
154
154
  accessToken: text("access_token"),
155
155
  refreshToken: text("refresh_token"),
156
+ idToken: text("id_token"),
156
157
  accessTokenExpiresAt: timestamp("access_token_expires_at"),
157
158
  refreshTokenExpiresAt: timestamp("refresh_token_expires_at"),
158
159
  scope: text("scope"),
@@ -986,44 +987,44 @@ class Builder extends NotTagged {
986
987
  this.first = first;
987
988
  this.rest = rest;
988
989
  }
989
- build(before, parameters, types2, options) {
990
+ build(before, parameters, types, options) {
990
991
  const keyword = builders.map(([x, fn]) => ({ fn, i: before.search(x) })).sort((a, b) => a.i - b.i).pop();
991
- return keyword.i === -1 ? escapeIdentifiers(this.first, options) : keyword.fn(this.first, this.rest, parameters, types2, options);
992
+ return keyword.i === -1 ? escapeIdentifiers(this.first, options) : keyword.fn(this.first, this.rest, parameters, types, options);
992
993
  }
993
994
  }
994
- function handleValue(x, parameters, types2, options) {
995
+ function handleValue(x, parameters, types, options) {
995
996
  let value = x instanceof Parameter ? x.value : x;
996
997
  if (value === undefined) {
997
998
  x instanceof Parameter ? x.value = options.transform.undefined : value = x = options.transform.undefined;
998
999
  if (value === undefined)
999
1000
  throw Errors.generic("UNDEFINED_VALUE", "Undefined values are not allowed");
1000
1001
  }
1001
- return "$" + types2.push(x instanceof Parameter ? (parameters.push(x.value), x.array ? x.array[x.type || inferType(x.value)] || x.type || firstIsString(x.value) : x.type) : (parameters.push(x), inferType(x)));
1002
+ return "$" + types.push(x instanceof Parameter ? (parameters.push(x.value), x.array ? x.array[x.type || inferType(x.value)] || x.type || firstIsString(x.value) : x.type) : (parameters.push(x), inferType(x)));
1002
1003
  }
1003
1004
  var defaultHandlers = typeHandlers(types);
1004
- function stringify(q, string, value, parameters, types2, options) {
1005
+ function stringify(q, string, value, parameters, types, options) {
1005
1006
  for (let i = 1;i < q.strings.length; i++) {
1006
- string += stringifyValue(string, value, parameters, types2, options) + q.strings[i];
1007
+ string += stringifyValue(string, value, parameters, types, options) + q.strings[i];
1007
1008
  value = q.args[i];
1008
1009
  }
1009
1010
  return string;
1010
1011
  }
1011
- function stringifyValue(string, value, parameters, types2, o) {
1012
- return value instanceof Builder ? value.build(string, parameters, types2, o) : value instanceof Query ? fragment(value, parameters, types2, o) : value instanceof Identifier ? value.value : value && value[0] instanceof Query ? value.reduce((acc, x) => acc + " " + fragment(x, parameters, types2, o), "") : handleValue(value, parameters, types2, o);
1012
+ function stringifyValue(string, value, parameters, types, o) {
1013
+ return value instanceof Builder ? value.build(string, parameters, types, o) : value instanceof Query ? fragment(value, parameters, types, o) : value instanceof Identifier ? value.value : value && value[0] instanceof Query ? value.reduce((acc, x) => acc + " " + fragment(x, parameters, types, o), "") : handleValue(value, parameters, types, o);
1013
1014
  }
1014
- function fragment(q, parameters, types2, options) {
1015
+ function fragment(q, parameters, types, options) {
1015
1016
  q.fragment = true;
1016
- return stringify(q, q.strings[0], q.args[0], parameters, types2, options);
1017
+ return stringify(q, q.strings[0], q.args[0], parameters, types, options);
1017
1018
  }
1018
- function valuesBuilder(first, parameters, types2, columns, options) {
1019
- return first.map((row) => "(" + columns.map((column) => stringifyValue("values", row[column], parameters, types2, options)).join(",") + ")").join(",");
1019
+ function valuesBuilder(first, parameters, types, columns, options) {
1020
+ return first.map((row) => "(" + columns.map((column) => stringifyValue("values", row[column], parameters, types, options)).join(",") + ")").join(",");
1020
1021
  }
1021
- function values(first, rest, parameters, types2, options) {
1022
+ function values(first, rest, parameters, types, options) {
1022
1023
  const multi = Array.isArray(first[0]);
1023
1024
  const columns = rest.length ? rest.flat() : Object.keys(multi ? first[0] : first);
1024
- return valuesBuilder(multi ? first : [first], parameters, types2, columns, options);
1025
+ return valuesBuilder(multi ? first : [first], parameters, types, columns, options);
1025
1026
  }
1026
- function select(first, rest, parameters, types2, options) {
1027
+ function select(first, rest, parameters, types, options) {
1027
1028
  typeof first === "string" && (first = [first].concat(rest));
1028
1029
  if (Array.isArray(first))
1029
1030
  return escapeIdentifiers(first, options);
@@ -1031,7 +1032,7 @@ function select(first, rest, parameters, types2, options) {
1031
1032
  const columns = rest.length ? rest.flat() : Object.keys(first);
1032
1033
  return columns.map((x) => {
1033
1034
  value = first[x];
1034
- return (value instanceof Query ? fragment(value, parameters, types2, options) : value instanceof Identifier ? value.value : handleValue(value, parameters, types2, options)) + " as " + escapeIdentifier(options.transform.column.to ? options.transform.column.to(x) : x);
1035
+ return (value instanceof Query ? fragment(value, parameters, types, options) : value instanceof Identifier ? value.value : handleValue(value, parameters, types, options)) + " as " + escapeIdentifier(options.transform.column.to ? options.transform.column.to(x) : x);
1035
1036
  }).join(",");
1036
1037
  }
1037
1038
  var builders = Object.entries({
@@ -1044,12 +1045,12 @@ var builders = Object.entries({
1044
1045
  as: select,
1045
1046
  returning: select,
1046
1047
  "\\(": select,
1047
- update(first, rest, parameters, types2, options) {
1048
- return (rest.length ? rest.flat() : Object.keys(first)).map((x) => escapeIdentifier(options.transform.column.to ? options.transform.column.to(x) : x) + "=" + stringifyValue("values", first[x], parameters, types2, options));
1048
+ update(first, rest, parameters, types, options) {
1049
+ return (rest.length ? rest.flat() : Object.keys(first)).map((x) => escapeIdentifier(options.transform.column.to ? options.transform.column.to(x) : x) + "=" + stringifyValue("values", first[x], parameters, types, options));
1049
1050
  },
1050
- insert(first, rest, parameters, types2, options) {
1051
+ insert(first, rest, parameters, types, options) {
1051
1052
  const columns = rest.length ? rest.flat() : Object.keys(Array.isArray(first) ? first[0] : first);
1052
- return "(" + escapeIdentifiers(columns, options) + ")values" + valuesBuilder(Array.isArray(first) ? first : [first], parameters, types2, columns, options);
1053
+ return "(" + escapeIdentifiers(columns, options) + ")values" + valuesBuilder(Array.isArray(first) ? first : [first], parameters, types, columns, options);
1053
1054
  }
1054
1055
  }).map(([x, fn]) => [new RegExp("((?:^|[\\s(])" + x + "(?:$|[\\s(]))(?![\\s\\S]*\\1)", "i"), fn]);
1055
1056
  function notTagged() {
@@ -1062,19 +1063,19 @@ function firstIsString(x) {
1062
1063
  return firstIsString(x[0]);
1063
1064
  return typeof x === "string" ? 1009 : 0;
1064
1065
  }
1065
- var mergeUserTypes = function(types2) {
1066
- const user = typeHandlers(types2 || {});
1066
+ var mergeUserTypes = function(types) {
1067
+ const user = typeHandlers(types || {});
1067
1068
  return {
1068
1069
  serializers: Object.assign({}, serializers, user.serializers),
1069
1070
  parsers: Object.assign({}, parsers, user.parsers)
1070
1071
  };
1071
1072
  };
1072
- function typeHandlers(types2) {
1073
- return Object.keys(types2).reduce((acc, k) => {
1074
- types2[k].from && [].concat(types2[k].from).forEach((x) => acc.parsers[x] = types2[k].parse);
1075
- if (types2[k].serialize) {
1076
- acc.serializers[types2[k].to] = types2[k].serialize;
1077
- types2[k].from && [].concat(types2[k].from).forEach((x) => acc.serializers[x] = types2[k].serialize);
1073
+ function typeHandlers(types) {
1074
+ return Object.keys(types).reduce((acc, k) => {
1075
+ types[k].from && [].concat(types[k].from).forEach((x) => acc.parsers[x] = types[k].parse);
1076
+ if (types[k].serialize) {
1077
+ acc.serializers[types[k].to] = types[k].serialize;
1078
+ types[k].from && [].concat(types[k].from).forEach((x) => acc.serializers[x] = types[k].serialize);
1078
1079
  }
1079
1080
  return acc;
1080
1081
  }, { parsers: {}, serializers: {} });
@@ -1085,15 +1086,15 @@ function escapeIdentifiers(xs, { transform: { column } }) {
1085
1086
  var escapeIdentifier = function escape(str) {
1086
1087
  return '"' + str.replace(/"/g, '""').replace(/\./g, '"."') + '"';
1087
1088
  };
1088
- var inferType = function inferType2(x) {
1089
- return x instanceof Parameter ? x.type : x instanceof Date ? 1184 : x instanceof Uint8Array ? 17 : x === true || x === false ? 16 : typeof x === "bigint" ? 20 : Array.isArray(x) ? inferType2(x[0]) : 0;
1089
+ var inferType = function inferType(x) {
1090
+ return x instanceof Parameter ? x.type : x instanceof Date ? 1184 : x instanceof Uint8Array ? 17 : x === true || x === false ? 16 : typeof x === "bigint" ? 20 : Array.isArray(x) ? inferType(x[0]) : 0;
1090
1091
  };
1091
1092
  var escapeBackslash = /\\/g;
1092
1093
  var escapeQuote = /"/g;
1093
1094
  function arrayEscape(x) {
1094
1095
  return x.replace(escapeBackslash, "\\\\").replace(escapeQuote, "\\\"");
1095
1096
  }
1096
- var arraySerializer = function arraySerializer2(xs, serializer, options, typarray) {
1097
+ var arraySerializer = function arraySerializer(xs, serializer, options, typarray) {
1097
1098
  if (Array.isArray(xs) === false)
1098
1099
  return xs;
1099
1100
  if (!xs.length)
@@ -1101,7 +1102,7 @@ var arraySerializer = function arraySerializer2(xs, serializer, options, typarra
1101
1102
  const first = xs[0];
1102
1103
  const delimiter = typarray === 1020 ? ";" : ",";
1103
1104
  if (Array.isArray(first) && !first.type)
1104
- return "{" + xs.map((x) => arraySerializer2(x, serializer, options, typarray)).join(delimiter) + "}";
1105
+ return "{" + xs.map((x) => arraySerializer(x, serializer, options, typarray)).join(delimiter) + "}";
1105
1106
  return "{" + xs.map((x) => {
1106
1107
  if (x === undefined) {
1107
1108
  x = options.transform.undefined;
@@ -1118,7 +1119,7 @@ var arrayParserState = {
1118
1119
  quoted: false,
1119
1120
  last: 0
1120
1121
  };
1121
- var arrayParser = function arrayParser2(x, parser, typarray) {
1122
+ var arrayParser = function arrayParser(x, parser, typarray) {
1122
1123
  arrayParserState.i = arrayParserState.last = 0;
1123
1124
  return arrayParserLoop(arrayParserState, x, parser, typarray);
1124
1125
  };
@@ -1175,7 +1176,7 @@ var fromPascal = (x) => (x.slice(0, 1) + x.slice(1).replace(/([A-Z])/g, "_$1")).
1175
1176
  var fromKebab = (x) => x.replace(/-/g, "_");
1176
1177
  function createJsonTransform(fn) {
1177
1178
  return function jsonTransform(x, column) {
1178
- return typeof x === "object" && x !== null && (column.type === 114 || column.type === 3802) ? Array.isArray(x) ? x.map((x2) => jsonTransform(x2, column)) : Object.entries(x).reduce((acc, [k, v]) => Object.assign(acc, { [fn(k)]: jsonTransform(v, column) }), {}) : x;
1179
+ return typeof x === "object" && x !== null && (column.type === 114 || column.type === 3802) ? Array.isArray(x) ? x.map((x) => jsonTransform(x, column)) : Object.entries(x).reduce((acc, [k, v]) => Object.assign(acc, { [fn(k)]: jsonTransform(v, column) }), {}) : x;
1179
1180
  };
1180
1181
  }
1181
1182
  toCamel.column = { from: toCamel };
@@ -1222,23 +1223,23 @@ class Result extends Array {
1222
1223
  var queue_default = Queue;
1223
1224
  function Queue(initial = []) {
1224
1225
  let xs = initial.slice();
1225
- let index2 = 0;
1226
+ let index = 0;
1226
1227
  return {
1227
1228
  get length() {
1228
- return xs.length - index2;
1229
+ return xs.length - index;
1229
1230
  },
1230
1231
  remove: (x) => {
1231
- const index3 = xs.indexOf(x);
1232
- return index3 === -1 ? null : (xs.splice(index3, 1), x);
1232
+ const index = xs.indexOf(x);
1233
+ return index === -1 ? null : (xs.splice(index, 1), x);
1233
1234
  },
1234
1235
  push: (x) => (xs.push(x), x),
1235
1236
  shift: () => {
1236
- const out = xs[index2++];
1237
- if (index2 === xs.length) {
1238
- index2 = 0;
1237
+ const out = xs[index++];
1238
+ if (index === xs.length) {
1239
+ index = 0;
1239
1240
  xs = [];
1240
1241
  } else {
1241
- xs[index2 - 1] = undefined;
1242
+ xs[index - 1] = undefined;
1242
1243
  }
1243
1244
  return out;
1244
1245
  }
@@ -1361,7 +1362,7 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1361
1362
  host,
1362
1363
  port,
1363
1364
  database,
1364
- parsers: parsers2,
1365
+ parsers,
1365
1366
  transform,
1366
1367
  onnotice,
1367
1368
  onnotify,
@@ -1373,11 +1374,11 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1373
1374
  } = options;
1374
1375
  const sent = queue_default(), id = uid++, backend = { pid: null, secret: null }, idleTimer = timer(end, options.idle_timeout), lifeTimer = timer(end, options.max_lifetime), connectTimer = timer(connectTimedOut, options.connect_timeout);
1375
1376
  let socket = null, cancelMessage, errorResponse = null, result = new Result, incoming = Buffer.alloc(0), needsTypes = options.fetch_types, backendParameters = {}, statements = {}, statementId = Math.random().toString(36).slice(2), statementCount = 1, closedTime = 0, remaining = 0, hostIndex = 0, retries = 0, length = 0, delay = 0, rows = 0, serverSignature = null, nextWriteTimer = null, terminated = false, incomings = null, results = null, initial = null, ending = null, stream = null, chunk = null, ended = null, nonce = null, query = null, final = null;
1376
- const connection2 = {
1377
+ const connection = {
1377
1378
  queue: queues.closed,
1378
1379
  idleTimer,
1379
- connect(query2) {
1380
- initial = query2;
1380
+ connect(query) {
1381
+ initial = query;
1381
1382
  reconnect();
1382
1383
  },
1383
1384
  terminate,
@@ -1387,8 +1388,8 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1387
1388
  count: 0,
1388
1389
  id
1389
1390
  };
1390
- queues.closed && queues.closed.push(connection2);
1391
- return connection2;
1391
+ queues.closed && queues.closed.push(connection);
1392
+ return connection;
1392
1393
  async function createSocket() {
1393
1394
  let x;
1394
1395
  try {
@@ -1408,8 +1409,8 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1408
1409
  await connect();
1409
1410
  socket.once("error", reject);
1410
1411
  socket.once("close", resolve);
1411
- } catch (error2) {
1412
- reject(error2);
1412
+ } catch (error) {
1413
+ reject(error);
1413
1414
  }
1414
1415
  }
1415
1416
  function execute(q) {
@@ -1423,10 +1424,10 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1423
1424
  q.state = backend;
1424
1425
  query ? sent.push(q) : (query = q, query.active = true);
1425
1426
  build(q);
1426
- return write(toBuffer(q)) && !q.describeFirst && !q.cursorFn && sent.length < max_pipeline && (!q.options.onexecute || q.options.onexecute(connection2));
1427
- } catch (error2) {
1427
+ return write(toBuffer(q)) && !q.describeFirst && !q.cursorFn && sent.length < max_pipeline && (!q.options.onexecute || q.options.onexecute(connection));
1428
+ } catch (error) {
1428
1429
  sent.length === 0 && write(Sync);
1429
- errored(error2);
1430
+ errored(error);
1430
1431
  return true;
1431
1432
  }
1432
1433
  }
@@ -1455,18 +1456,18 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1455
1456
  ]);
1456
1457
  }
1457
1458
  function build(q) {
1458
- const parameters = [], types2 = [];
1459
- const string = stringify(q, q.strings[0], q.args[0], parameters, types2, options);
1460
- !q.tagged && q.args.forEach((x) => handleValue(x, parameters, types2, options));
1459
+ const parameters = [], types = [];
1460
+ const string = stringify(q, q.strings[0], q.args[0], parameters, types, options);
1461
+ !q.tagged && q.args.forEach((x) => handleValue(x, parameters, types, options));
1461
1462
  q.prepare = options.prepare && ("prepare" in q.options ? q.options.prepare : true);
1462
1463
  q.string = string;
1463
- q.signature = q.prepare && types2 + string;
1464
+ q.signature = q.prepare && types + string;
1464
1465
  q.onlyDescribe && delete statements[q.signature];
1465
1466
  q.parameters = q.parameters || parameters;
1466
1467
  q.prepared = q.prepare && q.signature in statements;
1467
1468
  q.describeFirst = q.onlyDescribe || parameters.length && !q.prepared;
1468
- q.statement = q.prepared ? statements[q.signature] : { string, types: types2, name: q.prepare ? statementId + statementCount++ : "" };
1469
- typeof options.debug === "function" && options.debug(id, string, parameters, types2);
1469
+ q.statement = q.prepared ? statements[q.signature] : { string, types, name: q.prepare ? statementId + statementCount++ : "" };
1470
+ typeof options.debug === "function" && options.debug(id, string, parameters, types);
1470
1471
  }
1471
1472
  function write(x, fn) {
1472
1473
  chunk = chunk ? Buffer.concat([chunk, x]) : Buffer.from(x);
@@ -1492,25 +1493,25 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1492
1493
  if (!canSSL && ssl === "prefer")
1493
1494
  return connected();
1494
1495
  }
1495
- const options2 = {
1496
+ const options = {
1496
1497
  socket,
1497
1498
  servername: net.isIP(socket.host) ? undefined : socket.host
1498
1499
  };
1499
1500
  if (sslnegotiation === "direct")
1500
- options2.ALPNProtocols = ["postgresql"];
1501
+ options.ALPNProtocols = ["postgresql"];
1501
1502
  if (ssl === "require" || ssl === "allow" || ssl === "prefer")
1502
- options2.rejectUnauthorized = false;
1503
+ options.rejectUnauthorized = false;
1503
1504
  else if (typeof ssl === "object")
1504
- Object.assign(options2, ssl);
1505
+ Object.assign(options, ssl);
1505
1506
  socket.removeAllListeners();
1506
- socket = tls.connect(options2);
1507
+ socket = tls.connect(options);
1507
1508
  socket.on("secureConnect", connected);
1508
1509
  socket.on("error", error);
1509
1510
  socket.on("close", closed);
1510
1511
  socket.on("drain", drain);
1511
1512
  }
1512
1513
  function drain() {
1513
- !query && onopen(connection2);
1514
+ !query && onopen(connection);
1514
1515
  }
1515
1516
  function data(x) {
1516
1517
  if (incomings) {
@@ -1575,7 +1576,7 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1575
1576
  }
1576
1577
  }
1577
1578
  function error(err) {
1578
- if (connection2.queue === queues.connecting && options.host[retries + 1])
1579
+ if (connection.queue === queues.connecting && options.host[retries + 1])
1579
1580
  return;
1580
1581
  errored(err);
1581
1582
  while (sent.length)
@@ -1586,23 +1587,23 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1586
1587
  query && queryError(query, err);
1587
1588
  initial && (queryError(initial, err), initial = null);
1588
1589
  }
1589
- function queryError(query2, err) {
1590
- if (query2.reserve)
1591
- return query2.reject(err);
1590
+ function queryError(query, err) {
1591
+ if (query.reserve)
1592
+ return query.reject(err);
1592
1593
  if (!err || typeof err !== "object")
1593
1594
  err = new Error(err);
1594
1595
  "query" in err || "parameters" in err || Object.defineProperties(err, {
1595
- stack: { value: err.stack + query2.origin.replace(/.*\n/, `
1596
+ stack: { value: err.stack + query.origin.replace(/.*\n/, `
1596
1597
  `), enumerable: options.debug },
1597
- query: { value: query2.string, enumerable: options.debug },
1598
- parameters: { value: query2.parameters, enumerable: options.debug },
1599
- args: { value: query2.args, enumerable: options.debug },
1600
- types: { value: query2.statement && query2.statement.types, enumerable: options.debug }
1598
+ query: { value: query.string, enumerable: options.debug },
1599
+ parameters: { value: query.parameters, enumerable: options.debug },
1600
+ args: { value: query.args, enumerable: options.debug },
1601
+ types: { value: query.statement && query.statement.types, enumerable: options.debug }
1601
1602
  });
1602
- query2.reject(err);
1603
+ query.reject(err);
1603
1604
  }
1604
1605
  function end() {
1605
- return ending || (!connection2.reserved && onend(connection2), !connection2.reserved && !initial && !query && sent.length === 0 ? (terminate(), new Promise((r) => socket && socket.readyState !== "closed" ? socket.once("close", r) : r())) : ending = new Promise((r) => ended = r));
1606
+ return ending || (!connection.reserved && onend(connection), !connection.reserved && !initial && !query && sent.length === 0 ? (terminate(), new Promise((r) => socket && socket.readyState !== "closed" ? socket.once("close", r) : r())) : ending = new Promise((r) => ended = r));
1606
1607
  }
1607
1608
  function terminate() {
1608
1609
  terminated = true;
@@ -1634,22 +1635,22 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1634
1635
  closedTime = performance.now();
1635
1636
  hadError && options.shared.retries++;
1636
1637
  delay = (typeof backoff === "function" ? backoff(options.shared.retries) : backoff) * 1000;
1637
- onclose(connection2, Errors.connection("CONNECTION_CLOSED", options, socket));
1638
+ onclose(connection, Errors.connection("CONNECTION_CLOSED", options, socket));
1638
1639
  }
1639
1640
  function handle(xs, x = xs[0]) {
1640
1641
  (x === 68 ? DataRow : x === 100 ? CopyData : x === 65 ? NotificationResponse : x === 83 ? ParameterStatus : x === 90 ? ReadyForQuery : x === 67 ? CommandComplete : x === 50 ? BindComplete : x === 49 ? ParseComplete : x === 116 ? ParameterDescription : x === 84 ? RowDescription : x === 82 ? Authentication : x === 110 ? NoData : x === 75 ? BackendKeyData : x === 69 ? ErrorResponse : x === 115 ? PortalSuspended : x === 51 ? CloseComplete : x === 71 ? CopyInResponse : x === 78 ? NoticeResponse : x === 72 ? CopyOutResponse : x === 99 ? CopyDone : x === 73 ? EmptyQueryResponse : x === 86 ? FunctionCallResponse : x === 118 ? NegotiateProtocolVersion : x === 87 ? CopyBothResponse : UnknownMessage)(xs);
1641
1642
  }
1642
1643
  function DataRow(x) {
1643
- let index2 = 7;
1644
- let length2;
1644
+ let index = 7;
1645
+ let length;
1645
1646
  let column;
1646
1647
  let value;
1647
1648
  const row = query.isRaw ? new Array(query.statement.columns.length) : {};
1648
1649
  for (let i = 0;i < query.statement.columns.length; i++) {
1649
1650
  column = query.statement.columns[i];
1650
- length2 = x.readInt32BE(index2);
1651
- index2 += 4;
1652
- value = length2 === -1 ? null : query.isRaw === true ? x.subarray(index2, index2 += length2) : column.parser === undefined ? x.toString("utf8", index2, index2 += length2) : column.parser.array === true ? column.parser(x.toString("utf8", index2 + 1, index2 += length2)) : column.parser(x.toString("utf8", index2, index2 += length2));
1651
+ length = x.readInt32BE(index);
1652
+ index += 4;
1653
+ value = length === -1 ? null : query.isRaw === true ? x.subarray(index, index += length) : column.parser === undefined ? x.toString("utf8", index, index += length) : column.parser.array === true ? column.parser(x.toString("utf8", index + 1, index += length)) : column.parser(x.toString("utf8", index, index += length));
1653
1654
  query.isRaw ? row[i] = query.isRaw === true ? value : transform.value.from ? transform.value.from(value, column) : value : row[column.name] = transform.value.from ? transform.value.from(value, column) : value;
1654
1655
  }
1655
1656
  query.forEachFn ? query.forEachFn(transform.row.from ? transform.row.from(row) : row, result) : result[rows++] = transform.row.from ? transform.row.from(row) : row;
@@ -1695,7 +1696,7 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1695
1696
  Connection(options).cancel(query.state, query.cancelled.resolve, query.cancelled.reject);
1696
1697
  if (query)
1697
1698
  return;
1698
- connection2.reserved ? !connection2.reserved.release && x[5] === 73 ? ending ? terminate() : (connection2.reserved = null, onopen(connection2)) : connection2.reserved() : ending ? terminate() : onopen(connection2);
1699
+ connection.reserved ? !connection.reserved.release && x[5] === 73 ? ending ? terminate() : (connection.reserved = null, onopen(connection)) : connection.reserved() : ending ? terminate() : onopen(connection);
1699
1700
  }
1700
1701
  function CommandComplete(x) {
1701
1702
  rows = 0;
@@ -1709,7 +1710,7 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1709
1710
  }
1710
1711
  }
1711
1712
  final && (final(), final = null);
1712
- if (result.command === "BEGIN" && max !== 1 && !connection2.reserved)
1713
+ if (result.command === "BEGIN" && max !== 1 && !connection.reserved)
1713
1714
  return errored(Errors.generic("UNSAFE_TRANSACTION", "Only use sql.begin, sql.reserved or max: 1"));
1714
1715
  if (query.options.simple)
1715
1716
  return BindComplete();
@@ -1726,8 +1727,8 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1726
1727
  result.columns = query.statement.columns;
1727
1728
  }
1728
1729
  function ParameterDescription(x) {
1729
- const length2 = x.readUInt16BE(5);
1730
- for (let i = 0;i < length2; ++i)
1730
+ const length = x.readUInt16BE(5);
1731
+ for (let i = 0;i < length; ++i)
1731
1732
  !query.statement.types[i] && (query.statement.types[i] = x.readUInt32BE(7 + i * 4));
1732
1733
  query.prepare && (statements[query.signature] = query.statement);
1733
1734
  query.describeFirst && !query.onlyDescribe && (write(prepared(query)), query.describeFirst = false);
@@ -1739,25 +1740,25 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1739
1740
  result.count = null;
1740
1741
  query.statement.columns = null;
1741
1742
  }
1742
- const length2 = x.readUInt16BE(5);
1743
- let index2 = 7;
1743
+ const length = x.readUInt16BE(5);
1744
+ let index = 7;
1744
1745
  let start;
1745
- query.statement.columns = Array(length2);
1746
- for (let i = 0;i < length2; ++i) {
1747
- start = index2;
1748
- while (x[index2++] !== 0)
1746
+ query.statement.columns = Array(length);
1747
+ for (let i = 0;i < length; ++i) {
1748
+ start = index;
1749
+ while (x[index++] !== 0)
1749
1750
  ;
1750
- const table = x.readUInt32BE(index2);
1751
- const number = x.readUInt16BE(index2 + 4);
1752
- const type = x.readUInt32BE(index2 + 6);
1751
+ const table = x.readUInt32BE(index);
1752
+ const number = x.readUInt16BE(index + 4);
1753
+ const type = x.readUInt32BE(index + 6);
1753
1754
  query.statement.columns[i] = {
1754
- name: transform.column.from ? transform.column.from(x.toString("utf8", start, index2 - 1)) : x.toString("utf8", start, index2 - 1),
1755
- parser: parsers2[type],
1755
+ name: transform.column.from ? transform.column.from(x.toString("utf8", start, index - 1)) : x.toString("utf8", start, index - 1),
1756
+ parser: parsers[type],
1756
1757
  table,
1757
1758
  number,
1758
1759
  type
1759
1760
  };
1760
- index2 += 18;
1761
+ index += 18;
1761
1762
  }
1762
1763
  result.statement = query.statement;
1763
1764
  if (query.onlyDescribe)
@@ -1784,7 +1785,7 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1784
1785
  write(bytes_default.inc(4).str("n,,n=*,r=" + nonce).i32(bytes_default.i - i - 4, i).end());
1785
1786
  }
1786
1787
  async function SASLContinue(x) {
1787
- const res = x.toString("utf8", 9).split(",").reduce((acc, x2) => (acc[x2[0]] = x2.slice(2), acc), {});
1788
+ const res = x.toString("utf8", 9).split(",").reduce((acc, x) => (acc[x[0]] = x.slice(2), acc), {});
1788
1789
  const saltedPassword = await crypto.pbkdf2Sync(await Pass(), Buffer.from(res.s, "base64"), parseInt(res.i), 32, "sha256");
1789
1790
  const clientKey = await hmac(saltedPassword, "Client Key");
1790
1791
  const auth = "n=*,r=" + nonce + "," + "r=" + res.r + ",s=" + res.s + ",i=" + res.i + ",c=biws,r=" + res.r;
@@ -1813,7 +1814,7 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1813
1814
  }
1814
1815
  async function fetchArrayTypes() {
1815
1816
  needsTypes = false;
1816
- const types2 = await new Query([`
1817
+ const types = await new Query([`
1817
1818
  select b.oid, b.typarray
1818
1819
  from pg_catalog.pg_type a
1819
1820
  left join pg_catalog.pg_type b on b.oid = a.typelem
@@ -1821,7 +1822,7 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1821
1822
  group by b.oid, b.typarray
1822
1823
  order by b.oid
1823
1824
  `], [], execute);
1824
- types2.forEach(({ oid, typarray }) => addArrayType(oid, typarray));
1825
+ types.forEach(({ oid, typarray }) => addArrayType(oid, typarray));
1825
1826
  }
1826
1827
  function addArrayType(oid, typarray) {
1827
1828
  if (!!options.parsers[typarray] && !!options.serializers[typarray])
@@ -1836,15 +1837,15 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1836
1837
  return x === "read-write" && xs.default_transaction_read_only === "on" || x === "read-only" && xs.default_transaction_read_only === "off" || x === "primary" && xs.in_hot_standby === "on" || x === "standby" && xs.in_hot_standby === "off" || x === "prefer-standby" && xs.in_hot_standby === "off" && options.host[retries];
1837
1838
  }
1838
1839
  function fetchState() {
1839
- const query2 = new Query([`
1840
+ const query = new Query([`
1840
1841
  show transaction_read_only;
1841
1842
  select pg_catalog.pg_is_in_recovery()
1842
1843
  `], [], execute, null, { simple: true });
1843
- query2.resolve = ([[a], [b2]]) => {
1844
+ query.resolve = ([[a], [b]]) => {
1844
1845
  backendParameters.default_transaction_read_only = a.transaction_read_only;
1845
- backendParameters.in_hot_standby = b2.pg_is_in_recovery ? "on" : "off";
1846
+ backendParameters.in_hot_standby = b.pg_is_in_recovery ? "on" : "off";
1846
1847
  };
1847
- query2.execute();
1848
+ query.execute();
1848
1849
  }
1849
1850
  function ErrorResponse(x) {
1850
1851
  if (query) {
@@ -1854,18 +1855,18 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1854
1855
  errored(Errors.postgres(parseError(x)));
1855
1856
  }
1856
1857
  }
1857
- function retry(q, error2) {
1858
+ function retry(q, error) {
1858
1859
  delete statements[q.signature];
1859
- q.retried = error2;
1860
+ q.retried = error;
1860
1861
  execute(q);
1861
1862
  }
1862
1863
  function NotificationResponse(x) {
1863
1864
  if (!onnotify)
1864
1865
  return;
1865
- let index2 = 9;
1866
- while (x[index2++] !== 0)
1866
+ let index = 9;
1867
+ while (x[index++] !== 0)
1867
1868
  ;
1868
- onnotify(x.toString("utf8", 9, index2 - 1), x.toString("utf8", index2, x.length - 1));
1869
+ onnotify(x.toString("utf8", 9, index - 1), x.toString("utf8", index, x.length - 1));
1869
1870
  }
1870
1871
  async function PortalSuspended() {
1871
1872
  try {
@@ -1884,12 +1885,12 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1884
1885
  function CopyInResponse() {
1885
1886
  stream = new Stream.Writable({
1886
1887
  autoDestroy: true,
1887
- write(chunk2, encoding, callback) {
1888
- socket.write(bytes_default().d().raw(chunk2).end(), callback);
1888
+ write(chunk, encoding, callback) {
1889
+ socket.write(bytes_default().d().raw(chunk).end(), callback);
1889
1890
  },
1890
- destroy(error2, callback) {
1891
- callback(error2);
1892
- socket.write(bytes_default().f().str(error2 + bytes_default.N).end());
1891
+ destroy(error, callback) {
1892
+ callback(error);
1893
+ socket.write(bytes_default().f().str(error + bytes_default.N).end());
1893
1894
  stream = null;
1894
1895
  },
1895
1896
  final(callback) {
@@ -1914,12 +1915,12 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1914
1915
  read() {
1915
1916
  socket.resume();
1916
1917
  },
1917
- write(chunk2, encoding, callback) {
1918
- socket.write(bytes_default().d().raw(chunk2).end(), callback);
1918
+ write(chunk, encoding, callback) {
1919
+ socket.write(bytes_default().d().raw(chunk).end(), callback);
1919
1920
  },
1920
- destroy(error2, callback) {
1921
- callback(error2);
1922
- socket.write(bytes_default().f().str(error2 + bytes_default.N).end());
1921
+ destroy(error, callback) {
1922
+ callback(error);
1923
+ socket.write(bytes_default().f().str(error + bytes_default.N).end());
1923
1924
  stream = null;
1924
1925
  },
1925
1926
  final(callback) {
@@ -1952,13 +1953,13 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1952
1953
  function UnknownAuth(x, type) {
1953
1954
  console.error("Postgres.js : Unknown Auth:", type);
1954
1955
  }
1955
- function Bind(parameters, types2, statement = "", portal = "") {
1956
+ function Bind(parameters, types, statement = "", portal = "") {
1956
1957
  let prev, type;
1957
1958
  bytes_default().B().str(portal + bytes_default.N).str(statement + bytes_default.N).i16(0).i16(parameters.length);
1958
1959
  parameters.forEach((x, i) => {
1959
1960
  if (x === null)
1960
1961
  return bytes_default.i32(4294967295);
1961
- type = types2[i];
1962
+ type = types[i];
1962
1963
  parameters[i] = x = type in options.serializers ? options.serializers[type](x) : "" + x;
1963
1964
  prev = bytes_default.i;
1964
1965
  bytes_default.inc(4).str(x).i32(bytes_default.i - prev - 4, prev);
@@ -1966,17 +1967,17 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1966
1967
  bytes_default.i16(0);
1967
1968
  return bytes_default.end();
1968
1969
  }
1969
- function Parse(str, parameters, types2, name = "") {
1970
+ function Parse(str, parameters, types, name = "") {
1970
1971
  bytes_default().P().str(name + bytes_default.N).str(str + bytes_default.N).i16(parameters.length);
1971
- parameters.forEach((x, i) => bytes_default.i32(types2[i] || 0));
1972
+ parameters.forEach((x, i) => bytes_default.i32(types[i] || 0));
1972
1973
  return bytes_default.end();
1973
1974
  }
1974
1975
  function Describe(x, name = "") {
1975
1976
  return bytes_default().D().str(x).str(name + bytes_default.N).end();
1976
1977
  }
1977
- function Execute(portal = "", rows2 = 0) {
1978
+ function Execute(portal = "", rows = 0) {
1978
1979
  return Buffer.concat([
1979
- bytes_default().E().str(portal + bytes_default.N).i32(rows2).end(),
1980
+ bytes_default().E().str(portal + bytes_default.N).i32(rows).end(),
1980
1981
  Flush
1981
1982
  ]);
1982
1983
  }
@@ -2014,39 +2015,39 @@ function hmac(key, x) {
2014
2015
  function sha256(x) {
2015
2016
  return crypto.createHash("sha256").update(x).digest();
2016
2017
  }
2017
- function xor(a, b2) {
2018
- const length = Math.max(a.length, b2.length);
2019
- const buffer2 = Buffer.allocUnsafe(length);
2018
+ function xor(a, b) {
2019
+ const length = Math.max(a.length, b.length);
2020
+ const buffer = Buffer.allocUnsafe(length);
2020
2021
  for (let i = 0;i < length; i++)
2021
- buffer2[i] = a[i] ^ b2[i];
2022
- return buffer2;
2022
+ buffer[i] = a[i] ^ b[i];
2023
+ return buffer;
2023
2024
  }
2024
2025
  function timer(fn, seconds) {
2025
2026
  seconds = typeof seconds === "function" ? seconds() : seconds;
2026
2027
  if (!seconds)
2027
2028
  return { cancel: noop, start: noop };
2028
- let timer2;
2029
+ let timer;
2029
2030
  return {
2030
2031
  cancel() {
2031
- timer2 && (clearTimeout(timer2), timer2 = null);
2032
+ timer && (clearTimeout(timer), timer = null);
2032
2033
  },
2033
2034
  start() {
2034
- timer2 && clearTimeout(timer2);
2035
- timer2 = setTimeout(done, seconds * 1000, arguments);
2035
+ timer && clearTimeout(timer);
2036
+ timer = setTimeout(done, seconds * 1000, arguments);
2036
2037
  }
2037
2038
  };
2038
2039
  function done(args) {
2039
2040
  fn.apply(null, args);
2040
- timer2 = null;
2041
+ timer = null;
2041
2042
  }
2042
2043
  }
2043
2044
 
2044
2045
  // ../../node_modules/.bun/postgres@3.4.9/node_modules/postgres/src/subscribe.js
2045
2046
  var noop2 = () => {};
2046
- function Subscribe(postgres2, options) {
2047
+ function Subscribe(postgres, options) {
2047
2048
  const subscribers = new Map, slot = "postgresjs_" + Math.random().toString(36).slice(2), state = {};
2048
- let connection2, stream, ended = false;
2049
- const sql2 = subscribe.sql = postgres2({
2049
+ let connection, stream, ended = false;
2050
+ const sql = subscribe.sql = postgres({
2050
2051
  ...options,
2051
2052
  transform: { column: {}, value: {}, row: {} },
2052
2053
  max: 1,
@@ -2062,37 +2063,37 @@ function Subscribe(postgres2, options) {
2062
2063
  return;
2063
2064
  stream = null;
2064
2065
  state.pid = state.secret = undefined;
2065
- connected(await init(sql2, slot, options.publications));
2066
+ connected(await init(sql, slot, options.publications));
2066
2067
  subscribers.forEach((event) => event.forEach(({ onsubscribe }) => onsubscribe()));
2067
2068
  },
2068
2069
  no_subscribe: true
2069
2070
  });
2070
- const { end, close } = sql2;
2071
- sql2.end = async () => {
2071
+ const { end, close } = sql;
2072
+ sql.end = async () => {
2072
2073
  ended = true;
2073
2074
  stream && await new Promise((r) => (stream.once("close", r), stream.end()));
2074
2075
  return end();
2075
2076
  };
2076
- sql2.close = async () => {
2077
+ sql.close = async () => {
2077
2078
  stream && await new Promise((r) => (stream.once("close", r), stream.end()));
2078
2079
  return close();
2079
2080
  };
2080
2081
  return subscribe;
2081
2082
  async function subscribe(event, fn, onsubscribe = noop2, onerror = noop2) {
2082
2083
  event = parseEvent(event);
2083
- if (!connection2)
2084
- connection2 = init(sql2, slot, options.publications);
2084
+ if (!connection)
2085
+ connection = init(sql, slot, options.publications);
2085
2086
  const subscriber = { fn, onsubscribe };
2086
2087
  const fns = subscribers.has(event) ? subscribers.get(event).add(subscriber) : subscribers.set(event, new Set([subscriber])).get(event);
2087
2088
  const unsubscribe = () => {
2088
2089
  fns.delete(subscriber);
2089
2090
  fns.size === 0 && subscribers.delete(event);
2090
2091
  };
2091
- return connection2.then((x) => {
2092
+ return connection.then((x) => {
2092
2093
  connected(x);
2093
2094
  onsubscribe();
2094
2095
  stream && stream.on("error", onerror);
2095
- return { unsubscribe, state, sql: sql2 };
2096
+ return { unsubscribe, state, sql };
2096
2097
  });
2097
2098
  }
2098
2099
  function connected(x) {
@@ -2100,74 +2101,74 @@ function Subscribe(postgres2, options) {
2100
2101
  state.pid = x.state.pid;
2101
2102
  state.secret = x.state.secret;
2102
2103
  }
2103
- async function init(sql3, slot2, publications) {
2104
+ async function init(sql, slot, publications) {
2104
2105
  if (!publications)
2105
2106
  throw new Error("Missing publication names");
2106
- const xs = await sql3.unsafe(`CREATE_REPLICATION_SLOT ${slot2} TEMPORARY LOGICAL pgoutput NOEXPORT_SNAPSHOT`);
2107
+ const xs = await sql.unsafe(`CREATE_REPLICATION_SLOT ${slot} TEMPORARY LOGICAL pgoutput NOEXPORT_SNAPSHOT`);
2107
2108
  const [x] = xs;
2108
- const stream2 = await sql3.unsafe(`START_REPLICATION SLOT ${slot2} LOGICAL ${x.consistent_point} (proto_version '1', publication_names '${publications}')`).writable();
2109
- const state2 = {
2110
- lsn: Buffer.concat(x.consistent_point.split("/").map((x2) => Buffer.from(("00000000" + x2).slice(-8), "hex")))
2109
+ const stream = await sql.unsafe(`START_REPLICATION SLOT ${slot} LOGICAL ${x.consistent_point} (proto_version '1', publication_names '${publications}')`).writable();
2110
+ const state = {
2111
+ lsn: Buffer.concat(x.consistent_point.split("/").map((x) => Buffer.from(("00000000" + x).slice(-8), "hex")))
2111
2112
  };
2112
- stream2.on("data", data);
2113
- stream2.on("error", error);
2114
- stream2.on("close", sql3.close);
2115
- return { stream: stream2, state: xs.state };
2113
+ stream.on("data", data);
2114
+ stream.on("error", error);
2115
+ stream.on("close", sql.close);
2116
+ return { stream, state: xs.state };
2116
2117
  function error(e) {
2117
2118
  console.error("Unexpected error during logical streaming - reconnecting", e);
2118
2119
  }
2119
- function data(x2) {
2120
- if (x2[0] === 119) {
2121
- parse(x2.subarray(25), state2, sql3.options.parsers, handle, options.transform);
2122
- } else if (x2[0] === 107 && x2[17]) {
2123
- state2.lsn = x2.subarray(1, 9);
2120
+ function data(x) {
2121
+ if (x[0] === 119) {
2122
+ parse(x.subarray(25), state, sql.options.parsers, handle, options.transform);
2123
+ } else if (x[0] === 107 && x[17]) {
2124
+ state.lsn = x.subarray(1, 9);
2124
2125
  pong();
2125
2126
  }
2126
2127
  }
2127
- function handle(a, b2) {
2128
- const path = b2.relation.schema + "." + b2.relation.table;
2129
- call("*", a, b2);
2130
- call("*:" + path, a, b2);
2131
- b2.relation.keys.length && call("*:" + path + "=" + b2.relation.keys.map((x2) => a[x2.name]), a, b2);
2132
- call(b2.command, a, b2);
2133
- call(b2.command + ":" + path, a, b2);
2134
- b2.relation.keys.length && call(b2.command + ":" + path + "=" + b2.relation.keys.map((x2) => a[x2.name]), a, b2);
2128
+ function handle(a, b) {
2129
+ const path = b.relation.schema + "." + b.relation.table;
2130
+ call("*", a, b);
2131
+ call("*:" + path, a, b);
2132
+ b.relation.keys.length && call("*:" + path + "=" + b.relation.keys.map((x) => a[x.name]), a, b);
2133
+ call(b.command, a, b);
2134
+ call(b.command + ":" + path, a, b);
2135
+ b.relation.keys.length && call(b.command + ":" + path + "=" + b.relation.keys.map((x) => a[x.name]), a, b);
2135
2136
  }
2136
2137
  function pong() {
2137
- const x2 = Buffer.alloc(34);
2138
- x2[0] = 114;
2139
- x2.fill(state2.lsn, 1);
2140
- x2.writeBigInt64BE(BigInt(Date.now() - Date.UTC(2000, 0, 1)) * BigInt(1000), 25);
2141
- stream2.write(x2);
2138
+ const x = Buffer.alloc(34);
2139
+ x[0] = 114;
2140
+ x.fill(state.lsn, 1);
2141
+ x.writeBigInt64BE(BigInt(Date.now() - Date.UTC(2000, 0, 1)) * BigInt(1000), 25);
2142
+ stream.write(x);
2142
2143
  }
2143
2144
  }
2144
- function call(x, a, b2) {
2145
- subscribers.has(x) && subscribers.get(x).forEach(({ fn }) => fn(a, b2, x));
2145
+ function call(x, a, b) {
2146
+ subscribers.has(x) && subscribers.get(x).forEach(({ fn }) => fn(a, b, x));
2146
2147
  }
2147
2148
  }
2148
2149
  function Time(x) {
2149
2150
  return new Date(Date.UTC(2000, 0, 1) + Number(x / BigInt(1000)));
2150
2151
  }
2151
- function parse(x, state, parsers2, handle, transform) {
2152
+ function parse(x, state, parsers, handle, transform) {
2152
2153
  const char = (acc, [k, v]) => (acc[k.charCodeAt(0)] = v, acc);
2153
2154
  Object.entries({
2154
- R: (x2) => {
2155
+ R: (x) => {
2155
2156
  let i = 1;
2156
- const r = state[x2.readUInt32BE(i)] = {
2157
- schema: x2.toString("utf8", i += 4, i = x2.indexOf(0, i)) || "pg_catalog",
2158
- table: x2.toString("utf8", i + 1, i = x2.indexOf(0, i + 1)),
2159
- columns: Array(x2.readUInt16BE(i += 2)),
2157
+ const r = state[x.readUInt32BE(i)] = {
2158
+ schema: x.toString("utf8", i += 4, i = x.indexOf(0, i)) || "pg_catalog",
2159
+ table: x.toString("utf8", i + 1, i = x.indexOf(0, i + 1)),
2160
+ columns: Array(x.readUInt16BE(i += 2)),
2160
2161
  keys: []
2161
2162
  };
2162
2163
  i += 2;
2163
2164
  let columnIndex = 0, column;
2164
- while (i < x2.length) {
2165
+ while (i < x.length) {
2165
2166
  column = r.columns[columnIndex++] = {
2166
- key: x2[i++],
2167
- name: transform.column.from ? transform.column.from(x2.toString("utf8", i, i = x2.indexOf(0, i))) : x2.toString("utf8", i, i = x2.indexOf(0, i)),
2168
- type: x2.readUInt32BE(i += 1),
2169
- parser: parsers2[x2.readUInt32BE(i)],
2170
- atttypmod: x2.readUInt32BE(i += 4)
2167
+ key: x[i++],
2168
+ name: transform.column.from ? transform.column.from(x.toString("utf8", i, i = x.indexOf(0, i))) : x.toString("utf8", i, i = x.indexOf(0, i)),
2169
+ type: x.readUInt32BE(i += 1),
2170
+ parser: parsers[x.readUInt32BE(i)],
2171
+ atttypmod: x.readUInt32BE(i += 4)
2171
2172
  };
2172
2173
  column.key && r.keys.push(column);
2173
2174
  i += 4;
@@ -2175,38 +2176,38 @@ function parse(x, state, parsers2, handle, transform) {
2175
2176
  },
2176
2177
  Y: () => {},
2177
2178
  O: () => {},
2178
- B: (x2) => {
2179
- state.date = Time(x2.readBigInt64BE(9));
2180
- state.lsn = x2.subarray(1, 9);
2179
+ B: (x) => {
2180
+ state.date = Time(x.readBigInt64BE(9));
2181
+ state.lsn = x.subarray(1, 9);
2181
2182
  },
2182
- I: (x2) => {
2183
+ I: (x) => {
2183
2184
  let i = 1;
2184
- const relation = state[x2.readUInt32BE(i)];
2185
- const { row } = tuples(x2, relation.columns, i += 7, transform);
2185
+ const relation = state[x.readUInt32BE(i)];
2186
+ const { row } = tuples(x, relation.columns, i += 7, transform);
2186
2187
  handle(row, {
2187
2188
  command: "insert",
2188
2189
  relation
2189
2190
  });
2190
2191
  },
2191
- D: (x2) => {
2192
+ D: (x) => {
2192
2193
  let i = 1;
2193
- const relation = state[x2.readUInt32BE(i)];
2194
+ const relation = state[x.readUInt32BE(i)];
2194
2195
  i += 4;
2195
- const key = x2[i] === 75;
2196
- handle(key || x2[i] === 79 ? tuples(x2, relation.columns, i += 3, transform).row : null, {
2196
+ const key = x[i] === 75;
2197
+ handle(key || x[i] === 79 ? tuples(x, relation.columns, i += 3, transform).row : null, {
2197
2198
  command: "delete",
2198
2199
  relation,
2199
2200
  key
2200
2201
  });
2201
2202
  },
2202
- U: (x2) => {
2203
+ U: (x) => {
2203
2204
  let i = 1;
2204
- const relation = state[x2.readUInt32BE(i)];
2205
+ const relation = state[x.readUInt32BE(i)];
2205
2206
  i += 4;
2206
- const key = x2[i] === 75;
2207
- const xs = key || x2[i] === 79 ? tuples(x2, relation.columns, i += 3, transform) : null;
2207
+ const key = x[i] === 75;
2208
+ const xs = key || x[i] === 79 ? tuples(x, relation.columns, i += 3, transform) : null;
2208
2209
  xs && (i = xs.i);
2209
- const { row } = tuples(x2, relation.columns, i + 3, transform);
2210
+ const { row } = tuples(x, relation.columns, i + 3, transform);
2210
2211
  handle(row, {
2211
2212
  command: "update",
2212
2213
  relation,
@@ -2239,22 +2240,22 @@ function parseEvent(x) {
2239
2240
 
2240
2241
  // ../../node_modules/.bun/postgres@3.4.9/node_modules/postgres/src/large.js
2241
2242
  import Stream2 from "stream";
2242
- function largeObject(sql2, oid, mode = 131072 | 262144) {
2243
+ function largeObject(sql, oid, mode = 131072 | 262144) {
2243
2244
  return new Promise(async (resolve, reject) => {
2244
- await sql2.begin(async (sql3) => {
2245
+ await sql.begin(async (sql) => {
2245
2246
  let finish;
2246
- !oid && ([{ oid }] = await sql3`select lo_creat(-1) as oid`);
2247
- const [{ fd }] = await sql3`select lo_open(${oid}, ${mode}) as fd`;
2247
+ !oid && ([{ oid }] = await sql`select lo_creat(-1) as oid`);
2248
+ const [{ fd }] = await sql`select lo_open(${oid}, ${mode}) as fd`;
2248
2249
  const lo = {
2249
2250
  writable,
2250
2251
  readable,
2251
- close: () => sql3`select lo_close(${fd})`.then(finish),
2252
- tell: () => sql3`select lo_tell64(${fd})`,
2253
- read: (x) => sql3`select loread(${fd}, ${x}) as data`,
2254
- write: (x) => sql3`select lowrite(${fd}, ${x})`,
2255
- truncate: (x) => sql3`select lo_truncate64(${fd}, ${x})`,
2256
- seek: (x, whence = 0) => sql3`select lo_lseek64(${fd}, ${x}, ${whence})`,
2257
- size: () => sql3`
2252
+ close: () => sql`select lo_close(${fd})`.then(finish),
2253
+ tell: () => sql`select lo_tell64(${fd})`,
2254
+ read: (x) => sql`select loread(${fd}, ${x}) as data`,
2255
+ write: (x) => sql`select lowrite(${fd}, ${x})`,
2256
+ truncate: (x) => sql`select lo_truncate64(${fd}, ${x})`,
2257
+ seek: (x, whence = 0) => sql`select lo_lseek64(${fd}, ${x}, ${whence})`,
2258
+ size: () => sql`
2258
2259
  select
2259
2260
  lo_lseek64(${fd}, location, 0) as position,
2260
2261
  seek.size
@@ -2277,12 +2278,12 @@ function largeObject(sql2, oid, mode = 131072 | 262144) {
2277
2278
  start && await lo.seek(start);
2278
2279
  return new Stream2.Readable({
2279
2280
  highWaterMark,
2280
- async read(size2) {
2281
- const l = size2 > max ? size2 - max : size2;
2282
- max -= size2;
2281
+ async read(size) {
2282
+ const l = size > max ? size - max : size;
2283
+ max -= size;
2283
2284
  const [{ data }] = await lo.read(l);
2284
2285
  this.push(data);
2285
- if (data.length < size2)
2286
+ if (data.length < size)
2286
2287
  this.push(null);
2287
2288
  }
2288
2289
  });
@@ -2323,17 +2324,17 @@ Object.assign(Postgres, {
2323
2324
  }
2324
2325
  });
2325
2326
  var src_default = Postgres;
2326
- function Postgres(a, b2) {
2327
- const options = parseOptions(a, b2), subscribe = options.no_subscribe || Subscribe(Postgres, { ...options });
2327
+ function Postgres(a, b) {
2328
+ const options = parseOptions(a, b), subscribe = options.no_subscribe || Subscribe(Postgres, { ...options });
2328
2329
  let ending = false;
2329
2330
  const queries = queue_default(), connecting = queue_default(), reserved = queue_default(), closed = queue_default(), ended = queue_default(), open = queue_default(), busy = queue_default(), full = queue_default(), queues = { connecting, reserved, closed, ended, open, busy, full };
2330
2331
  const connections = [...Array(options.max)].map(() => connection_default(options, queues, { onopen, onend, onclose }));
2331
- const sql2 = Sql(handler);
2332
- Object.assign(sql2, {
2332
+ const sql = Sql(handler);
2333
+ Object.assign(sql, {
2333
2334
  get parameters() {
2334
2335
  return options.parameters;
2335
2336
  },
2336
- largeObject: largeObject.bind(null, sql2),
2337
+ largeObject: largeObject.bind(null, sql),
2337
2338
  subscribe,
2338
2339
  CLOSE,
2339
2340
  END: CLOSE,
@@ -2345,14 +2346,14 @@ function Postgres(a, b2) {
2345
2346
  close,
2346
2347
  end
2347
2348
  });
2348
- return sql2;
2349
- function Sql(handler2) {
2350
- handler2.debug = options.debug;
2349
+ return sql;
2350
+ function Sql(handler) {
2351
+ handler.debug = options.debug;
2351
2352
  Object.entries(options.types).reduce((acc, [name, type]) => {
2352
2353
  acc[name] = (x) => new Parameter(x, type.to);
2353
2354
  return acc;
2354
2355
  }, typed);
2355
- Object.assign(sql3, {
2356
+ Object.assign(sql, {
2356
2357
  types: typed,
2357
2358
  typed,
2358
2359
  unsafe,
@@ -2361,51 +2362,51 @@ function Postgres(a, b2) {
2361
2362
  json,
2362
2363
  file
2363
2364
  });
2364
- return sql3;
2365
+ return sql;
2365
2366
  function typed(value, type) {
2366
2367
  return new Parameter(value, type);
2367
2368
  }
2368
- function sql3(strings, ...args) {
2369
- const query = strings && Array.isArray(strings.raw) ? new Query(strings, args, handler2, cancel) : typeof strings === "string" && !args.length ? new Identifier(options.transform.column.to ? options.transform.column.to(strings) : strings) : new Builder(strings, args);
2369
+ function sql(strings, ...args) {
2370
+ const query = strings && Array.isArray(strings.raw) ? new Query(strings, args, handler, cancel) : typeof strings === "string" && !args.length ? new Identifier(options.transform.column.to ? options.transform.column.to(strings) : strings) : new Builder(strings, args);
2370
2371
  return query;
2371
2372
  }
2372
- function unsafe(string, args = [], options2 = {}) {
2373
- arguments.length === 2 && !Array.isArray(args) && (options2 = args, args = []);
2374
- const query = new Query([string], args, handler2, cancel, {
2373
+ function unsafe(string, args = [], options = {}) {
2374
+ arguments.length === 2 && !Array.isArray(args) && (options = args, args = []);
2375
+ const query = new Query([string], args, handler, cancel, {
2375
2376
  prepare: false,
2376
- ...options2,
2377
- simple: "simple" in options2 ? options2.simple : args.length === 0
2377
+ ...options,
2378
+ simple: "simple" in options ? options.simple : args.length === 0
2378
2379
  });
2379
2380
  return query;
2380
2381
  }
2381
- function file(path, args = [], options2 = {}) {
2382
- arguments.length === 2 && !Array.isArray(args) && (options2 = args, args = []);
2383
- const query = new Query([], args, (query2) => {
2382
+ function file(path, args = [], options = {}) {
2383
+ arguments.length === 2 && !Array.isArray(args) && (options = args, args = []);
2384
+ const query = new Query([], args, (query) => {
2384
2385
  fs.readFile(path, "utf8", (err, string) => {
2385
2386
  if (err)
2386
- return query2.reject(err);
2387
- query2.strings = [string];
2388
- handler2(query2);
2387
+ return query.reject(err);
2388
+ query.strings = [string];
2389
+ handler(query);
2389
2390
  });
2390
2391
  }, cancel, {
2391
- ...options2,
2392
- simple: "simple" in options2 ? options2.simple : args.length === 0
2392
+ ...options,
2393
+ simple: "simple" in options ? options.simple : args.length === 0
2393
2394
  });
2394
2395
  return query;
2395
2396
  }
2396
2397
  }
2397
2398
  async function listen(name, fn, onlisten) {
2398
2399
  const listener = { fn, onlisten };
2399
- const sql3 = listen.sql || (listen.sql = Postgres({
2400
+ const sql = listen.sql || (listen.sql = Postgres({
2400
2401
  ...options,
2401
2402
  max: 1,
2402
2403
  idle_timeout: null,
2403
2404
  max_lifetime: null,
2404
2405
  fetch_types: false,
2405
2406
  onclose() {
2406
- Object.entries(listen.channels).forEach(([name2, { listeners }]) => {
2407
- delete listen.channels[name2];
2408
- Promise.all(listeners.map((l) => listen(name2, l.fn, l.onlisten).catch(() => {})));
2407
+ Object.entries(listen.channels).forEach(([name, { listeners }]) => {
2408
+ delete listen.channels[name];
2409
+ Promise.all(listeners.map((l) => listen(name, l.fn, l.onlisten).catch(() => {})));
2409
2410
  });
2410
2411
  },
2411
2412
  onnotify(c, x) {
@@ -2415,11 +2416,11 @@ function Postgres(a, b2) {
2415
2416
  const channels = listen.channels || (listen.channels = {}), exists = name in channels;
2416
2417
  if (exists) {
2417
2418
  channels[name].listeners.push(listener);
2418
- const result2 = await channels[name].result;
2419
+ const result = await channels[name].result;
2419
2420
  listener.onlisten && listener.onlisten();
2420
- return { state: result2.state, unlisten };
2421
+ return { state: result.state, unlisten };
2421
2422
  }
2422
- channels[name] = { result: sql3`listen ${sql3.unsafe('"' + name.replace(/"/g, '""') + '"')}`, listeners: [listener] };
2423
+ channels[name] = { result: sql`listen ${sql.unsafe('"' + name.replace(/"/g, '""') + '"')}`, listeners: [listener] };
2423
2424
  const result = await channels[name].result;
2424
2425
  listener.onlisten && listener.onlisten();
2425
2426
  return { state: result.state, unlisten };
@@ -2430,11 +2431,11 @@ function Postgres(a, b2) {
2430
2431
  if (channels[name].listeners.length)
2431
2432
  return;
2432
2433
  delete channels[name];
2433
- return sql3`unlisten ${sql3.unsafe('"' + name.replace(/"/g, '""') + '"')}`;
2434
+ return sql`unlisten ${sql.unsafe('"' + name.replace(/"/g, '""') + '"')}`;
2434
2435
  }
2435
2436
  }
2436
2437
  async function notify(channel, payload) {
2437
- return await sql2`select pg_notify(${channel}, ${"" + payload})`;
2438
+ return await sql`select pg_notify(${channel}, ${"" + payload})`;
2438
2439
  }
2439
2440
  async function reserve() {
2440
2441
  const queue = queue_default();
@@ -2446,65 +2447,65 @@ function Postgres(a, b2) {
2446
2447
  move(c, reserved);
2447
2448
  c.reserved = () => queue.length ? c.execute(queue.shift()) : move(c, reserved);
2448
2449
  c.reserved.release = true;
2449
- const sql3 = Sql(handler2);
2450
- sql3.release = () => {
2450
+ const sql = Sql(handler);
2451
+ sql.release = () => {
2451
2452
  c.reserved = null;
2452
2453
  onopen(c);
2453
2454
  };
2454
- return sql3;
2455
- function handler2(q) {
2455
+ return sql;
2456
+ function handler(q) {
2456
2457
  c.queue === full ? queue.push(q) : c.execute(q) || move(c, full);
2457
2458
  }
2458
2459
  }
2459
- async function begin(options2, fn) {
2460
- !fn && (fn = options2, options2 = "");
2461
- const queries2 = queue_default();
2462
- let savepoints = 0, connection2, prepare = null;
2460
+ async function begin(options, fn) {
2461
+ !fn && (fn = options, options = "");
2462
+ const queries = queue_default();
2463
+ let savepoints = 0, connection, prepare = null;
2463
2464
  try {
2464
- await sql2.unsafe("begin " + options2.replace(/[^a-z ]/ig, ""), [], { onexecute }).execute();
2465
+ await sql.unsafe("begin " + options.replace(/[^a-z ]/ig, ""), [], { onexecute }).execute();
2465
2466
  return await Promise.race([
2466
- scope(connection2, fn),
2467
- new Promise((_, reject) => connection2.onclose = reject)
2467
+ scope(connection, fn),
2468
+ new Promise((_, reject) => connection.onclose = reject)
2468
2469
  ]);
2469
2470
  } catch (error) {
2470
2471
  throw error;
2471
2472
  }
2472
- async function scope(c, fn2, name) {
2473
- const sql3 = Sql(handler2);
2474
- sql3.savepoint = savepoint;
2475
- sql3.prepare = (x) => prepare = x.replace(/[^a-z0-9$-_. ]/gi);
2473
+ async function scope(c, fn, name) {
2474
+ const sql = Sql(handler);
2475
+ sql.savepoint = savepoint;
2476
+ sql.prepare = (x) => prepare = x.replace(/[^a-z0-9$-_. ]/gi);
2476
2477
  let uncaughtError, result;
2477
- name && await sql3`savepoint ${sql3(name)}`;
2478
+ name && await sql`savepoint ${sql(name)}`;
2478
2479
  try {
2479
2480
  result = await new Promise((resolve, reject) => {
2480
- const x = fn2(sql3);
2481
+ const x = fn(sql);
2481
2482
  Promise.resolve(Array.isArray(x) ? Promise.all(x) : x).then(resolve, reject);
2482
2483
  });
2483
2484
  if (uncaughtError)
2484
2485
  throw uncaughtError;
2485
2486
  } catch (e) {
2486
- await (name ? sql3`rollback to ${sql3(name)}` : sql3`rollback`);
2487
+ await (name ? sql`rollback to ${sql(name)}` : sql`rollback`);
2487
2488
  throw e instanceof PostgresError && e.code === "25P02" && uncaughtError || e;
2488
2489
  }
2489
2490
  if (!name) {
2490
- prepare ? await sql3`prepare transaction '${sql3.unsafe(prepare)}'` : await sql3`commit`;
2491
+ prepare ? await sql`prepare transaction '${sql.unsafe(prepare)}'` : await sql`commit`;
2491
2492
  }
2492
2493
  return result;
2493
- function savepoint(name2, fn3) {
2494
- if (name2 && Array.isArray(name2.raw))
2495
- return savepoint((sql4) => sql4.apply(sql4, arguments));
2496
- arguments.length === 1 && (fn3 = name2, name2 = null);
2497
- return scope(c, fn3, "s" + savepoints++ + (name2 ? "_" + name2 : ""));
2494
+ function savepoint(name, fn) {
2495
+ if (name && Array.isArray(name.raw))
2496
+ return savepoint((sql) => sql.apply(sql, arguments));
2497
+ arguments.length === 1 && (fn = name, name = null);
2498
+ return scope(c, fn, "s" + savepoints++ + (name ? "_" + name : ""));
2498
2499
  }
2499
- function handler2(q) {
2500
+ function handler(q) {
2500
2501
  q.catch((e) => uncaughtError || (uncaughtError = e));
2501
- c.queue === full ? queries2.push(q) : c.execute(q) || move(c, full);
2502
+ c.queue === full ? queries.push(q) : c.execute(q) || move(c, full);
2502
2503
  }
2503
2504
  }
2504
2505
  function onexecute(c) {
2505
- connection2 = c;
2506
+ connection = c;
2506
2507
  move(c, reserved);
2507
- c.reserved = () => queries2.length ? c.execute(queries2.shift()) : move(c, reserved);
2508
+ c.reserved = () => queries.length ? c.execute(queries.shift()) : move(c, reserved);
2508
2509
  }
2509
2510
  }
2510
2511
  function move(c, queue) {
@@ -2543,11 +2544,11 @@ function Postgres(a, b2) {
2543
2544
  if (ending)
2544
2545
  return ending;
2545
2546
  await 1;
2546
- let timer2;
2547
+ let timer;
2547
2548
  return ending = Promise.race([
2548
- new Promise((r) => timeout !== null && (timer2 = setTimeout(destroy, timeout * 1000, r))),
2549
+ new Promise((r) => timeout !== null && (timer = setTimeout(destroy, timeout * 1000, r))),
2549
2550
  Promise.all(connections.map((c) => c.end()).concat(listen.sql ? listen.sql.end({ timeout: 0 }) : [], subscribe.sql ? subscribe.sql.end({ timeout: 0 }) : []))
2550
- ]).then(() => clearTimeout(timer2));
2551
+ ]).then(() => clearTimeout(timer));
2551
2552
  }
2552
2553
  async function close() {
2553
2554
  await Promise.all(connections.map((c) => c.end()));
@@ -2586,10 +2587,10 @@ function Postgres(a, b2) {
2586
2587
  queries.length && connect(c, queries.shift());
2587
2588
  }
2588
2589
  }
2589
- function parseOptions(a, b2) {
2590
+ function parseOptions(a, b) {
2590
2591
  if (a && a.shared)
2591
2592
  return a;
2592
- const env = process.env, o = (!a || typeof a === "string" ? b2 : a) || {}, { url, multihost } = parseUrl(a), query = [...url.searchParams].reduce((a2, [b3, c]) => (a2[b3] = c, a2), {}), host = o.hostname || o.host || multihost || url.hostname || env.PGHOST || "localhost", port = o.port || url.port || env.PGPORT || 5432, user = o.user || o.username || url.username || env.PGUSERNAME || env.PGUSER || osUsername();
2593
+ const env = process.env, o = (!a || typeof a === "string" ? b : a) || {}, { url, multihost } = parseUrl(a), query = [...url.searchParams].reduce((a, [b, c]) => (a[b] = c, a), {}), host = o.hostname || o.host || multihost || url.hostname || env.PGHOST || "localhost", port = o.port || url.port || env.PGPORT || 5432, user = o.user || o.username || url.username || env.PGUSERNAME || env.PGUSER || osUsername();
2593
2594
  o.no_prepare && (o.prepare = false);
2594
2595
  query.sslmode && (query.ssl = query.sslmode, delete query.sslmode);
2595
2596
  "timeout" in o && (console.log("The timeout option is deprecated, use idle_timeout instead"), o.idle_timeout = o.timeout);