isomorfeus-operation 1.0.0.zeta14 → 1.0.0.zeta15
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 +6 -48
 - data/lib/isomorfeus/operation/handler/operation_handler.rb +17 -5
 - data/lib/isomorfeus/operation/version.rb +1 -1
 - data/lib/isomorfeus_operation/lucid_local_operation/mixin.rb +8 -5
 - data/lib/isomorfeus_operation/lucid_operation/mixin.rb +26 -13
 - data/lib/isomorfeus_operation/lucid_operation/promise_run.rb +1 -8
 - data/lib/isomorfeus_operation/lucid_quick_op/mixin.rb +27 -19
 - metadata +8 -8
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: d00f6ffa11f6782136e58a51ba27b03511a8401c9a582c7a195db27e6dd74dd4
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: bf17412a17c7dd68d6daddea536e854fe85ee1c938eb785afaf2a555bc5a85d3
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 43ae731325bef3667ad4520cc27f11a9a75c2c9f4a16506edd5395c3228409e589512d13065532c13dcc385a2514ee4f59ea068fdfde1fe8c607722a5aad68ad
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: e6210ac995463e6c44505fa2dd7be525565300e32c70458facfcbd4814b9db37863bc9b42ea3b9b0aa2f731628681d1e0dfb1c9c693d912367106446cb0e62ab
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -6,53 +6,11 @@ Operations for Isomorfeus. 
     | 
|
| 
       6 
