isomorfeus-operation 1.0.0.epsilon1 → 1.0.0.epsilon2
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/lib/isomorfeus/operation/handler/operation_handler.rb +25 -19
- data/lib/isomorfeus/operation/mixin.rb +2 -0
- data/lib/isomorfeus/operation/version.rb +1 -1
- data/lib/lucid_operation/base.rb +0 -1
- data/lib/lucid_operation/mixin.rb +2 -1
- data/lib/lucid_quick_op/base.rb +0 -1
- data/lib/lucid_quick_op/mixin.rb +0 -1
- metadata +32 -4
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: e6579700c64951e487d014a8ea4ff5a7c5878a51b40b7d2d7377a0a360e3f838
         | 
| 4 | 
            +
              data.tar.gz: 6c0a3ae43946b7a8b02ebbabf24581abf312cfcd771f756195151e2e6d2c0d6d
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 70c72e4e875220b4d3c77d07b3a412ff88419b023ffaeaacb4cd916c6fce08840b49da98923b2a1495ee4ac47df1ac4edd2579334dbe6869d0821e93d2ba9656
         | 
| 7 | 
            +
              data.tar.gz: a9afe16f39c342d64c811a9c54d20f4ce13d6d1b1b115f18287924a2715c5e663101e033dc5d951d37bb4857bad5ce4b0593ef579d27a092e5790944066efa9e
         | 
| @@ -1,36 +1,42 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 1 3 | 
             
            module Isomorfeus
         | 
| 2 4 | 
             
              module Operation
         | 
| 3 5 | 
             
                module Handler
         | 
| 4 6 | 
             
                  class OperationHandler < LucidHandler::Base
         | 
| 5 | 
            -
                    on_request do |pub_sub_client,  | 
| 7 | 
            +
                    on_request do |pub_sub_client, current_user, request, response|
         | 
| 6 8 | 
             
                      result = { error: 'No such thing' }
         | 
| 7 9 | 
             
                      # promise_send_path('Isomorfeus::Operation::Handler::OperationHandler', self.to_s, props_hash)
         | 
| 8 | 
            -
                      request. | 
| 10 | 
            +
                      request.each_key do |operation_class_name|
         | 
| 9 11 | 
             
                        if Isomorfeus.valid_operation_class_name?(operation_class_name)
         | 
| 10 12 | 
             
                          operation_class = Isomorfeus.cached_operation_class(operation_class_name)
         | 
| 11 13 | 
             
                          if operation_class
         | 
| 12 14 | 
             
                            props_json = request[operation_class_name]
         | 
| 13 15 | 
             
                            begin
         | 
| 14 16 | 
             
                              props = Oj.load(props_json, mode: :strict)
         | 
