elasticgraph-schema_artifacts 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.
Files changed (26) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/lib/elastic_graph/schema_artifacts/artifacts_helper_methods.rb +1 -1
  4. data/lib/elastic_graph/schema_artifacts/from_disk.rb +1 -1
  5. data/lib/elastic_graph/schema_artifacts/runtime_metadata/computation_detail.rb +1 -1
  6. data/lib/elastic_graph/schema_artifacts/runtime_metadata/configured_graphql_resolver.rb +1 -1
  7. data/lib/elastic_graph/schema_artifacts/runtime_metadata/enum.rb +1 -1
  8. data/lib/elastic_graph/schema_artifacts/runtime_metadata/extension.rb +1 -1
  9. data/lib/elastic_graph/schema_artifacts/runtime_metadata/extension_loader.rb +1 -1
  10. data/lib/elastic_graph/schema_artifacts/runtime_metadata/graphql_extension.rb +1 -1
  11. data/lib/elastic_graph/schema_artifacts/runtime_metadata/graphql_field.rb +1 -1
  12. data/lib/elastic_graph/schema_artifacts/runtime_metadata/graphql_resolver.rb +1 -1
  13. data/lib/elastic_graph/schema_artifacts/runtime_metadata/hash_dumper.rb +1 -1
  14. data/lib/elastic_graph/schema_artifacts/runtime_metadata/index_definition.rb +9 -5
  15. data/lib/elastic_graph/schema_artifacts/runtime_metadata/index_field.rb +1 -1
  16. data/lib/elastic_graph/schema_artifacts/runtime_metadata/interface_verifier.rb +1 -1
  17. data/lib/elastic_graph/schema_artifacts/runtime_metadata/object_type.rb +1 -1
  18. data/lib/elastic_graph/schema_artifacts/runtime_metadata/params.rb +1 -1
  19. data/lib/elastic_graph/schema_artifacts/runtime_metadata/relation.rb +1 -1
  20. data/lib/elastic_graph/schema_artifacts/runtime_metadata/scalar_type.rb +5 -7
  21. data/lib/elastic_graph/schema_artifacts/runtime_metadata/schema.rb +18 -1
  22. data/lib/elastic_graph/schema_artifacts/runtime_metadata/schema_element_names.rb +1 -1
  23. data/lib/elastic_graph/schema_artifacts/runtime_metadata/sort_field.rb +1 -1
  24. data/lib/elastic_graph/schema_artifacts/runtime_metadata/update_target.rb +1 -1
  25. data/lib/elastic_graph/schema_artifacts.rb +1 -1
  26. metadata +12 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1b105be8d931b4df673e1a49390a0adb267dca88185765eadf56c70017492a14
4
- data.tar.gz: 4669ade0c16874dccb59b7d4a7161530e9a5eb477eade264d84f5d1eb5d4832a
3
+ metadata.gz: 04c57e1fd04281add1acbfba8c9fd0a5274b9e2065758c723b0c10f758afb1b4
4
+ data.tar.gz: a5450c7dcd183d54afa4f7bdd17b6cf138cf879365b81d9799a4e4ba9da4066f
5
5
  SHA512:
6
- metadata.gz: ec2dc22c0e3420d4427a49d6290081aef2a28982266eb754361148b5f9e69d8aaf0e520fd8086867caaaa87d89b390df90f6fa0d79b51c8604d50ec9496602d3
7
- data.tar.gz: dfd05afe70cceaba09e3d214f82cae422807f711d913eb6ed05af59f4c835328b0b62244aab884e19ca8923f7e147a87c04e2c7944306af6c69bb0630da620d9
6
+ metadata.gz: 66dd782d2ce326dd52857cbd84b084ae42446f2074c7eb1c6071ff347efe5539ea4ca528ebc974f9ae6e04e866f065921e33b7cfb5c01ad82223e16a5adfad7b
7
+ data.tar.gz: c816ecb4c361379e68aa5a28a54ce9e1f78cfda29784321fe5f92318306d9b7e090869ab7f20ef12f95d638ef2e87f6bc82345336d73e4c32bbec5d1f66ac785
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2024 - 2025 Block, Inc.
3
+ Copyright (c) 2024 - 2026 Block, Inc.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2025 Block, Inc.
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
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2025 Block, Inc.
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
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2025 Block, Inc.
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
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2025 Block, Inc.
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
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2025 Block, Inc.
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
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2025 Block, Inc.
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
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2025 Block, Inc.
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
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2025 Block, Inc.
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
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2025 Block, Inc.
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
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2025 Block, Inc.
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
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2025 Block, Inc.
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
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2025 Block, Inc.
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
@@ -16,20 +16,22 @@ module ElasticGraph
16
16
  # Runtime metadata related to a datastore index definition.
