elasticgraph-schema_artifacts 0.19.2.0 → 0.19.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ed9482702dcda2510d507060aeddf082f437a2c8c306d78d96d144efc6edd59f
4
- data.tar.gz: 762c4dc97b95094765ce55b6e88059596be673bef65a1491f14e2ded59569b86
3
+ metadata.gz: 1cc728697f7cfe8e926a44626cce30567a2ef7638b2e5f134ae4aedd34d02947
4
+ data.tar.gz: 9c8a6cd5ffbdcadfd8f6d5edebebf2067b64c9de454736d85b85f9aea8994912
5
5
  SHA512:
6
- metadata.gz: d62417bfa74d5c50c0f6fee9517422b4e19e10fd4fc77700f5690658c9860e096adeb0313c4eac9028cef9220bea56a103d8a5a85aa1aa719c757505e82f618c
7
- data.tar.gz: eb2287a4b244ac96ba468af7e508a524a1ae28790f657e3a6db94ca06fcd63ffca5c49a0ea0d50e5f2c9b9cf1724674ccf9117fd1fc3a2f636b9837e834f07f2
6
+ metadata.gz: fe7be2fba3754752129f904541afd03c40aa856868d8eab0d08fd769289b0cef4e4064c516e6c8d117cd66251223f25cdbc261f81cb5e6d8d2f7e538c6a39d2a
7
+ data.tar.gz: 4f5cec991b458051b50870a9fe14dc7464b8d86d7c5cc2c1d71b71fec3f8b754bf661f0f9dabc7d357ebb76ded57c922172ca2b3e01ed5fe752e34f73762d46a
@@ -17,7 +17,7 @@ require "yaml"
17
17
  module ElasticGraph
18
18
  module SchemaArtifacts
19
19
  # Builds a `SchemaArtifacts::FromDisk` instance using the provided YAML settings.
20
- def self.from_parsed_yaml(parsed_yaml, for_context:)
20
+ def self.from_parsed_yaml(parsed_yaml)
21
21
  schema_artifacts = parsed_yaml.fetch("schema_artifacts") do
22
22
  raise Errors::ConfigError, "Config is missing required key `schema_artifacts`."
23
23
  end
@@ -30,11 +30,11 @@ module ElasticGraph
30
30
  raise Errors::ConfigError, "Config is missing required key `schema_artifacts.directory`."
31
31
  end
32
32
 
33
- FromDisk.new(directory, for_context)
33
+ FromDisk.new(directory)
34
34
  end
35
35
 
36
36
  # Responsible for loading schema artifacts from disk.
37
- class FromDisk < Support::MemoizableData.define(:artifacts_dir, :context)
37
+ class FromDisk < Support::MemoizableData.define(:artifacts_dir)
38
38
  include ArtifactsHelperMethods
39
39
 
40
40
  def graphql_schema_string
@@ -74,10 +74,7 @@ module ElasticGraph
74
74
  end
75
75
 
76
76
  def runtime_metadata
77
- @runtime_metadata ||= RuntimeMetadata::Schema.from_hash(
78
- parsed_yaml_from(RUNTIME_METADATA_FILE),
79
- for_context: context
80
- )
77
+ @runtime_metadata ||= RuntimeMetadata::Schema.from_hash(parsed_yaml_from(RUNTIME_METADATA_FILE))
81
78
  end
82
79
 
83
80
  private
@@ -0,0 +1,40 @@
1
+ # Copyright 2024 - 2025 Block, Inc.
2
+ #
3
+ # Use of this source code is governed by an MIT-style
4
+ # license that can be found in the LICENSE file or at
5
+ # https://opensource.org/licenses/MIT.
6
+ #
7
+ # frozen_string_literal: true
8
+
9
+ require "elastic_graph/schema_artifacts/runtime_metadata/extension_loader"
10
+
11
+ module ElasticGraph
12
+ module SchemaArtifacts
13
+ module RuntimeMetadata
14
+ class GraphQLExtension < ::Data.define(:extension_ref)
15
+ def self.loader
16
+ @loader ||= ExtensionLoader.new(Module.new)
17
+ end
18
+
19
+ EXTENSION_REF = "extension_ref"
20
+
21
+ def load_extension
22
+ Extension.load_from_hash(extension_ref, via: GraphQLExtension.loader)
23
+ end
24
+
25
+ def self.from_hash(hash)
26
+ new(
27
+ extension_ref: hash.fetch(EXTENSION_REF)
28
+ )
29
+ end
30
+
31
+ def to_dumpable_hash
32
+ {
33
+ # Keys here are ordered alphabetically; please keep them that way.
34
+ EXTENSION_REF => extension_ref
35
+ }
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -9,6 +9,7 @@
9
9
  require "elastic_graph/schema_artifacts/runtime_metadata/enum"
10
10
  require "elastic_graph/schema_artifacts/runtime_metadata/extension"
11
11
  require "elastic_graph/schema_artifacts/runtime_metadata/extension_loader"
12
+ require "elastic_graph/schema_artifacts/runtime_metadata/graphql_extension"
12
13
  require "elastic_graph/schema_artifacts/runtime_metadata/graphql_resolver"
