twiglet 3.17.2 → 3.18.1

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: c24a6e2ae1cf373e4922af0528244828063bcea811068caf9e0b936881fafbfc
4
- data.tar.gz: c1f067e514a0888b511a347203d2756061e362f710c0a1e32ebca98a24e804cf
3
+ metadata.gz: f374d2f2296590173140effe867843a31621087d0bfcaf5c25f5d739a7ba408e
4
+ data.tar.gz: 8c1e8460499e5b2d5e230e4446ef73fe1ca626d1ba09801b61550dff176dde82
5
5
  SHA512:
6
- metadata.gz: cb1d1569a326bcfe0dceefb15cfd3bf0d073336368e5f22a7f4b745063a0c19af0fd8f385ae424c2260778ca5ae8d5ecc3acee64ac1a1922b113310f3faa4388
7
- data.tar.gz: f983b678e912cbf317c1a5ddcc2d9559ecd5bcb97f090120609696db5b34331177cc6aed74b8ad41ef2cbe374312d51cd6acbf933dafddbd549fea10b01f4e56
6
+ metadata.gz: 505e1c1ed12eaae957d936ecfaca1cf6e85b33ca823eb9db3be9d6eab8144b25eade1b289604a2f86e7e274d1ec82fe740a64b87520bcff9507f09c7090f1a22
7
+ data.tar.gz: d4e203073bb3e9c832566194e319dd760e6b6f695d7c7a9d3f57b4e3a81d56f77b7269eefa900f19176d0eef601291b826126efe3f4e2b4a9750be506d77509c
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Twiglet
4
- VERSION = '3.17.2'
4
+ VERSION = '3.18.1'
5
5
  end
