@microsoft/agents-hosting-dialogs 0.2.14 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/agentComponent.d.ts +18 -4
- package/dist/src/agentComponent.js +12 -4
- package/dist/src/agentComponent.js.map +1 -1
- package/dist/src/agentStateSet.d.ts +2 -2
- package/dist/src/agentStateSet.js +2 -2
- package/dist/src/choices/choice.d.ts +9 -0
- package/dist/src/choices/findChoices.d.ts +12 -0
- package/dist/src/choices/findChoices.js.map +1 -1
- package/dist/src/choices/findValues.d.ts +27 -0
- package/dist/src/choices/findValues.js.map +1 -1
- package/dist/src/choices/modelResult.d.ts +20 -0
- package/dist/src/choices/modelResult.js +4 -0
- package/dist/src/choices/modelResult.js.map +1 -1
- package/dist/src/choices/tokenizer.d.ts +15 -0
- package/dist/src/choices/tokenizer.js +4 -0
- package/dist/src/choices/tokenizer.js.map +1 -1
- package/dist/src/configurable.d.ts +1 -0
- package/dist/src/configurable.js +1 -0
- package/dist/src/configurable.js.map +1 -1
- package/dist/src/converter.d.ts +10 -1
- package/dist/src/dialog.d.ts +14 -13
- package/dist/src/dialog.js +11 -10
- package/dist/src/dialog.js.map +1 -1
- package/dist/src/dialogContext.d.ts +34 -35
- package/dist/src/dialogContext.js +24 -25
- package/dist/src/dialogContext.js.map +1 -1
- package/dist/src/dialogEvent.d.ts +3 -0
- package/dist/src/dialogEvents.d.ts +20 -0
- package/dist/src/dialogEvents.js +20 -0
- package/dist/src/dialogEvents.js.map +1 -1
- package/dist/src/dialogHelper.js +14 -0
- package/dist/src/dialogHelper.js.map +1 -1
- package/dist/src/dialogManager.d.ts +0 -1
- package/dist/src/dialogManager.js +0 -1
- package/dist/src/dialogManager.js.map +1 -1
- package/dist/src/dialogSet.d.ts +5 -9
- package/dist/src/dialogSet.js +5 -9
- package/dist/src/dialogSet.js.map +1 -1
- package/dist/src/dialogTurnStateConstants.d.ts +13 -1
- package/dist/src/dialogTurnStateConstants.js +13 -1
- package/dist/src/dialogTurnStateConstants.js.map +1 -1
- package/dist/src/intentScore.d.ts +6 -0
- package/dist/src/memory/dialogPath.d.ts +40 -8
- package/dist/src/memory/dialogPath.js +32 -8
- package/dist/src/memory/dialogPath.js.map +1 -1
- package/dist/src/memory/dialogStateManager.d.ts +2 -2
- package/dist/src/memory/dialogStateManager.js +2 -2
- package/dist/src/memory/pathResolvers/aliasPathResolver.d.ts +4 -0
- package/dist/src/memory/pathResolvers/aliasPathResolver.js +4 -0
- package/dist/src/memory/pathResolvers/aliasPathResolver.js.map +1 -1
- package/dist/src/memory/pathResolvers/atAtPathResolver.d.ts +6 -2
- package/dist/src/memory/pathResolvers/atAtPathResolver.js +6 -2
- package/dist/src/memory/pathResolvers/atAtPathResolver.js.map +1 -1
- package/dist/src/memory/pathResolvers/atPathResolver.d.ts +13 -7
- package/dist/src/memory/pathResolvers/atPathResolver.js +13 -7
- package/dist/src/memory/pathResolvers/atPathResolver.js.map +1 -1
- package/dist/src/memory/pathResolvers/dollarPathResolver.d.ts +7 -2
- package/dist/src/memory/pathResolvers/dollarPathResolver.js +7 -2
- package/dist/src/memory/pathResolvers/dollarPathResolver.js.map +1 -1
- package/dist/src/memory/pathResolvers/hashPathResolver.d.ts +7 -2
- package/dist/src/memory/pathResolvers/hashPathResolver.js +7 -2
- package/dist/src/memory/pathResolvers/hashPathResolver.js.map +1 -1
- package/dist/src/memory/pathResolvers/pathResolver.d.ts +10 -5
- package/dist/src/memory/pathResolvers/percentPathResolver.d.ts +7 -2
- package/dist/src/memory/pathResolvers/percentPathResolver.js +7 -2
- package/dist/src/memory/pathResolvers/percentPathResolver.js.map +1 -1
- package/dist/src/memory/scopePath.d.ts +27 -0
- package/dist/src/memory/scopePath.js +27 -0
- package/dist/src/memory/scopePath.js.map +1 -1
- package/dist/src/memory/scopes/classMemoryScope.d.ts +18 -14
- package/dist/src/memory/scopes/classMemoryScope.js +18 -14
- package/dist/src/memory/scopes/classMemoryScope.js.map +1 -1
- package/dist/src/memory/scopes/dialogClassMemoryScope.d.ts +12 -6
- package/dist/src/memory/scopes/dialogClassMemoryScope.js +12 -6
- package/dist/src/memory/scopes/dialogClassMemoryScope.js.map +1 -1
- package/dist/src/memory/scopes/dialogContextMemoryScope.d.ts +11 -7
- package/dist/src/memory/scopes/dialogContextMemoryScope.js +11 -7
- package/dist/src/memory/scopes/dialogContextMemoryScope.js.map +1 -1
- package/dist/src/memory/scopes/dialogMemoryScope.d.ts +23 -16
- package/dist/src/memory/scopes/dialogMemoryScope.js +23 -16
- package/dist/src/memory/scopes/dialogMemoryScope.js.map +1 -1
- package/dist/src/memory/scopes/turnMemoryScope.d.ts +14 -13
- package/dist/src/memory/scopes/turnMemoryScope.js +14 -13
- package/dist/src/memory/scopes/turnMemoryScope.js.map +1 -1
- package/dist/src/memory/turnPath.d.ts +61 -13
- package/dist/src/memory/turnPath.js +49 -13
- package/dist/src/memory/turnPath.js.map +1 -1
- package/dist/src/prompts/attachmentPrompt.d.ts +1 -1
- package/dist/src/prompts/attachmentPrompt.js +1 -1
- package/dist/src/prompts/choicePrompt.d.ts +17 -3
- package/dist/src/prompts/choicePrompt.js +1 -1
- package/dist/src/prompts/choicePrompt.js.map +1 -1
- package/dist/src/prompts/confirmPrompt.d.ts +6 -6
- package/dist/src/prompts/confirmPrompt.js +3 -3
- package/dist/src/prompts/datetimePrompt.d.ts +6 -6
- package/dist/src/prompts/datetimePrompt.js +3 -3
- package/dist/src/prompts/numberPrompt.d.ts +6 -6
- package/dist/src/prompts/numberPrompt.js +6 -6
- package/dist/src/prompts/prompt.d.ts +7 -7
- package/dist/src/prompts/prompt.js +2 -2
- package/dist/src/prompts/promptCultureModels.d.ts +38 -3
- package/dist/src/prompts/promptCultureModels.js +38 -3
- package/dist/src/prompts/promptCultureModels.js.map +1 -1
- package/dist/src/recognizer.d.ts +8 -1
- package/dist/src/recognizer.js +5 -1
- package/dist/src/recognizer.js.map +1 -1
- package/dist/src/recognizerResult.d.ts +15 -0
- package/dist/src/recognizerResult.js.map +1 -1
- package/dist/src/serviceCollection.d.ts +22 -22
- package/dist/src/serviceCollection.js +11 -11
- package/dist/src/waterfallDialog.d.ts +5 -5
- package/dist/src/waterfallDialog.js +5 -5
- package/dist/src/waterfallStepContext.d.ts +21 -0
- package/dist/src/waterfallStepContext.js.map +1 -1
- package/package.json +2 -2
- package/src/agentComponent.ts +18 -4
- package/src/agentStateSet.ts +2 -2
- package/src/choices/choice.ts +11 -0
- package/src/choices/findChoices.ts +15 -0
- package/src/choices/findValues.ts +33 -0
- package/src/choices/modelResult.ts +25 -0
- package/src/choices/tokenizer.ts +19 -0
- package/src/configurable.ts +1 -0
- package/src/converter.ts +10 -1
- package/src/dialog.ts +14 -13
- package/src/dialogContext.ts +42 -43
- package/src/dialogEvent.ts +3 -0
- package/src/dialogEvents.ts +25 -0
- package/src/dialogHelper.ts +14 -1
- package/src/dialogManager.ts +0 -1
- package/src/dialogSet.ts +5 -9
- package/src/dialogTurnStateConstants.ts +15 -1
- package/src/intentScore.ts +9 -2
- package/src/memory/dialogPath.ts +47 -23
- package/src/memory/dialogStateManager.ts +2 -2
- package/src/memory/pathResolvers/aliasPathResolver.ts +4 -0
- package/src/memory/pathResolvers/atAtPathResolver.ts +6 -2
- package/src/memory/pathResolvers/atPathResolver.ts +13 -7
- package/src/memory/pathResolvers/dollarPathResolver.ts +7 -2
- package/src/memory/pathResolvers/hashPathResolver.ts +7 -2
- package/src/memory/pathResolvers/pathResolver.ts +10 -5
- package/src/memory/pathResolvers/percentPathResolver.ts +7 -2
- package/src/memory/scopePath.ts +35 -0
- package/src/memory/scopes/classMemoryScope.ts +18 -14
- package/src/memory/scopes/dialogClassMemoryScope.ts +12 -6
- package/src/memory/scopes/dialogContextMemoryScope.ts +11 -7
- package/src/memory/scopes/dialogMemoryScope.ts +23 -16
- package/src/memory/scopes/turnMemoryScope.ts +14 -13
- package/src/memory/turnPath.ts +61 -25
- package/src/prompts/attachmentPrompt.ts +1 -1
- package/src/prompts/choicePrompt.ts +18 -3
- package/src/prompts/confirmPrompt.ts +6 -6
- package/src/prompts/datetimePrompt.ts +6 -6
- package/src/prompts/numberPrompt.ts +6 -6
- package/src/prompts/prompt.ts +7 -7
- package/src/prompts/promptCultureModels.ts +38 -3
- package/src/recognizer.ts +8 -1
- package/src/recognizerResult.ts +24 -5
- package/src/serviceCollection.ts +22 -22
- package/src/waterfallDialog.ts +5 -5
- package/src/waterfallStepContext.ts +32 -6
package/src/prompts/prompt.ts
CHANGED
|
@@ -13,7 +13,7 @@ import { DialogEvent } from '../dialogEvent'
|
|
|
13
13
|
import { Activity, ActivityTypes, InputHints } from '@microsoft/agents-activity'
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
* Controls the way that choices for a
|
|
16
|
+
* Controls the way that choices for a {@link ChoicePrompt} or yes/no options for a {@link ConfirmPrompt} are
|
|
17
17
|
* presented to a user.
|
|
18
18
|
*/
|
|
19
19
|
export enum ListStyle {
|
|
@@ -91,13 +91,13 @@ export interface PromptOptions {
|
|
|
91
91
|
*/
|
|
92
92
|
export interface PromptRecognizerResult<T> {
|
|
93
93
|
/**
|
|
94
|
-
* If `true` the
|
|
94
|
+
* If `true` the user's utterance was successfully recognized and `value` contains the
|
|
95
95
|
* recognized result.
|
|
96
96
|
*/
|
|
97
97
|
succeeded: boolean;
|
|
98
98
|
|
|
99
99
|
/**
|
|
100
|
-
* Value that was recognized if
|
|
100
|
+
* Value that was recognized if `succeeded` is `true`.
|
|
101
101
|
*/
|
|
102
102
|
value?: T;
|
|
103
103
|
}
|
|
@@ -116,7 +116,7 @@ export interface PromptRecognizerResult<T> {
|
|
|
116
116
|
* > [!NOTE]
|
|
117
117
|
* > If the validator returns `false` the prompts default re-prompt logic will be run unless the
|
|
118
118
|
* > validator sends a custom re-prompt to the user using `prompt.context.sendActivity()`. In that
|
|
119
|
-
* > case the prompts default re-
|
|
119
|
+
* > case the prompts default re-prompt logic will not be run.
|
|
120
120
|
* @param T Type of recognizer result being validated.
|
|
121
121
|
* @param prompt Contextual information containing the recognizer result and original options passed to the prompt.
|
|
122
122
|
*/
|
|
@@ -140,8 +140,8 @@ export interface PromptValidatorContext<T> {
|
|
|
140
140
|
* Result returned from the prompts recognizer function.
|
|
141
141
|
*
|
|
142
142
|
* @remarks
|
|
143
|
-
* The
|
|
144
|
-
* anything and then the value can be retrieved from
|
|
143
|
+
* The {@link @microsoft/agents-hosting-dialogs.PromptRecognizerResult.succeeded | recognized.succeeded} field can be checked to determine of the recognizer found
|
|
144
|
+
* anything and then the value can be retrieved from {@link @microsoft/agents-hosting-dialogs.PromptRecognizerResult.value | recognized.value}.
|
|
145
145
|
*/
|
|
146
146
|
readonly recognized: PromptRecognizerResult<T>;
|
|
147
147
|
|
|
@@ -178,7 +178,7 @@ export abstract class Prompt<T> extends Dialog {
|
|
|
178
178
|
/**
|
|
179
179
|
* Creates a new Prompt instance.
|
|
180
180
|
*
|
|
181
|
-
* @param dialogId Unique ID of the prompt within its parent
|
|
181
|
+
* @param dialogId Unique ID of the prompt within its parent {@link DialogSet} or {@link ComponentDialog}.
|
|
182
182
|
* @param validator (Optional) custom validator used to provide additional validation and re-prompting logic for the prompt.
|
|
183
183
|
*/
|
|
184
184
|
protected constructor (
|
|
@@ -49,6 +49,9 @@ export interface PromptCultureModel {
|
|
|
49
49
|
* Class container for currently-supported Culture Models in Confirm and Choice Prompt.
|
|
50
50
|
*/
|
|
51
51
|
export class PromptCultureModels {
|
|
52
|
+
/**
|
|
53
|
+
* Represents the Chinese culture model with locale and language-specific settings.
|
|
54
|
+
*/
|
|
52
55
|
static Chinese: PromptCultureModel = {
|
|
53
56
|
locale: Culture.Chinese,
|
|
54
57
|
separator: ', ',
|
|
@@ -58,6 +61,9 @@ export class PromptCultureModels {
|
|
|
58
61
|
noInLanguage: '不',
|
|
59
62
|
}
|
|
60
63
|
|
|
64
|
+
/**
|
|
65
|
+
* Represents the Dutch culture model with locale and language-specific settings.
|
|
66
|
+
*/
|
|
61
67
|
static Dutch: PromptCultureModel = {
|
|
62
68
|
locale: Culture.Dutch,
|
|
63
69
|
separator: ', ',
|
|
@@ -67,6 +73,9 @@ export class PromptCultureModels {
|
|
|
67
73
|
noInLanguage: 'Nee',
|
|
68
74
|
}
|
|
69
75
|
|
|
76
|
+
/**
|
|
77
|
+
* Represents the English culture model with locale and language-specific settings.
|
|
78
|
+
*/
|
|
70
79
|
static English: PromptCultureModel = {
|
|
71
80
|
locale: Culture.English,
|
|
72
81
|
separator: ', ',
|
|
@@ -76,6 +85,9 @@ export class PromptCultureModels {
|
|
|
76
85
|
noInLanguage: 'No',
|
|
77
86
|
}
|
|
78
87
|
|
|
88
|
+
/**
|
|
89
|
+
* Represents the French culture model with locale and language-specific settings.
|
|
90
|
+
*/
|
|
79
91
|
static French: PromptCultureModel = {
|
|
80
92
|
locale: Culture.French,
|
|
81
93
|
separator: ', ',
|
|
@@ -85,6 +97,9 @@ export class PromptCultureModels {
|
|
|
85
97
|
noInLanguage: 'Non',
|
|
86
98
|
}
|
|
87
99
|
|
|
100
|
+
/**
|
|
101
|
+
* Represents the German culture model with locale and language-specific settings.
|
|
102
|
+
*/
|
|
88
103
|
static German: PromptCultureModel = {
|
|
89
104
|
locale: Culture.German,
|
|
90
105
|
separator: ', ',
|
|
@@ -94,6 +109,9 @@ export class PromptCultureModels {
|
|
|
94
109
|
noInLanguage: 'Nein',
|
|
95
110
|
}
|
|
96
111
|
|
|
112
|
+
/**
|
|
113
|
+
* Represents the Italian culture model with locale and language-specific settings.
|
|
114
|
+
*/
|
|
97
115
|
static Italian: PromptCultureModel = {
|
|
98
116
|
locale: Culture.Italian,
|
|
99
117
|
separator: ', ',
|
|
@@ -103,6 +121,9 @@ export class PromptCultureModels {
|
|
|
103
121
|
noInLanguage: 'No',
|
|
104
122
|
}
|
|
105
123
|
|
|
124
|
+
/**
|
|
125
|
+
* Represents the Japanese culture model with locale and language-specific settings.
|
|
126
|
+
*/
|
|
106
127
|
static Japanese: PromptCultureModel = {
|
|
107
128
|
locale: Culture.Japanese,
|
|
108
129
|
separator: '、 ',
|
|
@@ -112,6 +133,9 @@ export class PromptCultureModels {
|
|
|
112
133
|
noInLanguage: 'いいえ',
|
|
113
134
|
}
|
|
114
135
|
|
|
136
|
+
/**
|
|
137
|
+
* Represents the Portuguese culture model with locale and language-specific settings.
|
|
138
|
+
*/
|
|
115
139
|
static Portuguese: PromptCultureModel = {
|
|
116
140
|
locale: Culture.Portuguese,
|
|
117
141
|
separator: ', ',
|
|
@@ -121,6 +145,9 @@ export class PromptCultureModels {
|
|
|
121
145
|
noInLanguage: 'Não',
|
|
122
146
|
}
|
|
123
147
|
|
|
148
|
+
/**
|
|
149
|
+
* Represents the Spanish culture model with locale and language-specific settings.
|
|
150
|
+
*/
|
|
124
151
|
static Spanish: PromptCultureModel = {
|
|
125
152
|
locale: Culture.Spanish,
|
|
126
153
|
separator: ', ',
|
|
@@ -131,6 +158,9 @@ export class PromptCultureModels {
|
|
|
131
158
|
}
|
|
132
159
|
|
|
133
160
|
/**
|
|
161
|
+
* Retrieves a list of supported culture codes.
|
|
162
|
+
*
|
|
163
|
+
* @returns An array of supported locale strings.
|
|
134
164
|
* @private
|
|
135
165
|
*/
|
|
136
166
|
private static getSupportedCultureCodes (): string[] {
|
|
@@ -138,12 +168,12 @@ export class PromptCultureModels {
|
|
|
138
168
|
}
|
|
139
169
|
|
|
140
170
|
/**
|
|
141
|
-
*
|
|
171
|
+
* Normalizes a given locale string to the nearest supported language.
|
|
142
172
|
*
|
|
173
|
+
* @param cultureCode The locale string to normalize (e.g., "en-US").
|
|
174
|
+
* @returns The normalized locale string.
|
|
143
175
|
* @remarks This is mostly a copy/paste from https://github.com/microsoft/Recognizers-Text/blob/master/JavaScript/packages/recognizers-text/src/culture.ts#L39
|
|
144
176
|
* This doesn't directly use Recognizers-Text's MapToNearestLanguage because if they add language support before we do, it will break our prompts.
|
|
145
|
-
* @param cultureCode Represents locale. Examples: "en-US, en-us, EN".
|
|
146
|
-
* @returns Normalized locale.
|
|
147
177
|
*/
|
|
148
178
|
static mapToNearestLanguage (cultureCode: string): string {
|
|
149
179
|
if (cultureCode) {
|
|
@@ -164,6 +194,11 @@ export class PromptCultureModels {
|
|
|
164
194
|
return cultureCode
|
|
165
195
|
}
|
|
166
196
|
|
|
197
|
+
/**
|
|
198
|
+
* Retrieves a list of supported culture models.
|
|
199
|
+
*
|
|
200
|
+
* @returns An array of `PromptCultureModel` objects representing supported cultures.
|
|
201
|
+
*/
|
|
167
202
|
static getSupportedCultures = (): PromptCultureModel[] => [
|
|
168
203
|
PromptCultureModels.Chinese,
|
|
169
204
|
PromptCultureModels.Dutch,
|
package/src/recognizer.ts
CHANGED
|
@@ -13,9 +13,16 @@ export interface RecognizerConfiguration {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* Base class for implementing custom recognizers to identify intents and entities from user input.
|
|
17
|
+
*
|
|
18
|
+
* Recognizers process user input, such as text or speech, and return structured data representing
|
|
19
|
+
* the recognized intents, entities, and other relevant information. This class provides a foundation
|
|
20
|
+
* for creating custom recognizers by defining common methods and properties.
|
|
17
21
|
*/
|
|
18
22
|
export class Recognizer extends Configurable implements RecognizerConfiguration {
|
|
23
|
+
/**
|
|
24
|
+
* Optional. The unique identifier for the recognizer.
|
|
25
|
+
*/
|
|
19
26
|
id?: string
|
|
20
27
|
/**
|
|
21
28
|
* To recognize intents and entities in a users utterance.
|
package/src/recognizerResult.ts
CHANGED
|
@@ -8,11 +8,30 @@ import { IntentScore } from './intentScore'
|
|
|
8
8
|
* Value returned from a recognizer.
|
|
9
9
|
*/
|
|
10
10
|
export interface RecognizerResult {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
/**
|
|
12
|
+
* The original text input provided by the user.
|
|
13
|
+
*/
|
|
14
|
+
text: string
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Optional. The modified version of the text input, if applicable.
|
|
18
|
+
*/
|
|
19
|
+
alteredText?: string
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* A mapping of intent names to their corresponding confidence scores.
|
|
23
|
+
*/
|
|
24
|
+
intents: Record<string, IntentScore>
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Optional. Entities recognized in the input, if any.
|
|
28
|
+
*/
|
|
29
|
+
entities?: any
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Additional properties that may be included in the recognizer result.
|
|
33
|
+
*/
|
|
34
|
+
[propName: string]: any
|
|
16
35
|
}
|
|
17
36
|
|
|
18
37
|
export const getTopScoringIntent = (result: RecognizerResult): { intent: string; score: number } => {
|
package/src/serviceCollection.ts
CHANGED
|
@@ -62,9 +62,9 @@ export class ServiceCollection {
|
|
|
62
62
|
/**
|
|
63
63
|
* Register an instance by key. This will overwrite existing instances.
|
|
64
64
|
*
|
|
65
|
-
* @param key
|
|
66
|
-
* @param instance
|
|
67
|
-
* @returns this for chaining
|
|
65
|
+
* @param key Key of the instance being provided.
|
|
66
|
+
* @param instance Instance to provide.
|
|
67
|
+
* @returns `this` for chaining.
|
|
68
68
|
*/
|
|
69
69
|
addInstance<InstanceType>(key: string, instance: InstanceType): this {
|
|
70
70
|
if (this.graph.hasNode(key)) {
|
|
@@ -78,19 +78,19 @@ export class ServiceCollection {
|
|
|
78
78
|
/**
|
|
79
79
|
* Register a factory for a key.
|
|
80
80
|
*
|
|
81
|
-
* @param key
|
|
82
|
-
* @param factory
|
|
83
|
-
* @returns this for chaining
|
|
81
|
+
* @param key Key that factory will provide.
|
|
82
|
+
* @param factory Function that creates an instance to provide.
|
|
83
|
+
* @returns `this` for chaining.
|
|
84
84
|
*/
|
|
85
85
|
addFactory<InstanceType>(key: string, factory: Factory<InstanceType, false>): this
|
|
86
86
|
|
|
87
87
|
/**
|
|
88
88
|
* Register a factory for a key with a set of dependencies.
|
|
89
89
|
*
|
|
90
|
-
* @param key
|
|
91
|
-
* @param dependencies
|
|
92
|
-
* @param factory
|
|
93
|
-
* @returns this for chaining
|
|
90
|
+
* @param key Key that factory will provide.
|
|
91
|
+
* @param dependencies Set of things this instance depends on. Will be provided to factory function via `services`.
|
|
92
|
+
* @param factory Function that creates an instance to provide.
|
|
93
|
+
* @returns `this` for chaining.
|
|
94
94
|
*/
|
|
95
95
|
addFactory<InstanceType, Dependencies>(
|
|
96
96
|
key: string,
|
|
@@ -144,10 +144,10 @@ export class ServiceCollection {
|
|
|
144
144
|
* Register a factory (that expects an initial value that is not undefined) for a key
|
|
145
145
|
* with a set of dependencies.
|
|
146
146
|
*
|
|
147
|
-
* @param key
|
|
148
|
-
* @param dependencies
|
|
149
|
-
* @param factory
|
|
150
|
-
* @returns this for chaining
|
|
147
|
+
* @param key Key that factory will provide.
|
|
148
|
+
* @param dependencies Set of things this instance depends on. Will be provided to factory function via `services`.
|
|
149
|
+
* @param factory Function that creates an instance to provide.
|
|
150
|
+
* @returns `this` for chaining.
|
|
151
151
|
*/
|
|
152
152
|
composeFactory<InstanceType, Dependencies>(
|
|
153
153
|
key: string,
|
|
@@ -241,9 +241,9 @@ export class ServiceCollection {
|
|
|
241
241
|
/**
|
|
242
242
|
* Build a single service.
|
|
243
243
|
*
|
|
244
|
-
* @param key
|
|
245
|
-
* @param deep reconstruct all dependencies
|
|
246
|
-
* @returns
|
|
244
|
+
* @param key Service to build.
|
|
245
|
+
* @param deep Whether to reconstruct all dependencies.
|
|
246
|
+
* @returns The service instance, or undefined.
|
|
247
247
|
*/
|
|
248
248
|
makeInstance<InstanceType = unknown>(key: string, deep = false): InstanceType | undefined {
|
|
249
249
|
// If this is not a deep reconstruction, reuse any services that `key` depends on
|
|
@@ -264,9 +264,9 @@ export class ServiceCollection {
|
|
|
264
264
|
/**
|
|
265
265
|
* Build a single service and assert that it is not undefined.
|
|
266
266
|
*
|
|
267
|
-
* @param key
|
|
268
|
-
* @param deep reconstruct all dependencies
|
|
269
|
-
* @returns
|
|
267
|
+
* @param key Service to build.
|
|
268
|
+
* @param deep Wheter to reconstruct all dependencies.
|
|
269
|
+
* @returns The service instance
|
|
270
270
|
*/
|
|
271
271
|
mustMakeInstance<InstanceType = unknown>(key: string, deep = false): InstanceType {
|
|
272
272
|
const instance = this.makeInstance<InstanceType>(key, deep)
|
|
@@ -287,8 +287,8 @@ export class ServiceCollection {
|
|
|
287
287
|
/**
|
|
288
288
|
* Build the full set of services, asserting that the specified keys are not undefined.
|
|
289
289
|
*
|
|
290
|
-
* @param keys
|
|
291
|
-
* @returns
|
|
290
|
+
* @param keys Instances that must be not undefined
|
|
291
|
+
* @returns All resolve services
|
|
292
292
|
*/
|
|
293
293
|
mustMakeInstances<InstancesType extends Record<string, unknown> = Record<string, unknown>>(
|
|
294
294
|
...keys: string[]
|
package/src/waterfallDialog.ts
CHANGED
|
@@ -29,7 +29,7 @@ export class WaterfallDialog<O extends object = {}> extends Dialog<O> {
|
|
|
29
29
|
* Creates a new waterfall dialog containing the given array of steps.
|
|
30
30
|
*
|
|
31
31
|
* @remarks
|
|
32
|
-
* See the
|
|
32
|
+
* See the {@link WaterfallDialog.addStep | addStep function} for details on creating a valid step function.
|
|
33
33
|
* @param dialogId Unique ID of the dialog within the component or set its being added to.
|
|
34
34
|
* @param steps (Optional) array of asynchronous waterfall step functions.
|
|
35
35
|
*/
|
|
@@ -67,7 +67,7 @@ export class WaterfallDialog<O extends object = {}> extends Dialog<O> {
|
|
|
67
67
|
/**
|
|
68
68
|
* Called when the WaterfallDialog is started and pushed onto the dialog stack.
|
|
69
69
|
*
|
|
70
|
-
* @param dialogContext The DialogContext for the current turn of conversation.
|
|
70
|
+
* @param dialogContext The {@link DialogContext} for the current turn of conversation.
|
|
71
71
|
* @param options Optional, initial information to pass to the Dialog.
|
|
72
72
|
* @returns A Promise representing the asynchronous operation.
|
|
73
73
|
* @remarks
|
|
@@ -89,7 +89,7 @@ export class WaterfallDialog<O extends object = {}> extends Dialog<O> {
|
|
|
89
89
|
* Called when the WaterfallDialog is _continued_, where it is the active dialog and the
|
|
90
90
|
* user replies with a new Activity.
|
|
91
91
|
*
|
|
92
|
-
* @param dialogContext The DialogContext for the current turn of conversation.
|
|
92
|
+
* @param dialogContext The {@link DialogContext} for the current turn of conversation.
|
|
93
93
|
* @returns A Promise representing the asynchronous operation.
|
|
94
94
|
* @remarks
|
|
95
95
|
* If the task is successful, the result indicates whether the dialog is still
|
|
@@ -109,7 +109,7 @@ export class WaterfallDialog<O extends object = {}> extends Dialog<O> {
|
|
|
109
109
|
/**
|
|
110
110
|
* Called when a child WaterfallDialog completed its turn, returning control to this dialog.
|
|
111
111
|
*
|
|
112
|
-
* @param dc The DialogContext for the current turn of the conversation.
|
|
112
|
+
* @param dc The {@link DialogContext} for the current turn of the conversation.
|
|
113
113
|
* @param reason DialogReason why the dialog resumed.
|
|
114
114
|
* @param result Optional, value returned from the dialog that was called. The type
|
|
115
115
|
* of the value returned is dependent on the child dialog.
|
|
@@ -138,7 +138,7 @@ export class WaterfallDialog<O extends object = {}> extends Dialog<O> {
|
|
|
138
138
|
/**
|
|
139
139
|
* Executes a step of the WaterfallDialog.
|
|
140
140
|
*
|
|
141
|
-
* @param dc The DialogContext for the current turn of conversation.
|
|
141
|
+
* @param dc The {@link DialogContext} for the current turn of conversation.
|
|
142
142
|
* @param index The index of the current waterfall step to execute.
|
|
143
143
|
* @param reason The DialogReason the waterfall step is being executed.
|
|
144
144
|
* @param result Optional, result returned by a dialog called in the previous waterfall step.
|
|
@@ -10,12 +10,38 @@ import { DialogTurnResult } from './dialogTurnResult'
|
|
|
10
10
|
* Values passed to the `WaterfallStepContext` constructor.
|
|
11
11
|
*/
|
|
12
12
|
export interface WaterfallStepInfo<O extends object> {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
/**
|
|
14
|
+
* The index of the current step in the waterfall dialog.
|
|
15
|
+
*/
|
|
16
|
+
index: number
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The options passed to the waterfall dialog when it was started.
|
|
20
|
+
*/
|
|
21
|
+
options: O
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The reason the current step is being executed.
|
|
25
|
+
*/
|
|
26
|
+
reason: DialogReason
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The result returned by the previous step or dialog.
|
|
30
|
+
*/
|
|
31
|
+
result: any
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* A dictionary of values shared across all steps in the waterfall dialog.
|
|
35
|
+
*/
|
|
36
|
+
values: object
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* A function to proceed to the next step in the waterfall dialog.
|
|
40
|
+
*
|
|
41
|
+
* @param result Optional result to pass to the next step.
|
|
42
|
+
* @returns A promise resolving to the result of the next dialog turn.
|
|
43
|
+
*/
|
|
44
|
+
onNext(result?: any): Promise<DialogTurnResult>
|
|
19
45
|
}
|
|
20
46
|
|
|
21
47
|
/**
|