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.
- package/README.md +1148 -11
- package/dist/types/Api/Create/CreateTheCharacter.d.ts +42 -0
- package/dist/types/Api/Create/CreateTheConceptApi.d.ts +50 -0
- package/dist/types/Api/Create/CreateTheConnectionApi.d.ts +51 -0
- package/dist/types/Api/Create/CreateTheTextData.d.ts +56 -0
- package/dist/types/Api/Delete/DeleteConceptInBackend.d.ts +43 -0
- package/dist/types/Api/DeleteConnectionApiBulk.d.ts +55 -0
- package/dist/types/Api/DeleteTheConcept.d.ts +64 -0
- package/dist/types/Api/DeleteTheConnection.d.ts +76 -0
- package/dist/types/Api/GetAiData.d.ts +36 -0
- package/dist/types/Api/GetAllConcepts.d.ts +42 -0
- package/dist/types/Api/GetAllConceptsByType.d.ts +45 -0
- package/dist/types/Api/GetAllConnections.d.ts +48 -0
- package/dist/types/Api/GetAllConnectionsOfComposition.d.ts +79 -0
- package/dist/types/Api/GetAllConnectionsOfCompositionBulk.d.ts +90 -0
- package/dist/types/Api/GetAllLinkerConnectionsFromTheConcept.d.ts +52 -0
- package/dist/types/Api/GetAllLinkerConnectionsToTheConcept.d.ts +61 -0
- package/dist/types/Api/GetAllPrefetchConnections.d.ts +51 -0
- package/dist/types/Api/GetCharacterDataByCharacter.d.ts +31 -0
- package/dist/types/Api/GetCompositionConnectionsBetweenTwoConcepts.d.ts +39 -0
- package/dist/types/Api/GetConcept.d.ts +47 -0
- package/dist/types/Api/GetConceptBulk.d.ts +68 -0
- package/dist/types/Api/GetConceptByCharacterAndType.d.ts +75 -0
- package/dist/types/Api/GetConceptByCharacterValue.d.ts +47 -0
- package/dist/types/Api/GetConnection.d.ts +49 -0
- package/dist/types/Api/GetConnectionBulk.d.ts +46 -0
- package/dist/types/Api/GetConnectionOfTheConcept.d.ts +50 -0
- package/dist/types/Api/GetConnectionToTheConcept.d.ts +56 -0
- package/dist/types/Api/GetReservedConnectionIds.d.ts +36 -0
- package/dist/types/Api/GetReservedIds.d.ts +37 -0
- package/dist/types/Api/Login.d.ts +38 -0
- package/dist/types/Api/MakeTheNameInBackend.d.ts +39 -0
- package/dist/types/Api/MakeTheTypeConceptApi.d.ts +40 -0
- package/dist/types/Api/RecursiveSearch.d.ts +43 -0
- package/dist/types/Api/Search/FreeschemaQueryApi.d.ts +46 -0
- package/dist/types/Api/Search/Search.d.ts +67 -0
- package/dist/types/Api/Search/SearchInternalApi.d.ts +69 -0
- package/dist/types/Api/Search/SearchLinkMultipleApi.d.ts +90 -0
- package/dist/types/Api/Search/SearchWithLinker.d.ts +97 -0
- package/dist/types/Api/SearchConcept/GetConceptByCharacterAndCategoryApi.d.ts +39 -0
- package/dist/types/Api/SearchConcept/GetConceptByCharacterAndCategoryDirect.d.ts +47 -0
- package/dist/types/Api/Session/CreateSession.d.ts +45 -0
- package/dist/types/Api/Session/CreateSessionVisit.d.ts +43 -0
- package/dist/types/Api/Signin.d.ts +48 -0
- package/dist/types/Api/Signup.d.ts +44 -0
- package/dist/types/Api/View/ViewInternalDataApi.d.ts +50 -0
- package/dist/types/Constants/ApiConstants.d.ts +226 -0
- package/dist/types/Constants/FormatConstants.d.ts +80 -0
- package/dist/types/DataStructures/BaseUrl.d.ts +210 -0
- package/dist/types/DataStructures/BinaryCharacterTree.d.ts +211 -0
- package/dist/types/DataStructures/BinaryTree.d.ts +139 -0
- package/dist/types/DataStructures/BinaryTypeTree.d.ts +196 -0
- package/dist/types/DataStructures/CharacterRepository.d.ts +109 -0
- package/dist/types/DataStructures/Composition/Composition.d.ts +103 -0
- package/dist/types/DataStructures/Composition/CompositionBinaryTree.d.ts +104 -0
- package/dist/types/DataStructures/Composition/CompositionNode.d.ts +202 -0
- package/dist/types/DataStructures/Concept.d.ts +110 -0
- package/dist/types/DataStructures/ConceptData.d.ts +292 -0
- package/dist/types/DataStructures/ConceptsToDraw.d.ts +168 -0
- package/dist/types/DataStructures/Connection.d.ts +76 -0
- package/dist/types/DataStructures/ConnectionBinaryTree/ConnectionBinaryTree.d.ts +115 -0
- package/dist/types/DataStructures/ConnectionBinaryTree/ConnectionNode.d.ts +169 -0
- package/dist/types/DataStructures/ConnectionBinaryTree/ConnectionTypeTree.d.ts +82 -0
- package/dist/types/DataStructures/ConnectionData.d.ts +191 -0
- package/dist/types/DataStructures/Count/CountInfo.d.ts +73 -0
- package/dist/types/DataStructures/FilterSearch.d.ts +84 -0
- package/dist/types/DataStructures/IdentifierFlags.d.ts +34 -0
- package/dist/types/DataStructures/Local/LConcept.d.ts +105 -0
- package/dist/types/DataStructures/Local/LConnection.d.ts +83 -0
- package/dist/types/DataStructures/Local/LNode.d.ts +190 -0
- package/dist/types/DataStructures/Local/LocalBinaryCharacterTree.d.ts +133 -0
- package/dist/types/DataStructures/Local/LocalBinaryTree.d.ts +135 -0
- package/dist/types/DataStructures/Local/LocalBinaryTypeTree.d.ts +147 -0
- package/dist/types/DataStructures/Local/LocalConceptData.d.ts +100 -0
- package/dist/types/DataStructures/Local/LocalConnectionData.d.ts +109 -0
- package/dist/types/DataStructures/Local/LocalSyncData.d.ts +89 -0
- package/dist/types/DataStructures/PatcherStructure.d.ts +86 -0
- package/dist/types/DataStructures/ReferentInfo.d.ts +68 -0
- package/dist/types/DataStructures/ReservedIds.d.ts +101 -0
- package/dist/types/DataStructures/Responses/ErrorResponse.d.ts +184 -22
- package/dist/types/DataStructures/Responses/StandardResponses.d.ts +65 -0
- package/dist/types/DataStructures/Returner.d.ts +59 -0
- package/dist/types/DataStructures/Search/FreeschemaQuery.d.ts +165 -0
- package/dist/types/DataStructures/Search/SearchStructure.d.ts +69 -0
- package/dist/types/DataStructures/SearchQuery.d.ts +130 -0
- package/dist/types/DataStructures/Security/TokenStorage.d.ts +48 -0
- package/dist/types/DataStructures/Session/SessionData.d.ts +118 -0
- package/dist/types/DataStructures/SettingData.d.ts +32 -0
- package/dist/types/DataStructures/Settings.d.ts +27 -0
- package/dist/types/DataStructures/SigninModel.d.ts +50 -0
- package/dist/types/DataStructures/SignupModel.d.ts +50 -0
- package/dist/types/DataStructures/SyncData.d.ts +206 -0
- package/dist/types/DataStructures/TheCharacter.d.ts +87 -0
- package/dist/types/DataStructures/TheTexts.d.ts +92 -0
- package/dist/types/DataStructures/Transaction/Transaction.d.ts +294 -4
- package/dist/types/DataStructures/User/UserBinaryTree.d.ts +117 -0
- package/dist/types/DataStructures/User/UserNode.d.ts +130 -0
- package/dist/types/Database/GetConceptFromIndexDb.d.ts +9 -0
- package/dist/types/Database/NoIndexDb.d.ts +169 -0
- package/dist/types/Database/indexdblocal.d.ts +42 -0
- package/dist/types/Database/indexeddb.d.ts +43 -0
- package/dist/types/Drawing/ConceptDraw.d.ts +28 -0
- package/dist/types/Drawing/ConceptEvents.d.ts +46 -0
- package/dist/types/Helpers/CheckIfExists.d.ts +159 -0
- package/dist/types/Helpers/RemoveFromArray.d.ts +66 -0
- package/dist/types/Helpers/UniqueInsert.d.ts +28 -0
- package/dist/types/Services/CheckForConnectionDeletion.d.ts +190 -0
- package/dist/types/Services/Common/DecodeCountInfo.d.ts +54 -0
- package/dist/types/Services/Common/ErrorPosting.d.ts +49 -0
- package/dist/types/Services/Common/RegexFunction.d.ts +28 -0
- package/dist/types/Services/Composition/BuildComposition.d.ts +37 -0
- package/dist/types/Services/Composition/CompositionCache.d.ts +89 -0
- package/dist/types/Services/Composition/CreateCompositionCache.d.ts +43 -0
- package/dist/types/Services/Conversion/ConvertConcepts.d.ts +83 -0
- package/dist/types/Services/CreateBinaryTreeFromData.d.ts +38 -0
- package/dist/types/Services/CreateCharacterBinaryTreeFromData.d.ts +42 -0
- package/dist/types/Services/CreateConnectionBetweenTwoConcepts.d.ts +206 -0
- package/dist/types/Services/CreateDefaultConcept.d.ts +114 -0
- package/dist/types/Services/CreateTheComposition.d.ts +101 -0
- package/dist/types/Services/CreateTheConcept.d.ts +179 -0
- package/dist/types/Services/CreateTheConnection.d.ts +59 -0
- package/dist/types/Services/CreateTheConnectionGeneral.d.ts +127 -0
- package/dist/types/Services/CreateTypeTreeFromData.d.ts +43 -0
- package/dist/types/Services/Delete/DeleteConnectionByType.d.ts +52 -5
- package/dist/types/Services/Delete/GetAllConnectionByType.d.ts +57 -9
- package/dist/types/Services/DeleteConcept.d.ts +136 -0
- package/dist/types/Services/DeleteConnection.d.ts +194 -0
- package/dist/types/Services/FindConeceptsFromConnection.d.ts +179 -0
- package/dist/types/Services/FindConnectionsOfCompositionBulkInMemory.d.ts +157 -0
- package/dist/types/Services/GenerateHexNumber.d.ts +64 -0
- package/dist/types/Services/GetComposition.d.ts +331 -0
- package/dist/types/Services/GetCompositionBulk.d.ts +251 -3
- package/dist/types/Services/GetCompositionList.d.ts +130 -0
- package/dist/types/Services/GetConceptByCharacter.d.ts +84 -0
- package/dist/types/Services/GetConnections.d.ts +72 -0
- package/dist/types/Services/GetDataFromIndexDb.d.ts +79 -0
- package/dist/types/Services/GetLink.d.ts +104 -0
- package/dist/types/Services/GetLinkerConnectionFromConcept.d.ts +99 -0
- package/dist/types/Services/GetMaximumConnectionSyncTime.d.ts +57 -0
- package/dist/types/Services/GetRelation.d.ts +162 -0
- package/dist/types/Services/GetTheConcept.d.ts +71 -0
- package/dist/types/Services/GetTheReferent.d.ts +74 -0
- package/dist/types/Services/InitializeSystem.d.ts +119 -0
- package/dist/types/Services/Local/CreateDefaultLConcept.d.ts +48 -0
- package/dist/types/Services/Local/CreateLocalBinaryTreeFromData.d.ts +49 -0
- package/dist/types/Services/Local/CreateLocalBinaryTypeTreeFromData.d.ts +54 -0
- package/dist/types/Services/Local/CreateLocalCharacterBinaryTree.d.ts +60 -0
- package/dist/types/Services/Local/CreateTheCompositionLocal.d.ts +70 -0
- package/dist/types/Services/Local/CreateTheConceptLocal.d.ts +58 -0
- package/dist/types/Services/Local/CreateTheConnectionLocal.d.ts +56 -0
- package/dist/types/Services/Local/GetCompositionListLocal.d.ts +103 -0
- package/dist/types/Services/Local/GetCompositionLocal.d.ts +96 -0
- package/dist/types/Services/Local/GetConceptByCharacterLocal.d.ts +57 -0
- package/dist/types/Services/Local/MakeTheConceptLocal.d.ts +71 -0
- package/dist/types/Services/Local/MakeTheInstanceConceptLocal.d.ts +89 -0
- package/dist/types/Services/Local/MakeTheTypeLocal.d.ts +71 -0
- package/dist/types/Services/Local/UpdateCompositionLocal.d.ts +101 -0
- package/dist/types/Services/MakeTheCharacter.d.ts +74 -0
- package/dist/types/Services/MakeTheCharacterData.d.ts +65 -0
- package/dist/types/Services/MakeTheInstanceConcept.d.ts +75 -0
- package/dist/types/Services/MakeTheName.d.ts +81 -0
- package/dist/types/Services/MakeTheTimestamp.d.ts +68 -0
- package/dist/types/Services/MakeTheTypeConcept.d.ts +68 -0
- package/dist/types/Services/Mqtt/publishMessage.d.ts +27 -0
- package/dist/types/Services/Mqtt/subscribeMessage.d.ts +23 -0
- package/dist/types/Services/PatchComposition.d.ts +105 -0
- package/dist/types/Services/Search/DataIdFormat.d.ts +96 -24
- package/dist/types/Services/Search/FormatData.d.ts +92 -17
- package/dist/types/Services/Search/JustIdFormat.d.ts +91 -16
- package/dist/types/Services/Search/SearchLinkInternal.d.ts +28 -0
- package/dist/types/Services/Search/SearchLinkMultiple.d.ts +58 -0
- package/dist/types/Services/Search/SearchWithTypeAndLinker.d.ts +91 -24
- package/dist/types/Services/Search/orderingConnections.d.ts +34 -0
- package/dist/types/Services/SplitStrings.d.ts +50 -0
- package/dist/types/Services/UpdateComposition.d.ts +123 -0
- package/dist/types/Services/User/UserTranslation.d.ts +102 -0
- package/dist/types/Services/View/ViewInternalData.d.ts +32 -0
- package/dist/types/WrapperFunctions/SchemaQueryObservable.d.ts +140 -5
- package/dist/types/app.d.ts +71 -0
- package/package.json +1 -1
|
@@ -1,3 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API module for retrieving connections associated with a specific composition.
|
|
3
|
+
* This module handles both local caching and remote fetching of composition connections,
|
|
4
|
+
* with automatic synchronization and deletion detection.
|
|
5
|
+
*
|
|
6
|
+
* @module Api/GetAllConnectionsOfComposition
|
|
7
|
+
* @see https://documentation.freeschema.com for more information on the Concept Connection System
|
|
8
|
+
*/
|
|
1
9
|
import { Connection } from '../DataStructures/Connection';
|
|
10
|
+
/**
|
|
11
|
+
* Retrieves all connections associated with a specific composition, using local cache when available.
|
|
12
|
+
* This function implements a smart caching strategy: it first checks for locally stored connections,
|
|
13
|
+
* and if found, fetches fresh data from the server to detect any deletions or changes. If no local
|
|
14
|
+
* data exists, it directly fetches from the server.
|
|
15
|
+
*
|
|
16
|
+
* A composition represents a group or collection of related concepts and their connections.
|
|
17
|
+
* This function ensures that all connections within a composition are available and synchronized
|
|
18
|
+
* with the remote server.
|
|
19
|
+
*
|
|
20
|
+
* @param composition_id - The unique identifier of the composition whose connections should be retrieved
|
|
21
|
+
*
|
|
22
|
+
* @returns A promise that resolves to an array of Connection objects belonging to the composition
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* // Fetch all connections for composition 456
|
|
27
|
+
* const connections = await GetAllConnectionsOfComposition(456);
|
|
28
|
+
*
|
|
29
|
+
* // Process the connections
|
|
30
|
+
* connections.forEach(conn => {
|
|
31
|
+
* console.log(`Connection: ${conn.id} links concepts`);
|
|
32
|
+
* });
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @remarks
|
|
36
|
+
* This function implements a two-step synchronization process:
|
|
37
|
+
* 1. First fetch: Retrieves from local cache if available
|
|
38
|
+
* 2. Online fetch: Always fetches fresh data from server
|
|
39
|
+
* 3. Deletion check: Compares old and new data to detect removed connections
|
|
40
|
+
*
|
|
41
|
+
* This approach ensures data consistency while maintaining local performance benefits.
|
|
42
|
+
*
|
|
43
|
+
* @see GetAllConnectionsOfCompositionOnline for the underlying server fetch operation
|
|
44
|
+
* @see CheckForConnectionDeletion for how deleted connections are detected
|
|
45
|
+
* @see ConnectionData.GetConnectionsOfCompositionLocal for local cache access
|
|
46
|
+
*/
|
|
2
47
|
export declare function GetAllConnectionsOfComposition(composition_id: number): Promise<Connection[]>;
|
|
48
|
+
/**
|
|
49
|
+
* Fetches connections for a specific composition directly from the remote server.
|
|
50
|
+
* This function bypasses local caching and always retrieves fresh data from the backend,
|
|
51
|
+
* making it suitable for ensuring data accuracy and detecting server-side changes.
|
|
52
|
+
*
|
|
53
|
+
* All retrieved connections are automatically added to the local ConnectionData store
|
|
54
|
+
* for subsequent use throughout the application.
|
|
55
|
+
*
|
|
56
|
+
* @param composition_id - The unique identifier of the composition whose connections should be fetched
|
|
57
|
+
*
|
|
58
|
+
* @returns A promise that resolves to an array of Connection objects retrieved from the server
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```typescript
|
|
62
|
+
* // Fetch fresh connections directly from server
|
|
63
|
+
* const connections = await GetAllConnectionsOfCompositionOnline(456);
|
|
64
|
+
*
|
|
65
|
+
* // Compare with cached data
|
|
66
|
+
* const cachedConnections = await ConnectionData.GetConnectionsOfCompositionLocal(456);
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* @remarks
|
|
70
|
+
* This is the underlying server communication function used by GetAllConnectionsOfComposition.
|
|
71
|
+
* It should generally not be called directly unless you specifically need to bypass caching
|
|
72
|
+
* and force a fresh server fetch.
|
|
73
|
+
*
|
|
74
|
+
* Each retrieved connection is added to ConnectionData, making it available for local queries
|
|
75
|
+
* and reducing the need for subsequent server requests.
|
|
76
|
+
*
|
|
77
|
+
* @throws Will throw an error if the network request fails or if the server returns an error response
|
|
78
|
+
*
|
|
79
|
+
* @see GetAllConnectionsOfComposition for the recommended high-level function with caching
|
|
80
|
+
* @see ConnectionData.AddConnection for how connections are stored locally
|
|
81
|
+
*/
|
|
3
82
|
export declare function GetAllConnectionsOfCompositionOnline(composition_id: number): Promise<Connection[]>;
|
|
@@ -1,3 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API module for retrieving connections for multiple compositions in a single bulk operation.
|
|
3
|
+
* This module optimizes performance by fetching connections for multiple compositions at once,
|
|
4
|
+
* with automatic synchronization, deletion detection, and concept resolution.
|
|
5
|
+
*
|
|
6
|
+
* @module Api/GetAllConnectionsOfCompositionBulk
|
|
7
|
+
* @see https://documentation.freeschema.com for more information on the Concept Connection System
|
|
8
|
+
*/
|
|
1
9
|
import { Connection } from '../DataStructures/Connection';
|
|
10
|
+
/**
|
|
11
|
+
* Retrieves connections for multiple compositions in a single bulk operation for improved performance.
|
|
12
|
+
* This function fetches connections for multiple composition IDs at once, checks for deletions by
|
|
13
|
+
* comparing with in-memory data, and automatically resolves all referenced concepts.
|
|
14
|
+
*
|
|
15
|
+
* Bulk operations are significantly more efficient than individual requests when working with
|
|
16
|
+
* multiple compositions, reducing network overhead and improving application responsiveness.
|
|
17
|
+
*
|
|
18
|
+
* @param composition_ids - Array of composition IDs whose connections should be retrieved. Defaults to empty array.
|
|
19
|
+
*
|
|
20
|
+
* @returns A promise that resolves to an array of Connection objects from all specified compositions
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* // Fetch connections for multiple compositions at once
|
|
25
|
+
* const compositionIds = [100, 200, 300];
|
|
26
|
+
* const connections = await GetAllConnectionsOfCompositionBulk(compositionIds);
|
|
27
|
+
*
|
|
28
|
+
* console.log(`Retrieved ${connections.length} connections`);
|
|
29
|
+
*
|
|
30
|
+
* // All referenced concepts are automatically fetched
|
|
31
|
+
* connections.forEach(conn => {
|
|
32
|
+
* console.log(`Connection ${conn.id} is ready with its concepts`);
|
|
33
|
+
* });
|
|
34
|
+
*
|
|
35
|
+
* // Handle empty array case
|
|
36
|
+
* const noConnections = await GetAllConnectionsOfCompositionBulk([]);
|
|
37
|
+
* console.log(noConnections); // Returns empty array
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @remarks
|
|
41
|
+
* This function performs several important operations:
|
|
42
|
+
* 1. Early return if composition_ids array is empty
|
|
43
|
+
* 2. Retrieves old connections from in-memory storage for comparison
|
|
44
|
+
* 3. Fetches fresh connections from server via bulk endpoint
|
|
45
|
+
* 4. Detects and handles deleted connections via CheckForConnectionDeletion
|
|
46
|
+
* 5. Automatically resolves all concepts referenced by the connections
|
|
47
|
+
*
|
|
48
|
+
* The automatic concept resolution ensures that all concepts referenced in the connections
|
|
49
|
+
* are available locally, preventing the need for additional lookups.
|
|
50
|
+
*
|
|
51
|
+
* @see GetAllConnectionsOfCompositionOnline for the underlying bulk server fetch
|
|
52
|
+
* @see FindConnectionsOfCompositionsBulkInMemory for in-memory lookup
|
|
53
|
+
* @see FindConceptsFromConnections for automatic concept resolution
|
|
54
|
+
* @see CheckForConnectionDeletion for deletion detection logic
|
|
55
|
+
*/
|
|
2
56
|
export declare function GetAllConnectionsOfCompositionBulk(composition_ids?: number[]): Promise<Connection[]>;
|
|
57
|
+
/**
|
|
58
|
+
* Fetches connections for multiple compositions directly from the remote server in a single request.
|
|
59
|
+
* This function bypasses local caching and retrieves fresh data from the bulk endpoint,
|
|
60
|
+
* which is optimized for handling multiple composition IDs efficiently.
|
|
61
|
+
*
|
|
62
|
+
* All retrieved connections are automatically added to the local ConnectionData store
|
|
63
|
+
* for subsequent use throughout the application.
|
|
64
|
+
*
|
|
65
|
+
* @param composition_ids - Array of composition IDs to fetch connections for. Defaults to empty array.
|
|
66
|
+
*
|
|
67
|
+
* @returns A promise that resolves to an array of Connection objects retrieved from the server
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```typescript
|
|
71
|
+
* // Fetch connections for multiple compositions from server
|
|
72
|
+
* const connections = await GetAllConnectionsOfCompositionOnline([100, 200, 300]);
|
|
73
|
+
*
|
|
74
|
+
* // Process the bulk results
|
|
75
|
+
* console.log(`Fetched ${connections.length} connections from server`);
|
|
76
|
+
* ```
|
|
77
|
+
*
|
|
78
|
+
* @remarks
|
|
79
|
+
* This is the underlying server communication function for bulk composition queries.
|
|
80
|
+
* It uses JSON serialization for the request body to send the array of composition IDs,
|
|
81
|
+
* and the server returns all connections for those compositions in a single response.
|
|
82
|
+
*
|
|
83
|
+
* The function handles both successful and error responses gracefully, logging appropriate
|
|
84
|
+
* error messages with the prefix 'Get all connections of composition bulk error message'.
|
|
85
|
+
*
|
|
86
|
+
* Each retrieved connection is added to ConnectionData, making it available for local queries.
|
|
87
|
+
*
|
|
88
|
+
* @throws Will throw an error if the network request fails or if the server returns an error response
|
|
89
|
+
*
|
|
90
|
+
* @see GetAllConnectionsOfCompositionBulk for the recommended high-level function
|
|
91
|
+
* @see ConnectionData.AddConnection for how connections are stored locally
|
|
92
|
+
*/
|
|
3
93
|
export declare function GetAllConnectionsOfCompositionOnline(composition_ids?: number[]): Promise<Connection[]>;
|
|
@@ -1,2 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API module for retrieving all linker connections originating from a specific concept.
|
|
3
|
+
* This module fetches outbound linker connections where the specified concept acts as the source,
|
|
4
|
+
* enabling navigation and analysis of concept relationships in the forward direction.
|
|
5
|
+
*
|
|
6
|
+
* @module Api/GetAllLinkerConnectionsFromTheConcept
|
|
7
|
+
* @see https://documentation.freeschema.com for more information on the Concept Connection System
|
|
8
|
+
*/
|
|
1
9
|
import { Connection } from "../DataStructures/Connection";
|
|
10
|
+
/**
|
|
11
|
+
* Retrieves all linker connections that originate from a specific concept.
|
|
12
|
+
* This function fetches connections where the specified concept is the source (from-concept),
|
|
13
|
+
* allowing you to discover all concepts that this concept links to or relates with.
|
|
14
|
+
*
|
|
15
|
+
* Linker connections represent directed relationships in the concept graph, and this function
|
|
16
|
+
* specifically returns outbound connections where the given concept acts as the origin point.
|
|
17
|
+
* This is essential for graph traversal, relationship discovery, and understanding how a
|
|
18
|
+
* concept connects to other parts of the knowledge graph.
|
|
19
|
+
*
|
|
20
|
+
* @param conceptId - The unique identifier of the concept whose outbound linker connections should be retrieved
|
|
21
|
+
*
|
|
22
|
+
* @returns A promise that resolves to an array of Connection objects originating from the specified concept
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* // Get all connections from concept 789
|
|
27
|
+
* const outboundConnections = await GetAllLinkerConnectionsFromTheConcept(789);
|
|
28
|
+
*
|
|
29
|
+
* // Discover what this concept links to
|
|
30
|
+
* outboundConnections.forEach(connection => {
|
|
31
|
+
* console.log(`Concept 789 links to concept ${connection.toConceptId}`);
|
|
32
|
+
* });
|
|
33
|
+
*
|
|
34
|
+
* // Use for graph navigation
|
|
35
|
+
* async function traverseFromConcept(conceptId: number) {
|
|
36
|
+
* const connections = await GetAllLinkerConnectionsFromTheConcept(conceptId);
|
|
37
|
+
* return connections.map(conn => conn.toConceptId);
|
|
38
|
+
* }
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @remarks
|
|
42
|
+
* This function uses a GET request with the concept ID as a query parameter.
|
|
43
|
+
* Unlike some other API functions, it does not automatically add connections to ConnectionData,
|
|
44
|
+
* allowing the caller to decide how to handle the returned connections.
|
|
45
|
+
*
|
|
46
|
+
* The function returns an empty array if the request fails or if no connections are found.
|
|
47
|
+
* Errors are logged with the prefix 'Get all linker connection from the concepts error'.
|
|
48
|
+
*
|
|
49
|
+
* @throws Will throw an error if the network request fails or if the server returns an error response
|
|
50
|
+
*
|
|
51
|
+
* @see GetAllLinkerConnectionsToTheConcept for retrieving inbound connections to a concept
|
|
52
|
+
* @see Connection for the connection data structure
|
|
53
|
+
*/
|
|
2
54
|
export declare function GetAllLinkerConnectionsFromTheConcept(conceptId: number): Promise<Connection[]>;
|
|
@@ -1,2 +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
|
+
*/
|
|
1
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
|
+
*/
|
|
2
63
|
export declare function GetAllLinkerConnectionsToTheConcept(conceptId: number): Promise<Connection[]>;
|
|
@@ -1 +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
|
+
*/
|
|
1
52
|
export declare function GetAllPrefetchConnections(userId: number, inpage: number): Promise<void>;
|
|
@@ -1,2 +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
|
+
*/
|
|
1
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
|
+
*/
|
|
2
33
|
export declare function GetCharacterByCharacter(characterValue: string): Promise<TheCharacter>;
|
|
@@ -1,2 +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
|
+
*/
|
|
1
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
|
+
*/
|
|
2
41
|
export declare function GetCompositionConnectionsBetweenTwoConcepts(ofConceptId: number, toConcept: number, mainKey: number): Promise<Connection[]>;
|
|
@@ -1,2 +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
|
+
*/
|
|
1
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
|
+
*/
|
|
2
49
|
export declare function GetConcept(id: number): Promise<Concept>;
|
|
@@ -1,3 +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
|
+
*/
|
|
1
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
|
+
*/
|
|
2
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
|
+
*/
|
|
3
71
|
export declare function BulkConceptGetterApi(bulkConceptFetch: number[]): Promise<Concept[]>;
|
|
@@ -1,3 +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
|
+
*/
|
|
1
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
|
+
*/
|
|
2
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
|
+
*/
|
|
3
78
|
export declare function GetConceptByTypeBulk(connectionTypes: string[]): Promise<Concept[]>;
|