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,63 @@
1
+ /**
2
+ * API module for retrieving all linker connections pointing to a specific concept.
3
+ * This module fetches inbound linker connections where the specified concept acts as the target,
4
+ * enabling discovery of what other concepts reference or link to the given concept.
5
+ *
6
+ * @module Api/GetAllLinkerConnectionsToTheConcept
7
+ * @see https://documentation.freeschema.com for more information on the Concept Connection System
8
+ */
9
+ import { Connection } from "../DataStructures/Connection";
10
+ /**
11
+ * Retrieves all linker connections that point to a specific concept.
12
+ * This function fetches connections where the specified concept is the target (to-concept),
13
+ * allowing you to discover all concepts that link to or reference this concept.
14
+ *
15
+ * Linker connections represent directed relationships in the concept graph, and this function
16
+ * specifically returns inbound connections where the given concept acts as the destination.
17
+ * This is essential for reverse graph traversal, finding references, and understanding what
18
+ * other concepts depend on or relate to the specified concept.
19
+ *
20
+ * @param conceptId - The unique identifier of the concept whose inbound linker connections should be retrieved
21
+ *
22
+ * @returns A promise that resolves to an array of Connection objects pointing to the specified concept
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * // Get all connections to concept 789
27
+ * const inboundConnections = await GetAllLinkerConnectionsToTheConcept(789);
28
+ *
29
+ * // Discover what links to this concept
30
+ * inboundConnections.forEach(connection => {
31
+ * console.log(`Concept ${connection.fromConceptId} links to concept 789`);
32
+ * });
33
+ *
34
+ * // Find all references to a concept
35
+ * async function findReferences(conceptId: number) {
36
+ * const connections = await GetAllLinkerConnectionsToTheConcept(conceptId);
37
+ * return connections.map(conn => conn.fromConceptId);
38
+ * }
39
+ *
40
+ * // Check if a concept is referenced
41
+ * async function isConceptReferenced(conceptId: number): Promise<boolean> {
42
+ * const connections = await GetAllLinkerConnectionsToTheConcept(conceptId);
43
+ * return connections.length > 0;
44
+ * }
45
+ * ```
46
+ *
47
+ * @remarks
48
+ * This function uses a GET request with the concept ID as a query parameter.
49
+ * Unlike some other API functions, it does not automatically add connections to ConnectionData,
50
+ * allowing the caller to decide how to handle the returned connections.
51
+ *
52
+ * The function returns an empty array if the request fails or if no connections are found.
53
+ * Errors are logged with the prefix 'Get all linker connection To the concepts error'.
54
+ *
55
+ * This function is the complement to GetAllLinkerConnectionsFromTheConcept - together they
56
+ * provide complete bidirectional navigation of the concept graph.
57
+ *
58
+ * @throws Will throw an error if the network request fails or if the server returns an error response
59
+ *
60
+ * @see GetAllLinkerConnectionsFromTheConcept for retrieving outbound connections from a concept
61
+ * @see Connection for the connection data structure
62
+ */
63
+ export declare function GetAllLinkerConnectionsToTheConcept(conceptId: number): Promise<Connection[]>;
@@ -0,0 +1,52 @@
1
+ /**
2
+ * API module for prefetching connections to optimize application performance.
3
+ * This module retrieves frequently accessed or anticipated connections in advance,
4
+ * storing them for faster access and improved user experience.
5
+ *
6
+ * @module Api/GetAllPrefetchConnections
7
+ * @see https://documentation.freeschema.com for more information on the Concept Connection System
8
+ */
9
+ /**
10
+ * Prefetches connections for a user to optimize application performance and reduce load times.
11
+ * This function retrieves connections that are likely to be needed soon, such as connections
12
+ * for concepts on the current or next page, and stores them in persistent storage for fast access.
13
+ *
14
+ * Prefetching is a performance optimization technique that loads data before it's explicitly requested,
15
+ * reducing perceived latency and improving user experience. This function is particularly useful
16
+ * for pagination scenarios or predictive loading based on user behavior.
17
+ *
18
+ * @param userId - The unique identifier of the user whose connections should be prefetched
19
+ * @param inpage - The page number or index indicating which set of connections to prefetch
20
+ *
21
+ * @returns A promise that resolves when all prefetch connections have been fetched and stored
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * // Prefetch connections for user 123 on page 1
26
+ * await GetAllPrefetchConnections(123, 1);
27
+ *
28
+ * // Prefetch connections for the next page in advance
29
+ * const currentPage = 2;
30
+ * await GetAllPrefetchConnections(userId, currentPage + 1);
31
+ *
32
+ * // Connections are now in storage and will load instantly when needed
33
+ * const connections = await ConnectionData.GetConnectionsFromStorage();
34
+ * ```
35
+ *
36
+ * @remarks
37
+ * This function includes performance timing to measure the prefetch operation duration,
38
+ * logging the elapsed time in milliseconds to help monitor and optimize performance.
39
+ *
40
+ * Unlike other connection fetch functions, this uses AddConnectionToStorage rather than
41
+ * AddConnection, which may indicate a different storage mechanism optimized for prefetching.
42
+ *
43
+ * The function uses URLSearchParams to encode the user_id parameter in the request body.
44
+ * Errors are logged with the prefix 'Get all prefetch connections error message' and are
45
+ * re-thrown to allow calling code to handle failures.
46
+ *
47
+ * @throws Will throw an error if the network request fails or if the server returns an error response
48
+ *
49
+ * @see ConnectionData.AddConnectionToStorage for the specialized storage mechanism
50
+ * @see GetRequestHeader for request header configuration
51
+ */
52
+ export declare function GetAllPrefetchConnections(userId: number, inpage: number): Promise<void>;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Module for retrieving character data by character value from the CCS API.
3
+ * This module provides functionality to fetch TheCharacter objects using their unique character values.
4
+ *
5
+ * @module Api/GetCharacterDataByCharacter
6
+ * @see https://documentation.freeschema.com for API reference
7
+ */
8
+ import { TheCharacter } from "../DataStructures/TheCharacter";
9
+ /**
10
+ * Retrieves a character object from the database by its character value.
11
+ * This function makes an API call to fetch character data and returns the corresponding TheCharacter object.
12
+ *
13
+ * @param characterValue - The unique string identifier for the character to retrieve
14
+ * @returns A promise that resolves to the TheCharacter object containing the character data
15
+ *
16
+ * @throws {Error} Throws an error if the HTTP request fails or if the response status is not OK
17
+ *
18
+ * @example
19
+ * ```typescript
20
+ * // Fetch a character by its character value
21
+ * const character = await GetCharacterByCharacter("a");
22
+ * console.log(character.id, character.characterValue);
23
+ * ```
24
+ *
25
+ * @remarks
26
+ * This function uses form-urlencoded content type for the POST request.
27
+ * The character_value is sent as a form parameter to the API endpoint.
28
+ * Any HTTP errors are logged and handled through the HandleHttpError service.
29
+ *
30
+ * @see TheCharacter for the structure of the returned object
31
+ * @see BaseUrl.GetCharacterByCharacterUrl for the API endpoint
32
+ */
33
+ export declare function GetCharacterByCharacter(characterValue: string): Promise<TheCharacter>;
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Module for retrieving composition connections between two concepts in the CCS system.
3
+ * Composition connections represent hierarchical or structural relationships where one concept is composed of or contains another.
4
+ *
5
+ * @module Api/GetCompositionConnectionsBetweenTwoConcepts
6
+ * @see https://documentation.freeschema.com for composition connection details
7
+ */
8
+ import { Connection } from "../DataStructures/Connection";
9
+ /**
10
+ * Retrieves all composition connections that exist between two specific concepts.
11
+ * Composition connections define structural relationships where concepts are part of or contained within other concepts.
12
+ *
13
+ * @param ofConceptId - The ID of the source concept (the concept that has the composition relationship)
14
+ * @param toConcept - The ID of the target concept (the concept being composed or contained)
15
+ * @param mainKey - The main key identifier used for additional filtering or context
16
+ * @returns A promise that resolves to an array of Connection objects representing the composition relationships
17
+ *
18
+ * @example
19
+ * ```typescript
20
+ * // Get composition connections from concept 100 to concept 200
21
+ * const connections = await GetCompositionConnectionsBetweenTwoConcepts(100, 200, 1);
22
+ * connections.forEach(conn => {
23
+ * console.log(`Connection ID: ${conn.id}`);
24
+ * });
25
+ * ```
26
+ *
27
+ * @remarks
28
+ * This function:
29
+ * - Sends FormData with concept IDs and main key to the API
30
+ * - Automatically caches all retrieved connections in ConnectionData
31
+ * - Returns an empty array if the request fails rather than throwing
32
+ * - Logs errors but doesn't propagate them unless an exception occurs
33
+ *
34
+ * The connections are bidirectional composition relationships that help build
35
+ * hierarchical concept structures in the CCS system.
36
+ *
37
+ * @see Connection for the structure of connection objects
38
+ * @see ConnectionData.AddConnection for how connections are cached
39
+ * @see BaseUrl.GetCompositionConnectionBetweenTwoConceptsUrl for the API endpoint
40
+ */
41
+ export declare function GetCompositionConnectionsBetweenTwoConcepts(ofConceptId: number, toConcept: number, mainKey: number): Promise<Connection[]>;
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Module for retrieving individual concepts from the CCS system.
3
+ * Provides caching and optimized retrieval of Concept objects by their unique identifiers.
4
+ *
5
+ * @module Api/GetConcept
6
+ * @see https://documentation.freeschema.com for concept details
7
+ */
8
+ import { Concept } from "./../DataStructures/Concept";
9
+ /**
10
+ * Retrieves a concept by its unique ID with built-in caching and request deduplication.
11
+ * This is the primary function for fetching individual concepts in the CCS system.
12
+ *
13
+ * @param id - The unique numeric identifier of the concept to retrieve
14
+ * @returns A promise that resolves to the Concept object, or a default concept if not found
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * // Fetch a concept by ID
19
+ * const concept = await GetConcept(123);
20
+ * if (concept.id !== 0) {
21
+ * console.log(`Found concept: ${concept.characterValue}`);
22
+ * }
23
+ * ```
24
+ *
25
+ * @remarks
26
+ * This function implements a sophisticated multi-layer retrieval strategy:
27
+ *
28
+ * 1. Request Deduplication: If a request for the same ID is already in-flight,
29
+ * returns the existing promise instead of making a duplicate API call.
30
+ *
31
+ * 2. Local Cache Check: First checks ConceptsData for a cached concept or NPC marker.
32
+ *
33
+ * 3. API Fallback: If not found locally, fetches from the API endpoint.
34
+ *
35
+ * 4. NPC Tracking: If the API returns a concept with id = 0, marks it as an NPC
36
+ * (Non-Persistent Concept) to avoid repeated failed lookups.
37
+ *
38
+ * 5. Cache Cleanup: The in-flight request cache is automatically cleaned up
39
+ * after each request completes (success or failure).
40
+ *
41
+ * The function always returns a Concept object - either the found concept,
42
+ * or a default concept with id = 0 if not found.
43
+ *
44
+ * @see Concept for the structure of concept objects
45
+ * @see ConceptsData.GetConcept for local cache retrieval
46
+ * @see CreateDefaultConcept for default concept creation
47
+ * @see GetConceptBulk for retrieving multiple concepts efficiently
48
+ */
49
+ export declare function GetConcept(id: number): Promise<Concept>;
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Module for bulk retrieval of concepts from the CCS system.
3
+ * Provides optimized batch fetching of multiple concepts in a single API request.
4
+ *
5
+ * @module Api/GetConceptBulk
6
+ * @see https://documentation.freeschema.com for bulk operation details
7
+ */
8
+ import { Concept } from "./../DataStructures/Concept";
9
+ /**
10
+ * Retrieves multiple concepts in a single optimized API request.
11
+ * This function checks the local cache first and only fetches uncached concepts from the API.
12
+ *
13
+ * @param conceptIds - Array of concept IDs to retrieve
14
+ * @returns A promise that resolves to an array of Concept objects
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * // Fetch multiple concepts at once
19
+ * const concepts = await GetConceptBulk([1, 2, 3, 4, 5]);
20
+ * concepts.forEach(concept => {
21
+ * console.log(`Concept ${concept.id}: ${concept.characterValue}`);
22
+ * });
23
+ * ```
24
+ *
25
+ * @remarks
26
+ * Performance optimization strategy:
27
+ * 1. Checks ConceptsData cache for each requested concept ID
28
+ * 2. Immediately returns cached concepts without API call
29
+ * 3. Batches all uncached IDs into a single bulk API request
30
+ * 4. Caches all newly fetched concepts for future use
31
+ * 5. Returns empty array if all concepts are cached or if the API request fails
32
+ *
33
+ * This is significantly more efficient than calling GetConcept() multiple times
34
+ * when you need to retrieve multiple concepts, as it reduces network overhead.
35
+ *
36
+ * @see Concept for the structure of concept objects
37
+ * @see ConceptsData.AddConcept for caching mechanism
38
+ * @see GetConcept for single concept retrieval
39
+ * @see BulkConceptGetterApi for alternative bulk fetching without cache checking
40
+ */
41
+ export declare function GetConceptBulk(conceptIds: number[]): Promise<Concept[]>;
42
+ /**
43
+ * Alternative bulk concept fetcher that directly queries the API without pre-checking the cache.
44
+ * This function is useful when you want to force-fetch concepts from the API regardless of cache state.
45
+ *
46
+ * @param bulkConceptFetch - Array of concept IDs to fetch from the API
47
+ * @returns A promise that resolves to an array of Concept objects
48
+ *
49
+ * @example
50
+ * ```typescript
51
+ * // Force fetch concepts from API bypassing cache check
52
+ * const freshConcepts = await BulkConceptGetterApi([10, 20, 30]);
53
+ * console.log(`Fetched ${freshConcepts.length} concepts`);
54
+ * ```
55
+ *
56
+ * @remarks
57
+ * Differences from GetConceptBulk:
58
+ * - Does NOT check ConceptsData cache before making the API request
59
+ * - Always makes an API call if IDs are provided (except when array is empty)
60
+ * - Still caches the fetched concepts in ConceptsData after retrieval
61
+ * - Uses JSON content type for the request
62
+ *
63
+ * Use this function when:
64
+ * - You need the latest data from the server
65
+ * - You want to refresh cached concepts
66
+ * - Cache invalidation is needed for specific concepts
67
+ *
68
+ * @see GetConceptBulk for cache-aware bulk retrieval
69
+ * @see ConceptsData.AddConcept for caching mechanism
70
+ */
71
+ export declare function BulkConceptGetterApi(bulkConceptFetch: number[]): Promise<Concept[]>;
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Module for retrieving concepts by their character value and type combination.
3
+ * Provides specialized lookup for concepts using both character identifier and type classification.
4
+ *
5
+ * @module Api/GetConceptByCharacterAndType
6
+ * @see https://documentation.freeschema.com for character and type system details
7
+ */
8
+ import { Concept } from "./../DataStructures/Concept";
9
+ /**
10
+ * Retrieves a concept by its character value and type ID combination.
11
+ * This provides a more specific lookup than character value alone, useful when the same
12
+ * character can represent different concepts of different types.
13
+ *
14
+ * @param characterValue - The character string identifier of the concept
15
+ * @param typeId - The type ID that classifies the concept
16
+ * @returns A promise that resolves to the Concept object matching both criteria
17
+ *
18
+ * @example
19
+ * ```typescript
20
+ * // Get a specific concept by character and type
21
+ * const concept = await GetConceptByCharacterAndType("user", 5);
22
+ * if (concept && concept.id !== 0) {
23
+ * console.log(`Found concept: ${concept.id}`);
24
+ * }
25
+ * ```
26
+ *
27
+ * @remarks
28
+ * This function implements a multi-layer lookup strategy:
29
+ *
30
+ * 1. Request Deduplication: Caches in-flight requests using a composite key
31
+ * (characterValue + typeId) to prevent duplicate API calls.
32
+ *
33
+ * 2. Local Cache Check: First attempts to retrieve from ConceptsData using
34
+ * GetConceptByCharacterAndTypeLocal() method.
35
+ *
36
+ * 3. API Fallback: If not found locally, makes an API request with both
37
+ * character_value and type_id as JSON parameters.
38
+ *
39
+ * 4. Automatic Caching: Successfully retrieved concepts are cached in
40
+ * ConceptsData for future lookups.
41
+ *
42
+ * This is particularly useful in systems where the same character string
43
+ * can represent different semantic concepts based on context or type.
44
+ *
45
+ * @see Concept for the structure of concept objects
46
+ * @see ConceptsData.GetConceptByCharacterAndTypeLocal for local cache lookup
47
+ * @see GetConceptByCharacterValue for type-agnostic character lookup
48
+ * @see GetConceptByTypeBulk for bulk retrieval by type
49
+ */
50
+ export declare function GetConceptByCharacterAndType(characterValue: string, typeId: number): Promise<Concept>;
51
+ /**
52
+ * Retrieves multiple concepts matching any of the specified connection types in bulk.
53
+ * This function first fetches concept IDs by type, then retrieves the full concept data.
54
+ *
55
+ * @param connectionTypes - Array of connection type strings to match
56
+ * @returns A promise that resolves to an array of Concept objects matching the specified types
57
+ *
58
+ * @example
59
+ * ```typescript
60
+ * // Get all concepts associated with specific connection types
61
+ * const concepts = await GetConceptByTypeBulk(["friendship", "colleague", "family"]);
62
+ * console.log(`Found ${concepts.length} concepts`);
63
+ * ```
64
+ *
65
+ * @remarks
66
+ * This function performs a two-stage retrieval:
67
+ * 1. First API call: Sends connection types to get matching concept IDs
68
+ * 2. Second stage: Uses GetConceptBulk to efficiently fetch all concept data
69
+ *
70
+ * The connection types are sent as a JSON array to the API endpoint.
71
+ * This is useful for finding all concepts that participate in connections
72
+ * of specific types, enabling type-based concept discovery and filtering.
73
+ *
74
+ * @see GetConceptBulk for the bulk concept retrieval mechanism
75
+ * @see GetConceptByCharacterAndType for single concept lookup by character and type
76
+ * @see BaseUrl.GetConceptConnectionByType for the API endpoint
77
+ */
78
+ export declare function GetConceptByTypeBulk(connectionTypes: string[]): Promise<Concept[]>;
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Module for retrieving concepts by their character value string.
3
+ * Provides lookup functionality for concepts using their character identifier without type restrictions.
4
+ *
5
+ * @module Api/GetConceptByCharacterValue
6
+ * @see https://documentation.freeschema.com for character value system details
7
+ */
8
+ import { Concept } from "../DataStructures/Concept";
9
+ /**
10
+ * Retrieves a concept by its character value string identifier.
11
+ * This function performs a type-agnostic lookup, returning the first concept matching the character value.
12
+ *
13
+ * @param characterValue - The character string identifier of the concept to retrieve
14
+ * @returns A promise that resolves to the Concept object, or a default concept if not found
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * // Fetch a concept by its character value
19
+ * const concept = await GetConceptByCharacterValue("username");
20
+ * if (concept.id > 0) {
21
+ * console.log(`Found concept with ID: ${concept.id}`);
22
+ * } else {
23
+ * console.log("Concept not found");
24
+ * }
25
+ * ```
26
+ *
27
+ * @remarks
28
+ * This function provides a simplified lookup mechanism:
29
+ *
30
+ * 1. Makes a direct API call with the character_value parameter
31
+ * 2. Does not check local cache before making the request
32
+ * 3. Automatically caches successful results in ConceptsData
33
+ * 4. Returns a default concept (id = 0) if not found or on error
34
+ *
35
+ * Key characteristics:
36
+ * - Uses form-urlencoded content type for the POST request
37
+ * - Only caches concepts with id > 0 (valid concepts)
38
+ * - Does not throw errors on HTTP failure, only logs them
39
+ * - Simpler than GetConceptByCharacterAndType as it doesn't consider type
40
+ *
41
+ * Use this when you know the character value uniquely identifies a concept,
42
+ * or when type information is not available or relevant.
43
+ *
44
+ * @see Concept for the structure of concept objects
45
+ * @see CreateDefaultConcept for default concept structure
46
+ * @see GetConceptByCharacterAndType for character+type lookup
47
+ * @see ConceptsData.AddConcept for caching mechanism
48
+ */
49
+ export declare function GetConceptByCharacterValue(characterValue: string): Promise<Concept>;
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Module for retrieving individual connections from the CCS system.
3
+ * Provides caching and optimized retrieval of Connection objects by their unique identifiers.
4
+ *
5
+ * @module Api/GetConnection
6
+ * @see https://documentation.freeschema.com for connection details
7
+ */
8
+ import { Connection } from "../DataStructures/Connection";
9
+ /**
10
+ * Retrieves a connection by its unique ID with automatic caching.
11
+ * Connections represent relationships between concepts in the CCS system.
12
+ *
13
+ * @param id - The unique numeric identifier of the connection to retrieve
14
+ * @returns A promise that resolves to the Connection object
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * // Fetch a connection by ID
19
+ * const connection = await GetConnection(456);
20
+ * if (connection.id !== 0) {
21
+ * console.log(`Connection from ${connection.ofTheConceptId} to ${connection.toTheConceptId}`);
22
+ * }
23
+ * ```
24
+ *
25
+ * @remarks
26
+ * This function implements a two-tier retrieval strategy:
27
+ *
28
+ * 1. Local Cache Check: First attempts to retrieve the connection from
29
+ * ConnectionData cache using GetConnection().
30
+ *
31
+ * 2. API Fallback: If not found in cache (id = 0), makes an API request
32
+ * to fetch the connection from the server.
33
+ *
34
+ * 3. Automatic Caching: Successfully retrieved connections are cached in
35
+ * ConnectionData for future lookups.
36
+ *
37
+ * Key characteristics:
38
+ * - Uses form-urlencoded content type for POST request
39
+ * - Always returns a Connection object (default has id = 0 if not found)
40
+ * - Errors are logged but propagated to caller
41
+ * - Does not implement request deduplication (unlike GetConcept)
42
+ *
43
+ * Connections are fundamental to the CCS system, linking concepts together
44
+ * and forming the relationship graph that defines knowledge structure.
45
+ *
46
+ * @see Connection for the structure of connection objects
47
+ * @see ConnectionData.GetConnection for cache retrieval
48
+ * @see ConnectionData.AddConnection for caching mechanism
49
+ * @see GetConnectionBulk for retrieving multiple connections efficiently
50
+ */
51
+ export declare function GetConnection(id: number): Promise<Connection>;
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Module for bulk retrieval of connections from the CCS system.
3
+ * Provides optimized batch fetching of multiple connections in a single API request.
4
+ *
5
+ * @module Api/GetConnectionBulk
6
+ * @see https://documentation.freeschema.com for bulk connection operations
7
+ */
8
+ import { Connection } from "../DataStructures/Connection";
9
+ /**
10
+ * Retrieves multiple connections in a single optimized API request.
11
+ * This function checks the local cache first and only fetches uncached connections from the API.
12
+ *
13
+ * @param connectionIds - Array of connection IDs to retrieve (defaults to empty array)
14
+ * @returns A promise that resolves to an array of Connection objects
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * // Fetch multiple connections at once
19
+ * const connections = await GetConnectionBulk([101, 102, 103, 104]);
20
+ * connections.forEach(conn => {
21
+ * console.log(`Connection ${conn.id}: ${conn.ofTheConceptId} -> ${conn.toTheConceptId}`);
22
+ * });
23
+ * ```
24
+ *
25
+ * @remarks
26
+ * Performance optimization strategy:
27
+ * 1. Checks ConnectionData cache for each requested connection ID
28
+ * 2. Immediately includes cached connections in results
29
+ * 3. Batches all uncached IDs into a single bulk API request
30
+ * 4. Caches all newly fetched connections for future use
31
+ * 5. Automatically fetches related concepts via FindConceptsFromConnections
32
+ * 6. Returns empty array if all connections are cached or if none requested
33
+ *
34
+ * This function provides significant performance benefits:
35
+ * - Reduces network overhead by batching API requests
36
+ * - Avoids redundant fetches through cache checking
37
+ * - Proactively loads related concepts to prevent N+1 query problems
38
+ *
39
+ * The automatic concept fetching ensures that when you have connections,
40
+ * you also have the concepts they connect, enabling immediate relationship
41
+ * traversal without additional API calls.
42
+ *
43
+ * @see Connection for the structure of connection objects
44
+ * @see ConnectionData.AddConnection for caching mechanism
45
+ * @see GetConnection for single connection retrieval
46
+ * @see FindConceptsFromConnections for automatic concept loading
47
+ */
48
+ export declare function GetConnectionBulk(connectionIds?: number[]): Promise<Connection[]>;
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Module for retrieving outgoing connections from a specific concept.
3
+ * Provides paginated access to connections where a concept is the source (ofTheConcept).
4
+ *
5
+ * @module Api/GetConnectionOfTheConcept
6
+ * @see https://documentation.freeschema.com for connection direction details
7
+ */
8
+ import { Connection } from "../DataStructures/Connection";
9
+ /**
10
+ * Retrieves all connections originating from a specific concept with pagination support.
11
+ * Returns connections where the specified concept is the source (ofTheConcept).
12
+ *
13
+ * @param typeId - The type ID to filter connections by connection type
14
+ * @param ofTheConceptId - The ID of the source concept whose outgoing connections to retrieve
15
+ * @param userId - The user ID for access control and filtering
16
+ * @param inpage - Number of connections per page (default: 10)
17
+ * @param page - Page number for pagination, 1-indexed (default: 1)
18
+ * @returns A promise that resolves to an array of Connection objects
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * // Get first 10 connections of type 5 from concept 100 for user 1
23
+ * const connections = await GetConnectionOfTheConcept(5, 100, 1);
24
+ * console.log(`Found ${connections.length} outgoing connections`);
25
+ *
26
+ * // Get second page with 20 connections per page
27
+ * const moreConnections = await GetConnectionOfTheConcept(5, 100, 1, 20, 2);
28
+ * ```
29
+ *
30
+ * @remarks
31
+ * Connection Direction:
32
+ * This function retrieves "outgoing" or "from" connections where the specified
33
+ * concept is the source. In the CCS graph model, these represent relationships
34
+ * initiated by or originating from the concept.
35
+ *
36
+ * Pagination:
37
+ * - Uses 1-based page numbering (page 1 is the first page)
38
+ * - Results are limited by the inpage parameter
39
+ * - Useful for large result sets to avoid loading all connections at once
40
+ *
41
+ * Filtering:
42
+ * - typeId filters connections by their type/relationship kind
43
+ * - userId enables user-specific visibility and access control
44
+ *
45
+ * The function does NOT automatically cache results in ConnectionData,
46
+ * unlike GetConnection or GetConnectionBulk. It returns the raw API response.
47
+ *
48
+ * @see Connection for the structure of connection objects
49
+ * @see GetConnectionToTheConcept for retrieving incoming connections
50
+ * @see GetConnectionBulk for bulk connection retrieval with caching
51
+ */
52
+ export declare function GetConnectionOfTheConcept(typeId: number, ofTheConceptId: number, userId: number, inpage?: number, page?: number): Promise<Connection[]>;
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Module for retrieving incoming connections to a specific concept.
3
+ * Provides paginated access to connections where a concept is the target (toTheConcept).
4
+ *
5
+ * @module Api/GetConnectionToTheConcept
6
+ * @see https://documentation.freeschema.com for connection direction details
7
+ */
8
+ import { Connection } from "../DataStructures/Connection";
9
+ /**
10
+ * Retrieves all connections pointing to a specific concept with pagination support.
11
+ * Returns connections where the specified concept is the target (toTheConcept).
12
+ *
13
+ * @param typeId - The type ID to filter connections by connection type
14
+ * @param toTheConceptId - The ID of the target concept whose incoming connections to retrieve
15
+ * @param userId - The user ID for access control and filtering
16
+ * @param inpage - Number of connections per page (default: 10)
17
+ * @param page - Page number for pagination, 1-indexed (default: 1)
18
+ * @returns A promise that resolves to an array of Connection objects
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * // Get first 10 connections of type 3 pointing to concept 200 for user 1
23
+ * const connections = await GetConnectionToTheConcept(3, 200, 1);
24
+ * console.log(`Found ${connections.length} incoming connections`);
25
+ *
26
+ * // Get second page with 20 connections per page
27
+ * const moreConnections = await GetConnectionToTheConcept(3, 200, 1, 20, 2);
28
+ * ```
29
+ *
30
+ * @remarks
31
+ * Connection Direction:
32
+ * This function retrieves "incoming" or "to" connections where the specified
33
+ * concept is the target. In the CCS graph model, these represent relationships
34
+ * directed toward or pointing to the concept.
35
+ *
36
+ * Use Cases:
37
+ * - Finding all concepts that reference a specific concept
38
+ * - Discovering backlinks or reverse relationships
39
+ * - Building bidirectional relationship navigation
40
+ * - Analyzing concept dependencies
41
+ *
42
+ * Pagination:
43
+ * - Uses 1-based page numbering (page 1 is the first page)
44
+ * - Results are limited by the inpage parameter
45
+ * - Useful for large result sets to avoid loading all connections at once
46
+ *
47
+ * Filtering:
48
+ * - typeId filters connections by their type/relationship kind
49
+ * - userId enables user-specific visibility and access control
50
+ *
51
+ * The function does NOT automatically cache results in ConnectionData,
52
+ * unlike GetConnection or GetConnectionBulk. It returns the raw API response.
53
+ *
54
+ * @see Connection for the structure of connection objects
55
+ * @see GetConnectionOfTheConcept for retrieving outgoing connections
56
+ * @see GetConnectionBulk for bulk connection retrieval with caching
57
+ */
58
+ export declare function GetConnectionToTheConcept(typeId: number, toTheConceptId: number, userId: number, inpage?: number, page?: number): Promise<Connection[]>;