node-type-registry 0.35.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 (91) hide show
  1. package/blueprint-types.generated.d.ts +46 -1
  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-composite-field.js +4 -2
  13. package/data/data-direct-owner.js +5 -0
  14. package/data/data-entity-membership.js +5 -0
  15. package/data/data-feature-flag.d.ts +1 -1
  16. package/data/data-feature-flag.js +7 -7
  17. package/data/data-file-embedding.js +23 -10
  18. package/data/data-image-embedding.js +15 -9
  19. package/data/data-job-trigger.js +3 -53
  20. package/data/data-jsonb.js +2 -1
  21. package/data/data-limit-counter.d.ts +1 -1
  22. package/data/data-limit-counter.js +7 -7
  23. package/data/data-meter-rate-limit.d.ts +2 -0
  24. package/data/data-meter-rate-limit.js +42 -0
  25. package/data/data-ownership-in-entity.js +5 -0
  26. package/data/data-peoplestamps.js +5 -0
  27. package/data/data-publishable.js +2 -2
  28. package/data/data-slug.js +3 -4
  29. package/data/data-tags.js +2 -1
  30. package/data/event-tracker.d.ts +2 -0
  31. package/data/event-tracker.js +74 -0
  32. package/data/index.d.ts +9 -4
  33. package/data/index.js +15 -5
  34. package/data/limit-warning-aggregate.d.ts +2 -0
  35. package/data/limit-warning-aggregate.js +27 -0
  36. package/data/limit-warning-counter.d.ts +2 -0
  37. package/data/limit-warning-counter.js +33 -0
  38. package/data/limit-warning-rate.d.ts +2 -0
  39. package/data/limit-warning-rate.js +33 -0
  40. package/data/process-extraction.js +15 -10
  41. package/data/process-image-versions.js +3 -9
  42. package/data/search-unified.js +20 -0
  43. package/data/search-vector.js +12 -0
  44. package/esm/blueprint-types.generated.d.ts +46 -1
  45. package/esm/codegen/generate-types.js +37 -1
  46. package/esm/conditions/index.d.ts +1 -0
  47. package/esm/conditions/index.js +1 -0
  48. package/esm/conditions/trigger-condition.d.ts +35 -0
  49. package/esm/conditions/trigger-condition.js +94 -0
  50. package/esm/data/data-aggregate-limit-counter.d.ts +1 -1
  51. package/esm/data/data-aggregate-limit-counter.js +6 -6
  52. package/esm/data/data-billing-meter.d.ts +1 -1
  53. package/esm/data/data-billing-meter.js +6 -6
  54. package/esm/data/data-chunks.js +20 -0
  55. package/esm/data/data-composite-field.js +4 -2
  56. package/esm/data/data-direct-owner.js +5 -0
  57. package/esm/data/data-entity-membership.js +5 -0
  58. package/esm/data/data-feature-flag.d.ts +1 -1
  59. package/esm/data/data-feature-flag.js +6 -6
  60. package/esm/data/data-file-embedding.js +23 -10
  61. package/esm/data/data-image-embedding.js +15 -9
  62. package/esm/data/data-job-trigger.js +3 -53
  63. package/esm/data/data-jsonb.js +2 -1
  64. package/esm/data/data-limit-counter.d.ts +1 -1
  65. package/esm/data/data-limit-counter.js +6 -6
  66. package/esm/data/data-meter-rate-limit.d.ts +2 -0
  67. package/esm/data/data-meter-rate-limit.js +39 -0
  68. package/esm/data/data-ownership-in-entity.js +5 -0
  69. package/esm/data/data-peoplestamps.js +5 -0
  70. package/esm/data/data-publishable.js +2 -2
  71. package/esm/data/data-slug.js +3 -4
  72. package/esm/data/data-tags.js +2 -1
  73. package/esm/data/event-tracker.d.ts +2 -0
  74. package/esm/data/event-tracker.js +71 -0
  75. package/esm/data/index.d.ts +9 -4
  76. package/esm/data/index.js +9 -4
  77. package/esm/data/limit-warning-aggregate.d.ts +2 -0
  78. package/esm/data/limit-warning-aggregate.js +24 -0
  79. package/esm/data/limit-warning-counter.d.ts +2 -0
  80. package/esm/data/limit-warning-counter.js +30 -0
  81. package/esm/data/limit-warning-rate.d.ts +2 -0
  82. package/esm/data/limit-warning-rate.js +30 -0
  83. package/esm/data/process-extraction.js +15 -10
  84. package/esm/data/process-image-versions.js +3 -9
  85. package/esm/data/search-unified.js +20 -0
  86. package/esm/data/search-vector.js +12 -0
  87. package/esm/index.d.ts +1 -0
  88. package/esm/index.js +1 -0
  89. package/index.d.ts +1 -0
  90. package/index.js +1 -0
  91. package/package.json +2 -2
