node-type-registry 0.14.0 → 0.16.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.
@@ -781,6 +781,8 @@ export type BlueprintRelation = {
781
781
  target_table: string;
782
782
  source_schema_name?: string;
783
783
  target_schema_name?: string;
784
+ /** Name of the geometry/geography column on source_table that carries the @spatialRelation smart tag. */ source_field: string;
785
+ /** Name of the geometry/geography column on target_table that the predicate is evaluated against. */ target_field: string;
784
786
  } & Partial<RelationSpatialParams>;
785
787
  /** A table definition within a blueprint. */
786
788
  export interface BlueprintTable {
@@ -352,13 +352,23 @@ function buildNodeTypes(dataNodes) {
352
352
  // ---------------------------------------------------------------------------
353
353
  function buildRelationTypes(relationNodes) {
354
354
  const relationMembers = relationNodes.map((nt) => {
355
- const baseType = t.tsTypeLiteral([
355
+ const baseMembers = [
356
356
  requiredProp('$type', strLit(nt.name)),
357
357
  requiredProp('source_table', t.tsStringKeyword()),
358
358
  requiredProp('target_table', t.tsStringKeyword()),
359
359
  optionalProp('source_schema_name', t.tsStringKeyword()),
360
360
  optionalProp('target_schema_name', t.tsStringKeyword()),
361
- ]);
361
+ ];
362
+ // RelationSpatial is the only relation type that references *existing*
363
+ // columns rather than creating FK/junction fields. Its blueprint JSON
364
+ // therefore needs source_field / target_field (column *names* resolved
365
+ // server-side by resolve_blueprint_field), which have no ID-space
366
+ // equivalent in parameter_schema. Surface them here so blueprint authors
367
+ // get autocomplete without a cast.
368
+ if (nt.name === 'RelationSpatial') {
369
+ baseMembers.push(addJSDoc(requiredProp('source_field', t.tsStringKeyword()), 'Name of the geometry/geography column on source_table that carries the @spatialRelation smart tag.'), addJSDoc(requiredProp('target_field', t.tsStringKeyword()), 'Name of the geometry/geography column on target_table that the predicate is evaluated against.'));
370
+ }
371
+ const baseType = t.tsTypeLiteral(baseMembers);
362
372
  return t.tsIntersectionType([
363
373
  baseType,
364
374
  partialOf(t.tsTypeReference(t.identifier(`${nt.name}Params`))),
@@ -781,6 +781,8 @@ export type BlueprintRelation = {
781
781
  target_table: string;
782
782
  source_schema_name?: string;
783
783
  target_schema_name?: string;
784
+ /** Name of the geometry/geography column on source_table that carries the @spatialRelation smart tag. */ source_field: string;
785
+ /** Name of the geometry/geography column on target_table that the predicate is evaluated against. */ target_field: string;
784
786
  } & Partial<RelationSpatialParams>;
785
787
  /** A table definition within a blueprint. */
786
788
  export interface BlueprintTable {
@@ -317,13 +317,23 @@ function buildNodeTypes(dataNodes) {
317
317
  // ---------------------------------------------------------------------------
318
318
  function buildRelationTypes(relationNodes) {
319
319
  const relationMembers = relationNodes.map((nt) => {
320
- const baseType = t.tsTypeLiteral([
320
+ const baseMembers = [
321
321
  requiredProp('$type', strLit(nt.name)),
322
322
  requiredProp('source_table', t.tsStringKeyword()),
323
323
  requiredProp('target_table', t.tsStringKeyword()),
324
324
  optionalProp('source_schema_name', t.tsStringKeyword()),
325
325
  optionalProp('target_schema_name', t.tsStringKeyword()),
326
- ]);
326
+ ];
327
+ // RelationSpatial is the only relation type that references *existing*
328
+ // columns rather than creating FK/junction fields. Its blueprint JSON
329
+ // therefore needs source_field / target_field (column *names* resolved
330
+ // server-side by resolve_blueprint_field), which have no ID-space
331
+ // equivalent in parameter_schema. Surface them here so blueprint authors
332
+ // get autocomplete without a cast.
333
+ if (nt.name === 'RelationSpatial') {
334
+ baseMembers.push(addJSDoc(requiredProp('source_field', t.tsStringKeyword()), 'Name of the geometry/geography column on source_table that carries the @spatialRelation smart tag.'), addJSDoc(requiredProp('target_field', t.tsStringKeyword()), 'Name of the geometry/geography column on target_table that the predicate is evaluated against.'));
335
+ }
336
+ const baseType = t.tsTypeLiteral(baseMembers);
327
337
  return t.tsIntersectionType([
328
338
  baseType,
329
339
  partialOf(t.tsTypeReference(t.identifier(`${nt.name}Params`))),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-type-registry",
3
- "version": "0.14.0",
3
+ "version": "0.16.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": "1b3af3c5189b9ca2e765b9239a4b287099e64a03"
50
+ "gitHead": "5094bbe92916be47234fe80c583c6957f51226e1"
51
51
  }