trailblazer-endpoint 0.0.3 → 0.0.8
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/.gitignore +16 -0
 - data/Appraisals +5 -0
 - data/CHANGES.md +27 -0
 - data/README.md +40 -5
 - data/Rakefile +7 -1
 - data/gemfiles/rails_app.gemfile +12 -0
 - data/lib/trailblazer/endpoint.rb +50 -14
 - data/lib/trailblazer/endpoint/adapter.rb +30 -121
 - data/lib/trailblazer/endpoint/builder.rb +1 -1
 - data/lib/trailblazer/endpoint/controller.rb +217 -1
 - data/lib/trailblazer/endpoint/dsl.rb +8 -3
 - data/lib/trailblazer/endpoint/options.rb +16 -69
 - data/lib/trailblazer/endpoint/protocol.rb +7 -11
 - data/lib/trailblazer/endpoint/protocol/cipher.rb +27 -0
 - data/lib/trailblazer/endpoint/protocol/controller.rb +102 -0
 - data/lib/trailblazer/endpoint/protocol/find_process_model.rb +15 -0
 - data/lib/trailblazer/endpoint/version.rb +1 -1
 - data/test/adapter/api_test.rb +6 -11
 - data/test/adapter/web_test.rb +2 -5
 - data/test/config_test.rb +25 -0
 - data/test/docs/controller_test.rb +220 -73
 - data/test/endpoint_test.rb +1 -1
 - data/test/rails-app/.gitignore +8 -2
 - data/test/rails-app/.ruby-version +1 -0
 - data/test/rails-app/Gemfile +21 -9
 - data/test/rails-app/Gemfile.lock +174 -118
 - data/test/rails-app/app/concepts/app/api/v1/representer/errors.rb +16 -0
 - data/test/rails-app/app/concepts/auth/jwt.rb +35 -0
 - data/test/rails-app/app/concepts/auth/operation/authenticate.rb +32 -0
 - data/test/rails-app/app/concepts/auth/operation/policy.rb +9 -0
 - data/test/rails-app/app/concepts/song/cell/create.rb +4 -0
 - data/test/rails-app/app/concepts/song/cell/new.rb +4 -0
 - data/test/rails-app/app/concepts/song/operation/create.rb +17 -0
 - data/test/rails-app/app/concepts/song/operation/show.rb +10 -0
 - data/test/rails-app/app/concepts/song/representer.rb +5 -0
 - data/test/rails-app/app/concepts/song/view/create.erb +1 -0
 - data/test/rails-app/app/concepts/song/view/new.erb +1 -0
 - data/test/rails-app/app/controllers/api/v1/songs_controller.rb +41 -0
 - data/test/rails-app/app/controllers/application_controller.rb +8 -1
 - data/test/rails-app/app/controllers/application_controller/api.rb +107 -0
 - data/test/rails-app/app/controllers/application_controller/web.rb +46 -0
 - data/test/rails-app/app/controllers/auth_controller.rb +44 -0
 - data/test/rails-app/app/controllers/home_controller.rb +5 -0
 - data/test/rails-app/app/controllers/songs_controller.rb +254 -13
 - data/test/rails-app/app/models/song.rb +6 -0
 - data/test/rails-app/app/models/user.rb +7 -0
 - data/test/rails-app/bin/bundle +114 -0
 - data/test/rails-app/bin/rails +4 -0
 - data/test/rails-app/bin/rake +4 -0
 - data/test/rails-app/bin/setup +33 -0
 - data/test/rails-app/config/application.rb +26 -3
 - data/test/rails-app/config/credentials.yml.enc +1 -0
 - data/test/rails-app/config/database.yml +2 -2
 - data/test/rails-app/config/environments/development.rb +7 -17
 - data/test/rails-app/config/environments/production.rb +28 -23
 - data/test/rails-app/config/environments/test.rb +10 -12
 - data/test/rails-app/config/initializers/application_controller_renderer.rb +6 -4
 - data/test/rails-app/config/initializers/cors.rb +16 -0
 - data/test/rails-app/config/initializers/trailblazer.rb +2 -0
 - data/test/rails-app/config/locales/en.yml +11 -1
 - data/test/rails-app/config/master.key +1 -0
 - data/test/rails-app/config/routes.rb +27 -4
 - data/test/rails-app/db/schema.rb +15 -0
 - data/test/rails-app/test/controllers/api_songs_controller_test.rb +87 -0
 - data/test/rails-app/test/controllers/songs_controller_test.rb +152 -145
 - data/test/rails-app/test/test_helper.rb +7 -1
 - data/test/test_helper.rb +0 -2
 - data/trailblazer-endpoint.gemspec +2 -1
 - metadata +69 -24
 - data/test/rails-app/config/initializers/cookies_serializer.rb +0 -5
 - data/test/rails-app/config/initializers/new_framework_defaults.rb +0 -24
 - data/test/rails-app/config/initializers/session_store.rb +0 -3
 - data/test/rails-app/config/secrets.yml +0 -22
 - data/test/rails-app/test/helpers/.keep +0 -0
 - data/test/rails-app/test/integration/.keep +0 -0
 - data/test/rails-app/test/mailers/.keep +0 -0
 - data/test/rails-app/vendor/assets/javascripts/.keep +0 -0
 - data/test/rails-app/vendor/assets/stylesheets/.keep +0 -0
 
    
        data/test/endpoint_test.rb
    CHANGED
    
    | 
         @@ -261,7 +261,7 @@ class EndpointTest < Minitest::Spec 
     | 
|
| 
       261 
