mftsccs-node 0.2.7 → 0.2.8

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 (182) hide show
  1. package/README.md +1148 -11
  2. package/dist/bundle.js +1 -1
  3. package/dist/types/Api/Create/CreateTheCharacter.d.ts +42 -0
  4. package/dist/types/Api/Create/CreateTheConceptApi.d.ts +50 -0
  5. package/dist/types/Api/Create/CreateTheConnectionApi.d.ts +51 -0
  6. package/dist/types/Api/Create/CreateTheTextData.d.ts +56 -0
  7. package/dist/types/Api/Delete/DeleteConceptInBackend.d.ts +43 -0
  8. package/dist/types/Api/DeleteConnectionApiBulk.d.ts +55 -0
  9. package/dist/types/Api/DeleteTheConcept.d.ts +64 -0
  10. package/dist/types/Api/DeleteTheConnection.d.ts +76 -0
  11. package/dist/types/Api/GetAiData.d.ts +36 -0
  12. package/dist/types/Api/GetAllConcepts.d.ts +42 -0
  13. package/dist/types/Api/GetAllConceptsByType.d.ts +45 -0
  14. package/dist/types/Api/GetAllConnections.d.ts +48 -0
  15. package/dist/types/Api/GetAllConnectionsOfComposition.d.ts +79 -0
  16. package/dist/types/Api/GetAllConnectionsOfCompositionBulk.d.ts +90 -0
  17. package/dist/types/Api/GetAllLinkerConnectionsFromTheConcept.d.ts +52 -0
  18. package/dist/types/Api/GetAllLinkerConnectionsToTheConcept.d.ts +61 -0
  19. package/dist/types/Api/GetAllPrefetchConnections.d.ts +51 -0
  20. package/dist/types/Api/GetCharacterDataByCharacter.d.ts +31 -0
  21. package/dist/types/Api/GetCompositionConnectionsBetweenTwoConcepts.d.ts +39 -0
  22. package/dist/types/Api/GetConcept.d.ts +47 -0
  23. package/dist/types/Api/GetConceptBulk.d.ts +68 -0
  24. package/dist/types/Api/GetConceptByCharacterAndType.d.ts +75 -0
  25. package/dist/types/Api/GetConceptByCharacterValue.d.ts +47 -0
  26. package/dist/types/Api/GetConnection.d.ts +49 -0
  27. package/dist/types/Api/GetConnectionBulk.d.ts +46 -0
  28. package/dist/types/Api/GetConnectionOfTheConcept.d.ts +50 -0
  29. package/dist/types/Api/GetConnectionToTheConcept.d.ts +56 -0
  30. package/dist/types/Api/GetReservedConnectionIds.d.ts +36 -0
  31. package/dist/types/Api/GetReservedIds.d.ts +37 -0
  32. package/dist/types/Api/Login.d.ts +38 -0
  33. package/dist/types/Api/MakeTheNameInBackend.d.ts +39 -0
  34. package/dist/types/Api/MakeTheTypeConceptApi.d.ts +40 -0
  35. package/dist/types/Api/RecursiveSearch.d.ts +43 -0
  36. package/dist/types/Api/Search/FreeschemaQueryApi.d.ts +46 -0
  37. package/dist/types/Api/Search/Search.d.ts +67 -0
  38. package/dist/types/Api/Search/SearchInternalApi.d.ts +69 -0
  39. package/dist/types/Api/Search/SearchLinkMultipleApi.d.ts +90 -0
  40. package/dist/types/Api/Search/SearchWithLinker.d.ts +97 -0
  41. package/dist/types/Api/SearchConcept/GetConceptByCharacterAndCategoryApi.d.ts +39 -0
  42. package/dist/types/Api/SearchConcept/GetConceptByCharacterAndCategoryDirect.d.ts +47 -0
  43. package/dist/types/Api/Session/CreateSession.d.ts +45 -0
  44. package/dist/types/Api/Session/CreateSessionVisit.d.ts +43 -0
  45. package/dist/types/Api/Signin.d.ts +48 -0
  46. package/dist/types/Api/Signup.d.ts +44 -0
  47. package/dist/types/Api/View/ViewInternalDataApi.d.ts +50 -0
  48. package/dist/types/Constants/ApiConstants.d.ts +226 -0
  49. package/dist/types/Constants/FormatConstants.d.ts +81 -0
  50. package/dist/types/DataStructures/BaseUrl.d.ts +210 -0
  51. package/dist/types/DataStructures/BinaryCharacterTree.d.ts +211 -0
  52. package/dist/types/DataStructures/BinaryTree.d.ts +139 -0
  53. package/dist/types/DataStructures/BinaryTypeTree.d.ts +196 -0
  54. package/dist/types/DataStructures/CharacterRepository.d.ts +109 -0
  55. package/dist/types/DataStructures/Composition/Composition.d.ts +103 -0
  56. package/dist/types/DataStructures/Composition/CompositionBinaryTree.d.ts +104 -0
  57. package/dist/types/DataStructures/Composition/CompositionNode.d.ts +202 -0
  58. package/dist/types/DataStructures/Concept.d.ts +110 -0
  59. package/dist/types/DataStructures/ConceptData.d.ts +292 -0
  60. package/dist/types/DataStructures/ConceptsToDraw.d.ts +168 -0
  61. package/dist/types/DataStructures/Connection.d.ts +76 -0
  62. package/dist/types/DataStructures/ConnectionBinaryTree/ConnectionBinaryTree.d.ts +115 -0
  63. package/dist/types/DataStructures/ConnectionBinaryTree/ConnectionNode.d.ts +169 -0
  64. package/dist/types/DataStructures/ConnectionBinaryTree/ConnectionTypeTree.d.ts +82 -0
  65. package/dist/types/DataStructures/ConnectionData.d.ts +191 -0
  66. package/dist/types/DataStructures/Count/CountInfo.d.ts +73 -0
  67. package/dist/types/DataStructures/FilterSearch.d.ts +84 -0
  68. package/dist/types/DataStructures/IdentifierFlags.d.ts +34 -0
  69. package/dist/types/DataStructures/Local/LConcept.d.ts +105 -0
  70. package/dist/types/DataStructures/Local/LConnection.d.ts +83 -0
  71. package/dist/types/DataStructures/Local/LNode.d.ts +190 -0
  72. package/dist/types/DataStructures/Local/LocalBinaryCharacterTree.d.ts +133 -0
  73. package/dist/types/DataStructures/Local/LocalBinaryTree.d.ts +135 -0
  74. package/dist/types/DataStructures/Local/LocalBinaryTypeTree.d.ts +147 -0
  75. package/dist/types/DataStructures/Local/LocalConceptData.d.ts +100 -0
  76. package/dist/types/DataStructures/Local/LocalConnectionData.d.ts +109 -0
  77. package/dist/types/DataStructures/Local/LocalSyncData.d.ts +89 -0
  78. package/dist/types/DataStructures/PatcherStructure.d.ts +86 -0
  79. package/dist/types/DataStructures/ReferentInfo.d.ts +68 -0
  80. package/dist/types/DataStructures/ReservedIds.d.ts +101 -0
  81. package/dist/types/DataStructures/Responses/ErrorResponse.d.ts +184 -22
  82. package/dist/types/DataStructures/Responses/StandardResponses.d.ts +65 -0
  83. package/dist/types/DataStructures/Returner.d.ts +59 -0
  84. package/dist/types/DataStructures/Search/FreeschemaQuery.d.ts +165 -0
  85. package/dist/types/DataStructures/Search/SearchStructure.d.ts +69 -0
  86. package/dist/types/DataStructures/SearchQuery.d.ts +130 -0
  87. package/dist/types/DataStructures/Security/TokenStorage.d.ts +48 -0
  88. package/dist/types/DataStructures/Session/SessionData.d.ts +118 -0
  89. package/dist/types/DataStructures/SettingData.d.ts +32 -0
  90. package/dist/types/DataStructures/Settings.d.ts +27 -0
  91. package/dist/types/DataStructures/SigninModel.d.ts +50 -0
  92. package/dist/types/DataStructures/SignupModel.d.ts +50 -0
  93. package/dist/types/DataStructures/SyncData.d.ts +206 -0
  94. package/dist/types/DataStructures/TheCharacter.d.ts +87 -0
  95. package/dist/types/DataStructures/TheTexts.d.ts +92 -0
  96. package/dist/types/DataStructures/Transaction/Transaction.d.ts +294 -4
  97. package/dist/types/DataStructures/User/UserBinaryTree.d.ts +117 -0
  98. package/dist/types/DataStructures/User/UserNode.d.ts +130 -0
  99. package/dist/types/Database/GetConceptFromIndexDb.d.ts +9 -0
  100. package/dist/types/Database/NoIndexDb.d.ts +169 -0
  101. package/dist/types/Database/indexdblocal.d.ts +42 -0
  102. package/dist/types/Database/indexeddb.d.ts +43 -0
  103. package/dist/types/Drawing/ConceptDraw.d.ts +28 -0
  104. package/dist/types/Drawing/ConceptEvents.d.ts +46 -0
  105. package/dist/types/Helpers/CheckIfExists.d.ts +159 -0
  106. package/dist/types/Helpers/RemoveFromArray.d.ts +66 -0
  107. package/dist/types/Helpers/UniqueInsert.d.ts +28 -0
  108. package/dist/types/Services/CheckForConnectionDeletion.d.ts +190 -0
  109. package/dist/types/Services/Common/DecodeCountInfo.d.ts +54 -0
  110. package/dist/types/Services/Common/ErrorPosting.d.ts +49 -0
  111. package/dist/types/Services/Common/RegexFunction.d.ts +28 -0
  112. package/dist/types/Services/Composition/BuildComposition.d.ts +37 -0
  113. package/dist/types/Services/Composition/CompositionCache.d.ts +89 -0
  114. package/dist/types/Services/Composition/CreateCompositionCache.d.ts +43 -0
  115. package/dist/types/Services/Conversion/ConvertConcepts.d.ts +83 -0
  116. package/dist/types/Services/CreateBinaryTreeFromData.d.ts +38 -0
  117. package/dist/types/Services/CreateCharacterBinaryTreeFromData.d.ts +42 -0
  118. package/dist/types/Services/CreateConnectionBetweenTwoConcepts.d.ts +206 -0
  119. package/dist/types/Services/CreateDefaultConcept.d.ts +114 -0
  120. package/dist/types/Services/CreateTheComposition.d.ts +101 -0
  121. package/dist/types/Services/CreateTheConcept.d.ts +179 -0
  122. package/dist/types/Services/CreateTheConnection.d.ts +59 -0
  123. package/dist/types/Services/CreateTheConnectionGeneral.d.ts +127 -0
  124. package/dist/types/Services/CreateTypeTreeFromData.d.ts +43 -0
  125. package/dist/types/Services/Delete/DeleteConnectionByType.d.ts +52 -5
  126. package/dist/types/Services/Delete/GetAllConnectionByType.d.ts +57 -9
  127. package/dist/types/Services/DeleteConcept.d.ts +136 -0
  128. package/dist/types/Services/DeleteConnection.d.ts +194 -0
  129. package/dist/types/Services/FindConeceptsFromConnection.d.ts +179 -0
  130. package/dist/types/Services/FindConnectionsOfCompositionBulkInMemory.d.ts +157 -0
  131. package/dist/types/Services/GenerateHexNumber.d.ts +64 -0
  132. package/dist/types/Services/GetComposition.d.ts +331 -0
  133. package/dist/types/Services/GetCompositionBulk.d.ts +251 -3
  134. package/dist/types/Services/GetCompositionList.d.ts +130 -0
  135. package/dist/types/Services/GetConceptByCharacter.d.ts +84 -0
  136. package/dist/types/Services/GetConnections.d.ts +72 -0
  137. package/dist/types/Services/GetDataFromIndexDb.d.ts +79 -0
  138. package/dist/types/Services/GetLink.d.ts +104 -0
  139. package/dist/types/Services/GetLinkerConnectionFromConcept.d.ts +99 -0
  140. package/dist/types/Services/GetMaximumConnectionSyncTime.d.ts +57 -0
  141. package/dist/types/Services/GetRelation.d.ts +162 -0
  142. package/dist/types/Services/GetTheConcept.d.ts +71 -0
  143. package/dist/types/Services/GetTheReferent.d.ts +74 -0
  144. package/dist/types/Services/InitializeSystem.d.ts +119 -0
  145. package/dist/types/Services/Local/CreateDefaultLConcept.d.ts +48 -0
  146. package/dist/types/Services/Local/CreateLocalBinaryTreeFromData.d.ts +49 -0
  147. package/dist/types/Services/Local/CreateLocalBinaryTypeTreeFromData.d.ts +54 -0
  148. package/dist/types/Services/Local/CreateLocalCharacterBinaryTree.d.ts +60 -0
  149. package/dist/types/Services/Local/CreateTheCompositionLocal.d.ts +70 -0
  150. package/dist/types/Services/Local/CreateTheConceptLocal.d.ts +58 -0
  151. package/dist/types/Services/Local/CreateTheConnectionLocal.d.ts +56 -0
  152. package/dist/types/Services/Local/GetCompositionListLocal.d.ts +103 -0
  153. package/dist/types/Services/Local/GetCompositionLocal.d.ts +96 -0
  154. package/dist/types/Services/Local/GetConceptByCharacterLocal.d.ts +57 -0
  155. package/dist/types/Services/Local/MakeTheConceptLocal.d.ts +71 -0
  156. package/dist/types/Services/Local/MakeTheInstanceConceptLocal.d.ts +89 -0
  157. package/dist/types/Services/Local/MakeTheTypeLocal.d.ts +71 -0
  158. package/dist/types/Services/Local/UpdateCompositionLocal.d.ts +101 -0
  159. package/dist/types/Services/MakeTheCharacter.d.ts +74 -0
  160. package/dist/types/Services/MakeTheCharacterData.d.ts +65 -0
  161. package/dist/types/Services/MakeTheInstanceConcept.d.ts +75 -0
  162. package/dist/types/Services/MakeTheName.d.ts +81 -0
  163. package/dist/types/Services/MakeTheTimestamp.d.ts +68 -0
  164. package/dist/types/Services/MakeTheTypeConcept.d.ts +68 -0
  165. package/dist/types/Services/Mqtt/publishMessage.d.ts +27 -0
  166. package/dist/types/Services/Mqtt/subscribeMessage.d.ts +23 -0
  167. package/dist/types/Services/PatchComposition.d.ts +105 -0
  168. package/dist/types/Services/Search/DataIdFormat.d.ts +96 -24
  169. package/dist/types/Services/Search/FormatData.d.ts +92 -17
  170. package/dist/types/Services/Search/JustIdFormat.d.ts +91 -16
  171. package/dist/types/Services/Search/NewFormat.d.ts +4 -0
  172. package/dist/types/Services/Search/SearchLinkInternal.d.ts +28 -0
  173. package/dist/types/Services/Search/SearchLinkMultiple.d.ts +58 -0
  174. package/dist/types/Services/Search/SearchWithTypeAndLinker.d.ts +92 -24
  175. package/dist/types/Services/Search/orderingConnections.d.ts +34 -0
  176. package/dist/types/Services/SplitStrings.d.ts +50 -0
  177. package/dist/types/Services/UpdateComposition.d.ts +123 -0
  178. package/dist/types/Services/User/UserTranslation.d.ts +102 -0
  179. package/dist/types/Services/View/ViewInternalData.d.ts +32 -0
  180. package/dist/types/WrapperFunctions/SchemaQueryObservable.d.ts +140 -5
  181. package/dist/types/app.d.ts +72 -1
  182. package/package.json +1 -1
