@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,3828 @@
1
+ //#region src/PostgrestError.d.ts
2
+ /**
3
+ * Error format
4
+ *
5
+ * {@link https://postgrest.org/en/stable/api.html?highlight=options#errors-and-http-status-codes}
6
+ */
7
+ declare class PostgrestError extends Error {
8
+ details: string;
9
+ hint: string;
10
+ code: string;
11
+ /**
12
+ * @example
13
+ * ```ts
14
+ * import PostgrestError from '@supabase/postgrest-js'
15
+ *
16
+ * throw new PostgrestError({
17
+ * message: 'Row level security prevented the request',
18
+ * details: 'RLS denied the insert',
19
+ * hint: 'Check your policies',
20
+ * code: 'PGRST301',
21
+ * })
22
+ * ```
23
+ */
24
+ constructor(context: {
25
+ message: string;
26
+ details: string;
27
+ hint: string;
28
+ code: string;
29
+ });
30
+ toJSON(): {
31
+ name: string;
32
+ message: string;
33
+ details: string;
34
+ hint: string;
35
+ code: string;
36
+ };
37
+ }
38
+ //#endregion
39
+ //#region src/types/common/common.d.ts
40
+ type Fetch = typeof fetch;
41
+ type GenericRelationship = {
42
+ foreignKeyName: string;
43
+ columns: string[];
44
+ isOneToOne?: boolean;
45
+ referencedRelation: string;
46
+ referencedColumns: string[];
47
+ };
48
+ type GenericTable = {
49
+ Row: Record<string, unknown>;
50
+ Insert: Record<string, unknown>;
51
+ Update: Record<string, unknown>;
52
+ Relationships: GenericRelationship[];
53
+ };
54
+ type GenericUpdatableView = {
55
+ Row: Record<string, unknown>;
56
+ Insert: Record<string, unknown>;
57
+ Update: Record<string, unknown>;
58
+ Relationships: GenericRelationship[];
59
+ };
60
+ type GenericNonUpdatableView = {
61
+ Row: Record<string, unknown>;
62
+ Relationships: GenericRelationship[];
63
+ };
64
+ type GenericView = GenericUpdatableView | GenericNonUpdatableView;
65
+ type GenericSetofOption = {
66
+ isSetofReturn?: boolean | undefined;
67
+ isOneToOne?: boolean | undefined;
68
+ isNotNullable?: boolean | undefined;
69
+ to: string;
70
+ from: string;
71
+ };
72
+ type GenericFunction = {
73
+ Args: Record<string, unknown> | never;
74
+ Returns: unknown;
75
+ SetofOptions?: GenericSetofOption;
76
+ };
77
+ type GenericSchema = {
78
+ Tables: Record<string, GenericTable>;
79
+ Views: Record<string, GenericView>;
80
+ Functions: Record<string, GenericFunction>;
81
+ };
82
+ type ClientServerOptions = {
83
+ PostgrestVersion?: string;
84
+ };
85
+ //#endregion
86
+ //#region src/select-query-parser/types.d.ts
87
+ type AggregateWithoutColumnFunctions = 'count';
88
+ type AggregateWithColumnFunctions = 'sum' | 'avg' | 'min' | 'max' | AggregateWithoutColumnFunctions;
89
+ type AggregateFunctions = AggregateWithColumnFunctions;
90
+ type Json = string | number | boolean | null | {
91
+ [key: string]: Json | undefined;
92
+ } | Json[];
93
+ type PostgresSQLNumberTypes = 'int2' | 'int4' | 'int8' | 'float4' | 'float8' | 'numeric';
94
+ type PostgresSQLStringTypes = 'bytea' | 'bpchar' | 'varchar' | 'date' | 'text' | 'citext' | 'time' | 'timetz' | 'timestamp' | 'timestamptz' | 'uuid' | 'vector';
95
+ type SingleValuePostgreSQLTypes = PostgresSQLNumberTypes | PostgresSQLStringTypes | 'bool' | 'json' | 'jsonb' | 'void' | 'record' | string;
96
+ type ArrayPostgreSQLTypes = `_${SingleValuePostgreSQLTypes}`;
97
+ type TypeScriptSingleValueTypes<T extends SingleValuePostgreSQLTypes> = T extends 'bool' ? boolean : T extends PostgresSQLNumberTypes ? number : T extends PostgresSQLStringTypes ? string : T extends 'json' | 'jsonb' ? Json : T extends 'void' ? undefined : T extends 'record' ? Record<string, unknown> : unknown;
98
+ type StripUnderscore<T extends string> = T extends `_${infer U}` ? U : T;
99
+ type PostgreSQLTypes = SingleValuePostgreSQLTypes | ArrayPostgreSQLTypes;
100
+ type TypeScriptTypes<T extends PostgreSQLTypes> = T extends ArrayPostgreSQLTypes ? TypeScriptSingleValueTypes<StripUnderscore<Extract<T, SingleValuePostgreSQLTypes>>>[] : TypeScriptSingleValueTypes<T>;
101
+ type UnionToIntersection$1<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
102
+ type LastOf$1<T> = UnionToIntersection$1<T extends any ? () => T : never> extends (() => infer R) ? R : never;
103
+ type Push<T extends any[], V> = [...T, V];
104
+ type UnionToTuple<T, L$1 = LastOf$1<T>, N = ([T] extends [never] ? true : false)> = N extends true ? [] : Push<UnionToTuple<Exclude<T, L$1>>, L$1>;
105
+ type UnionToArray<T> = UnionToTuple<T>;
106
+ type ExtractFirstProperty<T> = T extends { [K in keyof T]: infer U } ? U : never;
107
+ type ContainsNull<T> = null extends T ? true : false;
108
+ type IsNonEmptyArray<T> = Exclude<T, undefined> extends readonly [unknown, ...unknown[]] ? true : false;
109
+ type TablesAndViews$2<Schema extends GenericSchema> = Schema['Tables'] & Exclude<Schema['Views'], ''>;
110
+ //#endregion
111
+ //#region src/select-query-parser/parser.d.ts
112
+ /**
113
+ * Parses a query.
114
+ * A query is a sequence of nodes, separated by `,`, ensuring that there is
115
+ * no remaining input after all nodes have been parsed.
116
+ *
117
+ * Returns an array of parsed nodes, or an error.
118
+ */
119
+ type ParseQuery<Query extends string> = string extends Query ? GenericStringError : ParseNodes<EatWhitespace<Query>> extends [infer Nodes, `${infer Remainder}`] ? Nodes extends Ast.Node[] ? EatWhitespace<Remainder> extends '' ? SimplifyDeep<Nodes> : ParserError<`Unexpected input: ${Remainder}`> : ParserError<'Invalid nodes array structure'> : ParseNodes<EatWhitespace<Query>>;
120
+ /**
121
+ * Notes: all `Parse*` types assume that their input strings have their whitespace
122
+ * removed. They return tuples of ["Return Value", "Remainder of text"] or
123
+ * a `ParserError`.
124
+ */
125
+ /**
126
+ * Parses a sequence of nodes, separated by `,`.
127
+ *
128
+ * Returns a tuple of ["Parsed fields", "Remainder of text"] or an error.
129
+ */
130
+ type ParseNodes<Input extends string> = string extends Input ? GenericStringError : ParseNodesHelper<Input, []>;
131
+ type ParseNodesHelper<Input extends string, Nodes$1 extends Ast.Node[]> = ParseNode<Input> extends [infer Node, `${infer Remainder}`] ? Node extends Ast.Node ? EatWhitespace<Remainder> extends `,${infer Remainder}` ? ParseNodesHelper<EatWhitespace<Remainder>, [...Nodes$1, Node]> : [[...Nodes$1, Node], EatWhitespace<Remainder>] : ParserError<'Invalid node type in nodes helper'> : ParseNode<Input>;
132
+ /**
133
+ * Parses a node.
134
+ * A node is one of the following:
135
+ * - `*`
136
+ * - a field, as defined above
137
+ * - a renamed field, `renamed_field:field`
138
+ * - a spread field, `...field`
139
+ */
140
+ type ParseNode<Input extends string> = Input extends '' ? ParserError<'Empty string'> : Input extends `*${infer Remainder}` ? [Ast.StarNode, EatWhitespace<Remainder>] : Input extends `...${infer Remainder}` ? ParseField<EatWhitespace<Remainder>> extends [infer TargetField, `${infer Remainder}`] ? TargetField extends Ast.FieldNode ? [{
141
+ type: 'spread';
142
+ target: TargetField;
143
+ }, EatWhitespace<Remainder>] : ParserError<'Invalid target field type in spread'> : ParserError<`Unable to parse spread resource at \`${Input}\``> : ParseIdentifier<Input> extends [infer NameOrAlias, `${infer Remainder}`] ? EatWhitespace<Remainder> extends `::${infer _}` ? ParseField<Input> : EatWhitespace<Remainder> extends `:${infer Remainder}` ? ParseField<EatWhitespace<Remainder>> extends [infer Field, `${infer Remainder}`] ? Field extends Ast.FieldNode ? [Omit<Field, 'alias'> & {
144
+ alias: NameOrAlias;
145
+ }, EatWhitespace<Remainder>] : ParserError<'Invalid field type in alias parsing'> : ParserError<`Unable to parse renamed field at \`${Input}\``> : ParseField<Input> : ParserError<`Expected identifier at \`${Input}\``>;
146
+ /**
147
+ * Parses a field without preceding alias.
148
+ * A field is one of the following:
149
+ * - a top-level `count` field: https://docs.postgrest.org/en/v12/references/api/aggregate_functions.html#the-case-of-count
150
+ * - a field with an embedded resource
151
+ * - `field(nodes)`
152
+ * - `field!hint(nodes)`
153
+ * - `field!inner(nodes)`
154
+ * - `field!left(nodes)`
155
+ * - `field!hint!inner(nodes)`
156
+ * - `field!hint!left(nodes)`
157
+ * - a field without an embedded resource (see {@link ParseNonEmbeddedResourceField})
158
+ */
159
+ type ParseField<Input extends string> = Input extends '' ? ParserError<'Empty string'> : ParseIdentifier<Input> extends [infer Name, `${infer Remainder}`] ? Name extends 'count' ? ParseCountField<Input> : Remainder extends `!inner${infer Remainder}` ? ParseEmbeddedResource<EatWhitespace<Remainder>> extends [infer Children, `${infer Remainder}`] ? Children extends Ast.Node[] ? [{
160
+ type: 'field';
161
+ name: Name;
162
+ innerJoin: true;
163
+ children: Children;
164
+ }, Remainder] : ParserError<'Invalid children array in inner join'> : CreateParserErrorIfRequired<ParseEmbeddedResource<EatWhitespace<Remainder>>, `Expected embedded resource after "!inner" at \`${Remainder}\``> : EatWhitespace<Remainder> extends `!left${infer Remainder}` ? ParseEmbeddedResource<EatWhitespace<Remainder>> extends [infer Children, `${infer Remainder}`] ? Children extends Ast.Node[] ? [{
165
+ type: 'field';
166
+ name: Name;
167
+ children: Children;
168
+ }, EatWhitespace<Remainder>] : ParserError<'Invalid children array in left join'> : CreateParserErrorIfRequired<ParseEmbeddedResource<EatWhitespace<Remainder>>, `Expected embedded resource after "!left" at \`${EatWhitespace<Remainder>}\``> : EatWhitespace<Remainder> extends `!${infer Remainder}` ? ParseIdentifier<EatWhitespace<Remainder>> extends [infer Hint, `${infer Remainder}`] ? EatWhitespace<Remainder> extends `!inner${infer Remainder}` ? ParseEmbeddedResource<EatWhitespace<Remainder>> extends [infer Children, `${infer Remainder}`] ? Children extends Ast.Node[] ? [{
169
+ type: 'field';
170
+ name: Name;
171
+ hint: Hint;
172
+ innerJoin: true;
173
+ children: Children;
174
+ }, EatWhitespace<Remainder>] : ParserError<'Invalid children array in hint inner join'> : ParseEmbeddedResource<EatWhitespace<Remainder>> : ParseEmbeddedResource<EatWhitespace<Remainder>> extends [infer Children, `${infer Remainder}`] ? Children extends Ast.Node[] ? [{
175
+ type: 'field';
176
+ name: Name;
177
+ hint: Hint;
178
+ children: Children;
179
+ }, EatWhitespace<Remainder>] : ParserError<'Invalid children array in hint'> : ParseEmbeddedResource<EatWhitespace<Remainder>> : ParserError<`Expected identifier after "!" at \`${EatWhitespace<Remainder>}\``> : EatWhitespace<Remainder> extends `(${infer _}` ? ParseEmbeddedResource<EatWhitespace<Remainder>> extends [infer Children, `${infer Remainder}`] ? Children extends Ast.Node[] ? [{
180
+ type: 'field';
181
+ name: Name;
182
+ children: Children;
183
+ }, EatWhitespace<Remainder>] : ParserError<'Invalid children array in field'> : ParseEmbeddedResource<EatWhitespace<Remainder>> : ParseNonEmbeddedResourceField<Input> : ParserError<`Expected identifier at \`${Input}\``>;
184
+ type ParseCountField<Input extends string> = ParseIdentifier<Input> extends ['count', `${infer Remainder}`] ? (EatWhitespace<Remainder> extends `()${infer Remainder_}` ? EatWhitespace<Remainder_> : EatWhitespace<Remainder>) extends `${infer Remainder}` ? Remainder extends `::${infer _}` ? ParseFieldTypeCast<Remainder> extends [infer CastType, `${infer Remainder}`] ? [{
185
+ type: 'field';
186
+ name: 'count';
187
+ aggregateFunction: 'count';
188
+ castType: CastType;
189
+ }, Remainder] : ParseFieldTypeCast<Remainder> : [{
190
+ type: 'field';
191
+ name: 'count';
192
+ aggregateFunction: 'count';
193
+ }, Remainder] : never : ParserError<`Expected "count" at \`${Input}\``>;
194
+ /**
195
+ * Parses an embedded resource, which is an opening `(`, followed by a sequence of
196
+ * 0 or more nodes separated by `,`, then a closing `)`.
197
+ *
198
+ * Returns a tuple of ["Parsed fields", "Remainder of text"], an error,
199
+ * or the original string input indicating that no opening `(` was found.
200
+ */
201
+ type ParseEmbeddedResource<Input extends string> = Input extends `(${infer Remainder}` ? EatWhitespace<Remainder> extends `)${infer Remainder}` ? [[], EatWhitespace<Remainder>] : ParseNodes<EatWhitespace<Remainder>> extends [infer Nodes, `${infer Remainder}`] ? Nodes extends Ast.Node[] ? EatWhitespace<Remainder> extends `)${infer Remainder}` ? [Nodes, EatWhitespace<Remainder>] : ParserError<`Expected ")" at \`${EatWhitespace<Remainder>}\``> : ParserError<'Invalid nodes array in embedded resource'> : ParseNodes<EatWhitespace<Remainder>> : ParserError<`Expected "(" at \`${Input}\``>;
202
+ /**
203
+ * Parses a field excluding embedded resources, without preceding field renaming.
204
+ * This is one of the following:
205
+ * - `field`
206
+ * - `field.aggregate()`
207
+ * - `field.aggregate()::type`
208
+ * - `field::type`
209
+ * - `field::type.aggregate()`
210
+ * - `field::type.aggregate()::type`
211
+ * - `field->json...`
212
+ * - `field->json.aggregate()`
213
+ * - `field->json.aggregate()::type`
214
+ * - `field->json::type`
215
+ * - `field->json::type.aggregate()`
216
+ * - `field->json::type.aggregate()::type`
217
+ */
218
+ type ParseNonEmbeddedResourceField<Input extends string> = ParseIdentifier<Input> extends [infer Name, `${infer Remainder}`] ? (Remainder extends `->${infer PathAndRest}` ? ParseJsonAccessor<Remainder> extends [infer PropertyName, infer PropertyType, `${infer Remainder}`] ? [{
219
+ type: 'field';
220
+ name: Name;
221
+ alias: PropertyName;
222
+ castType: PropertyType;
223
+ jsonPath: JsonPathToAccessor<PathAndRest extends `${infer Path},${string}` ? Path : PathAndRest>;
224
+ }, Remainder] : ParseJsonAccessor<Remainder> : [{
225
+ type: 'field';
226
+ name: Name;
227
+ }, Remainder]) extends infer Parsed ? Parsed extends [infer Field, `${infer Remainder}`] ? (Remainder extends `::${infer _}` ? ParseFieldTypeCast<Remainder> extends [infer CastType, `${infer Remainder}`] ? [Omit<Field, 'castType'> & {
228
+ castType: CastType;
229
+ }, Remainder] : ParseFieldTypeCast<Remainder> : [Field, Remainder]) extends infer Parsed ? Parsed extends [infer Field, `${infer Remainder}`] ? Remainder extends `.${infer _}` ? ParseFieldAggregation<Remainder> extends [infer AggregateFunction, `${infer Remainder}`] ? Remainder extends `::${infer _}` ? ParseFieldTypeCast<Remainder> extends [infer CastType, `${infer Remainder}`] ? [Omit<Field, 'castType'> & {
230
+ aggregateFunction: AggregateFunction;
231
+ castType: CastType;
232
+ }, Remainder] : ParseFieldTypeCast<Remainder> : [Field & {
233
+ aggregateFunction: AggregateFunction;
234
+ }, Remainder] : ParseFieldAggregation<Remainder> : [Field, Remainder] : Parsed : never : Parsed : never : ParserError<`Expected identifier at \`${Input}\``>;
235
+ /**
236
+ * Parses a JSON property accessor of the shape `->a->b->c`. The last accessor in
237
+ * the series may convert to text by using the ->> operator instead of ->.
238
+ *
239
+ * Returns a tuple of ["Last property name", "Last property type", "Remainder of text"]
240
+ */
241
+ type ParseJsonAccessor<Input extends string> = Input extends `->${infer Remainder}` ? Remainder extends `>${infer Remainder}` ? ParseIdentifier<Remainder> extends [infer Name, `${infer Remainder}`] ? [Name, 'text', EatWhitespace<Remainder>] : ParserError<'Expected property name after `->>`'> : ParseIdentifier<Remainder> extends [infer Name, `${infer Remainder}`] ? ParseJsonAccessor<Remainder> extends [infer PropertyName, infer PropertyType, `${infer Remainder}`] ? [PropertyName, PropertyType, EatWhitespace<Remainder>] : [Name, 'json', EatWhitespace<Remainder>] : ParserError<'Expected property name after `->`'> : ParserError<'Expected ->'>;
242
+ /**
243
+ * Parses a field typecast (`::type`), returning a tuple of ["Type", "Remainder of text"].
244
+ */
245
+ type ParseFieldTypeCast<Input extends string> = EatWhitespace<Input> extends `::${infer Remainder}` ? ParseIdentifier<EatWhitespace<Remainder>> extends [`${infer CastType}`, `${infer Remainder}`] ? [CastType, EatWhitespace<Remainder>] : ParserError<`Invalid type for \`::\` operator at \`${Remainder}\``> : ParserError<'Expected ::'>;
246
+ /**
247
+ * Parses a field aggregation (`.max()`), returning a tuple of ["Aggregate function", "Remainder of text"]
248
+ */
249
+ type ParseFieldAggregation<Input extends string> = EatWhitespace<Input> extends `.${infer Remainder}` ? ParseIdentifier<EatWhitespace<Remainder>> extends [`${infer FunctionName}`, `${infer Remainder}`] ? FunctionName extends Token.AggregateFunction ? EatWhitespace<Remainder> extends `()${infer Remainder}` ? [FunctionName, EatWhitespace<Remainder>] : ParserError<`Expected \`()\` after \`.\` operator \`${FunctionName}\``> : ParserError<`Invalid type for \`.\` operator \`${FunctionName}\``> : ParserError<`Invalid type for \`.\` operator at \`${Remainder}\``> : ParserError<'Expected .'>;
250
+ /**
251
+ * Parses a (possibly double-quoted) identifier.
252
+ * Identifiers are sequences of 1 or more letters.
253
+ */
254
+ type ParseIdentifier<Input extends string> = ParseLetters<Input> extends [infer Name, `${infer Remainder}`] ? [Name, EatWhitespace<Remainder>] : ParseQuotedLetters<Input> extends [infer Name, `${infer Remainder}`] ? [Name, EatWhitespace<Remainder>] : ParserError<`No (possibly double-quoted) identifier at \`${Input}\``>;
255
+ /**
256
+ * Parse a consecutive sequence of 1 or more letter, where letters are `[0-9a-zA-Z_]`.
257
+ */
258
+ type ParseLetters<Input extends string> = string extends Input ? GenericStringError : ParseLettersHelper<Input, ''> extends [`${infer Letters}`, `${infer Remainder}`] ? Letters extends '' ? ParserError<`Expected letter at \`${Input}\``> : [Letters, Remainder] : ParseLettersHelper<Input, ''>;
259
+ type ParseLettersHelper<Input extends string, Acc extends string> = string extends Input ? GenericStringError : Input extends `${infer L}${infer Remainder}` ? L extends Token.Letter ? ParseLettersHelper<Remainder, `${Acc}${L}`> : [Acc, Input] : [Acc, ''];
260
+ /**
261
+ * Parse a consecutive sequence of 1 or more double-quoted letters,
262
+ * where letters are `[^"]`.
263
+ */
264
+ type ParseQuotedLetters<Input extends string> = string extends Input ? GenericStringError : Input extends `"${infer Remainder}` ? ParseQuotedLettersHelper<Remainder, ''> extends [`${infer Letters}`, `${infer Remainder}`] ? Letters extends '' ? ParserError<`Expected string at \`${Remainder}\``> : [Letters, Remainder] : ParseQuotedLettersHelper<Remainder, ''> : ParserError<`Not a double-quoted string at \`${Input}\``>;
265
+ type ParseQuotedLettersHelper<Input extends string, Acc extends string> = string extends Input ? GenericStringError : Input extends `${infer L}${infer Remainder}` ? L extends '"' ? [Acc, Remainder] : ParseQuotedLettersHelper<Remainder, `${Acc}${L}`> : ParserError<`Missing closing double-quote in \`"${Acc}${Input}\``>;
266
+ /**
267
+ * Trims whitespace from the left of the input.
268
+ */
269
+ type EatWhitespace<Input extends string> = string extends Input ? GenericStringError : Input extends `${Token.Whitespace}${infer Remainder}` ? EatWhitespace<Remainder> : Input;
270
+ /**
271
+ * Creates a new {@link ParserError} if the given input is not already a parser error.
272
+ */
273
+ type CreateParserErrorIfRequired<Input, Message extends string> = Input extends ParserError<string> ? Input : ParserError<Message>;
274
+ /**
275
+ * Parser errors.
276
+ */
277
+ type ParserError<Message extends string> = {
278
+ error: true;
279
+ } & Message;
280
+ type GenericStringError = ParserError<'Received a generic string'>;
281
+ declare namespace Ast {
282
+ type Node = FieldNode | StarNode | SpreadNode;
283
+ type FieldNode = {
284
+ type: 'field';
285
+ name: string;
286
+ alias?: string;
287
+ hint?: string;
288
+ innerJoin?: true;
289
+ castType?: string;
290
+ jsonPath?: string;
291
+ aggregateFunction?: Token.AggregateFunction;
292
+ children?: Node[];
293
+ };
294
+ type StarNode = {
295
+ type: 'star';
296
+ };
297
+ type SpreadNode = {
298
+ type: 'spread';
299
+ target: FieldNode & {
300
+ children: Node[];
301
+ };
302
+ };
303
+ }
304
+ declare namespace Token {
305
+ export type Whitespace = ' ' | '\n' | '\t';
306
+ type LowerAlphabet = 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z';
307
+ type Alphabet = LowerAlphabet | Uppercase<LowerAlphabet>;
308
+ type Digit = '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '0';
309
+ export type Letter = Alphabet | Digit | '_';
310
+ export type AggregateFunction = 'count' | 'sum' | 'avg' | 'min' | 'max';
311
+ export {};
312
+ }
313
+ //#endregion
314
+ //#region src/select-query-parser/utils.d.ts
315
+ type IsAny$1<T> = 0 extends 1 & T ? true : false;
316
+ type SelectQueryError<Message extends string> = {
317
+ error: true;
318
+ } & Message;
319
+ type DeduplicateRelationships<T extends readonly unknown[]> = T extends readonly [infer First, ...infer Rest] ? First extends Rest[number] ? DeduplicateRelationships<Rest extends readonly unknown[] ? Rest : []> : [First, ...DeduplicateRelationships<Rest extends readonly unknown[] ? Rest : []>] : T;
320
+ type GetFieldNodeResultName<Field$1 extends Ast.FieldNode> = Field$1['alias'] extends string ? Field$1['alias'] : Field$1['aggregateFunction'] extends AggregateFunctions ? Field$1['aggregateFunction'] : Field$1['name'];
321
+ type FilterRelationNodes<Nodes$1 extends Ast.Node[]> = UnionToArray<{ [K in keyof Nodes$1]: Nodes$1[K] extends Ast.SpreadNode ? Nodes$1[K]['target'] : Nodes$1[K] extends Ast.FieldNode ? IsNonEmptyArray<Nodes$1[K]['children']> extends true ? Nodes$1[K] : never : never }[number]>;
322
+ type ResolveRelationships<Schema extends GenericSchema, RelationName extends string, Relationships extends GenericRelationship[], Nodes$1 extends Ast.FieldNode[]> = UnionToArray<{ [K in keyof Nodes$1]: Nodes$1[K] extends Ast.FieldNode ? ResolveRelationship<Schema, Relationships, Nodes$1[K], RelationName> extends infer Relation ? Relation extends {
323
+ relation: {
324
+ referencedRelation: string;
325
+ foreignKeyName: string;
326
+ match: string;
327
+ };
328
+ from: string;
329
+ } ? {
330
+ referencedTable: Relation['relation']['referencedRelation'];
331
+ fkName: Relation['relation']['foreignKeyName'];
332
+ from: Relation['from'];
333
+ match: Relation['relation']['match'];
334
+ fieldName: GetFieldNodeResultName<Nodes$1[K]>;
335
+ } : Relation : never : never }>[0];
336
+ /**
337
+ * Checks if a relation is implicitly referenced twice, requiring disambiguation
338
+ */
339
+ type IsDoubleReference<T, U> = T extends {
340
+ referencedTable: infer RT;
341
+ fieldName: infer FN;
342
+ match: infer M;
343
+ } ? M extends 'col' | 'refrel' ? U extends {
344
+ referencedTable: RT;
345
+ fieldName: FN;
346
+ match: M;
347
+ } ? true : false : false : false;
348
+ /**
349
+ * Compares one element with all other elements in the array to find duplicates
350
+ */
351
+ type CheckDuplicates<Arr extends any[], Current> = Arr extends [infer Head, ...infer Tail] ? IsDoubleReference<Current, Head> extends true ? Head | CheckDuplicates<Tail, Current> : CheckDuplicates<Tail, Current> : never;
352
+ /**
353
+ * Iterates over the elements of the array to find duplicates
354
+ */
355
+ type FindDuplicatesWithinDeduplicated<Arr extends any[]> = Arr extends [infer Head, ...infer Tail] ? CheckDuplicates<Tail, Head> | FindDuplicatesWithinDeduplicated<Tail> : never;
356
+ type FindDuplicates<Arr extends any[]> = FindDuplicatesWithinDeduplicated<DeduplicateRelationships<Arr>>;
357
+ type CheckDuplicateEmbededReference<Schema extends GenericSchema, RelationName extends string, Relationships extends GenericRelationship[], Nodes$1 extends Ast.Node[]> = FilterRelationNodes<Nodes$1> extends infer RelationsNodes ? RelationsNodes extends Ast.FieldNode[] ? ResolveRelationships<Schema, RelationName, Relationships, RelationsNodes> extends infer ResolvedRels ? ResolvedRels extends unknown[] ? FindDuplicates<ResolvedRels> extends infer Duplicates ? Duplicates extends never ? false : Duplicates extends {
358
+ fieldName: infer FieldName;
359
+ } ? FieldName extends string ? { [K in FieldName]: SelectQueryError<`table "${RelationName}" specified more than once use hinting for desambiguation`> } : false : false : false : false : false : false : false;
360
+ /**
361
+ * Returns a boolean representing whether there is a foreign key referencing
362
+ * a given relation.
363
+ */
364
+ type HasFKeyToFRel<FRelName, Relationships> = Relationships extends [infer R] ? R extends {
365
+ referencedRelation: FRelName;
366
+ } ? true : false : Relationships extends [infer R, ...infer Rest] ? HasFKeyToFRel<FRelName, [R]> extends true ? true : HasFKeyToFRel<FRelName, Rest> : false;
367
+ /**
368
+ * Checks if there is more than one relation to a given foreign relation name in the Relationships.
369
+ */
370
+ type HasMultipleFKeysToFRelDeduplicated<FRelName, Relationships> = Relationships extends [infer R, ...infer Rest] ? R extends {
371
+ referencedRelation: FRelName;
372
+ } ? HasFKeyToFRel<FRelName, Rest> extends true ? true : HasMultipleFKeysToFRelDeduplicated<FRelName, Rest> : HasMultipleFKeysToFRelDeduplicated<FRelName, Rest> : false;
373
+ type HasMultipleFKeysToFRel<FRelName, Relationships extends unknown[]> = HasMultipleFKeysToFRelDeduplicated<FRelName, DeduplicateRelationships<Relationships>>;
374
+ type CheckRelationshipError<Schema extends GenericSchema, Relationships extends GenericRelationship[], CurrentTableOrView extends keyof TablesAndViews$2<Schema> & string, FoundRelation$1> = FoundRelation$1 extends SelectQueryError<string> ? FoundRelation$1 : FoundRelation$1 extends {
375
+ relation: {
376
+ referencedRelation: infer RelatedRelationName;
377
+ name: string;
378
+ };
379
+ direction: 'reverse';
380
+ } ? RelatedRelationName extends string ? HasMultipleFKeysToFRel<RelatedRelationName, Relationships> extends true ? SelectQueryError<`Could not embed because more than one relationship was found for '${RelatedRelationName}' and '${CurrentTableOrView}' you need to hint the column with ${RelatedRelationName}!<columnName> ?`> : FoundRelation$1 : never : FoundRelation$1 extends {
381
+ relation: {
382
+ referencedRelation: infer RelatedRelationName;
383
+ name: string;
384
+ };
385
+ direction: 'forward';
386
+ from: infer From;
387
+ } ? RelatedRelationName extends string ? From extends keyof TablesAndViews$2<Schema> & string ? HasMultipleFKeysToFRel<RelatedRelationName, TablesAndViews$2<Schema>[From]['Relationships']> extends true ? SelectQueryError<`Could not embed because more than one relationship was found for '${From}' and '${RelatedRelationName}' you need to hint the column with ${From}!<columnName> ?`> : FoundRelation$1 : never : never : FoundRelation$1;
388
+ /**
389
+ * Resolves relationships for embedded resources and retrieves the referenced Table
390
+ */
391
+ type ResolveRelationship<Schema extends GenericSchema, Relationships extends GenericRelationship[], Field$1 extends Ast.FieldNode, CurrentTableOrView extends keyof TablesAndViews$2<Schema> & string> = ResolveReverseRelationship<Schema, Relationships, Field$1, CurrentTableOrView> extends infer ReverseRelationship ? ReverseRelationship extends false ? CheckRelationshipError<Schema, Relationships, CurrentTableOrView, ResolveForwardRelationship<Schema, Field$1, CurrentTableOrView>> : CheckRelationshipError<Schema, Relationships, CurrentTableOrView, ReverseRelationship> : never;
392
+ /**
393
+ * Resolves reverse relationships (from children to parent)
394
+ */
395
+ type ResolveReverseRelationship<Schema extends GenericSchema, Relationships extends GenericRelationship[], Field$1 extends Ast.FieldNode, CurrentTableOrView extends keyof TablesAndViews$2<Schema> & string> = FindFieldMatchingRelationships<Schema, Relationships, Field$1> extends infer FoundRelation ? FoundRelation extends never ? false : FoundRelation extends {
396
+ referencedRelation: infer RelatedRelationName;
397
+ } ? RelatedRelationName extends string ? RelatedRelationName extends keyof TablesAndViews$2<Schema> ? FoundRelation extends {
398
+ hint: string;
399
+ } ? {
400
+ referencedTable: TablesAndViews$2<Schema>[RelatedRelationName];
401
+ relation: FoundRelation;
402
+ direction: 'reverse';
403
+ from: CurrentTableOrView;
404
+ } : HasMultipleFKeysToFRel<RelatedRelationName, Relationships> extends true ? SelectQueryError<`Could not embed because more than one relationship was found for '${RelatedRelationName}' and '${CurrentTableOrView}' you need to hint the column with ${RelatedRelationName}!<columnName> ?`> : {
405
+ referencedTable: TablesAndViews$2<Schema>[RelatedRelationName];
406
+ relation: FoundRelation;
407
+ direction: 'reverse';
408
+ from: CurrentTableOrView;
409
+ } : SelectQueryError<`Relation '${RelatedRelationName}' not found in schema.`> : false : false : false;
410
+ type FindMatchingTableRelationships<Schema extends GenericSchema, Relationships extends GenericRelationship[], value extends string> = Relationships extends [infer R, ...infer Rest] ? Rest extends GenericRelationship[] ? R extends {
411
+ referencedRelation: infer ReferencedRelation;
412
+ } ? ReferencedRelation extends keyof Schema['Tables'] ? R extends {
413
+ foreignKeyName: value;
414
+ } ? R & {
415
+ match: 'fkname';
416
+ } : R extends {
417
+ referencedRelation: value;
418
+ } ? R & {
419
+ match: 'refrel';
420
+ } : R extends {
421
+ columns: [value];
422
+ } ? R & {
423
+ match: 'col';
424
+ } : FindMatchingTableRelationships<Schema, Rest, value> : FindMatchingTableRelationships<Schema, Rest, value> : false : false : false;
425
+ type FindMatchingViewRelationships<Schema extends GenericSchema, Relationships extends GenericRelationship[], value extends string> = Relationships extends [infer R, ...infer Rest] ? Rest extends GenericRelationship[] ? R extends {
426
+ referencedRelation: infer ReferencedRelation;
427
+ } ? ReferencedRelation extends keyof Schema['Views'] ? R extends {
428
+ foreignKeyName: value;
429
+ } ? R & {
430
+ match: 'fkname';
431
+ } : R extends {
432
+ referencedRelation: value;
433
+ } ? R & {
434
+ match: 'refrel';
435
+ } : R extends {
436
+ columns: [value];
437
+ } ? R & {
438
+ match: 'col';
439
+ } : FindMatchingViewRelationships<Schema, Rest, value> : FindMatchingViewRelationships<Schema, Rest, value> : false : false : false;
440
+ type FindMatchingHintTableRelationships<Schema extends GenericSchema, Relationships extends GenericRelationship[], hint extends string, name extends string> = Relationships extends [infer R, ...infer Rest] ? Rest extends GenericRelationship[] ? R extends {
441
+ referencedRelation: infer ReferencedRelation;
442
+ } ? ReferencedRelation extends name ? R extends {
443
+ foreignKeyName: hint;
444
+ } ? R & {
445
+ match: 'fkname';
446
+ } : R extends {
447
+ referencedRelation: hint;
448
+ } ? R & {
449
+ match: 'refrel';
450
+ } : R extends {
451
+ columns: [hint];
452
+ } ? R & {
453
+ match: 'col';
454
+ } : FindMatchingHintTableRelationships<Schema, Rest, hint, name> : FindMatchingHintTableRelationships<Schema, Rest, hint, name> : false : false : false;
455
+ type FindMatchingHintViewRelationships<Schema extends GenericSchema, Relationships extends GenericRelationship[], hint extends string, name extends string> = Relationships extends [infer R, ...infer Rest] ? Rest extends GenericRelationship[] ? R extends {
456
+ referencedRelation: infer ReferencedRelation;
457
+ } ? ReferencedRelation extends name ? R extends {
458
+ foreignKeyName: hint;
459
+ } ? R & {
460
+ match: 'fkname';
461
+ } : R extends {
462
+ referencedRelation: hint;
463
+ } ? R & {
464
+ match: 'refrel';
465
+ } : R extends {
466
+ columns: [hint];
467
+ } ? R & {
468
+ match: 'col';
469
+ } : FindMatchingHintViewRelationships<Schema, Rest, hint, name> : FindMatchingHintViewRelationships<Schema, Rest, hint, name> : false : false : false;
470
+ type IsColumnsNullable<Table extends Pick<GenericTable, 'Row'>, Columns extends (keyof Table['Row'])[]> = Columns extends [infer Column, ...infer Rest] ? Column extends keyof Table['Row'] ? ContainsNull<Table['Row'][Column]> extends true ? true : IsColumnsNullable<Table, Rest extends (keyof Table['Row'])[] ? Rest : []> : false : false;
471
+ type IsRelationNullable<Table extends GenericTable, Relation$1 extends GenericRelationship> = IsColumnsNullable<Table, Relation$1['columns']>;
472
+ type TableForwardRelationships<Schema extends GenericSchema, TName> = TName extends keyof TablesAndViews$2<Schema> ? UnionToArray<RecursivelyFindRelationships<Schema, TName, keyof TablesAndViews$2<Schema>>> extends infer R ? R extends (GenericRelationship & {
473
+ from: keyof TablesAndViews$2<Schema>;
474
+ })[] ? R : [] : [] : [];
475
+ type RecursivelyFindRelationships<Schema extends GenericSchema, TName, Keys extends keyof TablesAndViews$2<Schema>> = Keys extends infer K ? K extends keyof TablesAndViews$2<Schema> ? FilterRelationships<TablesAndViews$2<Schema>[K]['Relationships'], TName, K> extends never ? RecursivelyFindRelationships<Schema, TName, Exclude<Keys, K>> : FilterRelationships<TablesAndViews$2<Schema>[K]['Relationships'], TName, K> | RecursivelyFindRelationships<Schema, TName, Exclude<Keys, K>> : false : false;
476
+ type FilterRelationships<R$1, TName, From$1> = R$1 extends readonly (infer Rel)[] ? Rel extends {
477
+ referencedRelation: TName;
478
+ } ? Rel & {
479
+ from: From$1;
480
+ } : never : never;
481
+ type ResolveForwardRelationship<Schema extends GenericSchema, Field$1 extends Ast.FieldNode, CurrentTableOrView extends keyof TablesAndViews$2<Schema> & string> = FindFieldMatchingRelationships<Schema, TablesAndViews$2<Schema>[Field$1['name']]['Relationships'], Ast.FieldNode & {
482
+ name: CurrentTableOrView;
483
+ hint: Field$1['hint'];
484
+ }> extends infer FoundByName ? FoundByName extends GenericRelationship ? {
485
+ referencedTable: TablesAndViews$2<Schema>[Field$1['name']];
486
+ relation: FoundByName;
487
+ direction: 'forward';
488
+ from: Field$1['name'];
489
+ type: 'found-by-name';
490
+ } : FindFieldMatchingRelationships<Schema, TableForwardRelationships<Schema, CurrentTableOrView>, Field$1> extends infer FoundByMatch ? FoundByMatch extends GenericRelationship & {
491
+ from: keyof TablesAndViews$2<Schema>;
492
+ } ? {
493
+ referencedTable: TablesAndViews$2<Schema>[FoundByMatch['from']];
494
+ relation: FoundByMatch;
495
+ direction: 'forward';
496
+ from: CurrentTableOrView;
497
+ type: 'found-by-match';
498
+ } : FindJoinTableRelationship<Schema, CurrentTableOrView, Field$1['name']> extends infer FoundByJoinTable ? FoundByJoinTable extends GenericRelationship ? {
499
+ referencedTable: TablesAndViews$2<Schema>[FoundByJoinTable['referencedRelation']];
500
+ relation: FoundByJoinTable & {
501
+ match: 'refrel';
502
+ };
503
+ direction: 'forward';
504
+ from: CurrentTableOrView;
505
+ type: 'found-by-join-table';
506
+ } : ResolveEmbededFunctionJoinTableRelationship<Schema, CurrentTableOrView, Field$1['name']> extends infer FoundEmbededFunctionJoinTableRelation ? FoundEmbededFunctionJoinTableRelation extends GenericFunction ? FoundEmbededFunctionJoinTableRelation['SetofOptions'] extends GenericSetofOption ? FoundEmbededFunctionJoinTableRelation['SetofOptions']['to'] extends '' ? {
507
+ referencedTable: {
508
+ Row: Record<string, never>;
509
+ Relationships: [];
510
+ };
511
+ relation: {
512
+ foreignKeyName: `${Field$1['name']}_${CurrentTableOrView}_scalar_forward`;
513
+ columns: [];
514
+ isOneToOne: false;
515
+ referencedColumns: [];
516
+ referencedRelation: '';
517
+ } & {
518
+ match: 'func';
519
+ isNotNullable: FoundEmbededFunctionJoinTableRelation['SetofOptions']['isNotNullable'] extends true ? true : FoundEmbededFunctionJoinTableRelation['SetofOptions']['isSetofReturn'] extends true ? false : true;
520
+ isSetofReturn: FoundEmbededFunctionJoinTableRelation['SetofOptions']['isSetofReturn'];
521
+ };
522
+ scalarType: FoundEmbededFunctionJoinTableRelation['Returns'];
523
+ direction: 'forward';
524
+ from: CurrentTableOrView;
525
+ type: 'found-by-embeded-scalar-function';
526
+ } : {
527
+ referencedTable: TablesAndViews$2<Schema>[FoundEmbededFunctionJoinTableRelation['SetofOptions']['to']];
528
+ relation: {
529
+ foreignKeyName: `${Field$1['name']}_${CurrentTableOrView}_${FoundEmbededFunctionJoinTableRelation['SetofOptions']['to']}_forward`;
530
+ columns: [];
531
+ isOneToOne: FoundEmbededFunctionJoinTableRelation['SetofOptions']['isOneToOne'] extends true ? true : false;
532
+ referencedColumns: [];
533
+ referencedRelation: FoundEmbededFunctionJoinTableRelation['SetofOptions']['to'];
534
+ } & {
535
+ match: 'func';
536
+ isNotNullable: FoundEmbededFunctionJoinTableRelation['SetofOptions']['isNotNullable'] extends true ? true : FoundEmbededFunctionJoinTableRelation['SetofOptions']['isSetofReturn'] extends true ? false : true;
537
+ isSetofReturn: FoundEmbededFunctionJoinTableRelation['SetofOptions']['isSetofReturn'];
538
+ };
539
+ direction: 'forward';
540
+ from: CurrentTableOrView;
541
+ type: 'found-by-embeded-function';
542
+ } : SelectQueryError<`could not find the relation between ${CurrentTableOrView} and ${Field$1['name']}`> : SelectQueryError<`could not find the relation between ${CurrentTableOrView} and ${Field$1['name']}`> : SelectQueryError<`could not find the relation between ${CurrentTableOrView} and ${Field$1['name']}`> : SelectQueryError<`could not find the relation between ${CurrentTableOrView} and ${Field$1['name']}`> : SelectQueryError<`could not find the relation between ${CurrentTableOrView} and ${Field$1['name']}`> : SelectQueryError<`could not find the relation between ${CurrentTableOrView} and ${Field$1['name']}`>;
543
+ /**
544
+ * Given a CurrentTableOrView, finds all join tables to this relation.
545
+ * For example, if products and categories are linked via product_categories table:
546
+ *
547
+ * @example Find join table relationship
548
+ * Given:
549
+ * - CurrentTableView = 'products'
550
+ * - FieldName = "categories"
551
+ *
552
+ * It should return this relationship from product_categories:
553
+ * {
554
+ * foreignKeyName: "product_categories_category_id_fkey",
555
+ * columns: ["category_id"],
556
+ * isOneToOne: false,
557
+ * referencedRelation: "categories",
558
+ * referencedColumns: ["id"]
559
+ * }
560
+ */
561
+ type ResolveJoinTableRelationship<Schema extends GenericSchema, CurrentTableOrView extends keyof TablesAndViews$2<Schema> & string, FieldName$1 extends string> = { [TableName in keyof TablesAndViews$2<Schema>]: DeduplicateRelationships<TablesAndViews$2<Schema>[TableName]['Relationships']> extends readonly (infer Rel)[] ? Rel extends {
562
+ referencedRelation: CurrentTableOrView;
563
+ } ? DeduplicateRelationships<TablesAndViews$2<Schema>[TableName]['Relationships']> extends readonly (infer OtherRel)[] ? OtherRel extends {
564
+ referencedRelation: FieldName$1;
565
+ } ? OtherRel : never : never : never : never }[keyof TablesAndViews$2<Schema>];
566
+ type ResolveEmbededFunctionJoinTableRelationship<Schema extends GenericSchema, CurrentTableOrView extends keyof TablesAndViews$2<Schema> & string, FieldName$1 extends string> = FindMatchingFunctionBySetofFrom<Schema['Functions'][FieldName$1], CurrentTableOrView> extends infer Fn ? Fn extends GenericFunction ? Fn : false : false;
567
+ type FindJoinTableRelationship<Schema extends GenericSchema, CurrentTableOrView extends keyof TablesAndViews$2<Schema> & string, FieldName$1 extends string> = ResolveJoinTableRelationship<Schema, CurrentTableOrView, FieldName$1> extends infer Result ? [Result] extends [never] ? false : Result : never;
568
+ /**
569
+ * Finds a matching relationship based on the FieldNode's name and optional hint.
570
+ */
571
+ type FindFieldMatchingRelationships<Schema extends GenericSchema, Relationships extends GenericRelationship[], Field$1 extends Ast.FieldNode> = Field$1 extends {
572
+ hint: string;
573
+ } ? FindMatchingHintTableRelationships<Schema, Relationships, Field$1['hint'], Field$1['name']> extends GenericRelationship ? FindMatchingHintTableRelationships<Schema, Relationships, Field$1['hint'], Field$1['name']> & {
574
+ branch: 'found-in-table-via-hint';
575
+ hint: Field$1['hint'];
576
+ } : FindMatchingHintViewRelationships<Schema, Relationships, Field$1['hint'], Field$1['name']> extends GenericRelationship ? FindMatchingHintViewRelationships<Schema, Relationships, Field$1['hint'], Field$1['name']> & {
577
+ branch: 'found-in-view-via-hint';
578
+ hint: Field$1['hint'];
579
+ } : SelectQueryError<'Failed to find matching relation via hint'> : FindMatchingTableRelationships<Schema, Relationships, Field$1['name']> extends GenericRelationship ? FindMatchingTableRelationships<Schema, Relationships, Field$1['name']> & {
580
+ branch: 'found-in-table-via-name';
581
+ name: Field$1['name'];
582
+ } : FindMatchingViewRelationships<Schema, Relationships, Field$1['name']> extends GenericRelationship ? FindMatchingViewRelationships<Schema, Relationships, Field$1['name']> & {
583
+ branch: 'found-in-view-via-name';
584
+ name: Field$1['name'];
585
+ } : SelectQueryError<'Failed to find matching relation via name'>;
586
+ type JsonPathToAccessor<Path extends string> = Path extends `${infer P1}->${infer P2}` ? P2 extends `>${infer Rest}` ? JsonPathToAccessor<`${P1}.${Rest}`> : P2 extends string ? JsonPathToAccessor<`${P1}.${P2}`> : Path : Path extends `>${infer Rest}` ? JsonPathToAccessor<Rest> : Path extends `${infer P1}::${infer _}` ? JsonPathToAccessor<P1> : Path extends `${infer P1}${')' | ','}${infer _}` ? P1 : Path;
587
+ type JsonPathToType<T, Path extends string> = Path extends '' ? T : ContainsNull<T> extends true ? JsonPathToType<Exclude<T, null>, Path> : Path extends `${infer Key}.${infer Rest}` ? Key extends keyof T ? JsonPathToType<T[Key], Rest> : never : Path extends keyof T ? T[Path] : never;
588
+ type IsStringUnion<T> = string extends T ? false : T extends string ? [T] extends [never] ? false : true : false;
589
+ type MatchingFunctionBySetofFrom<Fn$1 extends GenericFunction, TableName$1 extends string> = Fn$1['SetofOptions'] extends GenericSetofOption ? TableName$1 extends Fn$1['SetofOptions']['from'] ? Fn$1 : never : false;
590
+ type FindMatchingFunctionBySetofFrom<FnUnion, TableName$1 extends string> = FnUnion extends infer Fn extends GenericFunction ? MatchingFunctionBySetofFrom<Fn, TableName$1> : false;
591
+ type ComputedField<Schema extends GenericSchema, RelationName extends keyof TablesAndViews$2<Schema>, FieldName$1 extends keyof TablesAndViews$2<Schema>[RelationName]['Row']> = FieldName$1 extends keyof Schema['Functions'] ? [Schema['Functions'][FieldName$1]['Args']] extends [never] ? never : Schema['Functions'][FieldName$1] extends {
592
+ Args: {
593
+ '': TablesAndViews$2<Schema>[RelationName]['Row'];
594
+ };
595
+ Returns: any;
596
+ } ? FieldName$1 : never : never;
597
+ type GetComputedFields<Schema extends GenericSchema, RelationName extends keyof TablesAndViews$2<Schema>> = { [K in keyof TablesAndViews$2<Schema>[RelationName]['Row']]: ComputedField<Schema, RelationName, K> }[keyof TablesAndViews$2<Schema>[RelationName]['Row']];
598
+ //#endregion
599
+ //#region src/types/types.d.ts
600
+ /**
601
+ * Response format
602
+ *
603
+ * {@link https://github.com/supabase/supabase-js/issues/32}
604
+ */
605
+ interface PostgrestResponseBase {
606
+ status: number;
607
+ statusText: string;
608
+ }
609
+ interface PostgrestResponseSuccess<T> extends PostgrestResponseBase {
610
+ success: true;
611
+ error: null;
612
+ data: T;
613
+ count: number | null;
614
+ }
615
+ interface PostgrestResponseFailure extends PostgrestResponseBase {
616
+ success: false;
617
+ error: PostgrestError;
618
+ data: null;
619
+ count: null;
620
+ }
621
+ type PostgrestSingleResponse<T> = PostgrestResponseSuccess<T> | PostgrestResponseFailure;
622
+ type PostgrestMaybeSingleResponse<T> = PostgrestSingleResponse<T | null>;
623
+ type PostgrestResponse<T> = PostgrestSingleResponse<T[]>;
624
+ type Prettify<T> = { [K in keyof T]: T[K] } & {};
625
+ type RejectExcessProperties<Base, Row> = Row & { [K in Exclude<keyof Row, keyof Base>]: never };
626
+ type SimplifyDeep<Type, ExcludeType = never> = ConditionalSimplifyDeep<Type, ExcludeType | NonRecursiveType | Set<unknown> | Map<unknown, unknown>, object>;
627
+ type ConditionalSimplifyDeep<Type, ExcludeType = never, IncludeType = unknown> = Type extends ExcludeType ? Type : Type extends IncludeType ? { [TypeKey in keyof Type]: ConditionalSimplifyDeep<Type[TypeKey], ExcludeType, IncludeType> } : Type;
628
+ type NonRecursiveType = BuiltIns | Function | (new (...arguments_: any[]) => unknown);
629
+ type BuiltIns = Primitive | void | Date | RegExp;
630
+ type Primitive = null | undefined | string | number | boolean | symbol | bigint;
631
+ type IsValidResultOverride<Result$1, NewResult, ErrorResult, ErrorNewResult> = Result$1 extends any[] ? NewResult extends any[] ? true : ErrorResult : NewResult extends any[] ? ErrorNewResult : true;
632
+ /**
633
+ * Utility type to check if array types match between Result and NewResult.
634
+ * Returns either the valid NewResult type or an error message type.
635
+ */
636
+ type CheckMatchingArrayTypes<Result$1, NewResult> = Result$1 extends SelectQueryError<string> ? NewResult : IsValidResultOverride<Result$1, NewResult, {
637
+ Error: 'Type mismatch: Cannot cast array result to a single object. Use .overrideTypes<Array<YourType>> or .returns<Array<YourType>> (deprecated) for array results or .single() to convert the result to a single object';
638
+ }, {
639
+ Error: 'Type mismatch: Cannot cast single object to array type. Remove Array wrapper from return type or make sure you are not using .single() up in the calling chain';
640
+ }> extends infer ValidationResult ? ValidationResult extends true ? ContainsNull<Result$1> extends true ? NewResult | null : NewResult : ValidationResult : never;
641
+ type Simplify<T> = T extends object ? { [K in keyof T]: T[K] } : T;
642
+ type ExplicitKeys<T> = { [K in keyof T]: string extends K ? never : K }[keyof T];
643
+ type MergeExplicit<New, Row> = { [K in ExplicitKeys<New> | ExplicitKeys<Row>]: K extends keyof New ? K extends keyof Row ? Row[K] extends SelectQueryError<string> ? New[K] : New[K] extends any[] ? Row[K] extends any[] ? Array<Simplify<MergeDeep<NonNullable<New[K][number]>, NonNullable<Row[K][number]>>>> : New[K] : IsPlainObject<NonNullable<New[K]>> extends true ? IsPlainObject<NonNullable<Row[K]>> extends true ? ContainsNull<New[K]> extends true ?
644
+ // If the override wants to preserve optionality
645
+ Simplify<MergeDeep<NonNullable<New[K]>, NonNullable<Row[K]>>> | null : Simplify<MergeDeep<New[K], NonNullable<Row[K]>>> : New[K] : New[K] : New[K] : K extends keyof Row ? Row[K] : never };
646
+ type MergeDeep<New, Row> = Simplify<MergeExplicit<New, Row> & (string extends keyof Row ? {
647
+ [K: string]: Row[string];
648
+ } : {})>;
649
+ type IsPlainObject<T> = T extends any[] ? false : T extends object ? true : false;
650
+ type MergePartialResult<NewResult, Result$1, Options> = Options extends {
651
+ merge: true;
652
+ } ? Result$1 extends any[] ? NewResult extends any[] ? Array<Simplify<MergeDeep<NewResult[number], Result$1[number]>>> : never : Simplify<MergeDeep<NewResult, Result$1>> : NewResult;
653
+ //#endregion
654
+ //#region src/PostgrestBuilder.d.ts
655
+ declare abstract class PostgrestBuilder<ClientOptions extends ClientServerOptions, Result$1, ThrowOnError extends boolean = false> implements PromiseLike<ThrowOnError extends true ? PostgrestResponseSuccess<Result$1> : PostgrestSingleResponse<Result$1>> {
656
+ protected method: 'GET' | 'HEAD' | 'POST' | 'PATCH' | 'DELETE';
657
+ protected url: URL;
658
+ protected headers: Headers;
659
+ protected schema?: string;
660
+ protected body?: unknown;
661
+ protected shouldThrowOnError: boolean;
662
+ protected signal?: AbortSignal;
663
+ protected fetch: Fetch;
664
+ protected isMaybeSingle: boolean;
665
+ protected shouldStripNulls: boolean;
666
+ protected urlLengthLimit: number;
667
+ protected retryEnabled: boolean;
668
+ /**
669
+ * Creates a builder configured for a specific PostgREST request.
670
+ *
671
+ * @example Using supabase-js (recommended)
672
+ * ```ts
673
+ * import { createClient } from '@supabase/supabase-js'
674
+ *
675
+ * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')
676
+ * const { data, error } = await supabase.from('users').select('*')
677
+ * ```
678
+ *
679
+ * @category Database
680
+ *
681
+ * @example Standalone import for bundle-sensitive environments
682
+ * ```ts
683
+ * import { PostgrestQueryBuilder } from '@supabase/postgrest-js'
684
+ *
685
+ * const builder = new PostgrestQueryBuilder(
686
+ * new URL('https://xyzcompany.supabase.co/rest/v1/users'),
687
+ * { headers: new Headers({ apikey: 'your-publishable-key' }) }
688
+ * )
689
+ * ```
690
+ */
691
+ constructor(builder: {
692
+ method: 'GET' | 'HEAD' | 'POST' | 'PATCH' | 'DELETE';
693
+ url: URL;
694
+ headers: HeadersInit;
695
+ schema?: string;
696
+ body?: unknown;
697
+ shouldThrowOnError?: boolean;
698
+ signal?: AbortSignal;
699
+ fetch?: Fetch;
700
+ isMaybeSingle?: boolean;
701
+ shouldStripNulls?: boolean;
702
+ urlLengthLimit?: number;
703
+ retry?: boolean;
704
+ });
705
+ /**
706
+ * If there's an error with the query, throwOnError will reject the promise by
707
+ * throwing the error instead of returning it as part of a successful response.
708
+ *
709
+ * {@link https://github.com/supabase/supabase-js/issues/92}
710
+ *
711
+ * @category Database
712
+ */
713
+ throwOnError(): this & PostgrestBuilder<ClientOptions, Result$1, true>;
714
+ /**
715
+ * Strip null values from the response data. Properties with `null` values
716
+ * will be omitted from the returned JSON objects.
717
+ *
718
+ * Requires PostgREST 11.2.0+.
719
+ *
720
+ * {@link https://docs.postgrest.org/en/stable/references/api/resource_representation.html#stripped-nulls}
721
+ *
722
+ * @category Database
723
+ * @subcategory Using modifiers
724
+ *
725
+ * @example With `select()`
726
+ * ```ts
727
+ * const { data, error } = await supabase
728
+ * .from('characters')
729
+ * .select()
730
+ * .stripNulls()
731
+ * ```
732
+ *
733
+ * @exampleSql With `select()`
734
+ * ```sql
735
+ * create table
736
+ * characters (id int8 primary key, name text, bio text);
737
+ *
738
+ * insert into
739
+ * characters (id, name, bio)
740
+ * values
741
+ * (1, 'Luke', null),
742
+ * (2, 'Leia', 'Princess of Alderaan');
743
+ * ```
744
+ *
745
+ * @exampleResponse With `select()`
746
+ * ```json
747
+ * {
748
+ * "data": [
749
+ * {
750
+ * "id": 1,
751
+ * "name": "Luke"
752
+ * },
753
+ * {
754
+ * "id": 2,
755
+ * "name": "Leia",
756
+ * "bio": "Princess of Alderaan"
757
+ * }
758
+ * ],
759
+ * "status": 200,
760
+ * "statusText": "OK"
761
+ * }
762
+ * ```
763
+ */
764
+ stripNulls(): this;
765
+ /**
766
+ * Set an HTTP header for the request.
767
+ *
768
+ * @category Database
769
+ */
770
+ setHeader(name: string, value: string): this;
771
+ /**
772
+ * @category Database
773
+ *
774
+ * Configure retry behavior for this request.
775
+ *
776
+ * By default, retries are enabled for idempotent requests (GET, HEAD, OPTIONS)
777
+ * that fail with network errors or specific HTTP status codes (503, 520).
778
+ * Retries use exponential backoff (1s, 2s, 4s) with a maximum of 3 attempts.
779
+ *
780
+ * @param enabled - Whether to enable retries for this request
781
+ *
782
+ * @example
783
+ * ```ts
784
+ * // Disable retries for a specific query
785
+ * const { data, error } = await supabase
786
+ * .from('users')
787
+ * .select()
788
+ * .retry(false)
789
+ * ```
790
+ */
791
+ retry(enabled: boolean): this;
792
+ then<TResult1 = (ThrowOnError extends true ? PostgrestResponseSuccess<Result$1> : PostgrestSingleResponse<Result$1>), TResult2 = never>(onfulfilled?: ((value: ThrowOnError extends true ? PostgrestResponseSuccess<Result$1> : PostgrestSingleResponse<Result$1>) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): PromiseLike<TResult1 | TResult2>;
793
+ /**
794
+ * Process a fetch response and return the standardized postgrest response.
795
+ */
796
+ private processResponse;
797
+ /**
798
+ * Override the type of the returned `data`.
799
+ *
800
+ * @typeParam NewResult - The new result type to override with
801
+ * @deprecated Use overrideTypes<yourType, { merge: false }>() method at the end of your call chain instead
802
+ *
803
+ * @category Database
804
+ */
805
+ returns<NewResult>(): PostgrestBuilder<ClientOptions, CheckMatchingArrayTypes<Result$1, NewResult>, ThrowOnError>;
806
+ /**
807
+ * Override the type of the returned `data` field in the response.
808
+ *
809
+ * @typeParam NewResult - The new type to cast the response data to
810
+ * @typeParam Options - Optional type configuration (defaults to { merge: true })
811
+ * @typeParam Options.merge - When true, merges the new type with existing return type. When false, replaces the existing types entirely (defaults to true)
812
+ * @example
813
+ * ```typescript
814
+ * // Merge with existing types (default behavior)
815
+ * const query = supabase
816
+ * .from('users')
817
+ * .select()
818
+ * .overrideTypes<{ custom_field: string }>()
819
+ *
820
+ * // Replace existing types completely
821
+ * const replaceQuery = supabase
822
+ * .from('users')
823
+ * .select()
824
+ * .overrideTypes<{ id: number; name: string }, { merge: false }>()
825
+ * ```
826
+ * @returns A PostgrestBuilder instance with the new type
827
+ *
828
+ * @category Database
829
+ * @subcategory Using modifiers
830
+ *
831
+ * @example Complete Override type of successful response
832
+ * ```ts
833
+ * const { data } = await supabase
834
+ * .from('countries')
835
+ * .select()
836
+ * .overrideTypes<Array<MyType>, { merge: false }>()
837
+ * ```
838
+ *
839
+ * @exampleResponse Complete Override type of successful response
840
+ * ```ts
841
+ * let x: typeof data // MyType[]
842
+ * ```
843
+ *
844
+ * @example Complete Override type of object response
845
+ * ```ts
846
+ * const { data } = await supabase
847
+ * .from('countries')
848
+ * .select()
849
+ * .maybeSingle()
850
+ * .overrideTypes<MyType, { merge: false }>()
851
+ * ```
852
+ *
853
+ * @exampleResponse Complete Override type of object response
854
+ * ```ts
855
+ * let x: typeof data // MyType | null
856
+ * ```
857
+ *
858
+ * @example Partial Override type of successful response
859
+ * ```ts
860
+ * const { data } = await supabase
861
+ * .from('countries')
862
+ * .select()
863
+ * .overrideTypes<Array<{ status: "A" | "B" }>>()
864
+ * ```
865
+ *
866
+ * @exampleResponse Partial Override type of successful response
867
+ * ```ts
868
+ * let x: typeof data // Array<CountryRowProperties & { status: "A" | "B" }>
869
+ * ```
870
+ *
871
+ * @example Partial Override type of object response
872
+ * ```ts
873
+ * const { data } = await supabase
874
+ * .from('countries')
875
+ * .select()
876
+ * .maybeSingle()
877
+ * .overrideTypes<{ status: "A" | "B" }>()
878
+ * ```
879
+ *
880
+ * @exampleResponse Partial Override type of object response
881
+ * ```ts
882
+ * let x: typeof data // CountryRowProperties & { status: "A" | "B" } | null
883
+ * ```
884
+ *
885
+ * @example Merge vs replace existing types
886
+ * ```typescript
887
+ * // Merge with existing types (default behavior)
888
+ * const query = supabase
889
+ * .from('users')
890
+ * .select()
891
+ * .overrideTypes<{ custom_field: string }>()
892
+ *
893
+ * // Replace existing types completely
894
+ * const replaceQuery = supabase
895
+ * .from('users')
896
+ * .select()
897
+ * .overrideTypes<{ id: number; name: string }, { merge: false }>()
898
+ * ```
899
+ */
900
+ overrideTypes<NewResult, Options extends {
901
+ merge?: boolean;
902
+ } = {
903
+ merge: true;
904
+ }>(): PostgrestBuilder<ClientOptions, IsValidResultOverride<Result$1, NewResult, false, false> extends true ? ContainsNull<Result$1> extends true ? MergePartialResult<NewResult, NonNullable<Result$1>, Options> | null : MergePartialResult<NewResult, Result$1, Options> : CheckMatchingArrayTypes<Result$1, NewResult>, ThrowOnError>;
905
+ }
906
+ //#endregion
907
+ //#region src/types/feature-flags.d.ts
908
+ type IsPostgrest13<PostgrestVersion extends string | undefined> = PostgrestVersion extends `13${string}` ? true : false;
909
+ type IsPostgrest14<PostgrestVersion extends string | undefined> = PostgrestVersion extends `14${string}` ? true : false;
910
+ type IsPostgrestVersionGreaterThan12<PostgrestVersion extends string | undefined> = IsPostgrest13<PostgrestVersion> extends true ? true : IsPostgrest14<PostgrestVersion> extends true ? true : false;
911
+ type MaxAffectedEnabled<PostgrestVersion extends string | undefined> = IsPostgrestVersionGreaterThan12<PostgrestVersion> extends true ? true : false;
912
+ type SpreadOnManyEnabled<PostgrestVersion extends string | undefined> = IsPostgrestVersionGreaterThan12<PostgrestVersion> extends true ? true : false;
913
+ //#endregion
914
+ //#region src/select-query-parser/result.d.ts
915
+ /**
916
+ * Main entry point for constructing the result type of a PostgREST query.
917
+ *
918
+ * @param Schema - Database schema.
919
+ * @param Row - The type of a row in the current table.
920
+ * @param RelationName - The name of the current table or view.
921
+ * @param Relationships - Relationships of the current table.
922
+ * @param Query - The select query string literal to parse.
923
+ */
924
+ type GetResult<Schema extends GenericSchema, Row extends Record<string, unknown>, RelationName, Relationships, Query extends string, ClientOptions extends ClientServerOptions> = IsAny$1<Schema> extends true ? ParseQuery<Query> extends infer ParsedQuery ? ParsedQuery extends Ast.Node[] ? RelationName extends string ? ProcessNodesWithoutSchema<ParsedQuery> : any : ParsedQuery : any : Relationships extends null ? ParseQuery<Query> extends infer ParsedQuery ? ParsedQuery extends Ast.Node[] ? RPCCallNodes<ParsedQuery, RelationName extends string ? RelationName : 'rpc_call', Row> : ParsedQuery : Row : ParseQuery<Query> extends infer ParsedQuery ? ParsedQuery extends Ast.Node[] ? RelationName extends string ? Relationships extends GenericRelationship[] ? ProcessNodes<ClientOptions, Schema, Row, RelationName, Relationships, ParsedQuery> : SelectQueryError<'Invalid Relationships cannot infer result type'> : SelectQueryError<'Invalid RelationName cannot infer result type'> : ParsedQuery : never;
925
+ type ProcessSimpleFieldWithoutSchema<Field$1 extends Ast.FieldNode> = Field$1['aggregateFunction'] extends AggregateFunctions ? { [K in GetFieldNodeResultName<Field$1>]: Field$1['castType'] extends PostgreSQLTypes ? TypeScriptTypes<Field$1['castType']> : number } : { [K in GetFieldNodeResultName<Field$1>]: Field$1['castType'] extends PostgreSQLTypes ? TypeScriptTypes<Field$1['castType']> : any };
926
+ type ProcessFieldNodeWithoutSchema<Node$1 extends Ast.FieldNode> = IsNonEmptyArray<Node$1['children']> extends true ? { [K in GetFieldNodeResultName<Node$1>]: Node$1['children'] extends Ast.Node[] ? ProcessNodesWithoutSchema<Node$1['children']>[] : ProcessSimpleFieldWithoutSchema<Node$1> } : ProcessSimpleFieldWithoutSchema<Node$1>;
927
+ /**
928
+ * Processes a single Node without schema and returns the resulting TypeScript type.
929
+ */
930
+ type ProcessNodeWithoutSchema<Node$1 extends Ast.Node> = Node$1 extends Ast.StarNode ? any : Node$1 extends Ast.SpreadNode ? Node$1['target']['children'] extends Ast.StarNode[] ? any : Node$1['target']['children'] extends Ast.FieldNode[] ? { [P in Node$1['target']['children'][number] as GetFieldNodeResultName<P>]: P['castType'] extends PostgreSQLTypes ? TypeScriptTypes<P['castType']> : any } : any : Node$1 extends Ast.FieldNode ? ProcessFieldNodeWithoutSchema<Node$1> : any;
931
+ /**
932
+ * Processes nodes when Schema is any, providing basic type inference
933
+ */
934
+ type ProcessNodesWithoutSchema<Nodes$1 extends Ast.Node[], Acc extends Record<string, unknown> = {}> = Nodes$1 extends [infer FirstNode, ...infer RestNodes] ? FirstNode extends Ast.Node ? RestNodes extends Ast.Node[] ? ProcessNodeWithoutSchema<FirstNode> extends infer FieldResult ? FieldResult extends Record<string, unknown> ? ProcessNodesWithoutSchema<RestNodes, Acc & FieldResult> : FieldResult : any : any : any : Prettify<Acc>;
935
+ /**
936
+ * Processes a single Node from a select chained after a rpc call
937
+ *
938
+ * @param Row - The type of a row in the current table.
939
+ * @param RelationName - The name of the current rpc function
940
+ * @param NodeType - The Node to process.
941
+ */
942
+ type ProcessRPCNode<Row extends Record<string, unknown>, RelationName extends string, NodeType extends Ast.Node> = NodeType['type'] extends Ast.StarNode['type'] ? Row : NodeType['type'] extends Ast.FieldNode['type'] ? ProcessSimpleField<Row, RelationName, Extract<NodeType, Ast.FieldNode>> : SelectQueryError<'RPC Unsupported node type.'>;
943
+ /**
944
+ * Process select call that can be chained after an rpc call
945
+ */
946
+ type RPCCallNodes<Nodes$1 extends Ast.Node[], RelationName extends string, Row extends Record<string, unknown>, Acc extends Record<string, unknown> = {}> = Nodes$1 extends [infer FirstNode, ...infer RestNodes] ? FirstNode extends Ast.Node ? RestNodes extends Ast.Node[] ? ProcessRPCNode<Row, RelationName, FirstNode> extends infer FieldResult ? FieldResult extends Record<string, unknown> ? RPCCallNodes<RestNodes, RelationName, Row, Acc & FieldResult> : FieldResult extends SelectQueryError<infer E> ? SelectQueryError<E> : SelectQueryError<'Could not retrieve a valid record or error value'> : SelectQueryError<'Processing node failed.'> : SelectQueryError<'Invalid rest nodes array in RPC call'> : SelectQueryError<'Invalid first node in RPC call'> : Prettify<Acc>;
947
+ /**
948
+ * Recursively processes an array of Nodes and accumulates the resulting TypeScript type.
949
+ *
950
+ * @param Schema - Database schema.
951
+ * @param Row - The type of a row in the current table.
952
+ * @param RelationName - The name of the current table or view.
953
+ * @param Relationships - Relationships of the current table.
954
+ * @param Nodes - An array of AST nodes to process.
955
+ * @param Acc - Accumulator for the constructed type.
956
+ */
957
+ type ProcessNodes<ClientOptions extends ClientServerOptions, Schema extends GenericSchema, Row extends Record<string, unknown>, RelationName extends string, Relationships extends GenericRelationship[], Nodes$1 extends Ast.Node[], Acc extends Record<string, unknown> = {}> = CheckDuplicateEmbededReference<Schema, RelationName, Relationships, Nodes$1> extends false ? Nodes$1 extends [infer FirstNode, ...infer RestNodes] ? FirstNode extends Ast.Node ? RestNodes extends Ast.Node[] ? ProcessNode<ClientOptions, Schema, Row, RelationName, Relationships, FirstNode> extends infer FieldResult ? FieldResult extends Record<string, unknown> ? ProcessNodes<ClientOptions, Schema, Row, RelationName, Relationships, RestNodes, Acc & FieldResult> : FieldResult extends SelectQueryError<infer E> ? SelectQueryError<E> : SelectQueryError<'Could not retrieve a valid record or error value'> : SelectQueryError<'Processing node failed.'> : SelectQueryError<'Invalid rest nodes array type in ProcessNodes'> : SelectQueryError<'Invalid first node type in ProcessNodes'> : Prettify<Acc> : Prettify<CheckDuplicateEmbededReference<Schema, RelationName, Relationships, Nodes$1>>;
958
+ /**
959
+ * Processes a single Node and returns the resulting TypeScript type.
960
+ *
961
+ * @param Schema - Database schema.
962
+ * @param Row - The type of a row in the current table.
963
+ * @param RelationName - The name of the current table or view.
964
+ * @param Relationships - Relationships of the current table.
965
+ * @param NodeType - The Node to process.
966
+ */
967
+ type ProcessNode<ClientOptions extends ClientServerOptions, Schema extends GenericSchema, Row extends Record<string, unknown>, RelationName extends string, Relationships extends GenericRelationship[], NodeType extends Ast.Node> = NodeType['type'] extends Ast.StarNode['type'] ? GetComputedFields<Schema, RelationName> extends never ? Row : Omit<Row, GetComputedFields<Schema, RelationName>> : NodeType['type'] extends Ast.SpreadNode['type'] ? ProcessSpreadNode<ClientOptions, Schema, Row, RelationName, Relationships, Extract<NodeType, Ast.SpreadNode>> : NodeType['type'] extends Ast.FieldNode['type'] ? ProcessFieldNode<ClientOptions, Schema, Row, RelationName, Relationships, Extract<NodeType, Ast.FieldNode>> : SelectQueryError<'Unsupported node type.'>;
968
+ /**
969
+ * Processes a FieldNode and returns the resulting TypeScript type.
970
+ *
971
+ * @param Schema - Database schema.
972
+ * @param Row - The type of a row in the current table.
973
+ * @param RelationName - The name of the current table or view.
974
+ * @param Relationships - Relationships of the current table.
975
+ * @param Field - The FieldNode to process.
976
+ */
977
+ type ProcessFieldNode<ClientOptions extends ClientServerOptions, Schema extends GenericSchema, Row extends Record<string, unknown>, RelationName extends string, Relationships extends GenericRelationship[], Field$1 extends Ast.FieldNode> = Field$1['children'] extends [] ? ProcessEmbeddedResource<ClientOptions, Schema, Relationships, Field$1, RelationName> : IsNonEmptyArray<Field$1['children']> extends true ? ProcessEmbeddedResource<ClientOptions, Schema, Relationships, Field$1, RelationName> : ProcessSimpleField<Row, RelationName, Field$1>;
978
+ type ResolveJsonPathType<Value, Path extends string | undefined, CastType$1 extends PostgreSQLTypes> = Path extends string ? JsonPathToType<Value, Path> extends never ? TypeScriptTypes<CastType$1> : JsonPathToType<Value, Path> extends infer PathResult ? PathResult extends string ? PathResult : IsStringUnion<PathResult> extends true ? PathResult : CastType$1 extends 'json' ? PathResult : TypeScriptTypes<CastType$1> : TypeScriptTypes<CastType$1> : TypeScriptTypes<CastType$1>;
979
+ /**
980
+ * Processes a simple field (without embedded resources).
981
+ *
982
+ * @param Row - The type of a row in the current table.
983
+ * @param RelationName - The name of the current table or view.
984
+ * @param Field - The FieldNode to process.
985
+ */
986
+ type ProcessSimpleField<Row extends Record<string, unknown>, RelationName extends string, Field$1 extends Ast.FieldNode> = Field$1['name'] extends keyof Row | 'count' ? Field$1['aggregateFunction'] extends AggregateFunctions ? { [K in GetFieldNodeResultName<Field$1>]: Field$1['castType'] extends PostgreSQLTypes ? TypeScriptTypes<Field$1['castType']> : number } : { [K in GetFieldNodeResultName<Field$1>]: Field$1['castType'] extends PostgreSQLTypes ? ResolveJsonPathType<Row[Field$1['name']], Field$1['jsonPath'], Field$1['castType']> : Row[Field$1['name']] } : SelectQueryError<`column '${Field$1['name']}' does not exist on '${RelationName}'.`>;
987
+ /**
988
+ * Processes an embedded resource (relation).
989
+ *
990
+ * @param Schema - Database schema.
991
+ * @param Row - The type of a row in the current table.
992
+ * @param RelationName - The name of the current table or view.
993
+ * @param Relationships - Relationships of the current table.
994
+ * @param Field - The FieldNode to process.
995
+ */
996
+ type ProcessEmbeddedResource<ClientOptions extends ClientServerOptions, Schema extends GenericSchema, Relationships extends GenericRelationship[], Field$1 extends Ast.FieldNode, CurrentTableOrView extends keyof TablesAndViews$2<Schema> & string> = ResolveRelationship<Schema, Relationships, Field$1, CurrentTableOrView> extends infer Resolved ? Resolved extends {
997
+ scalarType: infer ScalarType;
998
+ relation: {
999
+ isSetofReturn?: boolean;
1000
+ isNotNullable?: boolean;
1001
+ };
1002
+ } ? { [K in GetFieldNodeResultName<Field$1>]: Resolved['relation']['isSetofReturn'] extends true ? ScalarType : Resolved['relation']['isNotNullable'] extends true ? ScalarType : ScalarType | null } : Resolved extends {
1003
+ referencedTable: Pick<GenericTable, 'Row' | 'Relationships'>;
1004
+ relation: GenericRelationship & {
1005
+ match: 'refrel' | 'col' | 'fkname' | 'func';
1006
+ };
1007
+ direction: string;
1008
+ } ? Field$1['children'] extends [] ? {} : ProcessEmbeddedResourceResult<ClientOptions, Schema, Resolved, Field$1, CurrentTableOrView> : { [K in GetFieldNodeResultName<Field$1>]: Resolved } : { [K in GetFieldNodeResultName<Field$1>]: SelectQueryError<'Failed to resolve relationship.'> & string };
1009
+ /**
1010
+ * Helper type to process the result of an embedded resource.
1011
+ */
1012
+ type ProcessEmbeddedResourceResult<ClientOptions extends ClientServerOptions, Schema extends GenericSchema, Resolved$1 extends {
1013
+ referencedTable: Pick<GenericTable, 'Row' | 'Relationships'>;
1014
+ relation: GenericRelationship & {
1015
+ match: 'refrel' | 'col' | 'fkname' | 'func';
1016
+ isNotNullable?: boolean;
1017
+ referencedRelation: string;
1018
+ isSetofReturn?: boolean;
1019
+ };
1020
+ direction: string;
1021
+ }, Field$1 extends Ast.FieldNode, CurrentTableOrView extends keyof TablesAndViews$2<Schema>> = ProcessNodes<ClientOptions, Schema, Resolved$1['referencedTable']['Row'], Resolved$1['relation']['match'] extends 'func' ? Resolved$1['relation']['referencedRelation'] : Field$1['name'], Resolved$1['referencedTable']['Relationships'], Field$1['children'] extends undefined ? [] : Exclude<Field$1['children'], undefined> extends Ast.Node[] ? Exclude<Field$1['children'], undefined> : []> extends infer ProcessedChildren ? { [K in GetFieldNodeResultName<Field$1>]: Resolved$1['direction'] extends 'forward' ? Field$1 extends {
1022
+ innerJoin: true;
1023
+ } ? Resolved$1['relation']['isOneToOne'] extends true ? ProcessedChildren : ProcessedChildren[] : Resolved$1['relation']['isOneToOne'] extends true ? Resolved$1['relation']['match'] extends 'func' ? Resolved$1['relation']['isNotNullable'] extends true ? Resolved$1['relation']['isSetofReturn'] extends true ? ProcessedChildren : { [P in keyof ProcessedChildren]: ProcessedChildren[P] | null } : ProcessedChildren | null : ProcessedChildren | null : ProcessedChildren[] : Resolved$1['relation']['referencedRelation'] extends CurrentTableOrView ? Resolved$1['relation']['match'] extends 'col' ? IsRelationNullable<TablesAndViews$2<Schema>[CurrentTableOrView], Resolved$1['relation']> extends true ? ProcessedChildren | null : ProcessedChildren : ProcessedChildren[] : IsRelationNullable<TablesAndViews$2<Schema>[CurrentTableOrView], Resolved$1['relation']> extends true ? Field$1 extends {
1024
+ innerJoin: true;
1025
+ } ? ProcessedChildren : ProcessedChildren | null : ProcessedChildren } : { [K in GetFieldNodeResultName<Field$1>]: SelectQueryError<'Failed to process embedded resource nodes.'> & string };
1026
+ /**
1027
+ * Processes a SpreadNode by processing its target node.
1028
+ *
1029
+ * @param Schema - Database schema.
1030
+ * @param Row - The type of a row in the current table.
1031
+ * @param RelationName - The name of the current table or view.
1032
+ * @param Relationships - Relationships of the current table.
1033
+ * @param Spread - The SpreadNode to process.
1034
+ */
1035
+ type ProcessSpreadNode<ClientOptions extends ClientServerOptions, Schema extends GenericSchema, Row extends Record<string, unknown>, RelationName extends string, Relationships extends GenericRelationship[], Spread extends Ast.SpreadNode> = ProcessNode<ClientOptions, Schema, Row, RelationName, Relationships, Spread['target']> extends infer Result ? Result extends SelectQueryError<infer E> ? SelectQueryError<E> : ExtractFirstProperty<Result> extends unknown[] ? SpreadOnManyEnabled<ClientOptions['PostgrestVersion']> extends true ? ProcessManyToManySpreadNodeResult<Result> : { [K in Spread['target']['name']]: SelectQueryError<`"${RelationName}" and "${Spread['target']['name']}" do not form a many-to-one or one-to-one relationship spread not possible`> } : ProcessSpreadNodeResult<Result> : never;
1036
+ /**
1037
+ * Helper type to process the result of a many-to-many spread node.
1038
+ * Converts all fields in the spread object into arrays.
1039
+ */
1040
+ type ProcessManyToManySpreadNodeResult<Result$1> = Result$1 extends Record<string, SelectQueryError<string> | null> ? Result$1 : ExtractFirstProperty<Result$1> extends infer SpreadedObject ? SpreadedObject extends Array<Record<string, unknown>> ? { [K in keyof SpreadedObject[number]]: Array<SpreadedObject[number][K]> } : SelectQueryError<'An error occurred spreading the many-to-many object'> : SelectQueryError<'An error occurred spreading the many-to-many object'>;
1041
+ /**
1042
+ * Helper type to process the result of a spread node.
1043
+ */
1044
+ type ProcessSpreadNodeResult<Result$1> = Result$1 extends Record<string, SelectQueryError<string> | null> ? Result$1 : ExtractFirstProperty<Result$1> extends infer SpreadedObject ? ContainsNull<SpreadedObject> extends true ? Exclude<{ [K in keyof SpreadedObject]: SpreadedObject[K] | null }, null> : Exclude<{ [K in keyof SpreadedObject]: SpreadedObject[K] }, null> : SelectQueryError<'An error occurred spreading the object'>;
1045
+ //#endregion
1046
+ //#region src/PostgrestTransformBuilder.d.ts
1047
+ declare class PostgrestTransformBuilder<ClientOptions extends ClientServerOptions, Schema extends GenericSchema, Row extends Record<string, unknown>, Result$1, RelationName = unknown, Relationships = unknown, Method = unknown> extends PostgrestBuilder<ClientOptions, Result$1> {
1048
+ /**
1049
+ * Perform a SELECT on the query result.
1050
+ *
1051
+ * By default, `.insert()`, `.update()`, `.upsert()`, and `.delete()` do not
1052
+ * return modified rows. By calling this method, modified rows are returned in
1053
+ * `data`.
1054
+ *
1055
+ * @param columns - The columns to retrieve, separated by commas
1056
+ *
1057
+ * @category Database
1058
+ * @subcategory Using modifiers
1059
+ *
1060
+ * @example With `upsert()`
1061
+ * ```ts
1062
+ * const { data, error } = await supabase
1063
+ * .from('characters')
1064
+ * .upsert({ id: 1, name: 'Han Solo' })
1065
+ * .select()
1066
+ * ```
1067
+ *
1068
+ * @exampleSql With `upsert()`
1069
+ * ```sql
1070
+ * create table
1071
+ * characters (id int8 primary key, name text);
1072
+ *
1073
+ * insert into
1074
+ * characters (id, name)
1075
+ * values
1076
+ * (1, 'Han');
1077
+ * ```
1078
+ *
1079
+ * @exampleResponse With `upsert()`
1080
+ * ```json
1081
+ * {
1082
+ * "data": [
1083
+ * {
1084
+ * "id": 1,
1085
+ * "name": "Han Solo"
1086
+ * }
1087
+ * ],
1088
+ * "status": 201,
1089
+ * "statusText": "Created"
1090
+ * }
1091
+ * ```
1092
+ */
1093
+ select<Query extends string = '*', NewResultOne = GetResult<Schema, Row, RelationName, Relationships, Query, ClientOptions>>(columns?: Query): PostgrestFilterBuilder<ClientOptions, Schema, Row, Method extends 'RPC' ? Result$1 extends unknown[] ? NewResultOne[] : NewResultOne : NewResultOne[], RelationName, Relationships, Method>;
1094
+ order<ColumnName extends string & keyof Row>(column: ColumnName, options?: {
1095
+ ascending?: boolean;
1096
+ nullsFirst?: boolean;
1097
+ referencedTable?: undefined;
1098
+ }): this;
1099
+ order(column: string, options?: {
1100
+ ascending?: boolean;
1101
+ nullsFirst?: boolean;
1102
+ referencedTable?: string;
1103
+ }): this;
1104
+ /**
1105
+ * @deprecated Use `options.referencedTable` instead of `options.foreignTable`
1106
+ */
1107
+ order<ColumnName extends string & keyof Row>(column: ColumnName, options?: {
1108
+ ascending?: boolean;
1109
+ nullsFirst?: boolean;
1110
+ foreignTable?: undefined;
1111
+ }): this;
1112
+ /**
1113
+ * @deprecated Use `options.referencedTable` instead of `options.foreignTable`
1114
+ */
1115
+ order(column: string, options?: {
1116
+ ascending?: boolean;
1117
+ nullsFirst?: boolean;
1118
+ foreignTable?: string;
1119
+ }): this;
1120
+ /**
1121
+ * Limit the query result by `count`.
1122
+ *
1123
+ * @param count - The maximum number of rows to return
1124
+ * @param options - Named parameters
1125
+ * @param options.referencedTable - Set this to limit rows of referenced
1126
+ * tables instead of the parent table
1127
+ * @param options.foreignTable - Deprecated, use `options.referencedTable`
1128
+ * instead
1129
+ *
1130
+ * @category Database
1131
+ * @subcategory Using modifiers
1132
+ *
1133
+ * @example With `select()`
1134
+ * ```ts
1135
+ * const { data, error } = await supabase
1136
+ * .from('characters')
1137
+ * .select('name')
1138
+ * .limit(1)
1139
+ * ```
1140
+ *
1141
+ * @exampleSql With `select()`
1142
+ * ```sql
1143
+ * create table
1144
+ * characters (id int8 primary key, name text);
1145
+ *
1146
+ * insert into
1147
+ * characters (id, name)
1148
+ * values
1149
+ * (1, 'Luke'),
1150
+ * (2, 'Leia'),
1151
+ * (3, 'Han');
1152
+ * ```
1153
+ *
1154
+ * @exampleResponse With `select()`
1155
+ * ```json
1156
+ * {
1157
+ * "data": [
1158
+ * {
1159
+ * "name": "Luke"
1160
+ * }
1161
+ * ],
1162
+ * "status": 200,
1163
+ * "statusText": "OK"
1164
+ * }
1165
+ * ```
1166
+ *
1167
+ * @example On a referenced table
1168
+ * ```ts
1169
+ * const { data, error } = await supabase
1170
+ * .from('orchestral_sections')
1171
+ * .select(`
1172
+ * name,
1173
+ * instruments (
1174
+ * name
1175
+ * )
1176
+ * `)
1177
+ * .limit(1, { referencedTable: 'instruments' })
1178
+ * ```
1179
+ *
1180
+ * @exampleSql On a referenced table
1181
+ * ```sql
1182
+ * create table
1183
+ * orchestral_sections (id int8 primary key, name text);
1184
+ * create table
1185
+ * instruments (
1186
+ * id int8 primary key,
1187
+ * section_id int8 not null references orchestral_sections,
1188
+ * name text
1189
+ * );
1190
+ *
1191
+ * insert into
1192
+ * orchestral_sections (id, name)
1193
+ * values
1194
+ * (1, 'strings');
1195
+ * insert into
1196
+ * instruments (id, section_id, name)
1197
+ * values
1198
+ * (1, 1, 'harp'),
1199
+ * (2, 1, 'violin');
1200
+ * ```
1201
+ *
1202
+ * @exampleResponse On a referenced table
1203
+ * ```json
1204
+ * {
1205
+ * "data": [
1206
+ * {
1207
+ * "name": "strings",
1208
+ * "instruments": [
1209
+ * {
1210
+ * "name": "violin"
1211
+ * }
1212
+ * ]
1213
+ * }
1214
+ * ],
1215
+ * "status": 200,
1216
+ * "statusText": "OK"
1217
+ * }
1218
+ * ```
1219
+ */
1220
+ limit(count: number, {
1221
+ foreignTable,
1222
+ referencedTable
1223
+ }?: {
1224
+ foreignTable?: string;
1225
+ referencedTable?: string;
1226
+ }): this;
1227
+ /**
1228
+ * Limit the query result by starting at an offset `from` and ending at the offset `to`.
1229
+ * Only records within this range are returned.
1230
+ * This respects the query order and if there is no order clause the range could behave unexpectedly.
1231
+ * The `from` and `to` values are 0-based and inclusive: `range(1, 3)` will include the second, third
1232
+ * and fourth rows of the query.
1233
+ *
1234
+ * @param from - The starting index from which to limit the result
1235
+ * @param to - The last index to which to limit the result
1236
+ * @param options - Named parameters
1237
+ * @param options.referencedTable - Set this to limit rows of referenced
1238
+ * tables instead of the parent table
1239
+ * @param options.foreignTable - Deprecated, use `options.referencedTable`
1240
+ * instead
1241
+ *
1242
+ * @category Database
1243
+ * @subcategory Using modifiers
1244
+ *
1245
+ * @example With `select()`
1246
+ * ```ts
1247
+ * const { data, error } = await supabase
1248
+ * .from('characters')
1249
+ * .select('name')
1250
+ * .range(0, 1)
1251
+ * ```
1252
+ *
1253
+ * @exampleSql With `select()`
1254
+ * ```sql
1255
+ * create table
1256
+ * characters (id int8 primary key, name text);
1257
+ *
1258
+ * insert into
1259
+ * characters (id, name)
1260
+ * values
1261
+ * (1, 'Luke'),
1262
+ * (2, 'Leia'),
1263
+ * (3, 'Han');
1264
+ * ```
1265
+ *
1266
+ * @exampleResponse With `select()`
1267
+ * ```json
1268
+ * {
1269
+ * "data": [
1270
+ * {
1271
+ * "name": "Luke"
1272
+ * },
1273
+ * {
1274
+ * "name": "Leia"
1275
+ * }
1276
+ * ],
1277
+ * "status": 200,
1278
+ * "statusText": "OK"
1279
+ * }
1280
+ * ```
1281
+ */
1282
+ range(from: number, to: number, {
1283
+ foreignTable,
1284
+ referencedTable
1285
+ }?: {
1286
+ foreignTable?: string;
1287
+ referencedTable?: string;
1288
+ }): this;
1289
+ /**
1290
+ * Set the AbortSignal for the fetch request.
1291
+ *
1292
+ * @param signal - The AbortSignal to use for the fetch request
1293
+ *
1294
+ * @category Database
1295
+ * @subcategory Using modifiers
1296
+ *
1297
+ * @remarks
1298
+ * You can use this to set a timeout for the request.
1299
+ *
1300
+ * @exampleDescription Aborting requests in-flight
1301
+ * You can use an [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController) to abort requests.
1302
+ * Note that `status` and `statusText` don't mean anything for aborted requests as the request wasn't fulfilled.
1303
+ *
1304
+ * @example Aborting requests in-flight
1305
+ * ```ts
1306
+ * const ac = new AbortController()
1307
+ *
1308
+ * const { data, error } = await supabase
1309
+ * .from('very_big_table')
1310
+ * .select()
1311
+ * .abortSignal(ac.signal)
1312
+ *
1313
+ * // Abort the request after 100 ms
1314
+ * setTimeout(() => ac.abort(), 100)
1315
+ * ```
1316
+ *
1317
+ * @exampleResponse Aborting requests in-flight
1318
+ * ```json
1319
+ * {
1320
+ * "error": {
1321
+ * "message": "AbortError: The user aborted a request.",
1322
+ * "details": "",
1323
+ * "hint": "The request was aborted locally via the provided AbortSignal.",
1324
+ * "code": ""
1325
+ * },
1326
+ * "status": 0,
1327
+ * "statusText": ""
1328
+ * }
1329
+ *
1330
+ * ```
1331
+ *
1332
+ * @example Set a timeout
1333
+ * ```ts
1334
+ * const { data, error } = await supabase
1335
+ * .from('very_big_table')
1336
+ * .select()
1337
+ * .abortSignal(AbortSignal.timeout(1000 /* ms *\/))
1338
+ * ```
1339
+ *
1340
+ * @exampleResponse Set a timeout
1341
+ * ```json
1342
+ * {
1343
+ * "error": {
1344
+ * "message": "FetchError: The user aborted a request.",
1345
+ * "details": "",
1346
+ * "hint": "",
1347
+ * "code": ""
1348
+ * },
1349
+ * "status": 400,
1350
+ * "statusText": "Bad Request"
1351
+ * }
1352
+ *
1353
+ * ```
1354
+ */
1355
+ abortSignal(signal: AbortSignal): this;
1356
+ /**
1357
+ * Return `data` as a single object instead of an array of objects.
1358
+ *
1359
+ * Query result must be one row (e.g. using `.limit(1)`), otherwise this
1360
+ * returns an error.
1361
+ *
1362
+ * @category Database
1363
+ * @subcategory Using modifiers
1364
+ *
1365
+ * @example With `select()`
1366
+ * ```ts
1367
+ * const { data, error } = await supabase
1368
+ * .from('characters')
1369
+ * .select('name')
1370
+ * .limit(1)
1371
+ * .single()
1372
+ * ```
1373
+ *
1374
+ * @exampleSql With `select()`
1375
+ * ```sql
1376
+ * create table
1377
+ * characters (id int8 primary key, name text);
1378
+ *
1379
+ * insert into
1380
+ * characters (id, name)
1381
+ * values
1382
+ * (1, 'Luke'),
1383
+ * (2, 'Leia'),
1384
+ * (3, 'Han');
1385
+ * ```
1386
+ *
1387
+ * @exampleResponse With `select()`
1388
+ * ```json
1389
+ * {
1390
+ * "data": {
1391
+ * "name": "Luke"
1392
+ * },
1393
+ * "status": 200,
1394
+ * "statusText": "OK"
1395
+ * }
1396
+ * ```
1397
+ */
1398
+ single<ResultOne = (Result$1 extends (infer ResultOne)[] ? ResultOne : never)>(): PostgrestBuilder<ClientOptions, ResultOne>;
1399
+ /**
1400
+ * Return `data` as a single object instead of an array of objects.
1401
+ *
1402
+ * Query result must be zero or one row (e.g. using `.limit(1)`), otherwise
1403
+ * this returns an error.
1404
+ *
1405
+ * @category Database
1406
+ * @subcategory Using modifiers
1407
+ *
1408
+ * @example With `select()`
1409
+ * ```ts
1410
+ * const { data, error } = await supabase
1411
+ * .from('characters')
1412
+ * .select()
1413
+ * .eq('name', 'Katniss')
1414
+ * .maybeSingle()
1415
+ * ```
1416
+ *
1417
+ * @exampleSql With `select()`
1418
+ * ```sql
1419
+ * create table
1420
+ * characters (id int8 primary key, name text);
1421
+ *
1422
+ * insert into
1423
+ * characters (id, name)
1424
+ * values
1425
+ * (1, 'Luke'),
1426
+ * (2, 'Leia'),
1427
+ * (3, 'Han');
1428
+ * ```
1429
+ *
1430
+ * @exampleResponse With `select()`
1431
+ * ```json
1432
+ * {
1433
+ * "status": 200,
1434
+ * "statusText": "OK"
1435
+ * }
1436
+ * ```
1437
+ */
1438
+ maybeSingle<ResultOne = (Result$1 extends (infer ResultOne)[] ? ResultOne : never)>(): PostgrestBuilder<ClientOptions, ResultOne | null>;
1439
+ /**
1440
+ * Return `data` as a string in CSV format.
1441
+ *
1442
+ * @category Database
1443
+ * @subcategory Using modifiers
1444
+ *
1445
+ * @exampleDescription Return data as CSV
1446
+ * By default, the data is returned in JSON format, but can also be returned as Comma Separated Values.
1447
+ *
1448
+ * @example Return data as CSV
1449
+ * ```ts
1450
+ * const { data, error } = await supabase
1451
+ * .from('characters')
1452
+ * .select()
1453
+ * .csv()
1454
+ * ```
1455
+ *
1456
+ * @exampleSql Return data as CSV
1457
+ * ```sql
1458
+ * create table
1459
+ * characters (id int8 primary key, name text);
1460
+ *
1461
+ * insert into
1462
+ * characters (id, name)
1463
+ * values
1464
+ * (1, 'Luke'),
1465
+ * (2, 'Leia'),
1466
+ * (3, 'Han');
1467
+ * ```
1468
+ *
1469
+ * @exampleResponse Return data as CSV
1470
+ * ```json
1471
+ * {
1472
+ * "data": "id,name\n1,Luke\n2,Leia\n3,Han",
1473
+ * "status": 200,
1474
+ * "statusText": "OK"
1475
+ * }
1476
+ * ```
1477
+ */
1478
+ csv(): PostgrestBuilder<ClientOptions, string>;
1479
+ /**
1480
+ * Return `data` as an object in [GeoJSON](https://geojson.org) format.
1481
+ *
1482
+ * @category Database
1483
+ */
1484
+ geojson(): PostgrestBuilder<ClientOptions, Record<string, unknown>>;
1485
+ /**
1486
+ * Return `data` as the EXPLAIN plan for the query.
1487
+ *
1488
+ * You need to enable the
1489
+ * [db_plan_enabled](https://supabase.com/docs/guides/database/debugging-performance#enabling-explain)
1490
+ * setting before using this method.
1491
+ *
1492
+ * @param options - Named parameters
1493
+ *
1494
+ * @param options.analyze - If `true`, the query will be executed and the
1495
+ * actual run time will be returned
1496
+ *
1497
+ * @param options.verbose - If `true`, the query identifier will be returned
1498
+ * and `data` will include the output columns of the query
1499
+ *
1500
+ * @param options.settings - If `true`, include information on configuration
1501
+ * parameters that affect query planning
1502
+ *
1503
+ * @param options.buffers - If `true`, include information on buffer usage
1504
+ *
1505
+ * @param options.wal - If `true`, include information on WAL record generation
1506
+ *
1507
+ * @param options.format - The format of the output, can be `"text"` (default)
1508
+ * or `"json"`
1509
+ *
1510
+ * @category Database
1511
+ * @subcategory Using modifiers
1512
+ *
1513
+ * @exampleDescription Get the execution plan
1514
+ * By default, the data is returned in TEXT format, but can also be returned as JSON by using the `format` parameter.
1515
+ *
1516
+ * @example Get the execution plan
1517
+ * ```ts
1518
+ * const { data, error } = await supabase
1519
+ * .from('characters')
1520
+ * .select()
1521
+ * .explain()
1522
+ * ```
1523
+ *
1524
+ * @exampleSql Get the execution plan
1525
+ * ```sql
1526
+ * create table
1527
+ * characters (id int8 primary key, name text);
1528
+ *
1529
+ * insert into
1530
+ * characters (id, name)
1531
+ * values
1532
+ * (1, 'Luke'),
1533
+ * (2, 'Leia'),
1534
+ * (3, 'Han');
1535
+ * ```
1536
+ *
1537
+ * @exampleResponse Get the execution plan
1538
+ * ```js
1539
+ * Aggregate (cost=33.34..33.36 rows=1 width=112)
1540
+ * -> Limit (cost=0.00..18.33 rows=1000 width=40)
1541
+ * -> Seq Scan on characters (cost=0.00..22.00 rows=1200 width=40)
1542
+ * ```
1543
+ *
1544
+ * @exampleDescription Get the execution plan with analyze and verbose
1545
+ * By default, the data is returned in TEXT format, but can also be returned as JSON by using the `format` parameter.
1546
+ *
1547
+ * @example Get the execution plan with analyze and verbose
1548
+ * ```ts
1549
+ * const { data, error } = await supabase
1550
+ * .from('characters')
1551
+ * .select()
1552
+ * .explain({analyze:true,verbose:true})
1553
+ * ```
1554
+ *
1555
+ * @exampleSql Get the execution plan with analyze and verbose
1556
+ * ```sql
1557
+ * create table
1558
+ * characters (id int8 primary key, name text);
1559
+ *
1560
+ * insert into
1561
+ * characters (id, name)
1562
+ * values
1563
+ * (1, 'Luke'),
1564
+ * (2, 'Leia'),
1565
+ * (3, 'Han');
1566
+ * ```
1567
+ *
1568
+ * @exampleResponse Get the execution plan with analyze and verbose
1569
+ * ```js
1570
+ * Aggregate (cost=33.34..33.36 rows=1 width=112) (actual time=0.041..0.041 rows=1 loops=1)
1571
+ * 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)
1572
+ * -> Limit (cost=0.00..18.33 rows=1000 width=40) (actual time=0.005..0.006 rows=3 loops=1)
1573
+ * Output: characters.id, characters.name
1574
+ * -> Seq Scan on public.characters (cost=0.00..22.00 rows=1200 width=40) (actual time=0.004..0.005 rows=3 loops=1)
1575
+ * Output: characters.id, characters.name
1576
+ * Query Identifier: -4730654291623321173
1577
+ * Planning Time: 0.407 ms
1578
+ * Execution Time: 0.119 ms
1579
+ * ```
1580
+ */
1581
+ explain({
1582
+ analyze,
1583
+ verbose,
1584
+ settings,
1585
+ buffers,
1586
+ wal,
1587
+ format
1588
+ }?: {
1589
+ analyze?: boolean;
1590
+ verbose?: boolean;
1591
+ settings?: boolean;
1592
+ buffers?: boolean;
1593
+ wal?: boolean;
1594
+ format?: 'json' | 'text';
1595
+ }): PostgrestBuilder<ClientOptions, Record<string, unknown>[], false> | PostgrestBuilder<ClientOptions, string, false>;
1596
+ /**
1597
+ * Rollback the query.
1598
+ *
1599
+ * `data` will still be returned, but the query is not committed.
1600
+ *
1601
+ * @category Database
1602
+ */
1603
+ rollback(): this;
1604
+ /**
1605
+ * Override the type of the returned `data`.
1606
+ *
1607
+ * @typeParam NewResult - The new result type to override with
1608
+ * @deprecated Use overrideTypes<yourType, { merge: false }>() method at the end of your call chain instead
1609
+ *
1610
+ * @category Database
1611
+ * @subcategory Using modifiers
1612
+ *
1613
+ * @remarks
1614
+ * - Deprecated: use overrideTypes method instead
1615
+ *
1616
+ * @example Override type of successful response
1617
+ * ```ts
1618
+ * const { data } = await supabase
1619
+ * .from('countries')
1620
+ * .select()
1621
+ * .returns<Array<MyType>>()
1622
+ * ```
1623
+ *
1624
+ * @exampleResponse Override type of successful response
1625
+ * ```js
1626
+ * let x: typeof data // MyType[]
1627
+ * ```
1628
+ *
1629
+ * @example Override type of object response
1630
+ * ```ts
1631
+ * const { data } = await supabase
1632
+ * .from('countries')
1633
+ * .select()
1634
+ * .maybeSingle()
1635
+ * .returns<MyType>()
1636
+ * ```
1637
+ *
1638
+ * @exampleResponse Override type of object response
1639
+ * ```js
1640
+ * let x: typeof data // MyType | null
1641
+ * ```
1642
+ */
1643
+ returns<NewResult>(): PostgrestTransformBuilder<ClientOptions, Schema, Row, CheckMatchingArrayTypes<Result$1, NewResult>, RelationName, Relationships, Method>;
1644
+ /**
1645
+ * Set the maximum number of rows that can be affected by the query.
1646
+ * Only available in PostgREST v13+ and only works with PATCH and DELETE methods.
1647
+ *
1648
+ * @param value - The maximum number of rows that can be affected
1649
+ *
1650
+ * @category Database
1651
+ */
1652
+ maxAffected(value: number): MaxAffectedEnabled<ClientOptions['PostgrestVersion']> extends true ? Method extends 'PATCH' | 'DELETE' | 'RPC' ? this : InvalidMethodError<'maxAffected method only available on update or delete'> : InvalidMethodError<'maxAffected method only available on postgrest 13+'>;
1653
+ }
1654
+ //#endregion
1655
+ //#region src/PostgrestFilterBuilder.d.ts
1656
+ type FilterOperator = 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte' | 'like' | 'ilike' | 'is' | 'isdistinct' | 'in' | 'cs' | 'cd' | 'sl' | 'sr' | 'nxl' | 'nxr' | 'adj' | 'ov' | 'fts' | 'plfts' | 'phfts' | 'wfts' | 'match' | 'imatch';
1657
+ type IsStringOperator<Path extends string> = Path extends `${string}->>${string}` ? true : false;
1658
+ type ResolveFilterValue<Schema extends GenericSchema, Row extends Record<string, unknown>, ColumnName extends string> = ColumnName extends `${infer RelationshipTable}.${infer Remainder}` ? Remainder extends `${infer _}.${infer _}` ? ResolveFilterValue<Schema, Row, Remainder> : ResolveFilterRelationshipValue<Schema, RelationshipTable, Remainder> : ColumnName extends keyof Row ? Row[ColumnName] : IsStringOperator<ColumnName> extends true ? string : JsonPathToType<Row, JsonPathToAccessor<ColumnName>> extends infer JsonPathValue ? JsonPathValue extends never ? never : JsonPathValue : never;
1659
+ type ResolveFilterRelationshipValue<Schema extends GenericSchema, RelationshipTable$1 extends string, RelationshipColumn extends string> = Schema['Tables'] & Schema['Views'] extends infer TablesAndViews ? RelationshipTable$1 extends keyof TablesAndViews ? 'Row' extends keyof TablesAndViews[RelationshipTable$1] ? RelationshipColumn extends keyof TablesAndViews[RelationshipTable$1]['Row'] ? TablesAndViews[RelationshipTable$1]['Row'][RelationshipColumn] : unknown : unknown : unknown : never;
1660
+ type InvalidMethodError<S extends string> = {
1661
+ Error: S;
1662
+ };
1663
+ type NonNullableColumn<T extends Record<string, unknown>, Col extends string> = Col extends keyof T ? { [K in keyof T]: K extends Col ? NonNullable<T[K]> : T[K] } : T;
1664
+ type NarrowResultColumn<T, Col extends string> = T extends (infer Item)[] ? Item extends Record<string, unknown> ? Col extends keyof Item ? { [K in keyof Item]: K extends Col ? NonNullable<Item[K]> : Item[K] }[] : T : T : T extends Record<string, unknown> ? Col extends keyof T ? { [K in keyof T]: K extends Col ? NonNullable<T[K]> : T[K] } : T : T;
1665
+ declare class PostgrestFilterBuilder<ClientOptions extends ClientServerOptions, Schema extends GenericSchema, Row extends Record<string, unknown>, Result$1, RelationName = unknown, Relationships = unknown, Method = unknown> extends PostgrestTransformBuilder<ClientOptions, Schema, Row, Result$1, RelationName, Relationships, Method> {
1666
+ /**
1667
+ * Match only rows where `column` is equal to `value`.
1668
+ *
1669
+ * To check if the value of `column` is NULL, you should use `.is()` instead.
1670
+ *
1671
+ * @param column - The column to filter on
1672
+ * @param value - The value to filter with
1673
+ *
1674
+ * @category Database
1675
+ * @subcategory Using filters
1676
+ *
1677
+ * @example With `select()`
1678
+ * ```ts
1679
+ * const { data, error } = await supabase
1680
+ * .from('characters')
1681
+ * .select()
1682
+ * .eq('name', 'Leia')
1683
+ * ```
1684
+ *
1685
+ * @exampleSql With `select()`
1686
+ * ```sql
1687
+ * create table
1688
+ * characters (id int8 primary key, name text);
1689
+ *
1690
+ * insert into
1691
+ * characters (id, name)
1692
+ * values
1693
+ * (1, 'Luke'),
1694
+ * (2, 'Leia'),
1695
+ * (3, 'Han');
1696
+ * ```
1697
+ *
1698
+ * @exampleResponse With `select()`
1699
+ * ```json
1700
+ * {
1701
+ * "data": [
1702
+ * {
1703
+ * "id": 2,
1704
+ * "name": "Leia"
1705
+ * }
1706
+ * ],
1707
+ * "status": 200,
1708
+ * "statusText": "OK"
1709
+ * }
1710
+ * ```
1711
+ */
1712
+ eq<ColumnName extends string>(column: ColumnName extends keyof Row ? ColumnName : ColumnName extends `${string}.${string}` | `${string}->${string}` ? ColumnName : string extends ColumnName ? string : keyof Row, value: ResolveFilterValue<Schema, Row, ColumnName> extends never ? NonNullable<unknown> : ResolveFilterValue<Schema, Row, ColumnName> extends infer ResolvedFilterValue ? NonNullable<ResolvedFilterValue> : never): this;
1713
+ /**
1714
+ * Match only rows where `column` is not equal to `value`.
1715
+ *
1716
+ * @param column - The column to filter on
1717
+ * @param value - The value to filter with
1718
+ *
1719
+ * @category Database
1720
+ * @subcategory Using filters
1721
+ *
1722
+ * @example With `select()`
1723
+ * ```ts
1724
+ * const { data, error } = await supabase
1725
+ * .from('characters')
1726
+ * .select()
1727
+ * .neq('name', 'Leia')
1728
+ * ```
1729
+ *
1730
+ * @exampleSql With `select()`
1731
+ * ```sql
1732
+ * create table
1733
+ * characters (id int8 primary key, name text);
1734
+ *
1735
+ * insert into
1736
+ * characters (id, name)
1737
+ * values
1738
+ * (1, 'Luke'),
1739
+ * (2, 'Leia'),
1740
+ * (3, 'Han');
1741
+ * ```
1742
+ *
1743
+ * @exampleResponse With `select()`
1744
+ * ```json
1745
+ * {
1746
+ * "data": [
1747
+ * {
1748
+ * "id": 1,
1749
+ * "name": "Luke"
1750
+ * },
1751
+ * {
1752
+ * "id": 3,
1753
+ * "name": "Han"
1754
+ * }
1755
+ * ],
1756
+ * "status": 200,
1757
+ * "statusText": "OK"
1758
+ * }
1759
+ * ```
1760
+ */
1761
+ neq<ColumnName extends string>(column: ColumnName extends keyof Row ? ColumnName : ColumnName extends `${string}.${string}` | `${string}->${string}` ? ColumnName : string extends ColumnName ? string : keyof Row, value: ResolveFilterValue<Schema, Row, ColumnName> extends never ? unknown : ResolveFilterValue<Schema, Row, ColumnName> extends infer Resolved ? Resolved : never): this;
1762
+ gt<ColumnName extends string & keyof Row>(column: ColumnName, value: Row[ColumnName]): this;
1763
+ gt(column: string, value: unknown): this;
1764
+ gte<ColumnName extends string & keyof Row>(column: ColumnName, value: Row[ColumnName]): this;
1765
+ gte(column: string, value: unknown): this;
1766
+ lt<ColumnName extends string & keyof Row>(column: ColumnName, value: Row[ColumnName]): this;
1767
+ lt(column: string, value: unknown): this;
1768
+ lte<ColumnName extends string & keyof Row>(column: ColumnName, value: Row[ColumnName]): this;
1769
+ lte(column: string, value: unknown): this;
1770
+ like<ColumnName extends string & keyof Row>(column: ColumnName, pattern: string): this;
1771
+ like(column: string, pattern: string): this;
1772
+ likeAllOf<ColumnName extends string & keyof Row>(column: ColumnName, patterns: readonly string[]): this;
1773
+ likeAllOf(column: string, patterns: readonly string[]): this;
1774
+ likeAnyOf<ColumnName extends string & keyof Row>(column: ColumnName, patterns: readonly string[]): this;
1775
+ likeAnyOf(column: string, patterns: readonly string[]): this;
1776
+ ilike<ColumnName extends string & keyof Row>(column: ColumnName, pattern: string): this;
1777
+ ilike(column: string, pattern: string): this;
1778
+ ilikeAllOf<ColumnName extends string & keyof Row>(column: ColumnName, patterns: readonly string[]): this;
1779
+ ilikeAllOf(column: string, patterns: readonly string[]): this;
1780
+ ilikeAnyOf<ColumnName extends string & keyof Row>(column: ColumnName, patterns: readonly string[]): this;
1781
+ ilikeAnyOf(column: string, patterns: readonly string[]): this;
1782
+ regexMatch<ColumnName extends string & keyof Row>(column: ColumnName, pattern: string): this;
1783
+ regexMatch(column: string, pattern: string): this;
1784
+ regexIMatch<ColumnName extends string & keyof Row>(column: ColumnName, pattern: string): this;
1785
+ regexIMatch(column: string, pattern: string): this;
1786
+ is<ColumnName extends string & keyof Row>(column: ColumnName, value: Row[ColumnName] & (boolean | null)): this;
1787
+ is(column: string, value: boolean | null): this;
1788
+ /**
1789
+ * Match only rows where `column` IS DISTINCT FROM `value`.
1790
+ *
1791
+ * Unlike `.neq()`, this treats `NULL` as a comparable value. Two `NULL` values
1792
+ * are considered equal (not distinct), and comparing `NULL` with any non-NULL
1793
+ * value returns true (distinct).
1794
+ *
1795
+ * @param column - The column to filter on
1796
+ * @param value - The value to filter with
1797
+ */
1798
+ isDistinct<ColumnName extends string>(column: ColumnName, value: ResolveFilterValue<Schema, Row, ColumnName> extends never ? unknown : ResolveFilterValue<Schema, Row, ColumnName> extends infer ResolvedFilterValue ? ResolvedFilterValue : never): this;
1799
+ /**
1800
+ * Match only rows where `column` is included in the `values` array.
1801
+ *
1802
+ * @param column - The column to filter on
1803
+ * @param values - The values array to filter with
1804
+ *
1805
+ * @category Database
1806
+ * @subcategory Using filters
1807
+ *
1808
+ * @example With `select()`
1809
+ * ```ts
1810
+ * const { data, error } = await supabase
1811
+ * .from('characters')
1812
+ * .select()
1813
+ * .in('name', ['Leia', 'Han'])
1814
+ * ```
1815
+ *
1816
+ * @exampleSql With `select()`
1817
+ * ```sql
1818
+ * create table
1819
+ * characters (id int8 primary key, name text);
1820
+ *
1821
+ * insert into
1822
+ * characters (id, name)
1823
+ * values
1824
+ * (1, 'Luke'),
1825
+ * (2, 'Leia'),
1826
+ * (3, 'Han');
1827
+ * ```
1828
+ *
1829
+ * @exampleResponse With `select()`
1830
+ * ```json
1831
+ * {
1832
+ * "data": [
1833
+ * {
1834
+ * "id": 2,
1835
+ * "name": "Leia"
1836
+ * },
1837
+ * {
1838
+ * "id": 3,
1839
+ * "name": "Han"
1840
+ * }
1841
+ * ],
1842
+ * "status": 200,
1843
+ * "statusText": "OK"
1844
+ * }
1845
+ * ```
1846
+ */
1847
+ in<ColumnName extends string>(column: ColumnName, values: ReadonlyArray<ResolveFilterValue<Schema, Row, ColumnName> extends never ? unknown : ResolveFilterValue<Schema, Row, ColumnName> extends infer ResolvedFilterValue ? ResolvedFilterValue : never>): this;
1848
+ /**
1849
+ * Match only rows where `column` is NOT included in the `values` array.
1850
+ *
1851
+ * @param column - The column to filter on
1852
+ * @param values - The values array to filter with
1853
+ */
1854
+ notIn<ColumnName extends string>(column: ColumnName, values: ReadonlyArray<ResolveFilterValue<Schema, Row, ColumnName> extends never ? unknown : ResolveFilterValue<Schema, Row, ColumnName> extends infer ResolvedFilterValue ? ResolvedFilterValue : never>): this;
1855
+ contains<ColumnName extends string & keyof Row>(column: ColumnName, value: string | ReadonlyArray<Row[ColumnName]> | Record<string, unknown>): this;
1856
+ contains(column: string, value: string | readonly unknown[] | Record<string, unknown>): this;
1857
+ containedBy<ColumnName extends string & keyof Row>(column: ColumnName, value: string | ReadonlyArray<Row[ColumnName]> | Record<string, unknown>): this;
1858
+ containedBy(column: string, value: string | readonly unknown[] | Record<string, unknown>): this;
1859
+ rangeGt<ColumnName extends string & keyof Row>(column: ColumnName, range: string): this;
1860
+ rangeGt(column: string, range: string): this;
1861
+ rangeGte<ColumnName extends string & keyof Row>(column: ColumnName, range: string): this;
1862
+ rangeGte(column: string, range: string): this;
1863
+ rangeLt<ColumnName extends string & keyof Row>(column: ColumnName, range: string): this;
1864
+ rangeLt(column: string, range: string): this;
1865
+ rangeLte<ColumnName extends string & keyof Row>(column: ColumnName, range: string): this;
1866
+ rangeLte(column: string, range: string): this;
1867
+ rangeAdjacent<ColumnName extends string & keyof Row>(column: ColumnName, range: string): this;
1868
+ rangeAdjacent(column: string, range: string): this;
1869
+ overlaps<ColumnName extends string & keyof Row>(column: ColumnName, value: string | ReadonlyArray<Row[ColumnName]>): this;
1870
+ overlaps(column: string, value: string | readonly unknown[]): this;
1871
+ textSearch<ColumnName extends string & keyof Row>(column: ColumnName, query: string, options?: {
1872
+ config?: string;
1873
+ type?: 'plain' | 'phrase' | 'websearch';
1874
+ }): this;
1875
+ textSearch(column: string, query: string, options?: {
1876
+ config?: string;
1877
+ type?: 'plain' | 'phrase' | 'websearch';
1878
+ }): this;
1879
+ match<ColumnName extends string & keyof Row>(query: Record<ColumnName, Row[ColumnName]>): this;
1880
+ match(query: Record<string, unknown>): this;
1881
+ not<ColumnName extends string & keyof Row>(column: ColumnName, operator: 'is', value: null): PostgrestFilterBuilder<ClientOptions, Schema, NonNullableColumn<Row, ColumnName>, NarrowResultColumn<Result$1, ColumnName>, RelationName, Relationships, Method> & this;
1882
+ not<ColumnName extends string & keyof Row>(column: ColumnName, operator: FilterOperator, value: Row[ColumnName]): this;
1883
+ not(column: string, operator: string, value: unknown): this;
1884
+ /**
1885
+ * Match only rows which satisfy at least one of the filters.
1886
+ *
1887
+ * Unlike most filters, `filters` is used as-is and needs to follow [PostgREST
1888
+ * syntax](https://postgrest.org/en/stable/api.html#operators). You also need
1889
+ * to make sure it's properly sanitized.
1890
+ *
1891
+ * It's currently not possible to do an `.or()` filter across multiple tables.
1892
+ *
1893
+ * @param filters - The filters to use, following PostgREST syntax
1894
+ * @param options - Named parameters
1895
+ * @param options.referencedTable - Set this to filter on referenced tables
1896
+ * instead of the parent table
1897
+ * @param options.foreignTable - Deprecated, use `referencedTable` instead
1898
+ *
1899
+ * @category Database
1900
+ * @subcategory Using filters
1901
+ *
1902
+ * @remarks
1903
+ * or() expects you to use the raw PostgREST syntax for the filter names and values.
1904
+ *
1905
+ * ```ts
1906
+ * .or('id.in.(5,6,7), arraycol.cs.{"a","b"}') // Use `()` for `in` filter, `{}` for array values and `cs` for `contains()`.
1907
+ * .or('id.in.(5,6,7), arraycol.cd.{"a","b"}') // Use `cd` for `containedBy()`
1908
+ * ```
1909
+ *
1910
+ * @example With `select()`
1911
+ * ```ts
1912
+ * const { data, error } = await supabase
1913
+ * .from('characters')
1914
+ * .select('name')
1915
+ * .or('id.eq.2,name.eq.Han')
1916
+ * ```
1917
+ *
1918
+ * @exampleSql With `select()`
1919
+ * ```sql
1920
+ * create table
1921
+ * characters (id int8 primary key, name text);
1922
+ *
1923
+ * insert into
1924
+ * characters (id, name)
1925
+ * values
1926
+ * (1, 'Luke'),
1927
+ * (2, 'Leia'),
1928
+ * (3, 'Han');
1929
+ * ```
1930
+ *
1931
+ * @exampleResponse With `select()`
1932
+ * ```json
1933
+ * {
1934
+ * "data": [
1935
+ * {
1936
+ * "name": "Leia"
1937
+ * },
1938
+ * {
1939
+ * "name": "Han"
1940
+ * }
1941
+ * ],
1942
+ * "status": 200,
1943
+ * "statusText": "OK"
1944
+ * }
1945
+ * ```
1946
+ *
1947
+ * @example Use `or` with `and`
1948
+ * ```ts
1949
+ * const { data, error } = await supabase
1950
+ * .from('characters')
1951
+ * .select('name')
1952
+ * .or('id.gt.3,and(id.eq.1,name.eq.Luke)')
1953
+ * ```
1954
+ *
1955
+ * @exampleSql Use `or` with `and`
1956
+ * ```sql
1957
+ * create table
1958
+ * characters (id int8 primary key, name text);
1959
+ *
1960
+ * insert into
1961
+ * characters (id, name)
1962
+ * values
1963
+ * (1, 'Luke'),
1964
+ * (2, 'Leia'),
1965
+ * (3, 'Han');
1966
+ * ```
1967
+ *
1968
+ * @exampleResponse Use `or` with `and`
1969
+ * ```json
1970
+ * {
1971
+ * "data": [
1972
+ * {
1973
+ * "name": "Luke"
1974
+ * }
1975
+ * ],
1976
+ * "status": 200,
1977
+ * "statusText": "OK"
1978
+ * }
1979
+ * ```
1980
+ *
1981
+ * @example Use `or` on referenced tables
1982
+ * ```ts
1983
+ * const { data, error } = await supabase
1984
+ * .from('orchestral_sections')
1985
+ * .select(`
1986
+ * name,
1987
+ * instruments!inner (
1988
+ * name
1989
+ * )
1990
+ * `)
1991
+ * .or('section_id.eq.1,name.eq.guzheng', { referencedTable: 'instruments' })
1992
+ * ```
1993
+ *
1994
+ * @exampleSql Use `or` on referenced tables
1995
+ * ```sql
1996
+ * create table
1997
+ * orchestral_sections (id int8 primary key, name text);
1998
+ * create table
1999
+ * instruments (
2000
+ * id int8 primary key,
2001
+ * section_id int8 not null references orchestral_sections,
2002
+ * name text
2003
+ * );
2004
+ *
2005
+ * insert into
2006
+ * orchestral_sections (id, name)
2007
+ * values
2008
+ * (1, 'strings'),
2009
+ * (2, 'woodwinds');
2010
+ * insert into
2011
+ * instruments (id, section_id, name)
2012
+ * values
2013
+ * (1, 2, 'flute'),
2014
+ * (2, 1, 'violin');
2015
+ * ```
2016
+ *
2017
+ * @exampleResponse Use `or` on referenced tables
2018
+ * ```json
2019
+ * {
2020
+ * "data": [
2021
+ * {
2022
+ * "name": "strings",
2023
+ * "instruments": [
2024
+ * {
2025
+ * "name": "violin"
2026
+ * }
2027
+ * ]
2028
+ * }
2029
+ * ],
2030
+ * "status": 200,
2031
+ * "statusText": "OK"
2032
+ * }
2033
+ * ```
2034
+ */
2035
+ or(filters: string, {
2036
+ foreignTable,
2037
+ referencedTable
2038
+ }?: {
2039
+ foreignTable?: string;
2040
+ referencedTable?: string;
2041
+ }): this;
2042
+ filter<ColumnName extends string & keyof Row>(column: ColumnName, operator: `${'' | 'not.'}${FilterOperator}`, value: unknown): this;
2043
+ filter(column: string, operator: string, value: unknown): this;
2044
+ }
2045
+ //#endregion
2046
+ //#region src/PostgrestQueryBuilder.d.ts
2047
+ declare class PostgrestQueryBuilder<ClientOptions extends ClientServerOptions, Schema extends GenericSchema, Relation$1 extends GenericTable | GenericView, RelationName = unknown, Relationships = (Relation$1 extends {
2048
+ Relationships: infer R;
2049
+ } ? R : unknown)> {
2050
+ url: URL;
2051
+ headers: Headers;
2052
+ schema?: string;
2053
+ signal?: AbortSignal;
2054
+ fetch?: Fetch;
2055
+ urlLengthLimit: number;
2056
+ /**
2057
+ * Enable or disable automatic retries for transient errors.
2058
+ * When enabled, idempotent requests (GET/HEAD/OPTIONS) that fail with network
2059
+ * errors or HTTP 503/520 responses are automatically retried with exponential
2060
+ * backoff (1s, 2s, 4s, up to 3 attempts). Defaults to `true` when not specified.
2061
+ */
2062
+ retry?: boolean;
2063
+ /**
2064
+ * Creates a query builder scoped to a Postgres table or view.
2065
+ *
2066
+ * @category Database
2067
+ *
2068
+ * @param url - The URL for the query
2069
+ * @param options - Named parameters
2070
+ * @param options.headers - Custom headers
2071
+ * @param options.schema - Postgres schema to use
2072
+ * @param options.fetch - Custom fetch implementation
2073
+ * @param options.urlLengthLimit - Maximum URL length before warning
2074
+ * @param options.retry - Enable automatic retries for transient errors (default: true)
2075
+ *
2076
+ * @example Using supabase-js (recommended)
2077
+ * ```ts
2078
+ * import { createClient } from '@supabase/supabase-js'
2079
+ *
2080
+ * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')
2081
+ * const { data, error } = await supabase.from('users').select('*')
2082
+ * ```
2083
+ *
2084
+ * @example Standalone import for bundle-sensitive environments
2085
+ * ```ts
2086
+ * import { PostgrestQueryBuilder } from '@supabase/postgrest-js'
2087
+ *
2088
+ * const query = new PostgrestQueryBuilder(
2089
+ * new URL('https://xyzcompany.supabase.co/rest/v1/users'),
2090
+ * { headers: { apikey: 'your-publishable-key' }, retry: true }
2091
+ * )
2092
+ * ```
2093
+ */
2094
+ constructor(url: URL, {
2095
+ headers,
2096
+ schema,
2097
+ fetch,
2098
+ urlLengthLimit,
2099
+ retry
2100
+ }: {
2101
+ headers?: HeadersInit;
2102
+ schema?: string;
2103
+ fetch?: Fetch;
2104
+ urlLengthLimit?: number;
2105
+ retry?: boolean;
2106
+ });
2107
+ /**
2108
+ * Clone URL and headers to prevent shared state between operations.
2109
+ */
2110
+ private cloneRequestState;
2111
+ /**
2112
+ * Perform a SELECT query on the table or view.
2113
+ *
2114
+ * @param columns - The columns to retrieve, separated by commas. Columns can be renamed when returned with `customName:columnName`
2115
+ *
2116
+ * @param options - Named parameters
2117
+ *
2118
+ * @param options.head - When set to `true`, `data` will not be returned.
2119
+ * Useful if you only need the count.
2120
+ *
2121
+ * @param options.count - Count algorithm to use to count rows in the table or view.
2122
+ *
2123
+ * `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the
2124
+ * hood.
2125
+ *
2126
+ * `"planned"`: Approximated but fast count algorithm. Uses the Postgres
2127
+ * statistics under the hood.
2128
+ *
2129
+ * `"estimated"`: Uses exact count for low numbers and planned count for high
2130
+ * numbers.
2131
+ *
2132
+ * @remarks
2133
+ * When using `count` with `.range()` or `.limit()`, the returned `count` is the total number of rows
2134
+ * that match your filters, not the number of rows in the current page. Use this to build pagination UI.
2135
+
2136
+ * - 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.
2137
+ * - `select()` can be combined with [Filters](/docs/reference/javascript/using-filters)
2138
+ * - `select()` can be combined with [Modifiers](/docs/reference/javascript/using-modifiers)
2139
+ * - `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). *
2140
+ * @category Database
2141
+ *
2142
+ * @example Getting your data
2143
+ * ```js
2144
+ * const { data, error } = await supabase
2145
+ * .from('characters')
2146
+ * .select()
2147
+ * ```
2148
+ *
2149
+ * @exampleSql Getting your data
2150
+ * ```sql
2151
+ * create table
2152
+ * characters (id int8 primary key, name text);
2153
+ *
2154
+ * insert into
2155
+ * characters (id, name)
2156
+ * values
2157
+ * (1, 'Harry'),
2158
+ * (2, 'Frodo'),
2159
+ * (3, 'Katniss');
2160
+ * ```
2161
+ *
2162
+ * @exampleResponse Getting your data
2163
+ * ```json
2164
+ * {
2165
+ * "data": [
2166
+ * {
2167
+ * "id": 1,
2168
+ * "name": "Harry"
2169
+ * },
2170
+ * {
2171
+ * "id": 2,
2172
+ * "name": "Frodo"
2173
+ * },
2174
+ * {
2175
+ * "id": 3,
2176
+ * "name": "Katniss"
2177
+ * }
2178
+ * ],
2179
+ * "status": 200,
2180
+ * "statusText": "OK"
2181
+ * }
2182
+ * ```
2183
+ *
2184
+ * @example Selecting specific columns
2185
+ * ```js
2186
+ * const { data, error } = await supabase
2187
+ * .from('characters')
2188
+ * .select('name')
2189
+ * ```
2190
+ *
2191
+ * @exampleSql Selecting specific columns
2192
+ * ```sql
2193
+ * create table
2194
+ * characters (id int8 primary key, name text);
2195
+ *
2196
+ * insert into
2197
+ * characters (id, name)
2198
+ * values
2199
+ * (1, 'Frodo'),
2200
+ * (2, 'Harry'),
2201
+ * (3, 'Katniss');
2202
+ * ```
2203
+ *
2204
+ * @exampleResponse Selecting specific columns
2205
+ * ```json
2206
+ * {
2207
+ * "data": [
2208
+ * {
2209
+ * "name": "Frodo"
2210
+ * },
2211
+ * {
2212
+ * "name": "Harry"
2213
+ * },
2214
+ * {
2215
+ * "name": "Katniss"
2216
+ * }
2217
+ * ],
2218
+ * "status": 200,
2219
+ * "statusText": "OK"
2220
+ * }
2221
+ * ```
2222
+ *
2223
+ * @exampleDescription Query referenced tables
2224
+ * If your database has foreign key relationships, you can query related tables too.
2225
+ *
2226
+ * @example Query referenced tables
2227
+ * ```js
2228
+ * const { data, error } = await supabase
2229
+ * .from('orchestral_sections')
2230
+ * .select(`
2231
+ * name,
2232
+ * instruments (
2233
+ * name
2234
+ * )
2235
+ * `)
2236
+ * ```
2237
+ *
2238
+ * @exampleSql Query referenced tables
2239
+ * ```sql
2240
+ * create table
2241
+ * orchestral_sections (id int8 primary key, name text);
2242
+ * create table
2243
+ * instruments (
2244
+ * id int8 primary key,
2245
+ * section_id int8 not null references orchestral_sections,
2246
+ * name text
2247
+ * );
2248
+ *
2249
+ * insert into
2250
+ * orchestral_sections (id, name)
2251
+ * values
2252
+ * (1, 'strings'),
2253
+ * (2, 'woodwinds');
2254
+ * insert into
2255
+ * instruments (id, section_id, name)
2256
+ * values
2257
+ * (1, 2, 'flute'),
2258
+ * (2, 1, 'violin');
2259
+ * ```
2260
+ *
2261
+ * @exampleResponse Query referenced tables
2262
+ * ```json
2263
+ * {
2264
+ * "data": [
2265
+ * {
2266
+ * "name": "strings",
2267
+ * "instruments": [
2268
+ * {
2269
+ * "name": "violin"
2270
+ * }
2271
+ * ]
2272
+ * },
2273
+ * {
2274
+ * "name": "woodwinds",
2275
+ * "instruments": [
2276
+ * {
2277
+ * "name": "flute"
2278
+ * }
2279
+ * ]
2280
+ * }
2281
+ * ],
2282
+ * "status": 200,
2283
+ * "statusText": "OK"
2284
+ * }
2285
+ * ```
2286
+ *
2287
+ * @exampleDescription Query referenced tables with spaces in their names
2288
+ * If your table name contains spaces, you must use double quotes in the `select` statement to reference the table.
2289
+ *
2290
+ * @example Query referenced tables with spaces in their names
2291
+ * ```js
2292
+ * const { data, error } = await supabase
2293
+ * .from('orchestral sections')
2294
+ * .select(`
2295
+ * name,
2296
+ * "musical instruments" (
2297
+ * name
2298
+ * )
2299
+ * `)
2300
+ * ```
2301
+ *
2302
+ * @exampleSql Query referenced tables with spaces in their names
2303
+ * ```sql
2304
+ * create table
2305
+ * "orchestral sections" (id int8 primary key, name text);
2306
+ * create table
2307
+ * "musical instruments" (
2308
+ * id int8 primary key,
2309
+ * section_id int8 not null references "orchestral sections",
2310
+ * name text
2311
+ * );
2312
+ *
2313
+ * insert into
2314
+ * "orchestral sections" (id, name)
2315
+ * values
2316
+ * (1, 'strings'),
2317
+ * (2, 'woodwinds');
2318
+ * insert into
2319
+ * "musical instruments" (id, section_id, name)
2320
+ * values
2321
+ * (1, 2, 'flute'),
2322
+ * (2, 1, 'violin');
2323
+ * ```
2324
+ *
2325
+ * @exampleResponse Query referenced tables with spaces in their names
2326
+ * ```json
2327
+ * {
2328
+ * "data": [
2329
+ * {
2330
+ * "name": "strings",
2331
+ * "musical instruments": [
2332
+ * {
2333
+ * "name": "violin"
2334
+ * }
2335
+ * ]
2336
+ * },
2337
+ * {
2338
+ * "name": "woodwinds",
2339
+ * "musical instruments": [
2340
+ * {
2341
+ * "name": "flute"
2342
+ * }
2343
+ * ]
2344
+ * }
2345
+ * ],
2346
+ * "status": 200,
2347
+ * "statusText": "OK"
2348
+ * }
2349
+ * ```
2350
+ *
2351
+ * @exampleDescription Query referenced tables through a join table
2352
+ * If you're in a situation where your tables are **NOT** directly
2353
+ * related, but instead are joined by a _join table_, you can still use
2354
+ * the `select()` method to query the related data. The join table needs
2355
+ * to have the foreign keys as part of its composite primary key.
2356
+ *
2357
+ * @example Query referenced tables through a join table
2358
+ * ```ts
2359
+ * const { data, error } = await supabase
2360
+ * .from('users')
2361
+ * .select(`
2362
+ * name,
2363
+ * teams (
2364
+ * name
2365
+ * )
2366
+ * `)
2367
+ *
2368
+ * ```
2369
+ *
2370
+ * @exampleSql Query referenced tables through a join table
2371
+ * ```sql
2372
+ * create table
2373
+ * users (
2374
+ * id int8 primary key,
2375
+ * name text
2376
+ * );
2377
+ * create table
2378
+ * teams (
2379
+ * id int8 primary key,
2380
+ * name text
2381
+ * );
2382
+ * -- join table
2383
+ * create table
2384
+ * users_teams (
2385
+ * user_id int8 not null references users,
2386
+ * team_id int8 not null references teams,
2387
+ * -- both foreign keys must be part of a composite primary key
2388
+ * primary key (user_id, team_id)
2389
+ * );
2390
+ *
2391
+ * insert into
2392
+ * users (id, name)
2393
+ * values
2394
+ * (1, 'Kiran'),
2395
+ * (2, 'Evan');
2396
+ * insert into
2397
+ * teams (id, name)
2398
+ * values
2399
+ * (1, 'Green'),
2400
+ * (2, 'Blue');
2401
+ * insert into
2402
+ * users_teams (user_id, team_id)
2403
+ * values
2404
+ * (1, 1),
2405
+ * (1, 2),
2406
+ * (2, 2);
2407
+ * ```
2408
+ *
2409
+ * @exampleResponse Query referenced tables through a join table
2410
+ * ```json
2411
+ * {
2412
+ * "data": [
2413
+ * {
2414
+ * "name": "Kiran",
2415
+ * "teams": [
2416
+ * {
2417
+ * "name": "Green"
2418
+ * },
2419
+ * {
2420
+ * "name": "Blue"
2421
+ * }
2422
+ * ]
2423
+ * },
2424
+ * {
2425
+ * "name": "Evan",
2426
+ * "teams": [
2427
+ * {
2428
+ * "name": "Blue"
2429
+ * }
2430
+ * ]
2431
+ * }
2432
+ * ],
2433
+ * "status": 200,
2434
+ * "statusText": "OK"
2435
+ * }
2436
+ *
2437
+ * ```
2438
+ *
2439
+ * @exampleDescription Query the same referenced table multiple times
2440
+ * If you need to query the same referenced table twice, use the name of the
2441
+ * joined column to identify which join to use. You can also give each
2442
+ * column an alias.
2443
+ *
2444
+ * @example Query the same referenced table multiple times
2445
+ * ```ts
2446
+ * const { data, error } = await supabase
2447
+ * .from('messages')
2448
+ * .select(`
2449
+ * content,
2450
+ * from:sender_id(name),
2451
+ * to:receiver_id(name)
2452
+ * `)
2453
+ *
2454
+ * // To infer types, use the name of the table (in this case `users`) and
2455
+ * // the name of the foreign key constraint.
2456
+ * const { data, error } = await supabase
2457
+ * .from('messages')
2458
+ * .select(`
2459
+ * content,
2460
+ * from:users!messages_sender_id_fkey(name),
2461
+ * to:users!messages_receiver_id_fkey(name)
2462
+ * `)
2463
+ * ```
2464
+ *
2465
+ * @exampleSql Query the same referenced table multiple times
2466
+ * ```sql
2467
+ * create table
2468
+ * users (id int8 primary key, name text);
2469
+ *
2470
+ * create table
2471
+ * messages (
2472
+ * sender_id int8 not null references users,
2473
+ * receiver_id int8 not null references users,
2474
+ * content text
2475
+ * );
2476
+ *
2477
+ * insert into
2478
+ * users (id, name)
2479
+ * values
2480
+ * (1, 'Kiran'),
2481
+ * (2, 'Evan');
2482
+ *
2483
+ * insert into
2484
+ * messages (sender_id, receiver_id, content)
2485
+ * values
2486
+ * (1, 2, '👋');
2487
+ * ```
2488
+ * ```
2489
+ *
2490
+ * @exampleResponse Query the same referenced table multiple times
2491
+ * ```json
2492
+ * {
2493
+ * "data": [
2494
+ * {
2495
+ * "content": "👋",
2496
+ * "from": {
2497
+ * "name": "Kiran"
2498
+ * },
2499
+ * "to": {
2500
+ * "name": "Evan"
2501
+ * }
2502
+ * }
2503
+ * ],
2504
+ * "status": 200,
2505
+ * "statusText": "OK"
2506
+ * }
2507
+ * ```
2508
+ *
2509
+ * @exampleDescription Query nested foreign tables through a join table
2510
+ * You can use the result of a joined table to gather data in
2511
+ * another foreign table. With multiple references to the same foreign
2512
+ * table you must specify the column on which to conduct the join.
2513
+ *
2514
+ * @example Query nested foreign tables through a join table
2515
+ * ```ts
2516
+ * const { data, error } = await supabase
2517
+ * .from('games')
2518
+ * .select(`
2519
+ * game_id:id,
2520
+ * away_team:teams!games_away_team_fkey (
2521
+ * users (
2522
+ * id,
2523
+ * name
2524
+ * )
2525
+ * )
2526
+ * `)
2527
+ *
2528
+ * ```
2529
+ *
2530
+ * @exampleSql Query nested foreign tables through a join table
2531
+ * ```sql
2532
+ * ```sql
2533
+ * create table
2534
+ * users (
2535
+ * id int8 primary key,
2536
+ * name text
2537
+ * );
2538
+ * create table
2539
+ * teams (
2540
+ * id int8 primary key,
2541
+ * name text
2542
+ * );
2543
+ * -- join table
2544
+ * create table
2545
+ * users_teams (
2546
+ * user_id int8 not null references users,
2547
+ * team_id int8 not null references teams,
2548
+ *
2549
+ * primary key (user_id, team_id)
2550
+ * );
2551
+ * create table
2552
+ * games (
2553
+ * id int8 primary key,
2554
+ * home_team int8 not null references teams,
2555
+ * away_team int8 not null references teams,
2556
+ * name text
2557
+ * );
2558
+ *
2559
+ * insert into users (id, name)
2560
+ * values
2561
+ * (1, 'Kiran'),
2562
+ * (2, 'Evan');
2563
+ * insert into
2564
+ * teams (id, name)
2565
+ * values
2566
+ * (1, 'Green'),
2567
+ * (2, 'Blue');
2568
+ * insert into
2569
+ * users_teams (user_id, team_id)
2570
+ * values
2571
+ * (1, 1),
2572
+ * (1, 2),
2573
+ * (2, 2);
2574
+ * insert into
2575
+ * games (id, home_team, away_team, name)
2576
+ * values
2577
+ * (1, 1, 2, 'Green vs Blue'),
2578
+ * (2, 2, 1, 'Blue vs Green');
2579
+ * ```
2580
+ *
2581
+ * @exampleResponse Query nested foreign tables through a join table
2582
+ * ```json
2583
+ * {
2584
+ * "data": [
2585
+ * {
2586
+ * "game_id": 1,
2587
+ * "away_team": {
2588
+ * "users": [
2589
+ * {
2590
+ * "id": 1,
2591
+ * "name": "Kiran"
2592
+ * },
2593
+ * {
2594
+ * "id": 2,
2595
+ * "name": "Evan"
2596
+ * }
2597
+ * ]
2598
+ * }
2599
+ * },
2600
+ * {
2601
+ * "game_id": 2,
2602
+ * "away_team": {
2603
+ * "users": [
2604
+ * {
2605
+ * "id": 1,
2606
+ * "name": "Kiran"
2607
+ * }
2608
+ * ]
2609
+ * }
2610
+ * }
2611
+ * ],
2612
+ * "status": 200,
2613
+ * "statusText": "OK"
2614
+ * }
2615
+ *
2616
+ * ```
2617
+ *
2618
+ * @exampleDescription Filtering through referenced tables
2619
+ * If the filter on a referenced table's column is not satisfied, the referenced
2620
+ * table returns `[]` or `null` but the parent table is not filtered out.
2621
+ * If you want to filter out the parent table rows, use the `!inner` hint
2622
+ *
2623
+ * @example Filtering through referenced tables
2624
+ * ```ts
2625
+ * const { data, error } = await supabase
2626
+ * .from('instruments')
2627
+ * .select('name, orchestral_sections(*)')
2628
+ * .eq('orchestral_sections.name', 'percussion')
2629
+ * ```
2630
+ *
2631
+ * @exampleSql Filtering through referenced tables
2632
+ * ```sql
2633
+ * create table
2634
+ * orchestral_sections (id int8 primary key, name text);
2635
+ * create table
2636
+ * instruments (
2637
+ * id int8 primary key,
2638
+ * section_id int8 not null references orchestral_sections,
2639
+ * name text
2640
+ * );
2641
+ *
2642
+ * insert into
2643
+ * orchestral_sections (id, name)
2644
+ * values
2645
+ * (1, 'strings'),
2646
+ * (2, 'woodwinds');
2647
+ * insert into
2648
+ * instruments (id, section_id, name)
2649
+ * values
2650
+ * (1, 2, 'flute'),
2651
+ * (2, 1, 'violin');
2652
+ * ```
2653
+ *
2654
+ * @exampleResponse Filtering through referenced tables
2655
+ * ```json
2656
+ * {
2657
+ * "data": [
2658
+ * {
2659
+ * "name": "flute",
2660
+ * "orchestral_sections": null
2661
+ * },
2662
+ * {
2663
+ * "name": "violin",
2664
+ * "orchestral_sections": null
2665
+ * }
2666
+ * ],
2667
+ * "status": 200,
2668
+ * "statusText": "OK"
2669
+ * }
2670
+ * ```
2671
+ *
2672
+ * @exampleDescription Querying referenced table with count
2673
+ * You can get the number of rows in a related table by using the
2674
+ * **count** property.
2675
+ *
2676
+ * @example Querying referenced table with count
2677
+ * ```ts
2678
+ * const { data, error } = await supabase
2679
+ * .from('orchestral_sections')
2680
+ * .select(`*, instruments(count)`)
2681
+ * ```
2682
+ *
2683
+ * @exampleSql Querying referenced table with count
2684
+ * ```sql
2685
+ * create table orchestral_sections (
2686
+ * "id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,
2687
+ * "name" text
2688
+ * );
2689
+ *
2690
+ * create table characters (
2691
+ * "id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,
2692
+ * "name" text,
2693
+ * "section_id" "uuid" references public.orchestral_sections on delete cascade
2694
+ * );
2695
+ *
2696
+ * with section as (
2697
+ * insert into orchestral_sections (name)
2698
+ * values ('strings') returning id
2699
+ * )
2700
+ * insert into instruments (name, section_id) values
2701
+ * ('violin', (select id from section)),
2702
+ * ('viola', (select id from section)),
2703
+ * ('cello', (select id from section)),
2704
+ * ('double bass', (select id from section));
2705
+ * ```
2706
+ *
2707
+ * @exampleResponse Querying referenced table with count
2708
+ * ```json
2709
+ * [
2710
+ * {
2711
+ * "id": "693694e7-d993-4360-a6d7-6294e325d9b6",
2712
+ * "name": "strings",
2713
+ * "instruments": [
2714
+ * {
2715
+ * "count": 4
2716
+ * }
2717
+ * ]
2718
+ * }
2719
+ * ]
2720
+ * ```
2721
+ *
2722
+ * @exampleDescription Querying with count option
2723
+ * You can get the number of rows by using the
2724
+ * [count](/docs/reference/javascript/select#parameters) option.
2725
+ *
2726
+ * @example Querying with count option
2727
+ * ```ts
2728
+ * const { count, error } = await supabase
2729
+ * .from('characters')
2730
+ * .select('*', { count: 'exact', head: true })
2731
+ * ```
2732
+ *
2733
+ * @exampleSql Querying with count option
2734
+ * ```sql
2735
+ * create table
2736
+ * characters (id int8 primary key, name text);
2737
+ *
2738
+ * insert into
2739
+ * characters (id, name)
2740
+ * values
2741
+ * (1, 'Luke'),
2742
+ * (2, 'Leia'),
2743
+ * (3, 'Han');
2744
+ * ```
2745
+ *
2746
+ * @exampleResponse Querying with count option
2747
+ * ```json
2748
+ * {
2749
+ * "count": 3,
2750
+ * "status": 200,
2751
+ * "statusText": "OK"
2752
+ * }
2753
+ * ```
2754
+ *
2755
+ * @exampleDescription Querying JSON data
2756
+ * You can select and filter data inside of
2757
+ * [JSON](/docs/guides/database/json) columns. Postgres offers some
2758
+ * [operators](/docs/guides/database/json#query-the-jsonb-data) for
2759
+ * querying JSON data.
2760
+ *
2761
+ * @example Querying JSON data
2762
+ * ```ts
2763
+ * const { data, error } = await supabase
2764
+ * .from('users')
2765
+ * .select(`
2766
+ * id, name,
2767
+ * address->city
2768
+ * `)
2769
+ * ```
2770
+ *
2771
+ * @exampleSql Querying JSON data
2772
+ * ```sql
2773
+ * create table
2774
+ * users (
2775
+ * id int8 primary key,
2776
+ * name text,
2777
+ * address jsonb
2778
+ * );
2779
+ *
2780
+ * insert into
2781
+ * users (id, name, address)
2782
+ * values
2783
+ * (1, 'Frodo', '{"city":"Hobbiton"}');
2784
+ * ```
2785
+ *
2786
+ * @exampleResponse Querying JSON data
2787
+ * ```json
2788
+ * {
2789
+ * "data": [
2790
+ * {
2791
+ * "id": 1,
2792
+ * "name": "Frodo",
2793
+ * "city": "Hobbiton"
2794
+ * }
2795
+ * ],
2796
+ * "status": 200,
2797
+ * "statusText": "OK"
2798
+ * }
2799
+ * ```
2800
+ *
2801
+ * @exampleDescription Querying referenced table with inner join
2802
+ * If you don't want to return the referenced table contents, you can leave the parenthesis empty.
2803
+ * Like `.select('name, orchestral_sections!inner()')`.
2804
+ *
2805
+ * @example Querying referenced table with inner join
2806
+ * ```ts
2807
+ * const { data, error } = await supabase
2808
+ * .from('instruments')
2809
+ * .select('name, orchestral_sections!inner(name)')
2810
+ * .eq('orchestral_sections.name', 'woodwinds')
2811
+ * .limit(1)
2812
+ * ```
2813
+ *
2814
+ * @exampleSql Querying referenced table with inner join
2815
+ * ```sql
2816
+ * create table orchestral_sections (
2817
+ * "id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,
2818
+ * "name" text
2819
+ * );
2820
+ *
2821
+ * create table instruments (
2822
+ * "id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,
2823
+ * "name" text,
2824
+ * "section_id" "uuid" references public.orchestral_sections on delete cascade
2825
+ * );
2826
+ *
2827
+ * with section as (
2828
+ * insert into orchestral_sections (name)
2829
+ * values ('woodwinds') returning id
2830
+ * )
2831
+ * insert into instruments (name, section_id) values
2832
+ * ('flute', (select id from section)),
2833
+ * ('clarinet', (select id from section)),
2834
+ * ('bassoon', (select id from section)),
2835
+ * ('piccolo', (select id from section));
2836
+ * ```
2837
+ *
2838
+ * @exampleResponse Querying referenced table with inner join
2839
+ * ```json
2840
+ * {
2841
+ * "data": [
2842
+ * {
2843
+ * "name": "flute",
2844
+ * "orchestral_sections": {"name": "woodwinds"}
2845
+ * }
2846
+ * ],
2847
+ * "status": 200,
2848
+ * "statusText": "OK"
2849
+ * }
2850
+ * ```
2851
+ *
2852
+ * @exampleDescription Switching schemas per query
2853
+ * In addition to setting the schema during initialization, you can also switch schemas on a per-query basis.
2854
+ * Make sure you've set up your [database privileges and API settings](/docs/guides/api/using-custom-schemas).
2855
+ *
2856
+ * @example Switching schemas per query
2857
+ * ```ts
2858
+ * const { data, error } = await supabase
2859
+ * .schema('myschema')
2860
+ * .from('mytable')
2861
+ * .select()
2862
+ * ```
2863
+ *
2864
+ * @exampleSql Switching schemas per query
2865
+ * ```sql
2866
+ * create schema myschema;
2867
+ *
2868
+ * create table myschema.mytable (
2869
+ * id uuid primary key default gen_random_uuid(),
2870
+ * data text
2871
+ * );
2872
+ *
2873
+ * insert into myschema.mytable (data) values ('mydata');
2874
+ * ```
2875
+ *
2876
+ * @exampleResponse Switching schemas per query
2877
+ * ```json
2878
+ * {
2879
+ * "data": [
2880
+ * {
2881
+ * "id": "4162e008-27b0-4c0f-82dc-ccaeee9a624d",
2882
+ * "data": "mydata"
2883
+ * }
2884
+ * ],
2885
+ * "status": 200,
2886
+ * "statusText": "OK"
2887
+ * }
2888
+ * ```
2889
+ */
2890
+ select<Query extends string = '*', ResultOne = GetResult<Schema, Relation$1['Row'], RelationName, Relationships, Query, ClientOptions>>(columns?: Query, options?: {
2891
+ head?: boolean;
2892
+ count?: 'exact' | 'planned' | 'estimated' | (string & {});
2893
+ }): PostgrestFilterBuilder<ClientOptions, Schema, Relation$1['Row'], ResultOne[], RelationName, Relationships, 'GET'>;
2894
+ /**
2895
+ * Perform an INSERT into the table or view.
2896
+ *
2897
+ * By default, inserted rows are not returned. To return it, chain the call
2898
+ * with `.select()`.
2899
+ *
2900
+ * @param values - The values to insert. Pass an object to insert a single row
2901
+ * or an array to insert multiple rows.
2902
+ *
2903
+ * @param options - Named parameters
2904
+ *
2905
+ * @param options.count - Count algorithm to use to count inserted rows.
2906
+ *
2907
+ * `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the
2908
+ * hood.
2909
+ *
2910
+ * `"planned"`: Approximated but fast count algorithm. Uses the Postgres
2911
+ * statistics under the hood.
2912
+ *
2913
+ * `"estimated"`: Uses exact count for low numbers and planned count for high
2914
+ * numbers.
2915
+ *
2916
+ * @param options.defaultToNull - Make missing fields default to `null`.
2917
+ * Otherwise, use the default value for the column. Only applies for bulk
2918
+ * inserts.
2919
+ *
2920
+ * @category Database
2921
+ *
2922
+ * @example Create a record
2923
+ * ```ts
2924
+ * const { error } = await supabase
2925
+ * .from('countries')
2926
+ * .insert({ id: 1, name: 'Mordor' })
2927
+ * ```
2928
+ *
2929
+ * @exampleSql Create a record
2930
+ * ```sql
2931
+ * create table
2932
+ * countries (id int8 primary key, name text);
2933
+ * ```
2934
+ *
2935
+ * @exampleResponse Create a record
2936
+ * ```json
2937
+ * {
2938
+ * "status": 201,
2939
+ * "statusText": "Created"
2940
+ * }
2941
+ * ```
2942
+ *
2943
+ * @example Create a record and return it
2944
+ * ```ts
2945
+ * const { data, error } = await supabase
2946
+ * .from('countries')
2947
+ * .insert({ id: 1, name: 'Mordor' })
2948
+ * .select()
2949
+ * ```
2950
+ *
2951
+ * @exampleSql Create a record and return it
2952
+ * ```sql
2953
+ * create table
2954
+ * countries (id int8 primary key, name text);
2955
+ * ```
2956
+ *
2957
+ * @exampleResponse Create a record and return it
2958
+ * ```json
2959
+ * {
2960
+ * "data": [
2961
+ * {
2962
+ * "id": 1,
2963
+ * "name": "Mordor"
2964
+ * }
2965
+ * ],
2966
+ * "status": 201,
2967
+ * "statusText": "Created"
2968
+ * }
2969
+ * ```
2970
+ *
2971
+ * @exampleDescription Bulk create
2972
+ * A bulk create operation is handled in a single transaction.
2973
+ * If any of the inserts fail, none of the rows are inserted.
2974
+ *
2975
+ * @example Bulk create
2976
+ * ```ts
2977
+ * const { error } = await supabase
2978
+ * .from('countries')
2979
+ * .insert([
2980
+ * { id: 1, name: 'Mordor' },
2981
+ * { id: 1, name: 'The Shire' },
2982
+ * ])
2983
+ * ```
2984
+ *
2985
+ * @exampleSql Bulk create
2986
+ * ```sql
2987
+ * create table
2988
+ * countries (id int8 primary key, name text);
2989
+ * ```
2990
+ *
2991
+ * @exampleResponse Bulk create
2992
+ * ```json
2993
+ * {
2994
+ * "error": {
2995
+ * "code": "23505",
2996
+ * "details": "Key (id)=(1) already exists.",
2997
+ * "hint": null,
2998
+ * "message": "duplicate key value violates unique constraint \"countries_pkey\""
2999
+ * },
3000
+ * "status": 409,
3001
+ * "statusText": "Conflict"
3002
+ * }
3003
+ * ```
3004
+ */
3005
+ insert<Row extends (Relation$1 extends {
3006
+ Insert: unknown;
3007
+ } ? Relation$1['Insert'] : never)>(values: RejectExcessProperties<Relation$1 extends {
3008
+ Insert: unknown;
3009
+ } ? Relation$1['Insert'] : never, Row> | RejectExcessProperties<Relation$1 extends {
3010
+ Insert: unknown;
3011
+ } ? Relation$1['Insert'] : never, Row>[], {
3012
+ count,
3013
+ defaultToNull
3014
+ }?: {
3015
+ count?: 'exact' | 'planned' | 'estimated' | (string & {});
3016
+ defaultToNull?: boolean;
3017
+ }): PostgrestFilterBuilder<ClientOptions, Schema, Relation$1['Row'], null, RelationName, Relationships, 'POST'>;
3018
+ /**
3019
+ * Perform an UPSERT on the table or view. Depending on the column(s) passed
3020
+ * to `onConflict`, `.upsert()` allows you to perform the equivalent of
3021
+ * `.insert()` if a row with the corresponding `onConflict` columns doesn't
3022
+ * exist, or if it does exist, perform an alternative action depending on
3023
+ * `ignoreDuplicates`.
3024
+ *
3025
+ * By default, upserted rows are not returned. To return it, chain the call
3026
+ * with `.select()`.
3027
+ *
3028
+ * @param values - The values to upsert with. Pass an object to upsert a
3029
+ * single row or an array to upsert multiple rows.
3030
+ *
3031
+ * @param options - Named parameters
3032
+ *
3033
+ * @param options.onConflict - Comma-separated UNIQUE column(s) to specify how
3034
+ * duplicate rows are determined. Two rows are duplicates if all the
3035
+ * `onConflict` columns are equal.
3036
+ *
3037
+ * @param options.ignoreDuplicates - If `true`, duplicate rows are ignored. If
3038
+ * `false`, duplicate rows are merged with existing rows.
3039
+ *
3040
+ * @param options.count - Count algorithm to use to count upserted rows.
3041
+ *
3042
+ * `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the
3043
+ * hood.
3044
+ *
3045
+ * `"planned"`: Approximated but fast count algorithm. Uses the Postgres
3046
+ * statistics under the hood.
3047
+ *
3048
+ * `"estimated"`: Uses exact count for low numbers and planned count for high
3049
+ * numbers.
3050
+ *
3051
+ * @param options.defaultToNull - Make missing fields default to `null`.
3052
+ * Otherwise, use the default value for the column. This only applies when
3053
+ * inserting new rows, not when merging with existing rows under
3054
+ * `ignoreDuplicates: false`. This also only applies when doing bulk upserts.
3055
+ *
3056
+ * @example Upsert a single row using a unique key
3057
+ * ```ts
3058
+ * // Upserting a single row, overwriting based on the 'username' unique column
3059
+ * const { data, error } = await supabase
3060
+ * .from('users')
3061
+ * .upsert({ username: 'supabot' }, { onConflict: 'username' })
3062
+ *
3063
+ * // Example response:
3064
+ * // {
3065
+ * // data: [
3066
+ * // { id: 4, message: 'bar', username: 'supabot' }
3067
+ * // ],
3068
+ * // error: null
3069
+ * // }
3070
+ * ```
3071
+ *
3072
+ * @example Upsert with conflict resolution and exact row counting
3073
+ * ```ts
3074
+ * // Upserting and returning exact count
3075
+ * const { data, error, count } = await supabase
3076
+ * .from('users')
3077
+ * .upsert(
3078
+ * {
3079
+ * id: 3,
3080
+ * message: 'foo',
3081
+ * username: 'supabot'
3082
+ * },
3083
+ * {
3084
+ * onConflict: 'username',
3085
+ * count: 'exact'
3086
+ * }
3087
+ * )
3088
+ *
3089
+ * // Example response:
3090
+ * // {
3091
+ * // data: [
3092
+ * // {
3093
+ * // id: 42,
3094
+ * // handle: "saoirse",
3095
+ * // display_name: "Saoirse"
3096
+ * // }
3097
+ * // ],
3098
+ * // count: 1,
3099
+ * // error: null
3100
+ * // }
3101
+ * ```
3102
+ *
3103
+ * @category Database
3104
+ *
3105
+ * @remarks
3106
+ * - Primary keys must be included in `values` to use upsert.
3107
+ *
3108
+ * @example Upsert your data
3109
+ * ```ts
3110
+ * const { data, error } = await supabase
3111
+ * .from('instruments')
3112
+ * .upsert({ id: 1, name: 'piano' })
3113
+ * .select()
3114
+ * ```
3115
+ *
3116
+ * @exampleSql Upsert your data
3117
+ * ```sql
3118
+ * create table
3119
+ * instruments (id int8 primary key, name text);
3120
+ *
3121
+ * insert into
3122
+ * instruments (id, name)
3123
+ * values
3124
+ * (1, 'harpsichord');
3125
+ * ```
3126
+ *
3127
+ * @exampleResponse Upsert your data
3128
+ * ```json
3129
+ * {
3130
+ * "data": [
3131
+ * {
3132
+ * "id": 1,
3133
+ * "name": "piano"
3134
+ * }
3135
+ * ],
3136
+ * "status": 201,
3137
+ * "statusText": "Created"
3138
+ * }
3139
+ * ```
3140
+ *
3141
+ * @example Bulk Upsert your data
3142
+ * ```ts
3143
+ * const { data, error } = await supabase
3144
+ * .from('instruments')
3145
+ * .upsert([
3146
+ * { id: 1, name: 'piano' },
3147
+ * { id: 2, name: 'harp' },
3148
+ * ])
3149
+ * .select()
3150
+ * ```
3151
+ *
3152
+ * @exampleSql Bulk Upsert your data
3153
+ * ```sql
3154
+ * create table
3155
+ * instruments (id int8 primary key, name text);
3156
+ *
3157
+ * insert into
3158
+ * instruments (id, name)
3159
+ * values
3160
+ * (1, 'harpsichord');
3161
+ * ```
3162
+ *
3163
+ * @exampleResponse Bulk Upsert your data
3164
+ * ```json
3165
+ * {
3166
+ * "data": [
3167
+ * {
3168
+ * "id": 1,
3169
+ * "name": "piano"
3170
+ * },
3171
+ * {
3172
+ * "id": 2,
3173
+ * "name": "harp"
3174
+ * }
3175
+ * ],
3176
+ * "status": 201,
3177
+ * "statusText": "Created"
3178
+ * }
3179
+ * ```
3180
+ *
3181
+ * @exampleDescription Upserting into tables with constraints
3182
+ * In the following query, `upsert()` implicitly uses the `id`
3183
+ * (primary key) column to determine conflicts. If there is no existing
3184
+ * row with the same `id`, `upsert()` inserts a new row, which
3185
+ * will fail in this case as there is already a row with `handle` `"saoirse"`.
3186
+ * Using the `onConflict` option, you can instruct `upsert()` to use
3187
+ * another column with a unique constraint to determine conflicts.
3188
+ *
3189
+ * @example Upserting into tables with constraints
3190
+ * ```ts
3191
+ * const { data, error } = await supabase
3192
+ * .from('users')
3193
+ * .upsert({ id: 42, handle: 'saoirse', display_name: 'Saoirse' })
3194
+ * .select()
3195
+ * ```
3196
+ *
3197
+ * @exampleSql Upserting into tables with constraints
3198
+ * ```sql
3199
+ * create table
3200
+ * users (
3201
+ * id int8 generated by default as identity primary key,
3202
+ * handle text not null unique,
3203
+ * display_name text
3204
+ * );
3205
+ *
3206
+ * insert into
3207
+ * users (id, handle, display_name)
3208
+ * values
3209
+ * (1, 'saoirse', null);
3210
+ * ```
3211
+ *
3212
+ * @exampleResponse Upserting into tables with constraints
3213
+ * ```json
3214
+ * {
3215
+ * "error": {
3216
+ * "code": "23505",
3217
+ * "details": "Key (handle)=(saoirse) already exists.",
3218
+ * "hint": null,
3219
+ * "message": "duplicate key value violates unique constraint \"users_handle_key\""
3220
+ * },
3221
+ * "status": 409,
3222
+ * "statusText": "Conflict"
3223
+ * }
3224
+ * ```
3225
+ */
3226
+ upsert<Row extends (Relation$1 extends {
3227
+ Insert: unknown;
3228
+ } ? Relation$1['Insert'] : never)>(values: RejectExcessProperties<Relation$1 extends {
3229
+ Insert: unknown;
3230
+ } ? Relation$1['Insert'] : never, Row> | RejectExcessProperties<Relation$1 extends {
3231
+ Insert: unknown;
3232
+ } ? Relation$1['Insert'] : never, Row>[], {
3233
+ onConflict,
3234
+ ignoreDuplicates,
3235
+ count,
3236
+ defaultToNull
3237
+ }?: {
3238
+ onConflict?: string;
3239
+ ignoreDuplicates?: boolean;
3240
+ count?: 'exact' | 'planned' | 'estimated' | (string & {});
3241
+ defaultToNull?: boolean;
3242
+ }): PostgrestFilterBuilder<ClientOptions, Schema, Relation$1['Row'], null, RelationName, Relationships, 'POST'>;
3243
+ /**
3244
+ * Perform an UPDATE on the table or view.
3245
+ *
3246
+ * By default, updated rows are not returned. To return it, chain the call
3247
+ * with `.select()` after filters.
3248
+ *
3249
+ * @param values - The values to update with
3250
+ *
3251
+ * @param options - Named parameters
3252
+ *
3253
+ * @param options.count - Count algorithm to use to count updated rows.
3254
+ *
3255
+ * `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the
3256
+ * hood.
3257
+ *
3258
+ * `"planned"`: Approximated but fast count algorithm. Uses the Postgres
3259
+ * statistics under the hood.
3260
+ *
3261
+ * `"estimated"`: Uses exact count for low numbers and planned count for high
3262
+ * numbers.
3263
+ *
3264
+ * @category Database
3265
+ *
3266
+ * @remarks
3267
+ * - `update()` should always be combined with [Filters](/docs/reference/javascript/using-filters) to target the item(s) you wish to update.
3268
+ *
3269
+ * @example Updating your data
3270
+ * ```ts
3271
+ * const { error } = await supabase
3272
+ * .from('instruments')
3273
+ * .update({ name: 'piano' })
3274
+ * .eq('id', 1)
3275
+ * ```
3276
+ *
3277
+ * @exampleSql Updating your data
3278
+ * ```sql
3279
+ * create table
3280
+ * instruments (id int8 primary key, name text);
3281
+ *
3282
+ * insert into
3283
+ * instruments (id, name)
3284
+ * values
3285
+ * (1, 'harpsichord');
3286
+ * ```
3287
+ *
3288
+ * @exampleResponse Updating your data
3289
+ * ```json
3290
+ * {
3291
+ * "status": 204,
3292
+ * "statusText": "No Content"
3293
+ * }
3294
+ * ```
3295
+ *
3296
+ * @example Update a record and return it
3297
+ * ```ts
3298
+ * const { data, error } = await supabase
3299
+ * .from('instruments')
3300
+ * .update({ name: 'piano' })
3301
+ * .eq('id', 1)
3302
+ * .select()
3303
+ * ```
3304
+ *
3305
+ * @exampleSql Update a record and return it
3306
+ * ```sql
3307
+ * create table
3308
+ * instruments (id int8 primary key, name text);
3309
+ *
3310
+ * insert into
3311
+ * instruments (id, name)
3312
+ * values
3313
+ * (1, 'harpsichord');
3314
+ * ```
3315
+ *
3316
+ * @exampleResponse Update a record and return it
3317
+ * ```json
3318
+ * {
3319
+ * "data": [
3320
+ * {
3321
+ * "id": 1,
3322
+ * "name": "piano"
3323
+ * }
3324
+ * ],
3325
+ * "status": 200,
3326
+ * "statusText": "OK"
3327
+ * }
3328
+ * ```
3329
+ *
3330
+ * @exampleDescription Updating JSON data
3331
+ * Postgres offers some
3332
+ * [operators](/docs/guides/database/json#query-the-jsonb-data) for
3333
+ * working with JSON data. Currently, it is only possible to update the entire JSON document.
3334
+ *
3335
+ * @example Updating JSON data
3336
+ * ```ts
3337
+ * const { data, error } = await supabase
3338
+ * .from('users')
3339
+ * .update({
3340
+ * address: {
3341
+ * street: 'Melrose Place',
3342
+ * postcode: 90210
3343
+ * }
3344
+ * })
3345
+ * .eq('address->postcode', 90210)
3346
+ * .select()
3347
+ * ```
3348
+ *
3349
+ * @exampleSql Updating JSON data
3350
+ * ```sql
3351
+ * create table
3352
+ * users (
3353
+ * id int8 primary key,
3354
+ * name text,
3355
+ * address jsonb
3356
+ * );
3357
+ *
3358
+ * insert into
3359
+ * users (id, name, address)
3360
+ * values
3361
+ * (1, 'Michael', '{ "postcode": 90210 }');
3362
+ * ```
3363
+ *
3364
+ * @exampleResponse Updating JSON data
3365
+ * ```json
3366
+ * {
3367
+ * "data": [
3368
+ * {
3369
+ * "id": 1,
3370
+ * "name": "Michael",
3371
+ * "address": {
3372
+ * "street": "Melrose Place",
3373
+ * "postcode": 90210
3374
+ * }
3375
+ * }
3376
+ * ],
3377
+ * "status": 200,
3378
+ * "statusText": "OK"
3379
+ * }
3380
+ * ```
3381
+ */
3382
+ update<Row extends (Relation$1 extends {
3383
+ Update: unknown;
3384
+ } ? Relation$1['Update'] : never)>(values: RejectExcessProperties<Relation$1 extends {
3385
+ Update: unknown;
3386
+ } ? Relation$1['Update'] : never, Row>, {
3387
+ count
3388
+ }?: {
3389
+ count?: 'exact' | 'planned' | 'estimated' | (string & {});
3390
+ }): PostgrestFilterBuilder<ClientOptions, Schema, Relation$1['Row'], null, RelationName, Relationships, 'PATCH'>;
3391
+ /**
3392
+ * Perform a DELETE on the table or view.
3393
+ *
3394
+ * By default, deleted rows are not returned. To return it, chain the call
3395
+ * with `.select()` after filters.
3396
+ *
3397
+ * @param options - Named parameters
3398
+ *
3399
+ * @param options.count - Count algorithm to use to count deleted rows.
3400
+ *
3401
+ * `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the
3402
+ * hood.
3403
+ *
3404
+ * `"planned"`: Approximated but fast count algorithm. Uses the Postgres
3405
+ * statistics under the hood.
3406
+ *
3407
+ * `"estimated"`: Uses exact count for low numbers and planned count for high
3408
+ * numbers.
3409
+ *
3410
+ * @category Database
3411
+ *
3412
+ * @remarks
3413
+ * - `delete()` should always be combined with [filters](/docs/reference/javascript/using-filters) to target the item(s) you wish to delete.
3414
+ * - If you use `delete()` with filters and you have
3415
+ * [RLS](/docs/learn/auth-deep-dive/auth-row-level-security) enabled, only
3416
+ * rows visible through `SELECT` policies are deleted. Note that by default
3417
+ * no rows are visible, so you need at least one `SELECT`/`ALL` policy that
3418
+ * makes the rows visible.
3419
+ * - 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.
3420
+ *
3421
+ * @example Delete a single record
3422
+ * ```ts
3423
+ * const response = await supabase
3424
+ * .from('countries')
3425
+ * .delete()
3426
+ * .eq('id', 1)
3427
+ * ```
3428
+ *
3429
+ * @exampleSql Delete a single record
3430
+ * ```sql
3431
+ * create table
3432
+ * countries (id int8 primary key, name text);
3433
+ *
3434
+ * insert into
3435
+ * countries (id, name)
3436
+ * values
3437
+ * (1, 'Mordor');
3438
+ * ```
3439
+ *
3440
+ * @exampleResponse Delete a single record
3441
+ * ```json
3442
+ * {
3443
+ * "status": 204,
3444
+ * "statusText": "No Content"
3445
+ * }
3446
+ * ```
3447
+ *
3448
+ * @example Delete a record and return it
3449
+ * ```ts
3450
+ * const { data, error } = await supabase
3451
+ * .from('countries')
3452
+ * .delete()
3453
+ * .eq('id', 1)
3454
+ * .select()
3455
+ * ```
3456
+ *
3457
+ * @exampleSql Delete a record and return it
3458
+ * ```sql
3459
+ * create table
3460
+ * countries (id int8 primary key, name text);
3461
+ *
3462
+ * insert into
3463
+ * countries (id, name)
3464
+ * values
3465
+ * (1, 'Mordor');
3466
+ * ```
3467
+ *
3468
+ * @exampleResponse Delete a record and return it
3469
+ * ```json
3470
+ * {
3471
+ * "data": [
3472
+ * {
3473
+ * "id": 1,
3474
+ * "name": "Mordor"
3475
+ * }
3476
+ * ],
3477
+ * "status": 200,
3478
+ * "statusText": "OK"
3479
+ * }
3480
+ * ```
3481
+ *
3482
+ * @example Delete multiple records
3483
+ * ```ts
3484
+ * const response = await supabase
3485
+ * .from('countries')
3486
+ * .delete()
3487
+ * .in('id', [1, 2, 3])
3488
+ * ```
3489
+ *
3490
+ * @exampleSql Delete multiple records
3491
+ * ```sql
3492
+ * create table
3493
+ * countries (id int8 primary key, name text);
3494
+ *
3495
+ * insert into
3496
+ * countries (id, name)
3497
+ * values
3498
+ * (1, 'Rohan'), (2, 'The Shire'), (3, 'Mordor');
3499
+ * ```
3500
+ *
3501
+ * @exampleResponse Delete multiple records
3502
+ * ```json
3503
+ * {
3504
+ * "status": 204,
3505
+ * "statusText": "No Content"
3506
+ * }
3507
+ * ```
3508
+ */
3509
+ delete({
3510
+ count
3511
+ }?: {
3512
+ count?: 'exact' | 'planned' | 'estimated' | (string & {});
3513
+ }): PostgrestFilterBuilder<ClientOptions, Schema, Relation$1['Row'], null, RelationName, Relationships, 'DELETE'>;
3514
+ }
3515
+ //#endregion
3516
+ //#region src/types/common/rpc.d.ts
3517
+ type IsMatchingArgs<FnArgs extends GenericFunction['Args'], PassedArgs extends GenericFunction['Args']> = [FnArgs] extends [Record<PropertyKey, never>] ? PassedArgs extends Record<PropertyKey, never> ? true : false : keyof PassedArgs extends keyof FnArgs ? PassedArgs extends FnArgs ? true : false : false;
3518
+ type MatchingFunctionArgs<Fn$1 extends GenericFunction, Args extends GenericFunction['Args']> = Fn$1 extends {
3519
+ Args: infer A extends GenericFunction['Args'];
3520
+ } ? IsMatchingArgs<A, Args> extends true ? Fn$1 : never : false;
3521
+ type FindMatchingFunctionByArgs<FnUnion, Args extends GenericFunction['Args']> = FnUnion extends infer Fn extends GenericFunction ? MatchingFunctionArgs<Fn, Args> : false;
3522
+ type TablesAndViews$1<Schema extends GenericSchema> = Schema['Tables'] & Exclude<Schema['Views'], ''>;
3523
+ type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
3524
+ type LastOf<T> = UnionToIntersection<T extends any ? () => T : never> extends (() => infer R) ? R : never;
3525
+ type IsAny<T> = 0 extends 1 & T ? true : false;
3526
+ type ExactMatch<T, S> = [T] extends [S] ? ([S] extends [T] ? true : false) : false;
3527
+ type ExtractExactFunction<Fns, Args> = Fns extends infer F ? F extends GenericFunction ? ExactMatch<F['Args'], Args> extends true ? F : never : never : never;
3528
+ type IsNever<T> = [T] extends [never] ? true : false;
3529
+ type RpcFunctionNotFound<FnName> = {
3530
+ Row: any;
3531
+ Result: {
3532
+ error: true;
3533
+ } & "Couldn't infer function definition matching provided arguments";
3534
+ RelationName: FnName;
3535
+ Relationships: null;
3536
+ };
3537
+ type CrossSchemaError<TableRef extends string> = {
3538
+ error: true;
3539
+ } & `Function returns SETOF from a different schema ('${TableRef}'). Use .overrideTypes<YourReturnType>() to specify the return type explicitly.`;
3540
+ type GetRpcFunctionFilterBuilderByArgs<Schema extends GenericSchema, FnName extends string & keyof Schema['Functions'], Args> = {
3541
+ 0: Schema['Functions'][FnName];
3542
+ 1: IsAny<Schema> extends true ? any : IsNever<Args> extends true ? IsNever<ExtractExactFunction<Schema['Functions'][FnName], Args>> extends true ? LastOf<Schema['Functions'][FnName]> : ExtractExactFunction<Schema['Functions'][FnName], Args> : Args extends Record<PropertyKey, never> ? LastOf<Schema['Functions'][FnName]> : Args extends GenericFunction['Args'] ? IsNever<LastOf<FindMatchingFunctionByArgs<Schema['Functions'][FnName], Args>>> extends true ? LastOf<Schema['Functions'][FnName]> : LastOf<FindMatchingFunctionByArgs<Schema['Functions'][FnName], Args>> : ExtractExactFunction<Schema['Functions'][FnName], Args> extends GenericFunction ? ExtractExactFunction<Schema['Functions'][FnName], Args> : any;
3543
+ }[1] extends infer Fn ? IsAny<Fn> extends true ? {
3544
+ Row: any;
3545
+ Result: any;
3546
+ RelationName: FnName;
3547
+ Relationships: null;
3548
+ } : Fn extends GenericFunction ? {
3549
+ Row: Fn['SetofOptions'] extends GenericSetofOption ? Fn['SetofOptions']['to'] extends keyof TablesAndViews$1<Schema> ? TablesAndViews$1<Schema>[Fn['SetofOptions']['to']]['Row'] : Fn['Returns'] extends any[] ? Fn['Returns'][number] extends Record<string, unknown> ? Fn['Returns'][number] : CrossSchemaError<Fn['SetofOptions']['to'] & string> : Fn['Returns'] extends Record<string, unknown> ? Fn['Returns'] : CrossSchemaError<Fn['SetofOptions']['to'] & string> : Fn['Returns'] extends any[] ? Fn['Returns'][number] extends Record<string, unknown> ? Fn['Returns'][number] : never : Fn['Returns'] extends Record<string, unknown> ? Fn['Returns'] : never;
3550
+ Result: Fn['SetofOptions'] extends GenericSetofOption ? Fn['SetofOptions']['isSetofReturn'] extends true ? Fn['SetofOptions']['isOneToOne'] extends true ? Fn['Returns'][] : Fn['Returns'] : Fn['Returns'] : Fn['Returns'];
3551
+ RelationName: Fn['SetofOptions'] extends GenericSetofOption ? Fn['SetofOptions']['to'] : FnName;
3552
+ Relationships: Fn['SetofOptions'] extends GenericSetofOption ? Fn['SetofOptions']['to'] extends keyof Schema['Tables'] ? Schema['Tables'][Fn['SetofOptions']['to']]['Relationships'] : Fn['SetofOptions']['to'] extends keyof Schema['Views'] ? Schema['Views'][Fn['SetofOptions']['to']]['Relationships'] : null : null;
3553
+ } : Fn extends false ? RpcFunctionNotFound<FnName> : RpcFunctionNotFound<FnName> : RpcFunctionNotFound<FnName>;
3554
+ //#endregion
3555
+ //#region src/PostgrestClient.d.ts
3556
+ /**
3557
+ * PostgREST client.
3558
+ *
3559
+ * @typeParam Database - Types for the schema from the [type
3560
+ * generator](https://supabase.com/docs/reference/javascript/next/typescript-support)
3561
+ *
3562
+ * @typeParam SchemaName - Postgres schema to switch to. Must be a string
3563
+ * literal, the same one passed to the constructor. If the schema is not
3564
+ * `"public"`, this must be supplied manually.
3565
+ */
3566
+ declare class PostgrestClient<Database = any, ClientOptions extends ClientServerOptions = (Database extends {
3567
+ __InternalSupabase: infer I extends ClientServerOptions;
3568
+ } ? I : {}), SchemaName extends string & keyof Omit<Database, '__InternalSupabase'> = ('public' extends keyof Omit<Database, '__InternalSupabase'> ? 'public' : string & keyof Omit<Database, '__InternalSupabase'>), Schema extends GenericSchema = (Omit<Database, '__InternalSupabase'>[SchemaName] extends GenericSchema ? Omit<Database, '__InternalSupabase'>[SchemaName] : any)> {
3569
+ url: string;
3570
+ headers: Headers;
3571
+ schemaName?: SchemaName;
3572
+ fetch?: Fetch;
3573
+ urlLengthLimit: number;
3574
+ retry?: boolean;
3575
+ /**
3576
+ * Creates a PostgREST client.
3577
+ *
3578
+ * @param url - URL of the PostgREST endpoint
3579
+ * @param options - Named parameters
3580
+ * @param options.headers - Custom headers
3581
+ * @param options.schema - Postgres schema to switch to
3582
+ * @param options.fetch - Custom fetch
3583
+ * @param options.timeout - Optional timeout in milliseconds for all requests. When set, requests will automatically abort after this duration to prevent indefinite hangs.
3584
+ * @param options.urlLengthLimit - Maximum URL length in characters before warnings/errors are triggered. Defaults to 8000.
3585
+ * @param options.retry - Enable or disable automatic retries for transient errors.
3586
+ * When enabled, idempotent requests (GET, HEAD, OPTIONS) that fail with network
3587
+ * errors or HTTP 503/520 responses will be automatically retried up to 3 times
3588
+ * with exponential backoff (1s, 2s, 4s). Defaults to `true`.
3589
+ * @example Using supabase-js (recommended)
3590
+ * ```ts
3591
+ * import { createClient } from '@supabase/supabase-js'
3592
+ *
3593
+ * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')
3594
+ * const { data, error } = await supabase.from('profiles').select('*')
3595
+ * ```
3596
+ *
3597
+ * @category Database
3598
+ *
3599
+ * @remarks
3600
+ * - A `timeout` option (in milliseconds) can be set to automatically abort requests that take too long.
3601
+ * - A `urlLengthLimit` option (default: 8000) can be set to control when URL length warnings are included in error messages for aborted requests.
3602
+ *
3603
+ * @example Standalone import for bundle-sensitive environments
3604
+ * ```ts
3605
+ * import { PostgrestClient } from '@supabase/postgrest-js'
3606
+ *
3607
+ * const postgrest = new PostgrestClient('https://xyzcompany.supabase.co/rest/v1', {
3608
+ * headers: { apikey: 'your-publishable-key' },
3609
+ * schema: 'public',
3610
+ * timeout: 30000, // 30 second timeout
3611
+ * })
3612
+ * ```
3613
+ */
3614
+ constructor(url: string, {
3615
+ headers,
3616
+ schema,
3617
+ fetch,
3618
+ timeout,
3619
+ urlLengthLimit,
3620
+ retry
3621
+ }?: {
3622
+ headers?: HeadersInit;
3623
+ schema?: SchemaName;
3624
+ fetch?: Fetch;
3625
+ timeout?: number;
3626
+ urlLengthLimit?: number;
3627
+ retry?: boolean;
3628
+ });
3629
+ from<TableName$1 extends string & keyof Schema['Tables'], Table extends Schema['Tables'][TableName$1]>(relation: TableName$1): PostgrestQueryBuilder<ClientOptions, Schema, Table, TableName$1>;
3630
+ from<ViewName extends string & keyof Schema['Views'], View extends Schema['Views'][ViewName]>(relation: ViewName): PostgrestQueryBuilder<ClientOptions, Schema, View, ViewName>;
3631
+ /**
3632
+ * Select a schema to query or perform an function (rpc) call.
3633
+ *
3634
+ * The schema needs to be on the list of exposed schemas inside Supabase.
3635
+ *
3636
+ * @param schema - The schema to query
3637
+ *
3638
+ * @category Database
3639
+ */
3640
+ schema<DynamicSchema extends string & keyof Omit<Database, '__InternalSupabase'>>(schema: DynamicSchema): PostgrestClient<Database, ClientOptions, DynamicSchema, Database[DynamicSchema] extends GenericSchema ? Database[DynamicSchema] : any>;
3641
+ /**
3642
+ * Perform a function call.
3643
+ *
3644
+ * @param fn - The function name to call
3645
+ * @param args - The arguments to pass to the function call
3646
+ * @param options - Named parameters
3647
+ * @param options.head - When set to `true`, `data` will not be returned.
3648
+ * Useful if you only need the count.
3649
+ * @param options.get - When set to `true`, the function will be called with
3650
+ * read-only access mode.
3651
+ * @param options.count - Count algorithm to use to count rows returned by the
3652
+ * function. Only applicable for [set-returning
3653
+ * functions](https://www.postgresql.org/docs/current/functions-srf.html).
3654
+ *
3655
+ * `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the
3656
+ * hood.
3657
+ *
3658
+ * `"planned"`: Approximated but fast count algorithm. Uses the Postgres
3659
+ * statistics under the hood.
3660
+ *
3661
+ * `"estimated"`: Uses exact count for low numbers and planned count for high
3662
+ * numbers.
3663
+ *
3664
+ * @example
3665
+ * ```ts
3666
+ * // For cross-schema functions where type inference fails, use overrideTypes:
3667
+ * const { data } = await supabase
3668
+ * .schema('schema_b')
3669
+ * .rpc('function_a', {})
3670
+ * .overrideTypes<{ id: string; user_id: string }[]>()
3671
+ * ```
3672
+ *
3673
+ * @category Database
3674
+ *
3675
+ * @example Call a Postgres function without arguments
3676
+ * ```ts
3677
+ * const { data, error } = await supabase.rpc('hello_world')
3678
+ * ```
3679
+ *
3680
+ * @exampleSql Call a Postgres function without arguments
3681
+ * ```sql
3682
+ * create function hello_world() returns text as $$
3683
+ * select 'Hello world';
3684
+ * $$ language sql;
3685
+ * ```
3686
+ *
3687
+ * @exampleResponse Call a Postgres function without arguments
3688
+ * ```json
3689
+ * {
3690
+ * "data": "Hello world",
3691
+ * "status": 200,
3692
+ * "statusText": "OK"
3693
+ * }
3694
+ * ```
3695
+ *
3696
+ * @example Call a Postgres function with arguments
3697
+ * ```ts
3698
+ * const { data, error } = await supabase.rpc('echo', { say: '👋' })
3699
+ * ```
3700
+ *
3701
+ * @exampleSql Call a Postgres function with arguments
3702
+ * ```sql
3703
+ * create function echo(say text) returns text as $$
3704
+ * select say;
3705
+ * $$ language sql;
3706
+ * ```
3707
+ *
3708
+ * @exampleResponse Call a Postgres function with arguments
3709
+ * ```json
3710
+ * {
3711
+ * "data": "👋",
3712
+ * "status": 200,
3713
+ * "statusText": "OK"
3714
+ * }
3715
+ *
3716
+ * ```
3717
+ *
3718
+ * @exampleDescription Bulk processing
3719
+ * You can process large payloads by passing in an array as an argument.
3720
+ *
3721
+ * @example Bulk processing
3722
+ * ```ts
3723
+ * const { data, error } = await supabase.rpc('add_one_each', { arr: [1, 2, 3] })
3724
+ * ```
3725
+ *
3726
+ * @exampleSql Bulk processing
3727
+ * ```sql
3728
+ * create function add_one_each(arr int[]) returns int[] as $$
3729
+ * select array_agg(n + 1) from unnest(arr) as n;
3730
+ * $$ language sql;
3731
+ * ```
3732
+ *
3733
+ * @exampleResponse Bulk processing
3734
+ * ```json
3735
+ * {
3736
+ * "data": [
3737
+ * 2,
3738
+ * 3,
3739
+ * 4
3740
+ * ],
3741
+ * "status": 200,
3742
+ * "statusText": "OK"
3743
+ * }
3744
+ * ```
3745
+ *
3746
+ * @exampleDescription Call a Postgres function with filters
3747
+ * Postgres functions that return tables can also be combined with [Filters](/docs/reference/javascript/using-filters) and [Modifiers](/docs/reference/javascript/using-modifiers).
3748
+ *
3749
+ * @example Call a Postgres function with filters
3750
+ * ```ts
3751
+ * const { data, error } = await supabase
3752
+ * .rpc('list_stored_countries')
3753
+ * .eq('id', 1)
3754
+ * .single()
3755
+ * ```
3756
+ *
3757
+ * @exampleSql Call a Postgres function with filters
3758
+ * ```sql
3759
+ * create table
3760
+ * countries (id int8 primary key, name text);
3761
+ *
3762
+ * insert into
3763
+ * countries (id, name)
3764
+ * values
3765
+ * (1, 'Rohan'),
3766
+ * (2, 'The Shire');
3767
+ *
3768
+ * create function list_stored_countries() returns setof countries as $$
3769
+ * select * from countries;
3770
+ * $$ language sql;
3771
+ * ```
3772
+ *
3773
+ * @exampleResponse Call a Postgres function with filters
3774
+ * ```json
3775
+ * {
3776
+ * "data": {
3777
+ * "id": 1,
3778
+ * "name": "Rohan"
3779
+ * },
3780
+ * "status": 200,
3781
+ * "statusText": "OK"
3782
+ * }
3783
+ * ```
3784
+ *
3785
+ * @example Call a read-only Postgres function
3786
+ * ```ts
3787
+ * const { data, error } = await supabase.rpc('hello_world', undefined, { get: true })
3788
+ * ```
3789
+ *
3790
+ * @exampleSql Call a read-only Postgres function
3791
+ * ```sql
3792
+ * create function hello_world() returns text as $$
3793
+ * select 'Hello world';
3794
+ * $$ language sql;
3795
+ * ```
3796
+ *
3797
+ * @exampleResponse Call a read-only Postgres function
3798
+ * ```json
3799
+ * {
3800
+ * "data": "Hello world",
3801
+ * "status": 200,
3802
+ * "statusText": "OK"
3803
+ * }
3804
+ * ```
3805
+ */
3806
+ rpc<FnName extends string & keyof Schema['Functions'], Args extends Schema['Functions'][FnName]['Args'] = never, FilterBuilder extends GetRpcFunctionFilterBuilderByArgs<Schema, FnName, Args> = GetRpcFunctionFilterBuilderByArgs<Schema, FnName, Args>>(fn: FnName, args?: Args, {
3807
+ head,
3808
+ get,
3809
+ count
3810
+ }?: {
3811
+ head?: boolean;
3812
+ get?: boolean;
3813
+ count?: 'exact' | 'planned' | 'estimated' | (string & {});
3814
+ }): PostgrestFilterBuilder<ClientOptions, Schema, FilterBuilder['Row'], FilterBuilder['Result'], FilterBuilder['RelationName'], FilterBuilder['Relationships'], 'RPC'>;
3815
+ }
3816
+ //#endregion
3817
+ //#region src/index.d.ts
3818
+ declare const _default: {
3819
+ PostgrestClient: typeof PostgrestClient;
3820
+ PostgrestQueryBuilder: typeof PostgrestQueryBuilder;
3821
+ PostgrestFilterBuilder: typeof PostgrestFilterBuilder;
3822
+ PostgrestTransformBuilder: typeof PostgrestTransformBuilder;
3823
+ PostgrestBuilder: typeof PostgrestBuilder;
3824
+ PostgrestError: typeof PostgrestError;
3825
+ };
3826
+ //#endregion
3827
+ export { PostgrestBuilder, PostgrestClient, type ClientServerOptions as PostgrestClientOptions, PostgrestError, PostgrestFilterBuilder, type PostgrestMaybeSingleResponse, PostgrestQueryBuilder, type PostgrestResponse, type PostgrestResponseFailure, type PostgrestResponseSuccess, type PostgrestSingleResponse, PostgrestTransformBuilder, type GetResult as UnstableGetResult, _default as default };
3828
+ //# sourceMappingURL=index.d.cts.map