| 15 | 
            -
                              props.merge!({pub_sub_client: pub_sub_client,  | 
| 16 | 
            -
                               | 
| 17 | 
            -
             | 
| 18 | 
            -
                                 | 
| 19 | 
            -
                              else
         | 
| 20 | 
            -
                                start = Time.now
         | 
| 21 | 
            -
                                timeout = false
         | 
| 22 | 
            -
                                while !operation_promise.realized?
         | 
| 23 | 
            -
                                  if (Time.now - start) > 20
         | 
| 24 | 
            -
                                    timeout = true
         | 
| 25 | 
            -
                                    break
         | 
| 26 | 
            -
                                  end
         | 
| 27 | 
            -
                                  sleep 0.01
         | 
| 28 | 
            -
                                end
         | 
| 29 | 
            -
                                if timeout
         | 
| 30 | 
            -
                                  result = { error: 'Timeout' }
         | 
| 31 | 
            -
                                else
         | 
| 17 | 
            +
                              props.merge!({pub_sub_client: pub_sub_client, current_user: current_user})
         | 
| 18 | 
            +
                              if current_user.authorized?(operation_class, :promise_run, *props)
         | 
| 19 | 
            +
                                operation_promise = operation_class.promise_run(props)
         | 
| 20 | 
            +
                                if operation_promise.realized?
         | 
| 32 21 | 
             
                                  result = { success: 'ok' , result: operation_promise.value }
         | 
| 22 | 
            +
                                else
         | 
| 23 | 
            +
                                  start = Time.now
         | 
| 24 | 
            +
                                  timeout = false
         | 
| 25 | 
            +
                                  while !operation_promise.realized?
         | 
| 26 | 
            +
                                    if (Time.now - start) > 20
         | 
| 27 | 
            +
                                      timeout = true
         | 
| 28 | 
            +
                                      break
         | 
| 29 | 
            +
                                    end
         | 
| 30 | 
            +
                                    sleep 0.01
         | 
| 31 | 
            +
                                  end
         | 
| 32 | 
            +
                                  if timeout
         | 
| 33 | 
            +
                                    result = { error: 'Timeout' }
         | 
| 34 | 
            +
                                  else
         | 
| 35 | 
            +
                                    result = { success: 'ok' , result: operation_promise.value }
         | 
| 36 | 
            +
                                  end
         | 
| 33 37 | 
             
                                end
         | 
| 38 | 
            +
                              else
         | 
| 39 | 
            +
                                result = { error: 'Access denied!' }
         | 
| 34 40 | 
             
                              end
         | 
| 35 41 | 
             
                            rescue Exception => e
         | 
| 36 42 | 
             
                              result = if Isomorfeus.production?
         | 
    
        data/lib/lucid_operation/base.rb
    CHANGED
    
    
| @@ -1,3 +1,5 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 1 3 | 
             
            module LucidOperation
         | 
| 2 4 | 
             
              module Mixin
         | 
| 3 5 | 
             
                def self.included(base)
         | 
| @@ -53,7 +55,6 @@ module LucidOperation | |
| 53 55 |  | 
| 54 56 | 
             
                    unless base == LucidOperation::Base
         | 
| 55 57 | 
             
                      base.prop :pub_sub_client, default: nil
         | 
| 56 | 
            -
                      base.prop :session_id, default: nil
         | 
| 57 58 | 
             
                      base.prop :current_user, default: nil
         | 
| 58 59 | 
             
                    end
         | 
| 59 60 |  | 
    
        data/lib/lucid_quick_op/base.rb
    CHANGED
    
    
    
        data/lib/lucid_quick_op/mixin.rb
    CHANGED
    
    
    
        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.epsilon2
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Jan Biedermann
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2019-08- | 
| 11 | 
            +
            date: 2019-08-18 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: activesupport
         | 
| @@ -100,14 +100,42 @@ dependencies: | |
| 100 100 | 
             
                requirements:
         | 
| 101 101 | 
             
                - - '='
         | 
| 102 102 | 
             
                  - !ruby/object:Gem::Version
         | 
| 103 | 
            -
                    version: 1.0.0. | 
| 103 | 
            +
                    version: 1.0.0.epsilon2
         | 
| 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.epsilon2
         | 
| 111 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 112 | 
            +
              name: isomorfeus-installer
         | 
| 113 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 114 | 
            +
                requirements:
         | 
| 115 | 
            +
                - - '='
         | 
| 116 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 117 | 
            +
                    version: 1.0.0.epsilon2
         | 
| 118 | 
            +
              type: :development
         | 
| 119 | 
            +
              prerelease: false
         | 
| 120 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 121 | 
            +
                requirements:
         | 
| 122 | 
            +
                - - '='
         | 
| 123 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 124 | 
            +
                    version: 1.0.0.epsilon2
         | 
| 125 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 126 | 
            +
              name: opal-webpack-loader
         | 
| 127 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 128 | 
            +
                requirements:
         | 
| 129 | 
            +
                - - ">="
         | 
| 130 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 131 | 
            +
                    version: 0.9.4
         | 
| 132 | 
            +
              type: :development
         | 
| 133 | 
            +
              prerelease: false
         | 
| 134 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 135 | 
            +
                requirements:
         | 
| 136 | 
            +
                - - ">="
         | 
| 137 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 138 | 
            +
                    version: 0.9.4
         | 
| 111 139 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 112 140 | 
             
              name: rake
         | 
| 113 141 | 
             
              requirement: !ruby/object:Gem::Requirement
         |