dochub-sdk 0.1.159 → 0.1.161

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.
@@ -1,6 +1,7 @@
1
1
  /* eslint-disable no-unused-vars */
2
2
  import { Vue, Prop, Watch, Component } from 'vue-property-decorator';
3
- import { DocHub, IDocHubEditableComponent, IDocHubPresentationProfile, IDocHubPresentationsParams } from '../..';
3
+ import { DocHub } from '../..';
4
+ import type { IDocHubEditableComponent, IDocHubPresentationProfile, IDocHubPresentationsParams } from '../..';
4
5
 
5
6
  import ajv from 'ajv';
6
7
  import ajv_localize from 'ajv-i18n/localize/ru';
@@ -9,7 +10,8 @@ import ajv_localize from 'ajv-i18n/localize/ru';
9
10
  export class DocHubDocumentProto extends Vue implements IDocHubEditableComponent {
10
11
  onRefresher: any = null; // Таймер отложенного выполнения обновления
11
12
  followURI: string | null = null; // URI файла за которым установлено слежение
12
- error: string | null = null; // Ошибка
13
+ error: string | null = null; // Ошибка
14
+ isPending = true; // Признак внутренней работы. Например загрузка данных.
13
15
 
14
16
  /**
15
17
  * Профиль документа
@@ -84,27 +86,29 @@ export class DocHubDocumentProto extends Vue implements IDocHubEditableComponent
84
86
  */
85
87
  async doRefresh(): Promise<void> {
86
88
  try {
89
+ this.isPending = true;
87
90
  await this.refreshFileFollow();
88
91
  if (this.profile?.source) {
89
- DocHub.dataLake.pullData(this.profile.source, this.params).then(async(result) => {
90
- // Валидируем данные по структуре
91
- const rules = new ajv({ allErrors: true });
92
- const validator = rules.compile(this.getSchemaData());
93
- if (!validator(result)) {
94
- ajv_localize(validator.errors);
95
- this.error = JSON.stringify(validator.errors, null, 4);
96
- return;
97
- }
98
- // Если все в порядке, вызываем процессинг данных
99
- this.processingData(result);
100
- this.error = null;
101
- });
92
+ const result = await DocHub.dataLake.pullData(this.profile.source, this.params);
93
+ // Валидируем данные по структуре
94
+ const rules = new ajv({ allErrors: true });
95
+ const validator = rules.compile(this.getSchemaData());
96
+ if (!validator(result)) {
97
+ ajv_localize(validator.errors);
98
+ this.error = JSON.stringify(validator.errors, null, 4);
99
+ return;
100
+ }
101
+ // Если все в порядке, вызываем процессинг данных
102
+ this.processingData(result);
103
+ this.error = null;
102
104
  } else this.processingData(undefined);
103
105
  } catch (error) {
104
106
  // eslint-disable-next-line no-console
105
107
  console.error(error);
106
108
  this.error = error;
107
109
  this.processingData(undefined);
110
+ } finally {
111
+ this.isPending = false;
108
112
  }
109
113
  }
110
114
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dochub-sdk",
3
- "version": "0.1.159",
3
+ "version": "0.1.161",
4
4
  "description": "The DocHub System Development Kit.",
5
5
  "private": false,
6
6
  "main": "index.ts",