@carlonicora/nestjs-neo4jsonapi 8.11.0 → 8.12.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 (166) hide show
  1. package/dist/agents/community.detector/services/community.detector.service.d.ts +10 -7
  2. package/dist/agents/community.detector/services/community.detector.service.d.ts.map +1 -1
  3. package/dist/agents/community.detector/services/community.detector.service.js +26 -31
  4. package/dist/agents/community.detector/services/community.detector.service.js.map +1 -1
  5. package/dist/agents/community.summariser/community.summariser.module.d.ts.map +1 -1
  6. package/dist/agents/community.summariser/community.summariser.module.js +5 -1
  7. package/dist/agents/community.summariser/community.summariser.module.js.map +1 -1
  8. package/dist/agents/community.summariser/cron/community.summariser.cron.d.ts +1 -6
  9. package/dist/agents/community.summariser/cron/community.summariser.cron.d.ts.map +1 -1
  10. package/dist/agents/community.summariser/cron/community.summariser.cron.js +2 -6
  11. package/dist/agents/community.summariser/cron/community.summariser.cron.js.map +1 -1
  12. package/dist/agents/community.summariser/helpers/community-scope-filter.d.ts +3 -5
  13. package/dist/agents/community.summariser/helpers/community-scope-filter.d.ts.map +1 -1
  14. package/dist/agents/community.summariser/helpers/community-scope-filter.js +3 -7
  15. package/dist/agents/community.summariser/helpers/community-scope-filter.js.map +1 -1
  16. package/dist/agents/community.summariser/processors/community.summariser.processor.d.ts +1 -6
  17. package/dist/agents/community.summariser/processors/community.summariser.processor.d.ts.map +1 -1
  18. package/dist/agents/community.summariser/processors/community.summariser.processor.js +2 -6
  19. package/dist/agents/community.summariser/processors/community.summariser.processor.js.map +1 -1
  20. package/dist/agents/community.summariser/services/community.summariser.service.js +1 -1
  21. package/dist/agents/community.summariser/services/community.summariser.service.js.map +1 -1
  22. package/dist/agents/drift/nodes/followup.node.service.js +1 -1
  23. package/dist/agents/drift/nodes/followup.node.service.js.map +1 -1
  24. package/dist/agents/graph/prompts/graph.node.system.prompt.d.ts +19 -2
  25. package/dist/agents/graph/prompts/graph.node.system.prompt.d.ts.map +1 -1
  26. package/dist/agents/graph/prompts/graph.node.system.prompt.js +57 -4
  27. package/dist/agents/graph/prompts/graph.node.system.prompt.js.map +1 -1
  28. package/dist/agents/graph/services/compact-description.d.ts +76 -0
  29. package/dist/agents/graph/services/compact-description.d.ts.map +1 -0
  30. package/dist/agents/graph/services/compact-description.js +178 -0
  31. package/dist/agents/graph/services/compact-description.js.map +1 -0
  32. package/dist/agents/graph/services/filter-operators.d.ts +16 -0
  33. package/dist/agents/graph/services/filter-operators.d.ts.map +1 -0
  34. package/dist/agents/graph/services/filter-operators.js +35 -0
  35. package/dist/agents/graph/services/filter-operators.js.map +1 -0
  36. package/dist/agents/graph/tools/describe-entity.tool.d.ts +57 -1
  37. package/dist/agents/graph/tools/describe-entity.tool.d.ts.map +1 -1
  38. package/dist/agents/graph/tools/describe-entity.tool.js +121 -59
  39. package/dist/agents/graph/tools/describe-entity.tool.js.map +1 -1
  40. package/dist/agents/graph/tools/read-entity.tool.d.ts.map +1 -1
  41. package/dist/agents/graph/tools/read-entity.tool.js +11 -2
  42. package/dist/agents/graph/tools/read-entity.tool.js.map +1 -1
  43. package/dist/agents/graph/tools/search-entities.tool.d.ts.map +1 -1
  44. package/dist/agents/graph/tools/search-entities.tool.js +7 -2
  45. package/dist/agents/graph/tools/search-entities.tool.js.map +1 -1
  46. package/dist/agents/graph/tools/tool.factory.d.ts +35 -0
  47. package/dist/agents/graph/tools/tool.factory.d.ts.map +1 -1
  48. package/dist/agents/graph/tools/tool.factory.js +34 -0
  49. package/dist/agents/graph/tools/tool.factory.js.map +1 -1
  50. package/dist/agents/graph/tools/traverse.tool.d.ts +1 -13
  51. package/dist/agents/graph/tools/traverse.tool.d.ts.map +1 -1
  52. package/dist/agents/graph/tools/traverse.tool.js +13 -33
  53. package/dist/agents/graph/tools/traverse.tool.js.map +1 -1
  54. package/dist/agents/index.d.ts +6 -2
  55. package/dist/agents/index.d.ts.map +1 -1
  56. package/dist/agents/index.js +10 -2
  57. package/dist/agents/index.js.map +1 -1
  58. package/dist/agents/responder/nodes/graph.node.service.d.ts +48 -1
  59. package/dist/agents/responder/nodes/graph.node.service.d.ts.map +1 -1
  60. package/dist/agents/responder/nodes/graph.node.service.js +158 -41
  61. package/dist/agents/responder/nodes/graph.node.service.js.map +1 -1
  62. package/dist/agents/responder/nodes/responder.answer.node.service.d.ts +1 -1
  63. package/dist/agents/responder/nodes/responder.answer.node.service.d.ts.map +1 -1
  64. package/dist/agents/responder/nodes/responder.answer.node.service.js +14 -0
  65. package/dist/agents/responder/nodes/responder.answer.node.service.js.map +1 -1
  66. package/dist/config/base.config.d.ts +6 -0
  67. package/dist/config/base.config.d.ts.map +1 -1
  68. package/dist/config/base.config.js +1 -0
  69. package/dist/config/base.config.js.map +1 -1
  70. package/dist/config/interfaces/base.config.interface.d.ts +2 -0
  71. package/dist/config/interfaces/base.config.interface.d.ts.map +1 -1
  72. package/dist/config/interfaces/config.community.interface.d.ts +8 -0
  73. package/dist/config/interfaces/config.community.interface.d.ts.map +1 -0
  74. package/dist/config/interfaces/config.community.interface.js +3 -0
  75. package/dist/config/interfaces/config.community.interface.js.map +1 -0
  76. package/dist/config/interfaces/config.prompts.interface.d.ts +4 -4
  77. package/dist/config/interfaces/config.responder.interface.d.ts +7 -6
  78. package/dist/config/interfaces/config.responder.interface.d.ts.map +1 -1
  79. package/dist/config/interfaces/index.d.ts +1 -0
  80. package/dist/config/interfaces/index.d.ts.map +1 -1
  81. package/dist/config/interfaces/index.js +1 -0
  82. package/dist/config/interfaces/index.js.map +1 -1
  83. package/dist/core/llm/services/llm.service.d.ts +26 -0
  84. package/dist/core/llm/services/llm.service.d.ts.map +1 -1
  85. package/dist/core/llm/services/llm.service.js +146 -14
  86. package/dist/core/llm/services/llm.service.js.map +1 -1
  87. package/dist/foundations/analytics/index.d.ts +1 -0
  88. package/dist/foundations/analytics/index.d.ts.map +1 -1
  89. package/dist/foundations/analytics/index.js +3 -1
  90. package/dist/foundations/analytics/index.js.map +1 -1
  91. package/dist/foundations/analytics/interfaces/analytics.purge-visitor.input.d.ts +19 -0
  92. package/dist/foundations/analytics/interfaces/analytics.purge-visitor.input.d.ts.map +1 -0
  93. package/dist/foundations/analytics/interfaces/analytics.purge-visitor.input.js +6 -0
  94. package/dist/foundations/analytics/interfaces/analytics.purge-visitor.input.js.map +1 -0
  95. package/dist/foundations/analytics/processors/analytics.processor.d.ts +10 -1
  96. package/dist/foundations/analytics/processors/analytics.processor.d.ts.map +1 -1
  97. package/dist/foundations/analytics/processors/analytics.processor.js +29 -0
  98. package/dist/foundations/analytics/processors/analytics.processor.js.map +1 -1
  99. package/dist/foundations/analytics/repositories/analytics-session.repository.d.ts +11 -0
  100. package/dist/foundations/analytics/repositories/analytics-session.repository.d.ts.map +1 -1
  101. package/dist/foundations/analytics/repositories/analytics-session.repository.js +37 -0
  102. package/dist/foundations/analytics/repositories/analytics-session.repository.js.map +1 -1
  103. package/dist/foundations/analytics/services/analytics.service.d.ts +3 -1
  104. package/dist/foundations/analytics/services/analytics.service.d.ts.map +1 -1
  105. package/dist/foundations/analytics/services/analytics.service.js +18 -3
  106. package/dist/foundations/analytics/services/analytics.service.js.map +1 -1
  107. package/dist/foundations/community/community.module.d.ts.map +1 -1
  108. package/dist/foundations/community/community.module.js +5 -4
  109. package/dist/foundations/community/community.module.js.map +1 -1
  110. package/dist/foundations/community/entities/community.entity.d.ts +30 -4
  111. package/dist/foundations/community/entities/community.entity.d.ts.map +1 -1
  112. package/dist/foundations/community/entities/community.entity.js +51 -0
  113. package/dist/foundations/community/entities/community.entity.js.map +1 -1
  114. package/dist/foundations/community/index.d.ts +4 -2
  115. package/dist/foundations/community/index.d.ts.map +1 -1
  116. package/dist/foundations/community/index.js +8 -3
  117. package/dist/foundations/community/index.js.map +1 -1
  118. package/dist/foundations/community/repositories/community.repository.d.ts +93 -103
  119. package/dist/foundations/community/repositories/community.repository.d.ts.map +1 -1
  120. package/dist/foundations/community/repositories/community.repository.js +330 -328
  121. package/dist/foundations/community/repositories/community.repository.js.map +1 -1
  122. package/dist/foundations/community/services/community-layer.service.d.ts +38 -0
  123. package/dist/foundations/community/services/community-layer.service.d.ts.map +1 -0
  124. package/dist/foundations/community/services/community-layer.service.js +89 -0
  125. package/dist/foundations/community/services/community-layer.service.js.map +1 -0
  126. package/dist/foundations/community/services/community.service.d.ts +22 -4
  127. package/dist/foundations/community/services/community.service.d.ts.map +1 -1
  128. package/dist/foundations/community/services/community.service.js +9 -6
  129. package/dist/foundations/community/services/community.service.js.map +1 -1
  130. package/dist/foundations/stripe-invoice/repositories/stripe-invoice.repository.d.ts +8 -3
  131. package/dist/foundations/stripe-invoice/repositories/stripe-invoice.repository.d.ts.map +1 -1
  132. package/dist/foundations/stripe-invoice/repositories/stripe-invoice.repository.js +35 -29
  133. package/dist/foundations/stripe-invoice/repositories/stripe-invoice.repository.js.map +1 -1
  134. package/dist/foundations/stripe-price/entities/stripe-price.map.d.ts.map +1 -1
  135. package/dist/foundations/stripe-price/entities/stripe-price.map.js +2 -1
  136. package/dist/foundations/stripe-price/entities/stripe-price.map.js.map +1 -1
  137. package/dist/foundations/stripe-product/repositories/stripe-product.repository.d.ts +2 -1
  138. package/dist/foundations/stripe-product/repositories/stripe-product.repository.d.ts.map +1 -1
  139. package/dist/foundations/stripe-product/repositories/stripe-product.repository.js +4 -1
  140. package/dist/foundations/stripe-product/repositories/stripe-product.repository.js.map +1 -1
  141. package/dist/foundations/stripe-subscription/services/stripe-subscription-admin.service.d.ts +3 -18
  142. package/dist/foundations/stripe-subscription/services/stripe-subscription-admin.service.d.ts.map +1 -1
  143. package/dist/foundations/stripe-subscription/services/stripe-subscription-admin.service.js +20 -5
  144. package/dist/foundations/stripe-subscription/services/stripe-subscription-admin.service.js.map +1 -1
  145. package/dist/foundations/stripe-subscription/services/stripe-subscription-api.service.d.ts +6 -1
  146. package/dist/foundations/stripe-subscription/services/stripe-subscription-api.service.d.ts.map +1 -1
  147. package/dist/foundations/stripe-subscription/services/stripe-subscription-api.service.js +10 -3
  148. package/dist/foundations/stripe-subscription/services/stripe-subscription-api.service.js.map +1 -1
  149. package/dist/foundations/stripe-subscription/services/subscription-payment-confirmation.d.ts +1 -1
  150. package/dist/foundations/stripe-subscription/services/subscription-payment-confirmation.js +1 -1
  151. package/dist/foundations/stripe-webhook/controllers/stripe-webhook.controller.d.ts.map +1 -1
  152. package/dist/foundations/stripe-webhook/controllers/stripe-webhook.controller.js +2 -0
  153. package/dist/foundations/stripe-webhook/controllers/stripe-webhook.controller.js.map +1 -1
  154. package/dist/foundations/stripe-webhook/processors/stripe-webhook.processor.d.ts +1 -0
  155. package/dist/foundations/stripe-webhook/processors/stripe-webhook.processor.d.ts.map +1 -1
  156. package/dist/foundations/stripe-webhook/processors/stripe-webhook.processor.js +14 -9
  157. package/dist/foundations/stripe-webhook/processors/stripe-webhook.processor.js.map +1 -1
  158. package/package.json +1 -1
  159. package/dist/foundations/community/entities/community.map.d.ts +0 -8
  160. package/dist/foundations/community/entities/community.map.d.ts.map +0 -1
  161. package/dist/foundations/community/entities/community.map.js +0 -24
  162. package/dist/foundations/community/entities/community.map.js.map +0 -1
  163. package/dist/foundations/community/entities/community.model.d.ts +0 -4
  164. package/dist/foundations/community/entities/community.model.d.ts.map +0 -1
  165. package/dist/foundations/community/entities/community.model.js +0 -15
  166. package/dist/foundations/community/entities/community.model.js.map +0 -1
