forest_admin_datasource_toolkit 1.0.0.pre.beta.83 → 1.0.0.pre.beta.85

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: f3e6da6151544ce719d17e6a14b349c2fe48d623d4f6d8a301a82159e93132a1
4
- data.tar.gz: 6684f1ba755d15a7ac8dc5a9d46a1fb3a0c46ac77b61dea70d795dd16831dc52
3
+ metadata.gz: 3550cad39d6cdb44ffa071b6f872831a7f84ccdfc98303385c4d0f5c6071f865
4
+ data.tar.gz: b3cce92750ed549ad2ea34e08cf7ae77ba62518b6b867b492c0fe78233769b27
5
5
  SHA512:
6
- metadata.gz: 9ed9f1764a246355eec14f0ca39bfb37b068b8d24734b98c932cd529ee819e5e858773a347a1a93837f738b225c0a0d8fd8b7ef86742ccc7ffd678770d5385af
7
- data.tar.gz: 0caca749790952066e5e518660065600b4e143823b235a9ceb8699e30b9345dca1f1183ff07deedf9c0364736a39f3c8242e7a44b273161b3e2a3913ddaf87bd
6
+ metadata.gz: 130de0d0e11b0711fe4baaf61d33da6ed9f2411c64c10dad468d66635e02b65d8f7edc56fa1e9b4d8b3dd6117b570c13af42d5356fa15a5c16e286b7238e8d25
7
+ data.tar.gz: c2e8760294b55455e567c3bbd85b7350825034ec671f3ff200428042a56219f12273de101cd0c2b46514c45eb30352fa29249c7000673a2706148d5ab77af7eb
@@ -43,7 +43,7 @@ module ForestAdminDatasourceToolkit
43
43
  end
44
44
 
45
45
  def for_each_leaf(&handler)
46
- @conditions.each { |condition| condition.for_each_leaf(&handler) }
46
+ @conditions.map! { |condition| condition.for_each_leaf(&handler) }
47
47
  self
48
48
  end
49
49
 
@@ -40,9 +40,9 @@ module ForestAdminDatasourceToolkit
40
40
 
41
41
  case @operator
42
42
  when Operators::BLANK
43
- override(operator: Operators::BLANK)
44
- when Operators::PRESENT
45
43
  override(operator: Operators::PRESENT)
44
+ when Operators::PRESENT
45
+ override(operator: Operators::BLANK)
46
46
  else
47
47
  raise ForestException, "Operator: #{@operator} cannot be inverted."
48
48
  end
@@ -133,7 +133,7 @@ module ForestAdminDatasourceToolkit
133
133
  ConditionTreeLeaf.new(
134
134
  args[:field] || @field,
135
135
  args[:operator] || @operator,
136
- args[:value] || @value
136
+ args[:value].nil? ? @value : args[:value]
137
137
  )
138
138
  end
139
139
 
@@ -14,7 +14,7 @@ module ForestAdminDatasourceToolkit
14
14
  def self.compare(operator)
15
15
  {
16
16
  depends_on: [operator],
17
- for_types: ['Date', 'Dateonly'],
17
+ for_types: %w[Date Dateonly],
18
18
  replacer: proc { |leaf, tz|
19
19
  leaf.override(operator: operator, value: format(yield(Time.now.in_time_zone(tz), leaf.value)))
20
20
  }
@@ -24,7 +24,7 @@ module ForestAdminDatasourceToolkit
24
24
  def self.interval(start_fn, end_fn)
25
25
  {
26
26
  depends_on: [Operators::LESS_THAN, Operators::GREATER_THAN],
27
- for_types: ['Date', 'Dateonly'],
27
+ for_types: %w[Date Dateonly],
28
28
  replacer: proc do |leaf, tz|
29
29
  value_greater_than = if leaf.value.nil?
30
30
  format(start_fn.call(Time.now.in_time_zone(tz)))
@@ -4,7 +4,14 @@ module ForestAdminDatasourceToolkit
4
4
  class Filter
5
5
  attr_reader :condition_tree, :segment, :sort, :search, :search_extended, :page
6
6
 
7
- def initialize(condition_tree: nil, search: nil, search_extended: nil, segment: nil, sort: nil, page: nil)
7
+ def initialize(
8
+ condition_tree: nil,
9
+ search: nil,
10
+ search_extended: nil,
11
+ segment: nil,
12
+ sort: nil,
13
+ page: nil
14
+ )
8
15
  @condition_tree = condition_tree
9
16
  @search = search
10
17
  @search_extended = search_extended
@@ -33,9 +33,9 @@ module ForestAdminDatasourceToolkit
33
33
  when Operators::TODAY
34
34
  leaf.override(operator: Operators::YESTERDAY)
35
35
  when Operators::PREVIOUS_X_DAYS
36
- get_previous_x_days_period(leaf, timezone, 'Previous_X_Days')
36
+ get_previous_x_days_period(leaf, timezone, Operators::PREVIOUS_X_DAYS)
37
37
  when Operators::PREVIOUS_X_DAYS_TO_DATE
38
- get_previous_x_days_period(leaf, timezone, 'Previous_X_Days_To_Date')
38
+ get_previous_x_days_period(leaf, timezone, Operators::PREVIOUS_X_DAYS_TO_DATE)
39
39
  else
40
40
  leaf
41
41
  end
@@ -1,11 +1,12 @@
1
1
  module ForestAdminDatasourceToolkit
2
2
  class Datasource < Components::Contracts::DatasourceContract
3
- attr_reader :collections, :schema
3
+ attr_reader :collections, :schema, :live_query_connections
4
4
 
5
5
  def initialize
6
6
  super
7
7
  @schema = { charts: [] }
8
8
  @collections = {}
9
+ @live_query_connections = {}
9
10
  end
10
11
 
11
12
  def get_collection(name)
@@ -25,5 +26,13 @@ module ForestAdminDatasourceToolkit
25
26
  def render_chart(_caller, name)
26
27
  raise Exceptions::ForestException, "No chart named #{name} exists on this datasource."
27
28
  end
29
+
30
+ def execute_native_query(_connection_name, _query, _binds)
31
+ raise Exceptions::ForestException, 'this datasource do not support native query.'
32
+ end
33
+
34
+ def build_binding_symbol(_connection_name, _binds)
35
+ raise Exceptions::ForestException, 'this datasource do not support native query.'
36
+ end
28
37
  end
29
38
  end
@@ -1,3 +1,3 @@
1
1
  module ForestAdminDatasourceToolkit
2
- VERSION = "1.0.0-beta.83"
2
+ VERSION = "1.0.0-beta.85"
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.83
4
+ version: 1.0.0.pre.beta.85
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: 2024-12-13 00:00:00.000000000 Z
12
+ date: 2024-12-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport