eco-helpers 2.7.7 → 2.7.9
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 +28 -2
- data/eco-helpers.gemspec +1 -1
- data/lib/eco/api/common/people/default_parsers/date_parser.rb +1 -1
- data/lib/eco/api/usecases/graphql/base.rb +0 -1
- data/lib/eco/api/usecases/graphql/helpers/location/command/diff/as_update.rb +3 -1
- data/lib/eco/api/usecases/graphql/helpers/location/command/result.rb +9 -6
- data/lib/eco/api/usecases/graphql/helpers/location/command/results.rb +1 -1
- data/lib/eco/api/usecases/graphql/samples/location/command/service/tree_update.rb +2 -0
- data/lib/eco/cli_default/options.rb +12 -7
- data/lib/eco/data/locations/node_diff/accessors.rb +2 -2
- data/lib/eco/data/locations/node_diff/nodes_diff/selectors.rb +3 -2
- data/lib/eco/data/locations/node_diff/nodes_diff.rb +30 -0
- data/lib/eco/data/locations/node_diff.rb +9 -0
- data/lib/eco/version.rb +1 -1
- 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: 41e63439f7a3d89c5e3c9e10be328b9487ecffe4dde6a83a6fd6f9a561d924a8
|
4
|
+
data.tar.gz: bafc6c443ce57b2611c177b00eca9aca0fd06718712511eb2b93762ff957179b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0094ce51df0b47838a44b679fe82a4acacfc64953edeea38ef2c51b6efeb08f0629f019751b319542dddcac5e77838786cdd1b7333b16babb0bf02ad4e197fb3'
|
7
|
+
data.tar.gz: ee5243547b98cdeabba4cf1fdbbd8759b0f24d1e5ea4f4e42b998569ebe0c00bf3d5139ef2c28886bfa96efe6cd7e65344245b4eb6d7c9bb0a08964d075ddd12
|
data/CHANGELOG.md
CHANGED
@@ -1,16 +1,42 @@
|
|
1
1
|
# Change Log
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
-
## [2.7.
|
4
|
+
## [2.7.10] - 2024-05-xx
|
5
5
|
|
6
6
|
### Added
|
7
7
|
### Changed
|
8
8
|
### Fixed
|
9
9
|
|
10
|
-
## [2.7.
|
10
|
+
## [2.7.9] - 2024-05-16
|
11
|
+
|
12
|
+
### Fixed
|
13
|
+
- `Eco::Data::Locations::NodeDiff::NodesDiff#unarchive`
|
14
|
+
- It must include archived nodes that will receive new children
|
15
|
+
|
16
|
+
## [2.7.8] - 2024-05-16
|
11
17
|
|
12
18
|
### Added
|
19
|
+
- `Eco::API::UseCases::GraphQL::Helpers::Location::Command:Result`
|
20
|
+
- Feedback original command.
|
21
|
+
|
13
22
|
### Changed
|
23
|
+
- upgraded `ecoportal-api-graphql` gem
|
24
|
+
- able to skip email via options (`-no-email`)
|
25
|
+
|
26
|
+
## [2.7.8] - 2024-05-xx
|
27
|
+
|
28
|
+
### Added
|
29
|
+
- `Eco::API::UseCases::GraphQL::Helpers::Location::Command:Result`
|
30
|
+
- Feedback original command.
|
31
|
+
|
32
|
+
### Changed
|
33
|
+
- upgraded `ecoportal-api-graphql` gem
|
34
|
+
- able to skip email via options (`-no-email`)
|
35
|
+
|
36
|
+
### Fixed
|
37
|
+
|
38
|
+
## [2.7.7] - 2024-05-16
|
39
|
+
|
14
40
|
### Fixed
|
15
41
|
- `Eco::API::UseCases::OozeSamples::TargetOozesUpdateCase`
|
16
42
|
- default prompt to user to `Y` when in remote mode.
|
data/eco-helpers.gemspec
CHANGED
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
|
|
32
32
|
|
33
33
|
spec.add_dependency 'ecoportal-api', '>= 0.9.8', '< 0.10'
|
34
34
|
spec.add_dependency 'ecoportal-api-v2', '>= 1.1.8', '< 1.2'
|
35
|
-
spec.add_dependency 'ecoportal-api-graphql', '>= 0.3.
|
35
|
+
spec.add_dependency 'ecoportal-api-graphql', '>= 0.3.18', '< 0.4'
|
36
36
|
spec.add_dependency 'aws-sdk-s3', '>= 1.142.0', '< 2'
|
37
37
|
spec.add_dependency 'aws-sdk-ses', '>= 1.58.0', '< 2'
|
38
38
|
spec.add_dependency 'dotenv', '>= 2.8.1', '< 3'
|
@@ -24,7 +24,7 @@ class Eco::API::Common::People::DefaultParsers::DateParser < Eco::API::Common::L
|
|
24
24
|
date = Date.parse(value)
|
25
25
|
return date if valid_range?(date)
|
26
26
|
|
27
|
-
wrong!(value, attr: attr, desc: 'Date out of range (1900-2099). Given:
|
27
|
+
wrong!(value, attr: attr, desc: 'Date out of range (1900-2099). Given:')
|
28
28
|
rescue TypeError, Date::Error
|
29
29
|
nil
|
30
30
|
end
|
@@ -9,7 +9,6 @@ class Eco::API::UseCases::GraphQL::Base < Eco::API::Common::Loaders::UseCase
|
|
9
9
|
include Eco::Language::Methods::CallDetector
|
10
10
|
|
11
11
|
def main(_sess, options, _case)
|
12
|
-
options.deep_merge!(workflow: {no_email: true}) # prevent the default mailer to quick in
|
13
12
|
options[:end_get] = false
|
14
13
|
process
|
15
14
|
end
|
@@ -35,8 +35,10 @@ class Eco::API::UseCases::GraphQL::Helpers::Location::Command::Diff
|
|
35
35
|
h['parentId'] = after_id_update ? parent_id : parent_id_prev
|
36
36
|
end
|
37
37
|
else
|
38
|
+
return h if marked_for_unarchive?
|
39
|
+
|
38
40
|
# Something is wrong (not expected to be any other category)
|
39
|
-
raise "
|
41
|
+
raise "Please review code base, unexpected condition for #{h.pretty_inspect}"
|
40
42
|
end
|
41
43
|
end
|
42
44
|
end
|
@@ -41,13 +41,16 @@ module Eco::API::UseCases::GraphQL::Helpers::Location::Command
|
|
41
41
|
|
42
42
|
def error_msg
|
43
43
|
return nil unless error?
|
44
|
-
msg = ''
|
45
|
-
msg << "(#{command} '#{node_id}') #{error.message}\n"
|
46
|
-
return msg if error.validationErrors.empty?
|
47
44
|
|
48
|
-
msg
|
49
|
-
msg << error.
|
50
|
-
|
45
|
+
msg = []
|
46
|
+
msg << "(#{command} '#{node_id}') #{error.message}"
|
47
|
+
|
48
|
+
feed = []
|
49
|
+
feed.concat(error.validationErrors.map(&:message)) unless error.validationErrors.empty?
|
50
|
+
feed << "Command: #{command_input_data.pretty_inspect}"
|
51
|
+
|
52
|
+
msg << " • #{feed.join("\n • ")}"
|
53
|
+
msg.join("\n")
|
51
54
|
end
|
52
55
|
|
53
56
|
def command_result
|
@@ -82,6 +82,8 @@ class Eco::API::UseCases::GraphQL::Samples::Location
|
|
82
82
|
|
83
83
|
def email_digest(title)
|
84
84
|
return if simulate?
|
85
|
+
return if options.dig(:workflow, :no_email)
|
86
|
+
|
85
87
|
digest_msgs = logger.cache.logs(level: %i[info error warn])
|
86
88
|
exception = exception ? " - Exception!" : ''
|
87
89
|
subject = "#{config.active_enviro} - #{title}#{exception}"
|
@@ -1,8 +1,8 @@
|
|
1
|
-
ASSETS.cli.config do |cnf|
|
2
|
-
cnf.options_set do |options_set, options|
|
3
|
-
options_set.add("--help", "Offers a HELP") do |options,
|
1
|
+
ASSETS.cli.config do |cnf| # rubocop:disable Metrics/BlockLength
|
2
|
+
cnf.options_set do |options_set, options| # rubocop:disable Metrics/BlockLength
|
3
|
+
options_set.add("--help", "Offers a HELP") do |options, session|
|
4
4
|
conf = ASSETS.cli.config
|
5
|
-
active =
|
5
|
+
active = proc do |opt|
|
6
6
|
if there = SCR.get_arg(opt)
|
7
7
|
refine = SCR.get_arg(opt, with_param: true)
|
8
8
|
end
|
@@ -37,7 +37,7 @@ ASSETS.cli.config do |cnf|
|
|
37
37
|
desc = "Redirect Standard Ouput to file"
|
38
38
|
options_set.add("-stdout", desc) do |options, session|
|
39
39
|
file = SCR.get_arg("-stdout", with_param: true) || "output.txt"
|
40
|
-
|
40
|
+
$stdout.reopen(file, "w+")
|
41
41
|
end
|
42
42
|
|
43
43
|
desc = "Skips the check of the headers"
|
@@ -125,14 +125,14 @@ ASSETS.cli.config do |cnf|
|
|
125
125
|
options.deep_merge!(report: {people: {csv: file}})
|
126
126
|
end
|
127
127
|
|
128
|
-
desc
|
128
|
+
desc = "Runs in dry-run (no requests sent to server)"
|
129
129
|
options_set.add(["-dry-run", "-simulate"], desc) do |options, session|
|
130
130
|
options[:dry_run] = true
|
131
131
|
options[:simulate] = true
|
132
132
|
session.config.dry_run!
|
133
133
|
end
|
134
134
|
|
135
|
-
desc
|
135
|
+
desc = "Runs runs post_launch cases even if in dry-run"
|
136
136
|
options_set.add("-run-postlaunch", desc) do |options, session|
|
137
137
|
options.deep_merge!(post_launch: {run: true})
|
138
138
|
end
|
@@ -181,6 +181,11 @@ ASSETS.cli.config do |cnf|
|
|
181
181
|
options.deep_merge!(search: {soft: true, strict: false})
|
182
182
|
end
|
183
183
|
|
184
|
+
desc = "Prevent email to be sent (experimental)"
|
185
|
+
options_set.add("-no-email", desc) do |options|
|
186
|
+
options.deep_merge!(workflow: {no_email: true})
|
187
|
+
end
|
188
|
+
|
184
189
|
desc = "Silence notifications on account creation or invites"
|
185
190
|
options_set.add(["-no-invites", "-exclude-invites"], desc) do |options|
|
186
191
|
options.merge!(send_invites: false)
|
@@ -20,8 +20,8 @@ class Eco::Data::Locations::NodeDiff
|
|
20
20
|
def attr_expose(*attrs)
|
21
21
|
attrs.each do |attr|
|
22
22
|
meth = attr.to_sym
|
23
|
-
methp = "#{meth}_prev"
|
24
|
-
methq = "#{meth}?"
|
23
|
+
methp = :"#{meth}_prev"
|
24
|
+
methq = :"#{meth}?"
|
25
25
|
|
26
26
|
# current value
|
27
27
|
define_method meth do
|
@@ -5,8 +5,9 @@ class Eco::Data::Locations::NodeDiff::NodesDiff
|
|
5
5
|
# @note the selector method name with a question mark should exist in the `diff_result_class`
|
6
6
|
def selector(*attrs)
|
7
7
|
attrs.each do |attr|
|
8
|
-
meth
|
9
|
-
methq = "#{meth}?"
|
8
|
+
meth = attr.to_sym
|
9
|
+
methq = :"#{meth}?"
|
10
|
+
|
10
11
|
define_method meth do
|
11
12
|
diffs.select(&methq)
|
12
13
|
end
|
@@ -21,6 +21,7 @@ class Eco::Data::Locations::NodeDiff
|
|
21
21
|
def initialize(*args, original_tree:, **kargs, &block)
|
22
22
|
super(*args, **kargs, &block)
|
23
23
|
@original_tree = original_tree
|
24
|
+
mark_implicit_unarchive!
|
24
25
|
end
|
25
26
|
|
26
27
|
def diffs
|
@@ -95,6 +96,14 @@ class Eco::Data::Locations::NodeDiff
|
|
95
96
|
msg.compact.join("\n")
|
96
97
|
end
|
97
98
|
|
99
|
+
alias_method :unarchive_src, :unarchive
|
100
|
+
|
101
|
+
# @note we must unarchive destination parents that will get
|
102
|
+
# some children as well
|
103
|
+
def unarchive
|
104
|
+
unarchive_src | @implicit_unarchive
|
105
|
+
end
|
106
|
+
|
98
107
|
private
|
99
108
|
|
100
109
|
def when_present(list, default = nil)
|
@@ -103,5 +112,26 @@ class Eco::Data::Locations::NodeDiff
|
|
103
112
|
return yield(count) if count&.positive?
|
104
113
|
default
|
105
114
|
end
|
115
|
+
|
116
|
+
def mark_implicit_unarchive!
|
117
|
+
@implicit_unarchive = source_results.select do |result|
|
118
|
+
result.archived_prev && implicit_unarchive?(result)
|
119
|
+
end.tap do |results|
|
120
|
+
results.each(&:unarchive!)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def implicit_unarchive?(result)
|
125
|
+
[result.node_id, result.node_id_prev].compact.any? do |id|
|
126
|
+
target_parent_ids.include?(id)
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
def target_parent_ids
|
131
|
+
return @target_parent_ids if instance_variable_defined?(:@target_parent_ids)
|
132
|
+
|
133
|
+
@target_parent_ids = insert.map(&:parent_id).uniq
|
134
|
+
@target_parent_ids |= move.map(&:parent_id)
|
135
|
+
end
|
106
136
|
end
|
107
137
|
end
|
@@ -59,8 +59,17 @@ module Eco::Data::Locations
|
|
59
59
|
parent_id?
|
60
60
|
end
|
61
61
|
|
62
|
+
def unarchive!
|
63
|
+
@marked_for_unarchived = true
|
64
|
+
end
|
65
|
+
|
66
|
+
def marked_for_unarchive?
|
67
|
+
@marked_for_unarchived || false
|
68
|
+
end
|
69
|
+
|
62
70
|
# Has the `archived` property changed and it was `true`?
|
63
71
|
def unarchive?
|
72
|
+
return true if marked_for_unarchive?
|
64
73
|
return false if archived
|
65
74
|
return false unless update?
|
66
75
|
archived?
|
data/lib/eco/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eco-helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.7.
|
4
|
+
version: 2.7.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oscar Segura
|
@@ -156,7 +156,7 @@ dependencies:
|
|
156
156
|
requirements:
|
157
157
|
- - ">="
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: 0.3.
|
159
|
+
version: 0.3.18
|
160
160
|
- - "<"
|
161
161
|
- !ruby/object:Gem::Version
|
162
162
|
version: '0.4'
|
@@ -166,7 +166,7 @@ dependencies:
|
|
166
166
|
requirements:
|
167
167
|
- - ">="
|
168
168
|
- !ruby/object:Gem::Version
|
169
|
-
version: 0.3.
|
169
|
+
version: 0.3.18
|
170
170
|
- - "<"
|
171
171
|
- !ruby/object:Gem::Version
|
172
172
|
version: '0.4'
|