elasticgraph-schema_definition 0.19.3.1 → 1.0.0.rc1

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 (71) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/lib/elastic_graph/schema_definition/api.rb +5 -12
  4. data/lib/elastic_graph/schema_definition/factory.rb +19 -5
  5. data/lib/elastic_graph/schema_definition/indexing/derived_fields/append_only_set.rb +1 -1
  6. data/lib/elastic_graph/schema_definition/indexing/derived_fields/field_initializer_support.rb +1 -1
  7. data/lib/elastic_graph/schema_definition/indexing/derived_fields/immutable_value.rb +1 -1
  8. data/lib/elastic_graph/schema_definition/indexing/derived_fields/min_or_max_value.rb +1 -1
  9. data/lib/elastic_graph/schema_definition/indexing/derived_indexed_type.rb +1 -1
  10. data/lib/elastic_graph/schema_definition/indexing/event_envelope.rb +1 -1
  11. data/lib/elastic_graph/schema_definition/indexing/field.rb +1 -1
  12. data/lib/elastic_graph/schema_definition/indexing/field_reference.rb +1 -1
  13. data/lib/elastic_graph/schema_definition/indexing/field_type/enum.rb +1 -1
  14. data/lib/elastic_graph/schema_definition/indexing/field_type/object.rb +1 -1
  15. data/lib/elastic_graph/schema_definition/indexing/field_type/scalar.rb +1 -1
  16. data/lib/elastic_graph/schema_definition/indexing/field_type/union.rb +1 -1
  17. data/lib/elastic_graph/schema_definition/indexing/index.rb +1 -1
  18. data/lib/elastic_graph/schema_definition/indexing/json_schema_field_metadata.rb +1 -1
  19. data/lib/elastic_graph/schema_definition/indexing/json_schema_with_metadata.rb +1 -1
  20. data/lib/elastic_graph/schema_definition/indexing/list_counts_mapping.rb +1 -1
  21. data/lib/elastic_graph/schema_definition/indexing/relationship_resolver.rb +1 -1
  22. data/lib/elastic_graph/schema_definition/indexing/rollover_config.rb +1 -1
  23. data/lib/elastic_graph/schema_definition/indexing/update_target_factory.rb +1 -1
  24. data/lib/elastic_graph/schema_definition/indexing/update_target_resolver.rb +1 -1
  25. data/lib/elastic_graph/schema_definition/json_schema_pruner.rb +1 -1
  26. data/lib/elastic_graph/schema_definition/mixins/can_be_graphql_only.rb +1 -1
  27. data/lib/elastic_graph/schema_definition/mixins/has_derived_graphql_type_customizations.rb +1 -1
  28. data/lib/elastic_graph/schema_definition/mixins/has_directives.rb +1 -1
  29. data/lib/elastic_graph/schema_definition/mixins/has_documentation.rb +1 -1
  30. data/lib/elastic_graph/schema_definition/mixins/has_indices.rb +4 -17
  31. data/lib/elastic_graph/schema_definition/mixins/has_readable_to_s_and_inspect.rb +1 -1
  32. data/lib/elastic_graph/schema_definition/mixins/has_subtypes.rb +1 -1
  33. data/lib/elastic_graph/schema_definition/mixins/has_type_info.rb +2 -2
  34. data/lib/elastic_graph/schema_definition/mixins/implements_interfaces.rb +2 -13
  35. data/lib/elastic_graph/schema_definition/mixins/supports_default_value.rb +1 -1
  36. data/lib/elastic_graph/schema_definition/mixins/supports_filtering_and_aggregation.rb +23 -8
  37. data/lib/elastic_graph/schema_definition/mixins/verifies_graphql_name.rb +1 -1
  38. data/lib/elastic_graph/schema_definition/rake_tasks.rb +1 -1
  39. data/lib/elastic_graph/schema_definition/results.rb +5 -5
  40. data/lib/elastic_graph/schema_definition/schema_artifact_manager.rb +1 -1
  41. data/lib/elastic_graph/schema_definition/schema_elements/argument.rb +1 -1
  42. data/lib/elastic_graph/schema_definition/schema_elements/built_in_types.rb +108 -216
  43. data/lib/elastic_graph/schema_definition/schema_elements/deprecated_element.rb +1 -1
  44. data/lib/elastic_graph/schema_definition/schema_elements/directive.rb +1 -1
  45. data/lib/elastic_graph/schema_definition/schema_elements/enum_type.rb +1 -1
  46. data/lib/elastic_graph/schema_definition/schema_elements/enum_value.rb +1 -1
  47. data/lib/elastic_graph/schema_definition/schema_elements/enum_value_namer.rb +1 -1
  48. data/lib/elastic_graph/schema_definition/schema_elements/enums_for_indexed_types.rb +1 -1
  49. data/lib/elastic_graph/schema_definition/schema_elements/field.rb +103 -142
  50. data/lib/elastic_graph/schema_definition/schema_elements/field_path.rb +1 -1
  51. data/lib/elastic_graph/schema_definition/schema_elements/field_source.rb +1 -1
  52. data/lib/elastic_graph/schema_definition/schema_elements/graphql_sdl_enumerator.rb +1 -1
  53. data/lib/elastic_graph/schema_definition/schema_elements/input_field.rb +1 -1
  54. data/lib/elastic_graph/schema_definition/schema_elements/input_type.rb +1 -1
  55. data/lib/elastic_graph/schema_definition/schema_elements/interface_type.rb +1 -1
  56. data/lib/elastic_graph/schema_definition/schema_elements/list_counts_state.rb +1 -1
  57. data/lib/elastic_graph/schema_definition/schema_elements/object_type.rb +1 -1
  58. data/lib/elastic_graph/schema_definition/schema_elements/relationship.rb +1 -1
  59. data/lib/elastic_graph/schema_definition/schema_elements/scalar_type.rb +20 -2
  60. data/lib/elastic_graph/schema_definition/schema_elements/sort_order_enum_value.rb +1 -1
  61. data/lib/elastic_graph/schema_definition/schema_elements/sub_aggregation_path.rb +1 -1
  62. data/lib/elastic_graph/schema_definition/schema_elements/type_namer.rb +2 -1
  63. data/lib/elastic_graph/schema_definition/schema_elements/type_reference.rb +8 -10
  64. data/lib/elastic_graph/schema_definition/schema_elements/type_with_subfields.rb +7 -27
  65. data/lib/elastic_graph/schema_definition/schema_elements/union_type.rb +1 -1
  66. data/lib/elastic_graph/schema_definition/scripting/file_system_repository.rb +1 -1
  67. data/lib/elastic_graph/schema_definition/scripting/script.rb +1 -1
  68. data/lib/elastic_graph/schema_definition/scripting/scripts/update/index_data.painless +2 -22
  69. data/lib/elastic_graph/schema_definition/state.rb +1 -1
  70. data/lib/elastic_graph/schema_definition/test_support.rb +1 -1
  71. metadata +28 -28
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 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
@@ -279,12 +279,6 @@ module ElasticGraph
279
279
  # differently named field in the index.
