@gradio/client 2.7.0 → 2.7.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/dist/index.cjs CHANGED
@@ -2309,6 +2309,12 @@ function submit(endpoint, data = {}, event_data, trigger_id, all_events, additio
2309
2309
  });
2310
2310
  return new Promise((resolve) => resolvers.push(resolve));
2311
2311
  }
2312
+ const post_to_event = (suffix, body) => {
2313
+ job.then(() => {
2314
+ if (!event_id_final) return;
2315
+ this.post_data(`${config.root}${api_prefix}/stream/${event_id_final}${suffix}`, body);
2316
+ }, () => {});
2317
+ };
2312
2318
  const iterator = {
2313
2319
  [Symbol.asyncIterator]: () => iterator,
2314
2320
  next,
@@ -2325,14 +2331,14 @@ function submit(endpoint, data = {}, event_data, trigger_id, all_events, additio
2325
2331
  },
2326
2332
  cancel,
2327
2333
  send_chunk: (payload) => {
2328
- this.post_data(`${config.root}${api_prefix}/stream/${event_id_final}`, {
2334
+ post_to_event("", {
2329
2335
  ...payload,
2330
2336
  session_hash: this.session_hash
2331
2337
  });
2332
2338
  },
2333
2339
  close_stream: () => {
2334
- this.post_data(`${config.root}${api_prefix}/stream/${event_id_final}/close`, {});
2335
2340
  close();
2341
+ post_to_event("/close", {});
2336
2342
  },
2337
2343
  event_id: () => event_id_final,
2338
2344
  wait_for_id: async () => {
package/dist/index.js CHANGED
@@ -2308,6 +2308,12 @@ function submit(endpoint, data = {}, event_data, trigger_id, all_events, additio
2308
2308
  });
2309
2309
  return new Promise((resolve) => resolvers.push(resolve));
2310
2310
  }
2311
+ const post_to_event = (suffix, body) => {
2312
+ job.then(() => {
2313
+ if (!event_id_final) return;
2314
+ this.post_data(`${config.root}${api_prefix}/stream/${event_id_final}${suffix}`, body);
2315
+ }, () => {});
2316
+ };
2311
2317
  const iterator = {
2312
2318
  [Symbol.asyncIterator]: () => iterator,
2313
2319
  next,
@@ -2324,14 +2330,14 @@ function submit(endpoint, data = {}, event_data, trigger_id, all_events, additio
2324
2330
  },
2325
2331
  cancel,
2326
2332
  send_chunk: (payload) => {
2327
- this.post_data(`${config.root}${api_prefix}/stream/${event_id_final}`, {
2333
+ post_to_event("", {
2328
2334
  ...payload,
2329
2335
  session_hash: this.session_hash
2330
2336
  });
2331
2337
  },
2332
2338
  close_stream: () => {
2333
- this.post_data(`${config.root}${api_prefix}/stream/${event_id_final}/close`, {});
2334
2339
  close();
2340
+ post_to_event("/close", {});
2335
2341
  },
2336
2342
  event_id: () => event_id_final,
2337
2343
  wait_for_id: async () => {