abra-flexi 0.5.3 → 0.5.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.
package/dist/index.cjs CHANGED
@@ -66911,6 +66911,33 @@ var AFApiClient = class {
66911
66911
  throw e;
66912
66912
  }
66913
66913
  }
66914
+ async deleteUserRelation(entity, options) {
66915
+ if (!this.company || !this.company.length) throw new AFError(AFErrorCode.MISSING_ABRA_COMPANY, `Can't query AFApiClient without providing company path component first.`);
66916
+ const id = entity?.id;
66917
+ if (!id && typeof id !== "number") throw new AFError(AFErrorCode.MISSING_ID, `Can't delete entity without knowing it's id.`);
66918
+ const entityPath = entity.constructor.EntityPath;
66919
+ let url = this._url + "/c/" + this.company + "/" + entityPath + ".json";
66920
+ try {
66921
+ const raw$1 = await this._fetch(url, {
66922
+ signal: options.abortController?.signal,
66923
+ method: "PUT",
66924
+ body: JSON.stringify({ winstrom: [{
66925
+ [entityPath]: { id },
66926
+ [entityPath + "@action"]: "delete"
66927
+ }] })
66928
+ });
66929
+ if (raw$1.status >= 400 && raw$1.status < 600) throw new AFError(AFErrorCode.ABRA_FLEXI_ERROR, `${raw$1.status} ${raw$1.statusText}`);
66930
+ const json = await raw$1.json();
66931
+ console.log(json);
66932
+ if (json.winstrom["success"] === "true") {}
66933
+ } catch (e) {
66934
+ if (!(e instanceof AFError)) {
66935
+ console.log(e);
66936
+ e = new AFError(AFErrorCode.UNKNOWN, e.toString());
66937
+ }
66938
+ throw e;
66939
+ }
66940
+ }
66914
66941
  _decodeEntityObj(entity, obj) {
66915
66942
  if (!obj) return [];
66916
66943
  if (typeof obj === "string") {