dochub-sdk 0.1.359 → 0.1.360
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.
@@ -170,18 +170,19 @@ export class DocHubDocumentProto extends DocHubComponentProto implements IDocHub
|
|
170
170
|
*/
|
171
171
|
async doRefresh(): Promise<void> {
|
172
172
|
try {
|
173
|
-
if (!this.
|
173
|
+
if (!this.profile?.source) throw new DocHubError('Document must have field "source" in profile!');
|
174
174
|
this.isPending = true;
|
175
175
|
await this.refreshFilesFollow();
|
176
176
|
// Если есть шаблон, загружаем его
|
177
177
|
const template = (this.getType() === DocHubDocumentType.content) && this.templateURI
|
178
178
|
&& (await DocHub.dataLake.pullFile(this.templateURI));
|
179
|
-
let result: AxiosResponse = (template || (this.getType() === DocHubDocumentType.data))
|
179
|
+
let result: AxiosResponse | null = (template || (this.getType() === DocHubDocumentType.data))
|
180
180
|
&& { data: await DocHub.dataLake.resolveDataSetProfile(this.profile, {
|
181
181
|
params: this.params,
|
182
182
|
baseURI: this.baseURI
|
183
183
|
}) } as AxiosResponse
|
184
|
-
|| await DocHub.dataLake.pullFile(this.sourceURI);
|
184
|
+
|| (this.sourceURI ? await DocHub.dataLake.pullFile(this.sourceURI) : null);
|
185
|
+
if (!result) throw new DocHubError(`Can not render document [${this.profile?.$base}]`);
|
185
186
|
// Валидируем данные по структуре, если это требуется
|
186
187
|
if (template || (this.getType() === DocHubDocumentType.data)) {
|
187
188
|
const rules = new ajv({ allErrors: true });
|
@@ -243,7 +244,6 @@ export class DocHubDocumentProto extends DocHubComponentProto implements IDocHub
|
|
243
244
|
if (!this.templateURI) throw new DocHubError(`Can not resolve template URI for path [${templatePath}]`);
|
244
245
|
followFiles.push(this.templateURI);
|
245
246
|
} else if (typeof this.profile?.source === 'string' && this.getType() === DocHubDocumentType.content) {
|
246
|
-
debugger;
|
247
247
|
// Если шаблона нет, но документ предполагает работу с содержимым файла, то отслеживаем source
|
248
248
|
const sourcePath = [...baseStruct, 'source'].join('/');
|
249
249
|
this.sourceURI = (await DocHub.dataLake.getURIForPath(sourcePath) || []).pop()
|