diff --git a/ably.d.ts b/ably.d.ts index 5b6384fe8a..39951541c9 100644 --- a/ably.d.ts +++ b/ably.d.ts @@ -364,7 +364,7 @@ declare namespace Types { } /** - * Passes additional client-specific properties to the REST {@link Rest.constructor | `constructor()`} or the Realtime {@link Realtime.constructor | `constructor()`}. + * Passes additional client-specific properties to the REST {@link AbstractRest.constructor | `constructor()`} or the Realtime {@link AbstractRealtime.constructor | `constructor()`}. */ interface ClientOptions extends AuthOptions { /** @@ -1336,8 +1336,8 @@ declare namespace Types { /** * The `StatsParams` interface describes the parameters accepted by the following methods: * - * - {@link Rest.stats} - * - {@link Realtime.stats} + * - {@link AbstractRest.stats} + * - {@link AbstractRealtime.stats} */ interface StatsParams { /** @@ -1658,7 +1658,7 @@ declare namespace Types { /** * A client that offers a simple stateless API to interact directly with Ably's REST API. */ - abstract class Rest { + abstract class AbstractRest { /** * An {@link Types.Auth} object. */ @@ -1730,9 +1730,9 @@ declare namespace Types { } /** - * A client that extends the functionality of {@link Rest} and provides additional realtime-specific features. + * A client that extends the functionality of {@link AbstractRest} and provides additional realtime-specific features. */ - abstract class Realtime { + abstract class AbstractRealtime { /** * A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId` can be any non-empty string, except it cannot contain a `*`. This option is primarily intended to be used in situations where the library is instantiated with a key. A `clientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId` specified here conflicts with the `clientId` implicit in the token. */ @@ -2765,7 +2765,7 @@ declare namespace Types { /** * A client that offers a simple stateless API to interact directly with Ably's REST API. */ -export declare class Rest extends Types.Rest { +export declare class Rest extends Types.AbstractRest { /** * Construct a client object using an Ably {@link Types.ClientOptions} object. * @@ -2795,7 +2795,7 @@ export declare class Rest extends Types.Rest { /** * A client that extends the functionality of {@link Rest} and provides additional realtime-specific features. */ -export declare class Realtime extends Types.Realtime { +export declare class Realtime extends Types.AbstractRealtime { /** * Construct a client object using an Ably {@link Types.ClientOptions} object. * diff --git a/modules.d.ts b/modules.d.ts index b4782e5502..c621879024 100644 --- a/modules.d.ts +++ b/modules.d.ts @@ -242,7 +242,7 @@ export interface ModulesMap { * * `BaseRest` is the equivalent, in the modular variant of the Ably Client Library SDK, of the [`Rest`](../../default/classes/Rest.html) class in the default variant of the SDK. The difference is that its constructor allows you to decide exactly which functionality the client should include. This allows unused functionality to be tree-shaken, reducing bundle size. */ -export declare class BaseRest extends Types.Rest { +export declare class BaseRest extends Types.AbstractRest { /** * Construct a client object using an Ably {@link Types.ClientOptions} object. * @@ -261,7 +261,7 @@ export declare class BaseRest extends Types.Rest { * * `BaseRealtime` is the equivalent, in the modular variant of the Ably Client Library SDK, of the [`Realtime`](../../default/classes/Realtime.html) class in the default variant of the SDK. The difference is that its constructor allows you to decide exactly which functionality the client should include. This allows unused functionality to be tree-shaken, reducing bundle size. */ -export declare class BaseRealtime extends Types.Realtime { +export declare class BaseRealtime extends Types.AbstractRealtime { /** * Construct a client object using an Ably {@link Types.ClientOptions} object. * diff --git a/src/platform/react-hooks/src/AblyProvider.tsx b/src/platform/react-hooks/src/AblyProvider.tsx index a7ef61b879..855de7a0d2 100644 --- a/src/platform/react-hooks/src/AblyProvider.tsx +++ b/src/platform/react-hooks/src/AblyProvider.tsx @@ -8,11 +8,11 @@ const canUseSymbol = typeof Symbol === 'function' && typeof Symbol.for === 'func interface AblyProviderProps { children?: React.ReactNode | React.ReactNode[] | null; - client?: Ably.Types.Realtime; + client?: Ably.Types.AbstractRealtime; id?: string; } -type AblyContextType = React.Context; +type AblyContextType = React.Context; // An object is appended to `React.createContext` which stores all contexts // indexed by id, which is used by useAbly to find the correct context when an diff --git a/src/platform/react-hooks/src/hooks/useAbly.ts b/src/platform/react-hooks/src/hooks/useAbly.ts index be2910857b..12728583fb 100644 --- a/src/platform/react-hooks/src/hooks/useAbly.ts +++ b/src/platform/react-hooks/src/hooks/useAbly.ts @@ -2,8 +2,8 @@ import React from 'react'; import { getContext } from '../AblyProvider.js'; import * as API from '../../../../../ably.js'; -export function useAbly(id = 'default'): API.Types.Realtime { - const client = React.useContext(getContext(id)) as API.Types.Realtime; +export function useAbly(id = 'default'): API.Types.AbstractRealtime { + const client = React.useContext(getContext(id)) as API.Types.AbstractRealtime; if (!client) { throw new Error( diff --git a/src/platform/react-hooks/src/hooks/useChannel.test.tsx b/src/platform/react-hooks/src/hooks/useChannel.test.tsx index a1f66dcc34..91db939496 100644 --- a/src/platform/react-hooks/src/hooks/useChannel.test.tsx +++ b/src/platform/react-hooks/src/hooks/useChannel.test.tsx @@ -8,7 +8,7 @@ import { act } from 'react-dom/test-utils'; import { AblyProvider } from '../AblyProvider.js'; function renderInCtxProvider(client: FakeAblySdk, children: React.ReactNode | React.ReactNode[]) { - return render({children}); + return render({children}); } describe('useChannel', () => { @@ -57,7 +57,7 @@ describe('useChannel', () => { it('useChannel works with multiple clients', async () => { renderInCtxProvider( ablyClient, - + ); diff --git a/src/platform/react-hooks/src/hooks/useChannel.ts b/src/platform/react-hooks/src/hooks/useChannel.ts index f6becb3afd..7ef289de5f 100644 --- a/src/platform/react-hooks/src/hooks/useChannel.ts +++ b/src/platform/react-hooks/src/hooks/useChannel.ts @@ -8,7 +8,7 @@ export type AblyMessageCallback = Types.messageCallback; export interface ChannelResult { channel: Types.RealtimeChannel; - ably: Types.Realtime; + ably: Types.AbstractRealtime; connectionError: ErrorInfo | null; channelError: ErrorInfo | null; } diff --git a/src/platform/react-hooks/src/hooks/useChannelStateListener.test.tsx b/src/platform/react-hooks/src/hooks/useChannelStateListener.test.tsx index eee3e4d1fe..d3026cdb96 100644 --- a/src/platform/react-hooks/src/hooks/useChannelStateListener.test.tsx +++ b/src/platform/react-hooks/src/hooks/useChannelStateListener.test.tsx @@ -9,7 +9,7 @@ import { act } from 'react-dom/test-utils'; import { AblyProvider } from '../AblyProvider.js'; function renderInCtxProvider(client: FakeAblySdk, children: React.ReactNode | React.ReactNode[]) { - return render({children}); + return render({children}); } describe('useChannelStateListener', () => { diff --git a/src/platform/react-hooks/src/hooks/useConnectionStateListener.test.tsx b/src/platform/react-hooks/src/hooks/useConnectionStateListener.test.tsx index 068449d54e..7f47ba9239 100644 --- a/src/platform/react-hooks/src/hooks/useConnectionStateListener.test.tsx +++ b/src/platform/react-hooks/src/hooks/useConnectionStateListener.test.tsx @@ -9,7 +9,7 @@ import { AblyProvider } from '../AblyProvider.js'; import { useConnectionStateListener } from './useConnectionStateListener.js'; function renderInCtxProvider(client: FakeAblySdk, children: React.ReactNode | React.ReactNode[]) { - return render({children}); + return render({children}); } describe('useConnectionStateListener', () => { diff --git a/src/platform/react-hooks/src/hooks/usePresence.test.tsx b/src/platform/react-hooks/src/hooks/usePresence.test.tsx index 659163ba92..7651fceb96 100644 --- a/src/platform/react-hooks/src/hooks/usePresence.test.tsx +++ b/src/platform/react-hooks/src/hooks/usePresence.test.tsx @@ -7,7 +7,7 @@ import { AblyProvider } from '../AblyProvider.js'; import { Types, ErrorInfo } from '../../../../../ably.js'; function renderInCtxProvider(client: FakeAblySdk, children: React.ReactNode | React.ReactNode[]) { - return render({children}); + return render({children}); } const testChannelName = 'testChannel'; @@ -97,7 +97,7 @@ describe('usePresence', () => { it('usePresence works with multiple clients', async () => { renderInCtxProvider( ablyClient, - + );