foobara 0.4.1 → 0.4.3
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 +15 -0
- data/README.md +3 -1
- data/projects/command/src/command_pattern_implementation/concerns/transactions.rb +1 -0
- data/projects/command_connectors/Guardfile +1 -1
- data/projects/command_connectors/spec/auth_mappers_spec.rb +201 -0
- data/projects/command_connectors/spec/command_connector_spec.rb +2 -1
- data/projects/command_connectors/spec/pre_commit_transformers/load_atoms_pre_commit_transformer_spec.rb +5 -2
- data/projects/command_connectors/spec/request_spec.rb +23 -0
- data/projects/command_connectors/spec/spec_helper.rb +8 -3
- data/projects/command_connectors/src/authenticator.rb +27 -16
- data/projects/command_connectors/src/command_connector/request.rb +40 -5
- data/projects/command_connectors/src/command_connector.rb +98 -4
- data/projects/command_connectors/src/transformed_command.rb +12 -2
- data/projects/entities/spec/spec_helper.rb +4 -2
- data/projects/entities_plumbing/Guardfile +6 -0
- data/projects/entities_plumbing/lib/foobara/entities_plumbing.rb +12 -0
- data/projects/entities_plumbing/spec/auth_mappers_spec.rb +159 -0
- data/projects/entities_plumbing/spec/spec_helper.rb +54 -0
- data/projects/entities_plumbing/spec/support/rubyprof.rb +32 -0
- data/projects/entities_plumbing/spec/support/term_trap.rb +6 -0
- data/projects/entities_plumbing/src/command_connectors_extension.rb +17 -0
- data/projects/entities_plumbing/src/extensions/authenticator.rb +13 -0
- data/projects/manifest/spec/spec_helper.rb +6 -3
- data/projects/typesystem/projects/builtin_types/src/builtin_types.rb +6 -6
- data/projects/typesystem/projects/domain/src/domain.rb +0 -15
- data/projects/typesystem/projects/domain/src/domain_module_extension.rb +0 -153
- data/projects/typesystem/projects/domain/src/module_extension.rb +0 -58
- data/projects/typesystem/projects/namespace/src/is_namespace.rb +8 -0
- data/projects/typesystem/projects/type_declarations/lib/foobara/type_declarations.rb +0 -15
- data/projects/typesystem/projects/type_declarations/src/type_declaration.rb +15 -12
- data/projects/typesystem/projects/type_declarations/src/typed_transformer.rb +20 -2
- data/projects/typesystem/spec/common/data_path_spec.rb +6 -8
- data/projects/typesystem/spec/spec_helper.rb +5 -3
- data/version.rb +1 -1
- metadata +11 -2
- data/projects/entities/projects/model/src/extensions/domain/module_extension.rb +0 -20
|
@@ -38,19 +38,21 @@ module Foobara
|
|
|
38
38
|
def handle_symbolic_declaration
|
|
39
39
|
self.reference_checked = true
|
|
40
40
|
|
|
41
|
-
if declaration_data.is_a?(::Symbol)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
symbol = if declaration_data.is_a?(::Symbol)
|
|
42
|
+
declaration_data
|
|
43
|
+
elsif declaration_data.is_a?(::String)
|
|
44
|
+
declaration_data.to_sym
|
|
45
|
+
end
|
|
46
46
|
|
|
47
47
|
if symbol
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
mode = if absolutified?
|
|
49
|
+
Namespace::LookupMode::ABSOLUTE
|
|
50
50
|
else
|
|
51
|
-
|
|
51
|
+
Namespace::LookupMode::RELAXED
|
|
52
52
|
end
|
|
53
53
|
|
|
54
|
+
type = Domain.current.foobara_lookup_type(symbol, mode:)
|
|
55
|
+
|
|
54
56
|
if type
|
|
55
57
|
unless strict?
|
|
56
58
|
self.declaration_data = type.full_type_symbol
|
|
@@ -61,7 +63,6 @@ module Foobara
|
|
|
61
63
|
self.is_strict = true
|
|
62
64
|
self.is_deep_duped = true
|
|
63
65
|
self.is_duped = true
|
|
64
|
-
|
|
65
66
|
else
|
|
66
67
|
if declaration_data.is_a?(::Symbol)
|
|
67
68
|
self.is_duped = true
|
|
@@ -93,12 +94,14 @@ module Foobara
|
|
|
93
94
|
|
|
94
95
|
if type_symbol
|
|
95
96
|
if type_symbol.is_a?(::Symbol) || type_symbol.is_a?(::String)
|
|
96
|
-
|
|
97
|
-
|
|
97
|
+
mode = if absolutified?
|
|
98
|
+
Namespace::LookupMode::ABSOLUTE
|
|
98
99
|
else
|
|
99
|
-
|
|
100
|
+
Namespace::LookupMode::RELAXED
|
|
100
101
|
end
|
|
101
102
|
|
|
103
|
+
type = Domain.current.foobara_lookup_type(type_symbol, mode:)
|
|
104
|
+
|
|
102
105
|
if type
|
|
103
106
|
symbolize_keys!
|
|
104
107
|
self[:type] = type.full_type_symbol
|
|
@@ -1,8 +1,26 @@
|
|
|
1
1
|
module Foobara
|
|
2
2
|
module TypeDeclarations
|
|
3
3
|
# TODO: this should instead be a processor and have its own possible_errors
|
|
4
|
+
# TODO: does it make sense that this is in this project? Seems to be more generic than TypeDeclarations
|
|
4
5
|
class TypedTransformer < Value::Transformer
|
|
5
6
|
class << self
|
|
7
|
+
def subclass(to: nil, from: nil, &map_proc)
|
|
8
|
+
klass = Class.new(self)
|
|
9
|
+
|
|
10
|
+
klass.to(to) if to
|
|
11
|
+
klass.from(from) if from
|
|
12
|
+
|
|
13
|
+
if map_proc
|
|
14
|
+
if map_proc.arity.zero?
|
|
15
|
+
klass.define_method(:transform) { |_ignored| map_proc.call }
|
|
16
|
+
else
|
|
17
|
+
klass.define_method(:transform, &map_proc)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
klass
|
|
22
|
+
end
|
|
23
|
+
|
|
6
24
|
def requires_declaration_data?
|
|
7
25
|
false
|
|
8
26
|
end
|
|
@@ -66,8 +84,8 @@ module Foobara
|
|
|
66
84
|
@to_type = Domain.current.foobara_type_from_declaration(...)
|
|
67
85
|
end
|
|
68
86
|
|
|
69
|
-
def initialize(from: nil, to: nil)
|
|
70
|
-
super()
|
|
87
|
+
def initialize(from: nil, to: nil, **)
|
|
88
|
+
super(**)
|
|
71
89
|
|
|
72
90
|
if from
|
|
73
91
|
self.from from
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
require "ostruct"
|
|
2
|
-
|
|
3
1
|
RSpec.describe Foobara::DataPath do
|
|
4
2
|
let(:key) { described_class.new(path) }
|
|
5
3
|
|
|
@@ -174,13 +172,14 @@ RSpec.describe Foobara::DataPath do
|
|
|
174
172
|
end
|
|
175
173
|
|
|
176
174
|
describe ".set_value_at" do
|
|
177
|
-
|
|
175
|
+
let(:some_struct) { Struct.new(:z) }
|
|
176
|
+
|
|
178
177
|
let(:object) do
|
|
179
178
|
[
|
|
180
179
|
{
|
|
181
180
|
a: {
|
|
182
181
|
b: [1, 2, { c: 4 }],
|
|
183
|
-
d:
|
|
182
|
+
d: some_struct.new("zz")
|
|
184
183
|
}
|
|
185
184
|
},
|
|
186
185
|
"whatever"
|
|
@@ -198,7 +197,7 @@ RSpec.describe Foobara::DataPath do
|
|
|
198
197
|
{
|
|
199
198
|
a: {
|
|
200
199
|
b: [1, 2, { c: 100 }],
|
|
201
|
-
d:
|
|
200
|
+
d: some_struct.new("zz")
|
|
202
201
|
}
|
|
203
202
|
},
|
|
204
203
|
"whatever"
|
|
@@ -235,7 +234,7 @@ RSpec.describe Foobara::DataPath do
|
|
|
235
234
|
{
|
|
236
235
|
a: {
|
|
237
236
|
b: [1, 100, { c: 4 }],
|
|
238
|
-
d:
|
|
237
|
+
d: some_struct.new("zz")
|
|
239
238
|
}
|
|
240
239
|
},
|
|
241
240
|
"whatever"
|
|
@@ -257,7 +256,7 @@ RSpec.describe Foobara::DataPath do
|
|
|
257
256
|
{
|
|
258
257
|
a: {
|
|
259
258
|
b: [1, 2, { c: 4 }],
|
|
260
|
-
d:
|
|
259
|
+
d: some_struct.new(200)
|
|
261
260
|
}
|
|
262
261
|
},
|
|
263
262
|
"whatever"
|
|
@@ -265,6 +264,5 @@ RSpec.describe Foobara::DataPath do
|
|
|
265
264
|
)
|
|
266
265
|
end
|
|
267
266
|
end
|
|
268
|
-
# rubocop:enable Style/OpenStructUse
|
|
269
267
|
end
|
|
270
268
|
end
|
|
@@ -2,9 +2,11 @@ ENV["FOOBARA_ENV"] = "test"
|
|
|
2
2
|
|
|
3
3
|
require "bundler/setup"
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
if ENV["RUBY_DEBUG"] == "true"
|
|
6
|
+
require "debug"
|
|
7
|
+
elsif ENV["SKIP_PRY"] != "true" && ENV["CI"] != "true"
|
|
6
8
|
require "pry"
|
|
7
|
-
require "pry-byebug"
|
|
9
|
+
require "pry-byebug" unless ENV["SKIP_BYEBUG"] == "true"
|
|
8
10
|
end
|
|
9
11
|
|
|
10
12
|
require "rspec/its"
|
|
@@ -16,7 +18,7 @@ SimpleCov.coverage_dir "coverage/typesystem"
|
|
|
16
18
|
|
|
17
19
|
SimpleCov.start do
|
|
18
20
|
add_filter "spec/support/"
|
|
19
|
-
# TODO: when we run rspec in the typesystem/ directory we
|
|
21
|
+
# TODO: when we run rspec in the typesystem/ directory we should print this info out
|
|
20
22
|
# This avoids printing out info about coverage generated by HTTPFormatter
|
|
21
23
|
formatter Class.new { def format(_result) = nil }
|
|
22
24
|
end
|
data/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: foobara
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Miles Georgi
|
|
@@ -106,6 +106,7 @@ files:
|
|
|
106
106
|
- projects/command_connectors/Guardfile
|
|
107
107
|
- projects/command_connectors/lib/foobara/command_connectors.rb
|
|
108
108
|
- projects/command_connectors/spec/ambiguous_lookups_spec.rb
|
|
109
|
+
- projects/command_connectors/spec/auth_mappers_spec.rb
|
|
109
110
|
- projects/command_connectors/spec/command_connector_spec.rb
|
|
110
111
|
- projects/command_connectors/spec/command_registry_spec.rb
|
|
111
112
|
- projects/command_connectors/spec/commands/describe_spec.rb
|
|
@@ -257,7 +258,6 @@ files:
|
|
|
257
258
|
- projects/entities/projects/model/src/extensions/builtin_types/model/casters/hash.rb
|
|
258
259
|
- projects/entities/projects/model/src/extensions/builtin_types/model/supported_transformers/mutable.rb
|
|
259
260
|
- projects/entities/projects/model/src/extensions/builtin_types/model/validators/model_instance_is_valid.rb
|
|
260
|
-
- projects/entities/projects/model/src/extensions/domain/module_extension.rb
|
|
261
261
|
- projects/entities/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration.rb
|
|
262
262
|
- projects/entities/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/array_with_symbolic_elements.rb
|
|
263
263
|
- projects/entities/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/attributes_handler_desugarizer.rb
|
|
@@ -327,6 +327,14 @@ files:
|
|
|
327
327
|
- projects/entities/spec/support/rubyprof.rb
|
|
328
328
|
- projects/entities/spec/support/term_trap.rb
|
|
329
329
|
- projects/entities/spec/type_declarations/sensitive_type_removers_spec.rb
|
|
330
|
+
- projects/entities_plumbing/Guardfile
|
|
331
|
+
- projects/entities_plumbing/lib/foobara/entities_plumbing.rb
|
|
332
|
+
- projects/entities_plumbing/spec/auth_mappers_spec.rb
|
|
333
|
+
- projects/entities_plumbing/spec/spec_helper.rb
|
|
334
|
+
- projects/entities_plumbing/spec/support/rubyprof.rb
|
|
335
|
+
- projects/entities_plumbing/spec/support/term_trap.rb
|
|
336
|
+
- projects/entities_plumbing/src/command_connectors_extension.rb
|
|
337
|
+
- projects/entities_plumbing/src/extensions/authenticator.rb
|
|
330
338
|
- projects/manifest/lib/foobara/manifest.rb
|
|
331
339
|
- projects/manifest/spec/manifest_spec.rb
|
|
332
340
|
- projects/manifest/spec/model_spec.rb
|
|
@@ -654,6 +662,7 @@ require_paths:
|
|
|
654
662
|
- projects/command/lib
|
|
655
663
|
- projects/command_connectors/lib
|
|
656
664
|
- projects/domain_mapper/lib
|
|
665
|
+
- projects/entities_plumbing/lib
|
|
657
666
|
- projects/manifest/lib
|
|
658
667
|
- projects/model_plumbing/lib
|
|
659
668
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
module Foobara
|
|
2
|
-
module Domain
|
|
3
|
-
module ModuleExtension
|
|
4
|
-
private
|
|
5
|
-
|
|
6
|
-
def foobara_set_types_mod_constant(types_mod, name, value)
|
|
7
|
-
new_value = if value.extends?(BuiltinTypes[:model])
|
|
8
|
-
value.target_class
|
|
9
|
-
else
|
|
10
|
-
# TODO: test this path or delete it if unreachable
|
|
11
|
-
# :nocov:
|
|
12
|
-
value
|
|
13
|
-
# :nocov:
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
types_mod.const_set(name, new_value)
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|