foobara 0.0.93 → 0.0.94
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 +4 -0
- data/projects/command_connectors/src/command_connector/request.rb +7 -1
- data/projects/command_connectors/src/command_connector/response.rb +7 -1
- data/projects/command_connectors/src/command_connector.rb +24 -15
- data/projects/command_connectors/src/command_registry/exposed_command.rb +1 -0
- data/projects/command_connectors/src/serializers/errors_serializer.rb +4 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 481928c28115c1b97adee6f5caa284b559ca954ee57f337bbb456ab80972b4eb
|
4
|
+
data.tar.gz: 2d083d6fb702f82dd920e4de4a7ac9bc6e82dd3fa87d874cb89f49d495d4b780
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c9a25149a21e5d8aa851e4a8776f5f3d8a3e44635598544a4d9da2e8e9709ec61c812e286ecedacd6376e7a928c94993567a5dd00d0c67d829d4f6a4d9848f6
|
7
|
+
data.tar.gz: 9561f972da6f0c94e40adc04d23ef33e7eea856b045248c4e04f057365543eaf82b6810592221e64e1ecb9e3a31530edb2f7beefa2ab3845a117197bd0b6c6af
|
data/CHANGELOG.md
CHANGED
@@ -86,6 +86,18 @@ module Foobara
|
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
89
|
+
attr_accessor :command_registry, :authenticator, :capture_unknown_error
|
90
|
+
|
91
|
+
def initialize(authenticator: nil, capture_unknown_error: nil, default_serializers: nil)
|
92
|
+
self.command_registry = CommandRegistry.new(authenticator:)
|
93
|
+
self.authenticator = authenticator
|
94
|
+
self.capture_unknown_error = capture_unknown_error
|
95
|
+
|
96
|
+
Util.array(default_serializers).each do |serializer|
|
97
|
+
add_default_serializer(serializer)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
89
101
|
def find_builtin_command_class(command_class_name)
|
90
102
|
self.class.find_builtin_command_class(command_class_name)
|
91
103
|
end
|
@@ -104,8 +116,6 @@ module Foobara
|
|
104
116
|
:all_transformed_command_classes,
|
105
117
|
to: :command_registry
|
106
118
|
|
107
|
-
attr_accessor :command_registry, :authenticator
|
108
|
-
|
109
119
|
def lookup_command(name)
|
110
120
|
command_registry.foobara_lookup_command(name)
|
111
121
|
end
|
@@ -237,13 +247,11 @@ module Foobara
|
|
237
247
|
end
|
238
248
|
|
239
249
|
def set_response_status(response)
|
240
|
-
|
241
|
-
response.status = outcome.success? ? 0 : 1
|
250
|
+
response.status = response.success? ? 0 : 1
|
242
251
|
end
|
243
252
|
|
244
253
|
def set_response_body(response)
|
245
254
|
outcome = response.request.outcome
|
246
|
-
# response.body = outcome.success? ? outcome.result : outcome.error_collection
|
247
255
|
response.body = outcome.success? ? outcome.result : outcome.error_collection
|
248
256
|
end
|
249
257
|
|
@@ -263,15 +271,6 @@ module Foobara
|
|
263
271
|
end
|
264
272
|
end
|
265
273
|
|
266
|
-
def initialize(authenticator: nil, default_serializers: nil)
|
267
|
-
self.command_registry = CommandRegistry.new(authenticator:)
|
268
|
-
self.authenticator = authenticator
|
269
|
-
|
270
|
-
Util.array(default_serializers).each do |serializer|
|
271
|
-
add_default_serializer(serializer)
|
272
|
-
end
|
273
|
-
end
|
274
|
-
|
275
274
|
def connect_delayed(registerable_name, *args, **opts)
|
276
275
|
delayed_connections[registerable_name] = { args:, opts: }
|
277
276
|
end
|
@@ -343,7 +342,7 @@ module Foobara
|
|
343
342
|
end
|
344
343
|
|
345
344
|
if command
|
346
|
-
|
345
|
+
run_command(request)
|
347
346
|
# :nocov:
|
348
347
|
elsif !request.error
|
349
348
|
raise "No command returned from #request_to_command"
|
@@ -353,6 +352,16 @@ module Foobara
|
|
353
352
|
build_response(request)
|
354
353
|
end
|
355
354
|
|
355
|
+
def run_command(request)
|
356
|
+
request.command.run
|
357
|
+
rescue => e
|
358
|
+
if capture_unknown_error
|
359
|
+
request.error = CommandConnector::UnknownError.new(e)
|
360
|
+
else
|
361
|
+
raise
|
362
|
+
end
|
363
|
+
end
|
364
|
+
|
356
365
|
def authenticate(request)
|
357
366
|
request_command = request.command
|
358
367
|
|
@@ -4,8 +4,10 @@ module Foobara
|
|
4
4
|
module CommandConnectors
|
5
5
|
module Serializers
|
6
6
|
class ErrorsSerializer < Serializer
|
7
|
-
def
|
8
|
-
!request.outcome.success?
|
7
|
+
def applicable?(error_collection)
|
8
|
+
if request.outcome.nil? || !request.outcome.success?
|
9
|
+
error_collection.has_errors?
|
10
|
+
end
|
9
11
|
end
|
10
12
|
|
11
13
|
def serialize(error_collection)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foobara
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.94
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Georgi
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-04-
|
10
|
+
date: 2025-04-07 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: bigdecimal
|
@@ -487,7 +487,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
487
487
|
- !ruby/object:Gem::Version
|
488
488
|
version: '0'
|
489
489
|
requirements: []
|
490
|
-
rubygems_version: 3.6.
|
490
|
+
rubygems_version: 3.6.2
|
491
491
|
specification_version: 4
|
492
492
|
summary: A command-centric and discoverable software framework with a focus on domain
|
493
493
|
concepts and abstracting away integration code
|