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.
Files changed (73) hide show
  1. package/blueprint-types.generated.d.ts +39 -0
  2. package/codegen/generate-types.js +37 -1
  3. package/conditions/index.d.ts +1 -0
  4. package/conditions/index.js +8 -0
  5. package/conditions/trigger-condition.d.ts +35 -0
  6. package/conditions/trigger-condition.js +97 -0
  7. package/data/data-aggregate-limit-counter.d.ts +1 -1
  8. package/data/data-aggregate-limit-counter.js +7 -7
  9. package/data/data-billing-meter.d.ts +1 -1
  10. package/data/data-billing-meter.js +7 -7
  11. package/data/data-chunks.js +20 -0
  12. package/data/data-feature-flag.d.ts +1 -1
  13. package/data/data-feature-flag.js +7 -7
  14. package/data/data-file-embedding.js +22 -10
  15. package/data/data-image-embedding.js +15 -9
  16. package/data/data-job-trigger.js +3 -53
  17. package/data/data-limit-counter.d.ts +1 -1
  18. package/data/data-limit-counter.js +7 -7
  19. package/data/data-meter-rate-limit.d.ts +2 -0
  20. package/data/data-meter-rate-limit.js +42 -0
  21. package/data/event-tracker.d.ts +2 -0
  22. package/data/event-tracker.js +74 -0
  23. package/data/index.d.ts +9 -4
  24. package/data/index.js +15 -5
  25. package/data/limit-warning-aggregate.d.ts +2 -0
  26. package/data/limit-warning-aggregate.js +27 -0
  27. package/data/limit-warning-counter.d.ts +2 -0
  28. package/data/limit-warning-counter.js +33 -0
  29. package/data/limit-warning-rate.d.ts +2 -0
  30. package/data/limit-warning-rate.js +33 -0
  31. package/data/process-extraction.js +15 -10
  32. package/data/process-image-versions.js +3 -9
  33. package/data/search-unified.js +8 -0
  34. package/data/search-vector.js +12 -0
  35. package/esm/blueprint-types.generated.d.ts +39 -0
  36. package/esm/codegen/generate-types.js +37 -1
  37. package/esm/conditions/index.d.ts +1 -0
  38. package/esm/conditions/index.js +1 -0
  39. package/esm/conditions/trigger-condition.d.ts +35 -0
  40. package/esm/conditions/trigger-condition.js +94 -0
  41. package/esm/data/data-aggregate-limit-counter.d.ts +1 -1
  42. package/esm/data/data-aggregate-limit-counter.js +6 -6
  43. package/esm/data/data-billing-meter.d.ts +1 -1
  44. package/esm/data/data-billing-meter.js +6 -6
  45. package/esm/data/data-chunks.js +20 -0
  46. package/esm/data/data-feature-flag.d.ts +1 -1
  47. package/esm/data/data-feature-flag.js +6 -6
  48. package/esm/data/data-file-embedding.js +22 -10
  49. package/esm/data/data-image-embedding.js +15 -9
  50. package/esm/data/data-job-trigger.js +3 -53
  51. package/esm/data/data-limit-counter.d.ts +1 -1
  52. package/esm/data/data-limit-counter.js +6 -6
  53. package/esm/data/data-meter-rate-limit.d.ts +2 -0
  54. package/esm/data/data-meter-rate-limit.js +39 -0
  55. package/esm/data/event-tracker.d.ts +2 -0
  56. package/esm/data/event-tracker.js +71 -0
  57. package/esm/data/index.d.ts +9 -4
  58. package/esm/data/index.js +9 -4
  59. package/esm/data/limit-warning-aggregate.d.ts +2 -0
  60. package/esm/data/limit-warning-aggregate.js +24 -0
  61. package/esm/data/limit-warning-counter.d.ts +2 -0
  62. package/esm/data/limit-warning-counter.js +30 -0
  63. package/esm/data/limit-warning-rate.d.ts +2 -0
  64. package/esm/data/limit-warning-rate.js +30 -0
  65. package/esm/data/process-extraction.js +15 -10
  66. package/esm/data/process-image-versions.js +3 -9
  67. package/esm/data/search-unified.js +8 -0
  68. package/esm/data/search-vector.js +12 -0
  69. package/esm/index.d.ts +1 -0
  70. package/esm/index.js +1 -0
  71. package/index.d.ts +1 -0
  72. package/index.js +1 -0
  73. package/package.json +2 -2
@@ -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
+ };
@@ -0,0 +1,2 @@
1
+ import type { NodeTypeDefinition } from '../types';
2
+ export declare const EventTracker: NodeTypeDefinition;
@@ -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/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 { LimitAggregate } from './data-aggregate-limit-counter';
6
- export { BillingMeter } from './data-billing-meter';
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 { LimitFeatureFlag } from './data-feature-flag';
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 { LimitCounter } from './data-limit-counter';
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/data/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TableUserSettings = exports.TableUserProfiles = exports.TableOrganizationSettings = exports.SearchVector = exports.SearchUnified = exports.SearchTrgm = exports.SearchSpatialAggregate = exports.SearchSpatial = exports.SearchFullText = exports.SearchBm25 = exports.DataTimestamps = exports.DataTags = exports.DataStatusField = exports.DataSoftDelete = exports.DataSlug = exports.DataRealtime = exports.DataPublishable = exports.DataPeoplestamps = exports.DataOwnershipInEntity = exports.ProcessImageVersions = exports.ProcessExtraction = exports.DataOwnedFields = exports.DataJsonb = exports.LimitCounter = exports.JobTrigger = exports.DataInheritFromParent = exports.DataInflection = exports.DataImmutableFields = exports.ProcessImageEmbedding = exports.DataId = exports.DataForceCurrentUser = exports.LimitFeatureFlag = exports.ProcessFileEmbedding = exports.DataEntityMembership = exports.DataDirectOwner = exports.DataCompositeField = exports.ProcessChunks = exports.DataBulk = exports.BillingMeter = exports.LimitAggregate = exports.CheckOneOf = exports.CheckNotEqual = exports.CheckLessThan = exports.CheckGreaterThan = void 0;
3
+ exports.TableUserSettings = exports.TableUserProfiles = exports.TableOrganizationSettings = exports.SearchVector = exports.SearchUnified = exports.SearchTrgm = exports.SearchSpatialAggregate = exports.SearchSpatial = exports.SearchFullText = exports.SearchBm25 = exports.DataTimestamps = exports.DataTags = exports.DataStatusField = exports.DataSoftDelete = exports.DataSlug = exports.DataRealtime = exports.DataPublishable = exports.DataPeoplestamps = exports.DataOwnershipInEntity = exports.ProcessImageVersions = exports.ProcessExtraction = exports.DataOwnedFields = exports.DataJsonb = exports.LimitWarningRate = exports.LimitWarningAggregate = exports.LimitWarningCounter = exports.LimitEnforceRate = exports.LimitEnforceCounter = exports.JobTrigger = exports.DataInheritFromParent = exports.DataInflection = exports.DataImmutableFields = exports.ProcessImageEmbedding = exports.DataId = exports.DataForceCurrentUser = exports.LimitEnforceFeature = exports.ProcessFileEmbedding = exports.EventTracker = exports.DataEntityMembership = exports.DataDirectOwner = exports.DataCompositeField = exports.ProcessChunks = exports.DataBulk = exports.LimitTrackUsage = exports.LimitEnforceAggregate = exports.CheckOneOf = exports.CheckNotEqual = exports.CheckLessThan = exports.CheckGreaterThan = void 0;
4
4
  var check_greater_than_1 = require("./check-greater-than");
5
5
  Object.defineProperty(exports, "CheckGreaterThan", { enumerable: true, get: function () { return check_greater_than_1.CheckGreaterThan; } });
6
6
  var check_less_than_1 = require("./check-less-than");
@@ -10,9 +10,9 @@ Object.defineProperty(exports, "CheckNotEqual", { enumerable: true, get: functio
10
10
  var check_one_of_1 = require("./check-one-of");
11
11
  Object.defineProperty(exports, "CheckOneOf", { enumerable: true, get: function () { return check_one_of_1.CheckOneOf; } });
12
12
  var data_aggregate_limit_counter_1 = require("./data-aggregate-limit-counter");
13
- Object.defineProperty(exports, "LimitAggregate", { enumerable: true, get: function () { return data_aggregate_limit_counter_1.LimitAggregate; } });
13
+ Object.defineProperty(exports, "LimitEnforceAggregate", { enumerable: true, get: function () { return data_aggregate_limit_counter_1.LimitEnforceAggregate; } });
14
14
  var data_billing_meter_1 = require("./data-billing-meter");
15
- Object.defineProperty(exports, "BillingMeter", { enumerable: true, get: function () { return data_billing_meter_1.BillingMeter; } });
15
+ Object.defineProperty(exports, "LimitTrackUsage", { enumerable: true, get: function () { return data_billing_meter_1.LimitTrackUsage; } });
16
16
  var data_bulk_1 = require("./data-bulk");
17
17
  Object.defineProperty(exports, "DataBulk", { enumerable: true, get: function () { return data_bulk_1.DataBulk; } });
18
18
  var data_chunks_1 = require("./data-chunks");
@@ -23,10 +23,12 @@ var data_direct_owner_1 = require("./data-direct-owner");
23
23
  Object.defineProperty(exports, "DataDirectOwner", { enumerable: true, get: function () { return data_direct_owner_1.DataDirectOwner; } });
24
24
  var data_entity_membership_1 = require("./data-entity-membership");
25
25
  Object.defineProperty(exports, "DataEntityMembership", { enumerable: true, get: function () { return data_entity_membership_1.DataEntityMembership; } });
26
+ var event_tracker_1 = require("./event-tracker");
27
+ Object.defineProperty(exports, "EventTracker", { enumerable: true, get: function () { return event_tracker_1.EventTracker; } });
26
28
  var data_file_embedding_1 = require("./data-file-embedding");
27
29
  Object.defineProperty(exports, "ProcessFileEmbedding", { enumerable: true, get: function () { return data_file_embedding_1.ProcessFileEmbedding; } });
28
30
  var data_feature_flag_1 = require("./data-feature-flag");
29
- Object.defineProperty(exports, "LimitFeatureFlag", { enumerable: true, get: function () { return data_feature_flag_1.LimitFeatureFlag; } });
31
+ Object.defineProperty(exports, "LimitEnforceFeature", { enumerable: true, get: function () { return data_feature_flag_1.LimitEnforceFeature; } });
30
32
  var data_force_current_user_1 = require("./data-force-current-user");
31
33
  Object.defineProperty(exports, "DataForceCurrentUser", { enumerable: true, get: function () { return data_force_current_user_1.DataForceCurrentUser; } });
32
34
  var data_id_1 = require("./data-id");
@@ -42,7 +44,15 @@ Object.defineProperty(exports, "DataInheritFromParent", { enumerable: true, get:
42
44
  var data_job_trigger_1 = require("./data-job-trigger");
43
45
  Object.defineProperty(exports, "JobTrigger", { enumerable: true, get: function () { return data_job_trigger_1.JobTrigger; } });
44
46
  var data_limit_counter_1 = require("./data-limit-counter");
45
- Object.defineProperty(exports, "LimitCounter", { enumerable: true, get: function () { return data_limit_counter_1.LimitCounter; } });
47
+ Object.defineProperty(exports, "LimitEnforceCounter", { enumerable: true, get: function () { return data_limit_counter_1.LimitEnforceCounter; } });
48
+ var data_meter_rate_limit_1 = require("./data-meter-rate-limit");
49
+ Object.defineProperty(exports, "LimitEnforceRate", { enumerable: true, get: function () { return data_meter_rate_limit_1.LimitEnforceRate; } });
50
+ var limit_warning_counter_1 = require("./limit-warning-counter");
51
+ Object.defineProperty(exports, "LimitWarningCounter", { enumerable: true, get: function () { return limit_warning_counter_1.LimitWarningCounter; } });
52
+ var limit_warning_aggregate_1 = require("./limit-warning-aggregate");
53
+ Object.defineProperty(exports, "LimitWarningAggregate", { enumerable: true, get: function () { return limit_warning_aggregate_1.LimitWarningAggregate; } });
54
+ var limit_warning_rate_1 = require("./limit-warning-rate");
55
+ Object.defineProperty(exports, "LimitWarningRate", { enumerable: true, get: function () { return limit_warning_rate_1.LimitWarningRate; } });
46
56
  var data_jsonb_1 = require("./data-jsonb");
47
57
  Object.defineProperty(exports, "DataJsonb", { enumerable: true, get: function () { return data_jsonb_1.DataJsonb; } });
48
58
  var data_owned_fields_1 = require("./data-owned-fields");
@@ -0,0 +1,2 @@
1
+ import type { NodeTypeDefinition } from '../types';
2
+ export declare const LimitWarningAggregate: NodeTypeDefinition;
@@ -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,2 @@
1
+ import type { NodeTypeDefinition } from '../types';
2
+ export declare const LimitWarningCounter: NodeTypeDefinition;
@@ -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
+ };
@@ -0,0 +1,2 @@
1
+ import type { NodeTypeDefinition } from '../types';
2
+ export declare const LimitWarningRate: NodeTypeDefinition;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LimitWarningRate = void 0;
4
+ exports.LimitWarningRate = {
5
+ name: 'LimitWarningRate',
6
+ slug: 'limit_warning_rate',
7
+ category: 'limit_warning',
8
+ display_name: 'Warning Rate Limit',
9
+ description: 'Attaches an AFTER INSERT trigger that checks if the actor\'s current request count in the active sliding window 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 both a limits_module with limit_warnings enabled and a rate_limit_meters_module.',
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)',
16
+ },
17
+ entity_field: {
18
+ type: 'string',
19
+ format: 'column-ref',
20
+ description: 'Column on the target table that holds the entity id for rate limit lookup',
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 for rate limit lookup',
27
+ default: 'owner_id',
28
+ },
29
+ },
30
+ required: ['meter_slug'],
31
+ },
32
+ tags: ['rate-limits', 'triggers', 'warning', 'notifications', 'metering'],
33
+ };
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ProcessExtraction = void 0;
4
+ const conditions_1 = require("../conditions");
4
5
  /**
5
6
  * File extraction processing node.
6
7
  *
@@ -25,6 +26,7 @@ exports.ProcessExtraction = {
25
26
  'Typically used upstream of ProcessFileEmbedding or ProcessChunks.',
26
27
  parameter_schema: {
27
28
  type: 'object',
29
+ $defs: conditions_1.conditionDefs,
28
30
  properties: {
29
31
  // ── Output fields ─────────────────────────────────────────────
30
32
  text_field: {
@@ -39,6 +41,18 @@ exports.ProcessExtraction = {
39
41
  description: 'JSONB field for extraction metadata (page count, language, etc.)',
40
42
  default: 'extracted_metadata'
41
43
  },
44
+ // ── Model config (optional — flows into job payload) ──────────
45
+ extraction_model: {
46
+ type: 'string',
47
+ description: 'Extraction model identifier (e.g. a vision model for OCR, an LLM for ' +
48
+ 'structured extraction). Included in the job payload so the worker knows ' +
49
+ 'which model to use. When null, the worker falls back to runtime config.'
50
+ },
51
+ extraction_provider: {
52
+ type: 'string',
53
+ description: 'Extraction provider name (e.g. "ollama", "openai"). ' +
54
+ 'When null, the worker falls back to runtime config.'
55
+ },
42
56
  // ── MIME scoping ──────────────────────────────────────────────
43
57
  mime_patterns: {
44
58
  type: 'array',
@@ -70,16 +84,7 @@ exports.ProcessExtraction = {
70
84
  bucket_id: 'bucket_id'
71
85
  }
72
86
  },
73
- trigger_conditions: {
74
- description: 'Additional compound conditions beyond MIME filtering. ' +
75
- 'Merged with the auto-generated MIME conditions via AND. ' +
76
- 'Use this to add status checks (e.g., status = \'uploaded\').',
77
- 'x-codegen-type': 'TriggerCondition | TriggerCondition[]',
78
- oneOf: [
79
- { $ref: '#/$defs/triggerCondition' },
80
- { type: 'array', items: { $ref: '#/$defs/triggerCondition' } }
81
- ]
82
- },
87
+ trigger_conditions: conditions_1.triggerConditionsProperty,
83
88
  // ── Job options ───────────────────────────────────────────────
84
89
  queue_name: {
85
90
  type: 'string',
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ProcessImageVersions = void 0;
4
+ const conditions_1 = require("../conditions");
4
5
  /**
5
6
  * Image version processing node.
6
7
  *
@@ -26,6 +27,7 @@ exports.ProcessImageVersions = {
26
27
  'file records linked to the source image.',
27
28
  parameter_schema: {
28
29
  type: 'object',
30
+ $defs: conditions_1.conditionDefs,
29
31
  required: ['versions'],
30
32
  properties: {
31
33
  // ── Version definitions ───────────────────────────────────────
@@ -101,15 +103,7 @@ exports.ProcessImageVersions = {
101
103
  bucket_id: 'bucket_id'
102
104
  }
103
105
  },
104
- trigger_conditions: {
105
- description: 'Additional compound conditions beyond MIME filtering. ' +
106
- 'Merged with the auto-generated MIME conditions via AND.',
107
- 'x-codegen-type': 'TriggerCondition | TriggerCondition[]',
108
- oneOf: [
109
- { $ref: '#/$defs/triggerCondition' },
110
- { type: 'array', items: { $ref: '#/$defs/triggerCondition' } }
111
- ]
112
- },
106
+ trigger_conditions: conditions_1.triggerConditionsProperty,
113
107
  // ── Job options ───────────────────────────────────────────────
114
108
  queue_name: {
115
109
  type: 'string',
@@ -111,6 +111,14 @@ exports.SearchUnified = {
111
111
  format: 'column-ref'
112
112
  }
113
113
  },
114
+ embedding_model: {
115
+ type: 'string',
116
+ description: 'Embedding model identifier. When null, the worker falls back to runtime config.'
117
+ },
118
+ embedding_provider: {
119
+ type: 'string',
120
+ description: 'Embedding provider name. When null, the worker falls back to runtime config.'
121
+ },
114
122
  search_score_weight: {
115
123
  type: 'number',
116
124
  default: 1
@@ -53,6 +53,18 @@ exports.SearchVector = {
53
53
  },
54
54
  description: 'Column names that feed the embedding. Used by stale trigger to detect content changes.'
55
55
  },
56
+ // ── Model config (optional — flows into job payload) ──────────
57
+ embedding_model: {
58
+ type: 'string',
59
+ description: 'Embedding model identifier (e.g. "nomic-embed-text", "text-embedding-3-small"). ' +
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
+ },
56
68
  enqueue_job: {
57
69
  type: 'boolean',
58
70
  description: 'Auto-create trigger that enqueues embedding generation jobs',
@@ -830,6 +830,41 @@ export interface BlueprintStorageConfig {
830
830
  buckets?: BlueprintEntityTableProvision;
831
831
  };
832
832
  }
833
+ /** A requirement entry within a blueprint achievement. Defines what events must occur to earn the achievement. */
834
+ export interface BlueprintAchievementRequirement {
835
+ /** Name identifier matching an event_type or step name. */
836
+ event_name: string;
837
+ /** Number of events needed to satisfy this requirement. */
838
+ count: number;
839
+ /** Human-readable description of what this requirement entails. */
840
+ description?: string;
841
+ }
842
+ /** A reward entry within a blueprint achievement. Defines credits granted when the achievement is earned. */
843
+ export interface BlueprintAchievementReward {
844
+ /** Type of reward: limit_credit (grants limit credits) or meter_credit (grants meter credits). */
845
+ reward_type: 'limit_credit' | 'meter_credit';
846
+ /** Target limit name or meter slug for the credit grant. */
847
+ target_name: string;
848
+ /** Number of credits to grant. */
849
+ amount: number;
850
+ /** Credit type: permanent, expiring, etc. Defaults to "permanent". */
851
+ credit_type?: string;
852
+ }
853
+ /** An achievement entry for the blueprint achievements[] section. Creates a level with requirements and optional rewards in the events_module. Requires events_module to be provisioned (e.g., via entity_types[].has_levels = true or modules includes events_module). */
854
+ export interface BlueprintAchievement {
855
+ /** Unique name for the achievement level. */
856
+ name: string;
857
+ /** Human-readable description of this achievement. */
858
+ description?: string;
859
+ /** Display ordering priority; lower values appear first. Defaults to 100. */
860
+ priority?: number;
861
+ /** Requirements that must be met to earn this achievement. */
862
+ requirements: BlueprintAchievementRequirement[];
863
+ /** Rewards granted when the achievement is earned. */
864
+ rewards?: BlueprintAchievementReward[];
865
+ /** Entity prefix to scope this achievement to (e.g., "org", "app"). Used to resolve the correct events_module. Defaults to "app". */
866
+ entity_prefix?: string;
867
+ }
833
868
  /** Override object for the entity table created by a BlueprintEntityType. Shape mirrors BlueprintTable / secure_table_provision vocabulary. When supplied, policies[] replaces the default entity-table policies entirely. */