280
280
  # @param singular [String] indicates what the singular form of a field's name is. When provided, ElasticGraph will define a
281
281
  # `groupedBy` field (using the singular form) allowing clients to group by individual values from the field.
282
- # @param aggregatable [Boolean] force-enables or disables the ability for aggregation queries to aggregate over this field.
283
- # When not provided, ElasticGraph will infer field aggregatability based on the field's GraphQL type and mapping type.
284
- # @param filterable [Boolean] force-enables or disables the ability for queries to filter by this field. When not provided,
285
- # ElasticGraph will infer field filterability based on the field's GraphQL type and mapping type.
286
- # @param groupable [Boolean] force-enables or disables the ability for aggregation queries to group by this field. When
287
- # not provided, ElasticGraph will infer field groupability based on the field's GraphQL type and mapping type.
288
282
  # @yield [Field] the field for further customization
289
283
  # @return [void]
290
284
  #
@@ -301,37 +295,23 @@ module ElasticGraph
301
295
  # t.index "authors"
302
296
  # end
303
297
  # end
304
- def paginated_collection_field(
305
- name,
306
- element_type,
307
- name_in_index: name,
308
- graphql_only: false,
309
- singular: nil,
310
- groupable: !!singular,
311
- filterable: nil,
312
- aggregatable: nil,
313
- &block
314
- )
298
+ def paginated_collection_field(name, element_type, name_in_index: name, singular: nil, &block)
315
299
  element_type_ref = schema_def_state.type_ref(element_type).to_final_form
316
300
  element_type = element_type_ref.name
317
301
 
318
302
  schema_def_state.paginated_collection_element_types << element_type
319
303
 
320
- unless graphql_only
321
- field(name, "[#{element_type}!]!", indexing_only: true, name_in_index: name_in_index, &block)
322
- end
304
+ field(name, "[#{element_type}!]!", indexing_only: true, name_in_index: name_in_index, &block)
323
305
 
324
306
  field(
325
307
  name,
326
308
  element_type_ref.as_connection.name,
327
309
  name_in_index: name_in_index,
328
310
  type_for_derived_types: "[#{element_type}]",
311
+ groupable: !!singular,
312
+ sortable: false,
329
313
  graphql_only: true,
330
- singular: singular,
331
- groupable: groupable,
332
- filterable: filterable,
333
- aggregatable: aggregatable,
334
- sortable: false
314
+ singular: singular
335
315
  ) do |f|
336
316
  f.define_relay_pagination_arguments!
337
317
  block&.call(f)