@@ -66,12 +66,14 @@ export interface DataDirectOwnerParams {
66
66
  owner_field_name?: string;
67
67
  include_id?: boolean;
68
68
  include_user_fk?: boolean;
69
+ create_index?: boolean;
69
70
  }
70
71
  /** Adds entity reference for organization/group scoping. Enables AuthzEntityMembership, AuthzMembership, AuthzOrgHierarchy authorization. */
71
72
  export interface DataEntityMembershipParams {
72
73
  entity_field_name?: string;
73
74
  include_id?: boolean;
74
75
  include_user_fk?: boolean;
76
+ create_index?: boolean;
75
77
  }
76
78
  /** BEFORE INSERT trigger that forces a field to the value of jwt_public.current_user_id(). Prevents clients from spoofing the actor/uploader identity. The field value is always overwritten regardless of what the client provides. */
77
79
  export interface DataForceCurrentUserParams {
@@ -115,6 +117,7 @@ export interface DataOwnershipInEntityParams {
115
117
  entity_field_name?: string;
116
118
  include_id?: boolean;
117
119
  include_user_fk?: boolean;
120
+ create_index?: boolean;
118
121
  }
119
122
  /** Adds user tracking for creates/updates with created_by and updated_by columns. */
120
123
  export interface DataPeoplestampsParams {
@@ -122,6 +125,7 @@ export interface DataPeoplestampsParams {
122
125
  updated_by_field?: string;
123
126
  include_id?: boolean;
124
127
  include_user_fk?: boolean;
128
+ create_index?: boolean;
125
129
  }
126
130
  /** Adds publish state columns (is_published, published_at) for content visibility. Enables AuthzPublishable and AuthzTemporal authorization. */
127
131
  export interface DataPublishableParams {
@@ -136,7 +140,7 @@ export interface DataRealtimeParams {
136
140
  }
137
141
  /** Auto-generates URL-friendly slugs from field values on insert/update. Attaches BEFORE INSERT and BEFORE UPDATE triggers that call inflection.slugify() on the target field. References fields by name in data jsonb. */
138
142
  export interface DataSlugParams {
139
- field_name: string;
143
+ field_name?: string;
140
144
  source_field_name?: string;
141
145
  }
142
146
  /** Adds soft delete support with deleted_at and is_deleted columns. */
@@ -271,6 +275,8 @@ export interface SearchUnifiedParams {
271
275
  chunking_task_name?: string;
272
276
  };
273
277
  };
278
+ embedding_text_field?: string;
279
+ composite_format?: 'labeled' | 'plain';
274
280
  trgm_fields?: string[];
275
281
  search_config?: {
276
282
  weights?: {
@@ -824,6 +830,41 @@ export interface BlueprintStorageConfig {
824
830
  buckets?: BlueprintEntityTableProvision;
825
831
  };
826
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
+ }
827
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. */
828
869
  export interface BlueprintEntityTableProvision {
829
870
  /** Whether to enable RLS on the entity table. Forwarded to secure_table_provision. Defaults to true. */
@@ -864,6 +905,8 @@ export interface BlueprintEntityType {
864
905
  has_storage?: boolean;
865
906
  /** Whether to provision entity-scoped invite tables ({prefix}_invites, {prefix}_claimed_invites) and a submit_{prefix}_invite_code() function. Defaults to false. */
866
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;
867
910
  /** Escape hatch: when true AND table_provision is NULL, zero policies are provisioned on the entity table. Defaults to false. */
868
911
  skip_entity_policies?: boolean;
869
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). */
@@ -1136,4 +1179,6 @@ export interface BlueprintDefinition {
1136
1179
  entity_types?: BlueprintEntityType[];
1137
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. */
1138
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[];
1139
1184
  }
@@ -528,6 +528,37 @@ function buildBlueprintStorageConfig() {
528
528
  ])), '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.')
529
529
  ]), '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.');
