zizq 0.3.6 → 0.4.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 +4 -4
- data/README.md +3 -3
- data/lib/zizq/client.rb +37 -0
- data/lib/zizq/test/client.rb +20 -2
- data/lib/zizq/test.rb +7 -1
- data/lib/zizq/version.rb +1 -1
- data/sig/generated/zizq/client.rbs +29 -0
- data/sig/generated/zizq/test/client.rbs +14 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 16999267b593c3fbe71930e3e9d57754e8fd2fea5b336dbeef281e26aea80cb4
|
|
4
|
+
data.tar.gz: da78dd13533f26d22ad896435d62e0e6348ff4978047f96ee1dede9e98c06cc0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 24fa716817d30de27b041c693ea3275f24ad8eec6979d7b58b271e6d4868329a87a3a7a2402068699d21c7fcb96c19061609a77df2cc93034bbd4d355fb2277f
|
|
7
|
+
data.tar.gz: 23d3005105f3ce7140d2d644da28b2af508457c71e30e8df9754db44afa1ca3887b69c4f17fc950c65e46ea87bb2ce9bb8dda534a79321fd32a0138d5da9a6f9
|
data/README.md
CHANGED
|
@@ -33,13 +33,13 @@ API.
|
|
|
33
33
|
Add it to your application's `Gemfile`:
|
|
34
34
|
|
|
35
35
|
```ruby
|
|
36
|
-
gem 'zizq', '~> 0.
|
|
36
|
+
gem 'zizq', '~> 0.4.0'
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
Or install it manually:
|
|
40
40
|
|
|
41
41
|
```shell
|
|
42
|
-
$ gem install zizq -v 0.
|
|
42
|
+
$ gem install zizq -v 0.4.0
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
Ruby **3.2.8 or newer** is required. Client and server share version
|
|
@@ -161,7 +161,7 @@ Zizq.enqueue_raw(
|
|
|
161
161
|
)
|
|
162
162
|
```
|
|
163
163
|
|
|
164
|
-
### Cross-language and low-level dispatch
|
|
164
|
+
### Cross-language and low-level dispatch
|
|
165
165
|
|
|
166
166
|
When a Ruby app needs to *process* jobs enqueued by another language
|
|
167
167
|
(or by `Zizq.enqueue_raw`), `Zizq::Router` maps `type` strings to
|
data/lib/zizq/client.rb
CHANGED
|
@@ -336,6 +336,26 @@ module Zizq
|
|
|
336
336
|
data.fetch("deleted")
|
|
337
337
|
end
|
|
338
338
|
|
|
339
|
+
# Wipe *every* cron group and *every* job on the server.
|
|
340
|
+
#
|
|
341
|
+
# Equivalent to calling `delete_all_crons` followed by
|
|
342
|
+
# `delete_all_jobs` (no filter), but in a single request. Useful
|
|
343
|
+
# primarily as a setup/teardown step in tests where you want a
|
|
344
|
+
# known-empty server between scenarios.
|
|
345
|
+
#
|
|
346
|
+
# **Destructive.** No filters, no escape hatch, no confirmation —
|
|
347
|
+
# the server-side operation simply returns once everything is gone.
|
|
348
|
+
#
|
|
349
|
+
# Named `erase_all_data` rather than `reset` because `Zizq.reset!`
|
|
350
|
+
# already exists at the module level for client-side SDK state.
|
|
351
|
+
#
|
|
352
|
+
# @rbs return: void
|
|
353
|
+
def erase_all_data
|
|
354
|
+
response = raw_post("/reset")
|
|
355
|
+
handle_response!(response, expected: 204)
|
|
356
|
+
nil
|
|
357
|
+
end
|
|
358
|
+
|
|
339
359
|
# Update a single job's mutable fields.
|
|
340
360
|
#
|
|
341
361
|
# Fields not provided are left unchanged. Use `Zizq::RESET` to clear
|
|
@@ -502,6 +522,23 @@ module Zizq
|
|
|
502
522
|
nil
|
|
503
523
|
end
|
|
504
524
|
|
|
525
|
+
# Delete every cron group on the server in a single call.
|
|
526
|
+
#
|
|
527
|
+
# Returns the number of cron groups removed.
|
|
528
|
+
#
|
|
529
|
+
# **Destructive.** This deletes *every cron group on the server*.
|
|
530
|
+
# For granular deletes, use `delete_cron_group` with a specific
|
|
531
|
+
# name.
|
|
532
|
+
#
|
|
533
|
+
# Requires a Pro license on the server.
|
|
534
|
+
#
|
|
535
|
+
# @rbs return: Integer
|
|
536
|
+
def delete_all_crons
|
|
537
|
+
response = delete("/crons")
|
|
538
|
+
data = handle_response!(response, expected: 200)
|
|
539
|
+
data.fetch("deleted")
|
|
540
|
+
end
|
|
541
|
+
|
|
505
542
|
# Fetch a single cron entry.
|
|
506
543
|
#
|
|
507
544
|
# @rbs group: String
|
data/lib/zizq/test/client.rb
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
# rbs_inline: enabled
|
|
5
5
|
# frozen_string_literal: true
|
|
6
6
|
|
|
7
|
+
require "json"
|
|
8
|
+
|
|
7
9
|
module Zizq
|
|
8
10
|
module Test
|
|
9
11
|
# A `Zizq::Client` stand-in for use in test suites.
|
|
@@ -143,7 +145,7 @@ module Zizq
|
|
|
143
145
|
req = EnqueueRequest.new(
|
|
144
146
|
queue:,
|
|
145
147
|
type:,
|
|
146
|
-
payload
|
|
148
|
+
payload: self.class.normalize_payload(payload),
|
|
147
149
|
priority:,
|
|
148
150
|
ready_at:,
|
|
149
151
|
retry_limit:,
|
|
@@ -162,7 +164,7 @@ module Zizq
|
|
|
162
164
|
req = EnqueueRequest.new(
|
|
163
165
|
queue: params[:queue],
|
|
164
166
|
type: params[:type],
|
|
165
|
-
payload: params[:payload],
|
|
167
|
+
payload: self.class.normalize_payload(params[:payload]),
|
|
166
168
|
priority: params[:priority],
|
|
167
169
|
ready_at: params[:ready_at],
|
|
168
170
|
retry_limit: params[:retry_limit],
|
|
@@ -236,6 +238,22 @@ module Zizq
|
|
|
236
238
|
"#{ID_PREFIX}#{counter.to_s.rjust(ID_LENGTH - ID_PREFIX.length, '0')}"
|
|
237
239
|
end
|
|
238
240
|
|
|
241
|
+
public
|
|
242
|
+
|
|
243
|
+
# Round-trip the payload through JSON so the in-memory
|
|
244
|
+
# representation matches what a consumer would receive over the
|
|
245
|
+
# wire: symbol keys / Symbol values become strings, nested
|
|
246
|
+
# hashes and arrays are normalized recursively, and non-JSON-
|
|
247
|
+
# safe values (BigDecimal, custom objects) raise here rather
|
|
248
|
+
# than surviving in test mode only to break in production.
|
|
249
|
+
#
|
|
250
|
+
# Also used by `Zizq::Test.enqueued_raw?` / `enqueued_raw_count`
|
|
251
|
+
# to normalize the query side so symbol-keyed assertion payloads
|
|
252
|
+
# still match the (now string-keyed) buffer.
|
|
253
|
+
def self.normalize_payload(payload) #: (untyped) -> untyped
|
|
254
|
+
JSON.parse(JSON.generate(payload))
|
|
255
|
+
end
|
|
256
|
+
|
|
239
257
|
# Returns entries matching every named filter AND the predicate.
|
|
240
258
|
# All filter kwargs are optional; unset means "don't filter on
|
|
241
259
|
# this axis." Callers must hold `@mutex` — public accessors do
|
data/lib/zizq/test.rb
CHANGED
|
@@ -168,7 +168,13 @@ module Zizq
|
|
|
168
168
|
filters = {}
|
|
169
169
|
filters[:only_queues] = queue if queue
|
|
170
170
|
filters[:only_types] = type if type
|
|
171
|
-
|
|
171
|
+
unless payload.nil?
|
|
172
|
+
# Normalize the assertion-side payload the same way enqueue
|
|
173
|
+
# normalizes the buffered one, so symbol-keyed test payloads
|
|
174
|
+
# still match the (string-keyed) wire-format buffer.
|
|
175
|
+
normalized = Client.normalize_payload(payload)
|
|
176
|
+
filters[:filter] = ->(job) { job.payload == normalized }
|
|
177
|
+
end
|
|
172
178
|
client.enqueued_jobs(**filters).size
|
|
173
179
|
end
|
|
174
180
|
|
data/lib/zizq/version.rb
CHANGED
|
@@ -146,6 +146,22 @@ module Zizq
|
|
|
146
146
|
# @rbs return: Integer
|
|
147
147
|
def delete_all_jobs: (?where: Zizq::where_params) -> Integer
|
|
148
148
|
|
|
149
|
+
# Wipe *every* cron group and *every* job on the server.
|
|
150
|
+
#
|
|
151
|
+
# Equivalent to calling `delete_all_crons` followed by
|
|
152
|
+
# `delete_all_jobs` (no filter), but in a single request. Useful
|
|
153
|
+
# primarily as a setup/teardown step in tests where you want a
|
|
154
|
+
# known-empty server between scenarios.
|
|
155
|
+
#
|
|
156
|
+
# **Destructive.** No filters, no escape hatch, no confirmation —
|
|
157
|
+
# the server-side operation simply returns once everything is gone.
|
|
158
|
+
#
|
|
159
|
+
# Named `erase_all_data` rather than `reset` because `Zizq.reset!`
|
|
160
|
+
# already exists at the module level for client-side SDK state.
|
|
161
|
+
#
|
|
162
|
+
# @rbs return: void
|
|
163
|
+
def erase_all_data: () -> void
|
|
164
|
+
|
|
149
165
|
# Update a single job's mutable fields.
|
|
150
166
|
#
|
|
151
167
|
# Fields not provided are left unchanged. Use `Zizq::RESET` to clear
|
|
@@ -239,6 +255,19 @@ module Zizq
|
|
|
239
255
|
# @rbs return: void
|
|
240
256
|
def delete_cron_group: (String name) -> void
|
|
241
257
|
|
|
258
|
+
# Delete every cron group on the server in a single call.
|
|
259
|
+
#
|
|
260
|
+
# Returns the number of cron groups removed.
|
|
261
|
+
#
|
|
262
|
+
# **Destructive.** This deletes *every cron group on the server*.
|
|
263
|
+
# For granular deletes, use `delete_cron_group` with a specific
|
|
264
|
+
# name.
|
|
265
|
+
#
|
|
266
|
+
# Requires a Pro license on the server.
|
|
267
|
+
#
|
|
268
|
+
# @rbs return: Integer
|
|
269
|
+
def delete_all_crons: () -> Integer
|
|
270
|
+
|
|
242
271
|
# Fetch a single cron entry.
|
|
243
272
|
#
|
|
244
273
|
# @rbs group: String
|
|
@@ -120,6 +120,20 @@ module Zizq
|
|
|
120
120
|
|
|
121
121
|
def synthetic_id: (untyped counter) -> untyped
|
|
122
122
|
|
|
123
|
+
public
|
|
124
|
+
|
|
125
|
+
# Round-trip the payload through JSON so the in-memory
|
|
126
|
+
# representation matches what a consumer would receive over the
|
|
127
|
+
# wire: symbol keys / Symbol values become strings, nested
|
|
128
|
+
# hashes and arrays are normalized recursively, and non-JSON-
|
|
129
|
+
# safe values (BigDecimal, custom objects) raise here rather
|
|
130
|
+
# than surviving in test mode only to break in production.
|
|
131
|
+
#
|
|
132
|
+
# Also used by `Zizq::Test.enqueued_raw?` / `enqueued_raw_count`
|
|
133
|
+
# to normalize the query side so symbol-keyed assertion payloads
|
|
134
|
+
# still match the (now string-keyed) buffer.
|
|
135
|
+
def self.normalize_payload: (untyped payload) -> untyped
|
|
136
|
+
|
|
123
137
|
# Returns entries matching every named filter AND the predicate.
|
|
124
138
|
# All filter kwargs are optional; unset means "don't filter on
|
|
125
139
|
# this axis." Callers must hold `@mutex` — public accessors do
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: zizq
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Chris Corbyn <chris@zizq.io>
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-05-
|
|
11
|
+
date: 2026-05-31 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: async-http
|