mftsccs-node 0.0.57 → 0.0.58

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 (180) hide show
  1. package/README.md +1148 -11
  2. package/dist/types/Api/Create/CreateTheCharacter.d.ts +42 -0
  3. package/dist/types/Api/Create/CreateTheConceptApi.d.ts +50 -0
  4. package/dist/types/Api/Create/CreateTheConnectionApi.d.ts +51 -0
  5. package/dist/types/Api/Create/CreateTheTextData.d.ts +56 -0
  6. package/dist/types/Api/Delete/DeleteConceptInBackend.d.ts +43 -0
  7. package/dist/types/Api/DeleteConnectionApiBulk.d.ts +55 -0
  8. package/dist/types/Api/DeleteTheConcept.d.ts +64 -0
  9. package/dist/types/Api/DeleteTheConnection.d.ts +76 -0
  10. package/dist/types/Api/GetAiData.d.ts +36 -0
  11. package/dist/types/Api/GetAllConcepts.d.ts +42 -0
  12. package/dist/types/Api/GetAllConceptsByType.d.ts +45 -0
  13. package/dist/types/Api/GetAllConnections.d.ts +48 -0
  14. package/dist/types/Api/GetAllConnectionsOfComposition.d.ts +79 -0
  15. package/dist/types/Api/GetAllConnectionsOfCompositionBulk.d.ts +90 -0
  16. package/dist/types/Api/GetAllLinkerConnectionsFromTheConcept.d.ts +52 -0
  17. package/dist/types/Api/GetAllLinkerConnectionsToTheConcept.d.ts +61 -0
  18. package/dist/types/Api/GetAllPrefetchConnections.d.ts +51 -0
  19. package/dist/types/Api/GetCharacterDataByCharacter.d.ts +31 -0
  20. package/dist/types/Api/GetCompositionConnectionsBetweenTwoConcepts.d.ts +39 -0
  21. package/dist/types/Api/GetConcept.d.ts +47 -0
  22. package/dist/types/Api/GetConceptBulk.d.ts +68 -0
  23. package/dist/types/Api/GetConceptByCharacterAndType.d.ts +75 -0
  24. package/dist/types/Api/GetConceptByCharacterValue.d.ts +47 -0
  25. package/dist/types/Api/GetConnection.d.ts +49 -0
  26. package/dist/types/Api/GetConnectionBulk.d.ts +46 -0
  27. package/dist/types/Api/GetConnectionOfTheConcept.d.ts +50 -0
  28. package/dist/types/Api/GetConnectionToTheConcept.d.ts +56 -0
  29. package/dist/types/Api/GetReservedConnectionIds.d.ts +36 -0
  30. package/dist/types/Api/GetReservedIds.d.ts +37 -0
  31. package/dist/types/Api/Login.d.ts +38 -0
  32. package/dist/types/Api/MakeTheNameInBackend.d.ts +39 -0
  33. package/dist/types/Api/MakeTheTypeConceptApi.d.ts +40 -0
  34. package/dist/types/Api/RecursiveSearch.d.ts +43 -0
  35. package/dist/types/Api/Search/FreeschemaQueryApi.d.ts +46 -0
  36. package/dist/types/Api/Search/Search.d.ts +67 -0
  37. package/dist/types/Api/Search/SearchInternalApi.d.ts +69 -0
  38. package/dist/types/Api/Search/SearchLinkMultipleApi.d.ts +90 -0
  39. package/dist/types/Api/Search/SearchWithLinker.d.ts +97 -0
  40. package/dist/types/Api/SearchConcept/GetConceptByCharacterAndCategoryApi.d.ts +39 -0
  41. package/dist/types/Api/SearchConcept/GetConceptByCharacterAndCategoryDirect.d.ts +47 -0
  42. package/dist/types/Api/Session/CreateSession.d.ts +45 -0
  43. package/dist/types/Api/Session/CreateSessionVisit.d.ts +43 -0
  44. package/dist/types/Api/Signin.d.ts +48 -0
  45. package/dist/types/Api/Signup.d.ts +44 -0
  46. package/dist/types/Api/View/ViewInternalDataApi.d.ts +50 -0
  47. package/dist/types/Constants/ApiConstants.d.ts +226 -0
  48. package/dist/types/Constants/FormatConstants.d.ts +80 -0
  49. package/dist/types/DataStructures/BaseUrl.d.ts +210 -0
  50. package/dist/types/DataStructures/BinaryCharacterTree.d.ts +211 -0
  51. package/dist/types/DataStructures/BinaryTree.d.ts +139 -0
  52. package/dist/types/DataStructures/BinaryTypeTree.d.ts +196 -0
  53. package/dist/types/DataStructures/CharacterRepository.d.ts +109 -0
  54. package/dist/types/DataStructures/Composition/Composition.d.ts +103 -0
  55. package/dist/types/DataStructures/Composition/CompositionBinaryTree.d.ts +104 -0
  56. package/dist/types/DataStructures/Composition/CompositionNode.d.ts +202 -0
  57. package/dist/types/DataStructures/Concept.d.ts +110 -0
  58. package/dist/types/DataStructures/ConceptData.d.ts +292 -0
  59. package/dist/types/DataStructures/ConceptsToDraw.d.ts +168 -0
  60. package/dist/types/DataStructures/Connection.d.ts +76 -0
  61. package/dist/types/DataStructures/ConnectionBinaryTree/ConnectionBinaryTree.d.ts +115 -0
  62. package/dist/types/DataStructures/ConnectionBinaryTree/ConnectionNode.d.ts +169 -0
  63. package/dist/types/DataStructures/ConnectionBinaryTree/ConnectionTypeTree.d.ts +82 -0
  64. package/dist/types/DataStructures/ConnectionData.d.ts +191 -0
  65. package/dist/types/DataStructures/Count/CountInfo.d.ts +73 -0
  66. package/dist/types/DataStructures/FilterSearch.d.ts +84 -0
  67. package/dist/types/DataStructures/IdentifierFlags.d.ts +34 -0
  68. package/dist/types/DataStructures/Local/LConcept.d.ts +105 -0
  69. package/dist/types/DataStructures/Local/LConnection.d.ts +83 -0
  70. package/dist/types/DataStructures/Local/LNode.d.ts +190 -0
  71. package/dist/types/DataStructures/Local/LocalBinaryCharacterTree.d.ts +133 -0
  72. package/dist/types/DataStructures/Local/LocalBinaryTree.d.ts +135 -0
  73. package/dist/types/DataStructures/Local/LocalBinaryTypeTree.d.ts +147 -0
  74. package/dist/types/DataStructures/Local/LocalConceptData.d.ts +100 -0
  75. package/dist/types/DataStructures/Local/LocalConnectionData.d.ts +109 -0
  76. package/dist/types/DataStructures/Local/LocalSyncData.d.ts +89 -0
  77. package/dist/types/DataStructures/PatcherStructure.d.ts +86 -0
  78. package/dist/types/DataStructures/ReferentInfo.d.ts +68 -0
  79. package/dist/types/DataStructures/ReservedIds.d.ts +101 -0
  80. package/dist/types/DataStructures/Responses/ErrorResponse.d.ts +184 -22
  81. package/dist/types/DataStructures/Responses/StandardResponses.d.ts +65 -0
  82. package/dist/types/DataStructures/Returner.d.ts +59 -0
  83. package/dist/types/DataStructures/Search/FreeschemaQuery.d.ts +165 -0
  84. package/dist/types/DataStructures/Search/SearchStructure.d.ts +69 -0
  85. package/dist/types/DataStructures/SearchQuery.d.ts +130 -0
  86. package/dist/types/DataStructures/Security/TokenStorage.d.ts +48 -0
  87. package/dist/types/DataStructures/Session/SessionData.d.ts +118 -0
  88. package/dist/types/DataStructures/SettingData.d.ts +32 -0
  89. package/dist/types/DataStructures/Settings.d.ts +27 -0
  90. package/dist/types/DataStructures/SigninModel.d.ts +50 -0
  91. package/dist/types/DataStructures/SignupModel.d.ts +50 -0
  92. package/dist/types/DataStructures/SyncData.d.ts +206 -0
  93. package/dist/types/DataStructures/TheCharacter.d.ts +87 -0
  94. package/dist/types/DataStructures/TheTexts.d.ts +92 -0
  95. package/dist/types/DataStructures/Transaction/Transaction.d.ts +294 -4
  96. package/dist/types/DataStructures/User/UserBinaryTree.d.ts +117 -0
  97. package/dist/types/DataStructures/User/UserNode.d.ts +130 -0
  98. package/dist/types/Database/GetConceptFromIndexDb.d.ts +9 -0
  99. package/dist/types/Database/NoIndexDb.d.ts +169 -0
  100. package/dist/types/Database/indexdblocal.d.ts +42 -0
  101. package/dist/types/Database/indexeddb.d.ts +43 -0
  102. package/dist/types/Drawing/ConceptDraw.d.ts +28 -0
  103. package/dist/types/Drawing/ConceptEvents.d.ts +46 -0
  104. package/dist/types/Helpers/CheckIfExists.d.ts +159 -0
  105. package/dist/types/Helpers/RemoveFromArray.d.ts +66 -0
  106. package/dist/types/Helpers/UniqueInsert.d.ts +28 -0
  107. package/dist/types/Services/CheckForConnectionDeletion.d.ts +190 -0
  108. package/dist/types/Services/Common/DecodeCountInfo.d.ts +54 -0
  109. package/dist/types/Services/Common/ErrorPosting.d.ts +49 -0
  110. package/dist/types/Services/Common/RegexFunction.d.ts +28 -0
  111. package/dist/types/Services/Composition/BuildComposition.d.ts +37 -0
  112. package/dist/types/Services/Composition/CompositionCache.d.ts +89 -0
  113. package/dist/types/Services/Composition/CreateCompositionCache.d.ts +43 -0
  114. package/dist/types/Services/Conversion/ConvertConcepts.d.ts +83 -0
  115. package/dist/types/Services/CreateBinaryTreeFromData.d.ts +38 -0
  116. package/dist/types/Services/CreateCharacterBinaryTreeFromData.d.ts +42 -0
  117. package/dist/types/Services/CreateConnectionBetweenTwoConcepts.d.ts +206 -0
  118. package/dist/types/Services/CreateDefaultConcept.d.ts +114 -0
  119. package/dist/types/Services/CreateTheComposition.d.ts +101 -0
  120. package/dist/types/Services/CreateTheConcept.d.ts +179 -0
  121. package/dist/types/Services/CreateTheConnection.d.ts +59 -0
  122. package/dist/types/Services/CreateTheConnectionGeneral.d.ts +127 -0
  123. package/dist/types/Services/CreateTypeTreeFromData.d.ts +43 -0
  124. package/dist/types/Services/Delete/DeleteConnectionByType.d.ts +52 -5
  125. package/dist/types/Services/Delete/GetAllConnectionByType.d.ts +57 -9
  126. package/dist/types/Services/DeleteConcept.d.ts +136 -0
  127. package/dist/types/Services/DeleteConnection.d.ts +194 -0
  128. package/dist/types/Services/FindConeceptsFromConnection.d.ts +179 -0
  129. package/dist/types/Services/FindConnectionsOfCompositionBulkInMemory.d.ts +157 -0
  130. package/dist/types/Services/GenerateHexNumber.d.ts +64 -0
  131. package/dist/types/Services/GetComposition.d.ts +331 -0
  132. package/dist/types/Services/GetCompositionBulk.d.ts +251 -3
  133. package/dist/types/Services/GetCompositionList.d.ts +130 -0
  134. package/dist/types/Services/GetConceptByCharacter.d.ts +84 -0
  135. package/dist/types/Services/GetConnections.d.ts +72 -0
  136. package/dist/types/Services/GetDataFromIndexDb.d.ts +79 -0
  137. package/dist/types/Services/GetLink.d.ts +104 -0
  138. package/dist/types/Services/GetLinkerConnectionFromConcept.d.ts +99 -0
  139. package/dist/types/Services/GetMaximumConnectionSyncTime.d.ts +57 -0
  140. package/dist/types/Services/GetRelation.d.ts +162 -0
  141. package/dist/types/Services/GetTheConcept.d.ts +71 -0
  142. package/dist/types/Services/GetTheReferent.d.ts +74 -0
  143. package/dist/types/Services/InitializeSystem.d.ts +119 -0
  144. package/dist/types/Services/Local/CreateDefaultLConcept.d.ts +48 -0
  145. package/dist/types/Services/Local/CreateLocalBinaryTreeFromData.d.ts +49 -0
  146. package/dist/types/Services/Local/CreateLocalBinaryTypeTreeFromData.d.ts +54 -0
  147. package/dist/types/Services/Local/CreateLocalCharacterBinaryTree.d.ts +60 -0
  148. package/dist/types/Services/Local/CreateTheCompositionLocal.d.ts +70 -0
  149. package/dist/types/Services/Local/CreateTheConceptLocal.d.ts +58 -0
  150. package/dist/types/Services/Local/CreateTheConnectionLocal.d.ts +56 -0
  151. package/dist/types/Services/Local/GetCompositionListLocal.d.ts +103 -0
  152. package/dist/types/Services/Local/GetCompositionLocal.d.ts +96 -0
  153. package/dist/types/Services/Local/GetConceptByCharacterLocal.d.ts +57 -0
  154. package/dist/types/Services/Local/MakeTheConceptLocal.d.ts +71 -0
  155. package/dist/types/Services/Local/MakeTheInstanceConceptLocal.d.ts +89 -0
  156. package/dist/types/Services/Local/MakeTheTypeLocal.d.ts +71 -0
  157. package/dist/types/Services/Local/UpdateCompositionLocal.d.ts +101 -0
  158. package/dist/types/Services/MakeTheCharacter.d.ts +74 -0
  159. package/dist/types/Services/MakeTheCharacterData.d.ts +65 -0
  160. package/dist/types/Services/MakeTheInstanceConcept.d.ts +75 -0
  161. package/dist/types/Services/MakeTheName.d.ts +81 -0
  162. package/dist/types/Services/MakeTheTimestamp.d.ts +68 -0
  163. package/dist/types/Services/MakeTheTypeConcept.d.ts +68 -0
  164. package/dist/types/Services/Mqtt/publishMessage.d.ts +27 -0
  165. package/dist/types/Services/Mqtt/subscribeMessage.d.ts +23 -0
  166. package/dist/types/Services/PatchComposition.d.ts +105 -0
  167. package/dist/types/Services/Search/DataIdFormat.d.ts +96 -24
  168. package/dist/types/Services/Search/FormatData.d.ts +92 -17
  169. package/dist/types/Services/Search/JustIdFormat.d.ts +91 -16
  170. package/dist/types/Services/Search/SearchLinkInternal.d.ts +28 -0
  171. package/dist/types/Services/Search/SearchLinkMultiple.d.ts +58 -0
  172. package/dist/types/Services/Search/SearchWithTypeAndLinker.d.ts +91 -24
  173. package/dist/types/Services/Search/orderingConnections.d.ts +34 -0
  174. package/dist/types/Services/SplitStrings.d.ts +50 -0
  175. package/dist/types/Services/UpdateComposition.d.ts +123 -0
  176. package/dist/types/Services/User/UserTranslation.d.ts +102 -0
  177. package/dist/types/Services/View/ViewInternalData.d.ts +32 -0
  178. package/dist/types/WrapperFunctions/SchemaQueryObservable.d.ts +140 -5
  179. package/dist/types/app.d.ts +71 -0
  180. package/package.json +1 -1
