stentor-channel 1.60.21 → 1.60.23
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/lib/Channel.js +15 -6
- package/lib/Channel.js.map +1 -1
- package/package.json +5 -5
package/lib/Channel.js
CHANGED
|
@@ -38,7 +38,7 @@ exports.STENTOR_CHANNEL = {
|
|
|
38
38
|
test: Guards_1.isStentorRequest,
|
|
39
39
|
request: new Translators_1.TranslateStentorRequest(),
|
|
40
40
|
response: new Translators_1.TranslateStentorResponse(),
|
|
41
|
-
capabilities
|
|
41
|
+
capabilities,
|
|
42
42
|
};
|
|
43
43
|
function Stentor(nlu) {
|
|
44
44
|
const channel = Object.assign(Object.assign({}, exports.STENTOR_CHANNEL), { nlu });
|
|
@@ -46,7 +46,7 @@ function Stentor(nlu) {
|
|
|
46
46
|
// Add the preResponseTranslationHook
|
|
47
47
|
(0, stentor_logger_1.log)().debug(`Adding preResponseTranslation hook for setting context`);
|
|
48
48
|
const preResponseTranslation = (request, response, storage) => __awaiter(this, void 0, void 0, function* () {
|
|
49
|
-
var _a, _b;
|
|
49
|
+
var _a, _b, _c;
|
|
50
50
|
if ((0, stentor_guards_1.hasSessionId)(request)) {
|
|
51
51
|
const resp = response.response;
|
|
52
52
|
const sessionId = request.sessionId;
|
|
@@ -59,20 +59,29 @@ function Stentor(nlu) {
|
|
|
59
59
|
yield nlu.setContext({
|
|
60
60
|
userId: request.userId,
|
|
61
61
|
sessionId,
|
|
62
|
-
activeContext: (_b = resp.context) === null || _b === void 0 ? void 0 : _b.active
|
|
62
|
+
activeContext: (_b = resp.context) === null || _b === void 0 ? void 0 : _b.active,
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
65
|
catch (e) {
|
|
66
66
|
(0, stentor_logger_1.log)().error(`Error setting context.`);
|
|
67
|
-
(0, stentor_logger_1.log)().error(
|
|
68
|
-
|
|
67
|
+
(0, stentor_logger_1.log)().error(`UserId: ${request.userId}`);
|
|
68
|
+
(0, stentor_logger_1.log)().error(`SessionId: ${sessionId}`);
|
|
69
|
+
(0, stentor_logger_1.log)().error(`Active Context: ${JSON.stringify((_c = resp.context) === null || _c === void 0 ? void 0 : _c.active)}`);
|
|
70
|
+
if (e) {
|
|
71
|
+
if (e instanceof Error) {
|
|
72
|
+
(0, stentor_logger_1.log)().error(`Error: ${e.message}`);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
(0, stentor_logger_1.log)().error(`Error: ${JSON.stringify(e)}`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
69
78
|
}
|
|
70
79
|
}
|
|
71
80
|
}
|
|
72
81
|
return { request, response, storage };
|
|
73
82
|
});
|
|
74
83
|
channel.hooks = {
|
|
75
|
-
preResponseTranslation
|
|
84
|
+
preResponseTranslation,
|
|
76
85
|
};
|
|
77
86
|
}
|
|
78
87
|
return channel;
|
package/lib/Channel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Channel.js","sourceRoot":"","sources":["../src/Channel.ts"],"names":[],"mappings":";;;;;;;;;;;;AAkBA,
|
|
1
|
+
{"version":3,"file":"Channel.js","sourceRoot":"","sources":["../src/Channel.ts"],"names":[],"mappings":";;;;;;;;;;;;AAkBA,oCAMC;AAUD,0BAuDC;AAzFD,oCAAoC;AACpC,mDAA8C;AAC9C,mDAAqC;AAErC,iDAAkD;AAElD,2CAA+D;AAC/D,qCAA0D;AAC1D,+CAAkF;AAElF;;;;;;;GAOG;AACH,SAAgB,YAAY,CAAC,IAA6B;IACxD,IAAI,IAAA,qBAAY,EAAC,IAAI,CAAC,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,OAAO,0BAAc,CAAC;AACxB,CAAC;AAEY,QAAA,eAAe,GAAY;IACtC,IAAI,EAAE,4BAAgB;IACtB,IAAI,EAAE,yBAAgB;IACtB,OAAO,EAAE,IAAI,qCAAuB,EAAE;IACtC,QAAQ,EAAE,IA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C,OAAO,CAAC,EAAE,CAAC;wBACX,IAAA,oBAAG,GAAE,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;wBACtC,IAAA,oBAAG,GAAE,CAAC,KAAK,CAAC,WAAW,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;wBACzC,IAAA,oBAAG,GAAE,CAAC,KAAK,CAAC,cAAc,SAAS,EAAE,CAAC,CAAC;wBACvC,IAAA,oBAAG,GAAE,CAAC,KAAK,CAAC,mBAAmB,IAAI,CAAC,SAAS,CAAC,MAAA,IAAI,CAAC,OAAO,0CAAE,MAAM,CAAC,EAAE,CAAC,CAAC;wBACvE,IAAI,CAAC,EAAE,CAAC;4BACN,IAAI,CAAC,YAAY,KAAK,EAAE,CAAC;gCACvB,IAAA,oBAAG,GAAE,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;4BACrC,CAAC;iCAAM,CAAC;gCACN,IAAA,oBAAG,GAAE,CAAC,KAAK,CAAC,UAAU,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;4BAC7C,CAAC;wBACH,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;YAED,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;QACxC,CAAC,CAAA,CAAC;QAEF,OAAO,CAAC,KAAK,GAAG;YACd,sBAAsB;SACvB,CAAC;IACJ,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "1.60.
|
|
7
|
+
"version": "1.60.23",
|
|
8
8
|
"description": "The most basic of channels, one that uses stentor requests & responses as input.",
|
|
9
9
|
"types": "lib/index",
|
|
10
10
|
"main": "lib/index",
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
"mocha": "11.1.0",
|
|
24
24
|
"sinon": "20.0.0",
|
|
25
25
|
"sinon-chai": "3.7.0",
|
|
26
|
-
"stentor-models": "1.60.
|
|
26
|
+
"stentor-models": "1.60.23",
|
|
27
27
|
"ts-node": "10.9.2",
|
|
28
28
|
"typescript": "5.8.3"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@xapp/patterns": "2.0.2",
|
|
32
|
-
"stentor-logger": "1.60.
|
|
33
|
-
"stentor-utils": "1.60.
|
|
32
|
+
"stentor-logger": "1.60.23",
|
|
33
|
+
"stentor-utils": "1.60.23"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"stentor-models": "1.x"
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"clean": "rm -rf ./lib/*",
|
|
41
41
|
"test": "mocha --recursive -r ts-node/register \"./src/**/*.test.ts\""
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "39b3836c2a20ba49c46ac30cb00c770c857fea5a"
|
|
44
44
|
}
|