isomorfeus-data 23.6.0.rc4 → 23.6.0.rc5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a2933e76d12a5c71ca4b530780279752315411c3320399738506238db5930bf1
4
- data.tar.gz: b2285afb0da725ab3b9b617e20dca1cabfadedc7137c65253a02141dca973916
3
+ metadata.gz: 9ba8c579c7cf981541b8b7079ec550c9ef35a5c8a82d06d5573fe1234e0d6a52
4
+ data.tar.gz: 3405f884befcbcdf32121b2660a4b73581ce4727ea9a194e719614bd88896aca
5
5
  SHA512:
6
- metadata.gz: eb8bf3c9a01dc449a62e2107781d714c7e0fd7d99abaf702c39e15898d6e4f73c27364312eb554792893a59b303ec2ec1a3cec30435a5455188c6cd75e5d1847
7
- data.tar.gz: 77ed0b5486b8ec243f46e404692ce2451a40160d82354c600a358115c466a74b5b3f51c034176cae774406c3f713e71c208271346efdfb1fe1dbbb151dd208d5
6
+ metadata.gz: 3e87ee43905c60b7d307035d8670165bc94b2550fac70fc2b157400b35dd861e5527df3e0415ad9dd143c37b058693b466f9b06609dfccc0dc4b1bc8b3225d20
7
+ data.tar.gz: 3059d88172bbd52c8c00c8dd4355e4b429a0494b76cc18aa4b84e3932e3120417520a1f256b546b20f21c769bf508ead1119214f4ec1ffd72e2951be41da368b
@@ -118,7 +118,7 @@ module Isomorfeus
118
118
  item_class.field_conditions.each do |field, options|
119
119
  loaded_data.delete(field) if options[:server_only]
120
120
  end
121
- action = { type: 'DATA_MERGE', data: { item_class_name => { item_key => { fields: loaded_data, revision: revision, instance_uuid: instance_uuid }}}}
121
+ action = { type: 'DATA_ADD', data: { item_class_name => { item_key => { fields: loaded_data, revision: revision, instance_uuid: instance_uuid }}}}
122
122
  elsif action_type == 'DATA_SEARCH'
123
123
  item_class_name = action[:class_name]
124
124
  item_class = get_verified_class(item_class_name)
@@ -236,7 +236,7 @@ module Isomorfeus
236
236
  revision = stored_revision
237
237
  instance_uuid = nil
238
238
  end
239
- action = { type: 'DATA_MERGE', data: { item_class_name => { item_key => { data_uri: data_uri, revision: revision, instance_uuid: instance_uuid }}}}
239
+ action = { type: 'DATA_ADD', data: { item_class_name => { item_key => { data_uri: data_uri, revision: revision, instance_uuid: instance_uuid }}}}
240
240
  elsif action_type == 'FILE_DESTROY'
241
241
  item_class_name = action[:class_name]
242
242
  item_key = action[:key]
@@ -36,6 +36,11 @@ module Isomorfeus
36
36
  new_state = prev_state ? prev_state.deep_dup : {}
37
37
  new_state.deep_merge!(action[:data])
38
38
  new_state
39
+ elsif action_type == 'DATA_ADD'
40
+ new_state = prev_state ? prev_state.deep_dup : {}
41
+ new_state.deep_merge!(action[:data])
42
+ new_state[:queries] = { action[:data].keys.first => nil }
43
+ new_state
39
44
  elsif action_type == 'DATA_SET'
40
45
  new_state = prev_state ? prev_state.deep_dup : {}
41
46
  if !new_state[action[:class_name]]
@@ -44,6 +49,7 @@ module Isomorfeus
44
49
  new_state[action[:class_name]].delete(action[:key])
45
50
  end
46
51
  new_state[action[:class_name]][action[:key]] = action[:data]
52
+ new_state[:queries] = { action[:class_name] => nil }
47
53
  new_state
48
54
  else
49
55
  prev_state || {}
@@ -1,5 +1,5 @@
1
1
  module Isomorfeus
2
2
  module Data
3
- VERSION = '23.6.0.rc4'
3
+ VERSION = '23.6.0.rc5'
4
4
  end
5
5
  end
@@ -29,8 +29,6 @@ require 'isomorfeus/data/enhancer'
29
29
  Isomorfeus::Data::Enhancer.add_enhancer_to_store
30
30
 
31
31
  if RUBY_ENGINE == 'opal'
32
- Isomorfeus.zeitwerk.push_dir('isomorfeus_data')
33
- require_tree 'isomorfeus_data', autoload: true
34
32
  Isomorfeus.zeitwerk.push_dir('data')
35
33
  else
36
34
  require 'isomorfeus/data/rack_middleware'
@@ -6,7 +6,9 @@ class LucidDataGeneric
6
6
 
7
7
  def load(key:)
8
8
  instance = self.new(key: key, _loading: true)
9
- instance.loaded? ? instance : load!(key: key, instance: instance)
9
+ return instance if instance.loaded?
10
+ return load!(key: key, instance: instance) if instance.loadable?
11
+ instance
10
12
  end
