foobara 0.0.128 → 0.0.130
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 +8 -0
- data/README.md +3 -3
- data/projects/builtin_types/src/attributes/supported_transformers/defaults.rb +2 -2
- data/projects/command/src/command_pattern_implementation/concerns/runtime.rb +2 -1
- data/projects/command_connectors/src/serializers/yaml_serializer.rb +2 -0
- data/projects/entity/src/concerns/initialization.rb +4 -1
- data/projects/in_memory_crud_driver_minimal/src/in_memory_minimal.rb +0 -10
- data/projects/namespace/src/is_namespace.rb +1 -1
- data/projects/persistence/src/entity_attributes_crud_driver.rb +8 -4
- data/projects/persistence/src/entity_base/transaction_table.rb +2 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5dd322e7389be1e600f98133b9e92a177f1d14a1b2c0d4200e7b9630fd023983
|
4
|
+
data.tar.gz: 6518a4d6ac731b1973809640058b8e793ebcd9dc0d014827713fc2466fe209d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96d8ca1ee65877ae7315052668cdff9c247ee778f5d285d4828145b3c69f06402fc97b4085744315f76b30dad36d5a9bd7f4a753108a1195950c4676c9cf16e1
|
7
|
+
data.tar.gz: a3ee1b0364e55f320ea2272b17f6a49d0a5e5a4d7406c3f9aa65fb8b04cdbf7b5c1169db6ae06adb3851edc62ae595614011a95b6b0ffa4767e672466f2c855c
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
# [0.0.130] - 2025-06-06
|
2
|
+
|
3
|
+
- Support using a proc as an attributes default for lazy evaluation of default values
|
4
|
+
|
5
|
+
# [0.0.129] - 2025-05-30
|
6
|
+
|
7
|
+
- Store the raw, unprocessed, command result for debugging/introspection
|
8
|
+
|
1
9
|
# [0.0.128] - 2025-05-29
|
2
10
|
|
3
11
|
- Add StateMachine.for convenience method
|
data/README.md
CHANGED
@@ -3,7 +3,7 @@ domain operations in commands, and automatically expose machine-readable formal
|
|
3
3
|
commands so that integration code can be decoupled and abstracted away.
|
4
4
|
|
5
5
|
This, as well as some other features of foobara, help manage domain complexity and produce
|
6
|
-
more flexible systems
|
6
|
+
more flexible systems.
|
7
7
|
|
8
8
|
You can watch a video that gives a good overview of what Foobara is and its goals here:
|
9
9
|
[Introduction to the Foobara software framework](https://youtu.be/SSOmQqjNSVY)
|
@@ -27,7 +27,7 @@ You can watch a video that gives a good overview of what Foobara is and its goal
|
|
27
27
|
* [HTTP Command Connectors](#http-command-connectors)
|
28
28
|
* [Rack Connector](#rack-connector)
|
29
29
|
* [Rails Connector](#rails-connector)
|
30
|
-
|
30
|
+
* [MCP Command Connector](#mcp-command-connector)
|
31
31
|
* [Async Command Connectors](#async-command-connectors)
|
32
32
|
* [Scheduler Command Connectors](#scheduler-command-connectors)
|
33
33
|
* [Intermediate Foobara](#intermediate-foobara)
|
@@ -834,7 +834,7 @@ end
|
|
834
834
|
|
835
835
|
This has the same effect as the previous code and is just a stylistic alternative.
|
836
836
|
|
837
|
-
|
837
|
+
#### MCP Command Connector
|
838
838
|
|
839
839
|
We can have an MCP server for free for our commands. Let's try it!
|
840
840
|
|
@@ -20,11 +20,11 @@ module Foobara
|
|
20
20
|
allow_nil = parent_declaration_data[:element_type_declarations][attribute_name][:allow_nil]
|
21
21
|
|
22
22
|
unless allow_nil
|
23
|
-
to_apply[attribute_name] = default
|
23
|
+
to_apply[attribute_name] = default.is_a?(Proc) ? default.call : default
|
24
24
|
end
|
25
25
|
end
|
26
26
|
else
|
27
|
-
to_apply[attribute_name] = default
|
27
|
+
to_apply[attribute_name] = default.is_a?(Proc) ? default.call : default
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
@@ -18,6 +18,7 @@ module Foobara
|
|
18
18
|
end
|
19
19
|
|
20
20
|
attr_reader :outcome, :exception
|
21
|
+
attr_accessor :raw_result
|
21
22
|
|
22
23
|
def run!
|
23
24
|
run.result!
|
@@ -67,7 +68,7 @@ module Foobara
|
|
67
68
|
end
|
68
69
|
|
69
70
|
def run_execute
|
70
|
-
raw_result = execute
|
71
|
+
self.raw_result = execute
|
71
72
|
result = process_result_using_result_type(raw_result)
|
72
73
|
@outcome = Outcome.success(result)
|
73
74
|
end
|
@@ -86,7 +86,10 @@ module Foobara
|
|
86
86
|
|
87
87
|
defaults = attributes_type.declaration_data[:defaults]
|
88
88
|
if defaults && !defaults.empty?
|
89
|
-
|
89
|
+
resolved_defaults = defaults.transform_values do |value|
|
90
|
+
value.is_a?(Proc) ? value.call : value
|
91
|
+
end
|
92
|
+
record.write_attributes_without_callbacks(resolved_defaults)
|
90
93
|
end
|
91
94
|
|
92
95
|
record.write_attributes_without_callbacks(attributes)
|
@@ -32,16 +32,6 @@ module Foobara
|
|
32
32
|
Util.deep_dup(records[record_id])
|
33
33
|
end
|
34
34
|
|
35
|
-
def find!(record_id)
|
36
|
-
attributes = find(record_id)
|
37
|
-
|
38
|
-
unless attributes
|
39
|
-
raise CannotFindError.new(record_id, "does not exist")
|
40
|
-
end
|
41
|
-
|
42
|
-
attributes
|
43
|
-
end
|
44
|
-
|
45
35
|
def insert(attributes)
|
46
36
|
attributes = Util.deep_dup(attributes)
|
47
37
|
|
@@ -273,7 +273,7 @@ module Foobara
|
|
273
273
|
filter, method, bang = _filter_from_method_name(method_name)
|
274
274
|
|
275
275
|
if filter
|
276
|
-
method = "foobara_#{method}#{
|
276
|
+
method = "foobara_#{method}#{"!" if bang}"
|
277
277
|
send(method, *, **, filter:, &)
|
278
278
|
else
|
279
279
|
# :nocov:
|
@@ -107,10 +107,14 @@ module Foobara
|
|
107
107
|
# :nocov:
|
108
108
|
end
|
109
109
|
|
110
|
-
def find!(
|
111
|
-
|
112
|
-
|
113
|
-
|
110
|
+
def find!(record_id)
|
111
|
+
attributes = find(record_id)
|
112
|
+
|
113
|
+
unless attributes
|
114
|
+
raise CannotFindError.new(record_id, "does not exist")
|
115
|
+
end
|
116
|
+
|
117
|
+
attributes
|
114
118
|
end
|
115
119
|
|
116
120
|
def find_many!(record_ids)
|
@@ -86,6 +86,7 @@ module Foobara
|
|
86
86
|
# :nocov:
|
87
87
|
end
|
88
88
|
|
89
|
+
# rubocop:disable Lint/IdentityComparison
|
89
90
|
if entity &&
|
90
91
|
(!entity.equal?(entity_or_record_id) || entity.object_id != entity_or_record_id.object_id)
|
91
92
|
# :nocov:
|
@@ -93,6 +94,7 @@ module Foobara
|
|
93
94
|
"Try passing in the primary key instead of constructing an unloaded entity to pass in."
|
94
95
|
# :nocov:
|
95
96
|
end
|
97
|
+
# rubocop:enable Lint/IdentityComparison
|
96
98
|
|
97
99
|
record_id = entity.primary_key
|
98
100
|
else
|
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.0.
|
4
|
+
version: 0.0.130
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Georgi
|
@@ -41,16 +41,16 @@ dependencies:
|
|
41
41
|
name: foobara-util
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
|
-
- - "
|
44
|
+
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: 0.0
|
46
|
+
version: 1.0.0
|
47
47
|
type: :runtime
|
48
48
|
prerelease: false
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- - "
|
51
|
+
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 0.0
|
53
|
+
version: 1.0.0
|
54
54
|
- !ruby/object:Gem::Dependency
|
55
55
|
name: inheritable-thread-vars
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|