pact_broker 2.106.0 → 2.107.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (154) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +24 -0
  3. data/Gemfile +3 -0
  4. data/db/migrations/20230131_add_cons_ver_id_ndx_to_latest_pp_id_for_cons_ver.rb +8 -4
  5. data/db/migrations/20230216_add_branch_heads_branch_version_id_index.rb +21 -0
  6. data/db/migrations/20230428_add_index_for_webhook_executions_pact_publication_id.rb +17 -0
  7. data/lib/pact_broker/api/contracts/base_contract.rb +22 -7
  8. data/lib/pact_broker/api/contracts/can_i_deploy_query_schema.rb +34 -0
  9. data/lib/pact_broker/api/contracts/configuration.rb +2 -0
  10. data/lib/pact_broker/api/contracts/consumer_version_selector_contract.rb +140 -0
  11. data/lib/pact_broker/api/contracts/dry_validation_errors_formatter.rb +50 -0
  12. data/lib/pact_broker/api/contracts/dry_validation_macros.rb +79 -0
  13. data/lib/pact_broker/api/contracts/dry_validation_methods.rb +71 -0
  14. data/lib/pact_broker/api/contracts/environment_schema.rb +19 -33
  15. data/lib/pact_broker/api/contracts/pacticipant_create_schema.rb +4 -17
  16. data/lib/pact_broker/api/contracts/pacticipant_schema.rb +15 -24
  17. data/lib/pact_broker/api/contracts/pacts_for_verification_json_query_schema.rb +37 -146
  18. data/lib/pact_broker/api/contracts/pacts_for_verification_query_string_schema.rb +7 -20
  19. data/lib/pact_broker/api/contracts/publish_contracts_contract_contract.rb +62 -0
  20. data/lib/pact_broker/api/contracts/publish_contracts_schema.rb +25 -124
  21. data/lib/pact_broker/api/contracts/put_pact_params_contract.rb +21 -26
  22. data/lib/pact_broker/api/contracts/utf_8_validation.rb +2 -0
  23. data/lib/pact_broker/api/contracts/validation_helpers.rb +71 -0
  24. data/lib/pact_broker/api/contracts/verification_contract.rb +10 -29
  25. data/lib/pact_broker/api/contracts/webhook_contract.rb +20 -172
  26. data/lib/pact_broker/api/contracts/webhook_pacticipant_contract.rb +33 -0
  27. data/lib/pact_broker/api/contracts/webhook_request_contract.rb +125 -0
  28. data/lib/pact_broker/api/contracts.rb +3 -0
  29. data/lib/pact_broker/api/decorators/custom_error_problem_json_decorator.rb +4 -4
  30. data/lib/pact_broker/api/decorators/dashboard_text_decorator.rb +2 -2
  31. data/lib/pact_broker/api/decorators/extended_pact_decorator.rb +1 -1
  32. data/lib/pact_broker/api/decorators/matrix_decorator.rb +4 -4
  33. data/lib/pact_broker/api/decorators/matrix_text_decorator.rb +1 -1
  34. data/lib/pact_broker/api/decorators/pact_decorator.rb +1 -1
  35. data/lib/pact_broker/api/decorators/pacticipant_collection_decorator.rb +2 -2
  36. data/lib/pact_broker/api/decorators/pacticipant_decorator.rb +2 -1
  37. data/lib/pact_broker/api/decorators/pacts_for_verification_query_decorator.rb +4 -1
  38. data/lib/pact_broker/api/decorators/pagination_links.rb +6 -6
  39. data/lib/pact_broker/api/decorators/runtime_error_problem_json_decorator.rb +4 -4
  40. data/lib/pact_broker/api/decorators/validation_errors_problem_json_decorator.rb +6 -6
  41. data/lib/pact_broker/api/decorators/verifiable_pact_decorator.rb +4 -4
  42. data/lib/pact_broker/api/decorators/webhook_decorator.rb +2 -3
  43. data/lib/pact_broker/api/decorators/webhook_execution_result_decorator.rb +5 -12
  44. data/lib/pact_broker/api/resources/all_webhooks.rb +5 -11
  45. data/lib/pact_broker/api/resources/base_resource.rb +3 -20
  46. data/lib/pact_broker/api/resources/branch_version.rb +3 -3
  47. data/lib/pact_broker/api/resources/can_i_deploy.rb +4 -19
  48. data/lib/pact_broker/api/resources/can_i_deploy_pacticipant_version_by_branch_to_environment.rb +1 -4
  49. data/lib/pact_broker/api/resources/can_i_deploy_pacticipant_version_by_tag_to_tag.rb +0 -2
  50. data/lib/pact_broker/api/resources/can_i_deploy_pacticipant_version_by_tag_to_tag_badge.rb +1 -2
  51. data/lib/pact_broker/api/resources/currently_deployed_versions_for_environment.rb +2 -2
  52. data/lib/pact_broker/api/resources/currently_supported_versions_for_environment.rb +2 -2
  53. data/lib/pact_broker/api/resources/dashboard.rb +3 -3
  54. data/lib/pact_broker/api/resources/deployed_version.rb +1 -1
  55. data/lib/pact_broker/api/resources/deployed_versions_for_version_and_environment.rb +2 -2
  56. data/lib/pact_broker/api/resources/environment.rb +1 -1
  57. data/lib/pact_broker/api/resources/environments.rb +2 -2
  58. data/lib/pact_broker/api/resources/error_handling_methods.rb +2 -2
  59. data/lib/pact_broker/api/resources/integrations.rb +1 -1
  60. data/lib/pact_broker/api/resources/label.rb +1 -1
  61. data/lib/pact_broker/api/resources/latest_pact.rb +2 -2
  62. data/lib/pact_broker/api/resources/latest_pacts.rb +1 -1
  63. data/lib/pact_broker/api/resources/latest_verifications_for_consumer_version.rb +1 -1
  64. data/lib/pact_broker/api/resources/matrix.rb +2 -2
  65. data/lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb +1 -1
  66. data/lib/pact_broker/api/resources/pact.rb +7 -4
  67. data/lib/pact_broker/api/resources/pact_triggered_webhooks.rb +1 -1
  68. data/lib/pact_broker/api/resources/pact_versions.rb +1 -1
  69. data/lib/pact_broker/api/resources/pact_webhooks.rb +7 -14
  70. data/lib/pact_broker/api/resources/pact_webhooks_status.rb +6 -2
  71. data/lib/pact_broker/api/resources/pacticipant.rb +1 -1
  72. data/lib/pact_broker/api/resources/pacticipant_webhooks.rb +7 -5
  73. data/lib/pact_broker/api/resources/pacticipants.rb +2 -2
  74. data/lib/pact_broker/api/resources/pacticipants_for_label.rb +1 -1
  75. data/lib/pact_broker/api/resources/previous_distinct_pact_version.rb +1 -1
  76. data/lib/pact_broker/api/resources/provider_pacts.rb +1 -1
  77. data/lib/pact_broker/api/resources/provider_pacts_for_verification.rb +4 -13
  78. data/lib/pact_broker/api/resources/publish_contracts.rb +8 -3
  79. data/lib/pact_broker/api/resources/released_version.rb +1 -1
  80. data/lib/pact_broker/api/resources/released_versions_for_version_and_environment.rb +2 -2
  81. data/lib/pact_broker/api/resources/tag.rb +1 -1
  82. data/lib/pact_broker/api/resources/tagged_pact_versions.rb +1 -1
  83. data/lib/pact_broker/api/resources/triggered_webhook_logs.rb +2 -2
  84. data/lib/pact_broker/api/resources/verification.rb +2 -2
  85. data/lib/pact_broker/api/resources/verification_triggered_webhooks.rb +1 -1
  86. data/lib/pact_broker/api/resources/verifications.rb +4 -6
  87. data/lib/pact_broker/api/resources/version.rb +1 -1
  88. data/lib/pact_broker/api/resources/versions.rb +1 -1
  89. data/lib/pact_broker/api/resources/webhook.rb +7 -6
  90. data/lib/pact_broker/api/resources/webhook_execution.rb +6 -4
  91. data/lib/pact_broker/api.rb +3 -12
  92. data/lib/pact_broker/certificates/certificate.rb +1 -0
  93. data/lib/pact_broker/config/setting.rb +1 -0
  94. data/lib/pact_broker/contracts/service.rb +1 -0
  95. data/lib/pact_broker/date_helper.rb +1 -1
  96. data/lib/pact_broker/db/clean_incremental.rb +1 -1
  97. data/lib/pact_broker/db/delete_overwritten_data.rb +6 -2
  98. data/lib/pact_broker/deployments/currently_deployed_version_id.rb +2 -0
  99. data/lib/pact_broker/deployments/deployed_version.rb +2 -0
  100. data/lib/pact_broker/deployments/deployed_version_service.rb +5 -1
  101. data/lib/pact_broker/deployments/environment.rb +2 -0
  102. data/lib/pact_broker/deployments/environment_service.rb +4 -3
  103. data/lib/pact_broker/deployments/released_version.rb +2 -0
  104. data/lib/pact_broker/deployments/released_version_service.rb +4 -0
  105. data/lib/pact_broker/diagnostic/resources/base_resource.rb +1 -1
  106. data/lib/pact_broker/doc/views/index/publish-contracts.markdown +5 -5
  107. data/lib/pact_broker/domain/label.rb +1 -0
  108. data/lib/pact_broker/domain/tag.rb +2 -0
  109. data/lib/pact_broker/domain/verification.rb +1 -1
  110. data/lib/pact_broker/domain/version.rb +4 -1
  111. data/lib/pact_broker/domain/webhook.rb +1 -1
  112. data/lib/pact_broker/index/service.rb +1 -1
  113. data/lib/pact_broker/integrations/integration.rb +1 -0
  114. data/lib/pact_broker/locale/en.yml +35 -14
  115. data/lib/pact_broker/matrix/query_ids.rb +4 -4
  116. data/lib/pact_broker/matrix/resolved_selector.rb +6 -1
  117. data/lib/pact_broker/matrix/service.rb +1 -0
  118. data/lib/pact_broker/messages.rb +5 -1
  119. data/lib/pact_broker/pacticipants/repository.rb +12 -3
  120. data/lib/pact_broker/pacticipants/service.rb +7 -0
  121. data/lib/pact_broker/pacts/pact_params.rb +6 -17
  122. data/lib/pact_broker/pacts/pact_version.rb +1 -0
  123. data/lib/pact_broker/policies.rb +4 -4
  124. data/lib/pact_broker/test/http_test_data_builder.rb +46 -2
  125. data/lib/pact_broker/ui/app.rb +2 -2
  126. data/lib/pact_broker/verifications/latest_verification_id_for_pact_version_and_provider_version.rb +1 -1
  127. data/lib/pact_broker/verifications/pact_version_provider_tag_successful_verification.rb +1 -0
  128. data/lib/pact_broker/verifications/service.rb +0 -6
  129. data/lib/pact_broker/version.rb +1 -1
  130. data/lib/pact_broker/versions/branch.rb +1 -0
  131. data/lib/pact_broker/versions/branch_head.rb +2 -1
  132. data/lib/pact_broker/versions/branch_version.rb +11 -0
  133. data/lib/pact_broker/webhooks/execution.rb +1 -1
  134. data/lib/pact_broker/webhooks/repository.rb +1 -1
  135. data/lib/pact_broker/webhooks/service.rb +3 -25
  136. data/lib/pact_broker/webhooks/triggered_webhook.rb +1 -0
  137. data/lib/pact_broker/webhooks/webhook_event.rb +1 -0
  138. data/lib/pact_broker/webmachine.rb +22 -0
  139. data/lib/rack/pact_broker/invalid_uri_protection.rb +1 -1
  140. data/lib/rack/pact_broker/use_when.rb +6 -5
  141. data/lib/sequel/plugins/age.rb +13 -0
  142. data/lib/webmachine/application_monkey_patch.rb +5 -0
  143. data/lib/webmachine/describe_routes.rb +35 -8
  144. data/lib/webmachine/render_error_monkey_patch.rb +1 -1
  145. data/pact_broker.gemspec +6 -17
  146. metadata +56 -72
  147. data/lib/pact/doc/README.md +0 -5
  148. data/lib/pact_broker/api/contracts/dry_validation_predicates.rb +0 -36
  149. data/lib/pact_broker/api/contracts/dry_validation_workarounds.rb +0 -39
  150. data/lib/pact_broker/api/contracts/pacticipant_name_contract.rb +0 -24
  151. data/lib/pact_broker/api/contracts/pacticipant_name_validation.rb +0 -30
  152. data/lib/pact_broker/api/contracts/request_validations.rb +0 -33
  153. data/lib/pact_broker/api/resources/webhook_resource_methods.rb +0 -17
  154. data/lib/pact_broker/matrix/can_i_deploy_query_schema.rb +0 -46
