safrano 0.8.7 → 0.8.8
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 +4 -4
- data/lib/core_ext/Hash/transform.rb +3 -5
- data/lib/core_ext/MatchData/matchlen.rb +2 -2
- data/lib/odata/attribute.rb +1 -1
- data/lib/odata/batch.rb +1 -1
- data/lib/odata/collection.rb +1 -1
- data/lib/odata/collection_filter.rb +1 -1
- data/lib/odata/collection_media.rb +2 -2
- data/lib/odata/collection_order.rb +1 -1
- data/lib/odata/complex_type.rb +2 -2
- data/lib/odata/edm/primitive_types.rb +1 -1
- data/lib/odata/expand.rb +3 -3
- data/lib/odata/filter/parse.rb +17 -6
- data/lib/odata/filter/sequel.rb +3 -3
- data/lib/odata/filter/sequel_datetime_adapter.rb +2 -2
- data/lib/odata/filter/sequel_function_adapter.rb +2 -2
- data/lib/odata/filter/token.rb +39 -40
- data/lib/odata/filter/tree.rb +6 -8
- data/lib/odata/function_import.rb +2 -2
- data/lib/odata/model_ext.rb +4 -4
- data/lib/odata/navigation_attribute.rb +2 -2
- data/lib/odata/relations.rb +1 -1
- data/lib/odata/transition.rb +4 -4
- data/lib/safrano/multipart.rb +11 -13
- data/lib/safrano/request.rb +1 -2
- data/lib/safrano/service.rb +8 -5
- data/lib/safrano/type_mapping.rb +1 -1
- data/lib/safrano/version.rb +1 -1
- data/lib/sequel/plugins/join_by_paths.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b92fa13256a9916955424463617069d13f71aefee5fedb3a4fc1c17535874e74
|
|
4
|
+
data.tar.gz: 3bc6d8d42e58d0dca7ba4109238dd042ffb50502969b1dd7f07fe54bcbb7a02e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d0d0bcaa6df005df66eded6b5e4285af6c88896720e40ab1036d18d541d4d58643c8772a146d6187124ba4af61197cbbd74e3a0b452456745d71ac8e4908d0dc
|
|
7
|
+
data.tar.gz: e586938c711020382f7ab4e55f271b7b1094a1b45f13db0cc7c8e82e52c75143087daaa05c362cd02dec150a042bc8493c792bdb0e6ef305ce0746f7933672b9
|
data/lib/odata/attribute.rb
CHANGED
data/lib/odata/batch.rb
CHANGED
data/lib/odata/collection.rb
CHANGED
|
@@ -164,7 +164,7 @@ module Safrano
|
|
|
164
164
|
set_relation_info(@parent, childattrib)
|
|
165
165
|
|
|
166
166
|
@child_method = parent.method(childattrib.to_sym)
|
|
167
|
-
@child_dataset_method = parent.method("#{childattrib}_dataset"
|
|
167
|
+
@child_dataset_method = parent.method(:"#{childattrib}_dataset")
|
|
168
168
|
|
|
169
169
|
@cx = navigated_dataset
|
|
170
170
|
end
|
|
@@ -55,7 +55,7 @@ module Safrano
|
|
|
55
55
|
@filtexpr.map_result! { |f| dtcx.where(f) }
|
|
56
56
|
end
|
|
57
57
|
|
|
58
|
-
#
|
|
58
|
+
# NOTE: this is really only *parse* error, ie the error encounterd while
|
|
59
59
|
# trying to build the AST
|
|
60
60
|
# Later when evaluating the AST, there can be other errors, they shall
|
|
61
61
|
# be tracked with @error
|
|
@@ -4,7 +4,7 @@ require 'rack'
|
|
|
4
4
|
require 'fileutils'
|
|
5
5
|
require 'tempfile'
|
|
6
6
|
require 'pathname'
|
|
7
|
-
require_relative '
|
|
7
|
+
require_relative 'navigation_attribute'
|
|
8
8
|
|
|
9
9
|
module Safrano
|
|
10
10
|
module Media
|
|
@@ -141,7 +141,7 @@ module Safrano
|
|
|
141
141
|
abs_media_directory(entity).children(false).max.to_s
|
|
142
142
|
end
|
|
143
143
|
|
|
144
|
-
#
|
|
144
|
+
# NOTE: add a new Version and remove the previous one
|
|
145
145
|
def replace_file(data:, entity:)
|
|
146
146
|
with_media_directory(entity) do |d|
|
|
147
147
|
tp = Tempfile.open('', @abs_temp_dir) do |temp_file|
|
data/lib/odata/complex_type.rb
CHANGED
|
@@ -132,7 +132,7 @@ module Safrano
|
|
|
132
132
|
# wrapper
|
|
133
133
|
# for OData Entity return them directly
|
|
134
134
|
def self.do_execute_func_result(result, _req, apply_query_params: false)
|
|
135
|
-
#
|
|
135
|
+
# NOTE: Sequel entities instances seem to be thread safe, so we can
|
|
136
136
|
# safely add request-dependant data (eg. req.params) there
|
|
137
137
|
apply_query_params ? result : result.inactive_query_params
|
|
138
138
|
end
|
|
@@ -273,7 +273,7 @@ module Safrano
|
|
|
273
273
|
def self.ComplexType(**props)
|
|
274
274
|
Class.new(Safrano::ComplexType) do
|
|
275
275
|
@props = props
|
|
276
|
-
props.
|
|
276
|
+
props.each_key do |a|
|
|
277
277
|
asym = a.to_sym
|
|
278
278
|
define_method(asym) { @values[asym] }
|
|
279
279
|
define_method("#{a}=") { |val| @values[asym] = val }
|
|
@@ -29,7 +29,7 @@ module Safrano
|
|
|
29
29
|
|
|
30
30
|
DB_TYPE_FLOATP_RGX = /\A\s*(FLOAT)\s*(\(\s*(\d+)\s*\))?\s*\z/i.freeze
|
|
31
31
|
|
|
32
|
-
#
|
|
32
|
+
# NOTE: "char" (quoted!) is postgresql's byte type
|
|
33
33
|
DB_TYPE_INTLIKE_RGX = /\A\s*(smallserial|smallint|integer|int2|int4|int8|int|mediumint|bigint|serial|bigserial|tinyint)\s*/i.freeze
|
|
34
34
|
# used in $metadata
|
|
35
35
|
# cf. Sequel Database column_schema_default_to_ruby_value
|
data/lib/odata/expand.rb
CHANGED
|
@@ -41,13 +41,13 @@ module Safrano
|
|
|
41
41
|
# Recursive array to deep hash
|
|
42
42
|
# [1,2,3,4] --> {1=>{2=>{3=>4}}}
|
|
43
43
|
# [1] --> 1
|
|
44
|
-
DEEPH_0 = ->(inp) { inp.size > 1 ? { inp[0] => DEEPH_0.call(inp[1
|
|
44
|
+
DEEPH_0 = ->(inp) { inp.size > 1 ? { inp[0] => DEEPH_0.call(inp[1..]) } : inp[0] }
|
|
45
45
|
|
|
46
46
|
# used for building output template
|
|
47
47
|
# Recursive array to deep hash
|
|
48
48
|
# [1,2,3,4] --> {1=>{2=>{3=>4}}}
|
|
49
49
|
# [1] --> { 1 => {} }
|
|
50
|
-
DEEPH_1 = ->(inp) { inp.size > 1 ? { inp[0] => DEEPH_1.call(inp[1
|
|
50
|
+
DEEPH_1 = ->(inp) { inp.size > 1 ? { inp[0] => DEEPH_1.call(inp[1..]) } : { inp[0] => {} } }
|
|
51
51
|
|
|
52
52
|
NODESEP = '/'
|
|
53
53
|
|
|
@@ -79,7 +79,7 @@ module Safrano
|
|
|
79
79
|
COMASPLIT = /\s*,\s*/.freeze
|
|
80
80
|
attr_reader :template
|
|
81
81
|
|
|
82
|
-
#
|
|
82
|
+
# NOTE: if you change this method, please also update arity_full_monkey?
|
|
83
83
|
# see below
|
|
84
84
|
def initialize(expandstr, model)
|
|
85
85
|
@model = model
|
data/lib/odata/filter/parse.rb
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative '
|
|
4
|
-
require_relative '
|
|
5
|
-
require_relative '
|
|
3
|
+
require_relative 'token'
|
|
4
|
+
require_relative 'tree'
|
|
5
|
+
require_relative 'error'
|
|
6
6
|
|
|
7
7
|
# top level Safrano namespace
|
|
8
8
|
module Safrano
|
|
@@ -20,6 +20,7 @@ module Safrano
|
|
|
20
20
|
@input = input
|
|
21
21
|
@stack = []
|
|
22
22
|
@binop_stack = []
|
|
23
|
+
@binop_stack_markers = []
|
|
23
24
|
end
|
|
24
25
|
|
|
25
26
|
def server_error
|
|
@@ -63,6 +64,13 @@ module Safrano
|
|
|
63
64
|
@error = ErrorUnmatchedClose.new(tok, typ, @cursor)
|
|
64
65
|
end
|
|
65
66
|
|
|
67
|
+
def scoped_prev_binop
|
|
68
|
+
base = @binop_stack_markers.last || 0
|
|
69
|
+
return nil if @binop_stack.length <= base
|
|
70
|
+
|
|
71
|
+
@binop_stack.last
|
|
72
|
+
end
|
|
73
|
+
|
|
66
74
|
def with_accepted(tok, typ)
|
|
67
75
|
(err = @cursor.accept?(tok, typ)) ? (@error = err) : yield
|
|
68
76
|
end
|
|
@@ -81,16 +89,19 @@ module Safrano
|
|
|
81
89
|
unless @error
|
|
82
90
|
openarg = ArgTree.new('(')
|
|
83
91
|
@stack << openarg
|
|
92
|
+
@binop_stack_markers << @binop_stack.length
|
|
84
93
|
grow_at_cursor(openarg)
|
|
85
94
|
end
|
|
86
95
|
end
|
|
87
96
|
|
|
88
97
|
when ')'
|
|
98
|
+
mark_len = @binop_stack_markers.pop
|
|
89
99
|
break invalid_closing_delimiter_error(tok, typ) unless (@cursor = @stack.pop)
|
|
90
100
|
|
|
91
101
|
with_accepted(tok, typ) do
|
|
92
102
|
@cursor.update_state(tok, typ)
|
|
93
103
|
cursor_at_parent
|
|
104
|
+
@binop_stack.slice!(mark_len..)
|
|
94
105
|
end
|
|
95
106
|
end
|
|
96
107
|
|
|
@@ -101,7 +112,7 @@ module Safrano
|
|
|
101
112
|
|
|
102
113
|
when :UnopTree
|
|
103
114
|
unoptr = UnopTree.new(tok)
|
|
104
|
-
if (prev =
|
|
115
|
+
if (prev = scoped_prev_binop)
|
|
105
116
|
# handling of lower precedence binding vs the other
|
|
106
117
|
# ones(le,gt,eq...)
|
|
107
118
|
unless prev.precedence < unoptr.precedence
|
|
@@ -116,7 +127,7 @@ module Safrano
|
|
|
116
127
|
when :BinopBool
|
|
117
128
|
with_accepted(tok, typ) do
|
|
118
129
|
binoptr = BinopBool.new(tok)
|
|
119
|
-
if (prev =
|
|
130
|
+
if (prev = scoped_prev_binop)
|
|
120
131
|
# handling of lower precedence binding vs the other
|
|
121
132
|
# ones(le,gt,eq...)
|
|
122
133
|
unless prev.precedence < binoptr.precedence
|
|
@@ -132,7 +143,7 @@ module Safrano
|
|
|
132
143
|
when :BinopArithm
|
|
133
144
|
with_accepted(tok, typ) do
|
|
134
145
|
binoptr = BinopArithm.new(tok)
|
|
135
|
-
if (prev =
|
|
146
|
+
if (prev = scoped_prev_binop)
|
|
136
147
|
# handling of lower precedence binding vs the other
|
|
137
148
|
# ones(le,gt,eq...)
|
|
138
149
|
unless prev.precedence < binoptr.precedence
|
data/lib/odata/filter/sequel.rb
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative '
|
|
4
|
-
require_relative '
|
|
5
|
-
require_relative '
|
|
3
|
+
require_relative 'base'
|
|
4
|
+
require_relative 'sequel_function_adapter'
|
|
5
|
+
require_relative 'sequel_datetime_adapter'
|
|
6
6
|
module Safrano
|
|
7
7
|
module Filter
|
|
8
8
|
# Base class for Leaves, Trees, RootTrees etc
|
data/lib/odata/filter/token.rb
CHANGED
|
@@ -31,48 +31,47 @@ module Safrano
|
|
|
31
31
|
|
|
32
32
|
inp.scan(RGX) do |groups|
|
|
33
33
|
groups.each_with_index do |tok, i|
|
|
34
|
-
|
|
34
|
+
next unless tok
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
end
|
|
48
|
-
when 3
|
|
49
|
-
:BinopBool
|
|
50
|
-
when 4
|
|
51
|
-
:BinopArithm
|
|
52
|
-
when 5
|
|
53
|
-
:UnopTree
|
|
54
|
-
when 6
|
|
55
|
-
:QString
|
|
56
|
-
when 7
|
|
57
|
-
:DecimalLit
|
|
58
|
-
when 8
|
|
59
|
-
:FPNumber
|
|
60
|
-
when 9
|
|
61
|
-
:Qualit
|
|
62
|
-
when 10
|
|
63
|
-
:DateTimeLit
|
|
64
|
-
when 11
|
|
65
|
-
:DateTimeOffsetLit
|
|
66
|
-
when 12
|
|
67
|
-
:GuidLit
|
|
68
|
-
when 13
|
|
69
|
-
:Literal
|
|
70
|
-
when 14
|
|
71
|
-
:unmatchedQuote
|
|
36
|
+
typ = case i
|
|
37
|
+
when 0
|
|
38
|
+
:FuncTree
|
|
39
|
+
when 1
|
|
40
|
+
:NullLiteral
|
|
41
|
+
when 2
|
|
42
|
+
case tok
|
|
43
|
+
when '(', ')'
|
|
44
|
+
:Delimiter
|
|
45
|
+
when ','
|
|
46
|
+
:Separator
|
|
72
47
|
end
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
48
|
+
when 3
|
|
49
|
+
:BinopBool
|
|
50
|
+
when 4
|
|
51
|
+
:BinopArithm
|
|
52
|
+
when 5
|
|
53
|
+
:UnopTree
|
|
54
|
+
when 6
|
|
55
|
+
:QString
|
|
56
|
+
when 7
|
|
57
|
+
:DecimalLit
|
|
58
|
+
when 8
|
|
59
|
+
:FPNumber
|
|
60
|
+
when 9
|
|
61
|
+
:Qualit
|
|
62
|
+
when 10
|
|
63
|
+
:DateTimeLit
|
|
64
|
+
when 11
|
|
65
|
+
:DateTimeOffsetLit
|
|
66
|
+
when 12
|
|
67
|
+
:GuidLit
|
|
68
|
+
when 13
|
|
69
|
+
:Literal
|
|
70
|
+
when 14
|
|
71
|
+
:unmatchedQuote
|
|
72
|
+
end
|
|
73
|
+
yield tok, typ
|
|
74
|
+
break
|
|
76
75
|
end
|
|
77
76
|
end
|
|
78
77
|
end
|
data/lib/odata/filter/tree.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative '
|
|
4
|
-
require_relative '
|
|
3
|
+
require_relative 'base'
|
|
4
|
+
require_relative 'error'
|
|
5
5
|
|
|
6
6
|
module Safrano
|
|
7
7
|
module Filter
|
|
@@ -314,19 +314,17 @@ module Safrano
|
|
|
314
314
|
case typ
|
|
315
315
|
when :Delimiter
|
|
316
316
|
if @value == '(' && tok == ')' && @state != :closed
|
|
317
|
-
if
|
|
317
|
+
if @parent.instance_of?(IdentityFuncTree) ||
|
|
318
318
|
@parent.arity_full?(@children.size)
|
|
319
319
|
|
|
320
320
|
nil
|
|
321
321
|
else
|
|
322
322
|
Parser::ErrorInvalidArity.new(tok, typ, self)
|
|
323
323
|
end
|
|
324
|
+
elsif @value == '(' && tok == '(' && @state == :open
|
|
325
|
+
nil
|
|
324
326
|
else
|
|
325
|
-
|
|
326
|
-
nil
|
|
327
|
-
else
|
|
328
|
-
Parser::ErrorUnmatchedClose.new(tok, typ, self)
|
|
329
|
-
end
|
|
327
|
+
Parser::ErrorUnmatchedClose.new(tok, typ, self)
|
|
330
328
|
end
|
|
331
329
|
when :Separator
|
|
332
330
|
if @value == '(' && tok == ',' && @state == :val
|
|
@@ -135,7 +135,7 @@ module Safrano
|
|
|
135
135
|
|
|
136
136
|
def check_missing_params
|
|
137
137
|
# do we have all parameters provided ? use Set difference to check
|
|
138
|
-
pkeys = @params.keys.
|
|
138
|
+
pkeys = @params.keys.to_set(&:to_sym)
|
|
139
139
|
if (idiff = @input.keys.to_set - pkeys).empty?
|
|
140
140
|
Contract::OK
|
|
141
141
|
else
|
|
@@ -217,7 +217,7 @@ module Safrano
|
|
|
217
217
|
# (application-)error handling
|
|
218
218
|
# the result is an Error object or class
|
|
219
219
|
|
|
220
|
-
#
|
|
220
|
+
# NOTE: Sequel::Error exceptions are already
|
|
221
221
|
# handled on rack app level (cf. the call methode )
|
|
222
222
|
Safrano.with_error(result) do |error|
|
|
223
223
|
@error = error
|
data/lib/odata/model_ext.rb
CHANGED
|
@@ -452,9 +452,9 @@ module Safrano
|
|
|
452
452
|
if metadata[:edm_type] == 'Edm.Guid'
|
|
453
453
|
props = db_schema[primary_key]
|
|
454
454
|
@pk_castfunc = if props[:type] == :blob # Edm.Guid but as 16 byte binary Blob on DB level, eg in Sqlite
|
|
455
|
-
|
|
455
|
+
->(x) { "guid'#{UUIDTools::UUID.parse_raw(x)}'" unless x.nil? }
|
|
456
456
|
else
|
|
457
|
-
|
|
457
|
+
->(x) { "guid'#{x}'" unless x.nil? }
|
|
458
458
|
end
|
|
459
459
|
else
|
|
460
460
|
@pk_castfunc = @casted_cols[primary_key]
|
|
@@ -512,7 +512,7 @@ module Safrano
|
|
|
512
512
|
@odata_upk_parts = odata_upk_build.join(',').split('?')
|
|
513
513
|
|
|
514
514
|
# regex parts for unordered matching
|
|
515
|
-
@iuk_rgx_parts = primary_key.
|
|
515
|
+
@iuk_rgx_parts = primary_key.to_h do |pk|
|
|
516
516
|
kvpredicate = case db_schema[pk][:type]
|
|
517
517
|
when :integer
|
|
518
518
|
'(\\d+)'
|
|
@@ -520,7 +520,7 @@ module Safrano
|
|
|
520
520
|
"'(\\w+)'"
|
|
521
521
|
end
|
|
522
522
|
[pk, "#{pk}=#{kvpredicate}"]
|
|
523
|
-
end
|
|
523
|
+
end
|
|
524
524
|
|
|
525
525
|
# single regex assuming the key fields are ordered !
|
|
526
526
|
@iuk_rgx = /\A#{@iuk_rgx_parts.values.join(',\s*')}\z/
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require 'json'
|
|
4
4
|
require_relative '../safrano/core'
|
|
5
|
-
require_relative '
|
|
5
|
+
require_relative 'entity'
|
|
6
6
|
|
|
7
7
|
module Safrano
|
|
8
8
|
# remove the relation between entity and parent by clearing
|
|
@@ -28,7 +28,7 @@ module Safrano
|
|
|
28
28
|
def self.create_nav_relation(child, assoc, parent)
|
|
29
29
|
return unless assoc
|
|
30
30
|
|
|
31
|
-
#
|
|
31
|
+
# NOTE: this coding shares some bits from our sequel/plugins/join_by_paths,
|
|
32
32
|
# method build_unique_join_segments
|
|
33
33
|
# eventually there is an opportunity to have more reusable code here
|
|
34
34
|
case assoc[:type]
|
data/lib/odata/relations.rb
CHANGED
data/lib/odata/transition.rb
CHANGED
|
@@ -34,12 +34,12 @@ module Safrano
|
|
|
34
34
|
match_len = -1
|
|
35
35
|
tres_next = nil
|
|
36
36
|
|
|
37
|
-
@allowed_transitions.each
|
|
37
|
+
@allowed_transitions.each do |t|
|
|
38
38
|
if (res = t.longer_match(path_remain, match_len))
|
|
39
39
|
tres_next = res
|
|
40
40
|
match_len = tres_next.match_length
|
|
41
41
|
end
|
|
42
|
-
|
|
42
|
+
end
|
|
43
43
|
tres_next
|
|
44
44
|
end
|
|
45
45
|
end
|
|
@@ -56,12 +56,12 @@ module Safrano
|
|
|
56
56
|
match_len = -1
|
|
57
57
|
tres_next = nil
|
|
58
58
|
|
|
59
|
-
allowed_transitions.each
|
|
59
|
+
allowed_transitions.each do |t|
|
|
60
60
|
if (res = t.longer_match(path_remain, match_len))
|
|
61
61
|
tres_next = res
|
|
62
62
|
match_len = tres_next.match_length
|
|
63
63
|
end
|
|
64
|
-
|
|
64
|
+
end
|
|
65
65
|
tres_next
|
|
66
66
|
end
|
|
67
67
|
end
|
data/lib/safrano/multipart.rb
CHANGED
|
@@ -58,7 +58,7 @@ module MIME
|
|
|
58
58
|
if (hmd = HMD_RGX.match(line))
|
|
59
59
|
@target_hd[hmd[1].downcase] = hmd[2].strip
|
|
60
60
|
|
|
61
|
-
elsif
|
|
61
|
+
elsif line == CRLF
|
|
62
62
|
@target_ct = @target_hd[CTT_TYPE_LC] || TEXT_PLAIN
|
|
63
63
|
@state = new_content
|
|
64
64
|
|
|
@@ -118,7 +118,7 @@ module MIME
|
|
|
118
118
|
def new_content
|
|
119
119
|
@target =
|
|
120
120
|
if @target_ct.start_with?(MPS) &&
|
|
121
|
-
(md = (MP_RGX1.match(@target_ct[10
|
|
121
|
+
(md = (MP_RGX1.match(@target_ct[10..]) || MP_RGX2.match(@target_ct[10..])))
|
|
122
122
|
multipart_content(md[2].strip)
|
|
123
123
|
elsif @target_ct.start_with?(APP_HTTP)
|
|
124
124
|
MIME::Content::Application::Http.new
|
|
@@ -211,7 +211,7 @@ module MIME
|
|
|
211
211
|
def parse_head(line)
|
|
212
212
|
if (hmd = HMD_RGX.match(line))
|
|
213
213
|
@target.hd[hmd[1].downcase] = hmd[2].strip
|
|
214
|
-
elsif
|
|
214
|
+
elsif line == CRLF
|
|
215
215
|
@state = :b
|
|
216
216
|
else
|
|
217
217
|
@target.content << line
|
|
@@ -383,15 +383,13 @@ module MIME
|
|
|
383
383
|
# of the changes
|
|
384
384
|
|
|
385
385
|
full_req.db.transaction do
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
raise
|
|
394
|
-
end
|
|
386
|
+
@response.content = @content.map { |part| part.get_response(full_req) }
|
|
387
|
+
rescue Sequel::Rollback => e
|
|
388
|
+
# one of the changes of the changeset has failed
|
|
389
|
+
# --> provide a dummy empty response for the change-parts
|
|
390
|
+
# then transmit the Rollback to Sequel
|
|
391
|
+
get_failed_changeset_response(e)
|
|
392
|
+
raise
|
|
395
393
|
end
|
|
396
394
|
else
|
|
397
395
|
@response.content = @content.map { |part| part.get_response(full_req) }
|
|
@@ -528,7 +526,7 @@ module MIME
|
|
|
528
526
|
def parse_head(line)
|
|
529
527
|
if (hmd = HMD_RGX.match(line))
|
|
530
528
|
@target.content.hd[hmd[1].downcase] = hmd[2].strip
|
|
531
|
-
elsif
|
|
529
|
+
elsif line == CRLF
|
|
532
530
|
@state = :b
|
|
533
531
|
else
|
|
534
532
|
@body_lines << line
|
data/lib/safrano/request.rb
CHANGED
|
@@ -224,14 +224,13 @@ module Safrano
|
|
|
224
224
|
end
|
|
225
225
|
|
|
226
226
|
def accept
|
|
227
|
-
@env['safrano.accept'] ||=
|
|
227
|
+
@env['safrano.accept'] ||=
|
|
228
228
|
if @env.include?('HTTP_ACCEPT') && (@env['HTTP_ACCEPT'].to_s != '')
|
|
229
229
|
@env['HTTP_ACCEPT'].to_s.scan(HEADER_VAL_WITH_PAR)
|
|
230
230
|
.map! { |e| AcceptEntry.new(e) }.sort
|
|
231
231
|
else
|
|
232
232
|
[AcceptEntry.new('*/*')]
|
|
233
233
|
end
|
|
234
|
-
end
|
|
235
234
|
end
|
|
236
235
|
|
|
237
236
|
def accept?(type)
|
data/lib/safrano/service.rb
CHANGED
|
@@ -166,7 +166,10 @@ module Safrano
|
|
|
166
166
|
FINAL_TEMPLATE_FUNC_DEFAULT = ->(_template) {}
|
|
167
167
|
FINAL_TEMPLATE_FUNC_SKIP_META = ->(template) { template.delete(:meta) }
|
|
168
168
|
FINAL_TEMPLATE_FUNC_SKIP_DEFERR = ->(template) { template.delete(:deferr) }
|
|
169
|
-
FINAL_TEMPLATE_FUNC_SKIP_META_DEFERR =
|
|
169
|
+
FINAL_TEMPLATE_FUNC_SKIP_META_DEFERR = lambda do |template|
|
|
170
|
+
template.delete(:meta)
|
|
171
|
+
template.delete(:deferr)
|
|
172
|
+
end
|
|
170
173
|
|
|
171
174
|
def self.app_setup_singleton
|
|
172
175
|
@app_setup_singleton
|
|
@@ -185,7 +188,7 @@ module Safrano
|
|
|
185
188
|
# enabled per default starting from 0.6
|
|
186
189
|
@xbugfix_create_response = true
|
|
187
190
|
klass = self.class
|
|
188
|
-
# TODO better error
|
|
191
|
+
# TODO: better error
|
|
189
192
|
raise StandardError unless (klass.publish_proc or template_instance)
|
|
190
193
|
|
|
191
194
|
tmpli = if template_instance
|
|
@@ -291,14 +294,14 @@ module Safrano
|
|
|
291
294
|
(@v2.server_url(surl)) if @v2
|
|
292
295
|
end
|
|
293
296
|
|
|
294
|
-
VALID_RESP_FORMAT_OPTS = [
|
|
297
|
+
VALID_RESP_FORMAT_OPTS = %i[skip_deferred skip_metadata].freeze
|
|
295
298
|
def valid_resp_format_options(*args)
|
|
296
299
|
raise API::InvalidRespFormatOption.new(args) unless args
|
|
297
300
|
|
|
298
301
|
args.map!(&:to_sym)
|
|
299
|
-
args.each
|
|
302
|
+
args.each do |arg|
|
|
300
303
|
raise API::InvalidRespFormatOption.new(arg) unless VALID_RESP_FORMAT_OPTS.include?(arg)
|
|
301
|
-
|
|
304
|
+
end
|
|
302
305
|
yield(args)
|
|
303
306
|
end
|
|
304
307
|
|
data/lib/safrano/type_mapping.rb
CHANGED
data/lib/safrano/version.rb
CHANGED
|
@@ -138,8 +138,8 @@ class JoinByPathsHelper < Set
|
|
|
138
138
|
result_ = []
|
|
139
139
|
|
|
140
140
|
# in case of multiple many_to_many rels, we need differing through aliases
|
|
141
|
-
many_to_many_count
|
|
142
|
-
through_alias = "t#{many_to_many_count}"
|
|
141
|
+
many_to_many_count += 1
|
|
142
|
+
through_alias = :"t#{many_to_many_count}"
|
|
143
143
|
|
|
144
144
|
# For many_to_many first we add the join with assigment table
|
|
145
145
|
lks_ = [assoc[:left_primary_key]].flatten
|
|
@@ -242,7 +242,7 @@ module Sequel
|
|
|
242
242
|
@aliases_sym[pstr]
|
|
243
243
|
else
|
|
244
244
|
@alias_cnt += 1
|
|
245
|
-
@aliases_sym[pstr] = "a#{@alias_cnt}"
|
|
245
|
+
@aliases_sym[pstr] = :"a#{@alias_cnt}"
|
|
246
246
|
end
|
|
247
247
|
end
|
|
248
248
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: safrano
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.8.
|
|
4
|
+
version: 0.8.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- oz
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-11-
|
|
11
|
+
date: 2025-11-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rack
|