node-type-registry 0.40.0 → 0.42.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 (39) hide show
  1. package/authz/authz-member-owner.d.ts +2 -0
  2. package/authz/authz-member-owner.js +51 -0
  3. package/authz/index.d.ts +1 -0
  4. package/authz/index.js +3 -1
  5. package/blueprint-types.generated.d.ts +289 -63
  6. package/blueprint-types.generated.js +16 -4
  7. package/codegen/generate-types.js +119 -6
  8. package/data/data-member-owner.d.ts +2 -0
  9. package/data/data-member-owner.js +53 -0
  10. package/data/index.d.ts +1 -0
  11. package/data/index.js +3 -1
  12. package/esm/authz/authz-member-owner.d.ts +2 -0
  13. package/esm/authz/authz-member-owner.js +48 -0
  14. package/esm/authz/index.d.ts +1 -0
  15. package/esm/authz/index.js +1 -0
  16. package/esm/blueprint-types.generated.d.ts +289 -63
  17. package/esm/blueprint-types.generated.js +16 -4
  18. package/esm/codegen/generate-types.js +119 -6
  19. package/esm/data/data-member-owner.d.ts +2 -0
  20. package/esm/data/data-member-owner.js +50 -0
  21. package/esm/data/index.d.ts +1 -0
  22. package/esm/data/index.js +1 -0
  23. package/esm/job/trigger.js +28 -0
  24. package/esm/module-presets/full.d.ts +6 -6
  25. package/esm/module-presets/full.js +71 -16
  26. package/esm/process/chunks.js +16 -0
  27. package/esm/process/extraction.js +16 -0
  28. package/esm/process/file-embedding.js +16 -0
  29. package/esm/process/image-embedding.js +16 -0
  30. package/esm/process/image-versions.js +16 -0
  31. package/job/trigger.js +28 -0
  32. package/module-presets/full.d.ts +6 -6
  33. package/module-presets/full.js +71 -16
  34. package/package.json +4 -4
  35. package/process/chunks.js +16 -0
  36. package/process/extraction.js +16 -0
  37. package/process/file-embedding.js +16 -0
  38. package/process/image-embedding.js +16 -0
  39. package/process/image-versions.js +16 -0
@@ -16,25 +16,37 @@ Object.defineProperty(exports, "__esModule", { value: true });
16
16
  ;
17
17
  /**
18
18
  * ===========================================================================
19
- * Billing node type parameters
19
+ * Check node type parameters
20
20
  * ===========================================================================
21
21
  */
22
22
  ;
23
23
  /**
24
24
  * ===========================================================================
25
- * Check node type parameters
25
+ * Data node type parameters
26
26
  * ===========================================================================
27
27
  */
28
28
  ;
29
29
  /**
30
30
  * ===========================================================================
31
- * Data node type parameters
31
+ * Event node type parameters
32
+ * ===========================================================================
33
+ */
34
+ ;
35
+ /**
36
+ * ===========================================================================
37
+ * Limit_enforce node type parameters
38
+ * ===========================================================================
39
+ */
40
+ ;
41
+ /**
42
+ * ===========================================================================
43
+ * Limit_track node type parameters
32
44
  * ===========================================================================
33
45
  */
34
46
  ;
35
47
  /**
36
48
  * ===========================================================================
37
- * Limit node type parameters
49
+ * Limit_warning node type parameters
38
50
  * ===========================================================================
39
51
  */
40
52
  ;
