@veloceapps/api 9.0.0-6 → 9.0.0-8

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.
@@ -403,7 +403,7 @@ class ConfigurationApiService {
403
403
  if (runtimeModel) {
404
404
  return {
405
405
  ...configurePrice,
406
- lineItem: this.updatePortDomains(configurePrice.lineItem, runtimeModel),
406
+ lineItem: this.updateDomains(configurePrice.lineItem, runtimeModel),
407
407
  };
408
408
  }
409
409
  else {
@@ -423,7 +423,7 @@ class ConfigurationApiService {
423
423
  if (runtimeModel) {
424
424
  return {
425
425
  ...configurePrice,
426
- lineItem: this.updatePortDomains(configurePrice.lineItem, runtimeModel),
426
+ lineItem: this.updateDomains(configurePrice.lineItem, runtimeModel),
427
427
  };
428
428
  }
429
429
  else {
@@ -450,11 +450,11 @@ class ConfigurationApiService {
450
450
  url: `${this.SERVICE_URL}/${modelId}/model-test`,
451
451
  });
452
452
  }
453
- updatePortDomains(lineItem, runtimeModel) {
454
- const type = runtimeModel.components.get(lineItem.type);
453
+ updateDomains(lineItem, runtimeModel) {
454
+ const component = runtimeModel.components.get(lineItem.type);
455
455
  const portDomains = { ...lineItem.portDomains };
456
456
  // loop through ports to look for 'None' type domain computations
457
- for (const port of type?.ports ?? []) {
457
+ for (const port of component?.ports ?? []) {
458
458
  const { name: portName, type: typeName, min, max, domainTypes, properties } = port;
459
459
  const portDomain = portDomains[portName];
460
460
  if (portDomain) {
@@ -478,9 +478,25 @@ class ConfigurationApiService {
478
478
  };
479
479
  }
480
480
  }
481
+ const type = runtimeModel.types.find(({ name }) => {
482
+ return lineItem.type === name;
483
+ });
484
+ const attributeDomains = lineItem.attributeDomains;
485
+ if (type) {
486
+ const initialDomains = lineItem.attributeDomains;
487
+ type.attributes.forEach(attribute => {
488
+ if (Object.prototype.hasOwnProperty.call(initialDomains, attribute.name)) {
489
+ return;
490
+ }
491
+ if (attribute.attributeDomain) {
492
+ attributeDomains[attribute.name] = attribute.attributeDomain;
493
+ }
494
+ });
495
+ }
481
496
  return {
482
497
  ...lineItem,
483
- lineItems: lineItem.lineItems?.map(i => this.updatePortDomains(i, runtimeModel)),
498
+ lineItems: lineItem.lineItems?.map(i => this.updateDomains(i, runtimeModel)),
499
+ attributeDomains,
484
500
  portDomains,
485
501
  };
486
502
  }