@@ -1,34 +1,55 @@
1
- import { OnModuleInit } from "@nestjs/common";
1
+ import { ClsService } from "nestjs-cls";
2
2
  import { AgentScopeFilterService } from "../../../common/repositories/agent-scope.filter";
3
3
  import { AgentScope } from "../../../common/types/agent.scope";
4
- import { EmbedderService, ModelService } from "../../../core";
4
+ import { EmbedderService } from "../../../core/llm/services/embedder.service";
5
+ import { ModelService } from "../../../core/llm/services/model.service";
6
+ import { AbstractRepository } from "../../../core/neo4j/abstracts/abstract.repository";
5
7
  import { Neo4jService } from "../../../core/neo4j/services/neo4j.service";
6
8
  import { SecurityService } from "../../../core/security/services/security.service";
7
- import { Community } from "../entities/community.entity";
9
+ import { Community, CommunityDescriptor } from "../entities/community.entity";
10
+ import { CommunityLayerService } from "../services/community-layer.service";
8
11
  /**
9
12
  * Up to this many company/scope communities, `findByVector` ranks them by
10
13
  * exact cosine (no recall cliff). Above it, it falls back to the vector-index
11
14
  * over-fetch, which ranks globally and filters afterwards.
12
15
  */
13
16
  export declare const COMMUNITY_EXACT_SCAN_MAX_SCOPED_NODES = 5000;
