event_store_client 0.2.1 → 0.2.2
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/README.md +8 -0
- data/lib/event_store_client/data_decryptor.rb +1 -1
- data/lib/event_store_client/data_encryptor.rb +1 -1
- data/lib/event_store_client/encryption_metadata.rb +1 -1
- data/lib/event_store_client/mapper/encrypted.rb +3 -3
- data/lib/event_store_client/store_adapter/api/client.rb +4 -3
- data/lib/event_store_client/store_adapter/api/connection.rb +7 -4
- data/lib/event_store_client/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c833953b7c234efb592ba1c80b0b1ad920d6edfa38f712b4e0bd666c1a600a16
|
4
|
+
data.tar.gz: 56236d43242019d752ecf48243df4b077974deb41161017e5ecddbf60a120a45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 544fa64532df3c80581d1c972e96cb31d7c2cce68a056dc59165eff59df19f607e62b4b28b61eeb6ba88449a3a739227d0e1c6ffe32327ca0abe89aac325ac07
|
7
|
+
data.tar.gz: 597a9a467cf339289cea538953f42ca065324b755a8d7f3d01fa401b96bf4f567254956a66f8dec89020b86fb13423bec2925507c004147c097e7cf3e1ec054e
|
data/README.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+

|
2
|
+
[](https://badge.fury.io/rb/event_store_client)
|
3
|
+
|
1
4
|
# EventStoreClient
|
2
5
|
|
3
6
|
An easy-to use API client for connecting ruby applications with https://eventstore.org/
|
@@ -252,6 +255,11 @@ Do you want to contribute? Welcome!
|
|
252
255
|
2. Create Issue
|
253
256
|
3. Create PR ;)
|
254
257
|
|
258
|
+
### Publishing new version
|
259
|
+
|
260
|
+
1. Push commit with updated `version.rb` file to the `release` branch. The new version will be automatically pushed to [rubygems](https://rubygems.org).
|
261
|
+
2. Create release on github including change log.
|
262
|
+
|
255
263
|
## License
|
256
264
|
|
257
265
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
@@ -28,7 +28,7 @@ module EventStoreClient
|
|
28
28
|
|
29
29
|
def decrypt_attributes(key:, data:, attributes:)
|
30
30
|
decrypted_text = key_repository.decrypt(
|
31
|
-
key_id: key.id, text: data[
|
31
|
+
key_id: key.id, text: data['es_encrypted'], cipher: key.cipher, iv: key.iv
|
32
32
|
)
|
33
33
|
decrypted = JSON.parse(decrypted_text).transform_keys(&:to_s)
|
34
34
|
decrypted.each { |key, value| data[key] = value if data.key?(key) }
|
@@ -26,13 +26,13 @@ module EventStoreClient
|
|
26
26
|
event.class.respond_to?(:encryption_schema) &&
|
27
27
|
event.class.encryption_schema
|
28
28
|
)
|
29
|
-
encryptor = DataEncryptor.new(
|
29
|
+
encryptor = EventStoreClient::DataEncryptor.new(
|
30
30
|
data: event.data,
|
31
31
|
schema: encryption_schema,
|
32
32
|
repository: key_repository
|
33
33
|
)
|
34
34
|
encryptor.call
|
35
|
-
Event.new(
|
35
|
+
EventStoreClient::Event.new(
|
36
36
|
data: serializer.serialize(encryptor.encrypted_data),
|
37
37
|
metadata: serializer.serialize(
|
38
38
|
event.metadata.merge(encryption: encryptor.encryption_metadata)
|
@@ -52,7 +52,7 @@ module EventStoreClient
|
|
52
52
|
def deserialize(event)
|
53
53
|
metadata = serializer.deserialize(event.metadata)
|
54
54
|
encryption_schema = serializer.deserialize(event.metadata)['encryption']
|
55
|
-
decrypted_data = DataDecryptor.new(
|
55
|
+
decrypted_data = EventStoreClient::DataDecryptor.new(
|
56
56
|
data: serializer.deserialize(event.data),
|
57
57
|
schema: encryption_schema,
|
58
58
|
repository: key_repository
|
@@ -115,11 +115,12 @@ module EventStoreClient
|
|
115
115
|
|
116
116
|
private
|
117
117
|
|
118
|
-
attr_reader :endpoint, :per_page
|
118
|
+
attr_reader :endpoint, :per_page, :connection_options
|
119
119
|
|
120
|
-
def initialize(host:, port:, per_page: 20)
|
120
|
+
def initialize(host:, port:, per_page: 20, connection_options: {})
|
121
121
|
@endpoint = Endpoint.new(host: host, port: port)
|
122
122
|
@per_page = per_page
|
123
|
+
@connection_options = connection_options
|
123
124
|
end
|
124
125
|
|
125
126
|
def build_events_data(events)
|
@@ -153,7 +154,7 @@ module EventStoreClient
|
|
153
154
|
end
|
154
155
|
|
155
156
|
def connection
|
156
|
-
@connection ||= Api::Connection.new(endpoint).call
|
157
|
+
@connection ||= Api::Connection.new(endpoint, connection_options).call
|
157
158
|
end
|
158
159
|
|
159
160
|
def validate_response(resp, expected_version)
|
@@ -8,8 +8,10 @@ module EventStoreClient
|
|
8
8
|
class Connection
|
9
9
|
def call
|
10
10
|
Faraday.new(
|
11
|
-
|
12
|
-
|
11
|
+
{
|
12
|
+
url: endpoint.url,
|
13
|
+
headers: DEFAULT_HEADERS
|
14
|
+
}.merge(options)
|
13
15
|
) do |conn|
|
14
16
|
conn.basic_auth(ENV['EVENT_STORE_USER'], ENV['EVENT_STORE_PASSWORD'])
|
15
17
|
conn.adapter Faraday.default_adapter
|
@@ -18,11 +20,12 @@ module EventStoreClient
|
|
18
20
|
|
19
21
|
private
|
20
22
|
|
21
|
-
def initialize(endpoint)
|
23
|
+
def initialize(endpoint, options = {})
|
22
24
|
@endpoint = endpoint
|
25
|
+
@options = options
|
23
26
|
end
|
24
27
|
|
25
|
-
attr_reader :endpoint
|
28
|
+
attr_reader :endpoint, :options
|
26
29
|
|
27
30
|
DEFAULT_HEADERS = {
|
28
31
|
'Content-Type' => 'application/vnd.eventstore.events+json'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: event_store_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastian Wilgosz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-schema
|
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
148
|
- !ruby/object:Gem::Version
|
149
149
|
version: '0'
|
150
150
|
requirements: []
|
151
|
-
rubygems_version: 3.0.
|
151
|
+
rubygems_version: 3.0.4
|
152
152
|
signing_key:
|
153
153
|
specification_version: 4
|
154
154
|
summary: Ruby integration for https://eventstore.org
|