@midsummer-ai/sdk 0.1.0-staging.4516 → 0.1.0-staging.4522

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/calls/index.mjs CHANGED
@@ -340,7 +340,10 @@ function sfuMedia(ctx, auto, declined, offer) {
340
340
  timed();
341
341
  }
342
342
  };
343
- if (offer) serial(() => answer(offer)).catch(ctx.failed);
343
+ const set = offer ? serial(() => answer(offer)).then(() => true, (error) => {
344
+ ctx.failed(error);
345
+ return false;
346
+ }) : Promise.resolve(true);
344
347
  /** The people whose channel isn't received yet. */
345
348
  const unheard = () => others.filter((other) => other.kind === "person" && !channels.has(other.id)).map((other) => other.id);
346
349
  /** Opens this call's channel, once, and receives the channel of each person who has one open and isn't received yet: who was asked for. */
@@ -375,16 +378,17 @@ function sfuMedia(ctx, auto, declined, offer) {
375
378
  return from;
376
379
  }
377
380
  /**
378
- * Asks for the channels, one ask at a time, behind the join's offer being answered. Someone who came while an ask
379
- * was out is asked for after it; someone whose own isn't open yet is asked for again when the room next changes,
380
- * which their opening it does; a refusal likewise.
381
+ * Asks for the channels, one ask at a time, once the join's offer is answered: a channel needs the connection that
382
+ * set up and no offer of its own, so it is asked for beside whatever is being published or received, never ahead of
383
+ * it. Someone who came while an ask was out is asked for after it; someone whose own isn't open yet is asked for
384
+ * again when the room next changes, which their opening it does; a refusal likewise.
381
385
  */
382
386
  function askData() {
383
387
  if (dataAsking) dataAgain = true;
384
388
  if (dataAsking || closed || own && !unheard().length) return;
385
389
  dataAsking = true;
386
390
  dataAgain = false;
387
- serial(openData).then((asked) => {
391
+ set.then((up) => up ? openData() : unheard()).then((asked) => {
388
392
  dataAsking = false;
389
393
  if (dataAgain || unheard().some((of) => !asked.includes(of))) askData();
390
394
  }, (error) => {
package/here-C2jhTheQ.mjs CHANGED
@@ -12,7 +12,7 @@ function processEnv() {
12
12
  * This package's version: `0.0.0-dev` here, and in a published package the version it was published at, which the
13
13
  * release writes in its place as it stages the package (`stampSdk` in `scripts/release/packages.ts`).
14
14
  */
15
- const SDK_VERSION = "0.1.0-staging.4516";
15
+ const SDK_VERSION = "0.1.0-staging.4522";
16
16
  /**
17
17
  * The header that tells Midsummer which client made each of this package's calls: `Midsummer-Client: sdk/<version>
18
18
  * <part>`, `part` the product whose client it is (`database`, `storage`, `queues`, ...), so the platform counts which
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midsummer-ai/sdk",
3
- "version": "0.1.0-staging.4516",
3
+ "version": "0.1.0-staging.4522",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "description": "Midsummer's handles for an app's code: its Database, Storage, Queues, Vector DB, AI, Email and Agents, with stand-ins for tests.",