@quantod/qq 1.3.0 → 1.3.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.
package/dist/resources/guide.md
CHANGED
|
@@ -204,7 +204,7 @@ Reads items without claiming them. For inspection, data collection, and monitori
|
|
|
204
204
|
Parameters:
|
|
205
205
|
- `pipeline` (string)
|
|
206
206
|
- `stage` (string, optional) — supports globs. Defaults to `*`
|
|
207
|
-
- `payload_fields` (`"*"` | string[], optional) — which payload fields to return. `"*"` returns the full payload; an array of dot-notation paths (e.g. `["status", "meta.author"]`) returns only those fields; omit to return no payload. **Note: this controls payload projection, not item filtering.**
|
|
207
|
+
- `payload_fields` (`"*"` | string[], optional) — which payload fields to return. `"*"` returns the full payload; an array of dot-notation paths (e.g. `["status", "meta.author"]`) returns only those fields; omit to return no payload. **Note: this controls payload projection, not item filtering. Prefer '*' if you don't know exactly which fields can be in the payload.**
|
|
208
208
|
- `payload_filter` (object, optional) — MongoDB-style filter on payload fields. Keys are dot-notation paths into the payload. Values are either a literal (equality match) or an operator object. Supported operators: `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$in` (array), `$exists` (boolean). Example: `{ "status": "active", "score": { "$gt": 80 } }`.
|
|
209
209
|
- `claimed` (boolean, optional) — filter by claimed status
|
|
210
210
|
- `ids` (string[], optional)
|
|
@@ -508,7 +508,7 @@ while True:
|
|
|
508
508
|
item = qq_claim(pipeline, "pending")
|
|
509
509
|
if "error" in item: # "no items to claim" or other error
|
|
510
510
|
break
|
|
511
|
-
result = process_item(item["payload"])
|
|
511
|
+
result = process_item(item["payload"]) # payload is a dict
|
|
512
512
|
qq_release(pipeline, item["seq"], target="done", payload={"result": result})
|
|
513
513
|
|
|
514
514
|
items = qq_query(pipeline, "done", payload_fields="*")
|
|
@@ -516,9 +516,12 @@ for item in items:
|
|
|
516
516
|
print(item["id"], item["payload"]) # payload is a dict
|
|
517
517
|
|
|
518
518
|
# Filter by payload fields; select only specific fields
|
|
519
|
-
high_scores = qq_query(
|
|
519
|
+
high_scores = qq_query(
|
|
520
|
+
pipeline,
|
|
521
|
+
"done",
|
|
520
522
|
payload_filter={"score": {"$gt": 80}, "status": "active"},
|
|
521
|
-
payload_fields=["url", "score"]
|
|
523
|
+
payload_fields=["url", "score"],
|
|
524
|
+
)
|
|
522
525
|
|
|
523
526
|
# Monitor
|
|
524
527
|
s = qq_status(pipeline)
|
package/package.json
CHANGED
package/src/resources/guide.md
CHANGED
|
@@ -204,7 +204,7 @@ Reads items without claiming them. For inspection, data collection, and monitori
|
|
|
204
204
|
Parameters:
|
|
205
205
|
- `pipeline` (string)
|
|
206
206
|
- `stage` (string, optional) — supports globs. Defaults to `*`
|
|
207
|
-
- `payload_fields` (`"*"` | string[], optional) — which payload fields to return. `"*"` returns the full payload; an array of dot-notation paths (e.g. `["status", "meta.author"]`) returns only those fields; omit to return no payload. **Note: this controls payload projection, not item filtering.**
|
|
207
|
+
- `payload_fields` (`"*"` | string[], optional) — which payload fields to return. `"*"` returns the full payload; an array of dot-notation paths (e.g. `["status", "meta.author"]`) returns only those fields; omit to return no payload. **Note: this controls payload projection, not item filtering. Prefer '*' if you don't know exactly which fields can be in the payload.**
|
|
208
208
|
- `payload_filter` (object, optional) — MongoDB-style filter on payload fields. Keys are dot-notation paths into the payload. Values are either a literal (equality match) or an operator object. Supported operators: `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$in` (array), `$exists` (boolean). Example: `{ "status": "active", "score": { "$gt": 80 } }`.
|
|
209
209
|
- `claimed` (boolean, optional) — filter by claimed status
|
|
210
210
|
- `ids` (string[], optional)
|
|
@@ -508,7 +508,7 @@ while True:
|
|
|
508
508
|
item = qq_claim(pipeline, "pending")
|
|
509
509
|
if "error" in item: # "no items to claim" or other error
|
|
510
510
|
break
|
|
511
|
-
result = process_item(item["payload"])
|
|
511
|
+
result = process_item(item["payload"]) # payload is a dict
|
|
512
512
|
qq_release(pipeline, item["seq"], target="done", payload={"result": result})
|
|
513
513
|
|
|
514
514
|
items = qq_query(pipeline, "done", payload_fields="*")
|
|
@@ -516,9 +516,12 @@ for item in items:
|
|
|
516
516
|
print(item["id"], item["payload"]) # payload is a dict
|
|
517
517
|
|
|
518
518
|
# Filter by payload fields; select only specific fields
|
|
519
|
-
high_scores = qq_query(
|
|
519
|
+
high_scores = qq_query(
|
|
520
|
+
pipeline,
|
|
521
|
+
"done",
|
|
520
522
|
payload_filter={"score": {"$gt": 80}, "status": "active"},
|
|
521
|
-
payload_fields=["url", "score"]
|
|
523
|
+
payload_fields=["url", "score"],
|
|
524
|
+
)
|
|
522
525
|
|
|
523
526
|
# Monitor
|
|
524
527
|
s = qq_status(pipeline)
|