foobara 0.0.109 → 0.0.111
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 +4 -4
- data/CHANGELOG.md +11 -0
- data/projects/command/src/command_pattern_implementation/concerns/subcommands.rb +2 -1
- data/projects/command/src/transformed_command.rb +16 -4
- data/projects/command_connectors/src/command_connector.rb +1 -1
- data/projects/command_connectors/src/command_registry/exposed_command.rb +16 -0
- data/projects/model/src/concerns/types.rb +4 -0
- data/projects/persistence/src/entity_base/transaction_table/concerns/record_tracking.rb +0 -3
- data/projects/persistence/src/entity_base/transaction_table.rb +0 -4
- data/projects/weak_object_set/src/weak_object_set.rb +28 -10
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 0ff2cd0b6537dbf44f0ef865a8fc6c8ac339d7b306cb67ddfcb744b74d2cb73d
         | 
| 4 | 
            +
              data.tar.gz: cc3a822e6a43b1f2f27070c85fe2a4c07bc6a0274b963816fa3ef55bb531b597
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 4f1a8853b814a569aeaa4ac67d53363fe5349658f9e9f8214f2c05d649154fcc6b60be0f249e2912485dbc0689ade4ae1e67e2e5b913f478ff8a4151756a1542
         | 
| 7 | 
            +
              data.tar.gz: c52ccae166bf419ba503653a29aa4bde3b8094c2ba190f611e877eec13ada47bd787c448db5506def4f5cebb73748a215d4de0d2d6dc30325f5c110347ad12bd
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,3 +1,14 @@ | |
| 1 | 
            +
            # [0.0.111] - 2025-04-25
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            - Fix bug in DomainMapper.depends_on
         | 
| 4 | 
            +
            - Allow mutator instances to be used by connectors not just classes
         | 
| 5 | 
            +
            - Some WeakObjectSet tweaks
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            # [0.0.110] - 2025-04-23
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            - Automatically load associations needed for delegated attributes for
         | 
| 10 | 
            +
              result of commands exposed via command connectors
         | 
| 11 | 
            +
             | 
| 1 12 | 
             
            # [0.0.109] - 2025-04-22
         | 
| 2 13 |  | 
| 3 14 | 
             
            - Support CommandConnector transformers that don't take declaration_data
         | 
| @@ -59,7 +59,8 @@ module Foobara | |
| 59 59 | 
             
                        if subcommand_classes.empty?
         | 
| 60 60 | 
             
                          return @depends_on if defined?(@depends_on)
         | 
| 61 61 |  | 
| 62 | 
            -
                           | 
| 62 | 
            +
                          # TODO: get Command and DomainMapper out of here!
         | 
| 63 | 
            +
                          @depends_on = if self == Foobara::Command || self == Foobara::DomainMapper
         | 
| 63 64 | 
             
                                          Set.new
         | 
| 64 65 | 
             
                                        else
         | 
| 65 66 | 
             
                                          superclass.depends_on.dup
         | 
| @@ -122,8 +122,14 @@ module Foobara | |
| 122 122 |  | 
| 123 123 | 
             
                    mutated_result_type = result_type
         | 
| 124 124 |  | 
| 125 | 
            -
                    response_mutators | 
| 126 | 
            -
             | 
| 125 | 
            +
                    mutators = if response_mutators.size == 1
         | 
| 126 | 
            +
                                 [response_mutator]
         | 
| 127 | 
            +
                               else
         | 
| 128 | 
            +
                                 response_mutator&.processors&.reverse
         | 
| 129 | 
            +
                               end
         | 
| 130 | 
            +
             | 
| 131 | 
            +
                    mutators&.each do |mutator|
         | 
| 132 | 
            +
                      mutated_result_type = mutator.result_type_from(mutated_result_type)
         | 
| 127 133 | 
             
                    end
         | 
| 128 134 |  | 
| 129 135 | 
             
                    @result_type_for_manifest = mutated_result_type
         | 
| @@ -134,8 +140,14 @@ module Foobara | |
| 134 140 |  | 
| 135 141 | 
             
                    mutated_inputs_type = inputs_type
         | 
| 136 142 |  | 
| 137 | 
            -
                    request_mutators | 
| 138 | 
            -
             | 
| 143 | 
            +
                    mutators = if request_mutators.size == 1
         | 
| 144 | 
            +
                                 [request_mutator]
         | 
| 145 | 
            +
                               else
         | 
| 146 | 
            +
                                 request_mutator&.processors&.reverse
         | 
| 147 | 
            +
                               end
         | 
| 148 | 
            +
             | 
| 149 | 
            +
                    mutators&.each do |mutator|
         | 
| 150 | 
            +
                      mutated_inputs_type = mutator.inputs_type_from(mutated_inputs_type)
         | 
| 139 151 | 
             
                    end
         | 
| 140 152 |  | 
| 141 153 | 
             
                    @inputs_type_for_manifest = mutated_inputs_type
         | 
| @@ -90,6 +90,22 @@ module Foobara | |
| 90 90 | 
             
                    self.allowed_rule = allowed_rule
         | 
| 91 91 | 
             
                    self.requires_authentication = requires_authentication
         | 
| 92 92 | 
             
                    self.authenticator = authenticator
         | 
| 93 | 
            +
             | 
| 94 | 
            +
                    # A bit hacky... we should check if we need to shim in a LoadDelegatedAttributesEntitiesPreCommitTransformer
         | 
| 95 | 
            +
                    unless aggregate_entities
         | 
| 96 | 
            +
                      # It's possible delegates have been added or removed via the result transformers...
         | 
| 97 | 
            +
                      # We should figure out a way to check the transformed result type instead.
         | 
| 98 | 
            +
                      if _has_delegated_attributes?(command_class.result_type)
         | 
