isomorfeus-data 23.9.0.rc2 → 23.9.0.rc3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isomorfeus/data/enhancer.rb +8 -7
- data/lib/isomorfeus/data/file_accelerator.rb +2 -11
- data/lib/isomorfeus/data/sid.rb +1 -0
- data/lib/isomorfeus/data/version.rb +1 -1
- data/lib/lucid_file.rb +21 -11
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc95d885418b6e12dc9362e26f7e82675688da923045593a3747a1aab0a1e167
|
4
|
+
data.tar.gz: 5f6b105e0ed4b58fbfbd771d8406b453dd478a9427c046a5a63bcac4ea5cb27e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c77b8a0f96568725c56f20e300597d201d0d2f5b126425cad25e6405d2c9f9ffc05e2d8e451cc17796ec4c522da17223c76902c5c958a853dc90163b61e85c63
|
7
|
+
data.tar.gz: aa546e9a214a5e5470e6421f26f74945dbdc06d674666486763ecedc4ec4bc8d54ef8bb9f2af9200d86a7601fb6c70c7783cc02039a01717ded61788dc302fc5
|
@@ -180,8 +180,7 @@ module Isomorfeus
|
|
180
180
|
if data
|
181
181
|
content_type = Marcel::MimeType.for(data)
|
182
182
|
data_uri = item_class.format_data_uri(content_type, data)
|
183
|
-
|
184
|
-
item_hash = { data_uri: data_uri, revision: revision }
|
183
|
+
item_hash = { data_uri: data_uri }.merge(meta)
|
185
184
|
end
|
186
185
|
action = { type: 'DATA_MERGE', data: { item_class_name => { item_key => item_hash }}}
|
187
186
|
elsif action_type == 'FILE_SAVE'
|
@@ -191,6 +190,7 @@ module Isomorfeus
|
|
191
190
|
data_uri = action[:data_uri]
|
192
191
|
authorization_error!(action) unless Isomorfeus.current_user.authorized?(item_class, :save, { key: item_key, data_uri: data_uri })
|
193
192
|
revision = action[:revision]
|
193
|
+
name = action[:name]
|
194
194
|
sid = SID.new(item_class_name, item_key)
|
195
195
|
meta = item_class.file_accelerator.meta(sid: sid)
|
196
196
|
stored_revision = meta[:revision]
|
@@ -201,7 +201,7 @@ module Isomorfeus
|
|
201
201
|
res = item_class.before_save_block.call(key: item_key, data_uri: data_uri)
|
202
202
|
data_uri = res[:data_uri] if res.is_a?(Hash) && res.key?(:data_uri)
|
203
203
|
end
|
204
|
-
if item_class.file_accelerator.save(sid: sid, data: URI::Data.new(data_uri).data, meta: { revision: revision })
|
204
|
+
if item_class.file_accelerator.save(sid: sid, data: URI::Data.new(data_uri).data, meta: { revision: revision, name: name })
|
205
205
|
item_class.after_save_block.call(key: item_key, data_uri: data_uri) if item_class.after_save_block
|
206
206
|
else
|
207
207
|
instance_uuid = nil
|
@@ -210,13 +210,14 @@ module Isomorfeus
|
|
210
210
|
revision = 0
|
211
211
|
instance_uuid = nil
|
212
212
|
end
|
213
|
-
action = { type: 'DATA_MERGE', data: { item_class_name => { item_key => { data_uri: data_uri, revision: revision, instance_uuid: instance_uuid }}}}
|
213
|
+
action = { type: 'DATA_MERGE', data: { item_class_name => { item_key => { data_uri: data_uri, revision: revision, name: name, instance_uuid: instance_uuid }}}}
|
214
214
|
elsif action_type == 'FILE_CREATE'
|
215
215
|
item_class_name = action[:class_name]
|
216
216
|
item_key = action[:key]
|
217
217
|
item_class = get_verified_class(item_class_name)
|
218
218
|
data_uri = action[:data_uri]
|
219
219
|
authorization_error!(action) unless Isomorfeus.current_user.authorized?(item_class, :create, { key: item_key, data_uri: data_uri })
|
220
|
+
name = action[:name]
|
220
221
|
sid = SID.new(item_class_name, item_key)
|
221
222
|
meta = item_class.file_accelerator.meta(sid: sid)
|
222
223
|
stored_revision = meta ? meta[:revision] : nil
|
@@ -227,7 +228,7 @@ module Isomorfeus
|
|
227
228
|
res = item_class.before_create_block.call(key: item_key, data_uri: data_uri)
|
228
229
|
data_uri = res[:data_uri] if res.is_a?(Hash) && res.key?(:data_uri)
|
229
230
|
end
|
230
|
-
if item_class.file_accelerator.create(sid: sid, data: URI::Data.new(data_uri).data, meta: { revision: revision })
|
231
|
+
if item_class.file_accelerator.create(sid: sid, data: URI::Data.new(data_uri).data, meta: { revision: revision, name: name })
|
231
232
|
item_class.after_create_block.call(key: item_key, data_uri: data_uri) if item_class.after_create_block
|
232
233
|
else
|
233
234
|
stored_revision = 0
|
@@ -237,7 +238,7 @@ module Isomorfeus
|
|
237
238
|
revision = stored_revision
|
238
239
|
instance_uuid = nil
|
239
240
|
end
|
240
|
-
action = { type: 'DATA_ADD', data: { item_class_name => { item_key => { data_uri: data_uri, revision: revision, instance_uuid: instance_uuid }}}}
|
241
|
+
action = { type: 'DATA_ADD', data: { item_class_name => { item_key => { data_uri: data_uri, revision: revision, name: name, instance_uuid: instance_uuid }}}}
|
241
242
|
elsif action_type == 'FILE_SEARCH'
|
242
243
|
item_class_name = action[:class_name]
|
243
244
|
item_class = get_verified_class(item_class_name)
|
@@ -302,7 +303,7 @@ module Isomorfeus
|
|
302
303
|
end
|
303
304
|
|
304
305
|
def get_verified_class(item_class_name)
|
305
|
-
raise "Invalid data class!" unless Isomorfeus.valid_data_class_name?(item_class_name)
|
306
|
+
raise "Invalid data class #{item_class_name}!" unless Isomorfeus.valid_data_class_name?(item_class_name)
|
306
307
|
item_class = Isomorfeus.cached_data_class(item_class_name)
|
307
308
|
end
|
308
309
|
|
@@ -105,17 +105,8 @@ module Isomorfeus
|
|
105
105
|
end
|
106
106
|
|
107
107
|
def check_and_prepare_paths(key:)
|
108
|
-
Isomorfeus.raise_error(message: 'Invalid key
|
109
|
-
|
110
|
-
Isomorfeus.raise_error(message: 'Invalid key (contains more than 2 slashes "/")') if elements.size > 3
|
111
|
-
file = elements.pop
|
112
|
-
path = if elements.size > 0
|
113
|
-
dir_path = ::File.expand_path(::File.join(@store_path, *elements))
|
114
|
-
FileUtils.mkdir_p(dir_path) unless Dir.exist?(dir_path)
|
115
|
-
File.join(dir_path, file)
|
116
|
-
else
|
117
|
-
File.join(@store_path, file)
|
118
|
-
end
|
108
|
+
Isomorfeus.raise_error(message: 'Invalid key, must contain word characters or "-" only!') unless key.match?(SID::SID_S_KEY_RE)
|
109
|
+
path = File.join(@store_path, key)
|
119
110
|
[path, "#{path}__meta__"]
|
120
111
|
end
|
121
112
|
end
|
data/lib/isomorfeus/data/sid.rb
CHANGED
data/lib/lucid_file.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
class LucidFile < LucidDataGeneric
|
2
2
|
include LucidI18nMixin
|
3
3
|
|
4
|
-
VALID_METHODS = %i[key data data_uri content_type]
|
4
|
+
VALID_METHODS = %i[key data data_uri name content_type]
|
5
5
|
|
6
6
|
class << self
|
7
7
|
def api_path(key:)
|
@@ -34,11 +34,12 @@ class LucidFile < LucidDataGeneric
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
def initialize(key: nil, content_type: nil, data: nil, data_uri: nil, _loading: false)
|
37
|
+
def initialize(key: nil, content_type: nil, data: nil, data_uri: nil, name: nil, _loading: false)
|
38
38
|
super(key: key)
|
39
39
|
_update_paths
|
40
40
|
loaded = loaded?
|
41
41
|
@changed_uri_string = nil
|
42
|
+
@changed_name = name if name
|
42
43
|
if data_uri
|
43
44
|
@changed_uri_string = data_uri
|
44
45
|
elsif data || content_type
|
@@ -56,7 +57,7 @@ class LucidFile < LucidDataGeneric
|
|
56
57
|
d = data_uri
|
57
58
|
unchange!
|
58
59
|
Isomorfeus.something_loading!
|
59
|
-
Isomorfeus.store.deferred_dispatch(type: "FILE_CREATE", class_name: @class_name, key: @key, data_uri: d, instance_uuid: instance_uuid, revision: 0)
|
60
|
+
Isomorfeus.store.deferred_dispatch(type: "FILE_CREATE", class_name: @class_name, key: @key, data_uri: d, name: name, instance_uuid: instance_uuid, revision: 0)
|
60
61
|
self
|
61
62
|
end
|
62
63
|
|
@@ -66,16 +67,16 @@ class LucidFile < LucidDataGeneric
|
|
66
67
|
d = data_uri
|
67
68
|
unchange!
|
68
69
|
Isomorfeus.something_loading!
|
69
|
-
Isomorfeus.store.deferred_dispatch(type: "FILE_SAVE", class_name: @class_name, key: @key, data_uri: d, instance_uuid: instance_uuid, revision: @last_revision)
|
70
|
+
Isomorfeus.store.deferred_dispatch(type: "FILE_SAVE", class_name: @class_name, key: @key, data_uri: d, name: name, instance_uuid: instance_uuid, revision: @last_revision)
|
70
71
|
self
|
71
72
|
end
|
72
73
|
|
73
|
-
def [](
|
74
|
-
self.send(
|
74
|
+
def [](n)
|
75
|
+
self.send(n) if VALID_METHODS.include?(n)
|
75
76
|
end
|
76
77
|
|
77
|
-
def []=(
|
78
|
-
self.send("#{
|
78
|
+
def []=(n, value)
|
79
|
+
self.send("#{n}=".to_sym, value) if VALID_METHODS.include?(n)
|
79
80
|
end
|
80
81
|
|
81
82
|
def unchange!
|
@@ -84,7 +85,7 @@ class LucidFile < LucidDataGeneric
|
|
84
85
|
end
|
85
86
|
|
86
87
|
def _update_paths
|
87
|
-
@store_path = [:data_state, @class_name, @key
|
88
|
+
@store_path = [:data_state, @class_name, @key]
|
88
89
|
end
|
89
90
|
|
90
91
|
def content_type
|
@@ -93,13 +94,13 @@ class LucidFile < LucidDataGeneric
|
|
93
94
|
|
94
95
|
def content_type=(c)
|
95
96
|
changed!
|
96
|
-
uri_string = @changed_uri_string ? @changed_uri_string : Isomorfeus.store.dig(*@store_path)
|
97
|
+
uri_string = @changed_uri_string ? @changed_uri_string : Isomorfeus.store.dig(*@store_path)&.fetch(:data_uri, nil)
|
97
98
|
@changed_uri_string = self.class.format_data_uri(c, URI::Data.new(uri_string).data)
|
98
99
|
c
|
99
100
|
end
|
100
101
|
|
101
102
|
def data_uri
|
102
|
-
@changed_uri_string ? @changed_uri_string : Isomorfeus.store.dig(*@store_path)
|
103
|
+
@changed_uri_string ? @changed_uri_string : Isomorfeus.store.dig(*@store_path)&.fetch(:data_uri, nil)
|
103
104
|
end
|
104
105
|
|
105
106
|
def data_uri=(d)
|
@@ -127,6 +128,15 @@ class LucidFile < LucidDataGeneric
|
|
127
128
|
@changed_uri_string = self.class.format_data_uri(ct, d)
|
128
129
|
end
|
129
130
|
|
131
|
+
def name
|
132
|
+
@changed_name ? @changed_name : Isomorfeus.store.dig(*@store_path)&.fetch(:name, nil)
|
133
|
+
end
|
134
|
+
|
135
|
+
def name=(n)
|
136
|
+
changed!
|
137
|
+
@changed_name = name
|
138
|
+
end
|
139
|
+
|
130
140
|
if RUBY_ENGINE != 'opal'
|
131
141
|
class << self
|
132
142
|
def inherited(base)
|
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.9.0.
|
4
|
+
version: 23.9.0.rc3
|
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-09-
|
11
|
+
date: 2023-09-11 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.9.0.
|
109
|
+
version: 23.9.0.rc3
|
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.9.0.
|
116
|
+
version: 23.9.0.rc3
|
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.9.0.
|
123
|
+
version: 23.9.0.rc3
|
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.9.0.
|
130
|
+
version: 23.9.0.rc3
|
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.9.0.
|
137
|
+
version: 23.9.0.rc3
|
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.9.0.
|
144
|
+
version: 23.9.0.rc3
|
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.9.0.
|
151
|
+
version: 23.9.0.rc3
|
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.9.0.
|
158
|
+
version: 23.9.0.rc3
|
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.9.0.
|
165
|
+
version: 23.9.0.rc3
|
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.9.0.
|
172
|
+
version: 23.9.0.rc3
|
173
173
|
- !ruby/object:Gem::Dependency
|
174
174
|
name: rake
|
175
175
|
requirement: !ruby/object:Gem::Requirement
|