You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .agents/skills/constructive-jobs/SKILL.md
+83-6Lines changed: 83 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
name: constructive-jobs
3
-
description: "Background job system — DataJobTrigger blueprint node for enqueuing jobs on row changes, payload strategies, the Knative worker pipeline, scheduled jobs, and the app_jobs database extension. Use when asked to 'trigger a job', 'enqueue a background task', 'add a job trigger', 'run a function on row change', 'schedule a job', or when working with DataJobTrigger in blueprints."
3
+
description: "Background job system — DataJobTrigger blueprint node for enqueuing jobs on row changes (with compound conditions support: AND/OR/NOT combinators, column-aware type resolution), DataImageEmbedding composition wrapper, payload strategies, the Knative worker pipeline, scheduled jobs, and the app_jobs database extension. Use when asked to 'trigger a job', 'enqueue a background task', 'add a job trigger', 'run a function on row change', 'schedule a job', 'compound conditions', 'image embedding trigger', or when working with DataJobTrigger/DataImageEmbedding in blueprints."
4
4
metadata:
5
5
author: constructive-io
6
6
version: "1.0.0"
@@ -73,8 +73,9 @@ This creates INSERT and UPDATE triggers that enqueue a `process_invoice` job wit
|`max_attempts`| integer |`25`| Maximum retry attempts |
85
86
86
-
**Constraint:**`condition_field` and `watch_fields` cannot both be specified on the same trigger.
87
+
**Constraints:**`conditions`, `condition_field`, and `watch_fields` are mutually exclusive — only one can be specified per trigger.
88
+
89
+
### Compound Conditions
90
+
91
+
The `conditions` parameter accepts a structured JSON syntax for complex WHEN clauses. Column types are resolved automatically from the PostgreSQL schema — values in JSON are cast to the correct type at generation time.
- Compound conditions (status transitions, MIME type filtering)
103
147
- Delayed/debounced jobs (`run_at_delay` + `job_key`)
104
148
- Multiple triggers per table
105
149
- Email on invite, Stripe sync, audit trail, webhook dispatch
106
150
151
+
## DataImageEmbedding Blueprint Node
152
+
153
+
Composition wrapper that combines SearchVector + DataJobTrigger with image-specific defaults. Creates a vector embedding field with HNSW index and a job trigger that fires when image files transition to ready status.
154
+
155
+
```typescript
156
+
{
157
+
ref: 'files',
158
+
table_name: 'files',
159
+
nodes: [
160
+
...STORAGE_NODES,
161
+
{ $type: 'DataImageEmbedding' },
162
+
],
163
+
}
164
+
```
165
+
166
+
| Parameter | Type | Default | Description |
167
+
|-----------|------|---------|-------------|
168
+
|`field_name`| string |`'embedding'`| Vector column name |
@@ -156,4 +233,4 @@ The scheduler component in `knative-job-service` evaluates cron expressions and
156
233
-**[`constructive-safegres`](../constructive-safegres/SKILL.md)** — Security policies for tables with job triggers
157
234
-**Blueprint definition format** — [blueprints.md](../constructive-platform/references/blueprint-definition-format.md) for the full node types table
158
235
159
-
For SQL-level internals (generator functions, AST helpers, trigger function source), see the `constructive-job-triggers` skill in `constructive-private-skills`.
236
+
For SQL-level internals (generator functions, AST helpers, trigger function source), see the `constructive-db-compound-conditions` and `constructive-db-data-modules` skills in `constructive-io/constructive-db`.
Creates a WHEN clause: `WHEN (NEW.status = 'published' AND OLD.status = 'draft')`. The trigger only fires when `status` changes from `'draft'` to `'published'`.
113
+
114
+
## 3c. Compound Conditions with OR (MIME Type Filtering)
115
+
116
+
Fire when status transitions AND the row matches one of several MIME patterns:
For the common pattern of embedding image files on status transition, use `DataImageEmbedding` instead of manually wiring SearchVector + DataJobTrigger:
144
+
145
+
```typescript
146
+
nodes: [
147
+
...STORAGE_NODES,
148
+
{ $type: 'DataImageEmbedding' },
149
+
]
150
+
```
151
+
152
+
Equivalent to manually configuring SearchVector (512-dim, HNSW, cosine) + DataJobTrigger (UPDATE, `status: pending→ready`, `mime_type LIKE 'image/%'`). Override defaults as needed:
Copy file name to clipboardExpand all lines: .agents/skills/constructive-platform/references/blueprint-definition-format.md
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -210,7 +210,13 @@ All 25 node types from the `node_type_registry`:
210
210
|`DataInheritFromParent`| Copies field values from parent row (via FK) on insert/update |`parent_fk_field` (required — FK field pointing to parent), `fields` (required, array of field names to copy) |
211
211
|`DataForceCurrentUser`| Forces a field to `current_user_id()` on insert/update |`field_name` (default `'actor_id'` — must already exist) |
212
212
|`DataImmutableFields`| Prevents fields from being modified after initial insert |`fields` (required, array of field names to protect) |
213
-
|`DataJobTrigger`| Creates triggers that enqueue background jobs via `app_jobs.add_job()`|`task_identifier` (required), `payload_strategy` (default `'row_id'`), `watch_fields` (optional array), `events` (default `['INSERT','UPDATE']`), `condition_field`/`condition_value` (optional), `payload_fields` (optional array), `include_old` (default `false`), `include_meta` (default `false`), `job_key`, `queue_name`, `priority`, `run_at_delay`, `max_attempts` — see [`constructive-jobs`](../../constructive-jobs/SKILL.md)|
213
+
|`DataJobTrigger`| Creates triggers that enqueue background jobs via `app_jobs.add_job()`|`task_identifier` (required), `payload_strategy` (default `'row_id'`), `events` (default `['INSERT','UPDATE']`), `conditions` (compound WHEN clause — leaf conditions, AND/OR/NOT combinators, column-aware type resolution), `condition_field`/`condition_value` (legacy simple equality), `watch_fields` (optional array), `payload_fields` (optional array), `payload_custom` (object), `include_old` (default `false`), `include_meta` (default `false`), `job_key`, `queue_name`, `priority`, `run_at_delay`, `max_attempts` — see [`constructive-jobs`](../../constructive-jobs/SKILL.md)|
0 commit comments