abra-flexi 0.5.2 → 0.5.4

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
@@ -40647,7 +40647,7 @@ var AFTypUzivatelskeVazby = class extends AFEntity {
40647
40647
 
40648
40648
  //#endregion
40649
40649
  //#region src/generated/entities/AFUzivatelskaVazba.ts
40650
- var AFUzivatelskaVazba = class extends AFEntity {
40650
+ var AFUzivatelskaVazba$1 = class extends AFEntity {
40651
40651
  static {
40652
40652
  this.EntityPath = "uzivatelska-vazba";
40653
40653
  }
@@ -66332,7 +66332,7 @@ const AFEntityRegistry = {
66332
66332
  AFFormaDopravy,
66333
66333
  AFCisloBaliku,
66334
66334
  AFTypUzivatelskeVazby,
66335
- AFUzivatelskaVazba,
66335
+ AFUzivatelskaVazba: AFUzivatelskaVazba$1,
66336
66336
  AFVztah,
66337
66337
  AFIntrastatKrajUrceni,
66338
66338
  AFIntrastatZvlastniPohyb,
@@ -66911,6 +66911,32 @@ 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
+ let url = this._url + "/c/" + this.company + "/" + AFUzivatelskaVazba.EntityPath + ".json";
66919
+ try {
66920
+ const raw$1 = await this._fetch(url, {
66921
+ signal: options.abortController?.signal,
66922
+ method: "PUT",
66923
+ body: JSON.stringify({ winstrom: [{
66924
+ [AFUzivatelskaVazba.EntityPath]: { id },
66925
+ [AFUzivatelskaVazba.EntityPath + "@action"]: "delete"
66926
+ }] })
66927
+ });
66928
+ if (raw$1.status >= 400 && raw$1.status < 600) throw new AFError(AFErrorCode.ABRA_FLEXI_ERROR, `${raw$1.status} ${raw$1.statusText}`);
66929
+ const json = await raw$1.json();
66930
+ console.log(json);
66931
+ if (json.winstrom["success"] === "true") {}
66932
+ } catch (e) {
66933
+ if (!(e instanceof AFError)) {
66934
+ console.log(e);
66935
+ e = new AFError(AFErrorCode.UNKNOWN, e.toString());
66936
+ }
66937
+ throw e;
66938
+ }
66939
+ }
66914
66940
  _decodeEntityObj(entity, obj) {
66915
66941
  if (!obj) return [];
66916
66942
  if (typeof obj === "string") {
@@ -67164,9 +67190,17 @@ var AFApiSession = class {
67164
67190
  };
67165
67191
  }
67166
67192
  _establish(sessionId) {
67193
+ if (this.status === AFSessionStatus.LogingOut) throw new AFError(AFErrorCode.LOGOUT_UNDERWAY, `[AFApiSession] Can't establish while logout attempt is underway.`);
67194
+ if (this.status === AFSessionStatus.LogingIn) return this._loginPromise;
67195
+ this._sessionError = null;
67196
+ this._authSessionId = sessionId;
67167
67197
  this._loginPromise = (async () => {
67168
67198
  try {
67169
67199
  await this._keepaliveTick(true);
67200
+ this._enableKeepalive();
67201
+ } catch (e) {
67202
+ this._authSessionId = null;
67203
+ throw e;
67170
67204
  } finally {
67171
67205
  this._loginPromise = null;
67172
67206
  }
@@ -67176,7 +67210,9 @@ var AFApiSession = class {
67176
67210
  _enableKeepalive() {
67177
67211
  if (!this._keepAliveIntervalMs) return;
67178
67212
  if (this._keepAliveHandler) this._disableKeepalive();
67179
- this._keepAliveHandler = setInterval(this._notifyStatusChange.bind(this), this._keepAliveIntervalMs);
67213
+ this._keepAliveHandler = setInterval(() => {
67214
+ this._keepaliveTick(false);
67215
+ }, this._keepAliveIntervalMs);
67180
67216
  }
67181
67217
  _disableKeepalive() {
67182
67218
  clearInterval(this._keepAliveHandler);
@@ -67470,7 +67506,7 @@ exports.AFUmisteniVeSkladuRegal = AFUmisteniVeSkladuRegal;
67470
67506
  exports.AFUplatneniDaneZavazku = AFUplatneniDaneZavazku;
67471
67507
  exports.AFUplatneniDaneZavazkuPolozka = AFUplatneniDaneZavazkuPolozka;
67472
67508
  exports.AFUzivatel = AFUzivatel;
67473
- exports.AFUzivatelskaVazba = AFUzivatelskaVazba;
67509
+ exports.AFUzivatelskaVazba = AFUzivatelskaVazba$1;
67474
67510
  exports.AFUzivatelskyDotaz = AFUzivatelskyDotaz;
67475
67511
  exports.AFUzivatelskyDotazParametr = AFUzivatelskyDotazParametr;
67476
67512
  exports.AFUzivatelskyDotazVlastnost = AFUzivatelskyDotazVlastnost;