@@ -496,7 +496,7 @@ function buildBlueprintTableUniqueConstraint() {
496
496
  /**
497
497
  * Build the BlueprintBucketSeed interface.
498
498
  *
499
- * Matches the bucket entries in storage_config.buckets[].
499
+ * Matches the bucket entries in storage.buckets[].
500
500
  */
501
501
  function buildBlueprintBucketSeed() {
502
502
  return addJSDoc(exportInterface('BlueprintBucketSeed', [
@@ -506,12 +506,12 @@ function buildBlueprintBucketSeed() {
506
506
  addJSDoc(optionalProp('allowed_mime_types', t.tsArrayType(t.tsStringKeyword())), 'MIME type allowlist (e.g., ["image/png", "image/jpeg"]). NULL means all types allowed.'),
507
507
  addJSDoc(optionalProp('max_file_size', t.tsNumberKeyword()), 'Maximum file size in bytes for this bucket. NULL means no limit.'),
508
508
  addJSDoc(optionalProp('allowed_origins', t.tsArrayType(t.tsStringKeyword())), 'CORS allowed origins for this bucket.')
509
- ]), '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).');
509
+ ]), 'A bucket seed entry for storage.buckets[]. Creates an initial bucket row in the {prefix}_buckets table during entity type provisioning. Only used for app-level storage (not entity-scoped).');
510
510
  }
511
511
  /**
512
512
  * Build the BlueprintStorageConfig interface.
513
513
  *
514
- * Matches the jsonb shape accepted by storage_config on entity_type_provision.
514
+ * Matches the jsonb shape accepted by storage on entity_type_provision.
515
515
  */