@@ -45,7 +45,7 @@ module Rack
45
45
  end
46
46
 
47
47
  def validate(uri)
48
- decoded_path = URI.decode(uri.path)
48
+ decoded_path = URI.decode_www_form_component(uri.path)
49
49
  if decoded_path.include?("\n")
50
50
  message("errors.new_line_in_url_path")
51
51
  elsif decoded_path.include?("\t")
@@ -15,11 +15,12 @@ module Rack
15
15
  module PactBroker
16
16
  module UseWhen
17
17
  class ConditionallyUseMiddleware
18
- def initialize(app, condition_proc, middleware, *args, &block)
18
+ def initialize(app, condition_proc, middleware, *args, **kwargs, &block)
19
19
  @app_without_middleware = app
20
20
  @condition_proc = condition_proc
21
21
  @middleware = middleware
22
22
  @args = args
23
+ @kwargs = kwargs
23
24
  @block = block
24
25
  end
25
26
 
@@ -33,12 +34,12 @@ module Rack
33
34
 
34
35
  private
35
36
 
36
- attr_reader :app_without_middleware, :condition_proc, :middleware, :args, :block
37
+ attr_reader :app_without_middleware, :condition_proc, :middleware, :args, :kwargs, :block
37
38
 
38
39
  def app_with_middleware