17
17
  #
18
18
  # @private
19
- class IndexDefinition < ::Data.define(:route_with, :rollover, :default_sort_fields, :current_sources, :fields_by_path)
19
+ class IndexDefinition < ::Data.define(:route_with, :rollover, :default_sort_fields, :current_sources, :fields_by_path, :has_had_multiple_sources)
20
20
  ROUTE_WITH = "route_with"
21
21
  ROLLOVER = "rollover"
22
22
  DEFAULT_SORT_FIELDS = "default_sort_fields"
23
23
  CURRENT_SOURCES = "current_sources"
24
24
  FIELDS_BY_PATH = "fields_by_path"
25
+ HAS_HAD_MULTIPLE_SOURCES = "has_had_multiple_sources"
25
26
 
26
- def initialize(route_with:, rollover:, default_sort_fields:, current_sources:, fields_by_path:)
27
+ def initialize(route_with:, rollover:, default_sort_fields:, current_sources:, fields_by_path:, has_had_multiple_sources:)
27
28
  super(
28
29
  route_with: route_with,
29
30
  rollover: rollover,
30
31
  default_sort_fields: default_sort_fields,
31
32
  current_sources: current_sources.to_set,
32
- fields_by_path: fields_by_path
33
+ fields_by_path: fields_by_path,
34
+ has_had_multiple_sources: has_had_multiple_sources
33
35
  )
34
36
  end
35
37
 
@@ -39,7 +41,8 @@ module ElasticGraph
39
41
  rollover: hash[ROLLOVER]&.then { |h| Rollover.from_hash(h) },
40
42
  default_sort_fields: hash[DEFAULT_SORT_FIELDS]&.map { |h| SortField.from_hash(h) } || [],
41
43
  current_sources: hash[CURRENT_SOURCES] || [],
42
- fields_by_path: (hash[FIELDS_BY_PATH] || {}).transform_values { |h| IndexField.from_hash(h) }
44
+ fields_by_path: (hash[FIELDS_BY_PATH] || {}).transform_values { |h| IndexField.from_hash(h) },
45
+ has_had_multiple_sources: hash[HAS_HAD_MULTIPLE_SOURCES] || false
43
46
  )
44
47
  end
45
48
 
@@ -49,6 +52,7 @@ module ElasticGraph
49
52
  CURRENT_SOURCES => current_sources.sort,
50
53
  DEFAULT_SORT_FIELDS => default_sort_fields.map(&:to_dumpable_hash),
51
54
  FIELDS_BY_PATH => HashDumper.dump_hash(fields_by_path, &:to_dumpable_hash),
55
+ HAS_HAD_MULTIPLE_SOURCES => (true if has_had_multiple_sources),
52
56
  ROLLOVER => rollover&.to_dumpable_hash,
53
57
  ROUTE_WITH => route_with
54
58
  }
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2025 Block, Inc.
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
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2025 Block, Inc.
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
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2025 Block, Inc.
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
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2025 Block, Inc.
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
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2025 Block, Inc.
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
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2025 Block, Inc.
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
@@ -14,7 +14,7 @@ module ElasticGraph
14
14
  # Provides runtime metadata related to scalar types.
15
15
  #
16
16
  # @private
17
- class ScalarType < ::Data.define(:coercion_adapter_ref, :indexing_preparer_ref)
17
+ class ScalarType < ::Data.define(:coercion_adapter_ref, :indexing_preparer_ref, :grouping_missing_value_placeholder)
18
18
  def self.coercion_adapter_extension_loader