13
14
  require "elastic_graph/schema_artifacts/runtime_metadata/hash_dumper"
14
15
  require "elastic_graph/schema_artifacts/runtime_metadata/index_definition"
@@ -40,7 +41,7 @@ module ElasticGraph
40
41
  GRAPHQL_RESOLVERS_BY_NAME = "graphql_resolvers_by_name"
41
42
  STATIC_SCRIPT_IDS_BY_NAME = "static_script_ids_by_scoped_name"
42
43
 
43
- def self.from_hash(hash, for_context:)
44
+ def self.from_hash(hash)
44
45
  object_types_by_name = hash[OBJECT_TYPES_BY_NAME]&.transform_values do |type_hash|
45
46
  ObjectType.from_hash(type_hash)
46
47
  end || {}
@@ -59,17 +60,10 @@ module ElasticGraph
59
60
 
60
61
  schema_element_names = SchemaElementNames.from_hash(hash.fetch(SCHEMA_ELEMENT_NAMES))
61
62
 
62
- extension_loader = ExtensionLoader.new(Module.new)
63
63
  graphql_extension_modules =
64
- if for_context == :graphql
65
- hash[GRAPHQL_EXTENSION_MODULES]&.map do |ext_mod_hash|
66
- Extension.load_from_hash(ext_mod_hash, via: extension_loader)
67
- end || []
68
- else
69
- # Avoid loading GraphQL extension modules if we're not in a GraphQL context. We can't count
70
- # on the extension modules even being available to load in other contexts.
71
- [] # : ::Array[Extension]
72
- end
64
+ hash[GRAPHQL_EXTENSION_MODULES]&.map do |ext_mod_hash|
65
+ GraphQLExtension.from_hash(ext_mod_hash)
66
+ end || []
73
67
 
74
68
  graphql_resolvers_by_name = hash[GRAPHQL_RESOLVERS_BY_NAME]&.to_h do |name, resolver_hash|
75
69
  [name.to_sym, GraphQLResolver.from_hash(resolver_hash)]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elasticgraph-schema_artifacts
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.2.0
4
+ version: 0.19.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Myron Marston
@@ -9,7 +9,7 @@ authors:
9
9
  - Block Engineering
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2025-04-09 00:00:00.000000000 Z
12
+ date: 2025-04-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: elasticgraph-support
@@ -17,42 +17,42 @@ dependencies:
17
17
  requirements:
18
18
  - - '='
19
19
  - !ruby/object:Gem::Version
20
- version: 0.19.2.0
20
+ version: 0.19.2.1
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - '='
26
26
  - !ruby/object:Gem::Version
27
- version: 0.19.2.0
27
+ version: 0.19.2.1
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: elasticgraph-graphql
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - '='
33
33
  - !ruby/object:Gem::Version
34
- version: 0.19.2.0
34
+ version: 0.19.2.1
35
35
  type: :development
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: 0.19.2.0
41
+ version: 0.19.2.1
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: elasticgraph-indexer
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - '='
47
47
  - !ruby/object:Gem::Version
48
- version: 0.19.2.0
48
+ version: 0.19.2.1
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - '='
54
54
  - !ruby/object:Gem::Version
55
- version: 0.19.2.0
55
+ version: 0.19.2.1
56
56
  email:
57
57
  - myron@squareup.com
58
58
  executables: []
@@ -67,6 +67,7 @@ files:
67
67
  - lib/elastic_graph/schema_artifacts/runtime_metadata/enum.rb
68
68
  - lib/elastic_graph/schema_artifacts/runtime_metadata/extension.rb
69
69
  - lib/elastic_graph/schema_artifacts/runtime_metadata/extension_loader.rb
70
+ - lib/elastic_graph/schema_artifacts/runtime_metadata/graphql_extension.rb
70
71
  - lib/elastic_graph/schema_artifacts/runtime_metadata/graphql_field.rb
71
72
  - lib/elastic_graph/schema_artifacts/runtime_metadata/graphql_resolver.rb
72
73
  - lib/elastic_graph/schema_artifacts/runtime_metadata/hash_dumper.rb
@@ -86,10 +87,10 @@ licenses:
86
87
  - MIT
87
88
  metadata:
88
89
  bug_tracker_uri: https://github.com/block/elasticgraph/issues
89
- changelog_uri: https://github.com/block/elasticgraph/releases/tag/v0.19.2.0
90
- documentation_uri: https://block.github.io/elasticgraph/api-docs/v0.19.2.0/
90
+ changelog_uri: https://github.com/block/elasticgraph/releases/tag/v0.19.2.1
91
+ documentation_uri: https://block.github.io/elasticgraph/api-docs/v0.19.2.1/
91
92
  homepage_uri: https://block.github.io/elasticgraph/
92
- source_code_uri: https://github.com/block/elasticgraph/tree/v0.19.2.0/elasticgraph-schema_artifacts
93
+ source_code_uri: https://github.com/block/elasticgraph/tree/v0.19.2.1/elasticgraph-schema_artifacts
93
94
  gem_category: core
94
95
  rdoc_options: []
95
96
  require_paths: