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 generators, declarative, testing and schema #4214

Merged
merged 5 commits into from
Jun 15, 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
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Licensed under the MIT License.

export class BookingDetails {
public intent: string;
public origin: string;
public destination: string;
public travelDate: string;
intent: string;
origin: string;
destination: string;
travelDate: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class CancelAndHelpDialog extends ComponentDialog {
super(id);
}

public async onContinueDialog(innerDc: DialogContext): Promise<DialogTurnResult> {
async onContinueDialog(innerDc: DialogContext): Promise<DialogTurnResult> {
const result = await this.interrupt(innerDc);
if (result) {
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ export class FlightBookingRecognizer {
}
}

public get isConfigured(): boolean {
get isConfigured(): boolean {
return (this.recognizer !== undefined);
}

/**
* Returns an object with preformatted LUIS results for the bot's dialogs to consume.
* @param {TurnContext} context
*/
public async executeLuisQuery(context: TurnContext): Promise<RecognizerResult> {
async executeLuisQuery(context: TurnContext): Promise<RecognizerResult> {
return this.recognizer.recognize(context);
}

public getFromEntities(result) {
getFromEntities(result) {
let fromValue, fromAirportValue;
if (result.entities.$instance.From) {
fromValue = result.entities.$instance.From[0].text;
Expand All @@ -44,7 +44,7 @@ export class FlightBookingRecognizer {
return { from: fromValue, airport: fromAirportValue };
}

public getToEntities(result) {
getToEntities(result) {
let toValue, toAirportValue;
if (result.entities.$instance.To) {
toValue = result.entities.$instance.To[0].text;
Expand All @@ -60,7 +60,7 @@ export class FlightBookingRecognizer {
* This value will be a TIMEX. And we are only interested in a Date so grab the first result and drop the Time part.
* TIMEX is a format that represents DateTime expressions that include some ambiguity. e.g. missing a Year.
*/
public getTravelDate(result) {
getTravelDate(result) {
const datetimeEntity = result.entities.datetime;
if (!datetimeEntity || !datetimeEntity[0]) return undefined;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class MainDialog extends ComponentDialog {
* If no dialog is active, it will start the default dialog.
* @param {TurnContext} context
*/
public async run(context: TurnContext, accessor: StatePropertyAccessor<DialogState>) {
async run(context: TurnContext, accessor: StatePropertyAccessor<DialogState>) {
const dialogSet = new DialogSet(accessor);
dialogSet.add(this);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ class MockRootDialog extends Dialog {
super('mockRootDialog');
}

public async beginDialog(dc, options) {
async beginDialog(dc, options) {
await dc.context.sendActivity(`${ this.id } mock invoked`);
return await dc.endDialog();
}

public async run(turnContext, accessor) {
async run(turnContext, accessor) {
const dialogSet = new DialogSet(accessor);
dialogSet.add(this);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ class TestCancelAndHelpDialog extends CancelAndHelpDialog {
this.initialDialogId = 'WaterfallDialog';
}

public async promptStep(stepContext) {
async promptStep(stepContext) {
return await stepContext.prompt('TextPrompt', { prompt: MessageFactory.text('Hi there') });
}

public async finalStep(stepContext) {
async finalStep(stepContext) {
return await stepContext.endDialog();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class MockFlightBookingRecognizer extends FlightBookingRecognizer {
this.mockResult = mockResult;
}

public async executeLuisQuery(context) {
async executeLuisQuery(context) {
return this.mockResult;
}

Expand All @@ -39,7 +39,7 @@ class MockBookingDialog extends BookingDialog {
super('bookingDialog');
}

public async beginDialog(dc, options) {
async beginDialog(dc, options) {
const bookingDetails = {
destination: 'Seattle',
origin: 'New York',
Expand All @@ -60,7 +60,7 @@ class MockBookingDialogWithPrompt extends BookingDialog {
super('bookingDialog');
}

public async beginDialog(dc, options) {
async beginDialog(dc, options) {
dc.dialogs.add(new TextPrompt('MockDialog'));
return await dc.prompt('MockDialog', { prompt: `${ this.id } mock invoked` });
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class DefaultLoader implements CustomDeserializer<Configurable, Record<st
*
* @param {ResourceExplorer} _resourceExplorer The `ResourceExplorer` used by the loader.
*/
public constructor(private readonly _resourceExplorer: ResourceExplorer) {}
constructor(private readonly _resourceExplorer: ResourceExplorer) {}

/**
* The method that loads the configuration object to a requested type.
Expand All @@ -29,7 +29,7 @@ export class DefaultLoader implements CustomDeserializer<Configurable, Record<st
* @param {Newable<Configurable>} type The object type that the configuration will be deserialized to.
* @returns {Configurable} A `Configurable` object created from the configuration.
*/
public load(config: Record<string, unknown>, type: Newable<Configurable>): Configurable {
load(config: Record<string, unknown>, type: Newable<Configurable>): Configurable {
return Object.entries(config).reduce((instance, [key, value]) => {
let converter = instance.getConverter(key);

Expand Down
6 changes: 3 additions & 3 deletions libraries/botbuilder-dialogs-declarative/src/pathUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ export class PathUtil {
* Check if a path is a directory
* @param path Path of the diretory
*/
public static isDirectory(path: string): boolean {
static isDirectory(path: string): boolean {
return lstatSync(path).isDirectory();
}

/**
* Get sub folders in a directory
* @param path Path of root directory
*/
public static getDirectories(path: string): string[] {
static getDirectories(path: string): string[] {
return readdirSync(path)
.map((name: string): string => join(path, name))
.filter(PathUtil.isDirectory);
Expand All @@ -36,7 +36,7 @@ export class PathUtil {
* @param path Path of root directory
* @param includeSubFolders Whether include its sub folders
*/
public static getFiles(path: string, includeSubFolders = true): string[] {
static getFiles(path: string, includeSubFolders = true): string[] {
return readdirSync(path)
.map((name: string): string => join(path, name))
.reduce((files: string[], file: string): string[] => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class FileResource extends Resource {
* Initialize a new instance of the `FileResouce` class.
* @param path Path to file.
*/
public constructor(path: string) {
constructor(path: string) {
super();
this._fullname = path;
// The id will be the file name, without the path
Expand All @@ -27,7 +27,7 @@ export class FileResource extends Resource {
/**
* Read text content of a file resource.
*/
public readText(): string {
readText(): string {
const filePath = this._fullname;
const text = fs.readFileSync(filePath, 'utf-8');
return text;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class FolderResourceProvider extends ResourceProvider {
* @param includeSubFolders Whether include its sub folders.
* @param monitorChanges Whether monitor changes.
*/
public constructor(
constructor(
resourceExplorer: ResourceExplorer,
folder: string,
includeSubFolders = true,
Expand All @@ -54,24 +54,24 @@ export class FolderResourceProvider extends ResourceProvider {
/**
* Gets attached file watcher.
*/
public get watcher(): FSWatcher {
get watcher(): FSWatcher {
return this._watcher;
}

/**
* Folder to enumerate.
*/
public directory: string;
directory: string;

/**
* A value indicating whether to include subfolders.
*/
public includeSubFolders = true;
includeSubFolders = true;

/**
* Refresh any cached content and look for new content.
*/
public refresh(): void {
refresh(): void {
this._resources.clear();
const files: string[] = PathUtil.getFiles(this.directory, this.includeSubFolders);
const filteredFiles: string[] = files.filter((filename): boolean =>
Expand All @@ -88,15 +88,15 @@ export class FolderResourceProvider extends ResourceProvider {
* Gets resource by its id.
* @param id Resource id.
*/
public getResource(id: string): Resource {
getResource(id: string): Resource {
return this._resources.has(id) ? this._resources.get(id) : undefined;
}

/**
* Gets resources by extension.
* @param extension Resource extension.
*/
public getResources(extension: string): Resource[] {
getResources(extension: string): Resource[] {
extension = extension.startsWith('.') ? extension.toLowerCase() : `.${extension.toLowerCase()}`;

const resources: Resource[] = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ export abstract class Resource {
/**
* Resource id.
*/
public get id(): string {
get id(): string {
return this._id;
}

/**
* The full path to the resource on disk
*/
public get fullName(): string {
get fullName(): string {
return this._fullname;
}

/**
* Get resource as text.
*/
public abstract readText(): string;
abstract readText(): string;
}
Loading