Skip to content

Commit

Permalink
Remove 'public' access modifier from botbuilder-core folder (#4216)
Browse files Browse the repository at this point in the history
  • Loading branch information
sw-joelmut authored Jun 15, 2022
1 parent 36e60fc commit 82f2526
Show file tree
Hide file tree
Showing 31 changed files with 217 additions and 217 deletions.
2 changes: 1 addition & 1 deletion libraries/botbuilder-core/src/activityFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export class ActivityFactory {
* Generate the activity.
* @param lgResult string result from languageGenerator.
*/
public static fromObject(lgResult: any): Partial<Activity> {
static fromObject(lgResult: any): Partial<Activity> {
if (lgResult == null) {
return { type: ActivityTypes.Message };
}
Expand Down
40 changes: 20 additions & 20 deletions libraries/botbuilder-core/src/activityHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export class ActivityHandler extends ActivityHandlerBase {
* @remarks
* Returns a reference to the [ActivityHandler](xref:botbuilder-core.ActivityHandler) object.
*/
public onTurn(handler: BotHandler): this {
onTurn(handler: BotHandler): this {
return this.on('Turn', handler);
}

Expand All @@ -119,7 +119,7 @@ export class ActivityHandler extends ActivityHandlerBase {
* Not all message activities contain text, the activity's [text](xref:botframework-schema.Activity.text)
* property can be `null` or `undefined`.
*/
public onMessage(handler: BotHandler): this {
onMessage(handler: BotHandler): this {
return this.on('Message', handler);
}

Expand All @@ -139,7 +139,7 @@ export class ActivityHandler extends ActivityHandlerBase {
* [onMembersAdded](xref:botbuilder-core.ActivityHandler.onMembersAdded) and
* [onMembersRemoved](xref:botbuilder-core.ActivityHandler.onMembersRemoved) sub-type event handlers.
*/
public onConversationUpdate(handler: BotHandler): this {
onConversationUpdate(handler: BotHandler): this {
return this.on('ConversationUpdate', handler);
}

Expand All @@ -158,7 +158,7 @@ export class ActivityHandler extends ActivityHandlerBase {
* To handle conversation update events in general, use the
* [onConversationUpdate](xref:botbuilder-core.ActivityHandler.onConversationUpdate) type-specific event handler.
*/
public onMembersAdded(handler: BotHandler): this {
onMembersAdded(handler: BotHandler): this {
return this.on('MembersAdded', handler);
}

Expand All @@ -177,7 +177,7 @@ export class ActivityHandler extends ActivityHandlerBase {
* To handle conversation update events in general, use the
* [onConversationUpdate](xref:botbuilder-core.ActivityHandler.onConversationUpdate) type-specific event handler.
*/
public onMembersRemoved(handler: BotHandler): this {
onMembersRemoved(handler: BotHandler): this {
return this.on('MembersRemoved', handler);
}

Expand All @@ -200,7 +200,7 @@ export class ActivityHandler extends ActivityHandlerBase {
* [onReactionsAdded](xref:botbuilder-core.ActivityHandler.onReactionsAdded) and
* [onReactionsRemoved](xref:botbuilder-core.ActivityHandler.onReactionsRemoved) sub-type event handlers.
*/
public onMessageReaction(handler: BotHandler): this {
onMessageReaction(handler: BotHandler): this {
return this.on('MessageReaction', handler);
}

Expand All @@ -219,7 +219,7 @@ export class ActivityHandler extends ActivityHandlerBase {
* To handle message reaction events in general, use the
* [onMessageReaction](xref:botbuilder-core.ActivityHandler.onMessageReaction) type-specific event handler.
*/
public onReactionsAdded(handler: BotHandler): this {
onReactionsAdded(handler: BotHandler): this {
return this.on('ReactionsAdded', handler);
}

Expand All @@ -238,7 +238,7 @@ export class ActivityHandler extends ActivityHandlerBase {
* To handle message reaction events in general, use the
* [onMessageReaction](xref:botbuilder-core.ActivityHandler.onMessageReaction) type-specific event handler.
*/
public onReactionsRemoved(handler: BotHandler): this {
onReactionsRemoved(handler: BotHandler): this {
return this.on('ReactionsRemoved', handler);
}

Expand All @@ -261,7 +261,7 @@ export class ActivityHandler extends ActivityHandlerBase {
* [onTokenResponseEvent](xref:botbuilder-core.ActivityHandler.onTokenResponseEvent) sub-type
* event handler. To handle other named events, add logic to this handler.
*/
public onEvent(handler: BotHandler): this {
onEvent(handler: BotHandler): this {
return this.on('Event', handler);
}

Expand All @@ -278,7 +278,7 @@ export class ActivityHandler extends ActivityHandlerBase {
* To handle an End of Conversation, use the
* [onEndOfConversation](xref:botbuilder-core.ActivityHandler.onEndOfConversation) type-specific event handler.
*/
public onEndOfConversation(handler: BotHandler): this {
onEndOfConversation(handler: BotHandler): this {
return this.on('EndOfConversation', handler);
}

Expand All @@ -293,7 +293,7 @@ export class ActivityHandler extends ActivityHandlerBase {
* To handle a Typing event, use the
* [onTyping](xref:botbuilder-core.ActivityHandler.onTyping) type-specific event handler.
*/
public onTyping(handler: BotHandler): this {
onTyping(handler: BotHandler): this {
return this.on('Typing', handler);
}

Expand All @@ -308,7 +308,7 @@ export class ActivityHandler extends ActivityHandlerBase {
* To handle a InstallationUpdate event, use the
* [onInstallationUpdate](xref:botbuilder-core.ActivityHandler.onInstallationUpdate) type-specific event handler.
*/
public onInstallationUpdate(handler: BotHandler): this {
onInstallationUpdate(handler: BotHandler): this {
return this.on('InstallationUpdate', handler);
}

Expand All @@ -323,7 +323,7 @@ export class ActivityHandler extends ActivityHandlerBase {
* To handle a InstallationUpdateAdd event, use the
* [onInstallationUpdateAdd](xref:botbuilder-core.ActivityHandler.onInstallationUpdateAdd) type-specific event handler.
*/
public onInstallationUpdateAdd(handler: BotHandler): this {
onInstallationUpdateAdd(handler: BotHandler): this {
return this.on('InstallationUpdateAdd', handler);
}

Expand All @@ -338,7 +338,7 @@ export class ActivityHandler extends ActivityHandlerBase {
* To handle a InstallationUpdateRemove event, use the
* [onInstallationUpdateRemove](xref:botbuilder-core.ActivityHandler.onInstallationUpdateRemove) type-specific event handler.
*/
public onInstallationUpdateRemove(handler: BotHandler): this {
onInstallationUpdateRemove(handler: BotHandler): this {
return this.on('InstallationUpdateRemove', handler);
}

Expand All @@ -359,7 +359,7 @@ export class ActivityHandler extends ActivityHandlerBase {
* To handle other named events and event events in general, use the
* [onEvent](xref:botbuilder-core.ActivityHandler.onEvent) type-specific event handler.
*/
public onTokenResponseEvent(handler: BotHandler): this {
onTokenResponseEvent(handler: BotHandler): this {
return this.on('TokenResponseEvent', handler);
}

Expand All @@ -374,7 +374,7 @@ export class ActivityHandler extends ActivityHandlerBase {
* To handle a Command event, use the
* [onCommand](xref:botbuilder-core.ActivityHandler.onCommand) type-specific event handler.
*/
public onCommand(handler: BotHandler): this {
onCommand(handler: BotHandler): this {
return this.on('Command', handler);
}

Expand All @@ -389,7 +389,7 @@ export class ActivityHandler extends ActivityHandlerBase {
* To handle a CommandResult event, use the
* [onCommandResult](xref:botbuilder-core.ActivityHandler.onCommandResult) type-specific event handler.
*/
public onCommandResult(handler: BotHandler): this {
onCommandResult(handler: BotHandler): this {
return this.on('CommandResult', handler);
}

Expand All @@ -410,7 +410,7 @@ export class ActivityHandler extends ActivityHandlerBase {
*
* The activity's [type](xref:botframework-schema.Activity.type) property contains the activity type.
*/
public onUnrecognizedActivityType(handler: BotHandler): this {
onUnrecognizedActivityType(handler: BotHandler): this {
return this.on('UnrecognizedActivityType', handler);
}

Expand All @@ -423,7 +423,7 @@ export class ActivityHandler extends ActivityHandlerBase {
* Returns a reference to the [ActivityHandler](xref:botbuilder-core.ActivityHandler) object.
*
*/
public onDialog(handler: BotHandler): this {
onDialog(handler: BotHandler): this {
return this.on('Dialog', handler);
}

Expand All @@ -450,7 +450,7 @@ export class ActivityHandler extends ActivityHandlerBase {
* **See also**
* - [BotFrameworkAdapter.processActivity](xref:botbuilder.BotFrameworkAdapter.processActivity)
*/
public async run(context: TurnContext): Promise<void> {
async run(context: TurnContext): Promise<void> {
await super.run(context);
}

Expand Down
2 changes: 1 addition & 1 deletion libraries/botbuilder-core/src/activityHandlerBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ export class ActivityHandlerBase {
* **See also**
* - [BotFrameworkAdapter.processActivity](xref:botbuilder.BotFrameworkAdapter.processActivity)
*/
public async run(context: TurnContext): Promise<void> {
async run(context: TurnContext): Promise<void> {
if (!context) {
throw new Error(`Missing TurnContext parameter`);
}
Expand Down
6 changes: 3 additions & 3 deletions libraries/botbuilder-core/src/autoSaveStateMiddleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class AutoSaveStateMiddleware implements Middleware {
/**
* Set of `BotState` plugins being automatically saved.
*/
public botStateSet: BotStateSet;
botStateSet: BotStateSet;
/**
* Creates a new AutoSaveStateMiddleware instance.
* @param botStates One or more BotState plugins to automatically save at the end of the turn.
Expand All @@ -62,7 +62,7 @@ export class AutoSaveStateMiddleware implements Middleware {
* @param context The context object for this turn.
* @param next {function} The next delegate function.
*/
public async onTurn(context: TurnContext, next: () => Promise<void>): Promise<void> {
async onTurn(context: TurnContext, next: () => Promise<void>): Promise<void> {
await next();
await this.botStateSet.saveAllChanges(context, false);
}
Expand All @@ -71,7 +71,7 @@ export class AutoSaveStateMiddleware implements Middleware {
* Adds additional `BotState` plugins to be saved.
* @param botStates One or more BotState plugins to add.
*/
public add(...botStates: BotState[]): this {
add(...botStates: BotState[]): this {
BotStateSet.prototype.add.apply(this.botStateSet, botStates);

return this;
Expand Down
20 changes: 10 additions & 10 deletions libraries/botbuilder-core/src/botAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ export abstract class BotAdapter {

private turnError: (context: TurnContext, error: Error) => Promise<void>;

public readonly BotIdentityKey = Symbol('BotIdentity');
public readonly ConnectorClientKey = Symbol('ConnectorClient');
public readonly OAuthScopeKey = Symbol('OAuthScope');
readonly BotIdentityKey = Symbol('BotIdentity');
readonly ConnectorClientKey = Symbol('ConnectorClient');
readonly OAuthScopeKey = Symbol('OAuthScope');

/**
* Asynchronously sends a set of outgoing activities to a channel server.
Expand All @@ -53,7 +53,7 @@ export abstract class BotAdapter {
* response object will be returned for each sent activity. For `message` activities this will
* contain the ID of the delivered message.
*/
public abstract sendActivities(context: TurnContext, activities: Partial<Activity>[]): Promise<ResourceResponse[]>;
abstract sendActivities(context: TurnContext, activities: Partial<Activity>[]): Promise<ResourceResponse[]>;

/**
* Asynchronously replaces a previous activity with an updated version.
Expand All @@ -68,7 +68,7 @@ export abstract class BotAdapter {
* @remarks
* Not all channels support this operation. For channels that don't, this call may throw an exception.
*/
public abstract updateActivity(context: TurnContext, activity: Partial<Activity>): Promise<ResourceResponse | void>;
abstract updateActivity(context: TurnContext, activity: Partial<Activity>): Promise<ResourceResponse | void>;

/**
* Asynchronously deletes an existing activity.
Expand All @@ -83,7 +83,7 @@ export abstract class BotAdapter {
* @remarks
* Not all channels support this operation. For channels that don't, this call may throw an exception.
*/
public abstract deleteActivity(context: TurnContext, reference: Partial<ConversationReference>): Promise<void>;
abstract deleteActivity(context: TurnContext, reference: Partial<ConversationReference>): Promise<void>;

/**
* Asynchronously resumes a conversation with a user, possibly after some time has gone by.
Expand All @@ -96,7 +96,7 @@ export abstract class BotAdapter {
* send a message to a conversation or user without waiting for an incoming message.
* For example, a bot can use this method to send notifications or coupons to a user.
*/
public abstract continueConversation(
abstract continueConversation(
reference: Partial<ConversationReference>,
logic: (revocableContext: TurnContext) => Promise<void>
): Promise<void>;
Expand Down Expand Up @@ -201,7 +201,7 @@ export abstract class BotAdapter {
* | `context` | [TurnContext](xref:botbuilder-core.TurnContext) | The context object for the turn. |
* | `error` | `Error` | The Node.js error thrown. |
*/
public get onTurnError(): (context: TurnContext, error: Error) => Promise<void> {
get onTurnError(): (context: TurnContext, error: Error) => Promise<void> {
return this.turnError;
}

Expand All @@ -216,7 +216,7 @@ export abstract class BotAdapter {
* | `context` | [TurnContext](xref:botbuilder-core.TurnContext) | The context object for the turn. |
* | `error` | `Error` | The Node.js error thrown. |
*/
public set onTurnError(value: (context: TurnContext, error: Error) => Promise<void>) {
set onTurnError(value: (context: TurnContext, error: Error) => Promise<void>) {
this.turnError = value;
}

Expand All @@ -229,7 +229,7 @@ export abstract class BotAdapter {
* Middleware is added to the adapter at initialization time.
* Each turn, the adapter calls its middleware in the order in which you added it.
*/
public use(...middlewares: (MiddlewareHandler | Middleware)[]): this {
use(...middlewares: (MiddlewareHandler | Middleware)[]): this {
this.middleware.use(...middlewares);

return this;
Expand Down
12 changes: 6 additions & 6 deletions libraries/botbuilder-core/src/botState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class BotState implements PropertyManager {
* @param T (Optional) type of property to create. Defaults to `any` type.
* @param name Name of the property to add.
*/
public createProperty<T = any>(name: string): StatePropertyAccessor<T> {
createProperty<T = any>(name: string): StatePropertyAccessor<T> {
const prop: BotStatePropertyAccessor<T> = new BotStatePropertyAccessor<T>(this, name);
return prop;
}
Expand All @@ -72,7 +72,7 @@ export class BotState implements PropertyManager {
* @param context Context for current turn of conversation with the user.
* @param force (Optional) If `true` the cache will be bypassed and the state will always be read in directly from storage. Defaults to `false`.
*/
public load(context: TurnContext, force = false): Promise<any> {
load(context: TurnContext, force = false): Promise<any> {
const cached: CachedBotState = context.turnState.get(this.stateKey);
if (force || !cached || !cached.state) {
return Promise.resolve(this.storageKey(context)).then((key: string) => {
Expand Down Expand Up @@ -103,7 +103,7 @@ export class BotState implements PropertyManager {
* @param context Context for current turn of conversation with the user.
* @param force (Optional) if `true` the state will always be written out regardless of its change state. Defaults to `false`.
*/
public saveChanges(context: TurnContext, force = false): Promise<void> {
saveChanges(context: TurnContext, force = false): Promise<void> {
let cached: CachedBotState = context.turnState.get(this.stateKey);
if (force || (cached && cached.hash !== calculateChangeHash(cached.state))) {
return Promise.resolve(this.storageKey(context)).then((key: string) => {
Expand Down Expand Up @@ -138,7 +138,7 @@ export class BotState implements PropertyManager {
* ```
* @param context Context for current turn of conversation with the user.
*/
public clear(context: TurnContext): Promise<void> {
clear(context: TurnContext): Promise<void> {
// Just overwrite cached value with a new object and empty hash. The empty hash will force the
// changes to be saved.
context.turnState.set(this.stateKey, { state: {}, hash: '' });
Expand All @@ -157,7 +157,7 @@ export class BotState implements PropertyManager {
* ```
* @param context Context for current turn of conversation with the user.
*/
public delete(context: TurnContext): Promise<void> {
delete(context: TurnContext): Promise<void> {
if (context.turnState.has(this.stateKey)) {
context.turnState.delete(this.stateKey);
}
Expand All @@ -176,7 +176,7 @@ export class BotState implements PropertyManager {
* ```
* @param context Context for current turn of conversation with the user.
*/
public get(context: TurnContext): any | undefined {
get(context: TurnContext): any | undefined {
const cached: CachedBotState = context.turnState.get(this.stateKey);

return typeof cached === 'object' && typeof cached.state === 'object' ? cached.state : undefined;
Expand Down
10 changes: 5 additions & 5 deletions libraries/botbuilder-core/src/botStatePropertyAccessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export class BotStatePropertyAccessor<T = any> implements StatePropertyAccessor<
* Deletes the persisted property from its backing storage object.
* @param context [TurnContext](xref:botbuilder-core.TurnContext) object for this turn.
*/
public async delete(context: TurnContext): Promise<void> {
async delete(context: TurnContext): Promise<void> {
const obj: any = await this.state.load(context);
if (obj.hasOwnProperty(this.name)) {
delete obj[this.name];
Expand All @@ -105,15 +105,15 @@ export class BotStatePropertyAccessor<T = any> implements StatePropertyAccessor<
* @param context [TurnContext](xref:botbuilder-core.TurnContext) object for this turn.
* @returns A JSON representation of the cached state.
*/
public async get(context: TurnContext): Promise<T | undefined>;
public async get(context: TurnContext, defaultValue: T): Promise<T>;
async get(context: TurnContext): Promise<T | undefined>;
async get(context: TurnContext, defaultValue: T): Promise<T>;
/**
* Reads a persisted property from its backing storage object.
* @param context [TurnContext](xref:botbuilder-core.TurnContext) object for this turn.
* @param defaultValue Optional. Default value for the property.
* @returns A JSON representation of the cached state.
*/
public async get(context: TurnContext, defaultValue?: T): Promise<T> {
async get(context: TurnContext, defaultValue?: T): Promise<T> {
const obj: any = await this.state.load(context);
if (!obj.hasOwnProperty(this.name) && defaultValue !== undefined) {
const clone: any =
Expand All @@ -131,7 +131,7 @@ export class BotStatePropertyAccessor<T = any> implements StatePropertyAccessor<
* @param context [TurnContext](xref:botbuilder-core.TurnContext) object for this turn.
* @param value Value to set on the property.
*/
public async set(context: TurnContext, value: T): Promise<void> {
async set(context: TurnContext, value: T): Promise<void> {
const obj: any = await this.state.load(context);
obj[this.name] = value;
}
Expand Down
Loading

0 comments on commit 82f2526

Please sign in to comment.