forest_admin_datasource_toolkit 1.0.0.pre.beta.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/README.md +31 -0
  4. data/Rakefile +12 -0
  5. data/forest_admin_datasource_toolkit.gemspec +37 -0
  6. data/lib/forest_admin_datasource_toolkit/collection.rb +50 -0
  7. data/lib/forest_admin_datasource_toolkit/components/caller.rb +31 -0
  8. data/lib/forest_admin_datasource_toolkit/components/contracts/collection_contract.rb +51 -0
  9. data/lib/forest_admin_datasource_toolkit/components/contracts/datasource_contract.rb +27 -0
  10. data/lib/forest_admin_datasource_toolkit/components/query/aggregation.rb +23 -0
  11. data/lib/forest_admin_datasource_toolkit/components/query/condition_tree/condition_tree_equivalent.rb +66 -0
  12. data/lib/forest_admin_datasource_toolkit/components/query/condition_tree/condition_tree_factory.rb +123 -0
  13. data/lib/forest_admin_datasource_toolkit/components/query/condition_tree/nodes/condition_tree.rb +70 -0
  14. data/lib/forest_admin_datasource_toolkit/components/query/condition_tree/nodes/condition_tree_branch.rb +68 -0
  15. data/lib/forest_admin_datasource_toolkit/components/query/condition_tree/nodes/condition_tree_leaf.rb +144 -0
  16. data/lib/forest_admin_datasource_toolkit/components/query/condition_tree/operators.rb +100 -0
  17. data/lib/forest_admin_datasource_toolkit/components/query/condition_tree/transforms/comparisons.rb +123 -0
  18. data/lib/forest_admin_datasource_toolkit/components/query/condition_tree/transforms/pattern.rb +48 -0
  19. data/lib/forest_admin_datasource_toolkit/components/query/condition_tree/transforms/times.rb +112 -0
  20. data/lib/forest_admin_datasource_toolkit/components/query/filter.rb +45 -0
  21. data/lib/forest_admin_datasource_toolkit/components/query/filter_factory.rb +158 -0
  22. data/lib/forest_admin_datasource_toolkit/components/query/page.rb +14 -0
  23. data/lib/forest_admin_datasource_toolkit/components/query/projection.rb +42 -0
  24. data/lib/forest_admin_datasource_toolkit/components/query/projection_factory.rb +30 -0
  25. data/lib/forest_admin_datasource_toolkit/datasource.rb +29 -0
  26. data/lib/forest_admin_datasource_toolkit/exceptions/forest_exception.rb +10 -0
  27. data/lib/forest_admin_datasource_toolkit/schema/column_schema.rb +34 -0
  28. data/lib/forest_admin_datasource_toolkit/schema/primitive_type.rb +31 -0
  29. data/lib/forest_admin_datasource_toolkit/schema/relation_schema.rb +13 -0
  30. data/lib/forest_admin_datasource_toolkit/schema/relations/many_to_many_schema.rb +26 -0
  31. data/lib/forest_admin_datasource_toolkit/schema/relations/many_to_one_schema.rb +16 -0
  32. data/lib/forest_admin_datasource_toolkit/schema/relations/one_to_many_schema.rb +16 -0
  33. data/lib/forest_admin_datasource_toolkit/schema/relations/one_to_one_schema.rb +16 -0
  34. data/lib/forest_admin_datasource_toolkit/utils/collection.rb +162 -0
  35. data/lib/forest_admin_datasource_toolkit/utils/record.rb +20 -0
  36. data/lib/forest_admin_datasource_toolkit/utils/schema.rb +42 -0
  37. data/lib/forest_admin_datasource_toolkit/version.rb +3 -0
  38. data/lib/forest_admin_datasource_toolkit.rb +10 -0
  39. data/sig/forest_admin_datasource_toolkit/collection.rbs +26 -0
  40. data/sig/forest_admin_datasource_toolkit/components/contracts/collection_contract.rbs +29 -0
  41. data/sig/forest_admin_datasource_toolkit/components/contracts/datasource_contract.rbs +17 -0
  42. data/sig/forest_admin_datasource_toolkit/datasource.rbs +12 -0
  43. data/sig/forest_admin_datasource_toolkit/schema/column_schema.rbs +15 -0
  44. data/sig/forest_admin_datasource_toolkit/schema/relation_schema.rbs +8 -0
  45. data/sig/forest_admin_datasource_toolkit/schema/relations/many_relation_schema.rbs +10 -0
  46. data/sig/forest_admin_datasource_toolkit/schema/relations/many_to_many_schema.rbs +11 -0
  47. data/sig/forest_admin_datasource_toolkit/schema/relations/single_relation_schema.rbs +10 -0
  48. data/sig/forest_admin_datasource_toolkit.rbs +4 -0
  49. metadata +126 -0
