global-registry-bindings 0.1.2 → 0.1.3
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/README.md +8 -8
- data/lib/global_registry_bindings/global_registry_bindings.rb +5 -5
- data/lib/global_registry_bindings/model/entity.rb +4 -4
- data/lib/global_registry_bindings/model/relationship.rb +4 -4
- data/lib/global_registry_bindings/options/entity_class_options.rb +2 -2
- data/lib/global_registry_bindings/options/entity_instance_options.rb +4 -4
- data/lib/global_registry_bindings/options/entity_options_parser.rb +8 -8
- data/lib/global_registry_bindings/options/relationship_class_options.rb +2 -2
- data/lib/global_registry_bindings/options/relationship_instance_options.rb +4 -4
- data/lib/global_registry_bindings/options/relationship_options_parser.rb +8 -8
- data/lib/global_registry_bindings/version.rb +1 -1
- data/spec/acceptance/global_registry_bindings_spec.rb +14 -14
- data/spec/internal/app/models/address.rb +3 -2
- data/spec/internal/app/models/area.rb +1 -2
- data/spec/internal/app/models/assignment.rb +2 -2
- data/spec/internal/app/models/community.rb +3 -3
- data/spec/internal/app/models/country.rb +1 -1
- data/spec/internal/app/models/namespaced/person.rb +7 -8
- data/spec/internal/app/models/organization.rb +6 -6
- data/spec/internal/log/test.log +3655 -0
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: a1070674e56cacc49d588111ed8ce212005c1d5f
         | 
| 4 | 
            +
              data.tar.gz: 917c38d3b12d156eb4d7e8b059c2f750170cb581
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 8995bec861df933f950a3c0267a6087a7d3622754d1b510670c07f2d09128f902dd30b2b18d76e314ce12120bffb88d1f1404baba2a13d94bc24b8c37aac5b94
         | 
| 7 | 
            +
              data.tar.gz: 9fcb1a519d88e24db01fa2a234e33fa1b9597e0d4c568071a6ecbc918b5b7429218875da4f756f432fb8ff1904e9bb64ba50570d9f8ad51c7de8169d6403b322
         | 
    
        data/README.md
    CHANGED
    
    | @@ -64,7 +64,7 @@ is a unique name to identify the relationship. **[`:entity`, `:relationship`]** | |
| 64 64 | 
             
            (default: `[:create, :update, :destroy]`) **[`:entity`]**
         | 
| 65 65 |  | 
| 66 66 | 
             
            * `:parent_association`: Name of the Active Record parent association. Must be defined before calling
         | 
| 67 | 
            -
            global_registry_bindings in order to determine foreign_key for use in  | 
| 67 | 
            +
            global_registry_bindings in order to determine foreign_key for use in exclude. Used to create a
         | 
| 68 68 | 
             
            hierarchy or to push child entity types. (Ex: person -> address) (default: `nil`) **[`:entity`]**
         | 
| 69 69 |  | 
| 70 70 | 
             
            * `:parent_association_class`: Class name of the parent model. Required if `:parent_association` can not be used
         | 
| @@ -76,7 +76,7 @@ to `:entity`, but can be set to a `:relationship` type name (ex: `:assignment`) | |
| 76 76 | 
             
            between a relationship and an entity. (default: `:entity`) **[`:relationship`]**
         | 
| 77 77 |  | 
| 78 78 | 
             
            * `:primary_association`: Name of the Active Record primary association. Must be defined before calling
         | 
| 79 | 
            -
            global_registry_bindings in order to determine foreign_key for use in  | 
| 79 | 
            +
            global_registry_bindings in order to determine foreign_key for use in exclude. (default: `nil`)
         | 
| 80 80 | 
             
            **[`:relationship`]**
         | 
| 81 81 |  | 
| 82 82 | 
             
            * `:primary_association_class`: Class name of the primary model. Required if `:primary_association` can not be
         | 
