Skip to content

Commit 61155fd

Browse files
authored
Merge pull request #140 from noaccOS/push-mmptuxorplps
chore: forward-port release-1.3
2 parents c7d1221 + 0b9b218 commit 61155fd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+466
-147
lines changed

CHANGELOG.md

Lines changed: 83 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,103 +1,163 @@
11
# Changelog
2+
23
All notable changes to this project will be documented in this file.
34

45
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
56
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
67

78
## [Unreleased]
89

10+
## [1.3.0-rc.1] - 2026-01-23
11+
12+
### Fixed
13+
14+
- BREAKING: Trigger target decoding now returns the headers as a map instead of a list, in
15+
accordance with the typespec
16+
17+
## [1.3.0-rc.0] - 2025-10-20
18+
19+
### Added
20+
21+
- Device capabilities
22+
- Device capability `purge_property_compression_format`
23+
- Add events for device deletion started and finished.
24+
- Add event for device registration.
25+
26+
## [1.2.1] - 2026-03-06
27+
28+
### Fixed
29+
- [astarte_realm_management] Insufficient validation for conflicting options in interface aggregate mappings
30+
[#1072](https://github.com/astarte-platform/astarte/issues/1072)
31+
32+
## [1.2.1-rc.0] - 2025-08-22
33+
### Added
34+
- Allow `to_int` in custom enum types to be called with valid integers
35+
- Allow `from_int` in custom enum types to be called with valid atoms
36+
- Expose a custom `@type` for all structs
37+
- Implement json encoder for `IncomingIntrospectionEvent`
38+
939
## [1.2.0] - 2024-07-01
1040

1141
## [1.2.0-rc.0] - 2024-05-28
42+
1243
### Added
13-
- Function for translating realm to keyspace, to support multiple Astarte
44+
45+
- Function for translating realm to keyspace, to support multiple Astarte
1446
instances sharing the same database
1547
- Added device capabilities
1648
- Added device capability `purge_property_compression_format`
1749

1850
### Changed
51+
1952
- Bump Elixir to 1.15.7.
2053
- Bump Erlang/OTP to 26.1.
2154
- IncomingIntrospectionEvent holds now a interface-name -> {major, minor} map
2255
instead of the plain introspection string.
2356

2457
## [1.1.1] - 2023-10-03
58+
2559
### Fixed
60+
2661
- Handle Cyanide 2.0 binaries correctly. Fix #95.
2762
- Correctly encode binaryblobarrays in JSON payload of Astarte events.
2863

2964
## [1.1.0] - 2023-06-20
65+
3066
### Fixed
67+
3168
- Forward ported changes from 1.0.5 (Do not allow mappings where `database_retention_policy`...)
3269

3370
## [1.1.0-rc.0] - 2023-06-08
71+
3472
### Changed
73+
3574
- Bump Elixir and Erlang to 1.14.5 and 25.3.2, respectively.
3675

3776
## [1.1.0-alpha.0] - 2022-11-14
77+
3878
### Changed
79+
3980
- Extend interface mappings charset to support name prefixed with underscore
4081
- Introspection triggers are part of device triggers. Expose an API closer to other triggers.
4182

4283
## [1.0.6] - 2024-04-18
4384

4485
## [1.0.5] - 2023-09-25
86+
4587
### Fixed
88+
4689
- Do not allow mappings where `database_retention_policy` is
4790
`use_ttl` but no ttl is set. Fix #84.
4891

4992
## [1.0.4] - 2022-09-26
93+
5094
### Added
95+
5196
- Add delivery policies to triggers.
5297

5398
## [1.0.3] - 2022-07-04
5499

55100
## [1.0.2] - 2022-03-29
56101

57102
## [1.0.1] - 2021-12-16
103+
58104
### Added
105+
59106
- Handle array values when decoding simple events
60107

61108
### Fixed
109+
62110
- Don't treat structs as object aggregations when decoding simple events
63111

64112
## [1.0.0] - 2021-06-28
65113

66114
## [1.0.0-rc.0] - 2021-05-05
67115

68116
## [1.0.0-beta.2] - 2021-03-23
117+
69118
### Changed
119+
70120
- Update dependencies and Elixir version to 1.11
71121
- If `database_retention_policy` is set to `:no_ttl`, `database_retention_ttl` must not be set. (See #51)
72122

73123
### Fixed
124+
74125
- Correctly handle SimpleEvents JSON encoding even when they contain an object aggregation with a
75126
binaryblob value.
76127

77128
## [1.0.0-beta.1] - 2021-02-11
129+
78130
### Fixed
131+
79132
- Return an error instead of crashing when the endpoint is not present within a mapping.
80133

81134
## [1.0.0-alpha.1] - 2020-06-18
135+
82136
### Added
137+
83138
- Add `exchange` to `AMQPTriggerTarget` proto. This will allow to send events to any user defined
84139
AMQP exchange (see [#351](https://github.com/astarte-platform/astarte/issues/351)).
85140
- Add additional options to `AMQPTriggerTarget` such as `priority`, `expiration` and `persistent`.
86141
- Add support for device-specific and group-specific triggers.
87142
- Add `DeviceErrorEvent` to `SimpleEvents`, allowing to react to a device error.
88143

89144
### Changed
145+
90146
- It is now possible to omit the `device_id` in a `device_trigger`. This is equivalent to passing
91147
`*` as `device_id`. The old behaviour is still supported.
92148

93149
## [0.11.4] - 2021-01-25
150+
94151
### Fixed
152+
95153
- Correctly handle binaryblob value deserialization in events.
96154

97155
## [0.11.3] - 2020-09-24
98156

99157
## [0.11.2] - 2020-08-14
158+
100159
### Changed
160+
101161
- Test against Elixir 1.8.2.
102162

103163
## [0.11.1] - 2020-05-18
@@ -107,57 +167,78 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
107167
## [0.11.0-rc.1] - 2020-03-25
108168

109169
## [0.11.0-rc.0] - 2020-02-26
170+
110171
### Changed
172+
111173
- Add support for aggregated server owned interfaces.
112174

113175
### Fixed
176+
114177
- Correctly handle parametric endpoints regardless of the ordering, so that overlapping endpoints are always refused. (See #2)
115178

116179
## [0.11.0-beta.2] - 2020-01-24
180+
117181
### Changed
182+
118183
- Restrict the use of `*` as `interface_name` only to `incoming_data` data triggers.
119184
- Allow hyphens in `interface_name`. Both the top level domain and the last domain component
120185
must not contain hyphens. ([#7](https://github.com/astarte-platform/astarte_core/issues/7))
121186

122187
### Fixed
188+
123189
- Handle empty `bson_value` in `Triggers.SimpleEvents.Encoder`, avoiding crashes when an empty bson
124190
value is sent as event (e.g. unset).
125191

126192
## [0.11.0-beta.1] - 2019-12-24
193+
127194
### Changed
195+
128196
- `astarte`, `system` and all names starting with `system_` are now reserved realm names.
129197
- Add `database_retention_policy` and `database_retention_ttl` mapping attributes.
130198

131199
## [0.10.2] - 2019-12-09
200+
132201
### Added
202+
133203
- Add timestamp field to SimpleEvent protobuf.
134204

135205
## [0.10.1] - 2019-10-02
206+
136207
### Fixed
208+
137209
- Fix interface validation: object aggregated properties interfaces are not valid.
138210
- Fix interface validation: server owned object aggregated interfaces are not yet supported, hence not valid.
139211

140212
## [0.10.0] - 2019-04-16
141213

142214
## [0.10.0-rc.0] - 2019-04-03
215+
143216
### Fixed
217+
144218
- Fix endpoint placeholder regex used in Mapping.normalize_endpoint.
145219
- Fix overlapping endpoints detection, it was allowing some corner case overlappings.
146220

147221
## [0.10.0-beta.3] - 2018-12-19
222+
148223
### Changed
224+
149225
- Interface name `device` is reserved now.
150226

151227
### Fixed
228+
152229
- Correctly support Bson.Bin struct.
153230
- False positive overlapping endpoints were detected, EndpointsAutomaton now handles them as valid.
154-
- Correctly serialize triggers on the special "*" interface and device.
231+
- Correctly serialize triggers on the special "\*" interface and device.
155232

156233
## [0.10.0-beta.2] - 2018-10-19
234+
157235
### Added
236+
158237
- Add limit to 64K for string and blobs, 1024 items for arrays.
159238
- Add value validation code for any Astarte type.
160239

161240
## [0.10.0-beta.1] - 2018-08-10
241+
162242
### Added
243+
163244
- First Astarte release.

config/config.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This file is responsible for configuring your application
22
# and its dependencies with the aid of the Mix.Config module.
3-
use Mix.Config
3+
import Config
44

55
# This configuration is loaded before any dependency and is restricted
66
# to this project. If another project depends on this project, this

lib/astarte_core/device/capabilities.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#
2020

2121
defmodule Astarte.Core.Device.Capabilities do
22-
use Ecto.Schema
22+
use TypedEctoSchema
2323
import Ecto.Changeset
2424

2525
alias Astarte.Core.Device.Capabilities
@@ -29,7 +29,7 @@ defmodule Astarte.Core.Device.Capabilities do
2929
@permitted_fields [:purge_properties_compression_format] ++ @required_fields
3030

3131
@primary_key false
32-
embedded_schema do
32+
typed_embedded_schema do
3333
field :purge_properties_compression_format, Ecto.Enum,
3434
values: [zlib: 0, plaintext: 1],
3535
default: :zlib

lib/astarte_core/interface.ex

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,15 +218,17 @@ defmodule Astarte.Core.Interface do
218218

219219
defp validate_all_mappings_have_same_attributes(changeset) do
220220
mappings = get_field(changeset, :mappings, [])
221-
aggregation = get_field(changeset, :aggregation, [])
221+
aggregation = get_field(changeset, :aggregation, :individual)
222222

223223
if aggregation == :object and mappings != [] do
224224
%Mapping{
225225
retention: retention,
226226
reliability: reliability,
227227
expiry: expiry,
228228
allow_unset: allow_unset,
229-
explicit_timestamp: explicit_timestamp
229+
explicit_timestamp: explicit_timestamp,
230+
database_retention_policy: database_retention_policy,
231+
database_retention_ttl: database_retention_ttl
230232
} = List.first(mappings)
231233

232234
all_same_attributes =
@@ -236,12 +238,16 @@ defmodule Astarte.Core.Interface do
236238
reliability: mapping_reliability,
237239
expiry: mapping_expiry,
238240
allow_unset: mapping_allow_unset,
239-
explicit_timestamp: mapping_explicit_timestamp
241+
explicit_timestamp: mapping_explicit_timestamp,
242+
database_retention_policy: mapping_database_retention_policy,
243+
database_retention_ttl: mapping_database_retention_ttl
240244
} = mapping
241245

242246
retention == mapping_retention and reliability == mapping_reliability and
243247
expiry == mapping_expiry and allow_unset == mapping_allow_unset and
244-
explicit_timestamp == mapping_explicit_timestamp
248+
explicit_timestamp == mapping_explicit_timestamp and
249+
database_retention_policy == mapping_database_retention_policy and
250+
database_retention_ttl == mapping_database_retention_ttl
245251
end)
246252

247253
unless all_same_attributes do

lib/astarte_core/proto/astarte_reference.pb.ex

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
defmodule Astarte.Core.AstarteReference do
22
@moduledoc false
33

4-
use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto3
5-
6-
def fully_qualified_name, do: "AstarteReference"
4+
use Protobuf, protoc_gen_elixir_version: "0.15.0", syntax: :proto3
75

86
field :object_type, 1, type: :int32, json_name: "objectType"
97
field :object_uuid, 2, proto3_optional: true, type: :bytes, json_name: "objectUuid"

lib/astarte_core/triggers/policy/handler.ex

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,10 @@ defmodule Astarte.Core.Triggers.Policy.Handler do
115115
strategy: strategy
116116
} = handler
117117

118-
HandlerProto.new(
118+
%HandlerProto{
119119
strategy: Map.get(@strategy_string_to_atom, strategy),
120120
on: error_type_to_tagged_error_tuple(error_type)
121-
)
121+
}
122122
end
123123

124124
def from_handler_proto(%HandlerProto{} = handler_proto) do
@@ -134,12 +134,13 @@ defmodule Astarte.Core.Triggers.Policy.Handler do
134134
end
135135

136136
defp error_type_to_tagged_error_tuple(%Policy.ErrorKeyword{keyword: keyword}) do
137-
{:error_keyword,
138-
ErrorKeywordProto.new(keyword: Map.get(@error_keyword_string_to_atom, keyword))}
137+
error_keyword = %ErrorKeywordProto{keyword: Map.get(@error_keyword_string_to_atom, keyword)}
138+
{:error_keyword, error_keyword}
139139
end
140140

141141
defp error_type_to_tagged_error_tuple(%Policy.ErrorRange{error_codes: codes}) do
142-
{:error_range, ErrorRangeProto.new(error_codes: codes)}
142+
error_range = %ErrorRangeProto{error_codes: codes}
143+
{:error_range, error_range}
143144
end
144145

145146
defp tagged_error_tuple_to_error_type({_, %ErrorKeywordProto{keyword: keyword}}) do

lib/astarte_core/triggers/policy/policy.ex

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ defmodule Astarte.Core.Triggers.Policy do
2828

2929
@required_fields [
3030
:name,
31-
:error_handlers,
3231
:maximum_capacity
3332
]
3433

lib/astarte_core/triggers/policy_protobuf/error_keyword.pb.ex

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
defmodule Astarte.Core.Triggers.PolicyProtobuf.ErrorKeyword.KeywordType do
22
@moduledoc false
33

4-
use Protobuf, enum: true, protoc_gen_elixir_version: "0.11.0", syntax: :proto3
5-
6-
def fully_qualified_name, do: "ErrorKeyword.KeywordType"
4+
use Protobuf, enum: true, protoc_gen_elixir_version: "0.15.0", syntax: :proto3
75

86
field :INVALID, 0
97
field :ANY_ERROR, 1
@@ -14,9 +12,7 @@ end
1412
defmodule Astarte.Core.Triggers.PolicyProtobuf.ErrorKeyword do
1513
@moduledoc false
1614

17-
use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto3
18-
19-
def fully_qualified_name, do: "ErrorKeyword"
15+
use Protobuf, protoc_gen_elixir_version: "0.15.0", syntax: :proto3
2016

2117
field :keyword, 1,
2218
type: Astarte.Core.Triggers.PolicyProtobuf.ErrorKeyword.KeywordType,
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
defmodule Astarte.Core.Triggers.PolicyProtobuf.ErrorRange do
22
@moduledoc false
33

4-
use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto3
5-
6-
def fully_qualified_name, do: "ErrorRange"
4+
use Protobuf, protoc_gen_elixir_version: "0.15.0", syntax: :proto3
75

86
field :error_codes, 1, repeated: true, type: :int32, json_name: "errorCodes"
97
end

0 commit comments

Comments
 (0)