@@ -1,12 +1,145 @@
1
+ /**
2
+ * @fileoverview Local Binary Character Tree for managing concepts indexed by character value.
3
+ * This module provides a specialized binary tree implementation for efficient character-based lookups.
4
+ * @module DataStructures/Local/LocalBinaryCharacterTree
5
+ */
1
6
  import { LConcept } from "../../DataStructures/Local/LConcept";
2
7
  import { LNode } from "./../Local/LNode";
8
+ /**
9
+ * Binary tree data structure for managing local concepts indexed by character values.
10
+ *
11
+ * @remarks
12
+ * This class implements an AVL tree specifically optimized for character-based lookups.
13
+ * Unlike LocalBinaryTree which uses numeric IDs, this tree uses character values as keys,
14
+ * enabling efficient string-based searches with O(log n) complexity.
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * const concept = new LConcept(123, "example", 1);
19
+ * LocalBinaryCharacterTree.addConceptToTree(concept);
20
+ * const node = LocalBinaryCharacterTree.getNodeFromTree("example");
21
+ * ```
22
+ */
3
23
  export declare class LocalBinaryCharacterTree {
24
+ /**
25
+ * The root node of the character-indexed binary tree.
26
+ * Null if the tree is empty.
27
+ */
4
28
  static LocalCharacterRoot: LNode | null;
29
+ /**
30
+ * Waits for local character data to be loaded into the tree.
31
+ *
32
+ * @returns A promise that resolves with "done" when data is loaded, or rejects with "not" after 25 seconds
33
+ *
34
+ * @remarks
35
+ * This method polls the IdentifierFlags.isLocalCharacterLoaded flag every second.
36
+ * Useful for ensuring data is ready before performing operations on the tree.
37
+ *
38
+ * @example
39
+ * ```typescript
40
+ * try {
41
+ * await LocalBinaryCharacterTree.waitForDataToLoad();
42
+ * console.log("Character data loaded");
43
+ * } catch (error) {
44
+ * console.log("Loading timed out");
45
+ * }
46
+ * ```
47
+ */
5
48
  static waitForDataToLoad(): Promise<unknown>;
49
+ /**
50
+ * Periodically checks if local character data has been loaded.
51
+ *
52
+ * @param resolve - The promise resolve function to call when data is loaded
53
+ *
54
+ * @remarks
55
+ * This method recursively checks the IdentifierFlags.isLocalCharacterLoaded flag every 1000ms.
56
+ */
6
57
  static checkFlag(resolve: any): any;
58
+ /**
59
+ * Adds a node to the character-indexed binary tree.
60
+ *
61
+ * @param node - The LNode to be added to the tree (keyed by character value)
62
+ * @returns The root node after insertion
63
+ *
64
+ * @remarks
65
+ * If the tree is empty, the provided node becomes the root.
66
+ * Otherwise, uses the addCharacterNode method for character-based insertion.
67
+ *
68
+ * @example
69
+ * ```typescript
70
+ * const node = new LNode("example", concept, null, null);
71
+ * await LocalBinaryCharacterTree.addNodeToTree(node);
72
+ * ```
73
+ */
7
74
  static addNodeToTree(node: LNode): Promise<LNode | null>;
75
+ /**
76
+ * Creates a node from a concept and adds it to the character tree.
77
+ *
78
+ * @param concept - The LConcept object to be added to the tree
79
+ *
80
+ * @remarks
81
+ * Only adds the concept if it has a non-empty characterValue.
82
+ * The node is keyed by the concept's character value.
83
+ *
84
+ * @example
85
+ * ```typescript
86
+ * const concept = new LConcept(123, "example", 1);
87
+ * LocalBinaryCharacterTree.addConceptToTree(concept);
88
+ * ```
89
+ */
8
90
  static addConceptToTree(concept: LConcept): void;
91
+ /**
92
+ * Retrieves a node from the tree by its character value.
93
+ *
94
+ * @param value - The character string to search for
95
+ * @returns The LNode if found, the root node otherwise
96
+ *
97
+ * @remarks
98
+ * Performs a binary search through the tree using the character value as the key.
99
+ *
100
+ * @example
101
+ * ```typescript
102
+ * const node = LocalBinaryCharacterTree.getNodeFromTree("example");
103
+ * if (node) {
104
+ * console.log("Found concept:", node.value);
105
+ * }
106
+ * ```
107
+ */
9
108
  static getNodeFromTree(value: string): LNode | null;
109
+ /**
110
+ * Retrieves a node by matching both character value and type ID.
111
+ *
112
+ * @param value - The character value to search for
113
+ * @param typeId - The type ID to match
114
+ * @returns The matching LNode if found, the root node otherwise
115
+ *
116
+ * @remarks
117
+ * This method searches for a node that matches both the character value and type ID,
118
+ * useful for finding specific concept variants.
119
+ *
120
+ * @example
121
+ * ```typescript
122
+ * const node = await LocalBinaryCharacterTree.getCharacterAndTypeFromTree("example", 5);
123
+ * if (node) {
124
+ * console.log("Found matching concept:", node.value);
125
+ * }
126
+ * ```
127
+ */
10
128
  static getCharacterAndTypeFromTree(value: string, typeId: number): Promise<LNode | null>;
129
+ /**
130
+ * Removes a concept variant from the tree.
131
+ *
132
+ * @param character - The character value identifying the node
133
+ * @param id - The concept ID to remove
134
+ *
135
+ * @remarks
136
+ * This method removes a specific variant from a node while maintaining other variants.
137
+ * If the node has no remaining variants, the entire node is removed.
138
+ *
139
+ * @example
140
+ * ```typescript
141
+ * LocalBinaryCharacterTree.removeConceptType("example", 123);
142
+ * ```
143
+ */
11
144
  static removeConceptType(character: string, id: number): void;
12
145
  }