6 
     | 
    
         
             
            At the [Isomorfeus Framework Project](http://isomorfeus.com) 
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
            ### Usage
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
            -  
     | 
| 
       11 
     | 
    
         
            -
            - LucidOperation
         
     | 
| 
       12 
     | 
    
         
            -
            - LucidLocalOperation
         
     | 
| 
      
 9 
     | 
    
         
            +
            Operations use Props like other parts of the system.
         
     | 
| 
      
 10 
     | 
    
         
            +
            See [the isomorfeus-react props documentation](https://github.com/isomorfeus/isomorfeus-react/blob/master/ruby/docs/props.md#prop-declaration).
         
     | 
| 
       13 
11 
     | 
    
         | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
      
 12 
     | 
    
         
            +
            There are 3 kinds of Operations:
         
     | 
| 
      
 13 
     | 
    
         
            +
            - [LucidQuickOp](https://github.com/isomorfeus/isomorfeus-project/blob/master/ruby/isomorfeus-operation/docs/quick_op.md) - Quick simple operation, always executed on the server.
         
     | 
| 
      
 14 
     | 
    
         
            +
            - [LucidOperation](https://github.com/isomorfeus/isomorfeus-project/blob/master/ruby/isomorfeus-operation/docs/operation.md) - For complex multi-stepped operations, always executed on the server.
         
     | 
| 
      
 15 
     | 
    
         
            +
            - [LucidLocalOperation](https://github.com/isomorfeus/isomorfeus-project/blob/master/ruby/isomorfeus-operation/docs/operation.md) - For complex multi-stepped operations, always executed locally.
         
     | 
| 
       17 
16 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
              op do
         
     | 
| 
       19 
     | 
    
         
            -
                props.a_prop == 'a_value'
         
     | 
| 
       20 
     | 
    
         
            -
                # do something
         
     | 
| 
       21 
     | 
    
         
            -
              end
         
     | 
| 
       22 
     | 
    
         
            -
            end
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
            MyQuickOp.promise_run(a_prop: 'a_value')
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
            # or
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
            MyQuickOp.promise_run(props: { a_prop: 'a_value' })
         
     | 
| 
       29 
     | 
    
         
            -
            ```
         
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
            Quick remote procedure call, always executed on the server.
         
     | 
| 
       32 
     | 
    
         
            -
            LucidOperation too is always executed on the Server. It allows to define Operations in gherkin human language style:
         
     | 
| 
       33 
     | 
    
         
            -
            ```ruby
         
     | 
| 
       34 
     | 
    
         
            -
            class MyOperation < LucidOperation::Base
         
     | 
| 
       35 
     | 
    
         
            -
              prop :a_prop
         
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
              procedure <<~TEXT
         
     | 
| 
       38 
     | 
    
         
            -
                 Given a bird
         
     | 
| 
       39 
     | 
    
         
            -
                 When it flies
         
     | 
| 
       40 
     | 
    
         
            -
                 Then be happy
         
     | 
| 
       41 
     | 
    
         
            -
              TEXT
         
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
              Given /a bird/ do
         
     | 
| 
       44 
     | 
    
         
            -
                 props.a_prop == 'a_value'
         
     | 
| 
       45 
     | 
    
         
            -
              end
         
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
              # etc ...
         
     | 
| 
       48 
     | 
    
         
            -
            end
         
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
     | 
    
         
            -
            MyOperation.promise_run(a_prop: 'a_value')
         
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
            # or
         
     | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
       54 
     | 
    
         
            -
            MyOperation.promise_run(props: { a_prop: 'a_value' })
         
     | 
| 
       55 
     | 
    
         
            -
            ```
         
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
            LucidLocalOperation is the same as LucidOperation, except its always executed locally, wherever that may be.
         
     | 
| 
       58 
     | 
    
         
            -
            Its barely tested so far and no other docs.
         
     | 
| 
         @@ -10,13 +10,19 @@ module Isomorfeus 
     | 
|
| 
       10 
10 
     | 
    
         
             
                        if Isomorfeus.valid_operation_class_name?(operation_class_name)
         
     | 
| 
       11 
11 
     | 
    
         
             
                          operation_class = Isomorfeus.cached_operation_class(operation_class_name)
         
     | 
| 
       12 
12 
     | 
    
         
             
                          if operation_class
         
     | 
| 
       13 
     | 
    
         
            -
                             
     | 
| 
      
 13 
     | 
    
         
            +
                            props = response_agent.request[operation_class_name]
         
     | 
| 
      
 14 
     | 
    
         
            +
                            props.transform_keys!(&:to_sym)
         
     | 
| 
       14 
15 
     | 
    
         
             
                            begin
         
     | 
| 
       15 
     | 
    
         
            -
                              props = Oj.load(props_json, mode: :strict)
         
     | 
| 
       16 
16 
     | 
    
         
             
                              if Isomorfeus.current_user.authorized?(operation_class, :promise_run, props)
         
     | 
| 
       17 
     | 
    
         
            -
                                operation_promise = operation_class.promise_run(props)
         
     | 
| 
      
 17 
     | 
    
         
            +
                                operation_promise = operation_class.promise_run(**props)
         
     | 
| 
       18 
18 
     | 
    
         
             
                                if operation_promise.realized?
         
     | 
| 
       19 
     | 
    
         
            -
                                   
     | 
| 
      
 19 
     | 
    
         
            +
                                  state = operation_promise.resolved? ? :resolved : :rejected
         
     | 
| 
      
 20 
     | 
    
         
            +
                                  result_hash = { state => operation_promise.value }
         
     | 
| 
      
 21 
     | 
    
         
            +
                                  if operation_promise.error
         
     | 
| 
      
 22 
     | 
    
         
            +
                                    e = operation_promise.error
         
     | 
| 
      
 23 
     | 
    
         
            +
                                    result_hash[:error] = { message: e.message, class_name: e.class.to_s, back_trace: e.backtrace }
         
     | 
| 
      
 24 
     | 
    
         
            +
                                  end
         
     | 
| 
      
 25 
     | 
    
         
            +
                                  response_agent.agent_result = { success: 'ok' , result: result_hash }
         
     | 
| 
       20 
26 
     | 
    
         
             
                                else
         
     | 
| 
       21 
27 
     | 
    
         
             
                                  start = Time.now
         
     | 
| 
       22 
28 
     | 
    
         
             
                                  timeout = false
         
     | 
| 
         @@ -30,7 +36,13 @@ module Isomorfeus 
     | 
|
| 
       30 
36 
     | 
    
         
             
                                  if timeout
         
     | 
| 
       31 
37 
     | 
    
         
             
                                    response_agent.error = { error: 'Timeout' }
         
     | 
| 
       32 
38 
     | 
    
         
             
                                  else
         
     | 
| 
       33 
     | 
    
         
            -
                                     
     | 
| 
      
 39 
     | 
    
         
            +
                                    state = operation_promise.resolved? ? :resolved : :rejected
         
     | 
| 
      
 40 
     | 
    
         
            +
                                    result_hash = { state => operation_promise.value }
         
     | 
| 
      
 41 
     | 
    
         
            +
                                    if operation_promise.error
         
     | 
| 
      
 42 
     | 
    
         
            +
                                      e = operation_promise.error
         
     | 
| 
      
 43 
     | 
    
         
            +
                                      result_hash[:error] = { message: e.message, class_name: e.class.to_s, back_trace: e.backtrace }
         
     | 
| 
      
 44 
     | 
    
         
            +
                                    end
         
     | 
| 
      
 45 
     | 
    
         
            +
                                    response_agent.agent_result = { success: 'ok' , result: result_hash }
         
     | 
| 
       34 
46 
     | 
    
         
             
                                  end
         
     | 
| 
       35 
47 
     | 
    
         
             
                                end
         
     | 
| 
       36 
48 
     | 
    
         
             
                              else
         
     | 
| 
         @@ -14,17 +14,20 @@ module LucidLocalOperation 
     | 
|
| 
       14 
14 
     | 
    
         
             
                  base.include(LucidOperation::PromiseRun)
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
16 
     | 
    
         
             
                  base.instance_exec do
         
     | 
| 
       17 
     | 
    
         
            -
                    def promise_run(props_hash 
     | 
| 
       18 
     | 
    
         
            -
                      props_hash 
     | 
| 
       19 
     | 
    
         
            -
                      validate_props(props_hash)
         
     | 
| 
       20 
     | 
    
         
            -
                      self.new(props_hash).promise_run
         
     | 
| 
      
 17 
     | 
    
         
            +
                    def promise_run(**props_hash)
         
     | 
| 
      
 18 
     | 
    
         
            +
                      self.new(**props_hash).promise_run
         
     | 
| 
       21 
19 
     | 
    
         
             
                    end
         
     | 
| 
       22 
20 
     | 
    
         
             
                  end
         
     | 
| 
       23 
21 
     | 
    
         
             
                end
         
     | 
| 
       24 
22 
     | 
    
         | 
| 
       25 
     | 
    
         
            -
                 
     | 
| 
      
 23 
     | 
    
         
            +
                attr_reader :props
         
     | 
| 
       26 
24 
     | 
    
         
             
                attr_accessor :step_result
         
     | 
| 
       27 
25 
     | 
    
         | 
| 
      
 26 
     | 
    
         
            +
                def initialize(**props_hash)
         
     | 
| 
      
 27 
     | 
    
         
            +
                  props_hash = self.class.validated_props(props_hash)
         
     | 
| 
      
 28 
     | 
    
         
            +
                  @props = LucidProps.new(props_hash)
         
     | 
| 
      
 29 
     | 
    
         
            +
                end
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
       28 
31 
     | 
    
         
             
                def current_user
         
     | 
| 
       29 
32 
     | 
    
         
             
                  Isomorfeus.current_user
         
     | 
| 
       30 
33 
     | 
    
         
             
                end
         
     | 
| 
         @@ -36,14 +36,10 @@ module LucidOperation 
     | 
|
| 
       36 
36 
     | 
    
         
             
                        @finally_defined = true
         
     | 
| 
       37 
37 
     | 
    
         
             
                      end
         
     | 
| 
       38 
38 
     | 
    
         | 
| 
       39 
     | 
    
         
            -
                      def promise_run(props_hash 
     | 
| 
       40 
     | 
    
         
            -
                         
     | 
| 
       41 
     | 
    
         
            -
                         
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
                        Isomorfeus::Transport.promise_send_path('Isomorfeus::Operation::Handler::OperationHandler', self.name, props_json).then do |agent|
         
     | 
| 
       44 
     | 
    
         
            -
                          if agent.processed
         
     | 
| 
       45 
     | 
    
         
            -
                            agent.result
         
     | 
| 
       46 
     | 
    
         
            -
                          else
         
     | 
| 
      
 39 
     | 
    
         
            +
                      def promise_run(**props_hash)
         
     | 
| 
      
 40 
     | 
    
         
            +
                        props = validated_props(props_hash)
         
     | 
| 
      
 41 
     | 
    
         
            +
                        Isomorfeus::Transport.promise_send_path('Isomorfeus::Operation::Handler::OperationHandler', self.name, props).then do |agent|
         
     | 
| 
      
 42 
     | 
    
         
            +
                          unless agent.processed
         
     | 
| 
       47 
43 
     | 
    
         
             
                            agent.processed = true
         
     | 
| 
       48 
44 
     | 
    
         
             
                            if agent.response.key?(:error)
         
     | 
| 
       49 
45 
     | 
    
         
             
                              `console.error(#{agent.response[:error].to_n})`
         
     | 
| 
         @@ -51,6 +47,20 @@ module LucidOperation 
     | 
|
| 
       51 
47 
     | 
    
         
             
                            end
         
     | 
| 
       52 
48 
     | 
    
         
             
                            agent.result = agent.response[:result]
         
     | 
| 
       53 
49 
     | 
    
         
             
                          end
         
     | 
| 
      
 50 
     | 
    
         
            +
                          if agent.result.key?(:rejected)
         
     | 
| 
      
 51 
     | 
    
         
            +
                            if agent.result.key?(:error)
         
     | 
| 
      
 52 
     | 
    
         
            +
                              e = agent.result[:error]
         
     | 
| 
      
 53 
     | 
    
         
            +
                              exception_class_name = e[:class_name]
         
     | 
| 
      
 54 
     | 
    
         
            +
                              exception_class = exception_class_name.constantize
         
     | 
| 
      
 55 
     | 
    
         
            +
                              exception = exception_class.new(e[:message])
         
     | 
| 
      
 56 
     | 
    
         
            +
                              exception.set_backtrace(e[:backtrace])
         
     | 
| 
      
 57 
     | 
    
         
            +
                              raise exception
         
     | 
| 
      
 58 
     | 
    
         
            +
                            else
         
     | 
| 
      
 59 
     | 
    
         
            +
                              raise agent.result[:rejected]
         
     | 
| 
      
 60 
     | 
    
         
            +
                            end
         
     | 
| 
      
 61 
     | 
    
         
            +
                          else
         
     | 
| 
      
 62 
     | 
    
         
            +
                            agent.result[:resolved]
         
     | 
| 
      
 63 
     | 
    
         
            +
                          end
         
     | 
| 
       54 
64 
     | 
    
         
             
                        end
         
     | 
| 
       55 
65 
     | 
    
         
             
                      end
         
     | 
| 
       56 
66 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -60,16 +70,19 @@ module LucidOperation 
     | 
|
| 
       60 
70 
     | 
    
         
             
                    base.include(LucidOperation::PromiseRun)
         
     | 
| 
       61 
71 
     | 
    
         | 
| 
       62 
72 
     | 
    
         
             
                    base.instance_exec do
         
     | 
| 
       63 
     | 
    
         
            -
                      def promise_run(props_hash 
     | 
| 
       64 
     | 
    
         
            -
                        props_hash 
     | 
| 
       65 
     | 
    
         
            -
                        validate_props(props_hash)
         
     | 
| 
       66 
     | 
    
         
            -
                        self.new(props_hash).promise_run
         
     | 
| 
      
 73 
     | 
    
         
            +
                      def promise_run(**props_hash)
         
     | 
| 
      
 74 
     | 
    
         
            +
                        self.new(**props_hash).promise_run
         
     | 
| 
       67 
75 
     | 
    
         
             
                      end
         
     | 
| 
       68 
76 
     | 
    
         
             
                    end
         
     | 
| 
       69 
77 
     | 
    
         | 
| 
       70 
     | 
    
         
            -
                     
     | 
| 
      
 78 
     | 
    
         
            +
                    attr_reader :props
         
     | 
| 
       71 
79 
     | 
    
         
             
                    attr_accessor :step_result
         
     | 
| 
       72 
80 
     | 
    
         | 
| 
      
 81 
     | 
    
         
            +
                    def initialize(**props_hash)
         
     | 
| 
      
 82 
     | 
    
         
            +
                      props_hash = self.class.validated_props(props_hash)
         
     | 
| 
      
 83 
     | 
    
         
            +
                      @props = LucidProps.new(props_hash)
         
     | 
| 
      
 84 
     | 
    
         
            +
                    end
         
     | 
| 
      
 85 
     | 
    
         
            +
             
     | 
| 
       73 
86 
     | 
    
         
             
                    def current_user
         
     | 
| 
       74 
87 
     | 
    
         
             
                      Isomorfeus.current_user
         
     | 
| 
       75 
88 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -1,9 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module LucidOperation
         
     | 
| 
       2 
2 
     | 
    
         
             
              module PromiseRun
         
     | 
| 
       3 
     | 
    
         
            -
                def initialize(validated_props_hash)
         
     | 
| 
       4 
     | 
    
         
            -
                  @props = Isomorfeus::PropsProxy.new(validated_props_hash)
         
     | 
| 
       5 
     | 
    
         
            -
                end
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
3 
     | 
    
         
             
                def promise_run
         
     | 
| 
       8 
4 
     | 
    
         
             
                  promise = Promise.new
         
     | 
| 
       9 
5 
     | 
    
         
             
                  original_promise = promise
         
     | 
| 
         @@ -55,10 +51,7 @@ module LucidOperation 
     | 
|
| 
       55 
51 
     | 
    
         
             
                      if match_data
         
     | 
| 
       56 
52 
     | 
    
         
             
                        matched = true
         
     | 
| 
       57 
53 
     | 
    
         | 
| 
       58 
     | 
    
         
            -
                        promise = promise. 
     | 
| 
       59 
     | 
    
         
            -
                          operation.step_result = result
         
     | 
| 
       60 
     | 
    
         
            -
                          operation.instance_exec(*match_data, &step[1])
         
     | 
| 
       61 
     | 
    
         
            -
                        end.fail do |result|
         
     | 
| 
      
 54 
     | 
    
         
            +
                        promise = promise.ensure do |result|
         
     | 
| 
       62 
55 
     | 
    
         
             
                          operation.step_result = result
         
     | 
| 
       63 
56 
     | 
    
         
             
                          operation.instance_exec(*match_data, &step[1])
         
     | 
| 
       64 
57 
     | 
    
         
             
                        end
         
     | 
| 
         @@ -8,14 +8,10 @@ module LucidQuickOp 
     | 
|
| 
       8 
8 
     | 
    
         
             
                      def op
         
     | 
| 
       9 
9 
     | 
    
         
             
                      end
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
                      def promise_run(props_hash 
     | 
| 
       12 
     | 
    
         
            -
                         
     | 
| 
       13 
     | 
    
         
            -
                         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
                        Isomorfeus::Transport.promise_send_path('Isomorfeus::Operation::Handler::OperationHandler', self.name, props_json).then do |agent|
         
     | 
| 
       16 
     | 
    
         
            -
                          if agent.processed
         
     | 
| 
       17 
     | 
    
         
            -
                            agent.result
         
     | 
| 
       18 
     | 
    
         
            -
                          else
         
     | 
| 
      
 11 
     | 
    
         
            +
                      def promise_run(**props_hash)
         
     | 
| 
      
 12 
     | 
    
         
            +
                        props = validated_props(props_hash)
         
     | 
| 
      
 13 
     | 
    
         
            +
                        Isomorfeus::Transport.promise_send_path('Isomorfeus::Operation::Handler::OperationHandler', self.name, props).then do |agent|
         
     | 
| 
      
 14 
     | 
    
         
            +
                          unless agent.processed
         
     | 
| 
       19 
15 
     | 
    
         
             
                            agent.processed = true
         
     | 
| 
       20 
16 
     | 
    
         
             
                            if agent.response.key?(:error)
         
     | 
| 
       21 
17 
     | 
    
         
             
                              `console.error(#{agent.response[:error].to_n})`
         
     | 
| 
         @@ -23,6 +19,20 @@ module LucidQuickOp 
     | 
|
| 
       23 
19 
     | 
    
         
             
                            end
         
     | 
| 
       24 
20 
     | 
    
         
             
                            agent.result = agent.response[:result]
         
     | 
| 
       25 
21 
     | 
    
         
             
                          end
         
     | 
| 
      
 22 
     | 
    
         
            +
                          if agent.result.key?(:rejected)
         
     | 
| 
      
 23 
     | 
    
         
            +
                            if agent.result.key?(:error)
         
     | 
| 
      
 24 
     | 
    
         
            +
                              e = agent.result[:error]
         
     | 
| 
      
 25 
     | 
    
         
            +
                              exception_class_name = e[:class_name]
         
     | 
| 
      
 26 
     | 
    
         
            +
                              exception_class = exception_class_name.constantize
         
     | 
| 
      
 27 
     | 
    
         
            +
                              exception = exception_class.new(e[:message])
         
     | 
| 
      
 28 
     | 
    
         
            +
                              exception.set_backtrace(e[:backtrace])
         
     | 
| 
      
 29 
     | 
    
         
            +
                              raise exception
         
     | 
| 
      
 30 
     | 
    
         
            +
                            else
         
     | 
| 
      
 31 
     | 
    
         
            +
                              raise agent.result[:rejected]
         
     | 
| 
      
 32 
     | 
    
         
            +
                            end
         
     | 
| 
      
 33 
     | 
    
         
            +
                          else
         
     | 
| 
      
 34 
     | 
    
         
            +
                            agent.result[:resolved]
         
     | 
| 
      
 35 
     | 
    
         
            +
                          end
         
     | 
| 
       26 
36 
     | 
    
         
             
                        end
         
     | 
| 
       27 
37 
     | 
    
         
             
                      end
         
     | 
| 
       28 
38 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -34,31 +44,29 @@ module LucidQuickOp 
     | 
|
| 
       34 
44 
     | 
    
         
             
                        @op = block
         
     | 
| 
       35 
45 
     | 
    
         
             
                      end
         
     | 
| 
       36 
46 
     | 
    
         | 
| 
       37 
     | 
    
         
            -
                      def promise_run(props_hash 
     | 
| 
       38 
     | 
    
         
            -
                        props_hash 
     | 
| 
       39 
     | 
    
         
            -
                        validate_props(props_hash)
         
     | 
| 
       40 
     | 
    
         
            -
                        self.new(props_hash).promise_run
         
     | 
| 
      
 47 
     | 
    
         
            +
                      def promise_run(**props_hash)
         
     | 
| 
      
 48 
     | 
    
         
            +
                        self.new(**props_hash).promise_run
         
     | 
| 
       41 
49 
     | 
    
         
             
                      end
         
     | 
| 
       42 
50 
     | 
    
         
             
                    end
         
     | 
| 
       43 
51 
     | 
    
         
             
                  end
         
     | 
| 
       44 
52 
     | 
    
         
             
                end
         
     | 
| 
       45 
53 
     | 
    
         | 
| 
       46 
     | 
    
         
            -
                 
     | 
| 
      
 54 
     | 
    
         
            +
                attr_reader :props
         
     | 
| 
       47 
55 
     | 
    
         | 
| 
       48 
     | 
    
         
            -
                def initialize( 
     | 
| 
       49 
     | 
    
         
            -
                   
     | 
| 
       50 
     | 
    
         
            -
                  @ 
     | 
| 
      
 56 
     | 
    
         
            +
                def initialize(**props_hash)
         
     | 
| 
      
 57 
     | 
    
         
            +
                  props_hash = self.class.validated_props(props_hash)
         
     | 
| 
      
 58 
     | 
    
         
            +
                  @props = LucidProps.new(props_hash)
         
     | 
| 
       51 
59 
     | 
    
         
             
                end
         
     | 
| 
       52 
60 
     | 
    
         | 
| 
       53 
61 
     | 
    
         
             
                def promise_run
         
     | 
| 
       54 
62 
     | 
    
         
             
                  original_promise = Promise.new
         
     | 
| 
       55 
63 
     | 
    
         | 
| 
       56 
64 
     | 
    
         
             
                  operation = self
         
     | 
| 
       57 
     | 
    
         
            -
                  promise = original_promise.then do | 
     | 
| 
       58 
     | 
    
         
            -
                    operation.instance_exec(& 
     | 
| 
      
 65 
     | 
    
         
            +
                  promise = original_promise.then do |_|
         
     | 
| 
      
 66 
     | 
    
         
            +
                    operation.instance_exec(&operation.class.instance_variable_get(:@op))
         
     | 
| 
       59 
67 
     | 
    
         
             
                  end
         
     | 
| 
       60 
68 
     | 
    
         | 
| 
       61 
     | 
    
         
            -
                  original_promise.resolve 
     | 
| 
      
 69 
     | 
    
         
            +
                  original_promise.resolve
         
     | 
| 
       62 
70 
     | 
    
         
             
                  promise
         
     | 
| 
       63 
71 
     | 
    
         
             
                end
         
     | 
| 
       64 
72 
     | 
    
         | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: isomorfeus-operation
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.0.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.0.0.zeta15
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Jan Biedermann
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2020- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2020-02-10 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: activesupport
         
     | 
| 
         @@ -72,14 +72,14 @@ dependencies: 
     | 
|
| 
       72 
72 
     | 
    
         
             
                requirements:
         
     | 
| 
       73 
73 
     | 
    
         
             
                - - ">="
         
     | 
| 
       74 
74 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       75 
     | 
    
         
            -
                    version: 16.12. 
     | 
| 
      
 75 
     | 
    
         
            +
                    version: 16.12.17
         
     | 
| 
       76 
76 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       77 
77 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       78 
78 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       79 
79 
     | 
    
         
             
                requirements:
         
     | 
| 
       80 
80 
     | 
    
         
             
                - - ">="
         
     | 
| 
       81 
81 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       82 
     | 
    
         
            -
                    version: 16.12. 
     | 
| 
      
 82 
     | 
    
         
            +
                    version: 16.12.17
         
     | 
| 
       83 
83 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       84 
84 
     | 
    
         
             
              name: isomorfeus-redux
         
     | 
| 
       85 
85 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -100,28 +100,28 @@ dependencies: 
     | 
|
| 
       100 
100 
     | 
    
         
             
                requirements:
         
     | 
| 
       101 
101 
     | 
    
         
             
                - - '='
         
     | 
| 
       102 
102 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       103 
     | 
    
         
            -
                    version: 1.0.0. 
     | 
| 
      
 103 
     | 
    
         
            +
                    version: 1.0.0.zeta15
         
     | 
| 
       104 
104 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       105 
105 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       106 
106 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       107 
107 
     | 
    
         
             
                requirements:
         
     | 
| 
       108 
108 
     | 
    
         
             
                - - '='
         
     | 
| 
       109 
109 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       110 
     | 
    
         
            -
                    version: 1.0.0. 
     | 
| 
      
 110 
     | 
    
         
            +
                    version: 1.0.0.zeta15
         
     | 
| 
       111 
111 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       112 
112 
     | 
    
         
             
              name: isomorfeus
         
     | 
| 
       113 
113 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       114 
114 
     | 
    
         
             
                requirements:
         
     | 
| 
       115 
115 
     | 
    
         
             
                - - '='
         
     | 
| 
       116 
116 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       117 
     | 
    
         
            -
                    version: 1.0.0. 
     | 
| 
      
 117 
     | 
    
         
            +
                    version: 1.0.0.zeta15
         
     | 
| 
       118 
118 
     | 
    
         
             
              type: :development
         
     | 
| 
       119 
119 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       120 
120 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       121 
121 
     | 
    
         
             
                requirements:
         
     | 
| 
       122 
122 
     | 
    
         
             
                - - '='
         
     | 
| 
       123 
123 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       124 
     | 
    
         
            -
                    version: 1.0.0. 
     | 
| 
      
 124 
     | 
    
         
            +
                    version: 1.0.0.zeta15
         
     | 
| 
       125 
125 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       126 
126 
     | 
    
         
             
              name: opal-webpack-loader
         
     | 
| 
       127 
127 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     |