Skip to content

Commit beed33b

Browse files
authored
Only export types for TokenSource variants to try to push users to use the TokenSource.foo static constructors instead (#1707)
1 parent f0e578a commit beed33b

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

.changeset/heavy-baths-double.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'livekit-client': patch
3+
---
4+
5+
Only export types for TokenSource variants to try to push users to use the TokenSource.foo static constructors instead

src/room/token-source/TokenSource.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ abstract class TokenSourceCached extends TokenSourceConfigurable {
9494
type LiteralOrFn =
9595
| TokenSourceResponseObject
9696
| (() => TokenSourceResponseObject | Promise<TokenSourceResponseObject>);
97-
export class TokenSourceLiteral extends TokenSourceFixed {
97+
class TokenSourceLiteral extends TokenSourceFixed {
9898
private literalOrFn: LiteralOrFn;
9999

100100
constructor(literalOrFn: LiteralOrFn) {
@@ -114,7 +114,7 @@ export class TokenSourceLiteral extends TokenSourceFixed {
114114
type CustomFn = (
115115
options: TokenSourceFetchOptions,
116116
) => TokenSourceResponseObject | Promise<TokenSourceResponseObject>;
117-
export class TokenSourceCustom extends TokenSourceCached {
117+
class TokenSourceCustom extends TokenSourceCached {
118118
private customFn: CustomFn;
119119

120120
constructor(customFn: CustomFn) {
@@ -142,7 +142,7 @@ export class TokenSourceCustom extends TokenSourceCached {
142142

143143
export type EndpointOptions = Omit<RequestInit, 'body'>;
144144

145-
export class TokenSourceEndpoint extends TokenSourceCached {
145+
class TokenSourceEndpoint extends TokenSourceCached {
146146
private url: string;
147147

148148
private endpointOptions: EndpointOptions;
@@ -231,7 +231,7 @@ export type SandboxTokenServerOptions = {
231231
baseUrl?: string;
232232
};
233233

234-
export class TokenSourceSandboxTokenServer extends TokenSourceEndpoint {
234+
class TokenSourceSandboxTokenServer extends TokenSourceEndpoint {
235235
constructor(sandboxId: string, options: SandboxTokenServerOptions) {
236236
const { baseUrl = 'https://cloud-api.livekit.io', ...rest } = options;
237237

@@ -244,6 +244,13 @@ export class TokenSourceSandboxTokenServer extends TokenSourceEndpoint {
244244
}
245245
}
246246

247+
export {
248+
type TokenSourceLiteral,
249+
type TokenSourceCustom,
250+
type TokenSourceEndpoint,
251+
type TokenSourceSandboxTokenServer,
252+
};
253+
247254
export const TokenSource = {
248255
/** TokenSource.literal contains a single, literal set of {@link TokenSourceResponseObject}
249256
* credentials, either provided directly or returned from a provided function. */

0 commit comments

Comments
 (0)