elasticgraph-graphql 0.18.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +3 -0
- data/elasticgraph-graphql.gemspec +23 -0
- data/lib/elastic_graph/graphql/aggregation/composite_grouping_adapter.rb +79 -0
- data/lib/elastic_graph/graphql/aggregation/computation.rb +39 -0
- data/lib/elastic_graph/graphql/aggregation/date_histogram_grouping.rb +83 -0
- data/lib/elastic_graph/graphql/aggregation/field_path_encoder.rb +47 -0
- data/lib/elastic_graph/graphql/aggregation/field_term_grouping.rb +26 -0
- data/lib/elastic_graph/graphql/aggregation/key.rb +87 -0
- data/lib/elastic_graph/graphql/aggregation/nested_sub_aggregation.rb +37 -0
- data/lib/elastic_graph/graphql/aggregation/non_composite_grouping_adapter.rb +129 -0
- data/lib/elastic_graph/graphql/aggregation/path_segment.rb +31 -0
- data/lib/elastic_graph/graphql/aggregation/query.rb +172 -0
- data/lib/elastic_graph/graphql/aggregation/query_adapter.rb +345 -0
- data/lib/elastic_graph/graphql/aggregation/query_optimizer.rb +187 -0
- data/lib/elastic_graph/graphql/aggregation/resolvers/aggregated_values.rb +41 -0
- data/lib/elastic_graph/graphql/aggregation/resolvers/count_detail.rb +44 -0
- data/lib/elastic_graph/graphql/aggregation/resolvers/grouped_by.rb +30 -0
- data/lib/elastic_graph/graphql/aggregation/resolvers/node.rb +64 -0
- data/lib/elastic_graph/graphql/aggregation/resolvers/relay_connection_builder.rb +83 -0
- data/lib/elastic_graph/graphql/aggregation/resolvers/sub_aggregations.rb +82 -0
- data/lib/elastic_graph/graphql/aggregation/script_term_grouping.rb +32 -0
- data/lib/elastic_graph/graphql/aggregation/term_grouping.rb +118 -0
- data/lib/elastic_graph/graphql/client.rb +43 -0
- data/lib/elastic_graph/graphql/config.rb +81 -0
- data/lib/elastic_graph/graphql/datastore_query/document_paginator.rb +100 -0
- data/lib/elastic_graph/graphql/datastore_query/index_expression_builder.rb +142 -0
- data/lib/elastic_graph/graphql/datastore_query/paginator.rb +199 -0
- data/lib/elastic_graph/graphql/datastore_query/routing_picker.rb +239 -0
- data/lib/elastic_graph/graphql/datastore_query.rb +372 -0
- data/lib/elastic_graph/graphql/datastore_response/document.rb +78 -0
- data/lib/elastic_graph/graphql/datastore_response/search_response.rb +79 -0
- data/lib/elastic_graph/graphql/datastore_search_router.rb +151 -0
- data/lib/elastic_graph/graphql/decoded_cursor.rb +120 -0
- data/lib/elastic_graph/graphql/filtering/boolean_query.rb +45 -0
- data/lib/elastic_graph/graphql/filtering/field_path.rb +81 -0
- data/lib/elastic_graph/graphql/filtering/filter_args_translator.rb +58 -0
- data/lib/elastic_graph/graphql/filtering/filter_interpreter.rb +526 -0
- data/lib/elastic_graph/graphql/filtering/filter_value_set_extractor.rb +148 -0
- data/lib/elastic_graph/graphql/filtering/range_query.rb +56 -0
- data/lib/elastic_graph/graphql/http_endpoint.rb +229 -0
- data/lib/elastic_graph/graphql/monkey_patches/schema_field.rb +56 -0
- data/lib/elastic_graph/graphql/monkey_patches/schema_object.rb +48 -0
- data/lib/elastic_graph/graphql/query_adapter/filters.rb +161 -0
- data/lib/elastic_graph/graphql/query_adapter/pagination.rb +27 -0
- data/lib/elastic_graph/graphql/query_adapter/requested_fields.rb +124 -0
- data/lib/elastic_graph/graphql/query_adapter/sort.rb +32 -0
- data/lib/elastic_graph/graphql/query_details_tracker.rb +60 -0
- data/lib/elastic_graph/graphql/query_executor.rb +200 -0
- data/lib/elastic_graph/graphql/resolvers/get_record_field_value.rb +49 -0
- data/lib/elastic_graph/graphql/resolvers/graphql_adapter.rb +114 -0
- data/lib/elastic_graph/graphql/resolvers/list_records.rb +29 -0
- data/lib/elastic_graph/graphql/resolvers/nested_relationships.rb +74 -0
- data/lib/elastic_graph/graphql/resolvers/query_adapter.rb +85 -0
- data/lib/elastic_graph/graphql/resolvers/query_source.rb +46 -0
- data/lib/elastic_graph/graphql/resolvers/relay_connection/array_adapter.rb +71 -0
- data/lib/elastic_graph/graphql/resolvers/relay_connection/generic_adapter.rb +65 -0
- data/lib/elastic_graph/graphql/resolvers/relay_connection/page_info.rb +82 -0
- data/lib/elastic_graph/graphql/resolvers/relay_connection/search_response_adapter_builder.rb +40 -0
- data/lib/elastic_graph/graphql/resolvers/relay_connection.rb +42 -0
- data/lib/elastic_graph/graphql/resolvers/resolvable_value.rb +56 -0
- data/lib/elastic_graph/graphql/scalar_coercion_adapters/cursor.rb +35 -0
- data/lib/elastic_graph/graphql/scalar_coercion_adapters/date.rb +64 -0
- data/lib/elastic_graph/graphql/scalar_coercion_adapters/date_time.rb +60 -0
- data/lib/elastic_graph/graphql/scalar_coercion_adapters/local_time.rb +30 -0
- data/lib/elastic_graph/graphql/scalar_coercion_adapters/longs.rb +47 -0
- data/lib/elastic_graph/graphql/scalar_coercion_adapters/no_op.rb +24 -0
- data/lib/elastic_graph/graphql/scalar_coercion_adapters/time_zone.rb +44 -0
- data/lib/elastic_graph/graphql/scalar_coercion_adapters/untyped.rb +32 -0
- data/lib/elastic_graph/graphql/scalar_coercion_adapters/valid_time_zones.rb +634 -0
- data/lib/elastic_graph/graphql/schema/arguments.rb +78 -0
- data/lib/elastic_graph/graphql/schema/enum_value.rb +30 -0
- data/lib/elastic_graph/graphql/schema/field.rb +147 -0
- data/lib/elastic_graph/graphql/schema/relation_join.rb +103 -0
- data/lib/elastic_graph/graphql/schema/type.rb +263 -0
- data/lib/elastic_graph/graphql/schema.rb +164 -0
- data/lib/elastic_graph/graphql.rb +253 -0
- data/script/dump_time_zones +81 -0
- data/script/dump_time_zones.java +17 -0
- metadata +503 -0
@@ -0,0 +1,634 @@
|
|
1
|
+
# Copyright 2024 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
|
+
module ElasticGraph
|
10
|
+
class GraphQL
|
11
|
+
module ScalarCoercionAdapters
|
12
|
+
# The set of all valid time zones. We expect this set to align with the official IANA
|
13
|
+
# list[^1][^2][^3], but ultimately we pass these time zones to the datastore and need
|
14
|
+
# to enumerate all time zones it supports. Since Elasticsearch and OpenSearch run on the JVM and the
|
15
|
+
# date format docs[^4] link to Java's `java.time.format.DateTimeFormatter` class, we
|
16
|
+
# can conclude that they support the time zones that the java class supports. This set
|
17
|
+
# is generated by `script/dump_time_zones`, which queries Java's `java.time.ZoneId`[^5]
|
18
|
+
# class to get the set of time zones supported on the JVM.
|
19
|
+
#
|
20
|
+
# DO NOT EDIT BY HAND.
|
21
|
+
#
|
22
|
+
# [^1]: https://www.iana.org/time-zones
|
23
|
+
# [^2]: https://en.wikipedia.org/wiki/Tz_database
|
24
|
+
# [^3]: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List
|
25
|
+
# [^4]: https://www.elastic.co/guide/en/elasticsearch/reference/7.10/mapping-date-format.html#custom-date-formats
|
26
|
+
# [^5]: https://docs.oracle.com/javase/8/docs/api/java/time/ZoneId.html
|
27
|
+
VALID_TIME_ZONES = %w[
|
28
|
+
Africa/Abidjan
|
29
|
+
Africa/Accra
|
30
|
+
Africa/Addis_Ababa
|
31
|
+
Africa/Algiers
|
32
|
+
Africa/Asmara
|
33
|
+
Africa/Asmera
|
34
|
+
Africa/Bamako
|
35
|
+
Africa/Bangui
|
36
|
+
Africa/Banjul
|
37
|
+
Africa/Bissau
|
38
|
+
Africa/Blantyre
|
39
|
+
Africa/Brazzaville
|
40
|
+
Africa/Bujumbura
|
41
|
+
Africa/Cairo
|
42
|
+
Africa/Casablanca
|
43
|
+
Africa/Ceuta
|
44
|
+
Africa/Conakry
|
45
|
+
Africa/Dakar
|
46
|
+
Africa/Dar_es_Salaam
|
47
|
+
Africa/Djibouti
|
48
|
+
Africa/Douala
|
49
|
+
Africa/El_Aaiun
|
50
|
+
Africa/Freetown
|
51
|
+
Africa/Gaborone
|
52
|
+
Africa/Harare
|
53
|
+
Africa/Johannesburg
|
54
|
+
Africa/Juba
|
55
|
+
Africa/Kampala
|
56
|
+
Africa/Khartoum
|
57
|
+
Africa/Kigali
|
58
|
+
Africa/Kinshasa
|
59
|
+
Africa/Lagos
|
60
|
+
Africa/Libreville
|
61
|
+
Africa/Lome
|
62
|
+
Africa/Luanda
|
63
|
+
Africa/Lubumbashi
|
64
|
+
Africa/Lusaka
|
65
|
+
Africa/Malabo
|
66
|
+
Africa/Maputo
|
67
|
+
Africa/Maseru
|
68
|
+
Africa/Mbabane
|
69
|
+
Africa/Mogadishu
|
70
|
+
Africa/Monrovia
|
71
|
+
Africa/Nairobi
|
72
|
+
Africa/Ndjamena
|
73
|
+
Africa/Niamey
|
74
|
+
Africa/Nouakchott
|
75
|
+
Africa/Ouagadougou
|
76
|
+
Africa/Porto-Novo
|
77
|
+
Africa/Sao_Tome
|
78
|
+
Africa/Timbuktu
|
79
|
+
Africa/Tripoli
|
80
|
+
Africa/Tunis
|
81
|
+
Africa/Windhoek
|
82
|
+
America/Adak
|
83
|
+
America/Anchorage
|
84
|
+
America/Anguilla
|
85
|
+
America/Antigua
|
86
|
+
America/Araguaina
|
87
|
+
America/Argentina/Buenos_Aires
|
88
|
+
America/Argentina/Catamarca
|
89
|
+
America/Argentina/ComodRivadavia
|
90
|
+
America/Argentina/Cordoba
|
91
|
+
America/Argentina/Jujuy
|
92
|
+
America/Argentina/La_Rioja
|
93
|
+
America/Argentina/Mendoza
|
94
|
+
America/Argentina/Rio_Gallegos
|
95
|
+
America/Argentina/Salta
|
96
|
+
America/Argentina/San_Juan
|
97
|
+
America/Argentina/San_Luis
|
98
|
+
America/Argentina/Tucuman
|
99
|
+
America/Argentina/Ushuaia
|
100
|
+
America/Aruba
|
101
|
+
America/Asuncion
|
102
|
+
America/Atikokan
|
103
|
+
America/Atka
|
104
|
+
America/Bahia
|
105
|
+
America/Bahia_Banderas
|
106
|
+
America/Barbados
|
107
|
+
America/Belem
|
108
|
+
America/Belize
|
109
|
+
America/Blanc-Sablon
|
110
|
+
America/Boa_Vista
|
111
|
+
America/Bogota
|
112
|
+
America/Boise
|
113
|
+
America/Buenos_Aires
|
114
|
+
America/Cambridge_Bay
|
115
|
+
America/Campo_Grande
|
116
|
+
America/Cancun
|
117
|
+
America/Caracas
|
118
|
+
America/Catamarca
|
119
|
+
America/Cayenne
|
120
|
+
America/Cayman
|
121
|
+
America/Chicago
|
122
|
+
America/Chihuahua
|
123
|
+
America/Ciudad_Juarez
|
124
|
+
America/Coral_Harbour
|
125
|
+
America/Cordoba
|
126
|
+
America/Costa_Rica
|
127
|
+
America/Creston
|
128
|
+
America/Cuiaba
|
129
|
+
America/Curacao
|
130
|
+
America/Danmarkshavn
|
131
|
+
America/Dawson
|
132
|
+
America/Dawson_Creek
|
133
|
+
America/Denver
|
134
|
+
America/Detroit
|
135
|
+
America/Dominica
|
136
|
+
America/Edmonton
|
137
|
+
America/Eirunepe
|
138
|
+
America/El_Salvador
|
139
|
+
America/Ensenada
|
140
|
+
America/Fort_Nelson
|
141
|
+
America/Fort_Wayne
|
142
|
+
America/Fortaleza
|
143
|
+
America/Glace_Bay
|
144
|
+
America/Godthab
|
145
|
+
America/Goose_Bay
|
146
|
+
America/Grand_Turk
|
147
|
+
America/Grenada
|
148
|
+
America/Guadeloupe
|
149
|
+
America/Guatemala
|
150
|
+
America/Guayaquil
|
151
|
+
America/Guyana
|
152
|
+
America/Halifax
|
153
|
+
America/Havana
|
154
|
+
America/Hermosillo
|
155
|
+
America/Indiana/Indianapolis
|
156
|
+
America/Indiana/Knox
|
157
|
+
America/Indiana/Marengo
|
158
|
+
America/Indiana/Petersburg
|
159
|
+
America/Indiana/Tell_City
|
160
|
+
America/Indiana/Vevay
|
161
|
+
America/Indiana/Vincennes
|
162
|
+
America/Indiana/Winamac
|
163
|
+
America/Indianapolis
|
164
|
+
America/Inuvik
|
165
|
+
America/Iqaluit
|
166
|
+
America/Jamaica
|
167
|
+
America/Jujuy
|
168
|
+
America/Juneau
|
169
|
+
America/Kentucky/Louisville
|
170
|
+
America/Kentucky/Monticello
|
171
|
+
America/Knox_IN
|
172
|
+
America/Kralendijk
|
173
|
+
America/La_Paz
|
174
|
+
America/Lima
|
175
|
+
America/Los_Angeles
|
176
|
+
America/Louisville
|
177
|
+
America/Lower_Princes
|
178
|
+
America/Maceio
|
179
|
+
America/Managua
|
180
|
+
America/Manaus
|
181
|
+
America/Marigot
|
182
|
+
America/Martinique
|
183
|
+
America/Matamoros
|
184
|
+
America/Mazatlan
|
185
|
+
America/Mendoza
|
186
|
+
America/Menominee
|
187
|
+
America/Merida
|
188
|
+
America/Metlakatla
|
189
|
+
America/Mexico_City
|
190
|
+
America/Miquelon
|
191
|
+
America/Moncton
|
192
|
+
America/Monterrey
|
193
|
+
America/Montevideo
|
194
|
+
America/Montreal
|
195
|
+
America/Montserrat
|
196
|
+
America/Nassau
|
197
|
+
America/New_York
|
198
|
+
America/Nipigon
|
199
|
+
America/Nome
|
200
|
+
America/Noronha
|
201
|
+
America/North_Dakota/Beulah
|
202
|
+
America/North_Dakota/Center
|
203
|
+
America/North_Dakota/New_Salem
|
204
|
+
America/Nuuk
|
205
|
+
America/Ojinaga
|
206
|
+
America/Panama
|
207
|
+
America/Pangnirtung
|
208
|
+
America/Paramaribo
|
209
|
+
America/Phoenix
|
210
|
+
America/Port-au-Prince
|
211
|
+
America/Port_of_Spain
|
212
|
+
America/Porto_Acre
|
213
|
+
America/Porto_Velho
|
214
|
+
America/Puerto_Rico
|
215
|
+
America/Punta_Arenas
|
216
|
+
America/Rainy_River
|
217
|
+
America/Rankin_Inlet
|
218
|
+
America/Recife
|
219
|
+
America/Regina
|
220
|
+
America/Resolute
|
221
|
+
America/Rio_Branco
|
222
|
+
America/Rosario
|
223
|
+
America/Santa_Isabel
|
224
|
+
America/Santarem
|
225
|
+
America/Santiago
|
226
|
+
America/Santo_Domingo
|
227
|
+
America/Sao_Paulo
|
228
|
+
America/Scoresbysund
|
229
|
+
America/Shiprock
|
230
|
+
America/Sitka
|
231
|
+
America/St_Barthelemy
|
232
|
+
America/St_Johns
|
233
|
+
America/St_Kitts
|
234
|
+
America/St_Lucia
|
235
|
+
America/St_Thomas
|
236
|
+
America/St_Vincent
|
237
|
+
America/Swift_Current
|
238
|
+
America/Tegucigalpa
|
239
|
+
America/Thule
|
240
|
+
America/Thunder_Bay
|
241
|
+
America/Tijuana
|
242
|
+
America/Toronto
|
243
|
+
America/Tortola
|
244
|
+
America/Vancouver
|
245
|
+
America/Virgin
|
246
|
+
America/Whitehorse
|
247
|
+
America/Winnipeg
|
248
|
+
America/Yakutat
|
249
|
+
America/Yellowknife
|
250
|
+
Antarctica/Casey
|
251
|
+
Antarctica/Davis
|
252
|
+
Antarctica/DumontDUrville
|
253
|
+
Antarctica/Macquarie
|
254
|
+
Antarctica/Mawson
|
255
|
+
Antarctica/McMurdo
|
256
|
+
Antarctica/Palmer
|
257
|
+
Antarctica/Rothera
|
258
|
+
Antarctica/South_Pole
|
259
|
+
Antarctica/Syowa
|
260
|
+
Antarctica/Troll
|
261
|
+
Antarctica/Vostok
|
262
|
+
Arctic/Longyearbyen
|
263
|
+
Asia/Aden
|
264
|
+
Asia/Almaty
|
265
|
+
Asia/Amman
|
266
|
+
Asia/Anadyr
|
267
|
+
Asia/Aqtau
|
268
|
+
Asia/Aqtobe
|
269
|
+
Asia/Ashgabat
|
270
|
+
Asia/Ashkhabad
|
271
|
+
Asia/Atyrau
|
272
|
+
Asia/Baghdad
|
273
|
+
Asia/Bahrain
|
274
|
+
Asia/Baku
|
275
|
+
Asia/Bangkok
|
276
|
+
Asia/Barnaul
|
277
|
+
Asia/Beirut
|
278
|
+
Asia/Bishkek
|
279
|
+
Asia/Brunei
|
280
|
+
Asia/Calcutta
|
281
|
+
Asia/Chita
|
282
|
+
Asia/Choibalsan
|
283
|
+
Asia/Chongqing
|
284
|
+
Asia/Chungking
|
285
|
+
Asia/Colombo
|
286
|
+
Asia/Dacca
|
287
|
+
Asia/Damascus
|
288
|
+
Asia/Dhaka
|
289
|
+
Asia/Dili
|
290
|
+
Asia/Dubai
|
291
|
+
Asia/Dushanbe
|
292
|
+
Asia/Famagusta
|
293
|
+
Asia/Gaza
|
294
|
+
Asia/Harbin
|
295
|
+
Asia/Hebron
|
296
|
+
Asia/Ho_Chi_Minh
|
297
|
+
Asia/Hong_Kong
|
298
|
+
Asia/Hovd
|
299
|
+
Asia/Irkutsk
|
300
|
+
Asia/Istanbul
|
301
|
+
Asia/Jakarta
|
302
|
+
Asia/Jayapura
|
303
|
+
Asia/Jerusalem
|
304
|
+
Asia/Kabul
|
305
|
+
Asia/Kamchatka
|
306
|
+
Asia/Karachi
|
307
|
+
Asia/Kashgar
|
308
|
+
Asia/Kathmandu
|
309
|
+
Asia/Katmandu
|
310
|
+
Asia/Khandyga
|
311
|
+
Asia/Kolkata
|
312
|
+
Asia/Krasnoyarsk
|
313
|
+
Asia/Kuala_Lumpur
|
314
|
+
Asia/Kuching
|
315
|
+
Asia/Kuwait
|
316
|
+
Asia/Macao
|
317
|
+
Asia/Macau
|
318
|
+
Asia/Magadan
|
319
|
+
Asia/Makassar
|
320
|
+
Asia/Manila
|
321
|
+
Asia/Muscat
|
322
|
+
Asia/Nicosia
|
323
|
+
Asia/Novokuznetsk
|
324
|
+
Asia/Novosibirsk
|
325
|
+
Asia/Omsk
|
326
|
+
Asia/Oral
|
327
|
+
Asia/Phnom_Penh
|
328
|
+
Asia/Pontianak
|
329
|
+
Asia/Pyongyang
|
330
|
+
Asia/Qatar
|
331
|
+
Asia/Qostanay
|
332
|
+
Asia/Qyzylorda
|
333
|
+
Asia/Rangoon
|
334
|
+
Asia/Riyadh
|
335
|
+
Asia/Saigon
|
336
|
+
Asia/Sakhalin
|
337
|
+
Asia/Samarkand
|
338
|
+
Asia/Seoul
|
339
|
+
Asia/Shanghai
|
340
|
+
Asia/Singapore
|
341
|
+
Asia/Srednekolymsk
|
342
|
+
Asia/Taipei
|
343
|
+
Asia/Tashkent
|
344
|
+
Asia/Tbilisi
|
345
|
+
Asia/Tehran
|
346
|
+
Asia/Tel_Aviv
|
347
|
+
Asia/Thimbu
|
348
|
+
Asia/Thimphu
|
349
|
+
Asia/Tokyo
|
350
|
+
Asia/Tomsk
|
351
|
+
Asia/Ujung_Pandang
|
352
|
+
Asia/Ulaanbaatar
|
353
|
+
Asia/Ulan_Bator
|
354
|
+
Asia/Urumqi
|
355
|
+
Asia/Ust-Nera
|
356
|
+
Asia/Vientiane
|
357
|
+
Asia/Vladivostok
|
358
|
+
Asia/Yakutsk
|
359
|
+
Asia/Yangon
|
360
|
+
Asia/Yekaterinburg
|
361
|
+
Asia/Yerevan
|
362
|
+
Atlantic/Azores
|
363
|
+
Atlantic/Bermuda
|
364
|
+
Atlantic/Canary
|
365
|
+
Atlantic/Cape_Verde
|
366
|
+
Atlantic/Faeroe
|
367
|
+
Atlantic/Faroe
|
368
|
+
Atlantic/Jan_Mayen
|
369
|
+
Atlantic/Madeira
|
370
|
+
Atlantic/Reykjavik
|
371
|
+
Atlantic/South_Georgia
|
372
|
+
Atlantic/St_Helena
|
373
|
+
Atlantic/Stanley
|
374
|
+
Australia/ACT
|
375
|
+
Australia/Adelaide
|
376
|
+
Australia/Brisbane
|
377
|
+
Australia/Broken_Hill
|
378
|
+
Australia/Canberra
|
379
|
+
Australia/Currie
|
380
|
+
Australia/Darwin
|
381
|
+
Australia/Eucla
|
382
|
+
Australia/Hobart
|
383
|
+
Australia/LHI
|
384
|
+
Australia/Lindeman
|
385
|
+
Australia/Lord_Howe
|
386
|
+
Australia/Melbourne
|
387
|
+
Australia/NSW
|
388
|
+
Australia/North
|
389
|
+
Australia/Perth
|
390
|
+
Australia/Queensland
|
391
|
+
Australia/South
|
392
|
+
Australia/Sydney
|
393
|
+
Australia/Tasmania
|
394
|
+
Australia/Victoria
|
395
|
+
Australia/West
|
396
|
+
Australia/Yancowinna
|
397
|
+
Brazil/Acre
|
398
|
+
Brazil/DeNoronha
|
399
|
+
Brazil/East
|
400
|
+
Brazil/West
|
401
|
+
CET
|
402
|
+
CST6CDT
|
403
|
+
Canada/Atlantic
|
404
|
+
Canada/Central
|
405
|
+
Canada/Eastern
|
406
|
+
Canada/Mountain
|
407
|
+
Canada/Newfoundland
|
408
|
+
Canada/Pacific
|
409
|
+
Canada/Saskatchewan
|
410
|
+
Canada/Yukon
|
411
|
+
Chile/Continental
|
412
|
+
Chile/EasterIsland
|
413
|
+
Cuba
|
414
|
+
EET
|
415
|
+
EST5EDT
|
416
|
+
Egypt
|
417
|
+
Eire
|
418
|
+
Etc/GMT
|
419
|
+
Etc/GMT+0
|
420
|
+
Etc/GMT+1
|
421
|
+
Etc/GMT+10
|
422
|
+
Etc/GMT+11
|
423
|
+
Etc/GMT+12
|
424
|
+
Etc/GMT+2
|
425
|
+
Etc/GMT+3
|
426
|
+
Etc/GMT+4
|
427
|
+
Etc/GMT+5
|
428
|
+
Etc/GMT+6
|
429
|
+
Etc/GMT+7
|
430
|
+
Etc/GMT+8
|
431
|
+
Etc/GMT+9
|
432
|
+
Etc/GMT-0
|
433
|
+
Etc/GMT-1
|
434
|
+
Etc/GMT-10
|
435
|
+
Etc/GMT-11
|
436
|
+
Etc/GMT-12
|
437
|
+
Etc/GMT-13
|
438
|
+
Etc/GMT-14
|
439
|
+
Etc/GMT-2
|
440
|
+
Etc/GMT-3
|
441
|
+
Etc/GMT-4
|
442
|
+
Etc/GMT-5
|
443
|
+
Etc/GMT-6
|
444
|
+
Etc/GMT-7
|
445
|
+
Etc/GMT-8
|
446
|
+
Etc/GMT-9
|
447
|
+
Etc/GMT0
|
448
|
+
Etc/Greenwich
|
449
|
+
Etc/UCT
|
450
|
+
Etc/UTC
|
451
|
+
Etc/Universal
|
452
|
+
Etc/Zulu
|
453
|
+
Europe/Amsterdam
|
454
|
+
Europe/Andorra
|
455
|
+
Europe/Astrakhan
|
456
|
+
Europe/Athens
|
457
|
+
Europe/Belfast
|
458
|
+
Europe/Belgrade
|
459
|
+
Europe/Berlin
|
460
|
+
Europe/Bratislava
|
461
|
+
Europe/Brussels
|
462
|
+
Europe/Bucharest
|
463
|
+
Europe/Budapest
|
464
|
+
Europe/Busingen
|
465
|
+
Europe/Chisinau
|
466
|
+
Europe/Copenhagen
|
467
|
+
Europe/Dublin
|
468
|
+
Europe/Gibraltar
|
469
|
+
Europe/Guernsey
|
470
|
+
Europe/Helsinki
|
471
|
+
Europe/Isle_of_Man
|
472
|
+
Europe/Istanbul
|
473
|
+
Europe/Jersey
|
474
|
+
Europe/Kaliningrad
|
475
|
+
Europe/Kiev
|
476
|
+
Europe/Kirov
|
477
|
+
Europe/Kyiv
|
478
|
+
Europe/Lisbon
|
479
|
+
Europe/Ljubljana
|
480
|
+
Europe/London
|
481
|
+
Europe/Luxembourg
|
482
|
+
Europe/Madrid
|
483
|
+
Europe/Malta
|
484
|
+
Europe/Mariehamn
|
485
|
+
Europe/Minsk
|
486
|
+
Europe/Monaco
|
487
|
+
Europe/Moscow
|
488
|
+
Europe/Nicosia
|
489
|
+
Europe/Oslo
|
490
|
+
Europe/Paris
|
491
|
+
Europe/Podgorica
|
492
|
+
Europe/Prague
|
493
|
+
Europe/Riga
|
494
|
+
Europe/Rome
|
495
|
+
Europe/Samara
|
496
|
+
Europe/San_Marino
|
497
|
+
Europe/Sarajevo
|
498
|
+
Europe/Saratov
|
499
|
+
Europe/Simferopol
|
500
|
+
Europe/Skopje
|
501
|
+
Europe/Sofia
|
502
|
+
Europe/Stockholm
|
503
|
+
Europe/Tallinn
|
504
|
+
Europe/Tirane
|
505
|
+
Europe/Tiraspol
|
506
|
+
Europe/Ulyanovsk
|
507
|
+
Europe/Uzhgorod
|
508
|
+
Europe/Vaduz
|
509
|
+
Europe/Vatican
|
510
|
+
Europe/Vienna
|
511
|
+
Europe/Vilnius
|
512
|
+
Europe/Volgograd
|
513
|
+
Europe/Warsaw
|
514
|
+
Europe/Zagreb
|
515
|
+
Europe/Zaporozhye
|
516
|
+
Europe/Zurich
|
517
|
+
GB
|
518
|
+
GB-Eire
|
519
|
+
GMT
|
520
|
+
GMT0
|
521
|
+
Greenwich
|
522
|
+
Hongkong
|
523
|
+
Iceland
|
524
|
+
Indian/Antananarivo
|
525
|
+
Indian/Chagos
|
526
|
+
Indian/Christmas
|
527
|
+
Indian/Cocos
|
528
|
+
Indian/Comoro
|
529
|
+
Indian/Kerguelen
|
530
|
+
Indian/Mahe
|
531
|
+
Indian/Maldives
|
532
|
+
Indian/Mauritius
|
533
|
+
Indian/Mayotte
|
534
|
+
Indian/Reunion
|
535
|
+
Iran
|
536
|
+
Israel
|
537
|
+
Jamaica
|
538
|
+
Japan
|
539
|
+
Kwajalein
|
540
|
+
Libya
|
541
|
+
MET
|
542
|
+
MST7MDT
|
543
|
+
Mexico/BajaNorte
|
544
|
+
Mexico/BajaSur
|
545
|
+
Mexico/General
|
546
|
+
NZ
|
547
|
+
NZ-CHAT
|
548
|
+
Navajo
|
549
|
+
PRC
|
550
|
+
PST8PDT
|
551
|
+
Pacific/Apia
|
552
|
+
Pacific/Auckland
|
553
|
+
Pacific/Bougainville
|
554
|
+
Pacific/Chatham
|
555
|
+
Pacific/Chuuk
|
556
|
+
Pacific/Easter
|
557
|
+
Pacific/Efate
|
558
|
+
Pacific/Enderbury
|
559
|
+
Pacific/Fakaofo
|
560
|
+
Pacific/Fiji
|
561
|
+
Pacific/Funafuti
|
562
|
+
Pacific/Galapagos
|
563
|
+
Pacific/Gambier
|
564
|
+
Pacific/Guadalcanal
|
565
|
+
Pacific/Guam
|
566
|
+
Pacific/Honolulu
|
567
|
+
Pacific/Johnston
|
568
|
+
Pacific/Kanton
|
569
|
+
Pacific/Kiritimati
|
570
|
+
Pacific/Kosrae
|
571
|
+
Pacific/Kwajalein
|
572
|
+
Pacific/Majuro
|
573
|
+
Pacific/Marquesas
|
574
|
+
Pacific/Midway
|
575
|
+
Pacific/Nauru
|
576
|
+
Pacific/Niue
|
577
|
+
Pacific/Norfolk
|
578
|
+
Pacific/Noumea
|
579
|
+
Pacific/Pago_Pago
|
580
|
+
Pacific/Palau
|
581
|
+
Pacific/Pitcairn
|
582
|
+
Pacific/Pohnpei
|
583
|
+
Pacific/Ponape
|
584
|
+
Pacific/Port_Moresby
|
585
|
+
Pacific/Rarotonga
|
586
|
+
Pacific/Saipan
|
587
|
+
Pacific/Samoa
|
588
|
+
Pacific/Tahiti
|
589
|
+
Pacific/Tarawa
|
590
|
+
Pacific/Tongatapu
|
591
|
+
Pacific/Truk
|
592
|
+
Pacific/Wake
|
593
|
+
Pacific/Wallis
|
594
|
+
Pacific/Yap
|
595
|
+
Poland
|
596
|
+
Portugal
|
597
|
+
ROK
|
598
|
+
Singapore
|
599
|
+
SystemV/AST4
|
600
|
+
SystemV/AST4ADT
|
601
|
+
SystemV/CST6
|
602
|
+
SystemV/CST6CDT
|
603
|
+
SystemV/EST5
|
604
|
+
SystemV/EST5EDT
|
605
|
+
SystemV/HST10
|
606
|
+
SystemV/MST7
|
607
|
+
SystemV/MST7MDT
|
608
|
+
SystemV/PST8
|
609
|
+
SystemV/PST8PDT
|
610
|
+
SystemV/YST9
|
611
|
+
SystemV/YST9YDT
|
612
|
+
Turkey
|
613
|
+
UCT
|
614
|
+
US/Alaska
|
615
|
+
US/Aleutian
|
616
|
+
US/Arizona
|
617
|
+
US/Central
|
618
|
+
US/East-Indiana
|
619
|
+
US/Eastern
|
620
|
+
US/Hawaii
|
621
|
+
US/Indiana-Starke
|
622
|
+
US/Michigan
|
623
|
+
US/Mountain
|
624
|
+
US/Pacific
|
625
|
+
US/Samoa
|
626
|
+
UTC
|
627
|
+
Universal
|
628
|
+
W-SU
|
629
|
+
WET
|
630
|
+
Zulu
|
631
|
+
].to_set
|
632
|
+
end
|
633
|
+
end
|
634
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
# Copyright 2024 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
|
+
module ElasticGraph
|
10
|
+
class GraphQL
|
11
|
+
class Schema
|
12
|
+
# A utility module for working with GraphQL schema arguments.
|
13
|
+
module Arguments
|
14
|
+
# A utility method to convert the given `args_hash` to its schema form.
|
15
|
+
# The schema form is the casing of the arguments according to the GraphQL
|
16
|
+
# schema definition. For example, consider a case like:
|
17
|
+
#
|
18
|
+
# type Query {
|
19
|
+
# widgets(orderBy: [WidgetSort!]): [Widget!]!
|
20
|
+
# }
|
21
|
+
#
|
22
|
+
# The GraphQL gem converts all arguments to ruby keyword args style (symbolized,
|
23
|
+
# snake_case keys) before passing the args to us, but the `orderBy` argument in
|
24
|
+
# the schema definition uses camelCase. ElasticGraph was designed to flexibly
|
25
|
+
# support whatever casing the schema developer chooses to use but the GraphQL
|
26
|
+
# gem's conversion to keyword args style gets in the way. ElasticGraph needs to
|
27
|
+
# receive the arguments in the casing form defined in the schema so that, for example,
|
28
|
+
# when it creates a datastore query, it correctly filters on fields according
|
29
|
+
# to the casing of the fields in the index.
|
30
|
+
#
|
31
|
+
# This utility method converts an args hash back to its schema form (string keys,
|
32
|
+
# with the casing from the schema) by using the arg definitions themselves to get
|
33
|
+
# the arg names from the GraphQL schema.
|
34
|
+
#
|
35
|
+
# Example:
|
36
|
+
#
|
37
|
+
# to_schema_form({ order_by: ["size"] }, widgets_field)
|
38
|
+
# # => { "orderBy" => ["size"] }
|
39
|
+
#
|
40
|
+
# The implementation here was taken from a code snippet provided by the maintainer of
|
41
|
+
# the GraphQL gem: https://github.com/rmosolgo/graphql-ruby/issues/2869
|
42
|
+
def self.to_schema_form(args_value, args_owner)
|
43
|
+
# For custom scalar types (such as `_Any` for apollo federation), `args_owner` won't
|
44
|
+
# response to `arguments`.
|
45
|
+
return args_value unless args_owner.respond_to?(:arguments)
|
46
|
+
|
47
|
+
__skip__ = case args_value
|
48
|
+
when Hash, ::GraphQL::Schema::InputObject
|
49
|
+
arg_defns = args_owner.arguments.values
|
50
|
+
|
51
|
+
{}.tap do |accumulator|
|
52
|
+
args_value.each do |key, value|
|
53
|
+
# Note: we could build `arg_defns` into a hash keyed by `keyword`
|
54
|
+
# outside of this loop, to give us an O(1) lookup here. However,
|
55
|
+
# usually there are a small number of args (e.g 1 or 2, maybe up
|
56
|
+
# to 6 in extreme cases) so it's probably likely to be ultimately
|
57
|
+
# slower to build the hash, particularly when you account for the
|
58
|
+
# extra memory allocation and GC for the hash.
|
59
|
+
arg_defn = arg_defns.find do |a|
|
60
|
+
a.keyword == key
|
61
|
+
end || raise(SchemaError, "Cannot find an argument definition for #{key.inspect} on `#{args_owner.name}`")
|
62
|
+
|
63
|
+
next_owner = arg_defn.type.unwrap
|
64
|
+
accumulator[arg_defn.name] = to_schema_form(value, next_owner)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
when Array
|
68
|
+
args_value.map { |arg_value| to_schema_form(arg_value, args_owner) }
|
69
|
+
else
|
70
|
+
# :nocov: -- not sure how to cover this but we want this default branch.
|
71
|
+
args_value
|
72
|
+
# :nocov:
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|