optify-config 0.7.0-arm64-darwin → 0.8.0-arm64-darwin

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: 26e13c114d43d7ec709b17fec27915f06dfaa4c181a3ae48ea44465563a0cf74
4
- data.tar.gz: 4bc469738ebba83a34d12e43ff77386b11f0359ebd3ef7d92cbb34f251ada859
3
+ metadata.gz: 8809dd37472d1416cb39d809ea61f5c9aaff225ca963942d658266196451c7dd
4
+ data.tar.gz: 6b3aea9faa9e7a3cb736442161cc9b3a83a68e3e27117fa093769bf037066050
5
5
  SHA512:
6
- metadata.gz: 213631c0e929f1da0c8caea040b53c90a25a734c4445550cddae01a72303c48925224a0457ab681ec08ae9284f95ff668cefccb14e20c8747e502bab1cead847
7
- data.tar.gz: 9d53de661a86c0182b82f3e0886b9fdab7fdce249efad637db8776979f124d1f49d62659e0a64a9d2eadc93c00994ce75ea2af8a9a793ffef738130419887d6a
6
+ metadata.gz: 29c7194f1b9ae79297b01877ab70b605ea4ecca59c23abcc61466a01a4ee42af041b5840aa889592f7c5bac53481c5eba985f8efc1e97bf420853ca4a14d25fe
7
+ data.tar.gz: '09984dfb9cb8f5805832423840ea11e75261aa32a5dda886429907429bb944ed1181fb101a626408bc1085eb6dede595af1b4e214f8a76d7293faa1dd18887c9'
Binary file
Binary file
Binary file
@@ -38,16 +38,12 @@ module Optify
38
38
  def self._convert_value(value, type)
39
39
  case value
40
40
  when Array
41
- type = if type.type.respond_to?(:unwrap_nilable)
42
- # Handle nilable array.
43
- type.type.unwrap_nilable
44
- else
45
- # Handle array of 1 type.
46
- type.type
47
- end
48
- return value.map { |v| _convert_value(v, type) }.freeze
41
+ # Handle `T.nilable(T::Array[...])`
42
+ type = type.unwrap_nilable if type.respond_to?(:unwrap_nilable)
43
+ inner_type = type.type
44
+ return value.map { |v| _convert_value(v, inner_type) }.freeze
49
45
  when Hash
50
- # Handle nilable hash.
46
+ # Handle `T.nilable(T::Hash[...])`
51
47
  type = type.unwrap_nilable if type.respond_to?(:unwrap_nilable)
52
48
  return _convert_hash(value, type).freeze
53
49
  end
@@ -6,6 +6,7 @@ require 'json'
6
6
  require 'sorbet-runtime'
7
7
 
8
8
  require_relative './base_config'
9
+ require_relative './options_metadata'
9
10
 
10
11
  # Tools for working with configurations declared in files.
11
12
  module Optify
@@ -18,6 +19,28 @@ module Optify
18
19
  class OptionsProvider
19
20
  extend T::Sig
20
21
 
22
+ #: -> Hash[String, OptionsMetadata]
23
+ def features_with_metadata
24
+ return @features_with_metadata if @features_with_metadata
25
+
26
+ result = JSON.parse(features_with_metadata_json)
27
+ result.each do |key, value|
28
+ result[key] = OptionsMetadata.from_hash(value)
29
+ end
30
+ result.freeze
31
+
32
+ @features_with_metadata = T.let(result, T.nilable(T::Hash[String, OptionsMetadata]))
33
+ result
34
+ end
35
+
36
+ #: (String canonical_feature_name) -> Optify::OptionsMetadata?
37
+ def get_feature_metadata(canonical_feature_name)
38
+ metadata_json = get_feature_metadata_json(canonical_feature_name)
39
+ return nil if metadata_json.nil?
40
+
41
+ OptionsMetadata.from_hash(JSON.parse(metadata_json))
42
+ end
43
+
21
44
  # Fetches options based on the provided key and feature names.
22
45
  #
23
46
  # @param key The key to fetch options for.
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+ # typed: true
3
+
4
+ require 'sorbet-runtime'
5
+
6
+ require_relative './base_config'
7
+
8
+ module Optify
9
+ # Information about a feature.
10
+ class OptionsMetadata < BaseConfig
11
+ sig { returns(T.nilable(T::Array[String])) }
12
+ attr_reader :aliases
13
+
14
+ sig { returns(T.untyped) }
15
+ attr_reader :details
16
+
17
+ sig { returns(String) }
18
+ attr_reader :name
19
+
20
+ sig { returns(T.nilable(String)) }
21
+ attr_reader :owners
22
+ end
23
+ end
data/rbi/optify.rbi CHANGED
@@ -26,6 +26,21 @@ module Optify
26
26
  class CacheOptions < BaseConfig
27
27
  end
28
28
 
29
+ # Information about a feature.
30
+ class OptionsMetadata < BaseConfig
31
+ sig { returns(T.nilable(T::Array[String])) }
32
+ def aliases; end
33
+
34
+ sig { returns(T.untyped) }
35
+ def details; end
36
+
37
+ sig { returns(String) }
38
+ def name; end
39
+
40
+ sig { returns(T.nilable(String)) }
41
+ def owners; end
42
+ end
43
+
29
44
  # Preferences when getting options.