530
530
  }
531
+ // ---------------------------------------------------------------------------
532
+ // Achievement types
533
+ // ---------------------------------------------------------------------------
534
+ function buildBlueprintAchievementRequirement() {
535
+ return addJSDoc(exportInterface('BlueprintAchievementRequirement', [
536
+ addJSDoc(requiredProp('event_name', t.tsStringKeyword()), 'Name identifier matching an event_type or step name.'),
537
+ addJSDoc(requiredProp('count', t.tsNumberKeyword()), 'Number of events needed to satisfy this requirement.'),
538
+ addJSDoc(optionalProp('description', t.tsStringKeyword()), 'Human-readable description of what this requirement entails.')
539
+ ]), 'A requirement entry within a blueprint achievement. Defines what events must occur to earn the achievement.');
540
+ }
541
+ function buildBlueprintAchievementReward() {
542
+ return addJSDoc(exportInterface('BlueprintAchievementReward', [
543
+ addJSDoc(requiredProp('reward_type', t.tsUnionType([
544
+ t.tsLiteralType(t.stringLiteral('limit_credit')),
545
+ t.tsLiteralType(t.stringLiteral('meter_credit'))
546
+ ])), 'Type of reward: limit_credit (grants limit credits) or meter_credit (grants meter credits).'),
547
+ addJSDoc(requiredProp('target_name', t.tsStringKeyword()), 'Target limit name or meter slug for the credit grant.'),
548
+ addJSDoc(requiredProp('amount', t.tsNumberKeyword()), 'Number of credits to grant.'),
549
+ addJSDoc(optionalProp('credit_type', t.tsStringKeyword()), 'Credit type: permanent, expiring, etc. Defaults to "permanent".')
550
+ ]), 'A reward entry within a blueprint achievement. Defines credits granted when the achievement is earned.');
551
+ }
552
+ function buildBlueprintAchievement() {
553
+ return addJSDoc(exportInterface('BlueprintAchievement', [
554
+ addJSDoc(requiredProp('name', t.tsStringKeyword()), 'Unique name for the achievement level.'),
555
+ addJSDoc(optionalProp('description', t.tsStringKeyword()), 'Human-readable description of this achievement.'),
556
+ addJSDoc(optionalProp('priority', t.tsNumberKeyword()), 'Display ordering priority; lower values appear first. Defaults to 100.'),
557
+ addJSDoc(requiredProp('requirements', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintAchievementRequirement')))), 'Requirements that must be met to earn this achievement.'),
558
+ addJSDoc(optionalProp('rewards', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintAchievementReward')))), 'Rewards granted when the achievement is earned.'),
559
+ 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".')
560
+ ]), '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).');
561
+ }
531
562
  function buildBlueprintEntityTableProvision() {
532
563
  return addJSDoc(exportInterface('BlueprintEntityTableProvision', [
533
564
  addJSDoc(optionalProp('use_rls', t.tsBooleanKeyword()), 'Whether to enable RLS on the entity table. Forwarded to secure_table_provision. Defaults to true.'),
@@ -553,6 +584,7 @@ function buildBlueprintEntityType() {
553
584
  addJSDoc(optionalProp('has_levels', t.tsBooleanKeyword()), 'Whether to provision a levels module for this entity type. Defaults to false.'),
554
585
  addJSDoc(optionalProp('has_storage', t.tsBooleanKeyword()), 'Whether to provision a storage module (buckets, files tables) for this entity type. Defaults to false.'),
555
586
  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.'),
587
+ 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."),
556
588
  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.'),
557
589
  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).'),
558
590
  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).')
@@ -583,7 +615,8 @@ function buildBlueprintDefinition() {
583
615
  addJSDoc(optionalProp('full_text_searches', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintFullTextSearch')))), 'Full-text search configurations.'),
584
616
  addJSDoc(optionalProp('unique_constraints', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintUniqueConstraint')))), 'Unique constraints on table columns.'),
585
617
  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.'),
586
- 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.')
618
+ 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.'),
619
+ 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).')
587
620
  ]), 'The complete blueprint definition -- the JSONB shape accepted by construct_blueprint().');
588
621
  }
589
622
  // ---------------------------------------------------------------------------
@@ -642,6 +675,9 @@ function buildProgram(meta) {
642
675
  statements.push(buildBlueprintTableUniqueConstraint());
643
676
  statements.push(buildBlueprintBucketSeed());
644
677
  statements.push(buildBlueprintStorageConfig());
678
+ statements.push(buildBlueprintAchievementRequirement());
679
+ statements.push(buildBlueprintAchievementReward());
680
+ statements.push(buildBlueprintAchievement());
645
681
  statements.push(buildBlueprintEntityTableProvision());
646
682
  statements.push(buildBlueprintEntityType());
647
683
  // -- Node types discriminated union --
@@ -0,0 +1 @@
1
+ export { conditionDefs, conditionProperties, triggerConditionSchema, triggerConditionsProperty } from './trigger-condition';
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.triggerConditionsProperty = exports.triggerConditionSchema = exports.conditionProperties = exports.conditionDefs = void 0;
4
+ var trigger_condition_1 = require("./trigger-condition");
5
+ Object.defineProperty(exports, "conditionDefs", { enumerable: true, get: function () { return trigger_condition_1.conditionDefs; } });
6
+ Object.defineProperty(exports, "conditionProperties", { enumerable: true, get: function () { return trigger_condition_1.conditionProperties; } });
7
+ Object.defineProperty(exports, "triggerConditionSchema", { enumerable: true, get: function () { return trigger_condition_1.triggerConditionSchema; } });
8
+ Object.defineProperty(exports, "triggerConditionsProperty", { enumerable: true, get: function () { return trigger_condition_1.triggerConditionsProperty; } });
@@ -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;
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.triggerConditionsProperty = exports.conditionProperties = exports.conditionDefs = exports.triggerConditionSchema = void 0;
4
+ /**
5
+ * Shared trigger condition schema used by any node type that creates
6
+ * PostgreSQL triggers with conditional WHEN clauses.
7
+ *
8
+ * Consumed by: JobTrigger, EventTracker, ProcessExtraction,
9
+ * ProcessImageVersions, ProcessFileEmbedding, ProcessImageEmbedding.
10
+ *
11
+ * On the SQL side, these conditions are compiled to AST via
12
+ * metaschema_generators.build_condition_ast().
13
+ */
14
+ exports.triggerConditionSchema = {
15
+ type: 'object',
16
+ description: 'A leaf condition ({field, op, value?, row?, ref?}) or a combinator ({AND, OR, NOT}).',
17
+ properties: {
18
+ field: { type: 'string', format: 'column-ref', description: 'Column name (validated against the table).' },
19
+ op: {
20
+ type: 'string',
21
+ enum: ['=', '!=', '>', '<', '>=', '<=', 'LIKE', 'NOT LIKE', 'IS NULL', 'IS NOT NULL', 'IS DISTINCT FROM'],
22
+ description: 'Comparison operator.'
23
+ },
24
+ value: { description: 'Comparison value. Type is resolved from the column definition. Omit for IS NULL, IS NOT NULL, IS DISTINCT FROM.' },
25
+ row: { type: 'string', enum: ['NEW', 'OLD'], default: 'NEW', description: 'Row reference (default: NEW).' },
26
+ ref: {
27
+ type: 'object',
28
+ description: 'Column reference for field-to-field comparison (alternative to value).',
29
+ properties: {
30
+ field: { type: 'string', format: 'column-ref' },
31
+ row: { type: 'string', enum: ['NEW', 'OLD'], default: 'NEW' }
32
+ }
33
+ },
34
+ AND: { type: 'array', description: 'Array of conditions combined with AND.', items: { $ref: '#/$defs/triggerCondition' } },
35
+ OR: { type: 'array', description: 'Array of conditions combined with OR.', items: { $ref: '#/$defs/triggerCondition' } },
36
+ NOT: { $ref: '#/$defs/triggerCondition', description: 'Negated condition.' }
37
+ }
38
+ };
39
+ /**
40
+ * $defs block for parameter_schema. Spread into any node that uses conditions.
41
+ *
42
+ * Usage:
43
+ * parameter_schema: { type: 'object', $defs: conditionDefs, properties: { ... } }
44
+ */
45
+ exports.conditionDefs = {
46
+ triggerCondition: exports.triggerConditionSchema
47
+ };
48
+ /**
49
+ * Common condition-related properties for trigger-based nodes.
50
+ * Three mutually exclusive options for WHEN clause specification.
51
+ *
52
+ * Usage:
53
+ * properties: { event_name: { ... }, ...conditionProperties }
54
+ */
55
+ exports.conditionProperties = {
56
+ condition_field: {
57
+ type: 'string',
58
+ format: 'column-ref',
59
+ description: 'Column name for conditional WHEN clause (fires only when field equals condition_value)'
60
+ },
61
+ condition_value: {
62
+ type: 'string',
63
+ description: 'Value to compare against condition_field in WHEN clause'
64
+ },
65
+ conditions: {
66
+ 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.',
67
+ 'x-codegen-type': 'TriggerCondition | TriggerCondition[]',
68
+ oneOf: [
69
+ { $ref: '#/$defs/triggerCondition' },
70
+ { type: 'array', items: { $ref: '#/$defs/triggerCondition' } }
71
+ ]
72
+ },
73
+ watch_fields: {
74
+ type: 'array',
75
+ items: {
76
+ type: 'string',
77
+ format: 'column-ref'
78
+ },
79
+ description: 'For UPDATE triggers, only fire when these fields change (uses DISTINCT FROM)'
80
+ }
81
+ };
82
+ /**
83
+ * Standalone trigger_conditions property for nodes that compose on top of
84
+ * JobTrigger (Process* nodes). These use trigger_conditions instead of
85
+ * the full condition_field/conditions/watch_fields trio because the
86
+ * underlying JobTrigger handles the WHEN clause; this property adds
87
+ * additional conditions merged via AND.
88
+ */
89
+ exports.triggerConditionsProperty = {
90
+ description: 'Additional compound conditions beyond auto-generated filtering. ' +
91
+ 'Merged with the auto-generated conditions via AND.',
92
+ 'x-codegen-type': 'TriggerCondition | TriggerCondition[]',
93
+ oneOf: [
94
+ { $ref: '#/$defs/triggerCondition' },
95
+ { type: 'array', items: { $ref: '#/$defs/triggerCondition' } }
96
+ ]
97
+ };
@@ -1,2 +1,2 @@
1
1
  import type { NodeTypeDefinition } from '../types';
2
- export declare const LimitAggregate: NodeTypeDefinition;
2
+ export declare const LimitEnforceAggregate: NodeTypeDefinition;
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LimitAggregate = void 0;
4
- exports.LimitAggregate = {
5
- name: 'LimitAggregate',
6
- slug: 'data_aggregate_limit_counter',
7
- category: 'limit',
8
- display_name: 'Aggregate Limit Counter',
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', 'billing'],
35
+ tags: ['limits', 'triggers', 'aggregates', 'enforce'],
36
36
  };
@@ -1,2 +1,2 @@
1
1
  import type { NodeTypeDefinition } from '../types';
2
- export declare const BillingMeter: NodeTypeDefinition;
2
+ export declare const LimitTrackUsage: NodeTypeDefinition;
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BillingMeter = void 0;
4
- exports.BillingMeter = {
5
- name: 'BillingMeter',
6
- slug: 'data_billing_meter',
7
- category: 'billing',
8
- display_name: 'Billing Meter',
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
  };
@@ -66,6 +66,17 @@ exports.ProcessChunks = {
66
66
  description: 'Distance metric for the HNSW index on chunk embeddings',
67
67
  default: 'cosine'
68
68
  },
69
+ // ── Model config (optional — flows into job payload) ──────────
70
+ embedding_model: {
71
+ type: 'string',
72
+ description: 'Embedding model identifier for per-chunk embeddings. ' +
73
+ 'When null, the worker falls back to runtime config (llm_module / env vars).'
74
+ },
75
+ embedding_provider: {
76
+ type: 'string',
77
+ description: 'Embedding provider name (e.g. "ollama", "openai"). ' +
78
+ 'When null, the worker falls back to runtime config.'
79
+ },
69
80
  // ── Table naming ───────────────────────────────────────────────
70
81
  chunks_table_name: {
71
82
  type: 'string',
@@ -77,6 +88,15 @@ exports.ProcessChunks = {
77
88
  items: { type: 'string' },
78
89
  description: 'Field names from the parent table to copy into chunk metadata'
79
90
  },
91
+ // ── Search indexes ───────────────────────────────────────────────
92
+ search_indexes: {
93
+ type: 'array',
94
+ items: { type: 'string', enum: ['fulltext', 'bm25', 'trigram'] },
95
+ description: 'Text search indexes to create on the chunks content column. ' +
96
+ 'Enables keyword-based retrieval alongside vector search for ' +
97
+ 'hybrid RAG workflows.',
98
+ default: ['fulltext']
99
+ },
80
100
  // ── Job trigger ────────────────────────────────────────────────
81
101
  enqueue_chunking_job: {
82
102
  type: 'boolean',
@@ -13,7 +13,8 @@ exports.DataCompositeField = {
13
13
  target: {
14
14
  type: 'string',
15
15
  format: 'column-ref',
16
- description: "Name of the derived text field to create (default: 'embedding_text')"
16
+ description: 'Name of the derived text field to create',
17
+ default: 'embedding_text'
17
18
  },
18
19
  source_fields: {
19
20
  type: 'array',
@@ -26,7 +27,8 @@ exports.DataCompositeField = {
26
27
  format: {
27
28
  type: 'string',
28
29
  enum: ['labeled', 'plain'],
29
- description: "Output format: 'labeled' (field_name: value) or 'plain' (values only). Default: 'labeled'"
30
+ description: "Output format: 'labeled' (field_name: value) or 'plain' (values only)",
31
+ default: 'labeled'
30
32
  }
31
33
  },
32
34
  required: [
@@ -25,6 +25,11 @@ exports.DataDirectOwner = {
25
25
  type: 'boolean',
26
26
  description: 'If true, adds a foreign key constraint from owner_id to the users table',
27
27
  default: true
28
+ },
29
+ create_index: {
30
+ type: 'boolean',
31
+ description: 'If true, creates a B-tree index on the owner column',
32
+ default: true
28
33
  }
29
34
  }
30
35
  },
@@ -25,6 +25,11 @@ exports.DataEntityMembership = {
25
25
  type: 'boolean',
26
26
  description: 'If true, adds a foreign key constraint from entity_id to the users table',
27
27
  default: true
28
+ },
29
+ create_index: {
30
+ type: 'boolean',
31
+ description: 'If true, creates a B-tree index on the entity column',
32
+ default: true
28
33
  }
29
34
  }
30
35
  },
@@ -1,2 +1,2 @@
1
1
  import type { NodeTypeDefinition } from '../types';
2
- export declare const LimitFeatureFlag: NodeTypeDefinition;
2
+ export declare const LimitEnforceFeature: NodeTypeDefinition;
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LimitFeatureFlag = void 0;
4
- exports.LimitFeatureFlag = {
5
- name: 'LimitFeatureFlag',
6
- slug: 'data_feature_flag',
7
- category: 'limit',
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', 'billing', 'caps'],
32
+ tags: ['limits', 'triggers', 'feature-flags', 'enforce', 'caps'],
33
33
  };
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ProcessFileEmbedding = void 0;
4
+ const conditions_1 = require("../conditions");
4
5
  exports.ProcessFileEmbedding = {
5
6
  name: 'ProcessFileEmbedding',
6
7
  slug: 'data_file_embedding',
@@ -15,6 +16,7 @@ exports.ProcessFileEmbedding = {
15
16
  'names, and embedding strategies.',
16
17
  parameter_schema: {
17
18
  type: 'object',
19
+ $defs: conditions_1.conditionDefs,
18
20
  properties: {
19
21
  // ── Vector config (passed through to SearchVector) ─────────────
20
22
  field_name: {
@@ -45,6 +47,18 @@ exports.ProcessFileEmbedding = {
45
47
  description: 'Index-specific options. HNSW: {m, ef_construction}. IVFFlat: {lists}.',
46
48
  default: {}
47
49
  },
50
+ // ── Model config (optional — flows into job payload) ──────────
51
+ embedding_model: {
52
+ type: 'string',
53
+ description: 'Embedding model identifier (e.g. "nomic-embed-text", "text-embedding-3-small", ' +
54
+ '"clip-vit-base-patch32"). Included in the job payload so the worker knows which ' +
55
+ 'model to use. When null, the worker falls back to runtime config (llm_module / env vars).'
56
+ },
57
+ embedding_provider: {
58
+ type: 'string',
59
+ description: 'Embedding provider name (e.g. "ollama", "openai"). ' +
60
+ 'When null, the worker falls back to runtime config.'
61
+ },
48
62
  // ── MIME scoping ───────────────────────────────────────────────
49
63
  mime_patterns: {
50
64
  type: 'array',
@@ -77,16 +91,7 @@ exports.ProcessFileEmbedding = {
77
91
  bucket_id: 'bucket_id'
78
92
  }
79
93
  },
80
- trigger_conditions: {
81
- description: 'Additional compound conditions beyond MIME filtering. ' +
82
- 'Merged with the auto-generated MIME conditions via AND. ' +
83
- 'Use this to add status checks, field guards, etc.',
84
- 'x-codegen-type': 'TriggerCondition | TriggerCondition[]',
85
- oneOf: [
86
- { $ref: '#/$defs/triggerCondition' },
87
- { type: 'array', items: { $ref: '#/$defs/triggerCondition' } }
88
- ]
89
- },
94
+ trigger_conditions: conditions_1.triggerConditionsProperty,
90
95
  // ── Extraction config (optional — enables extract mode) ────────
91
96
  extraction: {
92
97
  type: 'object',
@@ -121,6 +126,7 @@ exports.ProcessFileEmbedding = {
121
126
  description: 'Chunking configuration passed through to ProcessChunks. When ' +
122
127
  'include_chunks is true (or defaults to true in extract mode), these ' +
123
128
  'params configure the chunks table, embedding dimensions, strategy, etc.',
129
+ default: {},
124
130
  properties: {
125
131
  content_field_name: {
126
132
  type: 'string',
@@ -149,6 +155,13 @@ exports.ProcessFileEmbedding = {
149
155
  items: { type: 'string' },
150
156
  description: 'Field names from parent to copy into chunk metadata'
151
157
  },
158
+ search_indexes: {
159
+ type: 'array',
160
+ items: { type: 'string', enum: ['fulltext', 'bm25', 'trigram'] },
161
+ description: 'Text search indexes to create on the chunks content column. ' +
162
+ 'Enables keyword-based retrieval alongside vector search.',
163
+ default: ['fulltext']
164
+ },
152
165
  enqueue_chunking_job: {
153
166
  type: 'boolean',
154
167
  description: 'Whether to auto-enqueue a chunking job on insert/update',
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ProcessImageEmbedding = void 0;
4
+ const conditions_1 = require("../conditions");
4
5
  /**
5
6
  * Image-specific preset of ProcessFileEmbedding.
6
7
  *
@@ -24,6 +25,7 @@ exports.ProcessImageEmbedding = {
24
25
  'Accepts all ProcessFileEmbedding parameters — any overrides are forwarded through.',
25
26
  parameter_schema: {
26
27
  type: 'object',
28
+ $defs: conditions_1.conditionDefs,
27
29
  properties: {
28
30
  // ── Vector config (passed through to ProcessFileEmbedding) ──────────
29
31
  field_name: {
@@ -54,6 +56,18 @@ exports.ProcessImageEmbedding = {
54
56
  description: 'Index-specific options. HNSW: {m, ef_construction}. IVFFlat: {lists}.',
55
57
  default: {}
56
58
  },
59
+ // ── Model config (optional — flows into job payload) ──────────
60
+ embedding_model: {
61
+ type: 'string',
62
+ description: 'Embedding model identifier (e.g. "clip-vit-base-patch32"). ' +
63
+ 'Included in the job payload so the worker knows which model to use. ' +
64
+ 'When null, the worker falls back to runtime config (llm_module / env vars).'
65
+ },
66
+ embedding_provider: {
67
+ type: 'string',
68
+ description: 'Embedding provider name (e.g. "ollama", "openai"). ' +
69
+ 'When null, the worker falls back to runtime config.'
70
+ },
57
71
  // ── MIME scoping ───────────────────────────────────────────────
58
72
  mime_patterns: {
59
73
  type: 'array',
@@ -84,15 +98,7 @@ exports.ProcessImageEmbedding = {
84
98
  bucket_id: 'bucket_id'
85
99
  }
86
100
  },
87
- trigger_conditions: {
88
- description: 'Additional compound conditions beyond MIME filtering. ' +
89
- 'Merged with the auto-generated MIME conditions via AND.',
90
- 'x-codegen-type': 'TriggerCondition | TriggerCondition[]',
91
- oneOf: [
92
- { $ref: '#/$defs/triggerCondition' },
93
- { type: 'array', items: { $ref: '#/$defs/triggerCondition' } }
94
- ]
95
- },
101
+ trigger_conditions: conditions_1.triggerConditionsProperty,
96
102
  // ── Extraction config (optional — enables extract mode) ────────
97
103
  extraction: {
98
104
  type: 'object',