tanstack_start_ts 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (336) hide show
  1. package/.wrangler/deploy/config.json +1 -0
  2. package/bunfig.toml +6 -0
  3. package/components.json +22 -0
  4. package/config.json +0 -0
  5. package/dist/client/.assetsignore +2 -0
  6. package/dist/client/assets/ProductCard-DbIkJAE-.js +1 -0
  7. package/dist/client/assets/about-AskxOruL.js +1 -0
  8. package/dist/client/assets/admin-BZVcAQM3.js +1 -0
  9. package/dist/client/assets/admin.functions--RdVcuBx.js +1 -0
  10. package/dist/client/assets/admin.login-QgrF_9Fp.js +1 -0
  11. package/dist/client/assets/affiliate-disclosure-BIAsA-HO.js +1 -0
  12. package/dist/client/assets/categories-D0N418mK.js +1 -0
  13. package/dist/client/assets/category._slug-aCaQm14E.js +1 -0
  14. package/dist/client/assets/contact-PhvO-V15.js +1 -0
  15. package/dist/client/assets/faq-BsiHWPM8.js +1 -0
  16. package/dist/client/assets/hero-bg-BP2eVUIX.jpg +0 -0
  17. package/dist/client/assets/index-BU9rnkF3.js +1 -0
  18. package/dist/client/assets/index-BpJWZkva.js +1 -0
  19. package/dist/client/assets/index-vRX-zAyq.js +1 -0
  20. package/dist/client/assets/login-DteE0ZGp.js +1 -0
  21. package/dist/client/assets/logo-pSNfLJQk.png +0 -0
  22. package/dist/client/assets/privacy-B_Pu7040.js +1 -0
  23. package/dist/client/assets/product-links-BkZ41Gv3.js +1 -0
  24. package/dist/client/assets/product._id-BVUysCW-.js +1 -0
  25. package/dist/client/assets/products.functions-cGzRziKO.js +1 -0
  26. package/dist/client/assets/profile-CveRcKq2.js +1 -0
  27. package/dist/client/assets/reset-password-ySEjItX_.js +1 -0
  28. package/dist/client/assets/saved-CHtdQDJF.js +1 -0
  29. package/dist/client/assets/search-CXWfET1y.js +1 -0
  30. package/dist/client/assets/signup-CEx90iuV.js +1 -0
  31. package/dist/client/assets/styles-DrNJG0BO.css +1 -0
  32. package/dist/client/assets/terms-VqJ9kX9b.js +1 -0
  33. package/dist/client/assets/update-password-C-d0ix5e.js +1 -0
  34. package/dist/client/assets/vendor-aria-hidden-DvXkyWUv.js +1 -0
  35. package/dist/client/assets/vendor-class-variance-authority-5VPnzWs2.js +1 -0
  36. package/dist/client/assets/vendor-clsx-B-dksMZM.js +1 -0
  37. package/dist/client/assets/vendor-cookie-es-CS0aJGDi.js +1 -0
  38. package/dist/client/assets/vendor-detect-node-es-l0sNRNKZ.js +1 -0
  39. package/dist/client/assets/vendor-floating-ui-core-BlUy28sp.js +1 -0
  40. package/dist/client/assets/vendor-floating-ui-dom-BxK0hn2R.js +1 -0
  41. package/dist/client/assets/vendor-floating-ui-react-dom-Bas3975S.js +1 -0
  42. package/dist/client/assets/vendor-floating-ui-utils-BfYUAVcw.js +1 -0
  43. package/dist/client/assets/vendor-framer-motion-BMdL-cuX.js +9 -0
  44. package/dist/client/assets/vendor-get-nonce-C-Z93AgS.js +1 -0
  45. package/dist/client/assets/vendor-iceberg-js-tWD4K6Lg.js +1 -0
  46. package/dist/client/assets/vendor-lovable.dev-cloud-auth-js-VuzqtJVg.js +1 -0
  47. package/dist/client/assets/vendor-lucide-react-b5K2fehp.js +1 -0
  48. package/dist/client/assets/vendor-motion-dom-BETJamZt.js +1 -0
  49. package/dist/client/assets/vendor-motion-utils-BuWewJbj.js +1 -0
  50. package/dist/client/assets/vendor-radix-ui-primitive-Dc_FVRD7.js +1 -0
  51. package/dist/client/assets/vendor-radix-ui-react-accordion-C22Rgxe9.js +1 -0
  52. package/dist/client/assets/vendor-radix-ui-react-arrow-DMHj2mKI.js +1 -0
  53. package/dist/client/assets/vendor-radix-ui-react-avatar-CVPBkFXg.js +1 -0
  54. package/dist/client/assets/vendor-radix-ui-react-collapsible-BvM-4sKX.js +1 -0
  55. package/dist/client/assets/vendor-radix-ui-react-collection-D9KtqmHm.js +1 -0
  56. package/dist/client/assets/vendor-radix-ui-react-compose-refs-Cvq0AS8Z.js +1 -0
  57. package/dist/client/assets/vendor-radix-ui-react-context-CAqqn5Nx.js +1 -0
  58. package/dist/client/assets/vendor-radix-ui-react-dialog-DZ01vOLq.js +5 -0
  59. package/dist/client/assets/vendor-radix-ui-react-direction-DxZwNuei.js +1 -0
  60. package/dist/client/assets/vendor-radix-ui-react-dismissable-layer-Dqgrs55Y.js +1 -0
  61. package/dist/client/assets/vendor-radix-ui-react-dropdown-menu-0uzvrqkn.js +1 -0
  62. package/dist/client/assets/vendor-radix-ui-react-focus-guards-DgWoZ-fP.js +1 -0
  63. package/dist/client/assets/vendor-radix-ui-react-focus-scope-BLIu5QaL.js +1 -0
  64. package/dist/client/assets/vendor-radix-ui-react-id-bpga_rLa.js +1 -0
  65. package/dist/client/assets/vendor-radix-ui-react-menu-D0qf2r6_.js +1 -0
  66. package/dist/client/assets/vendor-radix-ui-react-popper-BafIylxU.js +1 -0
  67. package/dist/client/assets/vendor-radix-ui-react-portal-BnAsfNCS.js +1 -0
  68. package/dist/client/assets/vendor-radix-ui-react-presence-C-f3UKQ2.js +1 -0
  69. package/dist/client/assets/vendor-radix-ui-react-primitive-zTHwXNoz.js +1 -0
  70. package/dist/client/assets/vendor-radix-ui-react-roving-focus-jyJB8K2E.js +1 -0
  71. package/dist/client/assets/vendor-radix-ui-react-slot-6LXHJrHl.js +1 -0
  72. package/dist/client/assets/vendor-radix-ui-react-use-callback-ref-E91aPc6s.js +1 -0
  73. package/dist/client/assets/vendor-radix-ui-react-use-controllable-state-Ca3eMtxa.js +1 -0
  74. package/dist/client/assets/vendor-radix-ui-react-use-effect-event-CPeX4A3c.js +1 -0
  75. package/dist/client/assets/vendor-radix-ui-react-use-escape-keydown-7n3YsXFo.js +1 -0
  76. package/dist/client/assets/vendor-radix-ui-react-use-is-hydrated-C1PY1qNv.js +1 -0
  77. package/dist/client/assets/vendor-radix-ui-react-use-layout-effect-B3AcGWPy.js +1 -0
  78. package/dist/client/assets/vendor-radix-ui-react-use-size-CXS04sct.js +1 -0
  79. package/dist/client/assets/vendor-react-dom-BnNs-kzm.js +9 -0
  80. package/dist/client/assets/vendor-react-gJPiVnX5.js +1 -0
  81. package/dist/client/assets/vendor-react-remove-scroll-DHKl-IMP.js +4 -0
  82. package/dist/client/assets/vendor-react-remove-scroll-bar-CSjdInc2.js +38 -0
  83. package/dist/client/assets/vendor-react-style-singleton-BqHpkgXn.js +1 -0
  84. package/dist/client/assets/vendor-scheduler-7OC5HNn7.js +1 -0
  85. package/dist/client/assets/vendor-seroval-B_Fur-nl.js +3 -0
  86. package/dist/client/assets/vendor-seroval-plugins-CBHnPkZJ.js +1 -0
  87. package/dist/client/assets/vendor-sonner-71-LdGG1.js +1 -0
  88. package/dist/client/assets/vendor-supabase-auth-js-DWrN-bIx.js +18 -0
  89. package/dist/client/assets/vendor-supabase-functions-js-uY_V-TxC.js +1 -0
  90. package/dist/client/assets/vendor-supabase-phoenix-BzEf37Ve.js +2 -0
  91. package/dist/client/assets/vendor-supabase-postgrest-js-C4rBWbCx.js +4 -0
  92. package/dist/client/assets/vendor-supabase-realtime-js-D6BlOYKE.js +23 -0
  93. package/dist/client/assets/vendor-supabase-storage-js-BG98L3Zz.js +1 -0
  94. package/dist/client/assets/vendor-supabase-supabase-js-DCCzdwBJ.js +1 -0
  95. package/dist/client/assets/vendor-tailwind-merge-Ct12j0u0.js +1 -0
  96. package/dist/client/assets/vendor-tanstack-history-C617CaxG.js +1 -0
  97. package/dist/client/assets/vendor-tanstack-query-core-7wuJJ5ZL.js +1 -0
  98. package/dist/client/assets/vendor-tanstack-react-query-HImzo8sX.js +1 -0
  99. package/dist/client/assets/vendor-tanstack-react-router-sIZLK-LU.js +1 -0
  100. package/dist/client/assets/vendor-tanstack-react-start-client-GiYCfWmf.js +1 -0
  101. package/dist/client/assets/vendor-tanstack-react-store-EvTi3ahh.js +1 -0
  102. package/dist/client/assets/vendor-tanstack-router-core-Cr7bYUZv.js +1 -0
  103. package/dist/client/assets/vendor-tanstack-start-client-core-C-00BBOu.js +2 -0
  104. package/dist/client/assets/vendor-tanstack-start-fn-stubs-l0sNRNKZ.js +1 -0
  105. package/dist/client/assets/vendor-tanstack-store-BC7mA7pq.js +1 -0
  106. package/dist/client/assets/vendor-tslib-Du-meQkk.js +1 -0
  107. package/dist/client/assets/vendor-use-callback-ref-C_fIAtot.js +1 -0
  108. package/dist/client/assets/vendor-use-sidecar-Bh0DDN6h.js +1 -0
  109. package/dist/client/assets/vendor-use-sync-external-store-ZvKHXaIn.js +1 -0
  110. package/dist/client/assets/vendor-vercel-analytics-DwPM5BWs.js +1 -0
  111. package/dist/client/assets/vendor-zod-By9teAtI.js +1 -0
  112. package/dist/client/robots.txt +2 -0
  113. package/dist/server/.dev.vars +5 -0
  114. package/dist/server/.vite/manifest.json +2528 -0
  115. package/dist/server/assets/ProductCard-CUPXy5Eo.js +149 -0
  116. package/dist/server/assets/_tanstack-start-manifest_v-do7vTWFD.js +4 -0
  117. package/dist/server/assets/about-TfKQw0Ga.js +28 -0
  118. package/dist/server/assets/admin-DspfJOJk.js +578 -0
  119. package/dist/server/assets/admin.functions-B78ppWLR.js +645 -0
  120. package/dist/server/assets/admin.functions-BWlKBoTL.js +93 -0
  121. package/dist/server/assets/admin.login-CV7QfeA6.js +139 -0
  122. package/dist/server/assets/affiliate-disclosure-B1wI1cDb.js +86 -0
  123. package/dist/server/assets/auth-middleware-Cn49MidW.js +62 -0
  124. package/dist/server/assets/categories-Z7jnAYZP.js +108 -0
  125. package/dist/server/assets/category._slug-D0XY3FGK.js +112 -0
  126. package/dist/server/assets/contact-IzyONsXs.js +104 -0
  127. package/dist/server/assets/faq-aRhB_CR3.js +133 -0
  128. package/dist/server/assets/hero-bg-BP2eVUIX.jpg +0 -0
  129. package/dist/server/assets/index-BTPHbXw9.js +221 -0
  130. package/dist/server/assets/index-ByJkHkrU.js +30 -0
  131. package/dist/server/assets/login-Dvy5Dm0f.js +175 -0
  132. package/dist/server/assets/logo-pSNfLJQk.png +0 -0
  133. package/dist/server/assets/privacy-B6Wiez1P.js +93 -0
  134. package/dist/server/assets/product-links-CGYEPP56.js +16 -0
  135. package/dist/server/assets/product._id-BpRa-1z0.js +231 -0
  136. package/dist/server/assets/products.functions-DSlmibYN.js +209 -0
  137. package/dist/server/assets/products.functions-DlHkRiqi.js +24 -0
  138. package/dist/server/assets/profile-B0NWzVAZ.js +314 -0
  139. package/dist/server/assets/reset-password-CY-rmqMr.js +115 -0
  140. package/dist/server/assets/saved-7FA6Dbom.js +126 -0
  141. package/dist/server/assets/search-Yw5c_fZa.js +329 -0
  142. package/dist/server/assets/signup-UPzgZo4i.js +143 -0
  143. package/dist/server/assets/styles-DrNJG0BO.css +1 -0
  144. package/dist/server/assets/terms-CMnX95bP.js +89 -0
  145. package/dist/server/assets/update-password-Cr94ea8n.js +131 -0
  146. package/dist/server/assets/vendor-aria-hidden-DPa16MWu.js +122 -0
  147. package/dist/server/assets/vendor-class-variance-authority-0YxJPB9Y.js +44 -0
  148. package/dist/server/assets/vendor-cloudflare-unenv-preset-ya0VEFBz.js +250 -0
  149. package/dist/server/assets/vendor-clsx-DgYk2OaC.js +16 -0
  150. package/dist/server/assets/vendor-cookie-es-DAoofYiI.js +44 -0
  151. package/dist/server/assets/vendor-detect-node-es-l0sNRNKZ.js +1 -0
  152. package/dist/server/assets/vendor-floating-ui-core-3tkK0THV.js +726 -0
  153. package/dist/server/assets/vendor-floating-ui-dom-C-cPtgJv.js +626 -0
  154. package/dist/server/assets/vendor-floating-ui-react-dom-CRG6gBpH.js +319 -0
  155. package/dist/server/assets/vendor-floating-ui-utils-DmXANH-E.js +320 -0
  156. package/dist/server/assets/vendor-framer-motion-X4zAkX3J.js +1979 -0
  157. package/dist/server/assets/vendor-get-nonce-DiSj3EHl.js +9 -0
  158. package/dist/server/assets/vendor-h3-v2-CCobnLY5.js +287 -0
  159. package/dist/server/assets/vendor-iceberg-js-bHCkXyJn.js +534 -0
  160. package/dist/server/assets/vendor-isbot-CZ7WjwVs.js +21 -0
  161. package/dist/server/assets/vendor-lovable.dev-cloud-auth-js-BE03njZw.js +180 -0
  162. package/dist/server/assets/vendor-lucide-react-Ddew6HYb.js +458 -0
  163. package/dist/server/assets/vendor-motion-dom-D2MTwGIG.js +5983 -0
  164. package/dist/server/assets/vendor-motion-utils-LJlIFN6m.js +161 -0
  165. package/dist/server/assets/vendor-radix-ui-primitive-B-mNdDrH.js +11 -0
  166. package/dist/server/assets/vendor-radix-ui-react-accordion-1Izf6x00.js +308 -0
  167. package/dist/server/assets/vendor-radix-ui-react-arrow-B882lnFK.js +23 -0
  168. package/dist/server/assets/vendor-radix-ui-react-avatar-BVgZt2Ab.js +209 -0
  169. package/dist/server/assets/vendor-radix-ui-react-collapsible-DCBbMZiS.js +147 -0
  170. package/dist/server/assets/vendor-radix-ui-react-collection-BZ2srfgU.js +150 -0
  171. package/dist/server/assets/vendor-radix-ui-react-compose-refs-D3qsKVk1.js +39 -0
  172. package/dist/server/assets/vendor-radix-ui-react-context-BVoNDLue.js +78 -0
  173. package/dist/server/assets/vendor-radix-ui-react-dialog-DlxMaNYK.js +406 -0
  174. package/dist/server/assets/vendor-radix-ui-react-direction-Dt_WDL1t.js +9 -0
  175. package/dist/server/assets/vendor-radix-ui-react-dismissable-layer-CjsuPohV.js +210 -0
  176. package/dist/server/assets/vendor-radix-ui-react-dropdown-menu-DVxKumY8.js +263 -0
  177. package/dist/server/assets/vendor-radix-ui-react-focus-guards-D_6NoePE.js +29 -0
  178. package/dist/server/assets/vendor-radix-ui-react-focus-scope-DEIhTJJH.js +206 -0
  179. package/dist/server/assets/vendor-radix-ui-react-id-DFFpgh6m.js +14 -0
  180. package/dist/server/assets/vendor-radix-ui-react-menu-CiTMLwjT.js +893 -0
  181. package/dist/server/assets/vendor-radix-ui-react-popper-23Ye2Vyc.js +286 -0
  182. package/dist/server/assets/vendor-radix-ui-react-portal-CZCH5uPk.js +16 -0
  183. package/dist/server/assets/vendor-radix-ui-react-presence-CaAULlDU.js +128 -0
  184. package/dist/server/assets/vendor-radix-ui-react-primitive-BeOk3UYa.js +124 -0
  185. package/dist/server/assets/vendor-radix-ui-react-roving-focus-DES9GR8l.js +224 -0
  186. package/dist/server/assets/vendor-radix-ui-react-slot-DUhZbzoH.js +103 -0
  187. package/dist/server/assets/vendor-radix-ui-react-use-callback-ref-BynBgohw.js +11 -0
  188. package/dist/server/assets/vendor-radix-ui-react-use-controllable-state-C9KpT6DG.js +69 -0
  189. package/dist/server/assets/vendor-radix-ui-react-use-effect-event-gpNY2xjS.js +1 -0
  190. package/dist/server/assets/vendor-radix-ui-react-use-escape-keydown-CcYRQ2pp.js +17 -0
  191. package/dist/server/assets/vendor-radix-ui-react-use-is-hydrated-D_LcBPXY.js +15 -0
  192. package/dist/server/assets/vendor-radix-ui-react-use-layout-effect-1LNLXAjr.js +6 -0
  193. package/dist/server/assets/vendor-radix-ui-react-use-size-D6fiKJQo.js +39 -0
  194. package/dist/server/assets/vendor-react-DvBrY0qp.js +511 -0
  195. package/dist/server/assets/vendor-react-dom-yvMLPM0j.js +10484 -0
  196. package/dist/server/assets/vendor-react-remove-scroll-BNtiEvVN.js +328 -0
  197. package/dist/server/assets/vendor-react-remove-scroll-bar-hLqRASRk.js +82 -0
  198. package/dist/server/assets/vendor-react-style-singleton-BXjcXskB.js +69 -0
  199. package/dist/server/assets/vendor-rou3-3NaGPdI8.js +8 -0
  200. package/dist/server/assets/vendor-seroval-dJyC-Zhz.js +1775 -0
  201. package/dist/server/assets/vendor-seroval-plugins-Pq_U2meB.js +58 -0
  202. package/dist/server/assets/vendor-sonner-CqbjhsRh.js +1086 -0
  203. package/dist/server/assets/vendor-srvx-BA-baEX9.js +6 -0
  204. package/dist/server/assets/vendor-supabase-auth-js-D4xjVprw.js +7602 -0
  205. package/dist/server/assets/vendor-supabase-functions-js-sWy4UYn1.js +322 -0
  206. package/dist/server/assets/vendor-supabase-phoenix-Bw3Uh2Nn.js +1777 -0
  207. package/dist/server/assets/vendor-supabase-postgrest-js-AO-BXa7I.js +4938 -0
  208. package/dist/server/assets/vendor-supabase-realtime-js-BtdNgJbm.js +2111 -0
  209. package/dist/server/assets/vendor-supabase-storage-js-Dk_MrPYO.js +2679 -0
  210. package/dist/server/assets/vendor-supabase-supabase-js-D1EEtG3j.js +697 -0
  211. package/dist/server/assets/vendor-tailwind-merge-BHb_obmC.js +3255 -0
  212. package/dist/server/assets/vendor-tanstack-history-C4pKJmkt.js +204 -0
  213. package/dist/server/assets/vendor-tanstack-query-core-PwwTR5ld.js +2552 -0
  214. package/dist/server/assets/vendor-tanstack-react-query-hhHzXAK1.js +190 -0
  215. package/dist/server/assets/vendor-tanstack-react-router-XzqpA65A.js +1120 -0
  216. package/dist/server/assets/vendor-tanstack-react-start-RvWUpvat.js +37 -0
  217. package/dist/server/assets/vendor-tanstack-react-start-client-gpNY2xjS.js +1 -0
  218. package/dist/server/assets/vendor-tanstack-react-start-server-uj_Y9pEN.js +15 -0
  219. package/dist/server/assets/vendor-tanstack-react-store-gpNY2xjS.js +1 -0
  220. package/dist/server/assets/vendor-tanstack-router-core-6wywV3KN.js +4252 -0
  221. package/dist/server/assets/vendor-tanstack-start-client-core-DoOKV2pA.js +1741 -0
  222. package/dist/server/assets/vendor-tanstack-start-fn-stubs-l0sNRNKZ.js +1 -0
  223. package/dist/server/assets/vendor-tanstack-start-server-core-CsAstXv7.js +1421 -0
  224. package/dist/server/assets/vendor-tanstack-start-storage-context-DgH9hIJT.js +17 -0
  225. package/dist/server/assets/vendor-tanstack-store-l0sNRNKZ.js +1 -0
  226. package/dist/server/assets/vendor-tslib-_8ICaZ64.js +67 -0
  227. package/dist/server/assets/vendor-unenv-DUvF4YIF.js +544 -0
  228. package/dist/server/assets/vendor-use-callback-ref-DMFDRvmi.js +66 -0
  229. package/dist/server/assets/vendor-use-sidecar-DG1tHua4.js +106 -0
  230. package/dist/server/assets/vendor-use-sync-external-store-rZ8vi0It.js +64 -0
  231. package/dist/server/assets/vendor-vercel-analytics-oP8BDp0L.js +168 -0
  232. package/dist/server/assets/vendor-zod-BRyQdbC-.js +3580 -0
  233. package/dist/server/index.js +158 -0
  234. package/dist/server/wrangler.json +1 -0
  235. package/enable-powershell.ps1 +7 -0
  236. package/eslint.config.js +41 -0
  237. package/lint.bat +4 -0
  238. package/package.json +95 -0
  239. package/public/robots.txt +2 -0
  240. package/run-npm-build.cjs +20 -0
  241. package/run-npm-build.js +20 -0
  242. package/src/assets/hero-bg.jpg +0 -0
  243. package/src/assets/logo.png +0 -0
  244. package/src/components/scrollsy/Footer.tsx +68 -0
  245. package/src/components/scrollsy/LiveTicker.tsx +31 -0
  246. package/src/components/scrollsy/Logo.tsx +28 -0
  247. package/src/components/scrollsy/Nav.tsx +255 -0
  248. package/src/components/scrollsy/ProductCard.tsx +190 -0
  249. package/src/components/scrollsy/ProductFilters.tsx +226 -0
  250. package/src/components/scrollsy/SupportWidget.tsx +197 -0
  251. package/src/components/ui/accordion.tsx +51 -0
  252. package/src/components/ui/alert-dialog.tsx +115 -0
  253. package/src/components/ui/alert.tsx +49 -0
  254. package/src/components/ui/aspect-ratio.tsx +5 -0
  255. package/src/components/ui/avatar.tsx +47 -0
  256. package/src/components/ui/badge.tsx +32 -0
  257. package/src/components/ui/breadcrumb.tsx +101 -0
  258. package/src/components/ui/button.tsx +49 -0
  259. package/src/components/ui/calendar.tsx +177 -0
  260. package/src/components/ui/card.tsx +55 -0
  261. package/src/components/ui/carousel.tsx +240 -0
  262. package/src/components/ui/chart.tsx +331 -0
  263. package/src/components/ui/checkbox.tsx +26 -0
  264. package/src/components/ui/collapsible.tsx +11 -0
  265. package/src/components/ui/command.tsx +143 -0
  266. package/src/components/ui/context-menu.tsx +187 -0
  267. package/src/components/ui/dialog.tsx +104 -0
  268. package/src/components/ui/drawer.tsx +98 -0
  269. package/src/components/ui/dropdown-menu.tsx +188 -0
  270. package/src/components/ui/form.tsx +171 -0
  271. package/src/components/ui/hover-card.tsx +27 -0
  272. package/src/components/ui/input-otp.tsx +69 -0
  273. package/src/components/ui/input.tsx +22 -0
  274. package/src/components/ui/label.tsx +21 -0
  275. package/src/components/ui/menubar.tsx +229 -0
  276. package/src/components/ui/navigation-menu.tsx +120 -0
  277. package/src/components/ui/pagination.tsx +98 -0
  278. package/src/components/ui/popover.tsx +31 -0
  279. package/src/components/ui/progress.tsx +25 -0
  280. package/src/components/ui/radio-group.tsx +36 -0
  281. package/src/components/ui/resizable.tsx +37 -0
  282. package/src/components/ui/scroll-area.tsx +44 -0
  283. package/src/components/ui/select.tsx +152 -0
  284. package/src/components/ui/separator.tsx +24 -0
  285. package/src/components/ui/sheet.tsx +122 -0
  286. package/src/components/ui/sidebar.tsx +744 -0
  287. package/src/components/ui/skeleton.tsx +7 -0
  288. package/src/components/ui/slider.tsx +23 -0
  289. package/src/components/ui/sonner.tsx +23 -0
  290. package/src/components/ui/switch.tsx +27 -0
  291. package/src/components/ui/table.tsx +94 -0
  292. package/src/components/ui/tabs.tsx +53 -0
  293. package/src/components/ui/textarea.tsx +21 -0
  294. package/src/components/ui/toggle-group.tsx +57 -0
  295. package/src/components/ui/toggle.tsx +42 -0
  296. package/src/components/ui/tooltip.tsx +32 -0
  297. package/src/hooks/use-auth.ts +26 -0
  298. package/src/hooks/use-mobile.tsx +19 -0
  299. package/src/integrations/lovable/index.ts +41 -0
  300. package/src/lib/admin.functions.ts +564 -0
  301. package/src/lib/error-capture.ts +27 -0
  302. package/src/lib/error-page.ts +30 -0
  303. package/src/lib/product-links.ts +39 -0
  304. package/src/lib/products.functions.ts +101 -0
  305. package/src/lib/utils.ts +6 -0
  306. package/src/routeTree.gen.ts +480 -0
  307. package/src/router.tsx +16 -0
  308. package/src/routes/__root.tsx +177 -0
  309. package/src/routes/about.tsx +66 -0
  310. package/src/routes/admin.login.tsx +95 -0
  311. package/src/routes/admin.tsx +811 -0
  312. package/src/routes/affiliate-disclosure.tsx +35 -0
  313. package/src/routes/categories.tsx +57 -0
  314. package/src/routes/category.$slug.tsx +51 -0
  315. package/src/routes/contact.tsx +69 -0
  316. package/src/routes/faq.tsx +63 -0
  317. package/src/routes/index.tsx +269 -0
  318. package/src/routes/login.tsx +160 -0
  319. package/src/routes/privacy.tsx +39 -0
  320. package/src/routes/product.$id.tsx +212 -0
  321. package/src/routes/profile.tsx +393 -0
  322. package/src/routes/reset-password.tsx +71 -0
  323. package/src/routes/saved.tsx +83 -0
  324. package/src/routes/search.tsx +136 -0
  325. package/src/routes/signup.tsx +108 -0
  326. package/src/routes/sitemap[.]xml.ts +34 -0
  327. package/src/routes/terms.tsx +40 -0
  328. package/src/routes/update-password.tsx +91 -0
  329. package/src/server.ts +80 -0
  330. package/src/start.ts +24 -0
  331. package/src/styles.css +333 -0
  332. package/terminal-test-output.txt +1 -0
  333. package/tsconfig.json +27 -0
  334. package/vercel.json +26 -0
  335. package/vite.config.ts +38 -0
  336. package/wrangler.jsonc +7 -0
