@eventmodelers/node-kit 0.0.2

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 (546) hide show
  1. package/README.md +66 -0
  2. package/package.json +36 -0
  3. package/src/cli.js +176 -0
  4. package/templates/.claude/skills/connect/SKILL.md +169 -0
  5. package/templates/.claude/skills/load-slice/SKILL.md +86 -0
  6. package/templates/realtime-agent/node_modules/.package-lock.json +107 -0
  7. package/templates/realtime-agent/node_modules/@supabase/auth-js/LICENSE +21 -0
  8. package/templates/realtime-agent/node_modules/@supabase/auth-js/README.md +190 -0
  9. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/AuthAdminApi.d.ts +4 -0
  10. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/AuthAdminApi.d.ts.map +1 -0
  11. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/AuthAdminApi.js +7 -0
  12. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/AuthAdminApi.js.map +1 -0
  13. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/AuthClient.d.ts +4 -0
  14. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/AuthClient.d.ts.map +1 -0
  15. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/AuthClient.js +7 -0
  16. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/AuthClient.js.map +1 -0
  17. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/GoTrueAdminApi.d.ts +716 -0
  18. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/GoTrueAdminApi.d.ts.map +1 -0
  19. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/GoTrueAdminApi.js +1108 -0
  20. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/GoTrueAdminApi.js.map +1 -0
  21. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/GoTrueClient.d.ts +2473 -0
  22. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/GoTrueClient.d.ts.map +1 -0
  23. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/GoTrueClient.js +5217 -0
  24. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/GoTrueClient.js.map +1 -0
  25. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/index.d.ts +9 -0
  26. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/index.d.ts.map +1 -0
  27. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/index.js +20 -0
  28. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/index.js.map +1 -0
  29. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/base64url.d.ts +76 -0
  30. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/base64url.d.ts.map +1 -0
  31. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/base64url.js +269 -0
  32. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/base64url.js.map +1 -0
  33. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/constants.d.ts +26 -0
  34. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/constants.d.ts.map +1 -0
  35. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/constants.js +31 -0
  36. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/constants.js.map +1 -0
  37. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/error-codes.d.ts +7 -0
  38. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/error-codes.d.ts.map +1 -0
  39. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/error-codes.js +3 -0
  40. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/error-codes.js.map +1 -0
  41. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/errors.d.ts +258 -0
  42. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/errors.d.ts.map +1 -0
  43. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/errors.js +290 -0
  44. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/errors.js.map +1 -0
  45. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/fetch.d.ts +54 -0
  46. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/fetch.d.ts.map +1 -0
  47. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/fetch.js +200 -0
  48. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/fetch.js.map +1 -0
  49. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/helpers.d.ts +94 -0
  50. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/helpers.d.ts.map +1 -0
  51. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/helpers.js +406 -0
  52. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/helpers.js.map +1 -0
  53. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/local-storage.d.ts +9 -0
  54. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/local-storage.d.ts.map +1 -0
  55. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/local-storage.js +21 -0
  56. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/local-storage.js.map +1 -0
  57. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/locks.d.ts +107 -0
  58. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/locks.d.ts.map +1 -0
  59. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/locks.js +349 -0
  60. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/locks.js.map +1 -0
  61. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/polyfills.d.ts +5 -0
  62. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/polyfills.d.ts.map +1 -0
  63. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/polyfills.js +29 -0
  64. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/polyfills.js.map +1 -0
  65. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/types.d.ts +2498 -0
  66. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/types.d.ts.map +1 -0
  67. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/types.js +23 -0
  68. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/types.js.map +1 -0
  69. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/version.d.ts +2 -0
  70. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/version.d.ts.map +1 -0
  71. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/version.js +11 -0
  72. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/version.js.map +1 -0
  73. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/web3/ethereum.d.ts +96 -0
  74. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/web3/ethereum.d.ts.map +1 -0
  75. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/web3/ethereum.js +66 -0
  76. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/web3/ethereum.js.map +1 -0
  77. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/web3/solana.d.ts +160 -0
  78. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/web3/solana.d.ts.map +1 -0
  79. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/web3/solana.js +4 -0
  80. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/web3/solana.js.map +1 -0
  81. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/webauthn.d.ts +284 -0
  82. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/webauthn.d.ts.map +1 -0
  83. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/webauthn.dom.d.ts +583 -0
  84. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/webauthn.dom.d.ts.map +1 -0
  85. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/webauthn.dom.js +4 -0
  86. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/webauthn.dom.js.map +1 -0
  87. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/webauthn.errors.d.ts +85 -0
  88. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/webauthn.errors.d.ts.map +1 -0
  89. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/webauthn.errors.js +272 -0
  90. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/webauthn.errors.js.map +1 -0
  91. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/webauthn.js +707 -0
  92. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/webauthn.js.map +1 -0
  93. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/AuthAdminApi.d.ts +4 -0
  94. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/AuthAdminApi.d.ts.map +1 -0
  95. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/AuthAdminApi.js +4 -0
  96. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/AuthAdminApi.js.map +1 -0
  97. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/AuthClient.d.ts +4 -0
  98. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/AuthClient.d.ts.map +1 -0
  99. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/AuthClient.js +4 -0
  100. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/AuthClient.js.map +1 -0
  101. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/GoTrueAdminApi.d.ts +716 -0
  102. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/GoTrueAdminApi.d.ts.map +1 -0
  103. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/GoTrueAdminApi.js +1105 -0
  104. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/GoTrueAdminApi.js.map +1 -0
  105. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/GoTrueClient.d.ts +2473 -0
  106. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/GoTrueClient.d.ts.map +1 -0
  107. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/GoTrueClient.js +5214 -0
  108. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/GoTrueClient.js.map +1 -0
  109. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/index.d.ts +9 -0
  110. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/index.d.ts.map +1 -0
  111. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/index.js +9 -0
  112. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/index.js.map +1 -0
  113. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/base64url.d.ts +76 -0
  114. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/base64url.d.ts.map +1 -0
  115. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/base64url.js +257 -0
  116. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/base64url.js.map +1 -0
  117. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/constants.d.ts +26 -0
  118. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/constants.d.ts.map +1 -0
  119. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/constants.js +28 -0
  120. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/constants.js.map +1 -0
  121. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/error-codes.d.ts +7 -0
  122. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/error-codes.d.ts.map +1 -0
  123. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/error-codes.js +2 -0
  124. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/error-codes.js.map +1 -0
  125. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/errors.d.ts +258 -0
  126. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/errors.d.ts.map +1 -0
  127. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/errors.js +267 -0
  128. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/errors.js.map +1 -0
  129. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/fetch.d.ts +54 -0
  130. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/fetch.d.ts.map +1 -0
  131. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/fetch.js +190 -0
  132. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/fetch.js.map +1 -0
  133. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/helpers.d.ts +94 -0
  134. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/helpers.d.ts.map +1 -0
  135. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/helpers.js +378 -0
  136. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/helpers.js.map +1 -0
  137. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/local-storage.d.ts +9 -0
  138. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/local-storage.d.ts.map +1 -0
  139. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/local-storage.js +18 -0
  140. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/local-storage.js.map +1 -0
  141. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/locks.d.ts +107 -0
  142. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/locks.d.ts.map +1 -0
  143. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/locks.js +341 -0
  144. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/locks.js.map +1 -0
  145. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/polyfills.d.ts +5 -0
  146. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/polyfills.d.ts.map +1 -0
  147. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/polyfills.js +26 -0
  148. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/polyfills.js.map +1 -0
  149. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/types.d.ts +2498 -0
  150. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/types.d.ts.map +1 -0
  151. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/types.js +20 -0
  152. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/types.js.map +1 -0
  153. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/version.d.ts +2 -0
  154. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/version.d.ts.map +1 -0
  155. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/version.js +8 -0
  156. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/version.js.map +1 -0
  157. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/web3/ethereum.d.ts +96 -0
  158. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/web3/ethereum.d.ts.map +1 -0
  159. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/web3/ethereum.js +60 -0
  160. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/web3/ethereum.js.map +1 -0
  161. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/web3/solana.d.ts +160 -0
  162. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/web3/solana.d.ts.map +1 -0
  163. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/web3/solana.js +3 -0
  164. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/web3/solana.js.map +1 -0
  165. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/webauthn.d.ts +284 -0
  166. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/webauthn.d.ts.map +1 -0
  167. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/webauthn.dom.d.ts +583 -0
  168. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/webauthn.dom.d.ts.map +1 -0
  169. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/webauthn.dom.js +3 -0
  170. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/webauthn.dom.js.map +1 -0
  171. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/webauthn.errors.d.ts +85 -0
  172. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/webauthn.errors.d.ts.map +1 -0
  173. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/webauthn.errors.js +264 -0
  174. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/webauthn.errors.js.map +1 -0
  175. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/webauthn.js +689 -0
  176. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/webauthn.js.map +1 -0
  177. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/tsconfig.module.tsbuildinfo +1 -0
  178. package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/tsconfig.tsbuildinfo +1 -0
  179. package/templates/realtime-agent/node_modules/@supabase/auth-js/package.json +44 -0
  180. package/templates/realtime-agent/node_modules/@supabase/auth-js/src/AuthAdminApi.ts +5 -0
  181. package/templates/realtime-agent/node_modules/@supabase/auth-js/src/AuthClient.ts +5 -0
  182. package/templates/realtime-agent/node_modules/@supabase/auth-js/src/GoTrueAdminApi.ts +1267 -0
  183. package/templates/realtime-agent/node_modules/@supabase/auth-js/src/GoTrueClient.ts +6360 -0
  184. package/templates/realtime-agent/node_modules/@supabase/auth-js/src/index.ts +13 -0
  185. package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/base64url.ts +308 -0
  186. package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/constants.ts +34 -0
  187. package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/error-codes.ts +90 -0
  188. package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/errors.ts +359 -0
  189. package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/fetch.ts +320 -0
  190. package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/helpers.ts +476 -0
  191. package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/local-storage.ts +21 -0
  192. package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/locks.ts +420 -0
  193. package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/polyfills.ts +23 -0
  194. package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/types.ts +2917 -0
  195. package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/version.ts +7 -0
  196. package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/web3/ethereum.ts +184 -0
  197. package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/web3/solana.ts +186 -0
  198. package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/webauthn.dom.ts +636 -0
  199. package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/webauthn.errors.ts +329 -0
  200. package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/webauthn.ts +946 -0
  201. package/templates/realtime-agent/node_modules/@supabase/functions-js/README.md +134 -0
  202. package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/FunctionsClient.d.ts +177 -0
  203. package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/FunctionsClient.d.ts.map +1 -0
  204. package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/FunctionsClient.js +309 -0
  205. package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/FunctionsClient.js.map +1 -0
  206. package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/helper.d.ts +3 -0
  207. package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/helper.d.ts.map +1 -0
  208. package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/helper.js +11 -0
  209. package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/helper.js.map +1 -0
  210. package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/index.d.ts +3 -0
  211. package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/index.d.ts.map +1 -0
  212. package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/index.js +12 -0
  213. package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/index.js.map +1 -0
  214. package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/types.d.ts +122 -0
  215. package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/types.d.ts.map +1 -0
  216. package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/types.js +98 -0
  217. package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/types.js.map +1 -0
  218. package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/version.d.ts +2 -0
  219. package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/version.d.ts.map +1 -0
  220. package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/version.js +11 -0
  221. package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/version.js.map +1 -0
  222. package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/FunctionsClient.d.ts +177 -0
  223. package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/FunctionsClient.d.ts.map +1 -0
  224. package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/FunctionsClient.js +305 -0
  225. package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/FunctionsClient.js.map +1 -0
  226. package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/helper.d.ts +3 -0
  227. package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/helper.d.ts.map +1 -0
  228. package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/helper.js +7 -0
  229. package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/helper.js.map +1 -0
  230. package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/index.d.ts +3 -0
  231. package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/index.d.ts.map +1 -0
  232. package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/index.js +3 -0
  233. package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/index.js.map +1 -0
  234. package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/types.d.ts +122 -0
  235. package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/types.d.ts.map +1 -0
  236. package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/types.js +91 -0
  237. package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/types.js.map +1 -0
  238. package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/version.d.ts +2 -0
  239. package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/version.d.ts.map +1 -0
  240. package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/version.js +8 -0
  241. package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/version.js.map +1 -0
  242. package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/tsconfig.module.tsbuildinfo +1 -0
  243. package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/tsconfig.tsbuildinfo +1 -0
  244. package/templates/realtime-agent/node_modules/@supabase/functions-js/package.json +52 -0
  245. package/templates/realtime-agent/node_modules/@supabase/functions-js/src/FunctionsClient.ts +335 -0
  246. package/templates/realtime-agent/node_modules/@supabase/functions-js/src/edge-runtime.d.ts +214 -0
  247. package/templates/realtime-agent/node_modules/@supabase/functions-js/src/helper.ts +8 -0
  248. package/templates/realtime-agent/node_modules/@supabase/functions-js/src/index.ts +10 -0
  249. package/templates/realtime-agent/node_modules/@supabase/functions-js/src/types.ts +146 -0
  250. package/templates/realtime-agent/node_modules/@supabase/functions-js/src/version.ts +7 -0
  251. package/templates/realtime-agent/node_modules/@supabase/phoenix/LICENSE.md +22 -0
  252. package/templates/realtime-agent/node_modules/@supabase/phoenix/README.md +121 -0
  253. package/templates/realtime-agent/node_modules/@supabase/phoenix/assets/js/phoenix/ajax.js +116 -0
  254. package/templates/realtime-agent/node_modules/@supabase/phoenix/assets/js/phoenix/channel.js +331 -0
  255. package/templates/realtime-agent/node_modules/@supabase/phoenix/assets/js/phoenix/constants.js +35 -0
  256. package/templates/realtime-agent/node_modules/@supabase/phoenix/assets/js/phoenix/index.js +212 -0
  257. package/templates/realtime-agent/node_modules/@supabase/phoenix/assets/js/phoenix/longpoll.js +192 -0
  258. package/templates/realtime-agent/node_modules/@supabase/phoenix/assets/js/phoenix/presence.js +208 -0
  259. package/templates/realtime-agent/node_modules/@supabase/phoenix/assets/js/phoenix/push.js +134 -0
  260. package/templates/realtime-agent/node_modules/@supabase/phoenix/assets/js/phoenix/serializer.js +133 -0
  261. package/templates/realtime-agent/node_modules/@supabase/phoenix/assets/js/phoenix/socket.js +756 -0
  262. package/templates/realtime-agent/node_modules/@supabase/phoenix/assets/js/phoenix/timer.js +48 -0
  263. package/templates/realtime-agent/node_modules/@supabase/phoenix/assets/js/phoenix/types.js +184 -0
  264. package/templates/realtime-agent/node_modules/@supabase/phoenix/assets/js/phoenix/utils.js +16 -0
  265. package/templates/realtime-agent/node_modules/@supabase/phoenix/package.json +58 -0
  266. package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/favicon.ico +0 -0
  267. package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/phoenix-orange.png +0 -0
  268. package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/phoenix.cjs.js +1825 -0
  269. package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/phoenix.cjs.js.map +7 -0
  270. package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/phoenix.js +1847 -0
  271. package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/phoenix.min.js +2 -0
  272. package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/phoenix.mjs +1802 -0
  273. package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/phoenix.mjs.map +7 -0
  274. package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/phoenix.png +0 -0
  275. package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/ajax.d.ts +10 -0
  276. package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/ajax.d.ts.map +1 -0
  277. package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/channel.d.ts +167 -0
  278. package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/channel.d.ts.map +1 -0
  279. package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/constants.d.ts +36 -0
  280. package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/constants.d.ts.map +1 -0
  281. package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/index.d.ts +10 -0
  282. package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/index.d.ts.map +1 -0
  283. package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/longpoll.d.ts +29 -0
  284. package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/longpoll.d.ts.map +1 -0
  285. package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/presence.d.ts +107 -0
  286. package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/presence.d.ts.map +1 -0
  287. package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/push.d.ts +70 -0
  288. package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/push.d.ts.map +1 -0
  289. package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/serializer.d.ts +74 -0
  290. package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/serializer.d.ts.map +1 -0
  291. package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/socket.d.ts +291 -0
  292. package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/socket.d.ts.map +1 -0
  293. package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/timer.d.ts +36 -0
  294. package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/timer.d.ts.map +1 -0
  295. package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/types.d.ts +280 -0
  296. package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/types.d.ts.map +1 -0
  297. package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/utils.d.ts +2 -0
  298. package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/utils.d.ts.map +1 -0
  299. package/templates/realtime-agent/node_modules/@supabase/phoenix/tsconfig.json +20 -0
  300. package/templates/realtime-agent/node_modules/@supabase/postgrest-js/README.md +213 -0
  301. package/templates/realtime-agent/node_modules/@supabase/postgrest-js/dist/index.cjs +5025 -0
  302. package/templates/realtime-agent/node_modules/@supabase/postgrest-js/dist/index.cjs.map +1 -0
  303. package/templates/realtime-agent/node_modules/@supabase/postgrest-js/dist/index.d.cts +3828 -0
  304. package/templates/realtime-agent/node_modules/@supabase/postgrest-js/dist/index.d.cts.map +1 -0
  305. package/templates/realtime-agent/node_modules/@supabase/postgrest-js/dist/index.d.mts +3828 -0
  306. package/templates/realtime-agent/node_modules/@supabase/postgrest-js/dist/index.d.mts.map +1 -0
  307. package/templates/realtime-agent/node_modules/@supabase/postgrest-js/dist/index.mjs +5017 -0
  308. package/templates/realtime-agent/node_modules/@supabase/postgrest-js/dist/index.mjs.map +1 -0
  309. package/templates/realtime-agent/node_modules/@supabase/postgrest-js/package.json +69 -0
  310. package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/PostgrestBuilder.ts +688 -0
  311. package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/PostgrestClient.ts +447 -0
  312. package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/PostgrestError.ts +41 -0
  313. package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/PostgrestFilterBuilder.ts +2137 -0
  314. package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/PostgrestQueryBuilder.ts +1703 -0
  315. package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/PostgrestTransformBuilder.ts +981 -0
  316. package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/constants.ts +2 -0
  317. package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/index.ts +34 -0
  318. package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/select-query-parser/parser.ts +476 -0
  319. package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/select-query-parser/result.ts +550 -0
  320. package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/select-query-parser/types.ts +129 -0
  321. package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/select-query-parser/utils.ts +704 -0
  322. package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/types/common/common.ts +83 -0
  323. package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/types/common/rpc.ts +148 -0
  324. package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/types/feature-flags.ts +17 -0
  325. package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/types/types.ts +161 -0
  326. package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/version.ts +7 -0
  327. package/templates/realtime-agent/node_modules/@supabase/realtime-js/README.md +326 -0
  328. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/RealtimeChannel.d.ts +442 -0
  329. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/RealtimeChannel.d.ts.map +1 -0
  330. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/RealtimeChannel.js +719 -0
  331. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/RealtimeChannel.js.map +1 -0
  332. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/RealtimeClient.d.ts +275 -0
  333. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/RealtimeClient.d.ts.map +1 -0
  334. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/RealtimeClient.js +697 -0
  335. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/RealtimeClient.js.map +1 -0
  336. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/RealtimePresence.d.ts +62 -0
  337. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/RealtimePresence.d.ts.map +1 -0
  338. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/RealtimePresence.js +43 -0
  339. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/RealtimePresence.js.map +1 -0
  340. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/index.d.ts +6 -0
  341. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/index.d.ts.map +1 -0
  342. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/index.js +18 -0
  343. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/index.js.map +1 -0
  344. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/constants.d.ts +43 -0
  345. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/constants.d.ts.map +1 -0
  346. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/constants.js +43 -0
  347. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/constants.js.map +1 -0
  348. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/normalizeChannelError.d.ts +10 -0
  349. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/normalizeChannelError.d.ts.map +1 -0
  350. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/normalizeChannelError.js +29 -0
  351. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/normalizeChannelError.js.map +1 -0
  352. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/serializer.d.ts +33 -0
  353. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/serializer.d.ts.map +1 -0
  354. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/serializer.js +155 -0
  355. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/serializer.js.map +1 -0
  356. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/transformers.d.ts +109 -0
  357. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/transformers.d.ts.map +1 -0
  358. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/transformers.js +241 -0
  359. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/transformers.js.map +1 -0
  360. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/version.d.ts +2 -0
  361. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/version.d.ts.map +1 -0
  362. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/version.js +11 -0
  363. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/version.js.map +1 -0
  364. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/websocket-factory.d.ts +82 -0
  365. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/websocket-factory.d.ts.map +1 -0
  366. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/websocket-factory.js +130 -0
  367. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/websocket-factory.js.map +1 -0
  368. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/channelAdapter.d.ts +32 -0
  369. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/channelAdapter.d.ts.map +1 -0
  370. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/channelAdapter.js +103 -0
  371. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/channelAdapter.js.map +1 -0
  372. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/presenceAdapter.d.ts +53 -0
  373. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/presenceAdapter.d.ts.map +1 -0
  374. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/presenceAdapter.js +93 -0
  375. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/presenceAdapter.js.map +1 -0
  376. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/socketAdapter.d.ts +38 -0
  377. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/socketAdapter.d.ts.map +1 -0
  378. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/socketAdapter.js +114 -0
  379. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/socketAdapter.js.map +1 -0
  380. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/types.d.ts +5 -0
  381. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/types.d.ts.map +1 -0
  382. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/types.js +3 -0
  383. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/types.js.map +1 -0
  384. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/RealtimeChannel.d.ts +442 -0
  385. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/RealtimeChannel.d.ts.map +1 -0
  386. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/RealtimeChannel.js +714 -0
  387. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/RealtimeChannel.js.map +1 -0
  388. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/RealtimeClient.d.ts +275 -0
  389. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/RealtimeClient.d.ts.map +1 -0
  390. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/RealtimeClient.js +693 -0
  391. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/RealtimeClient.js.map +1 -0
  392. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/RealtimePresence.d.ts +62 -0
  393. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/RealtimePresence.d.ts.map +1 -0
  394. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/RealtimePresence.js +38 -0
  395. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/RealtimePresence.js.map +1 -0
  396. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/index.d.ts +6 -0
  397. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/index.d.ts.map +1 -0
  398. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/index.js +6 -0
  399. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/index.js.map +1 -0
  400. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/constants.d.ts +43 -0
  401. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/constants.d.ts.map +1 -0
  402. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/constants.js +40 -0
  403. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/constants.js.map +1 -0
  404. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/normalizeChannelError.d.ts +10 -0
  405. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/normalizeChannelError.d.ts.map +1 -0
  406. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/normalizeChannelError.js +26 -0
  407. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/normalizeChannelError.js.map +1 -0
  408. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/serializer.d.ts +33 -0
  409. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/serializer.d.ts.map +1 -0
  410. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/serializer.js +152 -0
  411. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/serializer.js.map +1 -0
  412. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/transformers.d.ts +109 -0
  413. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/transformers.d.ts.map +1 -0
  414. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/transformers.js +229 -0
  415. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/transformers.js.map +1 -0
  416. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/version.d.ts +2 -0
  417. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/version.d.ts.map +1 -0
  418. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/version.js +8 -0
  419. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/version.js.map +1 -0
  420. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/websocket-factory.d.ts +82 -0
  421. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/websocket-factory.d.ts.map +1 -0
  422. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/websocket-factory.js +126 -0
  423. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/websocket-factory.js.map +1 -0
  424. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/channelAdapter.d.ts +32 -0
  425. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/channelAdapter.d.ts.map +1 -0
  426. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/channelAdapter.js +100 -0
  427. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/channelAdapter.js.map +1 -0
  428. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/presenceAdapter.d.ts +53 -0
  429. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/presenceAdapter.d.ts.map +1 -0
  430. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/presenceAdapter.js +90 -0
  431. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/presenceAdapter.js.map +1 -0
  432. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/socketAdapter.d.ts +38 -0
  433. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/socketAdapter.d.ts.map +1 -0
  434. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/socketAdapter.js +111 -0
  435. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/socketAdapter.js.map +1 -0
  436. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/types.d.ts +5 -0
  437. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/types.d.ts.map +1 -0
  438. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/types.js +2 -0
  439. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/types.js.map +1 -0
  440. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/tsconfig.module.tsbuildinfo +1 -0
  441. package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/tsconfig.tsbuildinfo +1 -0
  442. package/templates/realtime-agent/node_modules/@supabase/realtime-js/package.json +58 -0
  443. package/templates/realtime-agent/node_modules/@supabase/realtime-js/src/RealtimeChannel.ts +1118 -0
  444. package/templates/realtime-agent/node_modules/@supabase/realtime-js/src/RealtimeClient.ts +868 -0
  445. package/templates/realtime-agent/node_modules/@supabase/realtime-js/src/RealtimePresence.ts +71 -0
  446. package/templates/realtime-agent/node_modules/@supabase/realtime-js/src/index.ts +53 -0
  447. package/templates/realtime-agent/node_modules/@supabase/realtime-js/src/lib/constants.ts +62 -0
  448. package/templates/realtime-agent/node_modules/@supabase/realtime-js/src/lib/normalizeChannelError.ts +30 -0
  449. package/templates/realtime-agent/node_modules/@supabase/realtime-js/src/lib/serializer.ts +203 -0
  450. package/templates/realtime-agent/node_modules/@supabase/realtime-js/src/lib/transformers.ts +270 -0
  451. package/templates/realtime-agent/node_modules/@supabase/realtime-js/src/lib/version.ts +7 -0
  452. package/templates/realtime-agent/node_modules/@supabase/realtime-js/src/lib/websocket-factory.ts +204 -0
  453. package/templates/realtime-agent/node_modules/@supabase/realtime-js/src/phoenix/channelAdapter.ts +149 -0
  454. package/templates/realtime-agent/node_modules/@supabase/realtime-js/src/phoenix/presenceAdapter.ts +116 -0
  455. package/templates/realtime-agent/node_modules/@supabase/realtime-js/src/phoenix/socketAdapter.ts +168 -0
  456. package/templates/realtime-agent/node_modules/@supabase/realtime-js/src/phoenix/types.ts +32 -0
  457. package/templates/realtime-agent/node_modules/@supabase/storage-js/README.md +1262 -0
  458. package/templates/realtime-agent/node_modules/@supabase/storage-js/dist/index.cjs +2995 -0
  459. package/templates/realtime-agent/node_modules/@supabase/storage-js/dist/index.cjs.map +1 -0
  460. package/templates/realtime-agent/node_modules/@supabase/storage-js/dist/index.d.cts +2956 -0
  461. package/templates/realtime-agent/node_modules/@supabase/storage-js/dist/index.d.cts.map +1 -0
  462. package/templates/realtime-agent/node_modules/@supabase/storage-js/dist/index.d.mts +2956 -0
  463. package/templates/realtime-agent/node_modules/@supabase/storage-js/dist/index.d.mts.map +1 -0
  464. package/templates/realtime-agent/node_modules/@supabase/storage-js/dist/index.mjs +2979 -0
  465. package/templates/realtime-agent/node_modules/@supabase/storage-js/dist/index.mjs.map +1 -0
  466. package/templates/realtime-agent/node_modules/@supabase/storage-js/dist/umd/supabase.js +1 -0
  467. package/templates/realtime-agent/node_modules/@supabase/storage-js/package.json +62 -0
  468. package/templates/realtime-agent/node_modules/@supabase/storage-js/src/StorageClient.ts +98 -0
  469. package/templates/realtime-agent/node_modules/@supabase/storage-js/src/index.ts +19 -0
  470. package/templates/realtime-agent/node_modules/@supabase/storage-js/src/lib/common/BaseApiClient.ts +104 -0
  471. package/templates/realtime-agent/node_modules/@supabase/storage-js/src/lib/common/errors.ts +160 -0
  472. package/templates/realtime-agent/node_modules/@supabase/storage-js/src/lib/common/fetch.ts +303 -0
  473. package/templates/realtime-agent/node_modules/@supabase/storage-js/src/lib/common/headers.ts +43 -0
  474. package/templates/realtime-agent/node_modules/@supabase/storage-js/src/lib/common/helpers.ts +146 -0
  475. package/templates/realtime-agent/node_modules/@supabase/storage-js/src/lib/constants.ts +4 -0
  476. package/templates/realtime-agent/node_modules/@supabase/storage-js/src/lib/types.ts +654 -0
  477. package/templates/realtime-agent/node_modules/@supabase/storage-js/src/lib/version.ts +7 -0
  478. package/templates/realtime-agent/node_modules/@supabase/storage-js/src/packages/BlobDownloadBuilder.ts +62 -0
  479. package/templates/realtime-agent/node_modules/@supabase/storage-js/src/packages/StorageAnalyticsClient.ts +420 -0
  480. package/templates/realtime-agent/node_modules/@supabase/storage-js/src/packages/StorageBucketApi.ts +414 -0
  481. package/templates/realtime-agent/node_modules/@supabase/storage-js/src/packages/StorageFileApi.ts +1423 -0
  482. package/templates/realtime-agent/node_modules/@supabase/storage-js/src/packages/StorageVectorsClient.ts +644 -0
  483. package/templates/realtime-agent/node_modules/@supabase/storage-js/src/packages/StreamDownloadBuilder.ts +39 -0
  484. package/templates/realtime-agent/node_modules/@supabase/storage-js/src/packages/VectorBucketApi.ts +73 -0
  485. package/templates/realtime-agent/node_modules/@supabase/storage-js/src/packages/VectorDataApi.ts +98 -0
  486. package/templates/realtime-agent/node_modules/@supabase/storage-js/src/packages/VectorIndexApi.ts +90 -0
  487. package/templates/realtime-agent/node_modules/@supabase/supabase-js/README.md +238 -0
  488. package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/cors.cjs +89 -0
  489. package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/cors.cjs.map +1 -0
  490. package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/cors.d.cts +58 -0
  491. package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/cors.d.cts.map +1 -0
  492. package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/cors.d.mts +58 -0
  493. package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/cors.d.mts.map +1 -0
  494. package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/cors.mjs +88 -0
  495. package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/cors.mjs.map +1 -0
  496. package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/index.cjs +660 -0
  497. package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/index.cjs.map +1 -0
  498. package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/index.d.cts +616 -0
  499. package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/index.d.cts.map +1 -0
  500. package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/index.d.mts +616 -0
  501. package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/index.d.mts.map +1 -0
  502. package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/index.mjs +607 -0
  503. package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/index.mjs.map +1 -0
  504. package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/umd/supabase.js +24 -0
  505. package/templates/realtime-agent/node_modules/@supabase/supabase-js/package.json +122 -0
  506. package/templates/realtime-agent/node_modules/@supabase/supabase-js/src/SupabaseClient.ts +625 -0
  507. package/templates/realtime-agent/node_modules/@supabase/supabase-js/src/cors.ts +84 -0
  508. package/templates/realtime-agent/node_modules/@supabase/supabase-js/src/index.ts +106 -0
  509. package/templates/realtime-agent/node_modules/@supabase/supabase-js/src/lib/SupabaseAuthClient.ts +8 -0
  510. package/templates/realtime-agent/node_modules/@supabase/supabase-js/src/lib/constants.ts +35 -0
  511. package/templates/realtime-agent/node_modules/@supabase/supabase-js/src/lib/fetch.ts +36 -0
  512. package/templates/realtime-agent/node_modules/@supabase/supabase-js/src/lib/helpers.ts +98 -0
  513. package/templates/realtime-agent/node_modules/@supabase/supabase-js/src/lib/rest/types/common/common.ts +93 -0
  514. package/templates/realtime-agent/node_modules/@supabase/supabase-js/src/lib/rest/types/common/rpc.ts +158 -0
  515. package/templates/realtime-agent/node_modules/@supabase/supabase-js/src/lib/types.ts +196 -0
  516. package/templates/realtime-agent/node_modules/@supabase/supabase-js/src/lib/version.ts +7 -0
  517. package/templates/realtime-agent/node_modules/iceberg-js/LICENSE +21 -0
  518. package/templates/realtime-agent/node_modules/iceberg-js/README.md +439 -0
  519. package/templates/realtime-agent/node_modules/iceberg-js/dist/index.cjs +596 -0
  520. package/templates/realtime-agent/node_modules/iceberg-js/dist/index.cjs.map +1 -0
  521. package/templates/realtime-agent/node_modules/iceberg-js/dist/index.d.cts +547 -0
  522. package/templates/realtime-agent/node_modules/iceberg-js/dist/index.d.ts +547 -0
  523. package/templates/realtime-agent/node_modules/iceberg-js/dist/index.mjs +587 -0
  524. package/templates/realtime-agent/node_modules/iceberg-js/dist/index.mjs.map +1 -0
  525. package/templates/realtime-agent/node_modules/iceberg-js/package.json +77 -0
  526. package/templates/realtime-agent/node_modules/tslib/CopyrightNotice.txt +15 -0
  527. package/templates/realtime-agent/node_modules/tslib/LICENSE.txt +12 -0
  528. package/templates/realtime-agent/node_modules/tslib/README.md +164 -0
  529. package/templates/realtime-agent/node_modules/tslib/SECURITY.md +41 -0
  530. package/templates/realtime-agent/node_modules/tslib/modules/index.d.ts +38 -0
  531. package/templates/realtime-agent/node_modules/tslib/modules/index.js +70 -0
  532. package/templates/realtime-agent/node_modules/tslib/modules/package.json +3 -0
  533. package/templates/realtime-agent/node_modules/tslib/package.json +47 -0
  534. package/templates/realtime-agent/node_modules/tslib/tslib.d.ts +460 -0
  535. package/templates/realtime-agent/node_modules/tslib/tslib.es6.html +1 -0
  536. package/templates/realtime-agent/node_modules/tslib/tslib.es6.js +402 -0
  537. package/templates/realtime-agent/node_modules/tslib/tslib.es6.mjs +401 -0
  538. package/templates/realtime-agent/node_modules/tslib/tslib.html +1 -0
  539. package/templates/realtime-agent/node_modules/tslib/tslib.js +484 -0
  540. package/templates/realtime-agent/package-lock.json +114 -0
  541. package/templates/realtime-agent/package.json +11 -0
  542. package/templates/realtime-agent/src/index.js +152 -0
  543. package/templates/root/AGENT.md +37 -0
  544. package/templates/root/model.md +1 -0
  545. package/templates/root/prompt.md +91 -0
  546. package/templates/root/ralph.sh +47 -0
