node-type-registry 0.36.0 → 0.37.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.
- package/blueprint-types.generated.d.ts +39 -0
- package/codegen/generate-types.js +37 -1
- package/conditions/index.d.ts +1 -0
- package/conditions/index.js +8 -0
- package/conditions/trigger-condition.d.ts +35 -0
- package/conditions/trigger-condition.js +97 -0
- package/data/data-aggregate-limit-counter.d.ts +1 -1
- package/data/data-aggregate-limit-counter.js +7 -7
- package/data/data-billing-meter.d.ts +1 -1
- package/data/data-billing-meter.js +7 -7
- package/data/data-chunks.js +20 -0
- package/data/data-feature-flag.d.ts +1 -1
- package/data/data-feature-flag.js +7 -7
- package/data/data-file-embedding.js +22 -10
- package/data/data-image-embedding.js +15 -9
- package/data/data-job-trigger.js +3 -53
- package/data/data-limit-counter.d.ts +1 -1
- package/data/data-limit-counter.js +7 -7
- package/data/data-meter-rate-limit.d.ts +2 -0
- package/data/data-meter-rate-limit.js +42 -0
- package/data/event-tracker.d.ts +2 -0
- package/data/event-tracker.js +74 -0
- package/data/index.d.ts +9 -4
- package/data/index.js +15 -5
- package/data/limit-warning-aggregate.d.ts +2 -0
- package/data/limit-warning-aggregate.js +27 -0
- package/data/limit-warning-counter.d.ts +2 -0
- package/data/limit-warning-counter.js +33 -0
- package/data/limit-warning-rate.d.ts +2 -0
- package/data/limit-warning-rate.js +33 -0
- package/data/process-extraction.js +15 -10
- package/data/process-image-versions.js +3 -9
- package/data/search-unified.js +8 -0
- package/data/search-vector.js +12 -0
- package/esm/blueprint-types.generated.d.ts +39 -0
- package/esm/codegen/generate-types.js +37 -1
- package/esm/conditions/index.d.ts +1 -0
- package/esm/conditions/index.js +1 -0
- package/esm/conditions/trigger-condition.d.ts +35 -0
- package/esm/conditions/trigger-condition.js +94 -0
- package/esm/data/data-aggregate-limit-counter.d.ts +1 -1
- package/esm/data/data-aggregate-limit-counter.js +6 -6
- package/esm/data/data-billing-meter.d.ts +1 -1
- package/esm/data/data-billing-meter.js +6 -6
- package/esm/data/data-chunks.js +20 -0
- package/esm/data/data-feature-flag.d.ts +1 -1
- package/esm/data/data-feature-flag.js +6 -6
- package/esm/data/data-file-embedding.js +22 -10
- package/esm/data/data-image-embedding.js +15 -9
- package/esm/data/data-job-trigger.js +3 -53
- package/esm/data/data-limit-counter.d.ts +1 -1
- package/esm/data/data-limit-counter.js +6 -6
- package/esm/data/data-meter-rate-limit.d.ts +2 -0
- package/esm/data/data-meter-rate-limit.js +39 -0
- package/esm/data/event-tracker.d.ts +2 -0
- package/esm/data/event-tracker.js +71 -0
- package/esm/data/index.d.ts +9 -4
- package/esm/data/index.js +9 -4
- package/esm/data/limit-warning-aggregate.d.ts +2 -0
- package/esm/data/limit-warning-aggregate.js +24 -0
- package/esm/data/limit-warning-counter.d.ts +2 -0
- package/esm/data/limit-warning-counter.js +30 -0
- package/esm/data/limit-warning-rate.d.ts +2 -0
- package/esm/data/limit-warning-rate.js +30 -0
- package/esm/data/process-extraction.js +15 -10
- package/esm/data/process-image-versions.js +3 -9
- package/esm/data/search-unified.js +8 -0
- package/esm/data/search-vector.js +12 -0
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared trigger condition schema used by any node type that creates
|
|
3
|
+
* PostgreSQL triggers with conditional WHEN clauses.
|
|
4
|
+
*
|
|
5
|
+
* Consumed by: JobTrigger, EventTracker, ProcessExtraction,
|
|
6
|
+
* ProcessImageVersions, ProcessFileEmbedding, ProcessImageEmbedding.
|
|
7
|
+
*
|
|
8
|
+
* On the SQL side, these conditions are compiled to AST via
|
|
9
|
+
* metaschema_generators.build_condition_ast().
|
|
10
|
+
*/
|
|
11
|
+
export const triggerConditionSchema = {
|
|
12
|
+
type: 'object',
|
|
13
|
+
description: 'A leaf condition ({field, op, value?, row?, ref?}) or a combinator ({AND, OR, NOT}).',
|
|
14
|
+
properties: {
|
|
15
|
+
field: { type: 'string', format: 'column-ref', description: 'Column name (validated against the table).' },
|
|
16
|
+
op: {
|
|
17
|
+
type: 'string',
|
|
18
|
+
enum: ['=', '!=', '>', '<', '>=', '<=', 'LIKE', 'NOT LIKE', 'IS NULL', 'IS NOT NULL', 'IS DISTINCT FROM'],
|
|
19
|
+
description: 'Comparison operator.'
|
|
20
|
+
},
|
|
21
|
+
value: { description: 'Comparison value. Type is resolved from the column definition. Omit for IS NULL, IS NOT NULL, IS DISTINCT FROM.' },
|
|
22
|
+
row: { type: 'string', enum: ['NEW', 'OLD'], default: 'NEW', description: 'Row reference (default: NEW).' },
|
|
23
|
+
ref: {
|
|
24
|
+
type: 'object',
|
|
25
|
+
description: 'Column reference for field-to-field comparison (alternative to value).',
|
|
26
|
+
properties: {
|
|
27
|
+
field: { type: 'string', format: 'column-ref' },
|
|
28
|
+
row: { type: 'string', enum: ['NEW', 'OLD'], default: 'NEW' }
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
AND: { type: 'array', description: 'Array of conditions combined with AND.', items: { $ref: '#/$defs/triggerCondition' } },
|
|
32
|
+
OR: { type: 'array', description: 'Array of conditions combined with OR.', items: { $ref: '#/$defs/triggerCondition' } },
|
|
33
|
+
NOT: { $ref: '#/$defs/triggerCondition', description: 'Negated condition.' }
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* $defs block for parameter_schema. Spread into any node that uses conditions.
|
|
38
|
+
*
|
|
39
|
+
* Usage:
|
|
40
|
+
* parameter_schema: { type: 'object', $defs: conditionDefs, properties: { ... } }
|
|
41
|
+
*/
|
|
42
|
+
export const conditionDefs = {
|
|
43
|
+
triggerCondition: triggerConditionSchema
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Common condition-related properties for trigger-based nodes.
|
|
47
|
+
* Three mutually exclusive options for WHEN clause specification.
|
|
48
|
+
*
|
|
49
|
+
* Usage:
|
|
50
|
+
* properties: { event_name: { ... }, ...conditionProperties }
|
|
51
|
+
*/
|
|
52
|
+
export const conditionProperties = {
|
|
53
|
+
condition_field: {
|
|
54
|
+
type: 'string',
|
|
55
|
+
format: 'column-ref',
|
|
56
|
+
description: 'Column name for conditional WHEN clause (fires only when field equals condition_value)'
|
|
57
|
+
},
|
|
58
|
+
condition_value: {
|
|
59
|
+
type: 'string',
|
|
60
|
+
description: 'Value to compare against condition_field in WHEN clause'
|
|
61
|
+
},
|
|
62
|
+
conditions: {
|
|
63
|
+
description: 'Compound conditions for the trigger WHEN clause. Accepts a single leaf condition, an array of conditions (implicitly AND), or a nested combinator tree ({AND: [...], OR: [...], NOT: {...}}). Each leaf is {field, op, value?, row?, ref?}. Column types are resolved automatically from the table schema. Cannot be combined with condition_field or watch_fields.',
|
|
64
|
+
'x-codegen-type': 'TriggerCondition | TriggerCondition[]',
|
|
65
|
+
oneOf: [
|
|
66
|
+
{ $ref: '#/$defs/triggerCondition' },
|
|
67
|
+
{ type: 'array', items: { $ref: '#/$defs/triggerCondition' } }
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
watch_fields: {
|
|
71
|
+
type: 'array',
|
|
72
|
+
items: {
|
|
73
|
+
type: 'string',
|
|
74
|
+
format: 'column-ref'
|
|
75
|
+
},
|
|
76
|
+
description: 'For UPDATE triggers, only fire when these fields change (uses DISTINCT FROM)'
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Standalone trigger_conditions property for nodes that compose on top of
|
|
81
|
+
* JobTrigger (Process* nodes). These use trigger_conditions instead of
|
|
82
|
+
* the full condition_field/conditions/watch_fields trio because the
|
|
83
|
+
* underlying JobTrigger handles the WHEN clause; this property adds
|
|
84
|
+
* additional conditions merged via AND.
|
|
85
|
+
*/
|
|
86
|
+
export const triggerConditionsProperty = {
|
|
87
|
+
description: 'Additional compound conditions beyond auto-generated filtering. ' +
|
|
88
|
+
'Merged with the auto-generated conditions via AND.',
|
|
89
|
+
'x-codegen-type': 'TriggerCondition | TriggerCondition[]',
|
|
90
|
+
oneOf: [
|
|
91
|
+
{ $ref: '#/$defs/triggerCondition' },
|
|
92
|
+
{ type: 'array', items: { $ref: '#/$defs/triggerCondition' } }
|
|
93
|
+
]
|
|
94
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { NodeTypeDefinition } from '../types';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const LimitEnforceAggregate: NodeTypeDefinition;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export const
|
|
2
|
-
name: '
|
|
3
|
-
slug: '
|
|
4
|
-
category: '
|
|
5
|
-
display_name: 'Aggregate
|
|
1
|
+
export const LimitEnforceAggregate = {
|
|
2
|
+
name: 'LimitEnforceAggregate',
|
|
3
|
+
slug: 'limit_enforce_aggregate',
|
|
4
|
+
category: 'limit_enforce',
|
|
5
|
+
display_name: 'Enforce Aggregate Counter',
|
|
6
6
|
description: 'Declaratively attaches aggregate limit-tracking triggers to a table. On INSERT the named limit is incremented per entity; on DELETE it is decremented. Uses org_limit_aggregates_inc/dec for per-entity (org-level) aggregate limits rather than per-user limits. Requires a provisioned limits_module for the target database.',
|
|
7
7
|
parameter_schema: {
|
|
8
8
|
type: 'object',
|
|
@@ -29,5 +29,5 @@ export const LimitAggregate = {
|
|
|
29
29
|
},
|
|
30
30
|
required: ['limit_name'],
|
|
31
31
|
},
|
|
32
|
-
tags: ['limits', 'triggers', 'aggregates', '
|
|
32
|
+
tags: ['limits', 'triggers', 'aggregates', 'enforce'],
|
|
33
33
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { NodeTypeDefinition } from '../types';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const LimitTrackUsage: NodeTypeDefinition;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export const
|
|
2
|
-
name: '
|
|
3
|
-
slug: '
|
|
4
|
-
category: '
|
|
5
|
-
display_name: '
|
|
1
|
+
export const LimitTrackUsage = {
|
|
2
|
+
name: 'LimitTrackUsage',
|
|
3
|
+
slug: 'limit_track_usage',
|
|
4
|
+
category: 'limit_track',
|
|
5
|
+
display_name: 'Track Usage',
|
|
6
6
|
description: 'Declaratively attaches billing usage-recording triggers to a table. On INSERT the named meter is incremented via record_usage; on DELETE it is decremented (reversal). On UPDATE, if the entity_field changes, the old entity is decremented and the new entity is incremented. Requires a provisioned billing_module for the target database.',
|
|
7
7
|
parameter_schema: {
|
|
8
8
|
type: 'object',
|
|
@@ -34,5 +34,5 @@ export const BillingMeter = {
|
|
|
34
34
|
},
|
|
35
35
|
required: ['meter_slug'],
|
|
36
36
|
},
|
|
37
|
-
tags: ['billing', 'triggers', 'metering', 'usage'],
|
|
37
|
+
tags: ['billing', 'triggers', 'metering', 'usage', 'track'],
|
|
38
38
|
};
|
package/esm/data/data-chunks.js
CHANGED
|
@@ -63,6 +63,17 @@ export const ProcessChunks = {
|
|
|
63
63
|
description: 'Distance metric for the HNSW index on chunk embeddings',
|
|
64
64
|
default: 'cosine'
|
|
65
65
|
},
|
|
66
|
+
// ── Model config (optional — flows into job payload) ──────────
|
|
67
|
+
embedding_model: {
|
|
68
|
+
type: 'string',
|
|
69
|
+
description: 'Embedding model identifier for per-chunk embeddings. ' +
|
|
70
|
+
'When null, the worker falls back to runtime config (llm_module / env vars).'
|
|
71
|
+
},
|
|
72
|
+
embedding_provider: {
|
|
73
|
+
type: 'string',
|
|
74
|
+
description: 'Embedding provider name (e.g. "ollama", "openai"). ' +
|
|
75
|
+
'When null, the worker falls back to runtime config.'
|
|
76
|
+
},
|
|
66
77
|
// ── Table naming ───────────────────────────────────────────────
|
|
67
78
|
chunks_table_name: {
|
|
68
79
|
type: 'string',
|
|
@@ -74,6 +85,15 @@ export const ProcessChunks = {
|
|
|
74
85
|
items: { type: 'string' },
|
|
75
86
|
description: 'Field names from the parent table to copy into chunk metadata'
|
|
76
87
|
},
|
|
88
|
+
// ── Search indexes ───────────────────────────────────────────────
|
|
89
|
+
search_indexes: {
|
|
90
|
+
type: 'array',
|
|
91
|
+
items: { type: 'string', enum: ['fulltext', 'bm25', 'trigram'] },
|
|
92
|
+
description: 'Text search indexes to create on the chunks content column. ' +
|
|
93
|
+
'Enables keyword-based retrieval alongside vector search for ' +
|
|
94
|
+
'hybrid RAG workflows.',
|
|
95
|
+
default: ['fulltext']
|
|
96
|
+
},
|
|
77
97
|
// ── Job trigger ────────────────────────────────────────────────
|
|
78
98
|
enqueue_chunking_job: {
|
|
79
99
|
type: 'boolean',
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { NodeTypeDefinition } from '../types';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const LimitEnforceFeature: NodeTypeDefinition;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export const
|
|
2
|
-
name: '
|
|
3
|
-
slug: '
|
|
4
|
-
category: '
|
|
5
|
-
display_name: 'Feature Flag',
|
|
1
|
+
export const LimitEnforceFeature = {
|
|
2
|
+
name: 'LimitEnforceFeature',
|
|
3
|
+
slug: 'limit_enforce_feature',
|
|
4
|
+
category: 'limit_enforce',
|
|
5
|
+
display_name: 'Enforce Feature Flag',
|
|
6
6
|
description: 'Gates a table behind a feature flag backed by the cap tables. Attaches a BEFORE INSERT trigger that checks whether the named feature cap value is > 0. Features are modeled as caps with max=0 (disabled) or max=1 (enabled) in limit_caps / limit_caps_defaults tables. Resolution: COALESCE(per-entity cap, scope default, 0).',
|
|
7
7
|
parameter_schema: {
|
|
8
8
|
type: 'object',
|
|
@@ -26,5 +26,5 @@ export const LimitFeatureFlag = {
|
|
|
26
26
|
},
|
|
27
27
|
required: ['feature_name'],
|
|
28
28
|
},
|
|
29
|
-
tags: ['limits', 'triggers', 'feature-flags', '
|
|
29
|
+
tags: ['limits', 'triggers', 'feature-flags', 'enforce', 'caps'],
|
|
30
30
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { conditionDefs, triggerConditionsProperty } from '../conditions';
|
|
1
2
|
export const ProcessFileEmbedding = {
|
|
2
3
|
name: 'ProcessFileEmbedding',
|
|
3
4
|
slug: 'data_file_embedding',
|
|
@@ -12,6 +13,7 @@ export const ProcessFileEmbedding = {
|
|
|
12
13
|
'names, and embedding strategies.',
|
|
13
14
|
parameter_schema: {
|
|
14
15
|
type: 'object',
|
|
16
|
+
$defs: conditionDefs,
|
|
15
17
|
properties: {
|
|
16
18
|
// ── Vector config (passed through to SearchVector) ─────────────
|
|
17
19
|
field_name: {
|
|
@@ -42,6 +44,18 @@ export const ProcessFileEmbedding = {
|
|
|
42
44
|
description: 'Index-specific options. HNSW: {m, ef_construction}. IVFFlat: {lists}.',
|
|
43
45
|
default: {}
|
|
44
46
|
},
|
|
47
|
+
// ── Model config (optional — flows into job payload) ──────────
|
|
48
|
+
embedding_model: {
|
|
49
|
+
type: 'string',
|
|
50
|
+
description: 'Embedding model identifier (e.g. "nomic-embed-text", "text-embedding-3-small", ' +
|
|
51
|
+
'"clip-vit-base-patch32"). Included in the job payload so the worker knows which ' +
|
|
52
|
+
'model to use. When null, the worker falls back to runtime config (llm_module / env vars).'
|
|
53
|
+
},
|
|
54
|
+
embedding_provider: {
|
|
55
|
+
type: 'string',
|
|
56
|
+
description: 'Embedding provider name (e.g. "ollama", "openai"). ' +
|
|
57
|
+
'When null, the worker falls back to runtime config.'
|
|
58
|
+
},
|
|
45
59
|
// ── MIME scoping ───────────────────────────────────────────────
|
|
46
60
|
mime_patterns: {
|
|
47
61
|
type: 'array',
|
|
@@ -74,16 +88,7 @@ export const ProcessFileEmbedding = {
|
|
|
74
88
|
bucket_id: 'bucket_id'
|
|
75
89
|
}
|
|
76
90
|
},
|
|
77
|
-
trigger_conditions:
|
|
78
|
-
description: 'Additional compound conditions beyond MIME filtering. ' +
|
|
79
|
-
'Merged with the auto-generated MIME conditions via AND. ' +
|
|
80
|
-
'Use this to add status checks, field guards, etc.',
|
|
81
|
-
'x-codegen-type': 'TriggerCondition | TriggerCondition[]',
|
|
82
|
-
oneOf: [
|
|
83
|
-
{ $ref: '#/$defs/triggerCondition' },
|
|
84
|
-
{ type: 'array', items: { $ref: '#/$defs/triggerCondition' } }
|
|
85
|
-
]
|
|
86
|
-
},
|
|
91
|
+
trigger_conditions: triggerConditionsProperty,
|
|
87
92
|
// ── Extraction config (optional — enables extract mode) ────────
|
|
88
93
|
extraction: {
|
|
89
94
|
type: 'object',
|
|
@@ -147,6 +152,13 @@ export const ProcessFileEmbedding = {
|
|
|
147
152
|
items: { type: 'string' },
|
|
148
153
|
description: 'Field names from parent to copy into chunk metadata'
|
|
149
154
|
},
|
|
155
|
+
search_indexes: {
|
|
156
|
+
type: 'array',
|
|
157
|
+
items: { type: 'string', enum: ['fulltext', 'bm25', 'trigram'] },
|
|
158
|
+
description: 'Text search indexes to create on the chunks content column. ' +
|
|
159
|
+
'Enables keyword-based retrieval alongside vector search.',
|
|
160
|
+
default: ['fulltext']
|
|
161
|
+
},
|
|
150
162
|
enqueue_chunking_job: {
|
|
151
163
|
type: 'boolean',
|
|
152
164
|
description: 'Whether to auto-enqueue a chunking job on insert/update',
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { conditionDefs, triggerConditionsProperty } from '../conditions';
|
|
1
2
|
/**
|
|
2
3
|
* Image-specific preset of ProcessFileEmbedding.
|
|
3
4
|
*
|
|
@@ -21,6 +22,7 @@ export const ProcessImageEmbedding = {
|
|
|
21
22
|
'Accepts all ProcessFileEmbedding parameters — any overrides are forwarded through.',
|
|
22
23
|
parameter_schema: {
|
|
23
24
|
type: 'object',
|
|
25
|
+
$defs: conditionDefs,
|
|
24
26
|
properties: {
|
|
25
27
|
// ── Vector config (passed through to ProcessFileEmbedding) ──────────
|
|
26
28
|
field_name: {
|
|
@@ -51,6 +53,18 @@ export const ProcessImageEmbedding = {
|
|
|
51
53
|
description: 'Index-specific options. HNSW: {m, ef_construction}. IVFFlat: {lists}.',
|
|
52
54
|
default: {}
|
|
53
55
|
},
|
|
56
|
+
// ── Model config (optional — flows into job payload) ──────────
|
|
57
|
+
embedding_model: {
|
|
58
|
+
type: 'string',
|
|
59
|
+
description: 'Embedding model identifier (e.g. "clip-vit-base-patch32"). ' +
|
|
60
|
+
'Included in the job payload so the worker knows which model to use. ' +
|
|
61
|
+
'When null, the worker falls back to runtime config (llm_module / env vars).'
|
|
62
|
+
},
|
|
63
|
+
embedding_provider: {
|
|
64
|
+
type: 'string',
|
|
65
|
+
description: 'Embedding provider name (e.g. "ollama", "openai"). ' +
|
|
66
|
+
'When null, the worker falls back to runtime config.'
|
|
67
|
+
},
|
|
54
68
|
// ── MIME scoping ───────────────────────────────────────────────
|
|
55
69
|
mime_patterns: {
|
|
56
70
|
type: 'array',
|
|
@@ -81,15 +95,7 @@ export const ProcessImageEmbedding = {
|
|
|
81
95
|
bucket_id: 'bucket_id'
|
|
82
96
|
}
|
|
83
97
|
},
|
|
84
|
-
trigger_conditions:
|
|
85
|
-
description: 'Additional compound conditions beyond MIME filtering. ' +
|
|
86
|
-
'Merged with the auto-generated MIME conditions via AND.',
|
|
87
|
-
'x-codegen-type': 'TriggerCondition | TriggerCondition[]',
|
|
88
|
-
oneOf: [
|
|
89
|
-
{ $ref: '#/$defs/triggerCondition' },
|
|
90
|
-
{ type: 'array', items: { $ref: '#/$defs/triggerCondition' } }
|
|
91
|
-
]
|
|
92
|
-
},
|
|
98
|
+
trigger_conditions: triggerConditionsProperty,
|
|
93
99
|
// ── Extraction config (optional — enables extract mode) ────────
|
|
94
100
|
extraction: {
|
|
95
101
|
type: 'object',
|
|
@@ -1,28 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
type: 'object',
|
|
3
|
-
description: 'A leaf condition ({field, op, value?, row?, ref?}) or a combinator ({AND, OR, NOT}).',
|
|
4
|
-
properties: {
|
|
5
|
-
field: { type: 'string', format: 'column-ref', description: 'Column name (validated against the table).' },
|
|
6
|
-
op: {
|
|
7
|
-
type: 'string',
|
|
8
|
-
enum: ['=', '!=', '>', '<', '>=', '<=', 'LIKE', 'NOT LIKE', 'IS NULL', 'IS NOT NULL', 'IS DISTINCT FROM'],
|
|
9
|
-
description: 'Comparison operator.'
|
|
10
|
-
},
|
|
11
|
-
value: { description: 'Comparison value. Type is resolved from the column definition. Omit for IS NULL, IS NOT NULL, IS DISTINCT FROM.' },
|
|
12
|
-
row: { type: 'string', enum: ['NEW', 'OLD'], default: 'NEW', description: 'Row reference (default: NEW).' },
|
|
13
|
-
ref: {
|
|
14
|
-
type: 'object',
|
|
15
|
-
description: 'Column reference for field-to-field comparison (alternative to value).',
|
|
16
|
-
properties: {
|
|
17
|
-
field: { type: 'string', format: 'column-ref' },
|
|
18
|
-
row: { type: 'string', enum: ['NEW', 'OLD'], default: 'NEW' }
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
AND: { type: 'array', description: 'Array of conditions combined with AND.', items: { $ref: '#/$defs/triggerCondition' } },
|
|
22
|
-
OR: { type: 'array', description: 'Array of conditions combined with OR.', items: { $ref: '#/$defs/triggerCondition' } },
|
|
23
|
-
NOT: { $ref: '#/$defs/triggerCondition', description: 'Negated condition.' }
|
|
24
|
-
}
|
|
25
|
-
};
|
|
1
|
+
import { conditionDefs, conditionProperties } from '../conditions';
|
|
26
2
|
export const JobTrigger = {
|
|
27
3
|
name: 'JobTrigger',
|
|
28
4
|
slug: 'data_job_trigger',
|
|
@@ -31,9 +7,7 @@ export const JobTrigger = {
|
|
|
31
7
|
description: 'Dynamically creates PostgreSQL triggers that enqueue jobs via app_jobs.add_job() when table rows are inserted, updated, or deleted. Supports configurable payload strategies (full row, row ID, selected fields, or custom mapping), conditional firing via WHEN clauses, watched field changes, and extended job options (queue, priority, delay, max attempts).',
|
|
32
8
|
parameter_schema: {
|
|
33
9
|
type: 'object',
|
|
34
|
-
$defs:
|
|
35
|
-
triggerCondition: triggerConditionSchema
|
|
36
|
-
},
|
|
10
|
+
$defs: conditionDefs,
|
|
37
11
|
properties: {
|
|
38
12
|
task_identifier: {
|
|
39
13
|
type: 'string',
|
|
@@ -92,31 +66,7 @@ export const JobTrigger = {
|
|
|
92
66
|
description: 'Include table/schema metadata in payload',
|
|
93
67
|
default: false
|
|
94
68
|
},
|
|
95
|
-
|
|
96
|
-
type: 'string',
|
|
97
|
-
format: 'column-ref',
|
|
98
|
-
description: 'Column name for conditional WHEN clause (fires only when field equals condition_value)'
|
|
99
|
-
},
|
|
100
|
-
condition_value: {
|
|
101
|
-
type: 'string',
|
|
102
|
-
description: 'Value to compare against condition_field in WHEN clause'
|
|
103
|
-
},
|
|
104
|
-
conditions: {
|
|
105
|
-
description: 'Compound conditions for the trigger WHEN clause. Accepts a single leaf condition, an array of conditions (implicitly AND), or a nested combinator tree ({AND: [...], OR: [...], NOT: {...}}). Each leaf is {field, op, value?, row?, ref?}. Column types are resolved automatically from the table schema. Cannot be combined with condition_field or watch_fields.',
|
|
106
|
-
'x-codegen-type': 'TriggerCondition | TriggerCondition[]',
|
|
107
|
-
oneOf: [
|
|
108
|
-
{ $ref: '#/$defs/triggerCondition' },
|
|
109
|
-
{ type: 'array', items: { $ref: '#/$defs/triggerCondition' } }
|
|
110
|
-
]
|
|
111
|
-
},
|
|
112
|
-
watch_fields: {
|
|
113
|
-
type: 'array',
|
|
114
|
-
items: {
|
|
115
|
-
type: 'string',
|
|
116
|
-
format: 'column-ref'
|
|
117
|
-
},
|
|
118
|
-
description: 'For UPDATE triggers, only fire when these fields change (uses DISTINCT FROM)'
|
|
119
|
-
},
|
|
69
|
+
...conditionProperties,
|
|
120
70
|
job_key: {
|
|
121
71
|
type: 'string',
|
|
122
72
|
description: 'Static job key for upsert semantics (prevents duplicate jobs)'
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { NodeTypeDefinition } from '../types';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const LimitEnforceCounter: NodeTypeDefinition;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export const
|
|
2
|
-
name: '
|
|
3
|
-
slug: '
|
|
4
|
-
category: '
|
|
5
|
-
display_name: '
|
|
1
|
+
export const LimitEnforceCounter = {
|
|
2
|
+
name: 'LimitEnforceCounter',
|
|
3
|
+
slug: 'limit_enforce_counter',
|
|
4
|
+
category: 'limit_enforce',
|
|
5
|
+
display_name: 'Enforce Counter',
|
|
6
6
|
description: 'Declaratively attaches limit-tracking triggers to a table. On INSERT the named limit is incremented; on DELETE it is decremented. Requires a provisioned limits_module for the target scope.',
|
|
7
7
|
parameter_schema: {
|
|
8
8
|
type: 'object',
|
|
@@ -35,5 +35,5 @@ export const LimitCounter = {
|
|
|
35
35
|
},
|
|
36
36
|
required: ['limit_name'],
|
|
37
37
|
},
|
|
38
|
-
tags: ['limits', 'triggers', '
|
|
38
|
+
tags: ['limits', 'triggers', 'enforce'],
|
|
39
39
|
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export const LimitEnforceRate = {
|
|
2
|
+
name: 'LimitEnforceRate',
|
|
3
|
+
slug: 'limit_enforce_rate',
|
|
4
|
+
category: 'limit_enforce',
|
|
5
|
+
display_name: 'Enforce Rate Limit',
|
|
6
|
+
description: 'Attaches a BEFORE trigger that calls check_rate_limit() to enforce sliding-window rate limits before allowing mutations. The function checks all three scopes (entity, actor-in-entity, actor) in a single call; which scopes are actually enforced is controlled by what rows exist in rate_window_limits (plan-based config). Requires a provisioned meter_rate_limits_module and billing_module for the target database.',
|
|
7
|
+
parameter_schema: {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
meter_slug: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
description: 'Slug of the billing meter to check rate limits against (must match a meters table entry, e.g. "messaging", "inference")',
|
|
13
|
+
},
|
|
14
|
+
entity_field: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
format: 'column-ref',
|
|
17
|
+
description: 'Column on the target table that holds the entity id (org) for rate limiting',
|
|
18
|
+
default: 'entity_id',
|
|
19
|
+
},
|
|
20
|
+
actor_field: {
|
|
21
|
+
type: 'string',
|
|
22
|
+
format: 'column-ref',
|
|
23
|
+
description: 'Column on the target table that holds the actor id (user) for rate limiting',
|
|
24
|
+
default: 'owner_id',
|
|
25
|
+
},
|
|
26
|
+
events: {
|
|
27
|
+
type: 'array',
|
|
28
|
+
items: {
|
|
29
|
+
type: 'string',
|
|
30
|
+
enum: ['INSERT', 'UPDATE'],
|
|
31
|
+
},
|
|
32
|
+
description: 'Which DML events to enforce rate limits on (DELETE is excluded since it reduces load)',
|
|
33
|
+
default: ['INSERT'],
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
required: ['meter_slug'],
|
|
37
|
+
},
|
|
38
|
+
tags: ['rate-limits', 'triggers', 'enforce', 'metering', 'abuse-protection'],
|
|
39
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { conditionDefs, conditionProperties } from '../conditions';
|
|
2
|
+
export const EventTracker = {
|
|
3
|
+
name: 'EventTracker',
|
|
4
|
+
slug: 'event_tracker',
|
|
5
|
+
category: 'event',
|
|
6
|
+
display_name: 'Event Tracker',
|
|
7
|
+
description: 'Creates triggers that record events via the events module when table rows change. ' +
|
|
8
|
+
'Supports the same compound condition system as JobTrigger (condition_field, watch_fields, ' +
|
|
9
|
+
'or full AND/OR/NOT conditions). Events are recorded to app_events and aggregated ' +
|
|
10
|
+
'automatically. Use with achievements (blueprint-level) to unlock levels and grant ' +
|
|
11
|
+
'credits based on event accumulation.',
|
|
12
|
+
parameter_schema: {
|
|
13
|
+
type: 'object',
|
|
14
|
+
$defs: conditionDefs,
|
|
15
|
+
properties: {
|
|
16
|
+
event_name: {
|
|
17
|
+
type: 'string',
|
|
18
|
+
description: 'Event type name to record (e.g., "avatar_uploaded", "order_completed")'
|
|
19
|
+
},
|
|
20
|
+
events: {
|
|
21
|
+
type: 'array',
|
|
22
|
+
items: {
|
|
23
|
+
type: 'string',
|
|
24
|
+
enum: [
|
|
25
|
+
'INSERT',
|
|
26
|
+
'UPDATE',
|
|
27
|
+
'DELETE'
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
description: 'DML events that trigger recording',
|
|
31
|
+
default: ['INSERT']
|
|
32
|
+
},
|
|
33
|
+
count: {
|
|
34
|
+
type: 'integer',
|
|
35
|
+
description: 'Number of events to record per trigger fire',
|
|
36
|
+
default: 1
|
|
37
|
+
},
|
|
38
|
+
toggle: {
|
|
39
|
+
type: 'boolean',
|
|
40
|
+
description: 'Toggle mode: records event when condition is met, removes when condition is unmet',
|
|
41
|
+
default: false
|
|
42
|
+
},
|
|
43
|
+
actor_field: {
|
|
44
|
+
type: 'string',
|
|
45
|
+
format: 'column-ref',
|
|
46
|
+
description: 'Column containing the actor (user) ID to attribute the event to',
|
|
47
|
+
default: 'owner_id'
|
|
48
|
+
},
|
|
49
|
+
entity_field: {
|
|
50
|
+
type: 'string',
|
|
51
|
+
format: 'column-ref',
|
|
52
|
+
description: 'Column containing the entity ID (org/group) for entity-scoped events. Omit for user-only events.'
|
|
53
|
+
},
|
|
54
|
+
auto_register_type: {
|
|
55
|
+
type: 'boolean',
|
|
56
|
+
description: 'Automatically register the event_name in event_types during provisioning',
|
|
57
|
+
default: true
|
|
58
|
+
},
|
|
59
|
+
...conditionProperties
|
|
60
|
+
},
|
|
61
|
+
required: [
|
|
62
|
+
'event_name'
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
tags: [
|
|
66
|
+
'events',
|
|
67
|
+
'triggers',
|
|
68
|
+
'analytics',
|
|
69
|
+
'tracking'
|
|
70
|
+
]
|
|
71
|
+
};
|
package/esm/data/index.d.ts
CHANGED
|
@@ -2,15 +2,16 @@ export { CheckGreaterThan } from './check-greater-than';
|
|
|
2
2
|
export { CheckLessThan } from './check-less-than';
|
|
3
3
|
export { CheckNotEqual } from './check-not-equal';
|
|
4
4
|
export { CheckOneOf } from './check-one-of';
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
5
|
+
export { LimitEnforceAggregate } from './data-aggregate-limit-counter';
|
|
6
|
+
export { LimitTrackUsage } from './data-billing-meter';
|
|
7
7
|
export { DataBulk } from './data-bulk';
|
|
8
8
|
export { ProcessChunks } from './data-chunks';
|
|
9
9
|
export { DataCompositeField } from './data-composite-field';
|
|
10
10
|
export { DataDirectOwner } from './data-direct-owner';
|
|
11
11
|
export { DataEntityMembership } from './data-entity-membership';
|
|
12
|
+
export { EventTracker } from './event-tracker';
|
|
12
13
|
export { ProcessFileEmbedding } from './data-file-embedding';
|
|
13
|
-
export {
|
|
14
|
+
export { LimitEnforceFeature } from './data-feature-flag';
|
|
14
15
|
export { DataForceCurrentUser } from './data-force-current-user';
|
|
15
16
|
export { DataId } from './data-id';
|
|
16
17
|
export { ProcessImageEmbedding } from './data-image-embedding';
|
|
@@ -18,7 +19,11 @@ export { DataImmutableFields } from './data-immutable-fields';
|
|
|
18
19
|
export { DataInflection } from './data-inflection';
|
|
19
20
|
export { DataInheritFromParent } from './data-inherit-from-parent';
|
|
20
21
|
export { JobTrigger } from './data-job-trigger';
|
|
21
|
-
export {
|
|
22
|
+
export { LimitEnforceCounter } from './data-limit-counter';
|
|
23
|
+
export { LimitEnforceRate } from './data-meter-rate-limit';
|
|
24
|
+
export { LimitWarningCounter } from './limit-warning-counter';
|
|
25
|
+
export { LimitWarningAggregate } from './limit-warning-aggregate';
|
|
26
|
+
export { LimitWarningRate } from './limit-warning-rate';
|
|
22
27
|
export { DataJsonb } from './data-jsonb';
|
|
23
28
|
export { DataOwnedFields } from './data-owned-fields';
|
|
24
29
|
export { ProcessExtraction } from './process-extraction';
|
package/esm/data/index.js
CHANGED
|
@@ -2,15 +2,16 @@ export { CheckGreaterThan } from './check-greater-than';
|
|
|
2
2
|
export { CheckLessThan } from './check-less-than';
|
|
3
3
|
export { CheckNotEqual } from './check-not-equal';
|
|
4
4
|
export { CheckOneOf } from './check-one-of';
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
5
|
+
export { LimitEnforceAggregate } from './data-aggregate-limit-counter';
|
|
6
|
+
export { LimitTrackUsage } from './data-billing-meter';
|
|
7
7
|
export { DataBulk } from './data-bulk';
|
|
8
8
|
export { ProcessChunks } from './data-chunks';
|
|
9
9
|
export { DataCompositeField } from './data-composite-field';
|
|
10
10
|
export { DataDirectOwner } from './data-direct-owner';
|
|
11
11
|
export { DataEntityMembership } from './data-entity-membership';
|
|
12
|
+
export { EventTracker } from './event-tracker';
|
|
12
13
|
export { ProcessFileEmbedding } from './data-file-embedding';
|
|
13
|
-
export {
|
|
14
|
+
export { LimitEnforceFeature } from './data-feature-flag';
|
|
14
15
|
export { DataForceCurrentUser } from './data-force-current-user';
|
|
15
16
|
export { DataId } from './data-id';
|
|
16
17
|
export { ProcessImageEmbedding } from './data-image-embedding';
|
|
@@ -18,7 +19,11 @@ export { DataImmutableFields } from './data-immutable-fields';
|
|
|
18
19
|
export { DataInflection } from './data-inflection';
|
|
19
20
|
export { DataInheritFromParent } from './data-inherit-from-parent';
|
|
20
21
|
export { JobTrigger } from './data-job-trigger';
|
|
21
|
-
export {
|
|
22
|
+
export { LimitEnforceCounter } from './data-limit-counter';
|
|
23
|
+
export { LimitEnforceRate } from './data-meter-rate-limit';
|
|
24
|
+
export { LimitWarningCounter } from './limit-warning-counter';
|
|
25
|
+
export { LimitWarningAggregate } from './limit-warning-aggregate';
|
|
26
|
+
export { LimitWarningRate } from './limit-warning-rate';
|
|
22
27
|
export { DataJsonb } from './data-jsonb';
|
|
23
28
|
export { DataOwnedFields } from './data-owned-fields';
|
|
24
29
|
export { ProcessExtraction } from './process-extraction';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const LimitWarningAggregate = {
|
|
2
|
+
name: 'LimitWarningAggregate',
|
|
3
|
+
slug: 'limit_warning_aggregate',
|
|
4
|
+
category: 'limit_warning',
|
|
5
|
+
display_name: 'Warning Aggregate',
|
|
6
|
+
description: 'Attaches an AFTER INSERT trigger that checks if the entity\'s aggregate usage has crossed any warning threshold configured in the limit_warnings table. If a threshold is reached for the first time, enqueues a background job (e.g. email notification). Uses limit_warning_state for one-time dedup per warning/actor/entity triple. Requires a provisioned limits_module with limit_warnings and aggregate limits enabled.',
|
|
7
|
+
parameter_schema: {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
limit_name: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
description: 'Name of the aggregate limit to watch (must match a limit_warnings.name entry, e.g. "databases", "members")',
|
|
13
|
+
},
|
|
14
|
+
entity_field: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
format: 'column-ref',
|
|
17
|
+
description: 'Column on the target table that holds the entity id for aggregate limit lookup',
|
|
18
|
+
default: 'entity_id',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
required: ['limit_name'],
|
|
22
|
+
},
|
|
23
|
+
tags: ['limits', 'triggers', 'aggregates', 'warning', 'notifications'],
|
|
24
|
+
};
|