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