39
40
  @app_with_middleware ||= begin
40
41
  rack_builder = ::Rack::Builder.new
41
- rack_builder.use middleware, *args, &block
42
+ rack_builder.use middleware, *args, **kwargs, &block
42
43
  rack_builder.run app_without_middleware
43
44
  rack_builder.to_app
44
45
  end
@@ -46,8 +47,8 @@ module Rack
46
47
  end
47
48
 
48
49
  refine Rack::Builder do
49
- def use_when(condition_proc, middleware, *args, &block)
50
- use(ConditionallyUseMiddleware, condition_proc, middleware, *args, &block)
50
+ def use_when(condition_proc, middleware, *args, **kwargs, &block)
51
+ use(ConditionallyUseMiddleware, condition_proc, middleware, *args, **kwargs, &block)
51
52
  end
52
53
  end
53
54
  end
@@ -0,0 +1,13 @@
1
+ require "moments"
2
+
3
+ module Sequel
4
+ module Plugins
5
+ module Age
6
+ module InstanceMethods
7
+ def age
8
+ @age ||= Moments.difference(Time.now, created_at.to_time)
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -2,9 +2,14 @@ require "webmachine/application"
2
2
 
3
3
  class Webmachine::Application
4
4
  def application_context= application_context
5
+ @application_context = application_context
5
6
  # naughty, but better than setting each route manually