| 99 | 
            +
                        self.pre_commit_transformers = [
         | 
| 100 | 
            +
                          *self.pre_commit_transformers,
         | 
| 101 | 
            +
                          CommandConnectors::Transformers::LoadDelegatedAttributesEntitiesPreCommitTransformer
         | 
| 102 | 
            +
                        ].uniq
         | 
| 103 | 
            +
                      end
         | 
| 104 | 
            +
                    end
         | 
| 105 | 
            +
                  end
         | 
| 106 | 
            +
             | 
| 107 | 
            +
                  def _has_delegated_attributes?(type)
         | 
| 108 | 
            +
                    type&.extends?(BuiltinTypes[:model]) && type.target_class&.has_delegated_attributes?
         | 
| 93 109 | 
             
                  end
         | 
| 94 110 |  | 
| 95 111 | 
             
                  def full_command_name
         | 
| @@ -64,9 +64,6 @@ module Foobara | |
| 64 64 | 
             
                        end
         | 
| 65 65 |  | 
| 66 66 | 
             
                        def updated(record)
         | 
| 67 | 
            -
                          # Hacky way to handle situation where the primary key might have changed.
         | 
| 68 | 
            -
                          # TODO: make a better way of handling this.
         | 
| 69 | 
            -
                          tracked_records.delete(record)
         | 
| 70 67 | 
             
                          tracked_records << record
         | 
| 71 68 |  | 
| 72 69 | 
             
                          # TODO: is this check redundant? Maybe have the entity explode directly instead?
         | 
| @@ -519,8 +519,6 @@ module Foobara | |
| 519 519 |  | 
| 520 520 | 
             
                    def flush_created!
         | 
| 521 521 | 
             
                      marked_created.each do |record|
         | 
| 522 | 
            -
                        tracked_records.delete(record)
         | 
| 523 | 
            -
             | 
| 524 522 | 
             
                        flush_created_associations!(record)
         | 
| 525 523 |  | 
| 526 524 | 
             
                        # TODO: do this in bulk
         | 
| @@ -540,8 +538,6 @@ module Foobara | |
| 540 538 | 
             
                    end
         | 
| 541 539 |  | 
| 542 540 | 
             
                    def flush_created_record!(record)
         | 
| 543 | 
            -
                      tracked_records.delete(record)
         | 
| 544 | 
            -
             | 
| 545 541 | 
             
                      flush_created_associations!(record)
         | 
| 546 542 |  | 
| 547 543 | 
             
                      unmark_created(record)
         | 
| @@ -97,22 +97,40 @@ module Foobara | |
| 97 97 | 
             
                end
         | 
| 98 98 |  | 
| 99 99 | 
             
                def <<(object)
         | 
| 100 | 
            -
                  garbage_cleaner.track(object)
         | 
| 101 | 
            -
             | 
| 102 100 | 
             
                  object_id = object.object_id
         | 
| 103 101 |  | 
| 104 | 
            -
                   | 
| 102 | 
            +
                  if include?(object)
         | 
| 103 | 
            +
                    if @key_method
         | 
| 104 | 
            +
                      key = object.send(@key_method)
         | 
| 105 | 
            +
                      old_key = object_id_to_key[object_id]
         | 
| 105 106 |  | 
| 106 | 
            -
             | 
| 107 | 
            -
             | 
| 107 | 
            +
                      if key != old_key
         | 
| 108 | 
            +
                        key_to_object_id.delete(old_key)
         | 
| 108 109 |  | 
| 109 | 
            -
             | 
| 110 | 
            -
             | 
| 111 | 
            -
             | 
| 110 | 
            +
                        if key
         | 
| 111 | 
            +
                          key_to_object_id[key] = object_id
         | 
| 112 | 
            +
                          object_id_to_key[object_id] = key
         | 
| 113 | 
            +
                        else
         | 
| 114 | 
            +
                          object_id_to_key.delete(object_id)
         | 
| 115 | 
            +
                        end
         | 
| 116 | 
            +
                      end
         | 
| 112 117 | 
             
                    end
         | 
| 113 | 
            -
                   | 
| 118 | 
            +
                  else
         | 
| 119 | 
            +
                    garbage_cleaner.track(object)
         | 
| 114 120 |  | 
| 115 | 
            -
             | 
| 121 | 
            +
                    objects[object_id] = WeakRef.new(object)
         | 
| 122 | 
            +
             | 
| 123 | 
            +
                    if @key_method
         | 
| 124 | 
            +
                      key = object.send(@key_method)
         | 
| 125 | 
            +
             | 
| 126 | 
            +
                      if key
         | 
| 127 | 
            +
                        key_to_object_id[key] = object_id
         | 
| 128 | 
            +
                        object_id_to_key[object_id] = key
         | 
| 129 | 
            +
                      end
         | 
| 130 | 
            +
                    end
         | 
| 131 | 
            +
             | 
| 132 | 
            +
                    object
         | 
| 133 | 
            +
                  end
         | 
| 116 134 | 
             
                end
         | 
| 117 135 |  | 
| 118 136 | 
             
                def include?(object_or_object_id)
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: foobara
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.111
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Miles Georgi
         | 
| @@ -508,7 +508,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 508 508 | 
             
                - !ruby/object:Gem::Version
         | 
| 509 509 | 
             
                  version: '0'
         | 
| 510 510 | 
             
            requirements: []
         | 
| 511 | 
            -
            rubygems_version: 3.6. | 
| 511 | 
            +
            rubygems_version: 3.6.8
         | 
| 512 512 | 
             
            specification_version: 4
         | 
| 513 513 | 
             
            summary: A command-centric and discoverable software framework with a focus on domain
         | 
| 514 514 | 
             
              concepts and abstracting away integration code
         |