@@ -1,2 +1,107 @@
1
+ /**
2
+ * @fileoverview Composition patching service for the CCS-JS system.
3
+ * This module provides functionality to retrieve connections between concepts within a composition,
4
+ * which is essential for understanding and modifying the relationship structure in the concept graph.
5
+ * @module Services/PatchComposition
6
+ */
1
7
  import { Concept } from "../DataStructures/Concept";
8
+ /**
9
+ * Retrieves the connection between two concepts within a specific composition context.
10
+ *
11
+ * This function is used to find the relationship connection between a source concept (ofConcept)
12
+ * and a target concept (toConcept) within the scope of a main composition. It's particularly
13
+ * useful when you need to verify, modify, or delete a specific connection in a composition,
14
+ * or when analyzing the relationship structure between concepts.
15
+ *
16
+ * The function acts as a service layer wrapper around the API call, providing a cleaner
17
+ * interface for retrieving composition-specific connections. It ensures that only connections
18
+ * belonging to the specified composition are considered.
19
+ *
20
+ * @param ofConcept - The source concept from which the connection originates
21
+ * @param MainConcept - The main composition concept that contains both concepts and their connection
22
+ * @param toConcept - The target concept to which the connection points
23
+ * @returns The connection object between the two concepts within the composition context,
24
+ * or undefined if no such connection exists
25
+ *
26
+ * @example
27
+ * ```typescript
28
+ * // Find connection between two concepts in a composition
29
+ * import PatchComposition from './PatchComposition';
30
+ * import { Concept } from '../DataStructures/Concept';
31
+ *
32
+ * const userConcept: Concept = { id: 123, type: "user", ... };
33
+ * const profileConcept: Concept = { id: 456, type: "profile", ... };
34
+ * const compositionConcept: Concept = { id: 789, type: "composition", ... };
35
+ *
36
+ * const connection = PatchComposition(userConcept, compositionConcept, profileConcept);
37
+ * // Returns the connection object linking user to profile within the composition
38
+ * ```
39
+ *
40
+ * @example
41
+ * ```typescript
42
+ * // Use in connection validation
43
+ * const userConcept = await GetTheConcept(123);
44
+ * const addressConcept = await GetTheConcept(456);
45
+ * const mainComposition = await GetTheConcept(789);
46
+ *
47
+ * const existingConnection = PatchComposition(
48
+ * userConcept,
49
+ * mainComposition,
50
+ * addressConcept
51
+ * );
52
+ *
53
+ * if (existingConnection) {
54
+ * console.log("Connection already exists");
55
+ * } else {
56
+ * console.log("No connection found, can create new one");
57
+ * }
58
+ * ```
59
+ *
60
+ * @example
61
+ * ```typescript
62
+ * // Check connection before deletion
63
+ * const fromConcept = await GetTheConcept(111);
64
+ * const toConcept = await GetTheConcept(222);
65
+ * const composition = await GetTheConcept(333);
66
+ *
67
+ * const connection = PatchComposition(fromConcept, composition, toConcept);
68
+ * if (connection) {
69
+ * await DeleteConnectionById(connection.id);
70
+ * }
71
+ * ```
72
+ *
73
+ * @remarks
74
+ * Important considerations:
75
+ *
76
+ * **Function Purpose:**
77
+ * - Despite the name "PatchComposition", this function primarily retrieves connection data
78
+ * - It does not modify or patch the composition itself
79
+ * - It serves as a query function to find specific connections
80
+ *
81
+ * **Composition Context:**
82
+ * - The MainConcept parameter ensures the connection is searched within a specific composition
83
+ * - This prevents retrieving connections from other compositions that might link the same concepts
84
+ * - Provides composition-scoped connection lookup
85
+ *
86
+ * **Return Value:**
87
+ * - The function calls an API method but doesn't explicitly handle the return
88
+ * - The connection variable is assigned but not returned in the current implementation
89
+ * - This may be an incomplete implementation that needs a return statement
90
+ *
91
+ * **Use Cases:**
92
+ * - Verifying if a connection exists before creating a new one
93
+ * - Finding the connection ID for deletion operations
94
+ * - Validating composition structure
95
+ * - Analyzing relationship graphs within compositions
96
+ *
97
+ * **Potential Issues:**
98
+ * - Missing return statement means the function currently returns undefined
99
+ * - The retrieved connection is stored in a local variable but not returned
100
+ * - May need to be updated to return the connection value
101
+ *
102
+ * @see {@link GetCompositionConnectionsBetweenTwoConcepts} for the underlying API implementation
103
+ * @see {@link Concept} for the concept data structure
104
+ * @see {@link Connection} for the connection data structure
105
+ * @see {@link UpdateComposition} for composition update operations
106
+ */
2
107
  export default function PatchComposition(ofConcept: Concept, MainConcept: Concept, toConcept: Concept): void;