19
19
  @coercion_adapter_extension_loader ||= ExtensionLoader.new(ScalarCoercionAdapterInterface)
20
20
  end
@@ -41,11 +41,8 @@ module ElasticGraph
41
41
  scalar_type_hashes_by_name.transform_values do |hash|
42
42
  new(
43
43
  coercion_adapter_ref: hash.fetch("coercion_adapter"),
44
- # `indexing_preparer` is new as of Q4 2022, and as such is not present in schema artifacts
45
- # dumped before then. Therefore, we allow for the key to not be present in the runtime
46
- # metadata--important so that we don't have a "chicken and egg" problem where the rake tasks
47
- # that need to be loaded to dump new schema artifacts fail at load time due to the missing key.
48
- indexing_preparer_ref: hash.fetch("indexing_preparer", DEFAULT_INDEXING_PREPARER_REF)
44
+ indexing_preparer_ref: hash.fetch("indexing_preparer", DEFAULT_INDEXING_PREPARER_REF),
45
+ grouping_missing_value_placeholder: hash["grouping_missing_value_placeholder"]
49
46
  )
50
47
  end
51
48
  end
@@ -71,6 +68,7 @@ module ElasticGraph
71
68
  {
72
69
  # Keys here are ordered alphabetically; please keep them that way.
73
70
  "coercion_adapter" => load_coercion_adapter.to_dumpable_hash,
71
+ "grouping_missing_value_placeholder" => grouping_missing_value_placeholder,
74
72
  "indexing_preparer" => load_indexing_preparer.to_dumpable_hash
75
73
  }
76
74
  end
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2025 Block, Inc.
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,7 @@
6
6
  #
7
7
  # frozen_string_literal: true
8
8
 
9
+ require "elastic_graph/constants"
9
10
  require "elastic_graph/schema_artifacts/runtime_metadata/enum"
10
11
  require "elastic_graph/schema_artifacts/runtime_metadata/extension"
11
12
  require "elastic_graph/schema_artifacts/runtime_metadata/extension_loader"
@@ -17,6 +18,7 @@ require "elastic_graph/schema_artifacts/runtime_metadata/object_type"
17
18
  require "elastic_graph/schema_artifacts/runtime_metadata/scalar_type"
18
19
  require "elastic_graph/schema_artifacts/runtime_metadata/schema_element_names"
19
20
  require "elastic_graph/support/hash_util"
21
+ require "elastic_graph/version"
20
22
 
21
23
  module ElasticGraph
22
24
  module SchemaArtifacts
@@ -24,6 +26,7 @@ module ElasticGraph
24
26
  module RuntimeMetadata
25
27
  # Entry point for runtime metadata for an entire schema.
26
28
  class Schema < ::Data.define(
29
+ :elasticgraph_version,
27
30
  :object_types_by_name,
28
31
  :scalar_types_by_name,
29
32
  :enum_types_by_name,
@@ -33,6 +36,8 @@ module ElasticGraph
33
36
  :graphql_resolvers_by_name,
34
37
  :static_script_ids_by_scoped_name
35
38
  )
39
+ # @private
40
+ ELASTICGRAPH_VERSION = "elasticgraph_version"
36
41
  # @private
37
42
  OBJECT_TYPES_BY_NAME = "object_types_by_name"
38
43
  # @private
@@ -55,6 +60,16 @@ module ElasticGraph
55
60
  # @param hash [Hash<String, Hash<String, Object>>] runtime metadata hash loaded from YAML
56
61
  # @return [Schema] the runtime metadata schema instance
57
62
  def self.from_hash(hash)
63
+ elasticgraph_version = hash.fetch(ELASTICGRAPH_VERSION) do
64
+ raise Errors::SchemaError, "`#{RUNTIME_METADATA_FILE}` is missing `#{ELASTICGRAPH_VERSION}`. To proceed, regenerate the schema artifacts."
65
+ end
66
+ if elasticgraph_version != ElasticGraph::VERSION
67
+ raise Errors::SchemaError, <<~EOS
68
+ ElasticGraph version mismatch: schema artifacts were dumped by version #{elasticgraph_version}, but current version is #{ElasticGraph::VERSION}.
69
+ To proceed, regenerate the schema artifacts using ElasticGraph v#{ElasticGraph::VERSION} or boot with these artifacts using ElasticGraph v#{elasticgraph_version}.
70
+ EOS
71
+ end
72
+
58
73
  object_types_by_name = hash[OBJECT_TYPES_BY_NAME]&.transform_values do |type_hash|
