hephaestus 0.6.1 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +19 -0
- data/lib/hephaestus/actions/strip_comments_action.rb +1 -1
- data/lib/hephaestus/app_builder.rb +1 -1
- data/lib/hephaestus/generators/config_generator.rb +1 -1
- data/lib/hephaestus/version.rb +1 -1
- data/templates/.github/workflows/test.yml +3 -1
- data/templates/app/lib/body_parameter/yetto_parameters.rb +47 -40
- data/templates/app/lib/plug_app/middleware/tracing_attributes.rb +9 -10
- data/templates/compose.yml +0 -2
- data/templates/config/initializers/cors.rb +1 -0
- data/templates/lib/plug_app/schemas/api/2023-03-06/components/schemas/yetto.json +59 -110
- 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: 44ea48d1eb2074031506e9029eb3650657c2af45a4a0dc69d64297bcb3d1ce46
|
4
|
+
data.tar.gz: 83098f6cc522540642f8607ddfc98816d47a1f68981a5414572800a3151ecaff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ff481188d3525a3b232099cd902db74cf2fa29bb368dc4e62fc6b4525bdbe9b978e08666a490fca443bbc76e7cbe73af65894e50d85e51f3ef9d4d3c144c66d
|
7
|
+
data.tar.gz: 4fdc8e71109d913965923239ff10b00b185ee1289b34f503c196f25308b7aef8a5bf385b064c6931403b7bbcb1144057a297c0f4573c184fe7dcd200118bef34
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,22 @@
|
|
1
|
+
# [v0.6.3] - 05-07-2024
|
2
|
+
## What's Changed
|
3
|
+
* Changes to support Rack 3 param parsing by @gjtorikian in https://github.com/yettoapp/hephaestus/pull/21
|
4
|
+
|
5
|
+
|
6
|
+
**Full Changelog**: https://github.com/yettoapp/hephaestus/compare/v0.6.2...v0.6.3
|
7
|
+
# [v0.6.2] - 19-06-2024
|
8
|
+
## What's Changed
|
9
|
+
* Use Ruby test suite by @gjtorikian in https://github.com/yettoapp/hephaestus/pull/18
|
10
|
+
* Catch up with plug updates by @balevine in https://github.com/yettoapp/hephaestus/pull/17
|
11
|
+
|
12
|
+
|
13
|
+
**Full Changelog**: https://github.com/yettoapp/hephaestus/compare/v0.6.1...v0.6.2
|
14
|
+
## [v0.6.1] - 12-02-2024
|
15
|
+
## What's Changed
|
16
|
+
* Port recent Ruby, TOML, and OpenAPI changes by @gjtorikian in https://github.com/yettoapp/hephaestus/pull/16
|
17
|
+
|
18
|
+
|
19
|
+
**Full Changelog**: https://github.com/yettoapp/hephaestus/compare/v0.6.0...v0.6.1
|
1
20
|
## [v0.6.0] - 19-12-2023
|
2
21
|
## What's Changed
|
3
22
|
* Remove switch logic from plugs by @gjtorikian in https://github.com/yettoapp/hephaestus/pull/15
|
@@ -164,7 +164,7 @@ module Hephaestus
|
|
164
164
|
|
165
165
|
replace_in_files(destination_root, "PlugApp", app_name.underscore.camelcase)
|
166
166
|
replace_in_files(destination_root, "plug-app", app_name.dasherize)
|
167
|
-
replace_in_files("destination_root}/.github/workflows
|
167
|
+
replace_in_files("#{destination_root}/.github/workflows", "plug-app", app_name.dasherize)
|
168
168
|
replace_in_files(destination_root, "PLUG_APP", app_name.underscore.upcase)
|
169
169
|
replace_in_files(destination_root, "plug_app", app_name.underscore)
|
170
170
|
|
@@ -29,7 +29,7 @@ module Hephaestus
|
|
29
29
|
raltie_overload = <<~CONFIG
|
30
30
|
|
31
31
|
# Load dotenv only in development environment
|
32
|
-
Dotenv::
|
32
|
+
Dotenv::Rails.overwrite = true if Rails.env.development?
|
33
33
|
CONFIG
|
34
34
|
inject_into_file(
|
35
35
|
"config/application.rb",
|
data/lib/hephaestus/version.rb
CHANGED
@@ -6,9 +6,11 @@ on:
|
|
6
6
|
|
7
7
|
jobs:
|
8
8
|
ruby:
|
9
|
-
uses: yettoapp/actions/.github/workflows/
|
9
|
+
uses: yettoapp/actions/.github/workflows/rails_test_suite.yml@main
|
10
10
|
secrets:
|
11
11
|
gh_token: ${{ secrets.GH_SISYPHUS_YETTO_REPO_TOKEN }}
|
12
|
+
with:
|
13
|
+
system_tests: false
|
12
14
|
|
13
15
|
docker:
|
14
16
|
uses: yettoapp/actions/.github/workflows/test_dockerbuild.yml@main
|
@@ -7,116 +7,123 @@ module BodyParameter
|
|
7
7
|
|
8
8
|
sig { returns(String) }
|
9
9
|
def bparam_organization_id
|
10
|
-
plug_installation_params[:organization][:id]
|
10
|
+
plug_installation_params[:yetto][:organization][:id]
|
11
11
|
end
|
12
12
|
|
13
13
|
sig { returns(String) }
|
14
14
|
def bparam_inbox_id
|
15
|
-
plug_installation_params[:inbox][:id]
|
15
|
+
plug_installation_params[:yetto][:inbox][:id]
|
16
16
|
end
|
17
17
|
|
18
18
|
sig { returns(String) }
|
19
19
|
def bparam_plug_installation_id
|
20
|
-
plug_installation_params[:plug_installation][:id]
|
20
|
+
plug_installation_params[:yetto][:plug_installation][:id]
|
21
21
|
end
|
22
22
|
|
23
23
|
sig { returns(String) }
|
24
24
|
def bparam_plug_id
|
25
|
-
plug_installation_params[:plug][:id]
|
25
|
+
plug_installation_params[:yetto][:plug][:id]
|
26
26
|
end
|
27
27
|
|
28
28
|
sig { returns(T::Hash[Symbol, String]) }
|
29
29
|
def bparam_plug_installation_settings
|
30
|
-
plug_installation_params[:plug_installation][:settings]
|
30
|
+
plug_installation_params[:yetto][:plug_installation][:settings]
|
31
31
|
end
|
32
32
|
|
33
33
|
sig { returns(T::Hash[Symbol, String]) }
|
34
34
|
def plug_installation_params
|
35
35
|
return {} if params.blank?
|
36
36
|
|
37
|
-
|
37
|
+
yetto_params = params.fetch(:yetto, {})
|
38
|
+
plug_installation = yetto_params.fetch(:plug_installation, {})
|
39
|
+
|
38
40
|
plug_installation_id = plug_installation.fetch(:id, "")
|
39
41
|
settings = plug_installation.fetch(:settings, {}).to_unsafe_hash
|
40
42
|
|
41
|
-
organization_id =
|
42
|
-
plug_id =
|
43
|
-
inbox_id =
|
43
|
+
organization_id = yetto_params.fetch(:organization, {}).fetch(:id, "")
|
44
|
+
plug_id = yetto_params.fetch(:plug, {}).fetch(:id, "")
|
45
|
+
inbox_id = yetto_params.fetch(:inbox, {}).fetch(:id, "")
|
44
46
|
|
45
47
|
{
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
48
|
+
yetto: {
|
49
|
+
plug_installation: {
|
50
|
+
id: plug_installation_id,
|
51
|
+
settings: settings,
|
52
|
+
},
|
53
|
+
organization: {
|
54
|
+
id: organization_id,
|
55
|
+
},
|
56
|
+
plug: {
|
57
|
+
id: plug_id,
|
58
|
+
},
|
59
|
+
inbox: {
|
60
|
+
id: inbox_id,
|
61
|
+
},
|
58
62
|
},
|
59
63
|
}
|
60
64
|
end
|
61
65
|
|
62
66
|
sig { returns(String) }
|
63
67
|
def bparam_message_id
|
64
|
-
message_params[:message][:id]
|
68
|
+
message_params[:yetto][:message][:id]
|
65
69
|
end
|
66
70
|
|
67
71
|
sig { returns(String) }
|
68
72
|
def bparam_message_text_content
|
69
|
-
message_params[:message][:text_content]
|
73
|
+
message_params[:yetto][:message][:text_content]
|
70
74
|
end
|
71
75
|
|
72
76
|
sig { returns(String) }
|
73
77
|
def bparam_message_conversation_id
|
74
|
-
message_params[:message][:conversation][:id]
|
78
|
+
message_params[:yetto][:message][:conversation][:id]
|
75
79
|
end
|
76
80
|
|
77
81
|
sig { returns(String) }
|
78
82
|
def bparam_message_conversation_title
|
79
|
-
message_params[:message][:conversation][:title]
|
83
|
+
message_params[:yetto][:message][:conversation][:title]
|
80
84
|
end
|
81
85
|
|
82
86
|
sig { returns(String) }
|
83
87
|
def bparam_message_author_name
|
84
|
-
message_params[:message].fetch(:author, {}).fetch(:name, "Noone")
|
88
|
+
message_params[:yetto][:message].fetch(:author, {}).fetch(:name, "Noone")
|
85
89
|
end
|
86
90
|
|
87
91
|
sig { returns(T::Hash[Symbol, String]) }
|
88
92
|
def bparam_message_metadata
|
89
|
-
message_params[:message][:metadata]
|
93
|
+
message_params[:yetto][:message][:metadata]
|
90
94
|
end
|
91
95
|
|
92
96
|
sig { returns(T::Hash[Symbol, String]) }
|
93
97
|
def message_params
|
94
98
|
return {} if params.blank?
|
95
99
|
|
96
|
-
|
100
|
+
yetto_params = params.fetch(:yetto, {})
|
101
|
+
message = yetto_params.fetch(:message, {})
|
97
102
|
message_id = message.fetch(:id, "")
|
98
103
|
text_content = message.fetch(:text_content, "")
|
99
104
|
conversation = message.fetch(:conversation, {})
|
100
105
|
conversation_id = conversation.fetch(:id, "")
|
101
106
|
title = conversation.fetch(:title, "")
|
102
|
-
|
107
|
+
created_by_membership = message.fetch(:created_by_membership, {})
|
103
108
|
created_by_plug = message.fetch(:created_by_plug, {})
|
104
|
-
author =
|
109
|
+
author = created_by_membership.fetch(:user) || created_by_plug
|
105
110
|
name = author.fetch(:name, "")
|
106
111
|
metadata = message.fetch(:metadata, {}).to_unsafe_hash
|
107
112
|
|
108
113
|
{
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
114
|
+
yetto: {
|
115
|
+
message: {
|
116
|
+
id: message_id,
|
117
|
+
text_content: text_content,
|
118
|
+
conversation: {
|
119
|
+
id: conversation_id,
|
120
|
+
title: title,
|
121
|
+
},
|
122
|
+
author: {
|
123
|
+
name: name,
|
124
|
+
},
|
125
|
+
metadata: metadata,
|
118
126
|
},
|
119
|
-
metadata: metadata,
|
120
127
|
},
|
121
128
|
}
|
122
129
|
end
|
@@ -14,6 +14,7 @@ module PlugApp
|
|
14
14
|
|
15
15
|
HTTP_REQUEST_BODY = "http.request.body"
|
16
16
|
PLUG_APP_PATH_PREFIX = "/app/"
|
17
|
+
RACK_REQUEST_BODY = "rack.input"
|
17
18
|
|
18
19
|
sig { params(app: T.untyped).void }
|
19
20
|
def initialize(app)
|
@@ -23,24 +24,22 @@ module PlugApp
|
|
23
24
|
|
24
25
|
sig { params(env: T.untyped).returns(T.untyped) }
|
25
26
|
def call(env)
|
26
|
-
request = ActionDispatch::Request.new(env.dup)
|
27
|
-
|
28
27
|
OpenTelemetry::Trace.current_span.add_attributes({
|
29
28
|
OpenTelemetry::VERSION => PlugApp::Application::GIT_SHA,
|
30
29
|
OpenTelemetry::SemanticConventions::Trace::HTTP_REQUEST_CONTENT_LENGTH => env["CONTENT_LENGTH"].to_i,
|
31
|
-
HTTP_REQUEST_BODY => filtered_params(
|
30
|
+
HTTP_REQUEST_BODY => filtered_params(env),
|
32
31
|
})
|
33
32
|
|
34
33
|
app.call(env)
|
35
34
|
end
|
36
35
|
|
37
|
-
def filtered_params(
|
38
|
-
|
39
|
-
if
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
36
|
+
def filtered_params(env)
|
37
|
+
body = env[RACK_REQUEST_BODY]&.read
|
38
|
+
return "{}" if body.blank? || body == "{}"
|
39
|
+
|
40
|
+
@filterer.filter(JSON.parse(body)).to_json
|
41
|
+
ensure
|
42
|
+
env[RACK_REQUEST_BODY]&.try(:rewind)
|
44
43
|
end
|
45
44
|
end
|
46
45
|
end
|
data/templates/compose.yml
CHANGED
@@ -2,98 +2,77 @@
|
|
2
2
|
"CreateAppMessage": {
|
3
3
|
"type": "object",
|
4
4
|
"required": [
|
5
|
-
"
|
6
|
-
"message",
|
7
|
-
"inbox"
|
5
|
+
"yetto"
|
8
6
|
],
|
9
7
|
"properties": {
|
10
|
-
"
|
8
|
+
"yetto": {
|
11
9
|
"type": "object",
|
12
10
|
"required": [
|
13
|
-
"
|
14
|
-
"
|
11
|
+
"plug_installation",
|
12
|
+
"message"
|
15
13
|
],
|
16
14
|
"properties": {
|
17
|
-
"
|
18
|
-
"type": "string",
|
19
|
-
"pattern": "^(?:pli)_[A-Z0-9]{26}$"
|
20
|
-
},
|
21
|
-
"settings": {
|
22
|
-
"type": "object",
|
23
|
-
"required": [],
|
24
|
-
"properties": {}
|
25
|
-
}
|
26
|
-
}
|
27
|
-
},
|
28
|
-
"inbox": {
|
29
|
-
"type": "object",
|
30
|
-
"required": [
|
31
|
-
"id",
|
32
|
-
"organization"
|
33
|
-
],
|
34
|
-
"properties": {
|
35
|
-
"id": {
|
36
|
-
"type": "string",
|
37
|
-
"pattern": "^(?:ibx)_[A-Z0-9]{26}$"
|
38
|
-
},
|
39
|
-
"organization": {
|
15
|
+
"plug_installation": {
|
40
16
|
"type": "object",
|
41
17
|
"required": [
|
42
18
|
"id",
|
43
|
-
"
|
19
|
+
"settings"
|
44
20
|
],
|
45
21
|
"properties": {
|
46
22
|
"id": {
|
47
23
|
"type": "string",
|
48
|
-
"pattern": "^(?:
|
24
|
+
"pattern": "^(?:pli)_[A-Z0-9]{26}$"
|
49
25
|
},
|
50
|
-
"
|
51
|
-
"type": "
|
26
|
+
"settings": {
|
27
|
+
"type": "object",
|
28
|
+
"required": [],
|
29
|
+
"properties": {}
|
52
30
|
}
|
53
31
|
}
|
54
|
-
}
|
55
|
-
}
|
56
|
-
},
|
57
|
-
"message": {
|
58
|
-
"type": "object",
|
59
|
-
"required": [
|
60
|
-
"id",
|
61
|
-
"conversation",
|
62
|
-
"text_content",
|
63
|
-
"metadata"
|
64
|
-
],
|
65
|
-
"properties": {
|
66
|
-
"id": {
|
67
|
-
"type": "string",
|
68
|
-
"pattern": "^(?:msg)_[A-Z0-9]{26}$"
|
69
|
-
},
|
70
|
-
"text_content": {
|
71
|
-
"type": "string"
|
72
|
-
},
|
73
|
-
"metadata": {
|
74
|
-
"type": "object"
|
75
32
|
},
|
76
|
-
"
|
33
|
+
"message": {
|
77
34
|
"type": "object",
|
78
35
|
"required": [
|
79
36
|
"id",
|
80
|
-
"
|
37
|
+
"conversation",
|
38
|
+
"text_content",
|
81
39
|
"metadata"
|
82
40
|
],
|
83
41
|
"properties": {
|
84
42
|
"id": {
|
85
43
|
"type": "string",
|
86
|
-
"pattern": "^(?:
|
44
|
+
"pattern": "^(?:msg)_[A-Z0-9]{26}$"
|
87
45
|
},
|
88
|
-
"
|
46
|
+
"text_content": {
|
89
47
|
"type": "string"
|
90
48
|
},
|
91
49
|
"metadata": {
|
92
50
|
"type": "object"
|
51
|
+
},
|
52
|
+
"conversation": {
|
53
|
+
"type": "object",
|
54
|
+
"required": [
|
55
|
+
"id",
|
56
|
+
"title",
|
57
|
+
"metadata"
|
58
|
+
],
|
59
|
+
"properties": {
|
60
|
+
"id": {
|
61
|
+
"type": "string",
|
62
|
+
"pattern": "^(?:cnv)_[A-Z0-9]{26}$"
|
63
|
+
},
|
64
|
+
"title": {
|
65
|
+
"type": "string"
|
66
|
+
},
|
67
|
+
"metadata": {
|
68
|
+
"type": "object"
|
69
|
+
}
|
70
|
+
}
|
93
71
|
}
|
94
72
|
}
|
95
73
|
}
|
96
|
-
}
|
74
|
+
},
|
75
|
+
"additionalProperties": false
|
97
76
|
}
|
98
77
|
},
|
99
78
|
"additionalProperties": false
|
@@ -101,65 +80,35 @@
|
|
101
80
|
"ConfigureApp": {
|
102
81
|
"type": "object",
|
103
82
|
"required": [
|
104
|
-
"
|
105
|
-
"organization",
|
106
|
-
"plug",
|
107
|
-
"inbox"
|
83
|
+
"yetto"
|
108
84
|
],
|
109
85
|
"properties": {
|
110
|
-
"
|
86
|
+
"yetto": {
|
111
87
|
"type": "object",
|
112
88
|
"required": [
|
113
|
-
"
|
114
|
-
"settings"
|
89
|
+
"plug_installation",
|
115
90
|
],
|
116
91
|
"properties": {
|
117
|
-
"
|
118
|
-
"type": "string",
|
119
|
-
"pattern": "^(?:pli)_[A-Z0-9]{26}$"
|
120
|
-
},
|
121
|
-
"settings": {
|
92
|
+
"plug_installation": {
|
122
93
|
"type": "object",
|
123
|
-
"required": [
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
}
|
139
|
-
},
|
140
|
-
"plug": {
|
141
|
-
"type": "object",
|
142
|
-
"required": [
|
143
|
-
"id"
|
144
|
-
],
|
145
|
-
"properties": {
|
146
|
-
"id": {
|
147
|
-
"type": "string",
|
148
|
-
"pattern": "^(?:plg)_[A-Z0-9]{26}$"
|
149
|
-
}
|
150
|
-
}
|
151
|
-
},
|
152
|
-
"inbox": {
|
153
|
-
"type": "object",
|
154
|
-
"required": [
|
155
|
-
"id"
|
156
|
-
],
|
157
|
-
"properties": {
|
158
|
-
"id": {
|
159
|
-
"type": "string",
|
160
|
-
"pattern": "^(?:ibx)_[A-Z0-9]{26}$"
|
94
|
+
"required": [
|
95
|
+
"id",
|
96
|
+
"settings"
|
97
|
+
],
|
98
|
+
"properties": {
|
99
|
+
"id": {
|
100
|
+
"type": "string",
|
101
|
+
"pattern": "^(?:pli)_[A-Z0-9]{26}$"
|
102
|
+
},
|
103
|
+
"settings": {
|
104
|
+
"type": "object",
|
105
|
+
"required": [],
|
106
|
+
"properties": {}
|
107
|
+
}
|
108
|
+
}
|
161
109
|
}
|
162
|
-
}
|
110
|
+
},
|
111
|
+
"additionalProperties": false
|
163
112
|
}
|
164
113
|
},
|
165
114
|
"additionalProperties": false
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hephaestus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garen Torikian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -249,7 +249,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
249
249
|
- !ruby/object:Gem::Version
|
250
250
|
version: 3.4.7
|
251
251
|
requirements: []
|
252
|
-
rubygems_version: 3.5.
|
252
|
+
rubygems_version: 3.5.3
|
253
253
|
signing_key:
|
254
254
|
specification_version: 4
|
255
255
|
summary: Generate a Rails app that can be used to create plugs for Yetto.
|