@hotmeshio/hotmesh 0.29.0 → 0.29.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/build/package.json
CHANGED
|
@@ -103,13 +103,17 @@ function pickCte(name, selector, namespace, p) {
|
|
|
103
103
|
case 'signalKey':
|
|
104
104
|
return `${name} AS MATERIALIZED (SELECT e.id ${from} WHERE e.signal_key = ${p.add(selector.signalKey)}${ns} LIMIT 1)`;
|
|
105
105
|
case 'metadata': {
|
|
106
|
+
// The facet names a container: only a pending row carrying the
|
|
107
|
+
// accumulator declaration qualifies, so a release or remediation row
|
|
108
|
+
// sharing the facet (or a closed older generation) is never picked.
|
|
106
109
|
const filter = p.add(JSON.stringify({ [selector.key]: selector.value }));
|
|
107
110
|
const roles = p.add(selector.roles ?? null);
|
|
108
111
|
return `${name} AS MATERIALIZED (
|
|
109
112
|
SELECT e.id ${from}
|
|
110
113
|
WHERE e.metadata @> ${filter}::jsonb
|
|
114
|
+
AND e.metadata ? '${COUNT}'
|
|
111
115
|
AND (${roles}::text[] IS NULL OR e.role = ANY(${roles}::text[]))
|
|
112
|
-
AND e.status
|
|
116
|
+
AND e.status = 'pending'${ns}
|
|
113
117
|
ORDER BY e.priority ASC, e.created_at ASC
|
|
114
118
|
LIMIT 1)`;
|
|
115
119
|
}
|