cel 0.6.0 → 0.6.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 +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/cel/ast/elements/literal.rb +1 -1
- data/lib/cel/ast/elements/protobuf.rb +39 -9
- data/lib/cel/program.rb +2 -0
- data/lib/cel/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d6d9641e7b6b5cd40bda6d81519f89e9b5bd8e7d8d595306291e6d470ed3aa3c
|
|
4
|
+
data.tar.gz: 55490419080cc9eba65d907a99001deb7b3fbed08f1fc815e3dba293969162b8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 222160a59e461b0b0b6166fc839edb760b8b696a935c0471cae0f3437d1049215777a613cf9840e4fbd2c85c91fc80798e142de963ad0523eff9e586c9a53bd2
|
|
7
|
+
data.tar.gz: 6abacc2f4aa0be7f74af0f44fec56bbfb57ccb770f60bb0072aa5334ed9381c7bb75447f948cf85278b40f42714f44139e9a3b6cfc6634e116ba6e821ea54961
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [0.6.1] - 2026-07-27
|
|
4
|
+
|
|
5
|
+
* parser: enabled support for declaring CEL messages inside a CEL list.
|
|
6
|
+
* protobuf: don't convert primitive types onto protobuf values if the result is from an unexpected type.
|
|
7
|
+
* protobuf: workaround internal conversions of `Google::Protobuf::Map` into a hash, due to its incompatible block-less implementation of `#to_h`.
|
|
8
|
+
* protobuf: fix initialization of a proto fied with repeated values.
|
|
9
|
+
|
|
3
10
|
## [0.6.0] - 2026-02-28
|
|
4
11
|
|
|
5
12
|
### Features
|
|
@@ -16,7 +16,7 @@ module Cel
|
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
case val
|
|
19
|
-
when Literal, Identifier, Invoke, Operation, Condition, Group, # already cel
|
|
19
|
+
when Literal, Message, Identifier, Invoke, Operation, Condition, Group, # already cel
|
|
20
20
|
Protobuf.enum_class # already a usable class a la protobuf
|
|
21
21
|
val
|
|
22
22
|
when Protobuf.map_class
|
|
@@ -282,13 +282,39 @@ module Cel
|
|
|
282
282
|
|
|
283
283
|
next([key, value]) unless field_subtype
|
|
284
284
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
285
|
+
if field_descriptor.label == :repeated
|
|
286
|
+
value = case value
|
|
287
|
+
when Hash
|
|
288
|
+
key_type, value_type = field_subtype.msgclass.descriptor.map(&:subtype)
|
|
289
|
+
value.filter_map do |k, v|
|
|
290
|
+
kconv = key_type && !k.is_a?(key_type.msgclass) ?
|
|
291
|
+
convert_to_proto(key_type.msgclass, k, convert_value_to_proto: true) :
|
|
292
|
+
k
|
|
293
|
+
vconv = value_type && !v.is_a?(value_type.msgclass) ?
|
|
294
|
+
convert_to_proto(value_type.msgclass, v, convert_value_to_proto: true) :
|
|
295
|
+
v
|
|
296
|
+
|
|
297
|
+
next unless vconv
|
|
298
|
+
|
|
299
|
+
[kconv, vconv]
|
|
300
|
+
end.to_h
|
|
301
|
+
else
|
|
302
|
+
# Array
|
|
303
|
+
value.filter_map do |v|
|
|
304
|
+
if v.is_a?(field_subtype.msgclass)
|
|
305
|
+
v
|
|
306
|
+
else
|
|
307
|
+
convert_to_proto(field_subtype.msgclass, v, convert_value_to_proto: true)
|
|
308
|
+
end
|
|
309
|
+
end
|
|
310
|
+
end
|
|
311
|
+
else
|
|
312
|
+
unless value.is_a?(field_subtype.msgclass)
|
|
313
|
+
value = convert_to_proto(field_subtype.msgclass, value, convert_value_to_proto: true)
|
|
314
|
+
end
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
[key, value]
|
|
292
318
|
end
|
|
293
319
|
|
|
294
320
|
# protobuf sets maps as abstract classes, and there's apparently no way to identify them
|
|
@@ -298,7 +324,11 @@ module Cel
|
|
|
298
324
|
|
|
299
325
|
proto_type.new(values)
|
|
300
326
|
elsif values.nil?
|
|
301
|
-
Google::Protobuf::Value.from_ruby(values)
|
|
327
|
+
v = Google::Protobuf::Value.from_ruby(values)
|
|
328
|
+
|
|
329
|
+
return if proto_type && !v.is_a?(proto_type)
|
|
330
|
+
|
|
331
|
+
v
|
|
302
332
|
else
|
|
303
333
|
proto_type.new(value: values)
|
|
304
334
|
end
|
|
@@ -340,7 +370,7 @@ module Cel
|
|
|
340
370
|
when :repeated
|
|
341
371
|
case value
|
|
342
372
|
when Google::Protobuf::Map
|
|
343
|
-
value.
|
|
373
|
+
value.map { |k, v| [k, convert_from_proto_field_type(field, v)] }.to_h
|
|
344
374
|
else
|
|
345
375
|
value.map { |v| convert_from_proto_field_type(field, v) }
|
|
346
376
|
end
|
data/lib/cel/program.rb
CHANGED
data/lib/cel/version.rb
CHANGED