forest_admin_rails 1.14.4 → 1.15.0
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/lib/forest_admin/types.rb +191 -0
- data/lib/forest_admin_rails/version.rb +1 -1
- data/lib/forest_admin_rails.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c5da59d5de057e0448e039fad113b556685db5b25ab4c611a3161f10e198077c
|
|
4
|
+
data.tar.gz: 29650aa77eebb0ba5e9fab0088607d86b5cbae9767b40804d249b025cdc9ab0e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f3e26d15e79243635611ca7323ecdf4aa74a8b8c9b9bb7c866d3e1719ba6fb3f19f888a801f91a8104dbad53ad6634e5d26c3e0cc4ee244c5c6aac96543faa07
|
|
7
|
+
data.tar.gz: 6d67f9f0b01fc8929cb5d62ed604e6d776cd51f0d24f6636e461d0264ee39fda4e8d30756bd654260fa931977868c28ecb890269357e98829ce82f03f1909f4d
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Ensure dependencies are fully loaded before referencing their constants
|
|
4
|
+
require 'forest_admin_datasource_toolkit'
|
|
5
|
+
require 'forest_admin_datasource_customizer'
|
|
6
|
+
require 'forest_admin_agent'
|
|
7
|
+
|
|
8
|
+
# ForestAdmin::Types provides a convenient way to access commonly-used classes
|
|
9
|
+
# from ForestAdmin packages without requiring multiple includes.
|
|
10
|
+
#
|
|
11
|
+
# Usage:
|
|
12
|
+
# include ForestAdmin::Types
|
|
13
|
+
#
|
|
14
|
+
# # Now you can use short class names:
|
|
15
|
+
# ConditionTreeLeaf.new('status', Operators::EQUAL, 'active')
|
|
16
|
+
# Filter.new(condition_tree: tree)
|
|
17
|
+
# Aggregation.new(operation: 'Count', field: 'id')
|
|
18
|
+
#
|
|
19
|
+
# # In action blocks, result_builder is an ActionResultBuilder:
|
|
20
|
+
# result_builder.success(message: 'Done!')
|
|
21
|
+
# result_builder.file(content: data, name: 'export.csv')
|
|
22
|
+
#
|
|
23
|
+
# # In chart blocks, result_builder is a ChartResultBuilder:
|
|
24
|
+
# result_builder.value(42)
|
|
25
|
+
# result_builder.distribution({ 'Active' => 10, 'Inactive' => 5 })
|
|
26
|
+
#
|
|
27
|
+
# # Factory classes for building complex objects:
|
|
28
|
+
# tree = ConditionTreeFactory.from_plain_object({ field: 'status', operator: 'equal', value: 'active' })
|
|
29
|
+
# filter = ConditionTreeFactory.match_ids(collection, [1, 2, 3])
|
|
30
|
+
# combined = ConditionTreeFactory.intersect([tree1, tree2])
|
|
31
|
+
# projection = ProjectionFactory.all(collection)
|
|
32
|
+
# sort = SortFactory.by_primary_keys(collection)
|
|
33
|
+
#
|
|
34
|
+
# # Exception handling in hooks and actions:
|
|
35
|
+
# raise ValidationError.new('Invalid input') if invalid?
|
|
36
|
+
# raise ForbiddenError.new('Access denied') unless authorized?
|
|
37
|
+
# raise UnprocessableError.new('Cannot process request')
|
|
38
|
+
#
|
|
39
|
+
# # Context classes for different handlers:
|
|
40
|
+
# # - ChartContext: context.get_record(['field1', 'field2'])
|
|
41
|
+
# # - HookContext: context.raise_validation_error('Error message')
|
|
42
|
+
#
|
|
43
|
+
module ForestAdmin
|
|
44
|
+
module Types
|
|
45
|
+
# ============================================
|
|
46
|
+
# Query Components
|
|
47
|
+
# ============================================
|
|
48
|
+
|
|
49
|
+
# Filter - used to filter records in queries
|
|
50
|
+
Filter = ForestAdminDatasourceToolkit::Components::Query::Filter
|
|
51
|
+
|
|
52
|
+
# Aggregation - used for aggregate operations (Count, Sum, Avg, etc.)
|
|
53
|
+
Aggregation = ForestAdminDatasourceToolkit::Components::Query::Aggregation
|
|
54
|
+
|
|
55
|
+
# Projection - specifies which fields to retrieve
|
|
56
|
+
Projection = ForestAdminDatasourceToolkit::Components::Query::Projection
|
|
57
|
+
|
|
58
|
+
# Page - pagination parameters
|
|
59
|
+
Page = ForestAdminDatasourceToolkit::Components::Query::Page
|
|
60
|
+
|
|
61
|
+
# Sort - sorting parameters
|
|
62
|
+
Sort = ForestAdminDatasourceToolkit::Components::Query::Sort
|
|
63
|
+
|
|
64
|
+
# ============================================
|
|
65
|
+
# Condition Tree
|
|
66
|
+
# ============================================
|
|
67
|
+
|
|
68
|
+
# ConditionTreeLeaf - a single condition (field, operator, value)
|
|
69
|
+
ConditionTreeLeaf = ForestAdminDatasourceToolkit::Components::Query::ConditionTree::Nodes::ConditionTreeLeaf
|
|
70
|
+
|
|
71
|
+
# ConditionTreeBranch - combines multiple conditions with And/Or
|
|
72
|
+
ConditionTreeBranch = ForestAdminDatasourceToolkit::Components::Query::ConditionTree::Nodes::ConditionTreeBranch
|
|
73
|
+
|
|
74
|
+
# Operators - all available operators (EQUAL, GREATER_THAN, CONTAINS, etc.)
|
|
75
|
+
Operators = ForestAdminDatasourceToolkit::Components::Query::ConditionTree::Operators
|
|
76
|
+
|
|
77
|
+
# ============================================
|
|
78
|
+
# Action Types
|
|
79
|
+
# ============================================
|
|
80
|
+
|
|
81
|
+
# FieldType - field types for action forms (STRING, NUMBER, BOOLEAN, etc.)
|
|
82
|
+
FieldType = ForestAdminDatasourceCustomizer::Decorators::Action::Types::FieldType
|
|
83
|
+
|
|
84
|
+
# ActionScope - action scopes (SINGLE, BULK, GLOBAL)
|
|
85
|
+
ActionScope = ForestAdminDatasourceCustomizer::Decorators::Action::Types::ActionScope
|
|
86
|
+
|
|
87
|
+
# BaseAction - base class for defining actions
|
|
88
|
+
BaseAction = ForestAdminDatasourceCustomizer::Decorators::Action::BaseAction
|
|
89
|
+
|
|
90
|
+
# ============================================
|
|
91
|
+
# Action Contexts
|
|
92
|
+
# ============================================
|
|
93
|
+
|
|
94
|
+
# ActionContext - execution context for Bulk/Global actions
|
|
95
|
+
ActionContext = ForestAdminDatasourceCustomizer::Decorators::Action::Context::ActionContext
|
|
96
|
+
|
|
97
|
+
# ActionContextSingle - execution context for Single actions
|
|
98
|
+
ActionContextSingle = ForestAdminDatasourceCustomizer::Decorators::Action::Context::ActionContextSingle
|
|
99
|
+
|
|
100
|
+
# ActionResultBuilder - builder for action results (success, error, file, webhook)
|
|
101
|
+
ActionResultBuilder = ForestAdminDatasourceCustomizer::Decorators::Action::ResultBuilder
|
|
102
|
+
|
|
103
|
+
# ============================================
|
|
104
|
+
# Charts
|
|
105
|
+
# ============================================
|
|
106
|
+
|
|
107
|
+
# ChartResultBuilder - builder for chart results (value, distribution, time_based, etc.)
|
|
108
|
+
ChartResultBuilder = ForestAdminDatasourceCustomizer::Decorators::Chart::ResultBuilder
|
|
109
|
+
|
|
110
|
+
# ============================================
|
|
111
|
+
# Computed Fields
|
|
112
|
+
# ============================================
|
|
113
|
+
|
|
114
|
+
# ComputedDefinition - defines computed/virtual fields
|
|
115
|
+
ComputedDefinition = ForestAdminDatasourceCustomizer::Decorators::Computed::ComputedDefinition
|
|
116
|
+
|
|
117
|
+
# ============================================
|
|
118
|
+
# User/Caller Information
|
|
119
|
+
# ============================================
|
|
120
|
+
|
|
121
|
+
# Caller - represents the user making the request (email, timezone, team, etc.)
|
|
122
|
+
Caller = ForestAdminDatasourceToolkit::Components::Caller
|
|
123
|
+
|
|
124
|
+
# ============================================
|
|
125
|
+
# Plugins
|
|
126
|
+
# ============================================
|
|
127
|
+
|
|
128
|
+
# Plugin - base class for creating custom plugins
|
|
129
|
+
Plugin = ForestAdminDatasourceCustomizer::Plugins::Plugin
|
|
130
|
+
|
|
131
|
+
# ============================================
|
|
132
|
+
# Additional Context Classes
|
|
133
|
+
# ============================================
|
|
134
|
+
|
|
135
|
+
# ChartContext - execution context for chart handlers
|
|
136
|
+
# Methods: get_record(fields), record_id, composite_record_id
|
|
137
|
+
ChartContext = ForestAdminDatasourceCustomizer::Decorators::Chart::ChartContext
|
|
138
|
+
|
|
139
|
+
# HookContext - execution context for hook handlers
|
|
140
|
+
# Methods: raise_validation_error, raise_forbidden_error, raise_error
|
|
141
|
+
HookContext = ForestAdminDatasourceCustomizer::Decorators::Hook::Context::HookContext
|
|
142
|
+
|
|
143
|
+
# ============================================
|
|
144
|
+
# Exception Classes
|
|
145
|
+
# ============================================
|
|
146
|
+
|
|
147
|
+
# BusinessError - base class for all business errors
|
|
148
|
+
BusinessError = ForestAdminAgent::Http::Exceptions::BusinessError
|
|
149
|
+
|
|
150
|
+
# Specific error types for better error handling
|
|
151
|
+
ValidationError = ForestAdminAgent::Http::Exceptions::ValidationError
|
|
152
|
+
ForbiddenError = ForestAdminAgent::Http::Exceptions::ForbiddenError
|
|
153
|
+
UnauthorizedError = ForestAdminAgent::Http::Exceptions::UnauthorizedError
|
|
154
|
+
NotFoundError = ForestAdminAgent::Http::Exceptions::NotFoundError
|
|
155
|
+
UnprocessableError = ForestAdminAgent::Http::Exceptions::UnprocessableError
|
|
156
|
+
BadRequestError = ForestAdminAgent::Http::Exceptions::BadRequestError
|
|
157
|
+
|
|
158
|
+
# ============================================
|
|
159
|
+
# Factory Classes
|
|
160
|
+
# ============================================
|
|
161
|
+
|
|
162
|
+
# ConditionTreeFactory - factory methods for creating condition trees
|
|
163
|
+
# Methods: from_plain_object, match_ids, match_records, intersect, union, match_none
|
|
164
|
+
ConditionTreeFactory = ForestAdminDatasourceToolkit::Components::Query::ConditionTree::ConditionTreeFactory
|
|
165
|
+
|
|
166
|
+
# FilterFactory - factory methods for creating filters
|
|
167
|
+
# Methods: from_plain_object, make_foreign_filter, make_through_filter
|
|
168
|
+
FilterFactory = ForestAdminDatasourceToolkit::Components::Query::FilterFactory
|
|
169
|
+
|
|
170
|
+
# ProjectionFactory - factory methods for creating projections
|
|
171
|
+
# Methods: all(collection)
|
|
172
|
+
ProjectionFactory = ForestAdminDatasourceToolkit::Components::Query::ProjectionFactory
|
|
173
|
+
|
|
174
|
+
# SortFactory - factory methods for creating sort clauses
|
|
175
|
+
# Methods: by_primary_keys(collection)
|
|
176
|
+
SortFactory = ForestAdminDatasourceToolkit::Components::Query::SortUtils::SortFactory
|
|
177
|
+
|
|
178
|
+
# ============================================
|
|
179
|
+
# Module inclusion support
|
|
180
|
+
# ============================================
|
|
181
|
+
|
|
182
|
+
def self.included(base)
|
|
183
|
+
# When included, define constants on the including class/module
|
|
184
|
+
# This allows using `include ForestAdmin::Types` and then referencing
|
|
185
|
+
# the types directly without the ForestAdmin::Types prefix
|
|
186
|
+
constants.each do |const_name|
|
|
187
|
+
base.const_set(const_name, const_get(const_name)) unless base.const_defined?(const_name)
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
end
|
|
191
|
+
end
|
data/lib/forest_admin_rails.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: forest_admin_rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.15.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Matthieu
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2025-11-
|
|
12
|
+
date: 2025-11-26 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: base64
|
|
@@ -140,6 +140,7 @@ files:
|
|
|
140
140
|
- config/initializers/forest_admin_error_subscriber.rb
|
|
141
141
|
- config/initializers/forest_admin_route_cache.rb
|
|
142
142
|
- config/routes.rb
|
|
143
|
+
- lib/forest_admin/types.rb
|
|
143
144
|
- lib/forest_admin_rails.rb
|
|
144
145
|
- lib/forest_admin_rails/engine.rb
|
|
145
146
|
- lib/forest_admin_rails/version.rb
|