59
74
  ObjectType.from_hash(type_hash)
60
75
  end || {}
@@ -85,6 +100,7 @@ module ElasticGraph
85
100
  static_script_ids_by_scoped_name = hash[STATIC_SCRIPT_IDS_BY_NAME] || {}
86
101
 
87
102
  new(
103
+ elasticgraph_version: elasticgraph_version,
88
104
  object_types_by_name: object_types_by_name,
89
105
  scalar_types_by_name: scalar_types_by_name,
90
106
  enum_types_by_name: enum_types_by_name,
@@ -102,6 +118,7 @@ module ElasticGraph
102
118
  def to_dumpable_hash
103
119
  Support::HashUtil.recursively_prune_nils_and_empties_from({
104
120
  # Keys here are ordered alphabetically; please keep them that way.
121
+ ELASTICGRAPH_VERSION => elasticgraph_version,
105
122
  ENUM_TYPES_BY_NAME => HashDumper.dump_hash(enum_types_by_name, &:to_dumpable_hash),
106
123
  GRAPHQL_EXTENSION_MODULES => graphql_extension_modules.map(&:to_dumpable_hash),
107
124
  GRAPHQL_RESOLVERS_BY_NAME => HashDumper.dump_hash(graphql_resolvers_by_name.transform_keys(&:to_s), &:to_dumpable_hash),
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2025 Block, Inc.
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
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2025 Block, Inc.
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
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2025 Block, Inc.
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
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2025 Block, Inc.
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
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: 1.0.2
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Myron Marston
@@ -17,42 +17,42 @@ dependencies:
17
17
  requirements:
18
18
  - - '='
19
19
  - !ruby/object:Gem::Version
20
- version: 1.0.2
20
+ version: 1.1.0
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: 1.0.2
27
+ version: 1.1.0
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: 1.0.2
34
+ version: 1.1.0
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: 1.0.2
41
+ version: 1.1.0
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: 1.0.2
48
+ version: 1.1.0
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: 1.0.2
55
+ version: 1.1.0
56
56
  email:
57
57
  - myron@squareup.com
58
58
  executables: []
@@ -89,10 +89,10 @@ licenses:
89
89
  - MIT
90
90
  metadata:
91
91
  bug_tracker_uri: https://github.com/block/elasticgraph/issues
92
- changelog_uri: https://github.com/block/elasticgraph/releases/tag/v1.0.2
93
- documentation_uri: https://block.github.io/elasticgraph/api-docs/v1.0.2/
92
+ changelog_uri: https://github.com/block/elasticgraph/releases/tag/v1.1.0
93
+ documentation_uri: https://block.github.io/elasticgraph/api-docs/v1.1.0/
94
94
  homepage_uri: https://block.github.io/elasticgraph/
95
- source_code_uri: https://github.com/block/elasticgraph/tree/v1.0.2/elasticgraph-schema_artifacts
95
+ source_code_uri: https://github.com/block/elasticgraph/tree/v1.1.0/elasticgraph-schema_artifacts
96
96
  gem_category: core
97
97
  rdoc_options: []
98
98
  require_paths:
@@ -104,14 +104,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
104
104
  version: '3.4'
105
105
  - - "<"
106
106
  - !ruby/object:Gem::Version
107
- version: '3.5'
107
+ version: '4.1'
108
108
  required_rubygems_version: !ruby/object:Gem::Requirement
109
109
  requirements:
110
110
  - - ">="
111
111
  - !ruby/object:Gem::Version
112
112
  version: '0'
113
113
  requirements: []
114
- rubygems_version: 3.6.9
114
+ rubygems_version: 4.0.3
115
115
  specification_version: 4
116
116
  summary: Provides access to ElasticGraph schema artifacts.
117
117
  test_files: []