@onereach/step-voice 6.0.19 → 6.0.20-refdata.0
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/dst/voice.d.ts +0 -3
- package/dst/voice.js +2 -57
- package/package.json +3 -2
package/dst/voice.d.ts
CHANGED
|
@@ -56,8 +56,6 @@ export default class VoiceStep<TIn = unknown, TOut = unknown, TParams extends Vo
|
|
|
56
56
|
exitStepByThread(exitId: string, result: any): any;
|
|
57
57
|
exitToThread(): void;
|
|
58
58
|
sendCommands({ id, type, callback }: IVoiceCall, commands: TODO[]): Promise<void>;
|
|
59
|
-
handleDataThreadStart(): void;
|
|
60
|
-
handleDataThreadEnd(): void;
|
|
61
59
|
handleHeartbeat(call: IVoiceCall): Promise<void>;
|
|
62
60
|
handleCancel(): void;
|
|
63
61
|
extractSectionMessages(sections: IPromtpSection[]): string;
|
|
@@ -81,7 +79,6 @@ export default class VoiceStep<TIn = unknown, TOut = unknown, TParams extends Vo
|
|
|
81
79
|
rptsHasMore({ repromptsList }: TODO): boolean;
|
|
82
80
|
get rptsIndex(): number;
|
|
83
81
|
get rptsStarted(): boolean;
|
|
84
|
-
sleepUntilHangup(): Promise<void>;
|
|
85
82
|
canVoicerHearbeat(call: IVoiceCall): boolean;
|
|
86
83
|
canVoicerAck(call: IVoiceCall): boolean;
|
|
87
84
|
}
|
package/dst/voice.js
CHANGED
|
@@ -5,7 +5,6 @@ exports.VoiceStepError = void 0;
|
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
6
|
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
7
7
|
const nanoid_1 = require("nanoid");
|
|
8
|
-
const types_1 = require("@onereach/flow-sdk/dst/types");
|
|
9
8
|
const uuid_1 = require("uuid");
|
|
10
9
|
// TODO: !!!!! import ConvStep from '@onereach/step-conversation/dst/step' !!!!!
|
|
11
10
|
const step_1 = tslib_1.__importDefault(require("./step"));
|
|
@@ -18,7 +17,8 @@ class VoiceStep extends step_1.default {
|
|
|
18
17
|
async runBefore() {
|
|
19
18
|
await super.runBefore();
|
|
20
19
|
if (this.cache != null) {
|
|
21
|
-
this.
|
|
20
|
+
if (this.thread.id !== this.dataThreadId)
|
|
21
|
+
this.thread.refThread(this.dataThreadId);
|
|
22
22
|
if (!this.state.direct)
|
|
23
23
|
await this.handleHeartbeat(this.cache);
|
|
24
24
|
}
|
|
@@ -26,9 +26,6 @@ class VoiceStep extends step_1.default {
|
|
|
26
26
|
exitStep(exitId, data, byThread = false) {
|
|
27
27
|
if (byThread)
|
|
28
28
|
return this.exitStepByThread(exitId, data);
|
|
29
|
-
if (this.cache != null) {
|
|
30
|
-
this.handleDataThreadEnd();
|
|
31
|
-
}
|
|
32
29
|
return super.exitStep(exitId, data);
|
|
33
30
|
}
|
|
34
31
|
exitStepByThread(exitId, result) {
|
|
@@ -75,50 +72,6 @@ class VoiceStep extends step_1.default {
|
|
|
75
72
|
if (result == null)
|
|
76
73
|
throw new Error(`failed to send command to call: ${id}`);
|
|
77
74
|
}
|
|
78
|
-
handleDataThreadStart() {
|
|
79
|
-
if (this.dataThreadId === types_1.MAIN_THREAD_ID || this.thread.id === this.dataThreadId)
|
|
80
|
-
return;
|
|
81
|
-
const dataThread = this.process.getThread(this.dataThreadId);
|
|
82
|
-
if (dataThread == null)
|
|
83
|
-
return;
|
|
84
|
-
if (dataThread.state.name === this.sleepUntilHangup.name) {
|
|
85
|
-
this.log.debug('attach to sleep data thread', { thread: this.thread.id });
|
|
86
|
-
dataThread.waits[`thread/end/${this.thread.id}`] = {};
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
this.triggers.hook({ name: "ending" /* ACTION.ending */, thread: this.dataThreadId, sync: true, times: 1 }, async () => {
|
|
90
|
-
// TODO: this is not required in newer versions, delete in v6.1+
|
|
91
|
-
delete this.waits['@ending'];
|
|
92
|
-
delete this.waits.ending;
|
|
93
|
-
if (dataThread.state.name === this.sleepUntilHangup.name) {
|
|
94
|
-
this.log.debug('hook attach to sleep data thread', { thread: this.thread.id });
|
|
95
|
-
dataThread.waits[`thread/end/${this.thread.id}`] = {};
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
this.log.debug('hook create sleep data thread', { thread: this.thread.id });
|
|
99
|
-
dataThread.gotoState({
|
|
100
|
-
direct: true,
|
|
101
|
-
step: this.currentStepId,
|
|
102
|
-
name: this.sleepUntilHangup.name,
|
|
103
|
-
waits: {
|
|
104
|
-
[`thread/end/${this.thread.id}`]: {}
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
handleDataThreadEnd() {
|
|
110
|
-
if (this.dataThreadId === types_1.MAIN_THREAD_ID || this.thread.id === this.dataThreadId)
|
|
111
|
-
return;
|
|
112
|
-
const dataThread = this.process.getThread(this.dataThreadId);
|
|
113
|
-
if (dataThread == null)
|
|
114
|
-
return;
|
|
115
|
-
if (dataThread.state.name === this.sleepUntilHangup.name) {
|
|
116
|
-
this.log.debug('remove sleep data thread', { thread: this.thread.id });
|
|
117
|
-
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
118
|
-
delete dataThread.waits[`thread/end/${this.thread.id}`];
|
|
119
|
-
this.process.enqueue({ name: 'activate', thread: this.dataThreadId });
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
75
|
async handleHeartbeat(call) {
|
|
123
76
|
const allowHeartbeat = this.canVoicerHearbeat(call);
|
|
124
77
|
if (allowHeartbeat) {
|
|
@@ -392,14 +345,6 @@ class VoiceStep extends step_1.default {
|
|
|
392
345
|
get rptsStarted() {
|
|
393
346
|
return this.rptsIndex !== 0;
|
|
394
347
|
}
|
|
395
|
-
async sleepUntilHangup() {
|
|
396
|
-
const threadEndPrefix = 'thread/end/';
|
|
397
|
-
if (this.event.name.startsWith(threadEndPrefix)) {
|
|
398
|
-
this.event.processed = true;
|
|
399
|
-
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
400
|
-
delete this.waits[this.event.name];
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
348
|
canVoicerHearbeat(call) {
|
|
404
349
|
return call.vv >= 1;
|
|
405
350
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onereach/step-voice",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.20-refdata.0",
|
|
4
4
|
"author": "Roman Zolotarov <roman.zolotarov@onereach.com>",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Roman Zolotarov",
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
"uuid": "^9.0.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@onereach/flow-sdk": "^3.2.
|
|
22
|
+
"@onereach/flow-sdk": "^3.2.46",
|
|
23
|
+
"@onereach/orbes": "^3.1.51",
|
|
23
24
|
"@onereach/step-voice": "./test",
|
|
24
25
|
"@swc/cli": "^0.1.62",
|
|
25
26
|
"@swc/core": "^1.3.57",
|