6
7
  routes.each do | route |
7
8
  route.instance_variable_get(:@bindings)[:application_context] = application_context
8
9
  end
9
10
  end
11
+
12
+ def application_context
13
+ @application_context
14
+ end
10
15
  end
@@ -1,7 +1,9 @@
1
1
  require "webmachine/adapters/rack_mapped"
2
+ require "pact_broker/string_refinements"
2
3
 
3
4
  module Webmachine
4
5
  class DescribeRoutes
6
+ using PactBroker::StringRefinements
5
7
 
6
8
  Route = Struct.new(
7
9
  :path,
@@ -11,6 +13,7 @@ module Webmachine
11
13
  :resource_class_location,
12
14
  :allowed_methods,
13
15
  :policy_class,
16
+ :schemas,
14
17
  keyword_init: true) do
15
18
 
16
19
  def [](key)
@@ -77,33 +80,57 @@ module Webmachine
77
80
  resource_class: webmachine_route.resource,
78
81
  resource_name: webmachine_route.instance_variable_get(:@bindings)[:resource_name],
79
82
  resource_class_location: resource_path_absolute.relative_path_from(Pathname.pwd).to_s
80
- }.merge(info_from_resource_instance(webmachine_route)))
83
+ }.merge(info_from_resource_instance(webmachine_route, webmachine_application.application_context)))
81
84
  end.reject{ | route | route.resource_class == Webmachine::Trace::TraceResource }
82
85
  end
83
86
 
84
- def self.info_from_resource_instance(webmachine_route)
87
+ def self.info_from_resource_instance(webmachine_route, application_context)
85
88
  with_no_logging do
86
- path_info = { application_context: OpenStruct.new, pacticipant_name: "foo", pacticipant_version_number: "1", resource_name: "foo" }
89
+ path_info = { application_context: application_context, pacticipant_name: "foo", pacticipant_version_number: "1", resource_name: "foo" }
87
90
  path_info.default = "1"
88
- dummy_request = Webmachine::Adapters::Rack::RackRequest.new("GET", "/", Webmachine::Headers["host" => "example.org"], nil, {}, {}, { "REQUEST_METHOD" => "GET" })
89
- dummy_request.path_info = path_info
91
+ dummy_request = dummy_request(http_method: "GET", path_info: path_info)
92
+
90
93
  dummy_resource = webmachine_route.resource.new(dummy_request, Webmachine::Response.new)
91
94
  if dummy_resource
92
95
  {
93
96
  allowed_methods: dummy_resource.allowed_methods,
94
- }
97
+ schemas: dummy_resource.respond_to?(:schema, true) && dummy_resource.send(:schema) ? schemas(dummy_resource.allowed_methods, webmachine_route.resource, path_info) : nil
98
+ }.compact
95
99
  else
96
100
  {}
97
101
  end
98
102
  end
99
103
  rescue StandardError => e
100
- puts "Could not determine instance info for #{route.resource}. #{e.class} - #{e.message}"
104
+ puts "Could not determine instance info for #{webmachine_route.resource}. #{e.class} - #{e.message}"
101
105
  {}
102
106
  end
103
107
 
108
+ # This is not entirely accurate, because some GET requests have schemas too, but we can't tell that statically at the moment
109
+ def self.schemas(allowed_methods, resource, path_info)
110
+ (allowed_methods - ["GET", "OPTIONS", "DELETE"]).collect do | http_method |
111
+ resource.new(dummy_request(http_method: http_method, path_info: path_info), Webmachine::Response.new).send(:schema)
112
+ end.uniq.collect do | schema_class |
113
+ {
114
+ class: schema_class,
115
+ location: source_location_for(schema_class)
116
+ }
117
+ end
118
+ end
119
+
120
+ def self.dummy_request(http_method: "GET", path_info: )
121
+ dummy_request = Webmachine::Adapters::Rack::RackRequest.new(http_method, "/", Webmachine::Headers["host" => "example.org"], nil, {}, {}, { "REQUEST_METHOD" => http_method })
122
+ dummy_request.path_info = path_info
123
+ dummy_request
124
+ end
125
+
104
126
  def self.source_location_for(clazz)
105
127
  first_instance_method_name = (clazz.instance_methods(false) + clazz.private_instance_methods(false)).first
106
- clazz.instance_method(first_instance_method_name).source_location.first
128
+ if first_instance_method_name
129
+ clazz.instance_method(first_instance_method_name).source_location.first
130
+ else
131
+ # have a guess!
132
+ "lib/" + clazz.name.snakecase.gsub("::", "/") + ".rb"
133
+ end
107
134
  end
108
135
 
109
136
  # If we don't turn off the logging, we get metrics logging due to the instantiation of the Webmachine::RackRequest class
@@ -29,7 +29,7 @@ module Webmachine
29
29
  res.code = code
30
30
  unless res.body
