procore-sift 1.2.1 → 1.2.2
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/sift/validators/valid_int_validator.rb +7 -1
- data/lib/sift/version.rb +1 -1
- data/lib/sift/where_handler.rb +6 -2
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 84093056856631874cae787e9b102baa5dcd9066890118469d96f3bdea4d0149
|
|
4
|
+
data.tar.gz: 7110c14ac314373bd461785e3b3c1d45422960837d46ca6cff1641453ac5f23c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a6f8c9124a2e3f190e7ae35bb5be57dcdf315b714484a32065e855cb4095164e803144ca56f0a3941189035596cbc9f1ec51e20a8cb1d528a57e651e98bf2032
|
|
7
|
+
data.tar.gz: 5f6bee7ef9d36382dd2722dc427ce8943c81d2d32c8493037d46f296b46b365f12a02254a07a3ab86ff9bd6a2cdc200fc2bdf48825267ea1685e3d9586d0e68b
|
|
@@ -21,7 +21,13 @@ class ValidIntValidator < ActiveModel::EachValidator
|
|
|
21
21
|
value = Sift::ValueParser.new(value: value).array_from_json
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
-
value.is_a?(Array) && value.
|
|
24
|
+
value.is_a?(Array) && !value.empty? && value.all? { |v| integer_or_range?(v) || (allow_null_token? && null_element?(v)) }
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# A nil element can only come from an explicit JSON null (e.g. `[null,"5"]`); Rails strips
|
|
28
|
+
# nils from array params and blank values never reach here as array elements.
|
|
29
|
+
def null_element?(value)
|
|
30
|
+
value.nil? || null_token?(value)
|
|
25
31
|
end
|
|
26
32
|
|
|
27
33
|
def integer_or_range?(value)
|
data/lib/sift/version.rb
CHANGED
data/lib/sift/where_handler.rb
CHANGED
|
@@ -20,8 +20,8 @@ module Sift
|
|
|
20
20
|
|
|
21
21
|
def apply_null_aware_conditions(collection, value)
|
|
22
22
|
values = Array(value)
|
|
23
|
-
has_null = values.any? { |v| v
|
|
24
|
-
non_null_values = values.reject { |v| v
|
|
23
|
+
has_null = values.any? { |v| null_value?(v) }
|
|
24
|
+
non_null_values = values.reject { |v| null_value?(v) }
|
|
25
25
|
|
|
26
26
|
if has_null && non_null_values.any?
|
|
27
27
|
collection.where(@param.internal_name => nil)
|
|
@@ -33,6 +33,10 @@ module Sift
|
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
+
def null_value?(value)
|
|
37
|
+
value.nil? || value.to_s.downcase == NULL_TOKEN
|
|
38
|
+
end
|
|
39
|
+
|
|
36
40
|
def apply_jsonb_conditions(collection, value)
|
|
37
41
|
return collection.where("#{@param.internal_name} @> ?", value.to_s) if value.is_a?(Array)
|
|
38
42
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: procore-sift
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.2.
|
|
4
|
+
version: 1.2.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Procore Technologies
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-11-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|