@@ -1,32 +1,104 @@
1
+ /**
2
+ * @module DataIdFormat
3
+ * @description Provides formatting functions for DATA-ID format output, which includes both data and ID information for each concept
4
+ */
1
5
  import { Connection } from "../../app";
2
6
  /**
3
- * ## Format DATA-ID ##
4
- * this function takes in connections and creates a single level objects so that all the data are added to its object/ array.
5
- * This is then passed on further for stiching.
6
- * @param connections
7
- * @param compositionData
8
- * @param reverse
9
- * @returns
10
- */
7
+ * Converts connections to single-level objects in DATA-ID format, preparing data for stitching.
8
+ * Creates objects with both ID and data properties for each concept.
9
+ *
10
+ * @async
11
+ * @param {Connection[]} connections - Array of Connection objects to process
12
+ * @param {any[]} compositionData - Array/dictionary that stores composition data indexed by concept ID
13
+ * @param {number[]} [reverse=[]] - Array of connection IDs for reverse direction processing
14
+ * @returns {Promise<any[]>} A promise that resolves to the updated compositionData with ID and data structure
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * const connections: Connection[] = [...];
19
+ * const compositionData = [];
20
+ * const reverse = [102];
21
+ * const result = await FormatFunctionDataForData(connections, compositionData, reverse);
22
+ * // result = { 123: { user: { name: { id: 1, data: { type: "John" } } } } }
23
+ * ```
24
+ *
25
+ * @remarks
26
+ * Format: DATA-ID - First pass formatting with ID information
27
+ * This function:
28
+ * - Processes connections in order without sorting
29
+ * - Creates nested data structure with explicit ID and data fields
30
+ * - Handles numeric linkers as arrays
31
+ * - Uses linker character or concept type (with prefix removed) as key
32
+ * - Skips "_s_" type linkers
33
+ * - Supports reverse connections with "_reverse" suffix
34
+ */
11
35
  export declare function FormatFunctionDataForData(connections: Connection[], compositionData: any[], reverse?: number[]): Promise<any[]>;
12
36
  /**
13
- * ############ Format is data-id and is used for list. ############
14
- * This is helpful in building a format that has multiple mainCompositions i.e. in the context of the list
15
- * The list format is helpful because you do not have to go over each individual query.
16
- * @param connections the type connections that need (external connections) to be passed
17
- * @param compositionData this is a dictionary type of format that has all the build compositions {id: { actual data}}
18
- * @param mainComposition this is list of ids of the main composition that builds the tree
19
- * @param reverse this is the list of connections ids that needs to go to the reverse direction (to---->from)
20
- * @returns
21
- */
37
+ * Formats concepts and connections for list views in DATA-ID format, stitching together multiple compositions.
38
+ * Each result includes concept ID, nested data object, and creation timestamp.
39
+ *
40
+ * @async
41
+ * @param {Connection[]} connections - Array of type connections (external connections) to process
42
+ * @param {any[]} compositionData - Dictionary format with all built compositions indexed by ID
43
+ * @param {any} newCompositionData - New composition data to be populated (unused parameter)
44
+ * @param {number[]} mainComposition - Array of main composition IDs that build the tree
45
+ * @param {number[]} [reverse=[]] - Array of connection IDs for reverse direction (to -> from)
46
+ * @param {any[]} CountDictionary - Dictionary containing count information for connections
47
+ * @returns {Promise<any[]>} A promise that resolves to an array of formatted main compositions with DATA-ID structure
48
+ *
49
+ * @example
50
+ * ```typescript
51
+ * const connections: Connection[] = [...];
52
+ * const compositionData = { 123: { user: "data" } };
53
+ * const mainIds = [123];
54
+ * const result = await FormatFromConnectionsAlteredArrayExternal(
55
+ * connections,
56
+ * compositionData,
57
+ * {},
58
+ * mainIds,
59
+ * [],
60
+ * {}
61
+ * );
62
+ * // result = [{ id: 123, data: {...}, created_on: timestamp }]
63
+ * ```
64
+ *
65
+ * @remarks
66
+ * Format: DATA-ID - Used for list views with full ID and data information
67
+ * This function:
68
+ * - Processes type connections to link compositions
69
+ * - Creates objects with id, data, and created_on properties
70
+ * - Handles both "_s_" (array) and regular (object) linker types
71
+ * - Supports reverse connections with "_reverse" suffix
72
+ * - Includes creation timestamp for each linked concept
73
+ * - Returns array of formatted main compositions
74
+ */
22
75
  export declare function FormatFromConnectionsAlteredArrayExternal(connections: Connection[], compositionData: any[], newCompositionData: any, mainComposition: number[], reverse: number[] | undefined, CountDictionary: any[]): Promise<any[]>;
23
76
  /**
24
- * ## Format DATA-ID ##
25
- * this function takes in connections and creates a single level objects so that all the data are added to its object/ array.
26
- * This is then passed on further for stiching.
27
- * @param connections
28
- * @param compositionData
29
- * @param reverse
30
- * @returns
77
+ * Converts connections to initial single-level concept objects in DATA-ID format.
78
+ * This is the first pass that creates the basic concept structure before data nesting.
79
+ *
80
+ * @async
81
+ * @param {Connection[]} connections - Array of Connection objects to process
82
+ * @param {any[]} compositionData - Array/dictionary that stores composition data indexed by concept ID
83
+ * @param {number[]} [reverse=[]] - Array of connection IDs for reverse direction processing
84
+ * @returns {Promise<any[]>} A promise that resolves to the updated compositionData with initial structure
85
+ *
86
+ * @example
87
+ * ```typescript
88
+ * const connections: Connection[] = [...];
89
+ * const compositionData = [];
90
+ * const reverse = [];
91
+ * const result = await FormatFunctionData(connections, compositionData, reverse);
92
+ * // result = { 123: { user: {} }, 456: { post: {} } }
93
+ * ```
94
+ *
95
+ * @remarks
96
+ * Format: DATA-ID - Initial pass for concept creation
97
+ * This function:
98
+ * - Creates empty concept structures indexed by ID
99
+ * - Sets up the foundation for subsequent data population
100
+ * - Handles "_s_" type linkers by storing basic concept info
101
+ * - Does not add nested data (handled by FormatFunctionDataForData)
102
+ * - Supports reverse connections
31
103
  */
32
104
  export declare function FormatFunctionData(connections: Connection[], compositionData: any[], reverse?: number[]): Promise<any[]>;
@@ -1,26 +1,101 @@
1
+ /**
2
+ * @module FormatData
3
+ * @description Provides functions to format connection data into structured composition objects for Normal format output
4
+ */
1
5
  import { Connection } from "../../app";
2
6
  /**
7
+ * Converts connections to single-level objects by processing concepts and their relationships.
8
+ * This is the initial builder function that creates the foundation for composition arrays/objects.
9
+ *
10
+ * @async
11
+ * @param {Connection[]} connections - Array of Connection objects to process
12
+ * @param {any} compositionData - Dictionary object that stores composition data indexed by concept ID
13
+ * @param {number[]} reverse - Array of connection IDs that should be processed in reverse direction
14
+ * @returns {Promise<any>} A promise that resolves to the updated compositionData dictionary
3
15
  *
4
- * ## Format Normal ##
5
- * This function takes in the connections and then converts the connections to the single level objects for further processing
6
- * This function is the builder of the arrays/ objects from the connections.
16
+ * @example
17
+ * ```typescript
18
+ * const connections: Connection[] = [...];
19
+ * const compositionData = {};
20
+ * const reverse = [102];
21
+ * const result = await formatFunction(connections, compositionData, reverse);
22
+ * // result = { 123: { type: "value" }, 456: { type: "data" } }
23
+ * ```
24
+ *
25
+ * @remarks
26
+ * Format: Normal - First pass formatting
27
+ * This function:
28
+ * - Processes each connection to extract concepts
29
+ * - Handles both forward (of->to) and reverse (to->of) directions
30
+ * - Creates initial concept structures without nested data
31
+ * - Special handling for "_s_" linker types (skipped in output)
7
32
  */
8
33
  export declare function formatFunction(connections: Connection[], compositionData: any, reverse: number[]): Promise<any>;
9
34
  /**
10
- *
11
- * ## Format Normal ##
12
- * This function takes in the connections and then converts the connections to the single level objects for further processing
13
- * This function is the builder of the arrays/ objects from the connections.
14
- */
35
+ * Converts connections to single-level objects with nested data relationships.
36
+ * This is the second pass that adds detailed data properties to the composition structure.
37
+ *
38
+ * @async
39
+ * @param {Connection[]} connections - Array of Connection objects to process
40
+ * @param {any} compositionData - Dictionary object that stores composition data indexed by concept ID
41
+ * @param {number[]} reverse - Array of connection IDs that should be processed in reverse direction
42
+ * @returns {Promise<any>} A promise that resolves to the updated compositionData dictionary with nested data
43
+ *
44
+ * @example
45
+ * ```typescript
46
+ * const connections: Connection[] = [...];
47
+ * const compositionData = { 123: { user: {} } };
48
+ * const reverse = [];
49
+ * const result = await formatFunctionForData(connections, compositionData, reverse);
50
+ * // result = { 123: { user: { name: { type: "John" } } } }
51
+ * ```
52
+ *
53
+ * @remarks
54
+ * Format: Normal - Second pass formatting with data nesting
55
+ * This function:
56
+ * - Sorts connections by ID in descending order
57
+ * - Adds nested data properties to concepts
58
+ * - Handles numeric vs string linker types differently
59
+ * - Numeric linkers create arrays, string linkers create objects
60
+ * - Uses linker character value as property key or removes prefix if empty
61
+ * - Skips "_s_" type linkers in the output
62
+ */
15
63
  export declare function formatFunctionForData(connections: Connection[], compositionData: any, reverse: number[]): Promise<any>;
16
64
  /**
17
- * ######### Format is normal ######### used for listing. This only provides type connections.
18
- * This is helpful in building a format that has multiple mainCompositions i.e. in the context of the list
19
- * The list format is helpful because you do not have to go over each individual query.
20
- * @param connections the type connections that need (external connections) to be passed
21
- * @param compositionData this is a dictionary type of format that has all the build compositions {id: { actual data}}
22
- * @param mainComposition this is list of ids of the main composition that builds the tree
23
- * @param reverse this is the list of connections ids that needs to go to the reverse direction (to---->from)
24
- * @returns
25
- */
65
+ * Formats concepts and connections for list views in Normal format, stitching together multiple compositions.
66
+ * This function handles type connections and builds a tree structure from multiple main compositions.
67
+ *
68
+ * @async
69
+ * @param {Connection[]} [connections=[]] - Array of type connections (external connections) to process
70
+ * @param {any[]} [compositionData=[]] - Dictionary format with all built compositions indexed by ID
71
+ * @param {number[]} [mainComposition=[]] - Array of main composition IDs that build the tree
72
+ * @param {any} newCompositionData - New composition data to be populated (unused parameter)
73
+ * @param {number[]} [reverse=[]] - Array of connection IDs for reverse direction (to -> from)
74
+ * @returns {Promise<any[]>} A promise that resolves to an array of formatted main composition objects
75
+ *
76
+ * @example
77
+ * ```typescript
78
+ * const connections: Connection[] = [...];
79
+ * const compositionData = { 123: { user: "data" }, 456: { post: "info" } };
80
+ * const mainIds = [123, 456];
81
+ * const result = await FormatConceptsAndConnectionsNormalList(
82
+ * connections,
83
+ * compositionData,
84
+ * mainIds,
85
+ * {},
86
+ * []
87
+ * );
88
+ * // result = [{ id: 123, user: "data" }, { id: 456, post: "info" }]
89
+ * ```
90
+ *
91
+ * @remarks
92
+ * Format: Normal - Used for listing multiple compositions
93
+ * This function:
94
+ * - Processes type connections to link compositions together
95
+ * - Sorts connections by ID in descending order
96
+ * - Handles both "_s_" (array) and regular (object) linker types
97
+ * - Supports reverse connections with "_reverse" suffix
98
+ * - Returns an array of main compositions with their linked data
99
+ * - Useful for list views where multiple compositions need to be queried efficiently
100
+ */
26
101
  export declare function FormatConceptsAndConnectionsNormalList(connections: Connection[] | undefined, compositionData: any[] | undefined, mainComposition: number[] | undefined, newCompositionData: any, reverse?: number[]): Promise<any[]>;
@@ -1,23 +1,98 @@
1
+ /**
2
+ * @module JustIdFormat
3
+ * @description Provides formatting functions for JustId format output, which includes simplified ID-based data structures
4
+ */
1
5
  import { Connection } from "../../app";
2
6
  /**
3
- * ## Format Just-Id ##
4
- * this function takes in connections and creates a single level objects so that all the data are added to its object/ array.
5
- * This is then passed on further for stiching.
6
- * @param connections
7
- * @param compositionData
8
- * @param reverse
9
- * @returns
10
- */
7
+ * Converts connections to single-level objects in JustId format, preparing simplified data for stitching.
8
+ * Creates lightweight objects with ID and essential data properties.
9
+ *
10
+ * @async
11
+ * @param {Connection[]} connections - Array of Connection objects to process
12
+ * @param {any[]} compositionData - Array/dictionary that stores composition data indexed by concept ID
13
+ * @param {number[]} [reverse=[]] - Array of connection IDs for reverse direction processing
14
+ * @returns {Promise<any[]>} A promise that resolves to the updated compositionData with JustId structure
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * const connections: Connection[] = [...];
19
+ * const compositionData = [];
20
+ * const reverse = [];
21
+ * const result = await FormatFunctionDataForDataJustId(connections, compositionData, reverse);
22
+ * // result = { 123: { user: { name: { id: 1, data: "John", created_on: timestamp } } } }
23
+ * ```
24
+ *
25
+ * @remarks
26
+ * Format: JustId - Lightweight formatting with minimal data
27
+ * This function:
28
+ * - Creates simplified data structure with ID, data value, and timestamp
29
+ * - Handles numeric linkers as arrays
30
+ * - Uses linker character or concept type (with prefix removed) as key
31
+ * - Skips "_s_" type linkers
32
+ * - Supports reverse connections with "_reverse" suffix
33
+ * - Optimized for list views and reduced data transfer
34
+ */
11
35
  export declare function FormatFunctionDataForDataJustId(connections: Connection[], compositionData: any[], reverse?: number[]): Promise<any[]>;
12
36
  /**
13
- * ############ Format is Just Id and is used for list. ############
14
- * This is helpful in building a format that has multiple mainCompositions i.e. in the context of the list
15
- * The list format is helpful because you do not have to go over each individual query.
16
- * @param connections the type connections that need (external connections) to be passed
17
- * @param compositionData this is a dictionary type of format that has all the build compositions {id: { actual data}}
18
- * @param mainComposition this is list of ids of the main composition that builds the tree
19
- * @param reverse this is the list of connections ids that needs to go to the reverse direction (to---->from)
20
- * @returns
37
+ * Formats concepts and connections for list views in JustId format, stitching together multiple compositions.
38
+ * Creates lightweight list view with ID, data, and timestamp for each concept.
39
+ *
40
+ * @async
41
+ * @param {Connection[]} connections - Array of type connections (external connections) to process
42
+ * @param {any[]} compositionData - Dictionary format with all built compositions indexed by ID
43
+ * @param {number[]} mainComposition - Array of main composition IDs that build the tree
44
+ * @param {number[]} [reverse=[]] - Array of connection IDs for reverse direction (to -> from)
45
+ * @param {any[]} CountDictionary - Dictionary containing count information for connections by concept ID
46
+ * @returns {Promise<any[]>} A promise that resolves to an array of formatted main compositions with JustId structure
47
+ *
48
+ * @example
49
+ * ```typescript
50
+ * const connections: Connection[] = [...];
51
+ * const compositionData = { 123: { user: "data" } };
52
+ * const mainIds = [123];
53
+ * const countDict = { 123: { count: 5, connectionType: "follows" } };
54
+ * const result = await FormatFromConnectionsAlteredArrayExternalJustId(
55
+ * connections,
56
+ * compositionData,
57
+ * mainIds,
58
+ * [],
59
+ * countDict
60
+ * );
61
+ * // result = [{ id: 123, user: { id: 1, data: "value", created_on: timestamp }, follows_count: 5 }]
62
+ * ```
63
+ *
64
+ * @remarks
65
+ * Format: JustId - Used for list views with lightweight ID-based structure
66
+ * This function:
67
+ * - Processes type connections to link compositions
68
+ * - Creates objects with id, data, and created_on properties
69
+ * - Handles both "_s_" (array) and regular (object) linker types
70
+ * - Supports reverse connections with "_reverse" suffix
71
+ * - Adds count information from CountDictionary (e.g., "follows_count")
72
+ * - Optimized for performance with minimal data payload
73
+ * - Useful for paginated lists and mobile applications
21
74
  */
