node-type-registry 0.12.0 → 0.14.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.
@@ -401,6 +401,16 @@ export interface RelationManyToManyParams {
401
401
  [key: string]: unknown;
402
402
  };
403
403
  }
404
+ /** Declares a spatial predicate between two existing geometry/geography columns. Inserts a metaschema_public.spatial_relation row; the sync_spatial_relation_tags trigger then projects a @spatialRelation smart tag onto the owner column so graphile-postgis' PostgisSpatialRelationsPlugin can expose it as a cross-table filter in GraphQL. Metadata-only: both source_field and target_field must already exist on their tables. Idempotent on (source_table_id, name). One direction per tag — author two RelationSpatial entries if symmetry is desired. */
405
+ export interface RelationSpatialParams {
406
+ source_table_id: string;
407
+ source_field_id: string;
408
+ target_table_id: string;
409
+ target_field_id: string;
410
+ name: string;
411
+ operator: "st_contains" | "st_within" | "st_intersects" | "st_covers" | "st_coveredby" | "st_overlaps" | "st_touches" | "st_dwithin";
412
+ param_name?: string;
413
+ }
404
414
  /** Simple column selection from a single source table. Projects all or specific fields. */
405
415
  export interface ViewTableProjectionParams {
406
416
  source_table_id: string;
@@ -559,6 +569,21 @@ export interface BlueprintTableUniqueConstraint {
559
569
  /** Optional schema name override. */
560
570
  schema_name?: string;
561
571
  }
572
+ /** Override object for the entity table created by a BlueprintMembershipType. Shape mirrors BlueprintTable / secure_table_provision vocabulary. When supplied, policies[] replaces the default entity-table policies entirely. */
573
+ export interface BlueprintEntityTableProvision {
574
+ /** Whether to enable RLS on the entity table. Forwarded to secure_table_provision. Defaults to true. */
575
+ use_rls?: boolean;
576
+ /** Node objects applied to the entity table for field creation (e.g., DataTimestamps, DataPeoplestamps). Forwarded to secure_table_provision as-is. */
577
+ nodes?: BlueprintNode[];
578
+ /** Custom fields (columns) to add to the entity table. Forwarded to secure_table_provision as-is. */
579
+ fields?: BlueprintField[];
580
+ /** Privilege grants for the entity table as [verb, columns] tuples (e.g. [["select","*"],["insert","*"]]). Forwarded to secure_table_provision as-is. */
581
+ grant_privileges?: unknown[];
582
+ /** Database roles to grant privileges to. Forwarded to secure_table_provision as-is. Defaults to ["authenticated"]. */
583
+ grant_roles?: string[];
584
+ /** RLS policies for the entity table. When present, these policies fully replace the five default entity-table policies (is_visible becomes a no-op). */
585
+ policies?: BlueprintPolicy[];
586
+ }
562
587
  /** A membership type entry for Phase 0 of construct_blueprint(). Provisions a full entity type with its own entity table, membership modules, and security policies via entity_type_provision. */
563
588
  export interface BlueprintMembershipType {
564
589
  /** Entity type name (e.g., "data_room", "channel", "department"). Must be unique per database. */
@@ -571,7 +596,7 @@ export interface BlueprintMembershipType {
571
596
  parent_entity?: string;
572
597
  /** Custom table name for the entity table. Defaults to name-derived convention. */
573
598
  table_name?: string;
574
- /** Whether this entity type is visible in the API. Defaults to true. */
599
+ /** Whether parent-entity members can see child entities via the default parent_member SELECT policy. Gates one of the five default policies. No-op when table_provision is supplied. Defaults to true. */
575
600
  is_visible?: boolean;
576
601
  /** Whether to provision a limits module for this entity type. Defaults to false. */
577
602
  has_limits?: boolean;
@@ -579,8 +604,10 @@ export interface BlueprintMembershipType {
579
604
  has_profiles?: boolean;
580
605
  /** Whether to provision a levels module for this entity type. Defaults to false. */
581
606
  has_levels?: boolean;
582
- /** Whether to skip creating default RLS policies on the entity table. Defaults to false. */
607
+ /** Escape hatch: when true AND table_provision is NULL, zero policies are provisioned on the entity table. Defaults to false. */
583
608
  skip_entity_policies?: boolean;
609
+ /** 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). */
610
+ table_provision?: BlueprintEntityTableProvision;
584
611
  }
585
612
  /** String shorthand -- just the node type name. */
586
613
  export type BlueprintNodeShorthand = "AuthzDirectOwner" | "AuthzDirectOwnerAny" | "AuthzMembership" | "AuthzEntityMembership" | "AuthzRelatedEntityMembership" | "AuthzOrgHierarchy" | "AuthzTemporal" | "AuthzPublishable" | "AuthzMemberList" | "AuthzRelatedMemberList" | "AuthzAllowAll" | "AuthzDenyAll" | "AuthzComposite" | "AuthzNotReadOnly" | "AuthzPeerOwnership" | "AuthzRelatedPeerOwnership" | "DataId" | "DataDirectOwner" | "DataEntityMembership" | "DataOwnershipInEntity" | "DataTimestamps" | "DataPeoplestamps" | "DataPublishable" | "DataSoftDelete" | "SearchVector" | "SearchFullText" | "SearchBm25" | "SearchUnified" | "SearchSpatial" | "SearchSpatialAggregate" | "DataJobTrigger" | "DataTags" | "DataStatusField" | "DataJsonb" | "SearchTrgm" | "DataSlug" | "DataInflection" | "DataOwnedFields" | "DataInheritFromParent" | "DataForceCurrentUser" | "DataImmutableFields" | "DataCompositeField" | "TableUserProfiles" | "TableOrganizationSettings" | "TableUserSettings";
@@ -748,7 +775,13 @@ export type BlueprintRelation = {
748
775
  target_table: string;
749
776
  source_schema_name?: string;
750
777
  target_schema_name?: string;
751
- } & Partial<RelationManyToManyParams>;
778
+ } & Partial<RelationManyToManyParams> | {
779
+ $type: "RelationSpatial";
780
+ source_table: string;
781
+ target_table: string;
782
+ source_schema_name?: string;
783
+ target_schema_name?: string;
784
+ } & Partial<RelationSpatialParams>;
752
785
  /** A table definition within a blueprint. */
753
786
  export interface BlueprintTable {
754
787
  /** The PostgreSQL table name to create. */
@@ -384,6 +384,16 @@ function buildBlueprintTableUniqueConstraint() {
384
384
  addJSDoc(optionalProp('schema_name', t.tsStringKeyword()), 'Optional schema name override.'),
385
385
  ]), 'A unique constraint nested inside a table definition (table_name not required).');
386
386
  }
387
+ function buildBlueprintEntityTableProvision() {
388
+ return addJSDoc(exportInterface('BlueprintEntityTableProvision', [
389
+ addJSDoc(optionalProp('use_rls', t.tsBooleanKeyword()), 'Whether to enable RLS on the entity table. Forwarded to secure_table_provision. Defaults to true.'),
390
+ addJSDoc(optionalProp('nodes', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintNode')))), 'Node objects applied to the entity table for field creation (e.g., DataTimestamps, DataPeoplestamps). Forwarded to secure_table_provision as-is.'),
391
+ addJSDoc(optionalProp('fields', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintField')))), 'Custom fields (columns) to add to the entity table. Forwarded to secure_table_provision as-is.'),
392
+ addJSDoc(optionalProp('grant_privileges', t.tsArrayType(t.tsUnknownKeyword())), 'Privilege grants for the entity table as [verb, columns] tuples (e.g. [["select","*"],["insert","*"]]). Forwarded to secure_table_provision as-is.'),
393
+ addJSDoc(optionalProp('grant_roles', t.tsArrayType(t.tsStringKeyword())), 'Database roles to grant privileges to. Forwarded to secure_table_provision as-is. Defaults to ["authenticated"].'),
394
+ addJSDoc(optionalProp('policies', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintPolicy')))), 'RLS policies for the entity table. When present, these policies fully replace the five default entity-table policies (is_visible becomes a no-op).'),
395
+ ]), 'Override object for the entity table created by a BlueprintMembershipType. Shape mirrors BlueprintTable / secure_table_provision vocabulary. When supplied, policies[] replaces the default entity-table policies entirely.');
396
+ }
387
397
  function buildBlueprintMembershipType() {
388
398
  return addJSDoc(exportInterface('BlueprintMembershipType', [
389
399
  addJSDoc(requiredProp('name', t.tsStringKeyword()), 'Entity type name (e.g., "data_room", "channel", "department"). Must be unique per database.'),
@@ -391,11 +401,12 @@ function buildBlueprintMembershipType() {
391
401
  addJSDoc(optionalProp('description', t.tsStringKeyword()), 'Human-readable description of this entity type.'),
392
402
  addJSDoc(optionalProp('parent_entity', t.tsStringKeyword()), 'Parent entity type name. Defaults to "org".'),
393
403
  addJSDoc(optionalProp('table_name', t.tsStringKeyword()), 'Custom table name for the entity table. Defaults to name-derived convention.'),
394
- addJSDoc(optionalProp('is_visible', t.tsBooleanKeyword()), 'Whether this entity type is visible in the API. Defaults to true.'),
404
+ addJSDoc(optionalProp('is_visible', t.tsBooleanKeyword()), 'Whether parent-entity members can see child entities via the default parent_member SELECT policy. Gates one of the five default policies. No-op when table_provision is supplied. Defaults to true.'),
395
405
  addJSDoc(optionalProp('has_limits', t.tsBooleanKeyword()), 'Whether to provision a limits module for this entity type. Defaults to false.'),
396
406
  addJSDoc(optionalProp('has_profiles', t.tsBooleanKeyword()), 'Whether to provision a profiles module for this entity type. Defaults to false.'),
397
407
  addJSDoc(optionalProp('has_levels', t.tsBooleanKeyword()), 'Whether to provision a levels module for this entity type. Defaults to false.'),
398
- addJSDoc(optionalProp('skip_entity_policies', t.tsBooleanKeyword()), 'Whether to skip creating default RLS policies on the entity table. Defaults to false.'),
408
+ 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.'),
409
+ 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).'),
399
410
  ]), 'A membership type entry for Phase 0 of construct_blueprint(). Provisions a full entity type with its own entity table, membership modules, and security policies via entity_type_provision.');
400
411
  }
401
412
  function buildBlueprintTable() {
@@ -474,6 +485,7 @@ function buildProgram(meta) {
474
485
  statements.push(buildBlueprintTableIndex());
475
486
  statements.push(buildBlueprintUniqueConstraint());
476
487
  statements.push(buildBlueprintTableUniqueConstraint());
488
+ statements.push(buildBlueprintEntityTableProvision());
477
489
  statements.push(buildBlueprintMembershipType());
478
490
  // -- Node types discriminated union --
479
491
  statements.push(sectionComment('Node types -- discriminated union for nodes[] entries'));
@@ -401,6 +401,16 @@ export interface RelationManyToManyParams {
401
401
  [key: string]: unknown;
402
402
  };
403
403
  }
404
+ /** Declares a spatial predicate between two existing geometry/geography columns. Inserts a metaschema_public.spatial_relation row; the sync_spatial_relation_tags trigger then projects a @spatialRelation smart tag onto the owner column so graphile-postgis' PostgisSpatialRelationsPlugin can expose it as a cross-table filter in GraphQL. Metadata-only: both source_field and target_field must already exist on their tables. Idempotent on (source_table_id, name). One direction per tag — author two RelationSpatial entries if symmetry is desired. */
405
+ export interface RelationSpatialParams {
406
+ source_table_id: string;
407
+ source_field_id: string;
408
+ target_table_id: string;
409
+ target_field_id: string;
410
+ name: string;
411
+ operator: "st_contains" | "st_within" | "st_intersects" | "st_covers" | "st_coveredby" | "st_overlaps" | "st_touches" | "st_dwithin";
412
+ param_name?: string;
413
+ }
404
414
  /** Simple column selection from a single source table. Projects all or specific fields. */
405
415
  export interface ViewTableProjectionParams {
406
416
  source_table_id: string;
@@ -559,6 +569,21 @@ export interface BlueprintTableUniqueConstraint {
559
569
  /** Optional schema name override. */
560
570
  schema_name?: string;
561
571
  }
572
+ /** Override object for the entity table created by a BlueprintMembershipType. Shape mirrors BlueprintTable / secure_table_provision vocabulary. When supplied, policies[] replaces the default entity-table policies entirely. */
573
+ export interface BlueprintEntityTableProvision {
574
+ /** Whether to enable RLS on the entity table. Forwarded to secure_table_provision. Defaults to true. */
575
+ use_rls?: boolean;
576
+ /** Node objects applied to the entity table for field creation (e.g., DataTimestamps, DataPeoplestamps). Forwarded to secure_table_provision as-is. */
577
+ nodes?: BlueprintNode[];
578
+ /** Custom fields (columns) to add to the entity table. Forwarded to secure_table_provision as-is. */
579
+ fields?: BlueprintField[];
580
+ /** Privilege grants for the entity table as [verb, columns] tuples (e.g. [["select","*"],["insert","*"]]). Forwarded to secure_table_provision as-is. */
581
+ grant_privileges?: unknown[];
582
+ /** Database roles to grant privileges to. Forwarded to secure_table_provision as-is. Defaults to ["authenticated"]. */
583
+ grant_roles?: string[];
584
+ /** RLS policies for the entity table. When present, these policies fully replace the five default entity-table policies (is_visible becomes a no-op). */
585
+ policies?: BlueprintPolicy[];
586
+ }
562
587
  /** A membership type entry for Phase 0 of construct_blueprint(). Provisions a full entity type with its own entity table, membership modules, and security policies via entity_type_provision. */
563
588
  export interface BlueprintMembershipType {
564
589
  /** Entity type name (e.g., "data_room", "channel", "department"). Must be unique per database. */
@@ -571,7 +596,7 @@ export interface BlueprintMembershipType {
571
596
  parent_entity?: string;
572
597
  /** Custom table name for the entity table. Defaults to name-derived convention. */
573
598
  table_name?: string;
574
- /** Whether this entity type is visible in the API. Defaults to true. */
599
+ /** Whether parent-entity members can see child entities via the default parent_member SELECT policy. Gates one of the five default policies. No-op when table_provision is supplied. Defaults to true. */
575
600
  is_visible?: boolean;
576
601
  /** Whether to provision a limits module for this entity type. Defaults to false. */
577
602
  has_limits?: boolean;
@@ -579,8 +604,10 @@ export interface BlueprintMembershipType {
579
604
  has_profiles?: boolean;
580
605
  /** Whether to provision a levels module for this entity type. Defaults to false. */
581
606
  has_levels?: boolean;
582
- /** Whether to skip creating default RLS policies on the entity table. Defaults to false. */
607
+ /** Escape hatch: when true AND table_provision is NULL, zero policies are provisioned on the entity table. Defaults to false. */
583
608
  skip_entity_policies?: boolean;
609
+ /** 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). */
610
+ table_provision?: BlueprintEntityTableProvision;
584
611
  }
585
612
  /** String shorthand -- just the node type name. */
586
613
  export type BlueprintNodeShorthand = "AuthzDirectOwner" | "AuthzDirectOwnerAny" | "AuthzMembership" | "AuthzEntityMembership" | "AuthzRelatedEntityMembership" | "AuthzOrgHierarchy" | "AuthzTemporal" | "AuthzPublishable" | "AuthzMemberList" | "AuthzRelatedMemberList" | "AuthzAllowAll" | "AuthzDenyAll" | "AuthzComposite" | "AuthzNotReadOnly" | "AuthzPeerOwnership" | "AuthzRelatedPeerOwnership" | "DataId" | "DataDirectOwner" | "DataEntityMembership" | "DataOwnershipInEntity" | "DataTimestamps" | "DataPeoplestamps" | "DataPublishable" | "DataSoftDelete" | "SearchVector" | "SearchFullText" | "SearchBm25" | "SearchUnified" | "SearchSpatial" | "SearchSpatialAggregate" | "DataJobTrigger" | "DataTags" | "DataStatusField" | "DataJsonb" | "SearchTrgm" | "DataSlug" | "DataInflection" | "DataOwnedFields" | "DataInheritFromParent" | "DataForceCurrentUser" | "DataImmutableFields" | "DataCompositeField" | "TableUserProfiles" | "TableOrganizationSettings" | "TableUserSettings";
@@ -748,7 +775,13 @@ export type BlueprintRelation = {
748
775
  target_table: string;
749
776
  source_schema_name?: string;
750
777
  target_schema_name?: string;
751
- } & Partial<RelationManyToManyParams>;
778
+ } & Partial<RelationManyToManyParams> | {
779
+ $type: "RelationSpatial";
780
+ source_table: string;
781
+ target_table: string;
782
+ source_schema_name?: string;
783
+ target_schema_name?: string;
784
+ } & Partial<RelationSpatialParams>;
752
785
  /** A table definition within a blueprint. */
753
786
  export interface BlueprintTable {
754
787
  /** The PostgreSQL table name to create. */
@@ -349,6 +349,16 @@ function buildBlueprintTableUniqueConstraint() {
349
349
  addJSDoc(optionalProp('schema_name', t.tsStringKeyword()), 'Optional schema name override.'),
350
350
  ]), 'A unique constraint nested inside a table definition (table_name not required).');
351
351
  }
352
+ function buildBlueprintEntityTableProvision() {
353
+ return addJSDoc(exportInterface('BlueprintEntityTableProvision', [
354
+ addJSDoc(optionalProp('use_rls', t.tsBooleanKeyword()), 'Whether to enable RLS on the entity table. Forwarded to secure_table_provision. Defaults to true.'),
355
+ addJSDoc(optionalProp('nodes', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintNode')))), 'Node objects applied to the entity table for field creation (e.g., DataTimestamps, DataPeoplestamps). Forwarded to secure_table_provision as-is.'),
356
+ addJSDoc(optionalProp('fields', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintField')))), 'Custom fields (columns) to add to the entity table. Forwarded to secure_table_provision as-is.'),
357
+ addJSDoc(optionalProp('grant_privileges', t.tsArrayType(t.tsUnknownKeyword())), 'Privilege grants for the entity table as [verb, columns] tuples (e.g. [["select","*"],["insert","*"]]). Forwarded to secure_table_provision as-is.'),
358
+ addJSDoc(optionalProp('grant_roles', t.tsArrayType(t.tsStringKeyword())), 'Database roles to grant privileges to. Forwarded to secure_table_provision as-is. Defaults to ["authenticated"].'),
359
+ addJSDoc(optionalProp('policies', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintPolicy')))), 'RLS policies for the entity table. When present, these policies fully replace the five default entity-table policies (is_visible becomes a no-op).'),
360
+ ]), 'Override object for the entity table created by a BlueprintMembershipType. Shape mirrors BlueprintTable / secure_table_provision vocabulary. When supplied, policies[] replaces the default entity-table policies entirely.');
361
+ }
352
362
  function buildBlueprintMembershipType() {
353
363
  return addJSDoc(exportInterface('BlueprintMembershipType', [
354
364
  addJSDoc(requiredProp('name', t.tsStringKeyword()), 'Entity type name (e.g., "data_room", "channel", "department"). Must be unique per database.'),
@@ -356,11 +366,12 @@ function buildBlueprintMembershipType() {
356
366
  addJSDoc(optionalProp('description', t.tsStringKeyword()), 'Human-readable description of this entity type.'),
357
367
  addJSDoc(optionalProp('parent_entity', t.tsStringKeyword()), 'Parent entity type name. Defaults to "org".'),
358
368
  addJSDoc(optionalProp('table_name', t.tsStringKeyword()), 'Custom table name for the entity table. Defaults to name-derived convention.'),
359
- addJSDoc(optionalProp('is_visible', t.tsBooleanKeyword()), 'Whether this entity type is visible in the API. Defaults to true.'),
369
+ addJSDoc(optionalProp('is_visible', t.tsBooleanKeyword()), 'Whether parent-entity members can see child entities via the default parent_member SELECT policy. Gates one of the five default policies. No-op when table_provision is supplied. Defaults to true.'),
360
370
  addJSDoc(optionalProp('has_limits', t.tsBooleanKeyword()), 'Whether to provision a limits module for this entity type. Defaults to false.'),
361
371
  addJSDoc(optionalProp('has_profiles', t.tsBooleanKeyword()), 'Whether to provision a profiles module for this entity type. Defaults to false.'),
362
372
  addJSDoc(optionalProp('has_levels', t.tsBooleanKeyword()), 'Whether to provision a levels module for this entity type. Defaults to false.'),
363
- addJSDoc(optionalProp('skip_entity_policies', t.tsBooleanKeyword()), 'Whether to skip creating default RLS policies on the entity table. Defaults to false.'),
373
+ 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.'),
374
+ 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).'),
364
375
  ]), 'A membership type entry for Phase 0 of construct_blueprint(). Provisions a full entity type with its own entity table, membership modules, and security policies via entity_type_provision.');
365
376
  }
366
377
  function buildBlueprintTable() {
@@ -439,6 +450,7 @@ function buildProgram(meta) {
439
450
  statements.push(buildBlueprintTableIndex());
440
451
  statements.push(buildBlueprintUniqueConstraint());
441
452
  statements.push(buildBlueprintTableUniqueConstraint());
453
+ statements.push(buildBlueprintEntityTableProvision());
442
454
  statements.push(buildBlueprintMembershipType());
443
455
  // -- Node types discriminated union --
444
456
  statements.push(sectionComment('Node types -- discriminated union for nodes[] entries'));
@@ -2,3 +2,4 @@ export { RelationBelongsTo } from './relation-belongs-to';
2
2
  export { RelationHasOne } from './relation-has-one';
3
3
  export { RelationHasMany } from './relation-has-many';
4
4
  export { RelationManyToMany } from './relation-many-to-many';
5
+ export { RelationSpatial } from './relation-spatial';
@@ -2,3 +2,4 @@ export { RelationBelongsTo } from './relation-belongs-to';
2
2
  export { RelationHasOne } from './relation-has-one';
3
3
  export { RelationHasMany } from './relation-has-many';
4
4
  export { RelationManyToMany } from './relation-many-to-many';
5
+ export { RelationSpatial } from './relation-spatial';
@@ -0,0 +1,2 @@
1
+ import type { NodeTypeDefinition } from '../types';
2
+ export declare const RelationSpatial: NodeTypeDefinition;
@@ -0,0 +1,68 @@
1
+ export const RelationSpatial = {
2
+ "name": "RelationSpatial",
3
+ "slug": "relation_spatial",
4
+ "category": "relation",
5
+ "display_name": "Spatial Relation",
6
+ "description": "Declares a spatial predicate between two existing geometry/geography columns. Inserts a metaschema_public.spatial_relation row; the sync_spatial_relation_tags trigger then projects a @spatialRelation smart tag onto the owner column so graphile-postgis' PostgisSpatialRelationsPlugin can expose it as a cross-table filter in GraphQL. Metadata-only: both source_field and target_field must already exist on their tables. Idempotent on (source_table_id, name). One direction per tag — author two RelationSpatial entries if symmetry is desired.",
7
+ "parameter_schema": {
8
+ "type": "object",
9
+ "properties": {
10
+ "source_table_id": {
11
+ "type": "string",
12
+ "format": "uuid",
13
+ "description": "Table that owns the relation (the @spatialRelation tag is emitted on the owner column of this table)"
14
+ },
15
+ "source_field_id": {
16
+ "type": "string",
17
+ "format": "uuid",
18
+ "description": "Geometry/geography column on source_table that carries the @spatialRelation smart tag"
19
+ },
20
+ "target_table_id": {
21
+ "type": "string",
22
+ "format": "uuid",
23
+ "description": "Table being referenced by the spatial predicate"
24
+ },
25
+ "target_field_id": {
26
+ "type": "string",
27
+ "format": "uuid",
28
+ "description": "Geometry/geography column on target_table that the predicate is evaluated against"
29
+ },
30
+ "name": {
31
+ "type": "string",
32
+ "description": "Relation name (stable, snake_case). Becomes the generated filter field name in GraphQL (e.g. nearby_clinic). Unique per (source_table_id, name) — idempotency key."
33
+ },
34
+ "operator": {
35
+ "type": "string",
36
+ "enum": [
37
+ "st_contains",
38
+ "st_within",
39
+ "st_intersects",
40
+ "st_covers",
41
+ "st_coveredby",
42
+ "st_overlaps",
43
+ "st_touches",
44
+ "st_dwithin"
45
+ ],
46
+ "description": "PostGIS spatial predicate. One of the 8 whitelisted operators. st_dwithin requires param_name."
47
+ },
48
+ "param_name": {
49
+ "type": "string",
50
+ "description": "Parameter name for parametric operators (currently only st_dwithin, which needs a distance argument). Must be NULL for all other operators. Enforced by table CHECK."
51
+ }
52
+ },
53
+ "required": [
54
+ "source_table_id",
55
+ "source_field_id",
56
+ "target_table_id",
57
+ "target_field_id",
58
+ "name",
59
+ "operator"
60
+ ]
61
+ },
62
+ "tags": [
63
+ "relation",
64
+ "spatial",
65
+ "postgis",
66
+ "schema"
67
+ ]
68
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-type-registry",
3
- "version": "0.12.0",
3
+ "version": "0.14.0",
4
4
  "description": "Node type definitions for the Constructive blueprint system. Single source of truth for all Authz*, Data*, Relation*, and View* node types.",
5
5
  "author": "Constructive <developers@constructive.io>",
6
6
  "main": "index.js",
@@ -47,5 +47,5 @@
47
47
  "registry",
48
48
  "graphile"
49
49
  ],
50
- "gitHead": "0e97757923bc862adb144cfe8a34ec7ecf7aec8a"
50
+ "gitHead": "1b3af3c5189b9ca2e765b9239a4b287099e64a03"
51
51
  }
@@ -2,3 +2,4 @@ export { RelationBelongsTo } from './relation-belongs-to';
2
2
  export { RelationHasOne } from './relation-has-one';
3
3
  export { RelationHasMany } from './relation-has-many';
4
4
  export { RelationManyToMany } from './relation-many-to-many';
5
+ export { RelationSpatial } from './relation-spatial';
package/relation/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RelationManyToMany = exports.RelationHasMany = exports.RelationHasOne = exports.RelationBelongsTo = void 0;
3
+ exports.RelationSpatial = exports.RelationManyToMany = exports.RelationHasMany = exports.RelationHasOne = exports.RelationBelongsTo = void 0;
4
4
  var relation_belongs_to_1 = require("./relation-belongs-to");
5
5
  Object.defineProperty(exports, "RelationBelongsTo", { enumerable: true, get: function () { return relation_belongs_to_1.RelationBelongsTo; } });
6
6
  var relation_has_one_1 = require("./relation-has-one");
@@ -9,3 +9,5 @@ var relation_has_many_1 = require("./relation-has-many");
9
9
  Object.defineProperty(exports, "RelationHasMany", { enumerable: true, get: function () { return relation_has_many_1.RelationHasMany; } });
10
10
  var relation_many_to_many_1 = require("./relation-many-to-many");
11
11
  Object.defineProperty(exports, "RelationManyToMany", { enumerable: true, get: function () { return relation_many_to_many_1.RelationManyToMany; } });
12
+ var relation_spatial_1 = require("./relation-spatial");
13
+ Object.defineProperty(exports, "RelationSpatial", { enumerable: true, get: function () { return relation_spatial_1.RelationSpatial; } });
@@ -0,0 +1,2 @@
1
+ import type { NodeTypeDefinition } from '../types';
2
+ export declare const RelationSpatial: NodeTypeDefinition;
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RelationSpatial = void 0;
4
+ exports.RelationSpatial = {
5
+ "name": "RelationSpatial",
6
+ "slug": "relation_spatial",
7
+ "category": "relation",
8
+ "display_name": "Spatial Relation",
9
+ "description": "Declares a spatial predicate between two existing geometry/geography columns. Inserts a metaschema_public.spatial_relation row; the sync_spatial_relation_tags trigger then projects a @spatialRelation smart tag onto the owner column so graphile-postgis' PostgisSpatialRelationsPlugin can expose it as a cross-table filter in GraphQL. Metadata-only: both source_field and target_field must already exist on their tables. Idempotent on (source_table_id, name). One direction per tag — author two RelationSpatial entries if symmetry is desired.",
10
+ "parameter_schema": {
11
+ "type": "object",
12
+ "properties": {
13
+ "source_table_id": {
14
+ "type": "string",
15
+ "format": "uuid",
16
+ "description": "Table that owns the relation (the @spatialRelation tag is emitted on the owner column of this table)"
17
+ },
18
+ "source_field_id": {
19
+ "type": "string",
20
+ "format": "uuid",
21
+ "description": "Geometry/geography column on source_table that carries the @spatialRelation smart tag"
22
+ },
23
+ "target_table_id": {
24
+ "type": "string",
25
+ "format": "uuid",
26
+ "description": "Table being referenced by the spatial predicate"
27
+ },
28
+ "target_field_id": {
29
+ "type": "string",
30
+ "format": "uuid",
31
+ "description": "Geometry/geography column on target_table that the predicate is evaluated against"
32
+ },
33
+ "name": {
34
+ "type": "string",
35
+ "description": "Relation name (stable, snake_case). Becomes the generated filter field name in GraphQL (e.g. nearby_clinic). Unique per (source_table_id, name) — idempotency key."
36
+ },
37
+ "operator": {
38
+ "type": "string",
39
+ "enum": [
40
+ "st_contains",
41
+ "st_within",
42
+ "st_intersects",
43
+ "st_covers",
44
+ "st_coveredby",
45
+ "st_overlaps",
46
+ "st_touches",
47
+ "st_dwithin"
48
+ ],
49
+ "description": "PostGIS spatial predicate. One of the 8 whitelisted operators. st_dwithin requires param_name."
50
+ },
51
+ "param_name": {
52
+ "type": "string",
53
+ "description": "Parameter name for parametric operators (currently only st_dwithin, which needs a distance argument). Must be NULL for all other operators. Enforced by table CHECK."
54
+ }
55
+ },
56
+ "required": [
57
+ "source_table_id",
58
+ "source_field_id",
59
+ "target_table_id",
60
+ "target_field_id",
61
+ "name",
62
+ "operator"
63
+ ]
64
+ },
65
+ "tags": [
66
+ "relation",
67
+ "spatial",
68
+ "postgis",
69
+ "schema"
70
+ ]
71
+ };