@oracle/bots-node-sdk
Advanced tools
Comparing version 2.7.1 to 2.7.2
@@ -34,3 +34,2 @@ /** | ||
event.properties = {'attributeValue': row[attributeName]}; | ||
logger.debug(`Invoking event handler ${handlerPath} with event: ${JSON.stringify(event)}`); | ||
let returnValue = await Promise.resolve(handler(event.properties, context)); | ||
@@ -47,3 +46,2 @@ if (returnValue) { | ||
event.properties = {'settings': metadata}; | ||
logger.debug(`Invoking event handler ${handlerPath} with event: ${JSON.stringify(event)}`); | ||
let returnValue = await Promise.resolve(handler(event.properties, context)); | ||
@@ -59,3 +57,2 @@ if (returnValue) { | ||
event.properties = {'settings': settings}; | ||
logger.debug(`Invoking event handler ${handlerPath} with event: ${JSON.stringify(event)}`); | ||
let returnValue = await Promise.resolve(handler(event.properties, context)); | ||
@@ -69,3 +66,2 @@ if (returnValue) { | ||
event.properties = {'responseData': data}; | ||
logger.debug(`Invoking event handler ${handlerPath} with event: ${JSON.stringify(event)}`); | ||
let returnValue = await Promise.resolve(handler(event.properties, context)); | ||
@@ -77,3 +73,2 @@ if (returnValue) { | ||
event.properties = {'messages': context.getRequest().candidateMessages}; | ||
logger.debug(`Invoking event handler ${handlerPath} with event: ${JSON.stringify(event)}`); | ||
let returnValue = await Promise.resolve(handler(event.properties, context)); | ||
@@ -85,3 +80,3 @@ if (returnValue) { | ||
} else { | ||
logger.debug(`No handler found for event: ${handlerPath}`); | ||
logger.error(`No handler found for event: ${handlerPath}`); | ||
break; | ||
@@ -88,0 +83,0 @@ } |
@@ -38,3 +38,2 @@ /** | ||
if (handler) { | ||
logger.debug(`Invoking event handler ${handlerPath} with event: ${JSON.stringify(event)}`); | ||
// event handlers can be async (returning a promise), but we dont want to enforce | ||
@@ -47,3 +46,2 @@ // every event handler is async, hence Promise.resolve wrapping of invocation | ||
if (eventName==='shouldPrompt') { | ||
logger.debug(`Adding ${itemName} to shouldPrompt cache with value ${retValue}`); | ||
context._getShouldPromptCache()[itemName] = retValue; | ||
@@ -67,3 +65,3 @@ if (retValue) { | ||
} else { | ||
logger.debug(`No handler found for event: ${handlerPath}`); | ||
logger.error(`No handler found for event: ${handlerPath}`); | ||
break; | ||
@@ -70,0 +68,0 @@ } |
{ | ||
"name": "@oracle/bots-node-sdk", | ||
"version": "2.7.1", | ||
"version": "2.7.2", | ||
"description": "Oracle Digital Assistant SDK for custom component development and webhook integrations", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -38,4 +38,4 @@ import * as lib from './lib/'; | ||
type EntityItemPublishPromptMessageEvent = lib.EntityItemPublishPromptMessageEvent; | ||
type EntityItemPublishDisambiguationMessageEvent = lib.EntityItemPublishDisambiguationMessageEvent; | ||
type EntityItemPublishDisambiguateMessageEvent = lib.EntityItemPublishDisambiguateMessageEvent; | ||
type EntityItemMaxPromptsReachedEvent = lib.EntityItemMaxPromptsReachedEvent; | ||
} |
@@ -56,6 +56,7 @@ import { InvocationCallback } from '../../common/definitions'; | ||
export interface EntityItemEvents { | ||
items?: EntityItems; | ||
shouldPrompt?(event: EntityValidateEvent, context: EntityResolutionContext): void; | ||
validate?(event: EntityItemValidateEvent, context: EntityResolutionContext): void; | ||
publishPromptMessage?(event: EntityItemPublishPromptMessageEvent, context: EntityResolutionContext): void; | ||
publishDisambiguationMessage?(event: EntityItemPublishDisambiguationMessageEvent, context: EntityResolutionContext): void; | ||
publishDisambiguateMessage?(event: EntityItemPublishDisambiguateMessageEvent, context: EntityResolutionContext): void; | ||
maxPromptsReached?(event: EntityItemMaxPromptsReachedEvent, context: EntityResolutionContext): void; | ||
@@ -113,3 +114,3 @@ } | ||
} | ||
export interface EntityItemPublishDisambiguationMessageEvent extends EntityBaseEvent { | ||
export interface EntityItemPublishDisambiguateMessageEvent extends EntityBaseEvent { | ||
disambiguationValues: object[]; | ||
@@ -116,0 +117,0 @@ } |
@@ -48,3 +48,2 @@ "use strict"; | ||
event.properties = { 'attributeValue': row[attributeName] }; | ||
logger.debug(`Invoking event handler ${handlerPath} with event: ${JSON.stringify(event)}`); | ||
let returnValue = yield Promise.resolve(handler(event.properties, context)); | ||
@@ -62,3 +61,2 @@ if (returnValue) { | ||
event.properties = { 'settings': metadata }; | ||
logger.debug(`Invoking event handler ${handlerPath} with event: ${JSON.stringify(event)}`); | ||
let returnValue = yield Promise.resolve(handler(event.properties, context)); | ||
@@ -74,3 +72,2 @@ if (returnValue) { | ||
event.properties = { 'settings': settings }; | ||
logger.debug(`Invoking event handler ${handlerPath} with event: ${JSON.stringify(event)}`); | ||
let returnValue = yield Promise.resolve(handler(event.properties, context)); | ||
@@ -85,3 +82,2 @@ if (returnValue) { | ||
event.properties = { 'responseData': data }; | ||
logger.debug(`Invoking event handler ${handlerPath} with event: ${JSON.stringify(event)}`); | ||
let returnValue = yield Promise.resolve(handler(event.properties, context)); | ||
@@ -94,3 +90,2 @@ if (returnValue) { | ||
event.properties = { 'messages': context.getRequest().candidateMessages }; | ||
logger.debug(`Invoking event handler ${handlerPath} with event: ${JSON.stringify(event)}`); | ||
let returnValue = yield Promise.resolve(handler(event.properties, context)); | ||
@@ -103,3 +98,3 @@ if (returnValue) { | ||
else { | ||
logger.debug(`No handler found for event: ${handlerPath}`); | ||
logger.error(`No handler found for event: ${handlerPath}`); | ||
break; | ||
@@ -106,0 +101,0 @@ } |
@@ -45,3 +45,2 @@ "use strict"; | ||
if (handler) { | ||
logger.debug(`Invoking event handler ${handlerPath} with event: ${JSON.stringify(event)}`); | ||
// event handlers can be async (returning a promise), but we dont want to enforce | ||
@@ -52,5 +51,3 @@ // every event handler is async, hence Promise.resolve wrapping of invocation | ||
let retValue = returnValue === undefined ? true : (returnValue + '' === 'true'); | ||
logger.debug(`${eventName} returned ${retValue}`); | ||
if (eventName === 'shouldPrompt') { | ||
logger.debug(`Adding ${itemName} to shouldPrompt cache with value ${retValue}`); | ||
context._getShouldPromptCache()[itemName] = retValue; | ||
@@ -76,3 +73,3 @@ if (retValue) { | ||
else { | ||
logger.debug(`No handler found for event: ${handlerPath}`); | ||
logger.error(`No handler found for event: ${handlerPath}`); | ||
break; | ||
@@ -79,0 +76,0 @@ } |
@@ -38,11 +38,8 @@ "use strict"; | ||
if (eventName === `validateResponsePayload` || eventName === `validateRequestPayload`) { | ||
logger.debug(`Invoking event handler ${eventName}`); | ||
let returnValue = yield Promise.resolve(handler(event.properties, context)); | ||
// make sure return value is a boolean | ||
let retValue = returnValue === undefined ? true : (returnValue + '' === 'true'); | ||
logger.debug(`${eventName} returned ${retValue}`); | ||
context.getResponse().valid = retValue; | ||
} | ||
else if (eventName === `changeBotMessages`) { | ||
logger.debug(`Invoking event handler ${eventName}`); | ||
// convert json messages to message class | ||
@@ -65,3 +62,2 @@ const mf = context.getMessageFactory(); | ||
else { | ||
logger.debug(`Invoking ${event.custom ? 'custom ' : ''}event handler ${eventName}`); | ||
yield Promise.resolve(handler(event.properties, context)); | ||
@@ -71,3 +67,3 @@ } | ||
else { | ||
logger.debug(`No handler found for event: ${eventName}`); | ||
logger.error(`No handler found for event: ${eventName}`); | ||
} | ||
@@ -74,0 +70,0 @@ }); |
@@ -30,3 +30,2 @@ "use strict"; | ||
if (eventName === `transformRequestPayload`) { | ||
logger.debug(`Invoking event handler ${eventName}`); | ||
let returnValue = yield Promise.resolve(handler(event.properties, context)); | ||
@@ -38,3 +37,2 @@ if (returnValue) { | ||
else if (eventName === `transformResponsePayload` || eventName === `transformErrorResponsePayload`) { | ||
logger.debug(`Invoking event handler ${eventName}`); | ||
let returnValue = yield Promise.resolve(handler(event.properties, context)); | ||
@@ -47,3 +45,3 @@ if (returnValue) { | ||
else { | ||
logger.debug(`No handler found for event: ${eventName}`); | ||
logger.error(`No handler found for event: ${eventName}`); | ||
} | ||
@@ -50,0 +48,0 @@ }); |
@@ -12,2 +12,3 @@ import { Voice, ChannelCustomizable } from '../internal'; | ||
private style?; | ||
private displayType?; | ||
/** | ||
@@ -76,2 +77,13 @@ * Deserialize nested object properties into corresponding class instances | ||
setStyle(style: ActionStyle): this; | ||
/** | ||
* Gets the style of the action. | ||
* @returns {DisplayType} The display type of the action. | ||
*/ | ||
getDisplayType(): DisplayType; | ||
/** | ||
* Sets the display type of the action. | ||
* @param {DisplayType} displayType - The display type to set. | ||
* @returns The current instance of the Action class. | ||
*/ | ||
setDisplayType(displayType: DisplayType): this; | ||
} | ||
@@ -85,1 +97,9 @@ /** | ||
} | ||
/** | ||
* Represents the display type of an action. | ||
*/ | ||
export declare enum DisplayType { | ||
button = "button", | ||
link = "link", | ||
icon = "icon" | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ActionStyle = exports.Action = void 0; | ||
exports.DisplayType = exports.ActionStyle = exports.Action = void 0; | ||
const internal_1 = require("../internal"); | ||
@@ -106,2 +106,18 @@ /** | ||
} | ||
/** | ||
* Gets the style of the action. | ||
* @returns {DisplayType} The display type of the action. | ||
*/ | ||
getDisplayType() { | ||
return this.displayType; | ||
} | ||
/** | ||
* Sets the display type of the action. | ||
* @param {DisplayType} displayType - The display type to set. | ||
* @returns The current instance of the Action class. | ||
*/ | ||
setDisplayType(displayType) { | ||
this.displayType = displayType; | ||
return this; | ||
} | ||
} | ||
@@ -117,1 +133,10 @@ exports.Action = Action; | ||
})(ActionStyle = exports.ActionStyle || (exports.ActionStyle = {})); | ||
/** | ||
* Represents the display type of an action. | ||
*/ | ||
var DisplayType; | ||
(function (DisplayType) { | ||
DisplayType["button"] = "button"; | ||
DisplayType["link"] = "link"; | ||
DisplayType["icon"] = "icon"; | ||
})(DisplayType = exports.DisplayType || (exports.DisplayType = {})); |
export * from './callAction'; | ||
export * from './popupAction'; | ||
export * from './action'; | ||
@@ -3,0 +4,0 @@ export * from './keyword'; |
@@ -14,2 +14,3 @@ "use strict"; | ||
__exportStar(require("./callAction"), exports); | ||
__exportStar(require("./popupAction"), exports); | ||
__exportStar(require("./action"), exports); | ||
@@ -16,0 +17,0 @@ __exportStar(require("./keyword"), exports); |
@@ -51,2 +51,8 @@ "use strict"; | ||
break; | ||
case 'updateApplicationContextCommand': | ||
msg = Object.assign(new internal_1.UpdateApplicationContextCommandMessage(null), json); | ||
break; | ||
case 'executeApplicationActionCommand': | ||
msg = Object.assign(new internal_1.ExecuteApplicationActionCommandMessage(null, null), json); | ||
break; | ||
default: | ||
@@ -82,2 +88,5 @@ throw new Error(`Error deserializing message, unknown message type: ${type}`); | ||
break; | ||
case 'popup': | ||
action = Object.assign(new internal_1.PopupAction(null, null), json); | ||
break; | ||
case 'url': | ||
@@ -84,0 +93,0 @@ action = Object.assign(new internal_1.UrlAction(null, null), json); |
@@ -13,2 +13,3 @@ export * from './common/channelExtensions'; | ||
export * from './action/callAction'; | ||
export * from './action/popupAction'; | ||
export * from './action/locationAction'; | ||
@@ -41,2 +42,4 @@ export * from './action/postbackAction'; | ||
export * from './messagePayload/commandMessage'; | ||
export * from './messagePayload/executeApplicationActionCommandMessage'; | ||
export * from './messagePayload/updateApplicationContextCommandMessage'; | ||
export * from './messagePayload/editFormMessage'; | ||
@@ -43,0 +46,0 @@ export * from './messagePayload/formMessage'; |
@@ -30,2 +30,3 @@ "use strict"; | ||
__exportStar(require("./action/callAction"), exports); | ||
__exportStar(require("./action/popupAction"), exports); | ||
__exportStar(require("./action/locationAction"), exports); | ||
@@ -60,2 +61,4 @@ __exportStar(require("./action/postbackAction"), exports); | ||
__exportStar(require("./messagePayload/commandMessage"), exports); | ||
__exportStar(require("./messagePayload/executeApplicationActionCommandMessage"), exports); | ||
__exportStar(require("./messagePayload/updateApplicationContextCommandMessage"), exports); | ||
__exportStar(require("./messagePayload/editFormMessage"), exports); | ||
@@ -62,0 +65,0 @@ __exportStar(require("./messagePayload/formMessage"), exports); |
@@ -1,2 +0,3 @@ | ||
import { LocationAction, PostbackAction, ShareAction, CallAction, UrlAction, SubmitFormAction, Keyword, ReadOnlyForm, PaginationInfo, Voice, Row, TableHeading, DatePickerField, MultiSelectField, SelectFieldOption, NumberInputField, SingleSelectField, TextField, TextInputField, TimePickerField, ToggleField, LinkField, Field, ReadOnlyField, TextMessage, Attachment, AttachmentType, AttachmentMessage, Card, CardMessage, CommandMessage, CommandType, EditFormMessage, FormMessage, NonRawMessage, RawMessage, TableMessage, TableFormMessage, TextStreamMessage, StreamState, CustomEventAction } from './internal'; | ||
import { LocationAction, PostbackAction, ShareAction, CallAction, UrlAction, SubmitFormAction, Keyword, ReadOnlyForm, PaginationInfo, Voice, Row, TableHeading, DatePickerField, MultiSelectField, SelectFieldOption, NumberInputField, SingleSelectField, TextField, TextInputField, TimePickerField, ToggleField, LinkField, Field, ReadOnlyField, TextMessage, Attachment, AttachmentType, AttachmentMessage, Card, CardMessage, CommandMessage, CommandType, EditFormMessage, FormMessage, NonRawMessage, RawMessage, TableMessage, TableFormMessage, TextStreamMessage, StreamState, CustomEventAction, PopupAction, ActionField, MediaField, MediaType, Action } from './internal'; | ||
import { ExecuteApplicationActionCommandMessage, UpdateApplicationContextCommandMessage } from './messagePayload'; | ||
/** | ||
@@ -116,2 +117,15 @@ * Factory class to create the various message types of Oracle Digital Assistant Conversation Message Model (CMM) | ||
/** | ||
* Creates an instance of the ExecuteApplicationActionCommandMessage class. | ||
* @param {string} applicationName The name of the application | ||
* @param {string} action The action to execute | ||
* @returns {ExecuteApplicationActionCommandMessage} The created instance of the ExecuteApplicationActionCommandMessage. | ||
*/ | ||
static createExecuteApplicationActionCommandMessage(applicationName: string, action: string): ExecuteApplicationActionCommandMessage; | ||
/** | ||
* Creates an instance of the UpdateApplicationContextCommandMessage class. | ||
* @param {string} applicationName The name of the application | ||
* @returns {UpdateApplicationContextCommandMessage} The created instance of the UpdateApplicationContextCommandMessage. | ||
*/ | ||
static createUpdateApplicationContextCommandMessage(applicationName: string): UpdateApplicationContextCommandMessage; | ||
/** | ||
* Creates an instance of the PaginationInfo class. | ||
@@ -165,2 +179,9 @@ * @param {number} totalCount The total count. | ||
/** | ||
* Create a new Popup action | ||
* @param {string} label The label of the Popup action. | ||
* @param {NonRawMessage} popupContent The content shown in the popup. | ||
* @returns {PopupAction} A new instance of the PopupAction class. | ||
*/ | ||
static createPopupAction(label: string, popupContent: NonRawMessage): PopupAction; | ||
/** | ||
* Create a new Call action | ||
@@ -254,2 +275,16 @@ * @param {string} label The label of the Call action. | ||
static createLinkField(label: string, value: string, linkLabel: string): LinkField; | ||
/** | ||
* Creates an instance of the ActionField class. | ||
* @param action The action of the action field. | ||
* @returns The created instance of the ActionField. | ||
*/ | ||
static createActionField(action: Action): ActionField; | ||
/** | ||
* Creates an instance of the MediaField class. | ||
* @param label The label of the field. | ||
* @param value The URL value of the field | ||
* @param mediaType The media type for the field. | ||
* @returns The created instance of the MediaField. | ||
*/ | ||
static createMediaField(label: string, value: string, mediaType: MediaType): MediaField; | ||
} |
@@ -5,2 +5,3 @@ "use strict"; | ||
const internal_1 = require("./internal"); | ||
const messagePayload_1 = require("./messagePayload"); | ||
/** | ||
@@ -155,2 +156,19 @@ * Factory class to create the various message types of Oracle Digital Assistant Conversation Message Model (CMM) | ||
/** | ||
* Creates an instance of the ExecuteApplicationActionCommandMessage class. | ||
* @param {string} applicationName The name of the application | ||
* @param {string} action The action to execute | ||
* @returns {ExecuteApplicationActionCommandMessage} The created instance of the ExecuteApplicationActionCommandMessage. | ||
*/ | ||
static createExecuteApplicationActionCommandMessage(applicationName, action) { | ||
return new messagePayload_1.ExecuteApplicationActionCommandMessage(applicationName, action); | ||
} | ||
/** | ||
* Creates an instance of the UpdateApplicationContextCommandMessage class. | ||
* @param {string} applicationName The name of the application | ||
* @returns {UpdateApplicationContextCommandMessage} The created instance of the UpdateApplicationContextCommandMessage. | ||
*/ | ||
static createUpdateApplicationContextCommandMessage(applicationName) { | ||
return new messagePayload_1.UpdateApplicationContextCommandMessage(applicationName); | ||
} | ||
/** | ||
* Creates an instance of the PaginationInfo class. | ||
@@ -218,2 +236,11 @@ * @param {number} totalCount The total count. | ||
/** | ||
* Create a new Popup action | ||
* @param {string} label The label of the Popup action. | ||
* @param {NonRawMessage} popupContent The content shown in the popup. | ||
* @returns {PopupAction} A new instance of the PopupAction class. | ||
*/ | ||
static createPopupAction(label, popupContent) { | ||
return new internal_1.PopupAction(label, popupContent); | ||
} | ||
/** | ||
* Create a new Call action | ||
@@ -331,3 +358,21 @@ * @param {string} label The label of the Call action. | ||
} | ||
/** | ||
* Creates an instance of the ActionField class. | ||
* @param action The action of the action field. | ||
* @returns The created instance of the ActionField. | ||
*/ | ||
static createActionField(action) { | ||
return new internal_1.ActionField(action); | ||
} | ||
/** | ||
* Creates an instance of the MediaField class. | ||
* @param label The label of the field. | ||
* @param value The URL value of the field | ||
* @param mediaType The media type for the field. | ||
* @returns The created instance of the MediaField. | ||
*/ | ||
static createMediaField(label, value, mediaType) { | ||
return new internal_1.MediaField(label, value, mediaType); | ||
} | ||
} | ||
exports.MessageFactory = MessageFactory; |
@@ -52,3 +52,8 @@ import { NonRawMessage } from '../internal'; | ||
startDoNotDisturbMode = "startDoNotDisturbMode", | ||
stopDoNotDisturbMode = "stopDoNotDisturbMode" | ||
stopDoNotDisturbMode = "stopDoNotDisturbMode", | ||
invokeFlow = "invokeFlow", | ||
updateApplicationContext = "updateApplicationContext", | ||
custom = "custom", | ||
replayRequest = "replayRequest", | ||
executeApplicationAction = "executeApplicationAction" | ||
} |
@@ -65,2 +65,7 @@ "use strict"; | ||
CommandType["stopDoNotDisturbMode"] = "stopDoNotDisturbMode"; | ||
CommandType["invokeFlow"] = "invokeFlow"; | ||
CommandType["updateApplicationContext"] = "updateApplicationContext"; | ||
CommandType["custom"] = "custom"; | ||
CommandType["replayRequest"] = "replayRequest"; | ||
CommandType["executeApplicationAction"] = "executeApplicationAction"; | ||
})(CommandType = exports.CommandType || (exports.CommandType = {})); |
@@ -6,2 +6,4 @@ export * from './textMessage'; | ||
export * from './commandMessage'; | ||
export * from './updateApplicationContextCommandMessage'; | ||
export * from './executeApplicationActionCommandMessage'; | ||
export * from './editFormMessage'; | ||
@@ -8,0 +10,0 @@ export * from './formMessage'; |
@@ -18,2 +18,4 @@ "use strict"; | ||
__exportStar(require("./commandMessage"), exports); | ||
__exportStar(require("./updateApplicationContextCommandMessage"), exports); | ||
__exportStar(require("./executeApplicationActionCommandMessage"), exports); | ||
__exportStar(require("./editFormMessage"), exports); | ||
@@ -20,0 +22,0 @@ __exportStar(require("./formMessage"), exports); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
935430
332
24160