rails_surrogate_key_logging 1.0.0 → 1.1.0

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: f98ce688e0b5bccad6bcfc8e3fe0df9b3796f1a92fd4fe30e17d5093d7a176a8
4
- data.tar.gz: efd6b574da4f0ba06d0e47f1564e2f5c049d549d8b0fda59945bb9746028d922
3
+ metadata.gz: 59d8e483ef4291595ab8400d078f6b05d806b3f6ff2615742d1b581a339a471b
4
+ data.tar.gz: 45e9c0742590d9b511b9d0895d66243c89271c7b76e583c53886e6ff8c968f9e
5
5
  SHA512:
6
- metadata.gz: 2dbce84a07a1c6146dbf4022d47c6528c1b189c55f053c5671d307ee1d4c378d74a2126fe646728bfbb24b528603ac26d16d777d7e49448a864ade402eedfff0
7
- data.tar.gz: e42649376a21bd2838dca825aeee9c27dd8d2ec3921aa1b311e0a3f7c71f8a6e9b029089c7c6d8726b4135dfedb421b5261fdeb24e732ae88e1df1e498549d58
6
+ metadata.gz: abdb1c362e0f5dc3834cbcdf3e72053ff938dc300625ec573d0d2162c3a4039fe0f6ce9ef72b2107a1ad8dba7874189d617893f754e0d07e292b36399b1998d1
7
+ data.tar.gz: 21bada8eb48e7bb83bea8ed5fd982cf41c32ec97f22dfee44330d219a9db61921d89186c59fc0277b85bb29309930e5fa68e4fc0cb003f5a4981a5d3e28527bb
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ if defined?(::Sidekiq)
4
+ module Sidekiq
5
+ if defined?(Worker)
6
+ module Worker::ClassMethods
7
+ def surrogate_params(*attrs)
8
+ @surrogate_params ||= []
9
+ attrs.each do |attr|
10
+ @surrogate_params << attr.to_sym
11
+ end
12
+ @surrogate_params
13
+ end
14
+ end
15
+ end
16
+
17
+ if defined?(JobLogger)
18
+ class JobLogger
19
+ alias_method :job_hash_context__before_surrogate_key_logging, :job_hash_context
20
+ def job_hash_context(job_hash)
21
+ hash = job_hash_context__before_surrogate_key_logging(job_hash).stringify_keys
22
+ hash['args'] = {}
23
+ if job_hash.key?('args')
24
+ begin
25
+ klass = hash['class'].constantize
26
+ perform = klass.instance_method(:perform)
27
+ params = perform.parameters
28
+ params.each_with_index do |param, i|
29
+ hash['args'][param.last] = job_hash['args'][i]
30
+ end
31
+ hash['args'] = SurrogateKeyLogging.filter_for_attributes(klass.surrogate_params).filter(hash['args'])
32
+ end
33
+ end
34
+ hash
35
+ end
36
+ end
37
+ end
38
+
39
+ end
40
+ end
@@ -4,7 +4,7 @@ module SurrogateKeyLogging
4
4
 
5
5
  module Version
6
6
  MAJOR = 1
7
- MINOR = 0
7
+ MINOR = 1
8
8
  PATCH = 0
9
9
 
10
10
  end
@@ -12,12 +12,14 @@ module SurrogateKeyLogging
12
12
  autoload :ActiveRecord
13
13
  autoload :Config, 'surrogate_key_logging/configuration'
14
14
  autoload :Configuration
15
+ autoload :Engine
15
16
  autoload :KeyManager
16
17
  autoload :KeyStore
17
18
  autoload :Middleware
18
- autoload :Engine
19
19
  autoload :Version
20
20
 
21
+ require 'surrogate_key_logging/sidekiq' if defined?(::Sidekiq)
22
+
21
23
  @config = Config.new
22
24
 
23
25
  class << self
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_surrogate_key_logging
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taylor Yelverton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-31 00:00:00.000000000 Z
11
+ date: 2023-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
@@ -120,6 +120,7 @@ files:
120
120
  - lib/surrogate_key_logging/key_store.rb
121
121
  - lib/surrogate_key_logging/key_store/active_record.rb
122
122
  - lib/surrogate_key_logging/key_store/base.rb
123
+ - lib/surrogate_key_logging/sidekiq.rb
123
124
  - lib/surrogate_key_logging/version.rb
124
125
  - lib/tasks/key_store/active_record.rake
125
126
  - lib/tasks/surrogate_key_logging.rake