foobara 0.0.139 → 0.0.141

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: d8006a38d251e55d5412171c8b420ef424bc93bf6ec6a9bc40b4dac34c6d71fe
4
- data.tar.gz: ed9d0a5a764be0a8c51f4a88f311207c18be2186721c0bea5476e3f87b51fd21
3
+ metadata.gz: 338a171937c3133f7c23ce219f6c67a22f464b30727cb0987b88ef8fa2ae0cf9
4
+ data.tar.gz: 89ba9d99021a7914338de39be6a38520849702e33e38d20da39dcce05ce3f9d0
5
5
  SHA512:
6
- metadata.gz: 79d0287f4d63260543b050bf6122ed66f339b981726aae6917731e19467364c3e4a2542546d574e591cac6e464a14379dbaa729dababf0bb9a67eac1488a51be
7
- data.tar.gz: 2deb90d284941caddbdab98a9adf48273d84d9d56ac791ef98907ab8ddaaa6072712f66425387e66e09d4a1ad330179a57ebaa0ac5c73a263af2cbb48d4b0385
6
+ metadata.gz: d6b27814d890df2c4f46455a944c226b054383ec2112ee7fa937c0b25743bd6fbb8f099c973ad3b8f7bc9a0d603be39f9c59e08ada848332213baec8a1a92475
7
+ data.tar.gz: 67cf268318f31ea950e63cdf58f6927853d43b226c70dea0e7b42889442c2dbf1a9925927f623df6e673e386fe9ad9d53c4b823f822e3a138bc040cf1d9bc78f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ # [0.0.141] - 2025-07-31
2
+
3
+ - Fix bug returning a non-strict type declaration in the command connector manifest
4
+ - Support using :attributes as a type to permit anything with symbolizable keys
5
+ - Fix buggy global domain in command connector manifest
6
+
7
+ # [0.0.140] - 2025-07-25
8
+
9
+ - Support result :array, &block style for declaring result type
10
+ - Fix bug preventing using lambdas in attributes DSL
11
+
1
12
  # [0.0.139] - 2025-07-23
2
13
 
3
14
  - Add back an ErrorCollection method that some external projects depend on
@@ -72,11 +72,11 @@ module Foobara
72
72
  possible_errors:,
73
73
  depends_on:,
74
74
  # TODO: allow inputs type to be nil or really any type?
75
- inputs_type: inputs_type&.reference_or_declaration_data || {
75
+ inputs_type: inputs_type&.reference_or_declaration_data || GlobalDomain.foobara_type_from_declaration(
76
76
  type: "::attributes",
77
77
  element_type_declarations: {},
78
78
  required: []
79
- }
79
+ ).declaration_data
80
80
  ).merge(description:)
81
81
 
82
82
  if result_type
@@ -628,7 +628,7 @@ module Foobara
628
628
  fixed_scoped_path = error.scoped_full_path[index..]
629
629
  fixed_scoped_name = fixed_scoped_path.join("::")
630
630
  fixed_scoped_prefix = fixed_scoped_path[..-2]
631
- fixed_parent = [:domain, domain.full_domain_name]
631
+ fixed_parent = [:domain, domain.reference]
632
632
 
633
633
  error.relevant_manifest.merge(
634
634
  parent: fixed_parent,
@@ -3,7 +3,7 @@ require_relative "type_declaration"
3
3
  module Foobara
4
4
  module Manifest
5
5
  class Attributes < TypeDeclaration
6
- optional_keys :required, :defaults
6
+ optional_keys :required, :defaults, :element_type_declarations
7
7
 
8
8
  alias attributes_manifest relevant_manifest
9
9
 
@@ -19,6 +19,10 @@ module Foobara
19
19
  DataPath.value_at([:defaults, attribute_name], attributes_manifest)
20
20
  end
21
21
 
22
+ def has_attribute_declarations?
23
+ !element_type_declarations.nil?
24
+ end
25
+
22
26
  def attribute_declarations
23
27
  element_type_declarations.keys.to_h do |attribute_name|
24
28
  [
@@ -46,7 +46,7 @@ module Foobara
46
46
  attr_accessor :_method_missing_disabled
47
47
 
48
48
  def _to_declaration(&)
49
- instance_eval(&)
49
+ instance_exec(&)
50
50
  _type_declaration
51
51
  end
52
52
 
@@ -4,6 +4,13 @@ module Foobara
4
4
  module TypeDeclarations
5
5
  module SensitiveTypeRemovers
6
6
  class Attributes < SensitiveTypeRemover
7
+ def applicable?(strict_type_declaration)
8
+ return false unless super
9
+
10
+ element_type_declarations = strict_type_declaration[:element_type_declarations]
11
+ element_type_declarations && !element_type_declarations.empty?
12
+ end
13
+
7
14
  def transform(strict_type_declaration)
8
15
  to_change = {}
9
16
  to_remove = []
@@ -6,13 +6,15 @@ module Foobara
6
6
  # TODO: relocate these to a different file
7
7
  def args_to_type_declaration(*args, &block)
8
8
  if block
9
- unless args.empty?
9
+ if args.empty? || args == [:attributes]
10
+ block
11
+ elsif args == [:array]
12
+ { type: :array, element_type_declaration: block }
13
+ else
10
14
  # :nocov:
11
- raise ArgumentError, "Cannot provide both block and declaration"
15
+ raise ArgumentError, "Cannot provide both block and declaration of #{args}"
12
16
  # :nocov:
13
17
  end
14
-
15
- block
16
18
  else
17
19
  case args.size
18
20
  when 0
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foobara
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.139
4
+ version: 0.0.141
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Georgi
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
10
+ date: 2025-07-31 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: bigdecimal
@@ -535,7 +535,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
535
535
  - !ruby/object:Gem::Version
536
536
  version: '0'
537
537
  requirements: []
538
- rubygems_version: 3.6.9
538
+ rubygems_version: 3.6.2
539
539
  specification_version: 4
540
540
  summary: A command-centric and discoverable software framework with a focus on domain
541
541
  concepts and abstracting away integration code