@@ -0,0 +1,2679 @@
1
+ import { I as IcebergRestCatalog } from "./vendor-iceberg-js-bHCkXyJn.js";
2
+ function _typeof(o) {
3
+ "@babel/helpers - typeof";
4
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
5
+ return typeof o$1;
6
+ } : function(o$1) {
7
+ return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
8
+ }, _typeof(o);
9
+ }
10
+ function toPrimitive(t, r) {
11
+ if ("object" != _typeof(t) || !t) return t;
12
+ var e = t[Symbol.toPrimitive];
13
+ if (void 0 !== e) {
14
+ var i = e.call(t, r);
15
+ if ("object" != _typeof(i)) return i;
16
+ throw new TypeError("@@toPrimitive must return a primitive value.");
17
+ }
18
+ return ("string" === r ? String : Number)(t);
19
+ }
20
+ function toPropertyKey(t) {
21
+ var i = toPrimitive(t, "string");
22
+ return "symbol" == _typeof(i) ? i : i + "";
23
+ }
24
+ function _defineProperty(e, r, t) {
25
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
26
+ value: t,
27
+ enumerable: true,
28
+ configurable: true,
29
+ writable: true
30
+ }) : e[r] = t, e;
31
+ }
32
+ function ownKeys(e, r) {
33
+ var t = Object.keys(e);
34
+ if (Object.getOwnPropertySymbols) {
35
+ var o = Object.getOwnPropertySymbols(e);
36
+ r && (o = o.filter(function(r$1) {
37
+ return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
38
+ })), t.push.apply(t, o);
39
+ }
40
+ return t;
41
+ }
42
+ function _objectSpread2(e) {
43
+ for (var r = 1; r < arguments.length; r++) {
44
+ var t = null != arguments[r] ? arguments[r] : {};
45
+ r % 2 ? ownKeys(Object(t), true).forEach(function(r$1) {
46
+ _defineProperty(e, r$1, t[r$1]);
47
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) {
48
+ Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
49
+ });
50
+ }
51
+ return e;
52
+ }
53
+ var StorageError = class extends Error {
54
+ constructor(message, namespace = "storage", status, statusCode) {
55
+ super(message);
56
+ this.__isStorageError = true;
57
+ this.namespace = namespace;
58
+ this.name = namespace === "vectors" ? "StorageVectorsError" : "StorageError";
59
+ this.status = status;
60
+ this.statusCode = statusCode;
61
+ }
62
+ toJSON() {
63
+ return {
64
+ name: this.name,
65
+ message: this.message,
66
+ status: this.status,
67
+ statusCode: this.statusCode
68
+ };
69
+ }
70
+ };
71
+ function isStorageError(error) {
72
+ return typeof error === "object" && error !== null && "__isStorageError" in error;
73
+ }
74
+ var StorageApiError = class extends StorageError {
75
+ constructor(message, status, statusCode, namespace = "storage") {
76
+ super(message, namespace, status, statusCode);
77
+ this.name = namespace === "vectors" ? "StorageVectorsApiError" : "StorageApiError";
78
+ this.status = status;
79
+ this.statusCode = statusCode;
80
+ }
81
+ toJSON() {
82
+ return _objectSpread2({}, super.toJSON());
83
+ }
84
+ };
85
+ var StorageUnknownError = class extends StorageError {
86
+ constructor(message, originalError, namespace = "storage") {
87
+ super(message, namespace);
88
+ this.name = namespace === "vectors" ? "StorageVectorsUnknownError" : "StorageUnknownError";
89
+ this.originalError = originalError;
90
+ }
91
+ };
92
+ function setHeader(headers, name, value) {
93
+ const result = _objectSpread2({}, headers);
94
+ const nameLower = name.toLowerCase();
95
+ for (const key of Object.keys(result)) if (key.toLowerCase() === nameLower) delete result[key];
96
+ result[nameLower] = value;
97
+ return result;
98
+ }
99
+ function normalizeHeaders(headers) {
100
+ const result = {};
101
+ for (const [key, value] of Object.entries(headers)) result[key.toLowerCase()] = value;
102
+ return result;
103
+ }
104
+ const resolveFetch = (customFetch) => {
105
+ if (customFetch) return (...args) => customFetch(...args);
106
+ return (...args) => fetch(...args);
107
+ };
108
+ const isPlainObject = (value) => {
109
+ if (typeof value !== "object" || value === null) return false;
110
+ const prototype = Object.getPrototypeOf(value);
111
+ return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
112
+ };
113
+ const recursiveToCamel = (item) => {
114
+ if (Array.isArray(item)) return item.map((el) => recursiveToCamel(el));
115
+ else if (typeof item === "function" || item !== Object(item)) return item;
116
+ const result = {};
117
+ Object.entries(item).forEach(([key, value]) => {
118
+ const newKey = key.replace(/([-_][a-z])/gi, (c) => c.toUpperCase().replace(/[-_]/g, ""));
119
+ result[newKey] = recursiveToCamel(value);
120
+ });
121
+ return result;
122
+ };
123
+ const isValidBucketName = (bucketName) => {
124
+ if (!bucketName || typeof bucketName !== "string") return false;
125
+ if (bucketName.length === 0 || bucketName.length > 100) return false;
126
+ if (bucketName.trim() !== bucketName) return false;
127
+ if (bucketName.includes("/") || bucketName.includes("\\")) return false;
128
+ return /^[\w!.\*'() &$@=;:+,?-]+$/.test(bucketName);
129
+ };
130
+ const _getErrorMessage = (err) => {
131
+ if (typeof err === "object" && err !== null) {
132
+ const e = err;
133
+ if (typeof e.msg === "string") return e.msg;
134
+ if (typeof e.message === "string") return e.message;
135
+ if (typeof e.error_description === "string") return e.error_description;
136
+ if (typeof e.error === "string") return e.error;
137
+ if (typeof e.error === "object" && e.error !== null) {
138
+ const nested = e.error;
139
+ if (typeof nested.message === "string") return nested.message;
140
+ }
141
+ }
142
+ return JSON.stringify(err);
143
+ };
144
+ const handleError = async (error, reject, options, namespace) => {
145
+ if (error !== null && typeof error === "object" && "json" in error && typeof error.json === "function") {
146
+ const responseError = error;
147
+ let status = parseInt(String(responseError.status), 10);
148
+ if (!Number.isFinite(status)) status = 500;
149
+ responseError.json().then((err) => {
150
+ const statusCode = (err === null || err === void 0 ? void 0 : err.statusCode) || (err === null || err === void 0 ? void 0 : err.code) || status + "";
151
+ reject(new StorageApiError(_getErrorMessage(err), status, statusCode, namespace));
152
+ }).catch(() => {
153
+ const statusCode = status + "";
154
+ reject(new StorageApiError(responseError.statusText || `HTTP ${status} error`, status, statusCode, namespace));
155
+ });
156
+ } else reject(new StorageUnknownError(_getErrorMessage(error), error, namespace));
157
+ };
158
+ const _getRequestParams = (method, options, parameters, body) => {
159
+ const params = {
160
+ method,
161
+ headers: (options === null || options === void 0 ? void 0 : options.headers) || {}
162
+ };
163
+ if (method === "GET" || method === "HEAD" || !body) return _objectSpread2(_objectSpread2({}, params), parameters);
164
+ if (isPlainObject(body)) {
165
+ var _contentType;
166
+ const headers = (options === null || options === void 0 ? void 0 : options.headers) || {};
167
+ let contentType;
168
+ for (const [key, value] of Object.entries(headers)) if (key.toLowerCase() === "content-type") contentType = value;
169
+ params.headers = setHeader(headers, "Content-Type", (_contentType = contentType) !== null && _contentType !== void 0 ? _contentType : "application/json");
170
+ params.body = JSON.stringify(body);
171
+ } else params.body = body;
172
+ if (options === null || options === void 0 ? void 0 : options.duplex) params.duplex = options.duplex;
173
+ return _objectSpread2(_objectSpread2({}, params), parameters);
174
+ };
175
+ async function _handleRequest(fetcher, method, url, options, parameters, body, namespace) {
176
+ return new Promise((resolve, reject) => {
177
+ fetcher(url, _getRequestParams(method, options, parameters, body)).then((result) => {
178
+ if (!result.ok) throw result;
179
+ if (options === null || options === void 0 ? void 0 : options.noResolveJson) return result;
180
+ if (namespace === "vectors") {
181
+ const contentType = result.headers.get("content-type");
182
+ if (result.headers.get("content-length") === "0" || result.status === 204) return {};
183
+ if (!contentType || !contentType.includes("application/json")) return {};
184
+ }
185
+ return result.json();
186
+ }).then((data) => resolve(data)).catch((error) => handleError(error, reject, options, namespace));
187
+ });
188
+ }
189
+ function createFetchApi(namespace = "storage") {
190
+ return {
191
+ get: async (fetcher, url, options, parameters) => {
192
+ return _handleRequest(fetcher, "GET", url, options, parameters, void 0, namespace);
193
+ },
194
+ post: async (fetcher, url, body, options, parameters) => {
195
+ return _handleRequest(fetcher, "POST", url, options, parameters, body, namespace);
196
+ },
197
+ put: async (fetcher, url, body, options, parameters) => {
198
+ return _handleRequest(fetcher, "PUT", url, options, parameters, body, namespace);
199
+ },
200
+ head: async (fetcher, url, options, parameters) => {
201
+ return _handleRequest(fetcher, "HEAD", url, _objectSpread2(_objectSpread2({}, options), {}, { noResolveJson: true }), parameters, void 0, namespace);
202
+ },
203
+ remove: async (fetcher, url, body, options, parameters) => {
204
+ return _handleRequest(fetcher, "DELETE", url, options, parameters, body, namespace);
205
+ }
206
+ };
207
+ }
208
+ const defaultApi = createFetchApi("storage");
209
+ const { get, post, put, head, remove } = defaultApi;
210
+ const vectorsApi = createFetchApi("vectors");
211
+ var BaseApiClient = class {
212
+ /**
213
+ * Creates a new BaseApiClient instance
214
+ * @param url - Base URL for API requests
215
+ * @param headers - Default headers for API requests
216
+ * @param fetch - Optional custom fetch implementation
217
+ * @param namespace - Error namespace ('storage' or 'vectors')
218
+ */
219
+ constructor(url, headers = {}, fetch$1, namespace = "storage") {
220
+ this.shouldThrowOnError = false;
221
+ this.url = url;
222
+ this.headers = normalizeHeaders(headers);
223
+ this.fetch = resolveFetch(fetch$1);
224
+ this.namespace = namespace;
225
+ }
226
+ /**
227
+ * Enable throwing errors instead of returning them.
228
+ * When enabled, errors are thrown instead of returned in { data, error } format.
229
+ *
230
+ * @returns this - For method chaining
231
+ */
232
+ throwOnError() {
233
+ this.shouldThrowOnError = true;
234
+ return this;
235
+ }
236
+ /**
237
+ * Set an HTTP header for the request.
238
+ * Creates a shallow copy of headers to avoid mutating shared state.
239
+ *
240
+ * @param name - Header name
241
+ * @param value - Header value
242
+ * @returns this - For method chaining
243
+ */
244
+ setHeader(name, value) {
245
+ this.headers = setHeader(this.headers, name, value);
246
+ return this;
247
+ }
248
+ /**
249
+ * Handles API operation with standardized error handling
250
+ * Eliminates repetitive try-catch blocks across all API methods
251
+ *
252
+ * This wrapper:
253
+ * 1. Executes the operation
254
+ * 2. Returns { data, error: null } on success
255
+ * 3. Returns { data: null, error } on failure (if shouldThrowOnError is false)
256
+ * 4. Throws error on failure (if shouldThrowOnError is true)
257
+ *
258
+ * @typeParam T - The expected data type from the operation
259
+ * @param operation - Async function that performs the API call
260
+ * @returns Promise with { data, error } tuple
261
+ *
262
+ * @example Handling an operation
263
+ * ```typescript
264
+ * async listBuckets() {
265
+ * return this.handleOperation(async () => {
266
+ * return await get(this.fetch, `${this.url}/bucket`, {
267
+ * headers: this.headers,
268
+ * })
269
+ * })
270
+ * }
271
+ * ```
272
+ */
273
+ async handleOperation(operation) {
274
+ var _this = this;
275
+ try {
276
+ return {
277
+ data: await operation(),
278
+ error: null
279
+ };
280
+ } catch (error) {
281
+ if (_this.shouldThrowOnError) throw error;
282
+ if (isStorageError(error)) return {
283
+ data: null,
284
+ error
285
+ };
286
+ throw error;
287
+ }
288
+ }
289
+ };
290
+ let _Symbol$toStringTag$1;
291
+ _Symbol$toStringTag$1 = Symbol.toStringTag;
292
+ var StreamDownloadBuilder = class {
293
+ constructor(downloadFn, shouldThrowOnError) {
294
+ this.downloadFn = downloadFn;
295
+ this.shouldThrowOnError = shouldThrowOnError;
296
+ this[_Symbol$toStringTag$1] = "StreamDownloadBuilder";
297
+ this.promise = null;
298
+ }
299
+ then(onfulfilled, onrejected) {
300
+ return this.getPromise().then(onfulfilled, onrejected);
301
+ }
302
+ catch(onrejected) {
303
+ return this.getPromise().catch(onrejected);
304
+ }
305
+ finally(onfinally) {
306
+ return this.getPromise().finally(onfinally);
307
+ }
308
+ getPromise() {
309
+ if (!this.promise) this.promise = this.execute();
310
+ return this.promise;
311
+ }
312
+ async execute() {
313
+ var _this = this;
314
+ try {
315
+ return {
316
+ data: (await _this.downloadFn()).body,
317
+ error: null
318
+ };
319
+ } catch (error) {
320
+ if (_this.shouldThrowOnError) throw error;
321
+ if (isStorageError(error)) return {
322
+ data: null,
323
+ error
324
+ };
325
+ throw error;
326
+ }
327
+ }
328
+ };
329
+ let _Symbol$toStringTag;
330
+ _Symbol$toStringTag = Symbol.toStringTag;
331
+ var BlobDownloadBuilder = class {
332
+ constructor(downloadFn, shouldThrowOnError) {
333
+ this.downloadFn = downloadFn;
334
+ this.shouldThrowOnError = shouldThrowOnError;
335
+ this[_Symbol$toStringTag] = "BlobDownloadBuilder";
336
+ this.promise = null;
337
+ }
338
+ asStream() {
339
+ return new StreamDownloadBuilder(this.downloadFn, this.shouldThrowOnError);
340
+ }
341
+ then(onfulfilled, onrejected) {
342
+ return this.getPromise().then(onfulfilled, onrejected);
343
+ }
344
+ catch(onrejected) {
345
+ return this.getPromise().catch(onrejected);
346
+ }
347
+ finally(onfinally) {
348
+ return this.getPromise().finally(onfinally);
349
+ }
350
+ getPromise() {
351
+ if (!this.promise) this.promise = this.execute();
352
+ return this.promise;
353
+ }
354
+ async execute() {
355
+ var _this = this;
356
+ try {
357
+ return {
358
+ data: await (await _this.downloadFn()).blob(),
359
+ error: null
360
+ };
361
+ } catch (error) {
362
+ if (_this.shouldThrowOnError) throw error;
363
+ if (isStorageError(error)) return {
364
+ data: null,
365
+ error
366
+ };
367
+ throw error;
368
+ }
369
+ }
370
+ };
371
+ const DEFAULT_SEARCH_OPTIONS = {
372
+ limit: 100,
373
+ offset: 0,
374
+ sortBy: {
375
+ column: "name",
376
+ order: "asc"
377
+ }
378
+ };
379
+ const DEFAULT_FILE_OPTIONS = {
380
+ cacheControl: "3600",
381
+ contentType: "text/plain;charset=UTF-8",
382
+ upsert: false
383
+ };
384
+ var StorageFileApi = class extends BaseApiClient {
385
+ constructor(url, headers = {}, bucketId, fetch$1) {
386
+ super(url, headers, fetch$1, "storage");
387
+ this.bucketId = bucketId;
388
+ }
389
+ /**
390
+ * Uploads a file to an existing bucket or replaces an existing file at the specified path with a new one.
391
+ *
392
+ * @param method HTTP method.
393
+ * @param path The relative file path. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to upload.
394
+ * @param fileBody The body of the file to be stored in the bucket.
395
+ */
396
+ async uploadOrUpdate(method, path, fileBody, fileOptions) {
397
+ var _this = this;
398
+ return _this.handleOperation(async () => {
399
+ let body;
400
+ const options = _objectSpread2(_objectSpread2({}, DEFAULT_FILE_OPTIONS), fileOptions);
401
+ let headers = _objectSpread2(_objectSpread2({}, _this.headers), method === "POST" && { "x-upsert": String(options.upsert) });
402
+ const metadata = options.metadata;
403
+ if (typeof Blob !== "undefined" && fileBody instanceof Blob) {
404
+ body = new FormData();
405
+ body.append("cacheControl", options.cacheControl);
406
+ if (metadata) body.append("metadata", _this.encodeMetadata(metadata));
407
+ body.append("", fileBody);
408
+ } else if (typeof FormData !== "undefined" && fileBody instanceof FormData) {
409
+ body = fileBody;
410
+ if (!body.has("cacheControl")) body.append("cacheControl", options.cacheControl);
411
+ if (metadata && !body.has("metadata")) body.append("metadata", _this.encodeMetadata(metadata));
412
+ } else {
413
+ body = fileBody;
414
+ headers["cache-control"] = `max-age=${options.cacheControl}`;
415
+ headers["content-type"] = options.contentType;
416
+ if (metadata) headers["x-metadata"] = _this.toBase64(_this.encodeMetadata(metadata));
417
+ if ((typeof ReadableStream !== "undefined" && body instanceof ReadableStream || body && typeof body === "object" && "pipe" in body && typeof body.pipe === "function") && !options.duplex) options.duplex = "half";
418
+ }
419
+ if (fileOptions === null || fileOptions === void 0 ? void 0 : fileOptions.headers) for (const [key, value] of Object.entries(fileOptions.headers)) headers = setHeader(headers, key, value);
420
+ const cleanPath = _this._removeEmptyFolders(path);
421
+ const _path = _this._getFinalPath(cleanPath);
422
+ const data = await (method == "PUT" ? put : post)(_this.fetch, `${_this.url}/object/${_path}`, body, _objectSpread2({ headers }, (options === null || options === void 0 ? void 0 : options.duplex) ? { duplex: options.duplex } : {}));
423
+ return {
424
+ path: cleanPath,
425
+ id: data.Id,
426
+ fullPath: data.Key
427
+ };
428
+ });
429
+ }
430
+ /**
431
+ * Uploads a file to an existing bucket.
432
+ *
433
+ * @category Storage
434
+ * @subcategory File Buckets
435
+ * @param path The file path, including the file name. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to upload.
436
+ * @param fileBody The body of the file to be stored in the bucket.
437
+ * @param fileOptions Optional file upload options including cacheControl, contentType, upsert, and metadata.
438
+ * @returns Promise with response containing file path, id, and fullPath or error
439
+ *
440
+ * @example Upload file
441
+ * ```js
442
+ * const avatarFile = event.target.files[0]
443
+ * const { data, error } = await supabase
444
+ * .storage
445
+ * .from('avatars')
446
+ * .upload('public/avatar1.png', avatarFile, {
447
+ * cacheControl: '3600',
448
+ * upsert: false
449
+ * })
450
+ * ```
451
+ *
452
+ * Response:
453
+ * ```json
454
+ * {
455
+ * "data": {
456
+ * "path": "public/avatar1.png",
457
+ * "fullPath": "avatars/public/avatar1.png"
458
+ * },
459
+ * "error": null
460
+ * }
461
+ * ```
462
+ *
463
+ * @example Upload file using `ArrayBuffer` from base64 file data
464
+ * ```js
465
+ * import { decode } from 'base64-arraybuffer'
466
+ *
467
+ * const { data, error } = await supabase
468
+ * .storage
469
+ * .from('avatars')
470
+ * .upload('public/avatar1.png', decode('base64FileData'), {
471
+ * contentType: 'image/png'
472
+ * })
473
+ * ```
474
+ *
475
+ * @remarks
476
+ * - RLS policy permissions required:
477
+ * - `buckets` table permissions: none
478
+ * - `objects` table permissions: only `insert` when you are uploading new files and `select`, `insert` and `update` when you are upserting files
479
+ * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
480
+ * - For React Native, using either `Blob`, `File` or `FormData` does not work as intended. Upload file using `ArrayBuffer` from base64 file data instead, see example below.
481
+ */
482
+ async upload(path, fileBody, fileOptions) {
483
+ return this.uploadOrUpdate("POST", path, fileBody, fileOptions);
484
+ }
485
+ /**
486
+ * Upload a file with a token generated from `createSignedUploadUrl`.
487
+ *
488
+ * @category Storage
489
+ * @subcategory File Buckets
490
+ * @param path The file path, including the file name. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to upload.
491
+ * @param token The token generated from `createSignedUploadUrl`
492
+ * @param fileBody The body of the file to be stored in the bucket.
493
+ * @param fileOptions HTTP headers (cacheControl, contentType, etc.).
494
+ * **Note:** The `upsert` option has no effect here. To enable upsert behavior,
495
+ * pass `{ upsert: true }` when calling `createSignedUploadUrl()` instead.
496
+ * @returns Promise with response containing file path and fullPath or error
497
+ *
498
+ * @example Upload to a signed URL
499
+ * ```js
500
+ * const { data, error } = await supabase
501
+ * .storage
502
+ * .from('avatars')
503
+ * .uploadToSignedUrl('folder/cat.jpg', 'token-from-createSignedUploadUrl', file)
504
+ * ```
505
+ *
506
+ * Response:
507
+ * ```json
508
+ * {
509
+ * "data": {
510
+ * "path": "folder/cat.jpg",
511
+ * "fullPath": "avatars/folder/cat.jpg"
512
+ * },
513
+ * "error": null
514
+ * }
515
+ * ```
516
+ *
517
+ * @remarks
518
+ * - RLS policy permissions required:
519
+ * - `buckets` table permissions: none
520
+ * - `objects` table permissions: none
521
+ * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
522
+ */
523
+ async uploadToSignedUrl(path, token, fileBody, fileOptions) {
524
+ var _this3 = this;
525
+ const cleanPath = _this3._removeEmptyFolders(path);
526
+ const _path = _this3._getFinalPath(cleanPath);
527
+ const url = new URL(_this3.url + `/object/upload/sign/${_path}`);
528
+ url.searchParams.set("token", token);
529
+ return _this3.handleOperation(async () => {
530
+ let body;
531
+ const options = _objectSpread2(_objectSpread2({}, DEFAULT_FILE_OPTIONS), fileOptions);
532
+ let headers = _objectSpread2(_objectSpread2({}, _this3.headers), { "x-upsert": String(options.upsert) });
533
+ const metadata = options.metadata;
534
+ if (typeof Blob !== "undefined" && fileBody instanceof Blob) {
535
+ body = new FormData();
536
+ body.append("cacheControl", options.cacheControl);
537
+ if (metadata) body.append("metadata", _this3.encodeMetadata(metadata));
538
+ body.append("", fileBody);
539
+ } else if (typeof FormData !== "undefined" && fileBody instanceof FormData) {
540
+ body = fileBody;
541
+ if (!body.has("cacheControl")) body.append("cacheControl", options.cacheControl);
542
+ if (metadata && !body.has("metadata")) body.append("metadata", _this3.encodeMetadata(metadata));
543
+ } else {
544
+ body = fileBody;
545
+ headers["cache-control"] = `max-age=${options.cacheControl}`;
546
+ headers["content-type"] = options.contentType;
547
+ if (metadata) headers["x-metadata"] = _this3.toBase64(_this3.encodeMetadata(metadata));
548
+ if ((typeof ReadableStream !== "undefined" && body instanceof ReadableStream || body && typeof body === "object" && "pipe" in body && typeof body.pipe === "function") && !options.duplex) options.duplex = "half";
549
+ }
550
+ if (fileOptions === null || fileOptions === void 0 ? void 0 : fileOptions.headers) for (const [key, value] of Object.entries(fileOptions.headers)) headers = setHeader(headers, key, value);
551
+ return {
552
+ path: cleanPath,
553
+ fullPath: (await put(_this3.fetch, url.toString(), body, _objectSpread2({ headers }, (options === null || options === void 0 ? void 0 : options.duplex) ? { duplex: options.duplex } : {}))).Key
554
+ };
555
+ });
556
+ }
557
+ /**
558
+ * Creates a signed upload URL.
559
+ * Signed upload URLs can be used to upload files to the bucket without further authentication.
560
+ * They are valid for 2 hours.
561
+ *
562
+ * @category Storage
563
+ * @subcategory File Buckets
564
+ * @param path The file path, including the current file name. For example `folder/image.png`.
565
+ * @param options.upsert If set to true, allows the file to be overwritten if it already exists.
566
+ * @returns Promise with response containing signed upload URL, token, and path or error
567
+ *
568
+ * @example Create Signed Upload URL
569
+ * ```js
570
+ * const { data, error } = await supabase
571
+ * .storage
572
+ * .from('avatars')
573
+ * .createSignedUploadUrl('folder/cat.jpg')
574
+ * ```
575
+ *
576
+ * Response:
577
+ * ```json
578
+ * {
579
+ * "data": {
580
+ * "signedUrl": "https://example.supabase.co/storage/v1/object/upload/sign/avatars/folder/cat.jpg?token=<TOKEN>",
581
+ * "path": "folder/cat.jpg",
582
+ * "token": "<TOKEN>"
583
+ * },
584
+ * "error": null
585
+ * }
586
+ * ```
587
+ *
588
+ * @remarks
589
+ * - RLS policy permissions required:
590
+ * - `buckets` table permissions: none
591
+ * - `objects` table permissions: `insert`
592
+ * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
593
+ */
594
+ async createSignedUploadUrl(path, options) {
595
+ var _this4 = this;
596
+ return _this4.handleOperation(async () => {
597
+ let _path = _this4._getFinalPath(path);
598
+ const headers = _objectSpread2({}, _this4.headers);
599
+ if (options === null || options === void 0 ? void 0 : options.upsert) headers["x-upsert"] = "true";
600
+ const data = await post(_this4.fetch, `${_this4.url}/object/upload/sign/${_path}`, {}, { headers });
601
+ const url = new URL(_this4.url + data.url);
602
+ const token = url.searchParams.get("token");
603
+ if (!token) throw new StorageError("No token returned by API");
604
+ return {
605
+ signedUrl: url.toString(),
606
+ path,
607
+ token
608
+ };
609
+ });
610
+ }
611
+ /**
612
+ * Replaces an existing file at the specified path with a new one.
613
+ *
614
+ * @category Storage
615
+ * @subcategory File Buckets
616
+ * @param path The relative file path. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to update.
617
+ * @param fileBody The body of the file to be stored in the bucket.
618
+ * @param fileOptions Optional file upload options including cacheControl, contentType, and metadata.
619
+ * **Note:** The `upsert` option has no effect here. `update()` always replaces the
620
+ * file at the given path, so the `x-upsert` header is not sent. To control upsert
621
+ * behavior, use `upload()` instead.
622
+ * @returns Promise with response containing file path, id, and fullPath or error
623
+ *
624
+ * @example Update file
625
+ * ```js
626
+ * const avatarFile = event.target.files[0]
627
+ * const { data, error } = await supabase
628
+ * .storage
629
+ * .from('avatars')
630
+ * .update('public/avatar1.png', avatarFile, {
631
+ * cacheControl: '3600'
632
+ * })
633
+ * ```
634
+ *
635
+ * Response:
636
+ * ```json
637
+ * {
638
+ * "data": {
639
+ * "path": "public/avatar1.png",
640
+ * "fullPath": "avatars/public/avatar1.png"
641
+ * },
642
+ * "error": null
643
+ * }
644
+ * ```
645
+ *
646
+ * @example Update file using `ArrayBuffer` from base64 file data
647
+ * ```js
648
+ * import {decode} from 'base64-arraybuffer'
649
+ *
650
+ * const { data, error } = await supabase
651
+ * .storage
652
+ * .from('avatars')
653
+ * .update('public/avatar1.png', decode('base64FileData'), {
654
+ * contentType: 'image/png'
655
+ * })
656
+ * ```
657
+ *
658
+ * @remarks
659
+ * - RLS policy permissions required:
660
+ * - `buckets` table permissions: none
661
+ * - `objects` table permissions: `update` and `select`
662
+ * - `update()` always replaces the file at the given path regardless of the `upsert` option.
663
+ * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
664
+ * - For React Native, using either `Blob`, `File` or `FormData` does not work as intended. Update file using `ArrayBuffer` from base64 file data instead, see example below.
665
+ */
666
+ async update(path, fileBody, fileOptions) {
667
+ return this.uploadOrUpdate("PUT", path, fileBody, fileOptions);
668
+ }
669
+ /**
670
+ * Moves an existing file to a new path in the same bucket.
671
+ *
672
+ * @category Storage
673
+ * @subcategory File Buckets
674
+ * @param fromPath The original file path, including the current file name. For example `folder/image.png`.
675
+ * @param toPath The new file path, including the new file name. For example `folder/image-new.png`.
676
+ * @param options The destination options.
677
+ * @returns Promise with response containing success message or error
678
+ *
679
+ * @example Move file
680
+ * ```js
681
+ * const { data, error } = await supabase
682
+ * .storage
683
+ * .from('avatars')
684
+ * .move('public/avatar1.png', 'private/avatar2.png')
685
+ * ```
686
+ *
687
+ * Response:
688
+ * ```json
689
+ * {
690
+ * "data": {
691
+ * "message": "Successfully moved"
692
+ * },
693
+ * "error": null
694
+ * }
695
+ * ```
696
+ *
697
+ * @remarks
698
+ * - RLS policy permissions required:
699
+ * - `buckets` table permissions: none
700
+ * - `objects` table permissions: `update` and `select`
701
+ * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
702
+ */
703
+ async move(fromPath, toPath, options) {
704
+ var _this6 = this;
705
+ return _this6.handleOperation(async () => {
706
+ return await post(_this6.fetch, `${_this6.url}/object/move`, {
707
+ bucketId: _this6.bucketId,
708
+ sourceKey: fromPath,
709
+ destinationKey: toPath,
710
+ destinationBucket: options === null || options === void 0 ? void 0 : options.destinationBucket
711
+ }, { headers: _this6.headers });
712
+ });
713
+ }
714
+ /**
715
+ * Copies an existing file to a new path in the same bucket.
716
+ *
717
+ * @category Storage
718
+ * @subcategory File Buckets
719
+ * @param fromPath The original file path, including the current file name. For example `folder/image.png`.
720
+ * @param toPath The new file path, including the new file name. For example `folder/image-copy.png`.
721
+ * @param options The destination options.
722
+ * @returns Promise with response containing copied file path or error
723
+ *
724
+ * @example Copy file
725
+ * ```js
726
+ * const { data, error } = await supabase
727
+ * .storage
728
+ * .from('avatars')
729
+ * .copy('public/avatar1.png', 'private/avatar2.png')
730
+ * ```
731
+ *
732
+ * Response:
733
+ * ```json
734
+ * {
735
+ * "data": {
736
+ * "path": "avatars/private/avatar2.png"
737
+ * },
738
+ * "error": null
739
+ * }
740
+ * ```
741
+ *
742
+ * @remarks
743
+ * - RLS policy permissions required:
744
+ * - `buckets` table permissions: none
745
+ * - `objects` table permissions: `insert` and `select`
746
+ * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
747
+ */
748
+ async copy(fromPath, toPath, options) {
749
+ var _this7 = this;
750
+ return _this7.handleOperation(async () => {
751
+ return { path: (await post(_this7.fetch, `${_this7.url}/object/copy`, {
752
+ bucketId: _this7.bucketId,
753
+ sourceKey: fromPath,
754
+ destinationKey: toPath,
755
+ destinationBucket: options === null || options === void 0 ? void 0 : options.destinationBucket
756
+ }, { headers: _this7.headers })).Key };
757
+ });
758
+ }
759
+ /**
760
+ * Creates a signed URL. Use a signed URL to share a file for a fixed amount of time.
761
+ *
762
+ * @category Storage
763
+ * @subcategory File Buckets
764
+ * @param path The file path, including the current file name. For example `folder/image.png`.
765
+ * @param expiresIn The number of seconds until the signed URL expires. For example, `60` for a URL which is valid for one minute.
766
+ * @param options.download triggers the file as a download if set to true. Set this parameter as the name of the file if you want to trigger the download with a different filename.
767
+ * @param options.transform Transform the asset before serving it to the client.
768
+ * @param options.cacheNonce Append a cache nonce parameter to the URL to invalidate the cache.
769
+ * @returns Promise with response containing signed URL or error
770
+ *
771
+ * @example Create Signed URL
772
+ * ```js
773
+ * const { data, error } = await supabase
774
+ * .storage
775
+ * .from('avatars')
776
+ * .createSignedUrl('folder/avatar1.png', 60)
777
+ * ```
778
+ *
779
+ * Response:
780
+ * ```json
781
+ * {
782
+ * "data": {
783
+ * "signedUrl": "https://example.supabase.co/storage/v1/object/sign/avatars/folder/avatar1.png?token=<TOKEN>"
784
+ * },
785
+ * "error": null
786
+ * }
787
+ * ```
788
+ *
789
+ * @example Create a signed URL for an asset with transformations
790
+ * ```js
791
+ * const { data } = await supabase
792
+ * .storage
793
+ * .from('avatars')
794
+ * .createSignedUrl('folder/avatar1.png', 60, {
795
+ * transform: {
796
+ * width: 100,
797
+ * height: 100,
798
+ * }
799
+ * })
800
+ * ```
801
+ *
802
+ * @example Create a signed URL which triggers the download of the asset
803
+ * ```js
804
+ * const { data } = await supabase
805
+ * .storage
806
+ * .from('avatars')
807
+ * .createSignedUrl('folder/avatar1.png', 60, {
808
+ * download: true,
809
+ * })
810
+ * ```
811
+ *
812
+ * @remarks
813
+ * - RLS policy permissions required:
814
+ * - `buckets` table permissions: none
815
+ * - `objects` table permissions: `select`
816
+ * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
817
+ */
818
+ async createSignedUrl(path, expiresIn, options) {
819
+ var _this8 = this;
820
+ return _this8.handleOperation(async () => {
821
+ let _path = _this8._getFinalPath(path);
822
+ const hasTransform = typeof (options === null || options === void 0 ? void 0 : options.transform) === "object" && options.transform !== null && Object.keys(options.transform).length > 0;
823
+ let data = await post(_this8.fetch, `${_this8.url}/object/sign/${_path}`, _objectSpread2({ expiresIn }, hasTransform ? { transform: options.transform } : {}), { headers: _this8.headers });
824
+ const query = new URLSearchParams();
825
+ if (options === null || options === void 0 ? void 0 : options.download) query.set("download", options.download === true ? "" : options.download);
826
+ if ((options === null || options === void 0 ? void 0 : options.cacheNonce) != null) query.set("cacheNonce", String(options.cacheNonce));
827
+ const queryString = query.toString();
828
+ return { signedUrl: encodeURI(`${_this8.url}${data.signedURL}${queryString ? `&${queryString}` : ""}`) };
829
+ });
830
+ }
831
+ /**
832
+ * Creates multiple signed URLs. Use a signed URL to share a file for a fixed amount of time.
833
+ *
834
+ * @category Storage
835
+ * @subcategory File Buckets
836
+ * @param paths The file paths to be downloaded, including the current file names. For example `['folder/image.png', 'folder2/image2.png']`.
837
+ * @param expiresIn The number of seconds until the signed URLs expire. For example, `60` for URLs which are valid for one minute.
838
+ * @param options.download triggers the file as a download if set to true. Set this parameter as the name of the file if you want to trigger the download with a different filename.
839
+ * @param options.cacheNonce Append a cache nonce parameter to the URL to invalidate the cache.
840
+ * @returns Promise with response containing array of objects with signedUrl, path, and error or error
841
+ *
842
+ * @example Create Signed URLs
843
+ * ```js
844
+ * const { data, error } = await supabase
845
+ * .storage
846
+ * .from('avatars')
847
+ * .createSignedUrls(['folder/avatar1.png', 'folder/avatar2.png'], 60)
848
+ * ```
849
+ *
850
+ * Response:
851
+ * ```json
852
+ * {
853
+ * "data": [
854
+ * {
855
+ * "error": null,
856
+ * "path": "folder/avatar1.png",
857
+ * "signedURL": "/object/sign/avatars/folder/avatar1.png?token=<TOKEN>",
858
+ * "signedUrl": "https://example.supabase.co/storage/v1/object/sign/avatars/folder/avatar1.png?token=<TOKEN>"
859
+ * },
860
+ * {
861
+ * "error": null,
862
+ * "path": "folder/avatar2.png",
863
+ * "signedURL": "/object/sign/avatars/folder/avatar2.png?token=<TOKEN>",
864
+ * "signedUrl": "https://example.supabase.co/storage/v1/object/sign/avatars/folder/avatar2.png?token=<TOKEN>"
865
+ * }
866
+ * ],
867
+ * "error": null
868
+ * }
869
+ * ```
870
+ *
871
+ * @remarks
872
+ * - RLS policy permissions required:
873
+ * - `buckets` table permissions: none
874
+ * - `objects` table permissions: `select`
875
+ * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
876
+ */
877
+ async createSignedUrls(paths, expiresIn, options) {
878
+ var _this9 = this;
879
+ return _this9.handleOperation(async () => {
880
+ const data = await post(_this9.fetch, `${_this9.url}/object/sign/${_this9.bucketId}`, {
881
+ expiresIn,
882
+ paths
883
+ }, { headers: _this9.headers });
884
+ const query = new URLSearchParams();
885
+ if (options === null || options === void 0 ? void 0 : options.download) query.set("download", options.download === true ? "" : options.download);
886
+ if ((options === null || options === void 0 ? void 0 : options.cacheNonce) != null) query.set("cacheNonce", String(options.cacheNonce));
887
+ const queryString = query.toString();
888
+ return data.map((datum) => _objectSpread2(_objectSpread2({}, datum), {}, { signedUrl: datum.signedURL ? encodeURI(`${_this9.url}${datum.signedURL}${queryString ? `&${queryString}` : ""}`) : null }));
889
+ });
890
+ }
891
+ /**
892
+ * Downloads a file from a private bucket. For public buckets, make a request to the URL returned from `getPublicUrl` instead.
893
+ *
894
+ * @category Storage
895
+ * @subcategory File Buckets
896
+ * @param path The full path and file name of the file to be downloaded. For example `folder/image.png`.
897
+ * @param options.transform Transform the asset before serving it to the client.
898
+ * @param options.cacheNonce Append a cache nonce parameter to the URL to invalidate the cache.
899
+ * @param parameters Additional fetch parameters like signal for cancellation. Supports standard fetch options including cache control.
900
+ * @returns BlobDownloadBuilder instance for downloading the file
901
+ *
902
+ * @example Download file
903
+ * ```js
904
+ * const { data, error } = await supabase
905
+ * .storage
906
+ * .from('avatars')
907
+ * .download('folder/avatar1.png')
908
+ * ```
909
+ *
910
+ * Response:
911
+ * ```json
912
+ * {
913
+ * "data": <BLOB>,
914
+ * "error": null
915
+ * }
916
+ * ```
917
+ *
918
+ * @example Download file with transformations
919
+ * ```js
920
+ * const { data, error } = await supabase
921
+ * .storage
922
+ * .from('avatars')
923
+ * .download('folder/avatar1.png', {
924
+ * transform: {
925
+ * width: 100,
926
+ * height: 100,
927
+ * quality: 80
928
+ * }
929
+ * })
930
+ * ```
931
+ *
932
+ * @example Download with cache control (useful in Edge Functions)
933
+ * ```js
934
+ * const { data, error } = await supabase
935
+ * .storage
936
+ * .from('avatars')
937
+ * .download('folder/avatar1.png', {}, { cache: 'no-store' })
938
+ * ```
939
+ *
940
+ * @example Download with abort signal
941
+ * ```js
942
+ * const controller = new AbortController()
943
+ * setTimeout(() => controller.abort(), 5000)
944
+ *
945
+ * const { data, error } = await supabase
946
+ * .storage
947
+ * .from('avatars')
948
+ * .download('folder/avatar1.png', {}, { signal: controller.signal })
949
+ * ```
950
+ *
951
+ * @remarks
952
+ * - RLS policy permissions required:
953
+ * - `buckets` table permissions: none
954
+ * - `objects` table permissions: `select`
955
+ * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
956
+ */
957
+ download(path, options, parameters) {
958
+ const renderPath = typeof (options === null || options === void 0 ? void 0 : options.transform) === "object" && options.transform !== null && Object.keys(options.transform).length > 0 ? "render/image/authenticated" : "object";
959
+ const query = new URLSearchParams();
960
+ if (options === null || options === void 0 ? void 0 : options.transform) this.applyTransformOptsToQuery(query, options.transform);
961
+ if ((options === null || options === void 0 ? void 0 : options.cacheNonce) != null) query.set("cacheNonce", String(options.cacheNonce));
962
+ const queryString = query.toString();
963
+ const _path = this._getFinalPath(path);
964
+ const downloadFn = () => get(this.fetch, `${this.url}/${renderPath}/${_path}${queryString ? `?${queryString}` : ""}`, {
965
+ headers: this.headers,
966
+ noResolveJson: true
967
+ }, parameters);
968
+ return new BlobDownloadBuilder(downloadFn, this.shouldThrowOnError);
969
+ }
970
+ /**
971
+ * Retrieves the details of an existing file.
972
+ *
973
+ * Returns detailed file metadata including size, content type, and timestamps.
974
+ * Note: The API returns `last_modified` field, not `updated_at`.
975
+ *
976
+ * @category Storage
977
+ * @subcategory File Buckets
978
+ * @param path The file path, including the file name. For example `folder/image.png`.
979
+ * @returns Promise with response containing file metadata or error
980
+ *
981
+ * @example Get file info
982
+ * ```js
983
+ * const { data, error } = await supabase
984
+ * .storage
985
+ * .from('avatars')
986
+ * .info('folder/avatar1.png')
987
+ *
988
+ * if (data) {
989
+ * console.log('Last modified:', data.lastModified)
990
+ * console.log('Size:', data.size)
991
+ * }
992
+ * ```
993
+ */
994
+ async info(path) {
995
+ var _this10 = this;
996
+ const _path = _this10._getFinalPath(path);
997
+ return _this10.handleOperation(async () => {
998
+ return recursiveToCamel(await get(_this10.fetch, `${_this10.url}/object/info/${_path}`, { headers: _this10.headers }));
999
+ });
1000
+ }
1001
+ /**
1002
+ * Checks the existence of a file.
1003
+ *
1004
+ * @category Storage
1005
+ * @subcategory File Buckets
1006
+ * @param path The file path, including the file name. For example `folder/image.png`.
1007
+ * @returns Promise with response containing boolean indicating file existence or error
1008
+ *
1009
+ * @example Check file existence
1010
+ * ```js
1011
+ * const { data, error } = await supabase
1012
+ * .storage
1013
+ * .from('avatars')
1014
+ * .exists('folder/avatar1.png')
1015
+ * ```
1016
+ */
1017
+ async exists(path) {
1018
+ var _this11 = this;
1019
+ const _path = _this11._getFinalPath(path);
1020
+ try {
1021
+ await head(_this11.fetch, `${_this11.url}/object/${_path}`, { headers: _this11.headers });
1022
+ return {
1023
+ data: true,
1024
+ error: null
1025
+ };
1026
+ } catch (error) {
1027
+ if (_this11.shouldThrowOnError) throw error;
1028
+ if (isStorageError(error)) {
1029
+ var _error$originalError;
1030
+ const status = error instanceof StorageApiError ? error.status : error instanceof StorageUnknownError ? (_error$originalError = error.originalError) === null || _error$originalError === void 0 ? void 0 : _error$originalError.status : void 0;
1031
+ if (status !== void 0 && [400, 404].includes(status)) return {
1032
+ data: false,
1033
+ error
1034
+ };
1035
+ }
1036
+ throw error;
1037
+ }
1038
+ }
1039
+ /**
1040
+ * A simple convenience function to get the URL for an asset in a public bucket. If you do not want to use this function, you can construct the public URL by concatenating the bucket URL with the path to the asset.
1041
+ * This function does not verify if the bucket is public. If a public URL is created for a bucket which is not public, you will not be able to download the asset.
1042
+ *
1043
+ * @category Storage
1044
+ * @subcategory File Buckets
1045
+ * @param path The path and name of the file to generate the public URL for. For example `folder/image.png`.
1046
+ * @param options.download Triggers the file as a download if set to true. Set this parameter as the name of the file if you want to trigger the download with a different filename.
1047
+ * @param options.transform Transform the asset before serving it to the client.
1048
+ * @param options.cacheNonce Append a cache nonce parameter to the URL to invalidate the cache.
1049
+ * @returns Object with public URL
1050
+ *
1051
+ * @example Returns the URL for an asset in a public bucket
1052
+ * ```js
1053
+ * const { data } = supabase
1054
+ * .storage
1055
+ * .from('public-bucket')
1056
+ * .getPublicUrl('folder/avatar1.png')
1057
+ * ```
1058
+ *
1059
+ * Response:
1060
+ * ```json
1061
+ * {
1062
+ * "data": {
1063
+ * "publicUrl": "https://example.supabase.co/storage/v1/object/public/public-bucket/folder/avatar1.png"
1064
+ * }
1065
+ * }
1066
+ * ```
1067
+ *
1068
+ * @example Returns the URL for an asset in a public bucket with transformations
1069
+ * ```js
1070
+ * const { data } = supabase
1071
+ * .storage
1072
+ * .from('public-bucket')
1073
+ * .getPublicUrl('folder/avatar1.png', {
1074
+ * transform: {
1075
+ * width: 100,
1076
+ * height: 100,
1077
+ * }
1078
+ * })
1079
+ * ```
1080
+ *
1081
+ * @example Returns the URL which triggers the download of an asset in a public bucket
1082
+ * ```js
1083
+ * const { data } = supabase
1084
+ * .storage
1085
+ * .from('public-bucket')
1086
+ * .getPublicUrl('folder/avatar1.png', {
1087
+ * download: true,
1088
+ * })
1089
+ * ```
1090
+ *
1091
+ * @remarks
1092
+ * - The bucket needs to be set to public, either via [updateBucket()](/docs/reference/javascript/storage-updatebucket) or by going to Storage on [supabase.com/dashboard](https://supabase.com/dashboard), clicking the overflow menu on a bucket and choosing "Make public"
1093
+ * - RLS policy permissions required:
1094
+ * - `buckets` table permissions: none
1095
+ * - `objects` table permissions: none
1096
+ * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
1097
+ */
1098
+ getPublicUrl(path, options) {
1099
+ const _path = this._getFinalPath(path);
1100
+ const query = new URLSearchParams();
1101
+ if (options === null || options === void 0 ? void 0 : options.download) query.set("download", options.download === true ? "" : options.download);
1102
+ if (options === null || options === void 0 ? void 0 : options.transform) this.applyTransformOptsToQuery(query, options.transform);
1103
+ if ((options === null || options === void 0 ? void 0 : options.cacheNonce) != null) query.set("cacheNonce", String(options.cacheNonce));
1104
+ const queryString = query.toString();
1105
+ const renderPath = typeof (options === null || options === void 0 ? void 0 : options.transform) === "object" && options.transform !== null && Object.keys(options.transform).length > 0 ? "render/image" : "object";
1106
+ return { data: { publicUrl: encodeURI(`${this.url}/${renderPath}/public/${_path}`) + (queryString ? `?${queryString}` : "") } };
1107
+ }
1108
+ /**
1109
+ * Deletes files within the same bucket
1110
+ *
1111
+ * Returns an array of FileObject entries for the deleted files. Note that deprecated
1112
+ * fields like `bucket_id` may or may not be present in the response - do not rely on them.
1113
+ *
1114
+ * @category Storage
1115
+ * @subcategory File Buckets
1116
+ * @param paths An array of files to delete, including the path and file name. For example [`'folder/image.png'`].
1117
+ * @returns Promise with response containing array of deleted file objects or error
1118
+ *
1119
+ * @example Delete file
1120
+ * ```js
1121
+ * const { data, error } = await supabase
1122
+ * .storage
1123
+ * .from('avatars')
1124
+ * .remove(['folder/avatar1.png'])
1125
+ * ```
1126
+ *
1127
+ * Response:
1128
+ * ```json
1129
+ * {
1130
+ * "data": [],
1131
+ * "error": null
1132
+ * }
1133
+ * ```
1134
+ *
1135
+ * @remarks
1136
+ * - RLS policy permissions required:
1137
+ * - `buckets` table permissions: none
1138
+ * - `objects` table permissions: `delete` and `select`
1139
+ * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
1140
+ */
1141
+ async remove(paths) {
1142
+ var _this12 = this;
1143
+ return _this12.handleOperation(async () => {
1144
+ return await remove(_this12.fetch, `${_this12.url}/object/${_this12.bucketId}`, { prefixes: paths }, { headers: _this12.headers });
1145
+ });
1146
+ }
1147
+ /**
1148
+ * Get file metadata
1149
+ * @param id the file id to retrieve metadata
1150
+ */
1151
+ /**
1152
+ * Update file metadata
1153
+ * @param id the file id to update metadata
1154
+ * @param meta the new file metadata
1155
+ */
1156
+ /**
1157
+ * Lists all the files and folders within a path of the bucket.
1158
+ *
1159
+ * **Important:** For folder entries, fields like `id`, `updated_at`, `created_at`,
1160
+ * `last_accessed_at`, and `metadata` will be `null`. Only files have these fields populated.
1161
+ * Additionally, deprecated fields like `bucket_id`, `owner`, and `buckets` are NOT returned
1162
+ * by this method.
1163
+ *
1164
+ * @category Storage
1165
+ * @subcategory File Buckets
1166
+ * @param path The folder path.
1167
+ * @param options Search options including limit (defaults to 100), offset, sortBy, and search
1168
+ * @param parameters Optional fetch parameters including signal for cancellation
1169
+ * @returns Promise with response containing array of files/folders or error
1170
+ *
1171
+ * @example List files in a bucket
1172
+ * ```js
1173
+ * const { data, error } = await supabase
1174
+ * .storage
1175
+ * .from('avatars')
1176
+ * .list('folder', {
1177
+ * limit: 100,
1178
+ * offset: 0,
1179
+ * sortBy: { column: 'name', order: 'asc' },
1180
+ * })
1181
+ *
1182
+ * // Handle files vs folders
1183
+ * data?.forEach(item => {
1184
+ * if (item.id !== null) {
1185
+ * // It's a file
1186
+ * console.log('File:', item.name, 'Size:', item.metadata?.size)
1187
+ * } else {
1188
+ * // It's a folder
1189
+ * console.log('Folder:', item.name)
1190
+ * }
1191
+ * })
1192
+ * ```
1193
+ *
1194
+ * Response:
1195
+ * ```json
1196
+ * {
1197
+ * "data": [
1198
+ * {
1199
+ * "name": "avatar1.png",
1200
+ * "id": "e668cf7f-821b-4a2f-9dce-7dfa5dd1cfd2",
1201
+ * "updated_at": "2024-05-22T23:06:05.580Z",
1202
+ * "created_at": "2024-05-22T23:04:34.443Z",
1203
+ * "last_accessed_at": "2024-05-22T23:04:34.443Z",
1204
+ * "metadata": {
1205
+ * "eTag": "\"c5e8c553235d9af30ef4f6e280790b92\"",
1206
+ * "size": 32175,
1207
+ * "mimetype": "image/png",
1208
+ * "cacheControl": "max-age=3600",
1209
+ * "lastModified": "2024-05-22T23:06:05.574Z",
1210
+ * "contentLength": 32175,
1211
+ * "httpStatusCode": 200
1212
+ * }
1213
+ * }
1214
+ * ],
1215
+ * "error": null
1216
+ * }
1217
+ * ```
1218
+ *
1219
+ * @example Search files in a bucket
1220
+ * ```js
1221
+ * const { data, error } = await supabase
1222
+ * .storage
1223
+ * .from('avatars')
1224
+ * .list('folder', {
1225
+ * limit: 100,
1226
+ * offset: 0,
1227
+ * sortBy: { column: 'name', order: 'asc' },
1228
+ * search: 'jon'
1229
+ * })
1230
+ * ```
1231
+ *
1232
+ * @remarks
1233
+ * - RLS policy permissions required:
1234
+ * - `buckets` table permissions: none
1235
+ * - `objects` table permissions: `select`
1236
+ * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
1237
+ */
1238
+ async list(path, options, parameters) {
1239
+ var _this13 = this;
1240
+ return _this13.handleOperation(async () => {
1241
+ const body = _objectSpread2(_objectSpread2(_objectSpread2({}, DEFAULT_SEARCH_OPTIONS), options), {}, { prefix: path || "" });
1242
+ return await post(_this13.fetch, `${_this13.url}/object/list/${_this13.bucketId}`, body, { headers: _this13.headers }, parameters);
1243
+ });
1244
+ }
1245
+ /**
1246
+ * Lists all the files and folders within a bucket using the V2 API with pagination support.
1247
+ *
1248
+ * **Important:** Folder entries in the `folders` array only contain `name` and optionally `key` —
1249
+ * they have no `id`, timestamps, or `metadata` fields. Full file metadata is only available
1250
+ * on entries in the `objects` array.
1251
+ *
1252
+ * @experimental this method signature might change in the future
1253
+ *
1254
+ * @category Storage
1255
+ * @subcategory File Buckets
1256
+ * @param options Search options including prefix, cursor for pagination, limit, with_delimiter
1257
+ * @param parameters Optional fetch parameters including signal for cancellation
1258
+ * @returns Promise with response containing folders/objects arrays with pagination info or error
1259
+ *
1260
+ * @example List files with pagination
1261
+ * ```js
1262
+ * const { data, error } = await supabase
1263
+ * .storage
1264
+ * .from('avatars')
1265
+ * .listV2({
1266
+ * prefix: 'folder/',
1267
+ * limit: 100,
1268
+ * })
1269
+ *
1270
+ * // Handle pagination
1271
+ * if (data?.hasNext) {
1272
+ * const nextPage = await supabase
1273
+ * .storage
1274
+ * .from('avatars')
1275
+ * .listV2({
1276
+ * prefix: 'folder/',
1277
+ * cursor: data.nextCursor,
1278
+ * })
1279
+ * }
1280
+ *
1281
+ * // Handle files vs folders
1282
+ * data?.objects.forEach(file => {
1283
+ * if (file.id !== null) {
1284
+ * console.log('File:', file.name, 'Size:', file.metadata?.size)
1285
+ * }
1286
+ * })
1287
+ * data?.folders.forEach(folder => {
1288
+ * console.log('Folder:', folder.name)
1289
+ * })
1290
+ * ```
1291
+ */
1292
+ async listV2(options, parameters) {
1293
+ var _this14 = this;
1294
+ return _this14.handleOperation(async () => {
1295
+ const body = _objectSpread2({}, options);
1296
+ return await post(_this14.fetch, `${_this14.url}/object/list-v2/${_this14.bucketId}`, body, { headers: _this14.headers }, parameters);
1297
+ });
1298
+ }
1299
+ encodeMetadata(metadata) {
1300
+ return JSON.stringify(metadata);
1301
+ }
1302
+ toBase64(data) {
1303
+ if (typeof Buffer !== "undefined") return Buffer.from(data).toString("base64");
1304
+ return btoa(data);
1305
+ }
1306
+ _getFinalPath(path) {
1307
+ return `${this.bucketId}/${path.replace(/^\/+/, "")}`;
1308
+ }
1309
+ _removeEmptyFolders(path) {
1310
+ return path.replace(/^\/|\/$/g, "").replace(/\/+/g, "/");
1311
+ }
1312
+ /** Modifies the `query`, appending values the from `transform` */
1313
+ applyTransformOptsToQuery(query, transform) {
1314
+ if (transform.width) query.set("width", transform.width.toString());
1315
+ if (transform.height) query.set("height", transform.height.toString());
1316
+ if (transform.resize) query.set("resize", transform.resize);
1317
+ if (transform.format) query.set("format", transform.format);
1318
+ if (transform.quality) query.set("quality", transform.quality.toString());
1319
+ return query;
1320
+ }
1321
+ };
1322
+ const version = "2.106.1";
1323
+ const DEFAULT_HEADERS = { "X-Client-Info": `storage-js/${version}` };
1324
+ var StorageBucketApi = class extends BaseApiClient {
1325
+ constructor(url, headers = {}, fetch$1, opts) {
1326
+ const baseUrl = new URL(url);
1327
+ if (opts === null || opts === void 0 ? void 0 : opts.useNewHostname) {
1328
+ if (/supabase\.(co|in|red)$/.test(baseUrl.hostname) && !baseUrl.hostname.includes("storage.supabase.")) baseUrl.hostname = baseUrl.hostname.replace("supabase.", "storage.supabase.");
1329
+ }
1330
+ const finalUrl = baseUrl.href.replace(/\/$/, "");
1331
+ const finalHeaders = _objectSpread2(_objectSpread2({}, DEFAULT_HEADERS), headers);
1332
+ super(finalUrl, finalHeaders, fetch$1, "storage");
1333
+ }
1334
+ /**
1335
+ * Retrieves the details of all Storage buckets within an existing project.
1336
+ *
1337
+ * @category Storage
1338
+ * @subcategory File Buckets
1339
+ * @param options Query parameters for listing buckets
1340
+ * @param options.limit Maximum number of buckets to return
1341
+ * @param options.offset Number of buckets to skip
1342
+ * @param options.sortColumn Column to sort by ('id', 'name', 'created_at', 'updated_at')
1343
+ * @param options.sortOrder Sort order ('asc' or 'desc')
1344
+ * @param options.search Search term to filter bucket names
1345
+ * @returns Promise with response containing array of buckets or error
1346
+ *
1347
+ * @example List buckets
1348
+ * ```js
1349
+ * const { data, error } = await supabase
1350
+ * .storage
1351
+ * .listBuckets()
1352
+ * ```
1353
+ *
1354
+ * @example List buckets with options
1355
+ * ```js
1356
+ * const { data, error } = await supabase
1357
+ * .storage
1358
+ * .listBuckets({
1359
+ * limit: 10,
1360
+ * offset: 0,
1361
+ * sortColumn: 'created_at',
1362
+ * sortOrder: 'desc',
1363
+ * search: 'prod'
1364
+ * })
1365
+ * ```
1366
+ *
1367
+ * @remarks
1368
+ * - RLS policy permissions required:
1369
+ * - `buckets` table permissions: `select`
1370
+ * - `objects` table permissions: none
1371
+ * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
1372
+ */
1373
+ async listBuckets(options) {
1374
+ var _this = this;
1375
+ return _this.handleOperation(async () => {
1376
+ const queryString = _this.listBucketOptionsToQueryString(options);
1377
+ return await get(_this.fetch, `${_this.url}/bucket${queryString}`, { headers: _this.headers });
1378
+ });
1379
+ }
1380
+ /**
1381
+ * Retrieves the details of an existing Storage bucket.
1382
+ *
1383
+ * @category Storage
1384
+ * @subcategory File Buckets
1385
+ * @param id The unique identifier of the bucket you would like to retrieve.
1386
+ * @returns Promise with response containing bucket details or error
1387
+ *
1388
+ * @example Get bucket
1389
+ * ```js
1390
+ * const { data, error } = await supabase
1391
+ * .storage
1392
+ * .getBucket('avatars')
1393
+ * ```
1394
+ *
1395
+ * Response:
1396
+ * ```json
1397
+ * {
1398
+ * "data": {
1399
+ * "id": "avatars",
1400
+ * "name": "avatars",
1401
+ * "owner": "",
1402
+ * "public": false,
1403
+ * "file_size_limit": 1024,
1404
+ * "allowed_mime_types": [
1405
+ * "image/png"
1406
+ * ],
1407
+ * "created_at": "2024-05-22T22:26:05.100Z",
1408
+ * "updated_at": "2024-05-22T22:26:05.100Z"
1409
+ * },
1410
+ * "error": null
1411
+ * }
1412
+ * ```
1413
+ *
1414
+ * @remarks
1415
+ * - RLS policy permissions required:
1416
+ * - `buckets` table permissions: `select`
1417
+ * - `objects` table permissions: none
1418
+ * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
1419
+ */
1420
+ async getBucket(id) {
1421
+ var _this2 = this;
1422
+ return _this2.handleOperation(async () => {
1423
+ return await get(_this2.fetch, `${_this2.url}/bucket/${id}`, { headers: _this2.headers });
1424
+ });
1425
+ }
1426
+ /**
1427
+ * Creates a new Storage bucket
1428
+ *
1429
+ * @category Storage
1430
+ * @subcategory File Buckets
1431
+ * @param id A unique identifier for the bucket you are creating.
1432
+ * @param options.public The visibility of the bucket. Public buckets don't require an authorization token to download objects, but still require a valid token for all other operations. By default, buckets are private.
1433
+ * @param options.fileSizeLimit specifies the max file size in bytes that can be uploaded to this bucket.
1434
+ * The global file size limit takes precedence over this value.
1435
+ * The default value is null, which doesn't set a per bucket file size limit.
1436
+ * @param options.allowedMimeTypes specifies the allowed mime types that this bucket can accept during upload.
1437
+ * The default value is null, which allows files with all mime types to be uploaded.
1438
+ * Each mime type specified can be a wildcard, e.g. image/*, or a specific mime type, e.g. image/png.
1439
+ * @param options.type (private-beta) specifies the bucket type. see `BucketType` for more details.
1440
+ * - default bucket type is `STANDARD`
1441
+ * @returns Promise with response containing newly created bucket name or error
1442
+ *
1443
+ * @example Create bucket
1444
+ * ```js
1445
+ * const { data, error } = await supabase
1446
+ * .storage
1447
+ * .createBucket('avatars', {
1448
+ * public: false,
1449
+ * allowedMimeTypes: ['image/png'],
1450
+ * fileSizeLimit: 1024
1451
+ * })
1452
+ * ```
1453
+ *
1454
+ * Response:
1455
+ * ```json
1456
+ * {
1457
+ * "data": {
1458
+ * "name": "avatars"
1459
+ * },
1460
+ * "error": null
1461
+ * }
1462
+ * ```
1463
+ *
1464
+ * @remarks
1465
+ * - RLS policy permissions required:
1466
+ * - `buckets` table permissions: `insert`
1467
+ * - `objects` table permissions: none
1468
+ * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
1469
+ */
1470
+ async createBucket(id, options = { public: false }) {
1471
+ var _this3 = this;
1472
+ return _this3.handleOperation(async () => {
1473
+ return await post(_this3.fetch, `${_this3.url}/bucket`, {
1474
+ id,
1475
+ name: id,
1476
+ type: options.type,
1477
+ public: options.public,
1478
+ file_size_limit: options.fileSizeLimit,
1479
+ allowed_mime_types: options.allowedMimeTypes
1480
+ }, { headers: _this3.headers });
1481
+ });
1482
+ }
1483
+ /**
1484
+ * Updates a Storage bucket
1485
+ *
1486
+ * @category Storage
1487
+ * @subcategory File Buckets
1488
+ * @param id A unique identifier for the bucket you are updating.
1489
+ * @param options.public The visibility of the bucket. Public buckets don't require an authorization token to download objects, but still require a valid token for all other operations.
1490
+ * @param options.fileSizeLimit specifies the max file size in bytes that can be uploaded to this bucket.
1491
+ * The global file size limit takes precedence over this value.
1492
+ * The default value is null, which doesn't set a per bucket file size limit.
1493
+ * @param options.allowedMimeTypes specifies the allowed mime types that this bucket can accept during upload.
1494
+ * The default value is null, which allows files with all mime types to be uploaded.
1495
+ * Each mime type specified can be a wildcard, e.g. image/*, or a specific mime type, e.g. image/png.
1496
+ * @returns Promise with response containing success message or error
1497
+ *
1498
+ * @example Update bucket
1499
+ * ```js
1500
+ * const { data, error } = await supabase
1501
+ * .storage
1502
+ * .updateBucket('avatars', {
1503
+ * public: false,
1504
+ * allowedMimeTypes: ['image/png'],
1505
+ * fileSizeLimit: 1024
1506
+ * })
1507
+ * ```
1508
+ *
1509
+ * Response:
1510
+ * ```json
1511
+ * {
1512
+ * "data": {
1513
+ * "message": "Successfully updated"
1514
+ * },
1515
+ * "error": null
1516
+ * }
1517
+ * ```
1518
+ *
1519
+ * @remarks
1520
+ * - RLS policy permissions required:
1521
+ * - `buckets` table permissions: `select` and `update`
1522
+ * - `objects` table permissions: none
1523
+ * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
1524
+ */
1525
+ async updateBucket(id, options) {
1526
+ var _this4 = this;
1527
+ return _this4.handleOperation(async () => {
1528
+ return await put(_this4.fetch, `${_this4.url}/bucket/${id}`, {
1529
+ id,
1530
+ name: id,
1531
+ public: options.public,
1532
+ file_size_limit: options.fileSizeLimit,
1533
+ allowed_mime_types: options.allowedMimeTypes
1534
+ }, { headers: _this4.headers });
1535
+ });
1536
+ }
1537
+ /**
1538
+ * Removes all objects inside a single bucket.
1539
+ *
1540
+ * @category Storage
1541
+ * @subcategory File Buckets
1542
+ * @param id The unique identifier of the bucket you would like to empty.
1543
+ * @returns Promise with success message or error
1544
+ *
1545
+ * @example Empty bucket
1546
+ * ```js
1547
+ * const { data, error } = await supabase
1548
+ * .storage
1549
+ * .emptyBucket('avatars')
1550
+ * ```
1551
+ *
1552
+ * Response:
1553
+ * ```json
1554
+ * {
1555
+ * "data": {
1556
+ * "message": "Successfully emptied"
1557
+ * },
1558
+ * "error": null
1559
+ * }
1560
+ * ```
1561
+ *
1562
+ * @remarks
1563
+ * - RLS policy permissions required:
1564
+ * - `buckets` table permissions: `select`
1565
+ * - `objects` table permissions: `select` and `delete`
1566
+ * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
1567
+ */
1568
+ async emptyBucket(id) {
1569
+ var _this5 = this;
1570
+ return _this5.handleOperation(async () => {
1571
+ return await post(_this5.fetch, `${_this5.url}/bucket/${id}/empty`, {}, { headers: _this5.headers });
1572
+ });
1573
+ }
1574
+ /**
1575
+ * Deletes an existing bucket. A bucket can't be deleted with existing objects inside it.
1576
+ * You must first `empty()` the bucket.
1577
+ *
1578
+ * @category Storage
1579
+ * @subcategory File Buckets
1580
+ * @param id The unique identifier of the bucket you would like to delete.
1581
+ * @returns Promise with success message or error
1582
+ *
1583
+ * @example Delete bucket
1584
+ * ```js
1585
+ * const { data, error } = await supabase
1586
+ * .storage
1587
+ * .deleteBucket('avatars')
1588
+ * ```
1589
+ *
1590
+ * Response:
1591
+ * ```json
1592
+ * {
1593
+ * "data": {
1594
+ * "message": "Successfully deleted"
1595
+ * },
1596
+ * "error": null
1597
+ * }
1598
+ * ```
1599
+ *
1600
+ * @remarks
1601
+ * - RLS policy permissions required:
1602
+ * - `buckets` table permissions: `select` and `delete`
1603
+ * - `objects` table permissions: none
1604
+ * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
1605
+ */
1606
+ async deleteBucket(id) {
1607
+ var _this6 = this;
1608
+ return _this6.handleOperation(async () => {
1609
+ return await remove(_this6.fetch, `${_this6.url}/bucket/${id}`, {}, { headers: _this6.headers });
1610
+ });
1611
+ }
1612
+ listBucketOptionsToQueryString(options) {
1613
+ const params = {};
1614
+ if (options) {
1615
+ if ("limit" in options) params.limit = String(options.limit);
1616
+ if ("offset" in options) params.offset = String(options.offset);
1617
+ if (options.search) params.search = options.search;
1618
+ if (options.sortColumn) params.sortColumn = options.sortColumn;
1619
+ if (options.sortOrder) params.sortOrder = options.sortOrder;
1620
+ }
1621
+ return Object.keys(params).length > 0 ? "?" + new URLSearchParams(params).toString() : "";
1622
+ }
1623
+ };
1624
+ var StorageAnalyticsClient = class extends BaseApiClient {
1625
+ /**
1626
+ * @alpha
1627
+ *
1628
+ * Creates a new StorageAnalyticsClient instance
1629
+ *
1630
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
1631
+ *
1632
+ * @category Storage
1633
+ * @subcategory Analytics Buckets
1634
+ * @param url - The base URL for the storage API
1635
+ * @param headers - HTTP headers to include in requests
1636
+ * @param fetch - Optional custom fetch implementation
1637
+ *
1638
+ * @example Using supabase-js (recommended)
1639
+ * ```typescript
1640
+ * import { createClient } from '@supabase/supabase-js'
1641
+ *
1642
+ * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')
1643
+ * const { data, error } = await supabase.storage.analytics.listBuckets()
1644
+ * ```
1645
+ *
1646
+ * @example Standalone import for bundle-sensitive environments
1647
+ * ```typescript
1648
+ * import { StorageAnalyticsClient } from '@supabase/storage-js'
1649
+ *
1650
+ * const client = new StorageAnalyticsClient(url, headers)
1651
+ * ```
1652
+ */
1653
+ constructor(url, headers = {}, fetch$1) {
1654
+ const finalUrl = url.replace(/\/$/, "");
1655
+ const finalHeaders = _objectSpread2(_objectSpread2({}, DEFAULT_HEADERS), headers);
1656
+ super(finalUrl, finalHeaders, fetch$1, "storage");
1657
+ }
1658
+ /**
1659
+ * @alpha
1660
+ *
1661
+ * Creates a new analytics bucket using Iceberg tables
1662
+ * Analytics buckets are optimized for analytical queries and data processing
1663
+ *
1664
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
1665
+ *
1666
+ * @category Storage
1667
+ * @subcategory Analytics Buckets
1668
+ * @param name A unique name for the bucket you are creating
1669
+ * @returns Promise with response containing newly created analytics bucket or error
1670
+ *
1671
+ * @example Create analytics bucket
1672
+ * ```js
1673
+ * const { data, error } = await supabase
1674
+ * .storage
1675
+ * .analytics
1676
+ * .createBucket('analytics-data')
1677
+ * ```
1678
+ *
1679
+ * Response:
1680
+ * ```json
1681
+ * {
1682
+ * "data": {
1683
+ * "name": "analytics-data",
1684
+ * "type": "ANALYTICS",
1685
+ * "format": "iceberg",
1686
+ * "created_at": "2024-05-22T22:26:05.100Z",
1687
+ * "updated_at": "2024-05-22T22:26:05.100Z"
1688
+ * },
1689
+ * "error": null
1690
+ * }
1691
+ * ```
1692
+ *
1693
+ * @remarks
1694
+ * - Creates a new analytics bucket using Iceberg tables
1695
+ * - Analytics buckets are optimized for analytical queries and data processing
1696
+ */
1697
+ async createBucket(name) {
1698
+ var _this = this;
1699
+ return _this.handleOperation(async () => {
1700
+ return await post(_this.fetch, `${_this.url}/bucket`, { name }, { headers: _this.headers });
1701
+ });
1702
+ }
1703
+ /**
1704
+ * @alpha
1705
+ *
1706
+ * Retrieves the details of all Analytics Storage buckets within an existing project
1707
+ * Only returns buckets of type 'ANALYTICS'
1708
+ *
1709
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
1710
+ *
1711
+ * @category Storage
1712
+ * @subcategory Analytics Buckets
1713
+ * @param options Query parameters for listing buckets
1714
+ * @param options.limit Maximum number of buckets to return
1715
+ * @param options.offset Number of buckets to skip
1716
+ * @param options.sortColumn Column to sort by ('name', 'created_at', 'updated_at')
1717
+ * @param options.sortOrder Sort order ('asc' or 'desc')
1718
+ * @param options.search Search term to filter bucket names
1719
+ * @returns Promise with response containing array of analytics buckets or error
1720
+ *
1721
+ * @example List analytics buckets
1722
+ * ```js
1723
+ * const { data, error } = await supabase
1724
+ * .storage
1725
+ * .analytics
1726
+ * .listBuckets({
1727
+ * limit: 10,
1728
+ * offset: 0,
1729
+ * sortColumn: 'created_at',
1730
+ * sortOrder: 'desc'
1731
+ * })
1732
+ * ```
1733
+ *
1734
+ * Response:
1735
+ * ```json
1736
+ * {
1737
+ * "data": [
1738
+ * {
1739
+ * "name": "analytics-data",
1740
+ * "type": "ANALYTICS",
1741
+ * "format": "iceberg",
1742
+ * "created_at": "2024-05-22T22:26:05.100Z",
1743
+ * "updated_at": "2024-05-22T22:26:05.100Z"
1744
+ * }
1745
+ * ],
1746
+ * "error": null
1747
+ * }
1748
+ * ```
1749
+ *
1750
+ * @remarks
1751
+ * - Retrieves the details of all Analytics Storage buckets within an existing project
1752
+ * - Only returns buckets of type 'ANALYTICS'
1753
+ */
1754
+ async listBuckets(options) {
1755
+ var _this2 = this;
1756
+ return _this2.handleOperation(async () => {
1757
+ const queryParams = new URLSearchParams();
1758
+ if ((options === null || options === void 0 ? void 0 : options.limit) !== void 0) queryParams.set("limit", options.limit.toString());
1759
+ if ((options === null || options === void 0 ? void 0 : options.offset) !== void 0) queryParams.set("offset", options.offset.toString());
1760
+ if (options === null || options === void 0 ? void 0 : options.sortColumn) queryParams.set("sortColumn", options.sortColumn);
1761
+ if (options === null || options === void 0 ? void 0 : options.sortOrder) queryParams.set("sortOrder", options.sortOrder);
1762
+ if (options === null || options === void 0 ? void 0 : options.search) queryParams.set("search", options.search);
1763
+ const queryString = queryParams.toString();
1764
+ const url = queryString ? `${_this2.url}/bucket?${queryString}` : `${_this2.url}/bucket`;
1765
+ return await get(_this2.fetch, url, { headers: _this2.headers });
1766
+ });
1767
+ }
1768
+ /**
1769
+ * @alpha
1770
+ *
1771
+ * Deletes an existing analytics bucket
1772
+ * A bucket can't be deleted with existing objects inside it
1773
+ * You must first empty the bucket before deletion
1774
+ *
1775
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
1776
+ *
1777
+ * @category Storage
1778
+ * @subcategory Analytics Buckets
1779
+ * @param bucketName The unique identifier of the bucket you would like to delete
1780
+ * @returns Promise with response containing success message or error
1781
+ *
1782
+ * @example Delete analytics bucket
1783
+ * ```js
1784
+ * const { data, error } = await supabase
1785
+ * .storage
1786
+ * .analytics
1787
+ * .deleteBucket('analytics-data')
1788
+ * ```
1789
+ *
1790
+ * Response:
1791
+ * ```json
1792
+ * {
1793
+ * "data": {
1794
+ * "message": "Successfully deleted"
1795
+ * },
1796
+ * "error": null
1797
+ * }
1798
+ * ```
1799
+ *
1800
+ * @remarks
1801
+ * - Deletes an analytics bucket
1802
+ */
1803
+ async deleteBucket(bucketName) {
1804
+ var _this3 = this;
1805
+ return _this3.handleOperation(async () => {
1806
+ return await remove(_this3.fetch, `${_this3.url}/bucket/${bucketName}`, {}, { headers: _this3.headers });
1807
+ });
1808
+ }
1809
+ /**
1810
+ * @alpha
1811
+ *
1812
+ * Get an Iceberg REST Catalog client configured for a specific analytics bucket
1813
+ * Use this to perform advanced table and namespace operations within the bucket
1814
+ * The returned client provides full access to the Apache Iceberg REST Catalog API
1815
+ * with the Supabase `{ data, error }` pattern for consistent error handling on all operations.
1816
+ *
1817
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
1818
+ *
1819
+ * @category Storage
1820
+ * @subcategory Analytics Buckets
1821
+ * @param bucketName - The name of the analytics bucket (warehouse) to connect to
1822
+ * @returns The wrapped Iceberg catalog client
1823
+ * @throws {StorageError} If the bucket name is invalid
1824
+ *
1825
+ * @example Get catalog and create table
1826
+ * ```js
1827
+ * // First, create an analytics bucket
1828
+ * const { data: bucket, error: bucketError } = await supabase
1829
+ * .storage
1830
+ * .analytics
1831
+ * .createBucket('analytics-data')
1832
+ *
1833
+ * // Get the Iceberg catalog for that bucket
1834
+ * const catalog = supabase.storage.analytics.from('analytics-data')
1835
+ *
1836
+ * // Create a namespace
1837
+ * const { error: nsError } = await catalog.createNamespace({ namespace: ['default'] })
1838
+ *
1839
+ * // Create a table with schema
1840
+ * const { data: tableMetadata, error: tableError } = await catalog.createTable(
1841
+ * { namespace: ['default'] },
1842
+ * {
1843
+ * name: 'events',
1844
+ * schema: {
1845
+ * type: 'struct',
1846
+ * fields: [
1847
+ * { id: 1, name: 'id', type: 'long', required: true },
1848
+ * { id: 2, name: 'timestamp', type: 'timestamp', required: true },
1849
+ * { id: 3, name: 'user_id', type: 'string', required: false }
1850
+ * ],
1851
+ * 'schema-id': 0,
1852
+ * 'identifier-field-ids': [1]
1853
+ * },
1854
+ * 'partition-spec': {
1855
+ * 'spec-id': 0,
1856
+ * fields: []
1857
+ * },
1858
+ * 'write-order': {
1859
+ * 'order-id': 0,
1860
+ * fields: []
1861
+ * },
1862
+ * properties: {
1863
+ * 'write.format.default': 'parquet'
1864
+ * }
1865
+ * }
1866
+ * )
1867
+ * ```
1868
+ *
1869
+ * @example List tables in namespace
1870
+ * ```js
1871
+ * const catalog = supabase.storage.analytics.from('analytics-data')
1872
+ *
1873
+ * // List all tables in the default namespace
1874
+ * const { data: tables, error: listError } = await catalog.listTables({ namespace: ['default'] })
1875
+ * if (listError) {
1876
+ * if (listError.isNotFound()) {
1877
+ * console.log('Namespace not found')
1878
+ * }
1879
+ * return
1880
+ * }
1881
+ * console.log(tables) // [{ namespace: ['default'], name: 'events' }]
1882
+ * ```
1883
+ *
1884
+ * @example Working with namespaces
1885
+ * ```js
1886
+ * const catalog = supabase.storage.analytics.from('analytics-data')
1887
+ *
1888
+ * // List all namespaces
1889
+ * const { data: namespaces } = await catalog.listNamespaces()
1890
+ *
1891
+ * // Create namespace with properties
1892
+ * await catalog.createNamespace(
1893
+ * { namespace: ['production'] },
1894
+ * { properties: { owner: 'data-team', env: 'prod' } }
1895
+ * )
1896
+ * ```
1897
+ *
1898
+ * @example Cleanup operations
1899
+ * ```js
1900
+ * const catalog = supabase.storage.analytics.from('analytics-data')
1901
+ *
1902
+ * // Drop table with purge option (removes all data)
1903
+ * const { error: dropError } = await catalog.dropTable(
1904
+ * { namespace: ['default'], name: 'events' },
1905
+ * { purge: true }
1906
+ * )
1907
+ *
1908
+ * if (dropError?.isNotFound()) {
1909
+ * console.log('Table does not exist')
1910
+ * }
1911
+ *
1912
+ * // Drop namespace (must be empty)
1913
+ * await catalog.dropNamespace({ namespace: ['default'] })
1914
+ * ```
1915
+ *
1916
+ * @remarks
1917
+ * This method provides a bridge between Supabase's bucket management and the standard
1918
+ * Apache Iceberg REST Catalog API. The bucket name maps to the Iceberg warehouse parameter.
1919
+ * All authentication and configuration is handled automatically using your Supabase credentials.
1920
+ *
1921
+ * **Error Handling**: Invalid bucket names throw immediately. All catalog
1922
+ * operations return `{ data, error }` where errors are `IcebergError` instances from iceberg-js.
1923
+ * Use helper methods like `error.isNotFound()` or check `error.status` for specific error handling.
1924
+ * Use `.throwOnError()` on the analytics client if you prefer exceptions for catalog operations.
1925
+ *
1926
+ * **Cleanup Operations**: When using `dropTable`, the `purge: true` option permanently
1927
+ * deletes all table data. Without it, the table is marked as deleted but data remains.
1928
+ *
1929
+ * **Library Dependency**: The returned catalog wraps `IcebergRestCatalog` from iceberg-js.
1930
+ * For complete API documentation and advanced usage, refer to the
1931
+ * [iceberg-js documentation](https://supabase.github.io/iceberg-js/).
1932
+ */
1933
+ from(bucketName) {
1934
+ var _this4 = this;
1935
+ if (!isValidBucketName(bucketName)) throw new StorageError("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");
1936
+ const catalog = new IcebergRestCatalog({
1937
+ baseUrl: this.url,
1938
+ catalogName: bucketName,
1939
+ auth: {
1940
+ type: "custom",
1941
+ getHeaders: async () => _this4.headers
1942
+ },
1943
+ fetch: this.fetch
1944
+ });
1945
+ const shouldThrowOnError = this.shouldThrowOnError;
1946
+ return new Proxy(catalog, { get(target, prop) {
1947
+ const value = target[prop];
1948
+ if (typeof value !== "function") return value;
1949
+ return async (...args) => {
1950
+ try {
1951
+ return {
1952
+ data: await value.apply(target, args),
1953
+ error: null
1954
+ };
1955
+ } catch (error) {
1956
+ if (shouldThrowOnError) throw error;
1957
+ return {
1958
+ data: null,
1959
+ error
1960
+ };
1961
+ }
1962
+ };
1963
+ } });
1964
+ }
1965
+ };
1966
+ var VectorIndexApi = class extends BaseApiClient {
1967
+ /** Creates a new VectorIndexApi instance */
1968
+ constructor(url, headers = {}, fetch$1) {
1969
+ const finalUrl = url.replace(/\/$/, "");
1970
+ const finalHeaders = _objectSpread2(_objectSpread2({}, DEFAULT_HEADERS), {}, { "Content-Type": "application/json" }, headers);
1971
+ super(finalUrl, finalHeaders, fetch$1, "vectors");
1972
+ }
1973
+ /** Creates a new vector index within a bucket */
1974
+ async createIndex(options) {
1975
+ var _this = this;
1976
+ return _this.handleOperation(async () => {
1977
+ return await vectorsApi.post(_this.fetch, `${_this.url}/CreateIndex`, options, { headers: _this.headers }) || {};
1978
+ });
1979
+ }
1980
+ /** Retrieves metadata for a specific vector index */
1981
+ async getIndex(vectorBucketName, indexName) {
1982
+ var _this2 = this;
1983
+ return _this2.handleOperation(async () => {
1984
+ return await vectorsApi.post(_this2.fetch, `${_this2.url}/GetIndex`, {
1985
+ vectorBucketName,
1986
+ indexName
1987
+ }, { headers: _this2.headers });
1988
+ });
1989
+ }
1990
+ /** Lists vector indexes within a bucket with optional filtering and pagination */
1991
+ async listIndexes(options) {
1992
+ var _this3 = this;
1993
+ return _this3.handleOperation(async () => {
1994
+ return await vectorsApi.post(_this3.fetch, `${_this3.url}/ListIndexes`, options, { headers: _this3.headers });
1995
+ });
1996
+ }
1997
+ /** Deletes a vector index and all its data */
1998
+ async deleteIndex(vectorBucketName, indexName) {
1999
+ var _this4 = this;
2000
+ return _this4.handleOperation(async () => {
2001
+ return await vectorsApi.post(_this4.fetch, `${_this4.url}/DeleteIndex`, {
2002
+ vectorBucketName,
2003
+ indexName
2004
+ }, { headers: _this4.headers }) || {};
2005
+ });
2006
+ }
2007
+ };
2008
+ var VectorDataApi = class extends BaseApiClient {
2009
+ /** Creates a new VectorDataApi instance */
2010
+ constructor(url, headers = {}, fetch$1) {
2011
+ const finalUrl = url.replace(/\/$/, "");
2012
+ const finalHeaders = _objectSpread2(_objectSpread2({}, DEFAULT_HEADERS), {}, { "Content-Type": "application/json" }, headers);
2013
+ super(finalUrl, finalHeaders, fetch$1, "vectors");
2014
+ }
2015
+ /** Inserts or updates vectors in batch (1-500 per request) */
2016
+ async putVectors(options) {
2017
+ var _this = this;
2018
+ if (options.vectors.length < 1 || options.vectors.length > 500) throw new Error("Vector batch size must be between 1 and 500 items");
2019
+ return _this.handleOperation(async () => {
2020
+ return await vectorsApi.post(_this.fetch, `${_this.url}/PutVectors`, options, { headers: _this.headers }) || {};
2021
+ });
2022
+ }
2023
+ /** Retrieves vectors by their keys in batch */
2024
+ async getVectors(options) {
2025
+ var _this2 = this;
2026
+ return _this2.handleOperation(async () => {
2027
+ return await vectorsApi.post(_this2.fetch, `${_this2.url}/GetVectors`, options, { headers: _this2.headers });
2028
+ });
2029
+ }
2030
+ /** Lists vectors in an index with pagination */
2031
+ async listVectors(options) {
2032
+ var _this3 = this;
2033
+ if (options.segmentCount !== void 0) {
2034
+ if (options.segmentCount < 1 || options.segmentCount > 16) throw new Error("segmentCount must be between 1 and 16");
2035
+ if (options.segmentIndex !== void 0) {
2036
+ if (options.segmentIndex < 0 || options.segmentIndex >= options.segmentCount) throw new Error(`segmentIndex must be between 0 and ${options.segmentCount - 1}`);
2037
+ }
2038
+ }
2039
+ return _this3.handleOperation(async () => {
2040
+ return await vectorsApi.post(_this3.fetch, `${_this3.url}/ListVectors`, options, { headers: _this3.headers });
2041
+ });
2042
+ }
2043
+ /** Queries for similar vectors using approximate nearest neighbor search */
2044
+ async queryVectors(options) {
2045
+ var _this4 = this;
2046
+ return _this4.handleOperation(async () => {
2047
+ return await vectorsApi.post(_this4.fetch, `${_this4.url}/QueryVectors`, options, { headers: _this4.headers });
2048
+ });
2049
+ }
2050
+ /** Deletes vectors by their keys in batch (1-500 per request) */
2051
+ async deleteVectors(options) {
2052
+ var _this5 = this;
2053
+ if (options.keys.length < 1 || options.keys.length > 500) throw new Error("Keys batch size must be between 1 and 500 items");
2054
+ return _this5.handleOperation(async () => {
2055
+ return await vectorsApi.post(_this5.fetch, `${_this5.url}/DeleteVectors`, options, { headers: _this5.headers }) || {};
2056
+ });
2057
+ }
2058
+ };
2059
+ var VectorBucketApi = class extends BaseApiClient {
2060
+ /** Creates a new VectorBucketApi instance */
2061
+ constructor(url, headers = {}, fetch$1) {
2062
+ const finalUrl = url.replace(/\/$/, "");
2063
+ const finalHeaders = _objectSpread2(_objectSpread2({}, DEFAULT_HEADERS), {}, { "Content-Type": "application/json" }, headers);
2064
+ super(finalUrl, finalHeaders, fetch$1, "vectors");
2065
+ }
2066
+ /** Creates a new vector bucket */
2067
+ async createBucket(vectorBucketName) {
2068
+ var _this = this;
2069
+ return _this.handleOperation(async () => {
2070
+ return await vectorsApi.post(_this.fetch, `${_this.url}/CreateVectorBucket`, { vectorBucketName }, { headers: _this.headers }) || {};
2071
+ });
2072
+ }
2073
+ /** Retrieves metadata for a specific vector bucket */
2074
+ async getBucket(vectorBucketName) {
2075
+ var _this2 = this;
2076
+ return _this2.handleOperation(async () => {
2077
+ return await vectorsApi.post(_this2.fetch, `${_this2.url}/GetVectorBucket`, { vectorBucketName }, { headers: _this2.headers });
2078
+ });
2079
+ }
2080
+ /** Lists vector buckets with optional filtering and pagination */
2081
+ async listBuckets(options = {}) {
2082
+ var _this3 = this;
2083
+ return _this3.handleOperation(async () => {
2084
+ return await vectorsApi.post(_this3.fetch, `${_this3.url}/ListVectorBuckets`, options, { headers: _this3.headers });
2085
+ });
2086
+ }
2087
+ /** Deletes a vector bucket (must be empty first) */
2088
+ async deleteBucket(vectorBucketName) {
2089
+ var _this4 = this;
2090
+ return _this4.handleOperation(async () => {
2091
+ return await vectorsApi.post(_this4.fetch, `${_this4.url}/DeleteVectorBucket`, { vectorBucketName }, { headers: _this4.headers }) || {};
2092
+ });
2093
+ }
2094
+ };
2095
+ var StorageVectorsClient = class extends VectorBucketApi {
2096
+ /**
2097
+ * @alpha
2098
+ *
2099
+ * Creates a StorageVectorsClient that can manage buckets, indexes, and vectors.
2100
+ *
2101
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2102
+ *
2103
+ * @category Storage
2104
+ * @subcategory Vector Buckets
2105
+ * @param url - Base URL of the Storage Vectors REST API.
2106
+ * @param options.headers - Optional headers (for example `Authorization`) applied to every request.
2107
+ * @param options.fetch - Optional custom `fetch` implementation for non-browser runtimes.
2108
+ *
2109
+ * @example Using supabase-js (recommended)
2110
+ * ```typescript
2111
+ * import { createClient } from '@supabase/supabase-js'
2112
+ *
2113
+ * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')
2114
+ * const bucket = supabase.storage.vectors.from('embeddings-prod')
2115
+ * ```
2116
+ *
2117
+ * @example Standalone import for bundle-sensitive environments
2118
+ * ```typescript
2119
+ * import { StorageVectorsClient } from '@supabase/storage-js'
2120
+ *
2121
+ * const client = new StorageVectorsClient(url, options)
2122
+ * ```
2123
+ */
2124
+ constructor(url, options = {}) {
2125
+ super(url, options.headers || {}, options.fetch);
2126
+ }
2127
+ /**
2128
+ *
2129
+ * @alpha
2130
+ *
2131
+ * Access operations for a specific vector bucket
2132
+ * Returns a scoped client for index and vector operations within the bucket
2133
+ *
2134
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2135
+ *
2136
+ * @category Storage
2137
+ * @subcategory Vector Buckets
2138
+ * @param vectorBucketName - Name of the vector bucket
2139
+ * @returns Bucket-scoped client with index and vector operations
2140
+ *
2141
+ * @example Accessing a vector bucket
2142
+ * ```typescript
2143
+ * const bucket = supabase.storage.vectors.from('embeddings-prod')
2144
+ * ```
2145
+ */
2146
+ from(vectorBucketName) {
2147
+ return new VectorBucketScope(this.url, this.headers, vectorBucketName, this.fetch);
2148
+ }
2149
+ /**
2150
+ *
2151
+ * @alpha
2152
+ *
2153
+ * Creates a new vector bucket
2154
+ * Vector buckets are containers for vector indexes and their data
2155
+ *
2156
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2157
+ *
2158
+ * @category Storage
2159
+ * @subcategory Vector Buckets
2160
+ * @param vectorBucketName - Unique name for the vector bucket
2161
+ * @returns Promise with empty response on success or error
2162
+ *
2163
+ * @example Creating a vector bucket
2164
+ * ```typescript
2165
+ * const { data, error } = await supabase
2166
+ * .storage
2167
+ * .vectors
2168
+ * .createBucket('embeddings-prod')
2169
+ * ```
2170
+ */
2171
+ async createBucket(vectorBucketName) {
2172
+ var _superprop_getCreateBucket = () => super.createBucket, _this = this;
2173
+ return _superprop_getCreateBucket().call(_this, vectorBucketName);
2174
+ }
2175
+ /**
2176
+ *
2177
+ * @alpha
2178
+ *
2179
+ * Retrieves metadata for a specific vector bucket
2180
+ *
2181
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2182
+ *
2183
+ * @category Storage
2184
+ * @subcategory Vector Buckets
2185
+ * @param vectorBucketName - Name of the vector bucket
2186
+ * @returns Promise with bucket metadata or error
2187
+ *
2188
+ * @example Get bucket metadata
2189
+ * ```typescript
2190
+ * const { data, error } = await supabase
2191
+ * .storage
2192
+ * .vectors
2193
+ * .getBucket('embeddings-prod')
2194
+ *
2195
+ * console.log('Bucket created:', data?.vectorBucket.creationTime)
2196
+ * ```
2197
+ */
2198
+ async getBucket(vectorBucketName) {
2199
+ var _superprop_getGetBucket = () => super.getBucket, _this2 = this;
2200
+ return _superprop_getGetBucket().call(_this2, vectorBucketName);
2201
+ }
2202
+ /**
2203
+ *
2204
+ * @alpha
2205
+ *
2206
+ * Lists all vector buckets with optional filtering and pagination
2207
+ *
2208
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2209
+ *
2210
+ * @category Storage
2211
+ * @subcategory Vector Buckets
2212
+ * @param options - Optional filters (prefix, maxResults, nextToken)
2213
+ * @returns Promise with list of buckets or error
2214
+ *
2215
+ * @example List vector buckets
2216
+ * ```typescript
2217
+ * const { data, error } = await supabase
2218
+ * .storage
2219
+ * .vectors
2220
+ * .listBuckets({ prefix: 'embeddings-' })
2221
+ *
2222
+ * data?.vectorBuckets.forEach(bucket => {
2223
+ * console.log(bucket.vectorBucketName)
2224
+ * })
2225
+ * ```
2226
+ */
2227
+ async listBuckets(options = {}) {
2228
+ var _superprop_getListBuckets = () => super.listBuckets, _this3 = this;
2229
+ return _superprop_getListBuckets().call(_this3, options);
2230
+ }
2231
+ /**
2232
+ *
2233
+ * @alpha
2234
+ *
2235
+ * Deletes a vector bucket (bucket must be empty)
2236
+ * All indexes must be deleted before deleting the bucket
2237
+ *
2238
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2239
+ *
2240
+ * @category Storage
2241
+ * @subcategory Vector Buckets
2242
+ * @param vectorBucketName - Name of the vector bucket to delete
2243
+ * @returns Promise with empty response on success or error
2244
+ *
2245
+ * @example Delete a vector bucket
2246
+ * ```typescript
2247
+ * const { data, error } = await supabase
2248
+ * .storage
2249
+ * .vectors
2250
+ * .deleteBucket('embeddings-old')
2251
+ * ```
2252
+ */
2253
+ async deleteBucket(vectorBucketName) {
2254
+ var _superprop_getDeleteBucket = () => super.deleteBucket, _this4 = this;
2255
+ return _superprop_getDeleteBucket().call(_this4, vectorBucketName);
2256
+ }
2257
+ };
2258
+ var VectorBucketScope = class extends VectorIndexApi {
2259
+ /**
2260
+ * @alpha
2261
+ *
2262
+ * Creates a helper that automatically scopes all index operations to the provided bucket.
2263
+ *
2264
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2265
+ *
2266
+ * @category Storage
2267
+ * @subcategory Vector Buckets
2268
+ * @example Creating a vector bucket scope
2269
+ * ```typescript
2270
+ * const bucket = supabase.storage.vectors.from('embeddings-prod')
2271
+ * ```
2272
+ */
2273
+ constructor(url, headers, vectorBucketName, fetch$1) {
2274
+ super(url, headers, fetch$1);
2275
+ this.vectorBucketName = vectorBucketName;
2276
+ }
2277
+ /**
2278
+ *
2279
+ * @alpha
2280
+ *
2281
+ * Creates a new vector index in this bucket
2282
+ * Convenience method that automatically includes the bucket name
2283
+ *
2284
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2285
+ *
2286
+ * @category Storage
2287
+ * @subcategory Vector Buckets
2288
+ * @param options - Index configuration (vectorBucketName is automatically set)
2289
+ * @returns Promise with empty response on success or error
2290
+ *
2291
+ * @example Creating a vector index
2292
+ * ```typescript
2293
+ * const bucket = supabase.storage.vectors.from('embeddings-prod')
2294
+ * await bucket.createIndex({
2295
+ * indexName: 'documents-openai',
2296
+ * dataType: 'float32',
2297
+ * dimension: 1536,
2298
+ * distanceMetric: 'cosine',
2299
+ * metadataConfiguration: {
2300
+ * nonFilterableMetadataKeys: ['raw_text']
2301
+ * }
2302
+ * })
2303
+ * ```
2304
+ */
2305
+ async createIndex(options) {
2306
+ var _superprop_getCreateIndex = () => super.createIndex, _this5 = this;
2307
+ return _superprop_getCreateIndex().call(_this5, _objectSpread2(_objectSpread2({}, options), {}, { vectorBucketName: _this5.vectorBucketName }));
2308
+ }
2309
+ /**
2310
+ *
2311
+ * @alpha
2312
+ *
2313
+ * Lists indexes in this bucket
2314
+ * Convenience method that automatically includes the bucket name
2315
+ *
2316
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2317
+ *
2318
+ * @category Storage
2319
+ * @subcategory Vector Buckets
2320
+ * @param options - Listing options (vectorBucketName is automatically set)
2321
+ * @returns Promise with response containing indexes array and pagination token or error
2322
+ *
2323
+ * @example List indexes
2324
+ * ```typescript
2325
+ * const bucket = supabase.storage.vectors.from('embeddings-prod')
2326
+ * const { data } = await bucket.listIndexes({ prefix: 'documents-' })
2327
+ * ```
2328
+ */
2329
+ async listIndexes(options = {}) {
2330
+ var _superprop_getListIndexes = () => super.listIndexes, _this6 = this;
2331
+ return _superprop_getListIndexes().call(_this6, _objectSpread2(_objectSpread2({}, options), {}, { vectorBucketName: _this6.vectorBucketName }));
2332
+ }
2333
+ /**
2334
+ *
2335
+ * @alpha
2336
+ *
2337
+ * Retrieves metadata for a specific index in this bucket
2338
+ * Convenience method that automatically includes the bucket name
2339
+ *
2340
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2341
+ *
2342
+ * @category Storage
2343
+ * @subcategory Vector Buckets
2344
+ * @param indexName - Name of the index to retrieve
2345
+ * @returns Promise with index metadata or error
2346
+ *
2347
+ * @example Get index metadata
2348
+ * ```typescript
2349
+ * const bucket = supabase.storage.vectors.from('embeddings-prod')
2350
+ * const { data } = await bucket.getIndex('documents-openai')
2351
+ * console.log('Dimension:', data?.index.dimension)
2352
+ * ```
2353
+ */
2354
+ async getIndex(indexName) {
2355
+ var _superprop_getGetIndex = () => super.getIndex, _this7 = this;
2356
+ return _superprop_getGetIndex().call(_this7, _this7.vectorBucketName, indexName);
2357
+ }
2358
+ /**
2359
+ *
2360
+ * @alpha
2361
+ *
2362
+ * Deletes an index from this bucket
2363
+ * Convenience method that automatically includes the bucket name
2364
+ *
2365
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2366
+ *
2367
+ * @category Storage
2368
+ * @subcategory Vector Buckets
2369
+ * @param indexName - Name of the index to delete
2370
+ * @returns Promise with empty response on success or error
2371
+ *
2372
+ * @example Delete an index
2373
+ * ```typescript
2374
+ * const bucket = supabase.storage.vectors.from('embeddings-prod')
2375
+ * await bucket.deleteIndex('old-index')
2376
+ * ```
2377
+ */
2378
+ async deleteIndex(indexName) {
2379
+ var _superprop_getDeleteIndex = () => super.deleteIndex, _this8 = this;
2380
+ return _superprop_getDeleteIndex().call(_this8, _this8.vectorBucketName, indexName);
2381
+ }
2382
+ /**
2383
+ *
2384
+ * @alpha
2385
+ *
2386
+ * Access operations for a specific index within this bucket
2387
+ * Returns a scoped client for vector data operations
2388
+ *
2389
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2390
+ *
2391
+ * @category Storage
2392
+ * @subcategory Vector Buckets
2393
+ * @param indexName - Name of the index
2394
+ * @returns Index-scoped client with vector data operations
2395
+ *
2396
+ * @example Accessing an index
2397
+ * ```typescript
2398
+ * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
2399
+ *
2400
+ * // Insert vectors
2401
+ * await index.putVectors({
2402
+ * vectors: [
2403
+ * { key: 'doc-1', data: { float32: [...] }, metadata: { title: 'Intro' } }
2404
+ * ]
2405
+ * })
2406
+ *
2407
+ * // Query similar vectors
2408
+ * const { data } = await index.queryVectors({
2409
+ * queryVector: { float32: [...] },
2410
+ * topK: 5
2411
+ * })
2412
+ * ```
2413
+ */
2414
+ index(indexName) {
2415
+ return new VectorIndexScope(this.url, this.headers, this.vectorBucketName, indexName, this.fetch);
2416
+ }
2417
+ };
2418
+ var VectorIndexScope = class extends VectorDataApi {
2419
+ /**
2420
+ *
2421
+ * @alpha
2422
+ *
2423
+ * Creates a helper that automatically scopes all vector operations to the provided bucket/index names.
2424
+ *
2425
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2426
+ *
2427
+ * @category Storage
2428
+ * @subcategory Vector Buckets
2429
+ * @example Creating a vector index scope
2430
+ * ```typescript
2431
+ * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
2432
+ * ```
2433
+ */
2434
+ constructor(url, headers, vectorBucketName, indexName, fetch$1) {
2435
+ super(url, headers, fetch$1);
2436
+ this.vectorBucketName = vectorBucketName;
2437
+ this.indexName = indexName;
2438
+ }
2439
+ /**
2440
+ *
2441
+ * @alpha
2442
+ *
2443
+ * Inserts or updates vectors in this index
2444
+ * Convenience method that automatically includes bucket and index names
2445
+ *
2446
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2447
+ *
2448
+ * @category Storage
2449
+ * @subcategory Vector Buckets
2450
+ * @param options - Vector insertion options (bucket and index names automatically set)
2451
+ * @returns Promise with empty response on success or error
2452
+ *
2453
+ * @example Insert vectors into an index
2454
+ * ```typescript
2455
+ * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
2456
+ * await index.putVectors({
2457
+ * vectors: [
2458
+ * {
2459
+ * key: 'doc-1',
2460
+ * data: { float32: [0.1, 0.2, ...] },
2461
+ * metadata: { title: 'Introduction', page: 1 }
2462
+ * }
2463
+ * ]
2464
+ * })
2465
+ * ```
2466
+ */
2467
+ async putVectors(options) {
2468
+ var _superprop_getPutVectors = () => super.putVectors, _this9 = this;
2469
+ return _superprop_getPutVectors().call(_this9, _objectSpread2(_objectSpread2({}, options), {}, {
2470
+ vectorBucketName: _this9.vectorBucketName,
2471
+ indexName: _this9.indexName
2472
+ }));
2473
+ }
2474
+ /**
2475
+ *
2476
+ * @alpha
2477
+ *
2478
+ * Retrieves vectors by keys from this index
2479
+ * Convenience method that automatically includes bucket and index names
2480
+ *
2481
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2482
+ *
2483
+ * @category Storage
2484
+ * @subcategory Vector Buckets
2485
+ * @param options - Vector retrieval options (bucket and index names automatically set)
2486
+ * @returns Promise with response containing vectors array or error
2487
+ *
2488
+ * @example Get vectors by keys
2489
+ * ```typescript
2490
+ * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
2491
+ * const { data } = await index.getVectors({
2492
+ * keys: ['doc-1', 'doc-2'],
2493
+ * returnMetadata: true
2494
+ * })
2495
+ * ```
2496
+ */
2497
+ async getVectors(options) {
2498
+ var _superprop_getGetVectors = () => super.getVectors, _this10 = this;
2499
+ return _superprop_getGetVectors().call(_this10, _objectSpread2(_objectSpread2({}, options), {}, {
2500
+ vectorBucketName: _this10.vectorBucketName,
2501
+ indexName: _this10.indexName
2502
+ }));
2503
+ }
2504
+ /**
2505
+ *
2506
+ * @alpha
2507
+ *
2508
+ * Lists vectors in this index with pagination
2509
+ * Convenience method that automatically includes bucket and index names
2510
+ *
2511
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2512
+ *
2513
+ * @category Storage
2514
+ * @subcategory Vector Buckets
2515
+ * @param options - Listing options (bucket and index names automatically set)
2516
+ * @returns Promise with response containing vectors array and pagination token or error
2517
+ *
2518
+ * @example List vectors with pagination
2519
+ * ```typescript
2520
+ * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
2521
+ * const { data } = await index.listVectors({
2522
+ * maxResults: 500,
2523
+ * returnMetadata: true
2524
+ * })
2525
+ * ```
2526
+ */
2527
+ async listVectors(options = {}) {
2528
+ var _superprop_getListVectors = () => super.listVectors, _this11 = this;
2529
+ return _superprop_getListVectors().call(_this11, _objectSpread2(_objectSpread2({}, options), {}, {
2530
+ vectorBucketName: _this11.vectorBucketName,
2531
+ indexName: _this11.indexName
2532
+ }));
2533
+ }
2534
+ /**
2535
+ *
2536
+ * @alpha
2537
+ *
2538
+ * Queries for similar vectors in this index
2539
+ * Convenience method that automatically includes bucket and index names
2540
+ *
2541
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2542
+ *
2543
+ * @category Storage
2544
+ * @subcategory Vector Buckets
2545
+ * @param options - Query options (bucket and index names automatically set)
2546
+ * @returns Promise with response containing matches array of similar vectors ordered by distance or error
2547
+ *
2548
+ * @example Query similar vectors
2549
+ * ```typescript
2550
+ * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
2551
+ * const { data } = await index.queryVectors({
2552
+ * queryVector: { float32: [0.1, 0.2, ...] },
2553
+ * topK: 5,
2554
+ * filter: { category: 'technical' },
2555
+ * returnDistance: true,
2556
+ * returnMetadata: true
2557
+ * })
2558
+ * ```
2559
+ */
2560
+ async queryVectors(options) {
2561
+ var _superprop_getQueryVectors = () => super.queryVectors, _this12 = this;
2562
+ return _superprop_getQueryVectors().call(_this12, _objectSpread2(_objectSpread2({}, options), {}, {
2563
+ vectorBucketName: _this12.vectorBucketName,
2564
+ indexName: _this12.indexName
2565
+ }));
2566
+ }
2567
+ /**
2568
+ *
2569
+ * @alpha
2570
+ *
2571
+ * Deletes vectors by keys from this index
2572
+ * Convenience method that automatically includes bucket and index names
2573
+ *
2574
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2575
+ *
2576
+ * @category Storage
2577
+ * @subcategory Vector Buckets
2578
+ * @param options - Deletion options (bucket and index names automatically set)
2579
+ * @returns Promise with empty response on success or error
2580
+ *
2581
+ * @example Delete vectors by keys
2582
+ * ```typescript
2583
+ * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
2584
+ * await index.deleteVectors({
2585
+ * keys: ['doc-1', 'doc-2', 'doc-3']
2586
+ * })
2587
+ * ```
2588
+ */
2589
+ async deleteVectors(options) {
2590
+ var _superprop_getDeleteVectors = () => super.deleteVectors, _this13 = this;
2591
+ return _superprop_getDeleteVectors().call(_this13, _objectSpread2(_objectSpread2({}, options), {}, {
2592
+ vectorBucketName: _this13.vectorBucketName,
2593
+ indexName: _this13.indexName
2594
+ }));
2595
+ }
2596
+ };
2597
+ var StorageClient = class extends StorageBucketApi {
2598
+ /**
2599
+ * Creates a client for Storage buckets, files, analytics, and vectors.
2600
+ *
2601
+ * @category Storage
2602
+ * @subcategory File Buckets
2603
+ *
2604
+ * @example Using supabase-js (recommended)
2605
+ * ```ts
2606
+ * import { createClient } from '@supabase/supabase-js'
2607
+ *
2608
+ * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')
2609
+ * const avatars = supabase.storage.from('avatars')
2610
+ * ```
2611
+ *
2612
+ * @example Standalone import for bundle-sensitive environments
2613
+ * ```ts
2614
+ * import { StorageClient } from '@supabase/storage-js'
2615
+ *
2616
+ * const storage = new StorageClient('https://xyzcompany.supabase.co/storage/v1', {
2617
+ * apikey: 'your-publishable-key',
2618
+ * })
2619
+ * const avatars = storage.from('avatars')
2620
+ * ```
2621
+ */
2622
+ constructor(url, headers = {}, fetch$1, opts) {
2623
+ super(url, headers, fetch$1, opts);
2624
+ }
2625
+ /**
2626
+ * Perform file operation in a bucket.
2627
+ *
2628
+ * @category Storage
2629
+ * @subcategory File Buckets
2630
+ *
2631
+ * @param id The bucket id to operate on.
2632
+ *
2633
+ * @example Accessing a bucket
2634
+ * ```typescript
2635
+ * const avatars = supabase.storage.from('avatars')
2636
+ * ```
2637
+ */
2638
+ from(id) {
2639
+ return new StorageFileApi(this.url, this.headers, id, this.fetch);
2640
+ }
2641
+ /**
2642
+ *
2643
+ * @alpha
2644
+ *
2645
+ * Access vector storage operations.
2646
+ *
2647
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2648
+ *
2649
+ * @category Storage
2650
+ * @subcategory Vector Buckets
2651
+ *
2652
+ * @returns A StorageVectorsClient instance configured with the current storage settings.
2653
+ */
2654
+ get vectors() {
2655
+ return new StorageVectorsClient(this.url + "/vector", {
2656
+ headers: this.headers,
2657
+ fetch: this.fetch
2658
+ });
2659
+ }
2660
+ /**
2661
+ *
2662
+ * @alpha
2663
+ *
2664
+ * Access analytics storage operations using Iceberg tables.
2665
+ *
2666
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2667
+ *
2668
+ * @category Storage
2669
+ * @subcategory Analytics Buckets
2670
+ *
2671
+ * @returns A StorageAnalyticsClient instance configured with the current storage settings.
2672
+ */
2673
+ get analytics() {
2674
+ return new StorageAnalyticsClient(this.url + "/iceberg", this.headers, this.fetch);
2675
+ }
2676
+ };
2677
+ export {
2678
+ StorageClient as S
2679
+ };