trailblazer-finder 0.92.0 → 0.200.0

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: d5aa468a471c2d9bb6f7f0196e46a14905a557956a18da87723eb74a3f897b10
4
- data.tar.gz: 6d236f533affcf4eb828704e438b2ec9f30270d61626be709aa29d64c5489d5d
3
+ metadata.gz: 90dc16422aad1120e71229592d5754f1cddda1c4b100e5fd204d9489dbc380ff
4
+ data.tar.gz: f2ded79c05e8bf26bd3607e16bec67622209e667e3e446aec3b5c5987b9217ae
5
5
  SHA512:
6
- metadata.gz: 8067cad54995bf7b42b522dc10fc3574dcb7a0a62ad3548e207785c647737192059c0193dd80420891d7e9ab0e96ae13f66c18f0edee94bd29b211139c6457b6
7
- data.tar.gz: 9da38615d6276c0c886ab89396da5e0dcf776eefe8ed8e369d439ce38af3113d477c39dee6482c28d6110a9f4e880aa0c3f4b0a704140ed419ea66a83f06b410
6
+ metadata.gz: 60b6c26e8b09c3c9a5f833fcd46d84335961a0f633bd4d93743fe9bd69b3fedf2a7e861b2ae2e7f3ceea1d54b4cf4e1f3cab32b0159afcd794069db275a3d41a
7
+ data.tar.gz: 5af282dd278f41bf9ca9f89d34985989de777e8caa93da8a00107bd49700691e76babe4c665e70f57e1ef59897dc7cb6bbedbe9387f81da3a192a6817ac9d854
@@ -1,13 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "prepare_adapter"
4
- require_relative "prepare_entity"
5
- require_relative "prepare_properties"
6
- require_relative "prepare_filters"
7
- require_relative "prepare_params"
8
- require_relative "prepare_paging"
9
- require_relative "prepare_sorting"
10
-
11
3
  module Trailblazer
12
4
  class Finder
13
5
  module Activities
@@ -17,7 +17,7 @@ module Trailblazer
17
17
  end
18
18
 
19
19
  step :validate_entity
20
- fail :invalid_entity_error
20
+ left :invalid_entity_error
21
21
  step :set_entity
22
22
  end
23
23
  end
@@ -21,7 +21,7 @@ module Trailblazer
21
21
  end
22
22
 
23
23
  step :validate_filters
24
- fail :invalid_filters_error
24
+ left :invalid_filters_error
25
25
  step :set_filters
26
26
  end
27
27
  end
@@ -19,7 +19,7 @@ module Trailblazer
19
19
  end
20
20
 
21
21
  step :validate_params
22
- fail :invalid_params_error
22
+ left :invalid_params_error
23
23
  step :set_params
24
24
  end
25
25
  end
@@ -32,7 +32,7 @@ module Trailblazer
32
32
 
33
33
  step :check_property_types
34
34
  step :validate_property_types
35
- fail :invalid_properties_error
35
+ left :invalid_properties_error
36
36
  step :set_properties
37
37
  end
38
38
  end
@@ -1,11 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "process_adapters"
4
- require_relative "process_predicates"
5
- require_relative "process_paging"
6
- require_relative "process_sorting"
7
- require_relative "process_filters"
8
-
9
3
  module Trailblazer
10
4
  class Finder
11
5
  module Activities
@@ -37,7 +37,7 @@ module Trailblazer
37
37
  step :set_adapter, fast_track: true
38
38
  step Rescue(Dry::Types::ConstraintError, handler: :invalid_paginator_handler) {
39
39
  step :set_paginator
40
- fail :invalid_paginator_error
40
+ left :invalid_paginator_error
41
41
  }
42
42
  end
43
43
  end
@@ -7,7 +7,7 @@ module Trailblazer
7
7
  def self.included(base)
8
8
  base.include Helpers::Basic
9
9
  base.include Helpers::Sorting
10
- base.extend Finder::Dsl
10
+ base.extend Dsl
11
11
  end
12
12
 
13
13
  attr_reader :signal, :errors
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Trailblazer
4
4
  class Finder
5
- VERSION = "0.92.0"
5
+ VERSION = "0.200.0"
6
6
  end
7
7
  end
@@ -1,45 +1,28 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "forwardable"
4
- require "trailblazer"
5
- require "dry-types"
6
- require "ostruct"
3
+ require 'forwardable'
4
+ require 'dry-types'
5
+ require 'ostruct'
6
+ require 'zeitwerk'
7
+ require 'trailblazer/operation'
8
+ require 'trailblazer/macro'
7
9
 
