polyn-cli 0.2.0 → 0.3.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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/polyn/cli/schema_loader.rb +2 -13
- data/lib/polyn/cli/version.rb +1 -1
- data/lib/polyn/cli.rb +0 -1
- metadata +2 -4
- data/lib/polyn/cli/cloud_event.rb +0 -15
- data/lib/polyn/cloud-event-schema.json +0 -187
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 918d9c6f737ba311705c8190127536babc3e87260eceecdcacef5f40111945a7
|
4
|
+
data.tar.gz: d1048eaa24a80e2db328b511d014fd3232cad90bea8071f899ddead93bb2327f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: becfe06189a3250f4db8b89e1bfdcb0a89d0973c49ef5fd308105862b44a5ebb284ff4d7c55cca6e11cf528b5cd6b505867bc0912475bf3d32b825a0ab6fad1a
|
7
|
+
data.tar.gz: '0793abb236bc93a4c0d3affb83c96548ca380f67adef929ac011e49b53b9d4e1678e1b9777b9307e5131c2d2c7f266af7397af72be8c25ea6e2f015f2c1585f5'
|
data/Gemfile.lock
CHANGED
@@ -21,7 +21,6 @@ module Polyn
|
|
21
21
|
@client = connect
|
22
22
|
@store_name = opts.fetch(:store_name, STORE_NAME)
|
23
23
|
@bucket = client.key_value(@store_name)
|
24
|
-
@cloud_event_schema = Polyn::Cli::CloudEvent.to_h.freeze
|
25
24
|
@schemas_dir = opts.fetch(:schemas_dir, File.join(Dir.pwd, "schemas"))
|
26
25
|
@schemas = {}
|
27
26
|
@existing_schemas = {}
|
@@ -47,7 +46,6 @@ module Polyn
|
|
47
46
|
:schemas,
|
48
47
|
:client,
|
49
48
|
:bucket,
|
50
|
-
:cloud_event_schema,
|
51
49
|
:schemas_dir,
|
52
50
|
:store_name,
|
53
51
|
:existing_schemas
|
@@ -72,11 +70,10 @@ module Polyn
|
|
72
70
|
|
73
71
|
schema_files.each do |schema_file|
|
74
72
|
thor.say "Loading 'schema #{schema_file}'"
|
75
|
-
|
73
|
+
schema = JSON.parse(File.read(schema_file))
|
76
74
|
schema_name = File.basename(schema_file, ".json")
|
77
|
-
validate_schema!(schema_name,
|
75
|
+
validate_schema!(schema_name, schema)
|
78
76
|
Polyn::Cli::Naming.validate_message_name!(schema_name)
|
79
|
-
schema = compose_cloud_event(data_schema)
|
80
77
|
|
81
78
|
schemas[schema_name] = schema
|
82
79
|
end
|
@@ -114,14 +111,6 @@ module Polyn
|
|
114
111
|
"#{JSON.pretty_generate(schema)}"
|
115
112
|
end
|
116
113
|
|
117
|
-
def compose_cloud_event(data_schema)
|
118
|
-
cloud_event_schema.merge({
|
119
|
-
"definitions" => cloud_event_schema["definitions"].merge({
|
120
|
-
"datadef" => data_schema,
|
121
|
-
}),
|
122
|
-
})
|
123
|
-
end
|
124
|
-
|
125
114
|
def load_existing_schemas
|
126
115
|
sub = client.subscribe("#{key_prefix}.>")
|
127
116
|
|
data/lib/polyn/cli/version.rb
CHANGED
data/lib/polyn/cli.rb
CHANGED
@@ -8,7 +8,6 @@ require "polyn/cli/consumer_generator"
|
|
8
8
|
require "polyn/cli/naming"
|
9
9
|
require "polyn/cli/schema_generator"
|
10
10
|
require "polyn/cli/stream_generator"
|
11
|
-
require "polyn/cli/cloud_event"
|
12
11
|
require "polyn/cli/schema_loader"
|
13
12
|
require "polyn/cli/version"
|
14
13
|
require "json"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: polyn-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.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-
|
12
|
+
date: 2022-12-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: dotenv
|
@@ -91,7 +91,6 @@ files:
|
|
91
91
|
- bin/setup
|
92
92
|
- exe/polyn
|
93
93
|
- lib/polyn/cli.rb
|
94
|
-
- lib/polyn/cli/cloud_event.rb
|
95
94
|
- lib/polyn/cli/configuration.rb
|
96
95
|
- lib/polyn/cli/consumer_generator.rb
|
97
96
|
- lib/polyn/cli/naming.rb
|
@@ -99,7 +98,6 @@ files:
|
|
99
98
|
- lib/polyn/cli/schema_loader.rb
|
100
99
|
- lib/polyn/cli/stream_generator.rb
|
101
100
|
- lib/polyn/cli/version.rb
|
102
|
-
- lib/polyn/cloud-event-schema.json
|
103
101
|
- lib/polyn/templates/.dockerignore
|
104
102
|
- lib/polyn/templates/.gitignore
|
105
103
|
- lib/polyn/templates/Dockerfile
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Polyn
|
4
|
-
class Cli
|
5
|
-
##
|
6
|
-
# Access cloud event information
|
7
|
-
class CloudEvent
|
8
|
-
def self.to_h
|
9
|
-
path = File.expand_path(File.join(File.dirname(__FILE__), "../cloud-event-schema.json"))
|
10
|
-
file = File.open(path)
|
11
|
-
JSON.parse(file.read)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,187 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"$schema": "http://json-schema.org/draft-07/schema#",
|
3
|
-
"description": "CloudEvents Specification JSON Schema, extended for Polyn",
|
4
|
-
"type": "object",
|
5
|
-
"properties": {
|
6
|
-
"id": {
|
7
|
-
"description": "Identifies the event.",
|
8
|
-
"$ref": "#/definitions/iddef",
|
9
|
-
"examples": [
|
10
|
-
"A234-1234-1234"
|
11
|
-
]
|
12
|
-
},
|
13
|
-
"source": {
|
14
|
-
"description": "Identifies the context in which an event happened.",
|
15
|
-
"$ref": "#/definitions/sourcedef",
|
16
|
-
"examples" : [
|
17
|
-
"https://github.com/cloudevents",
|
18
|
-
"mailto:cncf-wg-serverless@lists.cncf.io",
|
19
|
-
"urn:uuid:6e8bc430-9c3a-11d9-9669-0800200c9a66",
|
20
|
-
"cloudevents/spec/pull/123",
|
21
|
-
"/sensors/tn-1234567/alerts",
|
22
|
-
"1-555-123-4567"
|
23
|
-
]
|
24
|
-
},
|
25
|
-
"specversion": {
|
26
|
-
"description": "The version of the CloudEvents specification which the event uses.",
|
27
|
-
"$ref": "#/definitions/specversiondef",
|
28
|
-
"examples": [
|
29
|
-
"1.0"
|
30
|
-
]
|
31
|
-
},
|
32
|
-
"type": {
|
33
|
-
"description": "Describes the type of event related to the originating occurrence.",
|
34
|
-
"$ref": "#/definitions/typedef",
|
35
|
-
"examples" : [
|
36
|
-
"com.github.pull_request.opened",
|
37
|
-
"com.example.object.deleted.v2"
|
38
|
-
]
|
39
|
-
},
|
40
|
-
"datacontenttype": {
|
41
|
-
"description": "Content type of the data value. Must adhere to RFC 2046 format.",
|
42
|
-
"$ref": "#/definitions/datacontenttypedef",
|
43
|
-
"examples": [
|
44
|
-
"text/xml",
|
45
|
-
"application/json",
|
46
|
-
"image/png",
|
47
|
-
"multipart/form-data"
|
48
|
-
]
|
49
|
-
},
|
50
|
-
"dataschema": {
|
51
|
-
"description": "Identifies the schema that data adheres to.",
|
52
|
-
"$ref": "#/definitions/dataschemadef"
|
53
|
-
},
|
54
|
-
"subject": {
|
55
|
-
"description": "Describes the subject of the event in the context of the event producer (identified by source).",
|
56
|
-
"$ref": "#/definitions/subjectdef",
|
57
|
-
"examples": [
|
58
|
-
"mynewfile.jpg"
|
59
|
-
]
|
60
|
-
},
|
61
|
-
"time": {
|
62
|
-
"description": "Timestamp of when the occurrence happened. Must adhere to RFC 3339.",
|
63
|
-
"$ref": "#/definitions/timedef",
|
64
|
-
"examples": [
|
65
|
-
"2018-04-05T17:31:00Z"
|
66
|
-
]
|
67
|
-
},
|
68
|
-
"data": {
|
69
|
-
"description": "The event payload.",
|
70
|
-
"$ref": "#/definitions/datadef",
|
71
|
-
"examples": [
|
72
|
-
"<much wow=\"xml\"/>"
|
73
|
-
]
|
74
|
-
},
|
75
|
-
"data_base64": {
|
76
|
-
"description": "Base64 encoded event payload. Must adhere to RFC4648.",
|
77
|
-
"$ref": "#/definitions/data_base64def",
|
78
|
-
"examples": [
|
79
|
-
"Zm9vYg=="
|
80
|
-
]
|
81
|
-
},
|
82
|
-
"polyndata": {
|
83
|
-
"$ref": "#/definitions/polyndatadef",
|
84
|
-
"description": "Information about the client that produced the event and additional metadata",
|
85
|
-
"examples": [
|
86
|
-
{
|
87
|
-
"clientlang": "elixir",
|
88
|
-
"clientlangversion": "1.13.2",
|
89
|
-
"clientversion": "0.1.0"
|
90
|
-
}
|
91
|
-
]
|
92
|
-
},
|
93
|
-
"polyntrace": {
|
94
|
-
"$ref": "#/definitions/polyntracedef",
|
95
|
-
"description": "Previous events that led to this one",
|
96
|
-
"examples": [
|
97
|
-
[
|
98
|
-
{
|
99
|
-
"type": "<topic>",
|
100
|
-
"time": "2018-04-05T17:31:00Z",
|
101
|
-
"id": "<uuid>"
|
102
|
-
}
|
103
|
-
]
|
104
|
-
]
|
105
|
-
}
|
106
|
-
},
|
107
|
-
"required": ["id", "source", "specversion", "type"],
|
108
|
-
"definitions": {
|
109
|
-
"iddef": {
|
110
|
-
"type": "string",
|
111
|
-
"minLength": 1
|
112
|
-
},
|
113
|
-
"sourcedef": {
|
114
|
-
"type": "string",
|
115
|
-
"format": "uri-reference",
|
116
|
-
"minLength": 1
|
117
|
-
},
|
118
|
-
"specversiondef": {
|
119
|
-
"type": "string",
|
120
|
-
"minLength": 1
|
121
|
-
},
|
122
|
-
"typedef": {
|
123
|
-
"type": "string",
|
124
|
-
"minLength": 1
|
125
|
-
},
|
126
|
-
"datacontenttypedef": {
|
127
|
-
"type": ["string", "null"],
|
128
|
-
"minLength": 1
|
129
|
-
},
|
130
|
-
"dataschemadef": {
|
131
|
-
"type": ["string", "null"],
|
132
|
-
"format": "uri",
|
133
|
-
"minLength": 1
|
134
|
-
},
|
135
|
-
"subjectdef": {
|
136
|
-
"type": ["string", "null"],
|
137
|
-
"minLength": 1
|
138
|
-
},
|
139
|
-
"timedef": {
|
140
|
-
"type": ["string", "null"],
|
141
|
-
"format": "date-time",
|
142
|
-
"minLength": 1
|
143
|
-
},
|
144
|
-
"datadef": {
|
145
|
-
"type": ["object", "string", "number", "array", "boolean", "null"]
|
146
|
-
},
|
147
|
-
"data_base64def": {
|
148
|
-
"type": ["string", "null"],
|
149
|
-
"contentEncoding": "base64"
|
150
|
-
},
|
151
|
-
"polyndatadef": {
|
152
|
-
"type": "object",
|
153
|
-
"properties": {
|
154
|
-
"clientlang": {
|
155
|
-
"type": "string"
|
156
|
-
},
|
157
|
-
"clientlangversion": {
|
158
|
-
"type": "string"
|
159
|
-
},
|
160
|
-
"clientversion": {
|
161
|
-
"type": "string"
|
162
|
-
}
|
163
|
-
},
|
164
|
-
"required": ["clientlang", "clientlangversion", "clientversion"]
|
165
|
-
},
|
166
|
-
"polyntracedef": {
|
167
|
-
"type" : "array",
|
168
|
-
"items": {
|
169
|
-
"type": "object",
|
170
|
-
"properties": {
|
171
|
-
"type": {
|
172
|
-
"type": "string"
|
173
|
-
},
|
174
|
-
"time": {
|
175
|
-
"type": "string",
|
176
|
-
"format": "date-time"
|
177
|
-
},
|
178
|
-
"id" : {
|
179
|
-
"type": "string",
|
180
|
-
"format": "uuid"
|
181
|
-
}
|
182
|
-
},
|
183
|
-
"required": ["type", "time", "id"]
|
184
|
-
}
|
185
|
-
}
|
186
|
-
}
|
187
|
-
}
|