node-type-registry 0.18.1 → 0.20.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 (151) hide show
  1. package/authz/authz-allow-all.js +10 -10
  2. package/authz/authz-composite.js +28 -28
  3. package/authz/authz-deny-all.js +10 -10
  4. package/authz/authz-direct-owner-any.js +19 -18
  5. package/authz/authz-direct-owner.js +17 -16
  6. package/authz/authz-entity-membership.js +39 -38
  7. package/authz/authz-member-list.js +17 -16
  8. package/authz/authz-membership-check.js +34 -34
  9. package/authz/authz-not-read-only.js +23 -22
  10. package/authz/authz-org-hierarchy.js +33 -31
  11. package/authz/authz-peer-ownership.js +40 -39
  12. package/authz/authz-publishable.js +26 -24
  13. package/authz/authz-related-entity-membership.js +57 -55
  14. package/authz/authz-related-member-list.js +35 -32
  15. package/authz/authz-related-peer-ownership.js +62 -59
  16. package/authz/authz-temporal.js +32 -30
  17. package/authz/index.d.ts +9 -9
  18. package/authz/index.js +19 -19
  19. package/blueprint-types.generated.d.ts +10 -17
  20. package/blueprint-types.generated.js +1 -1
  21. package/codegen/generate-types.js +10 -21
  22. package/data/data-composite-field.js +27 -25
  23. package/data/data-direct-owner.js +24 -23
  24. package/data/data-entity-membership.js +24 -23
  25. package/data/data-force-current-user.js +17 -16
  26. package/data/data-id.js +16 -15
  27. package/data/data-immutable-fields.js +20 -19
  28. package/data/data-inflection.js +33 -32
  29. package/data/data-inherit-from-parent.js +31 -29
  30. package/data/data-job-trigger.js +87 -84
  31. package/data/data-jsonb.js +27 -26
  32. package/data/data-owned-fields.js +25 -23
  33. package/data/data-ownership-in-entity.js +21 -21
  34. package/data/data-peoplestamps.js +19 -19
  35. package/data/data-publishable.js +16 -16
  36. package/data/data-slug.js +21 -19
  37. package/data/data-soft-delete.js +14 -14
  38. package/data/data-status-field.js +32 -31
  39. package/data/data-tags.js +23 -22
  40. package/data/data-timestamps.js +15 -15
  41. package/data/index.d.ts +17 -17
  42. package/data/index.js +35 -35
  43. package/data/search-bm25.js +34 -33
  44. package/data/search-full-text.js +49 -47
  45. package/data/search-spatial-aggregate.js +77 -74
  46. package/data/search-spatial.js +51 -50
  47. package/data/search-trgm.js +20 -19
  48. package/data/search-unified.js +170 -162
  49. package/data/search-vector.js +104 -101
  50. package/data/table-organization-settings.js +13 -13
  51. package/data/table-user-profiles.js +13 -13
  52. package/data/table-user-settings.js +13 -13
  53. package/esm/authz/authz-allow-all.js +10 -10
  54. package/esm/authz/authz-composite.js +28 -28
  55. package/esm/authz/authz-deny-all.js +10 -10
  56. package/esm/authz/authz-direct-owner-any.js +19 -18
  57. package/esm/authz/authz-direct-owner.js +17 -16
  58. package/esm/authz/authz-entity-membership.js +39 -38
  59. package/esm/authz/authz-member-list.js +17 -16
  60. package/esm/authz/authz-membership-check.js +34 -34
  61. package/esm/authz/authz-not-read-only.js +23 -22
  62. package/esm/authz/authz-org-hierarchy.js +33 -31
  63. package/esm/authz/authz-peer-ownership.js +40 -39
  64. package/esm/authz/authz-publishable.js +26 -24
  65. package/esm/authz/authz-related-entity-membership.js +57 -55
  66. package/esm/authz/authz-related-member-list.js +35 -32
  67. package/esm/authz/authz-related-peer-ownership.js +62 -59
  68. package/esm/authz/authz-temporal.js +32 -30
  69. package/esm/authz/index.d.ts +9 -9
  70. package/esm/authz/index.js +9 -9
  71. package/esm/blueprint-types.generated.d.ts +10 -17
  72. package/esm/blueprint-types.generated.js +1 -1
  73. package/esm/codegen/generate-types.js +10 -21
  74. package/esm/data/data-composite-field.js +27 -25
  75. package/esm/data/data-direct-owner.js +24 -23
  76. package/esm/data/data-entity-membership.js +24 -23
  77. package/esm/data/data-force-current-user.js +17 -16
  78. package/esm/data/data-id.js +16 -15
  79. package/esm/data/data-immutable-fields.js +20 -19
  80. package/esm/data/data-inflection.js +33 -32
  81. package/esm/data/data-inherit-from-parent.js +31 -29
  82. package/esm/data/data-job-trigger.js +87 -84
  83. package/esm/data/data-jsonb.js +27 -26
  84. package/esm/data/data-owned-fields.js +25 -23
  85. package/esm/data/data-ownership-in-entity.js +21 -21
  86. package/esm/data/data-peoplestamps.js +19 -19
  87. package/esm/data/data-publishable.js +16 -16
  88. package/esm/data/data-slug.js +21 -19
  89. package/esm/data/data-soft-delete.js +14 -14
  90. package/esm/data/data-status-field.js +32 -31
  91. package/esm/data/data-tags.js +23 -22
  92. package/esm/data/data-timestamps.js +15 -15
  93. package/esm/data/index.d.ts +17 -17
  94. package/esm/data/index.js +17 -17
  95. package/esm/data/search-bm25.js +34 -33
  96. package/esm/data/search-full-text.js +49 -47
  97. package/esm/data/search-spatial-aggregate.js +77 -74
  98. package/esm/data/search-spatial.js +51 -50
  99. package/esm/data/search-trgm.js +20 -19
  100. package/esm/data/search-unified.js +170 -162
  101. package/esm/data/search-vector.js +104 -101
  102. package/esm/data/table-organization-settings.js +13 -13
  103. package/esm/data/table-user-profiles.js +13 -13
  104. package/esm/data/table-user-settings.js +13 -13
  105. package/esm/index.d.ts +3 -3
  106. package/esm/index.js +3 -3
  107. package/esm/module-presets/auth-email-magic.js +2 -2
  108. package/esm/module-presets/auth-email.js +8 -8
  109. package/esm/module-presets/auth-passkey.js +4 -4
  110. package/esm/module-presets/auth-sso.js +7 -7
  111. package/esm/module-presets/full.js +1 -1
  112. package/esm/module-presets/index.d.ts +5 -5
  113. package/esm/module-presets/index.js +4 -4
  114. package/esm/relation/index.d.ts +1 -1
  115. package/esm/relation/index.js +1 -1
  116. package/esm/relation/relation-belongs-to.js +41 -40
  117. package/esm/relation/relation-has-many.js +42 -41
  118. package/esm/relation/relation-has-one.js +42 -41
  119. package/esm/relation/relation-many-to-many.js +70 -68
  120. package/esm/relation/relation-spatial.js +54 -54
  121. package/esm/view/index.d.ts +3 -3
  122. package/esm/view/index.js +3 -3
  123. package/esm/view/view-aggregated.js +50 -48
  124. package/esm/view/view-composite.js +18 -18
  125. package/esm/view/view-filtered-table.js +37 -36
  126. package/esm/view/view-joined-tables.js +65 -61
  127. package/esm/view/view-table-projection.js +29 -28
  128. package/index.d.ts +3 -3
  129. package/index.js +3 -3
  130. package/module-presets/auth-email-magic.js +2 -2
  131. package/module-presets/auth-email.js +8 -8
  132. package/module-presets/auth-passkey.js +4 -4
  133. package/module-presets/auth-sso.js +7 -7
  134. package/module-presets/full.js +1 -1
  135. package/module-presets/index.d.ts +5 -5
  136. package/module-presets/index.js +7 -7
  137. package/package.json +2 -2
  138. package/relation/index.d.ts +1 -1
  139. package/relation/index.js +3 -3
  140. package/relation/relation-belongs-to.js +41 -40
  141. package/relation/relation-has-many.js +42 -41
  142. package/relation/relation-has-one.js +42 -41
  143. package/relation/relation-many-to-many.js +70 -68
  144. package/relation/relation-spatial.js +54 -54
  145. package/view/index.d.ts +3 -3
  146. package/view/index.js +7 -7
  147. package/view/view-aggregated.js +50 -48
  148. package/view/view-composite.js +18 -18
  149. package/view/view-filtered-table.js +37 -36
  150. package/view/view-joined-tables.js +65 -61
  151. package/view/view-table-projection.js +29 -28
