@snabcentr/common-lib 1.65.0 → 1.65.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/manifest.json +1 -1
- package/dist/release_notes.tmp +2 -4
- package/dist/sc-common-lib.js +37 -33
- package/dist/sc-common-lib.js.map +1 -1
- package/dist/sc-common-lib.umd.cjs +1 -1
- package/dist/sc-common-lib.umd.cjs.map +1 -1
- package/dist/src/http/classes/http-requester.d.ts +6 -0
- package/dist/src/http/classes/http-requester.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/manifest.json
CHANGED
package/dist/release_notes.tmp
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
## 1.65.
|
|
1
|
+
## 1.65.1 (2025-08-27)
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
- [#12080: Выполнен рефакторинг базовых HTTP-провайдеров](web_soft/libs/ts/snabcentr-common-lib@ed74f9d820ad0b1269bbafc266e6141871e294be) ([merge request](web_soft/libs/ts/snabcentr-common-lib!123))
|
|
3
|
+
No changes.
|
|
6
4
|
|
package/dist/sc-common-lib.js
CHANGED
|
@@ -3,9 +3,9 @@ var pr = (n, r, e) => r in n ? ur(n, r, { enumerable: !0, configurable: !0, writ
|
|
|
3
3
|
var t = (n, r, e) => pr(n, typeof r != "symbol" ? r + "" : r, e);
|
|
4
4
|
import { jwtDecode as je } from "jwt-decode";
|
|
5
5
|
import { merge as We, isNil as U, toUpper as hr, constant as gr, isUndefined as mr, isString as f, cloneDeep as fr, noop as m, toLower as yr, isFunction as _e, isEmpty as Se, map as le, forEach as wr, isDate as Cr, isArray as Ee, omitBy as vr, isObject as Pr } from "lodash-es";
|
|
6
|
-
import { objectToCamel as
|
|
7
|
-
import { parseISO as y, format as z, isAfter as Rr, startOfToday as Ve, addSeconds as Ar, addBusinessDays as Dr, endOfTomorrow as $r, startOfTomorrow as ar, endOfYesterday as Tr, startOfYesterday as br, endOfToday as _r, endOfDay as Sr, startOfDay as
|
|
8
|
-
import
|
|
6
|
+
import { objectToCamel as Ie, objectToSnake as Oe } from "ts-case-convert";
|
|
7
|
+
import { parseISO as y, format as z, isAfter as Rr, startOfToday as Ve, addSeconds as Ar, addBusinessDays as Dr, endOfTomorrow as $r, startOfTomorrow as ar, endOfYesterday as Tr, startOfYesterday as br, endOfToday as _r, endOfDay as Sr, startOfDay as Ir } from "date-fns";
|
|
8
|
+
import Lr from "axios";
|
|
9
9
|
import { defineStore as fe } from "pinia";
|
|
10
10
|
import { ref as C, computed as v } from "vue";
|
|
11
11
|
class ue {
|
|
@@ -107,7 +107,7 @@ class ue {
|
|
|
107
107
|
* @param jwtToken JWT-ключ доступа.
|
|
108
108
|
*/
|
|
109
109
|
static getJwtPayload(r) {
|
|
110
|
-
return new ue(
|
|
110
|
+
return new ue(Ie(je(r)));
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
class At extends ue {
|
|
@@ -150,7 +150,7 @@ class At extends ue {
|
|
|
150
150
|
* @param jwtToken JWT-ключ доступа.
|
|
151
151
|
*/
|
|
152
152
|
static getJwtPayload(e) {
|
|
153
|
-
return new ue(
|
|
153
|
+
return new ue(Ie(je(e)));
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
class B {
|
|
@@ -286,7 +286,7 @@ class ye extends w {
|
|
|
286
286
|
return { id: -2, slug: Ke.Retail, name: "Розн. цена", guid: "", isNewRec: gr(!0) };
|
|
287
287
|
}
|
|
288
288
|
}
|
|
289
|
-
class
|
|
289
|
+
class Le {
|
|
290
290
|
/**
|
|
291
291
|
* Инициализирует экземпляр класса {@link ProductPriceCoefficient}.
|
|
292
292
|
*
|
|
@@ -548,7 +548,7 @@ class b extends kr {
|
|
|
548
548
|
t(this, "priceCoefficients");
|
|
549
549
|
this.supplierSku = e == null ? void 0 : e.supplierSku, this.unit = (e == null ? void 0 : e.unit) ?? "", this.pack = e == null ? void 0 : e.pack, this.minCount = e == null ? void 0 : e.minCount, this.quantityUnit = e == null ? void 0 : e.quantityUnit, this.currency = (e == null ? void 0 : e.currency) ?? "", this.cost = (e == null ? void 0 : e.cost) ?? 0, this.costRub = (e == null ? void 0 : e.costRub) ?? 0, this.costDate = f(e == null ? void 0 : e.costDate) ? y(e.costDate) : e == null ? void 0 : e.costDate, this.onOrder = (e == null ? void 0 : e.onOrder) ?? !1, this.stockCount = ((i = e == null ? void 0 : e.stockCount) == null ? void 0 : i.map((p) => new xr(p))) ?? [], this.currencySignature = (e == null ? void 0 : e.currencySignature) ?? "", this.type = "product";
|
|
550
550
|
const s = (e == null ? void 0 : e.category) ?? ((o = e == null ? void 0 : e.categories) == null ? void 0 : o.find((p) => p.isPrimary));
|
|
551
|
-
s && (this.category = new ae({ ...s, isPrimary: !0 }), this.categories = [this.category]), e != null && e.categories && (this.categories = e.categories.map((p) => new ae(p))), this.images = ((c = e == null ? void 0 : e.images) == null ? void 0 : c.map((p) => new dr(p, $.getConfig().http.mediaUrl))) ?? [], this.properties = (e == null ? void 0 : e.properties) ?? {}, this.retailCost = e == null ? void 0 : e.retailCost, this.retailCostRub = e == null ? void 0 : e.retailCostRub, this.priceCoefficients = ((u = e == null ? void 0 : e.priceCoefficients) == null ? void 0 : u.map((p) => new
|
|
551
|
+
s && (this.category = new ae({ ...s, isPrimary: !0 }), this.categories = [this.category]), e != null && e.categories && (this.categories = e.categories.map((p) => new ae(p))), this.images = ((c = e == null ? void 0 : e.images) == null ? void 0 : c.map((p) => new dr(p, $.getConfig().http.mediaUrl))) ?? [], this.properties = (e == null ? void 0 : e.properties) ?? {}, this.retailCost = e == null ? void 0 : e.retailCost, this.retailCostRub = e == null ? void 0 : e.retailCostRub, this.priceCoefficients = ((u = e == null ? void 0 : e.priceCoefficients) == null ? void 0 : u.map((p) => new Le(p))) ?? [], e && "codeNumber" in e && !e.code && (this.code = e == null ? void 0 : e.codeNumber);
|
|
552
552
|
}
|
|
553
553
|
/**
|
|
554
554
|
* Возвращает признак, что это измеряемый товар.
|
|
@@ -920,6 +920,12 @@ const _ = class _ {
|
|
|
920
920
|
* @param error Данные об ошибке.
|
|
921
921
|
*/
|
|
922
922
|
t(this, "requestErrorHandler", m);
|
|
923
|
+
/**
|
|
924
|
+
* Перехватчик запроса для установки URL для выполнения запросов.
|
|
925
|
+
*
|
|
926
|
+
* @param request Данные запроса.
|
|
927
|
+
*/
|
|
928
|
+
t(this, "setBaseUrlRequestInterceptor", (r) => (r.baseURL = this.getBaseUrl(), r));
|
|
923
929
|
/**
|
|
924
930
|
* Перехватчик запроса для установки заголовков аутентификации.
|
|
925
931
|
*
|
|
@@ -952,17 +958,15 @@ const _ = class _ {
|
|
|
952
958
|
* @param response Данные ответа на запрос.
|
|
953
959
|
*/
|
|
954
960
|
// eslint-disable-next-line class-methods-use-this
|
|
955
|
-
t(this, "dataConverterResponseInterceptor", (r) => (r.data && (r.data =
|
|
961
|
+
t(this, "dataConverterResponseInterceptor", (r) => (r.data && (r.data = Ie(r.data)), r));
|
|
956
962
|
const r = $.getConfig().version;
|
|
957
|
-
this.defaultInstanceNotificationErrorResponseHandler = _.baseDefaultNotificationErrorResponseHandler, this.httpClient =
|
|
958
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
959
|
-
baseURL: this.getBaseUrl(),
|
|
963
|
+
this.defaultInstanceNotificationErrorResponseHandler = _.baseDefaultNotificationErrorResponseHandler, this.httpClient = Lr.create({
|
|
960
964
|
headers: {
|
|
961
965
|
"APP-VERSION": `${r.name} (${r.version}, ${z(r.date, $.getConfig().dateFormats.uiDate)})`,
|
|
962
966
|
Accept: "application/json",
|
|
963
967
|
"Content-Type": "application/json"
|
|
964
968
|
}
|
|
965
|
-
}), this.httpClient.interceptors.request.use(this.authRequestInterceptor, (e) => Promise.reject(e)), this.httpClient.interceptors.request.use(this.dataConverterRequestInterceptor, (e) => Promise.reject(e)), this.httpClient.interceptors.response.use((e) => e, this.authErrorsResponseInterceptors), this.httpClient.interceptors.response.use(
|
|
969
|
+
}), this.httpClient.interceptors.request.use(this.setBaseUrlRequestInterceptor, (e) => Promise.reject(e)), this.httpClient.interceptors.request.use(this.authRequestInterceptor, (e) => Promise.reject(e)), this.httpClient.interceptors.request.use(this.dataConverterRequestInterceptor, (e) => Promise.reject(e)), this.httpClient.interceptors.response.use((e) => e, this.authErrorsResponseInterceptors), this.httpClient.interceptors.response.use(
|
|
966
970
|
this.dataConverterResponseInterceptor,
|
|
967
971
|
// Возвращаем изменённую структуру сообщения об ошибке.
|
|
968
972
|
(e) => _.convertHttpErrorResponse(e)
|
|
@@ -2464,7 +2468,7 @@ class St extends h {
|
|
|
2464
2468
|
return this.post(`/internal/clients/${r}/price/commercial-offer/send`, e);
|
|
2465
2469
|
}
|
|
2466
2470
|
}
|
|
2467
|
-
class
|
|
2471
|
+
class It extends h {
|
|
2468
2472
|
/**
|
|
2469
2473
|
* Возвращает список шаблонов прайс-листа привязанных к клиенту.
|
|
2470
2474
|
*
|
|
@@ -2556,7 +2560,7 @@ class Lt extends h {
|
|
|
2556
2560
|
return this.delete(`/internal/clients/${r}/price/templates/${e}/${s}`);
|
|
2557
2561
|
}
|
|
2558
2562
|
}
|
|
2559
|
-
class
|
|
2563
|
+
class Lt extends h {
|
|
2560
2564
|
/**
|
|
2561
2565
|
* Возвращает список данных о корневых категориях.
|
|
2562
2566
|
*
|
|
@@ -2629,7 +2633,7 @@ class It extends h {
|
|
|
2629
2633
|
getCategoryProductsCoefficients(r) {
|
|
2630
2634
|
return this.get(`/internal/catalog/categories/${r}/products/coefficients`, {}, (e) => {
|
|
2631
2635
|
const { data: s } = e;
|
|
2632
|
-
return wr(s, (i) => i.map((o) => new
|
|
2636
|
+
return wr(s, (i) => i.map((o) => new Le(o))), s;
|
|
2633
2637
|
});
|
|
2634
2638
|
}
|
|
2635
2639
|
/**
|
|
@@ -2679,7 +2683,7 @@ class xt extends h {
|
|
|
2679
2683
|
return this.get(
|
|
2680
2684
|
`/internal/catalog/products/${r}/coefficients`,
|
|
2681
2685
|
{},
|
|
2682
|
-
(e) => le(e.data, (s) => new
|
|
2686
|
+
(e) => le(e.data, (s) => new Le(s))
|
|
2683
2687
|
);
|
|
2684
2688
|
}
|
|
2685
2689
|
/**
|
|
@@ -4509,7 +4513,7 @@ class Bt extends ve {
|
|
|
4509
4513
|
* @see /doc/api/internal#/Контрагенты/api_internal_client_contragent_create
|
|
4510
4514
|
*/
|
|
4511
4515
|
createContragentClientData(r, e, s = {}) {
|
|
4512
|
-
var p, R, D,
|
|
4516
|
+
var p, R, D, I, L, x, k, d;
|
|
4513
4517
|
let i;
|
|
4514
4518
|
const o = e, c = e, u = e;
|
|
4515
4519
|
switch (e.opf.slug) {
|
|
@@ -4537,7 +4541,7 @@ class Bt extends ve {
|
|
|
4537
4541
|
name: c.name,
|
|
4538
4542
|
alternative_name: c.alternativeName,
|
|
4539
4543
|
partner_group_id: (D = c.partnerGroup) == null ? void 0 : D.id,
|
|
4540
|
-
manager_id: (
|
|
4544
|
+
manager_id: (I = c.manager) == null ? void 0 : I.id,
|
|
4541
4545
|
comment: c.comment,
|
|
4542
4546
|
inn: c.inn,
|
|
4543
4547
|
kpp: c.kpp,
|
|
@@ -4555,7 +4559,7 @@ class Bt extends ve {
|
|
|
4555
4559
|
opf: u.opf.slug,
|
|
4556
4560
|
name: u.name,
|
|
4557
4561
|
alternative_name: u.alternativeName,
|
|
4558
|
-
partner_group_id: (
|
|
4562
|
+
partner_group_id: (L = u.partnerGroup) == null ? void 0 : L.id,
|
|
4559
4563
|
manager_id: (x = u.manager) == null ? void 0 : x.id,
|
|
4560
4564
|
comment: u.comment,
|
|
4561
4565
|
director_name: u.directorName,
|
|
@@ -4598,7 +4602,7 @@ class Bt extends ve {
|
|
|
4598
4602
|
* @see /doc/api/internal#/Контрагенты/api_internal_client_contragent_update
|
|
4599
4603
|
*/
|
|
4600
4604
|
updateContragentClientData(r, e, s = {}) {
|
|
4601
|
-
var p, R, D,
|
|
4605
|
+
var p, R, D, I, L, x, k, d;
|
|
4602
4606
|
let i;
|
|
4603
4607
|
const o = e, c = e, u = e;
|
|
4604
4608
|
switch (e.opf.slug) {
|
|
@@ -4626,7 +4630,7 @@ class Bt extends ve {
|
|
|
4626
4630
|
name: c.name,
|
|
4627
4631
|
alternative_name: c.alternativeName,
|
|
4628
4632
|
partner_group_id: (D = c.partnerGroup) == null ? void 0 : D.id,
|
|
4629
|
-
manager_id: (
|
|
4633
|
+
manager_id: (I = c.manager) == null ? void 0 : I.id,
|
|
4630
4634
|
comment: c.comment,
|
|
4631
4635
|
inn: c.inn,
|
|
4632
4636
|
kpp: c.kpp,
|
|
@@ -4644,7 +4648,7 @@ class Bt extends ve {
|
|
|
4644
4648
|
opf: u.opf.slug,
|
|
4645
4649
|
name: u.name,
|
|
4646
4650
|
alternative_name: u.alternativeName,
|
|
4647
|
-
partner_group_id: (
|
|
4651
|
+
partner_group_id: (L = u.partnerGroup) == null ? void 0 : L.id,
|
|
4648
4652
|
manager_id: (x = u.manager) == null ? void 0 : x.id,
|
|
4649
4653
|
comment: u.comment,
|
|
4650
4654
|
director_name: u.directorName,
|
|
@@ -5127,7 +5131,7 @@ class jt {
|
|
|
5127
5131
|
const r = Dr(/* @__PURE__ */ new Date(), 1);
|
|
5128
5132
|
return {
|
|
5129
5133
|
// 'Следующий рабочий день' - это значение по-умолчанию
|
|
5130
|
-
nextWorkingDay: { label: "Следующий рабочий день", from:
|
|
5134
|
+
nextWorkingDay: { label: "Следующий рабочий день", from: Ir(r), to: Sr(r) },
|
|
5131
5135
|
today: { label: "Сегодня", from: Ve(), to: _r() },
|
|
5132
5136
|
yesterday: { label: "Вчера", from: br(), to: Tr() },
|
|
5133
5137
|
tomorrow: { label: "Завтра", from: ar(), to: $r() }
|
|
@@ -5621,7 +5625,7 @@ class Jt extends h {
|
|
|
5621
5625
|
}
|
|
5622
5626
|
}
|
|
5623
5627
|
const P = fe("__references_private", () => {
|
|
5624
|
-
const n = C({}), r = C(void 0), e = C(void 0), s = C(void 0), i = C(void 0), o = C(void 0), c = C(void 0), u = C(void 0), p = C(void 0), R = C(void 0), D = C(void 0),
|
|
5628
|
+
const n = C({}), r = C(void 0), e = C(void 0), s = C(void 0), i = C(void 0), o = C(void 0), c = C(void 0), u = C(void 0), p = C(void 0), R = C(void 0), D = C(void 0), I = C(void 0), L = C(void 0), x = C(void 0), k = C(void 0), d = C(void 0), O = C(void 0), l = C(void 0);
|
|
5625
5629
|
return {
|
|
5626
5630
|
/**
|
|
5627
5631
|
* Список загружаемых/загруженных на данный момент значений.
|
|
@@ -5670,11 +5674,11 @@ const P = fe("__references_private", () => {
|
|
|
5670
5674
|
/**
|
|
5671
5675
|
* Справочник типов файлов продукктов/категорий.
|
|
5672
5676
|
*/
|
|
5673
|
-
productFileTypeReference:
|
|
5677
|
+
productFileTypeReference: I,
|
|
5674
5678
|
/**
|
|
5675
5679
|
* Справочник типов ресурсов.
|
|
5676
5680
|
*/
|
|
5677
|
-
resourceTypesReference:
|
|
5681
|
+
resourceTypesReference: L,
|
|
5678
5682
|
/**
|
|
5679
5683
|
* Справочник направлений продаж.
|
|
5680
5684
|
*/
|
|
@@ -5752,12 +5756,12 @@ const P = fe("__references_private", () => {
|
|
|
5752
5756
|
return !l.salesDirectionsReference && !l.dataLoaderList.salesDirectionsReference && (l.dataLoaderList.salesDirectionsReference = !0, h.getInstance(A).getSalesDirections().then((g) => {
|
|
5753
5757
|
l.salesDirectionsReference = g;
|
|
5754
5758
|
}).catch(m)), l.salesDirectionsReference;
|
|
5755
|
-
}),
|
|
5759
|
+
}), I = v(() => {
|
|
5756
5760
|
const l = P();
|
|
5757
5761
|
return !l.sourcePrimaryInterestReference && !l.dataLoaderList.sourcePrimaryInterestReference && (l.dataLoaderList.sourcePrimaryInterestReference = !0, h.getInstance(A).getSourcePrimaryInterest().then((g) => {
|
|
5758
5762
|
l.sourcePrimaryInterestReference = g;
|
|
5759
5763
|
}).catch(m)), l.sourcePrimaryInterestReference;
|
|
5760
|
-
}),
|
|
5764
|
+
}), L = v(() => {
|
|
5761
5765
|
const l = P();
|
|
5762
5766
|
return !l.deliveryTypeReference && !l.dataLoaderList.deliveryTypeReference && (l.dataLoaderList.deliveryTypeReference = !0, h.getInstance(A).getDeliveryTypes().then((g) => {
|
|
5763
5767
|
l.deliveryTypeReference = g;
|
|
@@ -5831,11 +5835,11 @@ const P = fe("__references_private", () => {
|
|
|
5831
5835
|
/**
|
|
5832
5836
|
* Справочник каналов первичного интереса.
|
|
5833
5837
|
*/
|
|
5834
|
-
sourcePrimaryInterestsReference:
|
|
5838
|
+
sourcePrimaryInterestsReference: I,
|
|
5835
5839
|
/**
|
|
5836
5840
|
* Справочник типов доставки.
|
|
5837
5841
|
*/
|
|
5838
|
-
deliveryTypeReference:
|
|
5842
|
+
deliveryTypeReference: L,
|
|
5839
5843
|
/**
|
|
5840
5844
|
* Список менеджеров.
|
|
5841
5845
|
*/
|
|
@@ -5969,7 +5973,7 @@ export {
|
|
|
5969
5973
|
pe as ClientCategory,
|
|
5970
5974
|
Bt as ClientDataProvider,
|
|
5971
5975
|
St as ClientPriceProvider,
|
|
5972
|
-
|
|
5976
|
+
It as ClientPriceTemplateProvider,
|
|
5973
5977
|
K as ClientProduct,
|
|
5974
5978
|
kt as ClientProductCategoryDataProvider,
|
|
5975
5979
|
dt as ClientProductDataProvider,
|
|
@@ -6047,10 +6051,10 @@ export {
|
|
|
6047
6051
|
Ot as PricingRoleProvider,
|
|
6048
6052
|
ae as PrimaryCatalogableItem,
|
|
6049
6053
|
b as Product,
|
|
6050
|
-
|
|
6054
|
+
Lt as ProductCategoryDataProvider,
|
|
6051
6055
|
xt as ProductDataProvider,
|
|
6052
6056
|
Yr as ProductFileType,
|
|
6053
|
-
|
|
6057
|
+
Le as ProductPriceCoefficient,
|
|
6054
6058
|
rt as ProductPriceHistory,
|
|
6055
6059
|
qt as PropertiesProvider,
|
|
6056
6060
|
Z as Property,
|