mftsccs-node 0.0.56 → 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 (188) hide show
  1. package/README.md +1148 -11
  2. package/dist/bundle.js +1 -0
  3. package/dist/types/Api/Create/CreateTheCharacter.d.ts +45 -0
  4. package/dist/types/Api/Create/CreateTheConceptApi.d.ts +52 -0
  5. package/dist/types/Api/Create/CreateTheConnectionApi.d.ts +53 -0
  6. package/dist/types/Api/Create/CreateTheTextData.d.ts +58 -0
  7. package/dist/types/Api/Delete/DeleteConceptInBackend.d.ts +44 -0
  8. package/dist/types/Api/DeleteConnectionApiBulk.d.ts +56 -0
  9. package/dist/types/Api/DeleteTheConcept.d.ts +65 -0
  10. package/dist/types/Api/DeleteTheConnection.d.ts +77 -0
  11. package/dist/types/Api/GetAiData.d.ts +37 -0
  12. package/dist/types/Api/GetAllConcepts.d.ts +43 -0
  13. package/dist/types/Api/GetAllConceptsByType.d.ts +46 -0
  14. package/dist/types/Api/GetAllConnections.d.ts +49 -0
  15. package/dist/types/Api/GetAllConnectionsOfComposition.d.ts +82 -0
  16. package/dist/types/Api/GetAllConnectionsOfCompositionBulk.d.ts +93 -0
  17. package/dist/types/Api/GetAllLinkerConnectionsFromTheConcept.d.ts +54 -0
  18. package/dist/types/Api/GetAllLinkerConnectionsToTheConcept.d.ts +63 -0
  19. package/dist/types/Api/GetAllPrefetchConnections.d.ts +52 -0
  20. package/dist/types/Api/GetCharacterDataByCharacter.d.ts +33 -0
  21. package/dist/types/Api/GetCompositionConnectionsBetweenTwoConcepts.d.ts +41 -0
  22. package/dist/types/Api/GetConcept.d.ts +49 -0
  23. package/dist/types/Api/GetConceptBulk.d.ts +71 -0
  24. package/dist/types/Api/GetConceptByCharacterAndType.d.ts +78 -0
  25. package/dist/types/Api/GetConceptByCharacterValue.d.ts +49 -0
  26. package/dist/types/Api/GetConnection.d.ts +51 -0
  27. package/dist/types/Api/GetConnectionBulk.d.ts +48 -0
  28. package/dist/types/Api/GetConnectionOfTheConcept.d.ts +52 -0
  29. package/dist/types/Api/GetConnectionToTheConcept.d.ts +58 -0
  30. package/dist/types/Api/GetReservedConnectionIds.d.ts +37 -0
  31. package/dist/types/Api/GetReservedIds.d.ts +38 -0
  32. package/dist/types/Api/Login.d.ts +39 -0
  33. package/dist/types/Api/MakeTheNameInBackend.d.ts +40 -0
  34. package/dist/types/Api/MakeTheTypeConceptApi.d.ts +42 -0
  35. package/dist/types/Api/RecursiveSearch.d.ts +44 -0
  36. package/dist/types/Api/Search/FreeschemaQueryApi.d.ts +48 -0
  37. package/dist/types/Api/Search/Search.d.ts +68 -0
  38. package/dist/types/Api/Search/SearchInternalApi.d.ts +71 -0
  39. package/dist/types/Api/Search/SearchLinkMultipleApi.d.ts +92 -0
  40. package/dist/types/Api/Search/SearchWithLinker.d.ts +99 -0
  41. package/dist/types/Api/SearchConcept/GetConceptByCharacterAndCategoryApi.d.ts +41 -0
  42. package/dist/types/Api/SearchConcept/GetConceptByCharacterAndCategoryDirect.d.ts +49 -0
  43. package/dist/types/Api/Session/CreateSession.d.ts +47 -0
  44. package/dist/types/Api/Session/CreateSessionVisit.d.ts +44 -0
  45. package/dist/types/Api/Signin.d.ts +51 -0
  46. package/dist/types/Api/Signup.d.ts +47 -0
  47. package/dist/types/Api/View/ViewInternalDataApi.d.ts +51 -0
  48. package/dist/types/Constants/ApiConstants.d.ts +249 -0
  49. package/dist/types/Constants/FormatConstants.d.ts +87 -0
  50. package/dist/types/DataStructures/BaseUrl.d.ts +262 -0
  51. package/dist/types/DataStructures/BinaryCharacterTree.d.ts +227 -0
  52. package/dist/types/DataStructures/BinaryTree.d.ts +151 -0
  53. package/dist/types/DataStructures/BinaryTypeTree.d.ts +211 -0
  54. package/dist/types/DataStructures/CharacterRepository.d.ts +117 -0
  55. package/dist/types/DataStructures/Composition/Composition.d.ts +117 -0
  56. package/dist/types/DataStructures/Composition/CompositionBinaryTree.d.ts +114 -0
  57. package/dist/types/DataStructures/Composition/CompositionNode.d.ts +223 -0
  58. package/dist/types/DataStructures/Concept.d.ts +139 -0
  59. package/dist/types/DataStructures/ConceptData.d.ts +317 -0
  60. package/dist/types/DataStructures/ConceptsToDraw.d.ts +179 -0
  61. package/dist/types/DataStructures/Connection.d.ts +103 -0
  62. package/dist/types/DataStructures/ConnectionBinaryTree/ConnectionBinaryTree.d.ts +126 -0
  63. package/dist/types/DataStructures/ConnectionBinaryTree/ConnectionNode.d.ts +193 -0
  64. package/dist/types/DataStructures/ConnectionBinaryTree/ConnectionTypeTree.d.ts +95 -0
  65. package/dist/types/DataStructures/ConnectionData.d.ts +209 -0
  66. package/dist/types/DataStructures/Count/CountInfo.d.ts +79 -0
  67. package/dist/types/DataStructures/FilterSearch.d.ts +93 -0
  68. package/dist/types/DataStructures/IdentifierFlags.d.ts +45 -0
  69. package/dist/types/DataStructures/Local/LConcept.d.ts +126 -0
  70. package/dist/types/DataStructures/Local/LConnection.d.ts +101 -0
  71. package/dist/types/DataStructures/Local/LNode.d.ts +217 -0
  72. package/dist/types/DataStructures/Local/LocalBinaryCharacterTree.d.ts +145 -0
  73. package/dist/types/DataStructures/Local/LocalBinaryTree.d.ts +147 -0
  74. package/dist/types/DataStructures/Local/LocalBinaryTypeTree.d.ts +160 -0
  75. package/dist/types/DataStructures/Local/LocalConceptData.d.ts +114 -0
  76. package/dist/types/DataStructures/Local/LocalConnectionData.d.ts +125 -0
  77. package/dist/types/DataStructures/Local/LocalSyncData.d.ts +103 -0
  78. package/dist/types/DataStructures/Node.d.ts +29 -0
  79. package/dist/types/DataStructures/PatcherStructure.d.ts +94 -0
  80. package/dist/types/DataStructures/ReferentInfo.d.ts +75 -0
  81. package/dist/types/DataStructures/ReservedIds.d.ts +111 -0
  82. package/dist/types/DataStructures/Responses/ErrorResponse.d.ts +236 -0
  83. package/dist/types/DataStructures/Responses/StandardResponses.d.ts +71 -0
  84. package/dist/types/DataStructures/Returner.d.ts +66 -0
  85. package/dist/types/DataStructures/Search/FreeschemaQuery.d.ts +187 -0
  86. package/dist/types/DataStructures/Search/SearchStructure.d.ts +78 -0
  87. package/dist/types/DataStructures/SearchQuery.d.ts +146 -0
  88. package/dist/types/DataStructures/Security/TokenStorage.d.ts +51 -0
  89. package/dist/types/DataStructures/Session/SessionData.d.ts +131 -0
  90. package/dist/types/DataStructures/SettingData.d.ts +37 -0
  91. package/dist/types/DataStructures/Settings.d.ts +31 -0
  92. package/dist/types/DataStructures/SigninModel.d.ts +54 -0
  93. package/dist/types/DataStructures/SignupModel.d.ts +54 -0
  94. package/dist/types/DataStructures/SyncData.d.ts +232 -0
  95. package/dist/types/DataStructures/TheCharacter.d.ts +100 -0
  96. package/dist/types/DataStructures/TheTexts.d.ts +106 -0
  97. package/dist/types/DataStructures/Transaction/Transaction.d.ts +320 -0
  98. package/dist/types/DataStructures/User/UserBinaryTree.d.ts +132 -0
  99. package/dist/types/DataStructures/User/UserNode.d.ts +150 -0
  100. package/dist/types/Database/GetConceptFromIndexDb.d.ts +9 -0
  101. package/dist/types/Database/NoIndexDb.d.ts +178 -0
  102. package/dist/types/Database/indexdblocal.d.ts +45 -0
  103. package/dist/types/Database/indexeddb.d.ts +46 -0
  104. package/dist/types/Drawing/ConceptDraw.d.ts +29 -0
  105. package/dist/types/Drawing/ConceptEvents.d.ts +47 -0
  106. package/dist/types/Helpers/CheckIfExists.d.ts +169 -0
  107. package/dist/types/Helpers/RemoveFromArray.d.ts +72 -0
  108. package/dist/types/Helpers/UniqueInsert.d.ts +29 -0
  109. package/dist/types/Services/CheckForConnectionDeletion.d.ts +193 -0
  110. package/dist/types/Services/Common/DecodeCountInfo.d.ts +57 -0
  111. package/dist/types/Services/Common/ErrorPosting.d.ts +51 -0
  112. package/dist/types/Services/Common/RegexFunction.d.ts +29 -0
  113. package/dist/types/Services/Composition/BuildComposition.d.ts +40 -0
  114. package/dist/types/Services/Composition/CompositionCache.d.ts +93 -0
  115. package/dist/types/Services/Composition/CreateCompositionCache.d.ts +46 -0
  116. package/dist/types/Services/ConceptFinding/GetConceptByCharacterAndCategory.d.ts +5 -0
  117. package/dist/types/Services/Conversion/ConvertConcepts.d.ts +90 -0
  118. package/dist/types/Services/CreateBinaryTreeFromData.d.ts +39 -0
  119. package/dist/types/Services/CreateCharacterBinaryTreeFromData.d.ts +43 -0
  120. package/dist/types/Services/CreateConnectionBetweenTwoConcepts.d.ts +211 -0
  121. package/dist/types/Services/CreateDefaultConcept.d.ts +117 -0
  122. package/dist/types/Services/CreateTheComposition.d.ts +103 -0
  123. package/dist/types/Services/CreateTheConcept.d.ts +184 -0
  124. package/dist/types/Services/CreateTheConnection.d.ts +61 -0
  125. package/dist/types/Services/CreateTheConnectionGeneral.d.ts +132 -0
  126. package/dist/types/Services/CreateTypeTreeFromData.d.ts +44 -0
  127. package/dist/types/Services/Delete/DeleteConnectionByType.d.ts +60 -0
  128. package/dist/types/Services/Delete/GetAllConnectionByType.d.ts +64 -0
  129. package/dist/types/Services/DeleteConcept.d.ts +137 -0
  130. package/dist/types/Services/DeleteConnection.d.ts +196 -0
  131. package/dist/types/Services/FindConeceptsFromConnection.d.ts +181 -0
  132. package/dist/types/Services/FindConnectionsOfCompositionBulkInMemory.d.ts +159 -0
  133. package/dist/types/Services/GenerateHexNumber.d.ts +65 -0
  134. package/dist/types/Services/GetAccessIdOfUser.d.ts +0 -0
  135. package/dist/types/Services/GetComposition.d.ts +342 -0
  136. package/dist/types/Services/GetCompositionBulk.d.ts +259 -0
  137. package/dist/types/Services/GetCompositionList.d.ts +132 -0
  138. package/dist/types/Services/GetConceptByCharacter.d.ts +87 -0
  139. package/dist/types/Services/GetConnections.d.ts +74 -0
  140. package/dist/types/Services/GetDataFromIndexDb.d.ts +81 -0
  141. package/dist/types/Services/GetLink.d.ts +107 -0
  142. package/dist/types/Services/GetLinkerConnectionFromConcept.d.ts +102 -0
  143. package/dist/types/Services/GetMaximumConnectionSyncTime.d.ts +59 -0
  144. package/dist/types/Services/GetRelation.d.ts +167 -0
  145. package/dist/types/Services/GetTheConcept.d.ts +73 -0
  146. package/dist/types/Services/GetTheReferent.d.ts +76 -0
  147. package/dist/types/Services/InitializeSystem.d.ts +121 -0
  148. package/dist/types/Services/Local/CreateConnectionListFromDatat.d.ts +0 -0
  149. package/dist/types/Services/Local/CreateDefaultLConcept.d.ts +50 -0
  150. package/dist/types/Services/Local/CreateLocalBinaryTreeFromData.d.ts +50 -0
  151. package/dist/types/Services/Local/CreateLocalBinaryTypeTreeFromData.d.ts +55 -0
  152. package/dist/types/Services/Local/CreateLocalCharacterBinaryTree.d.ts +61 -0
  153. package/dist/types/Services/Local/CreateTheCompositionLocal.d.ts +72 -0
  154. package/dist/types/Services/Local/CreateTheConceptLocal.d.ts +60 -0
  155. package/dist/types/Services/Local/CreateTheConnectionLocal.d.ts +58 -0
  156. package/dist/types/Services/Local/GetCompositionListLocal.d.ts +105 -0
  157. package/dist/types/Services/Local/GetCompositionLocal.d.ts +98 -0
  158. package/dist/types/Services/Local/GetConceptByCharacterLocal.d.ts +58 -0
  159. package/dist/types/Services/Local/MakeTheConceptLocal.d.ts +73 -0
  160. package/dist/types/Services/Local/MakeTheInstanceConceptLocal.d.ts +91 -0
  161. package/dist/types/Services/Local/MakeTheTypeLocal.d.ts +73 -0
  162. package/dist/types/Services/Local/UpdateCompositionLocal.d.ts +103 -0
  163. package/dist/types/Services/MakeTheCharacter.d.ts +76 -0
  164. package/dist/types/Services/MakeTheCharacterData.d.ts +67 -0
  165. package/dist/types/Services/MakeTheConcept.d.ts +2 -0
  166. package/dist/types/Services/MakeTheInstanceConcept.d.ts +78 -0
  167. package/dist/types/Services/MakeTheLocalConcept.d.ts +0 -0
  168. package/dist/types/Services/MakeTheName.d.ts +83 -0
  169. package/dist/types/Services/MakeTheTimestamp.d.ts +70 -0
  170. package/dist/types/Services/MakeTheTypeConcept.d.ts +71 -0
  171. package/dist/types/Services/Mqtt/publishMessage.d.ts +28 -0
  172. package/dist/types/Services/Mqtt/subscribeMessage.d.ts +23 -0
  173. package/dist/types/Services/PatchComposition.d.ts +107 -0
  174. package/dist/types/Services/Search/DataIdFormat.d.ts +104 -0
  175. package/dist/types/Services/Search/FormatData.d.ts +101 -0
  176. package/dist/types/Services/Search/JustIdFormat.d.ts +98 -0
  177. package/dist/types/Services/Search/SearchLinkInternal.d.ts +30 -0
  178. package/dist/types/Services/Search/SearchLinkMultiple.d.ts +61 -0
  179. package/dist/types/Services/Search/SearchWithTypeAndLinker.d.ts +101 -0
  180. package/dist/types/Services/Search/orderingConnections.d.ts +36 -0
  181. package/dist/types/Services/Security/GetRequestHeader.d.ts +10 -0
  182. package/dist/types/Services/SplitStrings.d.ts +51 -0
  183. package/dist/types/Services/UpdateComposition.d.ts +125 -0
  184. package/dist/types/Services/User/UserTranslation.d.ts +108 -0
  185. package/dist/types/Services/View/ViewInternalData.d.ts +33 -0
  186. package/dist/types/WrapperFunctions/SchemaQueryObservable.d.ts +159 -0
  187. package/dist/types/app.d.ts +162 -0
  188. package/package.json +1 -1
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @module subscribeMessage
3
+ * @description Provides MQTT message subscription functionality for real-time cache invalidation (Currently commented out/unused)
4
+ */
5
+ /**
6
+ * MQTT message subscription handler (Currently disabled).
7
+ * When enabled, this function would subscribe to MQTT topics and handle incoming messages.
8
+ *
9
+ * @remarks
10
+ * This functionality is currently commented out and not in use.
11
+ * When enabled, it would:
12
+ * - Subscribe to MQTT message events
13
+ * - Listen for "compositionUpdate" topic
14
+ * - Parse composition IDs from messages
15
+ * - Remove compositions from cache (CompositionBinaryTree)
16
+ * - Provide real-time cache invalidation when compositions change
17
+ *
18
+ * To enable:
19
+ * 1. Uncomment the function code
20
+ * 2. Ensure global.mqttconn is properly initialized
21
+ * 3. Import CompositionBinaryTree
22
+ * 4. Set up proper MQTT connection management
23
+ */
@@ -0,0 +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
+ */
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
+ */
107
+ export default function PatchComposition(ofConcept: Concept, MainConcept: Concept, toConcept: Concept): void;
@@ -0,0 +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
+ */
5
+ import { Connection } from "../../app";
6
+ /**
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
+ */
35
+ export declare function FormatFunctionDataForData(connections: Connection[], compositionData: any[], reverse?: number[]): Promise<any[]>;
36
+ /**
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
+ */
75
+ export declare function FormatFromConnectionsAlteredArrayExternal(connections: Connection[], compositionData: any[], newCompositionData: any, mainComposition: number[], reverse: number[] | undefined, CountDictionary: any[]): Promise<any[]>;
76
+ /**
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
103
+ */
104
+ export declare function FormatFunctionData(connections: Connection[], compositionData: any[], reverse?: number[]): Promise<any[]>;
@@ -0,0 +1,101 @@
1
+ /**
2
+ * @module FormatData
3
+ * @description Provides functions to format connection data into structured composition objects for Normal format output
4
+ */
5
+ import { Connection } from "../../app";
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
15
+ *
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)
32
+ */
33
+ export declare function formatFunction(connections: Connection[], compositionData: any, reverse: number[]): Promise<any>;
34
+ /**
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
+ */
63
+ export declare function formatFunctionForData(connections: Connection[], compositionData: any, reverse: number[]): Promise<any>;
64
+ /**
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
+ */
101
+ export declare function FormatConceptsAndConnectionsNormalList(connections: Connection[] | undefined, compositionData: any[] | undefined, mainComposition: number[] | undefined, newCompositionData: any, reverse?: number[]): Promise<any[]>;
@@ -0,0 +1,98 @@
1
+ /**
2
+ * @module JustIdFormat
3
+ * @description Provides formatting functions for JustId format output, which includes simplified ID-based data structures
4
+ */
5
+ import { Connection } from "../../app";
6
+ /**
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
+ */
35
+ export declare function FormatFunctionDataForDataJustId(connections: Connection[], compositionData: any[], reverse?: number[]): Promise<any[]>;
36
+ /**
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
74
+ */
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
+ */
98
+ export declare function AddCount(ofTheConceptId: number, CountDictionary: any, newData: any): void;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @module SearchLinkInternal
3
+ * @description Provides functionality to search for internal links within concepts and return formatted data
4
+ */
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
+ */
30
+ export declare function SearchLinkInternal(searchQuery: SearchStructure, token?: string): Promise<any[]>;
@@ -0,0 +1,61 @@
1
+ /**
2
+ * @module SearchLinkMultiple
3
+ * @description Provides functionality to search for multiple links across compositions and format the results
4
+ */
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
+ */
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
+ */
61
+ export declare function FormatFromConnections(linkers: number[], compositionData: any[], mainComposition: number, reverse?: number[]): Promise<any>;
@@ -0,0 +1,101 @@
1
+ /**
2
+ * @module SearchWithTypeAndLinker
3
+ * @description Provides various formatting functions for search results with different output formats (Normal, DATA-ID, JustId)
4
+ */
5
+ import { CountInfo } from "../../DataStructures/Count/CountInfo";
6
+ /**
7
+ * Formats connections in the Normal format by fetching connections, converting them to single-level objects,
8
+ * and stitching them together to create a complex JSON structure or array.
9
+ *
10
+ * @async
11
+ * @param {number[]} linkers - Array of connection IDs that act as linkers between concepts
12
+ * @param {number[]} conceptIds - Array of concept IDs involved in the connections
13
+ * @param {number[]} mainCompositionIds - Array of main composition IDs to format
14
+ * @param {number[]} reverse - Array of connection IDs that should be treated as reverse connections
15
+ * @param {CountInfo[]} countInfos - Array of count information objects for connection statistics
16
+ * @returns {Promise<any[]>} A promise that resolves to an array of formatted composition data
17
+ *
18
+ * @example
19
+ * ```typescript
20
+ * const linkers = [101, 102];
21
+ * const conceptIds = [1, 2, 3];
22
+ * const mainIds = [100];
23
+ * const reverse = [102];
24
+ * const countInfos: CountInfo[] = [];
25
+ * const result = await formatConnections(linkers, conceptIds, mainIds, reverse, countInfos);
26
+ * ```
27
+ *
28
+ * @remarks
29
+ * Format: Normal - This format is used for standard composition retrieval
30
+ * Process:
31
+ * 1. Fetches all connections using the provided linker IDs
32
+ * 2. Orders the connections (descending by default)
33
+ * 3. Formats connections to single-level objects
34
+ * 4. Formats data connections
35
+ * 5. Combines and stitches all data into a complex structure
36
+ */
37
+ export declare function formatConnections(linkers: number[], conceptIds: number[], mainCompositionIds: number[], reverse: number[], countInfos: CountInfo[]): Promise<any>;
38
+ /**
39
+ * Formats connections in the DATA-ID format, which includes both data and ID information for each concept.
40
+ * Fetches connections, converts them to single-level objects, and stitches them together.
41
+ *
42
+ * @async
43
+ * @param {number[]} linkers - Array of connection IDs that act as linkers between concepts
44
+ * @param {number[]} conceptIds - Array of concept IDs involved in the connections
45
+ * @param {number[]} mainCompositionIds - Array of main composition IDs to format
46
+ * @param {number[]} reverse - Array of connection IDs that should be treated as reverse connections
47
+ * @param {CountInfo[]} countInfos - Array of count information objects for connection statistics
48
+ * @param {string} [order="DESC"] - Sort order for connections ("ASC" or "DESC")
49
+ * @returns {Promise<any[]>} A promise that resolves to an array of formatted composition data with ID and data fields
50
+ *
51
+ * @example
52
+ * ```typescript
53
+ * const result = await formatConnectionsDataId(
54
+ * [101, 102],
55
+ * [1, 2, 3],
56
+ * [100],
57
+ * [102],
58
+ * [],
59
+ * "ASC"
60
+ * );
61
+ * // Result format: [{ id: 100, data: {...}, created_on: timestamp }]
62
+ * ```
63
+ *
64
+ * @remarks
65
+ * Format: DATA-ID - Each result includes concept ID, data object, and creation timestamp
66
+ * This format is useful when you need to track both the identity and content of concepts
67
+ * The order parameter allows sorting connections by ID in ascending or descending order
68
+ */
69
+ export declare function formatConnectionsDataId(linkers: number[], conceptIds: number[], mainCompositionIds: number[], reverse: number[], countInfos: CountInfo[], order?: string): Promise<any>;
70
+ /**
71
+ * Formats connections in the JustId format, which provides a simplified view with IDs and minimal data.
72
+ * Fetches connections, converts them to single-level objects, and stitches them together.
73
+ *
74
+ * @async
75
+ * @param {number[]} linkers - Array of connection IDs that act as linkers between concepts
76
+ * @param {number[]} conceptIds - Array of concept IDs involved in the connections
77
+ * @param {number[]} mainCompositionIds - Array of main composition IDs to format
78
+ * @param {number[]} reverse - Array of connection IDs that should be treated as reverse connections
79
+ * @param {CountInfo[]} countInfos - Array of count information objects for connection statistics
80
+ * @param {string} [order="DESC"] - Sort order for connections ("ASC" or "DESC")
81
+ * @returns {Promise<any[]>} A promise that resolves to an array of formatted composition data with simplified ID structure
82
+ *
83
+ * @example
84
+ * ```typescript
85
+ * const result = await formatConnectionsJustId(
86
+ * [101, 102],
87
+ * [1, 2, 3],
88
+ * [100],
89
+ * [],
90
+ * [],
91
+ * "DESC"
92
+ * );
93
+ * // Result format: [{ id: 100, type: { id: 1, data: "value", created_on: timestamp } }]
94
+ * ```
95
+ *
96
+ * @remarks
97
+ * Format: JustId - This format provides a lightweight representation with IDs and essential data
98
+ * Useful for list views and when you need to minimize data transfer
99
+ * Each linked concept includes: ID, data value, and creation timestamp
100
+ */
101
+ export declare function formatConnectionsJustId(linkers: number[], conceptIds: number[], mainCompositionIds: number[], reverse: number[], countInfos: CountInfo[], order?: string): Promise<any>;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @module orderingConnections
3
+ * @description Provides functionality to sort connections by ID in ascending or descending order
4
+ */
5
+ import { Connection } from "../../app";
6
+ /**
7
+ * Sorts an array of connections by their ID in the specified order.
8
+ *
9
+ * @param {Connection[]} connections - Array of Connection objects to sort
10
+ * @param {string} [order="DESC"] - Sort order: "ASC" for ascending, "DESC" for descending
11
+ * @returns {Connection[]} The sorted array of connections (mutates the original array)
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * const connections: Connection[] = [
16
+ * { id: 103, ... },
17
+ * { id: 101, ... },
18
+ * { id: 102, ... }
19
+ * ];
20
+ *
21
+ * // Sort in descending order (newest first)
22
+ * const sorted = orderTheConnections(connections, "DESC");
23
+ * // Result: [{ id: 103 }, { id: 102 }, { id: 101 }]
24
+ *
25
+ * // Sort in ascending order (oldest first)
26
+ * const sortedAsc = orderTheConnections(connections, "ASC");
27
+ * // Result: [{ id: 101 }, { id: 102 }, { id: 103 }]
28
+ * ```
29
+ *
30
+ * @remarks
31
+ * - This function mutates the original array in place
32
+ * - Default order is "DESC" (descending, newest first)
33
+ * - Uses the connection ID for sorting
34
+ * - Any value other than "ASC" will result in descending order
35
+ */
36
+ export declare function orderTheConnections(connections: Connection[], order?: string): Connection[];