@@ -555,7 +535,7 @@ module ElasticGraph
555
535
  )
556
536
 
557
537
  field.relationship = relationship
558
- field.resolve_with :nested_relationships
538
+ field.resolver = :nested_relationships
559
539
 
560
540
  yield relationship if block_given?
561
541
 
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 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 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 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 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 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
@@ -31,30 +31,10 @@ if (previousSourceIdsForRelationship.size() > 0) {
31
31
  );
32
32
  }
33
33
 
34
- // While the version in `__versions` is going to be used for the doc version in the future, for now
35
- // we need to continue getting it from `__sourceVersions`. Both our old version and this versions of this
36
- // script keep the value in `__sourceVersions` up-to-date, whereas the old script only writes it to
37
- // `__sourceVersions`. Until we have completely migrated off of the old script for all ElasticGraph
38
- // clusters, we need to keep using it.
39
- //
40
- // Later, after the old script is no longer used by any clusters, we'll stop using `__sourceVersions`.
41
- Number _versionForSourceType = source.get("__sourceVersions")?.get(params.sourceType)?.get(sourceId);
42
- Number _versionForRelationship = relationshipVersionsMap.get(sourceId);
34
+ Number maybeDocVersion = source.__versions.get(params.relationship)?.get(params.sourceId);
43
35
 
44
36
  // Our JSON schema requires event versions to be non-negative, so we can safely use Long.MIN_VALUE as a stand-in when the value is null.
45
- long versionForSourceType = _versionForSourceType == null ? Long.MIN_VALUE : _versionForSourceType.longValue();
46
- long versionForRelationship = _versionForRelationship == null ? Long.MIN_VALUE : _versionForRelationship.longValue();
47
-
48
- // Pick the larger of the two versions as our doc version. Note that `Math.max` didn't work for me here for
49
- // reasons I don't understand, but a simple ternary works fine.
50
- //
51
- // In theory, we could just use `versionForSourceType` as the `docVersion` (and not even check `__versions` at all)
52
- // since both the old version and this version maintain the doc version in `__sourceVersions`. However, that would
53
- // prevent this version of the script from being forward-compatible with the planned next version of this script.
54
- // In the next version, we plan to stop writing to `__sourceVersions`, and as we can't deploy that change atomically,
55
- // this version of the script will continue to run after that has begun to be used. So this version of the script
56
- // must consider which version is greater here, and not simply trust either version value.
57
- long docVersion = versionForSourceType > versionForRelationship ? versionForSourceType : versionForRelationship;
37
+ long docVersion = maybeDocVersion == null ? Long.MIN_VALUE : maybeDocVersion.longValue();
58
38
 