@@ -0,0 +1,9 @@
1
+ module HashExtensions
2
+ def to_nested: () -> Hash[Symbol, untyped]
3
+ def deep_merge: (Hash[untyped, untyped] hash_to_merge) -> Hash[Symbol, untyped]
4
+
5
+ private
6
+
7
+ def contains_dotted_key?: () -> bool
8
+ def build_nested_object: (Symbol | String key, untyped val) -> Hash[Symbol, untyped]
9
+ end
@@ -0,0 +1,12 @@
1
+ # Ships to consumers: our signatures name these and json-schema has no RBS of its own.
2
+ # Keep method-free - a method here is a hard error in the build of any consumer with their
3
+ # own json-schema stubs.
4
+ module JSON
5
+ class Validator
6
+ end
7
+
8
+ class Schema
9
+ class ValidationError < StandardError
10
+ end
11
+ end
12
+ end
data/sig/manifest.yaml ADDED
@@ -0,0 +1,6 @@
1
+ # D = Development Dependencies
2
+ # S = Standard Library Dependencies
3
+ dependencies:
4
+ - name: logger
5
+ - name: json
6
+ - name: time
@@ -0,0 +1,9 @@
1
+ module Twiglet
2
+ class ErrorSerialiser
3
+ def serialise_error: (Exception error) -> Hash[Symbol, untyped]
4
+
5
+ private
6
+
7
+ def add_stack_trace: (Hash[Symbol, untyped] hash_to_add_to, Exception error) -> Hash[Symbol, untyped]
8
+ end
9
+ end
@@ -0,0 +1,24 @@
1
+ module Twiglet
2
+ class Formatter < ::Logger::Formatter
3
+ @service_name: String
4
+ @now: ^() -> Time
5
+ @default_properties: Hash[Symbol, untyped]
6
+ @context_providers: Array[^() -> Hash[Symbol, untyped]]
7
+ @validator: Validator
8
+
9
+ def initialize: (
10
+ String service_name,
11
+ validator: Validator,
12
+ ?default_properties: Hash[Symbol, untyped],
13
+ ?context_provider: (^() -> Hash[Symbol, untyped])?,
14
+ ?context_providers: Array[^() -> Hash[Symbol, untyped]],
15
+ ?now: ^() -> Time
16
+ ) -> void
17
+
18
+ def call: (String severity, Time _time, String? _progname, String | Hash[untyped, untyped] | nil msg) -> String
19
+
20
+ private
21
+
22
+ def log: (level: String, message: Message) -> String
23
+ end
24
+ end
@@ -0,0 +1,39 @@
1
+ module Twiglet
2
+ class Logger < ::Logger
3
+ DEFAULT_VALIDATION_SCHEMA: String
4
+
5
+ @service_name: String
6
+ @args: Hash[Symbol, untyped]
7
+ @validator: Validator
8
+
9
+ def initialize: (
10
+ String service_name,
11
+ ?now: ^() -> Time,
12
+ ?output: IO,
13
+ ?level: Integer,
14
+ ?validation_schema: String,
15
+ ?default_properties: Hash[Symbol, untyped],
16
+ ?context_provider: (^() -> Hash[Symbol, untyped])?,
17
+ ?context_providers: Array[^() -> Hash[Symbol, untyped]],
18
+ **untyped args
19
+ ) -> void
20
+
21
+ def configure_validation_error_response: () { (JSON::Schema::ValidationError) -> void } -> void
22
+
23
+ def debug: (?String | Hash[untyped, untyped] | Exception | nil message_or_error) ?{ () -> (String | Hash[untyped, untyped]) } -> true
24
+ def info: (?String | Hash[untyped, untyped] | Exception | nil message_or_error) ?{ () -> (String | Hash[untyped, untyped]) } -> true
25
+ def warn: (?String | Hash[untyped, untyped] | Exception | nil message_or_error) ?{ () -> (String | Hash[untyped, untyped]) } -> true
26
+ def error: (?String | Hash[untyped, untyped] | Exception | nil message_or_error, ?Exception? error) ?{ () -> (String | Hash[untyped, untyped]) } -> true
27
+
28
+ def with: (Hash[Symbol, untyped] default_properties) -> Logger
29
+ def validation_schema: (String validation_schema) -> Logger
30
+ def context_provider: () { () -> Hash[Symbol, untyped] } -> Logger
31
+
32
+ alias warning warn
33
+ alias critical fatal
34
+
35
+ private
36
+
37
+ def error_message: (Exception error, ?(String | Hash[untyped, untyped])? message) -> Message
38
+ end
39
+ end
@@ -0,0 +1,5 @@
1
+ module Twiglet
2
+ class Message < Hash[Symbol, untyped]
3
+ def initialize: (String | Hash[untyped, untyped] | nil msg) -> void
4
+ end
5
+ end
@@ -0,0 +1,11 @@
1
+ module Twiglet
2
+ class Validator
3
+ attr_accessor custom_error_handler: ^(JSON::Schema::ValidationError) -> void
4
+
5
+ @schema: Hash[String, untyped]
6
+ @validator: JSON::Validator
7
+
8
+ def initialize: (String schema) -> void
9
+ def validate: (Message message) -> void
10
+ end
11
+ end
@@ -0,0 +1,3 @@
1
+ module Twiglet
2
+ VERSION: String
3
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twiglet
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.17.2
4
+ version: 3.18.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simply Business
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2026-07-13 00:00:00.000000000 Z
10
+ date: 2026-10-06 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: json-schema
@@ -152,6 +152,15 @@ files:
152
152
  - lib/twiglet/validation_schema.json
153
153
  - lib/twiglet/validator.rb
154
154
  - lib/twiglet/version.rb
155
+ - sig/hash_extensions.rbs
156
+ - sig/json-schema.rbs
157
+ - sig/manifest.yaml
158
+ - sig/twiglet/error_serialiser.rbs
159
+ - sig/twiglet/formatter.rbs
160
+ - sig/twiglet/logger.rbs
161
+ - sig/twiglet/message.rbs
162
+ - sig/twiglet/validator.rbs
163
+ - sig/twiglet/version.rbs
155
164
  homepage: https://github.com/simplybusiness/twiglet-ruby
156
165
  licenses:
157
166
  - MIT