bkper-js 1.34.0 → 1.34.1

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 CHANGED
@@ -2087,9 +2087,9 @@ export declare class Message {
2087
2087
  */
2088
2088
  deleteProperty(key: string): Message;
2089
2089
  /**
2090
- * Performs create Message
2090
+ * Creates the Message and receives the synchronous Agent response.
2091
2091
  *
2092
- * @returns The created Message object
2092
+ * @returns The Agent response Message, with the created Message as its parent
2093
2093
  */
2094
2094
  create(): Promise<Message>;
2095
2095
  }
@@ -140,9 +140,9 @@ export class Message {
140
140
  return this;
141
141
  }
142
142
  /**
143
- * Performs create Message
143
+ * Creates the Message and receives the synchronous Agent response.
144
144
  *
145
- * @returns The created Message object
145
+ * @returns The Agent response Message, with the created Message as its parent
146
146
  */
147
147
  create() {
148
148
  return __awaiter(this, void 0, void 0, function* () {
@@ -150,12 +150,13 @@ export class Message {
150
150
  if (!conversationId) {
151
151
  throw new Error('Conversation id null!');
152
152
  }
153
- this.payload = yield ConversationService.createMessage(conversationId, this.payload);
154
- this.conversation.updateMessagesCache(this);
155
- if (this.payload.parent) {
156
- this.parent = new Message(this.conversation, this.payload.parent);
157
- this.conversation.updateMessagesCache(this.parent);
153
+ const responsePayload = yield ConversationService.createMessage(conversationId, this.payload);
154
+ if (responsePayload.parent) {
155
+ this.payload = responsePayload.parent;
158
156
  }
157
+ const responseMessage = new Message(this.conversation, responsePayload);
158
+ this.conversation.updateMessagesCache(this);
159
+ this.conversation.updateMessagesCache(responseMessage);
159
160
  return this;
160
161
  });
161
162
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bkper-js",
3
- "version": "1.34.0",
3
+ "version": "1.34.1",
4
4
  "description": "Javascript client for Bkper REST API",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",