834
869
  export interface BlueprintEntityTableProvision {
835
870
  /** Whether to enable RLS on the entity table. Forwarded to secure_table_provision. Defaults to true. */
@@ -870,6 +905,8 @@ export interface BlueprintEntityType {
870
905
  has_storage?: boolean;
871
906
  /** Whether to provision entity-scoped invite tables ({prefix}_invites, {prefix}_claimed_invites) and a submit_{prefix}_invite_code() function. Defaults to false. */
872
907
  has_invites?: boolean;
908
+ /** Whether to auto-attach an EventTracker to the claimed_invites table for invite-based achievements. Requires has_invites=true AND has_levels=true. When true, records 'invite_claimed' events credited to the sender (inviter) on each claimed invite. Defaults to false. */
909
+ has_invite_achievements?: boolean;
873
910
  /** Escape hatch: when true AND table_provision is NULL, zero policies are provisioned on the entity table. Defaults to false. */
874
911
  skip_entity_policies?: boolean;
875
912
  /** Override for the entity table. Shape mirrors BlueprintTable / secure_table_provision vocabulary. When supplied, its policies[] replaces the five default entity-table policies; is_visible becomes a no-op. When NULL (default), the five default policies are applied (gated by is_visible). */
@@ -1142,4 +1179,6 @@ export interface BlueprintDefinition {
1142
1179
  entity_types?: BlueprintEntityType[];
1143
1180
  /** App-level storage configuration. Creates a storage_module (membership_type = NULL), seeds initial buckets, and overrides module-level settings (expiry times, file size limits, CORS). Use provisions for per-table policy overrides. For entity-scoped storage, use entity_types[].has_storage + entity_types[].storage instead. */
1144
1181
  storage?: BlueprintStorageConfig;
1182
+ /** Achievement definitions. Each entry creates a level with requirements and optional rewards in the events_module. Requires events_module to be provisioned (e.g., via entity_types[].has_levels = true or modules includes events_module). */
1183
+ achievements?: BlueprintAchievement[];
1145
1184
  }
@@ -493,6 +493,37 @@ function buildBlueprintStorageConfig() {
493
493
  ])), 'Per-table overrides for storage tables. Each key targets a specific storage table (files, buckets) and uses the same shape as table_provision: { nodes, fields, grants, use_rls, policies }. Fanned out to secure_table_provision targeting the corresponding table. When a key includes policies[], those REPLACE the default storage policies for that table; tables without a key still get defaults.')
