Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: [#3518] Remove public access modifier from botbuilder-dialogs-adaptive - Part 3 #4223

Merged
merged 2 commits into from
Jun 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions libraries/botbuilder-dialogs-adaptive/src/actionContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class ActionContext extends DialogContext {
* @param actions Current list of remaining actions to execute.
* @param changeKey TurnState key for where to persist any changes.
*/
public constructor(
constructor(
dialogs: DialogSet,
parentDialogContext: DialogContext,
state: DialogState,
Expand All @@ -42,14 +42,14 @@ export class ActionContext extends DialogContext {
/**
* List of actions being executed.
*/
public actions: ActionState[];
actions: ActionState[];

/**
* Gets list of changes that are queued to be applied.
*
* @returns The list of changes queued.
*/
public get changes(): ActionChangeList[] {
get changes(): ActionChangeList[] {
return this.context.turnState.get(this._changeKey) || [];
}

Expand All @@ -58,7 +58,7 @@ export class ActionContext extends DialogContext {
*
* @param changes Plan changes to queue up.
*/
public queueChanges(changes: ActionChangeList): void {
queueChanges(changes: ActionChangeList): void {
const queue = this.changes;
queue.push(changes);
this.context.turnState.set(this._changeKey, queue);
Expand All @@ -69,7 +69,7 @@ export class ActionContext extends DialogContext {
*
* @returns True if there were any changes to apply.
*/
public async applyChanges(): Promise<boolean> {
async applyChanges(): Promise<boolean> {
// Retrieve queued change list
const changes = this.changes;
if (changes.length > 0) {
Expand Down
38 changes: 19 additions & 19 deletions libraries/botbuilder-dialogs-adaptive/src/adaptiveDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ export interface AdaptiveDialogConfiguration extends DialogConfiguration {
* The Adaptive Dialog models conversation using events and events to adapt dynamically to changing conversation flow.
*/
export class AdaptiveDialog<O extends object = {}> extends DialogContainer<O> implements AdaptiveDialogConfiguration {
public static $kind = 'Microsoft.AdaptiveDialog';
public static conditionTracker = 'dialog._tracker.conditions';
static $kind = 'Microsoft.AdaptiveDialog';
static conditionTracker = 'dialog._tracker.conditions';

private readonly adaptiveKey = '_adaptive';
private readonly defaultOperationKey = '$defaultOperation';
Expand All @@ -106,24 +106,24 @@ export class AdaptiveDialog<O extends object = {}> extends DialogContainer<O> im
*
* @param dialogId (Optional) unique ID of the component within its parents dialog set.
*/
public constructor(dialogId?: string) {
constructor(dialogId?: string) {
super(dialogId);
}

/**
* Optional. Recognizer used to analyze any message utterances.
*/
public recognizer?: Recognizer;
recognizer?: Recognizer;

/**
* Optional. Language Generator override.
*/
public generator?: LanguageGenerator;
generator?: LanguageGenerator;

/**
* Trigger handlers to respond to conditions which modify the executing plan.
*/
public triggers: OnCondition[] = [];
triggers: OnCondition[] = [];

/**
* Whether to end the dialog when there are no actions to execute.
Expand All @@ -133,25 +133,25 @@ export class AdaptiveDialog<O extends object = {}> extends DialogContainer<O> im
* If false, when there are no actions to execute, the current dialog will simply end the turn and still be active.
* Defaults to a value of true.
*/
public autoEndDialog: BoolExpression = new BoolExpression(true);
autoEndDialog: BoolExpression = new BoolExpression(true);

/**
* Optional. The selector for picking the possible events to execute.
*/
public selector: TriggerSelector;
selector: TriggerSelector;

/**
* The property to return as the result when the dialog ends when there are no more Actions and `AutoEndDialog = true`.
*
* @remarks
* Defaults to a value of `dialog.result`.
*/
public defaultResultProperty = 'dialog.result';
defaultResultProperty = 'dialog.result';

/**
* Sets the JSON Schema for the dialog.
*/
public set schema(value: object) {
set schema(value: object) {
this.dialogSchema = new SchemaHelper(value);
}

Expand All @@ -160,15 +160,15 @@ export class AdaptiveDialog<O extends object = {}> extends DialogContainer<O> im
*
* @returns The dialog schema.
*/
public get schema(): object {
get schema(): object {
return this.dialogSchema ? this.dialogSchema.schema : undefined;
}

/**
* @param property The key of the conditional selector configuration.
* @returns The converter for the selector configuration.
*/
public getConverter(property: keyof AdaptiveDialogConfiguration): Converter | ConverterFactory {
getConverter(property: keyof AdaptiveDialogConfiguration): Converter | ConverterFactory {
switch (property) {
case 'recognizer':
return RecognizerConverter;
Expand Down Expand Up @@ -267,7 +267,7 @@ export class AdaptiveDialog<O extends object = {}> extends DialogContainer<O> im
* @param options Optional, initial information to pass to the dialog.
* @returns A Promise representing the asynchronous operation.
*/
public async beginDialog(dc: DialogContext, options?: O): Promise<DialogTurnResult> {
async beginDialog(dc: DialogContext, options?: O): Promise<DialogTurnResult> {
await this.checkForVersionChange(dc);

// Install dependencies on first access
Expand Down Expand Up @@ -332,7 +332,7 @@ export class AdaptiveDialog<O extends object = {}> extends DialogContainer<O> im
* @param dc The [DialogContext](xref:botbuilder-dialogs.DialogContext) for the current turn of conversation.
* @returns A Promise representing the asynchronous operation.
*/
public async continueDialog(dc: DialogContext): Promise<DialogTurnResult> {
async continueDialog(dc: DialogContext): Promise<DialogTurnResult> {
await this.checkForVersionChange(dc);

this.ensureDependenciesInstalled();
Expand All @@ -349,7 +349,7 @@ export class AdaptiveDialog<O extends object = {}> extends DialogContainer<O> im
* @param reason Reason why the dialog ended.
* @returns A Promise representing the asynchronous operation.
*/
public async endDialog(turnContext: TurnContext, instance: DialogInstance, reason: DialogReason): Promise<void> {
async endDialog(turnContext: TurnContext, instance: DialogInstance, reason: DialogReason): Promise<void> {
const properties: { [key: string]: string } = {
DialogId: this.id,
Kind: 'Microsoft.AdaptiveDialog',
Expand Down Expand Up @@ -405,7 +405,7 @@ export class AdaptiveDialog<O extends object = {}> extends DialogContainer<O> im
* The type of the value returned is dependent on the child dialog.
* @returns A Promise representing the asynchronous operation.
*/
public async resumeDialog(dc: DialogContext, _reason?: DialogReason, _result?: any): Promise<DialogTurnResult> {
async resumeDialog(dc: DialogContext, _reason?: DialogReason, _result?: any): Promise<DialogTurnResult> {
await this.checkForVersionChange(dc);

// Containers are typically leaf nodes on the stack but the dev is free to push other dialogs
Expand All @@ -425,7 +425,7 @@ export class AdaptiveDialog<O extends object = {}> extends DialogContainer<O> im
* @param instance Current state information for this dialog.
* @returns A Promise representing the asynchronous operation.
*/
public async repromptDialog(context: DialogContext | TurnContext, instance: DialogInstance): Promise<void> {
async repromptDialog(context: DialogContext | TurnContext, instance: DialogInstance): Promise<void> {
if (context instanceof DialogContext) {
// Forward to current sequence action
const state: AdaptiveDialogState = instance.state[this.adaptiveKey];
Expand All @@ -446,7 +446,7 @@ export class AdaptiveDialog<O extends object = {}> extends DialogContainer<O> im
* @param dc The [DialogContext](xref:botbuilder-dialogs.DialogContext) for the current turn of conversation.
* @returns The child [DialogContext](xref:botbuilder-dialogs.DialogContext) or null if no [AdaptiveDialogState.actions](xref:botbuilder-dialogs-adaptive.AdaptiveDialogState.actions) are found for the given context.
*/
public createChildContext(dc: DialogContext): DialogContext {
createChildContext(dc: DialogContext): DialogContext {
const activeDialogState = dc.activeDialog.state;
const state: AdaptiveDialogState = activeDialogState[this.adaptiveKey];
if (!state) {
Expand All @@ -465,7 +465,7 @@ export class AdaptiveDialog<O extends object = {}> extends DialogContainer<O> im
*
* @returns [Dialog](xref:botbuilder-dialogs.Dialog)'s enumerated dependencies.
*/
public getDependencies(): Dialog[] {
getDependencies(): Dialog[] {
this.ensureDependenciesInstalled();
return [];
}
Expand Down
14 changes: 7 additions & 7 deletions libraries/botbuilder-dialogs-adaptive/src/adaptiveEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,35 @@ export class AdaptiveEvents extends DialogEvents {
/**
* Raised when utterance is received.
*/
public static readonly recognizeUtterance = 'recognizeUtterance';
static readonly recognizeUtterance = 'recognizeUtterance';

/**
* Raised when intent is recognized from utterance.
*/
public static readonly recognizedIntent = 'recognizedIntent';
static readonly recognizedIntent = 'recognizedIntent';

/**
* Raised when no intent can be recognized from utterance.
*/
public static readonly unknownIntent = 'unknownIntent';
static readonly unknownIntent = 'unknownIntent';

/**
* Raised when all actions and ambiguity events have been finished.
*/
public static readonly endOfActions = 'endOfActions';
static readonly endOfActions = 'endOfActions';

/**
* aised when there are multiple possible entity to property mappings.
*/
public static readonly chooseProperty = 'chooseProperty';
static readonly chooseProperty = 'chooseProperty';

/**
* Raised when there are multiple possible resolutions of an entity.
*/
public static readonly chooseEntity = 'chooseEntity';
static readonly chooseEntity = 'chooseEntity';

/**
* Raised when an entity should be assigned to a property.
*/
public static readonly assignEntity = 'assignEntity';
static readonly assignEntity = 'assignEntity';
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class DynamicBeginDialogDeserializer
* @param _resourceExplorer The `ResourceExplorer` used by the deserializer.
* @param _resourceId The resource id of the dynamic dialog.
*/
public constructor(private readonly _resourceExplorer: ResourceExplorer, private readonly _resourceId: string) {}
constructor(private readonly _resourceExplorer: ResourceExplorer, private readonly _resourceId: string) {}

/**
* The method that loads the configuration object to a `DynamicBeginDialog` object.
Expand All @@ -30,7 +30,7 @@ export class DynamicBeginDialogDeserializer
* @param type The object type that the configuration will be deserialized to.
* @returns A `DynamicBeginDialog` object created from the configuration.
*/
public load(
load(
config: BeginDialogConfiguration,
type: { new (...args: unknown[]): DynamicBeginDialog }
): DynamicBeginDialog {
Expand Down
22 changes: 11 additions & 11 deletions libraries/botbuilder-dialogs-adaptive/src/entityAssignment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,42 +57,42 @@ export class EntityAssignment implements EntityAssignmentConfiguration {
/**
* Event name to surface
*/
public event: string;
event: string;

/**
* Name of property being assigned.
*/
public property: string;
property: string;

/**
* Operation to assign entity to property.
*/
public operation: string;
operation: string;

/**
* Recognized entity value.
*/
public value: Partial<EntityInfo>;
value: Partial<EntityInfo>;

/**
* Alternative assignment.
*/
public alternative: EntityAssignment;
alternative: EntityAssignment;

/**
* Value indicating whether this entity was in `DialogPath.ExpectedProperties`.
*/
public isExpected: boolean;
isExpected: boolean;

/**
* The number of times event has been raised.
*/
public raisedCount: number;
raisedCount: number;

/**
* The expected properties when assignment was made.
*/
public expectedProperties: string[];
expectedProperties: string[];

/**
* Initializes a new instance of the [EntityAssignment](xref:botbuilder-dialogs-adaptive.EntityAssignment) class.
Expand Down Expand Up @@ -121,7 +121,7 @@ export class EntityAssignment implements EntityAssignmentConfiguration {
*
* @returns The alternative entity assigment.
*/
public get alternatives(): EntityAssignment[] {
get alternatives(): EntityAssignment[] {
const alternatives = [];
// eslint-disable-next-line @typescript-eslint/no-this-alias
let current: EntityAssignment = this;
Expand All @@ -138,7 +138,7 @@ export class EntityAssignment implements EntityAssignmentConfiguration {
*
* @param alternatives Alternatives to add.
*/
public addAlternatives(alternatives: EntityAssignment[]): void {
addAlternatives(alternatives: EntityAssignment[]): void {
// eslint-disable-next-line @typescript-eslint/no-this-alias
let current: EntityAssignment = this;
this.alternative = undefined;
Expand All @@ -155,7 +155,7 @@ export class EntityAssignment implements EntityAssignmentConfiguration {
*
* @returns A string that represents the current object.
*/
public toString(): string {
toString(): string {
return `${this.isExpected ? '+' : ''}${this.event}: ${this.property} = ${this.operation}(${EntityInfo.toString(
this.value
)})`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class EntityAssignmentComparer {
* @param y Second entity assigment to compare.
* @returns Numerical value representing x's relative priority.
*/
public compare(x: Partial<EntityAssignment>, y: Partial<EntityAssignment>): number {
compare(x: Partial<EntityAssignment>, y: Partial<EntityAssignment>): number {
// Order by event.
let comparison: number =
EntityAssignmentComparer.eventPreference.indexOf(x.event) -
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class EntityAssignments implements EntityAssignmentsConfiguration {
* @param actionContext Memory context.
* @returns Entity event queue.
*/
public static read(actionContext: ActionContext): EntityAssignments {
static read(actionContext: ActionContext): EntityAssignments {
const queuesObject = actionContext.state.getValue(events, new EntityAssignments());

const assignments = queuesObject.assignments?.map((assignment) => new EntityAssignment(assignment));
Expand All @@ -48,7 +48,7 @@ export class EntityAssignments implements EntityAssignmentsConfiguration {
*
* @param actionContext Memory context.
*/
public write(actionContext: ActionContext): void {
write(actionContext: ActionContext): void {
actionContext.state.setValue(events, this);
}

Expand All @@ -57,7 +57,7 @@ export class EntityAssignments implements EntityAssignmentsConfiguration {
*
* @returns The next entity event to surface.
*/
public get nextAssignment(): EntityAssignment {
get nextAssignment(): EntityAssignment {
if (this.assignments.length > 0) {
return this.assignments[0];
}
Expand All @@ -71,7 +71,7 @@ export class EntityAssignments implements EntityAssignmentsConfiguration {
* @param actionContext Memory context.
* @returns Removed event.
*/
public dequeue(actionContext: ActionContext): EntityAssignment {
dequeue(actionContext: ActionContext): EntityAssignment {
const assignment = this.assignments.shift();
this.write(actionContext);

Expand Down
Loading