graphiform 0.5.0 → 0.5.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: 68d73b56aab3ca718e3b8c8521ef9e03bc4872913a8d6fe2c5b05498611495ae
4
- data.tar.gz: f605a09353957a99960460be3c071b2f9d3558e6df61edf5b29f367c7517a117
3
+ metadata.gz: 19e01a0f9ea8fdc89179e49ae39577309e7c0db74ba008322c67aa0ca9f00a64
4
+ data.tar.gz: 5aeb7bf5df444d7bb20609dbf3bfb9653245418361c6c1a91d8186d9bad8b205
5
5
  SHA512:
6
- metadata.gz: 255499f8b9e7742cfbaf9f9cc1e7fe5df3002887e35dc527326dde57288678a1d8bf88923d1a6e6e5a6607b333badf78a90cc7ebc364c99c27365ed74bdaefa3
7
- data.tar.gz: e793c187d70413324c6c59b557dea0f7d46e346d688ee33681f5c9f4b690e0d14568861b61fb969916ee9596062e65a9a5fd2847442ee1104ab303ab0b103abb
6
+ metadata.gz: 5e128eb6bedb679a8895ad62c5f8bcfefa683e8021f93d64362f4935e6ed22556f1968c97267714d4bdeb6d21020ca76168391b3f5aea4196d009dbf00e6ec15
7
+ data.tar.gz: 35e63ac4f74add2bb905d01d38d6b377dadd5719d0ca1d80153ae4ef65a0149882c0c703d69df36e24a62b4e39f23662050c7799f549bb2f70886cdadaf7339a
@@ -325,11 +325,18 @@ module Graphiform
325
325
  @graphiform_pending_groupings ||= []
326
326
  end
327
327
 
328
+ def graphiform_pending_mutex
329
+ @graphiform_pending_mutex ||= Mutex.new
330
+ end
331
+
328
332
  def flush_pending_filters!
329
333
  return if @graphiform_pending_filters.nil? || @graphiform_pending_filters.empty?
330
334
 
331
- pending = @graphiform_pending_filters
332
- @graphiform_pending_filters = []
335
+ pending = graphiform_pending_mutex.synchronize do
336
+ drained = @graphiform_pending_filters
337
+ @graphiform_pending_filters = []
338
+ drained
339
+ end
333
340
  pending.each do |(name, identifier, options)|
334
341
  graphql_add_scopes_to_filter(name, identifier, **options)
335
342
  end
@@ -338,8 +345,11 @@ module Graphiform
338
345
  def flush_pending_sorts!
339
346
  return if @graphiform_pending_sorts.nil? || @graphiform_pending_sorts.empty?
340
347
 
341
- pending = @graphiform_pending_sorts
342
- @graphiform_pending_sorts = []
348
+ pending = graphiform_pending_mutex.synchronize do
349
+ drained = @graphiform_pending_sorts
350
+ @graphiform_pending_sorts = []
351
+ drained
352
+ end
343
353
  pending.each do |(name, identifier, options)|
344
354
  graphql_field_to_sort(name, identifier, **options)
345
355
  end
@@ -348,8 +358,11 @@ module Graphiform
348
358
  def flush_pending_groupings!
349
359
  return if @graphiform_pending_groupings.nil? || @graphiform_pending_groupings.empty?
350
360
 
351
- pending = @graphiform_pending_groupings
352
- @graphiform_pending_groupings = []
361
+ pending = graphiform_pending_mutex.synchronize do
362
+ drained = @graphiform_pending_groupings
363
+ @graphiform_pending_groupings = []
364
+ drained
365
+ end
353
366
  pending.each do |(name, identifier, options)|
354
367
  graphql_field_to_grouping(name, identifier, **options)
355
368
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'set'
4
+ require 'monitor'
4
5
 
5
6
  module Graphiform
6
7
  module Helpers
@@ -61,8 +62,14 @@ module Graphiform
61
62
  set = tracked_names(klass)
62
63
  return false if set.include?(normalized)
63
64
 
64
- yield
65
- set << normalized
65
+ mutex = (klass.instance_variable_get(:@graphiform_names_mutex) ||
66
+ klass.instance_variable_set(:@graphiform_names_mutex, Monitor.new))
67
+ mutex.synchronize do
68
+ return false if set.include?(normalized)
69
+
70
+ yield
71
+ set << normalized
72
+ end
66
73
  true
67
74
  end
68
75
  # -----------------------------------------------------------------------
@@ -85,12 +92,22 @@ module Graphiform
85
92
  val.ancestors.include?(GraphQL::Schema::Resolver)
86
93
  end
87
94
 
95
+ CONST_LOCKS = {}
96
+ CONST_LOCKS_MUTEX = Mutex.new
97
+
88
98
  def self.get_const_or_create(const, mod = Object)
89
99
  return mod.const_get(const) if mod.const_defined?(const, false)
90
-
91
- val = yield
92
- mod.const_set(const, val)
93
- val
100
+
101
+ key = [mod, const.to_s]
102
+ lock = CONST_LOCKS_MUTEX.synchronize { CONST_LOCKS[key] ||= Monitor.new }
103
+
104
+ lock.synchronize do
105
+ return mod.const_get(const) if mod.const_defined?(const, false)
106
+
107
+ val = yield
108
+ mod.const_set(const, val)
109
+ val
110
+ end
94
111
  end
95
112
 
96
113
  def self.full_const_name(name)
@@ -1,3 +1,3 @@
1
1
  module Graphiform
2
- VERSION = '0.5.0'.freeze
2
+ VERSION = '0.5.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphiform
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - jayce.pulsipher
8
8
  - zack.denkers
9
- autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2026-05-19 00:00:00.000000000 Z
11
+ date: 1980-01-02 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: activerecord
@@ -149,7 +148,6 @@ dependencies:
149
148
  - - ">="
150
149
  - !ruby/object:Gem::Version
151
150
  version: '0'
152
- description:
153
151
  email:
154
152
  - jayce.pulsipher@3-form.com
155
153
  - zack.denkers@3-form.com
@@ -175,7 +173,6 @@ homepage: https://github.com/3-form/graphiform
175
173
  licenses:
176
174
  - MIT
177
175
  metadata: {}
178
- post_install_message:
179
176
  rdoc_options: []
180
177
  require_paths:
181
178
  - lib
@@ -190,8 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
190
187
  - !ruby/object:Gem::Version
191
188
  version: '0'
192
189
  requirements: []
193
- rubygems_version: 3.3.27
194
- signing_key:
190
+ rubygems_version: 3.6.9
195
191
  specification_version: 4
196
192
  summary: Generate GraphQL types, inputs, resolvers, queries, and connections based
197
193
  off whitelisted column and association definitions