@@ -1,12 +1,147 @@
1
+ /**
2
+ * @fileoverview Local Binary Tree data structure for managing local concepts.
3
+ * This module provides a binary tree implementation for storing and retrieving LConcept objects
4
+ * using an AVL tree structure for balanced performance.
5
+ * @module DataStructures/Local/LocalBinaryTree
6
+ */
1
7
  import { LConcept } from "../../DataStructures/Local/LConcept";
2
8
  import { LNode } from "./../Local/LNode";
9
+ /**
10
+ * Binary tree data structure for managing local concepts with efficient lookup by ID.
11
+ *
12
+ * @remarks
13
+ * This class implements a self-balancing binary search tree (AVL tree) for storing local concepts.
14
+ * It provides O(log n) search, insertion, and deletion operations. The tree is keyed by concept ID
15
+ * and supports asynchronous data loading with timeout capabilities.
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * const concept = new LConcept(123, "example", 1);
20
+ * LocalBinaryTree.addConceptToTree(concept);
21
+ * const node = await LocalBinaryTree.getNodeFromTree(123);
22
+ * ```
23
+ */
3
24
  export declare class LocalBinaryTree {
25
+ /**
26
+ * The root node of the binary tree.
27
+ * Null if the tree is empty.
28
+ */
4
29
  static root: LNode | null;
30
+ /**
31
+ * Adds a node to the binary tree.
32
+ *
33
+ * @param node - The LNode to be added to the tree
34
+ * @returns The root node after insertion
35
+ *
36
+ * @remarks
37
+ * If the tree is empty, the provided node becomes the root.
38
+ * Otherwise, the node is inserted at the appropriate position using the AVL tree algorithm.
39
+ *
40
+ * @example
41
+ * ```typescript
42
+ * const node = new LNode(123, concept, null, null);
43
+ * LocalBinaryTree.addNodeToTree(node);
44
+ * ```
45
+ */
5
46
  static addNodeToTree(node: LNode): LNode | undefined;
47
+ /**
48
+ * Creates a node from a concept and adds it to the tree.
49
+ *
50
+ * @param concept - The LConcept object to be added to the tree
51
+ *
52
+ * @remarks
53
+ * This is a convenience method that creates an LNode from the concept and adds it to the tree.
54
+ * The node is keyed by the concept's ID.
55
+ *
56
+ * @example
57
+ * ```typescript
58
+ * const concept = new LConcept(123, "example", 1);
59
+ * LocalBinaryTree.addConceptToTree(concept);
60
+ * ```
61
+ */
6
62
  static addConceptToTree(concept: LConcept): void;
63
+ /**
64
+ * Waits for local data to be loaded into the tree.
65
+ *
66
+ * @returns A promise that resolves with "done" when data is loaded, or rejects with "not" after 25 seconds
67
+ *
68
+ * @remarks
69
+ * This method polls the IdentifierFlags.isLocalDataLoaded flag every second until it's true.
70
+ * If data isn't loaded within 25 seconds, the promise is rejected.
71
+ *
72
+ * @example
73
+ * ```typescript
74
+ * try {
75
+ * await LocalBinaryTree.waitForDataToLoad();
76
+ * console.log("Data loaded successfully");
77
+ * } catch (error) {
78
+ * console.log("Data loading timed out");
79
+ * }
80
+ * ```
81
+ */
7
82
  static waitForDataToLoad(): Promise<unknown>;
83
+ /**
84
+ * Periodically checks if local data has been loaded.
85
+ *
86
+ * @param resolve - The promise resolve function to call when data is loaded
87
+ *
88
+ * @remarks
89
+ * This method is called recursively every 1000ms until the data is loaded.
90
+ * It checks the IdentifierFlags.isLocalDataLoaded flag.
91
+ */
8
92
  static checkFlag(resolve: any): any;
93
+ /**
94
+ * Retrieves a node from the tree by its ID.
95
+ *
96
+ * @param id - The numeric ID of the node to retrieve
97
+ * @returns The LNode if found, null otherwise
98
+ *
99
+ * @remarks
100
+ * This method performs a binary search through the tree using the concept ID as the key.
101
+ * The search has O(log n) time complexity in a balanced tree.
102
+ *
103
+ * @example
104
+ * ```typescript
105
+ * const node = await LocalBinaryTree.getNodeFromTree(123);
106
+ * if (node) {
107
+ * console.log("Found concept:", node.value);
108
+ * }
109
+ * ```
110
+ */
9
111
  static getNodeFromTree(id: number): Promise<LNode | null>;
112
+ /**
113
+ * Retrieves a node by matching both character value and type ID.
114
+ *
115
+ * @param value - The character value to search for
116
+ * @param typeId - The type ID to match
117
+ * @returns The matching LNode if found, the root node otherwise
118
+ *
119
+ * @remarks
120
+ * This method searches for a node that matches both the character value and type ID.
121
+ * It's useful for finding specific concept variants.
122
+ *
123
+ * @example
124
+ * ```typescript
125
+ * const node = LocalBinaryTree.getCharacterAndTypeFromTree("example", 5);
126
+ * if (node) {
127
+ * console.log("Found matching concept:", node.value);
128
+ * }
129
+ * ```
130
+ */
10
131
  static getCharacterAndTypeFromTree(value: string, typeId: number): LNode | null;
132
+ /**
133
+ * Removes a node from the tree by its ID.
134
+ *
135
+ * @param id - The numeric ID of the node to remove
136
+ *
137
+ * @remarks
138
+ * This method removes a node from the tree while maintaining the AVL tree balance.
139
+ * The tree is automatically rebalanced after removal.
140
+ *
141
+ * @example
142
+ * ```typescript
143
+ * await LocalBinaryTree.removeNodeFromTree(123);
144
+ * ```
145
+ */
11
146
  static removeNodeFromTree(id: number): Promise<void>;
12
147
  }
