@synnaxlabs/client 0.17.0 → 0.17.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/client.js CHANGED
@@ -14802,9 +14802,14 @@ let hh = class {
14802
14802
  h(this, "client");
14803
14803
  this.frameClient = e, this.retriever = t, this.client = n, this.creator = s;
14804
14804
  }
14805
- async create(e) {
14806
- const t = !Array.isArray(e), n = await this.creator.create(Ne(e)), s = this.sugar(n);
14807
- return t ? s[0] : s;
14805
+ async create(e, t = {}) {
14806
+ const { retrieveIfNameExists: n = !1 } = t, s = !Array.isArray(e);
14807
+ let a = Ne(e), i = [];
14808
+ if (n) {
14809
+ const o = await this.retriever.retrieve(a.map((l) => l.name)), c = new Set(o.map((l) => l.name));
14810
+ a = a.filter((l) => !c.has(l.name)), i = this.sugar(o);
14811
+ }
14812
+ return i = i.concat(this.sugar(await this.creator.create(a))), s ? i[0] : i;
14808
14813
  }
14809
14814
  /**
14810
14815
  * Retrieves a channel from the database using the given parameters.