@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.
- package/README.md +66 -0
- package/package.json +36 -0
- package/src/cli.js +176 -0
- package/templates/.claude/skills/connect/SKILL.md +169 -0
- package/templates/.claude/skills/load-slice/SKILL.md +86 -0
- package/templates/realtime-agent/node_modules/.package-lock.json +107 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/LICENSE +21 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/README.md +190 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/AuthAdminApi.d.ts +4 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/AuthAdminApi.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/AuthAdminApi.js +7 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/AuthAdminApi.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/AuthClient.d.ts +4 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/AuthClient.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/AuthClient.js +7 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/AuthClient.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/GoTrueAdminApi.d.ts +716 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/GoTrueAdminApi.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/GoTrueAdminApi.js +1108 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/GoTrueAdminApi.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/GoTrueClient.d.ts +2473 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/GoTrueClient.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/GoTrueClient.js +5217 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/GoTrueClient.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/index.d.ts +9 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/index.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/index.js +20 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/index.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/base64url.d.ts +76 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/base64url.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/base64url.js +269 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/base64url.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/constants.d.ts +26 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/constants.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/constants.js +31 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/constants.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/error-codes.d.ts +7 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/error-codes.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/error-codes.js +3 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/error-codes.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/errors.d.ts +258 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/errors.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/errors.js +290 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/errors.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/fetch.d.ts +54 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/fetch.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/fetch.js +200 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/fetch.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/helpers.d.ts +94 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/helpers.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/helpers.js +406 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/helpers.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/local-storage.d.ts +9 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/local-storage.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/local-storage.js +21 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/local-storage.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/locks.d.ts +107 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/locks.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/locks.js +349 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/locks.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/polyfills.d.ts +5 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/polyfills.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/polyfills.js +29 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/polyfills.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/types.d.ts +2498 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/types.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/types.js +23 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/types.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/version.d.ts +2 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/version.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/version.js +11 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/version.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/web3/ethereum.d.ts +96 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/web3/ethereum.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/web3/ethereum.js +66 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/web3/ethereum.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/web3/solana.d.ts +160 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/web3/solana.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/web3/solana.js +4 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/web3/solana.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/webauthn.d.ts +284 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/webauthn.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/webauthn.dom.d.ts +583 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/webauthn.dom.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/webauthn.dom.js +4 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/webauthn.dom.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/webauthn.errors.d.ts +85 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/webauthn.errors.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/webauthn.errors.js +272 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/webauthn.errors.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/webauthn.js +707 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/webauthn.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/AuthAdminApi.d.ts +4 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/AuthAdminApi.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/AuthAdminApi.js +4 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/AuthAdminApi.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/AuthClient.d.ts +4 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/AuthClient.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/AuthClient.js +4 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/AuthClient.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/GoTrueAdminApi.d.ts +716 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/GoTrueAdminApi.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/GoTrueAdminApi.js +1105 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/GoTrueAdminApi.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/GoTrueClient.d.ts +2473 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/GoTrueClient.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/GoTrueClient.js +5214 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/GoTrueClient.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/index.d.ts +9 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/index.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/index.js +9 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/index.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/base64url.d.ts +76 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/base64url.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/base64url.js +257 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/base64url.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/constants.d.ts +26 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/constants.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/constants.js +28 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/constants.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/error-codes.d.ts +7 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/error-codes.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/error-codes.js +2 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/error-codes.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/errors.d.ts +258 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/errors.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/errors.js +267 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/errors.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/fetch.d.ts +54 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/fetch.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/fetch.js +190 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/fetch.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/helpers.d.ts +94 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/helpers.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/helpers.js +378 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/helpers.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/local-storage.d.ts +9 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/local-storage.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/local-storage.js +18 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/local-storage.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/locks.d.ts +107 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/locks.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/locks.js +341 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/locks.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/polyfills.d.ts +5 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/polyfills.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/polyfills.js +26 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/polyfills.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/types.d.ts +2498 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/types.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/types.js +20 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/types.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/version.d.ts +2 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/version.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/version.js +8 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/version.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/web3/ethereum.d.ts +96 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/web3/ethereum.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/web3/ethereum.js +60 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/web3/ethereum.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/web3/solana.d.ts +160 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/web3/solana.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/web3/solana.js +3 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/web3/solana.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/webauthn.d.ts +284 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/webauthn.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/webauthn.dom.d.ts +583 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/webauthn.dom.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/webauthn.dom.js +3 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/webauthn.dom.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/webauthn.errors.d.ts +85 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/webauthn.errors.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/webauthn.errors.js +264 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/webauthn.errors.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/webauthn.js +689 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/webauthn.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/tsconfig.module.tsbuildinfo +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/tsconfig.tsbuildinfo +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/package.json +44 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/src/AuthAdminApi.ts +5 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/src/AuthClient.ts +5 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/src/GoTrueAdminApi.ts +1267 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/src/GoTrueClient.ts +6360 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/src/index.ts +13 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/base64url.ts +308 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/constants.ts +34 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/error-codes.ts +90 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/errors.ts +359 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/fetch.ts +320 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/helpers.ts +476 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/local-storage.ts +21 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/locks.ts +420 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/polyfills.ts +23 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/types.ts +2917 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/version.ts +7 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/web3/ethereum.ts +184 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/web3/solana.ts +186 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/webauthn.dom.ts +636 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/webauthn.errors.ts +329 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/webauthn.ts +946 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/README.md +134 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/FunctionsClient.d.ts +177 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/FunctionsClient.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/FunctionsClient.js +309 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/FunctionsClient.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/helper.d.ts +3 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/helper.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/helper.js +11 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/helper.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/index.d.ts +3 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/index.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/index.js +12 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/index.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/types.d.ts +122 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/types.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/types.js +98 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/types.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/version.d.ts +2 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/version.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/version.js +11 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/version.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/FunctionsClient.d.ts +177 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/FunctionsClient.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/FunctionsClient.js +305 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/FunctionsClient.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/helper.d.ts +3 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/helper.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/helper.js +7 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/helper.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/index.d.ts +3 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/index.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/index.js +3 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/index.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/types.d.ts +122 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/types.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/types.js +91 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/types.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/version.d.ts +2 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/version.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/version.js +8 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/version.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/tsconfig.module.tsbuildinfo +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/tsconfig.tsbuildinfo +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/package.json +52 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/src/FunctionsClient.ts +335 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/src/edge-runtime.d.ts +214 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/src/helper.ts +8 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/src/index.ts +10 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/src/types.ts +146 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/src/version.ts +7 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/LICENSE.md +22 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/README.md +121 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/assets/js/phoenix/ajax.js +116 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/assets/js/phoenix/channel.js +331 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/assets/js/phoenix/constants.js +35 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/assets/js/phoenix/index.js +212 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/assets/js/phoenix/longpoll.js +192 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/assets/js/phoenix/presence.js +208 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/assets/js/phoenix/push.js +134 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/assets/js/phoenix/serializer.js +133 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/assets/js/phoenix/socket.js +756 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/assets/js/phoenix/timer.js +48 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/assets/js/phoenix/types.js +184 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/assets/js/phoenix/utils.js +16 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/package.json +58 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/favicon.ico +0 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/phoenix-orange.png +0 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/phoenix.cjs.js +1825 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/phoenix.cjs.js.map +7 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/phoenix.js +1847 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/phoenix.min.js +2 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/phoenix.mjs +1802 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/phoenix.mjs.map +7 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/phoenix.png +0 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/ajax.d.ts +10 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/ajax.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/channel.d.ts +167 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/channel.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/constants.d.ts +36 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/constants.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/index.d.ts +10 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/index.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/longpoll.d.ts +29 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/longpoll.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/presence.d.ts +107 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/presence.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/push.d.ts +70 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/push.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/serializer.d.ts +74 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/serializer.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/socket.d.ts +291 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/socket.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/timer.d.ts +36 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/timer.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/types.d.ts +280 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/types.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/utils.d.ts +2 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/utils.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/tsconfig.json +20 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/README.md +213 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/dist/index.cjs +5025 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/dist/index.cjs.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/dist/index.d.cts +3828 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/dist/index.d.cts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/dist/index.d.mts +3828 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/dist/index.d.mts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/dist/index.mjs +5017 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/dist/index.mjs.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/package.json +69 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/PostgrestBuilder.ts +688 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/PostgrestClient.ts +447 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/PostgrestError.ts +41 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/PostgrestFilterBuilder.ts +2137 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/PostgrestQueryBuilder.ts +1703 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/PostgrestTransformBuilder.ts +981 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/constants.ts +2 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/index.ts +34 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/select-query-parser/parser.ts +476 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/select-query-parser/result.ts +550 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/select-query-parser/types.ts +129 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/select-query-parser/utils.ts +704 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/types/common/common.ts +83 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/types/common/rpc.ts +148 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/types/feature-flags.ts +17 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/types/types.ts +161 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/version.ts +7 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/README.md +326 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/RealtimeChannel.d.ts +442 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/RealtimeChannel.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/RealtimeChannel.js +719 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/RealtimeChannel.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/RealtimeClient.d.ts +275 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/RealtimeClient.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/RealtimeClient.js +697 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/RealtimeClient.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/RealtimePresence.d.ts +62 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/RealtimePresence.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/RealtimePresence.js +43 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/RealtimePresence.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/index.d.ts +6 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/index.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/index.js +18 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/index.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/constants.d.ts +43 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/constants.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/constants.js +43 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/constants.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/normalizeChannelError.d.ts +10 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/normalizeChannelError.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/normalizeChannelError.js +29 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/normalizeChannelError.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/serializer.d.ts +33 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/serializer.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/serializer.js +155 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/serializer.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/transformers.d.ts +109 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/transformers.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/transformers.js +241 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/transformers.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/version.d.ts +2 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/version.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/version.js +11 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/version.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/websocket-factory.d.ts +82 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/websocket-factory.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/websocket-factory.js +130 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/websocket-factory.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/channelAdapter.d.ts +32 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/channelAdapter.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/channelAdapter.js +103 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/channelAdapter.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/presenceAdapter.d.ts +53 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/presenceAdapter.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/presenceAdapter.js +93 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/presenceAdapter.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/socketAdapter.d.ts +38 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/socketAdapter.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/socketAdapter.js +114 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/socketAdapter.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/types.d.ts +5 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/types.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/types.js +3 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/types.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/RealtimeChannel.d.ts +442 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/RealtimeChannel.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/RealtimeChannel.js +714 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/RealtimeChannel.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/RealtimeClient.d.ts +275 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/RealtimeClient.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/RealtimeClient.js +693 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/RealtimeClient.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/RealtimePresence.d.ts +62 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/RealtimePresence.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/RealtimePresence.js +38 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/RealtimePresence.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/index.d.ts +6 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/index.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/index.js +6 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/index.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/constants.d.ts +43 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/constants.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/constants.js +40 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/constants.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/normalizeChannelError.d.ts +10 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/normalizeChannelError.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/normalizeChannelError.js +26 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/normalizeChannelError.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/serializer.d.ts +33 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/serializer.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/serializer.js +152 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/serializer.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/transformers.d.ts +109 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/transformers.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/transformers.js +229 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/transformers.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/version.d.ts +2 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/version.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/version.js +8 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/version.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/websocket-factory.d.ts +82 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/websocket-factory.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/websocket-factory.js +126 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/websocket-factory.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/channelAdapter.d.ts +32 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/channelAdapter.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/channelAdapter.js +100 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/channelAdapter.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/presenceAdapter.d.ts +53 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/presenceAdapter.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/presenceAdapter.js +90 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/presenceAdapter.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/socketAdapter.d.ts +38 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/socketAdapter.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/socketAdapter.js +111 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/socketAdapter.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/types.d.ts +5 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/types.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/types.js +2 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/types.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/tsconfig.module.tsbuildinfo +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/tsconfig.tsbuildinfo +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/package.json +58 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/src/RealtimeChannel.ts +1118 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/src/RealtimeClient.ts +868 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/src/RealtimePresence.ts +71 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/src/index.ts +53 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/src/lib/constants.ts +62 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/src/lib/normalizeChannelError.ts +30 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/src/lib/serializer.ts +203 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/src/lib/transformers.ts +270 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/src/lib/version.ts +7 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/src/lib/websocket-factory.ts +204 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/src/phoenix/channelAdapter.ts +149 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/src/phoenix/presenceAdapter.ts +116 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/src/phoenix/socketAdapter.ts +168 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/src/phoenix/types.ts +32 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/README.md +1262 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/dist/index.cjs +2995 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/dist/index.cjs.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/dist/index.d.cts +2956 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/dist/index.d.cts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/dist/index.d.mts +2956 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/dist/index.d.mts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/dist/index.mjs +2979 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/dist/index.mjs.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/dist/umd/supabase.js +1 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/package.json +62 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/src/StorageClient.ts +98 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/src/index.ts +19 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/src/lib/common/BaseApiClient.ts +104 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/src/lib/common/errors.ts +160 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/src/lib/common/fetch.ts +303 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/src/lib/common/headers.ts +43 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/src/lib/common/helpers.ts +146 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/src/lib/constants.ts +4 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/src/lib/types.ts +654 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/src/lib/version.ts +7 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/src/packages/BlobDownloadBuilder.ts +62 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/src/packages/StorageAnalyticsClient.ts +420 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/src/packages/StorageBucketApi.ts +414 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/src/packages/StorageFileApi.ts +1423 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/src/packages/StorageVectorsClient.ts +644 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/src/packages/StreamDownloadBuilder.ts +39 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/src/packages/VectorBucketApi.ts +73 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/src/packages/VectorDataApi.ts +98 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/src/packages/VectorIndexApi.ts +90 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/README.md +238 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/cors.cjs +89 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/cors.cjs.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/cors.d.cts +58 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/cors.d.cts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/cors.d.mts +58 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/cors.d.mts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/cors.mjs +88 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/cors.mjs.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/index.cjs +660 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/index.cjs.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/index.d.cts +616 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/index.d.cts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/index.d.mts +616 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/index.d.mts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/index.mjs +607 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/index.mjs.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/umd/supabase.js +24 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/package.json +122 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/src/SupabaseClient.ts +625 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/src/cors.ts +84 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/src/index.ts +106 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/src/lib/SupabaseAuthClient.ts +8 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/src/lib/constants.ts +35 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/src/lib/fetch.ts +36 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/src/lib/helpers.ts +98 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/src/lib/rest/types/common/common.ts +93 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/src/lib/rest/types/common/rpc.ts +158 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/src/lib/types.ts +196 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/src/lib/version.ts +7 -0
- package/templates/realtime-agent/node_modules/iceberg-js/LICENSE +21 -0
- package/templates/realtime-agent/node_modules/iceberg-js/README.md +439 -0
- package/templates/realtime-agent/node_modules/iceberg-js/dist/index.cjs +596 -0
- package/templates/realtime-agent/node_modules/iceberg-js/dist/index.cjs.map +1 -0
- package/templates/realtime-agent/node_modules/iceberg-js/dist/index.d.cts +547 -0
- package/templates/realtime-agent/node_modules/iceberg-js/dist/index.d.ts +547 -0
- package/templates/realtime-agent/node_modules/iceberg-js/dist/index.mjs +587 -0
- package/templates/realtime-agent/node_modules/iceberg-js/dist/index.mjs.map +1 -0
- package/templates/realtime-agent/node_modules/iceberg-js/package.json +77 -0
- package/templates/realtime-agent/node_modules/tslib/CopyrightNotice.txt +15 -0
- package/templates/realtime-agent/node_modules/tslib/LICENSE.txt +12 -0
- package/templates/realtime-agent/node_modules/tslib/README.md +164 -0
- package/templates/realtime-agent/node_modules/tslib/SECURITY.md +41 -0
- package/templates/realtime-agent/node_modules/tslib/modules/index.d.ts +38 -0
- package/templates/realtime-agent/node_modules/tslib/modules/index.js +70 -0
- package/templates/realtime-agent/node_modules/tslib/modules/package.json +3 -0
- package/templates/realtime-agent/node_modules/tslib/package.json +47 -0
- package/templates/realtime-agent/node_modules/tslib/tslib.d.ts +460 -0
- package/templates/realtime-agent/node_modules/tslib/tslib.es6.html +1 -0
- package/templates/realtime-agent/node_modules/tslib/tslib.es6.js +402 -0
- package/templates/realtime-agent/node_modules/tslib/tslib.es6.mjs +401 -0
- package/templates/realtime-agent/node_modules/tslib/tslib.html +1 -0
- package/templates/realtime-agent/node_modules/tslib/tslib.js +484 -0
- package/templates/realtime-agent/package-lock.json +114 -0
- package/templates/realtime-agent/package.json +11 -0
- package/templates/realtime-agent/src/index.js +152 -0
- package/templates/root/AGENT.md +37 -0
- package/templates/root/model.md +1 -0
- package/templates/root/prompt.md +91 -0
- package/templates/root/ralph.sh +47 -0
|
@@ -0,0 +1,756 @@
|
|
|
1
|
+
import {
|
|
2
|
+
global,
|
|
3
|
+
phxWindow,
|
|
4
|
+
CHANNEL_EVENTS,
|
|
5
|
+
DEFAULT_TIMEOUT,
|
|
6
|
+
DEFAULT_VSN,
|
|
7
|
+
SOCKET_STATES,
|
|
8
|
+
TRANSPORTS,
|
|
9
|
+
WS_CLOSE_NORMAL,
|
|
10
|
+
AUTH_TOKEN_PREFIX
|
|
11
|
+
} from "./constants"
|
|
12
|
+
|
|
13
|
+
import {
|
|
14
|
+
closure
|
|
15
|
+
} from "./utils"
|
|
16
|
+
|
|
17
|
+
import Ajax from "./ajax"
|
|
18
|
+
import Channel from "./channel"
|
|
19
|
+
import LongPoll from "./longpoll"
|
|
20
|
+
import Serializer from "./serializer"
|
|
21
|
+
import Timer from "./timer"
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @import { Encode, Decode, Message, Vsn, SocketTransport, Params, SocketOnOpen, SocketOnClose, SocketOnError, SocketOnMessage, SocketOptions, SocketStateChangeCallbacks, HeartbeatCallback } from "./types"
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
export default class Socket {
|
|
28
|
+
/** Initializes the Socket *
|
|
29
|
+
*
|
|
30
|
+
* For IE8 support use an ES5-shim (https://github.com/es-shims/es5-shim)
|
|
31
|
+
*
|
|
32
|
+
* @constructor
|
|
33
|
+
* @param {string} endPoint - The string WebSocket endpoint, ie, `"ws://example.com/socket"`,
|
|
34
|
+
* `"wss://example.com"`
|
|
35
|
+
* `"/socket"` (inherited host & protocol)
|
|
36
|
+
* @param {SocketOptions} [opts] - Optional configuration
|
|
37
|
+
*/
|
|
38
|
+
constructor(endPoint, opts = {}){
|
|
39
|
+
/** @type{SocketStateChangeCallbacks} */
|
|
40
|
+
this.stateChangeCallbacks = {open: [], close: [], error: [], message: []}
|
|
41
|
+
/** @type{Channel[]} */
|
|
42
|
+
this.channels = []
|
|
43
|
+
/** @type{(() => void)[]} */
|
|
44
|
+
this.sendBuffer = []
|
|
45
|
+
/** @type{number} */
|
|
46
|
+
this.ref = 0
|
|
47
|
+
/** @type{?string} */
|
|
48
|
+
this.fallbackRef = null
|
|
49
|
+
/** @type{number} */
|
|
50
|
+
this.timeout = opts.timeout || DEFAULT_TIMEOUT
|
|
51
|
+
/** @type{SocketTransport} */
|
|
52
|
+
this.transport = opts.transport || global.WebSocket || LongPoll
|
|
53
|
+
/** @type{InstanceType<SocketTransport> | undefined | null} */
|
|
54
|
+
this.conn = undefined
|
|
55
|
+
/** @type{boolean} */
|
|
56
|
+
this.primaryPassedHealthCheck = false
|
|
57
|
+
/** @type{number | undefined} */
|
|
58
|
+
this.longPollFallbackMs = opts.longPollFallbackMs
|
|
59
|
+
/** @type{ReturnType<typeof setTimeout>} */
|
|
60
|
+
this.fallbackTimer = null
|
|
61
|
+
// In some environments (sandboxed iframes without `allow-same-origin`,
|
|
62
|
+
// in-app webviews, "block third-party storage" privacy modes), reading
|
|
63
|
+
// `global.sessionStorage` throws SecurityError at the property-access level.
|
|
64
|
+
// Wrap the read so the Socket constructor cannot throw synchronously.
|
|
65
|
+
let envSessionStorage = null
|
|
66
|
+
try { envSessionStorage = global && global.sessionStorage } catch {}
|
|
67
|
+
/** @type{Storage} */
|
|
68
|
+
this.sessionStore = opts.sessionStorage || envSessionStorage
|
|
69
|
+
/** @type{number} */
|
|
70
|
+
this.establishedConnections = 0
|
|
71
|
+
/** @type{Encode<void>} */
|
|
72
|
+
this.defaultEncoder = Serializer.encode.bind(Serializer)
|
|
73
|
+
/** @type{Decode<void>} */
|
|
74
|
+
this.defaultDecoder = Serializer.decode.bind(Serializer)
|
|
75
|
+
// We start with closeWasClean true to avoid the visibility change
|
|
76
|
+
// logic from connecting if the socket was never connected in the first place.
|
|
77
|
+
// transportConnect sets it to false on open.
|
|
78
|
+
/** @type{boolean} */
|
|
79
|
+
this.closeWasClean = true
|
|
80
|
+
/** @type{boolean} */
|
|
81
|
+
this.disconnecting = false
|
|
82
|
+
/** @type{BinaryType} */
|
|
83
|
+
this.binaryType = opts.binaryType || "arraybuffer"
|
|
84
|
+
/** @type{number} */
|
|
85
|
+
this.connectClock = 1
|
|
86
|
+
/** @type{boolean} */
|
|
87
|
+
this.pageHidden = false
|
|
88
|
+
/** @type{Encode<void>} */
|
|
89
|
+
this.encode = undefined
|
|
90
|
+
/** @type{Decode<void>} */
|
|
91
|
+
this.decode = undefined
|
|
92
|
+
if(this.transport !== LongPoll){
|
|
93
|
+
this.encode = opts.encode || this.defaultEncoder
|
|
94
|
+
this.decode = opts.decode || this.defaultDecoder
|
|
95
|
+
} else {
|
|
96
|
+
this.encode = this.defaultEncoder
|
|
97
|
+
this.decode = this.defaultDecoder
|
|
98
|
+
}
|
|
99
|
+
/** @type{number | null} */
|
|
100
|
+
let awaitingConnectionOnPageShow = null
|
|
101
|
+
if(phxWindow && phxWindow.addEventListener){
|
|
102
|
+
phxWindow.addEventListener("pagehide", _e => {
|
|
103
|
+
if(this.conn){
|
|
104
|
+
this.disconnect()
|
|
105
|
+
awaitingConnectionOnPageShow = this.connectClock
|
|
106
|
+
}
|
|
107
|
+
})
|
|
108
|
+
phxWindow.addEventListener("pageshow", _e => {
|
|
109
|
+
if(awaitingConnectionOnPageShow === this.connectClock){
|
|
110
|
+
awaitingConnectionOnPageShow = null
|
|
111
|
+
this.connect()
|
|
112
|
+
}
|
|
113
|
+
})
|
|
114
|
+
phxWindow.addEventListener("visibilitychange", () => {
|
|
115
|
+
if(document.visibilityState === "hidden"){
|
|
116
|
+
this.pageHidden = true
|
|
117
|
+
} else {
|
|
118
|
+
this.pageHidden = false
|
|
119
|
+
// reconnect immediately
|
|
120
|
+
if(!this.isConnected() && !this.closeWasClean){
|
|
121
|
+
this.teardown(() => this.connect())
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
})
|
|
125
|
+
}
|
|
126
|
+
/** @type{number} */
|
|
127
|
+
this.heartbeatIntervalMs = opts.heartbeatIntervalMs || 30000
|
|
128
|
+
/** @type{boolean} */
|
|
129
|
+
this.autoSendHeartbeat = opts.autoSendHeartbeat ?? true
|
|
130
|
+
/** @type{HeartbeatCallback} */
|
|
131
|
+
this.heartbeatCallback = opts.heartbeatCallback ?? (() => {})
|
|
132
|
+
/** @type{(tries: number) => number} */
|
|
133
|
+
this.rejoinAfterMs = (tries) => {
|
|
134
|
+
if(opts.rejoinAfterMs){
|
|
135
|
+
return opts.rejoinAfterMs(tries)
|
|
136
|
+
} else {
|
|
137
|
+
return [1000, 2000, 5000][tries - 1] || 10000
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
/** @type{(tries: number) => number} */
|
|
141
|
+
this.reconnectAfterMs = (tries) => {
|
|
142
|
+
if(opts.reconnectAfterMs){
|
|
143
|
+
return opts.reconnectAfterMs(tries)
|
|
144
|
+
} else {
|
|
145
|
+
return [10, 50, 100, 150, 200, 250, 500, 1000, 2000][tries - 1] || 5000
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
/** @type{((kind: string, msg: string, data: any) => void) | null} */
|
|
149
|
+
this.logger = opts.logger || null
|
|
150
|
+
if(!this.logger && opts.debug){
|
|
151
|
+
this.logger = (kind, msg, data) => { console.log(`${kind}: ${msg}`, data) }
|
|
152
|
+
}
|
|
153
|
+
/** @type{number} */
|
|
154
|
+
this.longpollerTimeout = opts.longpollerTimeout || 20000
|
|
155
|
+
/** @type{() => Params} */
|
|
156
|
+
this.params = closure(opts.params || {})
|
|
157
|
+
/** @type{string} */
|
|
158
|
+
this.endPoint = `${endPoint}/${TRANSPORTS.websocket}`
|
|
159
|
+
/** @type{Vsn} */
|
|
160
|
+
this.vsn = opts.vsn || DEFAULT_VSN
|
|
161
|
+
/** @type{ReturnType<typeof setTimeout>} */
|
|
162
|
+
this.heartbeatTimeoutTimer = null
|
|
163
|
+
/** @type{ReturnType<typeof setTimeout>} */
|
|
164
|
+
this.heartbeatTimer = null
|
|
165
|
+
/** @type{number | null} */
|
|
166
|
+
this.heartbeatSentAt = null
|
|
167
|
+
/** @type{?string} */
|
|
168
|
+
this.pendingHeartbeatRef = null
|
|
169
|
+
/** @type{Timer} */
|
|
170
|
+
this.reconnectTimer = new Timer( () => {
|
|
171
|
+
if(this.pageHidden){
|
|
172
|
+
this.log("Not reconnecting as page is hidden!")
|
|
173
|
+
this.teardown()
|
|
174
|
+
return
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
this.teardown(async () => {
|
|
178
|
+
if(opts.beforeReconnect) await opts.beforeReconnect()
|
|
179
|
+
this.connect()
|
|
180
|
+
})
|
|
181
|
+
}, this.reconnectAfterMs)
|
|
182
|
+
/** @type{string | undefined} */
|
|
183
|
+
this.authToken = opts.authToken
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Returns the LongPoll transport reference
|
|
188
|
+
*/
|
|
189
|
+
getLongPollTransport(){ return LongPoll }
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Disconnects and replaces the active transport
|
|
193
|
+
*
|
|
194
|
+
* @param {SocketTransport} newTransport - The new transport class to instantiate
|
|
195
|
+
*
|
|
196
|
+
*/
|
|
197
|
+
replaceTransport(newTransport){
|
|
198
|
+
this.connectClock++
|
|
199
|
+
this.closeWasClean = true
|
|
200
|
+
clearTimeout(this.fallbackTimer)
|
|
201
|
+
this.reconnectTimer.reset()
|
|
202
|
+
if(this.conn){
|
|
203
|
+
this.conn.close()
|
|
204
|
+
this.conn = null
|
|
205
|
+
}
|
|
206
|
+
this.transport = newTransport
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Returns the socket protocol
|
|
211
|
+
*
|
|
212
|
+
* @returns {"wss" | "ws"}
|
|
213
|
+
*/
|
|
214
|
+
protocol(){ return location.protocol.match(/^https/) ? "wss" : "ws" }
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* The fully qualified socket url
|
|
218
|
+
*
|
|
219
|
+
* @returns {string}
|
|
220
|
+
*/
|
|
221
|
+
endPointURL(){
|
|
222
|
+
let uri = Ajax.appendParams(
|
|
223
|
+
Ajax.appendParams(this.endPoint, this.params()), {vsn: this.vsn})
|
|
224
|
+
if(uri.charAt(0) !== "/"){ return uri }
|
|
225
|
+
if(uri.charAt(1) === "/"){ return `${this.protocol()}:${uri}` }
|
|
226
|
+
|
|
227
|
+
return `${this.protocol()}://${location.host}${uri}`
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Disconnects the socket
|
|
232
|
+
*
|
|
233
|
+
* See https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent#Status_codes for valid status codes.
|
|
234
|
+
*
|
|
235
|
+
* @param {() => void} [callback] - Optional callback which is called after socket is disconnected.
|
|
236
|
+
* @param {number} [code] - A status code for disconnection (Optional).
|
|
237
|
+
* @param {string} [reason] - A textual description of the reason to disconnect. (Optional)
|
|
238
|
+
*/
|
|
239
|
+
disconnect(callback, code, reason){
|
|
240
|
+
this.connectClock++
|
|
241
|
+
this.disconnecting = true
|
|
242
|
+
this.closeWasClean = true
|
|
243
|
+
clearTimeout(this.fallbackTimer)
|
|
244
|
+
this.reconnectTimer.reset()
|
|
245
|
+
this.teardown(() => {
|
|
246
|
+
this.disconnecting = false
|
|
247
|
+
callback && callback()
|
|
248
|
+
}, code, reason)
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* @param {Params} [params] - [DEPRECATED] The params to send when connecting, for example `{user_id: userToken}`
|
|
253
|
+
*
|
|
254
|
+
* Passing params to connect is deprecated; pass them in the Socket constructor instead:
|
|
255
|
+
* `new Socket("/socket", {params: {user_id: userToken}})`.
|
|
256
|
+
*/
|
|
257
|
+
connect(params){
|
|
258
|
+
if(params){
|
|
259
|
+
console && console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor")
|
|
260
|
+
this.params = closure(params)
|
|
261
|
+
}
|
|
262
|
+
if(this.conn && !this.disconnecting){ return }
|
|
263
|
+
if(this.longPollFallbackMs && this.transport !== LongPoll){
|
|
264
|
+
this.connectWithFallback(LongPoll, this.longPollFallbackMs)
|
|
265
|
+
} else {
|
|
266
|
+
this.transportConnect()
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Logs the message. Override `this.logger` for specialized logging. noops by default
|
|
272
|
+
* @param {string} kind
|
|
273
|
+
* @param {string} msg
|
|
274
|
+
* @param {Object} data
|
|
275
|
+
*/
|
|
276
|
+
log(kind, msg, data){ this.logger && this.logger(kind, msg, data) }
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Returns true if a logger has been set on this socket.
|
|
280
|
+
*/
|
|
281
|
+
hasLogger(){ return this.logger !== null }
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Registers callbacks for connection open events
|
|
285
|
+
*
|
|
286
|
+
* @example socket.onOpen(function(){ console.info("the socket was opened") })
|
|
287
|
+
*
|
|
288
|
+
* @param {SocketOnOpen} callback
|
|
289
|
+
*/
|
|
290
|
+
onOpen(callback){
|
|
291
|
+
let ref = this.makeRef()
|
|
292
|
+
this.stateChangeCallbacks.open.push([ref, callback])
|
|
293
|
+
return ref
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Registers callbacks for connection close events
|
|
298
|
+
* @param {SocketOnClose} callback
|
|
299
|
+
* @returns {string}
|
|
300
|
+
*/
|
|
301
|
+
onClose(callback){
|
|
302
|
+
let ref = this.makeRef()
|
|
303
|
+
this.stateChangeCallbacks.close.push([ref, callback])
|
|
304
|
+
return ref
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Registers callbacks for connection error events
|
|
309
|
+
*
|
|
310
|
+
* @example socket.onError(function(error){ alert("An error occurred") })
|
|
311
|
+
*
|
|
312
|
+
* @param {SocketOnError} callback
|
|
313
|
+
* @returns {string}
|
|
314
|
+
*/
|
|
315
|
+
onError(callback){
|
|
316
|
+
let ref = this.makeRef()
|
|
317
|
+
this.stateChangeCallbacks.error.push([ref, callback])
|
|
318
|
+
return ref
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Registers callbacks for connection message events
|
|
323
|
+
* @param {SocketOnMessage} callback
|
|
324
|
+
* @returns {string}
|
|
325
|
+
*/
|
|
326
|
+
onMessage(callback){
|
|
327
|
+
let ref = this.makeRef()
|
|
328
|
+
this.stateChangeCallbacks.message.push([ref, callback])
|
|
329
|
+
return ref
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Sets a callback that receives lifecycle events for internal heartbeat messages.
|
|
334
|
+
* Useful for instrumenting connection health (e.g. sent/ok/timeout/disconnected).
|
|
335
|
+
* @param {HeartbeatCallback} callback
|
|
336
|
+
*/
|
|
337
|
+
onHeartbeat(callback){
|
|
338
|
+
this.heartbeatCallback = callback
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Pings the server and invokes the callback with the RTT in milliseconds
|
|
343
|
+
* @param {(timeDelta: number) => void} callback
|
|
344
|
+
*
|
|
345
|
+
* Returns true if the ping was pushed or false if unable to be pushed.
|
|
346
|
+
*/
|
|
347
|
+
ping(callback){
|
|
348
|
+
if(!this.isConnected()){ return false }
|
|
349
|
+
let ref = this.makeRef()
|
|
350
|
+
let startTime = Date.now()
|
|
351
|
+
this.push({topic: "phoenix", event: "heartbeat", payload: {}, ref: ref})
|
|
352
|
+
let onMsgRef = this.onMessage(msg => {
|
|
353
|
+
if(msg.ref === ref){
|
|
354
|
+
this.off([onMsgRef])
|
|
355
|
+
callback(Date.now() - startTime)
|
|
356
|
+
}
|
|
357
|
+
})
|
|
358
|
+
return true
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* @private
|
|
363
|
+
*
|
|
364
|
+
* @param {Function}
|
|
365
|
+
*/
|
|
366
|
+
transportName(transport){
|
|
367
|
+
// JavaScript minification, enabled by default in production in Phoenix
|
|
368
|
+
// projects, renames symbols to reduce code size.
|
|
369
|
+
// See https://esbuild.github.io/api/#keep-names.
|
|
370
|
+
// This helper ensures we return the correct name for the LongPoll transport
|
|
371
|
+
// even after minification. The other common transport is WebSocket, which
|
|
372
|
+
// is native to browsers and does not need special handling.
|
|
373
|
+
switch(transport){
|
|
374
|
+
case LongPoll: return "LongPoll"
|
|
375
|
+
default: return transport.name
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* @private
|
|
381
|
+
*/
|
|
382
|
+
transportConnect(){
|
|
383
|
+
this.connectClock++
|
|
384
|
+
this.closeWasClean = false
|
|
385
|
+
let protocols = undefined
|
|
386
|
+
// Sec-WebSocket-Protocol based token
|
|
387
|
+
// (longpoll uses Authorization header instead)
|
|
388
|
+
if(this.authToken){
|
|
389
|
+
protocols = ["phoenix", `${AUTH_TOKEN_PREFIX}${btoa(this.authToken).replace(/=/g, "")}`]
|
|
390
|
+
}
|
|
391
|
+
this.conn = new this.transport(this.endPointURL(), protocols)
|
|
392
|
+
this.conn.binaryType = this.binaryType
|
|
393
|
+
this.conn.timeout = this.longpollerTimeout
|
|
394
|
+
this.conn.onopen = () => this.onConnOpen()
|
|
395
|
+
this.conn.onerror = error => this.onConnError(error)
|
|
396
|
+
this.conn.onmessage = event => this.onConnMessage(event)
|
|
397
|
+
this.conn.onclose = event => this.onConnClose(event)
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
getSession(key){ return this.sessionStore && this.sessionStore.getItem(key) }
|
|
401
|
+
|
|
402
|
+
storeSession(key, val){ this.sessionStore && this.sessionStore.setItem(key, val) }
|
|
403
|
+
|
|
404
|
+
connectWithFallback(fallbackTransport, fallbackThreshold = 2500){
|
|
405
|
+
clearTimeout(this.fallbackTimer)
|
|
406
|
+
let established = false
|
|
407
|
+
let primaryTransport = true
|
|
408
|
+
let openRef, errorRef
|
|
409
|
+
let fallbackTransportName = this.transportName(fallbackTransport)
|
|
410
|
+
let fallback = (reason) => {
|
|
411
|
+
this.log("transport", `falling back to ${fallbackTransportName}...`, reason)
|
|
412
|
+
this.off([openRef, errorRef])
|
|
413
|
+
primaryTransport = false
|
|
414
|
+
this.replaceTransport(fallbackTransport)
|
|
415
|
+
this.transportConnect()
|
|
416
|
+
}
|
|
417
|
+
if(this.getSession(`phx:fallback:${fallbackTransportName}`)){ return fallback("memorized") }
|
|
418
|
+
|
|
419
|
+
this.fallbackTimer = setTimeout(fallback, fallbackThreshold)
|
|
420
|
+
|
|
421
|
+
errorRef = this.onError(reason => {
|
|
422
|
+
this.log("transport", "error", reason)
|
|
423
|
+
if(primaryTransport && !established){
|
|
424
|
+
clearTimeout(this.fallbackTimer)
|
|
425
|
+
fallback(reason)
|
|
426
|
+
}
|
|
427
|
+
})
|
|
428
|
+
if(this.fallbackRef){
|
|
429
|
+
this.off([this.fallbackRef])
|
|
430
|
+
}
|
|
431
|
+
this.fallbackRef = this.onOpen(() => {
|
|
432
|
+
established = true
|
|
433
|
+
if(!primaryTransport){
|
|
434
|
+
let fallbackTransportName = this.transportName(fallbackTransport)
|
|
435
|
+
// only memorize LP if we never connected to primary
|
|
436
|
+
if(!this.primaryPassedHealthCheck){ this.storeSession(`phx:fallback:${fallbackTransportName}`, "true") }
|
|
437
|
+
return this.log("transport", `established ${fallbackTransportName} fallback`)
|
|
438
|
+
}
|
|
439
|
+
// if we've established primary, give the fallback a new period to attempt ping
|
|
440
|
+
clearTimeout(this.fallbackTimer)
|
|
441
|
+
this.fallbackTimer = setTimeout(fallback, fallbackThreshold)
|
|
442
|
+
this.ping(rtt => {
|
|
443
|
+
this.log("transport", "connected to primary after", rtt)
|
|
444
|
+
this.primaryPassedHealthCheck = true
|
|
445
|
+
clearTimeout(this.fallbackTimer)
|
|
446
|
+
})
|
|
447
|
+
})
|
|
448
|
+
this.transportConnect()
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
clearHeartbeats(){
|
|
452
|
+
clearTimeout(this.heartbeatTimer)
|
|
453
|
+
clearTimeout(this.heartbeatTimeoutTimer)
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
onConnOpen(){
|
|
457
|
+
if(this.hasLogger()) this.log("transport", `connected to ${this.endPointURL()}`)
|
|
458
|
+
this.closeWasClean = false
|
|
459
|
+
this.disconnecting = false
|
|
460
|
+
this.establishedConnections++
|
|
461
|
+
this.flushSendBuffer()
|
|
462
|
+
this.reconnectTimer.reset()
|
|
463
|
+
if(this.autoSendHeartbeat){
|
|
464
|
+
this.resetHeartbeat()
|
|
465
|
+
}
|
|
466
|
+
this.triggerStateCallbacks("open")
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* @private
|
|
471
|
+
*/
|
|
472
|
+
|
|
473
|
+
heartbeatTimeout(){
|
|
474
|
+
if(this.pendingHeartbeatRef){
|
|
475
|
+
this.pendingHeartbeatRef = null
|
|
476
|
+
this.heartbeatSentAt = null
|
|
477
|
+
if(this.hasLogger()){ this.log("transport", "heartbeat timeout. Attempting to re-establish connection") }
|
|
478
|
+
try {
|
|
479
|
+
this.heartbeatCallback("timeout")
|
|
480
|
+
} catch (e){
|
|
481
|
+
this.log("error", "error in heartbeat callback", e)
|
|
482
|
+
}
|
|
483
|
+
this.triggerChanError(new Error("heartbeat timeout"))
|
|
484
|
+
this.closeWasClean = false
|
|
485
|
+
this.teardown(() => this.reconnectTimer.scheduleTimeout(), WS_CLOSE_NORMAL, "heartbeat timeout")
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
resetHeartbeat(){
|
|
490
|
+
if(this.conn && this.conn.skipHeartbeat){ return }
|
|
491
|
+
this.pendingHeartbeatRef = null
|
|
492
|
+
this.clearHeartbeats()
|
|
493
|
+
this.heartbeatTimer = setTimeout(() => this.sendHeartbeat(), this.heartbeatIntervalMs)
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
teardown(callback, code, reason){
|
|
497
|
+
if(!this.conn){
|
|
498
|
+
return callback && callback()
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
// If someone calls connect before we finish tearing down,
|
|
502
|
+
// we create a new connection, but we still want to finish tearing down the old one.
|
|
503
|
+
const connToClose = this.conn
|
|
504
|
+
|
|
505
|
+
this.waitForBufferDone(connToClose, () => {
|
|
506
|
+
if(code){ connToClose.close(code, reason || "") } else { connToClose.close() }
|
|
507
|
+
|
|
508
|
+
this.waitForSocketClosed(connToClose, () => {
|
|
509
|
+
if(this.conn === connToClose){
|
|
510
|
+
this.conn.onopen = function (){ } // noop
|
|
511
|
+
this.conn.onerror = function (){ } // noop
|
|
512
|
+
this.conn.onmessage = function (){ } // noop
|
|
513
|
+
this.conn.onclose = function (){ } // noop
|
|
514
|
+
this.conn = null
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
callback && callback()
|
|
518
|
+
})
|
|
519
|
+
})
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
waitForBufferDone(conn, callback, tries = 1){
|
|
523
|
+
if(tries === 5 || !conn.bufferedAmount){
|
|
524
|
+
callback()
|
|
525
|
+
return
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
setTimeout(() => {
|
|
529
|
+
this.waitForBufferDone(conn, callback, tries + 1)
|
|
530
|
+
}, 150 * tries)
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
waitForSocketClosed(conn, callback, tries = 1){
|
|
534
|
+
if(tries === 5 || conn.readyState === SOCKET_STATES.closed){
|
|
535
|
+
callback()
|
|
536
|
+
return
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
setTimeout(() => {
|
|
540
|
+
this.waitForSocketClosed(conn, callback, tries + 1)
|
|
541
|
+
}, 150 * tries)
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* @param {CloseEvent} event
|
|
546
|
+
*/
|
|
547
|
+
onConnClose(event){
|
|
548
|
+
if(this.conn) this.conn.onclose = () => {} // noop to prevent recursive calls in teardown
|
|
549
|
+
if(this.hasLogger()) this.log("transport", "close", event)
|
|
550
|
+
this.triggerChanError(event)
|
|
551
|
+
this.clearHeartbeats()
|
|
552
|
+
if(!this.closeWasClean){
|
|
553
|
+
this.reconnectTimer.scheduleTimeout()
|
|
554
|
+
}
|
|
555
|
+
this.triggerStateCallbacks("close", event)
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
/**
|
|
559
|
+
* @private
|
|
560
|
+
* @param {Event} error
|
|
561
|
+
*/
|
|
562
|
+
onConnError(error){
|
|
563
|
+
if(this.hasLogger()) this.log("transport", "error", error)
|
|
564
|
+
let transportBefore = this.transport
|
|
565
|
+
let establishedBefore = this.establishedConnections
|
|
566
|
+
this.triggerStateCallbacks("error", error, transportBefore, establishedBefore)
|
|
567
|
+
if(transportBefore === this.transport || establishedBefore > 0){
|
|
568
|
+
this.triggerChanError(error)
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* @private
|
|
574
|
+
* @param {unknown} [reason] underlying close/error event forwarded to channel error listeners
|
|
575
|
+
*/
|
|
576
|
+
triggerChanError(reason){
|
|
577
|
+
this.channels.forEach(channel => {
|
|
578
|
+
if(!(channel.isErrored() || channel.isLeaving() || channel.isClosed())){
|
|
579
|
+
channel.trigger(CHANNEL_EVENTS.error, reason)
|
|
580
|
+
}
|
|
581
|
+
})
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
/**
|
|
585
|
+
* @returns {string}
|
|
586
|
+
*/
|
|
587
|
+
connectionState(){
|
|
588
|
+
switch(this.conn && this.conn.readyState){
|
|
589
|
+
case SOCKET_STATES.connecting: return "connecting"
|
|
590
|
+
case SOCKET_STATES.open: return "open"
|
|
591
|
+
case SOCKET_STATES.closing: return "closing"
|
|
592
|
+
default: return "closed"
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
/**
|
|
597
|
+
* @returns {boolean}
|
|
598
|
+
*/
|
|
599
|
+
isConnected(){ return this.connectionState() === "open" }
|
|
600
|
+
|
|
601
|
+
/**
|
|
602
|
+
*
|
|
603
|
+
* @param {Channel} channel
|
|
604
|
+
*/
|
|
605
|
+
remove(channel){
|
|
606
|
+
this.off(channel.stateChangeRefs)
|
|
607
|
+
this.channels = this.channels.filter(c => c !== channel)
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* Removes `onOpen`, `onClose`, `onError,` and `onMessage` registrations.
|
|
612
|
+
*
|
|
613
|
+
* @param {string[]} refs - list of refs returned by calls to
|
|
614
|
+
* `onOpen`, `onClose`, `onError,` and `onMessage`
|
|
615
|
+
*/
|
|
616
|
+
off(refs){
|
|
617
|
+
for(let key in this.stateChangeCallbacks){
|
|
618
|
+
this.stateChangeCallbacks[key] = this.stateChangeCallbacks[key].filter(([ref]) => {
|
|
619
|
+
return refs.indexOf(ref) === -1
|
|
620
|
+
})
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* Initiates a new channel for the given topic
|
|
626
|
+
*
|
|
627
|
+
* @param {string} topic
|
|
628
|
+
* @param {Params | (() => Params)} [chanParams]- Parameters for the channel
|
|
629
|
+
* @returns {Channel}
|
|
630
|
+
*/
|
|
631
|
+
channel(topic, chanParams = {}){
|
|
632
|
+
let chan = new Channel(topic, chanParams, this)
|
|
633
|
+
this.channels.push(chan)
|
|
634
|
+
return chan
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
/**
|
|
638
|
+
* @param {Message<Record<string, any>>} data
|
|
639
|
+
*/
|
|
640
|
+
push(data){
|
|
641
|
+
if(this.hasLogger()){
|
|
642
|
+
let {topic, event, payload, ref, join_ref} = data
|
|
643
|
+
this.log("push", `${topic} ${event} (${join_ref}, ${ref})`, payload)
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
if(this.isConnected()){
|
|
647
|
+
this.encode(data, result => this.conn.send(result))
|
|
648
|
+
} else {
|
|
649
|
+
this.sendBuffer.push(() => this.encode(data, result => this.conn.send(result)))
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
/**
|
|
654
|
+
* Return the next message ref, accounting for overflows
|
|
655
|
+
* @returns {string}
|
|
656
|
+
*/
|
|
657
|
+
makeRef(){
|
|
658
|
+
let newRef = this.ref + 1
|
|
659
|
+
if(newRef === this.ref){ this.ref = 0 } else { this.ref = newRef }
|
|
660
|
+
|
|
661
|
+
return this.ref.toString()
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
sendHeartbeat(){
|
|
665
|
+
if(!this.isConnected()){
|
|
666
|
+
try {
|
|
667
|
+
this.heartbeatCallback("disconnected")
|
|
668
|
+
} catch (e){
|
|
669
|
+
this.log("error", "error in heartbeat callback", e)
|
|
670
|
+
}
|
|
671
|
+
return
|
|
672
|
+
}
|
|
673
|
+
if(this.pendingHeartbeatRef){
|
|
674
|
+
this.heartbeatTimeout()
|
|
675
|
+
return
|
|
676
|
+
}
|
|
677
|
+
this.pendingHeartbeatRef = this.makeRef()
|
|
678
|
+
this.heartbeatSentAt = Date.now()
|
|
679
|
+
this.push({topic: "phoenix", event: "heartbeat", payload: {}, ref: this.pendingHeartbeatRef})
|
|
680
|
+
try {
|
|
681
|
+
this.heartbeatCallback("sent")
|
|
682
|
+
} catch (e){
|
|
683
|
+
this.log("error", "error in heartbeat callback", e)
|
|
684
|
+
}
|
|
685
|
+
this.heartbeatTimeoutTimer = setTimeout(() => this.heartbeatTimeout(), this.heartbeatIntervalMs)
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
flushSendBuffer(){
|
|
689
|
+
if(this.isConnected() && this.sendBuffer.length > 0){
|
|
690
|
+
this.sendBuffer.forEach(callback => callback())
|
|
691
|
+
this.sendBuffer = []
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
/**
|
|
696
|
+
* @param {MessageEvent<any>} rawMessage
|
|
697
|
+
*/
|
|
698
|
+
onConnMessage(rawMessage){
|
|
699
|
+
this.decode(rawMessage.data, msg => {
|
|
700
|
+
let {topic, event, payload, ref, join_ref} = msg
|
|
701
|
+
if(ref && ref === this.pendingHeartbeatRef){
|
|
702
|
+
const latency = this.heartbeatSentAt ? Date.now() - this.heartbeatSentAt : undefined
|
|
703
|
+
this.clearHeartbeats()
|
|
704
|
+
try {
|
|
705
|
+
this.heartbeatCallback(payload.status === "ok" ? "ok" : "error", latency)
|
|
706
|
+
} catch (e){
|
|
707
|
+
this.log("error", "error in heartbeat callback", e)
|
|
708
|
+
}
|
|
709
|
+
this.pendingHeartbeatRef = null
|
|
710
|
+
this.heartbeatSentAt = null
|
|
711
|
+
if(this.autoSendHeartbeat){
|
|
712
|
+
this.heartbeatTimer = setTimeout(() => this.sendHeartbeat(), this.heartbeatIntervalMs)
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
if(this.hasLogger()) this.log("receive", `${payload.status || ""} ${topic} ${event} ${ref && "(" + ref + ")" || ""}`.trim(), payload)
|
|
717
|
+
|
|
718
|
+
for(let i = 0; i < this.channels.length; i++){
|
|
719
|
+
const channel = this.channels[i]
|
|
720
|
+
if(!channel.isMember(topic, event, payload, join_ref)){ continue }
|
|
721
|
+
channel.trigger(event, payload, ref, join_ref)
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
this.triggerStateCallbacks("message", msg)
|
|
725
|
+
})
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
/**
|
|
729
|
+
* @private
|
|
730
|
+
* @template {keyof SocketStateChangeCallbacks} K
|
|
731
|
+
* @param {K} event
|
|
732
|
+
* @param {...Parameters<SocketStateChangeCallbacks[K][number][1]>} args
|
|
733
|
+
* @returns {void}
|
|
734
|
+
*/
|
|
735
|
+
triggerStateCallbacks(event, ...args){
|
|
736
|
+
try {
|
|
737
|
+
this.stateChangeCallbacks[event].forEach(([_, callback]) => {
|
|
738
|
+
try {
|
|
739
|
+
callback(...args)
|
|
740
|
+
} catch (e){
|
|
741
|
+
this.log("error", `error in ${event} callback`, e)
|
|
742
|
+
}
|
|
743
|
+
})
|
|
744
|
+
} catch (e){
|
|
745
|
+
this.log("error", `error triggering ${event} callbacks`, e)
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
leaveOpenTopic(topic){
|
|
750
|
+
let dupChannel = this.channels.find(c => c.topic === topic && (c.isJoined() || c.isJoining()))
|
|
751
|
+
if(dupChannel){
|
|
752
|
+
if(this.hasLogger()) this.log("transport", `leaving duplicate topic "${topic}"`)
|
|
753
|
+
dupChannel.leave()
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
}
|