polyn 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +2 -2
- data/lib/polyn/event.rb +1 -1
- data/lib/polyn/naming.rb +5 -7
- data/lib/polyn/serializers/json.rb +1 -1
- data/lib/polyn/version.rb +1 -1
- 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: af29ed5d49542d04eec8fb57a9945c7b2a5f16cbf0bc7244616396fd0d7a9da3
|
4
|
+
data.tar.gz: 84d78cd6661b9ce188cf9f2c413a8b011ded1a962a7fea89a32c87ff460cc73d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f86cd8dd54ee4655e90626ae060127cd0407820ca373f76e1130ae1f9ce7030274eddc0cd0daaae2b4a71d7496a80d31ad7f513e91ecb6d57297ac2692ecfdb2
|
7
|
+
data.tar.gz: 6fc44174ea147fd7d243cfd9cf8391c34a8984b25746a67f2b65e167408c130266be5c3b086504d1e5750c638d99b4d17eb1db7de61f8c85f7fb671686ae4542
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -34,7 +34,7 @@ And then execute:
|
|
34
34
|
|
35
35
|
## Schema Creation
|
36
36
|
|
37
|
-
In order for Polyn to process and validate event schemas you will need to use [Polyn CLI](https://github.com/SpiffInc/polyn-cli) to create an `
|
37
|
+
In order for Polyn to process and validate event schemas you will need to use [Polyn CLI](https://github.com/SpiffInc/polyn-cli) to create an `schemas` codebase. Once your `schemas` codebase is created you can create and manage your schemas there.
|
38
38
|
|
39
39
|
## Configuration
|
40
40
|
|
@@ -99,7 +99,7 @@ loop do
|
|
99
99
|
end
|
100
100
|
```
|
101
101
|
|
102
|
-
Polyn assumes you've already used [Polyn CLI](https://github.com/SpiffInc/polyn
|
102
|
+
Polyn assumes you've already used [Polyn CLI](https://github.com/SpiffInc/polyn/tree/main/polyn_cli) to generate a consumer.
|
103
103
|
|
104
104
|
Add the `:source` option to `pull_subscribe` if your consumer name includes more than just the `source_root`. Polyn automatically finds the consumer name from the `type` you pass in.
|
105
105
|
If your `source_root` was `user.backend` and the event type was `user.created.v1` it would look for a consumer named `user_backend_user_created_v1`. If your consumer had a more specific destination such as `notifications` you could pass that as the `:source` option and the consumer name lookup would use `user_backend_notifications_user_created_v1`.
|
data/lib/polyn/event.rb
CHANGED
@@ -118,7 +118,7 @@ module Polyn
|
|
118
118
|
##
|
119
119
|
# Get the Event `type` prefixed with reverse domain name
|
120
120
|
def self.full_type(type)
|
121
|
-
Polyn::Naming.
|
121
|
+
Polyn::Naming.validate_message_name!(type)
|
122
122
|
"#{domain}.#{Polyn::Naming.trim_domain_prefix(type)}"
|
123
123
|
end
|
124
124
|
|
data/lib/polyn/naming.rb
CHANGED
@@ -35,11 +35,9 @@ module Polyn
|
|
35
35
|
# Validate the `source` name and raise if invalid
|
36
36
|
def self.validate_source_name!(name)
|
37
37
|
message = validate_source_name(name)
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
raise Polyn::Errors::ValidationError, message
|
42
|
-
end
|
38
|
+
raise Polyn::Errors::ValidationError, message unless message == true
|
39
|
+
|
40
|
+
name
|
43
41
|
end
|
44
42
|
|
45
43
|
##
|
@@ -56,7 +54,7 @@ module Polyn
|
|
56
54
|
|
57
55
|
##
|
58
56
|
# Validate the event type
|
59
|
-
def self.
|
57
|
+
def self.validate_message_name!(name)
|
60
58
|
if name.is_a?(String) && name.match?(/\A[a-z0-9]+(?:\.[a-z0-9]+)*\z/)
|
61
59
|
name
|
62
60
|
else
|
@@ -75,7 +73,7 @@ module Polyn
|
|
75
73
|
##
|
76
74
|
# Create a consumer name from a source and type
|
77
75
|
def self.consumer_name(type, source = nil)
|
78
|
-
|
76
|
+
validate_message_name!(type)
|
79
77
|
type = trim_domain_prefix(type)
|
80
78
|
type = type.gsub(".", "_")
|
81
79
|
|
data/lib/polyn/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: polyn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jarod
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-
|
12
|
+
date: 2022-12-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json_schemer
|