node-type-registry 0.17.0 → 0.17.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.
- package/blueprint-types.generated.d.ts +24 -17
- package/codegen/generate-types.js +8 -4
- package/esm/blueprint-types.generated.d.ts +24 -17
- package/esm/codegen/generate-types.js +8 -4
- package/esm/relation/relation-many-to-many.js +20 -33
- package/package.json +2 -2
- package/relation/relation-many-to-many.js +20 -33
|
@@ -391,15 +391,20 @@ export interface RelationManyToManyParams {
|
|
|
391
391
|
nodes?: {
|
|
392
392
|
[key: string]: unknown;
|
|
393
393
|
}[];
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
394
|
+
grants?: {
|
|
395
|
+
roles: string[];
|
|
396
|
+
privileges: string[][];
|
|
397
|
+
}[];
|
|
398
|
+
policies?: {
|
|
399
|
+
$type: string;
|
|
400
|
+
data?: {
|
|
401
|
+
[key: string]: unknown;
|
|
402
|
+
};
|
|
403
|
+
privileges?: string[];
|
|
404
|
+
policy_role?: string;
|
|
405
|
+
permissive?: boolean;
|
|
406
|
+
policy_name?: string;
|
|
407
|
+
}[];
|
|
403
408
|
}
|
|
404
409
|
/** 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
410
|
export interface RelationSpatialParams {
|
|
@@ -577,10 +582,11 @@ export interface BlueprintEntityTableProvision {
|
|
|
577
582
|
nodes?: BlueprintNode[];
|
|
578
583
|
/** Custom fields (columns) to add to the entity table. Forwarded to secure_table_provision as-is. */
|
|
579
584
|
fields?: BlueprintField[];
|
|
580
|
-
/**
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
585
|
+
/** Unified grant objects for the entity table. Each entry is { roles: string[], privileges: unknown[] } where privileges are [verb, columns] tuples. Forwarded to secure_table_provision as-is. Defaults to []. */
|
|
586
|
+
grants?: {
|
|
587
|
+
roles: string[];
|
|
588
|
+
privileges: unknown[];
|
|
589
|
+
}[];
|
|
584
590
|
/** 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
591
|
policies?: BlueprintPolicy[];
|
|
586
592
|
}
|
|
@@ -796,10 +802,11 @@ export interface BlueprintTable {
|
|
|
796
802
|
fields?: BlueprintField[];
|
|
797
803
|
/** RLS policies for this table. */
|
|
798
804
|
policies?: BlueprintPolicy[];
|
|
799
|
-
/**
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
805
|
+
/** Unified grant objects. Each entry is { roles: string[], privileges: unknown[] } where privileges are [verb, columns] tuples (e.g. [["select","*"]]). Enables per-role targeting. Defaults to []. */
|
|
806
|
+
grants?: {
|
|
807
|
+
roles: string[];
|
|
808
|
+
privileges: unknown[];
|
|
809
|
+
}[];
|
|
803
810
|
/** Whether to enable RLS on this table. Defaults to true. */
|
|
804
811
|
use_rls?: boolean;
|
|
805
812
|
/** Table-level indexes (table_name inherited from parent). */
|
|
@@ -399,8 +399,10 @@ function buildBlueprintEntityTableProvision() {
|
|
|
399
399
|
addJSDoc(optionalProp('use_rls', t.tsBooleanKeyword()), 'Whether to enable RLS on the entity table. Forwarded to secure_table_provision. Defaults to true.'),
|
|
400
400
|
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.'),
|
|
401
401
|
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.'),
|
|
402
|
-
addJSDoc(optionalProp('
|
|
403
|
-
|
|
402
|
+
addJSDoc(optionalProp('grants', t.tsArrayType(t.tsTypeLiteral([
|
|
403
|
+
requiredProp('roles', t.tsArrayType(t.tsStringKeyword())),
|
|
404
|
+
requiredProp('privileges', t.tsArrayType(t.tsUnknownKeyword())),
|
|
405
|
+
]))), 'Unified grant objects for the entity table. Each entry is { roles: string[], privileges: unknown[] } where privileges are [verb, columns] tuples. Forwarded to secure_table_provision as-is. Defaults to [].'),
|
|
404
406
|
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).'),
|
|
405
407
|
]), '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.');
|
|
406
408
|
}
|
|
@@ -426,8 +428,10 @@ function buildBlueprintTable() {
|
|
|
426
428
|
addJSDoc(requiredProp('nodes', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintNode')))), "Array of node type entries that define the table's behavior."),
|
|
427
429
|
addJSDoc(optionalProp('fields', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintField')))), 'Custom fields (columns) to add to the table.'),
|
|
428
430
|
addJSDoc(optionalProp('policies', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintPolicy')))), 'RLS policies for this table.'),
|
|
429
|
-
addJSDoc(optionalProp('
|
|
430
|
-
|
|
431
|
+
addJSDoc(optionalProp('grants', t.tsArrayType(t.tsTypeLiteral([
|
|
432
|
+
requiredProp('roles', t.tsArrayType(t.tsStringKeyword())),
|
|
433
|
+
requiredProp('privileges', t.tsArrayType(t.tsUnknownKeyword())),
|
|
434
|
+
]))), 'Unified grant objects. Each entry is { roles: string[], privileges: unknown[] } where privileges are [verb, columns] tuples (e.g. [["select","*"]]). Enables per-role targeting. Defaults to [].'),
|
|
431
435
|
addJSDoc(optionalProp('use_rls', t.tsBooleanKeyword()), 'Whether to enable RLS on this table. Defaults to true.'),
|
|
432
436
|
addJSDoc(optionalProp('indexes', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintTableIndex')))), 'Table-level indexes (table_name inherited from parent).'),
|
|
433
437
|
addJSDoc(optionalProp('full_text_searches', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintTableFullTextSearch')))), 'Table-level full-text search configurations (table_name inherited from parent).'),
|
|
@@ -391,15 +391,20 @@ export interface RelationManyToManyParams {
|
|
|
391
391
|
nodes?: {
|
|
392
392
|
[key: string]: unknown;
|
|
393
393
|
}[];
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
394
|
+
grants?: {
|
|
395
|
+
roles: string[];
|
|
396
|
+
privileges: string[][];
|
|
397
|
+
}[];
|
|
398
|
+
policies?: {
|
|
399
|
+
$type: string;
|
|
400
|
+
data?: {
|
|
401
|
+
[key: string]: unknown;
|
|
402
|
+
};
|
|
403
|
+
privileges?: string[];
|
|
404
|
+
policy_role?: string;
|
|
405
|
+
permissive?: boolean;
|
|
406
|
+
policy_name?: string;
|
|
407
|
+
}[];
|
|
403
408
|
}
|
|
404
409
|
/** 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
410
|
export interface RelationSpatialParams {
|
|
@@ -577,10 +582,11 @@ export interface BlueprintEntityTableProvision {
|
|
|
577
582
|
nodes?: BlueprintNode[];
|
|
578
583
|
/** Custom fields (columns) to add to the entity table. Forwarded to secure_table_provision as-is. */
|
|
579
584
|
fields?: BlueprintField[];
|
|
580
|
-
/**
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
585
|
+
/** Unified grant objects for the entity table. Each entry is { roles: string[], privileges: unknown[] } where privileges are [verb, columns] tuples. Forwarded to secure_table_provision as-is. Defaults to []. */
|
|
586
|
+
grants?: {
|
|
587
|
+
roles: string[];
|
|
588
|
+
privileges: unknown[];
|
|
589
|
+
}[];
|
|
584
590
|
/** 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
591
|
policies?: BlueprintPolicy[];
|
|
586
592
|
}
|
|
@@ -796,10 +802,11 @@ export interface BlueprintTable {
|
|
|
796
802
|
fields?: BlueprintField[];
|
|
797
803
|
/** RLS policies for this table. */
|
|
798
804
|
policies?: BlueprintPolicy[];
|
|
799
|
-
/**
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
805
|
+
/** Unified grant objects. Each entry is { roles: string[], privileges: unknown[] } where privileges are [verb, columns] tuples (e.g. [["select","*"]]). Enables per-role targeting. Defaults to []. */
|
|
806
|
+
grants?: {
|
|
807
|
+
roles: string[];
|
|
808
|
+
privileges: unknown[];
|
|
809
|
+
}[];
|
|
803
810
|
/** Whether to enable RLS on this table. Defaults to true. */
|
|
804
811
|
use_rls?: boolean;
|
|
805
812
|
/** Table-level indexes (table_name inherited from parent). */
|
|
@@ -364,8 +364,10 @@ function buildBlueprintEntityTableProvision() {
|
|
|
364
364
|
addJSDoc(optionalProp('use_rls', t.tsBooleanKeyword()), 'Whether to enable RLS on the entity table. Forwarded to secure_table_provision. Defaults to true.'),
|
|
365
365
|
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.'),
|
|
366
366
|
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.'),
|
|
367
|
-
addJSDoc(optionalProp('
|
|
368
|
-
|
|
367
|
+
addJSDoc(optionalProp('grants', t.tsArrayType(t.tsTypeLiteral([
|
|
368
|
+
requiredProp('roles', t.tsArrayType(t.tsStringKeyword())),
|
|
369
|
+
requiredProp('privileges', t.tsArrayType(t.tsUnknownKeyword())),
|
|
370
|
+
]))), 'Unified grant objects for the entity table. Each entry is { roles: string[], privileges: unknown[] } where privileges are [verb, columns] tuples. Forwarded to secure_table_provision as-is. Defaults to [].'),
|
|
369
371
|
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).'),
|
|
370
372
|
]), '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.');
|
|
371
373
|
}
|
|
@@ -391,8 +393,10 @@ function buildBlueprintTable() {
|
|
|
391
393
|
addJSDoc(requiredProp('nodes', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintNode')))), "Array of node type entries that define the table's behavior."),
|
|
392
394
|
addJSDoc(optionalProp('fields', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintField')))), 'Custom fields (columns) to add to the table.'),
|
|
393
395
|
addJSDoc(optionalProp('policies', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintPolicy')))), 'RLS policies for this table.'),
|
|
394
|
-
addJSDoc(optionalProp('
|
|
395
|
-
|
|
396
|
+
addJSDoc(optionalProp('grants', t.tsArrayType(t.tsTypeLiteral([
|
|
397
|
+
requiredProp('roles', t.tsArrayType(t.tsStringKeyword())),
|
|
398
|
+
requiredProp('privileges', t.tsArrayType(t.tsUnknownKeyword())),
|
|
399
|
+
]))), 'Unified grant objects. Each entry is { roles: string[], privileges: unknown[] } where privileges are [verb, columns] tuples (e.g. [["select","*"]]). Enables per-role targeting. Defaults to [].'),
|
|
396
400
|
addJSDoc(optionalProp('use_rls', t.tsBooleanKeyword()), 'Whether to enable RLS on this table. Defaults to true.'),
|
|
397
401
|
addJSDoc(optionalProp('indexes', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintTableIndex')))), 'Table-level indexes (table_name inherited from parent).'),
|
|
398
402
|
addJSDoc(optionalProp('full_text_searches', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintTableFullTextSearch')))), 'Table-level full-text search configurations (table_name inherited from parent).'),
|
|
@@ -46,46 +46,33 @@ export const RelationManyToMany = {
|
|
|
46
46
|
},
|
|
47
47
|
"description": "Array of node objects for field creation on junction table. Each object has a $type key (e.g. DataId, DataEntityMembership) and optional data keys. Forwarded to secure_table_provision as-is. Empty array means no additional fields."
|
|
48
48
|
},
|
|
49
|
-
"
|
|
49
|
+
"grants": {
|
|
50
50
|
"type": "array",
|
|
51
51
|
"items": {
|
|
52
|
-
"type": "
|
|
52
|
+
"type": "object",
|
|
53
|
+
"properties": {
|
|
54
|
+
"roles": { "type": "array", "items": { "type": "string" } },
|
|
55
|
+
"privileges": { "type": "array", "items": { "type": "array", "items": { "type": "string" } } }
|
|
56
|
+
},
|
|
57
|
+
"required": ["roles", "privileges"]
|
|
53
58
|
},
|
|
54
|
-
"description": "
|
|
59
|
+
"description": "Unified grant objects for the junction table. Each entry is { roles: string[], privileges: string[][] }. Forwarded to secure_table_provision as-is. Default: []"
|
|
55
60
|
},
|
|
56
|
-
"
|
|
61
|
+
"policies": {
|
|
57
62
|
"type": "array",
|
|
58
63
|
"items": {
|
|
59
|
-
"type": "
|
|
60
|
-
"
|
|
61
|
-
"type": "string"
|
|
62
|
-
|
|
64
|
+
"type": "object",
|
|
65
|
+
"properties": {
|
|
66
|
+
"$type": { "type": "string" },
|
|
67
|
+
"data": { "type": "object" },
|
|
68
|
+
"privileges": { "type": "array", "items": { "type": "string" } },
|
|
69
|
+
"policy_role": { "type": "string" },
|
|
70
|
+
"permissive": { "type": "boolean" },
|
|
71
|
+
"policy_name": { "type": "string" }
|
|
72
|
+
},
|
|
73
|
+
"required": ["$type"]
|
|
63
74
|
},
|
|
64
|
-
"description": "
|
|
65
|
-
},
|
|
66
|
-
"policy_type": {
|
|
67
|
-
"type": "string",
|
|
68
|
-
"description": "RLS policy type for the junction table. Forwarded to secure_table_provision as-is. NULL means no policy."
|
|
69
|
-
},
|
|
70
|
-
"policy_privileges": {
|
|
71
|
-
"type": "array",
|
|
72
|
-
"items": {
|
|
73
|
-
"type": "string"
|
|
74
|
-
},
|
|
75
|
-
"description": "Privileges the policy applies to. Forwarded to secure_table_provision as-is. NULL means derived from grant_privileges verbs."
|
|
76
|
-
},
|
|
77
|
-
"policy_role": {
|
|
78
|
-
"type": "string",
|
|
79
|
-
"description": "Database role the policy targets. Forwarded to secure_table_provision as-is. NULL means falls back to first grant_role."
|
|
80
|
-
},
|
|
81
|
-
"policy_permissive": {
|
|
82
|
-
"type": "boolean",
|
|
83
|
-
"description": "Whether the policy is PERMISSIVE (true) or RESTRICTIVE (false). Forwarded to secure_table_provision as-is.",
|
|
84
|
-
"default": true
|
|
85
|
-
},
|
|
86
|
-
"policy_data": {
|
|
87
|
-
"type": "object",
|
|
88
|
-
"description": "Policy configuration forwarded to secure_table_provision as-is. Structure varies by policy_type."
|
|
75
|
+
"description": "RLS policy objects for the junction table. Each entry has $type (Authz* generator), optional data, privileges, policy_role, permissive, policy_name. Forwarded to secure_table_provision as-is. Default: []"
|
|
89
76
|
}
|
|
90
77
|
},
|
|
91
78
|
"required": [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-type-registry",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.1",
|
|
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": "
|
|
50
|
+
"gitHead": "ad2d49ede1f962293e13d68843831897f267915d"
|
|
51
51
|
}
|
|
@@ -49,46 +49,33 @@ exports.RelationManyToMany = {
|
|
|
49
49
|
},
|
|
50
50
|
"description": "Array of node objects for field creation on junction table. Each object has a $type key (e.g. DataId, DataEntityMembership) and optional data keys. Forwarded to secure_table_provision as-is. Empty array means no additional fields."
|
|
51
51
|
},
|
|
52
|
-
"
|
|
52
|
+
"grants": {
|
|
53
53
|
"type": "array",
|
|
54
54
|
"items": {
|
|
55
|
-
"type": "
|
|
55
|
+
"type": "object",
|
|
56
|
+
"properties": {
|
|
57
|
+
"roles": { "type": "array", "items": { "type": "string" } },
|
|
58
|
+
"privileges": { "type": "array", "items": { "type": "array", "items": { "type": "string" } } }
|
|
59
|
+
},
|
|
60
|
+
"required": ["roles", "privileges"]
|
|
56
61
|
},
|
|
57
|
-
"description": "
|
|
62
|
+
"description": "Unified grant objects for the junction table. Each entry is { roles: string[], privileges: string[][] }. Forwarded to secure_table_provision as-is. Default: []"
|
|
58
63
|
},
|
|
59
|
-
"
|
|
64
|
+
"policies": {
|
|
60
65
|
"type": "array",
|
|
61
66
|
"items": {
|
|
62
|
-
"type": "
|
|
63
|
-
"
|
|
64
|
-
"type": "string"
|
|
65
|
-
|
|
67
|
+
"type": "object",
|
|
68
|
+
"properties": {
|
|
69
|
+
"$type": { "type": "string" },
|
|
70
|
+
"data": { "type": "object" },
|
|
71
|
+
"privileges": { "type": "array", "items": { "type": "string" } },
|
|
72
|
+
"policy_role": { "type": "string" },
|
|
73
|
+
"permissive": { "type": "boolean" },
|
|
74
|
+
"policy_name": { "type": "string" }
|
|
75
|
+
},
|
|
76
|
+
"required": ["$type"]
|
|
66
77
|
},
|
|
67
|
-
"description": "
|
|
68
|
-
},
|
|
69
|
-
"policy_type": {
|
|
70
|
-
"type": "string",
|
|
71
|
-
"description": "RLS policy type for the junction table. Forwarded to secure_table_provision as-is. NULL means no policy."
|
|
72
|
-
},
|
|
73
|
-
"policy_privileges": {
|
|
74
|
-
"type": "array",
|
|
75
|
-
"items": {
|
|
76
|
-
"type": "string"
|
|
77
|
-
},
|
|
78
|
-
"description": "Privileges the policy applies to. Forwarded to secure_table_provision as-is. NULL means derived from grant_privileges verbs."
|
|
79
|
-
},
|
|
80
|
-
"policy_role": {
|
|
81
|
-
"type": "string",
|
|
82
|
-
"description": "Database role the policy targets. Forwarded to secure_table_provision as-is. NULL means falls back to first grant_role."
|
|
83
|
-
},
|
|
84
|
-
"policy_permissive": {
|
|
85
|
-
"type": "boolean",
|
|
86
|
-
"description": "Whether the policy is PERMISSIVE (true) or RESTRICTIVE (false). Forwarded to secure_table_provision as-is.",
|
|
87
|
-
"default": true
|
|
88
|
-
},
|
|
89
|
-
"policy_data": {
|
|
90
|
-
"type": "object",
|
|
91
|
-
"description": "Policy configuration forwarded to secure_table_provision as-is. Structure varies by policy_type."
|
|
78
|
+
"description": "RLS policy objects for the junction table. Each entry has $type (Authz* generator), optional data, privileges, policy_role, permissive, policy_name. Forwarded to secure_table_provision as-is. Default: []"
|
|
92
79
|
}
|
|
93
80
|
},
|
|
94
81
|
"required": [
|