-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split REST functionality into a tree-shakable module
This moves the following functionality from BaseRest into a new module named Rest: - methods that wrap REST endpoints (e.g. `stats`) - the `request` method - all functionality accessed via `BaseRest.channels` and `BaseRest.push` This allows us to now construct a BaseRealtime instance that doesn’t have REST functionality. Note that the BaseRest class always includes the Rest module. This comes after discussions in which we decided that it would be quite useless without it. Resolves #1374. Co-authored-by: Owen Pearson <owen.pearson@ably.com>
- Loading branch information
1 parent
20cc204
commit dd80361
Showing
9 changed files
with
277 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,15 @@ | ||
import BaseClient from './baseclient'; | ||
import ClientOptions from '../../types/ClientOptions'; | ||
import { ModulesMap } from './modulesmap'; | ||
import { Rest } from './rest'; | ||
|
||
/** | ||
`BaseRest` is an export of the tree-shakable version of the SDK, and acts as the base class for the `BaseRest` class exported by the non tree-shakable version. | ||
It always includes the `Rest` module. | ||
*/ | ||
export class BaseRest extends BaseClient {} | ||
export class BaseRest extends BaseClient { | ||
constructor(options: ClientOptions | string, modules: ModulesMap) { | ||
super(options, { Rest, ...modules }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
export interface ModulesMap {} | ||
import { Rest } from './rest'; | ||
|
||
export const allCommonModules: ModulesMap = {}; | ||
export interface ModulesMap { | ||
Rest?: typeof Rest; | ||
} | ||
|
||
export const allCommonModules: ModulesMap = { Rest }; |
Oops, something went wrong.