@@ -1,13 +1,160 @@
1
+ /**
2
+ * @fileoverview Local Binary Type Tree for managing concepts indexed by type ID.
3
+ * This module provides a specialized binary tree for efficient type-based concept lookups and variant retrieval.
4
+ * @module DataStructures/Local/LocalBinaryTypeTree
5
+ */
1
6
  import { LConcept } from "../../DataStructures/Local/LConcept";
2
7
  import { LNode } from "./LNode";
8
+ /**
9
+ * Binary tree data structure for managing local concepts indexed by type ID.
10
+ *
11
+ * @remarks
12
+ * This class implements an AVL tree optimized for type-based lookups, enabling efficient
13
+ * retrieval of all concepts of a specific type. It supports variant management, allowing
14
+ * multiple concepts to share the same type while being stored efficiently.
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * const concept = new LConcept(123, "example", 5);
19
+ * LocalBinaryTypeTree.addConceptToTree(concept);
20
+ * const variants = LocalBinaryTypeTree.getTypeVariantsFromTree(5);
21
+ * ```
22
+ */
3
23
  export declare class LocalBinaryTypeTree {
24
+ /**
25
+ * The root node of the type-indexed binary tree.
26
+ * Null if the tree is empty.
27
+ */
4
28
  static LocalTypeRoot: LNode | null;
29
+ /**
30
+ * Adds a node to the type-indexed binary tree.
31
+ *
32
+ * @param node - The LNode to be added to the tree (keyed by type ID)
33
+ * @returns The root node after insertion
34
+ *
35
+ * @remarks
36
+ * If the tree is empty, the provided node becomes the root.
37
+ * Otherwise, uses the addTypeNode method for type-based insertion with variant support.
38
+ *
39
+ * @example
40
+ * ```typescript
41
+ * const node = new LNode(5, concept, null, null);
42
+ * await LocalBinaryTypeTree.addNodeToTree(node);
43
+ * ```
44
+ */
5
45
  static addNodeToTree(node: LNode): Promise<LNode | null>;
46
+ /**
47
+ * Creates a node from a concept and adds it to the type tree.
48
+ *
49
+ * @param concept - The LConcept object to be added to the tree
50
+ *
51
+ * @remarks
52
+ * Only adds the concept if it has a non-zero typeId.
53
+ * The node is keyed by the concept's type ID.
54
+ *
55
+ * @example
56
+ * ```typescript
57
+ * const concept = new LConcept(123, "example", 5);
58
+ * LocalBinaryTypeTree.addConceptToTree(concept);
59
+ * ```
60
+ */
6
61
  static addConceptToTree(concept: LConcept): void;
62
+ /**
63
+ * Removes a specific concept variant from the tree.
64
+ *
65
+ * @param typeId - The type ID identifying the node
66
+ * @param id - The concept ID to remove
67
+ *
68
+ * @remarks
69
+ * This method removes a specific variant from a node while maintaining other variants.
70
+ * If the node has no remaining variants, the entire node is removed.
71
+ *
72
+ * @example
73
+ * ```typescript
74
+ * LocalBinaryTypeTree.removeConceptType(5, 123);
75
+ * ```
76
+ */
7
77
  static removeConceptType(typeId: number, id: number): void;
78
+ /**
79
+ * Retrieves a node from the tree by its type ID.
80
+ *
81
+ * @param id - The numeric type ID to search for
82
+ * @returns The LNode if found, the root node otherwise
83
+ *
84
+ * @remarks
85
+ * Performs a binary search through the tree using the type ID as the key.
86
+ *
87
+ * @example
88
+ * ```typescript
89
+ * const node = LocalBinaryTypeTree.getNodeFromTree(5);
90
+ * if (node) {
91
+ * console.log("Found type node with variants:", node.variants.length);
92
+ * }
93
+ * ```
94
+ */
8
95
  static getNodeFromTree(id: number): LNode | null;
96
+ /**
97
+ * Retrieves all concept variants for a specific type ID.
98
+ *
99
+ * @param typeId - The type ID to search for
100
+ * @returns An array of LConcept objects of the specified type
101
+ *
102
+ * @remarks
103
+ * This method retrieves the primary concept and all its variants that share the same type ID.
104
+ * Useful for getting all concepts of a particular type in one operation.
105
+ *
106
+ * @example
107
+ * ```typescript
108
+ * const concepts = LocalBinaryTypeTree.getTypeVariantsFromTree(5);
109
+ * console.log(`Found ${concepts.length} concepts of type 5`);
110
+ * ```
111
+ */
9
112
  static getTypeVariantsFromTree(typeId: number): LConcept[] | undefined;
113
+ /**
114
+ * Waits for local type data to be loaded into the tree.
115
+ *
116
+ * @returns A promise that resolves with "done" when data is loaded, or rejects with "not" after 25 seconds
117
+ *
118
+ * @remarks
119
+ * This method polls the IdentifierFlags.isLocalTypeLoaded flag every second.
120
+ * Ensures type data is ready before performing operations.
121
+ *
122
+ * @example
123
+ * ```typescript
124
+ * try {
125
+ * await LocalBinaryTypeTree.waitForDataToLoad();
126
+ * console.log("Type data loaded");
127
+ * } catch (error) {
128
+ * console.log("Loading timed out");
129
+ * }
130
+ * ```
131
+ */
10
132
  static waitForDataToLoad(): Promise<unknown>;
133
+ /**
134
+ * Periodically checks if local type data has been loaded.
135
+ *
136
+ * @param resolve - The promise resolve function to call when data is loaded
137
+ *
138
+ * @remarks
139
+ * This method recursively checks the IdentifierFlags.isLocalTypeLoaded flag every 1000ms.
140
+ */
11
141
  static checkFlag(resolve: any): any;
142
+ /**
143
+ * Retrieves all concept variants for a specific type ID filtered by user ID.
144
+ *
145
+ * @param typeId - The type ID to search for
146
+ * @param userId - The user ID to filter by
147
+ * @returns An array of LConcept objects of the specified type belonging to the specified user
148
+ *
149
+ * @remarks
150
+ * This method retrieves all concepts of a given type that belong to a specific user.
151
+ * Useful for user-specific concept management and filtering.
152
+ *
153
+ * @example
154
+ * ```typescript
155
+ * const userConcepts = await LocalBinaryTypeTree.getTypeVariantsFromTreeWithUserId(5, 42);
156
+ * console.log(`Found ${userConcepts.length} concepts of type 5 for user 42`);
157
+ * ```
158
+ */
12
159
  static getTypeVariantsFromTreeWithUserId(typeId: number, userId: number): Promise<LConcept[]>;
13
160
  }
@@ -1,14 +1,114 @@
1
+ /**
2
+ * @fileoverview Local Concepts Data management for the Concept Connection System.
3
+ * This module provides static methods for managing local concept data, including
4
+ * adding, retrieving, and querying concepts from local binary trees and memory.
5
+ * @module DataStructures/Local/LocalConceptData
6
+ */
1
7
  import { LConcept } from "./../Local/LConcept";
8
+ /**
9
+ * Manages local concept data storage and retrieval.
10
+ * Provides static methods for managing concepts in memory and across multiple
11
+ * binary tree structures for efficient querying.
12
+ *
13
+ * @class LocalConceptsData
14
+ * @export
15
+ */
2
16
  export declare class LocalConceptsData {
17
+ /**
18
+ * Name identifier for this data structure.
19
+ * @type {string}
20
+ */
3
21
  name: string;
22
+ /**
23
+ * Creates a new LocalConceptsData instance.
24
+ *
25
+ * @constructor
26
+ */
4
27
  constructor();
28
+ /**
29
+ * Static array storing all local concepts in memory.
30
+ * @type {LConcept[]}
31
+ * @static
32
+ */
5
33
  static localconceptsArray: LConcept[];
34
+ /**
35
+ * Adds a concept to the local storage system.
36
+ * Stores the concept in the database and adds it to all relevant binary trees.
37
+ *
38
+ * @static
39
+ * @method AddConcept
40
+ * @param {LConcept} concept - The concept to add
41
+ * @returns {void}
42
+ */
6
43
  static AddConcept(concept: LConcept): void;
44
+ /**
45
+ * Adds a concept to memory only (without database storage).
46
+ * Updates all relevant binary trees for fast lookups.
47
+ *
48
+ * @static
49
+ * @method AddConceptToMemory
50
+ * @param {LConcept} concept - The concept to add to memory
51
+ * @returns {void}
52
+ */
7
53
  static AddConceptToMemory(concept: LConcept): void;
54
+ /**
55
+ * Retrieves a concept by its ID from the local binary tree.
56
+ *
57
+ * @static
58
+ * @async
59
+ * @method GetConcept
60
+ * @param {number} id - The ID of the concept to retrieve
61
+ * @returns {Promise<LConcept>} The concept if found, otherwise a default concept
62
+ */
8
63
  static GetConcept(id: number): Promise<LConcept>;
64
+ /**
65
+ * Retrieves a concept by its character value.
66
+ *
67
+ * @static
68
+ * @async
69
+ * @method GetConceptByCharacter
70
+ * @param {string} characterValue - The character value to search for
71
+ * @returns {Promise<LConcept>} The concept if found, otherwise a default concept
72
+ */
9
73
  static GetConceptByCharacter(characterValue: string): Promise<LConcept>;
74
+ /**
75
+ * Retrieves a concept by both character value and type ID.
76
+ * Useful for finding specific concepts when multiple concepts share the same character value.
77
+ *
78
+ * @static
79
+ * @async
80
+ * @method GetConceptByCharacterAndTypeLocal
81
+ * @param {string} character_value - The character value to search for
82
+ * @param {number} typeId - The type ID to match
83
+ * @returns {Promise<LConcept>} The concept if found, otherwise a default concept
84
+ */
10
85
  static GetConceptByCharacterAndTypeLocal(character_value: string, typeId: number): Promise<LConcept>;
86
+ /**
87
+ * Retrieves all concepts of a specific type.
88
+ *
89
+ * @static
90
+ * @method GetConceptsByTypeId
91
+ * @param {number} typeId - The type ID to filter by
92
+ * @returns {LConcept[]} Array of concepts with the specified type
93
+ */
11
94
  static GetConceptsByTypeId(typeId: number): LConcept[];
95
+ /**
96
+ * Retrieves concepts filtered by both type ID and user ID.
97
+ * Useful for multi-user environments.
98
+ *
99
+ * @static
100
+ * @async
101
+ * @method GetConceptsByTypeIdAndUser
102
+ * @param {number} typeId - The type ID to filter by
103
+ * @param {number} userId - The user ID to filter by
104
+ * @returns {Promise<LConcept[]>} Array of concepts matching both criteria
105
+ */
12
106
  static GetConceptsByTypeIdAndUser(typeId: number, userId: number): Promise<LConcept[]>;
107
+ /**
108
+ * Gets the name of this data structure.
109
+ *
110
+ * @method getName
111
+ * @returns {string} The name identifier
112
+ */
13
113
  getName(): string;
14
114
  }
