node-type-registry 0.36.0 → 0.38.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 +46 -7
- package/codegen/generate-types.js +40 -4
- 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/index.d.ts +0 -10
- package/data/index.js +1 -21
- package/data/search-unified.js +8 -0
- package/data/search-vector.js +12 -0
- package/esm/blueprint-types.generated.d.ts +46 -7
- package/esm/codegen/generate-types.js +40 -4
- 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/index.d.ts +0 -10
- package/esm/data/index.js +0 -10
- package/esm/data/search-unified.js +8 -0
- package/esm/data/search-vector.js +12 -0
- package/esm/event/index.d.ts +2 -0
- package/esm/event/index.js +2 -0
- package/esm/event/referral.d.ts +2 -0
- package/esm/event/referral.js +62 -0
- package/esm/event/tracker.d.ts +2 -0
- package/esm/event/tracker.js +71 -0
- package/esm/index.d.ts +5 -0
- package/esm/index.js +13 -0
- package/esm/job/index.d.ts +1 -0
- package/esm/job/index.js +1 -0
- package/esm/{data/data-job-trigger.js → job/trigger.js} +3 -53
- package/esm/limit/enforce-aggregate.d.ts +2 -0
- package/esm/{data/data-aggregate-limit-counter.js → limit/enforce-aggregate.js} +6 -6
- package/esm/limit/enforce-counter.d.ts +2 -0
- package/esm/{data/data-limit-counter.js → limit/enforce-counter.js} +6 -6
- package/esm/limit/enforce-feature.d.ts +2 -0
- package/esm/{data/data-feature-flag.js → limit/enforce-feature.js} +6 -6
- package/esm/limit/enforce-rate.d.ts +2 -0
- package/esm/limit/enforce-rate.js +39 -0
- package/esm/limit/index.d.ts +8 -0
- package/esm/limit/index.js +8 -0
- package/esm/limit/track-usage.d.ts +2 -0
- package/esm/{data/data-billing-meter.js → limit/track-usage.js} +6 -6
- package/esm/limit/warning-aggregate.d.ts +2 -0
- package/esm/limit/warning-aggregate.js +24 -0
- package/esm/limit/warning-counter.d.ts +2 -0
- package/esm/limit/warning-counter.js +30 -0
- package/esm/limit/warning-rate.d.ts +2 -0
- package/esm/limit/warning-rate.js +30 -0
- package/esm/module-presets/auth-email-magic.js +2 -2
- package/esm/module-presets/auth-email.js +5 -5
- package/esm/module-presets/auth-hardened.js +2 -2
- package/esm/module-presets/auth-passkey.js +2 -2
- package/esm/module-presets/auth-sso.d.ts +1 -1
- package/esm/module-presets/auth-sso.js +5 -5
- package/esm/module-presets/b2b-storage.js +6 -6
- package/esm/module-presets/b2b.js +2 -2
- package/esm/module-presets/minimal.d.ts +1 -1
- package/esm/module-presets/minimal.js +3 -3
- package/esm/{data/data-chunks.js → process/chunks.js} +19 -0
- package/esm/{data/process-extraction.js → process/extraction.js} +15 -10
- package/esm/{data/data-file-embedding.js → process/file-embedding.js} +22 -10
- package/esm/{data/data-image-embedding.js → process/image-embedding.js} +15 -9
- package/esm/{data/process-image-versions.js → process/image-versions.js} +3 -9
- package/esm/process/index.d.ts +5 -0
- package/esm/process/index.js +5 -0
- package/event/index.d.ts +2 -0
- package/event/index.js +7 -0
- package/event/referral.d.ts +2 -0
- package/event/referral.js +65 -0
- package/event/tracker.d.ts +2 -0
- package/event/tracker.js +74 -0
- package/index.d.ts +5 -0
- package/index.js +13 -0
- package/job/index.d.ts +1 -0
- package/job/index.js +5 -0
- package/{data/data-job-trigger.js → job/trigger.js} +3 -53
- package/limit/enforce-aggregate.d.ts +2 -0
- package/{data/data-aggregate-limit-counter.js → limit/enforce-aggregate.js} +7 -7
- package/limit/enforce-counter.d.ts +2 -0
- package/{data/data-limit-counter.js → limit/enforce-counter.js} +7 -7
- package/limit/enforce-feature.d.ts +2 -0
- package/{data/data-feature-flag.js → limit/enforce-feature.js} +7 -7
- package/limit/enforce-rate.d.ts +2 -0
- package/limit/enforce-rate.js +42 -0
- package/limit/index.d.ts +8 -0
- package/limit/index.js +19 -0
- package/limit/track-usage.d.ts +2 -0
- package/{data/data-billing-meter.js → limit/track-usage.js} +7 -7
- package/limit/warning-aggregate.d.ts +2 -0
- package/limit/warning-aggregate.js +27 -0
- package/limit/warning-counter.d.ts +2 -0
- package/limit/warning-counter.js +33 -0
- package/limit/warning-rate.d.ts +2 -0
- package/limit/warning-rate.js +33 -0
- package/module-presets/auth-email-magic.js +2 -2
- package/module-presets/auth-email.js +5 -5
- package/module-presets/auth-hardened.js +2 -2
- package/module-presets/auth-passkey.js +2 -2
- package/module-presets/auth-sso.d.ts +1 -1
- package/module-presets/auth-sso.js +5 -5
- package/module-presets/b2b-storage.js +6 -6
- package/module-presets/b2b.js +2 -2
- package/module-presets/minimal.d.ts +1 -1
- package/module-presets/minimal.js +3 -3
- package/package.json +2 -2
- package/{data/data-chunks.js → process/chunks.js} +19 -0
- package/{data/process-extraction.js → process/extraction.js} +15 -10
- package/{data/data-file-embedding.js → process/file-embedding.js} +22 -10
- package/{data/data-image-embedding.js → process/image-embedding.js} +15 -9
- package/{data/process-image-versions.js → process/image-versions.js} +3 -9
- package/process/index.d.ts +5 -0
- package/process/index.js +13 -0
- package/data/data-aggregate-limit-counter.d.ts +0 -2
- package/data/data-billing-meter.d.ts +0 -2
- package/data/data-feature-flag.d.ts +0 -2
- package/data/data-limit-counter.d.ts +0 -2
- package/esm/data/data-aggregate-limit-counter.d.ts +0 -2
- package/esm/data/data-billing-meter.d.ts +0 -2
- package/esm/data/data-feature-flag.d.ts +0 -2
- package/esm/data/data-limit-counter.d.ts +0 -2
- /package/{data/data-job-trigger.d.ts → esm/job/trigger.d.ts} +0 -0
- /package/{data/data-chunks.d.ts → esm/process/chunks.d.ts} +0 -0
- /package/{data/process-extraction.d.ts → esm/process/extraction.d.ts} +0 -0
- /package/{data/data-file-embedding.d.ts → esm/process/file-embedding.d.ts} +0 -0
- /package/{data/data-image-embedding.d.ts → esm/process/image-embedding.d.ts} +0 -0
- /package/{data/process-image-versions.d.ts → esm/process/image-versions.d.ts} +0 -0
- /package/{esm/data/data-job-trigger.d.ts → job/trigger.d.ts} +0 -0
- /package/{esm/data/data-chunks.d.ts → process/chunks.d.ts} +0 -0
- /package/{esm/data/process-extraction.d.ts → process/extraction.d.ts} +0 -0
- /package/{esm/data/data-file-embedding.d.ts → process/file-embedding.d.ts} +0 -0
- /package/{esm/data/data-image-embedding.d.ts → process/image-embedding.d.ts} +0 -0
- /package/{esm/data/process-image-versions.d.ts → process/image-versions.d.ts} +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { conditionDefs, triggerConditionsProperty } from '../conditions';
|
|
1
2
|
/**
|
|
2
3
|
* Image version processing node.
|
|
3
4
|
*
|
|
@@ -23,6 +24,7 @@ export const ProcessImageVersions = {
|
|
|
23
24
|
'file records linked to the source image.',
|
|
24
25
|
parameter_schema: {
|
|
25
26
|
type: 'object',
|
|
27
|
+
$defs: conditionDefs,
|
|
26
28
|
required: ['versions'],
|
|
27
29
|
properties: {
|
|
28
30
|
// ── Version definitions ───────────────────────────────────────
|
|
@@ -98,15 +100,7 @@ export const ProcessImageVersions = {
|
|
|
98
100
|
bucket_id: 'bucket_id'
|
|
99
101
|
}
|
|
100
102
|
},
|
|
101
|
-
trigger_conditions:
|
|
102
|
-
description: 'Additional compound conditions beyond MIME filtering. ' +
|
|
103
|
-
'Merged with the auto-generated MIME conditions via AND.',
|
|
104
|
-
'x-codegen-type': 'TriggerCondition | TriggerCondition[]',
|
|
105
|
-
oneOf: [
|
|
106
|
-
{ $ref: '#/$defs/triggerCondition' },
|
|
107
|
-
{ type: 'array', items: { $ref: '#/$defs/triggerCondition' } }
|
|
108
|
-
]
|
|
109
|
-
},
|
|
103
|
+
trigger_conditions: triggerConditionsProperty,
|
|
110
104
|
// ── Job options ───────────────────────────────────────────────
|
|
111
105
|
queue_name: {
|
|
112
106
|
type: 'string',
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { ProcessChunks } from './chunks';
|
|
2
|
+
export { ProcessExtraction } from './extraction';
|
|
3
|
+
export { ProcessFileEmbedding } from './file-embedding';
|
|
4
|
+
export { ProcessImageEmbedding } from './image-embedding';
|
|
5
|
+
export { ProcessImageVersions } from './image-versions';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { ProcessChunks } from './chunks';
|
|
2
|
+
export { ProcessExtraction } from './extraction';
|
|
3
|
+
export { ProcessFileEmbedding } from './file-embedding';
|
|
4
|
+
export { ProcessImageEmbedding } from './image-embedding';
|
|
5
|
+
export { ProcessImageVersions } from './image-versions';
|
package/event/index.d.ts
ADDED
package/event/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EventTracker = exports.EventReferral = void 0;
|
|
4
|
+
var referral_1 = require("./referral");
|
|
5
|
+
Object.defineProperty(exports, "EventReferral", { enumerable: true, get: function () { return referral_1.EventReferral; } });
|
|
6
|
+
var tracker_1 = require("./tracker");
|
|
7
|
+
Object.defineProperty(exports, "EventTracker", { enumerable: true, get: function () { return tracker_1.EventTracker; } });
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EventReferral = void 0;
|
|
4
|
+
const conditions_1 = require("../conditions");
|
|
5
|
+
exports.EventReferral = {
|
|
6
|
+
name: 'EventReferral',
|
|
7
|
+
slug: 'event_referral',
|
|
8
|
+
category: 'event',
|
|
9
|
+
display_name: 'Event Referral',
|
|
10
|
+
description: 'Creates triggers that record events for the referrer (inviter) when their ' +
|
|
11
|
+
'invitees perform actions on a watched table. Resolves the referrer automatically ' +
|
|
12
|
+
'via the invites module\'s claimed_invites table using the membership_type context. ' +
|
|
13
|
+
'Supports the same compound condition system as EventTracker. Use with achievements ' +
|
|
14
|
+
'to unlock levels and grant credits based on invitee activity.',
|
|
15
|
+
parameter_schema: {
|
|
16
|
+
type: 'object',
|
|
17
|
+
$defs: conditions_1.conditionDefs,
|
|
18
|
+
properties: {
|
|
19
|
+
event_name: {
|
|
20
|
+
type: 'string',
|
|
21
|
+
description: 'Event type name to record for the referrer (e.g., "invitee_uploaded_avatar", "invitee_completed_onboarding")'
|
|
22
|
+
},
|
|
23
|
+
events: {
|
|
24
|
+
type: 'array',
|
|
25
|
+
items: {
|
|
26
|
+
type: 'string',
|
|
27
|
+
enum: [
|
|
28
|
+
'INSERT',
|
|
29
|
+
'UPDATE',
|
|
30
|
+
'DELETE'
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
description: 'DML events that trigger recording',
|
|
34
|
+
default: ['INSERT']
|
|
35
|
+
},
|
|
36
|
+
actor_field: {
|
|
37
|
+
type: 'string',
|
|
38
|
+
format: 'column-ref',
|
|
39
|
+
description: 'Column containing the invitee (actor) ID on the source table — used to look up the referrer via claimed_invites.receiver_id',
|
|
40
|
+
default: 'owner_id'
|
|
41
|
+
},
|
|
42
|
+
entity_field: {
|
|
43
|
+
type: 'string',
|
|
44
|
+
format: 'column-ref',
|
|
45
|
+
description: 'Column containing the entity ID (org/group) for entity-scoped referral events. Omit for user-only events.'
|
|
46
|
+
},
|
|
47
|
+
auto_register_type: {
|
|
48
|
+
type: 'boolean',
|
|
49
|
+
description: 'Automatically register the event_name in event_types during provisioning',
|
|
50
|
+
default: true
|
|
51
|
+
},
|
|
52
|
+
...conditions_1.conditionProperties
|
|
53
|
+
},
|
|
54
|
+
required: [
|
|
55
|
+
'event_name'
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
tags: [
|
|
59
|
+
'events',
|
|
60
|
+
'referral',
|
|
61
|
+
'invites',
|
|
62
|
+
'analytics',
|
|
63
|
+
'tracking'
|
|
64
|
+
]
|
|
65
|
+
};
|
package/event/tracker.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EventTracker = void 0;
|
|
4
|
+
const conditions_1 = require("../conditions");
|
|
5
|
+
exports.EventTracker = {
|
|
6
|
+
name: 'EventTracker',
|
|
7
|
+
slug: 'event_tracker',
|
|
8
|
+
category: 'event',
|
|
9
|
+
display_name: 'Event Tracker',
|
|
10
|
+
description: 'Creates triggers that record events via the events module when table rows change. ' +
|
|
11
|
+
'Supports the same compound condition system as JobTrigger (condition_field, watch_fields, ' +
|
|
12
|
+
'or full AND/OR/NOT conditions). Events are recorded to app_events and aggregated ' +
|
|
13
|
+
'automatically. Use with achievements (blueprint-level) to unlock levels and grant ' +
|
|
14
|
+
'credits based on event accumulation.',
|
|
15
|
+
parameter_schema: {
|
|
16
|
+
type: 'object',
|
|
17
|
+
$defs: conditions_1.conditionDefs,
|
|
18
|
+
properties: {
|
|
19
|
+
event_name: {
|
|
20
|
+
type: 'string',
|
|
21
|
+
description: 'Event type name to record (e.g., "avatar_uploaded", "order_completed")'
|
|
22
|
+
},
|
|
23
|
+
events: {
|
|
24
|
+
type: 'array',
|
|
25
|
+
items: {
|
|
26
|
+
type: 'string',
|
|
27
|
+
enum: [
|
|
28
|
+
'INSERT',
|
|
29
|
+
'UPDATE',
|
|
30
|
+
'DELETE'
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
description: 'DML events that trigger recording',
|
|
34
|
+
default: ['INSERT']
|
|
35
|
+
},
|
|
36
|
+
count: {
|
|
37
|
+
type: 'integer',
|
|
38
|
+
description: 'Number of events to record per trigger fire',
|
|
39
|
+
default: 1
|
|
40
|
+
},
|
|
41
|
+
toggle: {
|
|
42
|
+
type: 'boolean',
|
|
43
|
+
description: 'Toggle mode: records event when condition is met, removes when condition is unmet',
|
|
44
|
+
default: false
|
|
45
|
+
},
|
|
46
|
+
actor_field: {
|
|
47
|
+
type: 'string',
|
|
48
|
+
format: 'column-ref',
|
|
49
|
+
description: 'Column containing the actor (user) ID to attribute the event to',
|
|
50
|
+
default: 'owner_id'
|
|
51
|
+
},
|
|
52
|
+
entity_field: {
|
|
53
|
+
type: 'string',
|
|
54
|
+
format: 'column-ref',
|
|
55
|
+
description: 'Column containing the entity ID (org/group) for entity-scoped events. Omit for user-only events.'
|
|
56
|
+
},
|
|
57
|
+
auto_register_type: {
|
|
58
|
+
type: 'boolean',
|
|
59
|
+
description: 'Automatically register the event_name in event_types during provisioning',
|
|
60
|
+
default: true
|
|
61
|
+
},
|
|
62
|
+
...conditions_1.conditionProperties
|
|
63
|
+
},
|
|
64
|
+
required: [
|
|
65
|
+
'event_name'
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
tags: [
|
|
69
|
+
'events',
|
|
70
|
+
'triggers',
|
|
71
|
+
'analytics',
|
|
72
|
+
'tracking'
|
|
73
|
+
]
|
|
74
|
+
};
|
package/index.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
export * from './authz';
|
|
2
2
|
export * from './blueprint-types.generated';
|
|
3
|
+
export * from './conditions';
|
|
3
4
|
export * from './data';
|
|
5
|
+
export * from './event';
|
|
6
|
+
export * from './job';
|
|
7
|
+
export * from './limit';
|
|
4
8
|
export * from './module-presets';
|
|
9
|
+
export * from './process';
|
|
5
10
|
export * from './relation';
|
|
6
11
|
export type { JSONSchema, NodeTypeDefinition } from './types';
|
|
7
12
|
export * from './view';
|
package/index.js
CHANGED
|
@@ -39,17 +39,30 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.allNodeTypes = void 0;
|
|
40
40
|
__exportStar(require("./authz"), exports);
|
|
41
41
|
__exportStar(require("./blueprint-types.generated"), exports);
|
|
42
|
+
__exportStar(require("./conditions"), exports);
|
|
42
43
|
__exportStar(require("./data"), exports);
|
|
44
|
+
__exportStar(require("./event"), exports);
|
|
45
|
+
__exportStar(require("./job"), exports);
|
|
46
|
+
__exportStar(require("./limit"), exports);
|
|
43
47
|
__exportStar(require("./module-presets"), exports);
|
|
48
|
+
__exportStar(require("./process"), exports);
|
|
44
49
|
__exportStar(require("./relation"), exports);
|
|
45
50
|
__exportStar(require("./view"), exports);
|
|
46
51
|
const authz = __importStar(require("./authz"));
|
|
47
52
|
const data = __importStar(require("./data"));
|
|
53
|
+
const event = __importStar(require("./event"));
|
|
54
|
+
const job = __importStar(require("./job"));
|
|
55
|
+
const limit = __importStar(require("./limit"));
|
|
56
|
+
const process = __importStar(require("./process"));
|
|
48
57
|
const relation = __importStar(require("./relation"));
|
|
49
58
|
const view = __importStar(require("./view"));
|
|
50
59
|
exports.allNodeTypes = [
|
|
51
60
|
...Object.values(authz),
|
|
52
61
|
...Object.values(data),
|
|
62
|
+
...Object.values(event),
|
|
63
|
+
...Object.values(job),
|
|
64
|
+
...Object.values(limit),
|
|
65
|
+
...Object.values(process),
|
|
53
66
|
...Object.values(relation),
|
|
54
67
|
...Object.values(view)
|
|
55
68
|
];
|
package/job/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { JobTrigger } from './trigger';
|
package/job/index.js
ADDED
|
@@ -1,31 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.JobTrigger = void 0;
|
|
4
|
-
const
|
|
5
|
-
type: 'object',
|
|
6
|
-
description: 'A leaf condition ({field, op, value?, row?, ref?}) or a combinator ({AND, OR, NOT}).',
|
|
7
|
-
properties: {
|
|
8
|
-
field: { type: 'string', format: 'column-ref', description: 'Column name (validated against the table).' },
|
|
9
|
-
op: {
|
|
10
|
-
type: 'string',
|
|
11
|
-
enum: ['=', '!=', '>', '<', '>=', '<=', 'LIKE', 'NOT LIKE', 'IS NULL', 'IS NOT NULL', 'IS DISTINCT FROM'],
|
|
12
|
-
description: 'Comparison operator.'
|
|
13
|
-
},
|
|
14
|
-
value: { description: 'Comparison value. Type is resolved from the column definition. Omit for IS NULL, IS NOT NULL, IS DISTINCT FROM.' },
|
|
15
|
-
row: { type: 'string', enum: ['NEW', 'OLD'], default: 'NEW', description: 'Row reference (default: NEW).' },
|
|
16
|
-
ref: {
|
|
17
|
-
type: 'object',
|
|
18
|
-
description: 'Column reference for field-to-field comparison (alternative to value).',
|
|
19
|
-
properties: {
|
|
20
|
-
field: { type: 'string', format: 'column-ref' },
|
|
21
|
-
row: { type: 'string', enum: ['NEW', 'OLD'], default: 'NEW' }
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
AND: { type: 'array', description: 'Array of conditions combined with AND.', items: { $ref: '#/$defs/triggerCondition' } },
|
|
25
|
-
OR: { type: 'array', description: 'Array of conditions combined with OR.', items: { $ref: '#/$defs/triggerCondition' } },
|
|
26
|
-
NOT: { $ref: '#/$defs/triggerCondition', description: 'Negated condition.' }
|
|
27
|
-
}
|
|
28
|
-
};
|
|
4
|
+
const conditions_1 = require("../conditions");
|
|
29
5
|
exports.JobTrigger = {
|
|
30
6
|
name: 'JobTrigger',
|
|
31
7
|
slug: 'data_job_trigger',
|
|
@@ -34,9 +10,7 @@ exports.JobTrigger = {
|
|
|
34
10
|
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).',
|
|
35
11
|
parameter_schema: {
|
|
36
12
|
type: 'object',
|
|
37
|
-
$defs:
|
|
38
|
-
triggerCondition: triggerConditionSchema
|
|
39
|
-
},
|
|
13
|
+
$defs: conditions_1.conditionDefs,
|
|
40
14
|
properties: {
|
|
41
15
|
task_identifier: {
|
|
42
16
|
type: 'string',
|
|
@@ -95,31 +69,7 @@ exports.JobTrigger = {
|
|
|
95
69
|
description: 'Include table/schema metadata in payload',
|
|
96
70
|
default: false
|
|
97
71
|
},
|
|
98
|
-
|
|
99
|
-
type: 'string',
|
|
100
|
-
format: 'column-ref',
|
|
101
|
-
description: 'Column name for conditional WHEN clause (fires only when field equals condition_value)'
|
|
102
|
-
},
|
|
103
|
-
condition_value: {
|
|
104
|
-
type: 'string',
|
|
105
|
-
description: 'Value to compare against condition_field in WHEN clause'
|
|
106
|
-
},
|
|
107
|
-
conditions: {
|
|
108
|
-
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.',
|
|
109
|
-
'x-codegen-type': 'TriggerCondition | TriggerCondition[]',
|
|
110
|
-
oneOf: [
|
|
111
|
-
{ $ref: '#/$defs/triggerCondition' },
|
|
112
|
-
{ type: 'array', items: { $ref: '#/$defs/triggerCondition' } }
|
|
113
|
-
]
|
|
114
|
-
},
|
|
115
|
-
watch_fields: {
|
|
116
|
-
type: 'array',
|
|
117
|
-
items: {
|
|
118
|
-
type: 'string',
|
|
119
|
-
format: 'column-ref'
|
|
120
|
-
},
|
|
121
|
-
description: 'For UPDATE triggers, only fire when these fields change (uses DISTINCT FROM)'
|
|
122
|
-
},
|
|
72
|
+
...conditions_1.conditionProperties,
|
|
123
73
|
job_key: {
|
|
124
74
|
type: 'string',
|
|
125
75
|
description: 'Static job key for upsert semantics (prevents duplicate jobs)'
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
5
|
-
name: '
|
|
6
|
-
slug: '
|
|
7
|
-
category: '
|
|
8
|
-
display_name: 'Aggregate
|
|
3
|
+
exports.LimitEnforceAggregate = void 0;
|
|
4
|
+
exports.LimitEnforceAggregate = {
|
|
5
|
+
name: 'LimitEnforceAggregate',
|
|
6
|
+
slug: 'limit_enforce_aggregate',
|
|
7
|
+
category: 'limit_enforce',
|
|
8
|
+
display_name: 'Enforce Aggregate Counter',
|
|
9
9
|
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.',
|
|
10
10
|
parameter_schema: {
|
|
11
11
|
type: 'object',
|
|
@@ -32,5 +32,5 @@ exports.LimitAggregate = {
|
|
|
32
32
|
},
|
|
33
33
|
required: ['limit_name'],
|
|
34
34
|
},
|
|
35
|
-
tags: ['limits', 'triggers', 'aggregates', '
|
|
35
|
+
tags: ['limits', 'triggers', 'aggregates', 'enforce'],
|
|
36
36
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
5
|
-
name: '
|
|
6
|
-
slug: '
|
|
7
|
-
category: '
|
|
8
|
-
display_name: '
|
|
3
|
+
exports.LimitEnforceCounter = void 0;
|
|
4
|
+
exports.LimitEnforceCounter = {
|
|
5
|
+
name: 'LimitEnforceCounter',
|
|
6
|
+
slug: 'limit_enforce_counter',
|
|
7
|
+
category: 'limit_enforce',
|
|
8
|
+
display_name: 'Enforce Counter',
|
|
9
9
|
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.',
|
|
10
10
|
parameter_schema: {
|
|
11
11
|
type: 'object',
|
|
@@ -38,5 +38,5 @@ exports.LimitCounter = {
|
|
|
38
38
|
},
|
|
39
39
|
required: ['limit_name'],
|
|
40
40
|
},
|
|
41
|
-
tags: ['limits', 'triggers', '
|
|
41
|
+
tags: ['limits', 'triggers', 'enforce'],
|
|
42
42
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
5
|
-
name: '
|
|
6
|
-
slug: '
|
|
7
|
-
category: '
|
|
8
|
-
display_name: 'Feature Flag',
|
|
3
|
+
exports.LimitEnforceFeature = void 0;
|
|
4
|
+
exports.LimitEnforceFeature = {
|
|
5
|
+
name: 'LimitEnforceFeature',
|
|
6
|
+
slug: 'limit_enforce_feature',
|
|
7
|
+
category: 'limit_enforce',
|
|
8
|
+
display_name: 'Enforce Feature Flag',
|
|
9
9
|
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).',
|
|
10
10
|
parameter_schema: {
|
|
11
11
|
type: 'object',
|
|
@@ -29,5 +29,5 @@ exports.LimitFeatureFlag = {
|
|
|
29
29
|
},
|
|
30
30
|
required: ['feature_name'],
|
|
31
31
|
},
|
|
32
|
-
tags: ['limits', 'triggers', 'feature-flags', '
|
|
32
|
+
tags: ['limits', 'triggers', 'feature-flags', 'enforce', 'caps'],
|
|
33
33
|
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LimitEnforceRate = void 0;
|
|
4
|
+
exports.LimitEnforceRate = {
|
|
5
|
+
name: 'LimitEnforceRate',
|
|
6
|
+
slug: 'limit_enforce_rate',
|
|
7
|
+
category: 'limit_enforce',
|
|
8
|
+
display_name: 'Enforce Rate Limit',
|
|
9
|
+
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.',
|
|
10
|
+
parameter_schema: {
|
|
11
|
+
type: 'object',
|
|
12
|
+
properties: {
|
|
13
|
+
meter_slug: {
|
|
14
|
+
type: 'string',
|
|
15
|
+
description: 'Slug of the billing meter to check rate limits against (must match a meters table entry, e.g. "messaging", "inference")',
|
|
16
|
+
},
|
|
17
|
+
entity_field: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
format: 'column-ref',
|
|
20
|
+
description: 'Column on the target table that holds the entity id (org) for rate limiting',
|
|
21
|
+
default: 'entity_id',
|
|
22
|
+
},
|
|
23
|
+
actor_field: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
format: 'column-ref',
|
|
26
|
+
description: 'Column on the target table that holds the actor id (user) for rate limiting',
|
|
27
|
+
default: 'owner_id',
|
|
28
|
+
},
|
|
29
|
+
events: {
|
|
30
|
+
type: 'array',
|
|
31
|
+
items: {
|
|
32
|
+
type: 'string',
|
|
33
|
+
enum: ['INSERT', 'UPDATE'],
|
|
34
|
+
},
|
|
35
|
+
description: 'Which DML events to enforce rate limits on (DELETE is excluded since it reduces load)',
|
|
36
|
+
default: ['INSERT'],
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
required: ['meter_slug'],
|
|
40
|
+
},
|
|
41
|
+
tags: ['rate-limits', 'triggers', 'enforce', 'metering', 'abuse-protection'],
|
|
42
|
+
};
|
package/limit/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { LimitEnforceAggregate } from './enforce-aggregate';
|
|
2
|
+
export { LimitEnforceCounter } from './enforce-counter';
|
|
3
|
+
export { LimitEnforceFeature } from './enforce-feature';
|
|
4
|
+
export { LimitEnforceRate } from './enforce-rate';
|
|
5
|
+
export { LimitTrackUsage } from './track-usage';
|
|
6
|
+
export { LimitWarningAggregate } from './warning-aggregate';
|
|
7
|
+
export { LimitWarningCounter } from './warning-counter';
|
|
8
|
+
export { LimitWarningRate } from './warning-rate';
|
package/limit/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LimitWarningRate = exports.LimitWarningCounter = exports.LimitWarningAggregate = exports.LimitTrackUsage = exports.LimitEnforceRate = exports.LimitEnforceFeature = exports.LimitEnforceCounter = exports.LimitEnforceAggregate = void 0;
|
|
4
|
+
var enforce_aggregate_1 = require("./enforce-aggregate");
|
|
5
|
+
Object.defineProperty(exports, "LimitEnforceAggregate", { enumerable: true, get: function () { return enforce_aggregate_1.LimitEnforceAggregate; } });
|
|
6
|
+
var enforce_counter_1 = require("./enforce-counter");
|
|
7
|
+
Object.defineProperty(exports, "LimitEnforceCounter", { enumerable: true, get: function () { return enforce_counter_1.LimitEnforceCounter; } });
|
|
8
|
+
var enforce_feature_1 = require("./enforce-feature");
|
|
9
|
+
Object.defineProperty(exports, "LimitEnforceFeature", { enumerable: true, get: function () { return enforce_feature_1.LimitEnforceFeature; } });
|
|
10
|
+
var enforce_rate_1 = require("./enforce-rate");
|
|
11
|
+
Object.defineProperty(exports, "LimitEnforceRate", { enumerable: true, get: function () { return enforce_rate_1.LimitEnforceRate; } });
|
|
12
|
+
var track_usage_1 = require("./track-usage");
|
|
13
|
+
Object.defineProperty(exports, "LimitTrackUsage", { enumerable: true, get: function () { return track_usage_1.LimitTrackUsage; } });
|
|
14
|
+
var warning_aggregate_1 = require("./warning-aggregate");
|
|
15
|
+
Object.defineProperty(exports, "LimitWarningAggregate", { enumerable: true, get: function () { return warning_aggregate_1.LimitWarningAggregate; } });
|
|
16
|
+
var warning_counter_1 = require("./warning-counter");
|
|
17
|
+
Object.defineProperty(exports, "LimitWarningCounter", { enumerable: true, get: function () { return warning_counter_1.LimitWarningCounter; } });
|
|
18
|
+
var warning_rate_1 = require("./warning-rate");
|
|
19
|
+
Object.defineProperty(exports, "LimitWarningRate", { enumerable: true, get: function () { return warning_rate_1.LimitWarningRate; } });
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
5
|
-
name: '
|
|
6
|
-
slug: '
|
|
7
|
-
category: '
|
|
8
|
-
display_name: '
|
|
3
|
+
exports.LimitTrackUsage = void 0;
|
|
4
|
+
exports.LimitTrackUsage = {
|
|
5
|
+
name: 'LimitTrackUsage',
|
|
6
|
+
slug: 'limit_track_usage',
|
|
7
|
+
category: 'limit_track',
|
|
8
|
+
display_name: 'Track Usage',
|
|
9
9
|
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.',
|
|
10
10
|
parameter_schema: {
|
|
11
11
|
type: 'object',
|
|
@@ -37,5 +37,5 @@ exports.BillingMeter = {
|
|
|
37
37
|
},
|
|
38
38
|
required: ['meter_slug'],
|
|
39
39
|
},
|
|
40
|
-
tags: ['billing', 'triggers', 'metering', 'usage'],
|
|
40
|
+
tags: ['billing', 'triggers', 'metering', 'usage', 'track'],
|
|
41
41
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LimitWarningAggregate = void 0;
|
|
4
|
+
exports.LimitWarningAggregate = {
|
|
5
|
+
name: 'LimitWarningAggregate',
|
|
6
|
+
slug: 'limit_warning_aggregate',
|
|
7
|
+
category: 'limit_warning',
|
|
8
|
+
display_name: 'Warning Aggregate',
|
|
9
|
+
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.',
|
|
10
|
+
parameter_schema: {
|
|
11
|
+
type: 'object',
|
|
12
|
+
properties: {
|
|
13
|
+
limit_name: {
|
|
14
|
+
type: 'string',
|
|
15
|
+
description: 'Name of the aggregate limit to watch (must match a limit_warnings.name entry, e.g. "databases", "members")',
|
|
16
|
+
},
|
|
17
|
+
entity_field: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
format: 'column-ref',
|
|
20
|
+
description: 'Column on the target table that holds the entity id for aggregate limit lookup',
|
|
21
|
+
default: 'entity_id',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
required: ['limit_name'],
|
|
25
|
+
},
|
|
26
|
+
tags: ['limits', 'triggers', 'aggregates', 'warning', 'notifications'],
|
|
27
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LimitWarningCounter = void 0;
|
|
4
|
+
exports.LimitWarningCounter = {
|
|
5
|
+
name: 'LimitWarningCounter',
|
|
6
|
+
slug: 'limit_warning_counter',
|
|
7
|
+
category: 'limit_warning',
|
|
8
|
+
display_name: 'Warning Counter',
|
|
9
|
+
description: 'Attaches an AFTER INSERT trigger that checks if the actor\'s current 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 pair. Requires a provisioned limits_module with limit_warnings enabled.',
|
|
10
|
+
parameter_schema: {
|
|
11
|
+
type: 'object',
|
|
12
|
+
properties: {
|
|
13
|
+
limit_name: {
|
|
14
|
+
type: 'string',
|
|
15
|
+
description: 'Name of the limit to watch (must match a limit_warnings.name entry, e.g. "projects", "members")',
|
|
16
|
+
},
|
|
17
|
+
scope: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
enum: ['app', 'org'],
|
|
20
|
+
description: 'Limit scope: "app" (membership_type=1, user-level) or "org" (membership_type=2, entity-level)',
|
|
21
|
+
default: 'app',
|
|
22
|
+
},
|
|
23
|
+
actor_field: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
format: 'column-ref',
|
|
26
|
+
description: 'Column on the target table that holds the actor id for limit lookup',
|
|
27
|
+
default: 'owner_id',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
required: ['limit_name'],
|
|
31
|
+
},
|
|
32
|
+
tags: ['limits', 'triggers', 'warning', 'notifications'],
|
|
33
|
+
};
|