Sha256: 2f76b4627c764e0b49460d8116cca6403a5304054dae8a23ea9f5b02e21b6f21

Contents?: true

Size: 1.71 KB

Versions: 30

Compression:

Stored size: 1.71 KB

Contents

# frozen_string_literal: true

module Script
  module Layers
    module Application
      class ExtensionPoints
        class << self
          def get(type:)
            extension_point_repository.get_extension_point(type)
          end

          def types
            extension_point_repository.extension_point_types
          end

          def available_types
            available_extension_points.map(&:type)
          end

          def deprecated_types
            extension_point_repository
              .extension_points
              .select(&:deprecated?)
              .map(&:type)
          end

          def all_languages
            available_extension_points
              .map { |ep| ep.library_languages(include_betas: include_beta_languages?) }
              .flatten
              .uniq
          end

          def languages(type:)
            get(type: type).library_languages(include_betas: include_beta_languages?)
          end

          def supported_language?(type:, language:)
            languages(type: type).include?(language.downcase)
          end

          private

          def available_extension_points
            extension_point_repository.extension_points.select do |ep|
              next false if ep.deprecated?
              ep.stable? || include_beta_extension_points?
            end
          end

          def extension_point_repository
            Infrastructure::ExtensionPointRepository.new
          end

          def include_beta_languages?
            ShopifyCLI::Feature.enabled?(:scripts_beta_languages)
          end

          def include_beta_extension_points?
            ShopifyCLI::Feature.enabled?(:scripts_beta_extension_points)
          end
        end
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
shopify-cli-2.14.0 lib/project_types/script/layers/application/extension_points.rb
shopify-cli-2.13.0 lib/project_types/script/layers/application/extension_points.rb
shopify-cli-2.12.0 lib/project_types/script/layers/application/extension_points.rb
shopify-cli-2.11.2 lib/project_types/script/layers/application/extension_points.rb
shopify-cli-2.11.1 lib/project_types/script/layers/application/extension_points.rb
shopify-cli-2.11.0 lib/project_types/script/layers/application/extension_points.rb
shopify-cli-2.10.2 lib/project_types/script/layers/application/extension_points.rb
shopify-cli-2.10.1 lib/project_types/script/layers/application/extension_points.rb
shopify-cli-2.10.0 lib/project_types/script/layers/application/extension_points.rb
shopify-cli-2.9.0 lib/project_types/script/layers/application/extension_points.rb