@butlerbot/sdk 0.0.15 → 0.0.17

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.
@@ -126,7 +126,10 @@ export declare class Conversation {
126
126
  * Fetches the conversation progress from the server
127
127
  * Returns undefined if no active turn progress
128
128
  */
129
- fetchProgress(): Promise<TurnProgressEntry[] | undefined>;
129
+ fetchProgress(options?: {
130
+ lastEventId?: string;
131
+ includeCompleted?: boolean;
132
+ }): Promise<TurnProgressEntry[] | undefined>;
130
133
  /** Sends a message into the conversation */
131
134
  send(message: string, cb: (chunk: RequestResponse) => any, options?: DialogueRequestOptions): EventSource;
132
135
  }
@@ -232,12 +232,17 @@ class Conversation {
232
232
  * Fetches the conversation progress from the server
233
233
  * Returns undefined if no active turn progress
234
234
  */
235
- fetchProgress() {
235
+ fetchProgress(options) {
236
236
  return __awaiter(this, void 0, void 0, function* () {
237
237
  if (!this.convoId)
238
238
  throw new Error("Conversation ID is not set");
239
- const url = (0, url_formatter_1.formatURL)(this.endpoints.progress, { chatId: this.convoId }, { apiKey: this.apiKey, debug: this.debug });
240
- const response = yield fetch(url);
239
+ const payload = {
240
+ chatId: this.convoId,
241
+ };
242
+ if ((options === null || options === void 0 ? void 0 : options.includeCompleted) !== undefined)
243
+ payload["includeCompleted"] = options.includeCompleted;
244
+ const url = (0, url_formatter_1.formatURL)(this.endpoints.progress, payload, { apiKey: this.apiKey, debug: this.debug });
245
+ const response = yield fetch(url, { headers: (options === null || options === void 0 ? void 0 : options.lastEventId) ? { "last-event-id": options.lastEventId } : undefined });
241
246
  if (!response.ok) {
242
247
  const errorText = yield response.text();
243
248
  throw new Error(`Failed to fetch conversation progress: ${response.status} ${response.statusText} - ${errorText}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@butlerbot/sdk",
3
- "version": "0.0.15",
3
+ "version": "0.0.17",
4
4
  "description": "The official ButlerBot SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",