forest_admin_datasource_toolkit 1.0.0.pre.beta.24 → 1.0.0.pre.beta.25

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a6db15a9f9827fdef57eb3a018ec0c3a9851a5ab131f26b38d2792fc12cb897d
4
- data.tar.gz: 83ed4a24c607297af411ec2bbeacf739bb2c9f5c6b611343885a7237abb1deb6
3
+ metadata.gz: 8139afcd60607522083451780f9a7b7d98c9bdac9630a5befd8c9a795b5d1faf
4
+ data.tar.gz: ae361fde5da4f144c85ade92cd843c8f035c9b063f2f9c25330eba9fd55e8928
5
5
  SHA512:
6
- metadata.gz: 2169823cdaa62b57be4fbef2cbd5986c4576d43ea063425ab741a9abd58af0b83b17881cad854f1e2ec6a3fe8de1006e589842fa6cfe052394252748e4d4ad53
7
- data.tar.gz: fbc3374aefaeda605d14e882e9a988142d9a5e43c3d147546bbd1cfa17c6978429f953367e9588c02d47684146c41a32f664887d4d30205cbc228698654f3d0b
6
+ metadata.gz: 485716a1fdd2f1bc67a8d6043503be51479b240d27158877a54edb10f06de3b1ea22a4e64688b046e648e7b9a0decd79703ec08f96f5150f659f1a5bec6f0a12
7
+ data.tar.gz: 3c0d856e370425024bc2b5854a1ce904a66bccf0e15426d6ede04fb1ef8a1c3c5889b9cddd3eb6b8fe2e2ef92c2f68cb8006f9ba7c3180008a7e98f7d4e483b6
@@ -18,7 +18,8 @@ module ForestAdminDatasourceToolkit
18
18
  @name = name
19
19
  @native_driver = native_driver
20
20
  @schema = {
21
- fields: {}
21
+ fields: {},
22
+ countable: false
22
23
  }
23
24
  @actions = {}
24
25
  @segments = {}
@@ -28,11 +29,11 @@ module ForestAdminDatasourceToolkit
28
29
  end
29
30
 
30
31
  def enable_count
31
- @countable = true
32
+ @schema[:countable] = true
32
33
  end
33
34
 
34
35
  def is_countable?
35
- @countable
36
+ @schema[:countable]
36
37
  end
37
38
 
38
39
  def is_searchable?
@@ -13,14 +13,13 @@ module ForestAdminDatasourceToolkit
13
13
  # a reference to parent collections from children.
14
14
  return unless child_collection.is_a?(CollectionDecorator)
15
15
 
16
- original_child_mark_schema_as_dirty = child_collection.mark_schema_as_dirty
17
- child_collection.mark_schema_as_dirty = lambda {
16
+ child_collection.define_singleton_method(:mark_schema_as_dirty) do
18
17
  # Call the original method (the child)
19
18
  original_child_mark_schema_as_dirty.call(child_collection)
20
19
 
21
20
  # Invalidate our schema (the parent)
22
21
  mark_schema_as_dirty
23
- }
22
+ end
24
23
  end
25
24
 
26
25
  def native_driver
@@ -0,0 +1,21 @@
1
+ module ForestAdminDatasourceToolkit
2
+ module Decorators
3
+ module Schema
4
+ class SchemaCollectionDecorator < CollectionDecorator
5
+ def initialize(child_collection, datasource)
6
+ super
7
+ @schema_override = {}
8
+ end
9
+
10
+ def override_schema(value)
11
+ @schema_override.merge!(value)
12
+ mark_schema_as_dirty
13
+ end
14
+
15
+ def refine_schema(sub_schema)
16
+ sub_schema.merge(@schema_override)
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,3 +1,3 @@
1
1
  module ForestAdminDatasourceToolkit
2
- VERSION = "1.0.0-beta.24"
2
+ VERSION = "1.0.0-beta.25"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forest_admin_datasource_toolkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre.beta.24
4
+ version: 1.0.0.pre.beta.25
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: 2023-12-18 00:00:00.000000000 Z
12
+ date: 2023-12-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -84,6 +84,7 @@ files:
84
84
  - lib/forest_admin_datasource_toolkit/datasource.rb
85
85
  - lib/forest_admin_datasource_toolkit/decorators/collection_decorator.rb
86
86
  - lib/forest_admin_datasource_toolkit/decorators/datasource_decorator.rb
87
+ - lib/forest_admin_datasource_toolkit/decorators/schema/schema_collection_decorator.rb
87
88
  - lib/forest_admin_datasource_toolkit/exceptions/forest_exception.rb
88
89
  - lib/forest_admin_datasource_toolkit/schema/column_schema.rb
89
90
  - lib/forest_admin_datasource_toolkit/schema/primitive_type.rb