22
75
  export declare function FormatFromConnectionsAlteredArrayExternalJustId(connections: Connection[], compositionData: any[], mainComposition: number[], reverse: number[] | undefined, CountDictionary: any[]): Promise<any[]>;
76
+ /**
77
+ * Adds count information to the concept data based on the CountDictionary.
78
+ * Appends a "_count" suffix to the connection type name.
79
+ *
80
+ * @param {number} ofTheConceptId - The ID of the concept to add count information for
81
+ * @param {any} CountDictionary - Dictionary containing count information indexed by concept ID
82
+ * @param {any} newData - The data object to add count information to
83
+ *
84
+ * @example
85
+ * ```typescript
86
+ * const conceptId = 123;
87
+ * const countDict = { 123: { connectionType: "follows", count: 42 } };
88
+ * const data = { user: "data" };
89
+ * AddCount(conceptId, countDict, data);
90
+ * // data now includes: { user: "data", follows_count: 42 }
91
+ * ```
92
+ *
93
+ * @remarks
94
+ * This function mutates the newData object by adding a count property
95
+ * The count property name format is: "{connectionType}_count"
96
+ * If the concept ID is not in CountDictionary, no changes are made
97
+ */
23
98
  export declare function AddCount(ofTheConceptId: number, CountDictionary: any, newData: any): void;
