vigiles 0.1.0.pre.beta10 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cceedc075f3779ec0c77cc04a35058734cd2d2396ea67b95c6b1117763caa719
4
- data.tar.gz: 3ea39ba08de23e8b51b66bc0e4b4cc38ca52e467ccdf671d49cdb52e7ff98453
3
+ metadata.gz: 9c7da56eb222eab7028b219abca2ba0e58d07e6ea839e8cf128e2f06899e8369
4
+ data.tar.gz: 5cf3f8e95434d3db95d2fecf235e9887f13418999d67419428714054b5971816
5
5
  SHA512:
6
- metadata.gz: a884ac729b71b8351aae48ce0515d2a803f6358f03d03cc3efbbdb5304c2d811de6401eea203329fbea433c9d3896d77fc2f25bb0947226a689c1e466f64b8fd
7
- data.tar.gz: 8a2b120ce179764649389ce270a45015e8e67379f70cb40035cef4f58cf321c6e81a376b62482842825599d7c101fec4ee69aa60aa9889146f6ed2f1daa15297
6
+ metadata.gz: 0fab3769857951735aa3d586eb6cb1de7793f2687396cac8503d2804f22a75b6e786d96f68ecfff112f15ce7f7e152362c146f9c14f9af77f370d671918848c5
7
+ data.tar.gz: 7751d30f849eb16247aa8a23c7c7d07825b10080fa5689954d2493d2a9602fdfd2436c94ba64bacee1d455af9edfd9333a7fe6a11bd17d8dd583f6465cd6c2e8
@@ -59,7 +59,7 @@ module Vigiles
59
59
  protocol: request.protocol,
60
60
  headers: unfucked_headers,
61
61
  origin: request.origin || "unknown_origin_url",
62
- payload: request.body.read,
62
+ payload: Utilities::JSON.parse_benignly(request.body.read),
63
63
  http_method: Types::HttpMethod.deserialize(request.method),
64
64
  path: request.path,
65
65
  url: Utilities::URI.parse_into_http_or_https(request.url),
@@ -1,8 +1,6 @@
1
1
  # typed: strict
2
2
  # frozen_string_literal: true
3
3
 
4
- require "logger"
5
-
6
4
  module Vigiles
7
5
  module Middleware
8
6
  class RecordConversation
data/lib/vigiles/types.rb CHANGED
@@ -24,10 +24,12 @@ module Vigiles
24
24
  end
25
25
  end
26
26
 
27
- Headers = T.type_alias { T::Hash[String, T.untyped] }
28
- JsonPayload = T.type_alias { T::Hash[T.untyped, T.untyped] }
29
27
  HtmlPayload = String
28
+
29
+ UntypedHash = T.type_alias { T::Hash[T.untyped, T.untyped] }
30
+ JsonPayload = T.type_alias { UntypedHash }
30
31
  Payload = T.type_alias { T.any(JsonPayload, HtmlPayload) }
32
+ Headers = T.type_alias { T::Hash[String, T.untyped] }
31
33
 
32
34
  ContentTypeRecorder = T.type_alias do
33
35
  T::Hash[String, T.proc.params(arg0: ActionDispatch::Response).returns(Vigiles::Archive::Conversation)]
@@ -0,0 +1,21 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ require "json"
5
+
6
+ module Vigies
7
+ module Utilities
8
+ module JSON
9
+ extend T::Sig
10
+
11
+ UntypedHash = Vigiles::Types::UntypedHash
12
+
13
+ sig { params(text: String).returns(T.any(String, UntypedHash)) }
14
+ def self.parse_benignly(text)
15
+ ::JSON.parse(text)
16
+ rescue StandardError
17
+ text
18
+ end
19
+ end
20
+ end
21
+ end
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Vigiles
5
- VERSION = "0.1.0-beta10"
5
+ VERSION = "0.1.2"
6
6
  end
data/lib/vigiles.rb CHANGED
@@ -3,11 +3,11 @@
3
3
 
4
4
  require "zeitwerk"
5
5
  require "sorbet-runtime"
6
- require_relative "core_ext"
7
6
  require "action_dispatch"
7
+ require_relative "core_ext"
8
8
 
9
9
  loader = Zeitwerk::Loader.for_gem(warn_on_extra_files: false)
10
- loader.inflector.inflect("uri" => "URI")
10
+ loader.inflector.inflect("uri" => "URI", "json" => "JSON")
11
11
  loader.ignore("#{__dir__}/generators")
12
12
  loader.ignore("#{__dir__}/core_ext.rb")
13
13
  loader.ignore("#{__dir__}/core_ext")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vigiles
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre.beta10
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yaw Boakye
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-26 00:00:00.000000000 Z
11
+ date: 2024-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sorbet-runtime
@@ -228,6 +228,7 @@ files:
228
228
  - lib/vigiles/options.rb
229
229
  - lib/vigiles/spec.rb
230
230
  - lib/vigiles/types.rb
231
+ - lib/vigiles/utilities/json.rb
231
232
  - lib/vigiles/utilities/uri.rb
232
233
  - lib/vigiles/version.rb
233
234
  - sorbet/config