@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,1118 @@
1
+ import { CHANNEL_EVENTS, CHANNEL_STATES } from './lib/constants'
2
+ import type { ChannelState } from './lib/constants'
3
+ import type RealtimeClient from './RealtimeClient'
4
+ import RealtimePresence, { REALTIME_PRESENCE_LISTEN_EVENTS } from './RealtimePresence'
5
+ import type {
6
+ RealtimePresenceJoinPayload,
7
+ RealtimePresenceLeavePayload,
8
+ RealtimePresenceState,
9
+ } from './RealtimePresence'
10
+ import * as Transformers from './lib/transformers'
11
+ import { httpEndpointURL } from './lib/transformers'
12
+ import { normalizeChannelError } from './lib/normalizeChannelError'
13
+ import ChannelAdapter from './phoenix/channelAdapter'
14
+ import { ChannelBindingCallback, ChannelOnErrorCallback } from './phoenix/types'
15
+ import type { Timer } from './phoenix/types'
16
+
17
+ type ReplayOption = {
18
+ since: number
19
+ limit?: number
20
+ }
21
+
22
+ export type RealtimeChannelOptions = {
23
+ config: {
24
+ /**
25
+ * self option enables client to receive message it broadcast
26
+ * ack option instructs server to acknowledge that broadcast message was received
27
+ * replay option instructs server to replay broadcast messages
28
+ */
29
+ broadcast?: { self?: boolean; ack?: boolean; replay?: ReplayOption }
30
+ /**
31
+ * key option is used to track presence payload across clients
32
+ */
33
+ presence?: { key?: string; enabled?: boolean }
34
+ /**
35
+ * defines if the channel is private or not and if RLS policies will be used to check data
36
+ */
37
+ private?: boolean
38
+ }
39
+ }
40
+
41
+ type RealtimeChangesPayloadBase = {
42
+ schema: string
43
+ table: string
44
+ }
45
+
46
+ type RealtimeBroadcastChangesPayloadBase = RealtimeChangesPayloadBase & {
47
+ id: string
48
+ }
49
+
50
+ export type RealtimeBroadcastInsertPayload<T extends { [key: string]: any }> =
51
+ RealtimeBroadcastChangesPayloadBase & {
52
+ operation: `${REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.INSERT}`
53
+ record: T
54
+ old_record: null
55
+ }
56
+
57
+ export type RealtimeBroadcastUpdatePayload<T extends { [key: string]: any }> =
58
+ RealtimeBroadcastChangesPayloadBase & {
59
+ operation: `${REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.UPDATE}`
60
+ record: T
61
+ old_record: T
62
+ }
63
+
64
+ export type RealtimeBroadcastDeletePayload<T extends { [key: string]: any }> =
65
+ RealtimeBroadcastChangesPayloadBase & {
66
+ operation: `${REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.DELETE}`
67
+ record: null
68
+ old_record: T
69
+ }
70
+
71
+ export type RealtimeBroadcastPayload<T extends { [key: string]: any }> =
72
+ | RealtimeBroadcastInsertPayload<T>
73
+ | RealtimeBroadcastUpdatePayload<T>
74
+ | RealtimeBroadcastDeletePayload<T>
75
+
76
+ type RealtimePostgresChangesPayloadBase = {
77
+ schema: string
78
+ table: string
79
+ commit_timestamp: string
80
+ errors: string[]
81
+ }
82
+
83
+ export type RealtimePostgresInsertPayload<T extends { [key: string]: any }> =
84
+ RealtimePostgresChangesPayloadBase & {
85
+ eventType: `${REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.INSERT}`
86
+ new: T
87
+ old: {}
88
+ }
89
+
90
+ export type RealtimePostgresUpdatePayload<T extends { [key: string]: any }> =
91
+ RealtimePostgresChangesPayloadBase & {
92
+ eventType: `${REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.UPDATE}`
93
+ new: T
94
+ old: Partial<T>
95
+ }
96
+
97
+ export type RealtimePostgresDeletePayload<T extends { [key: string]: any }> =
98
+ RealtimePostgresChangesPayloadBase & {
99
+ eventType: `${REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.DELETE}`
100
+ new: {}
101
+ old: Partial<T>
102
+ }
103
+
104
+ export type RealtimePostgresChangesPayload<T extends { [key: string]: any }> =
105
+ | RealtimePostgresInsertPayload<T>
106
+ | RealtimePostgresUpdatePayload<T>
107
+ | RealtimePostgresDeletePayload<T>
108
+
109
+ export type RealtimePostgresChangesFilter<T extends `${REALTIME_POSTGRES_CHANGES_LISTEN_EVENT}`> = {
110
+ /**
111
+ * The type of database change to listen to.
112
+ */
113
+ event: T
114
+ /**
115
+ * The database schema to listen to.
116
+ */
117
+ schema: string
118
+ /**
119
+ * The database table to listen to.
120
+ */
121
+ table?: string
122
+ /**
123
+ * Receive database changes when filter is matched.
124
+ */
125
+ filter?: string
126
+ }
127
+
128
+ export type RealtimeChannelSendResponse = 'ok' | 'timed out' | 'error' | (string & {})
129
+
130
+ export enum REALTIME_POSTGRES_CHANGES_LISTEN_EVENT {
131
+ ALL = '*',
132
+ INSERT = 'INSERT',
133
+ UPDATE = 'UPDATE',
134
+ DELETE = 'DELETE',
135
+ }
136
+
137
+ export enum REALTIME_LISTEN_TYPES {
138
+ BROADCAST = 'broadcast',
139
+ PRESENCE = 'presence',
140
+ POSTGRES_CHANGES = 'postgres_changes',
141
+ SYSTEM = 'system',
142
+ }
143
+
144
+ export enum REALTIME_SUBSCRIBE_STATES {
145
+ SUBSCRIBED = 'SUBSCRIBED',
146
+ TIMED_OUT = 'TIMED_OUT',
147
+ CLOSED = 'CLOSED',
148
+ CHANNEL_ERROR = 'CHANNEL_ERROR',
149
+ }
150
+
151
+ export const REALTIME_CHANNEL_STATES = CHANNEL_STATES
152
+
153
+ type PostgresChangesFilters = {
154
+ postgres_changes: {
155
+ id: string
156
+ event: string
157
+ schema?: string
158
+ table?: string
159
+ filter?: string
160
+ }[]
161
+ }
162
+
163
+ type Binding = {
164
+ type: string
165
+ filter: { [key: string]: any }
166
+ callback: ChannelBindingCallback
167
+ ref: number
168
+ id?: string
169
+ }
170
+
171
+ /** A channel is the basic building block of Realtime
172
+ * and narrows the scope of data flow to subscribed clients.
173
+ * You can think of a channel as a chatroom where participants are able to see who's online
174
+ * and send and receive messages.
175
+ */
176
+ export default class RealtimeChannel {
177
+ bindings: Record<string, Binding[]> = {}
178
+ subTopic: string
179
+ broadcastEndpointURL: string
180
+ private: boolean
181
+ presence: RealtimePresence
182
+ /** @internal */
183
+ channelAdapter: ChannelAdapter
184
+
185
+ get state() {
186
+ return this.channelAdapter.state
187
+ }
188
+
189
+ set state(state: ChannelState) {
190
+ this.channelAdapter.state = state
191
+ }
192
+
193
+ get joinedOnce() {
194
+ return this.channelAdapter.joinedOnce
195
+ }
196
+
197
+ get timeout() {
198
+ return this.socket.timeout
199
+ }
200
+
201
+ get joinPush() {
202
+ return this.channelAdapter.joinPush
203
+ }
204
+
205
+ get rejoinTimer(): Timer {
206
+ return this.channelAdapter.rejoinTimer
207
+ }
208
+
209
+ /**
210
+ * Creates a channel that can broadcast messages, sync presence, and listen to Postgres changes.
211
+ *
212
+ * The topic determines which realtime stream you are subscribing to. Config options let you
213
+ * enable acknowledgement for broadcasts, presence tracking, or private channels.
214
+ *
215
+ * @category Realtime
216
+ *
217
+ * @example Using supabase-js (recommended)
218
+ * ```ts
219
+ * import { createClient } from '@supabase/supabase-js'
220
+ *
221
+ * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')
222
+ * const channel = supabase.channel('room1')
223
+ * channel
224
+ * .on('broadcast', { event: 'cursor-pos' }, (payload) => console.log(payload))
225
+ * .subscribe()
226
+ * ```
227
+ *
228
+ * @example Standalone import for bundle-sensitive environments
229
+ * ```ts
230
+ * import RealtimeClient from '@supabase/realtime-js'
231
+ *
232
+ * const client = new RealtimeClient('https://xyzcompany.supabase.co/realtime/v1', {
233
+ * params: { apikey: 'your-publishable-key' },
234
+ * })
235
+ * const channel = new RealtimeChannel('realtime:public:messages', { config: {} }, client)
236
+ * ```
237
+ */
238
+ constructor(
239
+ /** Topic name can be any string. */
240
+ public topic: string,
241
+ public params: RealtimeChannelOptions = { config: {} },
242
+ public socket: RealtimeClient
243
+ ) {
244
+ this.subTopic = topic.replace(/^realtime:/i, '')
245
+ this.params.config = {
246
+ ...{
247
+ broadcast: { ack: false, self: false },
248
+ presence: { key: '', enabled: false },
249
+ private: false,
250
+ },
251
+ ...params.config,
252
+ }
253
+
254
+ this.channelAdapter = new ChannelAdapter(this.socket.socketAdapter, topic, this.params)
255
+ this.presence = new RealtimePresence(this)
256
+
257
+ this._onClose(() => {
258
+ this.socket._remove(this)
259
+ })
260
+
261
+ this._updateFilterTransform()
262
+
263
+ this.broadcastEndpointURL = httpEndpointURL(this.socket.socketAdapter.endPointURL())
264
+ this.private = this.params.config.private || false
265
+
266
+ if (!this.private && this.params.config?.broadcast?.replay) {
267
+ throw new Error(
268
+ `tried to use replay on public channel '${this.topic}'. It must be a private channel.`
269
+ )
270
+ }
271
+ }
272
+
273
+ /**
274
+ * Subscribe registers your client with the server
275
+ * @category Realtime
276
+ */
277
+ subscribe(
278
+ callback?: (status: REALTIME_SUBSCRIBE_STATES, err?: Error) => void,
279
+ timeout = this.timeout
280
+ ): RealtimeChannel {
281
+ if (!this.socket.isConnected()) {
282
+ this.socket.connect()
283
+ }
284
+ if (this.channelAdapter.isClosed()) {
285
+ const {
286
+ config: { broadcast, presence, private: isPrivate },
287
+ } = this.params
288
+
289
+ const postgres_changes = this.bindings.postgres_changes?.map((r) => r.filter) ?? []
290
+
291
+ const presence_enabled =
292
+ (!!this.bindings[REALTIME_LISTEN_TYPES.PRESENCE] &&
293
+ this.bindings[REALTIME_LISTEN_TYPES.PRESENCE].length > 0) ||
294
+ this.params.config.presence?.enabled === true
295
+ const accessTokenPayload: { access_token?: string } = {}
296
+ const config = {
297
+ broadcast,
298
+ presence: { ...presence, enabled: presence_enabled },
299
+ postgres_changes,
300
+ private: isPrivate,
301
+ }
302
+
303
+ if (this.socket.accessTokenValue) {
304
+ accessTokenPayload.access_token = this.socket.accessTokenValue
305
+ }
306
+
307
+ this._onError((reason: unknown) => {
308
+ callback?.(REALTIME_SUBSCRIBE_STATES.CHANNEL_ERROR, normalizeChannelError(reason))
309
+ })
310
+
311
+ this._onClose(() => callback?.(REALTIME_SUBSCRIBE_STATES.CLOSED))
312
+
313
+ this.updateJoinPayload({ ...{ config }, ...accessTokenPayload })
314
+
315
+ this._updateFilterMessage()
316
+
317
+ this.channelAdapter
318
+ .subscribe(timeout)
319
+ .receive('ok', async ({ postgres_changes }: PostgresChangesFilters) => {
320
+ // Only refresh auth if using callback-based tokens
321
+ if (!this.socket._isManualToken()) {
322
+ this.socket.setAuth()
323
+ }
324
+ if (postgres_changes === undefined) {
325
+ callback?.(REALTIME_SUBSCRIBE_STATES.SUBSCRIBED)
326
+ return
327
+ }
328
+
329
+ this._updatePostgresBindings(postgres_changes, callback)
330
+ })
331
+ .receive('error', (error: { [key: string]: any }) => {
332
+ this.state = CHANNEL_STATES.errored
333
+ const message = Object.values(error).join(', ') || 'error'
334
+ callback?.(REALTIME_SUBSCRIBE_STATES.CHANNEL_ERROR, new Error(message, { cause: error }))
335
+ })
336
+ .receive('timeout', () => {
337
+ callback?.(REALTIME_SUBSCRIBE_STATES.TIMED_OUT)
338
+ })
339
+ }
340
+ return this
341
+ }
342
+
343
+ private _updatePostgresBindings(
344
+ postgres_changes: PostgresChangesFilters['postgres_changes'],
345
+ callback?: (status: REALTIME_SUBSCRIBE_STATES, err?: Error) => void
346
+ ) {
347
+ const clientPostgresBindings = this.bindings.postgres_changes
348
+ const bindingsLen = clientPostgresBindings?.length ?? 0
349
+ const newPostgresBindings = []
350
+
351
+ for (let i = 0; i < bindingsLen; i++) {
352
+ const clientPostgresBinding = clientPostgresBindings[i]
353
+ const {
354
+ filter: { event, schema, table, filter },
355
+ } = clientPostgresBinding
356
+ const serverPostgresFilter = postgres_changes && postgres_changes[i]
357
+
358
+ if (
359
+ serverPostgresFilter &&
360
+ serverPostgresFilter.event === event &&
361
+ RealtimeChannel.isFilterValueEqual(serverPostgresFilter.schema, schema) &&
362
+ RealtimeChannel.isFilterValueEqual(serverPostgresFilter.table, table) &&
363
+ RealtimeChannel.isFilterValueEqual(serverPostgresFilter.filter, filter)
364
+ ) {
365
+ newPostgresBindings.push({
366
+ ...clientPostgresBinding,
367
+ id: serverPostgresFilter.id,
368
+ })
369
+ } else {
370
+ this.unsubscribe()
371
+ this.state = CHANNEL_STATES.errored
372
+
373
+ callback?.(
374
+ REALTIME_SUBSCRIBE_STATES.CHANNEL_ERROR,
375
+ new Error('mismatch between server and client bindings for postgres changes')
376
+ )
377
+ return
378
+ }
379
+ }
380
+
381
+ this.bindings.postgres_changes = newPostgresBindings
382
+
383
+ if (this.state != CHANNEL_STATES.errored && callback) {
384
+ callback(REALTIME_SUBSCRIBE_STATES.SUBSCRIBED)
385
+ }
386
+ }
387
+
388
+ /**
389
+ * Returns the current presence state for this channel.
390
+ *
391
+ * The shape is a map keyed by presence key (for example a user id) where each entry contains the
392
+ * tracked metadata for that user.
393
+ *
394
+ * @category Realtime
395
+ */
396
+ presenceState<T extends { [key: string]: any } = {}>(): RealtimePresenceState<T> {
397
+ return this.presence.state as RealtimePresenceState<T>
398
+ }
399
+
400
+ /**
401
+ * Sends the supplied payload to the presence tracker so other subscribers can see that this
402
+ * client is online. Use `untrack` to stop broadcasting presence for the same key.
403
+ *
404
+ * @category Realtime
405
+ */
406
+ async track(
407
+ payload: { [key: string]: any },
408
+ opts: { [key: string]: any } = {}
409
+ ): Promise<RealtimeChannelSendResponse> {
410
+ return await this.send(
411
+ {
412
+ type: 'presence',
413
+ event: 'track',
414
+ payload,
415
+ },
416
+ opts.timeout || this.timeout
417
+ )
418
+ }
419
+
420
+ /**
421
+ * Removes the current presence state for this client.
422
+ *
423
+ * @category Realtime
424
+ */
425
+ async untrack(opts: { [key: string]: any } = {}): Promise<RealtimeChannelSendResponse> {
426
+ return await this.send(
427
+ {
428
+ type: 'presence',
429
+ event: 'untrack',
430
+ },
431
+ opts
432
+ )
433
+ }
434
+
435
+ /**
436
+ * Creates an event handler that listens to changes.
437
+ */
438
+ on(
439
+ type: `${REALTIME_LISTEN_TYPES.PRESENCE}`,
440
+ filter: { event: `${REALTIME_PRESENCE_LISTEN_EVENTS.SYNC}` },
441
+ callback: () => void
442
+ ): RealtimeChannel
443
+ on<T extends { [key: string]: any }>(
444
+ type: `${REALTIME_LISTEN_TYPES.PRESENCE}`,
445
+ filter: { event: `${REALTIME_PRESENCE_LISTEN_EVENTS.JOIN}` },
446
+ callback: (payload: RealtimePresenceJoinPayload<T>) => void
447
+ ): RealtimeChannel
448
+ on<T extends { [key: string]: any }>(
449
+ type: `${REALTIME_LISTEN_TYPES.PRESENCE}`,
450
+ filter: { event: `${REALTIME_PRESENCE_LISTEN_EVENTS.LEAVE}` },
451
+ callback: (payload: RealtimePresenceLeavePayload<T>) => void
452
+ ): RealtimeChannel
453
+ on<T extends { [key: string]: any }>(
454
+ type: `${REALTIME_LISTEN_TYPES.PRESENCE}`,
455
+ filter: { event: '*' },
456
+ callback: (payload?: RealtimePresenceJoinPayload<T> | RealtimePresenceLeavePayload<T>) => void
457
+ ): RealtimeChannel
458
+ on<T extends { [key: string]: any }>(
459
+ type: `${REALTIME_LISTEN_TYPES.POSTGRES_CHANGES}`,
460
+ filter: RealtimePostgresChangesFilter<`${REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.ALL}`>,
461
+ callback: (payload: RealtimePostgresChangesPayload<T>) => void
462
+ ): RealtimeChannel
463
+ on<T extends { [key: string]: any }>(
464
+ type: `${REALTIME_LISTEN_TYPES.POSTGRES_CHANGES}`,
465
+ filter: RealtimePostgresChangesFilter<`${REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.INSERT}`>,
466
+ callback: (payload: RealtimePostgresInsertPayload<T>) => void
467
+ ): RealtimeChannel
468
+ on<T extends { [key: string]: any }>(
469
+ type: `${REALTIME_LISTEN_TYPES.POSTGRES_CHANGES}`,
470
+ filter: RealtimePostgresChangesFilter<`${REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.UPDATE}`>,
471
+ callback: (payload: RealtimePostgresUpdatePayload<T>) => void
472
+ ): RealtimeChannel
473
+ on<T extends { [key: string]: any }>(
474
+ type: `${REALTIME_LISTEN_TYPES.POSTGRES_CHANGES}`,
475
+ filter: RealtimePostgresChangesFilter<`${REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.DELETE}`>,
476
+ callback: (payload: RealtimePostgresDeletePayload<T>) => void
477
+ ): RealtimeChannel
478
+ on<T extends { [key: string]: any }>(
479
+ type: `${REALTIME_LISTEN_TYPES.POSTGRES_CHANGES}`,
480
+ filter: RealtimePostgresChangesFilter<`${REALTIME_POSTGRES_CHANGES_LISTEN_EVENT}`>,
481
+ callback: (payload: RealtimePostgresChangesPayload<T>) => void
482
+ ): RealtimeChannel
483
+ /**
484
+ * The following is placed here to display on supabase.com/docs/reference/javascript/subscribe.
485
+ * @param type One of "broadcast", "presence", or "postgres_changes".
486
+ * @param filter Custom object specific to the Realtime feature detailing which payloads to receive.
487
+ * @param callback Function to be invoked when event handler is triggered.
488
+ */
489
+ on(
490
+ type: `${REALTIME_LISTEN_TYPES.BROADCAST}`,
491
+ filter: { event: string },
492
+ callback: (payload: {
493
+ type: `${REALTIME_LISTEN_TYPES.BROADCAST}`
494
+ event: string
495
+ meta?: {
496
+ replayed?: boolean
497
+ id: string
498
+ }
499
+ [key: string]: any
500
+ }) => void
501
+ ): RealtimeChannel
502
+ on<T extends { [key: string]: any }>(
503
+ type: `${REALTIME_LISTEN_TYPES.BROADCAST}`,
504
+ filter: { event: string },
505
+ callback: (payload: {
506
+ type: `${REALTIME_LISTEN_TYPES.BROADCAST}`
507
+ event: string
508
+ meta?: {
509
+ replayed?: boolean
510
+ id: string
511
+ }
512
+ payload: T
513
+ }) => void
514
+ ): RealtimeChannel
515
+ on<T extends Record<string, unknown>>(
516
+ type: `${REALTIME_LISTEN_TYPES.BROADCAST}`,
517
+ filter: { event: REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.ALL },
518
+ callback: (payload: {
519
+ type: `${REALTIME_LISTEN_TYPES.BROADCAST}`
520
+ event: REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.ALL
521
+ payload: RealtimeBroadcastPayload<T>
522
+ }) => void
523
+ ): RealtimeChannel
524
+ on<T extends { [key: string]: any }>(
525
+ type: `${REALTIME_LISTEN_TYPES.BROADCAST}`,
526
+ filter: { event: REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.INSERT },
527
+ callback: (payload: {
528
+ type: `${REALTIME_LISTEN_TYPES.BROADCAST}`
529
+ event: REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.INSERT
530
+ payload: RealtimeBroadcastInsertPayload<T>
531
+ }) => void
532
+ ): RealtimeChannel
533
+ on<T extends { [key: string]: any }>(
534
+ type: `${REALTIME_LISTEN_TYPES.BROADCAST}`,
535
+ filter: { event: REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.UPDATE },
536
+ callback: (payload: {
537
+ type: `${REALTIME_LISTEN_TYPES.BROADCAST}`
538
+ event: REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.UPDATE
539
+ payload: RealtimeBroadcastUpdatePayload<T>
540
+ }) => void
541
+ ): RealtimeChannel
542
+ on<T extends { [key: string]: any }>(
543
+ type: `${REALTIME_LISTEN_TYPES.BROADCAST}`,
544
+ filter: { event: REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.DELETE },
545
+ callback: (payload: {
546
+ type: `${REALTIME_LISTEN_TYPES.BROADCAST}`
547
+ event: REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.DELETE
548
+ payload: RealtimeBroadcastDeletePayload<T>
549
+ }) => void
550
+ ): RealtimeChannel
551
+ on<T extends { [key: string]: any }>(
552
+ type: `${REALTIME_LISTEN_TYPES.SYSTEM}`,
553
+ filter: {},
554
+ callback: (payload: any) => void
555
+ ): RealtimeChannel
556
+ /**
557
+ * Listen to realtime events on this channel.
558
+ * @category Realtime
559
+ *
560
+ * @remarks
561
+ * - By default, Broadcast and Presence are enabled for all projects.
562
+ * - By default, listening to database changes is disabled for new projects due to database performance and security concerns. You can turn it on by managing Realtime's [replication](/docs/guides/api#realtime-api-overview).
563
+ * - You can receive the "previous" data for updates and deletes by setting the table's `REPLICA IDENTITY` to `FULL` (e.g., `ALTER TABLE your_table REPLICA IDENTITY FULL;`).
564
+ * - Row level security is not applied to delete statements. When RLS is enabled and replica identity is set to full, only the primary key is sent to clients.
565
+ *
566
+ * @example Listen to broadcast messages
567
+ * ```js
568
+ * const channel = supabase.channel("room1")
569
+ *
570
+ * channel.on("broadcast", { event: "cursor-pos" }, (payload) => {
571
+ * console.log("Cursor position received!", payload);
572
+ * }).subscribe((status) => {
573
+ * if (status === "SUBSCRIBED") {
574
+ * channel.send({
575
+ * type: "broadcast",
576
+ * event: "cursor-pos",
577
+ * payload: { x: Math.random(), y: Math.random() },
578
+ * });
579
+ * }
580
+ * });
581
+ * ```
582
+ *
583
+ * @example Listen to presence sync
584
+ * ```js
585
+ * const channel = supabase.channel('room1')
586
+ * channel
587
+ * .on('presence', { event: 'sync' }, () => {
588
+ * console.log('Synced presence state: ', channel.presenceState())
589
+ * })
590
+ * .subscribe(async (status) => {
591
+ * if (status === 'SUBSCRIBED') {
592
+ * await channel.track({ online_at: new Date().toISOString() })
593
+ * }
594
+ * })
595
+ * ```
596
+ *
597
+ * @example Listen to presence join
598
+ * ```js
599
+ * const channel = supabase.channel('room1')
600
+ * channel
601
+ * .on('presence', { event: 'join' }, ({ newPresences }) => {
602
+ * console.log('Newly joined presences: ', newPresences)
603
+ * })
604
+ * .subscribe(async (status) => {
605
+ * if (status === 'SUBSCRIBED') {
606
+ * await channel.track({ online_at: new Date().toISOString() })
607
+ * }
608
+ * })
609
+ * ```
610
+ *
611
+ * @example Listen to presence leave
612
+ * ```js
613
+ * const channel = supabase.channel('room1')
614
+ * channel
615
+ * .on('presence', { event: 'leave' }, ({ leftPresences }) => {
616
+ * console.log('Newly left presences: ', leftPresences)
617
+ * })
618
+ * .subscribe(async (status) => {
619
+ * if (status === 'SUBSCRIBED') {
620
+ * await channel.track({ online_at: new Date().toISOString() })
621
+ * await channel.untrack()
622
+ * }
623
+ * })
624
+ * ```
625
+ *
626
+ * @example Listen to all database changes
627
+ * ```js
628
+ * supabase
629
+ * .channel('room1')
630
+ * .on('postgres_changes', { event: '*', schema: '*' }, payload => {
631
+ * console.log('Change received!', payload)
632
+ * })
633
+ * .subscribe()
634
+ * ```
635
+ *
636
+ * @example Listen to a specific table
637
+ * ```js
638
+ * supabase
639
+ * .channel('room1')
640
+ * .on('postgres_changes', { event: '*', schema: 'public', table: 'countries' }, payload => {
641
+ * console.log('Change received!', payload)
642
+ * })
643
+ * .subscribe()
644
+ * ```
645
+ *
646
+ * @example Listen to inserts
647
+ * ```js
648
+ * supabase
649
+ * .channel('room1')
650
+ * .on('postgres_changes', { event: 'INSERT', schema: 'public', table: 'countries' }, payload => {
651
+ * console.log('Change received!', payload)
652
+ * })
653
+ * .subscribe()
654
+ * ```
655
+ *
656
+ * @exampleDescription Listen to updates
657
+ * By default, Supabase will send only the updated record. If you want to receive the previous values as well you can
658
+ * enable full replication for the table you are listening to:
659
+ *
660
+ * ```sql
661
+ * alter table "your_table" replica identity full;
662
+ * ```
663
+ *
664
+ * @example Listen to updates
665
+ * ```js
666
+ * supabase
667
+ * .channel('room1')
668
+ * .on('postgres_changes', { event: 'UPDATE', schema: 'public', table: 'countries' }, payload => {
669
+ * console.log('Change received!', payload)
670
+ * })
671
+ * .subscribe()
672
+ * ```
673
+ *
674
+ * @exampleDescription Listen to deletes
675
+ * By default, Supabase does not send deleted records. If you want to receive the deleted record you can
676
+ * enable full replication for the table you are listening to:
677
+ *
678
+ * ```sql
679
+ * alter table "your_table" replica identity full;
680
+ * ```
681
+ *
682
+ * @example Listen to deletes
683
+ * ```js
684
+ * supabase
685
+ * .channel('room1')
686
+ * .on('postgres_changes', { event: 'DELETE', schema: 'public', table: 'countries' }, payload => {
687
+ * console.log('Change received!', payload)
688
+ * })
689
+ * .subscribe()
690
+ * ```
691
+ *
692
+ * @exampleDescription Listen to multiple events
693
+ * You can chain listeners if you want to listen to multiple events for each table.
694
+ *
695
+ * @example Listen to multiple events
696
+ * ```js
697
+ * supabase
698
+ * .channel('room1')
699
+ * .on('postgres_changes', { event: 'INSERT', schema: 'public', table: 'countries' }, handleRecordInserted)
700
+ * .on('postgres_changes', { event: 'DELETE', schema: 'public', table: 'countries' }, handleRecordDeleted)
701
+ * .subscribe()
702
+ * ```
703
+ *
704
+ * @exampleDescription Listen to row level changes
705
+ * You can listen to individual rows using the format `{table}:{col}=eq.{val}` - where `{col}` is the column name, and `{val}` is the value which you want to match.
706
+ *
707
+ * @example Listen to row level changes
708
+ * ```js
709
+ * supabase
710
+ * .channel('room1')
711
+ * .on('postgres_changes', { event: 'UPDATE', schema: 'public', table: 'countries', filter: 'id=eq.200' }, handleRecordUpdated)
712
+ * .subscribe()
713
+ * ```
714
+ */
715
+ on(
716
+ type: `${REALTIME_LISTEN_TYPES}`,
717
+ filter: { event: string; [key: string]: string },
718
+ callback: (payload: any) => void
719
+ ): RealtimeChannel {
720
+ const stateCheck = this.channelAdapter.isJoined() || this.channelAdapter.isJoining()
721
+ const typeCheck =
722
+ type === REALTIME_LISTEN_TYPES.PRESENCE || type === REALTIME_LISTEN_TYPES.POSTGRES_CHANGES
723
+
724
+ if (stateCheck && typeCheck) {
725
+ this.socket.log(
726
+ 'channel',
727
+ `cannot add \`${type}\` callbacks for ${this.topic} after \`subscribe()\`.`
728
+ )
729
+ throw new Error(`cannot add \`${type}\` callbacks for ${this.topic} after \`subscribe()\`.`)
730
+ }
731
+ return this._on(type, filter, callback)
732
+ }
733
+ /**
734
+ * Sends a broadcast message explicitly via REST API.
735
+ *
736
+ * This method always uses the REST API endpoint regardless of WebSocket connection state.
737
+ * Useful when you want to guarantee REST delivery or when gradually migrating from implicit REST fallback.
738
+ *
739
+ * @param event The name of the broadcast event
740
+ * @param payload Payload to be sent (required)
741
+ * @param opts Options including timeout
742
+ * @returns Promise resolving to object with success status, and error details if failed
743
+ *
744
+ * @category Realtime
745
+ */
746
+ async httpSend(
747
+ event: string,
748
+ payload: any,
749
+ opts: { timeout?: number } = {}
750
+ ): Promise<{ success: true } | { success: false; status: number; error: string }> {
751
+ if (payload === undefined || payload === null) {
752
+ return Promise.reject(new Error('Payload is required for httpSend()'))
753
+ }
754
+
755
+ const headers: Record<string, string> = {
756
+ apikey: this.socket.apiKey ? this.socket.apiKey : '',
757
+ 'Content-Type': 'application/json',
758
+ }
759
+
760
+ if (this.socket.accessTokenValue) {
761
+ headers['Authorization'] = `Bearer ${this.socket.accessTokenValue}`
762
+ }
763
+
764
+ const options = {
765
+ method: 'POST',
766
+ headers,
767
+ body: JSON.stringify({
768
+ messages: [
769
+ {
770
+ topic: this.subTopic,
771
+ event,
772
+ payload: payload,
773
+ private: this.private,
774
+ },
775
+ ],
776
+ }),
777
+ }
778
+
779
+ const response = await this._fetchWithTimeout(
780
+ this.broadcastEndpointURL,
781
+ options,
782
+ opts.timeout ?? this.timeout
783
+ )
784
+
785
+ if (response.status === 202) {
786
+ return { success: true }
787
+ }
788
+
789
+ let errorMessage = response.statusText
790
+ try {
791
+ const errorBody = await response.json()
792
+ errorMessage = errorBody.error || errorBody.message || errorMessage
793
+ } catch {}
794
+
795
+ return Promise.reject(new Error(errorMessage))
796
+ }
797
+
798
+ /**
799
+ * Sends a message into the channel.
800
+ *
801
+ * @param args Arguments to send to channel
802
+ * @param args.type The type of event to send
803
+ * @param args.event The name of the event being sent
804
+ * @param args.payload Payload to be sent
805
+ * @param opts Options to be used during the send process
806
+ *
807
+ * @category Realtime
808
+ *
809
+ * @remarks
810
+ * - When using REST you don't need to subscribe to the channel
811
+ * - REST calls are only available from 2.37.0 onwards
812
+ *
813
+ * @example Send a message via websocket
814
+ * ```js
815
+ * const channel = supabase.channel('room1')
816
+ *
817
+ * channel.subscribe((status) => {
818
+ * if (status === 'SUBSCRIBED') {
819
+ * channel.send({
820
+ * type: 'broadcast',
821
+ * event: 'cursor-pos',
822
+ * payload: { x: Math.random(), y: Math.random() },
823
+ * })
824
+ * }
825
+ * })
826
+ * ```
827
+ *
828
+ * @exampleResponse Send a message via websocket
829
+ * ```js
830
+ * ok | timed out | error
831
+ * ```
832
+ *
833
+ * @example Send a message via REST
834
+ * ```js
835
+ * supabase
836
+ * .channel('room1')
837
+ * .httpSend('cursor-pos', { x: Math.random(), y: Math.random() })
838
+ * ```
839
+ */
840
+ async send(
841
+ args: {
842
+ type: 'broadcast' | 'presence' | 'postgres_changes'
843
+ event: string
844
+ payload?: any
845
+ [key: string]: any
846
+ },
847
+ opts: { [key: string]: any } = {}
848
+ ): Promise<RealtimeChannelSendResponse> {
849
+ if (!this.channelAdapter.canPush() && args.type === 'broadcast') {
850
+ console.warn(
851
+ 'Realtime send() is automatically falling back to REST API. ' +
852
+ 'This behavior will be deprecated in the future. ' +
853
+ 'Please use httpSend() explicitly for REST delivery.'
854
+ )
855
+
856
+ const { event, payload: endpoint_payload } = args
857
+ const headers: Record<string, string> = {
858
+ apikey: this.socket.apiKey ? this.socket.apiKey : '',
859
+ 'Content-Type': 'application/json',
860
+ }
861
+
862
+ if (this.socket.accessTokenValue) {
863
+ headers['Authorization'] = `Bearer ${this.socket.accessTokenValue}`
864
+ }
865
+
866
+ const options = {
867
+ method: 'POST',
868
+ headers,
869
+ body: JSON.stringify({
870
+ messages: [
871
+ {
872
+ topic: this.subTopic,
873
+ event,
874
+ payload: endpoint_payload,
875
+ private: this.private,
876
+ },
877
+ ],
878
+ }),
879
+ }
880
+
881
+ try {
882
+ const response = await this._fetchWithTimeout(
883
+ this.broadcastEndpointURL,
884
+ options,
885
+ opts.timeout ?? this.timeout
886
+ )
887
+
888
+ await response.body?.cancel()
889
+ return response.ok ? 'ok' : 'error'
890
+ } catch (error) {
891
+ if (error instanceof Error && error.name === 'AbortError') {
892
+ return 'timed out'
893
+ } else {
894
+ return 'error'
895
+ }
896
+ }
897
+ } else {
898
+ return new Promise((resolve) => {
899
+ const push = this.channelAdapter.push(args.type, args, opts.timeout || this.timeout)
900
+
901
+ if (args.type === 'broadcast' && !this.params?.config?.broadcast?.ack) {
902
+ resolve('ok')
903
+ }
904
+
905
+ push.receive('ok', () => resolve('ok'))
906
+ push.receive('error', () => resolve('error'))
907
+ push.receive('timeout', () => resolve('timed out'))
908
+ })
909
+ }
910
+ }
911
+
912
+ /**
913
+ * Updates the payload that will be sent the next time the channel joins (reconnects).
914
+ * Useful for rotating access tokens or updating config without re-creating the channel.
915
+ *
916
+ * @category Realtime
917
+ */
918
+ updateJoinPayload(payload: Record<string, any>) {
919
+ this.channelAdapter.updateJoinPayload(payload)
920
+ }
921
+
922
+ /**
923
+ * Leaves the channel.
924
+ *
925
+ * Unsubscribes from server events, and instructs channel to terminate on server.
926
+ * Triggers onClose() hooks.
927
+ *
928
+ * To receive leave acknowledgements, use the a `receive` hook to bind to the server ack, ie:
929
+ * channel.unsubscribe().receive("ok", () => alert("left!") )
930
+ *
931
+ * @category Realtime
932
+ */
933
+ async unsubscribe(timeout = this.timeout) {
934
+ return new Promise<RealtimeChannelSendResponse>((resolve) => {
935
+ this.channelAdapter
936
+ .unsubscribe(timeout)
937
+ .receive('ok', () => resolve('ok'))
938
+ .receive('timeout', () => resolve('timed out'))
939
+ .receive('error', () => resolve('error'))
940
+ })
941
+ }
942
+
943
+ /**
944
+ * Destroys and stops related timers.
945
+ *
946
+ * @category Realtime
947
+ */
948
+ teardown() {
949
+ this.channelAdapter.teardown()
950
+ }
951
+
952
+ /** @internal */
953
+ async _fetchWithTimeout(url: string, options: { [key: string]: any }, timeout: number) {
954
+ const controller = new AbortController()
955
+ const id = setTimeout(() => controller.abort(), timeout)
956
+
957
+ const response = await this.socket.fetch(url, {
958
+ ...options,
959
+ signal: controller.signal,
960
+ })
961
+
962
+ clearTimeout(id)
963
+
964
+ return response
965
+ }
966
+
967
+ /** @internal */
968
+ _on(type: string, filter: { [key: string]: any }, callback: ChannelBindingCallback) {
969
+ const typeLower = type.toLocaleLowerCase()
970
+
971
+ const ref = this.channelAdapter.on(type, callback)
972
+
973
+ const binding: Binding = {
974
+ type: typeLower,
975
+ filter: filter,
976
+ callback: callback,
977
+ ref: ref,
978
+ }
979
+
980
+ if (this.bindings[typeLower]) {
981
+ this.bindings[typeLower].push(binding)
982
+ } else {
983
+ this.bindings[typeLower] = [binding]
984
+ }
985
+
986
+ this._updateFilterMessage()
987
+
988
+ return this
989
+ }
990
+
991
+ /**
992
+ * Registers a callback that will be executed when the channel closes.
993
+ *
994
+ * @internal
995
+ */
996
+ private _onClose(callback: ChannelBindingCallback) {
997
+ this.channelAdapter.onClose(callback)
998
+ }
999
+
1000
+ /**
1001
+ * Registers a callback that will be executed when the channel encounteres an error.
1002
+ *
1003
+ * @internal
1004
+ */
1005
+ private _onError(callback: ChannelOnErrorCallback) {
1006
+ this.channelAdapter.onError(callback)
1007
+ }
1008
+
1009
+ /** @internal */
1010
+ private _updateFilterMessage() {
1011
+ this.channelAdapter.updateFilterBindings((binding, payload: any, ref) => {
1012
+ const typeLower = binding.event.toLocaleLowerCase()
1013
+
1014
+ if (this._notThisChannelEvent(typeLower, ref)) {
1015
+ return false
1016
+ }
1017
+
1018
+ const bind = this.bindings[typeLower]?.find((bind) => bind.ref === binding.ref)
1019
+
1020
+ if (!bind) {
1021
+ return true
1022
+ }
1023
+
1024
+ if (['broadcast', 'presence', 'postgres_changes'].includes(typeLower)) {
1025
+ if ('id' in bind) {
1026
+ const bindId = bind.id
1027
+ const bindEvent = bind.filter?.event
1028
+ return (
1029
+ bindId &&
1030
+ payload.ids?.includes(bindId) &&
1031
+ (bindEvent === '*' ||
1032
+ bindEvent?.toLocaleLowerCase() === payload.data?.type.toLocaleLowerCase())
1033
+ )
1034
+ } else {
1035
+ const bindEvent = bind?.filter?.event?.toLocaleLowerCase()
1036
+ return bindEvent === '*' || bindEvent === payload?.event?.toLocaleLowerCase()
1037
+ }
1038
+ } else {
1039
+ return bind.type.toLocaleLowerCase() === typeLower
1040
+ }
1041
+ })
1042
+ }
1043
+
1044
+ /** @internal */
1045
+ private _notThisChannelEvent(event: string, ref?: string | null) {
1046
+ const { close, error, leave, join } = CHANNEL_EVENTS
1047
+ const events: string[] = [close, error, leave, join]
1048
+ return ref && events.includes(event) && ref !== this.joinPush.ref
1049
+ }
1050
+
1051
+ /** @internal */
1052
+ private _updateFilterTransform() {
1053
+ this.channelAdapter.updatePayloadTransform((event, payload: any, ref) => {
1054
+ if (typeof payload === 'object' && 'ids' in payload) {
1055
+ const postgresChanges = payload.data
1056
+ const { schema, table, commit_timestamp, type, errors } = postgresChanges
1057
+ const enrichedPayload = {
1058
+ schema: schema,
1059
+ table: table,
1060
+ commit_timestamp: commit_timestamp,
1061
+ eventType: type,
1062
+ new: {},
1063
+ old: {},
1064
+ errors: errors,
1065
+ }
1066
+ return {
1067
+ ...enrichedPayload,
1068
+ ...this._getPayloadRecords(postgresChanges),
1069
+ }
1070
+ }
1071
+
1072
+ return payload
1073
+ })
1074
+ }
1075
+
1076
+ copyBindings(other: RealtimeChannel) {
1077
+ if (this.joinedOnce) {
1078
+ throw new Error('cannot copy bindings into joined channel')
1079
+ }
1080
+ for (const kind in other.bindings) {
1081
+ for (const binding of other.bindings[kind]) {
1082
+ this._on(binding.type, binding.filter, binding.callback)
1083
+ }
1084
+ }
1085
+ }
1086
+
1087
+ /**
1088
+ * Compares two optional filter values for equality.
1089
+ * Treats undefined, null, and empty string as equivalent empty values.
1090
+ * @internal
1091
+ */
1092
+ private static isFilterValueEqual(
1093
+ serverValue: string | undefined | null,
1094
+ clientValue: string | undefined
1095
+ ): boolean {
1096
+ const normalizedServer = serverValue ?? undefined
1097
+ const normalizedClient = clientValue ?? undefined
1098
+ return normalizedServer === normalizedClient
1099
+ }
1100
+
1101
+ /** @internal */
1102
+ private _getPayloadRecords(payload: any) {
1103
+ const records = {
1104
+ new: {},
1105
+ old: {},
1106
+ }
1107
+
1108
+ if (payload.type === 'INSERT' || payload.type === 'UPDATE') {
1109
+ records.new = Transformers.convertChangeData(payload.columns, payload.record)
1110
+ }
1111
+
1112
+ if (payload.type === 'UPDATE' || payload.type === 'DELETE') {
1113
+ records.old = Transformers.convertChangeData(payload.columns, payload.old_record)
1114
+ }
1115
+
1116
+ return records
1117
+ }
1118
+ }