linked_rails 0.0.4.pre.gaa82a222d → 0.0.4.pre.gc3dfc6914
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/linked_rails/bulk_controller.rb +30 -1
- data/app/models/linked_rails/form.rb +1 -0
- data/app/models/linked_rails/manifest.rb +94 -20
- data/app/models/linked_rails/menus/list.rb +1 -1
- data/app/models/linked_rails/ontology.rb +1 -0
- data/app/policies/linked_rails/form_policy.rb +13 -0
- data/app/policies/linked_rails/ontology_policy.rb +13 -0
- data/app/workers/linked_rails/invalidation_stream_worker.rb +16 -0
- data/lib/generators/linked_rails/install/templates/locales.yml +2 -0
- data/lib/linked_rails/controller/delta.rb +1 -21
- data/lib/linked_rails/controller/error_handling.rb +5 -0
- data/lib/linked_rails/errors/forbidden.rb +37 -0
- data/lib/linked_rails/errors.rb +3 -0
- data/lib/linked_rails/helpers/resource_helper.rb +7 -0
- data/lib/linked_rails/middleware/linked_data_params.rb +1 -1
- data/lib/linked_rails/model/cacheable.rb +47 -0
- data/lib/linked_rails/model/dirty.rb +0 -11
- data/lib/linked_rails/model.rb +1 -0
- data/lib/linked_rails/params_parser.rb +6 -7
- data/lib/linked_rails/policy.rb +4 -0
- data/lib/linked_rails/storage.rb +31 -0
- data/lib/linked_rails.rb +6 -0
- metadata +25 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c46a1b1dd79f52ab737125d44fbf850d58ce90cfedfda01fc41f09f23479afd
|
4
|
+
data.tar.gz: 21772f28097f492ea3593f79e0c1ecaddaacdb91e04e62ac3c08497aacb1afbb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d17d949a1683172351c183f24be5174d36a96dba396a417a58448c5d72a22a5e833d7db8ca0056ec08cc25ddbc2ef5ac5da02a4bd7598b279336fb46fe95c47f
|
7
|
+
data.tar.gz: ddb938f6a9d7c3b3bc148c5bc6153318f0508eb6c57f101ee47434c900709538caf3dde57ae00b0813b95a09ef109d534b6c2fc4d2447e1ee5bc4c5d7e0ab5fe
|
@@ -21,8 +21,11 @@ module LinkedRails
|
|
21
21
|
return response_for_wrong_host(opts) if wrong_host?(opts[:iri])
|
22
22
|
|
23
23
|
include = opts[:include].to_s == 'true'
|
24
|
+
resource = LinkedRails.iri_mapper.resource_from_iri(request_path_to_url(opts[:iri]), user_context)
|
24
25
|
|
25
|
-
response_from_request(include, RDF::URI(opts[:iri]))
|
26
|
+
return response_from_request(include, RDF::URI(opts[:iri])) if resource.blank?
|
27
|
+
|
28
|
+
response_from_resource(include, opts[:iri], resource)
|
26
29
|
rescue StandardError => e
|
27
30
|
handle_resource_error(opts, e)
|
28
31
|
end
|
@@ -84,6 +87,13 @@ module LinkedRails
|
|
84
87
|
false
|
85
88
|
end
|
86
89
|
|
90
|
+
def resource_cache_control(cacheable, status, resource_policy)
|
91
|
+
return :private unless status == 200 && cacheable
|
92
|
+
return 'no-cache' unless resource_policy.try(:public_resource?)
|
93
|
+
|
94
|
+
:public
|
95
|
+
end
|
96
|
+
|
87
97
|
def resource_params(param)
|
88
98
|
params = param.permit(:include, :iri)
|
89
99
|
params[:iri] = URI(params[:iri])
|
@@ -131,6 +141,12 @@ module LinkedRails
|
|
131
141
|
}.merge(opts)
|
132
142
|
end
|
133
143
|
|
144
|
+
def resource_status(resource_policy)
|
145
|
+
raise(LinkedRails::Errors::Forbidden.new(query: :show?)) unless resource_policy.show?
|
146
|
+
|
147
|
+
200
|
148
|
+
end
|
149
|
+
|
134
150
|
def response_for_wrong_host(opts)
|
135
151
|
iri = opts[:iri]
|
136
152
|
term = term_from_vocab(iri)
|
@@ -139,6 +155,19 @@ module LinkedRails
|
|
139
155
|
ontology_term_response(iri, term, opts[:include])
|
140
156
|
end
|
141
157
|
|
158
|
+
def response_from_resource(include, iri, resource)
|
159
|
+
resource_policy = policy(resource)
|
160
|
+
status = resource_status(resource_policy)
|
161
|
+
|
162
|
+
resource_response(
|
163
|
+
iri,
|
164
|
+
body: include && status == 200 ? resource_body(resource) : nil,
|
165
|
+
cache: resource_cache_control(resource.try(:cacheable?), status, resource_policy),
|
166
|
+
language: I18n.locale,
|
167
|
+
status: status
|
168
|
+
)
|
169
|
+
end
|
170
|
+
|
142
171
|
def term_from_vocab(iri)
|
143
172
|
vocab = Vocab.for(iri)
|
144
173
|
tag = iri.to_s.split(vocab.to_s).last
|
@@ -5,6 +5,27 @@ module LinkedRails
|
|
5
5
|
include ActiveModel::Model
|
6
6
|
include LinkedRails::Model
|
7
7
|
|
8
|
+
def save
|
9
|
+
Storage.hset(
|
10
|
+
:persistent,
|
11
|
+
:manifest,
|
12
|
+
LinkedRails.iri.to_s => web_manifest.to_json
|
13
|
+
)
|
14
|
+
end
|
15
|
+
|
16
|
+
def web_manifest
|
17
|
+
web_manifest_base.merge(
|
18
|
+
ontola: web_manifest_ontola_section,
|
19
|
+
serviceworker: web_manifest_sw_section
|
20
|
+
)
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def allowed_external_sources
|
26
|
+
[]
|
27
|
+
end
|
28
|
+
|
8
29
|
def app_name
|
9
30
|
Rails.application.railtie_name.chomp('_application').humanize
|
10
31
|
end
|
@@ -17,8 +38,27 @@ module LinkedRails
|
|
17
38
|
'#eef0f2'
|
18
39
|
end
|
19
40
|
|
41
|
+
def blob_preview_iri
|
42
|
+
return unless ActiveStorage::Blob.service.present?
|
43
|
+
|
44
|
+
LinkedRails.iri(path: 'rails/active_storage/blobs/redirect/{signed_id}/preview')
|
45
|
+
end
|
46
|
+
|
47
|
+
def blob_upload_iri
|
48
|
+
return unless ActiveStorage::Blob.service.present?
|
49
|
+
|
50
|
+
LinkedRails.iri(path: 'rails/active_storage/direct_uploads')
|
51
|
+
end
|
52
|
+
|
20
53
|
def css_class; end
|
21
54
|
|
55
|
+
def csp_entries
|
56
|
+
{
|
57
|
+
connectSrc: [ActiveStorage::Blob.service.try(:bucket)&.url].compact,
|
58
|
+
scriptSrc: [ActiveStorage::Blob.service.try(:bucket)&.url].compact
|
59
|
+
}
|
60
|
+
end
|
61
|
+
|
22
62
|
def header_background
|
23
63
|
:primary
|
24
64
|
end
|
@@ -27,17 +67,16 @@ module LinkedRails
|
|
27
67
|
:white
|
28
68
|
end
|
29
69
|
|
30
|
-
def
|
31
|
-
[
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
]
|
70
|
+
def icons
|
71
|
+
[]
|
72
|
+
end
|
73
|
+
|
74
|
+
def lang
|
75
|
+
:nl
|
37
76
|
end
|
38
77
|
|
39
78
|
def scope
|
40
|
-
|
79
|
+
LinkedRails.iri.to_s
|
41
80
|
end
|
42
81
|
|
43
82
|
def site_theme_color
|
@@ -52,43 +91,46 @@ module LinkedRails
|
|
52
91
|
app_name
|
53
92
|
end
|
54
93
|
|
94
|
+
def start_url
|
95
|
+
scope == '/' ? scope : "#{scope}/"
|
96
|
+
end
|
97
|
+
|
55
98
|
def theme; end
|
56
99
|
|
57
100
|
def theme_options
|
58
101
|
{}
|
59
102
|
end
|
60
103
|
|
61
|
-
def web_manifest
|
62
|
-
web_manifest_base.merge(
|
63
|
-
ontola: web_manifest_ontola_section,
|
64
|
-
serviceworker: web_manifest_sw_section
|
65
|
-
)
|
66
|
-
end
|
67
|
-
|
68
104
|
def web_manifest_base # rubocop:disable Metrics/MethodLength
|
69
105
|
{
|
70
106
|
background_color: background_color,
|
71
107
|
dir: :rtl,
|
72
108
|
display: :standalone,
|
73
|
-
|
109
|
+
icons: icons,
|
110
|
+
lang: lang,
|
74
111
|
name: app_name,
|
75
112
|
scope: scope,
|
76
113
|
short_name: app_name,
|
77
|
-
start_url:
|
114
|
+
start_url: start_url,
|
78
115
|
theme_color: site_theme_color
|
79
116
|
}
|
80
117
|
end
|
81
118
|
|
82
119
|
def web_manifest_ontola_section # rubocop:disable Metrics/MethodLength
|
83
120
|
{
|
84
|
-
|
121
|
+
allowed_external_sources: allowed_external_sources,
|
122
|
+
blob_preview_iri: blob_preview_iri,
|
123
|
+
blob_upload_iri: blob_upload_iri,
|
124
|
+
csp: csp_entries,
|
85
125
|
header_background: header_background,
|
86
126
|
header_text: header_text,
|
87
|
-
|
127
|
+
preconnect: preconnect,
|
88
128
|
primary_color: site_theme_color,
|
89
129
|
secondary_color: site_secondary_color,
|
130
|
+
styled_headers: styled_headers,
|
90
131
|
theme: theme,
|
91
132
|
theme_options: theme_options.to_query,
|
133
|
+
tracking: tracking,
|
92
134
|
website_iri: LinkedRails.iri.to_s,
|
93
135
|
websocket_path: websocket_path
|
94
136
|
}
|
@@ -96,7 +138,7 @@ module LinkedRails
|
|
96
138
|
|
97
139
|
def web_manifest_sw_section
|
98
140
|
{
|
99
|
-
src: "#{scope}/sw.js
|
141
|
+
src: "#{scope}/sw.js",
|
100
142
|
scope: scope
|
101
143
|
}
|
102
144
|
end
|
@@ -104,5 +146,37 @@ module LinkedRails
|
|
104
146
|
def websocket_path
|
105
147
|
Rails.application.config.try(:action_cable).try(:mount_path).try(:[], 1..-1)
|
106
148
|
end
|
149
|
+
|
150
|
+
def preconnect
|
151
|
+
[]
|
152
|
+
end
|
153
|
+
|
154
|
+
def styled_headers
|
155
|
+
false
|
156
|
+
end
|
157
|
+
|
158
|
+
def tracking
|
159
|
+
[]
|
160
|
+
end
|
161
|
+
|
162
|
+
class << self
|
163
|
+
def destroy(iri)
|
164
|
+
Storage.hdel(:persistent, :manifest, iri)
|
165
|
+
end
|
166
|
+
|
167
|
+
def move(from, to)
|
168
|
+
Storage.hset(
|
169
|
+
:persistent,
|
170
|
+
:redirect,
|
171
|
+
"#{from}*" => to
|
172
|
+
)
|
173
|
+
|
174
|
+
data = Storage.hget(:persistent, :manifest, from)
|
175
|
+
|
176
|
+
Storage.hset(:persistent, :manifest, to, data) if data
|
177
|
+
|
178
|
+
destroy(from)
|
179
|
+
end
|
180
|
+
end
|
107
181
|
end
|
108
182
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module LinkedRails
|
4
|
+
class InvalidationStreamWorker < ActiveJob::Base
|
5
|
+
def perform(type, iri, resource_type)
|
6
|
+
entry = {
|
7
|
+
type: type,
|
8
|
+
resource: iri,
|
9
|
+
resourceType: resource_type
|
10
|
+
}
|
11
|
+
id = Storage.xadd(:stream, entry)
|
12
|
+
|
13
|
+
raise('No message id returned, implies failure') if id.blank?
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -5,20 +5,8 @@ module LinkedRails
|
|
5
5
|
module Delta
|
6
6
|
include LinkedRails::Helpers::DeltaHelper
|
7
7
|
|
8
|
-
def changes_triples(resource)
|
8
|
+
def changes_triples(resource)
|
9
9
|
resource_serializer(resource)&.send(:repository).statements
|
10
|
-
|
11
|
-
# resource.previous_changes_by_predicate.map do |predicate, (_old_value, _new_value)|
|
12
|
-
# serializer_attributes = resource.class.predicate_mapping[predicate]
|
13
|
-
# next if serializer_attributes.is_a?(FastJsonapi::Relationship)
|
14
|
-
#
|
15
|
-
# attr_name = serializer_attributes.key
|
16
|
-
# serialized_value =
|
17
|
-
# serializer.class.attributes_to_serialize[attr_name]&.serialize(resource, serializer_params, {})
|
18
|
-
# (serialized_value.is_a?(Array) ? serialized_value : [serialized_value]).map do |value|
|
19
|
-
# change_triple(resource, predicate, value)
|
20
|
-
# end
|
21
|
-
# end.compact.flatten
|
22
10
|
end
|
23
11
|
|
24
12
|
def changed_relations_triples(resource, inverted = nil) # rubocop:disable Metrics/AbcSize
|
@@ -35,14 +23,6 @@ module LinkedRails
|
|
35
23
|
|
36
24
|
private
|
37
25
|
|
38
|
-
def change_triple(resource, predicate, value)
|
39
|
-
if value.nil?
|
40
|
-
RDF::Statement.new(resource.iri, predicate, Vocab.sp[:Variable], graph_name: delta_iri(:remove))
|
41
|
-
else
|
42
|
-
RDF::Statement.new(resource.iri, predicate, value, graph_name: delta_iri(:replace))
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
26
|
def changed_relation_triples(predicate, destructed, resources, inverted)
|
47
27
|
related_resource_invalidations =
|
48
28
|
resources.flat_map do |resource|
|
@@ -6,6 +6,10 @@ module LinkedRails
|
|
6
6
|
extend ActiveSupport::Concern
|
7
7
|
include ActiveSupport::Rescuable
|
8
8
|
|
9
|
+
included do
|
10
|
+
rescue_from LinkedRails::Errors::Forbidden, with: :handle_error
|
11
|
+
end
|
12
|
+
|
9
13
|
private
|
10
14
|
|
11
15
|
def add_error_snackbar(error)
|
@@ -69,6 +73,7 @@ module LinkedRails
|
|
69
73
|
'Doorkeeper::Errors::InvalidGrantReuse' => 422,
|
70
74
|
'LinkedRails::Auth::Errors::Expired' => 410,
|
71
75
|
'LinkedRails::Auth::Errors::Unauthorized' => 401,
|
76
|
+
'LinkedRails::Errors::Forbidden' => 403,
|
72
77
|
'Pundit::NotAuthorizedError' => 403
|
73
78
|
}
|
74
79
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module LinkedRails
|
4
|
+
module Errors
|
5
|
+
class Forbidden < StandardError
|
6
|
+
attr_reader :query, :record, :policy, :action
|
7
|
+
|
8
|
+
# @param [Hash] options
|
9
|
+
# @option options [String] query The action of the request
|
10
|
+
# @option options [ActiveRecord::Base] record The record that was requested
|
11
|
+
# @option options [Policy] policy The policy that raised the exception
|
12
|
+
# @option options [String] message Override the default error message
|
13
|
+
# @return [String] the message
|
14
|
+
def initialize(**options)
|
15
|
+
@query = options.fetch(:query).to_s
|
16
|
+
@record = options[:record]
|
17
|
+
@policy = options[:policy]
|
18
|
+
@action = @query[-1] == '?' ? @query[0..-2] : @query
|
19
|
+
@message = options[:message]
|
20
|
+
|
21
|
+
raise StandardError if @query.blank? && @message.blank?
|
22
|
+
|
23
|
+
super(@message || default_message)
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def default_message
|
29
|
+
I18n.t(
|
30
|
+
"pundit.#{@policy.class.to_s.underscore}.#{@query}",
|
31
|
+
action: @action,
|
32
|
+
default: I18n.t('errors.access_denied')
|
33
|
+
)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -46,6 +46,13 @@ module LinkedRails
|
|
46
46
|
|
47
47
|
private
|
48
48
|
|
49
|
+
def request_path_to_url(path)
|
50
|
+
return path unless path.present? && URI(path).relative?
|
51
|
+
|
52
|
+
port = [80, 443].include?(request.port) ? nil : request.port
|
53
|
+
URI::Generic.new(request.scheme, nil, request.host, port, nil, path, nil, nil, nil).to_s
|
54
|
+
end
|
55
|
+
|
49
56
|
def build_new_resource
|
50
57
|
controller_class.build_new(user_context: user_context)
|
51
58
|
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module LinkedRails
|
4
|
+
module Model
|
5
|
+
module Cacheable
|
6
|
+
extend ActiveSupport::Concern
|
7
|
+
|
8
|
+
included do
|
9
|
+
if respond_to?(:after_commit)
|
10
|
+
after_commit :publish_create, on: :create, if: :should_publish_changes
|
11
|
+
after_commit :publish_update, on: :update, if: :should_publish_changes
|
12
|
+
after_commit :publish_delete, on: :destroy, if: :should_publish_changes
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def cacheable?
|
17
|
+
true
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def publish_create
|
23
|
+
publish_message('io.ontola.transactions.Created')
|
24
|
+
end
|
25
|
+
|
26
|
+
def publish_update
|
27
|
+
publish_message('io.ontola.transactions.Updated')
|
28
|
+
end
|
29
|
+
|
30
|
+
def publish_delete
|
31
|
+
publish_message('io.ontola.transactions.Deleted')
|
32
|
+
end
|
33
|
+
|
34
|
+
def publish_message(type)
|
35
|
+
LinkedRails::InvalidationStreamWorker.perform_now(type, iri.to_s, self.class.iri.to_s)
|
36
|
+
rescue StandardError
|
37
|
+
LinkedRails::InvalidationStreamWorker.perform_later(type, iri.to_s, self.class.iri.to_s)
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def should_publish_changes
|
43
|
+
cacheable? && !Rails.env.test?
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -22,17 +22,6 @@ module LinkedRails
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
def previous_changes_by_predicate
|
26
|
-
serializer_class = RDF::Serializers.serializer_for(self)
|
27
|
-
return {} unless respond_to?(:previous_changes) && serializer_class
|
28
|
-
|
29
|
-
Hash[
|
30
|
-
previous_changes
|
31
|
-
.map { |k, v| [self.class.predicate_for_key(k.to_sym), v] }
|
32
|
-
.select { |k, _v| k.present? }
|
33
|
-
]
|
34
|
-
end
|
35
|
-
|
36
25
|
def previously_changed_relations(inverted = nil)
|
37
26
|
serializer_class = RDF::Serializers.serializer_for(self)
|
38
27
|
return {} unless serializer_class.try(:relationships_to_serialize)
|
data/lib/linked_rails/model.rb
CHANGED
@@ -3,8 +3,7 @@
|
|
3
3
|
module LinkedRails
|
4
4
|
class ParamsParser # rubocop:disable Metrics/ClassLength
|
5
5
|
include ::Empathy::EmpJson::Helpers::Slices
|
6
|
-
include ::Empathy::EmpJson::Helpers::
|
7
|
-
include ::Empathy::EmpJson::Helpers::Values
|
6
|
+
include ::Empathy::EmpJson::Helpers::Parsing
|
8
7
|
|
9
8
|
attr_accessor :params, :slice, :user_context
|
10
9
|
delegate :filter_params, to: :collection_params_parser
|
@@ -63,11 +62,11 @@ module LinkedRails
|
|
63
62
|
def associated_class_from_params(reflection, object)
|
64
63
|
return reflection.klass unless reflection.polymorphic?
|
65
64
|
|
66
|
-
|
65
|
+
type = values_from_slice(slice, object, Vocab.rdfv[:type])
|
67
66
|
|
68
|
-
raise("No type given for '#{object}' referenced by polymorphic association '#{reflection.name}'") if
|
67
|
+
raise("No type given for '#{object}' referenced by polymorphic association '#{reflection.name}'") if type.blank?
|
69
68
|
|
70
|
-
iri_to_class(
|
69
|
+
iri_to_class(type)
|
71
70
|
end
|
72
71
|
|
73
72
|
def collection_params_parser
|
@@ -78,11 +77,11 @@ module LinkedRails
|
|
78
77
|
options = serializer_field(klass, predicate)
|
79
78
|
return unless value.count == 1 && options.present?
|
80
79
|
|
81
|
-
parsed_value = value.first.start_with?('http') ? RDF::URI(value.first) :
|
80
|
+
parsed_value = value.first.start_with?('http') ? RDF::URI(value.first) : value.first
|
82
81
|
parse_param(
|
83
82
|
klass,
|
84
83
|
options.predicate,
|
85
|
-
parsed_value
|
84
|
+
object_to_value(parsed_value)
|
86
85
|
)
|
87
86
|
end
|
88
87
|
|
data/lib/linked_rails/policy.rb
CHANGED
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'redis'
|
4
|
+
|
5
|
+
module LinkedRails
|
6
|
+
class Storage
|
7
|
+
REDIS_DB = {
|
8
|
+
cache: LinkedRails.cache_redis_database,
|
9
|
+
persistent: LinkedRails.persistent_redis_database,
|
10
|
+
stream: LinkedRails.stream_redis_database
|
11
|
+
}.freeze
|
12
|
+
KEYS = {
|
13
|
+
manifest: 'cache:Manifest',
|
14
|
+
redirect: 'cache:Redirect'
|
15
|
+
}.freeze
|
16
|
+
|
17
|
+
class << self
|
18
|
+
%i[xadd].each do |method|
|
19
|
+
define_method(method) do |db, *args|
|
20
|
+
Redis.new(db: REDIS_DB.fetch(db)).send(method, *args)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
%i[hset hdel hget].each do |method|
|
25
|
+
define_method(method) do |db, key, *args|
|
26
|
+
Redis.new(db: REDIS_DB.fetch(db)).send(method, KEYS.fetch(key), *args)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/linked_rails.rb
CHANGED
@@ -22,6 +22,10 @@ module LinkedRails
|
|
22
22
|
|
23
23
|
mattr_accessor :whitelisted_spi_ips
|
24
24
|
mattr_writer :host, :scheme
|
25
|
+
mattr_accessor :persistent_redis_database, default: ENV['PERSISTENT_REDIS_DATABASE'].presence || 6
|
26
|
+
mattr_accessor :stream_redis_database, default: ENV['STREAM_REDIS_DATABASE'].presence || 7
|
27
|
+
mattr_accessor :cache_redis_database, default: ENV['CACHE_REDIS_DATABASE'].presence || 8
|
28
|
+
mattr_accessor :cache_stream, default: ENV['CACHE_STREAM'].presence || 'transactions'
|
25
29
|
|
26
30
|
def self.configurable_class(parent, klass, default: nil, reader: nil) # rubocop:disable Metrics/AbcSize
|
27
31
|
method = :"#{[parent, klass.to_s.downcase].compact.join('_')}_class"
|
@@ -84,6 +88,7 @@ ActiveSupport::Inflector.inflections do |inflect|
|
|
84
88
|
inflect.acronym 'SHACL'
|
85
89
|
end
|
86
90
|
|
91
|
+
require 'linked_rails/errors'
|
87
92
|
require 'linked_rails/uri_template'
|
88
93
|
require 'linked_rails/vocab'
|
89
94
|
require 'linked_rails/cache'
|
@@ -101,3 +106,4 @@ require 'linked_rails/routes'
|
|
101
106
|
require 'linked_rails/serializer'
|
102
107
|
require 'linked_rails/translate'
|
103
108
|
require 'linked_rails/railtie'
|
109
|
+
require 'linked_rails/storage'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: linked_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.4.pre.
|
4
|
+
version: 0.0.4.pre.gc3dfc6914
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arthur Dingemans
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-08-
|
11
|
+
date: 2022-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_response
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 1.3.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 1.3.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: kaminari-activerecord
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: redis
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: rdf
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -285,8 +299,10 @@ files:
|
|
285
299
|
- app/policies/linked_rails/collection/view_policy.rb
|
286
300
|
- app/policies/linked_rails/collection_policy.rb
|
287
301
|
- app/policies/linked_rails/enum_value_policy.rb
|
302
|
+
- app/policies/linked_rails/form_policy.rb
|
288
303
|
- app/policies/linked_rails/menus/item_policy.rb
|
289
304
|
- app/policies/linked_rails/menus/list_policy.rb
|
305
|
+
- app/policies/linked_rails/ontology_policy.rb
|
290
306
|
- app/policies/linked_rails/sequence_policy.rb
|
291
307
|
- app/serializers/linked_rails/actions/item_serializer.rb
|
292
308
|
- app/serializers/linked_rails/actions/object_serializer.rb
|
@@ -324,6 +340,7 @@ files:
|
|
324
340
|
- app/serializers/linked_rails/web_page_serializer.rb
|
325
341
|
- app/serializers/linked_rails/web_site_serializer.rb
|
326
342
|
- app/serializers/linked_rails/widget_serializer.rb
|
343
|
+
- app/workers/linked_rails/invalidation_stream_worker.rb
|
327
344
|
- config/initializers/inflections.rb
|
328
345
|
- lib/generators/linked_rails/install/install_generator.rb
|
329
346
|
- lib/generators/linked_rails/install/templates/README
|
@@ -373,6 +390,8 @@ files:
|
|
373
390
|
- lib/linked_rails/enhancements/destroyable/controller.rb
|
374
391
|
- lib/linked_rails/enhancements/updatable/controller.rb
|
375
392
|
- lib/linked_rails/enhancements/updatable/serializer.rb
|
393
|
+
- lib/linked_rails/errors.rb
|
394
|
+
- lib/linked_rails/errors/forbidden.rb
|
376
395
|
- lib/linked_rails/helpers/delta_helper.rb
|
377
396
|
- lib/linked_rails/helpers/ontola_actions_helper.rb
|
378
397
|
- lib/linked_rails/helpers/resource_helper.rb
|
@@ -381,6 +400,7 @@ files:
|
|
381
400
|
- lib/linked_rails/middleware/linked_data_params.rb
|
382
401
|
- lib/linked_rails/model.rb
|
383
402
|
- lib/linked_rails/model/actionable.rb
|
403
|
+
- lib/linked_rails/model/cacheable.rb
|
384
404
|
- lib/linked_rails/model/collections.rb
|
385
405
|
- lib/linked_rails/model/dirty.rb
|
386
406
|
- lib/linked_rails/model/enhancements.rb
|
@@ -404,6 +424,7 @@ files:
|
|
404
424
|
- lib/linked_rails/serializer/actionable.rb
|
405
425
|
- lib/linked_rails/serializer/menuable.rb
|
406
426
|
- lib/linked_rails/serializer/singularable.rb
|
427
|
+
- lib/linked_rails/storage.rb
|
407
428
|
- lib/linked_rails/test_methods.rb
|
408
429
|
- lib/linked_rails/translate.rb
|
409
430
|
- lib/linked_rails/types/iri_type.rb
|