ecoportal-api-graphql 1.3.3 → 1.3.4
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 +22 -1
- data/lib/ecoportal/api/graphql/base/location_structure/draft.rb +23 -19
- data/lib/ecoportal/api/graphql/error/locations_error/fetch_nested.rb +8 -6
- data/lib/ecoportal/api/graphql/error/locations_error.rb +3 -1
- data/lib/ecoportal/api/graphql/error/locations_validation_error.rb +4 -1
- data/lib/ecoportal/api/graphql/fragment/location_draft.rb +14 -0
- data/lib/ecoportal/api/graphql/fragment/locations_error.rb +1 -0
- data/lib/ecoportal/api/graphql/input/location_structure/update_command.rb +14 -1
- data/lib/ecoportal/api/graphql/logic/payload.rb +7 -5
- data/lib/ecoportal/api/graphql/payload/location_structure/apply_commands.rb +3 -2
- data/lib/ecoportal/api/graphql/payload/location_structure/command_execution_result.rb +19 -9
- data/lib/ecoportal/api/graphql/payload/location_structure/draft/add_commands.rb +5 -2
- data/lib/ecoportal/api/graphql/payload/location_structure/draft/delete.rb +5 -2
- data/lib/ecoportal/api/graphql/payload/location_structure/draft/drop_bad_commands.rb +9 -7
- data/lib/ecoportal/api/graphql/payload/location_structure/draft/publish.rb +13 -6
- data/lib/ecoportal/api/graphql_version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5cc6136dc79d157acebf842f4b451e86a0f0266a5d239ad11dfa1f1db2f27ae7
|
4
|
+
data.tar.gz: 0a484624cc89b965ecb36e33beeb24470041288167deb2d48f52933a2f5f1d46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa8a69f025ff59c272b9b4285d76740d680e4a1757936ccc88383b9cda0335b1142842469cce72a330bc58bec970ca29ef1151b88761407f7938feeb4dbed220
|
7
|
+
data.tar.gz: 5da6da6b51a4795ba03f148a7b50d73f2465aa1c424be3f5accaebcd8eae3e599c022132458eabc0448d66df31f990d9f66b8efb5886b51bdbb061351afda4e5
|
data/CHANGELOG.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
|
5
|
-
## [1.3.
|
5
|
+
## [1.3.5] - 2025-09-xx
|
6
6
|
|
7
7
|
### Added
|
8
8
|
|
@@ -10,6 +10,27 @@ All notable changes to this project will be documented in this file.
|
|
10
10
|
|
11
11
|
### Fixed
|
12
12
|
|
13
|
+
## [1.3.4] - 2025-09-04
|
14
|
+
|
15
|
+
### Added
|
16
|
+
|
17
|
+
- Command execution result: **added** command doc when there's a `results` error.
|
18
|
+
- Payload improvements:
|
19
|
+
- On `LocationsError.validationErrors`: fetch `property` property.
|
20
|
+
- On **results**, `Command` always fetch `__typename` and the other properties.
|
21
|
+
|
22
|
+
### Changed
|
23
|
+
|
24
|
+
- Changed base `error_doc`: **consistent property name**
|
25
|
+
|
26
|
+
### Fixed
|
27
|
+
|
28
|
+
- Correct fetch on `ok` (sometimes it is `null`: that doesn't mean failed).
|
29
|
+
- **Consistent order** on `error?` and `error_doc`.
|
30
|
+
- `Draft`
|
31
|
+
- **Overlapping** name `ConflictingIds` (vs `LocationsError.conflictingIds`)
|
32
|
+
- **Wrong** include on `FetchNested`
|
33
|
+
|
13
34
|
## [1.3.3] - 2025-08-29
|
14
35
|
|
15
36
|
### Added
|
@@ -11,46 +11,50 @@ module Ecoportal
|
|
11
11
|
passkey :id
|
12
12
|
|
13
13
|
passthrough :name, :notes
|
14
|
-
|
14
|
+
|
15
|
+
passboolean :commited
|
15
16
|
alias_method :commited?, :commited
|
16
|
-
alias_method :ok?, :ok
|
17
17
|
|
18
18
|
embeds_one :createdAt, klass: Base::DateTime
|
19
19
|
|
20
|
+
embeds_one :structure, klass: :structure_class
|
21
|
+
|
20
22
|
passarray :conflictingIds
|
21
23
|
embeds_many :commands, klass: Interface::LocationStructure::Command
|
22
24
|
embeds_many :results, read_only: true, klass: "Ecoportal::API::GraphQL::Payload::LocationStructure::CommandExecutionResult"
|
23
25
|
|
24
|
-
|
26
|
+
passboolean :ok
|
25
27
|
|
26
|
-
|
28
|
+
def ok?
|
29
|
+
ok != false
|
30
|
+
end
|
31
|
+
|
32
|
+
def success?
|
33
|
+
!error?
|
34
|
+
end
|
27
35
|
|
28
36
|
def error?
|
29
|
-
|
37
|
+
conflictingIds? ||
|
30
38
|
result_errors? ||
|
31
|
-
|
39
|
+
!ok?
|
32
40
|
end
|
33
41
|
|
34
42
|
def error_doc
|
35
|
-
if
|
43
|
+
if conflictingIds?
|
36
44
|
{
|
37
|
-
|
45
|
+
conflictingIds: conflictingIds.doc
|
38
46
|
}
|
39
|
-
elsif
|
47
|
+
elsif result_errors?
|
40
48
|
{
|
41
|
-
|
49
|
+
results: [result_errors.first&.error_doc]
|
42
50
|
}
|
43
51
|
elsif !ok?
|
44
52
|
{
|
45
|
-
ok:
|
53
|
+
ok: ok
|
46
54
|
}
|
47
55
|
end
|
48
56
|
end
|
49
57
|
|
50
|
-
def success?
|
51
|
-
!error?
|
52
|
-
end
|
53
|
-
|
54
58
|
def structure_id
|
55
59
|
parent_structure&.id
|
56
60
|
end
|
@@ -68,6 +72,10 @@ module Ecoportal
|
|
68
72
|
_parent._parent
|
69
73
|
end
|
70
74
|
|
75
|
+
def conflictingIds?
|
76
|
+
(conflictingIds || []).any?
|
77
|
+
end
|
78
|
+
|
71
79
|
def result_errors?
|
72
80
|
result_errors.any?
|
73
81
|
end
|
@@ -75,10 +83,6 @@ module Ecoportal
|
|
75
83
|
def result_errors
|
76
84
|
results.select(&:error?)
|
77
85
|
end
|
78
|
-
|
79
|
-
def conflictingIds?
|
80
|
-
(conflictingIds || []).any?
|
81
|
-
end
|
82
86
|
end
|
83
87
|
end
|
84
88
|
end # GraphQL
|
@@ -7,9 +7,9 @@ module Ecoportal
|
|
7
7
|
def locations_error_doc
|
8
8
|
return unless locations_error?
|
9
9
|
|
10
|
-
if
|
10
|
+
if loc_err_conflicting_ids?
|
11
11
|
{
|
12
|
-
conflictingIds:
|
12
|
+
conflictingIds: loc_err_conflicting_ids.doc
|
13
13
|
}
|
14
14
|
elsif validationErrors?
|
15
15
|
{
|
@@ -19,18 +19,20 @@ module Ecoportal
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def locations_error?
|
22
|
-
|
22
|
+
return false if error.nil?
|
23
|
+
|
24
|
+
!error.empty?
|
23
25
|
end
|
24
26
|
|
25
|
-
def
|
26
|
-
|
27
|
+
def loc_err_conflicting_ids?
|
28
|
+
loc_err_conflicting_ids.any?
|
27
29
|
end
|
28
30
|
|
29
31
|
def validationErrors?
|
30
32
|
validationErrors.any?
|
31
33
|
end
|
32
34
|
|
33
|
-
def
|
35
|
+
def loc_err_conflicting_ids
|
34
36
|
return [] unless (err = error)
|
35
37
|
|
36
38
|
err.conflictingIds || []
|
@@ -17,11 +17,24 @@ module Ecoportal
|
|
17
17
|
id
|
18
18
|
state
|
19
19
|
__typename
|
20
|
+
... on LocationInsertCommand {
|
21
|
+
nodeId name parentId insertBefore classificationIds
|
22
|
+
}
|
23
|
+
... on LocationUpdateCommand {
|
24
|
+
nodeId newId
|
25
|
+
newName: name
|
26
|
+
newClassificationIds: classificationIds
|
27
|
+
}
|
28
|
+
... on LocationArchiveCommand { nodeId }
|
29
|
+
... on LocationUnarchiveCommand { nodeId }
|
30
|
+
... on LocationMoveCommand { nodeId parentId insertBefore }
|
31
|
+
... on LocationReorderCommand { parentId orderedIds }
|
20
32
|
}
|
21
33
|
error {
|
22
34
|
message
|
23
35
|
conflictingIds
|
24
36
|
validationErrors {
|
37
|
+
property
|
25
38
|
error
|
26
39
|
message
|
27
40
|
}
|
@@ -30,6 +43,7 @@ module Ecoportal
|
|
30
43
|
commands {
|
31
44
|
id
|
32
45
|
state
|
46
|
+
__typename
|
33
47
|
}
|
34
48
|
}
|
35
49
|
GRAPHQL
|
@@ -5,7 +5,20 @@ module Ecoportal
|
|
5
5
|
module LocationStructure
|
6
6
|
class UpdateCommand < Interface::LocationStructure::Command
|
7
7
|
passthrough :nodeId, :newId
|
8
|
-
passthrough :name, :
|
8
|
+
passthrough :name, :newName
|
9
|
+
passthrough :classificationIds, :newClassificationIds
|
10
|
+
|
11
|
+
def name
|
12
|
+
super if newName.nil?
|
13
|
+
|
14
|
+
newName
|
15
|
+
end
|
16
|
+
|
17
|
+
def classificationIds
|
18
|
+
super if newClassificationIds.empty?
|
19
|
+
|
20
|
+
newClassificationIds
|
21
|
+
end
|
9
22
|
end
|
10
23
|
end
|
11
24
|
end
|
@@ -18,19 +18,21 @@ module Ecoportal
|
|
18
18
|
embeds_one :item, klass: :item_class
|
19
19
|
embeds_one :errors, klass: Error::ValidationErrors, nullable: true
|
20
20
|
|
21
|
-
def error?
|
22
|
-
errors && !errors.empty?
|
23
|
-
end
|
24
|
-
|
25
21
|
def success?
|
26
22
|
!error?
|
27
23
|
end
|
28
24
|
|
25
|
+
def error?
|
26
|
+
return false if errors.nil?
|
27
|
+
|
28
|
+
!errors.empty?
|
29
|
+
end
|
30
|
+
|
29
31
|
def error_doc
|
30
32
|
return unless (err_doc = errors&.doc)
|
31
33
|
|
32
34
|
{
|
33
|
-
|
35
|
+
errors: err_doc
|
34
36
|
}
|
35
37
|
end
|
36
38
|
end
|
@@ -8,11 +8,12 @@ module Ecoportal
|
|
8
8
|
|
9
9
|
passthrough :clientMutationId
|
10
10
|
embeds_one :structure, klass: Model::LocationStructure
|
11
|
-
embeds_one :error, klass: Error::LocationsError, nullable: true
|
12
|
-
embeds_many :results, read_only: true, klass: Payload::LocationStructure::CommandExecutionResult
|
13
11
|
|
12
|
+
embeds_one :error, klass: Error::LocationsError, nullable: true
|
14
13
|
include Error::LocationsError::FetchNested
|
15
14
|
|
15
|
+
embeds_many :results, read_only: true, klass: Payload::LocationStructure::CommandExecutionResult
|
16
|
+
|
16
17
|
def error?
|
17
18
|
super || result_errors? || locations_error?
|
18
19
|
end
|
@@ -7,14 +7,23 @@ module Ecoportal
|
|
7
7
|
read_only!
|
8
8
|
|
9
9
|
embeds_one :command, klass: Interface::LocationStructure::Command
|
10
|
-
embeds_one :error, nullable: true, klass: Error::LocationsError
|
11
|
-
passboolean :ok
|
12
|
-
alias_method :ok?, :ok
|
13
10
|
|
11
|
+
embeds_one :error, klass: Error::LocationsError, nullable: true
|
14
12
|
include Error::LocationsError::FetchNested
|
15
13
|
|
14
|
+
passboolean :ok
|
15
|
+
|
16
|
+
def ok?
|
17
|
+
ok != false
|
18
|
+
end
|
19
|
+
|
20
|
+
def success?
|
21
|
+
!error?
|
22
|
+
end
|
23
|
+
|
16
24
|
def error?
|
17
|
-
|
25
|
+
locations_error? ||
|
26
|
+
!ok?
|
18
27
|
end
|
19
28
|
|
20
29
|
def error_doc
|
@@ -24,13 +33,14 @@ module Ecoportal
|
|
24
33
|
}
|
25
34
|
elsif !ok?
|
26
35
|
{
|
27
|
-
ok:
|
36
|
+
ok: ok
|
28
37
|
}
|
29
|
-
end
|
30
|
-
|
38
|
+
end.tap do |err_doc|
|
39
|
+
next unless err_doc.is_a?(Hash)
|
40
|
+
next if err_doc.empty?
|
31
41
|
|
32
|
-
|
33
|
-
|
42
|
+
err_doc[:command] = command.doc
|
43
|
+
end
|
34
44
|
end
|
35
45
|
end
|
36
46
|
end
|
@@ -6,7 +6,10 @@ module Ecoportal
|
|
6
6
|
module Draft
|
7
7
|
class AddCommands < Create
|
8
8
|
passboolean :ok
|
9
|
-
|
9
|
+
|
10
|
+
def ok?
|
11
|
+
ok != false
|
12
|
+
end
|
10
13
|
|
11
14
|
def error?
|
12
15
|
super || !ok?
|
@@ -16,7 +19,7 @@ module Ecoportal
|
|
16
19
|
err_doc = super
|
17
20
|
return err_doc if err_doc
|
18
21
|
|
19
|
-
{ ok:
|
22
|
+
{ ok: ok } unless ok?
|
20
23
|
end
|
21
24
|
end
|
22
25
|
end
|
@@ -6,7 +6,10 @@ module Ecoportal
|
|
6
6
|
module Draft
|
7
7
|
class Delete < Logic::Payload
|
8
8
|
passboolean :ok
|
9
|
-
|
9
|
+
|
10
|
+
def ok?
|
11
|
+
ok != false
|
12
|
+
end
|
10
13
|
|
11
14
|
def error?
|
12
15
|
super || !ok?
|
@@ -16,7 +19,7 @@ module Ecoportal
|
|
16
19
|
err_doc = super
|
17
20
|
return err_doc if err_doc
|
18
21
|
|
19
|
-
{ ok:
|
22
|
+
{ ok: ok } unless ok?
|
20
23
|
end
|
21
24
|
end
|
22
25
|
end
|
@@ -5,17 +5,19 @@ module Ecoportal
|
|
5
5
|
module LocationStructure
|
6
6
|
module Draft
|
7
7
|
class DropBadCommands < AddCommands
|
8
|
-
passboolean :ok
|
9
|
-
alias_method :ok?, :ok
|
10
|
-
|
11
8
|
embeds_one :error, klass: Error::LocationsError, nullable: true
|
12
|
-
|
13
9
|
include Error::LocationsError::FetchNested
|
14
10
|
|
11
|
+
passboolean :ok
|
12
|
+
|
13
|
+
def ok?
|
14
|
+
ok != false
|
15
|
+
end
|
16
|
+
|
15
17
|
def error?
|
16
18
|
super ||
|
17
|
-
|
18
|
-
|
19
|
+
locations_error? ||
|
20
|
+
!ok?
|
19
21
|
end
|
20
22
|
|
21
23
|
def error_doc
|
@@ -28,7 +30,7 @@ module Ecoportal
|
|
28
30
|
}
|
29
31
|
elsif !ok?
|
30
32
|
{
|
31
|
-
ok:
|
33
|
+
ok: ok
|
32
34
|
}
|
33
35
|
end
|
34
36
|
end
|
@@ -10,19 +10,22 @@ module Ecoportal
|
|
10
10
|
embeds_one :structure, klass: :item_class
|
11
11
|
alias_method :item, :structure
|
12
12
|
|
13
|
-
passboolean :ok
|
14
|
-
alias_method :ok?, :ok
|
15
|
-
|
16
13
|
embeds_one :error, klass: Error::LocationsError, nullable: true
|
14
|
+
include Error::LocationsError::FetchNested
|
15
|
+
|
17
16
|
embeds_many :results, read_only: true, klass: Payload::LocationStructure::CommandExecutionResult
|
18
17
|
|
19
|
-
|
18
|
+
passboolean :ok
|
19
|
+
|
20
|
+
def ok?
|
21
|
+
ok != false
|
22
|
+
end
|
20
23
|
|
21
24
|
def error?
|
22
25
|
super ||
|
23
|
-
!ok? ||
|
24
26
|
locations_error? ||
|
25
|
-
result_errors?
|
27
|
+
result_errors? ||
|
28
|
+
!ok?
|
26
29
|
end
|
27
30
|
|
28
31
|
def error_doc
|
@@ -37,6 +40,10 @@ module Ecoportal
|
|
37
40
|
{
|
38
41
|
results: [result_errors.first&.error_doc]
|
39
42
|
}
|
43
|
+
elsif !ok?
|
44
|
+
{
|
45
|
+
ok: ok
|
46
|
+
}
|
40
47
|
end
|
41
48
|
end
|
42
49
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ecoportal-api-graphql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oscar Segura
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|