bkper-js 1.35.3 → 1.35.5
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/index.d.ts +4 -0
- package/lib/model/Group.js +1 -1
- package/lib/model/Message.js +12 -0
- package/lib/service/conversation-service.js +5 -0
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -2139,6 +2139,10 @@ export declare class Message {
|
|
|
2139
2139
|
* @returns The Agent response Message, with the created Message as its parent
|
|
2140
2140
|
*/
|
|
2141
2141
|
create(): Promise<Message>;
|
|
2142
|
+
/**
|
|
2143
|
+
* Streams the Message to the Bkper API.
|
|
2144
|
+
*/
|
|
2145
|
+
stream(): Promise<void>;
|
|
2142
2146
|
}
|
|
2143
2147
|
|
|
2144
2148
|
/**
|
package/lib/model/Group.js
CHANGED
|
@@ -403,7 +403,7 @@ export class Group {
|
|
|
403
403
|
update() {
|
|
404
404
|
return __awaiter(this, void 0, void 0, function* () {
|
|
405
405
|
var _a;
|
|
406
|
-
const previousParentId = (_a = this.
|
|
406
|
+
const previousParentId = (_a = this.parent) === null || _a === void 0 ? void 0 : _a.getId();
|
|
407
407
|
this.payload = yield GroupService.updateGroup(this.book.getId(), this.payload);
|
|
408
408
|
this.book.updateGroupCache(this, previousParentId);
|
|
409
409
|
return this;
|
package/lib/model/Message.js
CHANGED
|
@@ -171,5 +171,17 @@ export class Message {
|
|
|
171
171
|
return this;
|
|
172
172
|
});
|
|
173
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* Streams the Message to the Bkper API.
|
|
176
|
+
*/
|
|
177
|
+
stream() {
|
|
178
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
179
|
+
const conversationId = this.conversation.getId();
|
|
180
|
+
if (!conversationId) {
|
|
181
|
+
throw new Error('Conversation id null!');
|
|
182
|
+
}
|
|
183
|
+
ConversationService.streamMessage(conversationId, this.payload);
|
|
184
|
+
});
|
|
185
|
+
}
|
|
174
186
|
}
|
|
175
187
|
//# sourceMappingURL=Message.js.map
|
|
@@ -34,4 +34,9 @@ export function createMessage(conversationId, message) {
|
|
|
34
34
|
return response.data;
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
+
export function streamMessage(conversationId, message) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
new HttpApiRequest(`v5/apps/conversations/${conversationId}/stream`).setMethod('POST').setPayload(message).fetch();
|
|
40
|
+
});
|
|
41
|
+
}
|
|
37
42
|
//# sourceMappingURL=conversation-service.js.map
|