eservices-core 1.0.553 → 1.0.555

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.
@@ -16,6 +16,10 @@ export default class dataService {
16
16
  * Используется для получения списка items.
17
17
  * */
18
18
  static getList<T>(entity: string, options?: Partial<IListOptions>): Promise<T[]>;
19
+ /**
20
+ * @description Возвращает Number - количество записей сущности
21
+ * */
22
+ static getCount(entity: string, options?: Partial<IListOptions>): Promise<number>;
19
23
  /**
20
24
  * @description Creating entity.
21
25
  * */
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * eservices-core v1.0.553
2
+ * eservices-core v1.0.555
3
3
  * (c) 2023 ESERVICES
4
4
  */
5
5
  'use strict';
@@ -2589,6 +2589,52 @@ class dataService {
2589
2589
  });
2590
2590
  });
2591
2591
  }
2592
+ /**
2593
+ * @description Возвращает Number - количество записей сущности
2594
+ * */
2595
+ static getCount(entity, options) {
2596
+ const queryUrl = new URLSearchParams();
2597
+ /**
2598
+ * Добавляет fields query к запросы
2599
+ * */
2600
+ function appendFieldsParam(query, fields) {
2601
+ const add = (v) => queryUrl.append('fields', v);
2602
+ if (typeof fields === 'string')
2603
+ return add(fields);
2604
+ if (Array.isArray(fields))
2605
+ return add(fields.join(' '));
2606
+ if (typeof fields === 'object')
2607
+ return add(Object.keys(fields).join(' '));
2608
+ }
2609
+ function appendOrder(query, order) {
2610
+ if (!order)
2611
+ return;
2612
+ if (!Object.keys(order).length)
2613
+ return;
2614
+ const orderStr = Object.entries(order)
2615
+ .map(([name, direction]) => `@${name} ${direction}`)
2616
+ .join(',');
2617
+ query.append('order', orderStr);
2618
+ }
2619
+ if (options) {
2620
+ appendFieldsParam(queryUrl, options.fields);
2621
+ appendOrder(queryUrl, options.order);
2622
+ if (options.limit)
2623
+ queryUrl.append('limit', options.limit.toString());
2624
+ if (options.offset)
2625
+ queryUrl.append('offset', options.offset.toString());
2626
+ if (options.filter)
2627
+ queryUrl.append('filter', options.filter.toString());
2628
+ if (options.useUsageContext)
2629
+ queryUrl.append('useUsageContext', options.useUsageContext.toString());
2630
+ }
2631
+ return Request(`/close-api/data/entities/${entity}/count?${queryUrl.toString()}`, {
2632
+ method: 'GET',
2633
+ headers: {
2634
+ 'Content-Type': 'application/json',
2635
+ },
2636
+ });
2637
+ }
2592
2638
  /**
2593
2639
  * @description Creating entity.
2594
2640
  * */
@@ -4025,9 +4071,9 @@ var script$d = /*#__PURE__*/ vue.defineComponent({
4025
4071
  'widget-list-body_inactive': __props.wait
4026
4072
  }])
4027
4073
  }, [
4028
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.array, (values, index) => {
4074
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.array, (values) => {
4029
4075
  return (vue.openBlock(), vue.createBlock(script$f, {
4030
- key: index,
4076
+ key: values,
4031
4077
  class: "widget-list-row",
4032
4078
  values: values,
4033
4079
  config: __props.config
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eservices-core",
3
- "version": "1.0.553",
3
+ "version": "1.0.555",
4
4
  "description": "Core library",
5
5
  "author": "",
6
6
  "scripts": {