| @@ -120,17 +120,17 @@ should cache this as it may be requested multiple times. (default: `nil`) **[`:r | |
| 120 120 | 
             
            (default: `:primary_association.id`) **[`:relationship`]**
         | 
| 121 121 |  | 
| 122 122 | 
             
            * `:include_all_columns`: Include all model columns in the fields to push to Global Registry. If `false`, fields must
         | 
| 123 | 
            -
            be defined in the `: | 
| 123 | 
            +
            be defined in the `:fields` option. (default: `false`)
         | 
| 124 124 | 
             
            **[`:entity`, `:relationship`]**
         | 
| 125 125 |  | 
| 126 | 
            -
            * `: | 
| 126 | 
            +
            * `:exclude`: Array, Proc or Symbol. Array of Model fields (as symbols) to exclude when pushing to Global
         | 
| 127 127 | 
             
            Registry. Array Will additionally include `:mdm_id_column` and `:parent_association` foreign key when defined.
         | 
| 128 128 | 
             
            If Proc, is passed type and model instance and should return an Array of the fields to exclude. If Symbol,
         | 
| 129 129 | 
             
            this should be a method name the Model instance responds to. It is passed the type and should return an Array
         | 
| 130 130 | 
             
            of fields to exclude. When Proc or Symbol are used, you must explicitly return the standard defaults.
         | 
| 131 131 | 
             
            (default:  `[:id, :created_at, :updated_at, :global_registry_id]`) **[`:entity`, `:relationship`]**
         | 
| 132 132 |  | 
| 133 | 
            -
            * `: | 
| 133 | 
            +
            * `:fields`: Additional fields to send to Global Registry. Hash, Proc or Symbol. As a Hash, names are the
         | 
| 134 134 | 
             
            keys and :type attributes are the values. Ex: `{language: :string}`. Name is a symbol and type is an
         | 
| 135 135 | 
             
            ActiveRecord column type. As a Proc, it is passed the type and model instance, and should return a Hash.
         | 
| 136 136 | 
             
            As a Symbol, the model should respond to this method, is passed the type, and should return a Hash.
         | 
| @@ -142,7 +142,7 @@ option is nil or empty. (default: `nil`) **[`:entity`]** | |
| 142 142 | 
             
            * `:mdm_timeout`: Only pull mdm information at most once every `:mdm_timeout`. (default: `1.minute`)
         | 
| 143 143 | 
             
            **[`:entity`]**
         | 
| 144 144 |  | 
| 145 | 
            -
            ## Values for ` | 
| 145 | 
            +
            ## Values for `fields`
         | 
| 146 146 |  | 
| 147 147 | 
             
            Values sent to Global Registry are calculated by sending the field `name` to the model. They can be overidden by
         | 
| 148 148 | 
             
            aliasing an existing method, adding a new method to the model or by overriding the `entity_attributes_to_push`
         | 
| @@ -151,8 +151,8 @@ method. If a model does not respond to a name or raises a `NoMethodError`, the f | |
| 151 151 | 
             
            ```ruby
         | 
| 152 152 | 
             
            class Person < ActiveRecord::Base
         | 
| 153 153 | 
             
              # Person has first_name, last_name and guid columns
         | 
| 154 | 
            -
              global_registry_bindings  | 
| 155 | 
            -
                                        | 
| 154 | 
            +
              global_registry_bindings fields: {full_name: :string, identity: :uuid, blargh: :integer},
         | 
| 155 | 
            +
                                       exclude: %i[guid]
         | 
| 156 156 |  | 
| 157 157 | 
             
              # Person doesn't respond to 'blargh' so it is omitted from the attributes to push
         | 
| 158 158 |  | 
| @@ -35,7 +35,7 @@ module GlobalRegistry #:nodoc: | |
| 35 35 | 
             
                #   (default: `[:create, :update, :destroy]`) **[`:entity`]**
         | 
| 36 36 | 
             
                #
         | 
| 37 37 | 
             
                # * `:parent_association`: Name of the Active Record parent association. Must be defined before calling
         | 
| 38 | 
            -
                #   global_registry_bindings in order to determine foreign_key for use in  | 
| 38 | 
            +
                #   global_registry_bindings in order to determine foreign_key for use in exclude. Used to create a
         | 
| 39 39 | 
             
                #   hierarchy or to push child entity types. (Ex: person -> address) (default: `nil`) **[`:entity`]**
         | 
| 40 40 | 
             
                #
         | 
| 41 41 | 
             
                # * `:parent_association_class`: Class name of the parent model. Required if `:parent_association` can not be used
         | 
| @@ -47,7 +47,7 @@ module GlobalRegistry #:nodoc: | |
| 47 47 | 
             
                #   between a relationship and an entity. (default: `:entity`) **[`:relationship`]**
         | 
| 48 48 | 
             
                #
         | 
| 49 49 | 
             
                # * `:primary_association`: Name of the Active Record primary association. Must be defined before calling
         | 
| 50 | 
            -
                #   global_registry_bindings in order to determine foreign_key for use in  | 
| 50 | 
            +
                #   global_registry_bindings in order to determine foreign_key for use in exclude. (default: `nil`)
         | 
| 51 51 | 
             
                #   **[`:relationship`]**
         | 
| 52 52 | 
             
                #
         | 
| 53 53 | 
             
                # * `:primary_association_class`: Class name of the primary model. Required if `:primary_association` can not be
         | 
| @@ -90,21 +90,21 @@ module GlobalRegistry #:nodoc: | |
| 90 90 | 
             
                # * `:client_integration_id`: Client Integration ID for relationship. Proc or Symbol.
         | 
| 91 91 | 
             
                #   (default: `:primary_association.id`) **[`:relationship`]**
         | 
| 92 92 | 
             
                #
         | 
| 93 | 
            -
                # * `: | 
| 93 | 
            +
                # * `:exclude`: Array, Proc or Symbol. Array of Model fields (as symbols) to exclude when pushing to Global
         | 
| 94 94 | 
             
                #   Registry. Array Will additionally include `:mdm_id_column` and `:parent_association` foreign key when defined.
         | 
| 95 95 | 
             
                #   If Proc, is passed type and model instance and should return an Array of the fields to exclude. If Symbol,
         | 
| 96 96 | 
             
                #   this should be a method name the Model instance responds to. It is passed the type and should return an Array
         | 
| 97 97 | 
             
                #   of fields to exclude. When Proc or Symbol are used, you must explicitly return the standard defaults.
         | 
| 98 98 | 
             
                #   (default:  `[:id, :created_at, :updated_at, :global_registry_id]`) **[`:entity`, `:relationship`]**
         | 
| 99 99 | 
             
                #
         | 
| 100 | 
            -
                # * `: | 
| 100 | 
            +
                # * `:fields`: Additional fields to send to Global Registry. Hash, Proc or Symbol. As a Hash, names are the
         | 
| 101 101 | 
             
                #   keys and :type attributes are the values. Ex: `{language: :string}`. Name is a symbol and type is an
         | 
| 102 102 | 
             
                #   ActiveRecord column type. As a Proc, it is passed the type and model instance, and should return a Hash.
         | 
| 103 103 | 
             
                #   As a Symbol, the model should respond to this method, is passed the type, and should return a Hash.
         | 
| 104 104 | 
             
                #   **[`:entity`, `:relationship`]**
         | 
| 105 105 | 
             
                #
         | 
| 106 106 | 
             
                # * `:include_all_columns`: Include all model columns in the fields to push to Global Registry. If `false`, fields
         | 
| 107 | 
            -
                #   must be defined in the `: | 
| 107 | 
            +
                #   must be defined in the `:fields` option. (default: `false`) **[`:entity`, `:relationship`]**
         | 
| 108 108 | 
             
                #
         | 
| 109 109 | 
             
                # * `:mdm_id_column`: Column used to enable MDM tracking and set the name of the column. MDM is disabled when this
         | 
| 110 110 | 
             
                #   option is nil or empty. (default: `nil`) **[`:entity`]**
         | 
| @@ -10,7 +10,7 @@ module GlobalRegistry #:nodoc: | |
| 10 10 | 
             
                      entity_attributes = entity_columns_to_push.map do |name, type|
         | 
| 11 11 | 
             
                        value_for_global_registry(name, type)
         | 
| 12 12 | 
             
                      end.compact.to_h
         | 
| 13 | 
            -
                      entity_attributes[:client_integration_id] = id unless global_registry_entity. | 
| 13 | 
            +
                      entity_attributes[:client_integration_id] = id unless global_registry_entity.exclude
         | 
| 14 14 | 
             
                                                                                                  .include?(:client_integration_id)
         | 
| 15 15 | 
             
                      entity_attributes[:client_updated_at] = updated_at.to_s(:db) if respond_to?(:updated_at)
         | 
| 16 16 | 
             
                      if global_registry_entity.parent_is_self?
         | 
| @@ -44,10 +44,10 @@ module GlobalRegistry #:nodoc: | |
| 44 44 | 
             
                                               { c.name.underscore.to_sym => normalize_entity_column_type(c.type, c.name) }
         | 
| 45 45 | 
             
                                             end # rubocop:disable Style/MultilineBlockChain
         | 
| 46 46 | 
             
                                               .reduce(&:merge)
         | 
| 47 | 
            -
                                               .reject { |k, _v| global_registry_entity. | 
| 48 | 
            -
                                               .merge(global_registry_entity. | 
| 47 | 
            +
                                               .reject { |k, _v| global_registry_entity.exclude.include? k }
         | 
| 48 | 
            +
                                               .merge(global_registry_entity.fields)
         | 
| 49 49 | 
             
                                           else
         | 
| 50 | 
            -
                                             global_registry_entity. | 
| 50 | 
            +
                                             global_registry_entity.fields
         | 
| 51 51 | 
             
                                           end
         | 
| 52 52 | 
             
                    end
         | 
| 53 53 |  | 
| @@ -10,7 +10,7 @@ module GlobalRegistry #:nodoc: | |
| 10 10 | 
             
                      entity_attributes = relationship_columns_to_push(type).map do |name, t|
         | 
| 11 11 | 
             
                        relationship_value_for_global_registry(name, t)
         | 
| 12 12 | 
             
                      end.compact.to_h
         | 
| 13 | 
            -
                      unless global_registry_relationship(type). | 
| 13 | 
            +
                      unless global_registry_relationship(type).exclude.include?(:client_integration_id)
         | 
| 14 14 | 
             
                        entity_attributes[:client_integration_id] = global_registry_relationship(type).client_integration_id
         | 
| 15 15 | 
             
                      end
         | 
| 16 16 | 
             
                      entity_attributes[:client_updated_at] = updated_at.to_s(:db) if respond_to?(:updated_at)
         | 
| @@ -58,10 +58,10 @@ module GlobalRegistry #:nodoc: | |
| 58 58 | 
             
                          { c.name.underscore.to_sym => normalize_relationship_column_type(c.type, c.name) }
         | 
| 59 59 | 
             
                        end # rubocop:disable Style/MultilineBlockChain
         | 
| 60 60 | 
             
                            .reduce(&:merge)
         | 
| 61 | 
            -
                            .reject { |k, _v| global_registry_relationship(type). | 
| 62 | 
            -
                            .merge(global_registry_relationship(type). | 
| 61 | 
            +
                            .reject { |k, _v| global_registry_relationship(type).exclude.include? k }
         | 
| 62 | 
            +
                            .merge(global_registry_relationship(type).fields)
         | 
| 63 63 | 
             
                      else
         | 
| 64 | 
            -
                        global_registry_relationship(type). | 
| 64 | 
            +
                        global_registry_relationship(type).fields || {}
         | 
| 65 65 | 
             
                      end
         | 
| 66 66 | 
             
                    end
         | 
| 67 67 | 
             
                  end
         | 
| @@ -62,8 +62,8 @@ module GlobalRegistry #:nodoc: | |
| 62 62 | 
             
                      parent_association.present? && parent_class == @model.class
         | 
| 63 63 | 
             
                    end
         | 
| 64 64 |  | 
| 65 | 
            -
                    def  | 
| 66 | 
            -
                      option = @class_options. | 
| 65 | 
            +
                    def exclude
         | 
| 66 | 
            +
                      option = @class_options.exclude
         | 
| 67 67 | 
             
                      case option
         | 
| 68 68 | 
             
                      when Proc
         | 
| 69 69 | 
             
                        option.call(type, @model)
         | 
| @@ -74,8 +74,8 @@ module GlobalRegistry #:nodoc: | |
| 74 74 | 
             
                      end
         | 
| 75 75 | 
             
                    end
         | 
| 76 76 |  | 
| 77 | 
            -
                    def  | 
| 78 | 
            -
                      option = @class_options. | 
| 77 | 
            +
                    def fields
         | 
| 78 | 
            +
                      option = @class_options.fields
         | 
| 79 79 | 
             
                      case option
         | 
| 80 80 | 
             
                      when Proc
         | 
| 81 81 | 
             
                        option.call(type, @model)
         | 
| @@ -17,9 +17,9 @@ module GlobalRegistry #:nodoc: | |
| 17 17 | 
             
                        parent_association: nil,
         | 
| 18 18 | 
             
                        parent_association_class: nil,
         | 
| 19 19 | 
             
                        parent_relationship_name: nil,
         | 
| 20 | 
            -
                         | 
| 21 | 
            -
                         | 
| 22 | 
            -
                        include_all_columns:  | 
| 20 | 
            +
                        exclude: %i[id created_at updated_at],
         | 
| 21 | 
            +
                        fields: {},
         | 
| 22 | 
            +
                        include_all_columns: false,
         | 
| 23 23 | 
             
                        mdm_timeout: 1.minute,
         | 
| 24 24 | 
             
                        ensure_entity_type: true
         | 
| 25 25 | 
             
                      }.freeze
         | 
| @@ -36,7 +36,7 @@ module GlobalRegistry #:nodoc: | |
| 36 36 |  | 
| 37 37 | 
             
                    def merge_defaults(options_hash = {})
         | 
| 38 38 | 
             
                      @options = defaults.merge(options_hash) do |key, oldval, newval|
         | 
| 39 | 
            -
                        if key == : | 
| 39 | 
            +
                        if key == :exclude
         | 
| 40 40 | 
             
                          case newval
         | 
| 41 41 | 
             
                          when Proc, Symbol
         | 
| 42 42 | 
             
                            newval
         | 
| @@ -56,12 +56,12 @@ module GlobalRegistry #:nodoc: | |
| 56 56 | 
             
                    end
         | 
| 57 57 |  | 
| 58 58 | 
             
                    def update_excludes
         | 
| 59 | 
            -
                      return unless @options[: | 
| 60 | 
            -
                      @options[: | 
| 61 | 
            -
                      @options[: | 
| 59 | 
            +
                      return unless @options[:exclude].is_a? Array
         | 
| 60 | 
            +
                      @options[:exclude] << @options[:id_column]
         | 
| 61 | 
            +
                      @options[:exclude] << @options[:mdm_id_column] if @options[:mdm_id_column].present?
         | 
| 62 62 |  | 
| 63 63 | 
             
                      parent_id_column = association_foreign_key @options[:parent_association]
         | 
| 64 | 
            -
                      @options[: | 
| 64 | 
            +
                      @options[:exclude] << parent_id_column.to_sym if parent_id_column
         | 
| 65 65 | 
             
                    end
         | 
| 66 66 |  | 
| 67 67 | 
             
                    def association_foreign_key(name)
         | 
| @@ -21,8 +21,8 @@ module GlobalRegistry #:nodoc: | |
| 21 21 | 
             
                             :related_association_type,
         | 
| 22 22 | 
             
                             :related_relationship_name,
         | 
| 23 23 | 
             
                             :related_global_registry_id,
         | 
| 24 | 
            -
                             : | 
| 25 | 
            -
                             : | 
| 24 | 
            +
                             :exclude,
         | 
| 25 | 
            +
                             :fields, to: :@options
         | 
| 26 26 |  | 
| 27 27 | 
             
                    def initialize(type, model_class)
         | 
| 28 28 | 
             
                      @model_class = model_class
         | 
| @@ -111,8 +111,8 @@ module GlobalRegistry #:nodoc: | |
| 111 111 | 
             
                      @class_options.related_relationship_name || related_type
         | 
| 112 112 | 
             
                    end
         | 
| 113 113 |  | 
| 114 | 
            -
                    def  | 
| 115 | 
            -
                      option = @class_options. | 
| 114 | 
            +
                    def exclude
         | 
| 115 | 
            +
                      option = @class_options.exclude
         | 
| 116 116 | 
             
                      case option
         | 
| 117 117 | 
             
                      when Proc
         | 
| 118 118 | 
             
                        option.call(type, @model)
         | 
| @@ -123,8 +123,8 @@ module GlobalRegistry #:nodoc: | |
| 123 123 | 
             
                      end
         | 
| 124 124 | 
             
                    end
         | 
| 125 125 |  | 
| 126 | 
            -
                    def  | 
| 127 | 
            -
                      option = @class_options. | 
| 126 | 
            +
                    def fields
         | 
| 127 | 
            +
                      option = @class_options.fields
         | 
| 128 128 | 
             
                      case option
         | 
| 129 129 | 
             
                      when Proc
         | 
| 130 130 | 
             
                        option.call(type, @model)
         | 
| @@ -20,8 +20,8 @@ module GlobalRegistry #:nodoc: | |
| 20 20 | 
             
                        related_association_class: nil, related_association_type: nil,
         | 
| 21 21 | 
             
                        related_relationship_name: nil,
         | 
| 22 22 | 
             
                        related_global_registry_id: nil,
         | 
| 23 | 
            -
                         | 
| 24 | 
            -
                         | 
| 23 | 
            +
                        exclude: %i[id created_at updated_at], include_all_columns: false,
         | 
| 24 | 
            +
                        fields: {}, ensure_relationship_type: true, rename_entity_type: true
         | 
| 25 25 | 
             
                      }.freeze
         | 
| 26 26 | 
             
                    end
         | 
| 27 27 |  | 
| @@ -37,7 +37,7 @@ module GlobalRegistry #:nodoc: | |
| 37 37 |  | 
| 38 38 | 
             
                    def merge_defaults(options_hash = {})
         | 
| 39 39 | 
             
                      @options = defaults.merge(options_hash) do |key, oldval, newval|
         | 
| 40 | 
            -
                        if key == : | 
| 40 | 
            +
                        if key == :exclude
         | 
| 41 41 | 
             
                          case newval
         | 
| 42 42 | 
             
                          when Proc, Symbol
         | 
| 43 43 | 
             
                            newval
         | 
| @@ -73,15 +73,15 @@ module GlobalRegistry #:nodoc: | |
| 73 73 | 
             
                    end
         | 
| 74 74 |  | 
| 75 75 | 
             
                    def update_excludes
         | 
| 76 | 
            -
                      return unless @options[: | 
| 77 | 
            -
                      @options[: | 
| 78 | 
            -
                      @options[: | 
| 76 | 
            +
                      return unless @options[:exclude].is_a? Array
         | 
| 77 | 
            +
                      @options[:exclude] << @options[:id_column]
         | 
| 78 | 
            +
                      @options[:exclude] << @options[:mdm_id_column] if @options[:mdm_id_column].present?
         | 
| 79 79 |  | 
| 80 80 | 
             
                      if @options[:primary_association_foreign_key]
         | 
| 81 | 
            -
                        @options[: | 
| 81 | 
            +
                        @options[:exclude] << @options[:primary_association_foreign_key]
         | 
| 82 82 | 
             
                      end
         | 
| 83 83 | 
             
                      if @options[:related_association_foreign_key] # rubocop:disable Style/GuardClause
         | 
| 84 | 
            -
                        @options[: | 
| 84 | 
            +
                        @options[:exclude] << @options[:related_association_foreign_key]
         | 
| 85 85 | 
             
                      end
         | 
| 86 86 | 
             
                    end
         | 
| 87 87 |  | 
| @@ -18,9 +18,9 @@ RSpec.describe 'GlobalRegistry::Bindings' do | |
| 18 18 | 
             
                    .to contain_exactly(:create, :update, :destroy)
         | 
| 19 19 | 
             
                  expect(Default.global_registry_entity.mdm_timeout).to eq 1.minute
         | 
| 20 20 | 
             
                  expect(Default.global_registry_entity.type).to be :default
         | 
| 21 | 
            -
                  expect(Default.global_registry_entity. | 
| 21 | 
            +
                  expect(Default.global_registry_entity.exclude)
         | 
| 22 22 | 
             
                    .to contain_exactly(:global_registry_id, :id, :created_at, :updated_at)
         | 
| 23 | 
            -
                  expect(Default.global_registry_entity. | 
| 23 | 
            +
                  expect(Default.global_registry_entity.fields).to be_a(Hash).and be_empty
         | 
| 24 24 | 
             
                end
         | 
| 25 25 |  | 
| 26 26 | 
             
                it 'should parse and set mdm options' do
         | 
| @@ -28,11 +28,11 @@ RSpec.describe 'GlobalRegistry::Bindings' do | |
| 28 28 | 
             
                  expect(Namespaced::Person.global_registry_entity.mdm_id_column).to be :global_registry_mdm_id
         | 
| 29 29 | 
             
                  expect(Namespaced::Person.global_registry_entity.mdm_timeout).to eq 24.hours
         | 
| 30 30 | 
             
                  expect(Namespaced::Person.global_registry_entity.type).to be :person
         | 
| 31 | 
            -
                  expect(Namespaced::Person.global_registry_entity. | 
| 31 | 
            +
                  expect(Namespaced::Person.global_registry_entity.exclude)
         | 
| 32 32 | 
             
                    .to contain_exactly(:country_of_residence_gr_id, :country_of_residence_id, :country_of_service_gr_id,
         | 
| 33 33 | 
             
                                        :country_of_service_id, :created_at, :global_registry_id, :global_registry_mdm_id,
         | 
| 34 34 | 
             
                                        :guid, :id, :updated_at)
         | 
| 35 | 
            -
                  expect(Namespaced::Person.global_registry_entity. | 
| 35 | 
            +
                  expect(Namespaced::Person.global_registry_entity.fields).to be_a(Hash).and be_empty
         | 
| 36 36 | 
             
                  expect(GlobalRegistry::Bindings::Workers::PullNamespacedPersonMdmIdWorker.get_sidekiq_options)
         | 
| 37 37 | 
             
                    .to include('unique' => :until_timeout, 'unique_expiration' => 24.hours)
         | 
| 38 38 | 
             
                end
         | 
| @@ -43,11 +43,11 @@ RSpec.describe 'GlobalRegistry::Bindings' do | |
| 43 43 | 
             
                  expect(Address.global_registry_entity.mdm_id_column).to be nil
         | 
| 44 44 | 
             
                  expect(Address.global_registry_entity.type).to be :address
         | 
| 45 45 | 
             
                  expect(Address.global_registry_entity.parent_association).to be :person
         | 
| 46 | 
            -
                  expect(Address.global_registry_entity. | 
| 47 | 
            -
                  expect(address.global_registry_entity. | 
| 46 | 
            +
                  expect(Address.global_registry_entity.exclude).to be_a Proc
         | 
| 47 | 
            +
                  expect(address.global_registry_entity.exclude)
         | 
| 48 48 | 
             
                    .to contain_exactly(:global_registry_id, :id, :created_at, :updated_at, :person_id, :address1)
         | 
| 49 | 
            -
                  expect(Address.global_registry_entity. | 
| 50 | 
            -
                  expect(address.global_registry_entity. | 
| 49 | 
            +
                  expect(Address.global_registry_entity.fields).to be_a Symbol
         | 
| 50 | 
            +
                  expect(address.global_registry_entity.fields)
         | 
| 51 51 | 
             
                    .to include(line1: :string, postal_code: :string)
         | 
| 52 52 | 
             
                end
         | 
| 53 53 |  | 
| @@ -59,11 +59,11 @@ RSpec.describe 'GlobalRegistry::Bindings' do | |
| 59 59 | 
             
                  expect(org.global_registry_entity.type).to be :fancy_org
         | 
| 60 60 | 
             
                  expect(Organization.global_registry_entity.parent_association).to be :parent
         | 
| 61 61 | 
             
                  expect(Organization.global_registry_entity.push_on).to be_an(Array).and eq(%i[create destroy])
         | 
| 62 | 
            -
                  expect(Organization.global_registry_entity. | 
| 63 | 
            -
                  expect(org.global_registry_entity. | 
| 62 | 
            +
                  expect(Organization.global_registry_entity.exclude).to be_a Symbol
         | 
| 63 | 
            +
                  expect(org.global_registry_entity.exclude)
         | 
| 64 64 | 
             
                    .to contain_exactly(:gr_id, :id, :created_at, :updated_at, :parent_id, :area_id, :global_registry_area_id)
         | 
| 65 | 
            -
                  expect(Organization.global_registry_entity. | 
| 66 | 
            -
                  expect(org.global_registry_entity. | 
| 65 | 
            +
                  expect(Organization.global_registry_entity.fields).to be_a Proc
         | 
| 66 | 
            +
                  expect(org.global_registry_entity.fields).to be_a(Hash).and be_empty
         | 
| 67 67 | 
             
                end
         | 
| 68 68 |  | 
| 69 69 | 
             
                it 'should parse and set relationship fields' do
         | 
| @@ -76,10 +76,10 @@ RSpec.describe 'GlobalRegistry::Bindings' do | |
| 76 76 | 
             
                  expect(Assignment.global_registry_relationship(:fancy_org_assignment).related_association).to be :organization
         | 
| 77 77 | 
             
                  expect(assignment.global_registry_relationship(:fancy_org_assignment).primary_relationship_name).to be :person
         | 
| 78 78 | 
             
                  expect(assignment.global_registry_relationship(:fancy_org_assignment).related_relationship_name).to be :fancy_org
         | 
| 79 | 
            -
                  expect(assignment.global_registry_relationship(:fancy_org_assignment). | 
| 79 | 
            +
                  expect(assignment.global_registry_relationship(:fancy_org_assignment).exclude)
         | 
| 80 80 | 
             
                    .to contain_exactly(:global_registry_id, :id, :created_at, :updated_at, :person_id, :organization_id,
         | 
| 81 81 | 
             
                                        :assigned_by_gr_rel_id, :assigned_by_id)
         | 
| 82 | 
            -
                  expect(assignment.global_registry_relationship(:fancy_org_assignment). | 
| 82 | 
            +
                  expect(assignment.global_registry_relationship(:fancy_org_assignment).fields)
         | 
| 83 83 | 
             
                    .to be_a(Hash)
         | 
| 84 84 | 
             
                end
         | 
| 85 85 | 
             
              end
         | 
| @@ -4,8 +4,9 @@ class Address < ApplicationRecord | |
| 4 4 | 
             
              EXCLUDE_GR_FIELDS = %i[id created_at updated_at global_registry_id person_id address1].freeze
         | 
| 5 5 | 
             
              belongs_to :person, class_name: 'Namespaced::Person', inverse_of: :addresses
         | 
| 6 6 | 
             
              global_registry_bindings parent_association: :person,
         | 
| 7 | 
            -
                                        | 
| 8 | 
            -
                                        | 
| 7 | 
            +
                                       exclude: proc { |_type, _model| EXCLUDE_GR_FIELDS },
         | 
| 8 | 
            +
                                       fields: :global_registry_extra_fields,
         | 
| 9 | 
            +
                                       include_all_columns: true
         | 
| 9 10 |  | 
| 10 11 | 
             
              alias_attribute :line1, :address1
         | 
| 11 12 | 
             
              alias_attribute :postal_code, :zip
         | 
| @@ -3,6 +3,5 @@ | |
| 3 3 | 
             
            class Area < ApplicationRecord
         | 
| 4 4 | 
             
              has_many :organizations
         | 
| 5 5 |  | 
| 6 | 
            -
              global_registry_bindings  | 
| 7 | 
            -
                                       extra_fields: { area_name: :string, area_code: :string, is_active: :boolean }
         | 
| 6 | 
            +
              global_registry_bindings fields: { area_name: :string, area_code: :string, is_active: :boolean }
         | 
| 8 7 | 
             
            end
         | 
| @@ -9,12 +9,12 @@ class Assignment < ApplicationRecord | |
| 9 9 | 
             
                                       type: :fancy_org_assignment,
         | 
| 10 10 | 
             
                                       primary_association: :person,
         | 
| 11 11 | 
             
                                       related_association: :organization,
         | 
| 12 | 
            -
                                        | 
| 12 | 
            +
                                       include_all_columns: true,
         | 
| 13 | 
            +
                                       exclude: %i[assigned_by_id assigned_by_gr_rel_id]
         | 
| 13 14 |  | 
| 14 15 | 
             
              global_registry_bindings binding: :relationship,
         | 
| 15 16 | 
             
                                       type: :assigned_by,
         | 
| 16 17 | 
             
                                       id_column: :assigned_by_gr_rel_id,
         | 
| 17 | 
            -
                                       include_all_columns: false,
         | 
| 18 18 | 
             
                                       primary_binding: :fancy_org_assignment,
         | 
| 19 19 | 
             
                                       primary_relationship_name: :assigned_by,
         | 
| 20 20 | 
             
                                       related_association: :assigned_by
         | 
| @@ -2,7 +2,8 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            class Community < ApplicationRecord
         | 
| 4 4 | 
             
              global_registry_bindings ensure_entity_type: false,
         | 
| 5 | 
            -
                                        | 
| 5 | 
            +
                                       include_all_columns: true,
         | 
| 6 | 
            +
                                       exclude: %i[infobase_id infobase_gr_id]
         | 
| 6 7 |  | 
| 7 8 | 
             
              global_registry_bindings binding: :relationship,
         | 
| 8 9 | 
             
                                       type: :infobase_ministry,
         | 
| @@ -10,8 +11,7 @@ class Community < ApplicationRecord | |
| 10 11 | 
             
                                       related_relationship_name: :ministry,
         | 
| 11 12 | 
             
                                       related_association_type: :ministry,
         | 
| 12 13 | 
             
                                       related_association_foreign_key: :infobase_id,
         | 
| 13 | 
            -
                                       related_global_registry_id: :pull_infobase_global_registry_id | 
| 14 | 
            -
                                       include_all_columns: false
         | 
| 14 | 
            +
                                       related_global_registry_id: :pull_infobase_global_registry_id
         | 
| 15 15 |  | 
| 16 16 | 
             
              def pull_infobase_global_registry_id(_type)
         | 
| 17 17 | 
             
                '41f767fd-86f4-42e2-8d24-cbc3f697b794'
         |