Skip to content

Commit

Permalink
Restore previously exported types
Browse files Browse the repository at this point in the history
  • Loading branch information
MeenaAlfons committed Jul 22, 2022
1 parent 0585534 commit cbb46e5
Show file tree
Hide file tree
Showing 12 changed files with 119 additions and 50 deletions.
29 changes: 19 additions & 10 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
export {
DeprecatedAuthOptions,
ChannelAuthorizerGenerator,
ChannelAuthorizerGenerator
} from './types/src/core/auth/deprecated_channel_authorizer';
export {
AuthOptions,
UserAuthenticationOptions,
ChannelAuthorizationOptions,
ChannelAuthorizationHandler,
UserAuthenticationHandler,
ChannelAuthorizationCallback,
UserAuthenticationCallback,
UserAuthenticationCallback
} from './types/src/core/auth/options';
export { Options } from './types/src/core/options'
export { Options } from './types/src/core/options';

export {default as Channel} from './types/src/core/channels/channel';
export {default as PresenceChannel} from './types/src/core/channels/presence_channel';
export {default as Members} from './types/src/core/channels/members';
export {default as Runtime} from './types/src/runtimes/interface'
export {default as ConnectionManager} from './types/src/core/connection/connection_manager'
export { default as Channel } from './types/src/core/channels/channel';
export { default as PresenceChannel } from './types/src/core/channels/presence_channel';
export { default as Members } from './types/src/core/channels/members';
export { default as Runtime } from './types/src/runtimes/interface';
export { default as ConnectionManager } from './types/src/core/connection/connection_manager';

export {default} from './types/src/core/pusher'
export { default } from './types/src/core/pusher';

// The following types are provided for backward compatability
export {
DeprecatedAuthOptions as AuthOptions,
DeprecatedChannelAuthorizer as Authorizer,
ChannelAuthorizerGenerator as AuthorizerGenerator
} from './types/src/core/auth/deprecated_channel_authorizer';
export { ChannelAuthorizationCallback as AuthorizerCallback } from './types/src/core/auth/options';
22 changes: 18 additions & 4 deletions react-native/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
export {
Authorizer,
AuthOptions,
AuthorizerGenerator,
AuthorizerCallback,
DeprecatedAuthOptions,
ChannelAuthorizerGenerator
} from '../types/src/core/auth/deprecated_channel_authorizer';
export {
UserAuthenticationOptions,
ChannelAuthorizationOptions,
ChannelAuthorizationHandler,
UserAuthenticationHandler,
ChannelAuthorizationCallback,
UserAuthenticationCallback
} from '../types/src/core/auth/options';
export { Options } from '../types/src/core/options';

Expand All @@ -13,3 +19,11 @@ export { default as Runtime } from '../types/src/runtimes/interface';
export { default as ConnectionManager } from '../types/src/core/connection/connection_manager';

export { default } from '../types/src/core/pusher';

// The following types are provided for backward compatability
export {
DeprecatedAuthOptions as AuthOptions,
DeprecatedChannelAuthorizer as Authorizer,
ChannelAuthorizerGenerator as AuthorizerGenerator
} from '../types/src/core/auth/deprecated_channel_authorizer';
export { ChannelAuthorizationCallback as AuthorizerCallback } from '../types/src/core/auth/options';
9 changes: 8 additions & 1 deletion src/core/auth/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,21 @@ export type AuthTransportCallback =
| ChannelAuthorizationCallback
| UserAuthenticationCallback;

