@snabcentr/common-lib 1.78.0 → 1.78.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.
@@ -4,6 +4,6 @@
4
4
  "name": "public-api",
5
5
  "src": "src/public-api.ts",
6
6
  "isEntry": true,
7
- "integrity": "sha384-qlDP5mPwPIcOkc0p/MpkXFhy1TBZgokamcT5lc9eFNPJks/2pDPE2ZDMY3xAItub"
7
+ "integrity": "sha384-u1WwX6EKoog+3gb7iywudMJsxkQUPOMqndlAXL+1PYBtvuMnzPlSNoZp4T64Rctd"
8
8
  }
9
9
  }
@@ -2,7 +2,7 @@ var Tr = Object.defineProperty;
2
2
  var ar = (n, r, e) => r in n ? Tr(n, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[r] = e;
3
3
  var t = (n, r, e) => ar(n, typeof r != "symbol" ? r + "" : r, e);
4
4
  import { jwtDecode as ir } from "jwt-decode";
5
- import { merge as ne, isNil as $, isEmpty as K, noop as w, mapValues as nr, isArray as V, every as br, split as Sr, toUpper as kr, constant as Ir, isString as v, cloneDeep as Lr, toLower as xr, isFunction as _e, map as Ce, forEach as dr, isDate as Le, omitBy as or, isObject as cr } from "lodash-es";
5
+ import { merge as ne, isNil as A, isEmpty as K, noop as w, mapValues as nr, isArray as V, every as br, split as Sr, toUpper as kr, constant as Ir, isString as v, cloneDeep as Lr, toLower as xr, isFunction as _e, map as Ce, forEach as dr, isDate as Le, omitBy as or, isObject as cr } from "lodash-es";
6
6
  import { objectToCamel as Ne, objectToSnake as We } from "ts-case-convert";
7
7
  import { defineStore as H } from "pinia";
8
8
  import { ref as y, markRaw as qr, computed as D } from "vue";
@@ -379,7 +379,7 @@ class me {
379
379
  try {
380
380
  const s = JSON.parse(e);
381
381
  if (!s.availableFor || Ee(C(s.availableFor) || xe(), /* @__PURE__ */ new Date())) {
382
- if ($(s.data) || K(s.data))
382
+ if (A(s.data) || K(s.data))
383
383
  throw new Error("Data is empty");
384
384
  return s.data;
385
385
  }
@@ -401,7 +401,7 @@ class me {
401
401
  static saveActualDataToStorage(r, e, s) {
402
402
  if (this.isLocalStorageAvailable())
403
403
  try {
404
- if ($(e) || K(e))
404
+ if (A(e) || K(e))
405
405
  throw new Error("Data is empty");
406
406
  const i = JSON.stringify({
407
407
  availableFor: s,
@@ -491,7 +491,7 @@ const M = H("common.auth_state_private", () => {
491
491
  })()
492
492
  ), r = y(void 0), e = y(void 0), s = qr(/* @__PURE__ */ new Map());
493
493
  function i() {
494
- e.value = void 0, $(n.value) || n.value.then((o) => {
494
+ e.value = void 0, A(n.value) || n.value.then((o) => {
495
495
  const c = _.getJwtPayload(o);
496
496
  e.value = c.exp * 1e3 > Date.now() ? nr(c.resourceAccess, (l) => (l == null ? void 0 : l.roles) ?? []) : void 0;
497
497
  }).catch(w);
@@ -521,7 +521,7 @@ const M = H("common.auth_state_private", () => {
521
521
  }), Te = H("common.auth_state", () => {
522
522
  const n = D(() => {
523
523
  const o = M();
524
- if ($(o.jwtToken) && !$(o.jwtTokenUpdater)) {
524
+ if (A(o.jwtToken) && !A(o.jwtTokenUpdater)) {
525
525
  const c = o.jwtTokenUpdater();
526
526
  o.jwtToken = c, c.then((l) => {
527
527
  o.jwtToken = Promise.resolve(l), me.saveActualDataToStorage("sc.token", l, Je(l)), o.recalculateUserPermissions();
@@ -542,7 +542,7 @@ const M = H("common.auth_state_private", () => {
542
542
  }
543
543
  function i(o) {
544
544
  const c = M();
545
- !$(c.jwtToken) && $(c.userPermissions) && c.jwtToken.then((f) => {
545
+ !A(c.jwtToken) && A(c.userPermissions) && c.jwtToken.then((f) => {
546
546
  const g = _.getJwtPayload(f);
547
547
  c.userPermissions = g.exp * 1e3 > Date.now() ? nr(g.resourceAccess, (S) => (S == null ? void 0 : S.roles) ?? []) : void 0;
548
548
  }).catch(w);
@@ -607,13 +607,13 @@ class j {
607
607
  * @inheritDoc
608
608
  */
609
609
  t(this, "guid");
610
- this.id = r == null ? void 0 : r.id, $(this.id) && ($(e) ? typeof (r == null ? void 0 : r.id) == "number" ? this.id = -1 : typeof (r == null ? void 0 : r.id) == "string" && (this.id = "") : this.id = e), this.guid = (r == null ? void 0 : r.guid) ?? "";
610
+ this.id = r == null ? void 0 : r.id, A(this.id) && (A(e) ? typeof (r == null ? void 0 : r.id) == "number" ? this.id = -1 : typeof (r == null ? void 0 : r.id) == "string" && (this.id = "") : this.id = e), this.guid = (r == null ? void 0 : r.guid) ?? "";
611
611
  }
612
612
  /**
613
613
  * Возвращает признак, что это новая запись.
614
614
  */
615
615
  isNewRec() {
616
- return typeof this.id == "number" ? this.id === -1 : typeof this.id == "string" ? this.id === "" : $(this.id);
616
+ return typeof this.id == "number" ? this.id === -1 : typeof this.id == "string" ? this.id === "" : A(this.id);
617
617
  }
618
618
  }
619
619
  class a extends j {
@@ -1168,7 +1168,7 @@ const P = class P {
1168
1168
  // eslint-disable-next-line class-methods-use-this
1169
1169
  t(this, "authRequestInterceptor", async (r) => {
1170
1170
  let e;
1171
- return $(Te().jwtToken) || (e = await Te().jwtToken), e && r.headers.set("Authorization", `Bearer ${e}`), r;
1171
+ return A(Te().jwtToken) || (e = await Te().jwtToken), e && r.headers.set("Authorization", `Bearer ${e}`), r;
1172
1172
  });
1173
1173
  /**
1174
1174
  * Перехватчик запроса для вызова пользовательских хуков.
@@ -1281,8 +1281,8 @@ const P = class P {
1281
1281
  */
1282
1282
  static convertHttpErrorResponse(r) {
1283
1283
  var e, s;
1284
- if (!$(r.request) || !$(r.response)) {
1285
- const i = r == null ? void 0 : r.response;
1284
+ if (A(r) || !A(r.request) || !A(r.response)) {
1285
+ const i = A(r) ? {} : r == null ? void 0 : r.response;
1286
1286
  return Promise.reject({
1287
1287
  status: (i == null ? void 0 : i.status) ?? 0,
1288
1288
  statusText: (i == null ? void 0 : i.statusText) ?? "Unknown",
@@ -2169,7 +2169,7 @@ class Ut {
2169
2169
  return Object.keys(this).forEach((c) => {
2170
2170
  const l = this[c];
2171
2171
  // eslint-disable-next-line prettier/prettier
2172
- $(l) || v(l) && l.trim().length === 0 || _e(l.isNewRec) && l.isNewRec() || (r[c] = l);
2172
+ A(l) || v(l) && l.trim().length === 0 || _e(l.isNewRec) && l.isNewRec() || (r[c] = l);
2173
2173
  }), !((e = r == null ? void 0 : r.createdAt) != null && e.from) && !((s = r == null ? void 0 : r.createdAt) != null && s.to) && delete r.createdAt, !((i = r == null ? void 0 : r.updatedAt) != null && i.from) && !((o = r == null ? void 0 : r.updatedAt) != null && o.to) && delete r.updatedAt, r;
2174
2174
  }
2175
2175
  }
@@ -4172,7 +4172,7 @@ class Kt {
4172
4172
  return Object.keys(this).forEach((c) => {
4173
4173
  const l = this[c];
4174
4174
  // eslint-disable-next-line prettier/prettier
4175
- $(l) || v(l) && l.trim().length === 0 || _e(l.isNewRec) && l.isNewRec() || (r[c] = l);
4175
+ A(l) || v(l) && l.trim().length === 0 || _e(l.isNewRec) && l.isNewRec() || (r[c] = l);
4176
4176
  }), !((e = r == null ? void 0 : r.createdAt) != null && e.from) && !((s = r == null ? void 0 : r.createdAt) != null && s.to) && delete r.createdAt, !((i = r == null ? void 0 : r.lastLoginDate) != null && i.from) && !((o = r == null ? void 0 : r.lastLoginDate) != null && o.to) && delete r.lastLoginDate, r;
4177
4177
  }
4178
4178
  }
@@ -5536,7 +5536,7 @@ const Ie = (n) => {
5536
5536
  salesDirections: (o = n.salesDirections) == null ? void 0 : o.map((c) => c.id),
5537
5537
  hideNotActive: n.hideNotActive
5538
5538
  },
5539
- (c) => $(c) || (V(c) || cr(c)) && K(c)
5539
+ (c) => A(c) || (V(c) || cr(c)) && K(c)
5540
5540
  ) : {};
5541
5541
  }, rr = (n) => {
5542
5542
  const r = {};
@@ -5685,7 +5685,7 @@ class os extends p {
5685
5685
  to: Le((l = r.costDate) == null ? void 0 : l.to) ? O(r.costDate.to, e) : (h = r.costDate) == null ? void 0 : h.to
5686
5686
  }
5687
5687
  }),
5688
- (g) => $(g) || (V(g) || cr(g)) && K(g)
5688
+ (g) => A(g) || (V(g) || cr(g)) && K(g)
5689
5689
  ), i = ((f = r.product) == null ? void 0 : f[0]) ?? 0;
5690
5690
  return delete s.product, this.get(`/internal/price/products/${i}/history`, s).then((g) => [
5691
5691
  new Dt(ne(g[0], { history: g }))
@@ -5896,7 +5896,7 @@ class T extends le {
5896
5896
  return this.getTypedDataArrayRequester(gt, "/public/references/product-file-type", !0);
5897
5897
  }
5898
5898
  }
5899
- const A = H("common.references_private", () => {
5899
+ const $ = H("common.references_private", () => {
5900
5900
  const n = y({}), r = y(void 0), e = y(void 0), s = y(void 0), i = y(void 0), o = y(void 0), c = y(void 0), l = y(void 0), h = y(void 0), f = y(void 0), g = y(void 0), S = y(void 0), ee = y(void 0), re = y(void 0), G = y(void 0), F = y(void 0), $e = y(void 0), u = y(void 0);
5901
5901
  return {
5902
5902
  /**
@@ -5974,87 +5974,87 @@ const A = H("common.references_private", () => {
5974
5974
  };
5975
5975
  }), us = H("common.references", () => {
5976
5976
  const n = D(() => {
5977
- const u = A();
5977
+ const u = $();
5978
5978
  return !u.channelPrimaryInterestReference && !u.dataLoaderList.channelPrimaryInterestReference && (u.dataLoaderList.channelPrimaryInterestReference = !0, p.getInstance(T).getChannelPrimaryInterest().then((m) => {
5979
5979
  u.channelPrimaryInterestReference = m;
5980
5980
  }).catch(w)), u.channelPrimaryInterestReference;
5981
5981
  }), r = D(() => {
5982
- const u = A();
5982
+ const u = $();
5983
5983
  return !u.contactPositionsReference && !u.dataLoaderList.contactPositionsReference && (u.dataLoaderList.contactPositionsReference = !0, p.getInstance(T).getContactPositions().then((m) => {
5984
5984
  u.contactPositionsReference = m;
5985
5985
  }).catch(w)), u.contactPositionsReference;
5986
5986
  }), e = D(() => {
5987
- const u = A();
5987
+ const u = $();
5988
5988
  return !u.currencyReference && !u.dataLoaderList.currencyReference && (u.dataLoaderList.currencyReference = !0, p.getInstance(T).getCurrency().then((m) => {
5989
5989
  u.currencyReference = m;
5990
5990
  }).catch(w)), u.currencyReference;
5991
5991
  }), s = D(() => {
5992
- const u = A();
5992
+ const u = $();
5993
5993
  return !u.opfReference && !u.dataLoaderList.opfReference && (u.dataLoaderList.opfReference = !0, p.getInstance(T).getOpf().then((m) => {
5994
5994
  u.opfReference = m;
5995
5995
  }).catch(w)), u.opfReference;
5996
5996
  }), i = D(() => {
5997
- const u = A();
5997
+ const u = $();
5998
5998
  return !u.orderPaymentStatusReference && !u.dataLoaderList.orderPaymentStatusReference && (u.dataLoaderList.orderPaymentStatusReference = !0, p.getInstance(T).getOrderPaymentStatuses().then((m) => {
5999
5999
  u.orderPaymentStatusReference = m;
6000
6000
  }).catch(w)), u.orderPaymentStatusReference;
6001
6001
  }), o = D(() => {
6002
- const u = A();
6002
+ const u = $();
6003
6003
  return !u.orderStatusReference && !u.dataLoaderList.orderStatusReference && (u.dataLoaderList.orderStatusReference = !0, p.getInstance(T).getOrderStatuses().then((m) => {
6004
6004
  u.orderStatusReference = m;
6005
6005
  }).catch(w)), u.orderStatusReference;
6006
6006
  }), c = D(() => {
6007
- const u = A();
6007
+ const u = $();
6008
6008
  return !u.paymentTypeReference && !u.dataLoaderList.paymentTypeReference && (u.dataLoaderList.paymentTypeReference = !0, p.getInstance(T).getPaymentTypes().then((m) => {
6009
6009
  u.paymentTypeReference = m;
6010
6010
  }).catch(w)), u.paymentTypeReference;
6011
6011
  }), l = D(() => {
6012
- const u = A();
6012
+ const u = $();
6013
6013
  return !u.partnerGroupReference && !u.dataLoaderList.partnerGroupReference && (u.dataLoaderList.partnerGroupReference = !0, p.getInstance(T).getPartnerGroup().then((m) => {
6014
6014
  u.partnerGroupReference = m;
6015
6015
  }).catch(w)), u.partnerGroupReference;
6016
6016
  }), h = D(() => {
6017
- const u = A();
6017
+ const u = $();
6018
6018
  return !u.productFileTypeReference && !u.dataLoaderList.productFileTypeReference && (u.dataLoaderList.productFileTypeReference = !0, p.getInstance(T).getProductFileType().then((m) => {
6019
6019
  u.productFileTypeReference = m;
6020
6020
  }).catch(w)), u.productFileTypeReference;
6021
6021
  }), f = D(() => {
6022
- const u = A();
6022
+ const u = $();
6023
6023
  return !u.resourceTypesReference && !u.dataLoaderList.resourceTypesReference && (u.dataLoaderList.resourceTypesReference = !0, p.getInstance(T).getResourceTypes().then((m) => {
6024
6024
  u.resourceTypesReference = m;
6025
6025
  }).catch(w)), u.resourceTypesReference;
6026
6026
  }), g = D(() => {
6027
- const u = A();
6027
+ const u = $();
6028
6028
  return !u.salesDirectionsReference && !u.dataLoaderList.salesDirectionsReference && (u.dataLoaderList.salesDirectionsReference = !0, p.getInstance(T).getSalesDirections().then((m) => {
6029
6029
  u.salesDirectionsReference = m;
6030
6030
  }).catch(w)), u.salesDirectionsReference;
6031
6031
  }), S = D(() => {
6032
- const u = A();
6032
+ const u = $();
6033
6033
  return !u.sourcePrimaryInterestReference && !u.dataLoaderList.sourcePrimaryInterestReference && (u.dataLoaderList.sourcePrimaryInterestReference = !0, p.getInstance(T).getSourcePrimaryInterest().then((m) => {
6034
6034
  u.sourcePrimaryInterestReference = m;
6035
6035
  }).catch(w)), u.sourcePrimaryInterestReference;
6036
6036
  }), ee = D(() => {
6037
- const u = A();
6037
+ const u = $();
6038
6038
  return !u.deliveryTypeReference && !u.dataLoaderList.deliveryTypeReference && (u.dataLoaderList.deliveryTypeReference = !0, p.getInstance(T).getDeliveryTypes().then((m) => {
6039
6039
  u.deliveryTypeReference = m;
6040
6040
  }).catch(w)), u.deliveryTypeReference;
6041
6041
  }), re = D(() => {
6042
- const u = A();
6042
+ const u = $();
6043
6043
  return !u.managersList && !u.dataLoaderList.managersList && (u.dataLoaderList.managersList = !0, p.getInstance(Ct).getManagers().then((m) => {
6044
6044
  u.managersList = m;
6045
6045
  }).catch(w)), u.managersList;
6046
6046
  }), G = D(() => {
6047
- const u = A();
6047
+ const u = $();
6048
6048
  return !u.warehousesReference && !u.dataLoaderList.warehousesReference && (u.dataLoaderList.warehousesReference = !0, p.getInstance(T).getWarehouses().then((m) => {
6049
6049
  u.warehousesReference = m;
6050
6050
  }).catch(w)), u.warehousesReference;
6051
6051
  }), F = D(() => {
6052
- const u = A();
6052
+ const u = $();
6053
6053
  return !u.propertyTypesReference && !u.dataLoaderList.propertyTypesReference && (u.dataLoaderList.propertyTypesReference = !0, p.getInstance(T).getPropertyTypes().then((m) => {
6054
6054
  u.propertyTypesReference = m;
6055
6055
  }).catch(w)), u.propertyTypesReference;
6056
6056
  }), $e = D(() => {
6057
- const u = A();
6057
+ const u = $();
6058
6058
  return !u.priceCoefficientsReference && !u.dataLoaderList.priceCoefficientsReference && (u.dataLoaderList.priceCoefficientsReference = !0, p.getInstance(T).getPriceCoefficients().then((m) => {
6059
6059
  u.priceCoefficientsReference = m;
6060
6060
  }).catch(w)), u.priceCoefficientsReference;
@@ -6512,4 +6512,3 @@ export {
6512
6512
  us as useReferencesStore,
6513
6513
  gs as useUserStateStore
6514
6514
  };
6515
- //# sourceMappingURL=sc-common-lib.js.map