sidekiq-sorbet 0.1.0 → 0.2.0

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: cf07ecd6229ca17be91443492b29af00f719d9fa26f6f6f13c8f5ef3750cd43a
4
- data.tar.gz: f821632d9af46561d5dabd1529ee0daeefd915f6ed1182a02035dc0084bb77ec
3
+ metadata.gz: '078966faedc5ed9f43d8521911fdf7d42019686248a00792e60b0af31c385f31'
4
+ data.tar.gz: 1186336551a72813a8112127d534d84332f2b95e2aaf3432dcf49bfb9b90d8d2
5
5
  SHA512:
6
- metadata.gz: 95792b5c0cf3a4c603098a61342d4788a8f8da9bea4269e4fcdc411b9bc631bfa94b63a9c2f15b394eef4d1251236c74310f997bf3b29e58e42139899fea5d59
7
- data.tar.gz: ebcedc188a5a2f7a7da792c8014daaaafdb18dc0cd944497abd4ef79692c0c0abf0e616cde526bc126dec6c18f1b0d879aeebb8443c0e9e8f222e02885890861
6
+ metadata.gz: 336219d342d70bc744e27c3dbd1fd74469765ae200962fa20914b9a7b94e5b5bfa13e57ac44643f2c85a053d226b13d5eea5f078e7bd76978141c0884ea36ae5
7
+ data.tar.gz: f0fe8bc2956348bdaf4e6e8adf671e457b8cdaeca4400e445ffba325cf4f9b33a285941e40ee8407686b6197a602fdd30fd4d21d936d08ca0eab8612978594e2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.2.0] - 2025-12-16
4
+
5
+ ### Added
6
+
7
+ - `run_at` and `run_in` methods
8
+
3
9
  ## [0.1.0] - 2025-12-16
4
10
 
5
11
  - Initial release
@@ -22,6 +22,34 @@ module Sidekiq
22
22
  perform_async(serialized)
23
23
  end
24
24
 
25
+ # Enqueues a job to be performed at a specific time with validated arguments
26
+ #
27
+ # @param time [Time, Numeric] When to perform the job (timestamp or Time object)
28
+ # @param kwargs [Hash] Arguments matching the Args T::Struct (or empty if no Args)
29
+ # @return [String] Sidekiq job ID
30
+ # @raise [InvalidArgsError] if arguments fail validation
31
+ # @raise [SerializationError] if serialization fails
32
+ sig { params(time: T.any(Time, Numeric), kwargs: T.untyped).returns(String) }
33
+ def run_at(time, **kwargs)
34
+ args_instance = build_args(**kwargs)
35
+ serialized = serialize_args(args_instance)
36
+ perform_at(time, serialized)
37
+ end
38
+
39
+ # Enqueues a job to be performed after a delay with validated arguments
40
+ #
41
+ # @param interval [Numeric] How long to wait before performing (in seconds)
42
+ # @param kwargs [Hash] Arguments matching the Args T::Struct (or empty if no Args)
43
+ # @return [String] Sidekiq job ID
44
+ # @raise [InvalidArgsError] if arguments fail validation
45
+ # @raise [SerializationError] if serialization fails
46
+ sig { params(interval: Numeric, kwargs: T.untyped).returns(String) }
47
+ def run_in(interval, **kwargs)
48
+ args_instance = build_args(**kwargs)
49
+ serialized = serialize_args(args_instance)
50
+ perform_in(interval, serialized)
51
+ end
52
+
25
53
  # Executes a job synchronously with validated arguments
26
54
  #
27
55
  # @param kwargs [Hash] Arguments matching the Args T::Struct (or empty if no Args)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Sidekiq
4
4
  module Sorbet
5
- VERSION = "0.1.0"
5
+ VERSION = "0.2.0"
6
6
  end
7
7
  end
@@ -47,6 +47,8 @@ module Tapioca
47
47
  root.create_path(constant) do |klass|
48
48
  generate_argument_accessors(klass) if args_class
49
49
  generate_run_async_method(klass)
50
+ generate_run_at_method(klass)
51
+ generate_run_in_method(klass)
50
52
  generate_run_sync_method(klass)
51
53
  end
52
54
  end
@@ -91,6 +93,26 @@ module Tapioca
91
93
  )
92
94
  end
93
95
 
96
+ sig { params(klass: RBI::Scope).void }
97
+ def generate_run_at_method(klass)
98
+ klass.create_method(
99
+ "run_at",
100
+ parameters: build_time_params_signature,
101
+ return_type: "String",
102
+ class_method: true,
103
+ )
104
+ end
105
+
106
+ sig { params(klass: RBI::Scope).void }
107
+ def generate_run_in_method(klass)
108
+ klass.create_method(
109
+ "run_in",
110
+ parameters: build_interval_params_signature,
111
+ return_type: "String",
112
+ class_method: true,
113
+ )
114
+ end
115
+
94
116
  sig { params(klass: RBI::Scope).void }
95
117
  def generate_run_sync_method(klass)
96
118
  klass.create_method(
@@ -118,6 +140,24 @@ module Tapioca
118
140
  RBI::TypedParam.new(param: param, type: type)
119
141
  end
120
142
  end
143
+
144
+ sig { returns(T::Array[RBI::TypedParam]) }
145
+ def build_time_params_signature
146
+ time_param = RBI::TypedParam.new(
147
+ param: RBI::ReqParam.new("time"),
148
+ type: "T.any(Time, Numeric)",
149
+ )
150
+ [time_param, *build_params_signature]
151
+ end
152
+
153
+ sig { returns(T::Array[RBI::TypedParam]) }
154
+ def build_interval_params_signature
155
+ interval_param = RBI::TypedParam.new(
156
+ param: RBI::ReqParam.new("interval"),
157
+ type: "Numeric",
158
+ )
159
+ [interval_param, *build_params_signature]
160
+ end
121
161
  end
122
162
  end
123
163
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-sorbet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kodkod