diff --git a/ably.d.ts b/ably.d.ts index 0b42cb2725..3fe3104e4b 100644 --- a/ably.d.ts +++ b/ably.d.ts @@ -4,12 +4,12 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import { - AbstractRest, + RestInterface, ClientOptions, Crypto, MessageStatic, PresenceMessageStatic, - AbstractRealtime, + RealtimeInterface, Auth, Channels, Channel, @@ -31,7 +31,7 @@ import { /** * A client that offers a simple stateless API to interact directly with Ably's REST API. */ -export declare class Rest implements AbstractRest { +export declare class Rest implements RestInterface { /** * Construct a client object using an Ably {@link ClientOptions} object. * @@ -57,7 +57,7 @@ export declare class Rest implements AbstractRest { */ static PresenceMessage: PresenceMessageStatic; - // Requirements of AbstractRest + // Requirements of RestInterface auth: Auth; channels: Channels; @@ -82,7 +82,7 @@ export declare class Rest implements AbstractRest { /** * A client that extends the functionality of {@link Rest} and provides additional realtime-specific features. */ -export declare class Realtime implements AbstractRealtime { +export declare class Realtime implements RealtimeInterface { /** * Construct a client object using an Ably {@link ClientOptions} object. * @@ -108,7 +108,7 @@ export declare class Realtime implements AbstractRealtime { */ static PresenceMessage: PresenceMessageStatic; - // Requirements of AbstractRealtime + // Requirements of RealtimeInterface clientId: string; close(): void; diff --git a/modules.d.ts b/modules.d.ts index 1ad73d1d00..6010f169e1 100644 --- a/modules.d.ts +++ b/modules.d.ts @@ -1,11 +1,11 @@ import { ErrorInfo } from './ably'; import { - AbstractRest, + RestInterface, ClientOptions, Crypto as CryptoClass, MessageStatic, PresenceMessageStatic, - AbstractRealtime, + RealtimeInterface, Auth, Channels, Channel, @@ -266,7 +266,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 implements AbstractRest { +export declare class BaseRest implements RestInterface { /** * Construct a client object using an Ably {@link ClientOptions} object. * @@ -279,7 +279,7 @@ export declare class BaseRest implements AbstractRest { */ constructor(options: ClientOptions, modules: ModulesMap); - // Requirements of AbstractRest + // Requirements of RestInterface auth: Auth; channels: Channels; @@ -307,7 +307,7 @@ export declare class BaseRest implements AbstractRest { * * `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 implements AbstractRealtime { +export declare class BaseRealtime implements RealtimeInterface { /** * Construct a client object using an Ably {@link ClientOptions} object. * @@ -321,7 +321,7 @@ export declare class BaseRealtime implements AbstractRealtime { */ constructor(options: ClientOptions, modules: ModulesMap); - // Requirements of AbstractRealtime + // Requirements of RealtimeInterface clientId: string; close(): void; diff --git a/src/platform/react-hooks/src/AblyProvider.tsx b/src/platform/react-hooks/src/AblyProvider.tsx index cfd2ef50e7..608a4ea538 100644 --- a/src/platform/react-hooks/src/AblyProvider.tsx +++ b/src/platform/react-hooks/src/AblyProvider.tsx @@ -7,11 +7,11 @@ const canUseSymbol = typeof Symbol === 'function' && typeof Symbol.for === 'func interface AblyProviderProps { children?: React.ReactNode | React.ReactNode[] | null; - client?: Ably.Ably.AbstractRealtime; + client?: Ably.Ably.RealtimeInterface; 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 470bbc24c1..4cc1c3fc6b 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.AbstractRealtime { - const client = React.useContext(getContext(id)) as API.AbstractRealtime; +export function useAbly(id = 'default'): API.RealtimeInterface { + const client = React.useContext(getContext(id)) as API.RealtimeInterface; 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 fea775df45..b0527d247b 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 47218f7320..9d2370b491 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 = Ably.messageCallback; export interface ChannelResult { channel: Ably.RealtimeChannel; - ably: Ably.AbstractRealtime; + ably: Ably.RealtimeInterface; connectionError: Ably.ErrorInfo | null; channelError: Ably.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 3187087a57..34af6521b0 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 b96c5e2b2b..223953a6cf 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 f22dbe048b..14b5bc266e 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 * as Ably 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, - + ); diff --git a/types.d.ts b/types.d.ts index e2fb35cfb9..694544edf2 100644 --- a/types.d.ts +++ b/types.d.ts @@ -364,7 +364,7 @@ export interface ChannelMetrics { } /** - * Passes additional client-specific properties to the REST {@link AbstractRest.constructor | `constructor()`} or the Realtime {@link AbstractRealtime.constructor | `constructor()`}. + * Passes additional client-specific properties to the REST {@link RestInterface.constructor | `constructor()`} or the Realtime {@link RealtimeInterface.constructor | `constructor()`}. */ export interface ClientOptions extends AuthOptions { /** @@ -1340,8 +1340,8 @@ export interface PushChannelsParams { /** * The `StatsParams` interface describes the parameters accepted by the following methods: * - * - {@link AbstractRest.stats} - * - {@link AbstractRealtime.stats} + * - {@link RestInterface.stats} + * - {@link RealtimeInterface.stats} */ export interface StatsParams { /** @@ -1662,7 +1662,7 @@ export interface EventEmitter { /** * A client that offers a simple stateless API to interact directly with Ably's REST API. */ -export interface AbstractRest { +export interface RestInterface { /** * An {@link Auth} object. */ @@ -1734,9 +1734,9 @@ export interface AbstractRest { } /** - * A client that extends the functionality of {@link AbstractRest} and provides additional realtime-specific features. + * A client that extends the functionality of {@link RestInterface} and provides additional realtime-specific features. */ -export interface AbstractRealtime { +export interface RealtimeInterface { /** * 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. */