30
45
  class GetOptionsPreferences
31
46
  sig { params(value: T::Boolean).returns(GetOptionsPreferences) }
@@ -40,6 +55,10 @@ module Optify
40
55
  sig { returns(T::Array[String]) }
41
56
  def features; end
42
57
 
58
+ # @return All of the keys and values for the the features.
59
+ sig { returns(T::Hash[String, OptionsMetadata]) }
60
+ def features_with_metadata; end
61
+
43
62
  # @return All of the keys and values for the the features.
44
63
  sig do
45
64
  params(feature_names: T::Array[String], preferences: GetOptionsPreferences)
@@ -55,6 +74,10 @@ module Optify
55
74
  sig { params(feature_name: String).returns(String) }
56
75
  def get_canonical_feature_name(feature_name); end
57
76
 
77
+ # @return The metadata for the feature.
78
+ sig { params(canonical_feature_name: String).returns(T.nilable(OptionsMetadata)) }
79
+ def get_feature_metadata(canonical_feature_name); end
80
+
58
81
  # Fetches options based on the provided key and feature names.
59
82
  #
60
83
  # @param key The key to fetch options for.
@@ -101,6 +124,16 @@ module Optify
101
124
  # @return [OptionsProvider] `self`.
102
125
  sig { returns(OptionsProvider) }
103
126
  def init; end
127
+
128
+ private
129
+
130
+ # @return The metadata for the feature.
131
+ sig { params(canonical_feature_name: String).returns(T.nilable(String)) }
132
+ def get_feature_metadata_json(canonical_feature_name); end
133
+
134
+ # @return All of the keys and values for the the features.
135
+ sig { returns(String) }
136
+ def features_with_metadata_json; end
104
137
  end
105
138
 
106
139
  # A builder for creating an `OptionsProvider` instance.
data/sig/optify.rbs CHANGED
@@ -22,6 +22,17 @@ end
22
22
  class Optify::CacheOptions < BaseConfig
23
23
  end
24
24
 
25
+ # Information about a feature.
26
+ class Optify::OptionsMetadata < BaseConfig
27
+ def aliases: () -> ::Array[String]?
28
+
29
+ def details: () -> untyped
30
+
31
+ def name: () -> String
32
+
33
+ def owners: () -> String?
34
+ end
35
+
25
36
  # Preferences when getting options.
26
37
  class Optify::GetOptionsPreferences
27
38
  def skip_feature_name_conversion=: (bool value) -> GetOptionsPreferences
@@ -34,6 +45,9 @@ class Optify::OptionsProvider
34
45
  # @return All of the canonical feature names.
35
46
  def features: () -> ::Array[String]
36
47
 
48
+ # @return All of the keys and values for the the features.
49
+ def features_with_metadata: () -> ::Hash[String, OptionsMetadata]
50
+
37
51
  def get_all_options_json: (::Array[String] feature_names, GetOptionsPreferences preferences) -> String
38
52
 
39
53
  # Map an alias or canonical feature name (perhaps derived from a file name) to a canonical feature name.
@@ -43,6 +57,9 @@ class Optify::OptionsProvider
43
57
  # @return The canonical feature name.
44
58
  def get_canonical_feature_name: (String feature_name) -> String
45
59
 
60
+ # @return The metadata for the feature.
61
+ def get_feature_metadata: (String canonical_feature_name) -> OptionsMetadata?
62
+
46
63
  def get_options: [Config] (String key, ::Array[String] feature_names, T::Class[Config] config_class, ?CacheOptions? cache_options, ?Optify::GetOptionsPreferences? preferences) -> Config
47
64
 
48
65
  # Fetches options in JSON format based on the provided key and feature names.
@@ -57,6 +74,12 @@ class Optify::OptionsProvider
57
74
  # (Optional) Eagerly initializes the cache.
58
75
  # @return [OptionsProvider] `self`.
59
76
  def init: () -> OptionsProvider
77
+
78
+ # @return The metadata for the feature.
79
+ def get_feature_metadata_json: (String canonical_feature_name) -> String?
80
+
81
+ # @return All of the keys and values for the the features.
82
+ def features_with_metadata_json: () -> String
60
83
  end
61
84
 
62
85
  # A builder for creating an `OptionsProvider` instance.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: optify-config
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: arm64-darwin
6
6
  authors:
7
7
  - Justin D. Harris
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-03-03 00:00:00.000000000 Z
11
+ date: 2025-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sorbet-runtime
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.5.11851
19
+ version: 0.5.11911
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.5.11851
26
+ version: 0.5.11911
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake-compiler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.5.11851
61
+ version: 0.5.11911
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.5.11851
68
+ version: 0.5.11911
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: tapioca
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +108,7 @@ files:
108
108
  - lib/optify_ruby/3.4/optify_ruby.bundle
109
109
  - lib/optify_ruby/base_config.rb
110
110
  - lib/optify_ruby/implementation.rb
111
+ - lib/optify_ruby/options_metadata.rb
111
112
  - rbi/optify.rbi
112
113
  - sig/optify.rbs
113
114
  homepage: https://github.com/juharris/optify