261 
     | 
    
         
             
              class MyApiAdapter < Trailblazer::Endpoint::Adapter::API
         
     | 
| 
       262 
262 
     | 
    
         
             
              # example how to add your own step to a certain path
         
     | 
| 
       263 
263 
     | 
    
         
             
                                  # FIXME: :after doesn't work
         
     | 
| 
       264 
     | 
    
         
            -
                step :my_401_handler, before: :_401_status, magnetic_to: :_401, Output(:success) => Track(:_401) 
     | 
| 
      
 264 
     | 
    
         
            +
                step :my_401_handler, before: :_401_status, magnetic_to: :_401, Output(:success) => Track(:_401)
         
     | 
| 
       265 
265 
     | 
    
         | 
| 
       266 
266 
     | 
    
         
             
                # def render_success(ctx, **)
         
     | 
| 
       267 
267 
     | 
    
         
             
                #   ctx[:json] = %{#{ctx[:representer]}.new(#{ctx[:model]})}
         
     | 
    
        data/test/rails-app/.gitignore
    CHANGED
    
    | 
         @@ -10,6 +10,7 @@ 
     | 
|
| 
       10 
10 
     | 
    
         
             
            # Ignore the default SQLite database.
         
     | 
| 
       11 
11 
     | 
    
         
             
            /db/*.sqlite3
         
     | 
| 
       12 
12 
     | 
    
         
             
            /db/*.sqlite3-journal
         
     | 
| 
      
 13 
     | 
    
         
            +
            /db/*.sqlite3-*
         
     | 
| 
       13 
14 
     | 
    
         | 
| 
       14 
15 
     | 
    
         
             
            # Ignore all logfiles and tempfiles.
         
     | 
| 
       15 
16 
     | 
    
         
             
            /log/*
         
     | 
| 
         @@ -17,5 +18,10 @@ 
     | 
|
| 
       17 
18 
     | 
    
         
             
            !/log/.keep
         
     | 
| 
       18 
19 
     | 
    
         
             
            !/tmp/.keep
         
     | 
| 
       19 
20 
     | 
    
         | 
| 
       20 
     | 
    
         
            -
            # Ignore  
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
      
 21 
     | 
    
         
            +
            # Ignore pidfiles, but keep the directory.
         
     | 
| 
      
 22 
     | 
    
         
            +
            /tmp/pids/*
         
     | 
| 
      
 23 
     | 
    
         
            +
            !/tmp/pids/
         
     | 
| 
      
 24 
     | 
    
         
            +
            !/tmp/pids/.keep
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            # Ignore master key for decrypting credentials and more.
         
     | 
| 
      
 27 
     | 
    
         
            +
            # /config/master.key
         
     | 
| 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ruby-2.5.1
         
     | 
    
        data/test/rails-app/Gemfile
    CHANGED
    
    | 
         @@ -1,17 +1,29 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            source 'https://rubygems.org'
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
      
 2 
     | 
    
         
            +
            git_source(:github) { |repo| "https://github.com/#{repo}.git" }
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
4 
     | 
    
         
             
            # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
         
     | 
| 
       5 
     | 
    
         
            -
            gem 'rails', '~>  
     | 
| 
      
 5 
     | 
    
         
            +
            gem 'rails', '~> 6.0.3', '>= 6.0.3.1'
         
     | 
| 
       6 
6 
     | 
    
         
             
            # Use sqlite3 as the database for Active Record
         
     | 
| 
       7 
     | 
    
         
            -
            gem 'sqlite3'
         
     | 
| 
      
 7 
     | 
    
         
            +
            gem 'sqlite3', '~> 1.4'
         
     | 
| 
      
 8 
     | 
    
         
            +
            # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
         
     | 
| 
      
 9 
     | 
    
         
            +
            # gem 'jbuilder', '~> 2.7'
         
     | 
| 
      
 10 
     | 
    
         
            +
            # Use Active Model has_secure_password
         
     | 
| 
      
 11 
     | 
    
         
            +
            # gem 'bcrypt', '~> 3.1.7'
         
     | 
| 
       8 
12 
     | 
    
         | 
| 
       9 
     | 
    
         
            -
            #  
     | 
| 
       10 
     | 
    
         
            -
            gem ' 
     | 
| 
      
 13 
     | 
    
         
            +
            # Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible
         
     | 
| 
      
 14 
     | 
    
         
            +
            # gem 'rack-cors'
         
     | 
| 
       11 
15 
     | 
    
         | 
| 
      
 16 
     | 
    
         
            +
            gem "trailblazer-operation"
         
     | 
| 
       12 
17 
     | 
    
         
             
            gem "trailblazer-endpoint", path: "../../."
         
     | 
| 
       13 
     | 
    
         
            -
            gem " 
     | 
| 
       14 
     | 
    
         
            -
            gem "trailblazer-operation", path: "../../../operation"
         
     | 
| 
       15 
     | 
    
         
            -
            # gem "trailblazer-rails"
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
      
 18 
     | 
    
         
            +
            gem "jwt"
         
     | 
| 
       17 
19 
     | 
    
         
             
            gem "multi_json"
         
     | 
| 
      
 20 
     | 
    
         
            +
            gem "minitest-line"
         
     | 
| 
      
 21 
     | 
    
         
            +
            gem "trailblazer-cells"
         
     | 
| 
      
 22 
     | 
    
         
            +
            gem "cells-erb"
         
     | 
| 
      
 23 
     | 
    
         
            +
            gem "cells-rails"
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            # FIXME
         
     | 
| 
      
 27 
     | 
    
         
            +
            gem "trailblazer-workflow", path: "../../../trailblazer-workflow"
         
     | 
| 
      
 28 
     | 
    
         
            +
            # gem "trailblazer-activity-dsl-linear", path: "../../../trailblazer-activity-dsl-linear"
         
     | 
| 
      
 29 
     | 
    
         
            +
            gem "trailblazer-activity-dsl-linear", ">= 0.3.4"
         
     | 
    
        data/test/rails-app/Gemfile.lock
    CHANGED
    
    | 
         @@ -1,157 +1,213 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            PATH
         
     | 
| 
       2 
     | 
    
         
            -
              remote: ../../../ 
     | 
| 
      
 2 
     | 
    
         
            +
              remote: ../../../trailblazer-workflow
         
     | 
| 
       3 
3 
     | 
    
         
             
              specs:
         
     | 
| 
       4 
     | 
    
         
            -
                trailblazer- 
     | 
| 
       5 
     | 
    
         
            -
                   
     | 
| 
       6 
     | 
    
         
            -
                   
     | 
| 
       7 
     | 
    
         
            -
                   
     | 
| 
      
 4 
     | 
    
         
            +
                trailblazer-workflow (0.0.8)
         
     | 
| 
      
 5 
     | 
    
         
            +
                  trailblazer-activity
         
     | 
| 
      
 6 
     | 
    
         
            +
                  trailblazer-activity-implementation (>= 0.0.4)
         
     | 
| 
      
 7 
     | 
    
         
            +
                  trailblazer-developer (>= 0.0.17)
         
     | 
| 
      
 8 
     | 
    
         
            +
                  trailblazer-endpoint
         
     | 
| 
       8 
9 
     | 
    
         | 
| 
       9 
10 
     | 
    
         
             
            PATH
         
     | 
| 
       10 
     | 
    
         
            -
              remote:  
     | 
| 
      
 11 
     | 
    
         
            +
              remote: ../..
         
     | 
| 
       11 
12 
     | 
    
         
             
              specs:
         
     | 
| 
       12 
     | 
    
         
            -
                trailblazer ( 
     | 
| 
       13 
     | 
    
         
            -
                   
     | 
| 
       14 
     | 
    
         
            -
                  reform (>= 2.2.0, < 3.0.0)
         
     | 
| 
       15 
     | 
    
         
            -
                  trailblazer-operation
         
     | 
| 
       16 
     | 
    
         
            -
                  uber (>= 0.1.0, < 0.2.0)
         
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
            PATH
         
     | 
| 
       19 
     | 
    
         
            -
              remote: ../../.
         
     | 
| 
       20 
     | 
    
         
            -
              specs:
         
     | 
| 
       21 
     | 
    
         
            -
                trailblazer-endpoint (0.0.1)
         
     | 
| 
       22 
     | 
    
         
            -
                  dry-matcher
         
     | 
| 
      
 13 
     | 
    
         
            +
                trailblazer-endpoint (0.0.7)
         
     | 
| 
      
 14 
     | 
    
         
            +
                  trailblazer-activity-dsl-linear (>= 0.3.4, < 0.4.0)
         
     | 
| 
       23 
15 
     | 
    
         | 
| 
       24 
16 
     | 
    
         
             
            GEM
         
     | 
| 
       25 
17 
     | 
    
         
             
              remote: https://rubygems.org/
         
     | 
| 
       26 
18 
     | 
    
         
             
              specs:
         
     | 
| 
       27 
     | 
    
         
            -
                actioncable ( 
     | 
| 
       28 
     | 
    
         
            -
                  actionpack (=  
     | 
| 
       29 
     | 
    
         
            -
                  nio4r (~>  
     | 
| 
       30 
     | 
    
         
            -
                  websocket-driver ( 
     | 
| 
       31 
     | 
    
         
            -
                 
     | 
| 
       32 
     | 
    
         
            -
                  actionpack (=  
     | 
| 
       33 
     | 
    
         
            -
                   
     | 
| 
       34 
     | 
    
         
            -
                   
     | 
| 
      
 19 
     | 
    
         
            +
                actioncable (6.0.3.4)
         
     | 
| 
      
 20 
     | 
    
         
            +
                  actionpack (= 6.0.3.4)
         
     | 
| 
      
 21 
     | 
    
         
            +
                  nio4r (~> 2.0)
         
     | 
| 
      
 22 
     | 
    
         
            +
                  websocket-driver (>= 0.6.1)
         
     | 
| 
      
 23 
     | 
    
         
            +
                actionmailbox (6.0.3.4)
         
     | 
| 
      
 24 
     | 
    
         
            +
                  actionpack (= 6.0.3.4)
         
     | 
| 
      
 25 
     | 
    
         
            +
                  activejob (= 6.0.3.4)
         
     | 
| 
      
 26 
     | 
    
         
            +
                  activerecord (= 6.0.3.4)
         
     | 
| 
      
 27 
     | 
    
         
            +
                  activestorage (= 6.0.3.4)
         
     | 
| 
      
 28 
     | 
    
         
            +
                  activesupport (= 6.0.3.4)
         
     | 
| 
      
 29 
     | 
    
         
            +
                  mail (>= 2.7.1)
         
     | 
| 
      
 30 
     | 
    
         
            +
                actionmailer (6.0.3.4)
         
     | 
| 
      
 31 
     | 
    
         
            +
                  actionpack (= 6.0.3.4)
         
     | 
| 
      
 32 
     | 
    
         
            +
                  actionview (= 6.0.3.4)
         
     | 
| 
      
 33 
     | 
    
         
            +
                  activejob (= 6.0.3.4)
         
     | 
| 
       35 
34 
     | 
    
         
             
                  mail (~> 2.5, >= 2.5.4)
         
     | 
| 
       36 
35 
     | 
    
         
             
                  rails-dom-testing (~> 2.0)
         
     | 
| 
       37 
     | 
    
         
            -
                actionpack ( 
     | 
| 
       38 
     | 
    
         
            -
                  actionview (=  
     | 
| 
       39 
     | 
    
         
            -
                  activesupport (=  
     | 
| 
       40 
     | 
    
         
            -
                  rack (~> 2.0)
         
     | 
| 
       41 
     | 
    
         
            -
                  rack-test ( 
     | 
| 
      
 36 
     | 
    
         
            +
                actionpack (6.0.3.4)
         
     | 
| 
      
 37 
     | 
    
         
            +
                  actionview (= 6.0.3.4)
         
     | 
| 
      
 38 
     | 
    
         
            +
                  activesupport (= 6.0.3.4)
         
     | 
| 
      
 39 
     | 
    
         
            +
                  rack (~> 2.0, >= 2.0.8)
         
     | 
| 
      
 40 
     | 
    
         
            +
                  rack-test (>= 0.6.3)
         
     | 
| 
       42 
41 
     | 
    
         
             
                  rails-dom-testing (~> 2.0)
         
     | 
| 
       43 
     | 
    
         
            -
                  rails-html-sanitizer (~> 1.0, >= 1.0 
     | 
| 
       44 
     | 
    
         
            -
                 
     | 
| 
       45 
     | 
    
         
            -
                   
     | 
| 
      
 42 
     | 
    
         
            +
                  rails-html-sanitizer (~> 1.0, >= 1.2.0)
         
     | 
| 
      
 43 
     | 
    
         
            +
                actiontext (6.0.3.4)
         
     | 
| 
      
 44 
     | 
    
         
            +
                  actionpack (= 6.0.3.4)
         
     | 
| 
      
 45 
     | 
    
         
            +
                  activerecord (= 6.0.3.4)
         
     | 
| 
      
 46 
     | 
    
         
            +
                  activestorage (= 6.0.3.4)
         
     | 
| 
      
 47 
     | 
    
         
            +
                  activesupport (= 6.0.3.4)
         
     | 
| 
      
 48 
     | 
    
         
            +
                  nokogiri (>= 1.8.5)
         
     | 
| 
      
 49 
     | 
    
         
            +
                actionview (6.0.3.4)
         
     | 
| 
      
 50 
     | 
    
         
            +
                  activesupport (= 6.0.3.4)
         
     | 
| 
       46 
51 
     | 
    
         
             
                  builder (~> 3.1)
         
     | 
| 
       47 
     | 
    
         
            -
                   
     | 
| 
      
 52 
     | 
    
         
            +
                  erubi (~> 1.4)
         
     | 
| 
       48 
53 
     | 
    
         
             
                  rails-dom-testing (~> 2.0)
         
     | 
| 
       49 
     | 
    
         
            -
                  rails-html-sanitizer (~> 1. 
     | 
| 
       50 
     | 
    
         
            -
                activejob ( 
     | 
| 
       51 
     | 
    
         
            -
                  activesupport (=  
     | 
| 
      
 54 
     | 
    
         
            +
                  rails-html-sanitizer (~> 1.1, >= 1.2.0)
         
     | 
| 
      
 55 
     | 
    
         
            +
                activejob (6.0.3.4)
         
     | 
| 
      
 56 
     | 
    
         
            +
                  activesupport (= 6.0.3.4)
         
     | 
| 
       52 
57 
     | 
    
         
             
                  globalid (>= 0.3.6)
         
     | 
| 
       53 
     | 
    
         
            -
                activemodel ( 
     | 
| 
       54 
     | 
    
         
            -
                  activesupport (=  
     | 
| 
       55 
     | 
    
         
            -
                activerecord ( 
     | 
| 
       56 
     | 
    
         
            -
                  activemodel (=  
     | 
| 
       57 
     | 
    
         
            -
                  activesupport (=  
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
      
 58 
     | 
    
         
            +
                activemodel (6.0.3.4)
         
     | 
| 
      
 59 
     | 
    
         
            +
                  activesupport (= 6.0.3.4)
         
     | 
| 
      
 60 
     | 
    
         
            +
                activerecord (6.0.3.4)
         
     | 
| 
      
 61 
     | 
    
         
            +
                  activemodel (= 6.0.3.4)
         
     | 
| 
      
 62 
     | 
    
         
            +
                  activesupport (= 6.0.3.4)
         
     | 
| 
      
 63 
     | 
    
         
            +
                activestorage (6.0.3.4)
         
     | 
| 
      
 64 
     | 
    
         
            +
                  actionpack (= 6.0.3.4)
         
     | 
| 
      
 65 
     | 
    
         
            +
                  activejob (= 6.0.3.4)
         
     | 
| 
      
 66 
     | 
    
         
            +
                  activerecord (= 6.0.3.4)
         
     | 
| 
      
 67 
     | 
    
         
            +
                  marcel (~> 0.3.1)
         
     | 
| 
      
 68 
     | 
    
         
            +
                activesupport (6.0.3.4)
         
     | 
| 
       60 
69 
     | 
    
         
             
                  concurrent-ruby (~> 1.0, >= 1.0.2)
         
     | 
| 
       61 
     | 
    
         
            -
                  i18n ( 
     | 
| 
      
 70 
     | 
    
         
            +
                  i18n (>= 0.7, < 2)
         
     | 
| 
       62 
71 
     | 
    
         
             
                  minitest (~> 5.1)
         
     | 
| 
       63 
72 
     | 
    
         
             
                  tzinfo (~> 1.1)
         
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
                builder (3.2. 
     | 
| 
       66 
     | 
    
         
            -
                 
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
       68 
     | 
    
         
            -
                   
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
                   
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
                   
     | 
| 
       73 
     | 
    
         
            -
             
     | 
| 
       74 
     | 
    
         
            -
                 
     | 
| 
       75 
     | 
    
         
            -
             
     | 
| 
       76 
     | 
    
         
            -
                   
     | 
| 
       77 
     | 
    
         
            -
                 
     | 
| 
       78 
     | 
    
         
            -
                 
     | 
| 
      
 73 
     | 
    
         
            +
                  zeitwerk (~> 2.2, >= 2.2.2)
         
     | 
| 
      
 74 
     | 
    
         
            +
                builder (3.2.4)
         
     | 
| 
      
 75 
     | 
    
         
            +
                cells (4.1.7)
         
     | 
| 
      
 76 
     | 
    
         
            +
                  declarative-builder (< 0.2.0)
         
     | 
| 
      
 77 
     | 
    
         
            +
                  declarative-option (< 0.2.0)
         
     | 
| 
      
 78 
     | 
    
         
            +
                  tilt (>= 1.4, < 3)
         
     | 
| 
      
 79 
     | 
    
         
            +
                  uber (< 0.2.0)
         
     | 
| 
      
 80 
     | 
    
         
            +
                cells-erb (0.1.0)
         
     | 
| 
      
 81 
     | 
    
         
            +
                  cells (~> 4.0)
         
     | 
| 
      
 82 
     | 
    
         
            +
                  erbse (>= 0.1.1)
         
     | 
| 
      
 83 
     | 
    
         
            +
                cells-rails (0.1.3)
         
     | 
| 
      
 84 
     | 
    
         
            +
                  actionpack (>= 5.0)
         
     | 
| 
      
 85 
     | 
    
         
            +
                  cells (>= 4.1.6, < 5.0.0)
         
     | 
| 
      
 86 
     | 
    
         
            +
                concurrent-ruby (1.1.7)
         
     | 
| 
      
 87 
     | 
    
         
            +
                crass (1.0.6)
         
     | 
| 
      
 88 
     | 
    
         
            +
                declarative (0.0.20)
         
     | 
| 
      
 89 
     | 
    
         
            +
                declarative-builder (0.1.0)
         
     | 
| 
      
 90 
     | 
    
         
            +
                  declarative-option (< 0.2.0)
         
     | 
| 
      
 91 
     | 
    
         
            +
                declarative-option (0.1.0)
         
     | 
| 
      
 92 
     | 
    
         
            +
                erbse (0.1.4)
         
     | 
| 
      
 93 
     | 
    
         
            +
                  temple
         
     | 
| 
      
 94 
     | 
    
         
            +
                erubi (1.10.0)
         
     | 
| 
      
 95 
     | 
    
         
            +
                globalid (0.4.2)
         
     | 
| 
      
 96 
     | 
    
         
            +
                  activesupport (>= 4.2.0)
         
     | 
| 
      
 97 
     | 
    
         
            +
                hashie (4.1.0)
         
     | 
| 
      
 98 
     | 
    
         
            +
                hirb (0.7.3)
         
     | 
| 
      
 99 
     | 
    
         
            +
                i18n (1.8.7)
         
     | 
| 
      
 100 
     | 
    
         
            +
                  concurrent-ruby (~> 1.0)
         
     | 
| 
      
 101 
     | 
    
         
            +
                jwt (2.2.2)
         
     | 
| 
      
 102 
     | 
    
         
            +
                loofah (2.8.0)
         
     | 
| 
      
 103 
     | 
    
         
            +
                  crass (~> 1.0.2)
         
     | 
| 
       79 
104 
     | 
    
         
             
                  nokogiri (>= 1.5.9)
         
     | 
| 
       80 
     | 
    
         
            -
                mail (2. 
     | 
| 
       81 
     | 
    
         
            -
                   
     | 
| 
       82 
     | 
    
         
            -
                 
     | 
| 
       83 
     | 
    
         
            -
             
     | 
| 
       84 
     | 
    
         
            -
             
     | 
| 
       85 
     | 
    
         
            -
                 
     | 
| 
       86 
     | 
    
         
            -
                 
     | 
| 
       87 
     | 
    
         
            -
                minitest (5. 
     | 
| 
       88 
     | 
    
         
            -
                 
     | 
| 
       89 
     | 
    
         
            -
             
     | 
| 
       90 
     | 
    
         
            -
                 
     | 
| 
       91 
     | 
    
         
            -
             
     | 
| 
       92 
     | 
    
         
            -
                 
     | 
| 
       93 
     | 
    
         
            -
             
     | 
| 
       94 
     | 
    
         
            -
                 
     | 
| 
       95 
     | 
    
         
            -
             
     | 
| 
       96 
     | 
    
         
            -
                 
     | 
| 
       97 
     | 
    
         
            -
                   
     | 
| 
       98 
     | 
    
         
            -
             
     | 
| 
       99 
     | 
    
         
            -
                   
     | 
| 
       100 
     | 
    
         
            -
                   
     | 
| 
       101 
     | 
    
         
            -
                   
     | 
| 
       102 
     | 
    
         
            -
                   
     | 
| 
       103 
     | 
    
         
            -
                   
     | 
| 
       104 
     | 
    
         
            -
                   
     | 
| 
       105 
     | 
    
         
            -
                   
     | 
| 
       106 
     | 
    
         
            -
                   
     | 
| 
      
 105 
     | 
    
         
            +
                mail (2.7.1)
         
     | 
| 
      
 106 
     | 
    
         
            +
                  mini_mime (>= 0.1.1)
         
     | 
| 
      
 107 
     | 
    
         
            +
                marcel (0.3.3)
         
     | 
| 
      
 108 
     | 
    
         
            +
                  mimemagic (~> 0.3.2)
         
     | 
| 
      
 109 
     | 
    
         
            +
                method_source (1.0.0)
         
     | 
| 
      
 110 
     | 
    
         
            +
                mimemagic (0.3.5)
         
     | 
| 
      
 111 
     | 
    
         
            +
                mini_mime (1.0.2)
         
     | 
| 
      
 112 
     | 
    
         
            +
                minitest (5.14.3)
         
     | 
| 
      
 113 
     | 
    
         
            +
                minitest-line (0.6.5)
         
     | 
| 
      
 114 
     | 
    
         
            +
                  minitest (~> 5.0)
         
     | 
| 
      
 115 
     | 
    
         
            +
                multi_json (1.15.0)
         
     | 
| 
      
 116 
     | 
    
         
            +
                nio4r (2.5.4)
         
     | 
| 
      
 117 
     | 
    
         
            +
                nokogiri (1.11.1-x86_64-linux)
         
     | 
| 
      
 118 
     | 
    
         
            +
                  racc (~> 1.4)
         
     | 
| 
      
 119 
     | 
    
         
            +
                racc (1.5.2)
         
     | 
| 
      
 120 
     | 
    
         
            +
                rack (2.2.3)
         
     | 
| 
      
 121 
     | 
    
         
            +
                rack-test (1.1.0)
         
     | 
| 
      
 122 
     | 
    
         
            +
                  rack (>= 1.0, < 3)
         
     | 
| 
      
 123 
     | 
    
         
            +
                rails (6.0.3.4)
         
     | 
| 
      
 124 
     | 
    
         
            +
                  actioncable (= 6.0.3.4)
         
     | 
| 
      
 125 
     | 
    
         
            +
                  actionmailbox (= 6.0.3.4)
         
     | 
| 
      
 126 
     | 
    
         
            +
                  actionmailer (= 6.0.3.4)
         
     | 
| 
      
 127 
     | 
    
         
            +
                  actionpack (= 6.0.3.4)
         
     | 
| 
      
 128 
     | 
    
         
            +
                  actiontext (= 6.0.3.4)
         
     | 
| 
      
 129 
     | 
    
         
            +
                  actionview (= 6.0.3.4)
         
     | 
| 
      
 130 
     | 
    
         
            +
                  activejob (= 6.0.3.4)
         
     | 
| 
      
 131 
     | 
    
         
            +
                  activemodel (= 6.0.3.4)
         
     | 
| 
      
 132 
     | 
    
         
            +
                  activerecord (= 6.0.3.4)
         
     | 
| 
      
 133 
     | 
    
         
            +
                  activestorage (= 6.0.3.4)
         
     | 
| 
      
 134 
     | 
    
         
            +
                  activesupport (= 6.0.3.4)
         
     | 
| 
      
 135 
     | 
    
         
            +
                  bundler (>= 1.3.0)
         
     | 
| 
      
 136 
     | 
    
         
            +
                  railties (= 6.0.3.4)
         
     | 
| 
       107 
137 
     | 
    
         
             
                  sprockets-rails (>= 2.0.0)
         
     | 
| 
       108 
     | 
    
         
            -
                rails-dom-testing (2.0. 
     | 
| 
       109 
     | 
    
         
            -
                  activesupport (>= 4.2.0 
     | 
| 
       110 
     | 
    
         
            -
                  nokogiri ( 
     | 
| 
       111 
     | 
    
         
            -
                rails-html-sanitizer (1.0 
     | 
| 
       112 
     | 
    
         
            -
                  loofah (~> 2. 
     | 
| 
       113 
     | 
    
         
            -
                railties ( 
     | 
| 
       114 
     | 
    
         
            -
                  actionpack (=  
     | 
| 
       115 
     | 
    
         
            -
                  activesupport (=  
     | 
| 
      
 138 
     | 
    
         
            +
                rails-dom-testing (2.0.3)
         
     | 
| 
      
 139 
     | 
    
         
            +
                  activesupport (>= 4.2.0)
         
     | 
| 
      
 140 
     | 
    
         
            +
                  nokogiri (>= 1.6)
         
     | 
| 
      
 141 
     | 
    
         
            +
                rails-html-sanitizer (1.3.0)
         
     | 
| 
      
 142 
     | 
    
         
            +
                  loofah (~> 2.3)
         
     | 
| 
      
 143 
     | 
    
         
            +
                railties (6.0.3.4)
         
     | 
| 
      
 144 
     | 
    
         
            +
                  actionpack (= 6.0.3.4)
         
     | 
| 
      
 145 
     | 
    
         
            +
                  activesupport (= 6.0.3.4)
         
     | 
| 
       116 
146 
     | 
    
         
             
                  method_source
         
     | 
| 
       117 
147 
     | 
    
         
             
                  rake (>= 0.8.7)
         
     | 
| 
       118 
     | 
    
         
            -
                  thor (>= 0. 
     | 
| 
       119 
     | 
    
         
            -
                rake ( 
     | 
| 
       120 
     | 
    
         
            -
                 
     | 
| 
       121 
     | 
    
         
            -
                   
     | 
| 
       122 
     | 
    
         
            -
                   
     | 
| 
       123 
     | 
    
         
            -
                  uber ( 
     | 
| 
       124 
     | 
    
         
            -
                 
     | 
| 
       125 
     | 
    
         
            -
                  declarative (~> 0.0.5)
         
     | 
| 
       126 
     | 
    
         
            -
                  uber (>= 0.0.15, < 0.2.0)
         
     | 
| 
       127 
     | 
    
         
            -
                sprockets (3.7.0)
         
     | 
| 
      
 148 
     | 
    
         
            +
                  thor (>= 0.20.3, < 2.0)
         
     | 
| 
      
 149 
     | 
    
         
            +
                rake (13.0.3)
         
     | 
| 
      
 150 
     | 
    
         
            +
                representable (3.0.4)
         
     | 
| 
      
 151 
     | 
    
         
            +
                  declarative (< 0.1.0)
         
     | 
| 
      
 152 
     | 
    
         
            +
                  declarative-option (< 0.2.0)
         
     | 
| 
      
 153 
     | 
    
         
            +
                  uber (< 0.2.0)
         
     | 
| 
      
 154 
     | 
    
         
            +
                sprockets (4.0.2)
         
     | 
| 
       128 
155 
     | 
    
         
             
                  concurrent-ruby (~> 1.0)
         
     | 
| 
       129 
156 
     | 
    
         
             
                  rack (> 1, < 3)
         
     | 
| 
       130 
     | 
    
         
            -
                sprockets-rails (3.2. 
     | 
| 
      
 157 
     | 
    
         
            +
                sprockets-rails (3.2.2)
         
     | 
| 
       131 
158 
     | 
    
         
             
                  actionpack (>= 4.0)
         
     | 
| 
       132 
159 
     | 
    
         
             
                  activesupport (>= 4.0)
         
     | 
| 
       133 
160 
     | 
    
         
             
                  sprockets (>= 3.0.0)
         
     | 
| 
       134 
     | 
    
         
            -
                sqlite3 (1. 
     | 
| 
       135 
     | 
    
         
            -
                 
     | 
| 
       136 
     | 
    
         
            -
                 
     | 
| 
       137 
     | 
    
         
            -
                 
     | 
| 
      
 161 
     | 
    
         
            +
                sqlite3 (1.4.2)
         
     | 
| 
      
 162 
     | 
    
         
            +
                temple (0.8.2)
         
     | 
| 
      
 163 
     | 
    
         
            +
                thor (1.0.1)
         
     | 
| 
      
 164 
     | 
    
         
            +
                thread_safe (0.3.6)
         
     | 
| 
      
 165 
     | 
    
         
            +
                tilt (2.0.10)
         
     | 
| 
      
 166 
     | 
    
         
            +
                trailblazer-activity (0.11.4)
         
     | 
| 
      
 167 
     | 
    
         
            +
                  trailblazer-context (>= 0.3.1, < 0.4.0)
         
     | 
| 
      
 168 
     | 
    
         
            +
                trailblazer-activity-dsl-linear (0.3.4)
         
     | 
| 
      
 169 
     | 
    
         
            +
                  trailblazer-activity (>= 0.11.3, < 1.0.0)
         
     | 
| 
      
 170 
     | 
    
         
            +
                trailblazer-activity-implementation (0.0.4)
         
     | 
| 
      
 171 
     | 
    
         
            +
                  trailblazer-activity (>= 0.11.4)
         
     | 
| 
      
 172 
     | 
    
         
            +
                  trailblazer-activity-dsl-linear
         
     | 
| 
      
 173 
     | 
    
         
            +
                trailblazer-cells (0.0.3)
         
     | 
| 
      
 174 
     | 
    
         
            +
                  cells (>= 4.1.0.rc1, < 5.0.0)
         
     | 
| 
      
 175 
     | 
    
         
            +
                trailblazer-context (0.3.1)
         
     | 
| 
      
 176 
     | 
    
         
            +
                  hashie (~> 4.1)
         
     | 
| 
      
 177 
     | 
    
         
            +
                trailblazer-developer (0.0.17)
         
     | 
| 
      
 178 
     | 
    
         
            +
                  hirb
         
     | 
| 
      
 179 
     | 
    
         
            +
                  representable
         
     | 
| 
      
 180 
     | 
    
         
            +
                  trailblazer-activity (>= 0.11.0, < 1.0.0)
         
     | 
| 
      
 181 
     | 
    
         
            +
                  trailblazer-activity-dsl-linear
         
     | 
| 
      
 182 
     | 
    
         
            +
                trailblazer-operation (0.6.5)
         
     | 
| 
      
 183 
     | 
    
         
            +
                  trailblazer-activity (>= 0.11.2, < 1.0.0)
         
     | 
| 
      
 184 
     | 
    
         
            +
                  trailblazer-activity-dsl-linear (>= 0.3.2, < 1.0.0)
         
     | 
| 
      
 185 
     | 
    
         
            +
                  trailblazer-developer (>= 0.0.8)
         
     | 
| 
      
 186 
     | 
    
         
            +
                tzinfo (1.2.9)
         
     | 
| 
       138 
187 
     | 
    
         
             
                  thread_safe (~> 0.1)
         
     | 
| 
       139 
188 
     | 
    
         
             
                uber (0.1.0)
         
     | 
| 
       140 
     | 
    
         
            -
                websocket-driver (0. 
     | 
| 
      
 189 
     | 
    
         
            +
                websocket-driver (0.7.3)
         
     | 
| 
       141 
190 
     | 
    
         
             
                  websocket-extensions (>= 0.1.0)
         
     | 
| 
       142 
     | 
    
         
            -
                websocket-extensions (0.1. 
     | 
| 
      
 191 
     | 
    
         
            +
                websocket-extensions (0.1.5)
         
     | 
| 
      
 192 
     | 
    
         
            +
                zeitwerk (2.4.2)
         
     | 
| 
       143 
193 
     | 
    
         | 
| 
       144 
194 
     | 
    
         
             
            PLATFORMS
         
     | 
| 
       145 
195 
     | 
    
         
             
              ruby
         
     | 
| 
      
 196 
     | 
    
         
            +
              x86_64-linux
         
     | 
| 
       146 
197 
     | 
    
         | 
| 
       147 
198 
     | 
    
         
             
            DEPENDENCIES
         
     | 
| 
      
 199 
     | 
    
         
            +
              cells-erb
         
     | 
| 
      
 200 
     | 
    
         
            +
              cells-rails
         
     | 
| 
      
 201 
     | 
    
         
            +
              jwt
         
     | 
| 
      
 202 
     | 
    
         
            +
              minitest-line
         
     | 
| 
       148 
203 
     | 
    
         
             
              multi_json
         
     | 
| 
       149 
     | 
    
         
            -
              rails (~>  
     | 
| 
       150 
     | 
    
         
            -
              sqlite3
         
     | 
| 
       151 
     | 
    
         
            -
              trailblazer 
     | 
| 
      
 204 
     | 
    
         
            +
              rails (~> 6.0.3, >= 6.0.3.1)
         
     | 
| 
      
 205 
     | 
    
         
            +
              sqlite3 (~> 1.4)
         
     | 
| 
      
 206 
     | 
    
         
            +
              trailblazer-activity-dsl-linear (>= 0.3.4)
         
     | 
| 
      
 207 
     | 
    
         
            +
              trailblazer-cells
         
     | 
| 
       152 
208 
     | 
    
         
             
              trailblazer-endpoint!
         
     | 
| 
       153 
     | 
    
         
            -
              trailblazer-operation 
     | 
| 
       154 
     | 
    
         
            -
               
     | 
| 
      
 209 
     | 
    
         
            +
              trailblazer-operation
         
     | 
| 
      
 210 
     | 
    
         
            +
              trailblazer-workflow!
         
     | 
| 
       155 
211 
     | 
    
         | 
| 
       156 
212 
     | 
    
         
             
            BUNDLED WITH
         
     | 
| 
       157 
     | 
    
         
            -
                
     | 
| 
      
 213 
     | 
    
         
            +
               2.2.1
         
     | 
| 
         @@ -0,0 +1,35 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'date'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require "jwt"
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            # Thanks to pocketrocket GmbH for providing this sample code.
         
     | 
| 
      
 5 
     | 
    
         
            +
            module Auth
         
     | 
| 
      
 6 
     | 
    
         
            +
              class Jwt
         
     | 
| 
      
 7 
     | 
    
         
            +
                # Generate a JWT from arguments
         
     | 
| 
      
 8 
     | 
    
         
            +
                def self.generate(encoding_key, encoding_value, payload)
         
     | 
| 
      
 9 
     | 
    
         
            +
                  # expiration_time = Rails.application.credentials[:jwt_expiration_time].hours.from_now.to_i # TODO: show how to inject config options
         
     | 
| 
      
 10 
     | 
    
         
            +
                  expiration_time = 1.hours.from_now.to_i
         
     | 
| 
      
 11 
     | 
    
         
            +
                  payload['exp']  = expiration_time
         
     | 
| 
      
 12 
     | 
    
         
            +
                  jwt = JWT.encode(payload,
         
     | 
| 
      
 13 
     | 
    
         
            +
                    Rails.application.credentials[:secret_key_base], 'HS512',
         
     | 
| 
      
 14 
     | 
    
         
            +
                    { exp: expiration_time, encoding_key.to_sym => encoding_value }
         
     | 
| 
      
 15 
     | 
    
         
            +
                  )
         
     | 
| 
      
 16 
     | 
    
         
            +
                  return jwt
         
     | 
| 
      
 17 
     | 
    
         
            +
                end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                # Validate tokens expiration date
         
     | 
| 
      
 20 
     | 
    
         
            +
                def self.expired?(token)
         
     | 
| 
      
 21 
     | 
    
         
            +
                  decoded_token = JwtService.decode(token)
         
     | 
| 
      
 22 
     | 
    
         
            +
                  expiry_timestamp = decoded_token.first['exp']
         
     | 
| 
      
 23 
     | 
    
         
            +
                  expiration_date = Time.at(expiry_timestamp).to_datetime
         
     | 
| 
      
 24 
     | 
    
         
            +
                  return DateTime.now > expiration_date
         
     | 
| 
      
 25 
     | 
    
         
            +
                rescue => err
         
     | 
| 
      
 26 
     | 
    
         
            +
                  return true
         
     | 
| 
      
 27 
     | 
    
         
            +
                end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                def self.decode(token)
         
     | 
| 
      
 30 
     | 
    
         
            +
                  JWT.decode(token, Rails.application.credentials[:secret_key_base], true, { algorithm: 'HS512'})
         
     | 
| 
      
 31 
     | 
    
         
            +
                rescue => err # FIXME: is there any way to call {JWT.decode} without an exception?
         
     | 
| 
      
 32 
     | 
    
         
            +
                  nil
         
     | 
| 
      
 33 
     | 
    
         
            +
                end
         
     | 
| 
      
 34 
     | 
    
         
            +
              end
         
     | 
| 
      
 35 
     | 
    
         
            +
            end
         
     |