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 +4 -4
- data/lib/surrogate_key_logging/sidekiq.rb +40 -0
- data/lib/surrogate_key_logging/version.rb +1 -1
- data/lib/surrogate_key_logging.rb +3 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59d8e483ef4291595ab8400d078f6b05d806b3f6ff2615742d1b581a339a471b
|
4
|
+
data.tar.gz: 45e9c0742590d9b511b9d0895d66243c89271c7b76e583c53886e6ff8c968f9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
@@ -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.
|
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-
|
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
|