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