forest_admin_agent 1.0.0.pre.beta.99 → 1.0.0.pre.beta.100

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 071bfbdcb392967adb71b8db86e80fc53e871ad773a293ee704a586ce0f19881
4
- data.tar.gz: a6e5580df5ae4fc67dc9adf93629b5a0c960a1a27d74ccea0bd7293bdfe2db8c
3
+ metadata.gz: 571b2ad1ae88257dca7e1818d91782c6f2e2e6289406814170bff6df5f1e298d
4
+ data.tar.gz: 80b3fc61ce8df873bc697ff898594cc0d90cd3a66312de5f7d205b4d9940ae74
5
5
  SHA512:
6
- metadata.gz: 86e0d403f2690a1796f9691ce799543829be6a4c168948253ac8fe6cf18417d0501b493559bf2ef1bd07b64ac8d13a9131032e093b237c979dc9595d84dfbd24
7
- data.tar.gz: cf9c649e95da03edca9db6d6b7518ccf0627fcb26eb9dfb9da8960979ee69c97149deb7c06e7721e6c63ef2d557503e64d9fd607532298b439f03929a380010c
6
+ metadata.gz: 8aabb66ff52ccabc7ac79c3e8f0d848e78d786a4d9205965107c39d5bcffd5a08511915b60525bfa90010486075a2214e1bf551c0db3be5f05f5ed1a428ae483
7
+ data.tar.gz: f06148e05b27bc68c11aa1193f6ba737c8cc17458a9bf57925f96759f512202488c6e7d271cc573c3587bb963044d321b67637d1ddccd59fa682af6d44f5d9ab
@@ -11,12 +11,12 @@ module ForestAdminAgent
11
11
  end
12
12
 
13
13
  def format_attributes(args)
14
- record = args[:params][:data][:attributes]
14
+ record = args[:params][:data][:attributes] || {}
15
15
 
16
16
  args[:params][:data][:relationships]&.map do |field, value|
17
17
  schema = @collection.schema[:fields][field]
18
18
 
19
- record[schema.foreign_key] = value['data'][schema.foreign_key_target] if schema.type == 'ManyToOne'
19
+ record[schema.foreign_key] = value['data']['id'] if schema.type == 'ManyToOne'
20
20
  end
21
21
 
22
22
  record || {}
@@ -31,7 +31,8 @@ module ForestAdminAgent
31
31
  ForestAdminAgent::Utils::QueryStringParser.parse_condition_tree(@child_collection, args)
32
32
  ]
33
33
  ),
34
- page: ForestAdminAgent::Utils::QueryStringParser.parse_pagination(args)
34
+ page: ForestAdminAgent::Utils::QueryStringParser.parse_pagination(args),
35
+ sort: ForestAdminAgent::Utils::QueryStringParser.parse_sort(@child_collection, args)
35
36
  )
36
37
  projection = ForestAdminAgent::Utils::QueryStringParser.parse_projection_with_pks(@child_collection, args)
37
38
  id = Utils::Id.unpack_id(@collection, args[:params]['id'], with_key: true)
@@ -20,8 +20,7 @@ module ForestAdminAgent
20
20
  id = Utils::Id.unpack_id(@collection, args[:params]['id'], with_key: true)
21
21
  condition_tree = ConditionTree::ConditionTreeFactory.match_records(@collection, [id])
22
22
  filter = ForestAdminDatasourceToolkit::Components::Query::Filter.new(
23
- condition_tree: ConditionTree::ConditionTreeFactory.intersect([condition_tree, scope]),
24
- page: ForestAdminAgent::Utils::QueryStringParser.parse_pagination(args)
23
+ condition_tree: ConditionTree::ConditionTreeFactory.intersect([condition_tree, scope])
25
24
  )
26
25
 
27
26
  projection = ProjectionFactory.all(@collection)
@@ -19,10 +19,9 @@ module ForestAdminAgent
19
19
  data = format_attributes(args)
20
20
  record = @collection.create(@caller, data)
21
21
  link_one_to_one_relations(args, record)
22
-
23
- id = Utils::Id.unpack_id(@collection, record['id'], with_key: true)
22
+ id = ForestAdminDatasourceToolkit::Utils::Record.primary_keys(@collection, record)
24
23
  filter = ForestAdminDatasourceToolkit::Components::Query::Filter.new(
25
- condition_tree: ConditionTree::ConditionTreeFactory.match_records(@collection, [id])
24
+ condition_tree: ConditionTree::ConditionTreeFactory.match_ids(@collection, [id])
26
25
  )
27
26
  records = @collection.list(@caller, filter, ProjectionFactory.all(@collection))
28
27
 
@@ -40,7 +39,7 @@ module ForestAdminAgent
40
39
  def link_one_to_one_relations(args, record)
41
40
  args[:params][:data][:relationships]&.map do |field, value|
42
41
  schema = @collection.schema[:fields][field]
43
- next unless ['OneToOne', 'PolymorphicOneToOne'].include?(schema.type)
42
+ next unless %w[OneToOne PolymorphicOneToOne].include?(schema.type)
44
43
 
45
44
  id = Utils::Id.unpack_id(@collection, value['data']['id'], with_key: true)
46
45
  foreign_collection = @datasource.get_collection(schema.foreign_collection)
@@ -31,9 +31,8 @@ module ForestAdminAgent
31
31
 
32
32
  def self.parse_value(collection, leaf)
33
33
  schema = Collection.get_field_schema(collection, leaf[:field])
34
- operator = leaf[:operator].titleize.tr(' ', '_')
35
34
 
36
- if operator == Operators::IN && leaf[:field].is_a?(String)
35
+ if leaf[:operator] == Operators::IN && leaf[:field].is_a?(String)
37
36
  values = leaf[:value].split(',').map(&:strip)
38
37
 
39
38
  return values.map { |item| !%w[false 0 no].include?(item) } if schema.column_type == 'Boolean'
@@ -7,7 +7,7 @@ module ForestAdminAgent
7
7
  class SchemaEmitter
8
8
  LIANA_NAME = "agent-ruby"
9
9
 
10
- LIANA_VERSION = "1.0.0-beta.99"
10
+ LIANA_VERSION = "1.0.0-beta.100"
11
11
 
12
12
  def self.get_serialized_schema(datasource)
13
13
  schema_path = Facades::Container.cache(:schema_path)
@@ -1,3 +1,3 @@
1
1
  module ForestAdminAgent
2
- VERSION = "1.0.0-beta.99"
2
+ VERSION = "1.0.0-beta.100"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forest_admin_agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre.beta.99
4
+ version: 1.0.0.pre.beta.100
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthieu
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2025-02-27 00:00:00.000000000 Z
12
+ date: 2025-03-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport