node-type-registry 0.4.0 → 0.5.1

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.
@@ -0,0 +1,659 @@
1
+ /** Adds a UUID primary key column with auto-generation default (uuidv7). This is the standard primary key pattern for all tables. */
2
+ export interface DataIdParams {
3
+ field_name?: string;
4
+ }
5
+ /** Adds ownership column for direct user ownership. Enables AuthzDirectOwner authorization. */
6
+ export interface DataDirectOwnerParams {
7
+ owner_field_name?: string;
8
+ include_id?: boolean;
9
+ include_user_fk?: boolean;
10
+ }
11
+ /** Adds entity reference for organization/group scoping. Enables AuthzEntityMembership, AuthzMembership, AuthzOrgHierarchy authorization. */
12
+ export interface DataEntityMembershipParams {
13
+ entity_field_name?: string;
14
+ include_id?: boolean;
15
+ include_user_fk?: boolean;
16
+ }
17
+ /** Combines direct ownership with entity scoping. Adds both owner_id and entity_id columns. Enables AuthzDirectOwner, AuthzEntityMembership, and AuthzOrgHierarchy authorization. Particularly useful for OrgHierarchy where a user owns a row (owner_id) within an entity (entity_id), and managers above can see subordinate-owned records via the hierarchy closure table. */
18
+ export interface DataOwnershipInEntityParams {
19
+ include_id?: boolean;
20
+ include_user_fk?: boolean;
21
+ }
22
+ /** Adds automatic timestamp tracking with created_at and updated_at columns. */
23
+ export interface DataTimestampsParams {
24
+ include_id?: boolean;
25
+ }
26
+ /** Adds user tracking for creates/updates with created_by and updated_by columns. */
27
+ export interface DataPeoplestampsParams {
28
+ include_id?: boolean;
29
+ include_user_fk?: boolean;
30
+ }
31
+ /** Adds publish state columns (is_published, published_at) for content visibility. Enables AuthzPublishable and AuthzTemporal authorization. */
32
+ export interface DataPublishableParams {
33
+ include_id?: boolean;
34
+ }
35
+ /** Adds soft delete support with deleted_at and is_deleted columns. */
36
+ export interface DataSoftDeleteParams {
37
+ include_id?: boolean;
38
+ }
39
+ /** Adds a vector embedding column with HNSW or IVFFlat index for similarity search. Supports configurable dimensions, distance metrics (cosine, l2, ip), stale tracking strategies (column, null, hash), and automatic job enqueue triggers for embedding generation. */
40
+ export interface DataEmbeddingParams {
41
+ field_name?: string;
42
+ dimensions?: number;
43
+ index_method?: "hnsw" | "ivfflat";
44
+ metric?: "cosine" | "l2" | "ip";
45
+ index_options?: {
46
+ [key: string]: unknown;
47
+ };
48
+ include_stale_field?: boolean;
49
+ source_fields?: string[];
50
+ enqueue_job?: boolean;
51
+ job_task_name?: string;
52
+ stale_strategy?: "column" | "null" | "hash";
53
+ }
54
+ /** Adds a tsvector column with GIN index and automatic trigger population from source fields. Enables PostgreSQL full-text search with configurable weights and language support. Leverages the existing metaschema full_text_search infrastructure. */
55
+ export interface DataFullTextSearchParams {
56
+ field_name?: string;
57
+ source_fields: {
58
+ field: string;
59
+ weight?: "A" | "B" | "C" | "D";
60
+ lang?: string;
61
+ }[];
62
+ search_score_weight?: number;
63
+ }
64
+ /** Creates a BM25 index on an existing text column using pg_textsearch. Enables statistical relevance ranking with configurable k1 and b parameters. The BM25 index is auto-detected by graphile-search. */
65
+ export interface DataBm25Params {
66
+ field_name: string;
67
+ text_config?: string;
68
+ k1?: number;
69
+ b?: number;
70
+ search_score_weight?: number;
71
+ }
72
+ /** Composite node type that orchestrates multiple search modalities (full-text search, BM25, embeddings, trigram) on a single table. Configures per-table search score weights, normalization strategy, and recency boost via the @searchConfig smart tag. */
73
+ export interface DataSearchParams {
74
+ full_text_search?: {
75
+ field_name?: string;
76
+ source_fields?: {
77
+ field: string;
78
+ weight?: "A" | "B" | "C" | "D";
79
+ lang?: string;
80
+ }[];
81
+ search_score_weight?: number;
82
+ };
83
+ bm25?: {
84
+ field_name?: string;
85
+ text_config?: string;
86
+ k1?: number;
87
+ b?: number;
88
+ search_score_weight?: number;
89
+ };
90
+ embedding?: {
91
+ field_name?: string;
92
+ dimensions?: number;
93
+ index_method?: "hnsw" | "ivfflat";
94
+ metric?: "cosine" | "l2" | "ip";
95
+ source_fields?: string[];
96
+ search_score_weight?: number;
97
+ };
98
+ trgm_fields?: string[];
99
+ search_config?: {
100
+ weights?: {
101
+ [key: string]: unknown;
102
+ };
103
+ normalization?: "linear" | "sigmoid";
104
+ boost_recent?: boolean;
105
+ boost_recency_field?: string;
106
+ boost_recency_decay?: number;
107
+ };
108
+ }
109
+ /** Adds a PostGIS geometry or geography column with a spatial index (GiST or SP-GiST). Supports configurable geometry types (Point, Polygon, etc.), SRID, and dimensionality. The graphile-postgis plugin auto-detects geometry/geography columns by codec type for spatial filtering (ST_Contains, ST_DWithin, bbox operators). */
110
+ export interface DataPostGISParams {
111
+ field_name?: string;
112
+ geometry_type?: "Point" | "LineString" | "Polygon" | "MultiPoint" | "MultiLineString" | "MultiPolygon" | "GeometryCollection" | "Geometry";
113
+ srid?: number;
114
+ dimension?: 2 | 3 | 4;
115
+ use_geography?: boolean;
116
+ index_method?: "gist" | "spgist";
117
+ }
118
+ /** Creates a derived/materialized geometry field on the parent table that automatically aggregates geometries from a source (child) table via triggers. When child rows are inserted/updated/deleted, the parent aggregate field is recalculated using the specified PostGIS aggregation function (ST_Union, ST_Collect, ST_ConvexHull, ST_ConcaveHull). Useful for materializing spatial boundaries from collections of points or polygons. */
119
+ export interface DataPostGISAggregateParams {
120
+ field_name?: string;
121
+ source_table_id: string;
122
+ source_geom_field?: string;
123
+ source_fk_field: string;
124
+ aggregate_function?: "union" | "collect" | "convex_hull" | "concave_hull";
125
+ geometry_type?: "Point" | "LineString" | "Polygon" | "MultiPoint" | "MultiLineString" | "MultiPolygon" | "GeometryCollection" | "Geometry";
126
+ srid?: number;
127
+ dimension?: 2 | 3 | 4;
128
+ use_geography?: boolean;
129
+ index_method?: "gist" | "spgist";
130
+ }
131
+ /** 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). */
132
+ export interface DataJobTriggerParams {
133
+ task_identifier: string;
134
+ payload_strategy?: "row" | "row_id" | "fields" | "custom";
135
+ payload_fields?: string[];
136
+ payload_custom?: {
137
+ [key: string]: unknown;
138
+ };
139
+ events?: ("INSERT" | "UPDATE" | "DELETE")[];
140
+ include_old?: boolean;
141
+ include_meta?: boolean;
142
+ condition_field?: string;
143
+ condition_value?: string;
144
+ watch_fields?: string[];
145
+ job_key?: string;
146
+ queue_name?: string;
147
+ priority?: number;
148
+ run_at_delay?: string;
149
+ max_attempts?: number;
150
+ }
151
+ /** Adds a citext[] tags column with GIN index for efficient array containment queries (@>, &&). Standard tagging pattern for categorization and filtering. */
152
+ export interface DataTagsParams {
153
+ field_name?: string;
154
+ default_value?: string;
155
+ is_required?: boolean;
156
+ }
157
+ /** Adds a status column with B-tree index for efficient equality filtering and sorting. Optionally constrains values via CHECK constraint when allowed_values is provided. */
158
+ export interface DataStatusFieldParams {
159
+ field_name?: string;
160
+ type?: string;
161
+ default_value?: string;
162
+ is_required?: boolean;
163
+ allowed_values?: string[];
164
+ }
165
+ /** Adds a JSONB column with optional GIN index for containment queries (@>, ?, ?|, ?&). Standard pattern for semi-structured metadata. */
166
+ export interface DataJsonbParams {
167
+ field_name?: string;
168
+ default_value?: string;
169
+ is_required?: boolean;
170
+ create_index?: boolean;
171
+ }
172
+ /** Creates GIN trigram indexes (gin_trgm_ops) on specified text/citext fields for fuzzy LIKE/ILIKE/similarity search. Adds @trgmSearch smart tag for PostGraphile integration. Fields must already exist on the table. */
173
+ export interface DataTrgmParams {
174
+ fields: string[];
175
+ }
176
+ /** 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. */
177
+ export interface DataSlugParams {
178
+ field_name: string;
179
+ source_field_name?: string;
180
+ }
181
+ /** Transforms field values using inflection operations (snake_case, camelCase, slugify, plural, singular, etc). Attaches BEFORE INSERT and BEFORE UPDATE triggers. References fields by name in data jsonb. */
182
+ export interface DataInflectionParams {
183
+ field_name: string;
184
+ ops: ("plural" | "singular" | "camel" | "pascal" | "dashed" | "slugify" | "underscore" | "lower" | "upper")[];
185
+ }
186
+ /** Restricts which user can modify specific columns in shared objects. Creates an AFTER UPDATE trigger that throws OWNED_PROPS when a non-owner tries to change protected fields. References fields by name in data jsonb. */
187
+ export interface DataOwnedFieldsParams {
188
+ role_key_field_name: string;
189
+ protected_field_names: string[];
190
+ }
191
+ /** BEFORE INSERT trigger that copies specified fields from a parent table via a foreign key. The parent row is looked up through RLS (SECURITY INVOKER), so the insert fails if the caller cannot see the parent. Used by the storage module to inherit owner_id and is_public from buckets to files. */
192
+ export interface DataInheritFromParentParams {
193
+ parent_fk_field: string;
194
+ fields: string[];
195
+ parent_table?: string;
196
+ parent_schema?: string;
197
+ }
198
+ /** 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. */
199
+ export interface DataForceCurrentUserParams {
200
+ field_name?: string;
201
+ }
202
+ /** BEFORE UPDATE trigger that prevents changes to a list of specified fields after INSERT. Raises an exception if any of the listed fields have changed. Unlike FieldImmutable (single-field), this handles multiple fields in a single trigger for efficiency. */
203
+ export interface DataImmutableFieldsParams {
204
+ fields: string[];
205
+ }
206
+ /** Creates a user profiles table with standard profile fields (profile_picture, bio, first_name, last_name, tags, desired). Uses AuthzDirectOwner for edit access and AuthzAllowAll for select. */
207
+ export type TableUserProfilesParams = {};
208
+ /** Creates an organization settings table with standard business fields (legal_name, address fields). Uses AuthzEntityMembership for access control. */
209
+ export type TableOrganizationSettingsParams = {};
210
+ /** Creates a user settings table for user-specific configuration. Uses AuthzDirectOwner for access control. */
211
+ export type TableUserSettingsParams = {};
212
+ /** Direct equality comparison between a table column and the current user ID. Simplest authorization pattern with no subqueries. */
213
+ export interface AuthzDirectOwnerParams {
214
+ entity_field: string;
215
+ }
216
+ /** OR logic for multiple ownership fields. Checks if current user matches any of the specified fields. */
217
+ export interface AuthzDirectOwnerAnyParams {
218
+ entity_fields: string[];
219
+ }
220
+ /** Membership check that verifies the user has membership (optionally with specific permission) without binding to any entity from the row. Uses EXISTS subquery against SPRT table. */
221
+ export interface AuthzMembershipParams {
222
+ membership_type: number | string;
223
+ permission?: string;
224
+ permissions?: string[];
225
+ is_admin?: boolean;
226
+ is_owner?: boolean;
227
+ }
228
+ /** Membership check scoped by a field on the row through the SPRT table. Verifies user has membership in the entity referenced by the row. */
229
+ export interface AuthzEntityMembershipParams {
230
+ entity_field: string;
231
+ membership_type?: number | string;
232
+ permission?: string;
233
+ permissions?: string[];
234
+ is_admin?: boolean;
235
+ is_owner?: boolean;
236
+ }
237
+ /** JOIN-based membership verification through related tables. Joins SPRT table with another table to verify membership. */
238
+ export interface AuthzRelatedEntityMembershipParams {
239
+ entity_field: string;
240
+ membership_type?: number | string;
241
+ obj_table_id?: string;
242
+ obj_schema?: string;
243
+ obj_table?: string;
244
+ obj_field_id?: string;
245
+ obj_field?: string;
246
+ permission?: string;
247
+ permissions?: string[];
248
+ is_admin?: boolean;
249
+ is_owner?: boolean;
250
+ }
251
+ /** Organizational hierarchy visibility using closure table. Managers can see subordinate data or subordinates can see manager data. */
252
+ export interface AuthzOrgHierarchyParams {
253
+ direction: "up" | "down";
254
+ entity_field?: string;
255
+ anchor_field: string;
256
+ max_depth?: number;
257
+ }
258
+ /** Time-window based access control. Restricts access based on valid_from and/or valid_until timestamps. At least one of valid_from_field or valid_until_field must be provided. */
259
+ export interface AuthzTemporalParams {
260
+ valid_from_field?: string;
261
+ valid_until_field?: string;
262
+ valid_from_inclusive?: boolean;
263
+ valid_until_inclusive?: boolean;
264
+ }
265
+ /** Published state access control. Restricts access to records that are published. */
266
+ export interface AuthzPublishableParams {
267
+ is_published_field?: string;
268
+ published_at_field?: string;
269
+ require_published_at?: boolean;
270
+ }
271
+ /** Check if current user is in an array column on the same row. */
272
+ export interface AuthzMemberListParams {
273
+ array_field: string;
274
+ }
275
+ /** Array membership check in a related table. */
276
+ export interface AuthzRelatedMemberListParams {
277
+ owned_schema: string;
278
+ owned_table: string;
279
+ owned_table_key: string;
280
+ owned_table_ref_key: string;
281
+ this_object_key: string;
282
+ }
283
+ /** Allows all access. Generates TRUE expression. */
284
+ export type AuthzAllowAllParams = {};
285
+ /** Denies all access. Generates FALSE expression. */
286
+ export type AuthzDenyAllParams = {};
287
+ /** Composite authorization policy that combines multiple authorization nodes using boolean logic (AND/OR). The data field contains a JSONB AST with nested authorization nodes. */
288
+ export interface AuthzCompositeParams {
289
+ BoolExpr?: {
290
+ boolop?: "AND_EXPR" | "OR_EXPR" | "NOT_EXPR";
291
+ args?: {
292
+ [key: string]: unknown;
293
+ }[];
294
+ };
295
+ }
296
+ /** Peer visibility through shared entity membership. Authorizes access to user-owned rows when the owner and current user are both members of the same entity. Self-joins the SPRT table to find peers. */
297
+ export interface AuthzPeerOwnershipParams {
298
+ owner_field: string;
299
+ membership_type?: number | string;
300
+ permission?: string;
301
+ permissions?: string[];
302
+ is_admin?: boolean;
303
+ is_owner?: boolean;
304
+ }
305
+ /** Peer visibility through shared entity membership via a related table. Like AuthzPeerOwnership but the owning user is resolved through a FK JOIN to a related table. Combines SPRT self-join with object table JOIN. */
306
+ export interface AuthzRelatedPeerOwnershipParams {
307
+ entity_field: string;
308
+ membership_type?: number | string;
309
+ obj_table_id?: string;
310
+ obj_schema?: string;
311
+ obj_table?: string;
312
+ obj_field_id?: string;
313
+ obj_field?: string;
314
+ obj_ref_field?: string;
315
+ permission?: string;
316
+ permissions?: string[];
317
+ is_admin?: boolean;
318
+ is_owner?: boolean;
319
+ }
320
+ /** Creates a foreign key field on the source table referencing the target table. Auto-derives the FK field name from the target table name using inflection (e.g., projects derives project_id). delete_action is required and must be explicitly provided by the caller. */
321
+ export interface RelationBelongsToParams {
322
+ source_table_id: string;
323
+ target_table_id: string;
324
+ field_name?: string;
325
+ delete_action: "c" | "r" | "n" | "d" | "a";
326
+ is_required?: boolean;
327
+ }
328
+ /** Creates a foreign key field with a unique constraint on the source table referencing the target table. Enforces 1:1 cardinality. Auto-derives the FK field name from the target table name using inflection. delete_action is required and must be explicitly provided by the caller. */
329
+ export interface RelationHasOneParams {
330
+ source_table_id: string;
331
+ target_table_id: string;
332
+ field_name?: string;
333
+ delete_action: "c" | "r" | "n" | "d" | "a";
334
+ is_required?: boolean;
335
+ }
336
+ /** Creates a foreign key field on the target table referencing the source table. Inverse of RelationBelongsTo — same FK, different perspective. "projects has many tasks" creates tasks.project_id. Auto-derives the FK field name from the source table name using inflection. delete_action is required and must be explicitly provided by the caller. */
337
+ export interface RelationHasManyParams {
338
+ source_table_id: string;
339
+ target_table_id: string;
340
+ field_name?: string;
341
+ delete_action: "c" | "r" | "n" | "d" | "a";
342
+ is_required?: boolean;
343
+ }
344
+ /** Creates a junction table between source and target tables with auto-derived naming and FK fields. The trigger creates a bare table (no implicit DataId or any node_type), adds FK fields to both tables, optionally creates a composite PK (use_composite_key), then forwards all security config to secure_table_provision as-is. The trigger never injects values the caller did not provide. Junction table FKs always CASCADE on delete. */
345
+ export interface RelationManyToManyParams {
346
+ source_table_id: string;
347
+ target_table_id: string;
348
+ junction_table_id?: string;
349
+ junction_table_name?: string;
350
+ source_field_name?: string;
351
+ target_field_name?: string;
352
+ use_composite_key?: boolean;
353
+ node_type?: string;
354
+ node_data?: {
355
+ [key: string]: unknown;
356
+ };
357
+ grant_roles?: string[];
358
+ grant_privileges?: string[];
359
+ policy_type?: string;
360
+ policy_privileges?: string[];
361
+ policy_role?: string;
362
+ policy_permissive?: boolean;
363
+ policy_data?: {
364
+ [key: string]: unknown;
365
+ };
366
+ }
367
+ /** Simple column selection from a single source table. Projects all or specific fields. */
368
+ export interface ViewTableProjectionParams {
369
+ source_table_id: string;
370
+ field_ids?: string[];
371
+ field_names?: string[];
372
+ }
373
+ /** Table projection with an Authz* filter baked into the view definition. The view only returns records matching the filter. */
374
+ export interface ViewFilteredTableParams {
375
+ source_table_id: string;
376
+ filter_type: string;
377
+ filter_data?: {
378
+ [key: string]: unknown;
379
+ };
380
+ field_ids?: string[];
381
+ field_names?: string[];
382
+ }
383
+ /** View that joins multiple tables together. Supports INNER, LEFT, RIGHT, and FULL joins. */
384
+ export interface ViewJoinedTablesParams {
385
+ primary_table_id: string;
386
+ primary_columns?: string[];
387
+ joins: {
388
+ table_id: string;
389
+ join_type?: "INNER" | "LEFT" | "RIGHT" | "FULL";
390
+ primary_field: string;
391
+ join_field: string;
392
+ columns?: string[];
393
+ }[];
394
+ field_ids?: string[];
395
+ }
396
+ /** View with GROUP BY and aggregate functions. Useful for summary/reporting views. */
397
+ export interface ViewAggregatedParams {
398
+ source_table_id: string;
399
+ group_by_fields: string[];
400
+ aggregates: {
401
+ function: "COUNT" | "SUM" | "AVG" | "MIN" | "MAX";
402
+ field?: string;
403
+ alias: string;
404
+ }[];
405
+ }
406
+ /** Advanced view using composite AST for the query. Use when other node types are insufficient (CTEs, UNIONs, complex subqueries, etc.). */
407
+ export interface ViewCompositeParams {
408
+ query_ast: {
409
+ [key: string]: unknown;
410
+ };
411
+ }
412
+ /** A custom field (column) to add to a blueprint table. */
413
+ export interface BlueprintField {
414
+ /** The column name. */
415
+ name: string;
416
+ /** The PostgreSQL type (e.g., "text", "integer", "boolean", "uuid"). */
417
+ type: string;
418
+ /** Whether the column has a NOT NULL constraint. */
419
+ is_required?: boolean;
420
+ /** SQL default value expression (e.g., "true", "now()"). */
421
+ default_value?: string;
422
+ /** Comment/description for this field. */
423
+ description?: string;
424
+ }
425
+ /** An RLS policy entry for a blueprint table. */
426
+ export interface BlueprintPolicy {
427
+ /** Authz* policy type name (e.g., "AuthzDirectOwner", "AuthzAllowAll"). */
428
+ $type: "AuthzDirectOwner" | "AuthzDirectOwnerAny" | "AuthzMembership" | "AuthzEntityMembership" | "AuthzRelatedEntityMembership" | "AuthzOrgHierarchy" | "AuthzTemporal" | "AuthzPublishable" | "AuthzMemberList" | "AuthzRelatedMemberList" | "AuthzAllowAll" | "AuthzDenyAll" | "AuthzComposite" | "AuthzPeerOwnership" | "AuthzRelatedPeerOwnership";
429
+ /** Role for this policy. Defaults to "authenticated". */
430
+ policy_role?: string;
431
+ /** Whether this policy is permissive (true) or restrictive (false). */
432
+ permissive?: boolean;
433
+ /** Optional custom name for this policy. */
434
+ policy_name?: string;
435
+ /** Privileges this policy applies to. */
436
+ privileges?: string[];
437
+ /** Policy-specific data (structure varies by policy type). */
438
+ data?: Record<string, unknown>;
439
+ }
440
+ /** A source field contributing to a full-text search tsvector column. */
441
+ export interface BlueprintFtsSource {
442
+ /** Column name of the source field. */
443
+ field: string;
444
+ /** TSVector weight: "A", "B", "C", or "D". */
445
+ weight: string;
446
+ /** Language for text search. Defaults to "english". */
447
+ lang?: string;
448
+ }
449
+ /** A full-text search configuration for a blueprint table. */
450
+ export interface BlueprintFullTextSearch {
451
+ /** Reference key of the table this full-text search belongs to. */
452
+ table_ref: string;
453
+ /** Name of the tsvector field on the table. */
454
+ field: string;
455
+ /** Source fields that feed into this tsvector. */
456
+ sources: BlueprintFtsSource[];
457
+ }
458
+ /** An index definition within a blueprint. */
459
+ export interface BlueprintIndex {
460
+ /** Reference key of the table this index belongs to. */
461
+ table_ref: string;
462
+ /** Single column name for the index. Mutually exclusive with "columns". */
463
+ column?: string;
464
+ /** Array of column names for a multi-column index. Mutually exclusive with "column". */
465
+ columns?: string[];
466
+ /** Index access method (e.g., "BTREE", "GIN", "GIST", "HNSW", "BM25"). */
467
+ access_method: string;
468
+ /** Whether this is a unique index. */
469
+ is_unique?: boolean;
470
+ /** Optional custom name for the index. */
471
+ name?: string;
472
+ /** Operator classes for the index columns. */
473
+ op_classes?: string[];
474
+ /** Additional index-specific options. */
475
+ options?: Record<string, unknown>;
476
+ }
477
+ /** String shorthand -- just the node type name. */
478
+ export type BlueprintNodeShorthand = "AuthzDirectOwner" | "AuthzDirectOwnerAny" | "AuthzMembership" | "AuthzEntityMembership" | "AuthzRelatedEntityMembership" | "AuthzOrgHierarchy" | "AuthzTemporal" | "AuthzPublishable" | "AuthzMemberList" | "AuthzRelatedMemberList" | "AuthzAllowAll" | "AuthzDenyAll" | "AuthzComposite" | "AuthzPeerOwnership" | "AuthzRelatedPeerOwnership" | "DataId" | "DataDirectOwner" | "DataEntityMembership" | "DataOwnershipInEntity" | "DataTimestamps" | "DataPeoplestamps" | "DataPublishable" | "DataSoftDelete" | "DataEmbedding" | "DataFullTextSearch" | "DataBm25" | "DataSearch" | "DataPostGIS" | "DataPostGISAggregate" | "DataJobTrigger" | "DataTags" | "DataStatusField" | "DataJsonb" | "DataTrgm" | "DataSlug" | "DataInflection" | "DataOwnedFields" | "DataInheritFromParent" | "DataForceCurrentUser" | "DataImmutableFields" | "TableUserProfiles" | "TableOrganizationSettings" | "TableUserSettings";
479
+ /** Object form -- { $type, data } with typed parameters. */
480
+ export type BlueprintNodeObject = {
481
+ $type: "AuthzDirectOwner";
482
+ data: AuthzDirectOwnerParams;
483
+ } | {
484
+ $type: "AuthzDirectOwnerAny";
485
+ data: AuthzDirectOwnerAnyParams;
486
+ } | {
487
+ $type: "AuthzMembership";
488
+ data: AuthzMembershipParams;
489
+ } | {
490
+ $type: "AuthzEntityMembership";
491
+ data: AuthzEntityMembershipParams;
492
+ } | {
493
+ $type: "AuthzRelatedEntityMembership";
494
+ data: AuthzRelatedEntityMembershipParams;
495
+ } | {
496
+ $type: "AuthzOrgHierarchy";
497
+ data: AuthzOrgHierarchyParams;
498
+ } | {
499
+ $type: "AuthzTemporal";
500
+ data: AuthzTemporalParams;
501
+ } | {
502
+ $type: "AuthzPublishable";
503
+ data: AuthzPublishableParams;
504
+ } | {
505
+ $type: "AuthzMemberList";
506
+ data: AuthzMemberListParams;
507
+ } | {
508
+ $type: "AuthzRelatedMemberList";
509
+ data: AuthzRelatedMemberListParams;
510
+ } | {
511
+ $type: "AuthzAllowAll";
512
+ data?: Record<string, never>;
513
+ } | {
514
+ $type: "AuthzDenyAll";
515
+ data?: Record<string, never>;
516
+ } | {
517
+ $type: "AuthzComposite";
518
+ data: AuthzCompositeParams;
519
+ } | {
520
+ $type: "AuthzPeerOwnership";
521
+ data: AuthzPeerOwnershipParams;
522
+ } | {
523
+ $type: "AuthzRelatedPeerOwnership";
524
+ data: AuthzRelatedPeerOwnershipParams;
525
+ } | {
526
+ $type: "DataId";
527
+ data: DataIdParams;
528
+ } | {
529
+ $type: "DataDirectOwner";
530
+ data: DataDirectOwnerParams;
531
+ } | {
532
+ $type: "DataEntityMembership";
533
+ data: DataEntityMembershipParams;
534
+ } | {
535
+ $type: "DataOwnershipInEntity";
536
+ data: DataOwnershipInEntityParams;
537
+ } | {
538
+ $type: "DataTimestamps";
539
+ data: DataTimestampsParams;
540
+ } | {
541
+ $type: "DataPeoplestamps";
542
+ data: DataPeoplestampsParams;
543
+ } | {
544
+ $type: "DataPublishable";
545
+ data: DataPublishableParams;
546
+ } | {
547
+ $type: "DataSoftDelete";
548
+ data: DataSoftDeleteParams;
549
+ } | {
550
+ $type: "DataEmbedding";
551
+ data: DataEmbeddingParams;
552
+ } | {
553
+ $type: "DataFullTextSearch";
554
+ data: DataFullTextSearchParams;
555
+ } | {
556
+ $type: "DataBm25";
557
+ data: DataBm25Params;
558
+ } | {
559
+ $type: "DataSearch";
560
+ data: DataSearchParams;
561
+ } | {
562
+ $type: "DataPostGIS";
563
+ data: DataPostGISParams;
564
+ } | {
565
+ $type: "DataPostGISAggregate";
566
+ data: DataPostGISAggregateParams;
567
+ } | {
568
+ $type: "DataJobTrigger";
569
+ data: DataJobTriggerParams;
570
+ } | {
571
+ $type: "DataTags";
572
+ data: DataTagsParams;
573
+ } | {
574
+ $type: "DataStatusField";
575
+ data: DataStatusFieldParams;
576
+ } | {
577
+ $type: "DataJsonb";
578
+ data: DataJsonbParams;
579
+ } | {
580
+ $type: "DataTrgm";
581
+ data: DataTrgmParams;
582
+ } | {
583
+ $type: "DataSlug";
584
+ data: DataSlugParams;
585
+ } | {
586
+ $type: "DataInflection";
587
+ data: DataInflectionParams;
588
+ } | {
589
+ $type: "DataOwnedFields";
590
+ data: DataOwnedFieldsParams;
591
+ } | {
592
+ $type: "DataInheritFromParent";
593
+ data: DataInheritFromParentParams;
594
+ } | {
595
+ $type: "DataForceCurrentUser";
596
+ data: DataForceCurrentUserParams;
597
+ } | {
598
+ $type: "DataImmutableFields";
599
+ data: DataImmutableFieldsParams;
600
+ } | {
601
+ $type: "TableUserProfiles";
602
+ data?: Record<string, never>;
603
+ } | {
604
+ $type: "TableOrganizationSettings";
605
+ data?: Record<string, never>;
606
+ } | {
607
+ $type: "TableUserSettings";
608
+ data?: Record<string, never>;
609
+ };
610
+ /** A node entry in a blueprint table. Either a string shorthand or a typed object. */
611
+ export type BlueprintNode = BlueprintNodeShorthand | BlueprintNodeObject;
612
+ /** A relation entry in a blueprint definition. */
613
+ export type BlueprintRelation = {
614
+ $type: "RelationBelongsTo";
615
+ source_ref: string;
616
+ target_ref: string;
617
+ } & Partial<RelationBelongsToParams> | {
618
+ $type: "RelationHasOne";
619
+ source_ref: string;
620
+ target_ref: string;
621
+ } & Partial<RelationHasOneParams> | {
622
+ $type: "RelationHasMany";
623
+ source_ref: string;
624
+ target_ref: string;
625
+ } & Partial<RelationHasManyParams> | {
626
+ $type: "RelationManyToMany";
627
+ source_ref: string;
628
+ target_ref: string;
629
+ } & Partial<RelationManyToManyParams>;
630
+ /** A table definition within a blueprint. */
631
+ export interface BlueprintTable {
632
+ /** Local reference key for this table (used by relations, indexes, fts). */
633
+ ref: string;
634
+ /** The PostgreSQL table name to create. */
635
+ table_name: string;
636
+ /** Array of node type entries that define the table's behavior. */
637
+ nodes: BlueprintNode[];
638
+ /** Custom fields (columns) to add to the table. */
639
+ fields?: BlueprintField[];
640
+ /** RLS policies for this table. */
641
+ policies?: BlueprintPolicy[];
642
+ /** Database roles to grant privileges to. Defaults to ["authenticated"]. */
643
+ grant_roles?: string[];
644
+ /** Privilege grants as [verb, column] tuples or objects. */
645
+ grants?: unknown[];
646
+ /** Whether to enable RLS on this table. Defaults to true. */
647
+ use_rls?: boolean;
648
+ }
649
+ /** The complete blueprint definition -- the JSONB shape accepted by construct_blueprint(). */
650
+ export interface BlueprintDefinition {
651
+ /** Tables to create. */
652
+ tables: BlueprintTable[];
653
+ /** Relations between tables. */
654
+ relations?: BlueprintRelation[];
655
+ /** Indexes on table columns. */
656
+ indexes?: BlueprintIndex[];
657
+ /** Full-text search configurations. */
658
+ full_text_searches?: BlueprintFullTextSearch[];
659
+ }