11
13
 
12
14
  def destroyed?(key:)
@@ -80,7 +82,7 @@ class LucidDataGeneric
80
82
  end # RUBY_ENGINE
81
83
 
82
84
  def initialize(key: nil)
83
- @key = key.nil? ? SecureRandom.uuid : key.to_s
85
+ @key = key.nil? ? instance_uuid : key.to_s
84
86
  @self_class = self.class
85
87
  @class_name = @self_class.name
86
88
  @class_name = @class_name.split('>::').last if @class_name.start_with?('#<')
@@ -91,6 +93,11 @@ class LucidDataGeneric
91
93
  revision > 0
92
94
  end
93
95
 
96
+ def loadable?
97
+ return true unless Isomorfeus.store.dig(:data_state, @class_name, @key)
98
+ Isomorfeus.store.dig(:data_state, @class_name, @key, :revision) != nil
99
+ end
100
+
94
101
  def instance_uuid
95
102
  @instance_uuid ||= SecureRandom.uuid
96
103
  end
data/lib/lucid_object.rb CHANGED
@@ -321,7 +321,7 @@ class LucidObject < LucidDataGeneric
321
321
  alias_method :fetch, :[]
322
322
 
323
323
  def []=(name, val)
324
- return self.key = name if name == :key
324
+ return self.key = val.to_s if name == :key
325
325
  val = _validate_field(name, val)
326
326
  changed!
327
327
  @changed_fields[name] = val
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isomorfeus-data
3
3
  version: !ruby/object:Gem::Version
4
- version: 23.6.0.rc4
4
+ version: 23.6.0.rc5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Biedermann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-19 00:00:00.000000000 Z
11
+ date: 2023-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -106,70 +106,70 @@ dependencies:
106
106
  requirements:
107
107
  - - '='
108
108
  - !ruby/object:Gem::Version
109
- version: 23.6.0.rc4
109
+ version: 23.6.0.rc5
110
110
  type: :runtime
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
114
  - - '='
115
115
  - !ruby/object:Gem::Version
116
- version: 23.6.0.rc4
116
+ version: 23.6.0.rc5
117
117
  - !ruby/object:Gem::Dependency
118
118
  name: isomorfeus-policy
119
119
  requirement: !ruby/object:Gem::Requirement
120
120
  requirements:
121
121
  - - '='
122
122
  - !ruby/object:Gem::Version
123
- version: 23.6.0.rc4
123
+ version: 23.6.0.rc5
124
124
  type: :runtime
125
125
  prerelease: false
126
126
  version_requirements: !ruby/object:Gem::Requirement
127
127
  requirements:
128
128
  - - '='
129
129
  - !ruby/object:Gem::Version
130
- version: 23.6.0.rc4
130
+ version: 23.6.0.rc5
131
131
  - !ruby/object:Gem::Dependency
132
132
  name: isomorfeus-preact
133
133
  requirement: !ruby/object:Gem::Requirement
134
134
  requirements:
135
135
  - - '='
136
136
  - !ruby/object:Gem::Version
137
- version: 23.6.0.rc4
137
+ version: 23.6.0.rc5
138
138
  type: :runtime
139
139
  prerelease: false
140
140
  version_requirements: !ruby/object:Gem::Requirement
141
141
  requirements:
142
142
  - - '='
143
143
  - !ruby/object:Gem::Version
144
- version: 23.6.0.rc4
144
+ version: 23.6.0.rc5
145
145
  - !ruby/object:Gem::Dependency
146
146
  name: isomorfeus-redux
147
147
  requirement: !ruby/object:Gem::Requirement
148
148
  requirements:
149
149
  - - '='
150
150
  - !ruby/object:Gem::Version
151
- version: 23.6.0.rc4
151
+ version: 23.6.0.rc5
152
152
  type: :runtime
153
153
  prerelease: false
154
154
  version_requirements: !ruby/object:Gem::Requirement
155
155
  requirements:
156
156
  - - '='
157
157
  - !ruby/object:Gem::Version
158
- version: 23.6.0.rc4
158
+ version: 23.6.0.rc5
159
159
  - !ruby/object:Gem::Dependency
160
160
  name: isomorfeus-transport
161
161
  requirement: !ruby/object:Gem::Requirement
162
162
  requirements:
163
163
  - - '='
164
164
  - !ruby/object:Gem::Version
165
- version: 23.6.0.rc4
165
+ version: 23.6.0.rc5
166
166
  type: :runtime
167
167
  prerelease: false
168
168
  version_requirements: !ruby/object:Gem::Requirement
169
169
  requirements:
170
170
  - - '='
171
171
  - !ruby/object:Gem::Version
172
- version: 23.6.0.rc4
172
+ version: 23.6.0.rc5
173
173
  - !ruby/object:Gem::Dependency
174
174
  name: rake
175
175
  requirement: !ruby/object:Gem::Requirement