export interface AuthOptions<AuthHandler> {
export interface AuthOptionsT<AuthHandler> {
transport: 'ajax' | 'jsonp';
endpoint: string;
params?: any;
headers?: any;
customHandler?: AuthHandler;
}

export declare type UserAuthenticationOptions = AuthOptionsT<
UserAuthenticationHandler
>;
export declare type ChannelAuthorizationOptions = AuthOptionsT<
ChannelAuthorizationHandler
>;

export interface InternalAuthOptions {
transport: 'ajax' | 'jsonp';
endpoint: string;
Expand Down
9 changes: 3 additions & 6 deletions src/core/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Defaults from './defaults';
import {
ChannelAuthorizationHandler,
UserAuthenticationHandler,
AuthOptions
ChannelAuthorizationOptions
} from './auth/options';
import UserAuthenticator from './auth/user_authenticator';
import ChannelAuthorizer from './auth/channel_authorizer';
Expand Down Expand Up @@ -150,11 +150,8 @@ function buildUserAuthenticator(opts: Options): UserAuthenticationHandler {
return UserAuthenticator(userAuthentication);
}

function buildChannelAuth(
opts: Options,
pusher
): AuthOptions<ChannelAuthorizationHandler> {
let channelAuthorization: AuthOptions<ChannelAuthorizationHandler>;
function buildChannelAuth(opts: Options, pusher): ChannelAuthorizationOptions {
let channelAuthorization: ChannelAuthorizationOptions;
if ('channelAuthorization' in opts) {
channelAuthorization = {
...Defaults.channelAuthorization,
Expand Down
9 changes: 4 additions & 5 deletions src/core/defaults.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
AuthOptions,
ChannelAuthorizationHandler,
UserAuthenticationHandler
ChannelAuthorizationOptions,
UserAuthenticationOptions
} from './auth/options';
import { AuthTransport } from './config';

Expand All @@ -22,8 +21,8 @@ export interface DefaultConfig {
pongTimeout: number;
unavailableTimeout: number;
cluster: string;
userAuthentication: AuthOptions<UserAuthenticationHandler>;
channelAuthorization: AuthOptions<ChannelAuthorizationHandler>;
userAuthentication: UserAuthenticationOptions;
channelAuthorization: ChannelAuthorizationOptions;

cdn_http?: string;
cdn_https?: string;
Expand Down
9 changes: 4 additions & 5 deletions src/core/options.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import ConnectionManager from './connection/connection_manager';
import {
AuthOptions,
ChannelAuthorizationHandler,
UserAuthenticationHandler
ChannelAuthorizationOptions,
UserAuthenticationOptions
} from './auth/options';
import {
ChannelAuthorizerGenerator,
Expand All @@ -19,8 +18,8 @@ export interface Options {
authTransport?: AuthTransport; // DEPRECATED use channelAuthorization instead
authorizer?: ChannelAuthorizerGenerator; // DEPRECATED use channelAuthorization instead

channelAuthorization?: AuthOptions<ChannelAuthorizationHandler>;
userAuthentication?: AuthOptions<UserAuthenticationHandler>;
channelAuthorization?: ChannelAuthorizationOptions;
userAuthentication?: UserAuthenticationOptions;

cluster?: string;
enableStats?: boolean;
Expand Down
4 changes: 3 additions & 1 deletion types/src/core/auth/options.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ export interface UserAuthenticationHandler {
(params: UserAuthenticationRequestParams, callback: UserAuthenticationCallback): void;
}
export declare type AuthTransportCallback = ChannelAuthorizationCallback | UserAuthenticationCallback;
export interface AuthOptions<AuthHandler> {
export interface AuthOptionsT<AuthHandler> {
transport: 'ajax' | 'jsonp';
endpoint: string;
params?: any;
headers?: any;
customHandler?: AuthHandler;
}
export declare type UserAuthenticationOptions = AuthOptionsT<UserAuthenticationHandler>;
export declare type ChannelAuthorizationOptions = AuthOptionsT<ChannelAuthorizationHandler>;
export interface InternalAuthOptions {
transport: 'ajax' | 'jsonp';
endpoint: string;
Expand Down
6 changes: 3 additions & 3 deletions types/src/core/defaults.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AuthOptions, ChannelAuthorizationHandler, UserAuthenticationHandler } from './auth/options';
import { ChannelAuthorizationOptions, UserAuthenticationOptions } from './auth/options';
import { AuthTransport } from './config';
export interface DefaultConfig {
VERSION: string;
Expand All @@ -17,8 +17,8 @@ export interface DefaultConfig {
pongTimeout: number;
unavailableTimeout: number;
cluster: string;
userAuthentication: AuthOptions<UserAuthenticationHandler>;
channelAuthorization: AuthOptions<ChannelAuthorizationHandler>;
userAuthentication: UserAuthenticationOptions;
channelAuthorization: ChannelAuthorizationOptions;
cdn_http?: string;
cdn_https?: string;
dependency_suffix?: string;
Expand Down
6 changes: 3 additions & 3 deletions types/src/core/options.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AuthOptions, ChannelAuthorizationHandler, UserAuthenticationHandler } from './auth/options';
import { ChannelAuthorizationOptions, UserAuthenticationOptions } from './auth/options';
import { ChannelAuthorizerGenerator, DeprecatedAuthOptions } from './auth/deprecated_channel_authorizer';
import { AuthTransport, Transport } from './config';
import * as nacl from 'tweetnacl';
Expand All @@ -8,8 +8,8 @@ export interface Options {
authEndpoint?: string;
authTransport?: AuthTransport;
authorizer?: ChannelAuthorizerGenerator;
channelAuthorization?: AuthOptions<ChannelAuthorizationHandler>;
userAuthentication?: AuthOptions<UserAuthenticationHandler>;
channelAuthorization?: ChannelAuthorizationOptions;
userAuthentication?: UserAuthenticationOptions;
cluster?: string;
enableStats?: boolean;
disableStats?: boolean;
Expand Down
22 changes: 18 additions & 4 deletions with-encryption/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
export {
Authorizer,
AuthOptions,
AuthorizerGenerator,
AuthorizerCallback
DeprecatedAuthOptions,
ChannelAuthorizerGenerator
} from '../types/src/core/auth/deprecated_channel_authorizer';
export {
ChannelAuthorizationOptions,
UserAuthenticationOptions,
ChannelAuthorizationHandler,
UserAuthenticationHandler,
ChannelAuthorizationCallback,
UserAuthenticationCallback
} from '../types/src/core/auth/options';
export { Options } from '../types/src/core/options';

Expand All @@ -13,3 +19,11 @@ export { default as Runtime } from '../types/src/runtimes/interface';
export { default as ConnectionManager } from '../types/src/core/connection/connection_manager';

export { default } from '../types/src/core/pusher';

// The following types are provided for backward compatability
export {
DeprecatedAuthOptions as AuthOptions,
DeprecatedChannelAuthorizer as Authorizer,
ChannelAuthorizerGenerator as AuthorizerGenerator
} from '../types/src/core/auth/deprecated_channel_authorizer';
export { ChannelAuthorizationCallback as AuthorizerCallback } from '../types/src/core/auth/options';
22 changes: 18 additions & 4 deletions worker/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
export {
Authorizer,
AuthOptions,
AuthorizerGenerator,
AuthorizerCallback,
DeprecatedAuthOptions,
ChannelAuthorizerGenerator
} from '../types/src/core/auth/deprecated_channel_authorizer';
export {
ChannelAuthorizationOptions,
UserAuthenticationOptions,
ChannelAuthorizationHandler,
UserAuthenticationHandler,
ChannelAuthorizationCallback,
UserAuthenticationCallback
} from '../types/src/core/auth/options';
export { Options } from '../types/src/core/options';

Expand All @@ -13,3 +19,11 @@ export { default as Runtime } from '../types/src/runtimes/interface';
export { default as ConnectionManager } from '../types/src/core/connection/connection_manager';

export { default } from '../types/src/core/pusher';

// The following types are provided for backward compatability
export {
DeprecatedAuthOptions as AuthOptions,
DeprecatedChannelAuthorizer as Authorizer,
ChannelAuthorizerGenerator as AuthorizerGenerator
} from '../types/src/core/auth/deprecated_channel_authorizer';
export { ChannelAuthorizationCallback as AuthorizerCallback } from '../types/src/core/auth/options';
22 changes: 18 additions & 4 deletions worker/with-encryption/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
export {
Authorizer,
AuthOptions,
AuthorizerGenerator,
AuthorizerCallback,
DeprecatedAuthOptions,
ChannelAuthorizerGenerator
} from '../../types/src/core/auth/deprecated_channel_authorizer';
export {
ChannelAuthorizationOptions,
UserAuthenticationOptions,
ChannelAuthorizationHandler,
UserAuthenticationHandler,
ChannelAuthorizationCallback,
UserAuthenticationCallback
} from '../../types/src/core/auth/options';
export { Options } from '../../types/src/core/options';

Expand All @@ -13,3 +19,11 @@ export { default as Runtime } from '../../types/src/runtimes/interface';
export { default as ConnectionManager } from '../../types/src/core/connection/connection_manager';

export { default } from '../../types/src/core/pusher';

// The following types are provided for backward compatability
export {
DeprecatedAuthOptions as AuthOptions,
DeprecatedChannelAuthorizer as Authorizer,
ChannelAuthorizerGenerator as AuthorizerGenerator
} from '../../types/src/core/auth/deprecated_channel_authorizer';
export { ChannelAuthorizationCallback as AuthorizerCallback } from '../../types/src/core/auth/options';

0 comments on commit cbb46e5

Please sign in to comment.