aimpress-chatbot/node_modules/botbuilder/lib/activityValidator.js
“SamoilenkoVadym” 55445dbc86
Some checks failed
Build and deploy Node.js app to Azure Web App - ChatBot2222 / build (push) Has been cancelled
Build and deploy Node.js app to Azure Web App - ChatBot2222 / deploy (push) Has been cancelled
Deploy bot to Azure
2025-04-27 19:55:19 +01:00

39 lines
No EOL
1.4 KiB
JavaScript

"use strict";
/**
* @module botbuilder
*/
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateAndFixActivity = void 0;
/**
* Validates an [Activity](xref:botbuilder-core.Activity) and formats the timestamp fields.
*
* @param activity [Activity](xref:botbuilder-core.Activity) to be validated.
* @returns The [Activity](xref:botframework-schema.Activity).
*/
function validateAndFixActivity(activity) {
if (typeof activity !== 'object') {
throw new Error('validateAndFixActivity(): invalid request body.');
}
if (typeof activity.type !== 'string') {
throw new Error('validateAndFixActivity(): missing activity type.');
}
if (typeof activity.timestamp === 'string') {
activity.rawTimestamp = activity.timestamp;
activity.timestamp = new Date(activity.timestamp);
}
if (typeof activity.expiration === 'string') {
activity.rawExpiration = activity.expiration;
activity.expiration = new Date(activity.expiration);
}
if (typeof activity.localTimestamp === 'string') {
activity.rawLocalTimestamp = activity.localTimestamp;
activity.localTimestamp = new Date(activity.localTimestamp);
}
return activity;
}
exports.validateAndFixActivity = validateAndFixActivity;
//# sourceMappingURL=activityValidator.js.map