elasticgraph-support 1.0.2 → 1.1.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/LICENSE.txt +1 -1
- data/README.md +3 -0
- data/lib/elastic_graph/constants.rb +39 -1
- data/lib/elastic_graph/errors.rb +1 -1
- data/lib/elastic_graph/support/config.rb +1 -1
- data/lib/elastic_graph/support/faraday_middleware/msearch_using_get_instead_of_post.rb +7 -1
- data/lib/elastic_graph/support/faraday_middleware/support_timeouts.rb +9 -1
- data/lib/elastic_graph/support/from_yaml_file.rb +2 -2
- data/lib/elastic_graph/support/graphql_formatter.rb +1 -1
- data/lib/elastic_graph/support/hash_util.rb +1 -1
- data/lib/elastic_graph/support/json_schema/meta_schema_validator.rb +1 -1
- data/lib/elastic_graph/support/json_schema/validator.rb +1 -1
- data/lib/elastic_graph/support/json_schema/validator_factory.rb +1 -1
- data/lib/elastic_graph/support/logger.rb +1 -1
- data/lib/elastic_graph/support/memoizable_data.rb +1 -1
- data/lib/elastic_graph/support/monotonic_clock.rb +1 -1
- data/lib/elastic_graph/support/threading.rb +1 -1
- data/lib/elastic_graph/support/time_set.rb +1 -1
- data/lib/elastic_graph/support/time_util.rb +1 -1
- data/lib/elastic_graph/support/untyped_encoder.rb +2 -10
- data/lib/elastic_graph/version.rb +2 -2
- metadata +10 -16
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4385b468e82bf7dbfc35f5ea06cb1a3e7249f3db6a45f3eec13e181304c21eae
|
|
4
|
+
data.tar.gz: c949877479f1f6370a2cdccd9602d20fe1bacf6e6c28795a175287c0314bdab8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0cc21f5f3b52d1d74f0f25f67147ed79de1b8c6ec4f5a9d59365b6a52e63b03bd8ac236a7247e7e2dcbe35225aa34842398ff6d41251e0831c48f9e0a8034038
|
|
7
|
+
data.tar.gz: f5318376302d6dab15ca81942f5716dfd2a9983469bfe863ea40d2517baaff1a0425c1c54457be313b3e1050a67164e1c03afac2ef93b6907f9632de58671b29
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
|
@@ -57,6 +57,9 @@ graph LR;
|
|
|
57
57
|
elasticgraph-schema_definition["elasticgraph-schema_definition"];
|
|
58
58
|
elasticgraph-schema_definition --> elasticgraph-support;
|
|
59
59
|
class elasticgraph-schema_definition otherEgGemStyle;
|
|
60
|
+
elasticgraph-warehouse["elasticgraph-warehouse"];
|
|
61
|
+
elasticgraph-warehouse --> elasticgraph-support;
|
|
62
|
+
class elasticgraph-warehouse otherEgGemStyle;
|
|
60
63
|
click logger href "https://rubygems.org/gems/logger" "Open on RubyGems.org" _blank;
|
|
61
64
|
click json_schemer href "https://rubygems.org/gems/json_schemer" "Open on RubyGems.org" _blank;
|
|
62
65
|
```
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright 2024 -
|
|
1
|
+
# Copyright 2024 - 2026 Block, Inc.
|
|
2
2
|
#
|
|
3
3
|
# Use of this source code is governed by an MIT-style
|
|
4
4
|
# license that can be found in the LICENSE file or at
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
#
|
|
7
7
|
# frozen_string_literal: true
|
|
8
8
|
|
|
9
|
+
require "securerandom"
|
|
10
|
+
|
|
9
11
|
# Root namespace for all ElasticGraph code.
|
|
10
12
|
module ElasticGraph
|
|
11
13
|
# Here we enumerate constants that are used from multiple places in the code.
|
|
@@ -20,6 +22,15 @@ module ElasticGraph
|
|
|
20
22
|
# @private
|
|
21
23
|
DATASTORE_DATE_TIME_FORMAT = "strict_date_time"
|
|
22
24
|
|
|
25
|
+
# The precision (number of decimal places) used when formatting DateTime values.
|
|
26
|
+
# A precision of 3 means millisecond precision (e.g., "2025-12-19T04:15:47.530Z").
|
|
27
|
+
#
|
|
28
|
+
# Consistent precision is critical for min/max value tracking which uses string comparison.
|
|
29
|
+
# Without it, string comparison produces incorrect results (e.g., "47.53Z" > "47.531Z"
|
|
30
|
+
# because 'Z' (ASCII 90) > '1' (ASCII 49)).
|
|
31
|
+
# @private
|
|
32
|
+
DATE_TIME_PRECISION = 3
|
|
33
|
+
|
|
23
34
|
# HTTP header that ElasticGraph HTTP implementations (e.g. elasticgraph-rack, elasticgraph-lambda)
|
|
24
35
|
# look at to determine a client-specified request timeout.
|
|
25
36
|
# @private
|
|
@@ -249,6 +260,33 @@ module ElasticGraph
|
|
|
249
260
|
# @private
|
|
250
261
|
VISIBILITY_PROFILE = :main
|
|
251
262
|
|
|
263
|
+
# Value used as the missing value placeholder for subaggregation on enum fields.
|
|
264
|
+
# This never collides with any real enum value since GraphQL enum values cannot contain `*` characters.
|
|
265
|
+
# @private
|
|
266
|
+
MISSING_ENUM_PLACEHOLDER = "**missing**"
|
|
267
|
+
|
|
268
|
+
# This is a placeholder for the actual placeholder value used for string types (keyword, text).
|
|
269
|
+
# When a type is configured with this placeholder value then in the graphql query layer
|
|
270
|
+
# we use the random valued MISSING_STRING_PLACEHOLDER_VALUE instead.
|
|
271
|
+
# @private
|
|
272
|
+
MISSING_STRING_PLACEHOLDER = "$SECURE_RANDOM_VALUE"
|
|
273
|
+
|
|
274
|
+
# A random 18 byte (24 character) base64 string used as the missing value placeholder
|
|
275
|
+
# for subaggregation on string fields. UUID are generally consider safe to use without
|
|
276
|
+
# risk of collision and since this has more random bits than a UUID it should have even
|
|
277
|
+
# less risk of collision. This uses a value generated randomly at runtime instead
|
|
278
|
+
# of using a hard-coded value in order to avoid intentional collision attacks.
|
|
279
|
+
# @private
|
|
280
|
+
MISSING_STRING_PLACEHOLDER_VALUE = SecureRandom.urlsafe_base64(18)
|
|
281
|
+
|
|
282
|
+
# Value used as the missing value placeholder for subaggregation on numeric fields.
|
|
283
|
+
# This never collides with any numeric values in the datastore because JSON, ElasticSearch,
|
|
284
|
+
# and OpenSearch aren't capable of storing NaN.
|
|
285
|
+
# NaN works as a placeholder for missing numeric values, but it does have the side-effect of coercing
|
|
286
|
+
# integers to floats so we only use it on types limited to the the JsonSafeLong range.
|
|
287
|
+
# @private
|
|
288
|
+
MISSING_NUMERIC_PLACEHOLDER = "NaN"
|
|
289
|
+
|
|
252
290
|
# TODO(steep): it complains about `define_schema` not being defined but it is defined
|
|
253
291
|
# in another file; I shouldn't have to say it's dynamic here. For now this works though.
|
|
254
292
|
# @dynamic self.define_schema
|
data/lib/elastic_graph/errors.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright 2024 -
|
|
1
|
+
# Copyright 2024 - 2026 Block, Inc.
|
|
2
2
|
#
|
|
3
3
|
# Use of this source code is governed by an MIT-style
|
|
4
4
|
# license that can be found in the LICENSE file or at
|
|
@@ -20,8 +20,14 @@ module ElasticGraph
|
|
|
20
20
|
# did for years.
|
|
21
21
|
#
|
|
22
22
|
# For more info, see: https://github.com/elastic/elasticsearch-ruby/issues/1005
|
|
23
|
+
# @private
|
|
23
24
|
MSearchUsingGetInsteadOfPost = ::Data.define(:app) do
|
|
24
25
|
# @implements MSearchUsingGetInsteadOfPost
|
|
26
|
+
|
|
27
|
+
# Processes a Faraday request, converting `_msearch` POST requests to GET requests.
|
|
28
|
+
#
|
|
29
|
+
# @param env [Faraday::Env] the Faraday request environment
|
|
30
|
+
# @return [Faraday::Response] the response from the next middleware in the stack
|
|
25
31
|
def call(env)
|
|
26
32
|
env.method = :get if env.url.path.to_s.end_with?("/_msearch")
|
|
27
33
|
app.call(env)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright 2024 -
|
|
1
|
+
# Copyright 2024 - 2026 Block, Inc.
|
|
2
2
|
#
|
|
3
3
|
# Use of this source code is governed by an MIT-style
|
|
4
4
|
# license that can be found in the LICENSE file or at
|
|
@@ -20,8 +20,16 @@ module ElasticGraph
|
|
|
20
20
|
#
|
|
21
21
|
# This middleware helps us work around this deficiency by looking for the TIMEOUT_MS_HEADER. If present, it deletes
|
|
22
22
|
# it from the headers and instead sets it as the request timeout.
|
|
23
|
+
# @private
|
|
23
24
|
SupportTimeouts = ::Data.define(:app) do
|
|
24
25
|
# @implements SupportTimeouts
|
|
26
|
+
|
|
27
|
+
# Processes a Faraday request, extracting timeout from headers and applying it to the request.
|
|
28
|
+
# Converts {TIMEOUT_MS_HEADER} from request headers into a Faraday request timeout setting.
|
|
29
|
+
#
|
|
30
|
+
# @param env [Faraday::Env] the Faraday request environment
|
|
31
|
+
# @return [Faraday::Response] the response from the next middleware in the stack
|
|
32
|
+
# @raise [Errors::RequestExceededDeadlineError] if the request times out
|
|
25
33
|
def call(env)
|
|
26
34
|
if (timeout_ms = env.request_headers.delete(TIMEOUT_MS_HEADER))
|
|
27
35
|
env.request.timeout = Integer(timeout_ms) / 1000.0
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright 2024 -
|
|
1
|
+
# Copyright 2024 - 2026 Block, Inc.
|
|
2
2
|
#
|
|
3
3
|
# Use of this source code is governed by an MIT-style
|
|
4
4
|
# license that can be found in the LICENSE file or at
|
|
@@ -43,7 +43,7 @@ module ElasticGraph
|
|
|
43
43
|
rescue => e
|
|
44
44
|
raise <<~EOS
|
|
45
45
|
Failed to load `#{component_class}` with `#{yaml_file}`. This can happen if the schema artifacts are out of date.
|
|
46
|
-
Run `rake schema_artifacts:dump` and try again.
|
|
46
|
+
Run `bundle exec rake schema_artifacts:dump` and try again.
|
|
47
47
|
|
|
48
48
|
#{e.class}: #{e.message}
|
|
49
49
|
EOS
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright 2024 -
|
|
1
|
+
# Copyright 2024 - 2026 Block, Inc.
|
|
2
2
|
#
|
|
3
3
|
# Use of this source code is governed by an MIT-style
|
|
4
4
|
# license that can be found in the LICENSE file or at
|
|
@@ -25,15 +25,7 @@ module ElasticGraph
|
|
|
25
25
|
# Encodes the given untyped value to a String so it can be indexed in a Elasticsearch/OpenSearch `keyword` field.
|
|
26
26
|
def self.encode(value)
|
|
27
27
|
return nil if value.nil?
|
|
28
|
-
|
|
29
|
-
# `generate` includes an extra check for self-referential data structures. `value` here ultimately
|
|
30
|
-
# comes out of a parsed JSON document (e.g. either from an ElasticGraph event at indexing time, or
|
|
31
|
-
# as a GraphQL query variable at search time), and JSON cannot express self-referential data
|
|
32
|
-
# structures, so we do not have to worry about that happening.
|
|
33
|
-
#
|
|
34
|
-
# ...but even if it did, we would get an error either way: `JSON.generate` would raise
|
|
35
|
-
# `JSON::NestingError` whereas `:JSON.fast_generate` would give us a `SystemStackError`.
|
|
36
|
-
::JSON.fast_generate(canonicalize(value))
|
|
28
|
+
::JSON.generate(canonicalize(value))
|
|
37
29
|
end
|
|
38
30
|
|
|
39
31
|
# Decodes a previously encoded Untyped value, returning its original value.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright 2024 -
|
|
1
|
+
# Copyright 2024 - 2026 Block, Inc.
|
|
2
2
|
#
|
|
3
3
|
# Use of this source code is governed by an MIT-style
|
|
4
4
|
# license that can be found in the LICENSE file or at
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
module ElasticGraph
|
|
10
10
|
# The version of all ElasticGraph gems.
|
|
11
|
-
VERSION = "1.0
|
|
11
|
+
VERSION = "1.1.0"
|
|
12
12
|
|
|
13
13
|
# Steep weirdly expects this here...
|
|
14
14
|
# @dynamic self.define_schema
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: elasticgraph-support
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Myron Marston
|
|
@@ -31,34 +31,28 @@ dependencies:
|
|
|
31
31
|
requirements:
|
|
32
32
|
- - "~>"
|
|
33
33
|
- !ruby/object:Gem::Version
|
|
34
|
-
version: '2.
|
|
34
|
+
version: '2.5'
|
|
35
35
|
type: :runtime
|
|
36
36
|
prerelease: false
|
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
|
38
38
|
requirements:
|
|
39
39
|
- - "~>"
|
|
40
40
|
- !ruby/object:Gem::Version
|
|
41
|
-
version: '2.
|
|
41
|
+
version: '2.5'
|
|
42
42
|
- !ruby/object:Gem::Dependency
|
|
43
43
|
name: faraday
|
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
|
45
45
|
requirements:
|
|
46
46
|
- - "~>"
|
|
47
47
|
- !ruby/object:Gem::Version
|
|
48
|
-
version: '2.
|
|
49
|
-
- - ">="
|
|
50
|
-
- !ruby/object:Gem::Version
|
|
51
|
-
version: 2.13.4
|
|
48
|
+
version: '2.14'
|
|
52
49
|
type: :development
|
|
53
50
|
prerelease: false
|
|
54
51
|
version_requirements: !ruby/object:Gem::Requirement
|
|
55
52
|
requirements:
|
|
56
53
|
- - "~>"
|
|
57
54
|
- !ruby/object:Gem::Version
|
|
58
|
-
version: '2.
|
|
59
|
-
- - ">="
|
|
60
|
-
- !ruby/object:Gem::Version
|
|
61
|
-
version: 2.13.4
|
|
55
|
+
version: '2.14'
|
|
62
56
|
email:
|
|
63
57
|
- myron@squareup.com
|
|
64
58
|
executables: []
|
|
@@ -91,10 +85,10 @@ licenses:
|
|
|
91
85
|
- MIT
|
|
92
86
|
metadata:
|
|
93
87
|
bug_tracker_uri: https://github.com/block/elasticgraph/issues
|
|
94
|
-
changelog_uri: https://github.com/block/elasticgraph/releases/tag/v1.0
|
|
95
|
-
documentation_uri: https://block.github.io/elasticgraph/api-docs/v1.0
|
|
88
|
+
changelog_uri: https://github.com/block/elasticgraph/releases/tag/v1.1.0
|
|
89
|
+
documentation_uri: https://block.github.io/elasticgraph/api-docs/v1.1.0/
|
|
96
90
|
homepage_uri: https://block.github.io/elasticgraph/
|
|
97
|
-
source_code_uri: https://github.com/block/elasticgraph/tree/v1.0
|
|
91
|
+
source_code_uri: https://github.com/block/elasticgraph/tree/v1.1.0/elasticgraph-support
|
|
98
92
|
gem_category: core
|
|
99
93
|
rdoc_options: []
|
|
100
94
|
require_paths:
|
|
@@ -106,14 +100,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
106
100
|
version: '3.4'
|
|
107
101
|
- - "<"
|
|
108
102
|
- !ruby/object:Gem::Version
|
|
109
|
-
version: '
|
|
103
|
+
version: '4.1'
|
|
110
104
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
105
|
requirements:
|
|
112
106
|
- - ">="
|
|
113
107
|
- !ruby/object:Gem::Version
|
|
114
108
|
version: '0'
|
|
115
109
|
requirements: []
|
|
116
|
-
rubygems_version:
|
|
110
|
+
rubygems_version: 4.0.3
|
|
117
111
|
specification_version: 4
|
|
118
112
|
summary: Provides support utilities for other ElasticGraph gems.
|
|
119
113
|
test_files: []
|