@redseat/api 0.4.4 → 0.4.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.
Files changed (2) hide show
  1. package/dist/library.js +9 -2
  2. package/package.json +1 -1
package/dist/library.js CHANGED
@@ -102,6 +102,13 @@ export class LibraryApi {
102
102
  ...params,
103
103
  token: this.client.getAuthToken()
104
104
  });
105
+ let finished = false;
106
+ const finish = () => {
107
+ if (!finished) {
108
+ finished = true;
109
+ callbacks.onFinished?.();
110
+ }
111
+ };
105
112
  return openFetchSSEStream(url, (eventType, data) => {
106
113
  if (eventType === 'results') {
107
114
  try {
@@ -113,9 +120,9 @@ export class LibraryApi {
113
120
  }
114
121
  }
115
122
  else if (eventType === 'finished') {
116
- callbacks.onFinished?.();
123
+ finish();
117
124
  }
118
- }, undefined, (error) => callbacks.onError?.(error));
125
+ }, finish, (error) => callbacks.onError?.(error));
119
126
  }
120
127
  async getTags(query) {
121
128
  const params = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redseat/api",
3
- "version": "0.4.4",
3
+ "version": "0.4.5",
4
4
  "description": "TypeScript API client library for interacting with Redseat servers",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",