8
- require_relative "finder/utils/array"
9
- require_relative "finder/utils/hash"
10
- require_relative "finder/utils/string"
11
- require_relative "finder/utils/splitter"
12
- require_relative "finder/utils/extra"
13
- require_relative "finder/adapters/active_record/predicates"
14
- require_relative "finder/adapters/active_record/paging"
15
- require_relative "finder/adapters/active_record/sorting"
16
- require_relative "finder/adapters/kaminari/paging"
17
- require_relative "finder/adapters/will_paginate/paging"
18
- require_relative "finder/adapters/sequel/predicates"
19
- require_relative "finder/adapters/sequel/paging"
20
- require_relative "finder/adapters/sequel/sorting"
21
- require_relative "finder/adapters/basic/predicates"
22
- require_relative "finder/adapters/basic/paging"
23
- require_relative "finder/adapters/basic/sorting"
24
- require_relative "finder/activities/prepare"
25
- require_relative "finder/activities/process"
26
- require_relative "finder/activities/find"
27
- require_relative "finder/helpers/basic"
28
- require_relative "finder/helpers/sorting"
29
- require_relative "finder/dsl"
30
- require_relative "finder/find"
31
- require_relative "finder/base"
32
- require_relative "operation/finder"
10
+ loader = Zeitwerk::Loader.for_gem_extension(Trailblazer)
11
+ adapters = "#{__dir__}/finder/adapters"
12
+ loader.do_not_eager_load(adapters)
13
+ loader.setup
33
14
 
34
15
  module Trailblazer
35
16
  class Finder
36
17
  module Types
37
18
  include Dry.Types(default: :nominal)
38
19
  end
39
- EXT_ORM_ADAPTERS = Types::Strict::String.enum("ActiveRecord", "Sequel")
40
- ORM_ADAPTERS = EXT_ORM_ADAPTERS | Types::Strict::String.enum("Basic")
41
- PAGING_ADAPTERS = Types::Strict::String.enum("Kaminari", "WillPaginate")
20
+ EXT_ORM_ADAPTERS = Types::Strict::String.enum('ActiveRecord', 'Sequel')
21
+ ORM_ADAPTERS = EXT_ORM_ADAPTERS | Types::Strict::String.enum('Basic')
22
+ PAGING_ADAPTERS = Types::Strict::String.enum('Kaminari', 'WillPaginate')
42
23
 
43
24
  include Base
44
25
  end
45
26
  end
27
+
28
+ loader.eager_load
@@ -1,7 +1,7 @@
1
1
  module Trailblazer
2
2
  class Operation
3
3
  def self.Finder(finder_class, action = nil, entity = nil)
4
- task = Trailblazer::Activity::Circuit::TaskAdapter.for_step(Finder.new, binary: true)
4
+ task = Activity::Circuit::TaskAdapter.for_step(Finder.new, binary: true)
5
5
  injections = [
6
6
  :params,
7
7
  {:"finder.class" => ->(*) { finder_class }},
@@ -17,7 +17,7 @@ module Trailblazer
17
17
  builder = Finder::Builder.new
18
18
  ctx[:finder] = finder = builder.call(options, options[:params])
19
19
  ctx[:model] = finder # Don't like it, but somehow it's needed if contracts are loaded
20
- ctx[:"result.finder"] = Trailblazer::Operation::Result.new(!finder.nil?, {})
20
+ ctx[:"result.finder"] = Result.new(!finder.nil?, {})
21
21
 
22
22
  ctx[:"result.finder"].success?
23
23
  end
@@ -0,0 +1 @@
1
+ require_relative 'trailblazer/finder'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trailblazer-finder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.92.0
4
+ version: 0.200.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Sutterer
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2024-01-12 00:00:00.000000000 Z
13
+ date: 2024-09-30 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: dry-types
@@ -26,6 +26,20 @@ dependencies:
26
26
  - - ">="
27
27
  - !ruby/object:Gem::Version
28
28
  version: 1.0.0
29
+ - !ruby/object:Gem::Dependency
30
+ name: trailblazer-macro
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: 2.1.15
36
+ type: :runtime
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 2.1.15
29
43
  - !ruby/object:Gem::Dependency
30
44
  name: trailblazer-activity
31
45
  requirement: !ruby/object:Gem::Requirement
@@ -40,6 +54,34 @@ dependencies:
40
54
  - - ">="
41
55
  - !ruby/object:Gem::Version
42
56
  version: 0.13.0
57
+ - !ruby/object:Gem::Dependency
58
+ name: trailblazer-activity-dsl-linear
59
+ requirement: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: 1.2.5
64
+ type: :runtime
65
+ prerelease: false
66
+ version_requirements: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: 1.2.5
71
+ - !ruby/object:Gem::Dependency
72
+ name: zeitwerk
73
+ requirement: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: 2.6.0
78
+ type: :runtime
79
+ prerelease: false
80
+ version_requirements: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: 2.6.0
43
85
  - !ruby/object:Gem::Dependency
44
86
  name: activerecord
45
87
  requirement: !ruby/object:Gem::Requirement
@@ -217,6 +259,7 @@ executables: []
217
259
  extensions: []
218
260
  extra_rdoc_files: []
219
261
  files:
262
+ - lib/trailblazer-finder.rb
220
263
  - lib/trailblazer/finder.rb
221
264
  - lib/trailblazer/finder/activities/find.rb
222
265
  - lib/trailblazer/finder/activities/prepare.rb
@@ -276,7 +319,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
276
319
  - !ruby/object:Gem::Version
277
320
  version: '0'
278
321
  requirements: []
279
- rubygems_version: 3.4.22
322
+ rubygems_version: 3.5.11
280
323
  signing_key:
281
324
  specification_version: 4
282
325
  summary: Trailblazer based finder objects. It is designed to be used on its own as