516
516
  function buildBlueprintStorageConfig() {
517
517
  return addJSDoc(exportInterface('BlueprintStorageConfig', [
@@ -564,6 +564,108 @@ function buildBlueprintAchievement() {
564
564
  addJSDoc(optionalProp('entity_prefix', t.tsStringKeyword()), 'Entity prefix to scope this achievement to (e.g., "org", "app"). Used to resolve the correct events_module. Defaults to "app".')
565
565
  ]), 'An achievement entry for the blueprint achievements[] section. Creates a level with requirements and optional rewards in the events_module. Requires events_module to be provisioned (e.g., via entity_types[].has_levels = true or modules includes events_module).');
566
566
  }
567
+ // ---------------------------------------------------------------------------
568
+ // Module config types (namespace, function, agent, graph)
569
+ // ---------------------------------------------------------------------------
570
+ /**
571
+ * Build the BlueprintNamespaceConfig interface.
572
+ *
573
+ * Matches the jsonb shape accepted by namespaces on entity_type_provision
574
+ * and the top-level definition.namespaces[] array in construct_blueprint().
575
+ */
576
+ function buildBlueprintNamespaceConfig() {
577
+ return addJSDoc(exportInterface('BlueprintNamespaceConfig', [
578
+ addJSDoc(optionalProp('scope', t.tsUnionType([
579
+ t.tsLiteralType(t.stringLiteral('app')),
580
+ t.tsLiteralType(t.stringLiteral('org'))
581
+ ])), 'Namespace scope. "app" (default) creates app-level namespaces (membership_type = NULL). "org" creates per-org namespaces. Only used at the top level of a blueprint definition — entity-scoped namespaces inherit scope from the entity type.'),
582
+ addJSDoc(optionalProp('key', t.tsStringKeyword()), 'Module discriminator for multi-module namespaces. Defaults to "default" (omitted from table names). Non-default keys appear as an infix: {prefix}_{key}_namespaces.'),
583
+ addJSDoc(optionalProp('policies', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintPolicy')))), 'RLS policy overrides for the namespaces table. NULL = apply defaults from apply_namespace_security().'),
584
+ addJSDoc(optionalProp('provisions', t.tsTypeLiteral([
585
+ optionalProp('namespaces', t.tsTypeReference(t.identifier('BlueprintEntityTableProvision'))),
586
+ optionalProp('namespace_events', t.tsTypeReference(t.identifier('BlueprintEntityTableProvision')))
587
+ ])), 'Per-table overrides for namespace tables. Each key targets a specific table (namespaces, namespace_events) and uses the same shape as table_provision: { nodes, fields, grants, use_rls, policies }. Fanned out to secure_table_provision.')
588
+ ]), 'Namespace module configuration. When used at the top level of a blueprint, the scope field controls whether namespaces are app-level ("app", default) or org-level ("org"). When used inside entity_types[], scope is inherited from the entity type. Provisions a namespaces table with computed-name proxy, rename trigger, and entity-scoped RLS.');
589
+ }
590
+ /**
591
+ * Build the BlueprintFunctionConfig interface.
592
+ *
593
+ * Matches the jsonb shape accepted by functions on entity_type_provision
594
+ * and the top-level definition.functions[] array in construct_blueprint().
595
+ */
596
+ function buildBlueprintFunctionConfig() {
597
+ return addJSDoc(exportInterface('BlueprintFunctionConfig', [
598
+ addJSDoc(optionalProp('scope', t.tsUnionType([
599
+ t.tsLiteralType(t.stringLiteral('app')),
600
+ t.tsLiteralType(t.stringLiteral('org'))
601
+ ])), 'Function scope. "app" (default) creates app-level functions (membership_type = NULL). "org" creates per-org functions. Only used at the top level of a blueprint definition — entity-scoped functions inherit scope from the entity type.'),
602
+ addJSDoc(optionalProp('key', t.tsStringKeyword()), 'Module discriminator for multi-module functions. Defaults to "default" (omitted from table names). Non-default keys appear as an infix: {prefix}_{key}_function_definitions.'),
603
+ addJSDoc(optionalProp('policies', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintPolicy')))), 'RLS policy overrides for the function tables. NULL = apply defaults from apply_function_security().'),
604
+ addJSDoc(optionalProp('provisions', t.tsTypeLiteral([
605
+ optionalProp('definitions', t.tsTypeReference(t.identifier('BlueprintEntityTableProvision'))),
606
+ optionalProp('invocations', t.tsTypeReference(t.identifier('BlueprintEntityTableProvision'))),
607
+ optionalProp('execution_logs', t.tsTypeReference(t.identifier('BlueprintEntityTableProvision')))
608
+ ])), 'Per-table overrides for function tables. Each key targets a specific table (definitions, invocations, execution_logs) and uses the same shape as table_provision: { nodes, fields, grants, use_rls, policies }. Fanned out to secure_table_provision.')
609
+ ]), 'Function module configuration. When used at the top level of a blueprint, the scope field controls whether functions are app-level ("app", default) or org-level ("org"). When used inside entity_types[], scope is inherited from the entity type. Provisions function_definitions, function_invocations (partitioned, 12-month retention), and function_execution_logs tables.');
610
+ }
611
+ /**
612
+ * Build the BlueprintAgentConfig interface.
613
+ *
614
+ * Matches the jsonb shape accepted by agents on entity_type_provision
615
+ * and the top-level definition.agents[] array in construct_blueprint().
616
+ */
617
+ function buildBlueprintAgentConfig() {
618
+ return addJSDoc(exportInterface('BlueprintAgentConfig', [
619
+ addJSDoc(optionalProp('scope', t.tsUnionType([
620
+ t.tsLiteralType(t.stringLiteral('app')),
621
+ t.tsLiteralType(t.stringLiteral('org'))
622
+ ])), 'Agent scope. "app" (default) creates app-level agent tables (membership_type = NULL). "org" creates per-org agent tables. Only used at the top level of a blueprint definition — entity-scoped agents inherit scope from the entity type.'),
623
+ addJSDoc(optionalProp('key', t.tsStringKeyword()), 'Module discriminator for multi-module agents. Defaults to "default" (omitted from table names). Non-default keys appear as an infix: {prefix}_{key}_agent_thread.'),
624
+ addJSDoc(optionalProp('api_name', t.tsStringKeyword()), 'API name for the agent module. Used in GraphQL naming. Defaults to "agent".'),
625
+ addJSDoc(optionalProp('has_knowledge', t.tsBooleanKeyword()), 'Whether to provision the agent_knowledge table with vector embeddings, tags, and trigger_phrases. Also inferred when a "knowledge" key is present. Defaults to false.'),
626
+ addJSDoc(optionalProp('knowledge', t.tsTypeLiteral([
627
+ optionalProp('has_chunks', t.tsBooleanKeyword()),
628
+ optionalProp('dimensions', t.tsNumberKeyword()),
629
+ optionalProp('chunk_size', t.tsNumberKeyword()),
630
+ optionalProp('chunk_overlap', t.tsNumberKeyword()),
631
+ optionalProp('chunk_strategy', t.tsUnionType([
632
+ t.tsLiteralType(t.stringLiteral('fixed')),
633
+ t.tsLiteralType(t.stringLiteral('sentence')),
634
+ t.tsLiteralType(t.stringLiteral('paragraph')),
635
+ t.tsLiteralType(t.stringLiteral('semantic'))
636
+ ])),
637
+ optionalProp('embedding_model', t.tsStringKeyword()),
638
+ optionalProp('embedding_provider', t.tsStringKeyword()),
639
+ optionalProp('search_indexes', t.tsArrayType(t.tsUnionType([
640
+ t.tsLiteralType(t.stringLiteral('fulltext')),
641
+ t.tsLiteralType(t.stringLiteral('bm25')),
642
+ t.tsLiteralType(t.stringLiteral('trigram'))
643
+ ])))
644
+ ])), 'Knowledge configuration overrides. Set has_chunks to false to disable the chunking pipeline. Controls vector dimensions, chunking strategy, embedding model/provider, and text search indexes for the agent_knowledge table. Presence implies has_knowledge = true.'),
645
+ addJSDoc(optionalProp('policies', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintPolicy')))), 'RLS policy overrides for the agent tables. NULL = apply defaults from apply_agent_security().'),
646
+ addJSDoc(optionalProp('provisions', t.tsTypeLiteral([
647
+ optionalProp('thread', t.tsTypeReference(t.identifier('BlueprintEntityTableProvision'))),
648
+ optionalProp('message', t.tsTypeReference(t.identifier('BlueprintEntityTableProvision'))),
649
+ optionalProp('task', t.tsTypeReference(t.identifier('BlueprintEntityTableProvision'))),
650
+ optionalProp('prompt', t.tsTypeReference(t.identifier('BlueprintEntityTableProvision'))),
651
+ optionalProp('knowledge', t.tsTypeReference(t.identifier('BlueprintEntityTableProvision')))
652
+ ])), 'Per-table overrides for agent tables. Each key targets a specific table (thread, message, task, prompt, knowledge) and uses the same shape as table_provision: { nodes, fields, grants, use_rls, policies }. Fanned out to secure_table_provision.')
653
+ ]), 'Agent module configuration. When used at the top level of a blueprint, the scope field controls whether agents are app-level ("app", default) or org-level ("org"). When used inside entity_types[], scope is inherited from the entity type. Provisions thread, message, task, prompt tables (and optionally knowledge with vector embeddings).');
654
+ }
655
+ /**
656
+ * Build the BlueprintGraphConfig interface.
657
+ *
658
+ * Matches the jsonb shape accepted by graphs on entity_type_provision.
659
+ * Graph module requires a merkle_store_module_id dependency, so
660
+ * entity_type_provision only registers permissions. The graph module itself
661
+ * must be provisioned separately with the merkle store dependency resolved.
662
+ */
663
+ function buildBlueprintGraphConfig() {
664
+ return addJSDoc(exportInterface('BlueprintGraphConfig', [
665
+ addJSDoc(optionalProp('key', t.tsStringKeyword()), 'Module discriminator for multi-module graphs. Defaults to "default".'),
666
+ addJSDoc(optionalProp('policies', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintPolicy')))), 'RLS policy overrides for the graph tables. NULL = apply defaults from apply_graph_security().')
667
+ ]), 'Graph module configuration. Presence triggers permission registration (manage_graphs, execute_graphs). The graph module requires a merkle_store_module_id dependency, so entity_type_provision only registers permissions here — the graph module itself must be provisioned separately.');
668
+ }
567
669
  function buildBlueprintEntityTableProvision() {
568
670
  return addJSDoc(exportInterface('BlueprintEntityTableProvision', [
569
671
  addJSDoc(optionalProp('use_rls', t.tsBooleanKeyword()), 'Whether to enable RLS on the entity table. Forwarded to secure_table_provision. Defaults to true.'),
@@ -591,7 +693,11 @@ function buildBlueprintEntityType() {
591
693
  addJSDoc(optionalProp('has_invite_achievements', t.tsBooleanKeyword()), "Whether to auto-attach an EventTracker to the claimed_invites table for invite-based achievements. Requires has_invites=true AND has_levels=true. When true, records 'invite_claimed' events credited to the sender (inviter) on each claimed invite. Defaults to false."),
592
694
  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.'),
593
695
  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).'),
594
- addJSDoc(optionalProp('storage', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintStorageConfig')))), 'Storage module configuration array. Each entry provisions a separate storage module with its own tables, RLS, and settings. When non-empty, has_storage is derived as true. Each entry may specify a storage_key for multi-module support (defaults to "default").')
696
+ addJSDoc(optionalProp('storage', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintStorageConfig')))), 'Storage module configuration array. Presence triggers provisioning (same inference model as namespaces, functions, agents). Each entry provisions a separate storage module with its own tables, RLS, and settings. Each entry may specify a storage_key for multi-module support (defaults to "default").'),
697
+ addJSDoc(optionalProp('namespaces', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintNamespaceConfig')))), 'Namespace module configuration array. Presence triggers provisioning. Each entry provisions a namespace_module with its own tables, computed-name proxy, and entity-scoped RLS. Registers manage_namespaces permission bit. "[{}]" = provision one default namespace module.'),
698
+ addJSDoc(optionalProp('functions', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintFunctionConfig')))), 'Function module configuration array. Presence triggers provisioning. Each entry provisions function_definitions, function_invocations (partitioned), and function_execution_logs tables. Registers manage_functions + invoke_functions permission bits. "[{}]" = provision one default function module.'),
699
+ addJSDoc(optionalProp('agents', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintAgentConfig')))), 'Agent module configuration array. Presence triggers provisioning. Each entry provisions thread, message, task, prompt tables (and optionally knowledge with vector embeddings). "[{}]" = provision one default agent module.'),
700
+ addJSDoc(optionalProp('graphs', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintGraphConfig')))), 'Graph module configuration array. Presence triggers permission registration (manage_graphs, execute_graphs). Graph module requires a merkle_store_module_id dependency, so entity_type_provision only registers permissions here. "[{}]" = register default graph permissions.')
595
701
  ]), 'An entity type entry for Phase 0 of construct_blueprint(). When name is provided, provisions a new entity type with its own entity table, membership modules, and security policies via entity_type_provision. When name is omitted and only prefix is given, extends an existing entity type (e.g., the built-in "org") with additional capabilities like storage — without creating a new entity type.');
596
702
  }
597
703
  function buildBlueprintTable() {
@@ -620,7 +726,10 @@ function buildBlueprintDefinition() {
620
726
  addJSDoc(optionalProp('unique_constraints', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintUniqueConstraint')))), 'Unique constraints on table columns.'),
621
727
  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.'),
622
728
  addJSDoc(optionalProp('storage', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintStorageConfig')))), 'Top-level storage configuration array. Each entry has an optional scope ("app" or "org"). App-scoped (default) creates storage_module with membership_type = NULL. Org-scoped creates per-org/user storage with owner_id and AFTER INSERT bucket seeding. When infra is installed, a private "functions" bucket is auto-injected into org-scoped entries. For child entity type storage, use entity_types[].storage instead.'),
623
- addJSDoc(optionalProp('achievements', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintAchievement')))), 'Achievement definitions. Each entry creates a level with requirements and optional rewards in the events_module. Requires events_module to be provisioned (e.g., via entity_types[].has_levels = true or modules includes events_module).')
729
+ addJSDoc(optionalProp('achievements', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintAchievement')))), 'Achievement definitions. Each entry creates a level with requirements and optional rewards in the events_module. Requires events_module to be provisioned (e.g., via entity_types[].has_levels = true or modules includes events_module).'),
730
+ addJSDoc(optionalProp('namespaces', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintNamespaceConfig')))), 'Top-level namespace configuration array (Phase 0.6). Each entry has an optional scope ("app" or "org"). App-scoped (default) creates namespace_module with membership_type = NULL. Org-scoped creates per-org namespaces. For entity-scoped namespaces, use entity_types[].namespaces instead.'),
731
+ addJSDoc(optionalProp('functions', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintFunctionConfig')))), 'Top-level function configuration array (Phase 0.6). Each entry has an optional scope ("app" or "org"). App-scoped (default) creates function_module with membership_type = NULL. Org-scoped creates per-org functions. For entity-scoped functions, use entity_types[].functions instead.'),
732
+ addJSDoc(optionalProp('agents', t.tsArrayType(t.tsTypeReference(t.identifier('BlueprintAgentConfig')))), 'Top-level agent configuration array (Phase 0.6). Each entry has an optional scope ("app" or "org"). App-scoped (default) creates agent_module with membership_type = NULL. Org-scoped creates per-org agents. For entity-scoped agents, use entity_types[].agents instead.')
624
733
  ]), 'The complete blueprint definition -- the JSONB shape accepted by construct_blueprint().');
625
734
  }
626
735
  // ---------------------------------------------------------------------------
@@ -655,7 +764,7 @@ function buildProgram(meta) {
655
764
  statements.push(sectionComment('Shared recursive types'));
656
765
  statements.push(buildTriggerConditionInterface());
657
766
  // -- Parameter interfaces grouped by category --
658
- const categoryOrder = ['billing', 'check', 'data', 'limit', 'search', 'job', 'process', 'authz', 'relation', 'view'];
767
+ const categoryOrder = ['billing', 'check', 'data', 'event', 'limit', 'limit_enforce', 'limit_track', 'limit_warning', 'search', 'job', 'process', 'authz', 'relation', 'view'];
659
768
  for (const cat of categoryOrder) {
660
769
  const nts = categories.get(cat);
661
770
  if (!nts || nts.length === 0)
@@ -682,6 +791,10 @@ function buildProgram(meta) {
682
791
  statements.push(buildBlueprintAchievementRequirement());
683
792
  statements.push(buildBlueprintAchievementReward());
684
793
  statements.push(buildBlueprintAchievement());
794
+ statements.push(buildBlueprintNamespaceConfig());
795
+ statements.push(buildBlueprintFunctionConfig());
796
+ statements.push(buildBlueprintAgentConfig());
797
+ statements.push(buildBlueprintGraphConfig());
685
798
  statements.push(buildBlueprintEntityTableProvision());
686
799
  statements.push(buildBlueprintEntityType());
687
800
  // -- Node types discriminated union --
@@ -0,0 +1,2 @@
1
+ import type { NodeTypeDefinition } from '../types';
2
+ export declare const DataMemberOwner: NodeTypeDefinition;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DataMemberOwner = void 0;
4
+ exports.DataMemberOwner = {
5
+ name: 'DataMemberOwner',
6
+ slug: 'data_member_owner',
7
+ category: 'data',
8
+ display_name: 'Member Owner',
9
+ description: 'Adds owner_id and entity_id columns with a compound AuthzMemberOwner policy. The actor must own the row (owner_id = current_user_id()) AND be a member of the entity (entity_id in SPRT). Use for private data within an entity scope — e.g., personal chat threads that belong to the company but only the author can see.',
10
+ parameter_schema: {
11
+ type: 'object',
12
+ properties: {
13
+ owner_field_name: {
14
+ type: 'string',
15
+ format: 'column-ref',
16
+ description: 'Column name for the owner reference',
17
+ default: 'owner_id'
18
+ },
19
+ entity_field_name: {
20
+ type: 'string',
21
+ format: 'column-ref',
22
+ description: 'Column name for the entity reference',
23
+ default: 'entity_id'
24
+ },
25
+ include_id: {
26
+ type: 'boolean',
27
+ description: 'If true, also adds a UUID primary key column with auto-generation',
28
+ default: true
29
+ },
30
+ include_user_fk: {
31
+ type: 'boolean',
32
+ description: 'If true, adds foreign key constraints from owner_id and entity_id to the users table',
33
+ default: true
34
+ },
35
+ create_index: {
36
+ type: 'boolean',
37
+ description: 'If true, creates B-tree indexes on the owner and entity columns',
38
+ default: true
39
+ },
40
+ membership_type: {
41
+ type: 'integer',
42
+ description: 'Membership type for SPRT resolution. Required for entity-scoped provisioning.',
43
+ default: null
44
+ }
45
+ }
46
+ },
47
+ tags: [
48
+ 'ownership',
49
+ 'membership',
50
+ 'security',
51
+ 'schema'
52
+ ]
53
+ };
package/data/index.d.ts CHANGED
@@ -12,6 +12,7 @@ export { DataImmutableFields } from './data-immutable-fields';
12
12
  export { DataInflection } from './data-inflection';
13
13
  export { DataInheritFromParent } from './data-inherit-from-parent';
14
14
  export { DataJsonb } from './data-jsonb';
15
+ export { DataMemberOwner } from './data-member-owner';
15
16
  export { DataOwnedFields } from './data-owned-fields';
16
17
  export { DataOwnershipInEntity } from './data-ownership-in-entity';
17
18
  export { DataPeoplestamps } from './data-peoplestamps';
package/data/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TableUserSettings = exports.TableUserProfiles = exports.TableOrganizationSettings = exports.SearchVector = exports.SearchUnified = exports.SearchTrgm = exports.SearchSpatialAggregate = exports.SearchSpatial = exports.SearchFullText = exports.SearchBm25 = exports.DataTimestamps = exports.DataTags = exports.DataStatusField = exports.DataSoftDelete = exports.DataSlug = exports.DataRealtime = exports.DataPublishable = exports.DataPeoplestamps = exports.DataOwnershipInEntity = exports.DataOwnedFields = exports.DataJsonb = exports.DataInheritFromParent = exports.DataInflection = exports.DataImmutableFields = exports.DataId = exports.DataForceCurrentUser = exports.DataEntityMembership = exports.DataDirectOwner = exports.DataCompositeField = exports.DataBulk = exports.CheckOneOf = exports.CheckNotEqual = exports.CheckLessThan = exports.CheckGreaterThan = void 0;
3
+ exports.TableUserSettings = exports.TableUserProfiles = exports.TableOrganizationSettings = exports.SearchVector = exports.SearchUnified = exports.SearchTrgm = exports.SearchSpatialAggregate = exports.SearchSpatial = exports.SearchFullText = exports.SearchBm25 = exports.DataTimestamps = exports.DataTags = exports.DataStatusField = exports.DataSoftDelete = exports.DataSlug = exports.DataRealtime = exports.DataPublishable = exports.DataPeoplestamps = exports.DataOwnershipInEntity = exports.DataOwnedFields = exports.DataMemberOwner = exports.DataJsonb = exports.DataInheritFromParent = exports.DataInflection = exports.DataImmutableFields = exports.DataId = exports.DataForceCurrentUser = exports.DataEntityMembership = exports.DataDirectOwner = exports.DataCompositeField = exports.DataBulk = exports.CheckOneOf = exports.CheckNotEqual = exports.CheckLessThan = exports.CheckGreaterThan = void 0;
4
4
  var check_greater_than_1 = require("./check-greater-than");
5
5
  Object.defineProperty(exports, "CheckGreaterThan", { enumerable: true, get: function () { return check_greater_than_1.CheckGreaterThan; } });
6
6
  var check_less_than_1 = require("./check-less-than");
@@ -29,6 +29,8 @@ var data_inherit_from_parent_1 = require("./data-inherit-from-parent");
29
29
  Object.defineProperty(exports, "DataInheritFromParent", { enumerable: true, get: function () { return data_inherit_from_parent_1.DataInheritFromParent; } });
30
30
  var data_jsonb_1 = require("./data-jsonb");
31
31
  Object.defineProperty(exports, "DataJsonb", { enumerable: true, get: function () { return data_jsonb_1.DataJsonb; } });
32
+ var data_member_owner_1 = require("./data-member-owner");
33
+ Object.defineProperty(exports, "DataMemberOwner", { enumerable: true, get: function () { return data_member_owner_1.DataMemberOwner; } });
32
34
  var data_owned_fields_1 = require("./data-owned-fields");
33
35
  Object.defineProperty(exports, "DataOwnedFields", { enumerable: true, get: function () { return data_owned_fields_1.DataOwnedFields; } });
34
36
  var data_ownership_in_entity_1 = require("./data-ownership-in-entity");
@@ -0,0 +1,2 @@
1
+ import type { NodeTypeDefinition } from '../types';
2
+ export declare const AuthzMemberOwner: NodeTypeDefinition;
@@ -0,0 +1,48 @@
1
+ export const AuthzMemberOwner = {
2
+ name: 'AuthzMemberOwner',
3
+ slug: 'authz_member_owner',
4
+ category: 'authz',
5
+ display_name: 'Member Owner',
6
+ description: 'Compound policy: the row must be owned by the current user (owner_field = current_user_id) AND the current user must be a member of the entity referenced by entity_field. Combines direct ownership with entity membership — the actor can only access rows they own within entities they belong to.',
7
+ parameter_schema: {
8
+ type: 'object',
9
+ properties: {
10
+ owner_field: {
11
+ type: 'string',
12
+ format: 'column-ref',
13
+ description: 'Column name containing the owner user ID (e.g., owner_id)',
14
+ default: 'owner_id'
15
+ },
16
+ entity_field: {
17
+ type: 'string',
18
+ format: 'column-ref',
19
+ description: 'Column name referencing the entity (e.g., entity_id)',
20
+ default: 'entity_id'
21
+ },
22
+ sel_field: {
23
+ type: 'string',
24
+ description: 'SPRT column to select for the entity match',
25
+ default: 'entity_id'
26
+ },
27
+ membership_type: {
28
+ type: ['integer', 'string'],
29
+ description: 'Scope: 1=app, 2=org, 3+=dynamic entity types (or string name resolved via membership_types_module)'
30
+ },
31
+ entity_type: {
32
+ type: 'string',
33
+ description: "Entity type prefix (e.g. 'channel', 'department'). Resolved to membership_type integer via memberships_module lookup."
34
+ },
35
+ permission: {
36
+ type: 'string',
37
+ description: 'Single permission name to check (resolved to bitstring mask)'
38
+ },
39
+ permissions: {
40
+ type: 'array',
41
+ items: { type: 'string' },
42
+ description: 'Multiple permission names to check (ORed together into mask)'
43
+ }
44
+ },
45
+ required: ['owner_field', 'entity_field']
46
+ },
47
+ tags: ['ownership', 'membership', 'authz']
48
+ };
@@ -9,6 +9,7 @@ export { AuthzEntityMembership } from './authz-entity-membership';
9
9
  export { AuthzMemberList } from './authz-member-list';
10
10
  export { AuthzNotReadOnly } from './authz-not-read-only';
11
11
  export { AuthzOrgHierarchy } from './authz-org-hierarchy';
12
+ export { AuthzMemberOwner } from './authz-member-owner';
12
13
  export { AuthzPeerOwnership } from './authz-peer-ownership';
13
14
  export { AuthzPublishable } from './authz-publishable';
14
15
  export { AuthzRelatedEntityMembership } from './authz-related-entity-membership';
@@ -9,6 +9,7 @@ export { AuthzEntityMembership } from './authz-entity-membership';
9
9
  export { AuthzMemberList } from './authz-member-list';
10
10
  export { AuthzNotReadOnly } from './authz-not-read-only';
11
11
  export { AuthzOrgHierarchy } from './authz-org-hierarchy';
12
+ export { AuthzMemberOwner } from './authz-member-owner';
12
13
  export { AuthzPeerOwnership } from './authz-peer-ownership';
13
14
  export { AuthzPublishable } from './authz-publishable';
14
15
  export { AuthzRelatedEntityMembership } from './authz-related-entity-membership';