evt-message_store 2.3.0.2 → 2.3.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 10704ac2544b2ef44429b0e55c4c44ccc78fe460c141b1927997b00d7d2dea75
4
- data.tar.gz: b217d7aa1b18943f71cfb8c450c3820da418ec6c465acfe23c02cf948563a925
3
+ metadata.gz: 0275af52a5677309393ba2fe0a1447042e32c9b586864eaba2b99b661f188607
4
+ data.tar.gz: f69ddf11f2594d75fdaa0711f099d0684bf2d240fd61a5cf76735f848ce91425
5
5
  SHA512:
6
- metadata.gz: a898788cd605db367f529f2f750899b40cf164908ee8297c0e3e3e092c246953704a2021be8a25c5b9ace959b14a82536184f641228b6845cb7a49ee3ba2730c
7
- data.tar.gz: 0272bc2fe2995e8448ccaee0e452037782a03581c0b77844233d27eaec2614971c2625959409c68b273a2027df7609a683ffb52ab21e179b41e075f0ed8203d0
6
+ metadata.gz: 33d403b5079967fa053ed4cc74c49486ae7dd64166407cf26cfdc078d2524afa34ee67a0da085eae3468241d1c88eead55ad2ade6f0a3f5cf788d1a383173cba
7
+ data.tar.gz: 057bf4f68b0ca75f1f5cba5bbfe82b031c147e0f2ec2c24c368bf094db46183b54f9c176764b8d961680ce86f2c5d6100910a434748834f273f9958430dd7a5c
@@ -11,11 +11,13 @@ require 'async_invocation'
11
11
 
12
12
  require 'message_store/expected_version'
13
13
  require 'message_store/no_stream'
14
+ require 'message_store/id'
15
+ require 'message_store/stream_name'
16
+
14
17
  require 'message_store/message_data'
15
18
  require 'message_store/message_data/hash/transform'
16
19
  require 'message_store/message_data/write'
17
20
  require 'message_store/message_data/read'
18
- require 'message_store/stream_name'
19
21
 
20
22
  require 'message_store/log'
21
23
 
@@ -0,0 +1,45 @@
1
+ module MessageStore
2
+ module ID
3
+ Error = Class.new(RuntimeError)
4
+
5
+ def self.compound_id_separator
6
+ '+'
7
+ end
8
+
9
+ def self.id(id)
10
+ if id.is_a?(Array)
11
+ id = compound_id(id)
12
+ else
13
+ if id.nil?
14
+ raise Error, "ID must not be omitted"
15
+ end
16
+ end
17
+
18
+ id
19
+ end
20
+
21
+ def self.get(id)
22
+ id(id)
23
+ end
24
+
25
+ def self.compound_id(ids)
26
+ if ids.empty?
27
+ raise Error, "IDs must not be omitted"
28
+ end
29
+
30
+ ids.join(compound_id_separator)
31
+ end
32
+
33
+ def self.get_cardinal_id(id)
34
+ parse(id).first
35
+ end
36
+
37
+ def self.parse(id)
38
+ if id.nil?
39
+ raise Error, "ID must not be omitted"
40
+ end
41
+
42
+ id.split(compound_id_separator)
43
+ end
44
+ end
45
+ end
@@ -7,7 +7,7 @@ module MessageStore
7
7
  end
8
8
 
9
9
  def self.compound_id_separator
10
- '+'
10
+ ID.compound_id_separator
11
11
  end
12
12
 
13
13
  def self.category_type_separator
@@ -42,9 +42,9 @@ module MessageStore
42
42
  id_list.concat(Array(id))
43
43
  id_list.concat(Array(ids))
44
44
 
45
- id_part = id_list.join(compound_id_separator)
46
-
47
- if not id_part.empty?
45
+ id_part = nil
46
+ if not id_list.empty?
47
+ id_part = ID.compound_id(id_list)
48
48
  stream_name = "#{stream_name}#{id_separator}#{id_part}"
49
49
  end
50
50
 
@@ -64,7 +64,7 @@ module MessageStore
64
64
 
65
65
  return [] if ids.nil?
66
66
 
67
- ids.split(compound_id_separator)
67
+ ID.parse(ids)
68
68
  end
69
69
 
70
70
  def self.get_cardinal_id(stream_name)
@@ -72,7 +72,7 @@ module MessageStore
72
72
 
73
73
  return nil if id.nil?
74
74
 
75
- id.split(compound_id_separator).first
75
+ ID.get_cardinal_id(id)
76
76
  end
77
77
 
78
78
  def self.get_category(stream_name)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evt-message_store
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0.2
4
+ version: 2.3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Eventide Project
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-12 00:00:00.000000000 Z
11
+ date: 2021-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: evt-casing
@@ -149,6 +149,7 @@ files:
149
149
  - lib/message_store/get/stream/last.rb
150
150
  - lib/message_store/get/stream/last/substitute.rb
151
151
  - lib/message_store/get/substitute.rb
152
+ - lib/message_store/id.rb
152
153
  - lib/message_store/log.rb
153
154
  - lib/message_store/message_data.rb
154
155
  - lib/message_store/message_data/hash/transform.rb
@@ -163,7 +164,7 @@ homepage: https://github.com/eventide-project/message-store
163
164
  licenses:
164
165
  - MIT
165
166
  metadata: {}
166
- post_install_message:
167
+ post_install_message:
167
168
  rdoc_options: []
168
169
  require_paths:
169
170
  - lib
@@ -179,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
179
180
  version: '0'
180
181
  requirements: []
181
182
  rubygems_version: 3.1.2
182
- signing_key:
183
+ signing_key:
183
184
  specification_version: 4
184
185
  summary: Common primitives for platform-specific message store implementations
185
186
  test_files: []