59
39
  if (docVersion >= eventVersion) {
60
40
  throw new IllegalArgumentException("ElasticGraph update was a no-op: [" +
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 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 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 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_definition
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.3.1
4
+ version: 1.0.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Myron Marston
@@ -17,84 +17,84 @@ dependencies:
17
17
  requirements:
18
18
  - - '='
19
19
  - !ruby/object:Gem::Version
20
- version: 0.19.3.1
20
+ version: 1.0.0.rc1
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.3.1
27
+ version: 1.0.0.rc1
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: elasticgraph-indexer
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - '='
33
33
  - !ruby/object:Gem::Version
34
- version: 0.19.3.1
34
+ version: 1.0.0.rc1
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: 0.19.3.1
41
+ version: 1.0.0.rc1
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: elasticgraph-json_schema
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - '='
47
47
  - !ruby/object:Gem::Version
48
- version: 0.19.3.1
48
+ version: 1.0.0.rc1
49
49
  type: :runtime
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.3.1
55
+ version: 1.0.0.rc1
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: elasticgraph-schema_artifacts
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - '='
61
61
  - !ruby/object:Gem::Version
62
- version: 0.19.3.1
62
+ version: 1.0.0.rc1
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - '='
68
68
  - !ruby/object:Gem::Version
69
- version: 0.19.3.1
69
+ version: 1.0.0.rc1
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: elasticgraph-support
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - '='
75
75
  - !ruby/object:Gem::Version
76
- version: 0.19.3.1
76
+ version: 1.0.0.rc1
77
77
  type: :runtime
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - '='
82
82
  - !ruby/object:Gem::Version
83
- version: 0.19.3.1
83
+ version: 1.0.0.rc1
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: graphql
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
88
  - - "~>"
89
89
  - !ruby/object:Gem::Version
90
- version: 2.6.6
90
+ version: 2.5.6
91
91
  type: :runtime
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - "~>"
96
96
  - !ruby/object:Gem::Version
97
- version: 2.6.6
97
+ version: 2.5.6
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: graphql-c_parser
100
100
  requirement: !ruby/object:Gem::Requirement
@@ -104,7 +104,7 @@ dependencies:
104
104
  version: '1.1'
105
105
  - - ">="
106
106
  - !ruby/object:Gem::Version
107
- version: 1.1.2
107
+ version: 1.1.3
108
108
  type: :runtime
109
109
  prerelease: false
110
110
  version_requirements: !ruby/object:Gem::Requirement
@@ -114,7 +114,7 @@ dependencies:
114
114
  version: '1.1'
115
115
  - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: 1.1.2
117
+ version: 1.1.3
118
118
  - !ruby/object:Gem::Dependency
119
119
  name: rake
120
120
  requirement: !ruby/object:Gem::Requirement
@@ -141,56 +141,56 @@ dependencies:
141
141
  requirements:
142
142
  - - '='
143
143
  - !ruby/object:Gem::Version
144
- version: 0.19.3.1
144
+ version: 1.0.0.rc1
145
145
  type: :development
146
146
  prerelease: false
147
147
  version_requirements: !ruby/object:Gem::Requirement
148
148
  requirements:
149
149
  - - '='
150
150
  - !ruby/object:Gem::Version
151
- version: 0.19.3.1
151
+ version: 1.0.0.rc1
152
152
  - !ruby/object:Gem::Dependency
153
153
  name: elasticgraph-datastore_core
154
154
  requirement: !ruby/object:Gem::Requirement
155
155
  requirements:
156
156
  - - '='
157
157
  - !ruby/object:Gem::Version
158
- version: 0.19.3.1
158
+ version: 1.0.0.rc1
159
159
  type: :development
160
160
  prerelease: false
161
161
  version_requirements: !ruby/object:Gem::Requirement
162
162
  requirements:
163
163
  - - '='
164
164
  - !ruby/object:Gem::Version
165
- version: 0.19.3.1
165
+ version: 1.0.0.rc1
166
166
  - !ruby/object:Gem::Dependency
167
167
  name: elasticgraph-elasticsearch
168
168
  requirement: !ruby/object:Gem::Requirement
169
169
  requirements:
170
170
  - - '='
171
171
  - !ruby/object:Gem::Version
172
- version: 0.19.3.1
172
+ version: 1.0.0.rc1
173
173
  type: :development
174
174
  prerelease: false
175
175
  version_requirements: !ruby/object:Gem::Requirement
176
176
  requirements:
177
177
  - - '='
178
178
  - !ruby/object:Gem::Version
179
- version: 0.19.3.1
179
+ version: 1.0.0.rc1
180
180
  - !ruby/object:Gem::Dependency
181
181
  name: elasticgraph-opensearch
182
182
  requirement: !ruby/object:Gem::Requirement
183
183
  requirements:
184
184
  - - '='
185
185
  - !ruby/object:Gem::Version
186
- version: 0.19.3.1
186
+ version: 1.0.0.rc1
187
187
  type: :development
188
188
  prerelease: false
189
189
  version_requirements: !ruby/object:Gem::Requirement
190
190
  requirements:
191
191
  - - '='
192
192
  - !ruby/object:Gem::Version
193
- version: 0.19.3.1
193
+ version: 1.0.0.rc1
194
194
  email:
195
195
  - myron@squareup.com
196
196
  executables: []
@@ -275,10 +275,10 @@ licenses:
275
275
  - MIT
276
276
  metadata:
277
277
  bug_tracker_uri: https://github.com/block/elasticgraph/issues
278
- changelog_uri: https://github.com/block/elasticgraph/releases/tag/v0.19.3.1
279
- documentation_uri: https://block.github.io/elasticgraph/api-docs/v0.19.3.1/
278
+ changelog_uri: https://github.com/block/elasticgraph/releases/tag/v1.0.0.rc1
279
+ documentation_uri: https://block.github.io/elasticgraph/api-docs/v1.0.0.rc1/
280
280
  homepage_uri: https://block.github.io/elasticgraph/
281
- source_code_uri: https://github.com/block/elasticgraph/tree/v0.19.3.1/elasticgraph-schema_definition
281
+ source_code_uri: https://github.com/block/elasticgraph/tree/v1.0.0.rc1/elasticgraph-schema_definition
282
282
  gem_category: local
283
283
  rdoc_options: []
284
284
  require_paths:
@@ -287,7 +287,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
287
287
  requirements:
288
288
  - - ">="
289
289
  - !ruby/object:Gem::Version
290
- version: '3.2'
290
+ version: '3.4'
291
291
  - - "<"
292
292
  - !ruby/object:Gem::Version
293
293
  version: '3.5'
@@ -297,7 +297,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
297
297
  - !ruby/object:Gem::Version
298
298
  version: '0'
299
299
  requirements: []
300
- rubygems_version: 3.6.9
300
+ rubygems_version: 3.6.7
301
301
  specification_version: 4
302
302
  summary: ElasticGraph gem that provides the schema definition API and generates schema
303
303
  artifacts.