14
- export declare class CommunityRepository implements OnModuleInit {
15
- private readonly neo4j;
17
+ /**
18
+ * Topic groups of key concepts, one set per company or per layer root (`CommunityLayerService`).
19
+ *
20
+ * Every match on a Community starts from `buildDefaultMatch()`, so the company predicate is the
21
+ * framework's. With no company in CLS that predicate matches every company: only
22
+ * `findAllStaleCommunities` (the cron) relies on it; every write throws instead.
23
+ */
24
+ export declare class CommunityRepository extends AbstractRepository<Community, typeof CommunityDescriptor.relationships> {
16
25
  private readonly embedderService;
17
26
  private readonly modelService;
18
- private readonly securityService;
19
27
  private readonly agentScope;
20
- constructor(neo4j: Neo4jService, embedderService: EmbedderService, modelService: ModelService, securityService: SecurityService, agentScope: AgentScopeFilterService);
28
+ private readonly layer;
29
+ protected readonly descriptor: import("../../..").EntityDescriptor<Community, {
30
+ keyconcept: {
31
+ model: import("../../..").DataMeta;
32
+ direction: "out";
33
+ relationship: string;
34
+ cardinality: "many";
35
+ required: false;
36
+ };
37
+ community: {
38
+ model: import("../../..").DataMeta;
39
+ direction: "out";
40
+ relationship: string;
41
+ cardinality: "many";
42
+ required: false;
43
+ };
44
+ }>;
45
+ constructor(neo4j: Neo4jService, securityService: SecurityService, clsService: ClsService, embedderService: EmbedderService, modelService: ModelService, agentScope: AgentScopeFilterService, layer: CommunityLayerService);
21
46
  onModuleInit(): Promise<void>;
47
+ /** A query on the Community serialiser, refused when no company is in context (writes). */
48
+ private writeQuery;
49
+ private readQuery;
22
50
  /**
23
- * Create a new community node with BELONGS_TO company relationship
24
- * Uses companyId from CLS (current request context)
25
- */
26
- /**
27
- * `scopeRoot` ties the community to the scope root its members were detected
28
- * within. Communities are built per scope root precisely so a scoped run can
29
- * be answered from communities that contain nothing from a sibling root;
30
- * without the edge, `findByVector` has no way to tell them apart and the
31
- * whole partition is decorative.
51
+ * `scopeRoot` ties the group to the layer root its members were detected within. Its `label`
52
+ * is ignored: the label comes from the layer. A `scopeRoot` with no layer configured throws.
32
53
  */
33
54
  createCommunity(params: {
34
55
  name: string;
@@ -40,74 +61,55 @@ export declare class CommunityRepository implements OnModuleInit {
40
61
  label: string;
41
62
  };
42
63
  }): Promise<Community>;
43
- /**
44
- * Update community members (HAS_MEMBER relationships to KeyConcepts)
45
- */
64
+ /** Replaces the group's HAS_MEMBER edges. */
46
65
  updateCommunityMembers(params: {
47
66
  communityId: string;
48
67
  keyConceptIds: string[];
49
68
  }): Promise<void>;
50
- /**
51
- * Set PARENT_OF relationship between communities (hierarchy)
52
- */
69
+ /** PARENT_OF between two groups of the same company. */
53
70
  setParentCommunity(params: {
54
71
  childCommunityId: string;
55
72
  parentCommunityId: string;
56
73
  }): Promise<void>;
57
- /**
58
- * Mark communities as stale (needs reprocessing)
59
- */
74
+ /** Marks groups as stale (needs reprocessing). */
60
75
  markAsStale(communityIds: string[]): Promise<void>;
61
76
  /**
62
- * Mark a community as deferred for lack of credits — the summariser cron
63
- * skips it (via `findAllStaleCommunities`'s WHERE clause) until approval
64
- * clears the flag (spec §2: a fresh top-up must not be silently eaten).
77
+ * Defers a group for lack of credits: the summariser cron skips it (`findAllStaleCommunities`)
78
+ * until approval clears the flag (spec §2: a fresh top-up must not be silently eaten).
65
79
  */
66
80
  markPendingCredits(communityId: string): Promise<void>;
67
- /**
68
- * Approval: clear the flag for the current company (from CLS); returns the
69
- * cleared community ids so the caller can re-enqueue them.
70
- */
81
+ /** Approval: clears the flag for the current company; returns the cleared ids so the caller can re-enqueue them. */
71
82
  clearPendingCredits(): Promise<string[]>;
72
- /**
73
- * Backlog count for the current company (from CLS) — mirrors countStaleCommunities.
74
- */
83
+ /** Backlog count for the current company (mirrors countStaleCommunities). */
75
84
  countPendingCredits(): Promise<number>;
76
- /**
77
- * Count stale communities for the current company (from CLS)
78
- */
85
+ /** Stale groups of the current company. */
79
86
  countStaleCommunities(): Promise<number>;
80
87
  /**
81
- * Find all stale communities with their company IDs (for cron job enqueuing)
82
- * No CLS context needed - returns cross-company results
88
+ * Stale groups with their company ids, for the cron. Runs with no company in CLS, so the
89
+ * default match spans every company (spec D5: no admin repository).
83
90
  */
84
91
  findAllStaleCommunities(): Promise<{
85
92
  communityId: string;
86
93
  companyId: string;
87
94
  }[]>;
88
95
  /**
89
- * The scope root a community was detected under (its `SCOPED_TO` target),
90
- * for the current company (from CLS). `rootLabels` are the scope-root labels
91
- * the caller knows (the graph catalog's roots); each is read as a typed node
92
- * with its registered model's serialiser. `null` when the community has no
93
- * scope root among them, or no company is in CLS. Both the community and the
94
- * root must belong to the CLS company.
96
+ * The layer root a group was detected under (its SCOPED_TO target), for the current company.
97
+ * `null` on the company layer, with no company in CLS, or when the group has no root.
98
+ *
99
+ * @deprecated rootLabels — accepted and ignored: the layer comes from CommunityLayerService.
95
100
  */
96
101
  findScopeRootForCommunity(params: {
97
102
  communityId: string;
98
- rootLabels: string[];
103
+ rootLabels?: string[];
99
104
  }): Promise<AgentScope | null>;
100
105
  /**
101
- * Delete every community detected under one scope root, for the current
102
- * company (from CLS). Communities of other roots, and unpartitioned ones,
103
- * are left alone. Does nothing when no company is in CLS.
106
+ * Deletes every group detected under one layer root, for the current company. A scope of
107
+ * another type than the layer (or no layer) does nothing; the label comes from the layer.
104
108
  */
105
109
  deleteCommunitiesForScope(params: {
106
110
  scope: AgentScope;
107
111
  }): Promise<void>;
108
- /**
109
- * Update community summary, embedding, and mark as not stale
110
- */
112
+ /** Writes the summary and embedding and clears the stale flag. */
111
113
  updateSummary(params: {
112
114
  communityId: string;
113
115
  name: string;
@@ -115,87 +117,76 @@ export declare class CommunityRepository implements OnModuleInit {
115
117
  embedding: number[];
116
118
  rating: number;
117
119
  }): Promise<void>;
120
+ /** Clears the stale flag without summarising (credit backlog discard). */
121
+ clearStaleness(params: {
122
+ communityIds: string[];
123
+ }): Promise<void>;
118
124
  /**
119
- * Find communities by vector similarity search
120
- * Filters by company from CLS context
121
- */
122
- /**
123
- * FAIL CLOSED on scope. A community summarises many members at once, so a
124
- * single unscoped hit hands the answer content from every scope root it drew
125
- * on. In a scoped run only communities detected within that exact root are
126
- * eligible; a community with no `SCOPED_TO` edge predates the partition and
127
- * is therefore assumed to mix roots.
125
+ * Vector search over the current company's groups.
126
+ *
127
+ * FAIL CLOSED on scope. A group summarises many members at once, so in a scoped chat only
128
+ * groups detected within that exact root are eligible. A chat scoped to a type other than the
129
+ * layer (or any scoped chat on the company layer) gets nothing: its groups mix roots.
128
130
  */
129
131
  findByVector(params: {
130
132
  embedding: number[];
131
133
  topK: number;
132
134
  level?: number;
133
135
  }): Promise<Community[]>;
134
- /**
135
- * Find communities by hierarchy level
136
- * Filters by company from CLS context
137
- */
136
+ /** Groups of one hierarchy level, for the current company. */
138
137
  findByLevel(params: {
139
138
  level: number;
140
139
  }): Promise<Community[]>;
141
- /**
142
- * Find member KeyConcepts for a community
143
- */
140
+ /** Member key concepts of a group. */
144
141
  findMemberKeyConcepts(communityId: string): Promise<{
145
142
  id: string;
146
143
  value: string;
147
144
  description?: string;
148
145
  }[]>;
149
- /**
150
- * Get KeyConceptRelationships between community members
151
- */
146
+ /** KeyConceptRelationships between a group's members. */
152
147
  findMemberRelationships(communityId: string): Promise<{
153
148
  keyConcept1: string;
154
149
  keyConcept2: string;
155
150
  weight: number;
156
151
  }[]>;
157
- /**
158
- * Get parent community chain (hierarchy)
159
- */
152
+ /** The group and its parent chain, top level first. */
160
153
  getHierarchy(communityId: string): Promise<Community[]>;
161
- /**
162
- * Get child communities
163
- */
154
+ /** Child groups of a group. */
164
155
  getChildren(communityId: string): Promise<Community[]>;
165
- /**
166
- * Delete a community and its relationships
167
- */
156
+ /** Deletes one group of the current company. */
168
157
  deleteCommunity(communityId: string): Promise<void>;
169
- /**
170
- * Delete all communities for the current company (from CLS)
171
- */
158
+ /** Deletes every group of the current company. */
172
159
  deleteAllCommunities(): Promise<void>;
173
- /**
174
- * Find communities that contain a specific KeyConcept
175
- */
160
+ /** Groups of the current company that contain a key concept. */
176
161
  findCommunitiesByKeyConcept(keyConceptId: string): Promise<Community[]>;
177
- /**
178
- * Count communities by level for the current company (from CLS)
179
- */
162
+ /** Group counts per level for the current company. */
180
163
  countByLevel(): Promise<{
181
164
  level: number;
182
165
  count: number;
183
166
  }[]>;
184
167
  /**
185
- * Find community by ID with company scope from CLS
168
+ * `findById({ id })` is the inherited read. A bare id string is the pre-descriptor signature,
169
+ * kept so existing callers do not break.
170
+ *
171
+ * @deprecated Passing a bare id string: use `findCommunityById(id)` (returns `null` when missing).
186
172
  */
187
- findById(communityId: string): Promise<Community | null>;
173
+ findById(params: string): Promise<Community | null>;
174
+ findById(params: {
175
+ id: string;
176
+ }): Promise<Community>;
188
177
  /**
189
- * Find communities that contain KeyConcepts related to a given KeyConcept
190
- * Returns affinity scores based on relationship count and weight
178
+ * Ids of the layer's root nodes the current company owns. `[]` on the company layer
179
+ * or with no company in CLS. The label comes from the layer, never from a caller.
191
180
  */
181
+ findLayerRootIds(): Promise<string[]>;
182
+ /** One group of the current company, or `null`. */
183
+ findCommunityById(communityId: string): Promise<Community | null>;
192
184
  /**
193
- * `scopeRoot` keeps incremental assignment inside its partition.
185
+ * Groups holding key concepts related to a given one, with affinity totals.
194
186
  *
195
- * KeyConcept nodes are globally de-duplicated by value, so a concept two
196
- * scope roots happen to share relates to members of BOTH their communities.
197
- * Without this filter the incremental path quietly re-mixes what detection
198
- * partitioned, and the mixing compounds on every ingest.
187
+ * `scopeRoot` keeps incremental assignment inside its partition: key concepts are shared by
188
+ * value, so a concept two roots share relates to members of both their groups. Its `label` is
189
+ * ignored (the layer's is used); with no layer no scope filter applies.
199
190
  */
200
191
  findCommunitiesByRelatedKeyConcepts(keyConceptId: string, scopeRoot?: {
201
192
  id: string;
@@ -206,12 +197,11 @@ export declare class CommunityRepository implements OnModuleInit {
206
197
  relationshipCount: number;
207
198
  totalWeight: number;
208
199
  }[]>;
209
- /**
210
- * Add a single KeyConcept to an existing community
211
- */
200
+ /** Adds one key concept to a group. */
212
201
  addMemberToCommunity(communityId: string, keyConceptId: string): Promise<void>;
213
202
  /**
214
- * Find KeyConcepts from a content that are not in any community
203
+ * Key concepts of one content that are in no group of THIS company. `label` must be a
204
+ * registered model's: an unknown label returns `[]` and never reaches the query text.
215
205
  */
216
206
  findOrphanKeyConceptsForContent(contentId: string, label: string): Promise<string[]>;
217
207
  }
@@ -1 +1 @@
1
- {"version":3,"file":"community.repository.d.ts","sourceRoot":"","sources":["../../../../src/foundations/community/repositories/community.repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,iDAAiD,CAAC;AAC1F,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AACnF,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAGzD;;;;GAIG;AACH,eAAO,MAAM,qCAAqC,OAAO,CAAC;AAE1D,qBACa,mBAAoB,YAAW,YAAY;IAEpD,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAJV,KAAK,EAAE,YAAY,EACnB,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,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;;OAEG;IACG,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAW5D;;OAEG;IACG,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAUzD;;OAEG;IACG,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IAS3C;;OAEG;IACG,2BAA2B,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAY7E;;OAEG;IACG,YAAY,IAAI,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAmBjE;;OAEG;IACG,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;IAU9D;;;OAGG;IACH;;;;;;;OAOG;IACG,mCAAmC,CACvC,YAAY,EAAE,MAAM,EACpB,SAAS,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GACxC,OAAO,CACR;QACE,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,MAAM,CAAC;QACpB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,WAAW,EAAE,MAAM,CAAC;KACrB,EAAE,CACJ;IA8BD;;OAEG;IACG,oBAAoB,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAapF;;OAEG;IACG,+BAA+B,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAW3F"}
1
+ {"version":3,"file":"community.repository.d.ts","sourceRoot":"","sources":["../../../../src/foundations/community/repositories/community.repository.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,EAAE,uBAAuB,EAAE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