@@ -1,46 +1,48 @@
1
1
  export const AuthzTemporal = {
2
- "name": "AuthzTemporal",
3
- "slug": "authz_temporal",
4
- "category": "authz",
5
- "display_name": "Temporal Access",
6
- "description": "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.",
7
- "parameter_schema": {
8
- "type": "object",
9
- "properties": {
10
- "valid_from_field": {
11
- "type": "string",
12
- "description": "Column for start time (at least one of valid_from_field or valid_until_field required)"
2
+ name: 'AuthzTemporal',
3
+ slug: 'authz_temporal',
4
+ category: 'authz',
5
+ display_name: 'Temporal Access',
6
+ description: '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.',
7
+ parameter_schema: {
8
+ type: 'object',
9
+ properties: {
10
+ valid_from_field: {
11
+ type: 'string',
12
+ format: 'column-ref',
13
+ description: 'Column for start time (at least one of valid_from_field or valid_until_field required)'
13
14
  },
14
- "valid_until_field": {
15
- "type": "string",
16
- "description": "Column for end time (at least one of valid_from_field or valid_until_field required)"
15
+ valid_until_field: {
16
+ type: 'string',
17
+ format: 'column-ref',
18
+ description: 'Column for end time (at least one of valid_from_field or valid_until_field required)'
17
19
  },
18
- "valid_from_inclusive": {
19
- "type": "boolean",
20
- "description": "Include start boundary",
21
- "default": true
20
+ valid_from_inclusive: {
21
+ type: 'boolean',
22
+ description: 'Include start boundary',
23
+ default: true
22
24
  },
23
- "valid_until_inclusive": {
24
- "type": "boolean",
25
- "description": "Include end boundary",
26
- "default": false
25
+ valid_until_inclusive: {
26
+ type: 'boolean',
27
+ description: 'Include end boundary',
28
+ default: false
27
29
  }
28
30
  },
29
- "anyOf": [
31
+ anyOf: [
30
32
  {
31
- "required": [
32
- "valid_from_field"
33
+ required: [
34
+ 'valid_from_field'
33
35
  ]
34
36
  },
35
37
  {
36
- "required": [
37
- "valid_until_field"
38
+ required: [
39
+ 'valid_until_field'
38
40
  ]
39
41
  }
40
42
  ]
41
43
  },
42
- "tags": [
43
- "temporal",
44
- "authz"
44
+ tags: [
45
+ 'temporal',
46
+ 'authz'
45
47
  ]
46
48
  };
@@ -1,16 +1,16 @@
1
+ export { AuthzAllowAll } from './authz-allow-all';
2
+ export { AuthzComposite } from './authz-composite';
3
+ export { AuthzDenyAll } from './authz-deny-all';
1
4
  export { AuthzDirectOwner } from './authz-direct-owner';
2
5
  export { AuthzDirectOwnerAny } from './authz-direct-owner-any';
3
- export { AuthzMembership } from './authz-membership-check';
4
6
  export { AuthzEntityMembership } from './authz-entity-membership';
5
- export { AuthzRelatedEntityMembership } from './authz-related-entity-membership';
6
- export { AuthzOrgHierarchy } from './authz-org-hierarchy';
7
- export { AuthzTemporal } from './authz-temporal';
8
- export { AuthzPublishable } from './authz-publishable';
9
7
  export { AuthzMemberList } from './authz-member-list';
10
- export { AuthzRelatedMemberList } from './authz-related-member-list';
11
- export { AuthzAllowAll } from './authz-allow-all';
12
- export { AuthzDenyAll } from './authz-deny-all';
13
- export { AuthzComposite } from './authz-composite';
8
+ export { AuthzMembership } from './authz-membership-check';
14
9
  export { AuthzNotReadOnly } from './authz-not-read-only';
10
+ export { AuthzOrgHierarchy } from './authz-org-hierarchy';
15
11
  export { AuthzPeerOwnership } from './authz-peer-ownership';
12
+ export { AuthzPublishable } from './authz-publishable';
13
+ export { AuthzRelatedEntityMembership } from './authz-related-entity-membership';
14
+ export { AuthzRelatedMemberList } from './authz-related-member-list';
16
15
  export { AuthzRelatedPeerOwnership } from './authz-related-peer-ownership';
16
+ export { AuthzTemporal } from './authz-temporal';
@@ -1,16 +1,16 @@
1
+ export { AuthzAllowAll } from './authz-allow-all';
2
+ export { AuthzComposite } from './authz-composite';
3
+ export { AuthzDenyAll } from './authz-deny-all';
1
4
  export { AuthzDirectOwner } from './authz-direct-owner';
2
5
  export { AuthzDirectOwnerAny } from './authz-direct-owner-any';
3
- export { AuthzMembership } from './authz-membership-check';
4
6
  export { AuthzEntityMembership } from './authz-entity-membership';
5
- export { AuthzRelatedEntityMembership } from './authz-related-entity-membership';
6
- export { AuthzOrgHierarchy } from './authz-org-hierarchy';
7
- export { AuthzTemporal } from './authz-temporal';
8
- export { AuthzPublishable } from './authz-publishable';
9
7
  export { AuthzMemberList } from './authz-member-list';
10
- export { AuthzRelatedMemberList } from './authz-related-member-list';
11
- export { AuthzAllowAll } from './authz-allow-all';
12
- export { AuthzDenyAll } from './authz-deny-all';
13
- export { AuthzComposite } from './authz-composite';
8
+ export { AuthzMembership } from './authz-membership-check';
14
9
  export { AuthzNotReadOnly } from './authz-not-read-only';
10
+ export { AuthzOrgHierarchy } from './authz-org-hierarchy';
15
11
  export { AuthzPeerOwnership } from './authz-peer-ownership';
12
+ export { AuthzPublishable } from './authz-publishable';
13
+ export { AuthzRelatedEntityMembership } from './authz-related-entity-membership';
14
+ export { AuthzRelatedMemberList } from './authz-related-member-list';
16
15
  export { AuthzRelatedPeerOwnership } from './authz-related-peer-ownership';
16
+ export { AuthzTemporal } from './authz-temporal';
@@ -574,19 +574,6 @@ export interface BlueprintTableUniqueConstraint {
574
574
  /** Optional schema name override. */
575
575
  schema_name?: string;
576
576
  }
577
- /** A storage-specific RLS policy object for apply_storage_security(). Each entry defines an Authz* policy with explicit privileges, scoped to specific storage tables. */
578
- export interface BlueprintStoragePolicy {
579
- /** Authz* policy generator type (e.g., "AuthzPublishable", "AuthzDirectOwner", "AuthzEntityMembership"). */
580
- $type: string;
581
- /** Privilege array (e.g., ["select", "insert", "update", "delete"]). Intersected with each storage table's supported operations. */
582
- privileges: string[];
583
- /** Policy data config. Auto-derived from $type when omitted (e.g., AuthzPublishable defaults to {"is_published_field": "is_public", "require_published_at": false}). */
584
- data?: Record<string, unknown>;
585
- /** Which storage tables to apply this policy to. Defaults to all three when omitted. Uses logical names (not prefixed). */
586
- tables?: ('buckets' | 'files' | 'upload_requests')[];
587
- /** Custom RLS policy name suffix. Auto-derived from $type when omitted (pub/own/mem). */
588
- policy_name?: string;
589
- }
590
577
  /** A bucket seed entry for storage_config.buckets[]. Creates an initial bucket row in the {prefix}_buckets table during entity type provisioning. Only used for app-level storage (not entity-scoped). */
591
578
  export interface BlueprintBucketSeed {
592
579
  /** Bucket key name (e.g., "avatars", "documents"). Becomes the key column value. */
@@ -602,10 +589,8 @@ export interface BlueprintBucketSeed {
602
589
  /** CORS allowed origins for this bucket. */
603
590
  allowed_origins?: string[];
604
591
  }
605
- /** Storage configuration for an entity type. Controls RLS policies on storage tables, seeds initial buckets, and overrides module-level settings (expiry times, file size limits, CORS). */
592
+ /** 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. */
606
593
  export interface BlueprintStorageConfig {
607
- /** Custom RLS policies for storage tables. When provided, replaces the default policy set (AuthzPublishable + membership + AuthzDirectOwner). Each entry is a policy object with $type, privileges, and optional data/tables/policy_name. */
608
- policies?: BlueprintStoragePolicy[];
609
594
  /** Initial bucket seed entries. Each creates a row in {prefix}_buckets during provisioning. Only used for app-level storage (not entity-scoped). */
610
595
  buckets?: BlueprintBucketSeed[];
611
596
  /** Override for presigned upload URL expiry time in seconds. */
@@ -616,6 +601,12 @@ export interface BlueprintStorageConfig {
616
601
  default_max_file_size?: number;
617
602
  /** CORS allowed origins for the storage module. */
618
603
  allowed_origins?: string[];
604
+ /** Per-table overrides for storage tables. Each key targets a specific storage table (files, buckets, upload_requests) 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. */
605
+ provisions?: {
606
+ files?: BlueprintEntityTableProvision;
607
+ buckets?: BlueprintEntityTableProvision;
608
+ upload_requests?: BlueprintEntityTableProvision;
609
+ };
619
610
  }
620
611
  /** 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. */
621
612
  export interface BlueprintEntityTableProvision {
@@ -655,6 +646,8 @@ export interface BlueprintEntityType {
655
646
  has_levels?: boolean;
656
647
  /** Whether to provision a storage module (buckets, files, upload_requests tables) for this entity type. Defaults to false. */
657
648
  has_storage?: boolean;
649
+ /** Whether to provision entity-scoped invite tables ({prefix}_invites, {prefix}_claimed_invites) and a submit_{prefix}_invite_code() function. Defaults to false. */
650
+ has_invites?: boolean;
658
651
  /** Escape hatch: when true AND table_provision is NULL, zero policies are provisioned on the entity table. Defaults to false. */
659
652
  skip_entity_policies?: boolean;
660
653
  /** 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). */
@@ -877,6 +870,6 @@ export interface BlueprintDefinition {
877
870
  unique_constraints?: BlueprintUniqueConstraint[];
878
871
  /** Entity types to provision in Phase 0 (before tables). Each entry creates an entity table with membership modules and security. */
879
872
  entity_types?: BlueprintEntityType[];
880
- /** App-level storage configuration. Creates a storage_module (membership_type = NULL) with the specified policies, seeds initial buckets, and overrides module-level settings (expiry times, file size limits, CORS). For entity-scoped storage, use entity_types[].has_storage + entity_types[].storage instead. */
873
+ /** 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. */
881
874
  storage?: BlueprintStorageConfig;
882
875
  }
@@ -2,7 +2,7 @@
2
2
  /* eslint-disable @typescript-eslint/no-empty-object-type */
3
3
  //
4
4
  // Regenerate with:
5
- // cd graphql/node-type-registry && pnpm generate:types
5
+ // cd packages/node-type-registry && pnpm generate:types
6
6
  //
7
7
  // These types match the JSONB shape expected by construct_blueprint().
8
8
  // All field names are snake_case to match the SQL convention.
@@ -359,21 +359,6 @@ function buildBlueprintTableUniqueConstraint() {
359
359
  addJSDoc(optionalProp('schema_name', t.tsStringKeyword()), 'Optional schema name override.')
360
360
  ]), 'A unique constraint nested inside a table definition (table_name not required).');
361
361
  }
362
- /**
363
- * Build the BlueprintStoragePolicy interface.
364
- *
365
- * Matches the jsonb policy objects accepted by apply_storage_security():
366
- * { "$type": "AuthzPublishable", "privileges": ["select"], "data": {...}, "tables": [...], "policy_name": "pub" }
367
- */
368
- function buildBlueprintStoragePolicy() {
369
- return addJSDoc(exportInterface('BlueprintStoragePolicy', [
370
- addJSDoc(requiredProp('$type', t.tsStringKeyword()), 'Authz* policy generator type (e.g., "AuthzPublishable", "AuthzDirectOwner", "AuthzEntityMembership").'),
371
- addJSDoc(requiredProp('privileges', t.tsArrayType(t.tsStringKeyword())), 'Privilege array (e.g., ["select", "insert", "update", "delete"]). Intersected with each storage table\'s supported operations.'),
372
- addJSDoc(optionalProp('data', recordType(t.tsStringKeyword(), t.tsUnknownKeyword())), 'Policy data config. Auto-derived from $type when omitted (e.g., AuthzPublishable defaults to {"is_published_field": "is_public", "require_published_at": false}).'),
373
- addJSDoc(optionalProp('tables', t.tsArrayType(strUnion(['buckets', 'files', 'upload_requests']))), 'Which storage tables to apply this policy to. Defaults to all three when omitted. Uses logical names (not prefixed).'),
374
- addJSDoc(optionalProp('policy_name', t.tsStringKeyword()), 'Custom RLS policy name suffix. Auto-derived from $type when omitted (pub/own/mem).')
375
- ]), 'A storage-specific RLS policy object for apply_storage_security(). Each entry defines an Authz* policy with explicit privileges, scoped to specific storage tables.');
376
- }
377
362
  /**
378
363
  * Build the BlueprintBucketSeed interface.
379
364
  *
@@ -396,13 +381,17 @@ function buildBlueprintBucketSeed() {
396
381
  */
397
382
  function buildBlueprintStorageConfig() {
398
383
  return addJSDoc(exportInterface('BlueprintStorageConfig', [
399
- addJSDoc(optionalProp('policies', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintStoragePolicy')))), 'Custom RLS policies for storage tables. When provided, replaces the default policy set (AuthzPublishable + membership + AuthzDirectOwner). Each entry is a policy object with $type, privileges, and optional data/tables/policy_name.'),
400
384
  addJSDoc(optionalProp('buckets', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintBucketSeed')))), 'Initial bucket seed entries. Each creates a row in {prefix}_buckets during provisioning. Only used for app-level storage (not entity-scoped).'),
401
385
  addJSDoc(optionalProp('upload_url_expiry_seconds', t.tsNumberKeyword()), 'Override for presigned upload URL expiry time in seconds.'),
402
386
  addJSDoc(optionalProp('download_url_expiry_seconds', t.tsNumberKeyword()), 'Override for presigned download URL expiry time in seconds.'),
403
387
  addJSDoc(optionalProp('default_max_file_size', t.tsNumberKeyword()), 'Default maximum file size in bytes for the storage module.'),
404
- addJSDoc(optionalProp('allowed_origins', t.tsArrayType(t.tsStringKeyword())), 'CORS allowed origins for the storage module.')
405
- ]), 'Storage configuration for an entity type. Controls RLS policies on storage tables, seeds initial buckets, and overrides module-level settings (expiry times, file size limits, CORS).');
388
+ addJSDoc(optionalProp('allowed_origins', t.tsArrayType(t.tsStringKeyword())), 'CORS allowed origins for the storage module.'),
389
+ addJSDoc(optionalProp('provisions', t.tsTypeLiteral([
390
+ optionalProp('files', t.tsTypeReference(t.identifier('BlueprintEntityTableProvision'))),
391
+ optionalProp('buckets', t.tsTypeReference(t.identifier('BlueprintEntityTableProvision'))),
392
+ optionalProp('upload_requests', t.tsTypeReference(t.identifier('BlueprintEntityTableProvision')))
393
+ ])), 'Per-table overrides for storage tables. Each key targets a specific storage table (files, buckets, upload_requests) 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.')
394
+ ]), '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.');
406
395
  }
407
396
  function buildBlueprintEntityTableProvision() {
408
397
  return addJSDoc(exportInterface('BlueprintEntityTableProvision', [
@@ -428,6 +417,7 @@ function buildBlueprintEntityType() {
428
417
  addJSDoc(optionalProp('has_profiles', t.tsBooleanKeyword()), 'Whether to provision a profiles module for this entity type. Defaults to false.'),
429
418
  addJSDoc(optionalProp('has_levels', t.tsBooleanKeyword()), 'Whether to provision a levels module for this entity type. Defaults to false.'),
430
419
  addJSDoc(optionalProp('has_storage', t.tsBooleanKeyword()), 'Whether to provision a storage module (buckets, files, upload_requests tables) for this entity type. Defaults to false.'),
420
+ 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.'),
431
421
  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.'),
432
422
  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).'),
433
423
  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).')
@@ -458,7 +448,7 @@ function buildBlueprintDefinition() {
458
448
  addJSDoc(optionalProp('full_text_searches', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintFullTextSearch')))), 'Full-text search configurations.'),
459
449
  addJSDoc(optionalProp('unique_constraints', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintUniqueConstraint')))), 'Unique constraints on table columns.'),
460
450
  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.'),
461
- addJSDoc(optionalProp('storage', t.tsTypeReference(t.identifier('BlueprintStorageConfig'))), 'App-level storage configuration. Creates a storage_module (membership_type = NULL) with the specified policies, seeds initial buckets, and overrides module-level settings (expiry times, file size limits, CORS). For entity-scoped storage, use entity_types[].has_storage + entity_types[].storage instead.')
451
+ 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.')
462
452
  ]), 'The complete blueprint definition -- the JSONB shape accepted by construct_blueprint().');
463
453
  }
464
454
  // ---------------------------------------------------------------------------
@@ -512,7 +502,6 @@ function buildProgram(meta) {
512
502
  statements.push(buildBlueprintTableIndex());
513
503
  statements.push(buildBlueprintUniqueConstraint());
514
504
  statements.push(buildBlueprintTableUniqueConstraint());
515
- statements.push(buildBlueprintStoragePolicy());
516
505
  statements.push(buildBlueprintBucketSeed());
517
506
  statements.push(buildBlueprintStorageConfig());
518
507
  statements.push(buildBlueprintEntityTableProvision());
@@ -535,7 +524,7 @@ function buildProgram(meta) {
535
524
  '/* eslint-disable @typescript-eslint/no-empty-object-type */',
536
525
  '//',
537
526
  '// Regenerate with:',
538
- '// cd graphql/node-type-registry && pnpm generate:types',
527
+ '// cd packages/node-type-registry && pnpm generate:types',
539
528
  '//',
540
529
  '// These types match the JSONB shape expected by construct_blueprint().',
541
530
  '// All field names are snake_case to match the SQL convention.',
@@ -1,35 +1,37 @@
1
1
  export const DataCompositeField = {
2
- "name": "DataCompositeField",
3
- "slug": "data_composite_field",
4
- "category": "data",
5
- "display_name": "Composite Field",
6
- "description": "Creates a derived text field that automatically concatenates multiple source fields via BEFORE INSERT/UPDATE triggers. Used to produce a unified text representation (e.g., embedding_text) from multiple columns on a table. The trigger fires with '_000' prefix to run before Search* triggers alphabetically.",
7
- "parameter_schema": {
8
- "type": "object",
9
- "properties": {
10
- "target": {
11
- "type": "string",
12
- "description": "Name of the derived text field to create (default: 'embedding_text')"
2
+ name: 'DataCompositeField',
3
+ slug: 'data_composite_field',
4
+ category: 'data',
5
+ display_name: 'Composite Field',
6
+ description: "Creates a derived text field that automatically concatenates multiple source fields via BEFORE INSERT/UPDATE triggers. Used to produce a unified text representation (e.g., embedding_text) from multiple columns on a table. The trigger fires with '_000' prefix to run before Search* triggers alphabetically.",
7
+ parameter_schema: {
8
+ type: 'object',
9
+ properties: {
10
+ target: {
11
+ type: 'string',
12
+ format: 'column-ref',
13
+ description: "Name of the derived text field to create (default: 'embedding_text')"
13
14
  },
14
- "source_fields": {
15
- "type": "array",
16
- "items": {
17
- "type": "string"
15
+ source_fields: {
16
+ type: 'array',
17
+ items: {
18
+ type: 'string',
19
+ format: 'column-ref'
18
20
  },
19
- "description": "Array of source field names to concatenate into the target field"
21
+ description: 'Array of source field names to concatenate into the target field'
20
22
  },
21
- "format": {
22
- "type": "string",
23
- "enum": ["labeled", "plain"],
24
- "description": "Output format: 'labeled' (field_name: value) or 'plain' (values only). Default: 'labeled'"
23
+ format: {
24
+ type: 'string',
25
+ enum: ['labeled', 'plain'],
26
+ description: "Output format: 'labeled' (field_name: value) or 'plain' (values only). Default: 'labeled'"
25
27
  }
26
28
  },
27
- "required": [
28
- "source_fields"
29
+ required: [
30
+ 'source_fields'
29
31
  ]
30
32
  },
31
- "tags": [
32
- "transform",
33
- "behavior"
33
+ tags: [
34
+ 'transform',
35
+ 'behavior'
34
36
  ]
35
37
  };
@@ -1,31 +1,32 @@
1
1
  export const DataDirectOwner = {
2
- "name": "DataDirectOwner",
3
- "slug": "data_direct_owner",
4
- "category": "data",
5
- "display_name": "Ownership",
6
- "description": "Adds ownership column for direct user ownership. Enables AuthzDirectOwner authorization.",
7
- "parameter_schema": {
8
- "type": "object",
9
- "properties": {
10
- "owner_field_name": {
11
- "type": "string",
12
- "description": "Column name for owner ID",
13
- "default": "owner_id"
2
+ name: 'DataDirectOwner',
3
+ slug: 'data_direct_owner',
4
+ category: 'data',
5
+ display_name: 'Ownership',
6
+ description: 'Adds ownership column for direct user ownership. Enables AuthzDirectOwner authorization.',
7
+ parameter_schema: {
8
+ type: 'object',
9
+ properties: {
10
+ owner_field_name: {
11
+ type: 'string',
12
+ format: 'column-ref',
13
+ description: 'Column name for owner ID',
14
+ default: 'owner_id'
14
15
  },
15
- "include_id": {
16
- "type": "boolean",
17
- "description": "If true, also adds a UUID primary key column with auto-generation",
18
- "default": true
16
+ include_id: {
17
+ type: 'boolean',
18
+ description: 'If true, also adds a UUID primary key column with auto-generation',
19
+ default: true
19
20
  },
20
- "include_user_fk": {
21
- "type": "boolean",
22
- "description": "If true, adds a foreign key constraint from owner_id to the users table",
23
- "default": true
21
+ include_user_fk: {
22
+ type: 'boolean',
23
+ description: 'If true, adds a foreign key constraint from owner_id to the users table',
24
+ default: true
24
25
  }
25
26
  }
26
27
  },
27
- "tags": [
28
- "ownership",
29
- "schema"
28
+ tags: [
29
+ 'ownership',
30
+ 'schema'
30
31
  ]
31
32
  };
@@ -1,31 +1,32 @@
1
1
  export const DataEntityMembership = {
2
- "name": "DataEntityMembership",
3
- "slug": "data_entity_membership",
4
- "category": "data",
5
- "display_name": "Entity Membership",
6
- "description": "Adds entity reference for organization/group scoping. Enables AuthzEntityMembership, AuthzMembership, AuthzOrgHierarchy authorization.",
7
- "parameter_schema": {
8
- "type": "object",
9
- "properties": {
10
- "entity_field_name": {
11
- "type": "string",
12
- "description": "Column name for entity ID",
13
- "default": "entity_id"
2
+ name: 'DataEntityMembership',
3
+ slug: 'data_entity_membership',
4
+ category: 'data',
5
+ display_name: 'Entity Membership',
6
+ description: 'Adds entity reference for organization/group scoping. Enables AuthzEntityMembership, AuthzMembership, AuthzOrgHierarchy authorization.',
7
+ parameter_schema: {
8
+ type: 'object',
9
+ properties: {
10
+ entity_field_name: {
11
+ type: 'string',
12
+ format: 'column-ref',
13
+ description: 'Column name for entity ID',
14
+ default: 'entity_id'
14
15
  },
15
- "include_id": {
16
- "type": "boolean",
17
- "description": "If true, also adds a UUID primary key column with auto-generation",
18
- "default": true
16
+ include_id: {
17
+ type: 'boolean',
18
+ description: 'If true, also adds a UUID primary key column with auto-generation',
19
+ default: true
19
20
  },
20
- "include_user_fk": {
21
- "type": "boolean",
22
- "description": "If true, adds a foreign key constraint from entity_id to the users table",
23
- "default": true
21
+ include_user_fk: {
22
+ type: 'boolean',
23
+ description: 'If true, adds a foreign key constraint from entity_id to the users table',
24
+ default: true
24
25
  }
25
26
  }
26
27
  },
27
- "tags": [
28
- "membership",
29
- "schema"
28
+ tags: [
29
+ 'membership',
30
+ 'schema'
30
31
  ]
31
32
  };
@@ -1,22 +1,23 @@
1
1
  export const DataForceCurrentUser = {
2
- "name": "DataForceCurrentUser",
3
- "slug": "data_force_current_user",
4
- "category": "data",
5
- "display_name": "Force Current User",
6
- "description": "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.",
7
- "parameter_schema": {
8
- "type": "object",
9
- "properties": {
10
- "field_name": {
11
- "type": "string",
12
- "description": "Name of the field to force to current_user_id()",
13
- "default": "actor_id"
2
+ name: 'DataForceCurrentUser',
3
+ slug: 'data_force_current_user',
4
+ category: 'data',
5
+ display_name: 'Force Current User',
6
+ description: '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.',
7
+ parameter_schema: {
8
+ type: 'object',
9
+ properties: {
10
+ field_name: {
11
+ type: 'string',
12
+ format: 'column-ref',
13
+ description: 'Name of the field to force to current_user_id()',
14
+ default: 'actor_id'
14
15
  }
15
16
  }
16
17
  },
17
- "tags": [
18
- "trigger",
19
- "security",
20
- "schema"
18
+ tags: [
19
+ 'trigger',
20
+ 'security',
21
+ 'schema'
21
22
  ]
22
23
  };
@@ -1,21 +1,22 @@
1
1
  export const DataId = {
2
- "name": "DataId",
3
- "slug": "data_id",
4
- "category": "data",
5
- "display_name": "Primary Key ID",
6
- "description": "Adds a UUID primary key column with auto-generation default (uuidv7). This is the standard primary key pattern for all tables.",
7
- "parameter_schema": {
8
- "type": "object",
9
- "properties": {
10
- "field_name": {
11
- "type": "string",
12
- "description": "Column name for the primary key",
13
- "default": "id"
2
+ name: 'DataId',
3
+ slug: 'data_id',
4
+ category: 'data',
5
+ display_name: 'Primary Key ID',
6
+ description: 'Adds a UUID primary key column with auto-generation default (uuidv7). This is the standard primary key pattern for all tables.',
7
+ parameter_schema: {
8
+ type: 'object',
9
+ properties: {
10
+ field_name: {
11
+ type: 'string',
12
+ format: 'column-ref',
13
+ description: 'Column name for the primary key',
14
+ default: 'id'
14
15
  }
15
16
  }
16
17
  },
17
- "tags": [
18
- "primary_key",
19
- "schema"
18
+ tags: [
19
+ 'primary_key',
20
+ 'schema'
20
21
  ]
21
22
  };
@@ -1,27 +1,28 @@
1
1
  export const DataImmutableFields = {
2
- "name": "DataImmutableFields",
3
- "slug": "data_immutable_fields",
4
- "category": "data",
5
- "display_name": "Immutable Fields",
6
- "description": "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.",
7
- "parameter_schema": {
8
- "type": "object",
9
- "properties": {
10
- "fields": {
11
- "type": "array",
12
- "items": {
13
- "type": "string"
2
+ name: 'DataImmutableFields',
3
+ slug: 'data_immutable_fields',
4
+ category: 'data',
5
+ display_name: 'Immutable Fields',
6
+ description: '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.',
7
+ parameter_schema: {
8
+ type: 'object',
9
+ properties: {
10
+ fields: {
11
+ type: 'array',
12
+ items: {
13
+ type: 'string',
14
+ format: 'column-ref'
14
15
  },
15
- "description": "Field names that cannot be modified after INSERT (e.g. [\"key\", \"bucket_id\", \"owner_id\"])"
16
+ description: 'Field names that cannot be modified after INSERT (e.g. ["key", "bucket_id", "owner_id"])'
16
17
  }
17
18
  },
18
- "required": [
19
- "fields"
19
+ required: [
20
+ 'fields'
20
21
  ]
21
22
  },
22
- "tags": [
23
- "trigger",
24
- "constraint",
25
- "schema"
23
+ tags: [
24
+ 'trigger',
25
+ 'constraint',
26
+ 'schema'
26
27
  ]
27
28
  };