@@ -1,2 +1,30 @@
1
+ /**
2
+ * @module SearchLinkInternal
3
+ * @description Provides functionality to search for internal links within concepts and return formatted data
4
+ */
1
5
  import { SearchStructure } from "../../app";
6
+ /**
7
+ * Searches for internal links within concepts based on the provided search query
8
+ * and returns the formatted internal data view.
9
+ *
10
+ * @async
11
+ * @param {SearchStructure} searchQuery - The search query structure containing search criteria
12
+ * @param {string} [token=""] - Optional authentication token for API requests
13
+ * @returns {Promise<any[]>} A promise that resolves to an array of formatted concept connections
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * const searchQuery: SearchStructure = {
18
+ * composition: 123,
19
+ * linker: 456
20
+ * };
21
+ * const results = await SearchLinkInternal(searchQuery, "auth-token");
22
+ * console.log(results);
23
+ * ```
24
+ *
25
+ * @remarks
26
+ * This function performs a two-step process:
27
+ * 1. Fetches internal concept connections using the SearchInternalApi
28
+ * 2. Formats the connections into a readable view using ViewInternalData
29
+ */
2
30
  export declare function SearchLinkInternal(searchQuery: SearchStructure, token?: string): Promise<any[]>;
@@ -1,3 +1,61 @@
1
+ /**
2
+ * @module SearchLinkMultiple
3
+ * @description Provides functionality to search for multiple links across compositions and format the results
4
+ */
1
5
  import { SearchQuery } from "../../DataStructures/SearchQuery";
