botium-core 1.13.11 → 1.13.14
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/botium-cjs.js +109 -58
- package/dist/botium-cjs.js.map +1 -1
- package/dist/botium-es.js +95 -45
- package/dist/botium-es.js.map +1 -1
- package/index.js +15 -9
- package/package.json +1 -1
- package/src/Capabilities.js +4 -0
- package/src/Defaults.js +0 -1
- package/src/containers/plugins/SimpleRestContainer.js +50 -22
- package/src/helpers/TranscriptUtils.js +12 -0
- package/test/compiler/compilermarkdown.spec.js +11 -11
- package/test/compiler/compilertxt.spec.js +11 -11
- package/test/compiler/compilerxlsx.spec.js +10 -10
- package/test/compiler/convos/md/{convos_with!.md → convos_with_exclamation.md} +0 -0
- package/test/compiler/convos/md/{convos_with!_secline.md → convos_with_exclamation_secline.md} +0 -0
- package/test/compiler/convos/md/{convos_with!!!!.md → convos_with_four_exclamation.md} +0 -0
- package/test/compiler/convos/md/{convos_with????.md → convos_with_four_question.md} +0 -0
- package/test/compiler/convos/md/{convos_with?.md → convos_with_question.md} +0 -0
- package/test/compiler/convos/md/{convos_with?!.md → convos_with_question_exclamation.md} +0 -0
- package/test/compiler/convos/md/{convos_with?_invalid.md → convos_with_question_invalid.md} +0 -0
- package/test/compiler/convos/md/{convos_with?_secline.md → convos_with_question_secline.md} +0 -0
- package/test/compiler/convos/md/{convos_with!!.md → convos_with_two_exclamation.md} +0 -0
- package/test/compiler/convos/md/{convos_with??.md → convos_with_two_question.md} +0 -0
- package/test/compiler/convos/md/{convos_with??!.md → convos_with_two_question_exclamation.md} +0 -0
- package/test/compiler/convos/txt/{convos_with!.convo.txt → convos_with_exclamation.convo.txt} +0 -0
- package/test/compiler/convos/txt/{convos_with!_secline.convo.txt → convos_with_exclamation_secline.convo.txt} +0 -0
- package/test/compiler/convos/txt/{convos_with!!!!.convo.txt → convos_with_four_exclamation.convo.txt} +0 -0
- package/test/compiler/convos/txt/{convos_with????.convo.txt → convos_with_four_question.convo.txt} +0 -0
- package/test/compiler/convos/txt/{convos_with_#.convo.txt → convos_with_hashmark.convo.txt} +0 -0
- package/test/compiler/convos/txt/{convos_with?.convo.txt → convos_with_question.convo.txt} +0 -0
- package/test/compiler/convos/txt/{convos_with?!.convo.txt → convos_with_question_exclamation.convo.txt} +0 -0
- package/test/compiler/convos/txt/{convos_with?_secline.convo.txt → convos_with_question_secline.convo.txt} +0 -0
- package/test/compiler/convos/txt/{convos_with!!.convo.txt → convos_with_two_exclamation.convo.txt} +0 -0
- package/test/compiler/convos/txt/{convos_with??.convo.txt → convos_with_two_question.convo.txt} +0 -0
- package/test/compiler/convos/txt/{convos_with??!.convo.txt → convos_with_two_question_exclamation.convo.txt} +0 -0
- package/test/compiler/convos/xlsx/{convos_with!.xlsx → convos_with_exclamation.xlsx} +0 -0
- package/test/compiler/convos/xlsx/{convos_with!_secline.xlsx → convos_with_exclamation_secline.xlsx} +0 -0
- package/test/compiler/convos/xlsx/{convos_with!!!!.xlsx → convos_with_four_exclamation.xlsx} +0 -0
- package/test/compiler/convos/xlsx/{convos_with????.xlsx → convos_with_four_question.xlsx} +0 -0
- package/test/compiler/convos/xlsx/{convos_with?.xlsx → convos_with_question.xlsx} +0 -0
- package/test/compiler/convos/xlsx/{convos_with?!.xlsx → convos_with_question_exclamation.xlsx} +0 -0
- package/test/compiler/convos/xlsx/{convos_with?_secline.xlsx → convos_with_question_secline.xlsx} +0 -0
- package/test/compiler/convos/xlsx/{convos_with!!.xlsx → convos_with_two_exclamation.xlsx} +0 -0
- package/test/compiler/convos/xlsx/{convos_with??.xlsx → convos_with_two_question.xlsx} +0 -0
- package/test/compiler/convos/xlsx/{convos_with??!.xlsx → convos_with_two_question_exclamation.xlsx} +0 -0
- package/test/connectors/simplerest.spec.js +53 -4
- package/test/driver/capabilities.spec.js +7 -7
- package/test/helpers/convos/hello.convo.txt +6 -0
- package/test/helpers/transcriptutils.spec.js +71 -0
package/dist/botium-es.js
CHANGED
|
@@ -37,7 +37,7 @@ import express from 'express';
|
|
|
37
37
|
import bodyParser from 'body-parser';
|
|
38
38
|
|
|
39
39
|
var name = "botium-core";
|
|
40
|
-
var version$1 = "1.13.
|
|
40
|
+
var version$1 = "1.13.14";
|
|
41
41
|
var description = "The Selenium for Chatbots";
|
|
42
42
|
var main = "index.js";
|
|
43
43
|
var module = "dist/botium-es.js";
|
|
@@ -247,10 +247,14 @@ var Capabilities = {
|
|
|
247
247
|
SIMPLEREST_RESPONSE_HOOK: 'SIMPLEREST_RESPONSE_HOOK',
|
|
248
248
|
SIMPLEREST_MEDIA_JSONPATH: 'SIMPLEREST_MEDIA_JSONPATH',
|
|
249
249
|
SIMPLEREST_BUTTONS_JSONPATH: 'SIMPLEREST_BUTTONS_JSONPATH',
|
|
250
|
+
SIMPLEREST_BUTTONS_TEXT_SUBJSONPATH: 'SIMPLEREST_BUTTONS_TEXT_SUBJSONPATH',
|
|
251
|
+
SIMPLEREST_BUTTONS_PAYLOAD_SUBJSONPATH: 'SIMPLEREST_BUTTONS_PAYLOAD_SUBJSONPATH',
|
|
250
252
|
SIMPLEREST_CARDS_JSONPATH: 'SIMPLEREST_CARDS_JSONPATH',
|
|
251
253
|
SIMPLEREST_CARD_TEXT_JSONPATH: 'SIMPLEREST_CARD_TEXT_JSONPATH',
|
|
252
254
|
SIMPLEREST_CARD_SUBTEXT_JSONPATH: 'SIMPLEREST_CARD_SUBTEXT_JSONPATH',
|
|
253
255
|
SIMPLEREST_CARD_BUTTONS_JSONPATH: 'SIMPLEREST_CARD_BUTTONS_JSONPATH',
|
|
256
|
+
SIMPLEREST_CARD_BUTTONS_TEXT_SUBJSONPATH: 'SIMPLEREST_CARD_BUTTONS_TEXT_SUBJSONPATH',
|
|
257
|
+
SIMPLEREST_CARD_BUTTONS_PAYLOAD_SUBJSONPATH: 'SIMPLEREST_CARD_BUTTONS_PAYLOAD_SUBJSONPATH',
|
|
254
258
|
SIMPLEREST_CARD_ATTACHMENTS_JSONPATH: 'SIMPLEREST_CARD_ATTACHMENTS_JSONPATH',
|
|
255
259
|
SIMPLEREST_CONTEXT_JSONPATH: 'SIMPLEREST_CONTEXT_JSONPATH',
|
|
256
260
|
SIMPLEREST_CONTEXT_MERGE_OR_REPLACE: 'SIMPLEREST_CONTEXT_MERGE_OR_REPLACE',
|
|
@@ -409,10 +413,14 @@ Capabilities.SIMPLEREST_RESPONSE_JSONPATH;
|
|
|
409
413
|
Capabilities.SIMPLEREST_RESPONSE_HOOK;
|
|
410
414
|
Capabilities.SIMPLEREST_MEDIA_JSONPATH;
|
|
411
415
|
Capabilities.SIMPLEREST_BUTTONS_JSONPATH;
|
|
416
|
+
Capabilities.SIMPLEREST_BUTTONS_TEXT_SUBJSONPATH;
|
|
417
|
+
Capabilities.SIMPLEREST_BUTTONS_PAYLOAD_SUBJSONPATH;
|
|
412
418
|
Capabilities.SIMPLEREST_CARDS_JSONPATH;
|
|
413
419
|
Capabilities.SIMPLEREST_CARD_TEXT_JSONPATH;
|
|
414
420
|
Capabilities.SIMPLEREST_CARD_SUBTEXT_JSONPATH;
|
|
415
421
|
Capabilities.SIMPLEREST_CARD_BUTTONS_JSONPATH;
|
|
422
|
+
Capabilities.SIMPLEREST_CARD_BUTTONS_TEXT_SUBJSONPATH;
|
|
423
|
+
Capabilities.SIMPLEREST_CARD_BUTTONS_PAYLOAD_SUBJSONPATH;
|
|
416
424
|
Capabilities.SIMPLEREST_CARD_ATTACHMENTS_JSONPATH;
|
|
417
425
|
Capabilities.SIMPLEREST_CONTEXT_JSONPATH;
|
|
418
426
|
Capabilities.SIMPLEREST_CONTEXT_MERGE_OR_REPLACE;
|
|
@@ -508,7 +516,6 @@ var Defaults$1 = {
|
|
|
508
516
|
[Capabilities.TEMPDIR]: 'botiumwork',
|
|
509
517
|
[Capabilities.CLEANUPTEMPDIR]: true,
|
|
510
518
|
[Capabilities.WAITFORBOTTIMEOUT]: 10000,
|
|
511
|
-
[Capabilities.SIMULATE_WRITING_SPEED]: false,
|
|
512
519
|
[Capabilities.SIMPLEREST_PING_RETRIES]: 6,
|
|
513
520
|
[Capabilities.SIMPLEREST_PING_TIMEOUT]: 10000,
|
|
514
521
|
[Capabilities.SIMPLEREST_PING_VERB]: 'GET',
|
|
@@ -7787,6 +7794,7 @@ var SimpleRestContainer_1 = class SimpleRestContainer {
|
|
|
7787
7794
|
await this._unsubscribeInbound();
|
|
7788
7795
|
await this._stopPolling();
|
|
7789
7796
|
this.view = {};
|
|
7797
|
+
this.cookies = {};
|
|
7790
7798
|
}
|
|
7791
7799
|
Clean() {
|
|
7792
7800
|
return this._cleanInbound();
|
|
@@ -7853,17 +7861,22 @@ var SimpleRestContainer_1 = class SimpleRestContainer {
|
|
|
7853
7861
|
}
|
|
7854
7862
|
const result = [];
|
|
7855
7863
|
if (isFromUser) {
|
|
7856
|
-
const
|
|
7857
|
-
|
|
7858
|
-
|
|
7859
|
-
|
|
7860
|
-
const rb = jsonpath.query(body, jsonPathBody);
|
|
7864
|
+
const _extractFrom = (root, jsonPaths) => {
|
|
7865
|
+
const flattened = [];
|
|
7866
|
+
for (const jsonPath of jsonPaths) {
|
|
7867
|
+
const rb = jsonpath.query(root, jsonPath);
|
|
7861
7868
|
if (lodash.isArray(rb)) {
|
|
7862
|
-
rb.forEach(r =>
|
|
7869
|
+
lodash.flattenDeep(rb).forEach(r => flattened.push(r));
|
|
7863
7870
|
} else if (rb) {
|
|
7864
|
-
|
|
7871
|
+
flattened.push(rb);
|
|
7865
7872
|
}
|
|
7866
7873
|
}
|
|
7874
|
+
return flattened;
|
|
7875
|
+
};
|
|
7876
|
+
const jsonPathRoots = [];
|
|
7877
|
+
const jsonPathsBody = getAllCapValues(Capabilities.SIMPLEREST_BODY_JSONPATH, this.caps);
|
|
7878
|
+
if (jsonPathsBody.length > 0) {
|
|
7879
|
+
jsonPathRoots.push(..._extractFrom(body, jsonPathsBody));
|
|
7867
7880
|
} else {
|
|
7868
7881
|
jsonPathRoots.push(body);
|
|
7869
7882
|
}
|
|
@@ -7881,16 +7894,33 @@ var SimpleRestContainer_1 = class SimpleRestContainer {
|
|
|
7881
7894
|
});
|
|
7882
7895
|
return retrievedMedia;
|
|
7883
7896
|
};
|
|
7884
|
-
const _retrieveButtons = (jsonPathButtonRoot,
|
|
7897
|
+
const _retrieveButtons = (jsonPathButtonRoot, capPrefix) => {
|
|
7898
|
+
const jsonPathsButtons = getAllCapValues(`${capPrefix}_JSONPATH`, this.caps);
|
|
7899
|
+
const jsonPathsButtonsText = getAllCapValues(`${capPrefix}_TEXT_SUBJSONPATH`, this.caps);
|
|
7900
|
+
const jsonPathsButtonsPayload = getAllCapValues(`${capPrefix}_PAYLOAD_SUBJSONPATH`, this.caps);
|
|
7885
7901
|
const retrievedButtons = [];
|
|
7886
|
-
|
|
7887
|
-
|
|
7888
|
-
|
|
7889
|
-
|
|
7890
|
-
|
|
7891
|
-
|
|
7902
|
+
const responseButtons = _extractFrom(jsonPathButtonRoot, jsonPathsButtons);
|
|
7903
|
+
for (const responseButton of responseButtons) {
|
|
7904
|
+
const retrievedButton = {};
|
|
7905
|
+
if (lodash.isString(responseButton)) {
|
|
7906
|
+
retrievedButton.text = responseButton;
|
|
7907
|
+
} else {
|
|
7908
|
+
if (jsonPathsButtonsText.length > 0) {
|
|
7909
|
+
const possibleTexts = _extractFrom(responseButton, jsonPathsButtonsText);
|
|
7910
|
+
if (possibleTexts.length > 0) retrievedButton.text = possibleTexts[0];
|
|
7911
|
+
}
|
|
7912
|
+
if (jsonPathsButtonsPayload.length > 0) {
|
|
7913
|
+
const possiblePayloads = _extractFrom(responseButton, jsonPathsButtonsPayload);
|
|
7914
|
+
if (possiblePayloads.length > 0) retrievedButton.payload = possiblePayloads[0];
|
|
7915
|
+
}
|
|
7892
7916
|
}
|
|
7893
|
-
|
|
7917
|
+
if (Object.keys(retrievedButton).length === 0 && responseButton) {
|
|
7918
|
+
retrievedButton.text = JSON.stringify(responseButton);
|
|
7919
|
+
}
|
|
7920
|
+
if (Object.keys(retrievedButton).length > 0) {
|
|
7921
|
+
retrievedButtons.push(retrievedButton);
|
|
7922
|
+
}
|
|
7923
|
+
}
|
|
7894
7924
|
return retrievedButtons;
|
|
7895
7925
|
};
|
|
7896
7926
|
const _getCardText = responseCardText => {
|
|
@@ -7906,7 +7936,7 @@ var SimpleRestContainer_1 = class SimpleRestContainer {
|
|
|
7906
7936
|
};
|
|
7907
7937
|
const media = _retrieveMedia(jsonPathRoot, getAllCapValues(Capabilities.SIMPLEREST_MEDIA_JSONPATH, this.caps));
|
|
7908
7938
|
debug$4(`found response media: ${util.inspect(media)}`);
|
|
7909
|
-
const buttons = _retrieveButtons(jsonPathRoot,
|
|
7939
|
+
const buttons = _retrieveButtons(jsonPathRoot, 'SIMPLEREST_BUTTONS');
|
|
7910
7940
|
debug$4(`found response buttons: ${util.inspect(buttons)}`);
|
|
7911
7941
|
const cards = [];
|
|
7912
7942
|
const jsonPathsCards = getAllCapValues(Capabilities.SIMPLEREST_CARDS_JSONPATH, this.caps);
|
|
@@ -7923,7 +7953,7 @@ var SimpleRestContainer_1 = class SimpleRestContainer {
|
|
|
7923
7953
|
jsonPathsCardSubText.forEach(jsonPath => {
|
|
7924
7954
|
card.subtext = _getCardText(jsonpath.query(c, jsonPath));
|
|
7925
7955
|
});
|
|
7926
|
-
card.buttons = _retrieveButtons(c,
|
|
7956
|
+
card.buttons = _retrieveButtons(c, 'SIMPLEREST_CARD_BUTTONS');
|
|
7927
7957
|
card.media = _retrieveMedia(c, getAllCapValues(Capabilities.SIMPLEREST_CARD_ATTACHMENTS_JSONPATH, this.caps));
|
|
7928
7958
|
if (lodash.keys(card).length > 0) {
|
|
7929
7959
|
cards.push(card);
|
|
@@ -8133,13 +8163,17 @@ var SimpleRestContainer_1 = class SimpleRestContainer {
|
|
|
8133
8163
|
}));
|
|
8134
8164
|
if (err) {
|
|
8135
8165
|
debug$4(`_waitForUrlResponse error on url check ${pingConfig.uri}: ${err}`);
|
|
8136
|
-
|
|
8166
|
+
if (tries <= retries) {
|
|
8167
|
+
await timeout(pingConfig.timeout);
|
|
8168
|
+
}
|
|
8137
8169
|
} else if (response.statusCode >= 400) {
|
|
8138
8170
|
debug$4(`_waitForUrlResponse on url check ${pingConfig.uri} got error response: ${response.statusCode}/${response.statusMessage}`);
|
|
8139
8171
|
if (debug$4.enabled && body) {
|
|
8140
8172
|
debug$4(Utils.shortenJsonString(body));
|
|
8141
8173
|
}
|
|
8142
|
-
|
|
8174
|
+
if (tries <= retries) {
|
|
8175
|
+
await timeout(pingConfig.timeout);
|
|
8176
|
+
}
|
|
8143
8177
|
} else {
|
|
8144
8178
|
debug$4(`_waitForUrlResponse success on url check ${pingConfig.uri}: ${response.statusCode}/${response.statusMessage}`);
|
|
8145
8179
|
this._storeCookiesFromResponse(response);
|
|
@@ -9188,43 +9222,59 @@ Plugins.PLUGIN_TYPE_LOGICHOOK;
|
|
|
9188
9222
|
Plugins.PLUGIN_TYPE_USERINPUT;
|
|
9189
9223
|
Plugins.TYPE_TO_PREFIX;
|
|
9190
9224
|
|
|
9225
|
+
var hasWaitForBotTimeout = transciptError => {
|
|
9226
|
+
if (!transciptError) {
|
|
9227
|
+
return false;
|
|
9228
|
+
}
|
|
9229
|
+
const str = transciptError.message || (lodash.isString(transciptError) ? transciptError : null);
|
|
9230
|
+
if (!str) {
|
|
9231
|
+
return false;
|
|
9232
|
+
}
|
|
9233
|
+
return str.indexOf(': error waiting for bot - Bot did not respond within') > 0;
|
|
9234
|
+
};
|
|
9235
|
+
var TranscriptUtils = {
|
|
9236
|
+
hasWaitForBotTimeout: hasWaitForBotTimeout
|
|
9237
|
+
};
|
|
9238
|
+
|
|
9191
9239
|
var botiumCore = {
|
|
9192
9240
|
BotDriver: BotDriver_1,
|
|
9193
|
-
ScriptingProvider: ScriptingProvider_1,
|
|
9194
|
-
ScriptingConstants: Constants,
|
|
9195
9241
|
Capabilities: Capabilities,
|
|
9196
9242
|
Defaults: Defaults$1,
|
|
9197
9243
|
Enums: Enums,
|
|
9198
|
-
Source: Source,
|
|
9199
9244
|
Events: Events,
|
|
9200
9245
|
Plugins: Plugins,
|
|
9246
|
+
Source: Source,
|
|
9247
|
+
InboundProxy: proxy,
|
|
9248
|
+
HookUtils: HookUtils,
|
|
9249
|
+
TranscriptUtils: TranscriptUtils,
|
|
9250
|
+
BotiumMockRichMessageTypes: BotiumMockRichMessageTypes,
|
|
9201
9251
|
BotiumError: BotiumError_1.BotiumError,
|
|
9252
|
+
ScriptingConstants: Constants,
|
|
9202
9253
|
ScriptingMemory: ScriptingMemory,
|
|
9203
|
-
|
|
9254
|
+
ScriptingProvider: ScriptingProvider_1,
|
|
9204
9255
|
LogicHookConstants: LogicHookConsts,
|
|
9205
9256
|
Lib: {
|
|
9206
|
-
|
|
9207
|
-
|
|
9208
|
-
}
|
|
9209
|
-
InboundProxy: proxy,
|
|
9210
|
-
BotiumMockRichMessageTypes: BotiumMockRichMessageTypes
|
|
9257
|
+
SimpleRestContainer: SimpleRestContainer_1,
|
|
9258
|
+
tryLoadPlugin: plugins.tryLoadPlugin
|
|
9259
|
+
}
|
|
9211
9260
|
};
|
|
9212
9261
|
var botiumCore_1 = botiumCore.BotDriver;
|
|
9213
|
-
var botiumCore_2 = botiumCore.
|
|
9214
|
-
var botiumCore_3 = botiumCore.
|
|
9215
|
-
var botiumCore_4 = botiumCore.
|
|
9216
|
-
var botiumCore_5 = botiumCore.
|
|
9217
|
-
var botiumCore_6 = botiumCore.
|
|
9262
|
+
var botiumCore_2 = botiumCore.Capabilities;
|
|
9263
|
+
var botiumCore_3 = botiumCore.Defaults;
|
|
9264
|
+
var botiumCore_4 = botiumCore.Enums;
|
|
9265
|
+
var botiumCore_5 = botiumCore.Events;
|
|
9266
|
+
var botiumCore_6 = botiumCore.Plugins;
|
|
9218
9267
|
var botiumCore_7 = botiumCore.Source;
|
|
9219
|
-
var botiumCore_8 = botiumCore.
|
|
9220
|
-
var botiumCore_9 = botiumCore.
|
|
9221
|
-
var botiumCore_10 = botiumCore.
|
|
9222
|
-
var botiumCore_11 = botiumCore.
|
|
9223
|
-
var botiumCore_12 = botiumCore.
|
|
9224
|
-
var botiumCore_13 = botiumCore.
|
|
9225
|
-
var botiumCore_14 = botiumCore.
|
|
9226
|
-
var botiumCore_15 = botiumCore.
|
|
9227
|
-
var botiumCore_16 = botiumCore.
|
|
9268
|
+
var botiumCore_8 = botiumCore.InboundProxy;
|
|
9269
|
+
var botiumCore_9 = botiumCore.HookUtils;
|
|
9270
|
+
var botiumCore_10 = botiumCore.TranscriptUtils;
|
|
9271
|
+
var botiumCore_11 = botiumCore.BotiumMockRichMessageTypes;
|
|
9272
|
+
var botiumCore_12 = botiumCore.BotiumError;
|
|
9273
|
+
var botiumCore_13 = botiumCore.ScriptingConstants;
|
|
9274
|
+
var botiumCore_14 = botiumCore.ScriptingMemory;
|
|
9275
|
+
var botiumCore_15 = botiumCore.ScriptingProvider;
|
|
9276
|
+
var botiumCore_16 = botiumCore.LogicHookConstants;
|
|
9277
|
+
var botiumCore_17 = botiumCore.Lib;
|
|
9228
9278
|
|
|
9229
|
-
export { botiumCore_1 as BotDriver,
|
|
9279
|
+
export { botiumCore_1 as BotDriver, botiumCore_12 as BotiumError, botiumCore_11 as BotiumMockRichMessageTypes, botiumCore_2 as Capabilities, botiumCore_3 as Defaults, botiumCore_4 as Enums, botiumCore_5 as Events, botiumCore_9 as HookUtils, botiumCore_8 as InboundProxy, botiumCore_17 as Lib, botiumCore_16 as LogicHookConstants, botiumCore_6 as Plugins, botiumCore_13 as ScriptingConstants, botiumCore_14 as ScriptingMemory, botiumCore_15 as ScriptingProvider, botiumCore_7 as Source, botiumCore_10 as TranscriptUtils, botiumCore as default };
|
|
9230
9280
|
//# sourceMappingURL=botium-es.js.map
|