@@ -1,16 +1,125 @@
1
+ /**
2
+ * @fileoverview Local Connection Data management for the Concept Connection System.
3
+ * This module provides static methods for managing local connection data, including
4
+ * adding, removing, and retrieving connections from memory and database storage.
5
+ * @module DataStructures/Local/LocalConnectionData
6
+ */
1
7
  import { LConnection } from "./LConnection";
8
+ /**
9
+ * Manages local connection data storage and retrieval.
10
+ * Provides static methods for managing connections in memory and database,
11
+ * with support for querying connections by composition and waiting for data loads.
12
+ *
13
+ * @class LocalConnectionData
14
+ * @export
15
+ */
2
16
  export declare class LocalConnectionData {
17
+ /**
18
+ * Name identifier for this data structure.
19
+ * @type {string}
20
+ */
3
21
  name: string;
22
+ /**
23
+ * Creates a new LocalConnectionData instance.
24
+ *
25
+ * @constructor
26
+ */
4
27
  constructor();
28
+ /**
29
+ * Static array storing all local connections in memory.
30
+ * @type {LConnection[]}
31
+ * @static
32
+ */
5
33
  static connectionArray: LConnection[];
34
+ /**
35
+ * Static dictionary/map for fast connection lookups by ID.
36
+ * @type {LConnection[]}
37
+ * @static
38
+ */
6
39
  static connectionDictionary: LConnection[];
40
+ /**
41
+ * Checks if a connection already exists in the array.
42
+ *
43
+ * @static
44
+ * @method CheckContains
45
+ * @param {LConnection} connection - The connection to check
46
+ * @returns {boolean} True if the connection exists, false otherwise
47
+ */
7
48
  static CheckContains(connection: LConnection): boolean;
49
+ /**
50
+ * Adds a connection to the local storage system.
51
+ * If the connection already exists, it is removed and re-added.
52
+ * Stores non-temporary connections with valid IDs to the database.
53
+ *
54
+ * @static
55
+ * @method AddConnection
56
+ * @param {LConnection} connection - The connection to add
57
+ * @returns {void}
58
+ */
8
59
  static AddConnection(connection: LConnection): void;
60
+ /**
61
+ * Adds a connection to the fast lookup dictionary.
62
+ *
63
+ * @static
64
+ * @method AddToDictionary
65
+ * @param {LConnection} connection - The connection to add to dictionary
66
+ * @returns {void}
67
+ */
9
68
  static AddToDictionary(connection: LConnection): void;
69
+ /**
70
+ * Removes a connection from the local storage system.
71
+ * Removes from both the array and the database (if it has a valid ID).
72
+ *
73
+ * @static
74
+ * @method RemoveConnection
75
+ * @param {LConnection} connection - The connection to remove
76
+ * @returns {void}
77
+ */
10
78
  static RemoveConnection(connection: LConnection): void;
79
+ /**
80
+ * Retrieves a connection by its ID.
81
+ *
82
+ * @static
83
+ * @method GetConnection
84
+ * @param {number} id - The ID of the connection to retrieve
85
+ * @returns {LConnection | null} The connection if found, null otherwise
86
+ */
11
87
  static GetConnection(id: number): LConnection | null;
88
+ /**
89
+ * Waits for the local connection data to finish loading.
90
+ * Uses a polling mechanism to check the loading flag.
91
+ *
92
+ * @static
93
+ * @async
94
+ * @method waitForDataToLoad
95
+ * @returns {Promise<string>} Resolves with "done" when loaded, rejects after 25 seconds
96
+ */
12
97
  static waitForDataToLoad(): Promise<unknown>;
98
+ /**
99
+ * Polling function that checks if connection data has finished loading.
100
+ *
101
+ * @static
102
+ * @method checkFlag
103
+ * @param {Function} resolve - The promise resolve function
104
+ * @returns {*} Resolves immediately if loaded, otherwise schedules next check
105
+ */
13
106
  static checkFlag(resolve: any): any;
107
+ /**
108
+ * Retrieves all connections of a specific composition (by type ID).
109
+ * Waits for data to load if necessary.
110
+ *
111
+ * @static
112
+ * @async
113
+ * @method GetConnectionsOfCompositionLocal
114
+ * @param {number} id - The composition type ID to filter by
115
+ * @returns {Promise<LConnection[]>} Array of connections with the specified type
116
+ */
14
117
  static GetConnectionsOfCompositionLocal(id: number): Promise<LConnection[]>;
118
+ /**
119
+ * Gets the name of this data structure.
120
+ *
121
+ * @method getName
122
+ * @returns {string} The name identifier
123
+ */
15
124
  getName(): string;
16
125
  }