@@ -0,0 +1,5025 @@
1
+ Object.defineProperty(exports, '__esModule', { value: true });
2
+
3
+ //#region src/types/common/common.ts
4
+ /**
5
+ * Default number of retry attempts.
6
+ */
7
+ const DEFAULT_MAX_RETRIES = 3;
8
+ /**
9
+ * Default exponential backoff delay function.
10
+ * Delays: 1s, 2s, 4s, 8s, ... (max 30s)
11
+ *
12
+ * @param attemptIndex - Zero-based index of the retry attempt
13
+ * @returns Delay in milliseconds before the next retry
14
+ */
15
+ const getRetryDelay = (attemptIndex) => Math.min(1e3 * 2 ** attemptIndex, 3e4);
16
+ /**
17
+ * Status codes that are safe to retry.
18
+ * 520 = Cloudflare timeout/connection errors (transient)
19
+ * 503 = PostgREST schema cache not yet loaded (transient, signals retry via Retry-After header)
20
+ */
21
+ const RETRYABLE_STATUS_CODES = [520, 503];
22
+ /**
23
+ * HTTP methods that are safe to retry (idempotent operations).
24
+ */
25
+ const RETRYABLE_METHODS = [
26
+ "GET",
27
+ "HEAD",
28
+ "OPTIONS"
29
+ ];
30
+
31
+ //#endregion
32
+ //#region src/PostgrestError.ts
33
+ /**
34
+ * Error format
35
+ *
36
+ * {@link https://postgrest.org/en/stable/api.html?highlight=options#errors-and-http-status-codes}
37
+ */
38
+ var PostgrestError = class extends Error {
39
+ /**
40
+ * @example
41
+ * ```ts
42
+ * import PostgrestError from '@supabase/postgrest-js'
43
+ *
44
+ * throw new PostgrestError({
45
+ * message: 'Row level security prevented the request',
46
+ * details: 'RLS denied the insert',
47
+ * hint: 'Check your policies',
48
+ * code: 'PGRST301',
49
+ * })
50
+ * ```
51
+ */
52
+ constructor(context) {
53
+ super(context.message);
54
+ this.name = "PostgrestError";
55
+ this.details = context.details;
56
+ this.hint = context.hint;
57
+ this.code = context.code;
58
+ }
59
+ toJSON() {
60
+ return {
61
+ name: this.name,
62
+ message: this.message,
63
+ details: this.details,
64
+ hint: this.hint,
65
+ code: this.code
66
+ };
67
+ }
68
+ };
69
+
70
+ //#endregion
71
+ //#region src/PostgrestBuilder.ts
72
+ /**
73
+ * Sleep for a given number of milliseconds.
74
+ * If an AbortSignal is provided, the sleep resolves early when the signal is aborted.
75
+ */
76
+ function sleep(ms, signal) {
77
+ return new Promise((resolve) => {
78
+ if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
79
+ resolve();
80
+ return;
81
+ }
82
+ const id = setTimeout(() => {
83
+ signal === null || signal === void 0 || signal.removeEventListener("abort", onAbort);
84
+ resolve();
85
+ }, ms);
86
+ function onAbort() {
87
+ clearTimeout(id);
88
+ resolve();
89
+ }
90
+ signal === null || signal === void 0 || signal.addEventListener("abort", onAbort);
91
+ });
92
+ }
93
+ /**
94
+ * Check if a request should be retried based on method and status code.
95
+ */
96
+ function shouldRetry(method, status, attemptCount, retryEnabled) {
97
+ if (!retryEnabled || attemptCount >= DEFAULT_MAX_RETRIES) return false;
98
+ if (!RETRYABLE_METHODS.includes(method)) return false;
99
+ if (!RETRYABLE_STATUS_CODES.includes(status)) return false;
100
+ return true;
101
+ }
102
+ var PostgrestBuilder = class {
103
+ /**
104
+ * Creates a builder configured for a specific PostgREST request.
105
+ *
106
+ * @example Using supabase-js (recommended)
107
+ * ```ts
108
+ * import { createClient } from '@supabase/supabase-js'
109
+ *
110
+ * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')
111
+ * const { data, error } = await supabase.from('users').select('*')
112
+ * ```
113
+ *
114
+ * @category Database
115
+ *
116
+ * @example Standalone import for bundle-sensitive environments
117
+ * ```ts
118
+ * import { PostgrestQueryBuilder } from '@supabase/postgrest-js'
119
+ *
120
+ * const builder = new PostgrestQueryBuilder(
121
+ * new URL('https://xyzcompany.supabase.co/rest/v1/users'),
122
+ * { headers: new Headers({ apikey: 'your-publishable-key' }) }
123
+ * )
124
+ * ```
125
+ */
126
+ constructor(builder) {
127
+ var _builder$shouldThrowO, _builder$isMaybeSingl, _builder$shouldStripN, _builder$urlLengthLim, _builder$retry;
128
+ this.shouldThrowOnError = false;
129
+ this.retryEnabled = true;
130
+ this.method = builder.method;
131
+ this.url = builder.url;
132
+ this.headers = new Headers(builder.headers);
133
+ this.schema = builder.schema;
134
+ this.body = builder.body;
135
+ this.shouldThrowOnError = (_builder$shouldThrowO = builder.shouldThrowOnError) !== null && _builder$shouldThrowO !== void 0 ? _builder$shouldThrowO : false;
136
+ this.signal = builder.signal;
137
+ this.isMaybeSingle = (_builder$isMaybeSingl = builder.isMaybeSingle) !== null && _builder$isMaybeSingl !== void 0 ? _builder$isMaybeSingl : false;
138
+ this.shouldStripNulls = (_builder$shouldStripN = builder.shouldStripNulls) !== null && _builder$shouldStripN !== void 0 ? _builder$shouldStripN : false;
139
+ this.urlLengthLimit = (_builder$urlLengthLim = builder.urlLengthLimit) !== null && _builder$urlLengthLim !== void 0 ? _builder$urlLengthLim : 8e3;
140
+ this.retryEnabled = (_builder$retry = builder.retry) !== null && _builder$retry !== void 0 ? _builder$retry : true;
141
+ if (builder.fetch) this.fetch = builder.fetch;
142
+ else this.fetch = fetch;
143
+ }
144
+ /**
145
+ * If there's an error with the query, throwOnError will reject the promise by
146
+ * throwing the error instead of returning it as part of a successful response.
147
+ *
148
+ * {@link https://github.com/supabase/supabase-js/issues/92}
149
+ *
150
+ * @category Database
151
+ */
152
+ throwOnError() {
153
+ this.shouldThrowOnError = true;
154
+ return this;
155
+ }
156
+ /**
157
+ * Strip null values from the response data. Properties with `null` values
158
+ * will be omitted from the returned JSON objects.
159
+ *
160
+ * Requires PostgREST 11.2.0+.
161
+ *
162
+ * {@link https://docs.postgrest.org/en/stable/references/api/resource_representation.html#stripped-nulls}
163
+ *
164
+ * @category Database
165
+ * @subcategory Using modifiers
166
+ *
167
+ * @example With `select()`
168
+ * ```ts
169
+ * const { data, error } = await supabase
170
+ * .from('characters')
171
+ * .select()
172
+ * .stripNulls()
173
+ * ```
174
+ *
175
+ * @exampleSql With `select()`
176
+ * ```sql
177
+ * create table
178
+ * characters (id int8 primary key, name text, bio text);
179
+ *
180
+ * insert into
181
+ * characters (id, name, bio)
182
+ * values
183
+ * (1, 'Luke', null),
184
+ * (2, 'Leia', 'Princess of Alderaan');
185
+ * ```
186
+ *
187
+ * @exampleResponse With `select()`
188
+ * ```json
189
+ * {
190
+ * "data": [
191
+ * {
192
+ * "id": 1,
193
+ * "name": "Luke"
194
+ * },
195
+ * {
196
+ * "id": 2,
197
+ * "name": "Leia",
198
+ * "bio": "Princess of Alderaan"
199
+ * }
200
+ * ],
201
+ * "status": 200,
202
+ * "statusText": "OK"
203
+ * }
204
+ * ```
205
+ */
206
+ stripNulls() {
207
+ if (this.headers.get("Accept") === "text/csv") throw new Error("stripNulls() cannot be used with csv()");
208
+ this.shouldStripNulls = true;
209
+ return this;
210
+ }
211
+ /**
212
+ * Set an HTTP header for the request.
213
+ *
214
+ * @category Database
215
+ */
216
+ setHeader(name, value) {
217
+ this.headers = new Headers(this.headers);
218
+ this.headers.set(name, value);
219
+ return this;
220
+ }
221
+ /**
222
+ * @category Database
223
+ *
224
+ * Configure retry behavior for this request.
225
+ *
226
+ * By default, retries are enabled for idempotent requests (GET, HEAD, OPTIONS)
227
+ * that fail with network errors or specific HTTP status codes (503, 520).
228
+ * Retries use exponential backoff (1s, 2s, 4s) with a maximum of 3 attempts.
229
+ *
230
+ * @param enabled - Whether to enable retries for this request
231
+ *
232
+ * @example
233
+ * ```ts
234
+ * // Disable retries for a specific query
235
+ * const { data, error } = await supabase
236
+ * .from('users')
237
+ * .select()
238
+ * .retry(false)
239
+ * ```
240
+ */
241
+ retry(enabled) {
242
+ this.retryEnabled = enabled;
243
+ return this;
244
+ }
245
+ then(onfulfilled, onrejected) {
246
+ var _this = this;
247
+ if (this.schema === void 0) {} else if (["GET", "HEAD"].includes(this.method)) this.headers.set("Accept-Profile", this.schema);
248
+ else this.headers.set("Content-Profile", this.schema);
249
+ if (this.method !== "GET" && this.method !== "HEAD") this.headers.set("Content-Type", "application/json");
250
+ if (this.shouldStripNulls) {
251
+ const currentAccept = this.headers.get("Accept");
252
+ if (currentAccept === "application/vnd.pgrst.object+json") this.headers.set("Accept", "application/vnd.pgrst.object+json;nulls=stripped");
253
+ else if (!currentAccept || currentAccept === "application/json") this.headers.set("Accept", "application/vnd.pgrst.array+json;nulls=stripped");
254
+ }
255
+ const _fetch = this.fetch;
256
+ const executeWithRetry = async () => {
257
+ let attemptCount = 0;
258
+ while (true) {
259
+ const requestHeaders = new Headers(_this.headers);
260
+ if (attemptCount > 0) requestHeaders.set("X-Retry-Count", String(attemptCount));
261
+ let res$1;
262
+ try {
263
+ res$1 = await _fetch(_this.url.toString(), {
264
+ method: _this.method,
265
+ headers: requestHeaders,
266
+ body: JSON.stringify(_this.body, (_, value) => typeof value === "bigint" ? value.toString() : value),
267
+ signal: _this.signal
268
+ });
269
+ } catch (fetchError) {
270
+ if ((fetchError === null || fetchError === void 0 ? void 0 : fetchError.name) === "AbortError" || (fetchError === null || fetchError === void 0 ? void 0 : fetchError.code) === "ABORT_ERR") throw fetchError;
271
+ if (!RETRYABLE_METHODS.includes(_this.method)) throw fetchError;
272
+ if (_this.retryEnabled && attemptCount < DEFAULT_MAX_RETRIES) {
273
+ const delay = getRetryDelay(attemptCount);
274
+ attemptCount++;
275
+ await sleep(delay, _this.signal);
276
+ continue;
277
+ }
278
+ throw fetchError;
279
+ }
280
+ if (shouldRetry(_this.method, res$1.status, attemptCount, _this.retryEnabled)) {
281
+ var _res$headers$get, _res$headers;
282
+ const retryAfterHeader = (_res$headers$get = (_res$headers = res$1.headers) === null || _res$headers === void 0 ? void 0 : _res$headers.get("Retry-After")) !== null && _res$headers$get !== void 0 ? _res$headers$get : null;
283
+ const delay = retryAfterHeader !== null ? Math.max(0, parseInt(retryAfterHeader, 10) || 0) * 1e3 : getRetryDelay(attemptCount);
284
+ await res$1.text();
285
+ attemptCount++;
286
+ await sleep(delay, _this.signal);
287
+ continue;
288
+ }
289
+ return await _this.processResponse(res$1);
290
+ }
291
+ };
292
+ let res = executeWithRetry();
293
+ if (!this.shouldThrowOnError) res = res.catch((fetchError) => {
294
+ var _fetchError$name2;
295
+ let errorDetails = "";
296
+ let hint = "";
297
+ let code = "";
298
+ const cause = fetchError === null || fetchError === void 0 ? void 0 : fetchError.cause;
299
+ if (cause) {
300
+ var _cause$message, _cause$code, _fetchError$name, _cause$name;
301
+ const causeMessage = (_cause$message = cause === null || cause === void 0 ? void 0 : cause.message) !== null && _cause$message !== void 0 ? _cause$message : "";
302
+ const causeCode = (_cause$code = cause === null || cause === void 0 ? void 0 : cause.code) !== null && _cause$code !== void 0 ? _cause$code : "";
303
+ errorDetails = `${(_fetchError$name = fetchError === null || fetchError === void 0 ? void 0 : fetchError.name) !== null && _fetchError$name !== void 0 ? _fetchError$name : "FetchError"}: ${fetchError === null || fetchError === void 0 ? void 0 : fetchError.message}`;
304
+ errorDetails += `\n\nCaused by: ${(_cause$name = cause === null || cause === void 0 ? void 0 : cause.name) !== null && _cause$name !== void 0 ? _cause$name : "Error"}: ${causeMessage}`;
305
+ if (causeCode) errorDetails += ` (${causeCode})`;
306
+ if (cause === null || cause === void 0 ? void 0 : cause.stack) errorDetails += `\n${cause.stack}`;
307
+ } else {
308
+ var _fetchError$stack;
309
+ errorDetails = (_fetchError$stack = fetchError === null || fetchError === void 0 ? void 0 : fetchError.stack) !== null && _fetchError$stack !== void 0 ? _fetchError$stack : "";
310
+ }
311
+ const urlLength = this.url.toString().length;
312
+ if ((fetchError === null || fetchError === void 0 ? void 0 : fetchError.name) === "AbortError" || (fetchError === null || fetchError === void 0 ? void 0 : fetchError.code) === "ABORT_ERR") {
313
+ code = "";
314
+ hint = "Request was aborted (timeout or manual cancellation)";
315
+ if (urlLength > this.urlLengthLimit) hint += `. Note: Your request URL is ${urlLength} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`;
316
+ } else if ((cause === null || cause === void 0 ? void 0 : cause.name) === "HeadersOverflowError" || (cause === null || cause === void 0 ? void 0 : cause.code) === "UND_ERR_HEADERS_OVERFLOW") {
317
+ code = "";
318
+ hint = "HTTP headers exceeded server limits (typically 16KB)";
319
+ if (urlLength > this.urlLengthLimit) hint += `. Your request URL is ${urlLength} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`;
320
+ }
321
+ return {
322
+ success: false,
323
+ error: {
324
+ message: `${(_fetchError$name2 = fetchError === null || fetchError === void 0 ? void 0 : fetchError.name) !== null && _fetchError$name2 !== void 0 ? _fetchError$name2 : "FetchError"}: ${fetchError === null || fetchError === void 0 ? void 0 : fetchError.message}`,
325
+ details: errorDetails,
326
+ hint,
327
+ code
328
+ },
329
+ data: null,
330
+ count: null,
331
+ status: 0,
332
+ statusText: ""
333
+ };
334
+ });
335
+ return res.then(onfulfilled, onrejected);
336
+ }
337
+ /**
338
+ * Process a fetch response and return the standardized postgrest response.
339
+ */
340
+ async processResponse(res) {
341
+ var _this2 = this;
342
+ let error = null;
343
+ let data = null;
344
+ let count = null;
345
+ let status = res.status;
346
+ let statusText = res.statusText;
347
+ if (res.ok) {
348
+ var _this$headers$get2, _res$headers$get2;
349
+ if (_this2.method !== "HEAD") {
350
+ var _this$headers$get;
351
+ const body = await res.text();
352
+ if (body === "") {} else if (_this2.headers.get("Accept") === "text/csv") data = body;
353
+ else if (_this2.headers.get("Accept") && ((_this$headers$get = _this2.headers.get("Accept")) === null || _this$headers$get === void 0 ? void 0 : _this$headers$get.includes("application/vnd.pgrst.plan+text"))) data = body;
354
+ else data = JSON.parse(body);
355
+ }
356
+ const countHeader = (_this$headers$get2 = _this2.headers.get("Prefer")) === null || _this$headers$get2 === void 0 ? void 0 : _this$headers$get2.match(/count=(exact|planned|estimated)/);
357
+ const contentRange = (_res$headers$get2 = res.headers.get("content-range")) === null || _res$headers$get2 === void 0 ? void 0 : _res$headers$get2.split("/");
358
+ if (countHeader && contentRange && contentRange.length > 1) count = parseInt(contentRange[1]);
359
+ if (_this2.isMaybeSingle && Array.isArray(data)) if (data.length > 1) {
360
+ error = {
361
+ code: "PGRST116",
362
+ details: `Results contain ${data.length} rows, application/vnd.pgrst.object+json requires 1 row`,
363
+ hint: null,
364
+ message: "JSON object requested, multiple (or no) rows returned"
365
+ };
366
+ data = null;
367
+ count = null;
368
+ status = 406;
369
+ statusText = "Not Acceptable";
370
+ } else if (data.length === 1) data = data[0];
371
+ else data = null;
372
+ } else {
373
+ const body = await res.text();
374
+ try {
375
+ error = JSON.parse(body);
376
+ if (Array.isArray(error) && res.status === 404) {
377
+ data = [];
378
+ error = null;
379
+ status = 200;
380
+ statusText = "OK";
381
+ }
382
+ } catch (_unused) {
383
+ if (res.status === 404 && body === "") {
384
+ status = 204;
385
+ statusText = "No Content";
386
+ } else error = { message: body };
387
+ }
388
+ if (error && _this2.shouldThrowOnError) throw new PostgrestError(error);
389
+ }
390
+ return {
391
+ success: error === null,
392
+ error,
393
+ data,
394
+ count,
395
+ status,
396
+ statusText
397
+ };
398
+ }
399
+ /**
400
+ * Override the type of the returned `data`.
401
+ *
402
+ * @typeParam NewResult - The new result type to override with
403
+ * @deprecated Use overrideTypes<yourType, { merge: false }>() method at the end of your call chain instead
404
+ *
405
+ * @category Database
406
+ */
407
+ returns() {
408
+ /* istanbul ignore next */
409
+ return this;
410
+ }
411
+ /**
412
+ * Override the type of the returned `data` field in the response.
413
+ *
414
+ * @typeParam NewResult - The new type to cast the response data to
415
+ * @typeParam Options - Optional type configuration (defaults to { merge: true })
416
+ * @typeParam Options.merge - When true, merges the new type with existing return type. When false, replaces the existing types entirely (defaults to true)
417
+ * @example
418
+ * ```typescript
419
+ * // Merge with existing types (default behavior)
420
+ * const query = supabase
421
+ * .from('users')
422
+ * .select()
423
+ * .overrideTypes<{ custom_field: string }>()
424
+ *
425
+ * // Replace existing types completely
426
+ * const replaceQuery = supabase
427
+ * .from('users')
428
+ * .select()
429
+ * .overrideTypes<{ id: number; name: string }, { merge: false }>()
430
+ * ```
431
+ * @returns A PostgrestBuilder instance with the new type
432
+ *
433
+ * @category Database
434
+ * @subcategory Using modifiers
435
+ *
436
+ * @example Complete Override type of successful response
437
+ * ```ts
438
+ * const { data } = await supabase
439
+ * .from('countries')
440
+ * .select()
441
+ * .overrideTypes<Array<MyType>, { merge: false }>()
442
+ * ```
443
+ *
444
+ * @exampleResponse Complete Override type of successful response
445
+ * ```ts
446
+ * let x: typeof data // MyType[]
447
+ * ```
448
+ *
449
+ * @example Complete Override type of object response
450
+ * ```ts
451
+ * const { data } = await supabase
452
+ * .from('countries')
453
+ * .select()
454
+ * .maybeSingle()
455
+ * .overrideTypes<MyType, { merge: false }>()
456
+ * ```
457
+ *
458
+ * @exampleResponse Complete Override type of object response
459
+ * ```ts
460
+ * let x: typeof data // MyType | null
461
+ * ```
462
+ *
463
+ * @example Partial Override type of successful response
464
+ * ```ts
465
+ * const { data } = await supabase
466
+ * .from('countries')
467
+ * .select()
468
+ * .overrideTypes<Array<{ status: "A" | "B" }>>()
469
+ * ```
470
+ *
471
+ * @exampleResponse Partial Override type of successful response
472
+ * ```ts
473
+ * let x: typeof data // Array<CountryRowProperties & { status: "A" | "B" }>
474
+ * ```
475
+ *
476
+ * @example Partial Override type of object response
477
+ * ```ts
478
+ * const { data } = await supabase
479
+ * .from('countries')
480
+ * .select()
481
+ * .maybeSingle()
482
+ * .overrideTypes<{ status: "A" | "B" }>()
483
+ * ```
484
+ *
485
+ * @exampleResponse Partial Override type of object response
486
+ * ```ts
487
+ * let x: typeof data // CountryRowProperties & { status: "A" | "B" } | null
488
+ * ```
489
+ *
490
+ * @example Merge vs replace existing types
491
+ * ```typescript
492
+ * // Merge with existing types (default behavior)
493
+ * const query = supabase
494
+ * .from('users')
495
+ * .select()
496
+ * .overrideTypes<{ custom_field: string }>()
497
+ *
498
+ * // Replace existing types completely
499
+ * const replaceQuery = supabase
500
+ * .from('users')
501
+ * .select()
502
+ * .overrideTypes<{ id: number; name: string }, { merge: false }>()
503
+ * ```
504
+ */
505
+ overrideTypes() {
506
+ return this;
507
+ }
508
+ };
509
+
510
+ //#endregion
511
+ //#region src/PostgrestTransformBuilder.ts
512
+ var PostgrestTransformBuilder = class extends PostgrestBuilder {
513
+ /**
514
+ * Perform a SELECT on the query result.
515
+ *
516
+ * By default, `.insert()`, `.update()`, `.upsert()`, and `.delete()` do not
517
+ * return modified rows. By calling this method, modified rows are returned in
518
+ * `data`.
519
+ *
520
+ * @param columns - The columns to retrieve, separated by commas
521
+ *
522
+ * @category Database
523
+ * @subcategory Using modifiers
524
+ *
525
+ * @example With `upsert()`
526
+ * ```ts
527
+ * const { data, error } = await supabase
528
+ * .from('characters')
529
+ * .upsert({ id: 1, name: 'Han Solo' })
530
+ * .select()
531
+ * ```
532
+ *
533
+ * @exampleSql With `upsert()`
534
+ * ```sql
535
+ * create table
536
+ * characters (id int8 primary key, name text);
537
+ *
538
+ * insert into
539
+ * characters (id, name)
540
+ * values
541
+ * (1, 'Han');
542
+ * ```
543
+ *
544
+ * @exampleResponse With `upsert()`
545
+ * ```json
546
+ * {
547
+ * "data": [
548
+ * {
549
+ * "id": 1,
550
+ * "name": "Han Solo"
551
+ * }
552
+ * ],
553
+ * "status": 201,
554
+ * "statusText": "Created"
555
+ * }
556
+ * ```
557
+ */
558
+ select(columns) {
559
+ let quoted = false;
560
+ const cleanedColumns = (columns !== null && columns !== void 0 ? columns : "*").split("").map((c) => {
561
+ if (/\s/.test(c) && !quoted) return "";
562
+ if (c === "\"") quoted = !quoted;
563
+ return c;
564
+ }).join("");
565
+ this.url.searchParams.set("select", cleanedColumns);
566
+ this.headers.append("Prefer", "return=representation");
567
+ return this;
568
+ }
569
+ /**
570
+ * Order the query result by `column`.
571
+ *
572
+ * You can call this method multiple times to order by multiple columns.
573
+ *
574
+ * You can order referenced tables, but it only affects the ordering of the
575
+ * parent table if you use `!inner` in the query.
576
+ *
577
+ * @param column - The column to order by
578
+ * @param options - Named parameters
579
+ * @param options.ascending - If `true`, the result will be in ascending order
580
+ * @param options.nullsFirst - If `true`, `null`s appear first. If `false`,
581
+ * `null`s appear last.
582
+ * @param options.referencedTable - Set this to order a referenced table by
583
+ * its columns
584
+ * @param options.foreignTable - Deprecated, use `options.referencedTable`
585
+ * instead
586
+ *
587
+ * @category Database
588
+ * @subcategory Using modifiers
589
+ *
590
+ * @example With `select()`
591
+ * ```ts
592
+ * const { data, error } = await supabase
593
+ * .from('characters')
594
+ * .select('id, name')
595
+ * .order('id', { ascending: false })
596
+ * ```
597
+ *
598
+ * @exampleSql With `select()`
599
+ * ```sql
600
+ * create table
601
+ * characters (id int8 primary key, name text);
602
+ *
603
+ * insert into
604
+ * characters (id, name)
605
+ * values
606
+ * (1, 'Luke'),
607
+ * (2, 'Leia'),
608
+ * (3, 'Han');
609
+ * ```
610
+ *
611
+ * @exampleResponse With `select()`
612
+ * ```json
613
+ * {
614
+ * "data": [
615
+ * {
616
+ * "id": 3,
617
+ * "name": "Han"
618
+ * },
619
+ * {
620
+ * "id": 2,
621
+ * "name": "Leia"
622
+ * },
623
+ * {
624
+ * "id": 1,
625
+ * "name": "Luke"
626
+ * }
627
+ * ],
628
+ * "status": 200,
629
+ * "statusText": "OK"
630
+ * }
631
+ * ```
632
+ *
633
+ * @exampleDescription On a referenced table
634
+ * Ordering with `referencedTable` doesn't affect the ordering of the
635
+ * parent table.
636
+ *
637
+ * @example On a referenced table
638
+ * ```ts
639
+ * const { data, error } = await supabase
640
+ * .from('orchestral_sections')
641
+ * .select(`
642
+ * name,
643
+ * instruments (
644
+ * name
645
+ * )
646
+ * `)
647
+ * .order('name', { referencedTable: 'instruments', ascending: false })
648
+ *
649
+ * ```
650
+ *
651
+ * @exampleSql On a referenced table
652
+ * ```sql
653
+ * create table
654
+ * orchestral_sections (id int8 primary key, name text);
655
+ * create table
656
+ * instruments (
657
+ * id int8 primary key,
658
+ * section_id int8 not null references orchestral_sections,
659
+ * name text
660
+ * );
661
+ *
662
+ * insert into
663
+ * orchestral_sections (id, name)
664
+ * values
665
+ * (1, 'strings'),
666
+ * (2, 'woodwinds');
667
+ * insert into
668
+ * instruments (id, section_id, name)
669
+ * values
670
+ * (1, 1, 'harp'),
671
+ * (2, 1, 'violin');
672
+ * ```
673
+ *
674
+ * @exampleResponse On a referenced table
675
+ * ```json
676
+ * {
677
+ * "data": [
678
+ * {
679
+ * "name": "strings",
680
+ * "instruments": [
681
+ * {
682
+ * "name": "violin"
683
+ * },
684
+ * {
685
+ * "name": "harp"
686
+ * }
687
+ * ]
688
+ * },
689
+ * {
690
+ * "name": "woodwinds",
691
+ * "instruments": []
692
+ * }
693
+ * ],
694
+ * "status": 200,
695
+ * "statusText": "OK"
696
+ * }
697
+ * ```
698
+ *
699
+ * @exampleDescription Order parent table by a referenced table
700
+ * Ordering with `referenced_table(col)` affects the ordering of the
701
+ * parent table.
702
+ *
703
+ * @example Order parent table by a referenced table
704
+ * ```ts
705
+ * const { data, error } = await supabase
706
+ * .from('instruments')
707
+ * .select(`
708
+ * name,
709
+ * section:orchestral_sections (
710
+ * name
711
+ * )
712
+ * `)
713
+ * .order('section(name)', { ascending: true })
714
+ *
715
+ * ```
716
+ *
717
+ * @exampleSql Order parent table by a referenced table
718
+ * ```sql
719
+ * create table
720
+ * orchestral_sections (id int8 primary key, name text);
721
+ * create table
722
+ * instruments (
723
+ * id int8 primary key,
724
+ * section_id int8 not null references orchestral_sections,
725
+ * name text
726
+ * );
727
+ *
728
+ * insert into
729
+ * orchestral_sections (id, name)
730
+ * values
731
+ * (1, 'strings'),
732
+ * (2, 'woodwinds');
733
+ * insert into
734
+ * instruments (id, section_id, name)
735
+ * values
736
+ * (1, 2, 'flute'),
737
+ * (2, 1, 'violin');
738
+ * ```
739
+ *
740
+ * @exampleResponse Order parent table by a referenced table
741
+ * ```json
742
+ * {
743
+ * "data": [
744
+ * {
745
+ * "name": "violin",
746
+ * "orchestral_sections": {"name": "strings"}
747
+ * },
748
+ * {
749
+ * "name": "flute",
750
+ * "orchestral_sections": {"name": "woodwinds"}
751
+ * }
752
+ * ],
753
+ * "status": 200,
754
+ * "statusText": "OK"
755
+ * }
756
+ * ```
757
+ */
758
+ order(column, { ascending = true, nullsFirst, foreignTable, referencedTable = foreignTable } = {}) {
759
+ const key = referencedTable ? `${referencedTable}.order` : "order";
760
+ const existingOrder = this.url.searchParams.get(key);
761
+ this.url.searchParams.set(key, `${existingOrder ? `${existingOrder},` : ""}${column}.${ascending ? "asc" : "desc"}${nullsFirst === void 0 ? "" : nullsFirst ? ".nullsfirst" : ".nullslast"}`);
762
+ return this;
763
+ }
764
+ /**
765
+ * Limit the query result by `count`.
766
+ *
767
+ * @param count - The maximum number of rows to return
768
+ * @param options - Named parameters
769
+ * @param options.referencedTable - Set this to limit rows of referenced
770
+ * tables instead of the parent table
771
+ * @param options.foreignTable - Deprecated, use `options.referencedTable`
772
+ * instead
773
+ *
774
+ * @category Database
775
+ * @subcategory Using modifiers
776
+ *
777
+ * @example With `select()`
778
+ * ```ts
779
+ * const { data, error } = await supabase
780
+ * .from('characters')
781
+ * .select('name')
782
+ * .limit(1)
783
+ * ```
784
+ *
785
+ * @exampleSql With `select()`
786
+ * ```sql
787
+ * create table
788
+ * characters (id int8 primary key, name text);
789
+ *
790
+ * insert into
791
+ * characters (id, name)
792
+ * values
793
+ * (1, 'Luke'),
794
+ * (2, 'Leia'),
795
+ * (3, 'Han');
796
+ * ```
797
+ *
798
+ * @exampleResponse With `select()`
799
+ * ```json
800
+ * {
801
+ * "data": [
802
+ * {
803
+ * "name": "Luke"
804
+ * }
805
+ * ],
806
+ * "status": 200,
807
+ * "statusText": "OK"
808
+ * }
809
+ * ```
810
+ *
811
+ * @example On a referenced table
812
+ * ```ts
813
+ * const { data, error } = await supabase
814
+ * .from('orchestral_sections')
815
+ * .select(`
816
+ * name,
817
+ * instruments (
818
+ * name
819
+ * )
820
+ * `)
821
+ * .limit(1, { referencedTable: 'instruments' })
822
+ * ```
823
+ *
824
+ * @exampleSql On a referenced table
825
+ * ```sql
826
+ * create table
827
+ * orchestral_sections (id int8 primary key, name text);
828
+ * create table
829
+ * instruments (
830
+ * id int8 primary key,
831
+ * section_id int8 not null references orchestral_sections,
832
+ * name text
833
+ * );
834
+ *
835
+ * insert into
836
+ * orchestral_sections (id, name)
837
+ * values
838
+ * (1, 'strings');
839
+ * insert into
840
+ * instruments (id, section_id, name)
841
+ * values
842
+ * (1, 1, 'harp'),
843
+ * (2, 1, 'violin');
844
+ * ```
845
+ *
846
+ * @exampleResponse On a referenced table
847
+ * ```json
848
+ * {
849
+ * "data": [
850
+ * {
851
+ * "name": "strings",
852
+ * "instruments": [
853
+ * {
854
+ * "name": "violin"
855
+ * }
856
+ * ]
857
+ * }
858
+ * ],
859
+ * "status": 200,
860
+ * "statusText": "OK"
861
+ * }
862
+ * ```
863
+ */
864
+ limit(count, { foreignTable, referencedTable = foreignTable } = {}) {
865
+ const key = typeof referencedTable === "undefined" ? "limit" : `${referencedTable}.limit`;
866
+ this.url.searchParams.set(key, `${count}`);
867
+ return this;
868
+ }
869
+ /**
870
+ * Limit the query result by starting at an offset `from` and ending at the offset `to`.
871
+ * Only records within this range are returned.
872
+ * This respects the query order and if there is no order clause the range could behave unexpectedly.
873
+ * The `from` and `to` values are 0-based and inclusive: `range(1, 3)` will include the second, third
874
+ * and fourth rows of the query.
875
+ *
876
+ * @param from - The starting index from which to limit the result
877
+ * @param to - The last index to which to limit the result
878
+ * @param options - Named parameters
879
+ * @param options.referencedTable - Set this to limit rows of referenced
880
+ * tables instead of the parent table
881
+ * @param options.foreignTable - Deprecated, use `options.referencedTable`
882
+ * instead
883
+ *
884
+ * @category Database
885
+ * @subcategory Using modifiers
886
+ *
887
+ * @example With `select()`
888
+ * ```ts
889
+ * const { data, error } = await supabase
890
+ * .from('characters')
891
+ * .select('name')
892
+ * .range(0, 1)
893
+ * ```
894
+ *
895
+ * @exampleSql With `select()`
896
+ * ```sql
897
+ * create table
898
+ * characters (id int8 primary key, name text);
899
+ *
900
+ * insert into
901
+ * characters (id, name)
902
+ * values
903
+ * (1, 'Luke'),
904
+ * (2, 'Leia'),
905
+ * (3, 'Han');
906
+ * ```
907
+ *
908
+ * @exampleResponse With `select()`
909
+ * ```json
910
+ * {
911
+ * "data": [
912
+ * {
913
+ * "name": "Luke"
914
+ * },
915
+ * {
916
+ * "name": "Leia"
917
+ * }
918
+ * ],
919
+ * "status": 200,
920
+ * "statusText": "OK"
921
+ * }
922
+ * ```
923
+ */
924
+ range(from, to, { foreignTable, referencedTable = foreignTable } = {}) {
925
+ const keyOffset = typeof referencedTable === "undefined" ? "offset" : `${referencedTable}.offset`;
926
+ const keyLimit = typeof referencedTable === "undefined" ? "limit" : `${referencedTable}.limit`;
927
+ this.url.searchParams.set(keyOffset, `${from}`);
928
+ this.url.searchParams.set(keyLimit, `${to - from + 1}`);
929
+ return this;
930
+ }
931
+ /**
932
+ * Set the AbortSignal for the fetch request.
933
+ *
934
+ * @param signal - The AbortSignal to use for the fetch request
935
+ *
936
+ * @category Database
937
+ * @subcategory Using modifiers
938
+ *
939
+ * @remarks
940
+ * You can use this to set a timeout for the request.
941
+ *
942
+ * @exampleDescription Aborting requests in-flight
943
+ * You can use an [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController) to abort requests.
944
+ * Note that `status` and `statusText` don't mean anything for aborted requests as the request wasn't fulfilled.
945
+ *
946
+ * @example Aborting requests in-flight
947
+ * ```ts
948
+ * const ac = new AbortController()
949
+ *
950
+ * const { data, error } = await supabase
951
+ * .from('very_big_table')
952
+ * .select()
953
+ * .abortSignal(ac.signal)
954
+ *
955
+ * // Abort the request after 100 ms
956
+ * setTimeout(() => ac.abort(), 100)
957
+ * ```
958
+ *
959
+ * @exampleResponse Aborting requests in-flight
960
+ * ```json
961
+ * {
962
+ * "error": {
963
+ * "message": "AbortError: The user aborted a request.",
964
+ * "details": "",
965
+ * "hint": "The request was aborted locally via the provided AbortSignal.",
966
+ * "code": ""
967
+ * },
968
+ * "status": 0,
969
+ * "statusText": ""
970
+ * }
971
+ *
972
+ * ```
973
+ *
974
+ * @example Set a timeout
975
+ * ```ts
976
+ * const { data, error } = await supabase
977
+ * .from('very_big_table')
978
+ * .select()
979
+ * .abortSignal(AbortSignal.timeout(1000 /* ms *\/))
980
+ * ```
981
+ *
982
+ * @exampleResponse Set a timeout
983
+ * ```json
984
+ * {
985
+ * "error": {
986
+ * "message": "FetchError: The user aborted a request.",
987
+ * "details": "",
988
+ * "hint": "",
989
+ * "code": ""
990
+ * },
991
+ * "status": 400,
992
+ * "statusText": "Bad Request"
993
+ * }
994
+ *
995
+ * ```
996
+ */
997
+ abortSignal(signal) {
998
+ this.signal = signal;
999
+ return this;
1000
+ }
1001
+ /**
1002
+ * Return `data` as a single object instead of an array of objects.
1003
+ *
1004
+ * Query result must be one row (e.g. using `.limit(1)`), otherwise this
1005
+ * returns an error.
1006
+ *
1007
+ * @category Database
1008
+ * @subcategory Using modifiers
1009
+ *
1010
+ * @example With `select()`
1011
+ * ```ts
1012
+ * const { data, error } = await supabase
1013
+ * .from('characters')
1014
+ * .select('name')
1015
+ * .limit(1)
1016
+ * .single()
1017
+ * ```
1018
+ *
1019
+ * @exampleSql With `select()`
1020
+ * ```sql
1021
+ * create table
1022
+ * characters (id int8 primary key, name text);
1023
+ *
1024
+ * insert into
1025
+ * characters (id, name)
1026
+ * values
1027
+ * (1, 'Luke'),
1028
+ * (2, 'Leia'),
1029
+ * (3, 'Han');
1030
+ * ```
1031
+ *
1032
+ * @exampleResponse With `select()`
1033
+ * ```json
1034
+ * {
1035
+ * "data": {
1036
+ * "name": "Luke"
1037
+ * },
1038
+ * "status": 200,
1039
+ * "statusText": "OK"
1040
+ * }
1041
+ * ```
1042
+ */
1043
+ single() {
1044
+ this.headers.set("Accept", "application/vnd.pgrst.object+json");
1045
+ return this;
1046
+ }
1047
+ /**
1048
+ * Return `data` as a single object instead of an array of objects.
1049
+ *
1050
+ * Query result must be zero or one row (e.g. using `.limit(1)`), otherwise
1051
+ * this returns an error.
1052
+ *
1053
+ * @category Database
1054
+ * @subcategory Using modifiers
1055
+ *
1056
+ * @example With `select()`
1057
+ * ```ts
1058
+ * const { data, error } = await supabase
1059
+ * .from('characters')
1060
+ * .select()
1061
+ * .eq('name', 'Katniss')
1062
+ * .maybeSingle()
1063
+ * ```
1064
+ *
1065
+ * @exampleSql With `select()`
1066
+ * ```sql
1067
+ * create table
1068
+ * characters (id int8 primary key, name text);
1069
+ *
1070
+ * insert into
1071
+ * characters (id, name)
1072
+ * values
1073
+ * (1, 'Luke'),
1074
+ * (2, 'Leia'),
1075
+ * (3, 'Han');
1076
+ * ```
1077
+ *
1078
+ * @exampleResponse With `select()`
1079
+ * ```json
1080
+ * {
1081
+ * "status": 200,
1082
+ * "statusText": "OK"
1083
+ * }
1084
+ * ```
1085
+ */
1086
+ maybeSingle() {
1087
+ this.isMaybeSingle = true;
1088
+ return this;
1089
+ }
1090
+ /**
1091
+ * Return `data` as a string in CSV format.
1092
+ *
1093
+ * @category Database
1094
+ * @subcategory Using modifiers
1095
+ *
1096
+ * @exampleDescription Return data as CSV
1097
+ * By default, the data is returned in JSON format, but can also be returned as Comma Separated Values.
1098
+ *
1099
+ * @example Return data as CSV
1100
+ * ```ts
1101
+ * const { data, error } = await supabase
1102
+ * .from('characters')
1103
+ * .select()
1104
+ * .csv()
1105
+ * ```
1106
+ *
1107
+ * @exampleSql Return data as CSV
1108
+ * ```sql
1109
+ * create table
1110
+ * characters (id int8 primary key, name text);
1111
+ *
1112
+ * insert into
1113
+ * characters (id, name)
1114
+ * values
1115
+ * (1, 'Luke'),
1116
+ * (2, 'Leia'),
1117
+ * (3, 'Han');
1118
+ * ```
1119
+ *
1120
+ * @exampleResponse Return data as CSV
1121
+ * ```json
1122
+ * {
1123
+ * "data": "id,name\n1,Luke\n2,Leia\n3,Han",
1124
+ * "status": 200,
1125
+ * "statusText": "OK"
1126
+ * }
1127
+ * ```
1128
+ */
1129
+ csv() {
1130
+ this.headers.set("Accept", "text/csv");
1131
+ return this;
1132
+ }
1133
+ /**
1134
+ * Return `data` as an object in [GeoJSON](https://geojson.org) format.
1135
+ *
1136
+ * @category Database
1137
+ */
1138
+ geojson() {
1139
+ this.headers.set("Accept", "application/geo+json");
1140
+ return this;
1141
+ }
1142
+ /**
1143
+ * Return `data` as the EXPLAIN plan for the query.
1144
+ *
1145
+ * You need to enable the
1146
+ * [db_plan_enabled](https://supabase.com/docs/guides/database/debugging-performance#enabling-explain)
1147
+ * setting before using this method.
1148
+ *
1149
+ * @param options - Named parameters
1150
+ *
1151
+ * @param options.analyze - If `true`, the query will be executed and the
1152
+ * actual run time will be returned
1153
+ *
1154
+ * @param options.verbose - If `true`, the query identifier will be returned
1155
+ * and `data` will include the output columns of the query
1156
+ *
1157
+ * @param options.settings - If `true`, include information on configuration
1158
+ * parameters that affect query planning
1159
+ *
1160
+ * @param options.buffers - If `true`, include information on buffer usage
1161
+ *
1162
+ * @param options.wal - If `true`, include information on WAL record generation
1163
+ *
1164
+ * @param options.format - The format of the output, can be `"text"` (default)
1165
+ * or `"json"`
1166
+ *
1167
+ * @category Database
1168
+ * @subcategory Using modifiers
1169
+ *
1170
+ * @exampleDescription Get the execution plan
1171
+ * By default, the data is returned in TEXT format, but can also be returned as JSON by using the `format` parameter.
1172
+ *
1173
+ * @example Get the execution plan
1174
+ * ```ts
1175
+ * const { data, error } = await supabase
1176
+ * .from('characters')
1177
+ * .select()
1178
+ * .explain()
1179
+ * ```
1180
+ *
1181
+ * @exampleSql Get the execution plan
1182
+ * ```sql
1183
+ * create table
1184
+ * characters (id int8 primary key, name text);
1185
+ *
1186
+ * insert into
1187
+ * characters (id, name)
1188
+ * values
1189
+ * (1, 'Luke'),
1190
+ * (2, 'Leia'),
1191
+ * (3, 'Han');
1192
+ * ```
1193
+ *
1194
+ * @exampleResponse Get the execution plan
1195
+ * ```js
1196
+ * Aggregate (cost=33.34..33.36 rows=1 width=112)
1197
+ * -> Limit (cost=0.00..18.33 rows=1000 width=40)
1198
+ * -> Seq Scan on characters (cost=0.00..22.00 rows=1200 width=40)
1199
+ * ```
1200
+ *
1201
+ * @exampleDescription Get the execution plan with analyze and verbose
1202
+ * By default, the data is returned in TEXT format, but can also be returned as JSON by using the `format` parameter.
1203
+ *
1204
+ * @example Get the execution plan with analyze and verbose
1205
+ * ```ts
1206
+ * const { data, error } = await supabase
1207
+ * .from('characters')
1208
+ * .select()
1209
+ * .explain({analyze:true,verbose:true})
1210
+ * ```
1211
+ *
1212
+ * @exampleSql Get the execution plan with analyze and verbose
1213
+ * ```sql
1214
+ * create table
1215
+ * characters (id int8 primary key, name text);
1216
+ *
1217
+ * insert into
1218
+ * characters (id, name)
1219
+ * values
1220
+ * (1, 'Luke'),
1221
+ * (2, 'Leia'),
1222
+ * (3, 'Han');
1223
+ * ```
1224
+ *
1225
+ * @exampleResponse Get the execution plan with analyze and verbose
1226
+ * ```js
1227
+ * Aggregate (cost=33.34..33.36 rows=1 width=112) (actual time=0.041..0.041 rows=1 loops=1)
1228
+ * Output: NULL::bigint, count(ROW(characters.id, characters.name)), COALESCE(json_agg(ROW(characters.id, characters.name)), '[]'::json), NULLIF(current_setting('response.headers'::text, true), ''::text), NULLIF(current_setting('response.status'::text, true), ''::text)
1229
+ * -> Limit (cost=0.00..18.33 rows=1000 width=40) (actual time=0.005..0.006 rows=3 loops=1)
1230
+ * Output: characters.id, characters.name
1231
+ * -> Seq Scan on public.characters (cost=0.00..22.00 rows=1200 width=40) (actual time=0.004..0.005 rows=3 loops=1)
1232
+ * Output: characters.id, characters.name
1233
+ * Query Identifier: -4730654291623321173
1234
+ * Planning Time: 0.407 ms
1235
+ * Execution Time: 0.119 ms
1236
+ * ```
1237
+ */
1238
+ explain({ analyze = false, verbose = false, settings = false, buffers = false, wal = false, format = "text" } = {}) {
1239
+ var _this$headers$get;
1240
+ const options = [
1241
+ analyze ? "analyze" : null,
1242
+ verbose ? "verbose" : null,
1243
+ settings ? "settings" : null,
1244
+ buffers ? "buffers" : null,
1245
+ wal ? "wal" : null
1246
+ ].filter(Boolean).join("|");
1247
+ const forMediatype = (_this$headers$get = this.headers.get("Accept")) !== null && _this$headers$get !== void 0 ? _this$headers$get : "application/json";
1248
+ this.headers.set("Accept", `application/vnd.pgrst.plan+${format}; for="${forMediatype}"; options=${options};`);
1249
+ if (format === "json") return this;
1250
+ else return this;
1251
+ }
1252
+ /**
1253
+ * Rollback the query.
1254
+ *
1255
+ * `data` will still be returned, but the query is not committed.
1256
+ *
1257
+ * @category Database
1258
+ */
1259
+ rollback() {
1260
+ this.headers.append("Prefer", "tx=rollback");
1261
+ return this;
1262
+ }
1263
+ /**
1264
+ * Override the type of the returned `data`.
1265
+ *
1266
+ * @typeParam NewResult - The new result type to override with
1267
+ * @deprecated Use overrideTypes<yourType, { merge: false }>() method at the end of your call chain instead
1268
+ *
1269
+ * @category Database
1270
+ * @subcategory Using modifiers
1271
+ *
1272
+ * @remarks
1273
+ * - Deprecated: use overrideTypes method instead
1274
+ *
1275
+ * @example Override type of successful response
1276
+ * ```ts
1277
+ * const { data } = await supabase
1278
+ * .from('countries')
1279
+ * .select()
1280
+ * .returns<Array<MyType>>()
1281
+ * ```
1282
+ *
1283
+ * @exampleResponse Override type of successful response
1284
+ * ```js
1285
+ * let x: typeof data // MyType[]
1286
+ * ```
1287
+ *
1288
+ * @example Override type of object response
1289
+ * ```ts
1290
+ * const { data } = await supabase
1291
+ * .from('countries')
1292
+ * .select()
1293
+ * .maybeSingle()
1294
+ * .returns<MyType>()
1295
+ * ```
1296
+ *
1297
+ * @exampleResponse Override type of object response
1298
+ * ```js
1299
+ * let x: typeof data // MyType | null
1300
+ * ```
1301
+ */
1302
+ returns() {
1303
+ return this;
1304
+ }
1305
+ /**
1306
+ * Set the maximum number of rows that can be affected by the query.
1307
+ * Only available in PostgREST v13+ and only works with PATCH and DELETE methods.
1308
+ *
1309
+ * @param value - The maximum number of rows that can be affected
1310
+ *
1311
+ * @category Database
1312
+ */
1313
+ maxAffected(value) {
1314
+ this.headers.append("Prefer", "handling=strict");
1315
+ this.headers.append("Prefer", `max-affected=${value}`);
1316
+ return this;
1317
+ }
1318
+ };
1319
+
1320
+ //#endregion
1321
+ //#region src/PostgrestFilterBuilder.ts
1322
+ const PostgrestReservedCharsRegexp = /* @__PURE__ */ new RegExp("[,()]");
1323
+ var PostgrestFilterBuilder = class extends PostgrestTransformBuilder {
1324
+ /**
1325
+ * Match only rows where `column` is equal to `value`.
1326
+ *
1327
+ * To check if the value of `column` is NULL, you should use `.is()` instead.
1328
+ *
1329
+ * @param column - The column to filter on
1330
+ * @param value - The value to filter with
1331
+ *
1332
+ * @category Database
1333
+ * @subcategory Using filters
1334
+ *
1335
+ * @example With `select()`
1336
+ * ```ts
1337
+ * const { data, error } = await supabase
1338
+ * .from('characters')
1339
+ * .select()
1340
+ * .eq('name', 'Leia')
1341
+ * ```
1342
+ *
1343
+ * @exampleSql With `select()`
1344
+ * ```sql
1345
+ * create table
1346
+ * characters (id int8 primary key, name text);
1347
+ *
1348
+ * insert into
1349
+ * characters (id, name)
1350
+ * values
1351
+ * (1, 'Luke'),
1352
+ * (2, 'Leia'),
1353
+ * (3, 'Han');
1354
+ * ```
1355
+ *
1356
+ * @exampleResponse With `select()`
1357
+ * ```json
1358
+ * {
1359
+ * "data": [
1360
+ * {
1361
+ * "id": 2,
1362
+ * "name": "Leia"
1363
+ * }
1364
+ * ],
1365
+ * "status": 200,
1366
+ * "statusText": "OK"
1367
+ * }
1368
+ * ```
1369
+ */
1370
+ eq(column, value) {
1371
+ this.url.searchParams.append(column, `eq.${value}`);
1372
+ return this;
1373
+ }
1374
+ /**
1375
+ * Match only rows where `column` is not equal to `value`.
1376
+ *
1377
+ * @param column - The column to filter on
1378
+ * @param value - The value to filter with
1379
+ *
1380
+ * @category Database
1381
+ * @subcategory Using filters
1382
+ *
1383
+ * @example With `select()`
1384
+ * ```ts
1385
+ * const { data, error } = await supabase
1386
+ * .from('characters')
1387
+ * .select()
1388
+ * .neq('name', 'Leia')
1389
+ * ```
1390
+ *
1391
+ * @exampleSql With `select()`
1392
+ * ```sql
1393
+ * create table
1394
+ * characters (id int8 primary key, name text);
1395
+ *
1396
+ * insert into
1397
+ * characters (id, name)
1398
+ * values
1399
+ * (1, 'Luke'),
1400
+ * (2, 'Leia'),
1401
+ * (3, 'Han');
1402
+ * ```
1403
+ *
1404
+ * @exampleResponse With `select()`
1405
+ * ```json
1406
+ * {
1407
+ * "data": [
1408
+ * {
1409
+ * "id": 1,
1410
+ * "name": "Luke"
1411
+ * },
1412
+ * {
1413
+ * "id": 3,
1414
+ * "name": "Han"
1415
+ * }
1416
+ * ],
1417
+ * "status": 200,
1418
+ * "statusText": "OK"
1419
+ * }
1420
+ * ```
1421
+ */
1422
+ neq(column, value) {
1423
+ this.url.searchParams.append(column, `neq.${value}`);
1424
+ return this;
1425
+ }
1426
+ /**
1427
+ * Match only rows where `column` is greater than `value`.
1428
+ *
1429
+ * @param column - The column to filter on
1430
+ * @param value - The value to filter with
1431
+ *
1432
+ * @category Database
1433
+ * @subcategory Using filters
1434
+ *
1435
+ * @exampleDescription With `select()`
1436
+ * When using [reserved words](https://www.postgresql.org/docs/current/sql-keywords-appendix.html) for column names you need
1437
+ * to add double quotes e.g. `.gt('"order"', 2)`
1438
+ *
1439
+ * @example With `select()`
1440
+ * ```ts
1441
+ * const { data, error } = await supabase
1442
+ * .from('characters')
1443
+ * .select()
1444
+ * .gt('id', 2)
1445
+ * ```
1446
+ *
1447
+ * @exampleSql With `select()`
1448
+ * ```sql
1449
+ * create table
1450
+ * characters (id int8 primary key, name text);
1451
+ *
1452
+ * insert into
1453
+ * characters (id, name)
1454
+ * values
1455
+ * (1, 'Luke'),
1456
+ * (2, 'Leia'),
1457
+ * (3, 'Han');
1458
+ * ```
1459
+ *
1460
+ * @exampleResponse With `select()`
1461
+ * ```json
1462
+ * {
1463
+ * "data": [
1464
+ * {
1465
+ * "id": 3,
1466
+ * "name": "Han"
1467
+ * }
1468
+ * ],
1469
+ * "status": 200,
1470
+ * "statusText": "OK"
1471
+ * }
1472
+ * ```
1473
+ */
1474
+ gt(column, value) {
1475
+ this.url.searchParams.append(column, `gt.${value}`);
1476
+ return this;
1477
+ }
1478
+ /**
1479
+ * Match only rows where `column` is greater than or equal to `value`.
1480
+ *
1481
+ * @param column - The column to filter on
1482
+ * @param value - The value to filter with
1483
+ *
1484
+ * @category Database
1485
+ * @subcategory Using filters
1486
+ *
1487
+ * @example With `select()`
1488
+ * ```ts
1489
+ * const { data, error } = await supabase
1490
+ * .from('characters')
1491
+ * .select()
1492
+ * .gte('id', 2)
1493
+ * ```
1494
+ *
1495
+ * @exampleSql With `select()`
1496
+ * ```sql
1497
+ * create table
1498
+ * characters (id int8 primary key, name text);
1499
+ *
1500
+ * insert into
1501
+ * characters (id, name)
1502
+ * values
1503
+ * (1, 'Luke'),
1504
+ * (2, 'Leia'),
1505
+ * (3, 'Han');
1506
+ * ```
1507
+ *
1508
+ * @exampleResponse With `select()`
1509
+ * ```json
1510
+ * {
1511
+ * "data": [
1512
+ * {
1513
+ * "id": 2,
1514
+ * "name": "Leia"
1515
+ * },
1516
+ * {
1517
+ * "id": 3,
1518
+ * "name": "Han"
1519
+ * }
1520
+ * ],
1521
+ * "status": 200,
1522
+ * "statusText": "OK"
1523
+ * }
1524
+ * ```
1525
+ */
1526
+ gte(column, value) {
1527
+ this.url.searchParams.append(column, `gte.${value}`);
1528
+ return this;
1529
+ }
1530
+ /**
1531
+ * Match only rows where `column` is less than `value`.
1532
+ *
1533
+ * @param column - The column to filter on
1534
+ * @param value - The value to filter with
1535
+ *
1536
+ * @category Database
1537
+ * @subcategory Using filters
1538
+ *
1539
+ * @example With `select()`
1540
+ * ```ts
1541
+ * const { data, error } = await supabase
1542
+ * .from('characters')
1543
+ * .select()
1544
+ * .lt('id', 2)
1545
+ * ```
1546
+ *
1547
+ * @exampleSql With `select()`
1548
+ * ```sql
1549
+ * create table
1550
+ * characters (id int8 primary key, name text);
1551
+ *
1552
+ * insert into
1553
+ * characters (id, name)
1554
+ * values
1555
+ * (1, 'Luke'),
1556
+ * (2, 'Leia'),
1557
+ * (3, 'Han');
1558
+ * ```
1559
+ *
1560
+ * @exampleResponse With `select()`
1561
+ * ```json
1562
+ * {
1563
+ * "data": [
1564
+ * {
1565
+ * "id": 1,
1566
+ * "name": "Luke"
1567
+ * }
1568
+ * ],
1569
+ * "status": 200,
1570
+ * "statusText": "OK"
1571
+ * }
1572
+ * ```
1573
+ */
1574
+ lt(column, value) {
1575
+ this.url.searchParams.append(column, `lt.${value}`);
1576
+ return this;
1577
+ }
1578
+ /**
1579
+ * Match only rows where `column` is less than or equal to `value`.
1580
+ *
1581
+ * @param column - The column to filter on
1582
+ * @param value - The value to filter with
1583
+ *
1584
+ * @category Database
1585
+ * @subcategory Using filters
1586
+ *
1587
+ * @example With `select()`
1588
+ * ```ts
1589
+ * const { data, error } = await supabase
1590
+ * .from('characters')
1591
+ * .select()
1592
+ * .lte('id', 2)
1593
+ * ```
1594
+ *
1595
+ * @exampleSql With `select()`
1596
+ * ```sql
1597
+ * create table
1598
+ * characters (id int8 primary key, name text);
1599
+ *
1600
+ * insert into
1601
+ * characters (id, name)
1602
+ * values
1603
+ * (1, 'Luke'),
1604
+ * (2, 'Leia'),
1605
+ * (3, 'Han');
1606
+ * ```
1607
+ *
1608
+ * @exampleResponse With `select()`
1609
+ * ```json
1610
+ * {
1611
+ * "data": [
1612
+ * {
1613
+ * "id": 1,
1614
+ * "name": "Luke"
1615
+ * },
1616
+ * {
1617
+ * "id": 2,
1618
+ * "name": "Leia"
1619
+ * }
1620
+ * ],
1621
+ * "status": 200,
1622
+ * "statusText": "OK"
1623
+ * }
1624
+ * ```
1625
+ */
1626
+ lte(column, value) {
1627
+ this.url.searchParams.append(column, `lte.${value}`);
1628
+ return this;
1629
+ }
1630
+ /**
1631
+ * Match only rows where `column` matches `pattern` case-sensitively.
1632
+ *
1633
+ * @param column - The column to filter on
1634
+ * @param pattern - The pattern to match with
1635
+ *
1636
+ * @category Database
1637
+ * @subcategory Using filters
1638
+ *
1639
+ * @example With `select()`
1640
+ * ```ts
1641
+ * const { data, error } = await supabase
1642
+ * .from('characters')
1643
+ * .select()
1644
+ * .like('name', '%Lu%')
1645
+ * ```
1646
+ *
1647
+ * @exampleSql With `select()`
1648
+ * ```sql
1649
+ * create table
1650
+ * characters (id int8 primary key, name text);
1651
+ *
1652
+ * insert into
1653
+ * characters (id, name)
1654
+ * values
1655
+ * (1, 'Luke'),
1656
+ * (2, 'Leia'),
1657
+ * (3, 'Han');
1658
+ * ```
1659
+ *
1660
+ * @exampleResponse With `select()`
1661
+ * ```json
1662
+ * {
1663
+ * "data": [
1664
+ * {
1665
+ * "id": 1,
1666
+ * "name": "Luke"
1667
+ * }
1668
+ * ],
1669
+ * "status": 200,
1670
+ * "statusText": "OK"
1671
+ * }
1672
+ * ```
1673
+ */
1674
+ like(column, pattern) {
1675
+ this.url.searchParams.append(column, `like.${pattern}`);
1676
+ return this;
1677
+ }
1678
+ /**
1679
+ * Match only rows where `column` matches all of `patterns` case-sensitively.
1680
+ *
1681
+ * @param column - The column to filter on
1682
+ * @param patterns - The patterns to match with
1683
+ *
1684
+ * @category Database
1685
+ * @subcategory Using filters
1686
+ */
1687
+ likeAllOf(column, patterns) {
1688
+ this.url.searchParams.append(column, `like(all).{${patterns.join(",")}}`);
1689
+ return this;
1690
+ }
1691
+ /**
1692
+ * Match only rows where `column` matches any of `patterns` case-sensitively.
1693
+ *
1694
+ * @param column - The column to filter on
1695
+ * @param patterns - The patterns to match with
1696
+ *
1697
+ * @category Database
1698
+ * @subcategory Using filters
1699
+ */
1700
+ likeAnyOf(column, patterns) {
1701
+ this.url.searchParams.append(column, `like(any).{${patterns.join(",")}}`);
1702
+ return this;
1703
+ }
1704
+ /**
1705
+ * Match only rows where `column` matches `pattern` case-insensitively.
1706
+ *
1707
+ * @param column - The column to filter on
1708
+ * @param pattern - The pattern to match with
1709
+ *
1710
+ * @category Database
1711
+ * @subcategory Using filters
1712
+ *
1713
+ * @example With `select()`
1714
+ * ```ts
1715
+ * const { data, error } = await supabase
1716
+ * .from('characters')
1717
+ * .select()
1718
+ * .ilike('name', '%lu%')
1719
+ * ```
1720
+ *
1721
+ * @exampleSql With `select()`
1722
+ * ```sql
1723
+ * create table
1724
+ * characters (id int8 primary key, name text);
1725
+ *
1726
+ * insert into
1727
+ * characters (id, name)
1728
+ * values
1729
+ * (1, 'Luke'),
1730
+ * (2, 'Leia'),
1731
+ * (3, 'Han');
1732
+ * ```
1733
+ *
1734
+ * @exampleResponse With `select()`
1735
+ * ```json
1736
+ * {
1737
+ * "data": [
1738
+ * {
1739
+ * "id": 1,
1740
+ * "name": "Luke"
1741
+ * }
1742
+ * ],
1743
+ * "status": 200,
1744
+ * "statusText": "OK"
1745
+ * }
1746
+ * ```
1747
+ */
1748
+ ilike(column, pattern) {
1749
+ this.url.searchParams.append(column, `ilike.${pattern}`);
1750
+ return this;
1751
+ }
1752
+ /**
1753
+ * Match only rows where `column` matches all of `patterns` case-insensitively.
1754
+ *
1755
+ * @param column - The column to filter on
1756
+ * @param patterns - The patterns to match with
1757
+ *
1758
+ * @category Database
1759
+ * @subcategory Using filters
1760
+ */
1761
+ ilikeAllOf(column, patterns) {
1762
+ this.url.searchParams.append(column, `ilike(all).{${patterns.join(",")}}`);
1763
+ return this;
1764
+ }
1765
+ /**
1766
+ * Match only rows where `column` matches any of `patterns` case-insensitively.
1767
+ *
1768
+ * @param column - The column to filter on
1769
+ * @param patterns - The patterns to match with
1770
+ *
1771
+ * @category Database
1772
+ * @subcategory Using filters
1773
+ */
1774
+ ilikeAnyOf(column, patterns) {
1775
+ this.url.searchParams.append(column, `ilike(any).{${patterns.join(",")}}`);
1776
+ return this;
1777
+ }
1778
+ /**
1779
+ * Match only rows where `column` matches the PostgreSQL regex `pattern`
1780
+ * case-sensitively (using the `~` operator).
1781
+ *
1782
+ * @param column - The column to filter on
1783
+ * @param pattern - The PostgreSQL regular expression pattern to match with
1784
+ */
1785
+ regexMatch(column, pattern) {
1786
+ this.url.searchParams.append(column, `match.${pattern}`);
1787
+ return this;
1788
+ }
1789
+ /**
1790
+ * Match only rows where `column` matches the PostgreSQL regex `pattern`
1791
+ * case-insensitively (using the `~*` operator).
1792
+ *
1793
+ * @param column - The column to filter on
1794
+ * @param pattern - The PostgreSQL regular expression pattern to match with
1795
+ */
1796
+ regexIMatch(column, pattern) {
1797
+ this.url.searchParams.append(column, `imatch.${pattern}`);
1798
+ return this;
1799
+ }
1800
+ /**
1801
+ * Match only rows where `column` IS `value`.
1802
+ *
1803
+ * For non-boolean columns, this is only relevant for checking if the value of
1804
+ * `column` is NULL by setting `value` to `null`.
1805
+ *
1806
+ * For boolean columns, you can also set `value` to `true` or `false` and it
1807
+ * will behave the same way as `.eq()`.
1808
+ *
1809
+ * @param column - The column to filter on
1810
+ * @param value - The value to filter with
1811
+ *
1812
+ * @category Database
1813
+ * @subcategory Using filters
1814
+ *
1815
+ * @exampleDescription Checking for nullness, true or false
1816
+ * Using the `eq()` filter doesn't work when filtering for `null`.
1817
+ *
1818
+ * Instead, you need to use `is()`.
1819
+ *
1820
+ * @example Checking for nullness, true or false
1821
+ * ```ts
1822
+ * const { data, error } = await supabase
1823
+ * .from('countries')
1824
+ * .select()
1825
+ * .is('name', null)
1826
+ * ```
1827
+ *
1828
+ * @exampleSql Checking for nullness, true or false
1829
+ * ```sql
1830
+ * create table
1831
+ * countries (id int8 primary key, name text);
1832
+ *
1833
+ * insert into
1834
+ * countries (id, name)
1835
+ * values
1836
+ * (1, 'null'),
1837
+ * (2, null);
1838
+ * ```
1839
+ *
1840
+ * @exampleResponse Checking for nullness, true or false
1841
+ * ```json
1842
+ * {
1843
+ * "data": [
1844
+ * {
1845
+ * "id": 2,
1846
+ * "name": "null"
1847
+ * }
1848
+ * ],
1849
+ * "status": 200,
1850
+ * "statusText": "OK"
1851
+ * }
1852
+ * ```
1853
+ */
1854
+ is(column, value) {
1855
+ this.url.searchParams.append(column, `is.${value}`);
1856
+ return this;
1857
+ }
1858
+ /**
1859
+ * Match only rows where `column` IS DISTINCT FROM `value`.
1860
+ *
1861
+ * Unlike `.neq()`, this treats `NULL` as a comparable value. Two `NULL` values
1862
+ * are considered equal (not distinct), and comparing `NULL` with any non-NULL
1863
+ * value returns true (distinct).
1864
+ *
1865
+ * @param column - The column to filter on
1866
+ * @param value - The value to filter with
1867
+ */
1868
+ isDistinct(column, value) {
1869
+ this.url.searchParams.append(column, `isdistinct.${value}`);
1870
+ return this;
1871
+ }
1872
+ /**
1873
+ * Match only rows where `column` is included in the `values` array.
1874
+ *
1875
+ * @param column - The column to filter on
1876
+ * @param values - The values array to filter with
1877
+ *
1878
+ * @category Database
1879
+ * @subcategory Using filters
1880
+ *
1881
+ * @example With `select()`
1882
+ * ```ts
1883
+ * const { data, error } = await supabase
1884
+ * .from('characters')
1885
+ * .select()
1886
+ * .in('name', ['Leia', 'Han'])
1887
+ * ```
1888
+ *
1889
+ * @exampleSql With `select()`
1890
+ * ```sql
1891
+ * create table
1892
+ * characters (id int8 primary key, name text);
1893
+ *
1894
+ * insert into
1895
+ * characters (id, name)
1896
+ * values
1897
+ * (1, 'Luke'),
1898
+ * (2, 'Leia'),
1899
+ * (3, 'Han');
1900
+ * ```
1901
+ *
1902
+ * @exampleResponse With `select()`
1903
+ * ```json
1904
+ * {
1905
+ * "data": [
1906
+ * {
1907
+ * "id": 2,
1908
+ * "name": "Leia"
1909
+ * },
1910
+ * {
1911
+ * "id": 3,
1912
+ * "name": "Han"
1913
+ * }
1914
+ * ],
1915
+ * "status": 200,
1916
+ * "statusText": "OK"
1917
+ * }
1918
+ * ```
1919
+ */
1920
+ in(column, values) {
1921
+ const cleanedValues = Array.from(new Set(values)).map((s) => {
1922
+ if (typeof s === "string" && PostgrestReservedCharsRegexp.test(s)) return `"${s}"`;
1923
+ else return `${s}`;
1924
+ }).join(",");
1925
+ this.url.searchParams.append(column, `in.(${cleanedValues})`);
1926
+ return this;
1927
+ }
1928
+ /**
1929
+ * Match only rows where `column` is NOT included in the `values` array.
1930
+ *
1931
+ * @param column - The column to filter on
1932
+ * @param values - The values array to filter with
1933
+ */
1934
+ notIn(column, values) {
1935
+ const cleanedValues = Array.from(new Set(values)).map((s) => {
1936
+ if (typeof s === "string" && PostgrestReservedCharsRegexp.test(s)) return `"${s}"`;
1937
+ else return `${s}`;
1938
+ }).join(",");
1939
+ this.url.searchParams.append(column, `not.in.(${cleanedValues})`);
1940
+ return this;
1941
+ }
1942
+ /**
1943
+ * Only relevant for jsonb, array, and range columns. Match only rows where
1944
+ * `column` contains every element appearing in `value`.
1945
+ *
1946
+ * @param column - The jsonb, array, or range column to filter on
1947
+ * @param value - The jsonb, array, or range value to filter with
1948
+ *
1949
+ * @category Database
1950
+ * @subcategory Using filters
1951
+ *
1952
+ * @example On array columns
1953
+ * ```ts
1954
+ * const { data, error } = await supabase
1955
+ * .from('issues')
1956
+ * .select()
1957
+ * .contains('tags', ['is:open', 'priority:low'])
1958
+ * ```
1959
+ *
1960
+ * @exampleSql On array columns
1961
+ * ```sql
1962
+ * create table
1963
+ * issues (
1964
+ * id int8 primary key,
1965
+ * title text,
1966
+ * tags text[]
1967
+ * );
1968
+ *
1969
+ * insert into
1970
+ * issues (id, title, tags)
1971
+ * values
1972
+ * (1, 'Cache invalidation is not working', array['is:open', 'severity:high', 'priority:low']),
1973
+ * (2, 'Use better names', array['is:open', 'severity:low', 'priority:medium']);
1974
+ * ```
1975
+ *
1976
+ * @exampleResponse On array columns
1977
+ * ```json
1978
+ * {
1979
+ * "data": [
1980
+ * {
1981
+ * "title": "Cache invalidation is not working"
1982
+ * }
1983
+ * ],
1984
+ * "status": 200,
1985
+ * "statusText": "OK"
1986
+ * }
1987
+ * ```
1988
+ *
1989
+ * @exampleDescription On range columns
1990
+ * Postgres supports a number of [range
1991
+ * types](https://www.postgresql.org/docs/current/rangetypes.html). You
1992
+ * can filter on range columns using the string representation of range
1993
+ * values.
1994
+ *
1995
+ * @example On range columns
1996
+ * ```ts
1997
+ * const { data, error } = await supabase
1998
+ * .from('reservations')
1999
+ * .select()
2000
+ * .contains('during', '[2000-01-01 13:00, 2000-01-01 13:30)')
2001
+ * ```
2002
+ *
2003
+ * @exampleSql On range columns
2004
+ * ```sql
2005
+ * create table
2006
+ * reservations (
2007
+ * id int8 primary key,
2008
+ * room_name text,
2009
+ * during tsrange
2010
+ * );
2011
+ *
2012
+ * insert into
2013
+ * reservations (id, room_name, during)
2014
+ * values
2015
+ * (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'),
2016
+ * (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');
2017
+ * ```
2018
+ *
2019
+ * @exampleResponse On range columns
2020
+ * ```json
2021
+ * {
2022
+ * "data": [
2023
+ * {
2024
+ * "id": 1,
2025
+ * "room_name": "Emerald",
2026
+ * "during": "[\"2000-01-01 13:00:00\",\"2000-01-01 15:00:00\")"
2027
+ * }
2028
+ * ],
2029
+ * "status": 200,
2030
+ * "statusText": "OK"
2031
+ * }
2032
+ * ```
2033
+ *
2034
+ * @example On `jsonb` columns
2035
+ * ```ts
2036
+ * const { data, error } = await supabase
2037
+ * .from('users')
2038
+ * .select('name')
2039
+ * .contains('address', { postcode: 90210 })
2040
+ * ```
2041
+ *
2042
+ * @exampleSql On `jsonb` columns
2043
+ * ```sql
2044
+ * create table
2045
+ * users (
2046
+ * id int8 primary key,
2047
+ * name text,
2048
+ * address jsonb
2049
+ * );
2050
+ *
2051
+ * insert into
2052
+ * users (id, name, address)
2053
+ * values
2054
+ * (1, 'Michael', '{ "postcode": 90210, "street": "Melrose Place" }'),
2055
+ * (2, 'Jane', '{}');
2056
+ * ```
2057
+ *
2058
+ * @exampleResponse On `jsonb` columns
2059
+ * ```json
2060
+ * {
2061
+ * "data": [
2062
+ * {
2063
+ * "name": "Michael"
2064
+ * }
2065
+ * ],
2066
+ * "status": 200,
2067
+ * "statusText": "OK"
2068
+ * }
2069
+ * ```
2070
+ */
2071
+ contains(column, value) {
2072
+ if (typeof value === "string") this.url.searchParams.append(column, `cs.${value}`);
2073
+ else if (Array.isArray(value)) this.url.searchParams.append(column, `cs.{${value.join(",")}}`);
2074
+ else this.url.searchParams.append(column, `cs.${JSON.stringify(value)}`);
2075
+ return this;
2076
+ }
2077
+ /**
2078
+ * Only relevant for jsonb, array, and range columns. Match only rows where
2079
+ * every element appearing in `column` is contained by `value`.
2080
+ *
2081
+ * @param column - The jsonb, array, or range column to filter on
2082
+ * @param value - The jsonb, array, or range value to filter with
2083
+ *
2084
+ * @category Database
2085
+ * @subcategory Using filters
2086
+ *
2087
+ * @example On array columns
2088
+ * ```ts
2089
+ * const { data, error } = await supabase
2090
+ * .from('classes')
2091
+ * .select('name')
2092
+ * .containedBy('days', ['monday', 'tuesday', 'wednesday', 'friday'])
2093
+ * ```
2094
+ *
2095
+ * @exampleSql On array columns
2096
+ * ```sql
2097
+ * create table
2098
+ * classes (
2099
+ * id int8 primary key,
2100
+ * name text,
2101
+ * days text[]
2102
+ * );
2103
+ *
2104
+ * insert into
2105
+ * classes (id, name, days)
2106
+ * values
2107
+ * (1, 'Chemistry', array['monday', 'friday']),
2108
+ * (2, 'History', array['monday', 'wednesday', 'thursday']);
2109
+ * ```
2110
+ *
2111
+ * @exampleResponse On array columns
2112
+ * ```json
2113
+ * {
2114
+ * "data": [
2115
+ * {
2116
+ * "name": "Chemistry"
2117
+ * }
2118
+ * ],
2119
+ * "status": 200,
2120
+ * "statusText": "OK"
2121
+ * }
2122
+ * ```
2123
+ *
2124
+ * @exampleDescription On range columns
2125
+ * Postgres supports a number of [range
2126
+ * types](https://www.postgresql.org/docs/current/rangetypes.html). You
2127
+ * can filter on range columns using the string representation of range
2128
+ * values.
2129
+ *
2130
+ * @example On range columns
2131
+ * ```ts
2132
+ * const { data, error } = await supabase
2133
+ * .from('reservations')
2134
+ * .select()
2135
+ * .containedBy('during', '[2000-01-01 00:00, 2000-01-01 23:59)')
2136
+ * ```
2137
+ *
2138
+ * @exampleSql On range columns
2139
+ * ```sql
2140
+ * create table
2141
+ * reservations (
2142
+ * id int8 primary key,
2143
+ * room_name text,
2144
+ * during tsrange
2145
+ * );
2146
+ *
2147
+ * insert into
2148
+ * reservations (id, room_name, during)
2149
+ * values
2150
+ * (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'),
2151
+ * (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');
2152
+ * ```
2153
+ *
2154
+ * @exampleResponse On range columns
2155
+ * ```json
2156
+ * {
2157
+ * "data": [
2158
+ * {
2159
+ * "id": 1,
2160
+ * "room_name": "Emerald",
2161
+ * "during": "[\"2000-01-01 13:00:00\",\"2000-01-01 15:00:00\")"
2162
+ * }
2163
+ * ],
2164
+ * "status": 200,
2165
+ * "statusText": "OK"
2166
+ * }
2167
+ * ```
2168
+ *
2169
+ * @example On `jsonb` columns
2170
+ * ```ts
2171
+ * const { data, error } = await supabase
2172
+ * .from('users')
2173
+ * .select('name')
2174
+ * .containedBy('address', {})
2175
+ * ```
2176
+ *
2177
+ * @exampleSql On `jsonb` columns
2178
+ * ```sql
2179
+ * create table
2180
+ * users (
2181
+ * id int8 primary key,
2182
+ * name text,
2183
+ * address jsonb
2184
+ * );
2185
+ *
2186
+ * insert into
2187
+ * users (id, name, address)
2188
+ * values
2189
+ * (1, 'Michael', '{ "postcode": 90210, "street": "Melrose Place" }'),
2190
+ * (2, 'Jane', '{}');
2191
+ * ```
2192
+ *
2193
+ * @exampleResponse On `jsonb` columns
2194
+ * ```json
2195
+ * {
2196
+ * "data": [
2197
+ * {
2198
+ * "name": "Jane"
2199
+ * }
2200
+ * ],
2201
+ * "status": 200,
2202
+ * "statusText": "OK"
2203
+ * }
2204
+ *
2205
+ * ```
2206
+ */
2207
+ containedBy(column, value) {
2208
+ if (typeof value === "string") this.url.searchParams.append(column, `cd.${value}`);
2209
+ else if (Array.isArray(value)) this.url.searchParams.append(column, `cd.{${value.join(",")}}`);
2210
+ else this.url.searchParams.append(column, `cd.${JSON.stringify(value)}`);
2211
+ return this;
2212
+ }
2213
+ /**
2214
+ * Only relevant for range columns. Match only rows where every element in
2215
+ * `column` is greater than any element in `range`.
2216
+ *
2217
+ * @param column - The range column to filter on
2218
+ * @param range - The range to filter with
2219
+ *
2220
+ * @category Database
2221
+ * @subcategory Using filters
2222
+ *
2223
+ * @exampleDescription With `select()`
2224
+ * Postgres supports a number of [range
2225
+ * types](https://www.postgresql.org/docs/current/rangetypes.html). You
2226
+ * can filter on range columns using the string representation of range
2227
+ * values.
2228
+ *
2229
+ * @example With `select()`
2230
+ * ```ts
2231
+ * const { data, error } = await supabase
2232
+ * .from('reservations')
2233
+ * .select()
2234
+ * .rangeGt('during', '[2000-01-02 08:00, 2000-01-02 09:00)')
2235
+ * ```
2236
+ *
2237
+ * @exampleSql With `select()`
2238
+ * ```sql
2239
+ * create table
2240
+ * reservations (
2241
+ * id int8 primary key,
2242
+ * room_name text,
2243
+ * during tsrange
2244
+ * );
2245
+ *
2246
+ * insert into
2247
+ * reservations (id, room_name, during)
2248
+ * values
2249
+ * (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'),
2250
+ * (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');
2251
+ * ```
2252
+ *
2253
+ * @exampleResponse With `select()`
2254
+ * ```json
2255
+ * {
2256
+ * "data": [
2257
+ * {
2258
+ * "id": 2,
2259
+ * "room_name": "Topaz",
2260
+ * "during": "[\"2000-01-02 09:00:00\",\"2000-01-02 10:00:00\")"
2261
+ * }
2262
+ * ],
2263
+ * "status": 200,
2264
+ * "statusText": "OK"
2265
+ * }
2266
+ *
2267
+ * ```
2268
+ */
2269
+ rangeGt(column, range) {
2270
+ this.url.searchParams.append(column, `sr.${range}`);
2271
+ return this;
2272
+ }
2273
+ /**
2274
+ * Only relevant for range columns. Match only rows where every element in
2275
+ * `column` is either contained in `range` or greater than any element in
2276
+ * `range`.
2277
+ *
2278
+ * @param column - The range column to filter on
2279
+ * @param range - The range to filter with
2280
+ *
2281
+ * @category Database
2282
+ * @subcategory Using filters
2283
+ *
2284
+ * @exampleDescription With `select()`
2285
+ * Postgres supports a number of [range
2286
+ * types](https://www.postgresql.org/docs/current/rangetypes.html). You
2287
+ * can filter on range columns using the string representation of range
2288
+ * values.
2289
+ *
2290
+ * @example With `select()`
2291
+ * ```ts
2292
+ * const { data, error } = await supabase
2293
+ * .from('reservations')
2294
+ * .select()
2295
+ * .rangeGte('during', '[2000-01-02 08:30, 2000-01-02 09:30)')
2296
+ * ```
2297
+ *
2298
+ * @exampleSql With `select()`
2299
+ * ```sql
2300
+ * create table
2301
+ * reservations (
2302
+ * id int8 primary key,
2303
+ * room_name text,
2304
+ * during tsrange
2305
+ * );
2306
+ *
2307
+ * insert into
2308
+ * reservations (id, room_name, during)
2309
+ * values
2310
+ * (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'),
2311
+ * (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');
2312
+ * ```
2313
+ *
2314
+ * @exampleResponse With `select()`
2315
+ * ```json
2316
+ * {
2317
+ * "data": [
2318
+ * {
2319
+ * "id": 2,
2320
+ * "room_name": "Topaz",
2321
+ * "during": "[\"2000-01-02 09:00:00\",\"2000-01-02 10:00:00\")"
2322
+ * }
2323
+ * ],
2324
+ * "status": 200,
2325
+ * "statusText": "OK"
2326
+ * }
2327
+ *
2328
+ * ```
2329
+ */
2330
+ rangeGte(column, range) {
2331
+ this.url.searchParams.append(column, `nxl.${range}`);
2332
+ return this;
2333
+ }
2334
+ /**
2335
+ * Only relevant for range columns. Match only rows where every element in
2336
+ * `column` is less than any element in `range`.
2337
+ *
2338
+ * @param column - The range column to filter on
2339
+ * @param range - The range to filter with
2340
+ *
2341
+ * @category Database
2342
+ * @subcategory Using filters
2343
+ *
2344
+ * @exampleDescription With `select()`
2345
+ * Postgres supports a number of [range
2346
+ * types](https://www.postgresql.org/docs/current/rangetypes.html). You
2347
+ * can filter on range columns using the string representation of range
2348
+ * values.
2349
+ *
2350
+ * @example With `select()`
2351
+ * ```ts
2352
+ * const { data, error } = await supabase
2353
+ * .from('reservations')
2354
+ * .select()
2355
+ * .rangeLt('during', '[2000-01-01 15:00, 2000-01-01 16:00)')
2356
+ * ```
2357
+ *
2358
+ * @exampleSql With `select()`
2359
+ * ```sql
2360
+ * create table
2361
+ * reservations (
2362
+ * id int8 primary key,
2363
+ * room_name text,
2364
+ * during tsrange
2365
+ * );
2366
+ *
2367
+ * insert into
2368
+ * reservations (id, room_name, during)
2369
+ * values
2370
+ * (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'),
2371
+ * (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');
2372
+ * ```
2373
+ *
2374
+ * @exampleResponse With `select()`
2375
+ * ```json
2376
+ * {
2377
+ * "data": [
2378
+ * {
2379
+ * "id": 1,
2380
+ * "room_name": "Emerald",
2381
+ * "during": "[\"2000-01-01 13:00:00\",\"2000-01-01 15:00:00\")"
2382
+ * }
2383
+ * ],
2384
+ * "status": 200,
2385
+ * "statusText": "OK"
2386
+ * }
2387
+ * ```
2388
+ */
2389
+ rangeLt(column, range) {
2390
+ this.url.searchParams.append(column, `sl.${range}`);
2391
+ return this;
2392
+ }
2393
+ /**
2394
+ * Only relevant for range columns. Match only rows where every element in
2395
+ * `column` is either contained in `range` or less than any element in
2396
+ * `range`.
2397
+ *
2398
+ * @param column - The range column to filter on
2399
+ * @param range - The range to filter with
2400
+ *
2401
+ * @category Database
2402
+ * @subcategory Using filters
2403
+ *
2404
+ * @exampleDescription With `select()`
2405
+ * Postgres supports a number of [range
2406
+ * types](https://www.postgresql.org/docs/current/rangetypes.html). You
2407
+ * can filter on range columns using the string representation of range
2408
+ * values.
2409
+ *
2410
+ * @example With `select()`
2411
+ * ```ts
2412
+ * const { data, error } = await supabase
2413
+ * .from('reservations')
2414
+ * .select()
2415
+ * .rangeLte('during', '[2000-01-01 14:00, 2000-01-01 16:00)')
2416
+ * ```
2417
+ *
2418
+ * @exampleSql With `select()`
2419
+ * ```sql
2420
+ * create table
2421
+ * reservations (
2422
+ * id int8 primary key,
2423
+ * room_name text,
2424
+ * during tsrange
2425
+ * );
2426
+ *
2427
+ * insert into
2428
+ * reservations (id, room_name, during)
2429
+ * values
2430
+ * (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'),
2431
+ * (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');
2432
+ * ```
2433
+ *
2434
+ * @exampleResponse With `select()`
2435
+ * ```json
2436
+ * {
2437
+ * "data": [
2438
+ * {
2439
+ * "id": 1,
2440
+ * "room_name": "Emerald",
2441
+ * "during": "[\"2000-01-01 13:00:00\",\"2000-01-01 15:00:00\")"
2442
+ * }
2443
+ * ],
2444
+ * "status": 200,
2445
+ * "statusText": "OK"
2446
+ * }
2447
+ *
2448
+ * ```
2449
+ */
2450
+ rangeLte(column, range) {
2451
+ this.url.searchParams.append(column, `nxr.${range}`);
2452
+ return this;
2453
+ }
2454
+ /**
2455
+ * Only relevant for range columns. Match only rows where `column` is
2456
+ * mutually exclusive to `range` and there can be no element between the two
2457
+ * ranges.
2458
+ *
2459
+ * @param column - The range column to filter on
2460
+ * @param range - The range to filter with
2461
+ *
2462
+ * @category Database
2463
+ * @subcategory Using filters
2464
+ *
2465
+ * @exampleDescription With `select()`
2466
+ * Postgres supports a number of [range
2467
+ * types](https://www.postgresql.org/docs/current/rangetypes.html). You
2468
+ * can filter on range columns using the string representation of range
2469
+ * values.
2470
+ *
2471
+ * @example With `select()`
2472
+ * ```ts
2473
+ * const { data, error } = await supabase
2474
+ * .from('reservations')
2475
+ * .select()
2476
+ * .rangeAdjacent('during', '[2000-01-01 12:00, 2000-01-01 13:00)')
2477
+ * ```
2478
+ *
2479
+ * @exampleSql With `select()`
2480
+ * ```sql
2481
+ * create table
2482
+ * reservations (
2483
+ * id int8 primary key,
2484
+ * room_name text,
2485
+ * during tsrange
2486
+ * );
2487
+ *
2488
+ * insert into
2489
+ * reservations (id, room_name, during)
2490
+ * values
2491
+ * (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'),
2492
+ * (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');
2493
+ * ```
2494
+ *
2495
+ * @exampleResponse With `select()`
2496
+ * ```json
2497
+ * {
2498
+ * "data": [
2499
+ * {
2500
+ * "id": 1,
2501
+ * "room_name": "Emerald",
2502
+ * "during": "[\"2000-01-01 13:00:00\",\"2000-01-01 15:00:00\")"
2503
+ * }
2504
+ * ],
2505
+ * "status": 200,
2506
+ * "statusText": "OK"
2507
+ * }
2508
+ * ```
2509
+ */
2510
+ rangeAdjacent(column, range) {
2511
+ this.url.searchParams.append(column, `adj.${range}`);
2512
+ return this;
2513
+ }
2514
+ /**
2515
+ * Only relevant for array and range columns. Match only rows where
2516
+ * `column` and `value` have an element in common.
2517
+ *
2518
+ * @param column - The array or range column to filter on
2519
+ * @param value - The array or range value to filter with
2520
+ *
2521
+ * @category Database
2522
+ * @subcategory Using filters
2523
+ *
2524
+ * @example On array columns
2525
+ * ```ts
2526
+ * const { data, error } = await supabase
2527
+ * .from('issues')
2528
+ * .select('title')
2529
+ * .overlaps('tags', ['is:closed', 'severity:high'])
2530
+ * ```
2531
+ *
2532
+ * @exampleSql On array columns
2533
+ * ```sql
2534
+ * create table
2535
+ * issues (
2536
+ * id int8 primary key,
2537
+ * title text,
2538
+ * tags text[]
2539
+ * );
2540
+ *
2541
+ * insert into
2542
+ * issues (id, title, tags)
2543
+ * values
2544
+ * (1, 'Cache invalidation is not working', array['is:open', 'severity:high', 'priority:low']),
2545
+ * (2, 'Use better names', array['is:open', 'severity:low', 'priority:medium']);
2546
+ * ```
2547
+ *
2548
+ * @exampleResponse On array columns
2549
+ * ```json
2550
+ * {
2551
+ * "data": [
2552
+ * {
2553
+ * "title": "Cache invalidation is not working"
2554
+ * }
2555
+ * ],
2556
+ * "status": 200,
2557
+ * "statusText": "OK"
2558
+ * }
2559
+ * ```
2560
+ *
2561
+ * @exampleDescription On range columns
2562
+ * Postgres supports a number of [range
2563
+ * types](https://www.postgresql.org/docs/current/rangetypes.html). You
2564
+ * can filter on range columns using the string representation of range
2565
+ * values.
2566
+ *
2567
+ * @example On range columns
2568
+ * ```ts
2569
+ * const { data, error } = await supabase
2570
+ * .from('reservations')
2571
+ * .select()
2572
+ * .overlaps('during', '[2000-01-01 12:45, 2000-01-01 13:15)')
2573
+ * ```
2574
+ *
2575
+ * @exampleSql On range columns
2576
+ * ```sql
2577
+ * create table
2578
+ * reservations (
2579
+ * id int8 primary key,
2580
+ * room_name text,
2581
+ * during tsrange
2582
+ * );
2583
+ *
2584
+ * insert into
2585
+ * reservations (id, room_name, during)
2586
+ * values
2587
+ * (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'),
2588
+ * (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');
2589
+ * ```
2590
+ *
2591
+ * @exampleResponse On range columns
2592
+ * ```json
2593
+ * {
2594
+ * "data": [
2595
+ * {
2596
+ * "id": 1,
2597
+ * "room_name": "Emerald",
2598
+ * "during": "[\"2000-01-01 13:00:00\",\"2000-01-01 15:00:00\")"
2599
+ * }
2600
+ * ],
2601
+ * "status": 200,
2602
+ * "statusText": "OK"
2603
+ * }
2604
+ * ```
2605
+ */
2606
+ overlaps(column, value) {
2607
+ if (typeof value === "string") this.url.searchParams.append(column, `ov.${value}`);
2608
+ else this.url.searchParams.append(column, `ov.{${value.join(",")}}`);
2609
+ return this;
2610
+ }
2611
+ /**
2612
+ * Only relevant for text and tsvector columns. Match only rows where
2613
+ * `column` matches the query string in `query`.
2614
+ *
2615
+ * @param column - The text or tsvector column to filter on
2616
+ * @param query - The query text to match with
2617
+ * @param options - Named parameters
2618
+ * @param options.config - The text search configuration to use
2619
+ * @param options.type - Change how the `query` text is interpreted
2620
+ *
2621
+ * @category Database
2622
+ * @subcategory Using filters
2623
+ *
2624
+ * @remarks
2625
+ * - For more information, see [Postgres full text search](/docs/guides/database/full-text-search).
2626
+ *
2627
+ * @example Text search
2628
+ * ```ts
2629
+ * const result = await supabase
2630
+ * .from("texts")
2631
+ * .select("content")
2632
+ * .textSearch("content", `'eggs' & 'ham'`, {
2633
+ * config: "english",
2634
+ * });
2635
+ * ```
2636
+ *
2637
+ * @exampleSql Text search
2638
+ * ```sql
2639
+ * create table texts (
2640
+ * id bigint
2641
+ * primary key
2642
+ * generated always as identity,
2643
+ * content text
2644
+ * );
2645
+ *
2646
+ * insert into texts (content) values
2647
+ * ('Four score and seven years ago'),
2648
+ * ('The road goes ever on and on'),
2649
+ * ('Green eggs and ham')
2650
+ * ;
2651
+ * ```
2652
+ *
2653
+ * @exampleResponse Text search
2654
+ * ```json
2655
+ * {
2656
+ * "data": [
2657
+ * {
2658
+ * "content": "Green eggs and ham"
2659
+ * }
2660
+ * ],
2661
+ * "status": 200,
2662
+ * "statusText": "OK"
2663
+ * }
2664
+ * ```
2665
+ *
2666
+ * @exampleDescription Basic normalization
2667
+ * Uses PostgreSQL's `plainto_tsquery` function.
2668
+ *
2669
+ * @example Basic normalization
2670
+ * ```ts
2671
+ * const { data, error } = await supabase
2672
+ * .from('quotes')
2673
+ * .select('catchphrase')
2674
+ * .textSearch('catchphrase', `'fat' & 'cat'`, {
2675
+ * type: 'plain',
2676
+ * config: 'english'
2677
+ * })
2678
+ * ```
2679
+ *
2680
+ * @exampleDescription Full normalization
2681
+ * Uses PostgreSQL's `phraseto_tsquery` function.
2682
+ *
2683
+ * @example Full normalization
2684
+ * ```ts
2685
+ * const { data, error } = await supabase
2686
+ * .from('quotes')
2687
+ * .select('catchphrase')
2688
+ * .textSearch('catchphrase', `'fat' & 'cat'`, {
2689
+ * type: 'phrase',
2690
+ * config: 'english'
2691
+ * })
2692
+ * ```
2693
+ *
2694
+ * @exampleDescription Websearch
2695
+ * Uses PostgreSQL's `websearch_to_tsquery` function.
2696
+ * This function will never raise syntax errors, which makes it possible to use raw user-supplied input for search, and can be used
2697
+ * with advanced operators.
2698
+ *
2699
+ * - `unquoted text`: text not inside quote marks will be converted to terms separated by & operators, as if processed by plainto_tsquery.
2700
+ * - `"quoted text"`: text inside quote marks will be converted to terms separated by `<->` operators, as if processed by phraseto_tsquery.
2701
+ * - `OR`: the word “or” will be converted to the | operator.
2702
+ * - `-`: a dash will be converted to the ! operator.
2703
+ *
2704
+ * @example Websearch
2705
+ * ```ts
2706
+ * const { data, error } = await supabase
2707
+ * .from('quotes')
2708
+ * .select('catchphrase')
2709
+ * .textSearch('catchphrase', `'fat or cat'`, {
2710
+ * type: 'websearch',
2711
+ * config: 'english'
2712
+ * })
2713
+ * ```
2714
+ */
2715
+ textSearch(column, query, { config, type } = {}) {
2716
+ let typePart = "";
2717
+ if (type === "plain") typePart = "pl";
2718
+ else if (type === "phrase") typePart = "ph";
2719
+ else if (type === "websearch") typePart = "w";
2720
+ const configPart = config === void 0 ? "" : `(${config})`;
2721
+ this.url.searchParams.append(column, `${typePart}fts${configPart}.${query}`);
2722
+ return this;
2723
+ }
2724
+ /**
2725
+ * Match only rows where each column in `query` keys is equal to its
2726
+ * associated value. Shorthand for multiple `.eq()`s.
2727
+ *
2728
+ * @param query - The object to filter with, with column names as keys mapped
2729
+ * to their filter values
2730
+ *
2731
+ * @category Database
2732
+ * @subcategory Using filters
2733
+ *
2734
+ * @example With `select()`
2735
+ * ```ts
2736
+ * const { data, error } = await supabase
2737
+ * .from('characters')
2738
+ * .select('name')
2739
+ * .match({ id: 2, name: 'Leia' })
2740
+ * ```
2741
+ *
2742
+ * @exampleSql With `select()`
2743
+ * ```sql
2744
+ * create table
2745
+ * characters (id int8 primary key, name text);
2746
+ *
2747
+ * insert into
2748
+ * characters (id, name)
2749
+ * values
2750
+ * (1, 'Luke'),
2751
+ * (2, 'Leia'),
2752
+ * (3, 'Han');
2753
+ * ```
2754
+ *
2755
+ * @exampleResponse With `select()`
2756
+ * ```json
2757
+ * {
2758
+ * "data": [
2759
+ * {
2760
+ * "name": "Leia"
2761
+ * }
2762
+ * ],
2763
+ * "status": 200,
2764
+ * "statusText": "OK"
2765
+ * }
2766
+ * ```
2767
+ */
2768
+ match(query) {
2769
+ Object.entries(query).filter(([_, value]) => value !== void 0).forEach(([column, value]) => {
2770
+ this.url.searchParams.append(column, `eq.${value}`);
2771
+ });
2772
+ return this;
2773
+ }
2774
+ /**
2775
+ * Match only rows which doesn't satisfy the filter.
2776
+ *
2777
+ * Unlike most filters, `opearator` and `value` are used as-is and need to
2778
+ * follow [PostgREST
2779
+ * syntax](https://postgrest.org/en/stable/api.html#operators). You also need
2780
+ * to make sure they are properly sanitized.
2781
+ *
2782
+ * @param column - The column to filter on
2783
+ * @param operator - The operator to be negated to filter with, following
2784
+ * PostgREST syntax
2785
+ * @param value - The value to filter with, following PostgREST syntax
2786
+ *
2787
+ * @category Database
2788
+ * @subcategory Using filters
2789
+ *
2790
+ * @remarks
2791
+ * not() expects you to use the raw PostgREST syntax for the filter values.
2792
+ *
2793
+ * ```ts
2794
+ * .not('id', 'in', '(5,6,7)') // Use `()` for `in` filter
2795
+ * .not('arraycol', 'cs', '{"a","b"}') // Use `cs` for `contains()`, `{}` for array values
2796
+ * ```
2797
+ *
2798
+ * @example With `select()`
2799
+ * ```ts
2800
+ * const { data, error } = await supabase
2801
+ * .from('countries')
2802
+ * .select()
2803
+ * .not('name', 'is', null)
2804
+ * ```
2805
+ *
2806
+ * @exampleSql With `select()`
2807
+ * ```sql
2808
+ * create table
2809
+ * countries (id int8 primary key, name text);
2810
+ *
2811
+ * insert into
2812
+ * countries (id, name)
2813
+ * values
2814
+ * (1, 'null'),
2815
+ * (2, null);
2816
+ * ```
2817
+ *
2818
+ * @exampleResponse With `select()`
2819
+ * ```json
2820
+ * {
2821
+ * "data": [
2822
+ * {
2823
+ * "id": 1,
2824
+ * "name": "null"
2825
+ * }
2826
+ * ],
2827
+ * "status": 200,
2828
+ * "statusText": "OK"
2829
+ * }
2830
+ *
2831
+ * ```
2832
+ */
2833
+ not(column, operator, value) {
2834
+ this.url.searchParams.append(column, `not.${operator}.${value}`);
2835
+ return this;
2836
+ }
2837
+ /**
2838
+ * Match only rows which satisfy at least one of the filters.
2839
+ *
2840
+ * Unlike most filters, `filters` is used as-is and needs to follow [PostgREST
2841
+ * syntax](https://postgrest.org/en/stable/api.html#operators). You also need
2842
+ * to make sure it's properly sanitized.
2843
+ *
2844
+ * It's currently not possible to do an `.or()` filter across multiple tables.
2845
+ *
2846
+ * @param filters - The filters to use, following PostgREST syntax
2847
+ * @param options - Named parameters
2848
+ * @param options.referencedTable - Set this to filter on referenced tables
2849
+ * instead of the parent table
2850
+ * @param options.foreignTable - Deprecated, use `referencedTable` instead
2851
+ *
2852
+ * @category Database
2853
+ * @subcategory Using filters
2854
+ *
2855
+ * @remarks
2856
+ * or() expects you to use the raw PostgREST syntax for the filter names and values.
2857
+ *
2858
+ * ```ts
2859
+ * .or('id.in.(5,6,7), arraycol.cs.{"a","b"}') // Use `()` for `in` filter, `{}` for array values and `cs` for `contains()`.
2860
+ * .or('id.in.(5,6,7), arraycol.cd.{"a","b"}') // Use `cd` for `containedBy()`
2861
+ * ```
2862
+ *
2863
+ * @example With `select()`
2864
+ * ```ts
2865
+ * const { data, error } = await supabase
2866
+ * .from('characters')
2867
+ * .select('name')
2868
+ * .or('id.eq.2,name.eq.Han')
2869
+ * ```
2870
+ *
2871
+ * @exampleSql With `select()`
2872
+ * ```sql
2873
+ * create table
2874
+ * characters (id int8 primary key, name text);
2875
+ *
2876
+ * insert into
2877
+ * characters (id, name)
2878
+ * values
2879
+ * (1, 'Luke'),
2880
+ * (2, 'Leia'),
2881
+ * (3, 'Han');
2882
+ * ```
2883
+ *
2884
+ * @exampleResponse With `select()`
2885
+ * ```json
2886
+ * {
2887
+ * "data": [
2888
+ * {
2889
+ * "name": "Leia"
2890
+ * },
2891
+ * {
2892
+ * "name": "Han"
2893
+ * }
2894
+ * ],
2895
+ * "status": 200,
2896
+ * "statusText": "OK"
2897
+ * }
2898
+ * ```
2899
+ *
2900
+ * @example Use `or` with `and`
2901
+ * ```ts
2902
+ * const { data, error } = await supabase
2903
+ * .from('characters')
2904
+ * .select('name')
2905
+ * .or('id.gt.3,and(id.eq.1,name.eq.Luke)')
2906
+ * ```
2907
+ *
2908
+ * @exampleSql Use `or` with `and`
2909
+ * ```sql
2910
+ * create table
2911
+ * characters (id int8 primary key, name text);
2912
+ *
2913
+ * insert into
2914
+ * characters (id, name)
2915
+ * values
2916
+ * (1, 'Luke'),
2917
+ * (2, 'Leia'),
2918
+ * (3, 'Han');
2919
+ * ```
2920
+ *
2921
+ * @exampleResponse Use `or` with `and`
2922
+ * ```json
2923
+ * {
2924
+ * "data": [
2925
+ * {
2926
+ * "name": "Luke"
2927
+ * }
2928
+ * ],
2929
+ * "status": 200,
2930
+ * "statusText": "OK"
2931
+ * }
2932
+ * ```
2933
+ *
2934
+ * @example Use `or` on referenced tables
2935
+ * ```ts
2936
+ * const { data, error } = await supabase
2937
+ * .from('orchestral_sections')
2938
+ * .select(`
2939
+ * name,
2940
+ * instruments!inner (
2941
+ * name
2942
+ * )
2943
+ * `)
2944
+ * .or('section_id.eq.1,name.eq.guzheng', { referencedTable: 'instruments' })
2945
+ * ```
2946
+ *
2947
+ * @exampleSql Use `or` on referenced tables
2948
+ * ```sql
2949
+ * create table
2950
+ * orchestral_sections (id int8 primary key, name text);
2951
+ * create table
2952
+ * instruments (
2953
+ * id int8 primary key,
2954
+ * section_id int8 not null references orchestral_sections,
2955
+ * name text
2956
+ * );
2957
+ *
2958
+ * insert into
2959
+ * orchestral_sections (id, name)
2960
+ * values
2961
+ * (1, 'strings'),
2962
+ * (2, 'woodwinds');
2963
+ * insert into
2964
+ * instruments (id, section_id, name)
2965
+ * values
2966
+ * (1, 2, 'flute'),
2967
+ * (2, 1, 'violin');
2968
+ * ```
2969
+ *
2970
+ * @exampleResponse Use `or` on referenced tables
2971
+ * ```json
2972
+ * {
2973
+ * "data": [
2974
+ * {
2975
+ * "name": "strings",
2976
+ * "instruments": [
2977
+ * {
2978
+ * "name": "violin"
2979
+ * }
2980
+ * ]
2981
+ * }
2982
+ * ],
2983
+ * "status": 200,
2984
+ * "statusText": "OK"
2985
+ * }
2986
+ * ```
2987
+ */
2988
+ or(filters, { foreignTable, referencedTable = foreignTable } = {}) {
2989
+ const key = referencedTable ? `${referencedTable}.or` : "or";
2990
+ this.url.searchParams.append(key, `(${filters})`);
2991
+ return this;
2992
+ }
2993
+ /**
2994
+ * Match only rows which satisfy the filter. This is an escape hatch - you
2995
+ * should use the specific filter methods wherever possible.
2996
+ *
2997
+ * Unlike most filters, `opearator` and `value` are used as-is and need to
2998
+ * follow [PostgREST
2999
+ * syntax](https://postgrest.org/en/stable/api.html#operators). You also need
3000
+ * to make sure they are properly sanitized.
3001
+ *
3002
+ * @param column - The column to filter on
3003
+ * @param operator - The operator to filter with, following PostgREST syntax
3004
+ * @param value - The value to filter with, following PostgREST syntax
3005
+ *
3006
+ * @category Database
3007
+ * @subcategory Using filters
3008
+ *
3009
+ * @remarks
3010
+ * filter() expects you to use the raw PostgREST syntax for the filter values.
3011
+ *
3012
+ * ```ts
3013
+ * .filter('id', 'in', '(5,6,7)') // Use `()` for `in` filter
3014
+ * .filter('arraycol', 'cs', '{"a","b"}') // Use `cs` for `contains()`, `{}` for array values
3015
+ * ```
3016
+ *
3017
+ * @example With `select()`
3018
+ * ```ts
3019
+ * const { data, error } = await supabase
3020
+ * .from('characters')
3021
+ * .select()
3022
+ * .filter('name', 'in', '("Han","Yoda")')
3023
+ * ```
3024
+ *
3025
+ * @exampleSql With `select()`
3026
+ * ```sql
3027
+ * create table
3028
+ * characters (id int8 primary key, name text);
3029
+ *
3030
+ * insert into
3031
+ * characters (id, name)
3032
+ * values
3033
+ * (1, 'Luke'),
3034
+ * (2, 'Leia'),
3035
+ * (3, 'Han');
3036
+ * ```
3037
+ *
3038
+ * @exampleResponse With `select()`
3039
+ * ```json
3040
+ * {
3041
+ * "data": [
3042
+ * {
3043
+ * "id": 3,
3044
+ * "name": "Han"
3045
+ * }
3046
+ * ],
3047
+ * "status": 200,
3048
+ * "statusText": "OK"
3049
+ * }
3050
+ * ```
3051
+ *
3052
+ * @example On a referenced table
3053
+ * ```ts
3054
+ * const { data, error } = await supabase
3055
+ * .from('orchestral_sections')
3056
+ * .select(`
3057
+ * name,
3058
+ * instruments!inner (
3059
+ * name
3060
+ * )
3061
+ * `)
3062
+ * .filter('instruments.name', 'eq', 'flute')
3063
+ * ```
3064
+ *
3065
+ * @exampleSql On a referenced table
3066
+ * ```sql
3067
+ * create table
3068
+ * orchestral_sections (id int8 primary key, name text);
3069
+ * create table
3070
+ * instruments (
3071
+ * id int8 primary key,
3072
+ * section_id int8 not null references orchestral_sections,
3073
+ * name text
3074
+ * );
3075
+ *
3076
+ * insert into
3077
+ * orchestral_sections (id, name)
3078
+ * values
3079
+ * (1, 'strings'),
3080
+ * (2, 'woodwinds');
3081
+ * insert into
3082
+ * instruments (id, section_id, name)
3083
+ * values
3084
+ * (1, 2, 'flute'),
3085
+ * (2, 1, 'violin');
3086
+ * ```
3087
+ *
3088
+ * @exampleResponse On a referenced table
3089
+ * ```json
3090
+ * {
3091
+ * "data": [
3092
+ * {
3093
+ * "name": "woodwinds",
3094
+ * "instruments": [
3095
+ * {
3096
+ * "name": "flute"
3097
+ * }
3098
+ * ]
3099
+ * }
3100
+ * ],
3101
+ * "status": 200,
3102
+ * "statusText": "OK"
3103
+ * }
3104
+ * ```
3105
+ */
3106
+ filter(column, operator, value) {
3107
+ this.url.searchParams.append(column, `${operator}.${value}`);
3108
+ return this;
3109
+ }
3110
+ };
3111
+
3112
+ //#endregion
3113
+ //#region src/PostgrestQueryBuilder.ts
3114
+ var PostgrestQueryBuilder = class {
3115
+ /**
3116
+ * Creates a query builder scoped to a Postgres table or view.
3117
+ *
3118
+ * @category Database
3119
+ *
3120
+ * @param url - The URL for the query
3121
+ * @param options - Named parameters
3122
+ * @param options.headers - Custom headers
3123
+ * @param options.schema - Postgres schema to use
3124
+ * @param options.fetch - Custom fetch implementation
3125
+ * @param options.urlLengthLimit - Maximum URL length before warning
3126
+ * @param options.retry - Enable automatic retries for transient errors (default: true)
3127
+ *
3128
+ * @example Using supabase-js (recommended)
3129
+ * ```ts
3130
+ * import { createClient } from '@supabase/supabase-js'
3131
+ *
3132
+ * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')
3133
+ * const { data, error } = await supabase.from('users').select('*')
3134
+ * ```
3135
+ *
3136
+ * @example Standalone import for bundle-sensitive environments
3137
+ * ```ts
3138
+ * import { PostgrestQueryBuilder } from '@supabase/postgrest-js'
3139
+ *
3140
+ * const query = new PostgrestQueryBuilder(
3141
+ * new URL('https://xyzcompany.supabase.co/rest/v1/users'),
3142
+ * { headers: { apikey: 'your-publishable-key' }, retry: true }
3143
+ * )
3144
+ * ```
3145
+ */
3146
+ constructor(url, { headers = {}, schema, fetch: fetch$1, urlLengthLimit = 8e3, retry }) {
3147
+ this.url = url;
3148
+ this.headers = new Headers(headers);
3149
+ this.schema = schema;
3150
+ this.fetch = fetch$1;
3151
+ this.urlLengthLimit = urlLengthLimit;
3152
+ this.retry = retry;
3153
+ }
3154
+ /**
3155
+ * Clone URL and headers to prevent shared state between operations.
3156
+ */
3157
+ cloneRequestState() {
3158
+ return {
3159
+ url: new URL(this.url.toString()),
3160
+ headers: new Headers(this.headers)
3161
+ };
3162
+ }
3163
+ /**
3164
+ * Perform a SELECT query on the table or view.
3165
+ *
3166
+ * @param columns - The columns to retrieve, separated by commas. Columns can be renamed when returned with `customName:columnName`
3167
+ *
3168
+ * @param options - Named parameters
3169
+ *
3170
+ * @param options.head - When set to `true`, `data` will not be returned.
3171
+ * Useful if you only need the count.
3172
+ *
3173
+ * @param options.count - Count algorithm to use to count rows in the table or view.
3174
+ *
3175
+ * `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the
3176
+ * hood.
3177
+ *
3178
+ * `"planned"`: Approximated but fast count algorithm. Uses the Postgres
3179
+ * statistics under the hood.
3180
+ *
3181
+ * `"estimated"`: Uses exact count for low numbers and planned count for high
3182
+ * numbers.
3183
+ *
3184
+ * @remarks
3185
+ * When using `count` with `.range()` or `.limit()`, the returned `count` is the total number of rows
3186
+ * that match your filters, not the number of rows in the current page. Use this to build pagination UI.
3187
+
3188
+ * - By default, Supabase projects return a maximum of 1,000 rows. This setting can be changed in your project's [API settings](/dashboard/project/_/settings/api). It's recommended that you keep it low to limit the payload size of accidental or malicious requests. You can use `range()` queries to paginate through your data.
3189
+ * - `select()` can be combined with [Filters](/docs/reference/javascript/using-filters)
3190
+ * - `select()` can be combined with [Modifiers](/docs/reference/javascript/using-modifiers)
3191
+ * - `apikey` is a reserved keyword if you're using the [Supabase Platform](/docs/guides/platform) and [should be avoided as a column name](https://github.com/supabase/supabase/issues/5465). *
3192
+ * @category Database
3193
+ *
3194
+ * @example Getting your data
3195
+ * ```js
3196
+ * const { data, error } = await supabase
3197
+ * .from('characters')
3198
+ * .select()
3199
+ * ```
3200
+ *
3201
+ * @exampleSql Getting your data
3202
+ * ```sql
3203
+ * create table
3204
+ * characters (id int8 primary key, name text);
3205
+ *
3206
+ * insert into
3207
+ * characters (id, name)
3208
+ * values
3209
+ * (1, 'Harry'),
3210
+ * (2, 'Frodo'),
3211
+ * (3, 'Katniss');
3212
+ * ```
3213
+ *
3214
+ * @exampleResponse Getting your data
3215
+ * ```json
3216
+ * {
3217
+ * "data": [
3218
+ * {
3219
+ * "id": 1,
3220
+ * "name": "Harry"
3221
+ * },
3222
+ * {
3223
+ * "id": 2,
3224
+ * "name": "Frodo"
3225
+ * },
3226
+ * {
3227
+ * "id": 3,
3228
+ * "name": "Katniss"
3229
+ * }
3230
+ * ],
3231
+ * "status": 200,
3232
+ * "statusText": "OK"
3233
+ * }
3234
+ * ```
3235
+ *
3236
+ * @example Selecting specific columns
3237
+ * ```js
3238
+ * const { data, error } = await supabase
3239
+ * .from('characters')
3240
+ * .select('name')
3241
+ * ```
3242
+ *
3243
+ * @exampleSql Selecting specific columns
3244
+ * ```sql
3245
+ * create table
3246
+ * characters (id int8 primary key, name text);
3247
+ *
3248
+ * insert into
3249
+ * characters (id, name)
3250
+ * values
3251
+ * (1, 'Frodo'),
3252
+ * (2, 'Harry'),
3253
+ * (3, 'Katniss');
3254
+ * ```
3255
+ *
3256
+ * @exampleResponse Selecting specific columns
3257
+ * ```json
3258
+ * {
3259
+ * "data": [
3260
+ * {
3261
+ * "name": "Frodo"
3262
+ * },
3263
+ * {
3264
+ * "name": "Harry"
3265
+ * },
3266
+ * {
3267
+ * "name": "Katniss"
3268
+ * }
3269
+ * ],
3270
+ * "status": 200,
3271
+ * "statusText": "OK"
3272
+ * }
3273
+ * ```
3274
+ *
3275
+ * @exampleDescription Query referenced tables
3276
+ * If your database has foreign key relationships, you can query related tables too.
3277
+ *
3278
+ * @example Query referenced tables
3279
+ * ```js
3280
+ * const { data, error } = await supabase
3281
+ * .from('orchestral_sections')
3282
+ * .select(`
3283
+ * name,
3284
+ * instruments (
3285
+ * name
3286
+ * )
3287
+ * `)
3288
+ * ```
3289
+ *
3290
+ * @exampleSql Query referenced tables
3291
+ * ```sql
3292
+ * create table
3293
+ * orchestral_sections (id int8 primary key, name text);
3294
+ * create table
3295
+ * instruments (
3296
+ * id int8 primary key,
3297
+ * section_id int8 not null references orchestral_sections,
3298
+ * name text
3299
+ * );
3300
+ *
3301
+ * insert into
3302
+ * orchestral_sections (id, name)
3303
+ * values
3304
+ * (1, 'strings'),
3305
+ * (2, 'woodwinds');
3306
+ * insert into
3307
+ * instruments (id, section_id, name)
3308
+ * values
3309
+ * (1, 2, 'flute'),
3310
+ * (2, 1, 'violin');
3311
+ * ```
3312
+ *
3313
+ * @exampleResponse Query referenced tables
3314
+ * ```json
3315
+ * {
3316
+ * "data": [
3317
+ * {
3318
+ * "name": "strings",
3319
+ * "instruments": [
3320
+ * {
3321
+ * "name": "violin"
3322
+ * }
3323
+ * ]
3324
+ * },
3325
+ * {
3326
+ * "name": "woodwinds",
3327
+ * "instruments": [
3328
+ * {
3329
+ * "name": "flute"
3330
+ * }
3331
+ * ]
3332
+ * }
3333
+ * ],
3334
+ * "status": 200,
3335
+ * "statusText": "OK"
3336
+ * }
3337
+ * ```
3338
+ *
3339
+ * @exampleDescription Query referenced tables with spaces in their names
3340
+ * If your table name contains spaces, you must use double quotes in the `select` statement to reference the table.
3341
+ *
3342
+ * @example Query referenced tables with spaces in their names
3343
+ * ```js
3344
+ * const { data, error } = await supabase
3345
+ * .from('orchestral sections')
3346
+ * .select(`
3347
+ * name,
3348
+ * "musical instruments" (
3349
+ * name
3350
+ * )
3351
+ * `)
3352
+ * ```
3353
+ *
3354
+ * @exampleSql Query referenced tables with spaces in their names
3355
+ * ```sql
3356
+ * create table
3357
+ * "orchestral sections" (id int8 primary key, name text);
3358
+ * create table
3359
+ * "musical instruments" (
3360
+ * id int8 primary key,
3361
+ * section_id int8 not null references "orchestral sections",
3362
+ * name text
3363
+ * );
3364
+ *
3365
+ * insert into
3366
+ * "orchestral sections" (id, name)
3367
+ * values
3368
+ * (1, 'strings'),
3369
+ * (2, 'woodwinds');
3370
+ * insert into
3371
+ * "musical instruments" (id, section_id, name)
3372
+ * values
3373
+ * (1, 2, 'flute'),
3374
+ * (2, 1, 'violin');
3375
+ * ```
3376
+ *
3377
+ * @exampleResponse Query referenced tables with spaces in their names
3378
+ * ```json
3379
+ * {
3380
+ * "data": [
3381
+ * {
3382
+ * "name": "strings",
3383
+ * "musical instruments": [
3384
+ * {
3385
+ * "name": "violin"
3386
+ * }
3387
+ * ]
3388
+ * },
3389
+ * {
3390
+ * "name": "woodwinds",
3391
+ * "musical instruments": [
3392
+ * {
3393
+ * "name": "flute"
3394
+ * }
3395
+ * ]
3396
+ * }
3397
+ * ],
3398
+ * "status": 200,
3399
+ * "statusText": "OK"
3400
+ * }
3401
+ * ```
3402
+ *
3403
+ * @exampleDescription Query referenced tables through a join table
3404
+ * If you're in a situation where your tables are **NOT** directly
3405
+ * related, but instead are joined by a _join table_, you can still use
3406
+ * the `select()` method to query the related data. The join table needs
3407
+ * to have the foreign keys as part of its composite primary key.
3408
+ *
3409
+ * @example Query referenced tables through a join table
3410
+ * ```ts
3411
+ * const { data, error } = await supabase
3412
+ * .from('users')
3413
+ * .select(`
3414
+ * name,
3415
+ * teams (
3416
+ * name
3417
+ * )
3418
+ * `)
3419
+ *
3420
+ * ```
3421
+ *
3422
+ * @exampleSql Query referenced tables through a join table
3423
+ * ```sql
3424
+ * create table
3425
+ * users (
3426
+ * id int8 primary key,
3427
+ * name text
3428
+ * );
3429
+ * create table
3430
+ * teams (
3431
+ * id int8 primary key,
3432
+ * name text
3433
+ * );
3434
+ * -- join table
3435
+ * create table
3436
+ * users_teams (
3437
+ * user_id int8 not null references users,
3438
+ * team_id int8 not null references teams,
3439
+ * -- both foreign keys must be part of a composite primary key
3440
+ * primary key (user_id, team_id)
3441
+ * );
3442
+ *
3443
+ * insert into
3444
+ * users (id, name)
3445
+ * values
3446
+ * (1, 'Kiran'),
3447
+ * (2, 'Evan');
3448
+ * insert into
3449
+ * teams (id, name)
3450
+ * values
3451
+ * (1, 'Green'),
3452
+ * (2, 'Blue');
3453
+ * insert into
3454
+ * users_teams (user_id, team_id)
3455
+ * values
3456
+ * (1, 1),
3457
+ * (1, 2),
3458
+ * (2, 2);
3459
+ * ```
3460
+ *
3461
+ * @exampleResponse Query referenced tables through a join table
3462
+ * ```json
3463
+ * {
3464
+ * "data": [
3465
+ * {
3466
+ * "name": "Kiran",
3467
+ * "teams": [
3468
+ * {
3469
+ * "name": "Green"
3470
+ * },
3471
+ * {
3472
+ * "name": "Blue"
3473
+ * }
3474
+ * ]
3475
+ * },
3476
+ * {
3477
+ * "name": "Evan",
3478
+ * "teams": [
3479
+ * {
3480
+ * "name": "Blue"
3481
+ * }
3482
+ * ]
3483
+ * }
3484
+ * ],
3485
+ * "status": 200,
3486
+ * "statusText": "OK"
3487
+ * }
3488
+ *
3489
+ * ```
3490
+ *
3491
+ * @exampleDescription Query the same referenced table multiple times
3492
+ * If you need to query the same referenced table twice, use the name of the
3493
+ * joined column to identify which join to use. You can also give each
3494
+ * column an alias.
3495
+ *
3496
+ * @example Query the same referenced table multiple times
3497
+ * ```ts
3498
+ * const { data, error } = await supabase
3499
+ * .from('messages')
3500
+ * .select(`
3501
+ * content,
3502
+ * from:sender_id(name),
3503
+ * to:receiver_id(name)
3504
+ * `)
3505
+ *
3506
+ * // To infer types, use the name of the table (in this case `users`) and
3507
+ * // the name of the foreign key constraint.
3508
+ * const { data, error } = await supabase
3509
+ * .from('messages')
3510
+ * .select(`
3511
+ * content,
3512
+ * from:users!messages_sender_id_fkey(name),
3513
+ * to:users!messages_receiver_id_fkey(name)
3514
+ * `)
3515
+ * ```
3516
+ *
3517
+ * @exampleSql Query the same referenced table multiple times
3518
+ * ```sql
3519
+ * create table
3520
+ * users (id int8 primary key, name text);
3521
+ *
3522
+ * create table
3523
+ * messages (
3524
+ * sender_id int8 not null references users,
3525
+ * receiver_id int8 not null references users,
3526
+ * content text
3527
+ * );
3528
+ *
3529
+ * insert into
3530
+ * users (id, name)
3531
+ * values
3532
+ * (1, 'Kiran'),
3533
+ * (2, 'Evan');
3534
+ *
3535
+ * insert into
3536
+ * messages (sender_id, receiver_id, content)
3537
+ * values
3538
+ * (1, 2, '👋');
3539
+ * ```
3540
+ * ```
3541
+ *
3542
+ * @exampleResponse Query the same referenced table multiple times
3543
+ * ```json
3544
+ * {
3545
+ * "data": [
3546
+ * {
3547
+ * "content": "👋",
3548
+ * "from": {
3549
+ * "name": "Kiran"
3550
+ * },
3551
+ * "to": {
3552
+ * "name": "Evan"
3553
+ * }
3554
+ * }
3555
+ * ],
3556
+ * "status": 200,
3557
+ * "statusText": "OK"
3558
+ * }
3559
+ * ```
3560
+ *
3561
+ * @exampleDescription Query nested foreign tables through a join table
3562
+ * You can use the result of a joined table to gather data in
3563
+ * another foreign table. With multiple references to the same foreign
3564
+ * table you must specify the column on which to conduct the join.
3565
+ *
3566
+ * @example Query nested foreign tables through a join table
3567
+ * ```ts
3568
+ * const { data, error } = await supabase
3569
+ * .from('games')
3570
+ * .select(`
3571
+ * game_id:id,
3572
+ * away_team:teams!games_away_team_fkey (
3573
+ * users (
3574
+ * id,
3575
+ * name
3576
+ * )
3577
+ * )
3578
+ * `)
3579
+ *
3580
+ * ```
3581
+ *
3582
+ * @exampleSql Query nested foreign tables through a join table
3583
+ * ```sql
3584
+ * ```sql
3585
+ * create table
3586
+ * users (
3587
+ * id int8 primary key,
3588
+ * name text
3589
+ * );
3590
+ * create table
3591
+ * teams (
3592
+ * id int8 primary key,
3593
+ * name text
3594
+ * );
3595
+ * -- join table
3596
+ * create table
3597
+ * users_teams (
3598
+ * user_id int8 not null references users,
3599
+ * team_id int8 not null references teams,
3600
+ *
3601
+ * primary key (user_id, team_id)
3602
+ * );
3603
+ * create table
3604
+ * games (
3605
+ * id int8 primary key,
3606
+ * home_team int8 not null references teams,
3607
+ * away_team int8 not null references teams,
3608
+ * name text
3609
+ * );
3610
+ *
3611
+ * insert into users (id, name)
3612
+ * values
3613
+ * (1, 'Kiran'),
3614
+ * (2, 'Evan');
3615
+ * insert into
3616
+ * teams (id, name)
3617
+ * values
3618
+ * (1, 'Green'),
3619
+ * (2, 'Blue');
3620
+ * insert into
3621
+ * users_teams (user_id, team_id)
3622
+ * values
3623
+ * (1, 1),
3624
+ * (1, 2),
3625
+ * (2, 2);
3626
+ * insert into
3627
+ * games (id, home_team, away_team, name)
3628
+ * values
3629
+ * (1, 1, 2, 'Green vs Blue'),
3630
+ * (2, 2, 1, 'Blue vs Green');
3631
+ * ```
3632
+ *
3633
+ * @exampleResponse Query nested foreign tables through a join table
3634
+ * ```json
3635
+ * {
3636
+ * "data": [
3637
+ * {
3638
+ * "game_id": 1,
3639
+ * "away_team": {
3640
+ * "users": [
3641
+ * {
3642
+ * "id": 1,
3643
+ * "name": "Kiran"
3644
+ * },
3645
+ * {
3646
+ * "id": 2,
3647
+ * "name": "Evan"
3648
+ * }
3649
+ * ]
3650
+ * }
3651
+ * },
3652
+ * {
3653
+ * "game_id": 2,
3654
+ * "away_team": {
3655
+ * "users": [
3656
+ * {
3657
+ * "id": 1,
3658
+ * "name": "Kiran"
3659
+ * }
3660
+ * ]
3661
+ * }
3662
+ * }
3663
+ * ],
3664
+ * "status": 200,
3665
+ * "statusText": "OK"
3666
+ * }
3667
+ *
3668
+ * ```
3669
+ *
3670
+ * @exampleDescription Filtering through referenced tables
3671
+ * If the filter on a referenced table's column is not satisfied, the referenced
3672
+ * table returns `[]` or `null` but the parent table is not filtered out.
3673
+ * If you want to filter out the parent table rows, use the `!inner` hint
3674
+ *
3675
+ * @example Filtering through referenced tables
3676
+ * ```ts
3677
+ * const { data, error } = await supabase
3678
+ * .from('instruments')
3679
+ * .select('name, orchestral_sections(*)')
3680
+ * .eq('orchestral_sections.name', 'percussion')
3681
+ * ```
3682
+ *
3683
+ * @exampleSql Filtering through referenced tables
3684
+ * ```sql
3685
+ * create table
3686
+ * orchestral_sections (id int8 primary key, name text);
3687
+ * create table
3688
+ * instruments (
3689
+ * id int8 primary key,
3690
+ * section_id int8 not null references orchestral_sections,
3691
+ * name text
3692
+ * );
3693
+ *
3694
+ * insert into
3695
+ * orchestral_sections (id, name)
3696
+ * values
3697
+ * (1, 'strings'),
3698
+ * (2, 'woodwinds');
3699
+ * insert into
3700
+ * instruments (id, section_id, name)
3701
+ * values
3702
+ * (1, 2, 'flute'),
3703
+ * (2, 1, 'violin');
3704
+ * ```
3705
+ *
3706
+ * @exampleResponse Filtering through referenced tables
3707
+ * ```json
3708
+ * {
3709
+ * "data": [
3710
+ * {
3711
+ * "name": "flute",
3712
+ * "orchestral_sections": null
3713
+ * },
3714
+ * {
3715
+ * "name": "violin",
3716
+ * "orchestral_sections": null
3717
+ * }
3718
+ * ],
3719
+ * "status": 200,
3720
+ * "statusText": "OK"
3721
+ * }
3722
+ * ```
3723
+ *
3724
+ * @exampleDescription Querying referenced table with count
3725
+ * You can get the number of rows in a related table by using the
3726
+ * **count** property.
3727
+ *
3728
+ * @example Querying referenced table with count
3729
+ * ```ts
3730
+ * const { data, error } = await supabase
3731
+ * .from('orchestral_sections')
3732
+ * .select(`*, instruments(count)`)
3733
+ * ```
3734
+ *
3735
+ * @exampleSql Querying referenced table with count
3736
+ * ```sql
3737
+ * create table orchestral_sections (
3738
+ * "id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,
3739
+ * "name" text
3740
+ * );
3741
+ *
3742
+ * create table characters (
3743
+ * "id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,
3744
+ * "name" text,
3745
+ * "section_id" "uuid" references public.orchestral_sections on delete cascade
3746
+ * );
3747
+ *
3748
+ * with section as (
3749
+ * insert into orchestral_sections (name)
3750
+ * values ('strings') returning id
3751
+ * )
3752
+ * insert into instruments (name, section_id) values
3753
+ * ('violin', (select id from section)),
3754
+ * ('viola', (select id from section)),
3755
+ * ('cello', (select id from section)),
3756
+ * ('double bass', (select id from section));
3757
+ * ```
3758
+ *
3759
+ * @exampleResponse Querying referenced table with count
3760
+ * ```json
3761
+ * [
3762
+ * {
3763
+ * "id": "693694e7-d993-4360-a6d7-6294e325d9b6",
3764
+ * "name": "strings",
3765
+ * "instruments": [
3766
+ * {
3767
+ * "count": 4
3768
+ * }
3769
+ * ]
3770
+ * }
3771
+ * ]
3772
+ * ```
3773
+ *
3774
+ * @exampleDescription Querying with count option
3775
+ * You can get the number of rows by using the
3776
+ * [count](/docs/reference/javascript/select#parameters) option.
3777
+ *
3778
+ * @example Querying with count option
3779
+ * ```ts
3780
+ * const { count, error } = await supabase
3781
+ * .from('characters')
3782
+ * .select('*', { count: 'exact', head: true })
3783
+ * ```
3784
+ *
3785
+ * @exampleSql Querying with count option
3786
+ * ```sql
3787
+ * create table
3788
+ * characters (id int8 primary key, name text);
3789
+ *
3790
+ * insert into
3791
+ * characters (id, name)
3792
+ * values
3793
+ * (1, 'Luke'),
3794
+ * (2, 'Leia'),
3795
+ * (3, 'Han');
3796
+ * ```
3797
+ *
3798
+ * @exampleResponse Querying with count option
3799
+ * ```json
3800
+ * {
3801
+ * "count": 3,
3802
+ * "status": 200,
3803
+ * "statusText": "OK"
3804
+ * }
3805
+ * ```
3806
+ *
3807
+ * @exampleDescription Querying JSON data
3808
+ * You can select and filter data inside of
3809
+ * [JSON](/docs/guides/database/json) columns. Postgres offers some
3810
+ * [operators](/docs/guides/database/json#query-the-jsonb-data) for
3811
+ * querying JSON data.
3812
+ *
3813
+ * @example Querying JSON data
3814
+ * ```ts
3815
+ * const { data, error } = await supabase
3816
+ * .from('users')
3817
+ * .select(`
3818
+ * id, name,
3819
+ * address->city
3820
+ * `)
3821
+ * ```
3822
+ *
3823
+ * @exampleSql Querying JSON data
3824
+ * ```sql
3825
+ * create table
3826
+ * users (
3827
+ * id int8 primary key,
3828
+ * name text,
3829
+ * address jsonb
3830
+ * );
3831
+ *
3832
+ * insert into
3833
+ * users (id, name, address)
3834
+ * values
3835
+ * (1, 'Frodo', '{"city":"Hobbiton"}');
3836
+ * ```
3837
+ *
3838
+ * @exampleResponse Querying JSON data
3839
+ * ```json
3840
+ * {
3841
+ * "data": [
3842
+ * {
3843
+ * "id": 1,
3844
+ * "name": "Frodo",
3845
+ * "city": "Hobbiton"
3846
+ * }
3847
+ * ],
3848
+ * "status": 200,
3849
+ * "statusText": "OK"
3850
+ * }
3851
+ * ```
3852
+ *
3853
+ * @exampleDescription Querying referenced table with inner join
3854
+ * If you don't want to return the referenced table contents, you can leave the parenthesis empty.
3855
+ * Like `.select('name, orchestral_sections!inner()')`.
3856
+ *
3857
+ * @example Querying referenced table with inner join
3858
+ * ```ts
3859
+ * const { data, error } = await supabase
3860
+ * .from('instruments')
3861
+ * .select('name, orchestral_sections!inner(name)')
3862
+ * .eq('orchestral_sections.name', 'woodwinds')
3863
+ * .limit(1)
3864
+ * ```
3865
+ *
3866
+ * @exampleSql Querying referenced table with inner join
3867
+ * ```sql
3868
+ * create table orchestral_sections (
3869
+ * "id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,
3870
+ * "name" text
3871
+ * );
3872
+ *
3873
+ * create table instruments (
3874
+ * "id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,
3875
+ * "name" text,
3876
+ * "section_id" "uuid" references public.orchestral_sections on delete cascade
3877
+ * );
3878
+ *
3879
+ * with section as (
3880
+ * insert into orchestral_sections (name)
3881
+ * values ('woodwinds') returning id
3882
+ * )
3883
+ * insert into instruments (name, section_id) values
3884
+ * ('flute', (select id from section)),
3885
+ * ('clarinet', (select id from section)),
3886
+ * ('bassoon', (select id from section)),
3887
+ * ('piccolo', (select id from section));
3888
+ * ```
3889
+ *
3890
+ * @exampleResponse Querying referenced table with inner join
3891
+ * ```json
3892
+ * {
3893
+ * "data": [
3894
+ * {
3895
+ * "name": "flute",
3896
+ * "orchestral_sections": {"name": "woodwinds"}
3897
+ * }
3898
+ * ],
3899
+ * "status": 200,
3900
+ * "statusText": "OK"
3901
+ * }
3902
+ * ```
3903
+ *
3904
+ * @exampleDescription Switching schemas per query
3905
+ * In addition to setting the schema during initialization, you can also switch schemas on a per-query basis.
3906
+ * Make sure you've set up your [database privileges and API settings](/docs/guides/api/using-custom-schemas).
3907
+ *
3908
+ * @example Switching schemas per query
3909
+ * ```ts
3910
+ * const { data, error } = await supabase
3911
+ * .schema('myschema')
3912
+ * .from('mytable')
3913
+ * .select()
3914
+ * ```
3915
+ *
3916
+ * @exampleSql Switching schemas per query
3917
+ * ```sql
3918
+ * create schema myschema;
3919
+ *
3920
+ * create table myschema.mytable (
3921
+ * id uuid primary key default gen_random_uuid(),
3922
+ * data text
3923
+ * );
3924
+ *
3925
+ * insert into myschema.mytable (data) values ('mydata');
3926
+ * ```
3927
+ *
3928
+ * @exampleResponse Switching schemas per query
3929
+ * ```json
3930
+ * {
3931
+ * "data": [
3932
+ * {
3933
+ * "id": "4162e008-27b0-4c0f-82dc-ccaeee9a624d",
3934
+ * "data": "mydata"
3935
+ * }
3936
+ * ],
3937
+ * "status": 200,
3938
+ * "statusText": "OK"
3939
+ * }
3940
+ * ```
3941
+ */
3942
+ select(columns, options) {
3943
+ const { head = false, count } = options !== null && options !== void 0 ? options : {};
3944
+ const method = head ? "HEAD" : "GET";
3945
+ let quoted = false;
3946
+ const cleanedColumns = (columns !== null && columns !== void 0 ? columns : "*").split("").map((c) => {
3947
+ if (/\s/.test(c) && !quoted) return "";
3948
+ if (c === "\"") quoted = !quoted;
3949
+ return c;
3950
+ }).join("");
3951
+ const { url, headers } = this.cloneRequestState();
3952
+ url.searchParams.set("select", cleanedColumns);
3953
+ if (count) headers.append("Prefer", `count=${count}`);
3954
+ return new PostgrestFilterBuilder({
3955
+ method,
3956
+ url,
3957
+ headers,
3958
+ schema: this.schema,
3959
+ fetch: this.fetch,
3960
+ urlLengthLimit: this.urlLengthLimit,
3961
+ retry: this.retry
3962
+ });
3963
+ }
3964
+ /**
3965
+ * Perform an INSERT into the table or view.
3966
+ *
3967
+ * By default, inserted rows are not returned. To return it, chain the call
3968
+ * with `.select()`.
3969
+ *
3970
+ * @param values - The values to insert. Pass an object to insert a single row
3971
+ * or an array to insert multiple rows.
3972
+ *
3973
+ * @param options - Named parameters
3974
+ *
3975
+ * @param options.count - Count algorithm to use to count inserted rows.
3976
+ *
3977
+ * `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the
3978
+ * hood.
3979
+ *
3980
+ * `"planned"`: Approximated but fast count algorithm. Uses the Postgres
3981
+ * statistics under the hood.
3982
+ *
3983
+ * `"estimated"`: Uses exact count for low numbers and planned count for high
3984
+ * numbers.
3985
+ *
3986
+ * @param options.defaultToNull - Make missing fields default to `null`.
3987
+ * Otherwise, use the default value for the column. Only applies for bulk
3988
+ * inserts.
3989
+ *
3990
+ * @category Database
3991
+ *
3992
+ * @example Create a record
3993
+ * ```ts
3994
+ * const { error } = await supabase
3995
+ * .from('countries')
3996
+ * .insert({ id: 1, name: 'Mordor' })
3997
+ * ```
3998
+ *
3999
+ * @exampleSql Create a record
4000
+ * ```sql
4001
+ * create table
4002
+ * countries (id int8 primary key, name text);
4003
+ * ```
4004
+ *
4005
+ * @exampleResponse Create a record
4006
+ * ```json
4007
+ * {
4008
+ * "status": 201,
4009
+ * "statusText": "Created"
4010
+ * }
4011
+ * ```
4012
+ *
4013
+ * @example Create a record and return it
4014
+ * ```ts
4015
+ * const { data, error } = await supabase
4016
+ * .from('countries')
4017
+ * .insert({ id: 1, name: 'Mordor' })
4018
+ * .select()
4019
+ * ```
4020
+ *
4021
+ * @exampleSql Create a record and return it
4022
+ * ```sql
4023
+ * create table
4024
+ * countries (id int8 primary key, name text);
4025
+ * ```
4026
+ *
4027
+ * @exampleResponse Create a record and return it
4028
+ * ```json
4029
+ * {
4030
+ * "data": [
4031
+ * {
4032
+ * "id": 1,
4033
+ * "name": "Mordor"
4034
+ * }
4035
+ * ],
4036
+ * "status": 201,
4037
+ * "statusText": "Created"
4038
+ * }
4039
+ * ```
4040
+ *
4041
+ * @exampleDescription Bulk create
4042
+ * A bulk create operation is handled in a single transaction.
4043
+ * If any of the inserts fail, none of the rows are inserted.
4044
+ *
4045
+ * @example Bulk create
4046
+ * ```ts
4047
+ * const { error } = await supabase
4048
+ * .from('countries')
4049
+ * .insert([
4050
+ * { id: 1, name: 'Mordor' },
4051
+ * { id: 1, name: 'The Shire' },
4052
+ * ])
4053
+ * ```
4054
+ *
4055
+ * @exampleSql Bulk create
4056
+ * ```sql
4057
+ * create table
4058
+ * countries (id int8 primary key, name text);
4059
+ * ```
4060
+ *
4061
+ * @exampleResponse Bulk create
4062
+ * ```json
4063
+ * {
4064
+ * "error": {
4065
+ * "code": "23505",
4066
+ * "details": "Key (id)=(1) already exists.",
4067
+ * "hint": null,
4068
+ * "message": "duplicate key value violates unique constraint \"countries_pkey\""
4069
+ * },
4070
+ * "status": 409,
4071
+ * "statusText": "Conflict"
4072
+ * }
4073
+ * ```
4074
+ */
4075
+ insert(values, { count, defaultToNull = true } = {}) {
4076
+ var _this$fetch;
4077
+ const method = "POST";
4078
+ const { url, headers } = this.cloneRequestState();
4079
+ if (count) headers.append("Prefer", `count=${count}`);
4080
+ if (!defaultToNull) headers.append("Prefer", `missing=default`);
4081
+ if (Array.isArray(values)) {
4082
+ const columns = values.reduce((acc, x) => acc.concat(Object.keys(x)), []);
4083
+ if (columns.length > 0) {
4084
+ const uniqueColumns = [...new Set(columns)].map((column) => `"${column}"`);
4085
+ url.searchParams.set("columns", uniqueColumns.join(","));
4086
+ }
4087
+ }
4088
+ return new PostgrestFilterBuilder({
4089
+ method,
4090
+ url,
4091
+ headers,
4092
+ schema: this.schema,
4093
+ body: values,
4094
+ fetch: (_this$fetch = this.fetch) !== null && _this$fetch !== void 0 ? _this$fetch : fetch,
4095
+ urlLengthLimit: this.urlLengthLimit,
4096
+ retry: this.retry
4097
+ });
4098
+ }
4099
+ /**
4100
+ * Perform an UPSERT on the table or view. Depending on the column(s) passed
4101
+ * to `onConflict`, `.upsert()` allows you to perform the equivalent of
4102
+ * `.insert()` if a row with the corresponding `onConflict` columns doesn't
4103
+ * exist, or if it does exist, perform an alternative action depending on
4104
+ * `ignoreDuplicates`.
4105
+ *
4106
+ * By default, upserted rows are not returned. To return it, chain the call
4107
+ * with `.select()`.
4108
+ *
4109
+ * @param values - The values to upsert with. Pass an object to upsert a
4110
+ * single row or an array to upsert multiple rows.
4111
+ *
4112
+ * @param options - Named parameters
4113
+ *
4114
+ * @param options.onConflict - Comma-separated UNIQUE column(s) to specify how
4115
+ * duplicate rows are determined. Two rows are duplicates if all the
4116
+ * `onConflict` columns are equal.
4117
+ *
4118
+ * @param options.ignoreDuplicates - If `true`, duplicate rows are ignored. If
4119
+ * `false`, duplicate rows are merged with existing rows.
4120
+ *
4121
+ * @param options.count - Count algorithm to use to count upserted rows.
4122
+ *
4123
+ * `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the
4124
+ * hood.
4125
+ *
4126
+ * `"planned"`: Approximated but fast count algorithm. Uses the Postgres
4127
+ * statistics under the hood.
4128
+ *
4129
+ * `"estimated"`: Uses exact count for low numbers and planned count for high
4130
+ * numbers.
4131
+ *
4132
+ * @param options.defaultToNull - Make missing fields default to `null`.
4133
+ * Otherwise, use the default value for the column. This only applies when
4134
+ * inserting new rows, not when merging with existing rows under
4135
+ * `ignoreDuplicates: false`. This also only applies when doing bulk upserts.
4136
+ *
4137
+ * @example Upsert a single row using a unique key
4138
+ * ```ts
4139
+ * // Upserting a single row, overwriting based on the 'username' unique column
4140
+ * const { data, error } = await supabase
4141
+ * .from('users')
4142
+ * .upsert({ username: 'supabot' }, { onConflict: 'username' })
4143
+ *
4144
+ * // Example response:
4145
+ * // {
4146
+ * // data: [
4147
+ * // { id: 4, message: 'bar', username: 'supabot' }
4148
+ * // ],
4149
+ * // error: null
4150
+ * // }
4151
+ * ```
4152
+ *
4153
+ * @example Upsert with conflict resolution and exact row counting
4154
+ * ```ts
4155
+ * // Upserting and returning exact count
4156
+ * const { data, error, count } = await supabase
4157
+ * .from('users')
4158
+ * .upsert(
4159
+ * {
4160
+ * id: 3,
4161
+ * message: 'foo',
4162
+ * username: 'supabot'
4163
+ * },
4164
+ * {
4165
+ * onConflict: 'username',
4166
+ * count: 'exact'
4167
+ * }
4168
+ * )
4169
+ *
4170
+ * // Example response:
4171
+ * // {
4172
+ * // data: [
4173
+ * // {
4174
+ * // id: 42,
4175
+ * // handle: "saoirse",
4176
+ * // display_name: "Saoirse"
4177
+ * // }
4178
+ * // ],
4179
+ * // count: 1,
4180
+ * // error: null
4181
+ * // }
4182
+ * ```
4183
+ *
4184
+ * @category Database
4185
+ *
4186
+ * @remarks
4187
+ * - Primary keys must be included in `values` to use upsert.
4188
+ *
4189
+ * @example Upsert your data
4190
+ * ```ts
4191
+ * const { data, error } = await supabase
4192
+ * .from('instruments')
4193
+ * .upsert({ id: 1, name: 'piano' })
4194
+ * .select()
4195
+ * ```
4196
+ *
4197
+ * @exampleSql Upsert your data
4198
+ * ```sql
4199
+ * create table
4200
+ * instruments (id int8 primary key, name text);
4201
+ *
4202
+ * insert into
4203
+ * instruments (id, name)
4204
+ * values
4205
+ * (1, 'harpsichord');
4206
+ * ```
4207
+ *
4208
+ * @exampleResponse Upsert your data
4209
+ * ```json
4210
+ * {
4211
+ * "data": [
4212
+ * {
4213
+ * "id": 1,
4214
+ * "name": "piano"
4215
+ * }
4216
+ * ],
4217
+ * "status": 201,
4218
+ * "statusText": "Created"
4219
+ * }
4220
+ * ```
4221
+ *
4222
+ * @example Bulk Upsert your data
4223
+ * ```ts
4224
+ * const { data, error } = await supabase
4225
+ * .from('instruments')
4226
+ * .upsert([
4227
+ * { id: 1, name: 'piano' },
4228
+ * { id: 2, name: 'harp' },
4229
+ * ])
4230
+ * .select()
4231
+ * ```
4232
+ *
4233
+ * @exampleSql Bulk Upsert your data
4234
+ * ```sql
4235
+ * create table
4236
+ * instruments (id int8 primary key, name text);
4237
+ *
4238
+ * insert into
4239
+ * instruments (id, name)
4240
+ * values
4241
+ * (1, 'harpsichord');
4242
+ * ```
4243
+ *
4244
+ * @exampleResponse Bulk Upsert your data
4245
+ * ```json
4246
+ * {
4247
+ * "data": [
4248
+ * {
4249
+ * "id": 1,
4250
+ * "name": "piano"
4251
+ * },
4252
+ * {
4253
+ * "id": 2,
4254
+ * "name": "harp"
4255
+ * }
4256
+ * ],
4257
+ * "status": 201,
4258
+ * "statusText": "Created"
4259
+ * }
4260
+ * ```
4261
+ *
4262
+ * @exampleDescription Upserting into tables with constraints
4263
+ * In the following query, `upsert()` implicitly uses the `id`
4264
+ * (primary key) column to determine conflicts. If there is no existing
4265
+ * row with the same `id`, `upsert()` inserts a new row, which
4266
+ * will fail in this case as there is already a row with `handle` `"saoirse"`.
4267
+ * Using the `onConflict` option, you can instruct `upsert()` to use
4268
+ * another column with a unique constraint to determine conflicts.
4269
+ *
4270
+ * @example Upserting into tables with constraints
4271
+ * ```ts
4272
+ * const { data, error } = await supabase
4273
+ * .from('users')
4274
+ * .upsert({ id: 42, handle: 'saoirse', display_name: 'Saoirse' })
4275
+ * .select()
4276
+ * ```
4277
+ *
4278
+ * @exampleSql Upserting into tables with constraints
4279
+ * ```sql
4280
+ * create table
4281
+ * users (
4282
+ * id int8 generated by default as identity primary key,
4283
+ * handle text not null unique,
4284
+ * display_name text
4285
+ * );
4286
+ *
4287
+ * insert into
4288
+ * users (id, handle, display_name)
4289
+ * values
4290
+ * (1, 'saoirse', null);
4291
+ * ```
4292
+ *
4293
+ * @exampleResponse Upserting into tables with constraints
4294
+ * ```json
4295
+ * {
4296
+ * "error": {
4297
+ * "code": "23505",
4298
+ * "details": "Key (handle)=(saoirse) already exists.",
4299
+ * "hint": null,
4300
+ * "message": "duplicate key value violates unique constraint \"users_handle_key\""
4301
+ * },
4302
+ * "status": 409,
4303
+ * "statusText": "Conflict"
4304
+ * }
4305
+ * ```
4306
+ */
4307
+ upsert(values, { onConflict, ignoreDuplicates = false, count, defaultToNull = true } = {}) {
4308
+ var _this$fetch2;
4309
+ const method = "POST";
4310
+ const { url, headers } = this.cloneRequestState();
4311
+ headers.append("Prefer", `resolution=${ignoreDuplicates ? "ignore" : "merge"}-duplicates`);
4312
+ if (onConflict !== void 0) url.searchParams.set("on_conflict", onConflict);
4313
+ if (count) headers.append("Prefer", `count=${count}`);
4314
+ if (!defaultToNull) headers.append("Prefer", "missing=default");
4315
+ if (Array.isArray(values)) {
4316
+ const columns = values.reduce((acc, x) => acc.concat(Object.keys(x)), []);
4317
+ if (columns.length > 0) {
4318
+ const uniqueColumns = [...new Set(columns)].map((column) => `"${column}"`);
4319
+ url.searchParams.set("columns", uniqueColumns.join(","));
4320
+ }
4321
+ }
4322
+ return new PostgrestFilterBuilder({
4323
+ method,
4324
+ url,
4325
+ headers,
4326
+ schema: this.schema,
4327
+ body: values,
4328
+ fetch: (_this$fetch2 = this.fetch) !== null && _this$fetch2 !== void 0 ? _this$fetch2 : fetch,
4329
+ urlLengthLimit: this.urlLengthLimit,
4330
+ retry: this.retry
4331
+ });
4332
+ }
4333
+ /**
4334
+ * Perform an UPDATE on the table or view.
4335
+ *
4336
+ * By default, updated rows are not returned. To return it, chain the call
4337
+ * with `.select()` after filters.
4338
+ *
4339
+ * @param values - The values to update with
4340
+ *
4341
+ * @param options - Named parameters
4342
+ *
4343
+ * @param options.count - Count algorithm to use to count updated rows.
4344
+ *
4345
+ * `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the
4346
+ * hood.
4347
+ *
4348
+ * `"planned"`: Approximated but fast count algorithm. Uses the Postgres
4349
+ * statistics under the hood.
4350
+ *
4351
+ * `"estimated"`: Uses exact count for low numbers and planned count for high
4352
+ * numbers.
4353
+ *
4354
+ * @category Database
4355
+ *
4356
+ * @remarks
4357
+ * - `update()` should always be combined with [Filters](/docs/reference/javascript/using-filters) to target the item(s) you wish to update.
4358
+ *
4359
+ * @example Updating your data
4360
+ * ```ts
4361
+ * const { error } = await supabase
4362
+ * .from('instruments')
4363
+ * .update({ name: 'piano' })
4364
+ * .eq('id', 1)
4365
+ * ```
4366
+ *
4367
+ * @exampleSql Updating your data
4368
+ * ```sql
4369
+ * create table
4370
+ * instruments (id int8 primary key, name text);
4371
+ *
4372
+ * insert into
4373
+ * instruments (id, name)
4374
+ * values
4375
+ * (1, 'harpsichord');
4376
+ * ```
4377
+ *
4378
+ * @exampleResponse Updating your data
4379
+ * ```json
4380
+ * {
4381
+ * "status": 204,
4382
+ * "statusText": "No Content"
4383
+ * }
4384
+ * ```
4385
+ *
4386
+ * @example Update a record and return it
4387
+ * ```ts
4388
+ * const { data, error } = await supabase
4389
+ * .from('instruments')
4390
+ * .update({ name: 'piano' })
4391
+ * .eq('id', 1)
4392
+ * .select()
4393
+ * ```
4394
+ *
4395
+ * @exampleSql Update a record and return it
4396
+ * ```sql
4397
+ * create table
4398
+ * instruments (id int8 primary key, name text);
4399
+ *
4400
+ * insert into
4401
+ * instruments (id, name)
4402
+ * values
4403
+ * (1, 'harpsichord');
4404
+ * ```
4405
+ *
4406
+ * @exampleResponse Update a record and return it
4407
+ * ```json
4408
+ * {
4409
+ * "data": [
4410
+ * {
4411
+ * "id": 1,
4412
+ * "name": "piano"
4413
+ * }
4414
+ * ],
4415
+ * "status": 200,
4416
+ * "statusText": "OK"
4417
+ * }
4418
+ * ```
4419
+ *
4420
+ * @exampleDescription Updating JSON data
4421
+ * Postgres offers some
4422
+ * [operators](/docs/guides/database/json#query-the-jsonb-data) for
4423
+ * working with JSON data. Currently, it is only possible to update the entire JSON document.
4424
+ *
4425
+ * @example Updating JSON data
4426
+ * ```ts
4427
+ * const { data, error } = await supabase
4428
+ * .from('users')
4429
+ * .update({
4430
+ * address: {
4431
+ * street: 'Melrose Place',
4432
+ * postcode: 90210
4433
+ * }
4434
+ * })
4435
+ * .eq('address->postcode', 90210)
4436
+ * .select()
4437
+ * ```
4438
+ *
4439
+ * @exampleSql Updating JSON data
4440
+ * ```sql
4441
+ * create table
4442
+ * users (
4443
+ * id int8 primary key,
4444
+ * name text,
4445
+ * address jsonb
4446
+ * );
4447
+ *
4448
+ * insert into
4449
+ * users (id, name, address)
4450
+ * values
4451
+ * (1, 'Michael', '{ "postcode": 90210 }');
4452
+ * ```
4453
+ *
4454
+ * @exampleResponse Updating JSON data
4455
+ * ```json
4456
+ * {
4457
+ * "data": [
4458
+ * {
4459
+ * "id": 1,
4460
+ * "name": "Michael",
4461
+ * "address": {
4462
+ * "street": "Melrose Place",
4463
+ * "postcode": 90210
4464
+ * }
4465
+ * }
4466
+ * ],
4467
+ * "status": 200,
4468
+ * "statusText": "OK"
4469
+ * }
4470
+ * ```
4471
+ */
4472
+ update(values, { count } = {}) {
4473
+ var _this$fetch3;
4474
+ const method = "PATCH";
4475
+ const { url, headers } = this.cloneRequestState();
4476
+ if (count) headers.append("Prefer", `count=${count}`);
4477
+ return new PostgrestFilterBuilder({
4478
+ method,
4479
+ url,
4480
+ headers,
4481
+ schema: this.schema,
4482
+ body: values,
4483
+ fetch: (_this$fetch3 = this.fetch) !== null && _this$fetch3 !== void 0 ? _this$fetch3 : fetch,
4484
+ urlLengthLimit: this.urlLengthLimit,
4485
+ retry: this.retry
4486
+ });
4487
+ }
4488
+ /**
4489
+ * Perform a DELETE on the table or view.
4490
+ *
4491
+ * By default, deleted rows are not returned. To return it, chain the call
4492
+ * with `.select()` after filters.
4493
+ *
4494
+ * @param options - Named parameters
4495
+ *
4496
+ * @param options.count - Count algorithm to use to count deleted rows.
4497
+ *
4498
+ * `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the
4499
+ * hood.
4500
+ *
4501
+ * `"planned"`: Approximated but fast count algorithm. Uses the Postgres
4502
+ * statistics under the hood.
4503
+ *
4504
+ * `"estimated"`: Uses exact count for low numbers and planned count for high
4505
+ * numbers.
4506
+ *
4507
+ * @category Database
4508
+ *
4509
+ * @remarks
4510
+ * - `delete()` should always be combined with [filters](/docs/reference/javascript/using-filters) to target the item(s) you wish to delete.
4511
+ * - If you use `delete()` with filters and you have
4512
+ * [RLS](/docs/learn/auth-deep-dive/auth-row-level-security) enabled, only
4513
+ * rows visible through `SELECT` policies are deleted. Note that by default
4514
+ * no rows are visible, so you need at least one `SELECT`/`ALL` policy that
4515
+ * makes the rows visible.
4516
+ * - When using `delete().in()`, specify an array of values to target multiple rows with a single query. This is particularly useful for batch deleting entries that share common criteria, such as deleting users by their IDs. Ensure that the array you provide accurately represents all records you intend to delete to avoid unintended data removal.
4517
+ *
4518
+ * @example Delete a single record
4519
+ * ```ts
4520
+ * const response = await supabase
4521
+ * .from('countries')
4522
+ * .delete()
4523
+ * .eq('id', 1)
4524
+ * ```
4525
+ *
4526
+ * @exampleSql Delete a single record
4527
+ * ```sql
4528
+ * create table
4529
+ * countries (id int8 primary key, name text);
4530
+ *
4531
+ * insert into
4532
+ * countries (id, name)
4533
+ * values
4534
+ * (1, 'Mordor');
4535
+ * ```
4536
+ *
4537
+ * @exampleResponse Delete a single record
4538
+ * ```json
4539
+ * {
4540
+ * "status": 204,
4541
+ * "statusText": "No Content"
4542
+ * }
4543
+ * ```
4544
+ *
4545
+ * @example Delete a record and return it
4546
+ * ```ts
4547
+ * const { data, error } = await supabase
4548
+ * .from('countries')
4549
+ * .delete()
4550
+ * .eq('id', 1)
4551
+ * .select()
4552
+ * ```
4553
+ *
4554
+ * @exampleSql Delete a record and return it
4555
+ * ```sql
4556
+ * create table
4557
+ * countries (id int8 primary key, name text);
4558
+ *
4559
+ * insert into
4560
+ * countries (id, name)
4561
+ * values
4562
+ * (1, 'Mordor');
4563
+ * ```
4564
+ *
4565
+ * @exampleResponse Delete a record and return it
4566
+ * ```json
4567
+ * {
4568
+ * "data": [
4569
+ * {
4570
+ * "id": 1,
4571
+ * "name": "Mordor"
4572
+ * }
4573
+ * ],
4574
+ * "status": 200,
4575
+ * "statusText": "OK"
4576
+ * }
4577
+ * ```
4578
+ *
4579
+ * @example Delete multiple records
4580
+ * ```ts
4581
+ * const response = await supabase
4582
+ * .from('countries')
4583
+ * .delete()
4584
+ * .in('id', [1, 2, 3])
4585
+ * ```
4586
+ *
4587
+ * @exampleSql Delete multiple records
4588
+ * ```sql
4589
+ * create table
4590
+ * countries (id int8 primary key, name text);
4591
+ *
4592
+ * insert into
4593
+ * countries (id, name)
4594
+ * values
4595
+ * (1, 'Rohan'), (2, 'The Shire'), (3, 'Mordor');
4596
+ * ```
4597
+ *
4598
+ * @exampleResponse Delete multiple records
4599
+ * ```json
4600
+ * {
4601
+ * "status": 204,
4602
+ * "statusText": "No Content"
4603
+ * }
4604
+ * ```
4605
+ */
4606
+ delete({ count } = {}) {
4607
+ var _this$fetch4;
4608
+ const method = "DELETE";
4609
+ const { url, headers } = this.cloneRequestState();
4610
+ if (count) headers.append("Prefer", `count=${count}`);
4611
+ return new PostgrestFilterBuilder({
4612
+ method,
4613
+ url,
4614
+ headers,
4615
+ schema: this.schema,
4616
+ fetch: (_this$fetch4 = this.fetch) !== null && _this$fetch4 !== void 0 ? _this$fetch4 : fetch,
4617
+ urlLengthLimit: this.urlLengthLimit,
4618
+ retry: this.retry
4619
+ });
4620
+ }
4621
+ };
4622
+
4623
+ //#endregion
4624
+ //#region \0@oxc-project+runtime@0.101.0/helpers/typeof.js
4625
+ function _typeof(o) {
4626
+ "@babel/helpers - typeof";
4627
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
4628
+ return typeof o$1;
4629
+ } : function(o$1) {
4630
+ return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
4631
+ }, _typeof(o);
4632
+ }
4633
+
4634
+ //#endregion
4635
+ //#region \0@oxc-project+runtime@0.101.0/helpers/toPrimitive.js
4636
+ function toPrimitive(t, r) {
4637
+ if ("object" != _typeof(t) || !t) return t;
4638
+ var e = t[Symbol.toPrimitive];
4639
+ if (void 0 !== e) {
4640
+ var i = e.call(t, r || "default");
4641
+ if ("object" != _typeof(i)) return i;
4642
+ throw new TypeError("@@toPrimitive must return a primitive value.");
4643
+ }
4644
+ return ("string" === r ? String : Number)(t);
4645
+ }
4646
+
4647
+ //#endregion
4648
+ //#region \0@oxc-project+runtime@0.101.0/helpers/toPropertyKey.js
4649
+ function toPropertyKey(t) {
4650
+ var i = toPrimitive(t, "string");
4651
+ return "symbol" == _typeof(i) ? i : i + "";
4652
+ }
4653
+
4654
+ //#endregion
4655
+ //#region \0@oxc-project+runtime@0.101.0/helpers/defineProperty.js
4656
+ function _defineProperty(e, r, t) {
4657
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
4658
+ value: t,
4659
+ enumerable: !0,
4660
+ configurable: !0,
4661
+ writable: !0
4662
+ }) : e[r] = t, e;
4663
+ }
4664
+
4665
+ //#endregion
4666
+ //#region \0@oxc-project+runtime@0.101.0/helpers/objectSpread2.js
4667
+ function ownKeys(e, r) {
4668
+ var t = Object.keys(e);
4669
+ if (Object.getOwnPropertySymbols) {
4670
+ var o = Object.getOwnPropertySymbols(e);
4671
+ r && (o = o.filter(function(r$1) {
4672
+ return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
4673
+ })), t.push.apply(t, o);
4674
+ }
4675
+ return t;
4676
+ }
4677
+ function _objectSpread2(e) {
4678
+ for (var r = 1; r < arguments.length; r++) {
4679
+ var t = null != arguments[r] ? arguments[r] : {};
4680
+ r % 2 ? ownKeys(Object(t), !0).forEach(function(r$1) {
4681
+ _defineProperty(e, r$1, t[r$1]);
4682
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) {
4683
+ Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
4684
+ });
4685
+ }
4686
+ return e;
4687
+ }
4688
+
4689
+ //#endregion
4690
+ //#region src/PostgrestClient.ts
4691
+ /**
4692
+ * PostgREST client.
4693
+ *
4694
+ * @typeParam Database - Types for the schema from the [type
4695
+ * generator](https://supabase.com/docs/reference/javascript/next/typescript-support)
4696
+ *
4697
+ * @typeParam SchemaName - Postgres schema to switch to. Must be a string
4698
+ * literal, the same one passed to the constructor. If the schema is not
4699
+ * `"public"`, this must be supplied manually.
4700
+ */
4701
+ var PostgrestClient = class PostgrestClient {
4702
+ /**
4703
+ * Creates a PostgREST client.
4704
+ *
4705
+ * @param url - URL of the PostgREST endpoint
4706
+ * @param options - Named parameters
4707
+ * @param options.headers - Custom headers
4708
+ * @param options.schema - Postgres schema to switch to
4709
+ * @param options.fetch - Custom fetch
4710
+ * @param options.timeout - Optional timeout in milliseconds for all requests. When set, requests will automatically abort after this duration to prevent indefinite hangs.
4711
+ * @param options.urlLengthLimit - Maximum URL length in characters before warnings/errors are triggered. Defaults to 8000.
4712
+ * @param options.retry - Enable or disable automatic retries for transient errors.
4713
+ * When enabled, idempotent requests (GET, HEAD, OPTIONS) that fail with network
4714
+ * errors or HTTP 503/520 responses will be automatically retried up to 3 times
4715
+ * with exponential backoff (1s, 2s, 4s). Defaults to `true`.
4716
+ * @example Using supabase-js (recommended)
4717
+ * ```ts
4718
+ * import { createClient } from '@supabase/supabase-js'
4719
+ *
4720
+ * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')
4721
+ * const { data, error } = await supabase.from('profiles').select('*')
4722
+ * ```
4723
+ *
4724
+ * @category Database
4725
+ *
4726
+ * @remarks
4727
+ * - A `timeout` option (in milliseconds) can be set to automatically abort requests that take too long.
4728
+ * - A `urlLengthLimit` option (default: 8000) can be set to control when URL length warnings are included in error messages for aborted requests.
4729
+ *
4730
+ * @example Standalone import for bundle-sensitive environments
4731
+ * ```ts
4732
+ * import { PostgrestClient } from '@supabase/postgrest-js'
4733
+ *
4734
+ * const postgrest = new PostgrestClient('https://xyzcompany.supabase.co/rest/v1', {
4735
+ * headers: { apikey: 'your-publishable-key' },
4736
+ * schema: 'public',
4737
+ * timeout: 30000, // 30 second timeout
4738
+ * })
4739
+ * ```
4740
+ */
4741
+ constructor(url, { headers = {}, schema, fetch: fetch$1, timeout, urlLengthLimit = 8e3, retry } = {}) {
4742
+ this.url = url;
4743
+ this.headers = new Headers(headers);
4744
+ this.schemaName = schema;
4745
+ this.urlLengthLimit = urlLengthLimit;
4746
+ const originalFetch = fetch$1 !== null && fetch$1 !== void 0 ? fetch$1 : globalThis.fetch;
4747
+ if (timeout !== void 0 && timeout > 0) this.fetch = (input, init) => {
4748
+ const controller = new AbortController();
4749
+ const timeoutId = setTimeout(() => controller.abort(), timeout);
4750
+ const existingSignal = init === null || init === void 0 ? void 0 : init.signal;
4751
+ if (existingSignal) {
4752
+ if (existingSignal.aborted) {
4753
+ clearTimeout(timeoutId);
4754
+ return originalFetch(input, init);
4755
+ }
4756
+ const abortHandler = () => {
4757
+ clearTimeout(timeoutId);
4758
+ controller.abort();
4759
+ };
4760
+ existingSignal.addEventListener("abort", abortHandler, { once: true });
4761
+ return originalFetch(input, _objectSpread2(_objectSpread2({}, init), {}, { signal: controller.signal })).finally(() => {
4762
+ clearTimeout(timeoutId);
4763
+ existingSignal.removeEventListener("abort", abortHandler);
4764
+ });
4765
+ }
4766
+ return originalFetch(input, _objectSpread2(_objectSpread2({}, init), {}, { signal: controller.signal })).finally(() => clearTimeout(timeoutId));
4767
+ };
4768
+ else this.fetch = originalFetch;
4769
+ this.retry = retry;
4770
+ }
4771
+ /**
4772
+ * Perform a query on a table or a view.
4773
+ *
4774
+ * @param relation - The table or view name to query
4775
+ *
4776
+ * @category Database
4777
+ */
4778
+ from(relation) {
4779
+ if (!relation || typeof relation !== "string" || relation.trim() === "") throw new Error("Invalid relation name: relation must be a non-empty string.");
4780
+ return new PostgrestQueryBuilder(new URL(`${this.url}/${relation}`), {
4781
+ headers: new Headers(this.headers),
4782
+ schema: this.schemaName,
4783
+ fetch: this.fetch,
4784
+ urlLengthLimit: this.urlLengthLimit,
4785
+ retry: this.retry
4786
+ });
4787
+ }
4788
+ /**
4789
+ * Select a schema to query or perform an function (rpc) call.
4790
+ *
4791
+ * The schema needs to be on the list of exposed schemas inside Supabase.
4792
+ *
4793
+ * @param schema - The schema to query
4794
+ *
4795
+ * @category Database
4796
+ */
4797
+ schema(schema) {
4798
+ return new PostgrestClient(this.url, {
4799
+ headers: this.headers,
4800
+ schema,
4801
+ fetch: this.fetch,
4802
+ urlLengthLimit: this.urlLengthLimit,
4803
+ retry: this.retry
4804
+ });
4805
+ }
4806
+ /**
4807
+ * Perform a function call.
4808
+ *
4809
+ * @param fn - The function name to call
4810
+ * @param args - The arguments to pass to the function call
4811
+ * @param options - Named parameters
4812
+ * @param options.head - When set to `true`, `data` will not be returned.
4813
+ * Useful if you only need the count.
4814
+ * @param options.get - When set to `true`, the function will be called with
4815
+ * read-only access mode.
4816
+ * @param options.count - Count algorithm to use to count rows returned by the
4817
+ * function. Only applicable for [set-returning
4818
+ * functions](https://www.postgresql.org/docs/current/functions-srf.html).
4819
+ *
4820
+ * `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the
4821
+ * hood.
4822
+ *
4823
+ * `"planned"`: Approximated but fast count algorithm. Uses the Postgres
4824
+ * statistics under the hood.
4825
+ *
4826
+ * `"estimated"`: Uses exact count for low numbers and planned count for high
4827
+ * numbers.
4828
+ *
4829
+ * @example
4830
+ * ```ts
4831
+ * // For cross-schema functions where type inference fails, use overrideTypes:
4832
+ * const { data } = await supabase
4833
+ * .schema('schema_b')
4834
+ * .rpc('function_a', {})
4835
+ * .overrideTypes<{ id: string; user_id: string }[]>()
4836
+ * ```
4837
+ *
4838
+ * @category Database
4839
+ *
4840
+ * @example Call a Postgres function without arguments
4841
+ * ```ts
4842
+ * const { data, error } = await supabase.rpc('hello_world')
4843
+ * ```
4844
+ *
4845
+ * @exampleSql Call a Postgres function without arguments
4846
+ * ```sql
4847
+ * create function hello_world() returns text as $$
4848
+ * select 'Hello world';
4849
+ * $$ language sql;
4850
+ * ```
4851
+ *
4852
+ * @exampleResponse Call a Postgres function without arguments
4853
+ * ```json
4854
+ * {
4855
+ * "data": "Hello world",
4856
+ * "status": 200,
4857
+ * "statusText": "OK"
4858
+ * }
4859
+ * ```
4860
+ *
4861
+ * @example Call a Postgres function with arguments
4862
+ * ```ts
4863
+ * const { data, error } = await supabase.rpc('echo', { say: '👋' })
4864
+ * ```
4865
+ *
4866
+ * @exampleSql Call a Postgres function with arguments
4867
+ * ```sql
4868
+ * create function echo(say text) returns text as $$
4869
+ * select say;
4870
+ * $$ language sql;
4871
+ * ```
4872
+ *
4873
+ * @exampleResponse Call a Postgres function with arguments
4874
+ * ```json
4875
+ * {
4876
+ * "data": "👋",
4877
+ * "status": 200,
4878
+ * "statusText": "OK"
4879
+ * }
4880
+ *
4881
+ * ```
4882
+ *
4883
+ * @exampleDescription Bulk processing
4884
+ * You can process large payloads by passing in an array as an argument.
4885
+ *
4886
+ * @example Bulk processing
4887
+ * ```ts
4888
+ * const { data, error } = await supabase.rpc('add_one_each', { arr: [1, 2, 3] })
4889
+ * ```
4890
+ *
4891
+ * @exampleSql Bulk processing
4892
+ * ```sql
4893
+ * create function add_one_each(arr int[]) returns int[] as $$
4894
+ * select array_agg(n + 1) from unnest(arr) as n;
4895
+ * $$ language sql;
4896
+ * ```
4897
+ *
4898
+ * @exampleResponse Bulk processing
4899
+ * ```json
4900
+ * {
4901
+ * "data": [
4902
+ * 2,
4903
+ * 3,
4904
+ * 4
4905
+ * ],
4906
+ * "status": 200,
4907
+ * "statusText": "OK"
4908
+ * }
4909
+ * ```
4910
+ *
4911
+ * @exampleDescription Call a Postgres function with filters
4912
+ * Postgres functions that return tables can also be combined with [Filters](/docs/reference/javascript/using-filters) and [Modifiers](/docs/reference/javascript/using-modifiers).
4913
+ *
4914
+ * @example Call a Postgres function with filters
4915
+ * ```ts
4916
+ * const { data, error } = await supabase
4917
+ * .rpc('list_stored_countries')
4918
+ * .eq('id', 1)
4919
+ * .single()
4920
+ * ```
4921
+ *
4922
+ * @exampleSql Call a Postgres function with filters
4923
+ * ```sql
4924
+ * create table
4925
+ * countries (id int8 primary key, name text);
4926
+ *
4927
+ * insert into
4928
+ * countries (id, name)
4929
+ * values
4930
+ * (1, 'Rohan'),
4931
+ * (2, 'The Shire');
4932
+ *
4933
+ * create function list_stored_countries() returns setof countries as $$
4934
+ * select * from countries;
4935
+ * $$ language sql;
4936
+ * ```
4937
+ *
4938
+ * @exampleResponse Call a Postgres function with filters
4939
+ * ```json
4940
+ * {
4941
+ * "data": {
4942
+ * "id": 1,
4943
+ * "name": "Rohan"
4944
+ * },
4945
+ * "status": 200,
4946
+ * "statusText": "OK"
4947
+ * }
4948
+ * ```
4949
+ *
4950
+ * @example Call a read-only Postgres function
4951
+ * ```ts
4952
+ * const { data, error } = await supabase.rpc('hello_world', undefined, { get: true })
4953
+ * ```
4954
+ *
4955
+ * @exampleSql Call a read-only Postgres function
4956
+ * ```sql
4957
+ * create function hello_world() returns text as $$
4958
+ * select 'Hello world';
4959
+ * $$ language sql;
4960
+ * ```
4961
+ *
4962
+ * @exampleResponse Call a read-only Postgres function
4963
+ * ```json
4964
+ * {
4965
+ * "data": "Hello world",
4966
+ * "status": 200,
4967
+ * "statusText": "OK"
4968
+ * }
4969
+ * ```
4970
+ */
4971
+ rpc(fn, args = {}, { head = false, get = false, count } = {}) {
4972
+ var _this$fetch;
4973
+ let method;
4974
+ const url = new URL(`${this.url}/rpc/${fn}`);
4975
+ let body;
4976
+ const _isObject = (v) => v !== null && typeof v === "object" && (!Array.isArray(v) || v.some(_isObject));
4977
+ const _hasObjectArg = head && Object.values(args).some(_isObject);
4978
+ if (_hasObjectArg) {
4979
+ method = "POST";
4980
+ body = args;
4981
+ } else if (head || get) {
4982
+ method = head ? "HEAD" : "GET";
4983
+ Object.entries(args).filter(([_, value]) => value !== void 0).map(([name, value]) => [name, Array.isArray(value) ? `{${value.join(",")}}` : `${value}`]).forEach(([name, value]) => {
4984
+ url.searchParams.append(name, value);
4985
+ });
4986
+ } else {
4987
+ method = "POST";
4988
+ body = args;
4989
+ }
4990
+ const headers = new Headers(this.headers);
4991
+ if (_hasObjectArg) headers.set("Prefer", count ? `count=${count},return=minimal` : "return=minimal");
4992
+ else if (count) headers.set("Prefer", `count=${count}`);
4993
+ return new PostgrestFilterBuilder({
4994
+ method,
4995
+ url,
4996
+ headers,
4997
+ schema: this.schemaName,
4998
+ body,
4999
+ fetch: (_this$fetch = this.fetch) !== null && _this$fetch !== void 0 ? _this$fetch : fetch,
5000
+ urlLengthLimit: this.urlLengthLimit,
5001
+ retry: this.retry
5002
+ });
5003
+ }
5004
+ };
5005
+
5006
+ //#endregion
5007
+ //#region src/index.ts
5008
+ var src_default = {
5009
+ PostgrestClient,
5010
+ PostgrestQueryBuilder,
5011
+ PostgrestFilterBuilder,
5012
+ PostgrestTransformBuilder,
5013
+ PostgrestBuilder,
5014
+ PostgrestError
5015
+ };
5016
+
5017
+ //#endregion
5018
+ exports.PostgrestBuilder = PostgrestBuilder;
5019
+ exports.PostgrestClient = PostgrestClient;
5020
+ exports.PostgrestError = PostgrestError;
5021
+ exports.PostgrestFilterBuilder = PostgrestFilterBuilder;
5022
+ exports.PostgrestQueryBuilder = PostgrestQueryBuilder;
5023
+ exports.PostgrestTransformBuilder = PostgrestTransformBuilder;
5024
+ exports.default = src_default;
5025
+ //# sourceMappingURL=index.cjs.map