private getUpdateTypeFromPropertySpec()

in packages/@aws-c2a/engine/lib/platform-mapping/cloudformation/cf-resource.ts [63:88]


  private getUpdateTypeFromPropertySpec(
    property: schema.Property,
    propertyPath: string[],
    scopeUpdateType?: ComponentUpdateType,
  ): ComponentUpdateType {

    const updateType = this.cfUpdateTypeToComponentUpdateType(property.UpdateType ?? 'Mutable', scopeUpdateType);

    if(propertyPath.length === 1 || updateType === ComponentUpdateType.NONE){
      return updateType;
    }

    const nextPropertyPath = isListProperty(property) ? propertyPath.slice(2) : propertyPath.slice(1);
    const itemType = (property as Record<string, string>).ItemType;

    if(itemType){
      const propertySpec = cfSpec.PropertyTypes[[this.resourceType, itemType].join('.')];
      if(propertySpec && isRecordType(propertySpec)){
        const nextProperty = propertySpec.Properties[nextPropertyPath[0]];
        if(nextProperty) {
          return this.getUpdateTypeFromPropertySpec(nextProperty, nextPropertyPath, updateType);
        }
      }
    }
    return ComponentUpdateType.NONE;
  }