6
+ /**
7
+ * Searches for multiple links across compositions based on an array of search queries.
8
+ * Returns formatted data with all linked concepts and their relationships.
9
+ *
10
+ * @async
11
+ * @param {SearchQuery[]} searchQuery - Array of search query objects containing composition and link criteria
12
+ * @param {string} [token=""] - Optional authentication token for API requests
13
+ * @returns {Promise<any>} A promise that resolves to formatted composition data with all linked concepts
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * const queries: SearchQuery[] = [
18
+ * { composition: 123, linker: 456, reverse: false },
19
+ * { composition: 789, linker: 456, reverse: true }
20
+ * ];
21
+ * const result = await SearchLinkMultipleAll(queries, "auth-token");
22
+ * console.log(result);
23
+ * ```
24
+ *
25
+ * @remarks
26
+ * This function:
27
+ * 1. Fetches multiple linked compositions from the API
28
+ * 2. Retrieves all related concepts and connections
29
+ * 3. Formats the data structure with proper linker relationships
30
+ * 4. Handles both forward and reverse link directions
31
+ */
2
32
  export declare function SearchLinkMultipleAll(searchQuery: SearchQuery[], token?: string): Promise<any>;
33
+ /**
34
+ * Formats composition data from connection linkers, organizing concepts into a hierarchical structure.
35
+ * Handles both forward and reverse relationships between concepts.
36
+ *
37
+ * @async
38
+ * @param {number[]} linkers - Array of connection IDs that link concepts together
39
+ * @param {any[]} compositionData - Dictionary of composition data indexed by concept ID
40
+ * @param {number} mainComposition - The ID of the main composition to return
41
+ * @param {number[]} [reverse=[]] - Array of connection IDs that should be treated as reverse connections
42
+ * @returns {Promise<any>} A promise that resolves to the formatted main composition data with all linked concepts
43
+ *
44
+ * @example
45
+ * ```typescript
46
+ * const linkers = [101, 102, 103];
47
+ * const compositionData = { 123: { type: "data" }, 456: { type: "info" } };
48
+ * const mainId = 123;
49
+ * const reverseConnections = [102];
50
+ * const result = await FormatFromConnections(linkers, compositionData, mainId, reverseConnections);
51
+ * ```
52
+ *
53
+ * @remarks
54
+ * This function:
55
+ * - Fetches all connections from the provided linker IDs
56
+ * - Processes each connection to build relationships
57
+ * - Handles reverse connections (to -> from instead of from -> to)
58
+ * - Uses the linker concept's character value as the relationship key
59
+ * - Appends "_reverse" suffix for reverse relationships
60
+ */
3
61
  export declare function FormatFromConnections(linkers: number[], compositionData: any[], mainComposition: number, reverse?: number[]): Promise<any>;