@@ -0,0 +1,10 @@
1
+ require_relative "forest_admin_datasource_toolkit/version"
2
+ require 'zeitwerk'
3
+
4
+ loader = Zeitwerk::Loader.for_gem
5
+ loader.setup
6
+
7
+ module ForestAdminDatasourceToolkit
8
+ class Error < StandardError; end
9
+ # Your code goes here...
10
+ end
@@ -0,0 +1,26 @@
1
+ module ForestAdminDatasourceToolkit
2
+ class Collection
3
+ attr_reader actions: Hash[string, string]
4
+ attr_reader charts: Hash[string, string]
5
+ attr_writer countable: bool
6
+ attr_reader datasource: Components::Contracts::DatasourceContract
7
+ attr_reader fields: Hash[string, string]
8
+ attr_writer fields: void
9
+ attr_reader name: string
10
+ attr_reader native_driver: untyped | nil
11
+ attr_reader schema: Hash[string, string]
12
+ attr_writer searchable: bool
13
+ attr_reader segments: Hash[string, string]
14
+ attr_writer segments: void
15
+
16
+ # replace untyped by ColumnSchema|RelationSchema
17
+ def add_field: (string, untyped) -> void
18
+
19
+ # replace untyped by ColumnSchema|RelationSchema
20
+ def add_fields:(Hash[string, untyped]) -> void
21
+
22
+ def is_countable?: -> bool
23
+
24
+ def is_searchable?: -> bool
25
+ end
26
+ end
@@ -0,0 +1,29 @@
1
+ module ForestAdminDatasourceToolkit
2
+ module Components
3
+ module Contracts
4
+ class CollectionContract
5
+ def aggregate: -> untyped
6
+
7
+ def create: -> untyped
8
+
9
+ def datasource: -> untyped
10
+
11
+ def delete: -> untyped
12
+
13
+ def execute: -> untyped
14
+
15
+ def form: -> untyped
16
+
17
+ def list: -> untyped
18
+
19
+ def name: -> untyped
20
+
21
+ def render_chart: -> untyped
22
+
23
+ def schema: -> untyped
24
+
25
+ def update: -> untyped
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,17 @@
1
+ module ForestAdminDatasourceToolkit
2
+ module Components
3
+ module Contracts
4
+ module DatasourceContract
5
+ def add_collection:(CollectionContract collection) -> untyped
6
+
7
+ def charts: -> untyped
8
+
9
+ def collection:(string name) -> untyped
10
+
11
+ def collections: -> untyped
12
+
13
+ def render_chart:(untyped caller, string name) -> untyped
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,12 @@
1
+ module ForestAdminDatasourceToolkit
2
+ class Datasource
3
+ @charts: Hash[string, string]
4
+ @collections: Hash[string, string]
5
+
6
+ def add_collection:(Components::Contracts::CollectionContract collection) -> void
7
+
8
+ def collection:(string name) -> Components::Contracts::CollectionContract
9
+
10
+ def render_chart:(untyped caller, string name) -> untyped
11
+ end
12
+ end
@@ -0,0 +1,15 @@
1
+ module ForestAdminDatasourceToolkit
2
+ module Schema
3
+ class ColumnSchema
4
+ attr_accessor column_type: Array[String] | String
5
+ attr_reader default_value: untyped
6
+ attr_reader enum_values: Array[String]
7
+ attr_accessor filter_operators: Array[String]
8
+ attr_reader is_primary_key: bool
9
+ attr_accessor is_read_only: bool
10
+ attr_accessor is_sortable: bool
11
+ attr_reader type: String
12
+ attr_accessor validations: Array[String]
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,8 @@
1
+ module ForestAdminDatasourceToolkit
2
+ module Schema
3
+ class RelationSchema
4
+ attr_accessor foreign_collection: String
5
+ attr_reader type: String
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,10 @@
1
+ module ForestAdminDatasourceToolkit
2
+ module Schema
3
+ module Relations
4
+ class ManyRelationSchema
5
+ attr_accessor foreign_key: String
6
+ attr_reader foreign_key_target: String
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,11 @@
1
+ module ForestAdminDatasourceToolkit
2
+ module Schema
3
+ module Relations
4
+ class ManyToManySchema
5
+ attr_accessor origin_key: String
6
+ attr_reader origin_key_target: String
7
+ attr_accessor through_collection: String
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,10 @@
1
+ module ForestAdminDatasourceToolkit
2
+ module Schema
3
+ module Relations
4
+ class SingleRelationSchema
5
+ attr_accessor origin_key: String
6
+ attr_reader origin_key_target: String
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,4 @@
1
+ module ForestAdminDatasourceToolkit
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,126 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: forest_admin_datasource_toolkit
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0.pre.beta.21
5
+ platform: ruby
6
+ authors:
7
+ - Matthieu
8
+ - Nicolas
9
+ autorequire:
10
+ bindir: exe
11
+ cert_chain: []
12
+ date: 2023-11-20 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: activesupport
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '6.1'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '6.1'
28
+ - !ruby/object:Gem::Dependency
29
+ name: zeitwerk
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '2.3'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '2.3'
42
+ description: |-
43
+ Forest is a modern admin interface that works on all major web frameworks. This gem makes Forest
44
+ admin work on any Ruby application.
45
+ email:
46
+ - matthv@gmail.com
47
+ - nicolasalexandre9@gmail.com
48
+ executables: []
49
+ extensions: []
50
+ extra_rdoc_files: []
51
+ files:
52
+ - ".rspec"
53
+ - README.md
54
+ - Rakefile
55
+ - forest_admin_datasource_toolkit.gemspec
56
+ - lib/forest_admin_datasource_toolkit.rb
57
+ - lib/forest_admin_datasource_toolkit/collection.rb
58
+ - lib/forest_admin_datasource_toolkit/components/caller.rb
59
+ - lib/forest_admin_datasource_toolkit/components/contracts/collection_contract.rb
60
+ - lib/forest_admin_datasource_toolkit/components/contracts/datasource_contract.rb
61
+ - lib/forest_admin_datasource_toolkit/components/query/aggregation.rb
62
+ - lib/forest_admin_datasource_toolkit/components/query/condition_tree/condition_tree_equivalent.rb
63
+ - lib/forest_admin_datasource_toolkit/components/query/condition_tree/condition_tree_factory.rb
64
+ - lib/forest_admin_datasource_toolkit/components/query/condition_tree/nodes/condition_tree.rb
65
+ - lib/forest_admin_datasource_toolkit/components/query/condition_tree/nodes/condition_tree_branch.rb
66
+ - lib/forest_admin_datasource_toolkit/components/query/condition_tree/nodes/condition_tree_leaf.rb
67
+ - lib/forest_admin_datasource_toolkit/components/query/condition_tree/operators.rb
68
+ - lib/forest_admin_datasource_toolkit/components/query/condition_tree/transforms/comparisons.rb
69
+ - lib/forest_admin_datasource_toolkit/components/query/condition_tree/transforms/pattern.rb
70
+ - lib/forest_admin_datasource_toolkit/components/query/condition_tree/transforms/times.rb
71
+ - lib/forest_admin_datasource_toolkit/components/query/filter.rb
72
+ - lib/forest_admin_datasource_toolkit/components/query/filter_factory.rb
73
+ - lib/forest_admin_datasource_toolkit/components/query/page.rb
74
+ - lib/forest_admin_datasource_toolkit/components/query/projection.rb
75
+ - lib/forest_admin_datasource_toolkit/components/query/projection_factory.rb
76
+ - lib/forest_admin_datasource_toolkit/datasource.rb
77
+ - lib/forest_admin_datasource_toolkit/exceptions/forest_exception.rb
78
+ - lib/forest_admin_datasource_toolkit/schema/column_schema.rb
79
+ - lib/forest_admin_datasource_toolkit/schema/primitive_type.rb
80
+ - lib/forest_admin_datasource_toolkit/schema/relation_schema.rb
81
+ - lib/forest_admin_datasource_toolkit/schema/relations/many_to_many_schema.rb
82
+ - lib/forest_admin_datasource_toolkit/schema/relations/many_to_one_schema.rb
83
+ - lib/forest_admin_datasource_toolkit/schema/relations/one_to_many_schema.rb
84
+ - lib/forest_admin_datasource_toolkit/schema/relations/one_to_one_schema.rb
85
+ - lib/forest_admin_datasource_toolkit/utils/collection.rb
86
+ - lib/forest_admin_datasource_toolkit/utils/record.rb
87
+ - lib/forest_admin_datasource_toolkit/utils/schema.rb
88
+ - lib/forest_admin_datasource_toolkit/version.rb
89
+ - sig/forest_admin_datasource_toolkit.rbs
90
+ - sig/forest_admin_datasource_toolkit/collection.rbs
91
+ - sig/forest_admin_datasource_toolkit/components/contracts/collection_contract.rbs
92
+ - sig/forest_admin_datasource_toolkit/components/contracts/datasource_contract.rbs
93
+ - sig/forest_admin_datasource_toolkit/datasource.rbs
94
+ - sig/forest_admin_datasource_toolkit/schema/column_schema.rbs
95
+ - sig/forest_admin_datasource_toolkit/schema/relation_schema.rbs
96
+ - sig/forest_admin_datasource_toolkit/schema/relations/many_relation_schema.rbs
97
+ - sig/forest_admin_datasource_toolkit/schema/relations/many_to_many_schema.rbs
98
+ - sig/forest_admin_datasource_toolkit/schema/relations/single_relation_schema.rbs
99
+ homepage: https://www.forestadmin.com
100
+ licenses:
101
+ - MIT
102
+ metadata:
103
+ homepage_uri: https://www.forestadmin.com
104
+ source_code_uri: https://github.com/ForestAdmin/agent-ruby
105
+ changelog_uri: https://github.com/ForestAdmin/agent-ruby/CHANGELOG.md
106
+ rubygems_mfa_required: 'false'
107
+ post_install_message:
108
+ rdoc_options: []
109
+ require_paths:
110
+ - lib
111
+ required_ruby_version: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: 3.0.0
116
+ required_rubygems_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ">"
119
+ - !ruby/object:Gem::Version
120
+ version: 1.3.1
121
+ requirements: []
122
+ rubygems_version: 3.3.5
123
+ signing_key:
124
+ specification_version: 4
125
+ summary: Ruby agent for Forest Admin.
126
+ test_files: []