494
494
  ]), 'Storage configuration for an entity type. Seeds initial buckets, overrides module-level settings (expiry times, file size limits, CORS), and provides per-table provisioning overrides via provisions.');
495
495
  }
496
+ // ---------------------------------------------------------------------------
497
+ // Achievement types
498
+ // ---------------------------------------------------------------------------
499
+ function buildBlueprintAchievementRequirement() {
500
+ return addJSDoc(exportInterface('BlueprintAchievementRequirement', [
501
+ addJSDoc(requiredProp('event_name', t.tsStringKeyword()), 'Name identifier matching an event_type or step name.'),
502
+ addJSDoc(requiredProp('count', t.tsNumberKeyword()), 'Number of events needed to satisfy this requirement.'),
503
+ addJSDoc(optionalProp('description', t.tsStringKeyword()), 'Human-readable description of what this requirement entails.')
504
+ ]), 'A requirement entry within a blueprint achievement. Defines what events must occur to earn the achievement.');
505
+ }
506
+ function buildBlueprintAchievementReward() {
507
+ return addJSDoc(exportInterface('BlueprintAchievementReward', [
508
+ addJSDoc(requiredProp('reward_type', t.tsUnionType([
509
+ t.tsLiteralType(t.stringLiteral('limit_credit')),
510
+ t.tsLiteralType(t.stringLiteral('meter_credit'))
511
+ ])), 'Type of reward: limit_credit (grants limit credits) or meter_credit (grants meter credits).'),
512
+ addJSDoc(requiredProp('target_name', t.tsStringKeyword()), 'Target limit name or meter slug for the credit grant.'),
513
+ addJSDoc(requiredProp('amount', t.tsNumberKeyword()), 'Number of credits to grant.'),
514
+ addJSDoc(optionalProp('credit_type', t.tsStringKeyword()), 'Credit type: permanent, expiring, etc. Defaults to "permanent".')
515
+ ]), 'A reward entry within a blueprint achievement. Defines credits granted when the achievement is earned.');
516
+ }
517
+ function buildBlueprintAchievement() {
518
+ return addJSDoc(exportInterface('BlueprintAchievement', [
519
+ addJSDoc(requiredProp('name', t.tsStringKeyword()), 'Unique name for the achievement level.'),
520
+ addJSDoc(optionalProp('description', t.tsStringKeyword()), 'Human-readable description of this achievement.'),
521
+ addJSDoc(optionalProp('priority', t.tsNumberKeyword()), 'Display ordering priority; lower values appear first. Defaults to 100.'),
522
+ addJSDoc(requiredProp('requirements', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintAchievementRequirement')))), 'Requirements that must be met to earn this achievement.'),
523
+ addJSDoc(optionalProp('rewards', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintAchievementReward')))), 'Rewards granted when the achievement is earned.'),
524
+ addJSDoc(optionalProp('entity_prefix', t.tsStringKeyword()), 'Entity prefix to scope this achievement to (e.g., "org", "app"). Used to resolve the correct events_module. Defaults to "app".')
525
+ ]), 'An achievement entry for the blueprint achievements[] section. Creates a level with requirements and optional rewards in the events_module. Requires events_module to be provisioned (e.g., via entity_types[].has_levels = true or modules includes events_module).');
526
+ }
496
527
  function buildBlueprintEntityTableProvision() {
497
528
  return addJSDoc(exportInterface('BlueprintEntityTableProvision', [
498
529
  addJSDoc(optionalProp('use_rls', t.tsBooleanKeyword()), 'Whether to enable RLS on the entity table. Forwarded to secure_table_provision. Defaults to true.'),
@@ -518,6 +549,7 @@ function buildBlueprintEntityType() {
518
549
  addJSDoc(optionalProp('has_levels', t.tsBooleanKeyword()), 'Whether to provision a levels module for this entity type. Defaults to false.'),
519
550
  addJSDoc(optionalProp('has_storage', t.tsBooleanKeyword()), 'Whether to provision a storage module (buckets, files tables) for this entity type. Defaults to false.'),
520
551
  addJSDoc(optionalProp('has_invites', t.tsBooleanKeyword()), 'Whether to provision entity-scoped invite tables ({prefix}_invites, {prefix}_claimed_invites) and a submit_{prefix}_invite_code() function. Defaults to false.'),
552
+ addJSDoc(optionalProp('has_invite_achievements', t.tsBooleanKeyword()), "Whether to auto-attach an EventTracker to the claimed_invites table for invite-based achievements. Requires has_invites=true AND has_levels=true. When true, records 'invite_claimed' events credited to the sender (inviter) on each claimed invite. Defaults to false."),
521
553
  addJSDoc(optionalProp('skip_entity_policies', t.tsBooleanKeyword()), 'Escape hatch: when true AND table_provision is NULL, zero policies are provisioned on the entity table. Defaults to false.'),
522
554
  addJSDoc(optionalProp('table_provision', t.tsTypeReference(t.identifier('BlueprintEntityTableProvision'))), 'Override for the entity table. Shape mirrors BlueprintTable / secure_table_provision vocabulary. When supplied, its policies[] replaces the five default entity-table policies; is_visible becomes a no-op. When NULL (default), the five default policies are applied (gated by is_visible).'),
523
555
  addJSDoc(optionalProp('storage', t.tsTypeReference(t.identifier('BlueprintStorageConfig'))), 'Storage configuration. Only used when has_storage is true. Controls RLS policies on storage tables, seeds initial buckets, and overrides module-level settings (expiry times, file size limits, CORS).')
@@ -548,7 +580,8 @@ function buildBlueprintDefinition() {
548
580
  addJSDoc(optionalProp('full_text_searches', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintFullTextSearch')))), 'Full-text search configurations.'),
549
581
  addJSDoc(optionalProp('unique_constraints', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintUniqueConstraint')))), 'Unique constraints on table columns.'),
550
582
  addJSDoc(optionalProp('entity_types', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintEntityType')))), 'Entity types to provision in Phase 0 (before tables). Each entry creates an entity table with membership modules and security.'),
551
- addJSDoc(optionalProp('storage', t.tsTypeReference(t.identifier('BlueprintStorageConfig'))), 'App-level storage configuration. Creates a storage_module (membership_type = NULL), seeds initial buckets, and overrides module-level settings (expiry times, file size limits, CORS). Use provisions for per-table policy overrides. For entity-scoped storage, use entity_types[].has_storage + entity_types[].storage instead.')
583
+ addJSDoc(optionalProp('storage', t.tsTypeReference(t.identifier('BlueprintStorageConfig'))), 'App-level storage configuration. Creates a storage_module (membership_type = NULL), seeds initial buckets, and overrides module-level settings (expiry times, file size limits, CORS). Use provisions for per-table policy overrides. For entity-scoped storage, use entity_types[].has_storage + entity_types[].storage instead.'),
584
+ addJSDoc(optionalProp('achievements', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintAchievement')))), 'Achievement definitions. Each entry creates a level with requirements and optional rewards in the events_module. Requires events_module to be provisioned (e.g., via entity_types[].has_levels = true or modules includes events_module).')
552
585
  ]), 'The complete blueprint definition -- the JSONB shape accepted by construct_blueprint().');
553
586
  }
554
587
  // ---------------------------------------------------------------------------
@@ -607,6 +640,9 @@ function buildProgram(meta) {
607
640
  statements.push(buildBlueprintTableUniqueConstraint());
608
641
  statements.push(buildBlueprintBucketSeed());
609
642
  statements.push(buildBlueprintStorageConfig());
643
+ statements.push(buildBlueprintAchievementRequirement());
644
+ statements.push(buildBlueprintAchievementReward());
645
+ statements.push(buildBlueprintAchievement());
610
646
  statements.push(buildBlueprintEntityTableProvision());
611
647
  statements.push(buildBlueprintEntityType());
612
648
  // -- Node types discriminated union --
@@ -0,0 +1 @@
1
+ export { conditionDefs, conditionProperties, triggerConditionSchema, triggerConditionsProperty } from './trigger-condition';
@@ -0,0 +1 @@
1
+ export { conditionDefs, conditionProperties, triggerConditionSchema, triggerConditionsProperty } from './trigger-condition';
@@ -0,0 +1,35 @@
1
+ import type { JSONSchema } from '../types';
2
+ /**
3
+ * Shared trigger condition schema used by any node type that creates
4
+ * PostgreSQL triggers with conditional WHEN clauses.
5
+ *
6
+ * Consumed by: JobTrigger, EventTracker, ProcessExtraction,
7
+ * ProcessImageVersions, ProcessFileEmbedding, ProcessImageEmbedding.
8
+ *
9
+ * On the SQL side, these conditions are compiled to AST via
10
+ * metaschema_generators.build_condition_ast().
11
+ */
12
+ export declare const triggerConditionSchema: JSONSchema;
13
+ /**
14
+ * $defs block for parameter_schema. Spread into any node that uses conditions.
15
+ *
16
+ * Usage:
17
+ * parameter_schema: { type: 'object', $defs: conditionDefs, properties: { ... } }
18
+ */
19
+ export declare const conditionDefs: Record<string, JSONSchema>;
20
+ /**
21
+ * Common condition-related properties for trigger-based nodes.
22
+ * Three mutually exclusive options for WHEN clause specification.
23
+ *
24
+ * Usage:
25
+ * properties: { event_name: { ... }, ...conditionProperties }
26
+ */
27
+ export declare const conditionProperties: Record<string, JSONSchema>;
28
+ /**
29
+ * Standalone trigger_conditions property for nodes that compose on top of
30
+ * JobTrigger (Process* nodes). These use trigger_conditions instead of
31
+ * the full condition_field/conditions/watch_fields trio because the
32
+ * underlying JobTrigger handles the WHEN clause; this property adds
33
+ * additional conditions merged via AND.
34
+ */
35
+ export declare const triggerConditionsProperty: JSONSchema;