Add OnInstallationUpdateActivity in adaptive trigger conditions (#4629)

* add OnInstallationUpdateActivity and related tests

* adjust comments

* add schema for InstallationUpdate activity

* update test.schema

* update schema
This commit is contained in:
Fei Chen 2020-09-19 13:34:33 +08:00 коммит произвёл GitHub
Родитель b9a125bcb9
Коммит 31af94b55b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
8 изменённых файлов: 181 добавлений и 19 удалений

Просмотреть файл

@ -58,6 +58,7 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive
yield return new DeclarativeType<OnConversationUpdateActivity>(OnConversationUpdateActivity.Kind);
yield return new DeclarativeType<OnEndOfConversationActivity>(OnEndOfConversationActivity.Kind);
yield return new DeclarativeType<OnTypingActivity>(OnTypingActivity.Kind);
yield return new DeclarativeType<OnInstallationUpdateActivity>(OnInstallationUpdateActivity.Kind);
yield return new DeclarativeType<OnHandoffActivity>(OnHandoffActivity.Kind);
yield return new DeclarativeType<OnChooseIntent>(OnChooseIntent.Kind);
yield return new DeclarativeType<OnQnAMatch>(OnQnAMatch.Kind);

Просмотреть файл

@ -0,0 +1,10 @@
{
"$schema": "https://schemas.botframework.com/schemas/component/v1.0/component.schema",
"$role": [ "implements(Microsoft.ITrigger)", "extends(Microsoft.OnCondition)" ],
"title": "On InstallationUpdate activity",
"description": "Actions to perform on receipt of an activity with type 'InstallationUpdate'.",
"type": "object",
"required": [
"actions"
]
}

Просмотреть файл

@ -0,0 +1,14 @@
{
"$schema": "https://schemas.botframework.com/schemas/ui/v1.0/ui.schema",
"form": {
"order": [
"condition",
"*"
],
"hidden": [
"actions"
],
"label": "Installation updated",
"subtitle": "Installation updated activity"
}
}

Просмотреть файл

@ -0,0 +1,25 @@
// Licensed under the MIT License.
// Copyright (c) Microsoft Corporation. All rights reserved.
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using Microsoft.Bot.Schema;
using Newtonsoft.Json;
namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Conditions
{
/// <summary>
/// Actions triggered when a InstallationUpdateActivity is received.
/// </summary>
public class OnInstallationUpdateActivity : OnActivity
{
[JsonProperty("$kind")]
public new const string Kind = "Microsoft.OnInstallationUpdateActivity";
[JsonConstructor]
public OnInstallationUpdateActivity(List<Dialog> actions = null, string condition = null, [CallerFilePath] string callerPath = "", [CallerLineNumber] int callerLine = 0)
: base(type: ActivityTypes.InstallationUpdate, actions: actions, condition: condition, callerPath: callerPath, callerLine: callerLine)
{
}
}
}

Просмотреть файл

@ -75,6 +75,13 @@ namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Tests
},
$"((turn.activity.type == '{ActivityTypes.Typing}') && ((turn.dialogEvent.name == '{AdaptiveEvents.ActivityReceived}') && (turn.test == 1)))");
AssertExpression(
new OnInstallationUpdateActivity()
{
Condition = "turn.test == 1"
},
$"((turn.activity.type == '{ActivityTypes.InstallationUpdate}') && ((turn.dialogEvent.name == '{AdaptiveEvents.ActivityReceived}') && (turn.test == 1)))");
AssertExpression(
new OnEndOfConversationActivity()
{

Просмотреть файл

@ -45,6 +45,16 @@
}
]
},
{
"$kind": "Microsoft.OnInstallationUpdateActivity",
"condition": "turn.activity.text == 'OnInstallationUpdateActivity'",
"actions": [
{
"$kind": "Microsoft.SendActivity",
"activity": "OnInstallationUpdateActivity"
}
]
},
{
"$kind": "Microsoft.OnEndOfConversationActivity",
"condition": "turn.activity.text == 'OnEndOfConversationActivity'",
@ -165,6 +175,17 @@
"$kind": "Microsoft.Test.AssertReply",
"text": "OnTypingActivity"
},
{
"$kind": "Microsoft.Test.UserActivity",
"activity": {
"type": "installationUpdate",
"text": "OnInstallationUpdateActivity"
}
},
{
"$kind": "Microsoft.Test.AssertReply",
"text": "OnInstallationUpdateActivity"
},
{
"$kind": "Microsoft.Test.UserActivity",
"activity": {

Просмотреть файл

@ -211,6 +211,9 @@
{
"$ref": "#/definitions/Microsoft.OnHandoffActivity"
},
{
"$ref": "#/definitions/Microsoft.OnInstallationUpdateActivity"
},
{
"$ref": "#/definitions/Microsoft.OnIntent"
},
@ -3844,10 +3847,10 @@
"type": "string"
},
{
"$ref": "#/definitions/Microsoft.OrchestratorRecognizer"
"$ref": "#/definitions/Microsoft.OrchestratorRecognizer"
},
{
"$ref": "#/definitions/Microsoft.LuisRecognizer"
"$ref": "#/definitions/Microsoft.LuisRecognizer"
},
{
"$ref": "#/definitions/Microsoft.QnAMakerRecognizer"
@ -3937,6 +3940,9 @@
{
"$ref": "#/definitions/Microsoft.OnHandoffActivity"
},
{
"$ref": "#/definitions/Microsoft.OnInstallationUpdateActivity"
},
{
"$ref": "#/definitions/Microsoft.OnIntent"
},
@ -6126,6 +6132,71 @@
}
}
},
"Microsoft.OnInstallationUpdateActivity": {
"$role": [
"implements(Microsoft.ITrigger)",
"extends(Microsoft.OnCondition)"
],
"title": "On InstallationUpdate activity",
"description": "Actions to perform on receipt of an activity with type 'InstallationUpdate'.",
"type": "object",
"required": [
"actions",
"$kind"
],
"additionalProperties": false,
"patternProperties": {
"^\\$": {
"title": "Tooling property",
"description": "Open ended property for tooling."
}
},
"properties": {
"condition": {
"$ref": "#/definitions/condition",
"title": "Condition",
"description": "Condition (expression).",
"examples": [
"user.vip == true"
]
},
"actions": {
"type": "array",
"title": "Actions",
"description": "Sequence of actions to execute.",
"items": {
"$kind": "Microsoft.IDialog",
"$ref": "#/definitions/Microsoft.IDialog"
}
},
"priority": {
"$ref": "#/definitions/integerExpression",
"title": "Priority",
"description": "Priority for trigger with 0 being the highest and < 0 ignored."
},
"runOnce": {
"$ref": "#/definitions/booleanExpression",
"title": "Run Once",
"description": "True if rule should run once per unique conditions",
"examples": [
true,
"=f(x)"
]
},
"$kind": {
"title": "Kind of dialog object",
"description": "Defines the valid properties for the component you are configuring (from a dialog .schema file)",
"type": "string",
"pattern": "^[a-zA-Z][a-zA-Z0-9.]*$",
"const": "Microsoft.OnInstallationUpdateActivity"
},
"$designer": {
"title": "Designer information",
"type": "object",
"description": "Extra information for the Bot Framework Composer."
}
}
},
"Microsoft.OnIntent": {
"$role": [
"implements(Microsoft.ITrigger)",
@ -7090,23 +7161,23 @@
]
},
"strictFiltersCompoundOperationType": {
"$ref": "#/definitions/stringExpression",
"title": "StrictFiltersCompoundOperationType",
"description": "Join operator for Strict Filters.",
"oneOf": [
{
"title": "StrictFilters CompoundOperation Type",
"description": "Value of Join Operator to be used as Conjunction with Strict Filter Value.",
"enum": [
"AND",
"OR"
],
"default": "AND"
},
{
"$ref": "#/definitions/equalsExpression"
}
]
"$ref": "#/definitions/stringExpression",
"title": "strictFiltersCompoundOperationType",
"description": "Join operator for Strict Filters.",
"oneOf": [
{
"title": "StrictFilters CompoundOperation Type",
"description": "Value of Join Operator to be used as Conjunction with Strict Filter Value.",
"enum": [
"AND",
"OR"
],
"default": "AND"
},
{
"$ref": "#/definitions/equalsExpression"
}
]
},
"$kind": {
"title": "Kind of dialog object",

Просмотреть файл

@ -446,6 +446,19 @@
"subtitle": "Handoff activity"
}
},
"Microsoft.OnInstallationUpdateActivity": {
"form": {
"hidden": [
"actions"
],
"label": "Installation updated",
"order": [
"condition",
"*"
],
"subtitle": "Installation updated activity"
}
},
"Microsoft.OnIntent": {
"form": {
"hidden": [