diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0d4123d..5936497 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -16,7 +16,7 @@ importers: version: 6.1.4 laravel-echo: specifier: ^1.16.1 - version: 1.16.1 + version: 1.17.0 ofetch: specifier: ^1.4.0 version: 1.4.1 @@ -2884,8 +2884,8 @@ packages: kolorist@1.8.0: resolution: {integrity: sha512-Y+60/zizpJ3HRH8DCss+q95yr6145JXZo46OTpFvDZWLfRCE4qChOyk1b26nMaNpfHHgxagk9dXT5OP0Tfe+dQ==} - laravel-echo@1.16.1: - resolution: {integrity: sha512-++Ylb6M3ariC9Rk5WE5gZjj6wcEV5kvLF8b+geJ5/rRIfdoOA+eG6b9qJPrarMD9rY28Apx+l3eelIrCc2skVg==} + laravel-echo@1.17.0: + resolution: {integrity: sha512-uf+BVZMkXc7+pzxS2dG5v1P+MT3yWS+/9oDSJUcQ4KqnDKLYfM1lc7yUmnxvLtwPksGuQJv6XBtzvWLHSEheNQ==} engines: {node: '>=10'} launch-editor@2.9.1: @@ -7494,7 +7494,7 @@ snapshots: kolorist@1.8.0: {} - laravel-echo@1.16.1: {} + laravel-echo@1.17.0: {} launch-editor@2.9.1: dependencies: diff --git a/src/runtime/composables/useEcho.ts b/src/runtime/composables/useEcho.ts index 7bfca7f..1250c5c 100644 --- a/src/runtime/composables/useEcho.ts +++ b/src/runtime/composables/useEcho.ts @@ -1,8 +1,9 @@ import type Echo from 'laravel-echo' +import type { SupportedBroadcaster } from '../types' import { useNuxtApp } from '#app' -export const useEcho = (): Echo => { +export const useEcho = (): Echo => { const { $echo } = useNuxtApp() - return $echo as Echo + return $echo as Echo } diff --git a/src/runtime/plugin.client.ts b/src/runtime/plugin.client.ts index 75baadd..1600564 100644 --- a/src/runtime/plugin.client.ts +++ b/src/runtime/plugin.client.ts @@ -4,7 +4,7 @@ import type { ChannelAuthorizationData } from 'pusher-js/types/src/core/auth/opt import { type ConsolaInstance, createConsola } from 'consola' import type { FetchOptions } from 'ofetch' import { useEchoConfig } from './composables/useEchoConfig' -import type { Authentication, ModuleOptions } from './types' +import type { Authentication, ModuleOptions, SupportedBroadcaster } from './types' import { createError, defineNuxtPlugin, useCookie } from '#app' // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -12,7 +12,7 @@ const Pusher = (PusherPkg as any).default || PusherPkg declare global { interface Window { - Echo: Echo + Echo: Echo Pusher: typeof Pusher } } diff --git a/src/runtime/types.ts b/src/runtime/types.ts index c860adc..70a461d 100644 --- a/src/runtime/types.ts +++ b/src/runtime/types.ts @@ -1,3 +1,5 @@ +export type SupportedBroadcaster = 'reverb' | 'pusher' + export interface Authentication { /** * The base URL of Laravel application. @@ -36,7 +38,7 @@ export interface ModuleOptions { * The Laravel broadcaster type to use. * @default 'reverb' */ - broadcaster: 'reverb' | 'pusher' + broadcaster: SupportedBroadcaster /** * The host to connect to WebSocket. * @default 'localhost'