@snabcentr/common-lib 1.42.1 → 1.44.0

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-M3QJ23rMjH9r8ZVTnAVhGoLu0IHVwwZMuIS3k7hc2O9a0ow0eYQmlyGFiJlgbc8J"
7
+ "integrity": "sha384-ukPb6cgmkEnU6lnD7zMDjbUiqWKTRI9Lt9EHhX2/JIZ6FRv2kIRwc3fFBJsSeCGY"
8
8
  }
9
9
  }
@@ -1,6 +1,6 @@
1
- ## 1.42.1 (2025-04-25)
1
+ ## 1.44.0 (2025-04-25)
2
2
 
3
- ### fixed (1 change)
3
+ ### added (1 change)
4
4
 
5
- - [#11455: Исправлены ошибки в типе файлов каталога](web_soft/libs/ts/snabcentr-common-lib@ebe155c78e40accb996d32d8b819be693199f2b3) ([merge request](web_soft/libs/ts/snabcentr-common-lib!68))
5
+ - [#11455: Добавлена HTTP конфигурация для media-сервера](web_soft/libs/ts/snabcentr-common-lib@fd8f7411bc6090e3d19e8bf50afc89fe8677b6c0) ([merge request](web_soft/libs/ts/snabcentr-common-lib!70))
6
6
 
@@ -264,7 +264,7 @@ const B = class B {
264
264
  * Конфигурация приложения.
265
265
  */
266
266
  s(B, "config");
267
- let d = B;
267
+ let O = B;
268
268
  class yr extends xe {
269
269
  /**
270
270
  * Инициализирует экземпляр класса {@link HiddenCatalogableItem}.
@@ -380,14 +380,14 @@ class x extends yr {
380
380
  const t = (e == null ? void 0 : e.category) ?? ((o = e == null ? void 0 : e.categories) == null ? void 0 : o.find((g) => g.isPrimary));
381
381
  t && (this.category = new fe({ ...t, isPrimary: !0 }), this.categories = [this.category]), e != null && e.categories && (this.categories = e.categories.map((g) => new fe(g))), this.images = ((l = e == null ? void 0 : e.images) == null ? void 0 : l.map((g) => {
382
382
  var y;
383
- return new wr(g, (y = d.getConfig().urls) == null ? void 0 : y.mediaServer);
383
+ return new wr(g, (y = O.getConfig().urls) == null ? void 0 : y.mediaServer);
384
384
  })) ?? [], this.properties = (e == null ? void 0 : e.properties) ?? {}, this.priceCoefficients = ((u = e == null ? void 0 : e.priceCoefficients) == null ? void 0 : u.map((g) => new De(g))) ?? [], e && "codeNumber" in e && !e.code && (this.code = e == null ? void 0 : e.codeNumber);
385
385
  }
386
386
  /**
387
387
  * Возвращает признак, что это измеряемый товар.
388
388
  */
389
389
  getIsMeasurable() {
390
- const e = d.getConfig().products.units;
390
+ const e = O.getConfig().products.units;
391
391
  return [...e.linear, ...e.square].includes(this.unit);
392
392
  }
393
393
  }
@@ -551,11 +551,15 @@ class Dr {
551
551
  * API URI для выполнения запросов.
552
552
  */
553
553
  s(this, "apiUri");
554
+ /**
555
+ * URL медиа-сервера.
556
+ */
557
+ s(this, "mediaUrl");
554
558
  /**
555
559
  * Время кэширования данных ответов на запросы (секунд).
556
560
  */
557
561
  s(this, "responseDataCacheTimeout");
558
- this.apiUri = (r == null ? void 0 : r.apiUri) ?? "", this.responseDataCacheTimeout = (r == null ? void 0 : r.responseDataCacheTimeout) ?? 3 * 60 * 60;
562
+ this.apiUri = (r == null ? void 0 : r.apiUri) ?? "", this.mediaUrl = (r == null ? void 0 : r.mediaUrl) ?? "", this.responseDataCacheTimeout = (r == null ? void 0 : r.responseDataCacheTimeout) ?? 3 * 60 * 60;
559
563
  }
560
564
  }
561
565
  class Pr {
@@ -719,7 +723,7 @@ const b = class b {
719
723
  * - validationFieldResultData Список полей, для которых необходимо установить данные об ошибках валидации в случае ошибок в запросах.
720
724
  */
721
725
  s(this, "defaultInstanceNotificationErrorResponseHandler", m);
722
- const t = d.getConfig().version;
726
+ const t = O.getConfig().version;
723
727
  this.defaultInstanceNotificationErrorResponseHandler = b.baseDefaultNotificationErrorResponseHandler, this.httpClient = gr.create({
724
728
  // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
725
729
  baseURL: r,
@@ -857,7 +861,7 @@ const W = class W extends ye {
857
861
  * Время кэширования данных ответов на запросы (секунд).
858
862
  */
859
863
  s(this, "responseDataCacheTimeout");
860
- const n = d.getConfig();
864
+ const n = O.getConfig();
861
865
  this.responseDataCacheTimeout = n.http.responseDataCacheTimeout;
862
866
  }
863
867
  /**
@@ -911,7 +915,7 @@ class p extends we {
911
915
  */
912
916
  constructor() {
913
917
  var t, n;
914
- const r = d.getConfig(), e = {};
918
+ const r = O.getConfig(), e = {};
915
919
  (t = r.devMode) != null && t.authBearerToken && (e.Authorization = `Bearer ${(n = r.devMode) == null ? void 0 : n.authBearerToken}`), super(`${r.http.apiUri}/api`, e);
916
920
  }
917
921
  }
@@ -1039,7 +1043,7 @@ class U extends ce {
1039
1043
  this.categories = (t = e == null ? void 0 : e.categories) == null ? void 0 : t.map((o) => new U(o)), this.products = (n = e == null ? void 0 : e.products) == null ? void 0 : n.map((o) => new x(o));
1040
1044
  }
1041
1045
  }
1042
- class de extends P {
1046
+ class Oe extends P {
1043
1047
  /**
1044
1048
  * Инициализирует экземпляр класса {@link UpdatableNamedIdentity}.
1045
1049
  *
@@ -1054,7 +1058,7 @@ class de extends P {
1054
1058
  this.updatedAt = e == null ? void 0 : e.updatedAt;
1055
1059
  }
1056
1060
  }
1057
- class Tr extends de {
1061
+ class Tr extends Oe {
1058
1062
  /**
1059
1063
  * Инициализирует экземпляр класса {@link UpdatableNamedIdentity}.
1060
1064
  *
@@ -1157,7 +1161,7 @@ class Sr extends P {
1157
1161
  this.costCoefficient = (e == null ? void 0 : e.costCoefficient) ?? 0, this.isLowPriceAllowed = (e == null ? void 0 : e.isLowPriceAllowed) ?? !1, this.publishedAt = e != null && e.publishedAt ? D(e.publishedAt) ? N(e.publishedAt) : e.publishedAt : void 0, this.description = (e == null ? void 0 : e.description) ?? void 0, this.percent = (e == null ? void 0 : e.percent) ?? 0, this.owner = new q(e == null ? void 0 : e.owner), this.deletedAt = e != null && e.deletedAt ? D(e.deletedAt) ? N(e.deletedAt) : e.deletedAt : void 0;
1158
1162
  }
1159
1163
  }
1160
- class _r extends de {
1164
+ class _r extends Oe {
1161
1165
  /**
1162
1166
  * Инициализирует экземпляр класса {@link PriceTemplate}.
1163
1167
  *
@@ -1344,7 +1348,7 @@ class re extends ar {
1344
1348
  this.categories = (t = e == null ? void 0 : e.categories) == null ? void 0 : t.map((o) => new re(o)), this.products = (n = e == null ? void 0 : e.products) == null ? void 0 : n.map((o) => new ue(o));
1345
1349
  }
1346
1350
  }
1347
- class Oe extends f {
1351
+ class de extends f {
1348
1352
  }
1349
1353
  class J extends P {
1350
1354
  /**
@@ -1366,7 +1370,7 @@ class J extends P {
1366
1370
  * Дополнительные метаданные свойства.
1367
1371
  */
1368
1372
  s(this, "metadata");
1369
- this.type = new Oe(e == null ? void 0 : e.type), this.description = (e == null ? void 0 : e.description) ?? "", this.metadata = e == null ? void 0 : e.metadata;
1373
+ this.type = new de(e == null ? void 0 : e.type), this.description = (e == null ? void 0 : e.description) ?? "", this.metadata = e == null ? void 0 : e.metadata;
1370
1374
  }
1371
1375
  }
1372
1376
  class F {
@@ -1467,10 +1471,10 @@ class Nr extends f {
1467
1471
  }
1468
1472
  class M extends f {
1469
1473
  }
1470
- class dr extends f {
1471
- }
1472
1474
  class Or extends f {
1473
1475
  }
1476
+ class dr extends f {
1477
+ }
1474
1478
  class qe extends f {
1475
1479
  }
1476
1480
  class Ge extends f {
@@ -1534,7 +1538,7 @@ class R extends p {
1534
1538
  * Возвращает {@link Promise} для получения справочника данных типов оплаты заказов.
1535
1539
  */
1536
1540
  getPaymentTypes() {
1537
- return this.getTypedDataArrayRequester(dr, "/public/references/payment-type", !0);
1541
+ return this.getTypedDataArrayRequester(Or, "/public/references/payment-type", !0);
1538
1542
  }
1539
1543
  /**
1540
1544
  * Возвращает {@link Promise} для получения справочника типов ресурсов.
@@ -1594,7 +1598,7 @@ class R extends p {
1594
1598
  * Возвращает {@link Promise} для получения справочника типов свойств.
1595
1599
  */
1596
1600
  getPropertyTypes() {
1597
- return this.getTypedDataArrayRequester(Oe, "/internal/references/property-type", !0);
1601
+ return this.getTypedDataArrayRequester(de, "/internal/references/property-type", !0);
1598
1602
  }
1599
1603
  /**
1600
1604
  * Возвращает {@link Promise} для получения справочника коэффициентов цен.
@@ -1606,7 +1610,7 @@ class R extends p {
1606
1610
  * Возвращает {@link Promise} для получения справочника типов файлов продуктов/категорий.
1607
1611
  */
1608
1612
  getProductFileType() {
1609
- return this.getTypedDataArrayRequester(Or, "/public/references/product-file-type", !0);
1613
+ return this.getTypedDataArrayRequester(dr, "/public/references/product-file-type", !0);
1610
1614
  }
1611
1615
  }
1612
1616
  var Ur = /* @__PURE__ */ ((i) => (i.Admin = "admin", i.Manager = "manager", i.Operator = "operator", i.Client = "client", i.Guest = "guest", i))(Ur || {});
@@ -1828,7 +1832,7 @@ class ls extends p {
1828
1832
  */
1829
1833
  // eslint-disable-next-line class-methods-use-this
1830
1834
  getPriceExportLink(r = "csv", e = !1, t = void 0) {
1831
- let o = `${d.getConfig().http.apiUri}/api/internal/price/export?format=${r}&show_hidden=${e}`;
1835
+ let o = `${O.getConfig().http.apiUri}/api/internal/price/export?format=${r}&show_hidden=${e}`;
1832
1836
  return t && (o += `&client_id=${t}`), o;
1833
1837
  }
1834
1838
  }
@@ -2530,6 +2534,16 @@ class fs extends Ae {
2530
2534
  updateCategorySlug(r, e) {
2531
2535
  return this.patch(`/internal/catalog/categories/${r}/properties/slug`, { slug: e });
2532
2536
  }
2537
+ /**
2538
+ * Обновляет изображение категории.
2539
+ *
2540
+ * @param categoryId Идентификатор категории.
2541
+ * @param fileData Данные загружаемого файла.
2542
+ * @see /doc/api/internal#/operations/api_internal_catalog_categories_image_save
2543
+ */
2544
+ updateCategoryImage(r, e) {
2545
+ return this.post(`/internal/catalog/categories/${r}/image`, e);
2546
+ }
2533
2547
  }
2534
2548
  class ys extends p {
2535
2549
  /**
@@ -3832,7 +3846,7 @@ class Ds extends Ae {
3832
3846
  return this.post(
3833
3847
  `/internal/clients/${r}/contragents`,
3834
3848
  n,
3835
- (O) => ne.createInstance(O.data),
3849
+ (d) => ne.createInstance(d.data),
3836
3850
  t
3837
3851
  );
3838
3852
  }
@@ -3924,7 +3938,7 @@ class Ds extends Ae {
3924
3938
  return this.patch(
3925
3939
  `/internal/clients/${r}/contragents/${e.id}`,
3926
3940
  n,
3927
- (O) => ne.createInstance(O.data),
3941
+ (d) => ne.createInstance(d.data),
3928
3942
  t
3929
3943
  );
3930
3944
  }
@@ -4549,7 +4563,7 @@ class Ts extends p {
4549
4563
  }
4550
4564
  }
4551
4565
  const v = oe("__references_private", () => {
4552
- const i = w({}), r = w(void 0), e = w(void 0), t = w(void 0), n = w(void 0), o = w(void 0), l = w(void 0), u = w(void 0), g = w(void 0), y = w(void 0), A = w(void 0), S = w(void 0), _ = w(void 0), L = w(void 0), a = w(void 0), I = w(void 0), O = w(void 0), c = w(void 0);
4566
+ const i = w({}), r = w(void 0), e = w(void 0), t = w(void 0), n = w(void 0), o = w(void 0), l = w(void 0), u = w(void 0), g = w(void 0), y = w(void 0), A = w(void 0), S = w(void 0), _ = w(void 0), L = w(void 0), a = w(void 0), I = w(void 0), d = w(void 0), c = w(void 0);
4553
4567
  return {
4554
4568
  /**
4555
4569
  * Список загружаемых/загруженных на данный момент значений.
@@ -4618,7 +4632,7 @@ const v = oe("__references_private", () => {
4618
4632
  /**
4619
4633
  * Справочник типов свойств.
4620
4634
  */
4621
- propertyTypesReference: O,
4635
+ propertyTypesReference: d,
4622
4636
  /**
4623
4637
  * Справочник коэффициентов цен.
4624
4638
  */
@@ -4705,7 +4719,7 @@ const v = oe("__references_private", () => {
4705
4719
  return !c.propertyTypesReference && !c.dataLoaderList.propertyTypesReference && (c.dataLoaderList.propertyTypesReference = !0, p.getInstance(R).getPropertyTypes().then((h) => {
4706
4720
  c.propertyTypesReference = h;
4707
4721
  }).catch(m)), c.propertyTypesReference;
4708
- }), O = C(() => {
4722
+ }), d = C(() => {
4709
4723
  const c = v();
4710
4724
  return !c.priceCoefficientsReference && !c.dataLoaderList.priceCoefficientsReference && (c.dataLoaderList.priceCoefficientsReference = !0, p.getInstance(R).getPriceCoefficients().then((h) => {
4711
4725
  c.priceCoefficientsReference = h;
@@ -4779,7 +4793,7 @@ const v = oe("__references_private", () => {
4779
4793
  /**
4780
4794
  * Справочник коэффициентов цен.
4781
4795
  */
4782
- priceCoefficientsReference: O
4796
+ priceCoefficientsReference: d
4783
4797
  };
4784
4798
  }), Qr = oe("__user_state_private", () => {
4785
4799
  const i = w({}), r = w(void 0);
@@ -4877,7 +4891,7 @@ class as {
4877
4891
  export {
4878
4892
  Ir as AnyReference,
4879
4893
  ns as AppBaseConfig,
4880
- d as AppConfigProvider,
4894
+ O as AppConfigProvider,
4881
4895
  Ce as BankAccount,
4882
4896
  Ae as BasePaginationProvider,
4883
4897
  X as Cart,
@@ -4953,7 +4967,7 @@ export {
4953
4967
  Nr as OrderStatus,
4954
4968
  Cs as OrdersDataProvider,
4955
4969
  M as PartnerGroup,
4956
- dr as PaymentType,
4970
+ Or as PaymentType,
4957
4971
  os as PreferencesStorageProvider,
4958
4972
  br as PriceCoefficientEnum,
4959
4973
  _r as PriceTemplate,
@@ -4963,12 +4977,12 @@ export {
4963
4977
  x as Product,
4964
4978
  us as ProductCategoryDataProvider,
4965
4979
  ps as ProductDataProvider,
4966
- Or as ProductFileType,
4980
+ dr as ProductFileType,
4967
4981
  De as ProductPriceCoefficient,
4968
4982
  Mr as ProductPriceHistory,
4969
4983
  fs as PropertiesProvider,
4970
4984
  J as Property,
4971
- Oe as PropertyType,
4985
+ de as PropertyType,
4972
4986
  $r as PropertyTypeEnum,
4973
4987
  F as PropertyValue,
4974
4988
  ys as RecommendationsDataProvider,
@@ -4986,7 +5000,7 @@ export {
4986
5000
  Pe as TypedInstanceFactory,
4987
5001
  Le as UnitsHelper,
4988
5002
  Ps as UnknownClientDataProvider,
4989
- de as UpdatableNamedIdentity,
5003
+ Oe as UpdatableNamedIdentity,
4990
5004
  qr as User,
4991
5005
  Me as UserCommonInfo,
4992
5006
  Gr as UserDataProvider,