datory 2.2.0.rc2 → 2.2.1
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/datory/attributes/attribute.rb +1 -1
- data/lib/datory/attributes/descriptor.rb +1 -1
- data/lib/datory/attributes/dsl.rb +4 -4
- data/lib/datory/attributes/options/base.rb +6 -6
- data/lib/datory/attributes/options/from.rb +1 -1
- data/lib/datory/attributes/options/to.rb +3 -3
- data/lib/datory/attributes/serialization/serializator.rb +1 -1
- data/lib/datory/attributes/workspace.rb +2 -2
- data/lib/datory/console.rb +3 -3
- data/lib/datory/context/callable.rb +11 -11
- data/lib/datory/context/workspace.rb +7 -7
- data/lib/datory/service/builder.rb +8 -8
- data/lib/datory/version.rb +2 -2
- metadata +11 -56
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 73e07ca3ba99f0f55ab76b4fc53b2e0deaaae05957f6fc6ef55bef9d29f1f52e
|
|
4
|
+
data.tar.gz: 8e9549b871d64c15811f4c017f829fcc4ac46bc512a224747d8b50ebf11008c1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b1f740b62a35e34fdf7a60b5c0875a808ce975e4d259c2c216f17ffb6d574fa8a087b5f1ea061f50bac633397e55f8a590a09ab412605890a9d06983b7769173
|
|
7
|
+
data.tar.gz: da5e06664b22cf5f22ed019d2b10a81077f9ff6cfa92d811cf2ee20c5a946267b779e921acbe1b996bb95fc3428add605145b47675591211c85528f371ef838c
|
|
@@ -7,7 +7,7 @@ module Datory
|
|
|
7
7
|
|
|
8
8
|
def initialize(name, **options) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
|
9
9
|
@from = Options::From.new(
|
|
10
|
-
name
|
|
10
|
+
name:,
|
|
11
11
|
type: options.fetch(:from),
|
|
12
12
|
consists_of: options.fetch(:consists_of, false),
|
|
13
13
|
min: options.fetch(:min, nil),
|
|
@@ -28,7 +28,7 @@ module Datory
|
|
|
28
28
|
name,
|
|
29
29
|
to: to.presence || name,
|
|
30
30
|
from: [include, Hash],
|
|
31
|
-
include
|
|
31
|
+
include:,
|
|
32
32
|
as: [include, Hash]
|
|
33
33
|
)
|
|
34
34
|
end
|
|
@@ -40,7 +40,7 @@ module Datory
|
|
|
40
40
|
name,
|
|
41
41
|
to: to.presence || name,
|
|
42
42
|
from: [include, Hash, NilClass],
|
|
43
|
-
include
|
|
43
|
+
include:,
|
|
44
44
|
as: [include, Hash, NilClass],
|
|
45
45
|
required: false
|
|
46
46
|
)
|
|
@@ -52,7 +52,7 @@ module Datory
|
|
|
52
52
|
to: to.presence || name,
|
|
53
53
|
from: Array,
|
|
54
54
|
consists_of: [include, Hash],
|
|
55
|
-
include
|
|
55
|
+
include:,
|
|
56
56
|
as: Array
|
|
57
57
|
)
|
|
58
58
|
end
|
|
@@ -65,7 +65,7 @@ module Datory
|
|
|
65
65
|
to: to.presence || name,
|
|
66
66
|
from: Array,
|
|
67
67
|
consists_of: [include, Hash],
|
|
68
|
-
include
|
|
68
|
+
include:,
|
|
69
69
|
as: Array,
|
|
70
70
|
required: false,
|
|
71
71
|
default: []
|
|
@@ -13,13 +13,13 @@ module Datory
|
|
|
13
13
|
|
|
14
14
|
format = format.fetch(:to, nil) if format.is_a?(Hash)
|
|
15
15
|
|
|
16
|
-
super(name
|
|
16
|
+
super(name:, type:, consists_of:, min:, max:, format:)
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def info
|
|
20
20
|
super.merge(
|
|
21
|
-
required
|
|
22
|
-
default
|
|
21
|
+
required:,
|
|
22
|
+
default:,
|
|
23
23
|
include: include_class
|
|
24
24
|
)
|
|
25
25
|
end
|
|
@@ -5,7 +5,7 @@ module Datory
|
|
|
5
5
|
module Serialization
|
|
6
6
|
class Serializator
|
|
7
7
|
def self.serialize(model:, collection_of_attributes:)
|
|
8
|
-
new(collection_of_attributes:
|
|
8
|
+
new(collection_of_attributes:).serialize(model:)
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def initialize(collection_of_attributes:)
|
|
@@ -13,8 +13,8 @@ module Datory
|
|
|
13
13
|
model = Serialization::ServiceBuilder.build!(self, model, collection_of_attributes)
|
|
14
14
|
|
|
15
15
|
Serialization::Serializator.serialize(
|
|
16
|
-
model
|
|
17
|
-
collection_of_attributes:
|
|
16
|
+
model:,
|
|
17
|
+
collection_of_attributes:
|
|
18
18
|
)
|
|
19
19
|
end
|
|
20
20
|
|
data/lib/datory/console.rb
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module Datory
|
|
4
4
|
module Context
|
|
5
|
-
module Callable
|
|
5
|
+
module Callable # rubocop:disable Metrics/ModuleLength
|
|
6
6
|
def form(model)
|
|
7
7
|
Datory::Attributes::Form.new(self, model)
|
|
8
8
|
end
|
|
@@ -52,8 +52,8 @@ module Datory
|
|
|
52
52
|
message = "Failed to parse data for deserialization: #{e.message}"
|
|
53
53
|
|
|
54
54
|
raise Datory::Exceptions::DeserializationError.new(
|
|
55
|
-
context
|
|
56
|
-
message
|
|
55
|
+
context:,
|
|
56
|
+
message:,
|
|
57
57
|
meta: { original_exception: e }
|
|
58
58
|
)
|
|
59
59
|
end
|
|
@@ -72,13 +72,13 @@ module Datory
|
|
|
72
72
|
|
|
73
73
|
direction = direction.to_s.inquiry
|
|
74
74
|
|
|
75
|
-
_to_model(context, direction
|
|
75
|
+
_to_model(context, direction:, **attributes)
|
|
76
76
|
end
|
|
77
77
|
|
|
78
78
|
def describe
|
|
79
79
|
Datory::Attributes::Descriptor.describe(
|
|
80
80
|
service_class_name: name,
|
|
81
|
-
collection_of_attributes:
|
|
81
|
+
collection_of_attributes:
|
|
82
82
|
)
|
|
83
83
|
end
|
|
84
84
|
alias table describe
|
|
@@ -100,8 +100,8 @@ module Datory
|
|
|
100
100
|
def _serialize(context, model)
|
|
101
101
|
context.send(
|
|
102
102
|
:_serialize,
|
|
103
|
-
model
|
|
104
|
-
collection_of_attributes:
|
|
103
|
+
model:,
|
|
104
|
+
collection_of_attributes:
|
|
105
105
|
)
|
|
106
106
|
end
|
|
107
107
|
|
|
@@ -109,16 +109,16 @@ module Datory
|
|
|
109
109
|
context.send(
|
|
110
110
|
:_deserialize,
|
|
111
111
|
incoming_attributes: attributes.symbolize_keys,
|
|
112
|
-
collection_of_attributes:
|
|
112
|
+
collection_of_attributes:
|
|
113
113
|
)
|
|
114
114
|
end
|
|
115
115
|
|
|
116
116
|
def _to_model(context, direction:, **attributes)
|
|
117
117
|
context.send(
|
|
118
118
|
:_to_model,
|
|
119
|
-
direction
|
|
120
|
-
attributes
|
|
121
|
-
collection_of_attributes:
|
|
119
|
+
direction:,
|
|
120
|
+
attributes:,
|
|
121
|
+
collection_of_attributes:
|
|
122
122
|
)
|
|
123
123
|
end
|
|
124
124
|
|
|
@@ -29,23 +29,23 @@ module Datory
|
|
|
29
29
|
|
|
30
30
|
def _serialize(model:, collection_of_attributes:)
|
|
31
31
|
serialize(
|
|
32
|
-
model
|
|
33
|
-
collection_of_attributes:
|
|
32
|
+
model:,
|
|
33
|
+
collection_of_attributes:
|
|
34
34
|
)
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
def _deserialize(incoming_attributes:, collection_of_attributes:)
|
|
38
38
|
deserialize(
|
|
39
|
-
incoming_attributes
|
|
40
|
-
collection_of_attributes:
|
|
39
|
+
incoming_attributes:,
|
|
40
|
+
collection_of_attributes:
|
|
41
41
|
)
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
def _to_model(direction:, attributes:, collection_of_attributes:)
|
|
45
45
|
to_model(
|
|
46
|
-
direction
|
|
47
|
-
attributes
|
|
48
|
-
collection_of_attributes:
|
|
46
|
+
direction:,
|
|
47
|
+
attributes:,
|
|
48
|
+
collection_of_attributes:
|
|
49
49
|
)
|
|
50
50
|
end
|
|
51
51
|
|
|
@@ -5,14 +5,14 @@ module Datory
|
|
|
5
5
|
class Builder < Base
|
|
6
6
|
TRANSFORMATIONS = {
|
|
7
7
|
SERIALIZATION: {
|
|
8
|
-
Symbol =>
|
|
9
|
-
String =>
|
|
10
|
-
Integer =>
|
|
11
|
-
Float =>
|
|
12
|
-
Date =>
|
|
13
|
-
Time =>
|
|
14
|
-
DateTime =>
|
|
15
|
-
ActiveSupport::Duration =>
|
|
8
|
+
Symbol => lambda(&:to_sym),
|
|
9
|
+
String => lambda(&:to_s),
|
|
10
|
+
Integer => lambda(&:to_i),
|
|
11
|
+
Float => lambda(&:to_f),
|
|
12
|
+
Date => lambda(&:to_s),
|
|
13
|
+
Time => lambda(&:to_s),
|
|
14
|
+
DateTime => lambda(&:to_s),
|
|
15
|
+
ActiveSupport::Duration => lambda(&:iso8601)
|
|
16
16
|
},
|
|
17
17
|
DESERIALIZATION: {
|
|
18
18
|
# NOTE: These types do not need to be cast automatically:
|
data/lib/datory/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: datory
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.2.
|
|
4
|
+
version: 2.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Anton Sokolov
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 2025-02-19 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: activesupport
|
|
@@ -50,14 +49,14 @@ dependencies:
|
|
|
50
49
|
requirements:
|
|
51
50
|
- - ">="
|
|
52
51
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: 2.9.0
|
|
52
|
+
version: 2.9.0
|
|
54
53
|
type: :runtime
|
|
55
54
|
prerelease: false
|
|
56
55
|
version_requirements: !ruby/object:Gem::Requirement
|
|
57
56
|
requirements:
|
|
58
57
|
- - ">="
|
|
59
58
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: 2.9.0
|
|
59
|
+
version: 2.9.0
|
|
61
60
|
- !ruby/object:Gem::Dependency
|
|
62
61
|
name: terminal-table
|
|
63
62
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -143,61 +142,19 @@ dependencies:
|
|
|
143
142
|
- !ruby/object:Gem::Version
|
|
144
143
|
version: '3.12'
|
|
145
144
|
- !ruby/object:Gem::Dependency
|
|
146
|
-
name: rubocop
|
|
145
|
+
name: servactory-rubocop
|
|
147
146
|
requirement: !ruby/object:Gem::Requirement
|
|
148
147
|
requirements:
|
|
149
|
-
- - "
|
|
150
|
-
- !ruby/object:Gem::Version
|
|
151
|
-
version: '1.57'
|
|
152
|
-
type: :development
|
|
153
|
-
prerelease: false
|
|
154
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
155
|
-
requirements:
|
|
156
|
-
- - "~>"
|
|
157
|
-
- !ruby/object:Gem::Version
|
|
158
|
-
version: '1.57'
|
|
159
|
-
- !ruby/object:Gem::Dependency
|
|
160
|
-
name: rubocop-performance
|
|
161
|
-
requirement: !ruby/object:Gem::Requirement
|
|
162
|
-
requirements:
|
|
163
|
-
- - "~>"
|
|
164
|
-
- !ruby/object:Gem::Version
|
|
165
|
-
version: '1.19'
|
|
166
|
-
type: :development
|
|
167
|
-
prerelease: false
|
|
168
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
169
|
-
requirements:
|
|
170
|
-
- - "~>"
|
|
171
|
-
- !ruby/object:Gem::Version
|
|
172
|
-
version: '1.19'
|
|
173
|
-
- !ruby/object:Gem::Dependency
|
|
174
|
-
name: rubocop-rake
|
|
175
|
-
requirement: !ruby/object:Gem::Requirement
|
|
176
|
-
requirements:
|
|
177
|
-
- - "~>"
|
|
178
|
-
- !ruby/object:Gem::Version
|
|
179
|
-
version: '0.6'
|
|
180
|
-
type: :development
|
|
181
|
-
prerelease: false
|
|
182
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
183
|
-
requirements:
|
|
184
|
-
- - "~>"
|
|
185
|
-
- !ruby/object:Gem::Version
|
|
186
|
-
version: '0.6'
|
|
187
|
-
- !ruby/object:Gem::Dependency
|
|
188
|
-
name: rubocop-rspec
|
|
189
|
-
requirement: !ruby/object:Gem::Requirement
|
|
190
|
-
requirements:
|
|
191
|
-
- - "~>"
|
|
148
|
+
- - ">="
|
|
192
149
|
- !ruby/object:Gem::Version
|
|
193
|
-
version: '
|
|
150
|
+
version: '0.5'
|
|
194
151
|
type: :development
|
|
195
152
|
prerelease: false
|
|
196
153
|
version_requirements: !ruby/object:Gem::Requirement
|
|
197
154
|
requirements:
|
|
198
|
-
- - "
|
|
155
|
+
- - ">="
|
|
199
156
|
- !ruby/object:Gem::Version
|
|
200
|
-
version: '
|
|
157
|
+
version: '0.5'
|
|
201
158
|
description: A set of tools for building reliable services of any complexity
|
|
202
159
|
email:
|
|
203
160
|
- profox.rus@gmail.com
|
|
@@ -250,7 +207,6 @@ metadata:
|
|
|
250
207
|
bug_tracker_uri: https://github.com/servactory/datory/issues
|
|
251
208
|
changelog_uri: https://github.com/servactory/datory/blob/master/CHANGELOG.md
|
|
252
209
|
rubygems_mfa_required: 'true'
|
|
253
|
-
post_install_message:
|
|
254
210
|
rdoc_options: []
|
|
255
211
|
require_paths:
|
|
256
212
|
- lib
|
|
@@ -258,15 +214,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
258
214
|
requirements:
|
|
259
215
|
- - ">="
|
|
260
216
|
- !ruby/object:Gem::Version
|
|
261
|
-
version: 3.
|
|
217
|
+
version: 3.1.0
|
|
262
218
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
263
219
|
requirements:
|
|
264
220
|
- - ">="
|
|
265
221
|
- !ruby/object:Gem::Version
|
|
266
222
|
version: '0'
|
|
267
223
|
requirements: []
|
|
268
|
-
rubygems_version: 3.
|
|
269
|
-
signing_key:
|
|
224
|
+
rubygems_version: 3.6.2
|
|
270
225
|
specification_version: 4
|
|
271
226
|
summary: A set of tools for building reliable services of any complexity
|
|
272
227
|
test_files: []
|