gitlab-cloud-connector 1.31.0 → 1.32.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7a03e541468f29317840e04821e2cab6fb78f1288ef4584e75d0e5e493f32f61
4
- data.tar.gz: 2045b3aba0703d05a6be223836007901bd01df78ed1a670c54eff2e9f1ad9980
3
+ metadata.gz: c4b754e732653e937997ea041260c3f1d9386f3126914fe9f6b7f7e9863ac2a7
4
+ data.tar.gz: add25f8293e1df30744b6e165bdd3b3ecd410b02407399dc19a2128cbe4efdad
5
5
  SHA512:
6
- metadata.gz: 0b266e25555a0c825545eaeee746508ef96d2243e1dce2bd56025a90e117f2e5b79e29445c4b7f0d562c057a3f48613a5d97e6c1d22474c4413c584510429108
7
- data.tar.gz: 44e9018e64dd651b8242c07205cd2cad340c78645d38e16f998bf61736989161ffbc0a5990eb9a164dc3aa64ccc85280df9861b4abac151fb6b9d31b00ebf152
6
+ metadata.gz: 128ea70bcbb3e2a62806960fc61dc4e7e68abad8fc7b623abd1707c6644098dba018b42758f5ce5ac4eada46ebf6985a7b6ebd05c428751c3b286c602ae53945
7
+ data.tar.gz: a1764ebeacf9689195080a44344baffe5373d0456c9596304998a4b1a55ccd2467b9709f170e4a1148500448294c0cfd8ca37db2756cb942021b8ed5a81c9ee5
@@ -15,6 +15,12 @@
15
15
  "type": "string"
16
16
  }
17
17
  },
18
+ "alias_names": {
19
+ "type": "array",
20
+ "items": {
21
+ "type": "string"
22
+ }
23
+ },
18
24
  "backend_services": {
19
25
  "type": "array",
20
26
  "items": {
@@ -9,3 +9,5 @@ backend_services:
9
9
  - ai_gateway
10
10
  add_ons:
11
11
  - duo_enterprise
12
+ alias_names:
13
+ - generate_description
@@ -8,13 +8,36 @@ module Gitlab
8
8
  @model_class = model_class
9
9
  end
10
10
 
11
- def load!
12
- raise NotImplementedError, "#{self.class} must implement #load!"
11
+ def load_with_index!
12
+ with_cache do
13
+ build_name_index(load!)
14
+ end
13
15
  end
14
16
 
15
17
  protected
16
18
 
17
19
  attr_reader :model_class
20
+
21
+ def load!
22
+ raise NotImplementedError, "#{self.class} must implement #load!"
23
+ end
24
+
25
+ # Optional: subclasses can wrap caching around the computation
26
+ def with_cache
27
+ yield
28
+ end
29
+
30
+ def build_name_index(records)
31
+ records.each_with_object({}) do |record, index|
32
+ index[record.name.to_sym] = record
33
+
34
+ next unless record.respond_to?(:alias_names)
35
+
36
+ record.alias_names&.each do |alias_name|
37
+ index[alias_name.to_sym] = record
38
+ end
39
+ end
40
+ end
18
41
  end
19
42
  end
20
43
  end
@@ -19,15 +19,19 @@ module Gitlab
19
19
  end
20
20
 
21
21
  def find_by_name(name)
22
- all.find { |record| record.name.to_sym == name }
22
+ name_index[name.to_sym]
23
23
  end
24
24
 
25
25
  def all
26
- data_loader.load!
26
+ name_index.values.uniq
27
27
  end
28
28
 
29
29
  private
30
30
 
31
+ def name_index
32
+ data_loader.load_with_index!
33
+ end
34
+
31
35
  def data_loader
32
36
  @data_loader ||= Configuration.data_loader_class.new(self)
33
37
  end
@@ -10,14 +10,14 @@ module Gitlab
10
10
  class YamlDataLoader < AbstractDataLoader
11
11
  include Overridable
12
12
 
13
+ protected
14
+
13
15
  def load!
14
- load_data_from_files
16
+ Dir.glob(data_files_path).map { |file| load_model_from_file(file) }
15
17
  end
16
18
 
17
- private
18
-
19
- def load_data_from_files
20
- @load_data_from_files ||= Dir.glob(data_files_path).map { |file| load_model_from_file(file) }
19
+ def with_cache
20
+ @name_index ||= yield
21
21
  end
22
22
 
23
23
  def data_files_path
@@ -10,9 +10,9 @@ module Gitlab
10
10
  # Returns a hash of all data objects loaded from YAML files.
11
11
  def self.load_all(loader_class: YamlDataLoader)
12
12
  Base.subclasses.each_with_object({}) do |clazz, h|
13
- data_obj = loader_class.new(clazz).load!
13
+ data_obj = loader_class.new(clazz).load_with_index!
14
14
  key = clazz.name.demodulize.pluralize.underscore.to_sym
15
- h[key] = data_obj.map(&:to_hash)
15
+ h[key] = data_obj.values.uniq.map(&:to_hash)
16
16
  end
17
17
  end
18
18
 
@@ -23,7 +23,7 @@ module Gitlab
23
23
 
24
24
  attr_reader :cut_off_date, :deprecated_by_url, :deprecation_message, :description, :documentation_url,
25
25
  :feature_category, :group, :introduced_by_url, :milestone, :min_gitlab_version,
26
- :min_gitlab_version_for_free_access, :name, :unit_primitive_issue_url
26
+ :min_gitlab_version_for_free_access, :name, :unit_primitive_issue_url, :alias_names
27
27
  end
28
28
 
29
29
  class Service < Base
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Gitlab
4
4
  module CloudConnector
5
- VERSION = '1.31.0'
5
+ VERSION = '1.32.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-cloud-connector
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.31.0
4
+ version: 1.32.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nikola Milojevic
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-08-29 00:00:00.000000000 Z
11
+ date: 2025-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport