import {BlueprintURLs, ResourceDictionaryURLs} from '../../../../common/constants/app-constants';
import {PackagesApiService} from '../packages-api.service';
import {PackagesStore} from '../packages.store';
+import {ResourceDictionary} from './mapping-models/ResourceDictionary.model';
@Injectable({
providedIn: 'root'
return this.api.post(BlueprintURLs.save, body, {responseType: 'text'});
}
+ private enrichBlueprint(body: any | null, options?: any): Observable<any> {
+ return this.api.post(BlueprintURLs.enrich, body, {responseType: 'text'});
+ }
+
async checkBluePrintNameAndVersion(name: string, version: string): Promise<boolean> {
return await this.packagesListService.checkBluePrintIfItExists(name, version)
.then(bluePrintModelsResult => bluePrintModelsResult != null && bluePrintModelsResult.length > 0);
}
savePackage(blob) {
+ const formData = this.getFormData(blob);
+ return this.saveBlueprint(formData);
+ }
+
+ enrichPackage(blob) {
+ const formData = this.getFormData(blob);
+ return this.enrichBlueprint(formData);
+ }
+ private getFormData(blob) {
const formData = new FormData();
formData.append('file', blob);
- this.saveBlueprint(formData)
- .subscribe(
- data => {
- console.log('Success:' + JSON.stringify(data));
- }, error => {
- console.log('Error -' + error.message);
- });
+ return formData;
}
- getTemplateAndMapping(variables: string[]): Observable<any> {
+ getTemplateAndMapping(variables: string[]): Observable<ResourceDictionary[]> {
return this.api.post(ResourceDictionaryURLs.searchResourceDictionaryByNames, variables);
}
}