servus 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/generators/servus/event_handler/event_handler_generator.rb +1 -1
- data/lib/generators/servus/guard/guard_generator.rb +1 -1
- data/lib/generators/servus/guard/templates/guard.rb.erb +5 -3
- data/lib/generators/servus/service/service_generator.rb +1 -1
- data/lib/servus/base.rb +46 -3
- data/lib/servus/config.rb +71 -3
- data/lib/servus/events/bus.rb +29 -0
- data/lib/servus/events/emitter.rb +15 -0
- data/lib/servus/guard.rb +7 -6
- data/lib/servus/guards/falsey_guard.rb +3 -3
- data/lib/servus/guards/presence_guard.rb +4 -4
- data/lib/servus/guards/state_guard.rb +4 -5
- data/lib/servus/guards/truthy_guard.rb +3 -3
- data/lib/servus/helpers/controller_helpers.rb +40 -0
- data/lib/servus/support/errors.rb +16 -0
- data/lib/servus/support/lockdown.rb +94 -0
- data/lib/servus/support/logger.rb +16 -0
- data/lib/servus/support/validator.rb +65 -34
- data/lib/servus/testing/example_builders.rb +52 -0
- data/lib/servus/testing/matchers.rb +99 -0
- data/lib/servus/version.rb +1 -1
- data/lib/servus.rb +1 -0
- metadata +7 -111
- data/.claude/commands/check-docs.md +0 -1
- data/.claude/commands/consistency-check.md +0 -1
- data/.claude/commands/fine-tooth-comb.md +0 -1
- data/.claude/commands/red-green-refactor.md +0 -5
- data/.claude/settings.json +0 -24
- data/.rspec +0 -3
- data/.rubocop.yml +0 -27
- data/.yardopts +0 -6
- data/CHANGELOG.md +0 -169
- data/CLAUDE.md +0 -10
- data/IDEAS.md +0 -5
- data/LICENSE.txt +0 -21
- data/READme.md +0 -856
- data/Rakefile +0 -45
- data/docs/core/1_overview.md +0 -81
- data/docs/core/2_architecture.md +0 -120
- data/docs/core/3_service_objects.md +0 -154
- data/docs/features/1_schema_validation.md +0 -161
- data/docs/features/2_error_handling.md +0 -129
- data/docs/features/3_async_execution.md +0 -81
- data/docs/features/4_logging.md +0 -64
- data/docs/features/5_event_bus.md +0 -244
- data/docs/features/6_guards.md +0 -356
- data/docs/features/7_lazy_resolvers.md +0 -238
- data/docs/features/guards_naming_convention.md +0 -540
- data/docs/guides/1_common_patterns.md +0 -90
- data/docs/guides/2_migration_guide.md +0 -225
- data/docs/integration/1_configuration.md +0 -154
- data/docs/integration/2_testing.md +0 -304
- data/docs/integration/3_rails_integration.md +0 -99
- data/docs/yard/Servus/Base.html +0 -1645
- data/docs/yard/Servus/Config.html +0 -582
- data/docs/yard/Servus/Extensions/Async/Call.html +0 -400
- data/docs/yard/Servus/Extensions/Async/Errors/AsyncError.html +0 -140
- data/docs/yard/Servus/Extensions/Async/Errors/JobEnqueueError.html +0 -154
- data/docs/yard/Servus/Extensions/Async/Errors/ServiceNotFoundError.html +0 -154
- data/docs/yard/Servus/Extensions/Async/Errors.html +0 -128
- data/docs/yard/Servus/Extensions/Async/Ext.html +0 -119
- data/docs/yard/Servus/Extensions/Async/Job.html +0 -310
- data/docs/yard/Servus/Extensions/Async.html +0 -141
- data/docs/yard/Servus/Extensions.html +0 -117
- data/docs/yard/Servus/Generators/ServiceGenerator.html +0 -261
- data/docs/yard/Servus/Generators.html +0 -115
- data/docs/yard/Servus/Helpers/ControllerHelpers.html +0 -457
- data/docs/yard/Servus/Helpers.html +0 -115
- data/docs/yard/Servus/Railtie.html +0 -134
- data/docs/yard/Servus/Support/Errors/AuthenticationError.html +0 -287
- data/docs/yard/Servus/Support/Errors/BadRequestError.html +0 -283
- data/docs/yard/Servus/Support/Errors/ForbiddenError.html +0 -284
- data/docs/yard/Servus/Support/Errors/InternalServerError.html +0 -283
- data/docs/yard/Servus/Support/Errors/NotFoundError.html +0 -284
- data/docs/yard/Servus/Support/Errors/ServiceError.html +0 -489
- data/docs/yard/Servus/Support/Errors/ServiceUnavailableError.html +0 -290
- data/docs/yard/Servus/Support/Errors/UnauthorizedError.html +0 -200
- data/docs/yard/Servus/Support/Errors/UnprocessableEntityError.html +0 -288
- data/docs/yard/Servus/Support/Errors/ValidationError.html +0 -200
- data/docs/yard/Servus/Support/Errors.html +0 -140
- data/docs/yard/Servus/Support/Logger.html +0 -856
- data/docs/yard/Servus/Support/Rescuer/BlockContext.html +0 -585
- data/docs/yard/Servus/Support/Rescuer/CallOverride.html +0 -257
- data/docs/yard/Servus/Support/Rescuer/ClassMethods.html +0 -343
- data/docs/yard/Servus/Support/Rescuer.html +0 -267
- data/docs/yard/Servus/Support/Response.html +0 -574
- data/docs/yard/Servus/Support/Validator.html +0 -1150
- data/docs/yard/Servus/Support.html +0 -119
- data/docs/yard/Servus/Testing/ExampleBuilders.html +0 -523
- data/docs/yard/Servus/Testing/ExampleExtractor.html +0 -578
- data/docs/yard/Servus/Testing.html +0 -142
- data/docs/yard/Servus.html +0 -343
- data/docs/yard/_index.html +0 -535
- data/docs/yard/class_list.html +0 -54
- data/docs/yard/css/common.css +0 -1
- data/docs/yard/css/full_list.css +0 -58
- data/docs/yard/css/style.css +0 -503
- data/docs/yard/file.1_common_patterns.html +0 -154
- data/docs/yard/file.1_configuration.html +0 -115
- data/docs/yard/file.1_overview.html +0 -142
- data/docs/yard/file.1_schema_validation.html +0 -188
- data/docs/yard/file.2_architecture.html +0 -157
- data/docs/yard/file.2_error_handling.html +0 -190
- data/docs/yard/file.2_migration_guide.html +0 -242
- data/docs/yard/file.2_testing.html +0 -227
- data/docs/yard/file.3_async_execution.html +0 -145
- data/docs/yard/file.3_rails_integration.html +0 -160
- data/docs/yard/file.3_service_objects.html +0 -191
- data/docs/yard/file.4_logging.html +0 -135
- data/docs/yard/file.ErrorHandling.html +0 -190
- data/docs/yard/file.READme.html +0 -674
- data/docs/yard/file.architecture.html +0 -157
- data/docs/yard/file.async_execution.html +0 -145
- data/docs/yard/file.common_patterns.html +0 -154
- data/docs/yard/file.configuration.html +0 -115
- data/docs/yard/file.error_handling.html +0 -190
- data/docs/yard/file.logging.html +0 -135
- data/docs/yard/file.migration_guide.html +0 -242
- data/docs/yard/file.overview.html +0 -142
- data/docs/yard/file.rails_integration.html +0 -160
- data/docs/yard/file.schema_validation.html +0 -188
- data/docs/yard/file.service_objects.html +0 -191
- data/docs/yard/file.testing.html +0 -227
- data/docs/yard/file_list.html +0 -119
- data/docs/yard/frames.html +0 -22
- data/docs/yard/index.html +0 -674
- data/docs/yard/js/app.js +0 -344
- data/docs/yard/js/full_list.js +0 -242
- data/docs/yard/js/jquery.js +0 -4
- data/docs/yard/method_list.html +0 -542
- data/docs/yard/top-level-namespace.html +0 -110
|
@@ -45,15 +45,14 @@ module Servus
|
|
|
45
45
|
# @api private
|
|
46
46
|
def self.validate_arguments!(service_class, args)
|
|
47
47
|
schema = load_schema(service_class, 'arguments')
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
serialized_result = args.as_json
|
|
51
|
-
validation_errors = JSON::Validator.fully_validate(schema, serialized_result)
|
|
48
|
+
enforce_schema_presence!(schema, service_class, :require_service_arguments_schema)
|
|
49
|
+
return true unless schema
|
|
52
50
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
validate_data_against_schema!(
|
|
52
|
+
args,
|
|
53
|
+
schema,
|
|
54
|
+
"Invalid arguments for #{service_class.name}"
|
|
55
|
+
)
|
|
57
56
|
|
|
58
57
|
true
|
|
59
58
|
end
|
|
@@ -74,21 +73,35 @@ module Servus
|
|
|
74
73
|
#
|
|
75
74
|
# @api private
|
|
76
75
|
def self.validate_result!(service_class, result)
|
|
77
|
-
schema = result_schema_for(service_class, result)
|
|
76
|
+
schema, schema_type = result_schema_for(service_class, result)
|
|
78
77
|
return result unless schema
|
|
79
78
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
error_message = "Invalid #{schema_type} structure from #{service_class.name}: #{validation_errors.join(', ')}"
|
|
86
|
-
raise Servus::Base::ValidationError, error_message
|
|
87
|
-
end
|
|
79
|
+
validate_data_against_schema!(
|
|
80
|
+
result.data,
|
|
81
|
+
schema,
|
|
82
|
+
"Invalid #{schema_type} structure from #{service_class.name}"
|
|
83
|
+
)
|
|
88
84
|
|
|
89
85
|
result
|
|
90
86
|
end
|
|
91
87
|
|
|
88
|
+
# Resolves the schema and type label for a service result.
|
|
89
|
+
#
|
|
90
|
+
# @param service_class [Class] the service class
|
|
91
|
+
# @param result [Servus::Support::Response] the response object
|
|
92
|
+
# @return [Array(Hash, String), Array(nil, nil)] the schema and type label
|
|
93
|
+
#
|
|
94
|
+
# @api private
|
|
95
|
+
def self.result_schema_for(service_class, result)
|
|
96
|
+
if result.success?
|
|
97
|
+
schema = load_schema(service_class, 'result')
|
|
98
|
+
enforce_schema_presence!(schema, service_class, :require_service_result_schema)
|
|
99
|
+
[schema, 'result']
|
|
100
|
+
elsif result.data
|
|
101
|
+
[load_schema(service_class, 'failure'), 'failure']
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
92
105
|
# Validates event payload against the handler's payload schema.
|
|
93
106
|
#
|
|
94
107
|
# @param handler_class [Class] the event handler class
|
|
@@ -103,15 +116,14 @@ module Servus
|
|
|
103
116
|
# @api private
|
|
104
117
|
def self.validate_event_payload!(handler_class, payload)
|
|
105
118
|
schema = handler_class.payload_schema
|
|
119
|
+
enforce_schema_presence!(schema, handler_class, :require_event_payload_schema)
|
|
106
120
|
return true unless schema
|
|
107
121
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
"Invalid payload for event :#{handler_class.event_name}: #{validation_errors.join(', ')}"
|
|
114
|
-
end
|
|
122
|
+
validate_data_against_schema!(
|
|
123
|
+
payload,
|
|
124
|
+
schema,
|
|
125
|
+
"Invalid payload for event :#{handler_class.event_name}"
|
|
126
|
+
)
|
|
115
127
|
|
|
116
128
|
true
|
|
117
129
|
end
|
|
@@ -179,19 +191,38 @@ module Servus
|
|
|
179
191
|
@schema_cache
|
|
180
192
|
end
|
|
181
193
|
|
|
182
|
-
#
|
|
194
|
+
# Serializes data and validates it against a JSON schema.
|
|
183
195
|
#
|
|
184
|
-
# @param
|
|
185
|
-
# @param
|
|
186
|
-
# @
|
|
196
|
+
# @param data [Object] the data to validate
|
|
197
|
+
# @param schema [Hash] the JSON schema to validate against
|
|
198
|
+
# @param message_prefix [String] prefix for the error message on failure
|
|
199
|
+
# @return [void]
|
|
200
|
+
# @raise [Servus::Support::Errors::ValidationError] if data fails validation
|
|
187
201
|
#
|
|
188
202
|
# @api private
|
|
189
|
-
def self.
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
203
|
+
def self.validate_data_against_schema!(data, schema, message_prefix)
|
|
204
|
+
errors = JSON::Validator.fully_validate(schema, data.as_json)
|
|
205
|
+
return if errors.empty?
|
|
206
|
+
|
|
207
|
+
raise Servus::Base::ValidationError, "#{message_prefix}: #{errors.join(', ')}"
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
# Returns the schema if present. Raises if absent and the config flag is enabled.
|
|
211
|
+
#
|
|
212
|
+
# @param schema [Hash, nil] the loaded schema
|
|
213
|
+
# @param klass [Class] the service or handler class
|
|
214
|
+
# @param config_flag [Symbol] the config method to check
|
|
215
|
+
# @return [Hash, nil] the schema
|
|
216
|
+
# @raise [Servus::Support::Errors::SchemaRequiredError] if schema is nil and enforcement is enabled
|
|
217
|
+
#
|
|
218
|
+
# @api private
|
|
219
|
+
def self.enforce_schema_presence!(schema, klass, config_flag)
|
|
220
|
+
return schema if schema
|
|
221
|
+
|
|
222
|
+
return unless Servus.config.public_send(config_flag)
|
|
223
|
+
|
|
224
|
+
raise Servus::Support::Errors::SchemaRequiredError,
|
|
225
|
+
"#{klass.name} schema missing! #{config_flag} is set to true."
|
|
195
226
|
end
|
|
196
227
|
|
|
197
228
|
# Fetches schema from DSL, inline constant, or file.
|
|
@@ -138,6 +138,58 @@ module Servus
|
|
|
138
138
|
Servus::Support::Response.new(false, example, Servus::Support::Errors::ServiceError.new)
|
|
139
139
|
end
|
|
140
140
|
|
|
141
|
+
# Builds a successful Response object with the given data.
|
|
142
|
+
#
|
|
143
|
+
# Convenience method for creating successful responses in tests
|
|
144
|
+
# without calling +Servus::Support::Response.new+ directly.
|
|
145
|
+
#
|
|
146
|
+
# @param data [Hash] the success data to wrap in the response
|
|
147
|
+
# @return [Servus::Support::Response] a successful response wrapping the data
|
|
148
|
+
#
|
|
149
|
+
# @example Basic usage
|
|
150
|
+
# response = servus_success_response(transferred: 50)
|
|
151
|
+
# response.success? # => true
|
|
152
|
+
# response.data[:transferred] # => 50
|
|
153
|
+
#
|
|
154
|
+
# @example Stubbing a service call
|
|
155
|
+
# allow(TransferService).to receive(:call).and_return(
|
|
156
|
+
# servus_success_response(transferred: 50)
|
|
157
|
+
# )
|
|
158
|
+
#
|
|
159
|
+
# @see #servus_failure_response
|
|
160
|
+
def servus_success_response(data = {})
|
|
161
|
+
Servus::Support::Response.new(true, data, nil)
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
# Builds a failure Response object with the given message and error type.
|
|
165
|
+
#
|
|
166
|
+
# Convenience method for creating failure responses in tests.
|
|
167
|
+
# Mirrors the signature of {Servus::Base#failure}.
|
|
168
|
+
#
|
|
169
|
+
# @param message [String, nil] the error message (uses error type's default if nil)
|
|
170
|
+
# @param data [Hash, nil] optional structured data to include with the failure
|
|
171
|
+
# @param type [Class] the error class to use (default: ServiceError)
|
|
172
|
+
# @return [Servus::Support::Response] a failure response with the error
|
|
173
|
+
#
|
|
174
|
+
# @example Basic usage
|
|
175
|
+
# response = servus_failure_response("Insufficient funds")
|
|
176
|
+
# response.failure? # => true
|
|
177
|
+
# response.error.message # => "Insufficient funds"
|
|
178
|
+
#
|
|
179
|
+
# @example With custom error type
|
|
180
|
+
# response = servus_failure_response("Not found", type: Servus::Support::Errors::NotFoundError)
|
|
181
|
+
# response.error.http_status # => :not_found
|
|
182
|
+
#
|
|
183
|
+
# @example With structured failure data
|
|
184
|
+
# response = servus_failure_response("Failed", data: { reason: "expired" })
|
|
185
|
+
# response.data[:reason] # => "expired"
|
|
186
|
+
#
|
|
187
|
+
# @see #servus_success_response
|
|
188
|
+
def servus_failure_response(message = nil, data: nil, type: Servus::Support::Errors::ServiceError)
|
|
189
|
+
error = type.new(message)
|
|
190
|
+
Servus::Support::Response.new(false, data, error)
|
|
191
|
+
end
|
|
192
|
+
|
|
141
193
|
private
|
|
142
194
|
|
|
143
195
|
# Helper method to extract and merge examples from schema
|
|
@@ -85,4 +85,103 @@ RSpec::Matchers.define :call_service do |service_class|
|
|
|
85
85
|
"expected #{service_class} to receive #{method}"
|
|
86
86
|
end
|
|
87
87
|
end
|
|
88
|
+
|
|
89
|
+
# Matcher for asserting schema presence on a service or event handler
|
|
90
|
+
RSpec::Matchers.define :have_schema do |schema_type|
|
|
91
|
+
match do |klass|
|
|
92
|
+
if schema_type.to_s == 'payload'
|
|
93
|
+
!klass.payload_schema.nil?
|
|
94
|
+
else
|
|
95
|
+
Servus::Support::Validator.clear_cache!
|
|
96
|
+
!Servus::Support::Validator.load_schema(klass, schema_type.to_s).nil?
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
failure_message do |klass|
|
|
101
|
+
"expected #{klass.name} to have a #{schema_type} schema defined"
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
failure_message_when_negated do |klass|
|
|
105
|
+
"expected #{klass.name} not to have a #{schema_type} schema defined"
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# Matcher for asserting a successful service response
|
|
110
|
+
RSpec::Matchers.define :be_service_success do
|
|
111
|
+
match do |result|
|
|
112
|
+
@result = result
|
|
113
|
+
result.is_a?(Servus::Support::Response) && result.success?
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
failure_message do
|
|
117
|
+
if @result.is_a?(Servus::Support::Response)
|
|
118
|
+
"expected a successful response, but got failure with error: #{@result.error&.message}"
|
|
119
|
+
else
|
|
120
|
+
"expected a Servus::Support::Response, got #{@result.class}"
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
failure_message_when_negated do
|
|
125
|
+
'expected a failure response, but got success'
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# Matcher for asserting a failed service response with optional error class and message
|
|
130
|
+
RSpec::Matchers.define :be_service_failure do |expected_error_class|
|
|
131
|
+
chain :with_message do |message|
|
|
132
|
+
@expected_message = message
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
match do |result|
|
|
136
|
+
@result = result
|
|
137
|
+
return false unless result.is_a?(Servus::Support::Response) && result.failure?
|
|
138
|
+
return false if expected_error_class && !result.error.is_a?(expected_error_class)
|
|
139
|
+
return false if @expected_message && result.error.message != @expected_message
|
|
140
|
+
|
|
141
|
+
true
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
failure_message do
|
|
145
|
+
if !@result.is_a?(Servus::Support::Response)
|
|
146
|
+
"expected a Servus::Support::Response, got #{@result.class}"
|
|
147
|
+
elsif @result.success?
|
|
148
|
+
'expected a failure response, but got success'
|
|
149
|
+
elsif expected_error_class && !@result.error.is_a?(expected_error_class)
|
|
150
|
+
"expected error to be a #{expected_error_class.name}, got #{@result.error.class.name}"
|
|
151
|
+
elsif @expected_message
|
|
152
|
+
"expected error message #{@expected_message.inspect}, got #{@result.error.message.inspect}"
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
# Matcher for asserting a guard failure response with optional error code and message
|
|
158
|
+
RSpec::Matchers.define :be_guard_failure do |expected_code|
|
|
159
|
+
chain :with_message do |message|
|
|
160
|
+
@expected_message = message
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
match do |result|
|
|
164
|
+
@result = result
|
|
165
|
+
return false unless result.is_a?(Servus::Support::Response) && result.failure?
|
|
166
|
+
return false unless result.error.is_a?(Servus::Support::Errors::GuardError)
|
|
167
|
+
return false if expected_code && result.error.code != expected_code
|
|
168
|
+
return false if @expected_message && result.error.message != @expected_message
|
|
169
|
+
|
|
170
|
+
true
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
failure_message do
|
|
174
|
+
if !@result.is_a?(Servus::Support::Response)
|
|
175
|
+
"expected a Servus::Support::Response, got #{@result.class}"
|
|
176
|
+
elsif @result.success?
|
|
177
|
+
'expected a guard failure response, but got success'
|
|
178
|
+
elsif !@result.error.is_a?(Servus::Support::Errors::GuardError)
|
|
179
|
+
"expected error to be a GuardError, got #{@result.error.class.name}"
|
|
180
|
+
elsif expected_code && @result.error.code != expected_code
|
|
181
|
+
"expected guard error code #{expected_code.inspect}, got #{@result.error.code.inspect}"
|
|
182
|
+
elsif @expected_message
|
|
183
|
+
"expected guard error message #{@expected_message.inspect}, got #{@result.error.message.inspect}"
|
|
184
|
+
end
|
|
185
|
+
end
|
|
186
|
+
end
|
|
88
187
|
# rubocop:enable Metrics/BlockLength
|
data/lib/servus/version.rb
CHANGED
data/lib/servus.rb
CHANGED
|
@@ -25,6 +25,7 @@ require_relative 'servus/support/response'
|
|
|
25
25
|
require_relative 'servus/support/validator'
|
|
26
26
|
require_relative 'servus/support/errors'
|
|
27
27
|
require_relative 'servus/support/rescuer'
|
|
28
|
+
require_relative 'servus/support/lockdown'
|
|
28
29
|
require_relative 'servus/support/message_resolver'
|
|
29
30
|
|
|
30
31
|
# Events
|
metadata
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: servus
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sebastian Scholl
|
|
8
|
+
autorequire:
|
|
8
9
|
bindir: exe
|
|
9
10
|
cert_chain: []
|
|
10
|
-
date:
|
|
11
|
+
date: 2026-04-30 00:00:00.000000000 Z
|
|
11
12
|
dependencies:
|
|
12
13
|
- !ruby/object:Gem::Dependency
|
|
13
14
|
name: active_model_serializers
|
|
@@ -74,114 +75,6 @@ executables: []
|
|
|
74
75
|
extensions: []
|
|
75
76
|
extra_rdoc_files: []
|
|
76
77
|
files:
|
|
77
|
-
- ".claude/commands/check-docs.md"
|
|
78
|
-
- ".claude/commands/consistency-check.md"
|
|
79
|
-
- ".claude/commands/fine-tooth-comb.md"
|
|
80
|
-
- ".claude/commands/red-green-refactor.md"
|
|
81
|
-
- ".claude/settings.json"
|
|
82
|
-
- ".rspec"
|
|
83
|
-
- ".rubocop.yml"
|
|
84
|
-
- ".yardopts"
|
|
85
|
-
- CHANGELOG.md
|
|
86
|
-
- CLAUDE.md
|
|
87
|
-
- IDEAS.md
|
|
88
|
-
- LICENSE.txt
|
|
89
|
-
- READme.md
|
|
90
|
-
- Rakefile
|
|
91
|
-
- docs/core/1_overview.md
|
|
92
|
-
- docs/core/2_architecture.md
|
|
93
|
-
- docs/core/3_service_objects.md
|
|
94
|
-
- docs/features/1_schema_validation.md
|
|
95
|
-
- docs/features/2_error_handling.md
|
|
96
|
-
- docs/features/3_async_execution.md
|
|
97
|
-
- docs/features/4_logging.md
|
|
98
|
-
- docs/features/5_event_bus.md
|
|
99
|
-
- docs/features/6_guards.md
|
|
100
|
-
- docs/features/7_lazy_resolvers.md
|
|
101
|
-
- docs/features/guards_naming_convention.md
|
|
102
|
-
- docs/guides/1_common_patterns.md
|
|
103
|
-
- docs/guides/2_migration_guide.md
|
|
104
|
-
- docs/integration/1_configuration.md
|
|
105
|
-
- docs/integration/2_testing.md
|
|
106
|
-
- docs/integration/3_rails_integration.md
|
|
107
|
-
- docs/yard/Servus.html
|
|
108
|
-
- docs/yard/Servus/Base.html
|
|
109
|
-
- docs/yard/Servus/Config.html
|
|
110
|
-
- docs/yard/Servus/Extensions.html
|
|
111
|
-
- docs/yard/Servus/Extensions/Async.html
|
|
112
|
-
- docs/yard/Servus/Extensions/Async/Call.html
|
|
113
|
-
- docs/yard/Servus/Extensions/Async/Errors.html
|
|
114
|
-
- docs/yard/Servus/Extensions/Async/Errors/AsyncError.html
|
|
115
|
-
- docs/yard/Servus/Extensions/Async/Errors/JobEnqueueError.html
|
|
116
|
-
- docs/yard/Servus/Extensions/Async/Errors/ServiceNotFoundError.html
|
|
117
|
-
- docs/yard/Servus/Extensions/Async/Ext.html
|
|
118
|
-
- docs/yard/Servus/Extensions/Async/Job.html
|
|
119
|
-
- docs/yard/Servus/Generators.html
|
|
120
|
-
- docs/yard/Servus/Generators/ServiceGenerator.html
|
|
121
|
-
- docs/yard/Servus/Helpers.html
|
|
122
|
-
- docs/yard/Servus/Helpers/ControllerHelpers.html
|
|
123
|
-
- docs/yard/Servus/Railtie.html
|
|
124
|
-
- docs/yard/Servus/Support.html
|
|
125
|
-
- docs/yard/Servus/Support/Errors.html
|
|
126
|
-
- docs/yard/Servus/Support/Errors/AuthenticationError.html
|
|
127
|
-
- docs/yard/Servus/Support/Errors/BadRequestError.html
|
|
128
|
-
- docs/yard/Servus/Support/Errors/ForbiddenError.html
|
|
129
|
-
- docs/yard/Servus/Support/Errors/InternalServerError.html
|
|
130
|
-
- docs/yard/Servus/Support/Errors/NotFoundError.html
|
|
131
|
-
- docs/yard/Servus/Support/Errors/ServiceError.html
|
|
132
|
-
- docs/yard/Servus/Support/Errors/ServiceUnavailableError.html
|
|
133
|
-
- docs/yard/Servus/Support/Errors/UnauthorizedError.html
|
|
134
|
-
- docs/yard/Servus/Support/Errors/UnprocessableEntityError.html
|
|
135
|
-
- docs/yard/Servus/Support/Errors/ValidationError.html
|
|
136
|
-
- docs/yard/Servus/Support/Logger.html
|
|
137
|
-
- docs/yard/Servus/Support/Rescuer.html
|
|
138
|
-
- docs/yard/Servus/Support/Rescuer/BlockContext.html
|
|
139
|
-
- docs/yard/Servus/Support/Rescuer/CallOverride.html
|
|
140
|
-
- docs/yard/Servus/Support/Rescuer/ClassMethods.html
|
|
141
|
-
- docs/yard/Servus/Support/Response.html
|
|
142
|
-
- docs/yard/Servus/Support/Validator.html
|
|
143
|
-
- docs/yard/Servus/Testing.html
|
|
144
|
-
- docs/yard/Servus/Testing/ExampleBuilders.html
|
|
145
|
-
- docs/yard/Servus/Testing/ExampleExtractor.html
|
|
146
|
-
- docs/yard/_index.html
|
|
147
|
-
- docs/yard/class_list.html
|
|
148
|
-
- docs/yard/css/common.css
|
|
149
|
-
- docs/yard/css/full_list.css
|
|
150
|
-
- docs/yard/css/style.css
|
|
151
|
-
- docs/yard/file.1_common_patterns.html
|
|
152
|
-
- docs/yard/file.1_configuration.html
|
|
153
|
-
- docs/yard/file.1_overview.html
|
|
154
|
-
- docs/yard/file.1_schema_validation.html
|
|
155
|
-
- docs/yard/file.2_architecture.html
|
|
156
|
-
- docs/yard/file.2_error_handling.html
|
|
157
|
-
- docs/yard/file.2_migration_guide.html
|
|
158
|
-
- docs/yard/file.2_testing.html
|
|
159
|
-
- docs/yard/file.3_async_execution.html
|
|
160
|
-
- docs/yard/file.3_rails_integration.html
|
|
161
|
-
- docs/yard/file.3_service_objects.html
|
|
162
|
-
- docs/yard/file.4_logging.html
|
|
163
|
-
- docs/yard/file.ErrorHandling.html
|
|
164
|
-
- docs/yard/file.READme.html
|
|
165
|
-
- docs/yard/file.architecture.html
|
|
166
|
-
- docs/yard/file.async_execution.html
|
|
167
|
-
- docs/yard/file.common_patterns.html
|
|
168
|
-
- docs/yard/file.configuration.html
|
|
169
|
-
- docs/yard/file.error_handling.html
|
|
170
|
-
- docs/yard/file.logging.html
|
|
171
|
-
- docs/yard/file.migration_guide.html
|
|
172
|
-
- docs/yard/file.overview.html
|
|
173
|
-
- docs/yard/file.rails_integration.html
|
|
174
|
-
- docs/yard/file.schema_validation.html
|
|
175
|
-
- docs/yard/file.service_objects.html
|
|
176
|
-
- docs/yard/file.testing.html
|
|
177
|
-
- docs/yard/file_list.html
|
|
178
|
-
- docs/yard/frames.html
|
|
179
|
-
- docs/yard/index.html
|
|
180
|
-
- docs/yard/js/app.js
|
|
181
|
-
- docs/yard/js/full_list.js
|
|
182
|
-
- docs/yard/js/jquery.js
|
|
183
|
-
- docs/yard/method_list.html
|
|
184
|
-
- docs/yard/top-level-namespace.html
|
|
185
78
|
- lib/generators/servus/event_handler/event_handler_generator.rb
|
|
186
79
|
- lib/generators/servus/event_handler/templates/handler.rb.erb
|
|
187
80
|
- lib/generators/servus/event_handler/templates/handler_spec.rb.erb
|
|
@@ -218,6 +111,7 @@ files:
|
|
|
218
111
|
- lib/servus/railtie.rb
|
|
219
112
|
- lib/servus/support/data_object.rb
|
|
220
113
|
- lib/servus/support/errors.rb
|
|
114
|
+
- lib/servus/support/lockdown.rb
|
|
221
115
|
- lib/servus/support/logger.rb
|
|
222
116
|
- lib/servus/support/message_resolver.rb
|
|
223
117
|
- lib/servus/support/rescuer.rb
|
|
@@ -237,6 +131,7 @@ metadata:
|
|
|
237
131
|
source_code_uri: https://github.com/zarpay/servus
|
|
238
132
|
changelog_uri: https://github.com/zarpay/servus/blob/main/CHANGELOG.md
|
|
239
133
|
rubygems_mfa_required: 'true'
|
|
134
|
+
post_install_message:
|
|
240
135
|
rdoc_options: []
|
|
241
136
|
require_paths:
|
|
242
137
|
- lib
|
|
@@ -251,7 +146,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
251
146
|
- !ruby/object:Gem::Version
|
|
252
147
|
version: '0'
|
|
253
148
|
requirements: []
|
|
254
|
-
rubygems_version:
|
|
149
|
+
rubygems_version: 3.5.22
|
|
150
|
+
signing_key:
|
|
255
151
|
specification_version: 4
|
|
256
152
|
summary: A gem for managing service objects.
|
|
257
153
|
test_files: []
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Scan the documentation in docs/ then check the current git changeset. If the changeset has modifications that might affect the documentation, then review the related documentation and make any necessary updates.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Are the latest changes consistent with the way that similar functionality has been implemented in the rest of the codebase? #$ARGUMENTS
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
We're going to go over #$ARGUMENTS with a fine-tooth comb. I want detailed explanations and no edits unless I ask for them. Start by identifying the first thing that looks wrong and explain why.
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
During this session we will be practicing TDD in the red-green-refactor cycle. The first step in the cycle is to write a test for the smallest possible unit of functionality. Once the test is written, run the test and it should fail. This is the red phase. The next step is to write the code to make the test pass. This is the green phase. Once the test passes, the code is refactored to be more readable and maintainable. This is the refactor phase.
|
|
2
|
-
|
|
3
|
-
If we get into a situation where more than one test fails, we will focus on the test that is most important to fix first. During that fix phase, we will only run the test that is failing until it passes.
|
|
4
|
-
|
|
5
|
-
While we're in this mode, you will not use your TODO tool to track tasks. You will rely on me (the human user) to tell you what the next step is.
|
data/.claude/settings.json
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"permissions": {
|
|
3
|
-
"allow": [
|
|
4
|
-
"Bash(bundle exec rspec:*)",
|
|
5
|
-
"Bash(bundle exec rubocop:*)",
|
|
6
|
-
"Bash(find:*)"
|
|
7
|
-
],
|
|
8
|
-
"deny": [],
|
|
9
|
-
"ask": []
|
|
10
|
-
},
|
|
11
|
-
"hooks": {
|
|
12
|
-
"PostToolUse": [
|
|
13
|
-
{
|
|
14
|
-
"matcher": "Write|Edit",
|
|
15
|
-
"hooks": [
|
|
16
|
-
{
|
|
17
|
-
"type": "command",
|
|
18
|
-
"command": "bundle exec rubocop -A"
|
|
19
|
-
}
|
|
20
|
-
]
|
|
21
|
-
}
|
|
22
|
-
]
|
|
23
|
-
}
|
|
24
|
-
}
|
data/.rspec
DELETED
data/.rubocop.yml
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
AllCops:
|
|
2
|
-
NewCops: enable
|
|
3
|
-
TargetRubyVersion: 3.3
|
|
4
|
-
Include:
|
|
5
|
-
- 'lib/**/*.rb'
|
|
6
|
-
- 'spec/**/*.rb'
|
|
7
|
-
Exclude:
|
|
8
|
-
- 'spec/dummy/**/*'
|
|
9
|
-
- 'vendor/bundle/**/*'
|
|
10
|
-
|
|
11
|
-
Lint/ConstantDefinitionInBlock:
|
|
12
|
-
Enabled: false
|
|
13
|
-
|
|
14
|
-
Lint/ConstantReassignment:
|
|
15
|
-
Exclude:
|
|
16
|
-
- 'spec/**/*'
|
|
17
|
-
|
|
18
|
-
Lint/MissingSuper:
|
|
19
|
-
Exclude:
|
|
20
|
-
- 'spec/**/*'
|
|
21
|
-
|
|
22
|
-
Metrics/BlockLength:
|
|
23
|
-
Exclude:
|
|
24
|
-
- 'spec/**/*'
|
|
25
|
-
|
|
26
|
-
Naming/PredicateMethod:
|
|
27
|
-
Enabled: false
|