jets 2.3.13 → 2.3.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +37 -0
- data/Gemfile +1 -1
- data/backers.md +1 -0
- data/jets.gemspec +1 -1
- data/lib/jets.rb +2 -0
- data/lib/jets/application/defaults.rb +1 -0
- data/lib/jets/builders/code_builder.rb +14 -5
- data/lib/jets/builders/gem_replacer.rb +3 -1
- data/lib/jets/builders/ruby_packager.rb +1 -1
- data/lib/jets/cfn/upload.rb +18 -2
- data/lib/jets/commands/build.rb +1 -0
- data/lib/jets/commands/call.rb +1 -1
- data/lib/jets/commands/call/base_guesser.rb +4 -2
- data/lib/jets/commands/gems.rb +1 -1
- data/lib/jets/commands/import/base.rb +1 -1
- data/lib/jets/commands/main.rb +1 -1
- data/lib/jets/commands/new.rb +1 -1
- data/lib/jets/commands/rake_tasks.rb +1 -0
- data/lib/jets/commands/templates/skeleton/Gemfile.tt +2 -2
- data/lib/jets/commands/templates/webpacker/app/javascript/packs/application.js.tt +9 -1
- data/lib/jets/controller/authorization.rb +10 -1
- data/lib/jets/controller/base.rb +17 -4
- data/lib/jets/controller/parameters_filter.rb +29 -0
- data/lib/jets/controller/params.rb +8 -0
- data/lib/jets/core_ext/bundler.rb +7 -0
- data/lib/jets/job/base.rb +1 -1
- data/lib/jets/rack_server.rb +1 -1
- data/lib/jets/resource/api_gateway/method.rb +3 -1
- data/lib/jets/resource/api_gateway/method/authorization.rb +9 -0
- data/lib/jets/resource/api_gateway/resource.rb +1 -1
- data/lib/jets/resource/lambda/function.rb +3 -3
- data/lib/jets/router.rb +10 -10
- data/lib/jets/router/route/authorizer.rb +4 -0
- data/lib/jets/spec_helpers/controllers/request.rb +1 -1
- data/lib/jets/turbo/rails.rb +1 -1
- data/lib/jets/turbo/templates/config/database.yml +4 -0
- data/lib/jets/version.rb +1 -1
- metadata +19 -17
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 268e0ae0a8ea29568f0fc6bd1c5766be51ce75707d38aa91b2e297a4e3290c06
|
|
4
|
+
data.tar.gz: '05185b74c8cf470526dc50284074405acb63e9dfa351abddd465d3863485215b'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fc2abade16acc08eb2107d8ae4547c2f33b0e46c803a8f8231af4d8e236bc985d8f0bea8c8a335c39baf324fba9725f9c30c2377ac96fca53ae12067f1a6737a
|
|
7
|
+
data.tar.gz: 384865807f6d9154fdffa82a0cd165d9bb6c6d8bc5d9e6b3a505ced37586e9d7f382caeb0ae95f483005029f4b71ddbf606312eb0b6211cd834a4427c186a013
|
data/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,43 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
This project *loosely tries* to adhere to [Semantic Versioning](http://semver.org/).
|
|
5
5
|
|
|
6
|
+
## [2.3.18]
|
|
7
|
+
- #514 Allow to define route that contains dot
|
|
8
|
+
- #515 set content type on upload by using extension so cloudfront will compress when serving
|
|
9
|
+
- #517 support nested query params in tests
|
|
10
|
+
|
|
11
|
+
## [2.3.17]
|
|
12
|
+
- #472 Docs: Update cors-support.md
|
|
13
|
+
- #475 Docs: Update activerecord.md to include db:create step
|
|
14
|
+
- #476 Docs: Update authorizer-cognito.md
|
|
15
|
+
- #482 Docs: Fixed description for "jetpacker" gem in Gemfile
|
|
16
|
+
- #483 Docs: controllers Fix minor typo
|
|
17
|
+
- #489 Docs: call typo
|
|
18
|
+
- #490 Docs: authorizers typo
|
|
19
|
+
- #504 Docs: tutorial series
|
|
20
|
+
- #505 Docs: display more tutorial articles
|
|
21
|
+
- #509 Docs: Update lamdba permissions for minimal-iam-policy doc
|
|
22
|
+
- #512 Bug fix: fix on_lambda? check allow testing #512
|
|
23
|
+
|
|
24
|
+
## [2.3.16]
|
|
25
|
+
- #466 fix application_config typo
|
|
26
|
+
- #467 Handle forbidden error from s3
|
|
27
|
+
- #468 authorization_scopes
|
|
28
|
+
- #469 Fixed typo from STMP to SMTP
|
|
29
|
+
- #470 remove json dependency
|
|
30
|
+
- #471 use `Bundler.with_unbundled_env` remove bundler deprecation
|
|
31
|
+
|
|
32
|
+
## [2.3.15]
|
|
33
|
+
- #461 fix guesser lookup for long function names
|
|
34
|
+
|
|
35
|
+
## [2.3.14]
|
|
36
|
+
- #432 filtered_parameters support
|
|
37
|
+
- #447 improve nested routes support. order routes so that nested resources always work
|
|
38
|
+
- #451 Fix Jets turbo DB encoding
|
|
39
|
+
- #452 Print Cfn templates location after build
|
|
40
|
+
- #458 update webpacker fork with jetpacker gem
|
|
41
|
+
- #459 fix afterburner mode
|
|
42
|
+
|
|
6
43
|
## [2.3.13]
|
|
7
44
|
- #430 Remove out-of-date note about FIFO Queue
|
|
8
45
|
- #433 Fixed ApiResources with long names not included in the main CloudFormation template
|
data/Gemfile
CHANGED
data/backers.md
CHANGED
data/jets.gemspec
CHANGED
|
@@ -50,7 +50,6 @@ Gem::Specification.new do |spec|
|
|
|
50
50
|
spec.add_dependency "hashie"
|
|
51
51
|
spec.add_dependency "jets-gems"
|
|
52
52
|
spec.add_dependency "jets-html-sanitizer"
|
|
53
|
-
spec.add_dependency "json"
|
|
54
53
|
spec.add_dependency "kramdown"
|
|
55
54
|
spec.add_dependency "memoist"
|
|
56
55
|
spec.add_dependency "mimemagic"
|
|
@@ -67,4 +66,5 @@ Gem::Specification.new do |spec|
|
|
|
67
66
|
spec.add_development_dependency "bundler"
|
|
68
67
|
spec.add_development_dependency "rake"
|
|
69
68
|
spec.add_development_dependency "rspec"
|
|
69
|
+
spec.add_development_dependency "cfn-status"
|
|
70
70
|
end
|
data/lib/jets.rb
CHANGED
|
@@ -18,6 +18,8 @@ $:.unshift("#{gem_root}/lib")
|
|
|
18
18
|
$:.unshift("#{gem_root}/vendor/cfn-status/lib")
|
|
19
19
|
require "cfn_status"
|
|
20
20
|
|
|
21
|
+
require "jets/core_ext/bundler"
|
|
22
|
+
|
|
21
23
|
require "jets/autoloaders"
|
|
22
24
|
Jets::Autoloaders.log! if ENV["JETS_AUTOLOAD_LOG"]
|
|
23
25
|
Jets::Autoloaders.once.setup
|
|
@@ -149,6 +149,7 @@ class Jets::Application
|
|
|
149
149
|
|
|
150
150
|
config.controllers = ActiveSupport::OrderedOptions.new
|
|
151
151
|
config.controllers.default_protect_from_forgery = nil
|
|
152
|
+
config.controllers.filtered_parameters = []
|
|
152
153
|
|
|
153
154
|
config.deploy = ActiveSupport::OrderedOptions.new
|
|
154
155
|
config.deploy.stagger = ActiveSupport::OrderedOptions.new
|
|
@@ -82,7 +82,7 @@ module Jets::Builders
|
|
|
82
82
|
begin
|
|
83
83
|
s3.head_object(bucket: s3_bucket, key: s3_key)
|
|
84
84
|
true
|
|
85
|
-
rescue Aws::S3::Errors::NotFound
|
|
85
|
+
rescue Aws::S3::Errors::NotFound, Aws::S3::Errors::Forbidden
|
|
86
86
|
false
|
|
87
87
|
end
|
|
88
88
|
end
|
|
@@ -99,8 +99,17 @@ module Jets::Builders
|
|
|
99
99
|
|
|
100
100
|
# Code prep and zipping
|
|
101
101
|
check_code_size!
|
|
102
|
-
generate_shims
|
|
103
|
-
|
|
102
|
+
calculate_md5s # must be called before create_zip_files and generate_shims because checksums need to be populated
|
|
103
|
+
# generate_shims and create_zip_files use checksums
|
|
104
|
+
#
|
|
105
|
+
# Notes:
|
|
106
|
+
#
|
|
107
|
+
# Had moved calculate_md5s to fix a what thought was a subtle issue https://github.com/tongueroo/jets/pull/424
|
|
108
|
+
# But am unsure about that the fix now. This essentially reverts that issue.
|
|
109
|
+
#
|
|
110
|
+
# Fix in https://github.com/tongueroo/jets/pull/459
|
|
111
|
+
#
|
|
112
|
+
generate_shims # the generated handlers/data.yml has rack_zip key
|
|
104
113
|
create_zip_files
|
|
105
114
|
end
|
|
106
115
|
|
|
@@ -211,7 +220,7 @@ module Jets::Builders
|
|
|
211
220
|
# Checking this way because when using jets standalone for Afterburner mode we don't want to run into
|
|
212
221
|
# bundler gem collisions. TODO: figure out the a better way to handle the collisions.
|
|
213
222
|
lines = IO.readlines("#{Jets.root}/Gemfile")
|
|
214
|
-
lines.detect { |l| l =~ /webpacker/ }
|
|
223
|
+
lines.detect { |l| l =~ /webpacker/ || l =~ /jetpacker/ }
|
|
215
224
|
end
|
|
216
225
|
|
|
217
226
|
# This happens in the current app directory not the tmp code for simplicity
|
|
@@ -226,7 +235,7 @@ module Jets::Builders
|
|
|
226
235
|
|
|
227
236
|
# Need to capture JETS_ROOT since can be changed by Turbo mode
|
|
228
237
|
jets_root = Jets.root
|
|
229
|
-
Bundler.
|
|
238
|
+
Bundler.with_unbundled_env do
|
|
230
239
|
# Switch gemfile for Afterburner mode
|
|
231
240
|
gemfile = ENV['BUNDLE_GEMFILE']
|
|
232
241
|
ENV['BUNDLE_GEMFILE'] = "#{jets_root}/rack/Gemfile"
|
|
@@ -6,7 +6,9 @@ module Jets::Builders
|
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
def run
|
|
9
|
-
|
|
9
|
+
# use_gemspec to resolve http-parser gem issue
|
|
10
|
+
use_gemspec = !Jets::Turbo.afterburner? # gemspec approach breaks afterburner mode
|
|
11
|
+
check = Jets::Gems::Check.new(use_gemspec: use_gemspec)
|
|
10
12
|
if Jets.config.lambda.layers.empty?
|
|
11
13
|
found_gems = check.run! # exits early if missing gems found
|
|
12
14
|
else
|
|
@@ -59,7 +59,7 @@ module Jets::Builders
|
|
|
59
59
|
|
|
60
60
|
FileUtils.rm_rf("#{cache_area}/.bundle")
|
|
61
61
|
require "bundler" # dynamically require bundler so user can use any bundler
|
|
62
|
-
Bundler.
|
|
62
|
+
Bundler.with_unbundled_env do
|
|
63
63
|
sh(
|
|
64
64
|
"cd #{cache_area} && " \
|
|
65
65
|
"env bundle install --path #{cache_area}/vendor/gems --without development test"
|
data/lib/jets/cfn/upload.rb
CHANGED
|
@@ -7,6 +7,13 @@ module Jets::Cfn
|
|
|
7
7
|
include ActionView::Helpers::NumberHelper # number_to_human_size
|
|
8
8
|
|
|
9
9
|
attr_reader :bucket_name
|
|
10
|
+
|
|
11
|
+
CONTENT_TYPES_BY_EXTENSION = {
|
|
12
|
+
'.css' => 'text/css',
|
|
13
|
+
'.js' => 'application/javascript',
|
|
14
|
+
'.html' => 'text/html'
|
|
15
|
+
}
|
|
16
|
+
|
|
10
17
|
def initialize(bucket_name)
|
|
11
18
|
@bucket_name = bucket_name
|
|
12
19
|
end
|
|
@@ -90,8 +97,17 @@ module Jets::Cfn
|
|
|
90
97
|
|
|
91
98
|
key = s3_key(full_path)
|
|
92
99
|
obj = s3_resource.bucket(bucket_name).object(key)
|
|
93
|
-
puts "Uploading s3://#{bucket_name}/#{key}" # uncomment to see and debug
|
|
94
|
-
obj.upload_file(full_path, acl: "public-read", cache_control: cache_control)
|
|
100
|
+
puts "Uploading and setting content type for s3://#{bucket_name}/#{key}" # uncomment to see and debug
|
|
101
|
+
obj.upload_file(full_path, { acl: "public-read", cache_control: cache_control }.merge(content_type_headers(full_path)))
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def content_type_headers(full_path)
|
|
105
|
+
content_type = CONTENT_TYPES_BY_EXTENSION[File.extname(full_path)]
|
|
106
|
+
if content_type
|
|
107
|
+
{ content_type: content_type }
|
|
108
|
+
else
|
|
109
|
+
{}
|
|
110
|
+
end
|
|
95
111
|
end
|
|
96
112
|
|
|
97
113
|
def s3_key(full_path)
|
data/lib/jets/commands/build.rb
CHANGED
data/lib/jets/commands/call.rb
CHANGED
|
@@ -140,7 +140,7 @@ class Jets::Commands::Call
|
|
|
140
140
|
puts "Pro tip: The Lambda Console Link to the #{function_name} function has been added to your clipboard." unless @options[:mute]
|
|
141
141
|
end
|
|
142
142
|
|
|
143
|
-
# TODO: Hook client_context up and
|
|
143
|
+
# TODO: Hook client_context up and make sure it works. Think I've figure out how to sign client_context below.
|
|
144
144
|
# Client context must be a valid Base64-encoded JSON object
|
|
145
145
|
# Example: http://docs.aws.amazon.com/mobileanalytics/latest/ug/PutEvents.html
|
|
146
146
|
def client_context
|
|
@@ -36,9 +36,11 @@ class Jets::Commands::Call
|
|
|
36
36
|
def generated_function_name(function_name)
|
|
37
37
|
if function_name.size > Jets::MAX_FUNCTION_NAME_SIZE # name generated by CloudFormation
|
|
38
38
|
logical_id = @class_name.gsub('::','')
|
|
39
|
-
app_stack_arn = lookup(parent_stack[:outputs], logical_id)
|
|
40
39
|
|
|
41
|
-
|
|
40
|
+
parent_resources = stack_resources(parent_stack.stack_id)
|
|
41
|
+
app_stack = parent_resources.find { |s| s.logical_resource_id == logical_id }
|
|
42
|
+
|
|
43
|
+
resources = stack_resources(app_stack.physical_resource_id)
|
|
42
44
|
resource = resources.find { |r| r.logical_resource_id == method_name.camelize + "LambdaFunction" } # method_name only contains the method
|
|
43
45
|
resource.physical_resource_id # actual function name
|
|
44
46
|
else
|
data/lib/jets/commands/gems.rb
CHANGED
|
@@ -3,7 +3,7 @@ module Jets::Commands
|
|
|
3
3
|
desc "check", "Check if pre-built Lambda gems are available from the sources"
|
|
4
4
|
long_desc Help.text("gems:check")
|
|
5
5
|
def check
|
|
6
|
-
check = Jets::Gems::Check.new
|
|
6
|
+
check = Jets::Gems::Check.new
|
|
7
7
|
check.run! # exits early if missing gems found
|
|
8
8
|
# If reach here, means all gems are ok.
|
|
9
9
|
puts "Congrats! All gems are available in as pre-built Lambda gems 👍"
|
data/lib/jets/commands/main.rb
CHANGED
|
@@ -43,7 +43,7 @@ module Jets::Commands
|
|
|
43
43
|
puts Jets::Booter.message
|
|
44
44
|
Jets::Booter.check_config_ru!
|
|
45
45
|
Jets::RackServer.start(options) unless ENV['JETS_RACK'] == '0' # rack server runs in background by default
|
|
46
|
-
Bundler.
|
|
46
|
+
Bundler.with_unbundled_env do
|
|
47
47
|
system(command)
|
|
48
48
|
end
|
|
49
49
|
end
|
data/lib/jets/commands/new.rb
CHANGED
|
@@ -27,6 +27,7 @@ class Jets::Commands::RakeTasks
|
|
|
27
27
|
def load_webpacker_tasks
|
|
28
28
|
begin
|
|
29
29
|
require "webpacker"
|
|
30
|
+
require "webpacker/rake_tasks"
|
|
30
31
|
rescue LoadError
|
|
31
32
|
# puts "WARN: unable to load gem. #{$!}. Running with 'bundle exec' might fix this warning."
|
|
32
33
|
# Happens whne user calls jets help outside the jets project folder.
|
|
@@ -3,8 +3,8 @@ source "https://rubygems.org"
|
|
|
3
3
|
gem "jets"
|
|
4
4
|
|
|
5
5
|
<% if @webpacker -%>
|
|
6
|
-
# Include
|
|
7
|
-
gem "
|
|
6
|
+
# Include jetpacker if you are building html pages
|
|
7
|
+
gem "jetpacker"
|
|
8
8
|
<% end -%>
|
|
9
9
|
<% if @database == 'postgresql' %>
|
|
10
10
|
# Include pg gem if you are using ActiveRecord, remove next line
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint no-console:0 */
|
|
2
|
-
// This file is automatically compiled by Webpack
|
|
2
|
+
// This file is automatically compiled by Webpack, along with any other files
|
|
3
3
|
// present in this directory. You're encouraged to place your actual application logic in
|
|
4
4
|
// a relevant structure within app/javascript and only use these pack files to reference
|
|
5
5
|
// that code so it'll be compiled.
|
|
@@ -7,6 +7,14 @@
|
|
|
7
7
|
// To reference this file, add <%%= javascript_pack_tag 'application' %> to the appropriate
|
|
8
8
|
// layout file, like app/views/layouts/application.html.erb
|
|
9
9
|
|
|
10
|
+
|
|
11
|
+
// Uncomment to copy all static images under ../images to the output folder and reference
|
|
12
|
+
// them with the image_pack_tag helper in views (e.g <%%= image_pack_tag 'rails.png' %>)
|
|
13
|
+
// or the `imagePath` JavaScript helper below.
|
|
14
|
+
//
|
|
15
|
+
// const images = require.context('../images', true)
|
|
16
|
+
// const imagePath = (name) => images(name, true)
|
|
17
|
+
|
|
10
18
|
<% if @bootstrap -%>
|
|
11
19
|
import 'bootstrap/dist/js/bootstrap';
|
|
12
20
|
<% end -%>
|
|
@@ -6,7 +6,8 @@ class Jets::Controller
|
|
|
6
6
|
class_attribute :auth_type,
|
|
7
7
|
:auth_to,
|
|
8
8
|
:auth_options, # for only and except filters
|
|
9
|
-
:api_key_needed
|
|
9
|
+
:api_key_needed,
|
|
10
|
+
:authorization_scopes_value
|
|
10
11
|
end
|
|
11
12
|
|
|
12
13
|
class_methods do
|
|
@@ -31,6 +32,14 @@ class Jets::Controller
|
|
|
31
32
|
end
|
|
32
33
|
end
|
|
33
34
|
|
|
35
|
+
def authorization_scopes(value=nil)
|
|
36
|
+
if !value.nil?
|
|
37
|
+
self.authorization_scopes_value = value
|
|
38
|
+
else
|
|
39
|
+
self.authorization_scopes_value
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
34
43
|
def authorizer_metadata
|
|
35
44
|
Jets::Router::Route::Authorizer.metadata(auth_to)
|
|
36
45
|
end
|
data/lib/jets/controller/base.rb
CHANGED
|
@@ -100,14 +100,27 @@ class Jets::Controller
|
|
|
100
100
|
end
|
|
101
101
|
|
|
102
102
|
def log_info_start
|
|
103
|
-
display_event = @event.dup
|
|
104
|
-
display_event['body'] = '[BASE64_ENCODED]' if @event['isBase64Encoded']
|
|
105
103
|
# JSON.dump makes logging look pretty in CloudWatch logs because it keeps it on 1 line
|
|
104
|
+
|
|
106
105
|
ip = request.ip
|
|
107
106
|
Jets.logger.info "Started #{@event['httpMethod']} \"#{@event['path']}\" for #{ip} at #{Time.now}"
|
|
108
107
|
Jets.logger.info "Processing #{self.class.name}##{@meth}"
|
|
109
|
-
Jets.logger.info " Event: #{
|
|
110
|
-
Jets.logger.info " Parameters: #{JSON.dump(
|
|
108
|
+
Jets.logger.info " Event: #{event_log}"
|
|
109
|
+
Jets.logger.info " Parameters: #{JSON.dump(filtered_parameters.to_h)}"
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def event_log
|
|
113
|
+
display_event = @event.dup
|
|
114
|
+
|
|
115
|
+
if @event['isBase64Encoded']
|
|
116
|
+
display_event['body'] = '[BASE64_ENCODED]'
|
|
117
|
+
else
|
|
118
|
+
display_event['body'] = parameter_filter.filter_json(display_event['body'])
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
display_event["queryStringParameters"] = parameter_filter.filter(display_event['queryStringParameters'])
|
|
122
|
+
display_event["pathParameters"] = parameter_filter.filter(display_event['pathParameters'])
|
|
123
|
+
json_dump(display_event)
|
|
111
124
|
end
|
|
112
125
|
|
|
113
126
|
# Handles binary data safely
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
require "active_support/parameter_filter"
|
|
2
|
+
|
|
3
|
+
class Jets::Controller
|
|
4
|
+
class ParametersFilter
|
|
5
|
+
attr_reader :filters, :params_filter
|
|
6
|
+
|
|
7
|
+
def initialize(filters)
|
|
8
|
+
@filters = filters
|
|
9
|
+
@params_filter = ActiveSupport::ParameterFilter.new(filters)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def filter(params)
|
|
13
|
+
params && params_filter.filter(params)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def filter_json(json_text)
|
|
17
|
+
return json_text if filters.blank? || json_text.blank?
|
|
18
|
+
|
|
19
|
+
begin
|
|
20
|
+
hash_params = JSON.parse(json_text)
|
|
21
|
+
filtered_params = filter(hash_params)
|
|
22
|
+
JSON.dump(filtered_params)
|
|
23
|
+
rescue JSON::ParserError
|
|
24
|
+
String.new
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -29,6 +29,10 @@ class Jets::Controller
|
|
|
29
29
|
end
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
+
def filtered_parameters(**kwargs)
|
|
33
|
+
parameter_filter.filter params(**kwargs, raw: true) # Always filter raw hash
|
|
34
|
+
end
|
|
35
|
+
|
|
32
36
|
def query_parameters
|
|
33
37
|
event["queryStringParameters"] || {}
|
|
34
38
|
end
|
|
@@ -83,5 +87,9 @@ class Jets::Controller
|
|
|
83
87
|
return nil if body.nil?
|
|
84
88
|
Base64.decode64(body)
|
|
85
89
|
end
|
|
90
|
+
|
|
91
|
+
def parameter_filter
|
|
92
|
+
@parameter_filter ||= ParametersFilter.new Jets.config.controllers.filtered_parameters
|
|
93
|
+
end
|
|
86
94
|
end
|
|
87
95
|
end
|
data/lib/jets/job/base.rb
CHANGED
data/lib/jets/rack_server.rb
CHANGED
|
@@ -34,7 +34,7 @@ module Jets
|
|
|
34
34
|
def serve
|
|
35
35
|
# Note, looks like stopping jets server with Ctrl-C sends the TERM signal
|
|
36
36
|
# down to the sub bin/rackup command cleans up the child process fine.
|
|
37
|
-
Bundler.
|
|
37
|
+
Bundler.with_unbundled_env do
|
|
38
38
|
args = ''
|
|
39
39
|
# only forward the host option, port is always 9292 for simplicity
|
|
40
40
|
if @options[:host]
|
|
@@ -36,6 +36,8 @@ module Jets::Resource::ApiGateway
|
|
|
36
36
|
method_responses: []
|
|
37
37
|
}
|
|
38
38
|
props[:authorizer_id] = authorizer_id if authorizer_id
|
|
39
|
+
props[:authorization_scopes] = authorization_scopes if authorization_scopes
|
|
40
|
+
|
|
39
41
|
props
|
|
40
42
|
end
|
|
41
43
|
|
|
@@ -94,7 +96,7 @@ module Jets::Resource::ApiGateway
|
|
|
94
96
|
def camelized_path
|
|
95
97
|
path = @route.path
|
|
96
98
|
path = "homepage" if path == ''
|
|
97
|
-
path.gsub('/','_').gsub(':','').gsub('*','').camelize
|
|
99
|
+
path.gsub('/','_').gsub(':','').gsub('*','').gsub('.','').camelize
|
|
98
100
|
end
|
|
99
101
|
end
|
|
100
102
|
end
|
|
@@ -28,5 +28,14 @@ class Jets::Resource::ApiGateway::Method
|
|
|
28
28
|
controller_klass.api_key_required ||
|
|
29
29
|
Jets.config.api.api_key_required
|
|
30
30
|
end
|
|
31
|
+
|
|
32
|
+
def authorization_scopes
|
|
33
|
+
if @route.authorization_scopes
|
|
34
|
+
authorization_scopes = @route.authorization_scopes
|
|
35
|
+
elsif controller_klass.authorization_scopes
|
|
36
|
+
authorization_scopes = controller_klass.authorization_scopes
|
|
37
|
+
end
|
|
38
|
+
authorization_scopes
|
|
39
|
+
end
|
|
31
40
|
end
|
|
32
41
|
end
|
|
@@ -76,7 +76,7 @@ module Jets::Resource::ApiGateway
|
|
|
76
76
|
private
|
|
77
77
|
# Similar path_logical_id method in resource/route.rb
|
|
78
78
|
def path_logical_id(path)
|
|
79
|
-
path.gsub('/','_').gsub(':','').gsub('*','').gsub('-','_').camelize
|
|
79
|
+
path.gsub('/','_').gsub(':','').gsub('*','').gsub('-','_').gsub('.','_').camelize
|
|
80
80
|
end
|
|
81
81
|
end
|
|
82
82
|
end
|
|
@@ -52,8 +52,8 @@ module Jets::Resource::Lambda
|
|
|
52
52
|
environment: { variables: environment },
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
baseline.merge(
|
|
55
|
+
application_config = Jets.application.config.function.to_h
|
|
56
|
+
baseline.merge(application_config)
|
|
57
57
|
end
|
|
58
58
|
|
|
59
59
|
# Class properties example:
|
|
@@ -211,4 +211,4 @@ module Jets::Resource::Lambda
|
|
|
211
211
|
"#{@app_class}##{@task.meth}"
|
|
212
212
|
end
|
|
213
213
|
end
|
|
214
|
-
end
|
|
214
|
+
end
|
data/lib/jets/router.rb
CHANGED
|
@@ -93,18 +93,18 @@ module Jets
|
|
|
93
93
|
# Useful for RouterMatcher
|
|
94
94
|
#
|
|
95
95
|
# Precedence:
|
|
96
|
-
#
|
|
97
|
-
# 2. Then consider the routes with captures: post/:id
|
|
98
|
-
# 3. Last consider the routes with wildcards: *catchall
|
|
96
|
+
# Routes with wildcards are considered after routes without wildcards
|
|
99
97
|
#
|
|
100
|
-
#
|
|
101
|
-
#
|
|
98
|
+
# Routes with fewer captures are ordered first since both
|
|
99
|
+
# /posts/:post_id/comments/new and /posts/:post_id/comments/:id are equally
|
|
100
|
+
# long
|
|
101
|
+
#
|
|
102
|
+
# Routes with the same amount of captures and wildcards are orderd so that
|
|
103
|
+
# the longest path is considered first since posts/:id and posts/:id/edit
|
|
104
|
+
# can both match.
|
|
102
105
|
def ordered_routes
|
|
103
|
-
length = Proc.new { |r| r.path.length * -1 }
|
|
104
|
-
|
|
105
|
-
wildcard_routes = routes.select { |r| r.path.include?('*') }.sort_by(&length)
|
|
106
|
-
simple_routes = (routes - capture_routes - wildcard_routes).sort_by(&length)
|
|
107
|
-
simple_routes + capture_routes + wildcard_routes
|
|
106
|
+
length = Proc.new { |r| [r.path.count("*"), r.path.count(":"), r.path.length * -1] }
|
|
107
|
+
routes.sort_by(&length)
|
|
108
108
|
end
|
|
109
109
|
|
|
110
110
|
class << self
|
data/lib/jets/turbo/rails.rb
CHANGED
|
@@ -110,7 +110,7 @@ class Jets::Turbo
|
|
|
110
110
|
# TODO: remove duplication, copied from jets/commands/import/base.rb
|
|
111
111
|
# And modified it slightly
|
|
112
112
|
def bundle_install
|
|
113
|
-
Bundler.
|
|
113
|
+
Bundler.with_unbundled_env do
|
|
114
114
|
sh "cd #{build_area}/#{@project_folder}/rack && bundle install"
|
|
115
115
|
end
|
|
116
116
|
end
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
default: &default
|
|
2
2
|
adapter: <%= @adapter %>
|
|
3
|
+
<% if @adapter == 'postgresql' -%>
|
|
4
|
+
encoding: unicode
|
|
5
|
+
<% else -%>
|
|
3
6
|
encoding: utf8mb4
|
|
7
|
+
<% end -%>
|
|
4
8
|
pool: <%%= ENV["DB_POOL"] || 5 %>
|
|
5
9
|
database: <%%= ENV['DB_NAME'] || '<%= @database_development %>' %>
|
|
6
10
|
<% if @adapter == 'postgresql' -%>
|
data/lib/jets/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jets
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.3.
|
|
4
|
+
version: 2.3.18
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tung Nguyen
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-
|
|
11
|
+
date: 2020-11-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: actionmailer
|
|
@@ -332,20 +332,6 @@ dependencies:
|
|
|
332
332
|
- - ">="
|
|
333
333
|
- !ruby/object:Gem::Version
|
|
334
334
|
version: '0'
|
|
335
|
-
- !ruby/object:Gem::Dependency
|
|
336
|
-
name: json
|
|
337
|
-
requirement: !ruby/object:Gem::Requirement
|
|
338
|
-
requirements:
|
|
339
|
-
- - ">="
|
|
340
|
-
- !ruby/object:Gem::Version
|
|
341
|
-
version: '0'
|
|
342
|
-
type: :runtime
|
|
343
|
-
prerelease: false
|
|
344
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
345
|
-
requirements:
|
|
346
|
-
- - ">="
|
|
347
|
-
- !ruby/object:Gem::Version
|
|
348
|
-
version: '0'
|
|
349
335
|
- !ruby/object:Gem::Dependency
|
|
350
336
|
name: kramdown
|
|
351
337
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -556,6 +542,20 @@ dependencies:
|
|
|
556
542
|
- - ">="
|
|
557
543
|
- !ruby/object:Gem::Version
|
|
558
544
|
version: '0'
|
|
545
|
+
- !ruby/object:Gem::Dependency
|
|
546
|
+
name: cfn-status
|
|
547
|
+
requirement: !ruby/object:Gem::Requirement
|
|
548
|
+
requirements:
|
|
549
|
+
- - ">="
|
|
550
|
+
- !ruby/object:Gem::Version
|
|
551
|
+
version: '0'
|
|
552
|
+
type: :development
|
|
553
|
+
prerelease: false
|
|
554
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
555
|
+
requirements:
|
|
556
|
+
- - ">="
|
|
557
|
+
- !ruby/object:Gem::Version
|
|
558
|
+
version: '0'
|
|
559
559
|
description: 'Jets is a framework that allows you to create serverless applications
|
|
560
560
|
with a beautiful language: Ruby. It includes everything required to build and deploy
|
|
561
561
|
an application. Jets leverages the power of Ruby to make serverless joyful for
|
|
@@ -786,6 +786,7 @@ files:
|
|
|
786
786
|
- lib/jets/controller/middleware/main.rb
|
|
787
787
|
- lib/jets/controller/middleware/reloader.rb
|
|
788
788
|
- lib/jets/controller/middleware/webpacker_setup.rb
|
|
789
|
+
- lib/jets/controller/parameters_filter.rb
|
|
789
790
|
- lib/jets/controller/params.rb
|
|
790
791
|
- lib/jets/controller/rack/adapter.rb
|
|
791
792
|
- lib/jets/controller/rack/env.rb
|
|
@@ -796,6 +797,7 @@ files:
|
|
|
796
797
|
- lib/jets/controller/response.rb
|
|
797
798
|
- lib/jets/controller/stage.rb
|
|
798
799
|
- lib/jets/core.rb
|
|
800
|
+
- lib/jets/core_ext/bundler.rb
|
|
799
801
|
- lib/jets/core_ext/kernel.rb
|
|
800
802
|
- lib/jets/db.rb
|
|
801
803
|
- lib/jets/dotenv.rb
|
|
@@ -1101,7 +1103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
1101
1103
|
- !ruby/object:Gem::Version
|
|
1102
1104
|
version: '0'
|
|
1103
1105
|
requirements: []
|
|
1104
|
-
rubygems_version: 3.1.
|
|
1106
|
+
rubygems_version: 3.1.4
|
|
1105
1107
|
signing_key:
|
|
1106
1108
|
specification_version: 4
|
|
1107
1109
|
summary: Ruby Serverless Framework
|