31
31
  title, message = t(["errors.#{code}.title", "errors.#{code}.message"],
32
- { :method => req.method,
32
+ **{ :method => req.method,
33
33
  :error => res.error}.merge(options))
34
34
 
35
35
  title = options[:title] if options[:title]
data/pact_broker.gemspec CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |gem|
20
20
  if Dir.exist?(".git")
21
21
  Dir.chdir(File.expand_path(__dir__)) do
22
22
  include_patterns = %w[lib/**/* db/**/* docs/**/*.md public/**/* vendor/**/* LICENSE.txt README.md CHANGELOG.md Gemfile pact_broker.gemspec]
23
- exclude_patterns = %w[db/test/**/*]
23
+ exclude_patterns = %w[db/test/**/* lib/**/*/README.md]
24
24
  include_list = include_patterns.flat_map{ | pattern | Dir.glob(pattern) } - exclude_patterns.flat_map{ | pattern | Dir.glob(pattern) }
25
25
 
26
26
  `git ls-files -z`.split("\x0") & include_list
@@ -49,23 +49,13 @@ Gem::Specification.new do |gem|
49
49
  gem.require_paths = ["lib"]
50
50
  gem.license = "MIT"
51
51
 
52
- #gem.add_runtime_dependency 'pact'
53
52
  gem.add_runtime_dependency "json", "~> 2.3"
53
+ gem.add_runtime_dependency "psych", "~> 4.0" # TODO identify breaking changes and see if we can use 5
54
54
  gem.add_runtime_dependency "roar", "~> 1.1"
55
- gem.add_runtime_dependency "reform", "~> 2.3.3"
56
- gem.add_runtime_dependency "dry-validation", "~> 0.10.5"
57
- # if dry-container is not locked, get this error:
58
- # An error occurred while loading spec_helper.
59
- # Failure/Error: require "reform/form/dry"
60
- # NoMethodError:
61
- # undefined method `call' for nil:NilClass
62
- # # /Users/beth.skurrie/.gem/ruby/2.7.5/gems/dry-container-0.10.0/lib/dry/container/mixin.rb:151:in `register'
63
- gem.add_runtime_dependency "dry-container", "0.8.0"
64
- # /usr/local/bundle/gems/dry-validation-0.10.7/lib/dry/validation/schema/class_interface.rb:7:in `<module:Validation>' [dry-configurable] default value as positional argument to settings is deprecated and will be removed in the next major version
65
- # Provide a `default:` keyword argument instead
66
- gem.add_runtime_dependency "dry-configurable", "0.12.1"
55
+ gem.add_runtime_dependency "dry-validation", "~> 1.8"
56
+ gem.add_runtime_dependency "reform", "~> 2.6"
67
57
  gem.add_runtime_dependency "sequel", "~> 5.28"
68
- gem.add_runtime_dependency "webmachine", "1.6.0"
58
+ gem.add_runtime_dependency "webmachine", ">= 2.0.0.beta", "< 3.0"
69
59
  gem.add_runtime_dependency "semver2", "~> 3.4.2"
70
60
  gem.add_runtime_dependency "rack", ">= 2.2.3", "~> 2.2"
71
61
  gem.add_runtime_dependency "redcarpet", ">= 3.5.1", "~>3.5"
@@ -75,12 +65,11 @@ Gem::Specification.new do |gem|
75
65
  gem.add_runtime_dependency "haml", "~>5.0"
76
66
  gem.add_runtime_dependency "sucker_punch", "~>2.0"
77
67
  gem.add_runtime_dependency "rack-protection", ">= 2.0.8.1", "< 3.0"
78
- gem.add_runtime_dependency "dry-types", "~> 0.10.3" # https://travis-ci.org/pact-foundation/pact_broker/jobs/249448621
79
- gem.add_runtime_dependency "dry-logic", "0.4.2" # Later version cases ArgumentError: wrong number of arguments
80
68
  gem.add_runtime_dependency "table_print", "~> 1.5"
81
69
  gem.add_runtime_dependency "semantic_logger", "~> 4.11"
82
70
  gem.add_runtime_dependency "sanitize", "~> 6.0"
83
71
  gem.add_runtime_dependency "wisper", "~> 2.0"
84
72
  gem.add_runtime_dependency "anyway_config", "~> 2.1"
85
73
  gem.add_runtime_dependency "request_store", "~> 1.5"
74
+ gem.add_runtime_dependency "moments", "~> 0.2"
86
75
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pact_broker
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.106.0
4
+ version: 2.107.0.beta.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bethany Skurrie
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2023-02-03 00:00:00.000000000 Z
13
+ date: 2023-05-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: json
@@ -27,75 +27,61 @@ dependencies:
27
27
  - !ruby/object:Gem::Version
28
28
  version: '2.3'
29
29
  - !ruby/object:Gem::Dependency
30
- name: roar
30
+ name: psych
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
33
  - - "~>"
34
34
  - !ruby/object:Gem::Version
35
- version: '1.1'
35
+ version: '4.0'
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - "~>"
41
41
  - !ruby/object:Gem::Version
42
- version: '1.1'
42
+ version: '4.0'
43
43
  - !ruby/object:Gem::Dependency
44
- name: reform
44
+ name: roar
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: 2.3.3
49
+ version: '1.1'
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - "~>"
55
55
  - !ruby/object:Gem::Version
56
- version: 2.3.3
56
+ version: '1.1'
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: dry-validation
59
59
  requirement: !ruby/object:Gem::Requirement
60
60
  requirements:
61
61
  - - "~>"
62
62
  - !ruby/object:Gem::Version
63
- version: 0.10.5
63
+ version: '1.8'
64
64
  type: :runtime
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
68
  - - "~>"
69
69
  - !ruby/object:Gem::Version
70
- version: 0.10.5
71
- - !ruby/object:Gem::Dependency
72
- name: dry-container
73
- requirement: !ruby/object:Gem::Requirement
74
- requirements:
75
- - - '='
76
- - !ruby/object:Gem::Version
77
- version: 0.8.0
78
- type: :runtime
79
- prerelease: false
80
- version_requirements: !ruby/object:Gem::Requirement
81
- requirements:
82
- - - '='
83
- - !ruby/object:Gem::Version
84
- version: 0.8.0
70
+ version: '1.8'
85
71
  - !ruby/object:Gem::Dependency
86
- name: dry-configurable
72
+ name: reform
87
73
  requirement: !ruby/object:Gem::Requirement
88
74
  requirements:
89
- - - '='
75
+ - - "~>"
90
76
  - !ruby/object:Gem::Version
91
- version: 0.12.1
77
+ version: '2.6'
92
78
  type: :runtime
93
79
  prerelease: false
94
80
  version_requirements: !ruby/object:Gem::Requirement
95
81
  requirements:
96
- - - '='
82
+ - - "~>"
97
83
  - !ruby/object:Gem::Version
98
- version: 0.12.1
84
+ version: '2.6'
99
85
  - !ruby/object:Gem::Dependency
100
86
  name: sequel
101
87
  requirement: !ruby/object:Gem::Requirement
@@ -114,16 +100,22 @@ dependencies:
114
100
  name: webmachine
115
101
  requirement: !ruby/object:Gem::Requirement
116
102
  requirements:
117
- - - '='
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: 2.0.0.beta
106
+ - - "<"
118
107
  - !ruby/object:Gem::Version
119
- version: 1.6.0
108
+ version: '3.0'
120
109
  type: :runtime
121
110
  prerelease: false
122
111
  version_requirements: !ruby/object:Gem::Requirement
123
112
  requirements:
124
- - - '='
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: 2.0.0.beta
116
+ - - "<"
125
117
  - !ruby/object:Gem::Version
126
- version: 1.6.0
118
+ version: '3.0'
127
119
  - !ruby/object:Gem::Dependency
128
120
  name: semver2
129
121
  requirement: !ruby/object:Gem::Requirement
@@ -286,34 +278,6 @@ dependencies:
286
278
  - - "<"
287
279
  - !ruby/object:Gem::Version
288
280
  version: '3.0'
289
- - !ruby/object:Gem::Dependency
290
- name: dry-types
291
- requirement: !ruby/object:Gem::Requirement
292
- requirements:
293
- - - "~>"
294
- - !ruby/object:Gem::Version
295
- version: 0.10.3
296
- type: :runtime
297
- prerelease: false
298
- version_requirements: !ruby/object:Gem::Requirement
299
- requirements:
300
- - - "~>"
301
- - !ruby/object:Gem::Version
302
- version: 0.10.3
303
- - !ruby/object:Gem::Dependency
304
- name: dry-logic
305
- requirement: !ruby/object:Gem::Requirement
306
- requirements:
307
- - - '='
308
- - !ruby/object:Gem::Version
309
- version: 0.4.2
310
- type: :runtime
311
- prerelease: false
312
- version_requirements: !ruby/object:Gem::Requirement
313
- requirements:
314
- - - '='
315
- - !ruby/object:Gem::Version
316
- version: 0.4.2
317
281
  - !ruby/object:Gem::Dependency
318
282
  name: table_print
319
283
  requirement: !ruby/object:Gem::Requirement
@@ -398,6 +362,20 @@ dependencies:
398
362
  - - "~>"
399
363
  - !ruby/object:Gem::Version
400
364
  version: '1.5'
365
+ - !ruby/object:Gem::Dependency
366
+ name: moments
367
+ requirement: !ruby/object:Gem::Requirement
368
+ requirements:
369
+ - - "~>"
370
+ - !ruby/object:Gem::Version
371
+ version: '0.2'
372
+ type: :runtime
373
+ prerelease: false
374
+ version_requirements: !ruby/object:Gem::Requirement
375
+ requirements:
376
+ - - "~>"
377
+ - !ruby/object:Gem::Version
378
+ version: '0.2'
401
379
  description: A server that stores and returns pact files generated by the pact gem.
402
380
  It enables head/prod cross testing of the consumer and provider projects.
403
381
  email:
@@ -591,12 +569,13 @@ files:
591
569
  - db/migrations/20221208_add_index_to_pact_version_provider_tag_successful_verifications.rb
592
570
  - db/migrations/20221215_add_prov_ver_id_ndx_to_latest_verifi_id_for_pact_ver_and_prov_ver.rb
593
571
  - db/migrations/20230131_add_cons_ver_id_ndx_to_latest_pp_id_for_cons_ver.rb
572
+ - db/migrations/20230216_add_branch_heads_branch_version_id_index.rb
573
+ - db/migrations/20230428_add_index_for_webhook_executions_pact_publication_id.rb
594
574
  - db/migrations/migration_helper.rb
595
575
  - docs/CONFIGURATION.md
596
576
  - docs/api/PACTICIPANTS.md
597
577
  - docs/api/PAGINATION.md
598
578
  - docs/api/WEBHOOKS.md
599
- - lib/pact/doc/README.md
600
579
  - lib/pact/doc/doc_file.rb
601
580
  - lib/pact/doc/generate.rb
602
581
  - lib/pact/doc/generator.rb
@@ -611,23 +590,28 @@ files:
611
590
  - lib/pact_broker/api.rb
612
591
  - lib/pact_broker/api/authorization/resource_access_policy.rb
613
592
  - lib/pact_broker/api/authorization/resource_access_rules.rb
593
+ - lib/pact_broker/api/contracts.rb
614
594
  - lib/pact_broker/api/contracts/base_contract.rb
595
+ - lib/pact_broker/api/contracts/can_i_deploy_query_schema.rb
615
596
  - lib/pact_broker/api/contracts/configuration.rb
616
- - lib/pact_broker/api/contracts/dry_validation_predicates.rb
617
- - lib/pact_broker/api/contracts/dry_validation_workarounds.rb
597
+ - lib/pact_broker/api/contracts/consumer_version_selector_contract.rb
598
+ - lib/pact_broker/api/contracts/dry_validation_errors_formatter.rb
599
+ - lib/pact_broker/api/contracts/dry_validation_macros.rb
600
+ - lib/pact_broker/api/contracts/dry_validation_methods.rb
618
601
  - lib/pact_broker/api/contracts/environment_schema.rb
619
602
  - lib/pact_broker/api/contracts/pacticipant_create_schema.rb
620
- - lib/pact_broker/api/contracts/pacticipant_name_contract.rb
621
- - lib/pact_broker/api/contracts/pacticipant_name_validation.rb
622
603
  - lib/pact_broker/api/contracts/pacticipant_schema.rb
623
604
  - lib/pact_broker/api/contracts/pacts_for_verification_json_query_schema.rb
624
605
  - lib/pact_broker/api/contracts/pacts_for_verification_query_string_schema.rb
606
+ - lib/pact_broker/api/contracts/publish_contracts_contract_contract.rb
625
607
  - lib/pact_broker/api/contracts/publish_contracts_schema.rb
626
608
  - lib/pact_broker/api/contracts/put_pact_params_contract.rb
627
- - lib/pact_broker/api/contracts/request_validations.rb
628
609
  - lib/pact_broker/api/contracts/utf_8_validation.rb
610
+ - lib/pact_broker/api/contracts/validation_helpers.rb
629
611
  - lib/pact_broker/api/contracts/verification_contract.rb
630
612
  - lib/pact_broker/api/contracts/webhook_contract.rb
613
+ - lib/pact_broker/api/contracts/webhook_pacticipant_contract.rb
614
+ - lib/pact_broker/api/contracts/webhook_request_contract.rb
631
615
  - lib/pact_broker/api/decorators.rb
632
616
  - lib/pact_broker/api/decorators/base_decorator.rb
633
617
  - lib/pact_broker/api/decorators/basic_pacticipant_decorator.rb
@@ -776,7 +760,6 @@ files:
776
760
  - lib/pact_broker/api/resources/webhook.rb
777
761
  - lib/pact_broker/api/resources/webhook_execution.rb
778
762
  - lib/pact_broker/api/resources/webhook_execution_methods.rb
779
- - lib/pact_broker/api/resources/webhook_resource_methods.rb
780
763
  - lib/pact_broker/app.rb
781
764
  - lib/pact_broker/application_context.rb
782
765
  - lib/pact_broker/badges/service.rb
@@ -926,7 +909,6 @@ files:
926
909
  - lib/pact_broker/locale/en.yml
927
910
  - lib/pact_broker/logging.rb
928
911
  - lib/pact_broker/logging/default_formatter.rb
929
- - lib/pact_broker/matrix/can_i_deploy_query_schema.rb
930
912
  - lib/pact_broker/matrix/deployment_status_summary.rb
931
913
  - lib/pact_broker/matrix/every_row.rb
932
914
  - lib/pact_broker/matrix/integration.rb
@@ -1087,6 +1069,7 @@ files:
1087
1069
  - lib/pact_broker/webhooks/webhook_execution_result.rb
1088
1070
  - lib/pact_broker/webhooks/webhook_request_logger.rb
1089
1071
  - lib/pact_broker/webhooks/webhook_request_template.rb
1072
+ - lib/pact_broker/webmachine.rb
1090
1073
  - lib/rack/hal_browser.rb
1091
1074
  - lib/rack/hal_browser/redirect.rb
1092
1075
  - lib/rack/pact_broker/add_pact_broker_version_header.rb
@@ -1105,6 +1088,7 @@ files:
1105
1088
  - lib/rack/pact_broker/use_when.rb
1106
1089
  - lib/semantic_logger/formatters/short.rb
1107
1090
  - lib/sequel/extensions/statement_timeout.rb
1091
+ - lib/sequel/plugins/age.rb
1108
1092
  - lib/sequel/plugins/insert_ignore.rb
1109
1093
  - lib/sequel/plugins/upsert.rb
1110
1094
  - lib/webmachine/application_monkey_patch.rb
@@ -1235,11 +1219,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
1235
1219
  version: 2.2.0
1236
1220
  required_rubygems_version: !ruby/object:Gem::Requirement
1237
1221
  requirements:
1238
- - - ">="
1222
+ - - ">"
1239
1223
  - !ruby/object:Gem::Version
1240
- version: '0'
1224
+ version: 1.3.1
1241
1225
  requirements: []
1242
- rubygems_version: 3.4.6
1226
+ rubygems_version: 3.4.12
1243
1227
  signing_key:
1244
1228
  specification_version: 4
1245
1229
  summary: See description
@@ -1,5 +0,0 @@
1
- # Pact::Doc
2
-
3
- The code in pact/doc has been copied from the pact gem to break the runtime dependency between the pact_broker and the pact gem, which requires the pact_mock-service, which requires webrick.
4
-
5
- This was required as there is a vulnerability in webrick <= 1.3.1 that we don't want to include in the pact_broker gem, but webrick > 1.3.1 requires ruby 2.3.0, but we need ruby 2.2 for Travelling Ruby, which we use to package the Ruby codebase so it can be shared with implementations in other langauges.
@@ -1,36 +0,0 @@
1
- require "dry-validation"
2
-
3
- module PactBroker
4
- module Api
5
- module Contracts
6
- module DryValidationPredicates
7
- include Dry::Logic::Predicates
8
-
9
- predicate(:date?) do |value|
10
- DateTime.parse(value) rescue false
11
- end
12
-
13
- predicate(:base64?) do |value|
14
- Base64.strict_decode64(value) rescue false
15
- end
16
-
17
- predicate(:not_blank?) do | value |
18
- value && value.is_a?(String) && value.strip.size > 0
19
- end
20
-
21
- predicate(:single_line?) do | value |
22
- value && value.is_a?(String) && !value.include?("\n")
23
- end
24
-
25
- predicate(:no_spaces?) do | value |
26
- value && value.is_a?(String) && !value.include?(" ")
27
- end
28
-
29
- predicate(:environment_with_name_exists?) do | value |
30
- require "pact_broker/deployments/environment_service"
31
- !!PactBroker::Deployments::EnvironmentService.find_by_name(value)
32
- end
33
- end
34
- end
35
- end
36
- end
@@ -1,39 +0,0 @@
1
- module PactBroker
2
- module Api
3
- module Contracts
4
- module DryValidationWorkarounds
5
- extend self
6
-
7
- # I just cannot seem to get the validation to stop on the first error.
8
- # If one rule fails, they all come back failed, and it's driving me nuts.
9
- # Why on earth would I want that behaviour?
10
- def select_first_message(messages)
11
- messages.each_with_object({}) do | (key, value), new_messages |
12
- new_messages[key] = [value.first]
13
- end
14
- end
15
-
16
- def flatten_array_of_hashes(array_of_hashes)
17
- array_of_hashes.collect do | index, hash_or_array |
18
- array = hash_or_array.is_a?(Hash) ? hash_or_array.values.flatten : hash_or_array
19
- array.collect { | text | "#{text} at index #{index}"}
20
- end.flatten
21
- end
22
-
23
- def flatten_indexed_messages(messages)
24
- if messages.values.any?{ | value | is_indexed_structure?(value) }
25
- messages.each_with_object({}) do | (key, value), new_messages |
26
- new_messages[key] = is_indexed_structure?(value) ? flatten_array_of_hashes(value) : value
27
- end
28
- else
29
- messages
30
- end
31
- end
32
-
33
- def is_indexed_structure?(thing)
34
- thing.is_a?(Hash) && thing.keys.first.is_a?(Integer)
35
- end
36
- end
37
- end
38
- end
39
- end
@@ -1,24 +0,0 @@
1
- require "pact_broker/api/contracts/base_contract"
2
-
3
- module PactBroker
4
- module Api
5
- module Contracts
6
- class PacticipantNameContract < BaseContract
7
- property :name
8
- property :name_in_pact
9
- property :pacticipant
10
- property :message_args
11
-
12
- include PactBroker::Messages
13
-
14
- def blank? string
15
- string && string.strip.empty?
16
- end
17
-
18
- def empty? string
19
- string.nil? || blank?(string)
20
- end
21
- end
22
- end
23
- end
24
- end
@@ -1,30 +0,0 @@
1
- module PactBroker
2
- module Api
3
- module Contracts
4
- module PacticipantNameValidation
5
-
6
- include PactBroker::Messages
7
-
8
- def name_in_pact_present
9
- unless name_in_pact
10
- errors.add(:'name', validation_message("pact_missing_pacticipant_name", pacticipant: pacticipant))
11
- end
12
- end
13
-
14
- def name_not_blank
15
- if blank? name
16
- errors.add(:'name', validation_message("blank"))
17
- end
18
- end
19
-
20
- def blank? string
21
- string && string.strip.empty?
22
- end
23
-
24
- def empty? string
25
- string.nil? || blank?(string)
26
- end
27
- end
28
- end
29
- end
30
- end