mftsccs-node 0.2.7 → 0.2.9
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/bundle.js +1 -1
- 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 +81 -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/NewFormat.d.ts +4 -0
- 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 +92 -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 +72 -1
- package/package.json +1 -1
|
@@ -1,6 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Remove From Array Helper Module for Concept Connection System (CCS-JS)
|
|
3
|
+
*
|
|
4
|
+
* This module provides utility functions for removing concepts and connections from arrays.
|
|
5
|
+
* These functions mutate the original arrays by splicing out matching elements by ID.
|
|
6
|
+
*
|
|
7
|
+
* @module Helpers/RemoveFromArray
|
|
8
|
+
* @see https://documentation.freeschema.com for data structure reference
|
|
9
|
+
*/
|
|
1
10
|
import { Concept } from "../DataStructures/Concept";
|
|
2
11
|
import { Connection } from "../DataStructures/Connection";
|
|
3
12
|
import { LConnection } from "../app";
|
|
13
|
+
/**
|
|
14
|
+
* Removes a concept from an array by matching its ID.
|
|
15
|
+
*
|
|
16
|
+
* @param conceptList - Array of concepts to remove from (will be mutated)
|
|
17
|
+
* @param concept - The concept to remove from the array
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const concepts = [concept1, concept2, concept3];
|
|
22
|
+
* RemoveConceptFromList(concepts, concept2);
|
|
23
|
+
* console.log(concepts.length); // 2 (concept2 has been removed)
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @remarks
|
|
27
|
+
* This function mutates the original array using splice().
|
|
28
|
+
* If the concept is not found (findIndex returns -1), splice will remove the last element.
|
|
29
|
+
* Ensure the concept exists in the array before calling this function to avoid unintended removals.
|
|
30
|
+
*/
|
|
4
31
|
export declare function RemoveConceptFromList(conceptList: Concept[] | undefined, concept: Concept): void;
|
|
32
|
+
/**
|
|
33
|
+
* Removes a connection from an array by matching its ID.
|
|
34
|
+
*
|
|
35
|
+
* @param connectionList - Array of connections to remove from (will be mutated)
|
|
36
|
+
* @param connection - The connection to remove from the array
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* const connections = [conn1, conn2, conn3];
|
|
41
|
+
* RemoveConnectionFromList(connections, conn2);
|
|
42
|
+
* console.log(connections.length); // 2 (conn2 has been removed)
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @remarks
|
|
46
|
+
* This function mutates the original array using splice().
|
|
47
|
+
* If the connection is not found (findIndex returns -1), splice will remove the last element.
|
|
48
|
+
* Ensure the connection exists in the array before calling this function to avoid unintended removals.
|
|
49
|
+
*/
|
|
5
50
|
export declare function RemoveConnectionFromList(connectionList: Connection[] | undefined, connection: Connection): void;
|
|
51
|
+
/**
|
|
52
|
+
* Removes an LConnection (lightweight connection) from an array by matching its ID.
|
|
53
|
+
*
|
|
54
|
+
* @param connectionList - Array of LConnections to remove from (will be mutated)
|
|
55
|
+
* @param connection - The LConnection to remove from the array
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* const lconnections = [lconn1, lconn2, lconn3];
|
|
60
|
+
* RemoveLConnectionFromList(lconnections, lconn2);
|
|
61
|
+
* console.log(lconnections.length); // 2 (lconn2 has been removed)
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* @remarks
|
|
65
|
+
* This is the LConnection variant of RemoveConnectionFromList.
|
|
66
|
+
* LConnection is a lightweight representation used for performance optimization.
|
|
67
|
+
* This function mutates the original array using splice().
|
|
68
|
+
* If the connection is not found (findIndex returns -1), splice will remove the last element.
|
|
69
|
+
*
|
|
70
|
+
* @see {@link RemoveConnectionFromList}
|
|
71
|
+
*/
|
|
6
72
|
export declare function RemoveLConnectionFromList(connectionList: LConnection[] | undefined, connection: LConnection): void;
|
|
@@ -1 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unique Insert Helper Module for Concept Connection System (CCS-JS)
|
|
3
|
+
*
|
|
4
|
+
* This module provides utility functions for inserting values into arrays while ensuring uniqueness.
|
|
5
|
+
* It prevents duplicate entries by checking if the value already exists before insertion.
|
|
6
|
+
*
|
|
7
|
+
* @module Helpers/UniqueInsert
|
|
8
|
+
* @see https://documentation.freeschema.com for data structure reference
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Inserts a number into an array only if it doesn't already exist.
|
|
12
|
+
*
|
|
13
|
+
* @param Array - Array of numbers to insert into (will be mutated if insertion occurs)
|
|
14
|
+
* @param toInsert - The number to insert into the array
|
|
15
|
+
* @returns The modified array with the number inserted (or unchanged if it already existed)
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const numbers = [1, 2, 3];
|
|
20
|
+
* InsertUniqueNumber(numbers, 4); // [1, 2, 3, 4]
|
|
21
|
+
* InsertUniqueNumber(numbers, 2); // [1, 2, 3, 4] (2 already exists, no change)
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @remarks
|
|
25
|
+
* This function mutates the original array by pushing the value if it's not found.
|
|
26
|
+
* Uses indexOf() for checking existence, which has O(n) time complexity.
|
|
27
|
+
* For large arrays with frequent insertions, consider using a Set data structure instead.
|
|
28
|
+
*/
|
|
1
29
|
export default function InsertUniqueNumber(Array: number[], toInsert: number): number[];
|
|
@@ -1,3 +1,193 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Connection deletion check service for the CCS-JS system.
|
|
3
|
+
* This module provides utilities for identifying and removing connections that are no longer
|
|
4
|
+
* needed by comparing old and new connection sets. It's essential for maintaining cache
|
|
5
|
+
* consistency when compositions are updated or refreshed.
|
|
6
|
+
* @module Services/CheckForConnectionDeletion
|
|
7
|
+
*/
|
|
1
8
|
import { Connection } from "../DataStructures/Connection";
|
|
9
|
+
/**
|
|
10
|
+
* Identifies and removes connections that exist in the old set but not in the new set.
|
|
11
|
+
*
|
|
12
|
+
* This function performs a differential check between old and new connection arrays to find
|
|
13
|
+
* connections that should be deleted. It's commonly used when updating compositions or
|
|
14
|
+
* refreshing data from the backend, ensuring that removed connections are cleaned from
|
|
15
|
+
* the local cache.
|
|
16
|
+
*
|
|
17
|
+
* The function iterates through old connections and checks if each one exists in the new
|
|
18
|
+
* connections array by comparing IDs. If a connection is not found in the new array,
|
|
19
|
+
* it's removed from the ConnectionData cache.
|
|
20
|
+
*
|
|
21
|
+
* @param newConnections - Array of current/updated connections. Defaults to empty array.
|
|
22
|
+
* @param oldConnections - Array of previous connections to check against. Defaults to empty array.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* // Check and remove deleted connections after composition update
|
|
27
|
+
* import { CheckForConnectionDeletion } from './CheckForConnectionDeletion';
|
|
28
|
+
*
|
|
29
|
+
* const oldConnections = await getCompositionConnections(compositionId);
|
|
30
|
+
* const newConnections = await refreshCompositionFromBackend(compositionId);
|
|
31
|
+
*
|
|
32
|
+
* CheckForConnectionDeletion(newConnections, oldConnections);
|
|
33
|
+
* // Removes any connections that were deleted on the backend
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* // Handle composition refresh with connection cleanup
|
|
39
|
+
* const cachedConnections = composition.connections;
|
|
40
|
+
* const freshConnections = await fetchLatestConnections();
|
|
41
|
+
*
|
|
42
|
+
* CheckForConnectionDeletion(freshConnections, cachedConnections);
|
|
43
|
+
* composition.connections = freshConnections;
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```typescript
|
|
48
|
+
* // Clean up connections when switching between compositions
|
|
49
|
+
* const currentCompositionConnections = getCurrentConnections();
|
|
50
|
+
* const newCompositionConnections = loadNewComposition();
|
|
51
|
+
*
|
|
52
|
+
* CheckForConnectionDeletion(newCompositionConnections, currentCompositionConnections);
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @remarks
|
|
56
|
+
* **Comparison Logic:**
|
|
57
|
+
* - Uses array.find() to check if each old connection exists in new connections
|
|
58
|
+
* - Compares connections by ID (obj.id === oldConnections[i].id)
|
|
59
|
+
* - Only removes connections that are completely absent from new array
|
|
60
|
+
*
|
|
61
|
+
* **Safety Check:**
|
|
62
|
+
* - Verifies newConnections is an array before comparison
|
|
63
|
+
* - This prevents errors if newConnections is null or undefined
|
|
64
|
+
* - Skips deletion if newConnections is not a valid array
|
|
65
|
+
*
|
|
66
|
+
* **Side Effects:**
|
|
67
|
+
* - Directly modifies ConnectionData cache by removing connections
|
|
68
|
+
* - Permanent removal from cache (cannot be undone)
|
|
69
|
+
* - Does not affect backend data, only local cache
|
|
70
|
+
*
|
|
71
|
+
* **Performance:**
|
|
72
|
+
* - O(n*m) complexity where n = oldConnections.length, m = newConnections.length
|
|
73
|
+
* - Uses array.find() for each old connection
|
|
74
|
+
* - Consider using CheckForConnectionDeletionWithIds for better performance with large arrays
|
|
75
|
+
*
|
|
76
|
+
* **Use Cases:**
|
|
77
|
+
* - Synchronizing local cache with backend state
|
|
78
|
+
* - Cleaning up after composition updates
|
|
79
|
+
* - Maintaining cache consistency during data refresh
|
|
80
|
+
* - Removing orphaned connections
|
|
81
|
+
*
|
|
82
|
+
* @see {@link CheckForConnectionDeletionWithIds} for ID-based comparison (better performance)
|
|
83
|
+
* @see {@link ConnectionData.RemoveConnection} for connection removal implementation
|
|
84
|
+
* @see {@link Connection} for connection data structure
|
|
85
|
+
*/
|
|
2
86
|
export declare function CheckForConnectionDeletion(newConnections?: Connection[], oldConnections?: Connection[]): void;
|
|
87
|
+
/**
|
|
88
|
+
* Identifies and removes connections using ID-based comparison for improved performance.
|
|
89
|
+
*
|
|
90
|
+
* This function is a more efficient variant of CheckForConnectionDeletion that compares
|
|
91
|
+
* connection IDs directly instead of searching through connection objects. It uses
|
|
92
|
+
* Array.includes() which is faster than array.find() for ID lookups, making it better
|
|
93
|
+
* suited for large datasets.
|
|
94
|
+
*
|
|
95
|
+
* The function checks each old connection against an array of new connection IDs.
|
|
96
|
+
* If an old connection's ID is not in the new ID array, it's removed from the cache.
|
|
97
|
+
* This is particularly useful when you already have a list of IDs or when working
|
|
98
|
+
* with large numbers of connections.
|
|
99
|
+
*
|
|
100
|
+
* @param newConnectionIds - Array of current connection IDs. Defaults to empty array.
|
|
101
|
+
* @param oldConnections - Array of previous connection objects to check. Defaults to empty array.
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```typescript
|
|
105
|
+
* // Efficient cleanup using ID array
|
|
106
|
+
* import { CheckForConnectionDeletionWithIds } from './CheckForConnectionDeletion';
|
|
107
|
+
*
|
|
108
|
+
* const newConnectionIds = [123, 456, 789];
|
|
109
|
+
* const oldConnections = cachedComposition.connections;
|
|
110
|
+
*
|
|
111
|
+
* CheckForConnectionDeletionWithIds(newConnectionIds, oldConnections);
|
|
112
|
+
* // Removes connections whose IDs are not in [123, 456, 789]
|
|
113
|
+
* ```
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```typescript
|
|
117
|
+
* // Use when fetching connections from API
|
|
118
|
+
* const apiResponse = await getConnectionsFromBackend(compositionId);
|
|
119
|
+
* const newIds = apiResponse.map(conn => conn.id);
|
|
120
|
+
* const cachedConnections = getLocalConnections();
|
|
121
|
+
*
|
|
122
|
+
* CheckForConnectionDeletionWithIds(newIds, cachedConnections);
|
|
123
|
+
* ```
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```typescript
|
|
127
|
+
* // Cleanup connections for a composition update
|
|
128
|
+
* const updatedConnectionIds = composition.connections.map(c => c.id);
|
|
129
|
+
* const previousConnections = await getPreviousConnections(composition.id);
|
|
130
|
+
*
|
|
131
|
+
* CheckForConnectionDeletionWithIds(updatedConnectionIds, previousConnections);
|
|
132
|
+
* ```
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* ```typescript
|
|
136
|
+
* // Filter out deleted connections during sync
|
|
137
|
+
* const syncedIds = syncData.connectionIds;
|
|
138
|
+
* const localConnections = ConnectionData.GetAllConnections();
|
|
139
|
+
*
|
|
140
|
+
* CheckForConnectionDeletionWithIds(syncedIds, localConnections);
|
|
141
|
+
* // Removes any local connections not present in sync data
|
|
142
|
+
* ```
|
|
143
|
+
*
|
|
144
|
+
* @remarks
|
|
145
|
+
* **Performance Advantages:**
|
|
146
|
+
* - Uses Array.includes() which is O(n) instead of array.find()
|
|
147
|
+
* - More efficient for large connection arrays
|
|
148
|
+
* - Better memory usage as only IDs are compared
|
|
149
|
+
* - Recommended for datasets with 100+ connections
|
|
150
|
+
*
|
|
151
|
+
* **Comparison Logic:**
|
|
152
|
+
* - Checks if oldConnection.id exists in newConnectionIds array
|
|
153
|
+
* - Simple inclusion check without object comparison
|
|
154
|
+
* - No need to iterate through connection properties
|
|
155
|
+
*
|
|
156
|
+
* **No Safety Check:**
|
|
157
|
+
* - Does not verify if newConnectionIds is an array
|
|
158
|
+
* - Will throw if newConnectionIds is null/undefined
|
|
159
|
+
* - Caller should ensure newConnectionIds is a valid array
|
|
160
|
+
*
|
|
161
|
+
* **Side Effects:**
|
|
162
|
+
* - Removes connections from ConnectionData cache
|
|
163
|
+
* - Permanent local cache modification
|
|
164
|
+
* - Does not affect backend or persistent storage
|
|
165
|
+
*
|
|
166
|
+
* **When to Use:**
|
|
167
|
+
* - Large numbers of connections (100+)
|
|
168
|
+
* - When you already have ID arrays
|
|
169
|
+
* - Performance-critical operations
|
|
170
|
+
* - Batch processing scenarios
|
|
171
|
+
*
|
|
172
|
+
* **When to Use CheckForConnectionDeletion Instead:**
|
|
173
|
+
* - Small datasets (< 100 connections)
|
|
174
|
+
* - When you don't have IDs readily available
|
|
175
|
+
* - When newConnections might be null/undefined
|
|
176
|
+
* - When the array check is needed
|
|
177
|
+
*
|
|
178
|
+
* **Common Patterns:**
|
|
179
|
+
* ```typescript
|
|
180
|
+
* // Pattern 1: Extract IDs from API response
|
|
181
|
+
* const ids = apiData.map(conn => conn.id);
|
|
182
|
+
* CheckForConnectionDeletionWithIds(ids, oldConnections);
|
|
183
|
+
*
|
|
184
|
+
* // Pattern 2: Use with composition updates
|
|
185
|
+
* const validIds = getValidConnectionIds(composition);
|
|
186
|
+
* CheckForConnectionDeletionWithIds(validIds, currentConnections);
|
|
187
|
+
* ```
|
|
188
|
+
*
|
|
189
|
+
* @see {@link CheckForConnectionDeletion} for object-based comparison with safety checks
|
|
190
|
+
* @see {@link ConnectionData.RemoveConnection} for connection removal implementation
|
|
191
|
+
* @see {@link Connection} for connection data structure
|
|
192
|
+
*/
|
|
3
193
|
export declare function CheckForConnectionDeletionWithIds(newConnectionIds?: number[], oldConnections?: Connection[]): void;
|
|
@@ -1,3 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module DecodeCountInfo
|
|
3
|
+
* @description Provides functions to decode and process count information for connections
|
|
4
|
+
*/
|
|
1
5
|
import { CountInfo } from "../../DataStructures/Count/CountInfo";
|
|
6
|
+
/**
|
|
7
|
+
* Decodes an array of count information strings into CountInfo objects.
|
|
8
|
+
* Parses encoded count data for connection statistics.
|
|
9
|
+
*
|
|
10
|
+
* @param {string[]} [countStrings=[]] - Array of count strings in format "conceptId_connectionTypeId_count"
|
|
11
|
+
* @returns {CountInfo[]} Array of decoded CountInfo objects
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const countStrings = ["123_456_42", "789_456_15"];
|
|
16
|
+
* const countInfos = DecodeCountInfo(countStrings);
|
|
17
|
+
* // countInfos = [
|
|
18
|
+
* // { conceptId: 123, connectionTypeId: 456, count: 42 },
|
|
19
|
+
* // { conceptId: 789, connectionTypeId: 456, count: 15 }
|
|
20
|
+
* // ]
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @remarks
|
|
24
|
+
* - Each string must be in format: "conceptId_connectionTypeId_count"
|
|
25
|
+
* - All three parts must be numeric
|
|
26
|
+
* - Returns empty array if no strings provided
|
|
27
|
+
* - Throws error if string format is invalid
|
|
28
|
+
*/
|
|
2
29
|
export declare function DecodeCountInfo(countStrings?: string[]): CountInfo[];
|
|
30
|
+
/**
|
|
31
|
+
* Fetches connection type concepts for count information and creates a dictionary.
|
|
32
|
+
* Enriches CountInfo objects with connection type names and indexes them by concept ID.
|
|
33
|
+
*
|
|
34
|
+
* @async
|
|
35
|
+
* @param {CountInfo[]} countInfos - Array of CountInfo objects to process
|
|
36
|
+
* @returns {Promise<any>} A promise that resolves to a dictionary mapping concept IDs to enriched CountInfo objects
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* const countInfos: CountInfo[] = [
|
|
41
|
+
* { conceptId: 123, connectionTypeId: 456, count: 42 },
|
|
42
|
+
* { conceptId: 789, connectionTypeId: 456, count: 15 }
|
|
43
|
+
* ];
|
|
44
|
+
* const dictionary = await GetConnectionTypeForCount(countInfos);
|
|
45
|
+
* // dictionary = {
|
|
46
|
+
* // 123: { conceptId: 123, connectionTypeId: 456, count: 42, connectionType: "follows" },
|
|
47
|
+
* // 789: { conceptId: 789, connectionTypeId: 456, count: 15, connectionType: "follows" }
|
|
48
|
+
* // }
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @remarks
|
|
52
|
+
* - Fetches concept objects for each connectionTypeId
|
|
53
|
+
* - Adds connectionType (character value) to each CountInfo
|
|
54
|
+
* - Returns dictionary indexed by conceptId for fast lookup
|
|
55
|
+
* - Used by formatting functions to add count information
|
|
56
|
+
*/
|
|
3
57
|
export declare function GetConnectionTypeForCount(countInfos: CountInfo[]): Promise<any>;
|
|
@@ -1,2 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module ErrorPosting
|
|
3
|
+
* @description Provides error handling functions for HTTP and internal errors with structured error responses
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Handles HTTP errors by creating and throwing structured error responses.
|
|
7
|
+
* Specifically handles 401 Unauthorized errors.
|
|
8
|
+
*
|
|
9
|
+
* @param {Response} response - The HTTP Response object to process
|
|
10
|
+
* @throws {FreeSchemaResponse} Throws a structured error response for unauthorized requests
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const response = await fetch("https://api.example.com/data");
|
|
15
|
+
* HandleHttpError(response);
|
|
16
|
+
* // Throws FreeSchemaResponse if status is 401
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* - Currently only handles 401 status codes
|
|
21
|
+
* - Creates FreeSchemaResponse with status text, success=false, status code, and URL
|
|
22
|
+
* - Other status codes are not handled (function returns normally)
|
|
23
|
+
* - Useful for API call error handling
|
|
24
|
+
*/
|
|
1
25
|
export declare function HandleHttpError(response: Response): void;
|
|
26
|
+
/**
|
|
27
|
+
* Handles internal application errors by creating and throwing structured error responses.
|
|
28
|
+
* Wraps any error object into a FreeSchemaResponse.
|
|
29
|
+
*
|
|
30
|
+
* @param {any} error - The error object to process
|
|
31
|
+
* @param {string} [url=""] - Optional URL associated with the error
|
|
32
|
+
* @throws {FreeSchemaResponse} Always throws a structured error response
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* try {
|
|
37
|
+
* // Some operation
|
|
38
|
+
* throw new Error("Something went wrong");
|
|
39
|
+
* } catch (error) {
|
|
40
|
+
* HandleInternalError(error, "https://api.example.com/data");
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @remarks
|
|
45
|
+
* - Checks if error has a status property to use, defaults to 500
|
|
46
|
+
* - Creates FreeSchemaResponse with error message, success=false, status, and stack trace
|
|
47
|
+
* - Sets URL if provided
|
|
48
|
+
* - Useful for consistent error handling throughout the application
|
|
49
|
+
* - Always throws after creating the response (never returns)
|
|
50
|
+
*/
|
|
2
51
|
export declare function HandleInternalError(error: any, url?: string): void;
|
|
@@ -1 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module RegexFunction
|
|
3
|
+
* @description Provides string manipulation functions for concept type names
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Removes the "the_" prefix from a string if it exists.
|
|
7
|
+
* Used for cleaning concept type names in the CCS system.
|
|
8
|
+
*
|
|
9
|
+
* @param {string} inputString - The string to process
|
|
10
|
+
* @returns {string} The string with "the_" prefix removed, or the original string if prefix not found
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const typeName = "the_user";
|
|
15
|
+
* const cleaned = removeThePrefix(typeName);
|
|
16
|
+
* // cleaned = "user"
|
|
17
|
+
*
|
|
18
|
+
* const noPrefix = "post";
|
|
19
|
+
* const unchanged = removeThePrefix(noPrefix);
|
|
20
|
+
* // unchanged = "post"
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @remarks
|
|
24
|
+
* - Only removes prefix if string starts with exactly "the_"
|
|
25
|
+
* - Case-sensitive matching
|
|
26
|
+
* - Returns original string if prefix not found
|
|
27
|
+
* - Used throughout formatting functions to clean type names
|
|
28
|
+
*/
|
|
1
29
|
export declare function removeThePrefix(inputString: string): string;
|
|
@@ -1,3 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module BuildComposition
|
|
3
|
+
* @description Provides functions to recursively build composition structures from concepts and connections with caching support
|
|
4
|
+
*/
|
|
1
5
|
import { Connection } from '../../DataStructures/Connection';
|
|
2
6
|
import { Concept } from '../../DataStructures/Concept';
|
|
7
|
+
/**
|
|
8
|
+
* Recursively fetches and builds a composition structure from provided concepts and connections.
|
|
9
|
+
* Uses passed data rather than querying externally, with backend fallback for missing data.
|
|
10
|
+
*
|
|
11
|
+
* @async
|
|
12
|
+
* @param {number} id - The concept ID to start building the composition from
|
|
13
|
+
* @param {Connection[]} connectionList - Array of all connections to use for building
|
|
14
|
+
* @param {Concept[]} conceptList - Array of all concepts available for building
|
|
15
|
+
* @param {compositionList} compositionList - Array of concept IDs that are compositions (not leaf values)
|
|
16
|
+
* @param {number[]} [visitedConcepts=[]] - Array tracking visited concept IDs to prevent circular references
|
|
17
|
+
* @returns {Promise<any>} A promise that resolves to the built composition object or character value
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const conceptId = 123;
|
|
22
|
+
* const connections: Connection[] = [...];
|
|
23
|
+
* const concepts: Concept[] = [...];
|
|
24
|
+
* const compositionIds = [123, 456];
|
|
25
|
+
* const visited: number[] = [];
|
|
26
|
+
* const result = await recursiveFetchNew(conceptId, connections, concepts, compositionIds, visited);
|
|
27
|
+
* // result = { user: { name: "John", email: "john@example.com" } }
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* This function:
|
|
32
|
+
* - Works with pre-loaded concepts and connections (no external queries during recursion)
|
|
33
|
+
* - Falls back to backend API if concept/connection not found in provided lists
|
|
34
|
+
* - Tracks visited concepts to prevent infinite loops in circular relationships
|
|
35
|
+
* - Distinguishes between composition nodes (objects/arrays) and leaf values (strings)
|
|
36
|
+
* - Removes "the_" prefix from type names for cleaner keys
|
|
37
|
+
* - Handles numeric types as arrays, string types as objects
|
|
38
|
+
* - Returns empty string for concepts not in compositionList (leaf values)
|
|
39
|
+
*/
|
|
3
40
|
export declare function recursiveFetchNew(id: number, connectionList: Connection[], conceptList: Concept[], compositionList: number[], visitedConcepts?: number[]): Promise<any>;
|
|
@@ -1,4 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module CompositionCache
|
|
3
|
+
* @description Provides composition retrieval functions with caching support for improved performance
|
|
4
|
+
*/
|
|
1
5
|
import { Connection } from '../../DataStructures/Connection';
|
|
6
|
+
/**
|
|
7
|
+
* Retrieves a composition by ID with caching support, optionally using provided connections.
|
|
8
|
+
* Returns a formatted composition object with all internal connections.
|
|
9
|
+
*
|
|
10
|
+
* @async
|
|
11
|
+
* @param {number} id - The composition concept ID to retrieve
|
|
12
|
+
* @param {Connection[]} [connectionListPassed=[]] - Optional pre-fetched connections for this composition
|
|
13
|
+
* @returns {Promise<any>} A promise that resolves to the formatted composition object
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* // Retrieve composition without pre-loaded connections
|
|
18
|
+
* const composition = await GetCompositionWithCache(123);
|
|
19
|
+
* // composition = { user: { name: "John", email: "john@example.com" } }
|
|
20
|
+
*
|
|
21
|
+
* // Retrieve composition with pre-loaded connections (more efficient)
|
|
22
|
+
* const connections: Connection[] = [...]; // Previously fetched
|
|
23
|
+
* const composition = await GetCompositionWithCache(123, connections);
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @remarks
|
|
27
|
+
* This function:
|
|
28
|
+
* - Checks local cache (ConceptsData) before making API calls
|
|
29
|
+
* - Uses provided connections if available, otherwise fetches them
|
|
30
|
+
* - Builds list of composition IDs and concept IDs from connections
|
|
31
|
+
* - Recursively builds the composition structure
|
|
32
|
+
* - Returns empty string if concept ID is 0
|
|
33
|
+
* - Uses concept type as the root key in returned object
|
|
34
|
+
*/
|
|
2
35
|
export declare function GetCompositionWithCache(id: number, connectionListPassed?: Connection[]): Promise<any>;
|
|
36
|
+
/**
|
|
37
|
+
* Retrieves a composition by ID in DATA-ID format with caching support.
|
|
38
|
+
* Returns composition with id, data, and created_at fields.
|
|
39
|
+
*
|
|
40
|
+
* @async
|
|
41
|
+
* @param {number} id - The composition concept ID to retrieve
|
|
42
|
+
* @param {Connection[]} [connectionListPassed=[]] - Optional pre-fetched connections for this composition
|
|
43
|
+
* @returns {Promise<any>} A promise that resolves to composition object with id, data, and created_at properties
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```typescript
|
|
47
|
+
* const composition = await GetCompositionWithDataIdWithCache(123);
|
|
48
|
+
* // composition = {
|
|
49
|
+
* // id: 123,
|
|
50
|
+
* // data: { user: { name: "John", email: "john@example.com" } },
|
|
51
|
+
* // created_at: "2023-10-30T12:00:00Z"
|
|
52
|
+
* // }
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @remarks
|
|
56
|
+
* Format: DATA-ID - Includes explicit ID and timestamp information
|
|
57
|
+
* This function:
|
|
58
|
+
* - Similar to GetCompositionWithCache but includes ID metadata
|
|
59
|
+
* - Returns object with id, data (composition tree), and created_at
|
|
60
|
+
* - Uses caching for improved performance
|
|
61
|
+
* - Returns empty string if concept ID is 0
|
|
62
|
+
*/
|
|
3
63
|
export declare function GetCompositionWithDataIdWithCache(id: number, connectionListPassed?: Connection[]): Promise<any>;
|
|
64
|
+
/**
|
|
65
|
+
* Retrieves multiple compositions in bulk using DATA-ID format.
|
|
66
|
+
* Efficiently fetches multiple compositions with their internal connections in one operation.
|
|
67
|
+
*
|
|
68
|
+
* @async
|
|
69
|
+
* @param {number[]} ids - Array of composition concept IDs to retrieve
|
|
70
|
+
* @param {number[]} connections - Array of connection IDs for all compositions
|
|
71
|
+
* @returns {Promise<any[]>} A promise that resolves to array of composition objects with DATA-ID format
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```typescript
|
|
75
|
+
* const compositionIds = [123, 456, 789];
|
|
76
|
+
* const connectionIds = [1, 2, 3, 4, 5];
|
|
77
|
+
* const compositions = await GetCompositionWithDataIdBulk(compositionIds, connectionIds);
|
|
78
|
+
* // compositions = [
|
|
79
|
+
* // { id: 123, data: {...}, created_at: timestamp },
|
|
80
|
+
* // { id: 456, data: {...}, created_at: timestamp },
|
|
81
|
+
* // { id: 789, data: {...}, created_at: timestamp }
|
|
82
|
+
* // ]
|
|
83
|
+
* ```
|
|
84
|
+
*
|
|
85
|
+
* @remarks
|
|
86
|
+
* This function:
|
|
87
|
+
* - Optimized for bulk operations to reduce API calls
|
|
88
|
+
* - Fetches all connections once, then filters per composition
|
|
89
|
+
* - Each result includes id, data object, and created_at timestamp
|
|
90
|
+
* - Filters out null/undefined compositions from results
|
|
91
|
+
* - More efficient than calling GetCompositionWithDataIdWithCache individually
|
|
92
|
+
*/
|
|
4
93
|
export declare function GetCompositionWithDataIdBulk(ids: number[], connections: number[]): Promise<any[]>;
|
|
@@ -1,3 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module CreateCompositionCache
|
|
3
|
+
* @description Provides functionality to create compositions from JSON objects with caching support
|
|
4
|
+
*/
|
|
1
5
|
import { Concept } from '../../DataStructures/Concept';
|
|
2
6
|
import { Composition } from '../../DataStructures/Composition/Composition';
|
|
7
|
+
/**
|
|
8
|
+
* Creates a composition from a JSON object with caching mechanism.
|
|
9
|
+
* Recursively processes nested objects/arrays to create concepts and connections.
|
|
10
|
+
*
|
|
11
|
+
* @async
|
|
12
|
+
* @param {any} json - The JSON object to convert into a composition
|
|
13
|
+
* @param {number | null} [ofTheConceptId=null] - Parent concept ID (null for root)
|
|
14
|
+
* @param {number | null} [ofTheConceptUserId=null] - Parent concept's user ID
|
|
15
|
+
* @param {number | null} [mainKey=null] - Main composition ID (root concept ID)
|
|
16
|
+
* @param {number | null} [userId=null] - User ID creating the composition (defaults to 999)
|
|
17
|
+
* @param {number | null} [accessId=null] - Access level ID (defaults to 4)
|
|
18
|
+
* @param {number | null} [sessionInformationId=null] - Session ID (defaults to 999)
|
|
19
|
+
* @param {Composition | null} [composition=null] - Existing Composition object to populate
|
|
20
|
+
* @returns {Promise<Concept>} A promise that resolves to the main (root) Concept of the composition
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* const jsonData = {
|
|
25
|
+
* user: {
|
|
26
|
+
* name: "John",
|
|
27
|
+
* email: "john@example.com",
|
|
28
|
+
* age: 30
|
|
29
|
+
* }
|
|
30
|
+
* };
|
|
31
|
+
* const mainConcept = await CreateTheCompositionWithCache(jsonData, null, null, null, 1, 4, 1);
|
|
32
|
+
* // Creates concepts for user, name, email, age with proper connections
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @remarks
|
|
36
|
+
* This function:
|
|
37
|
+
* - Recursively processes nested JSON structures
|
|
38
|
+
* - Creates concepts for each key-value pair
|
|
39
|
+
* - Establishes connections between parent and child concepts
|
|
40
|
+
* - Distinguishes between composition nodes (objects/arrays) and leaf values (primitives)
|
|
41
|
+
* - Populates the Composition object with all concepts and connections
|
|
42
|
+
* - Uses caching for improved performance
|
|
43
|
+
* - First call (no parent) creates the root concept
|
|
44
|
+
* - Subsequent recursive calls create child concepts linked to parents
|
|
45
|
+
*/
|
|
3
46
|
export declare function CreateTheCompositionWithCache(json: any, ofTheConceptId?: number | null, ofTheConceptUserId?: number | null, mainKey?: number | null, userId?: number | null, accessId?: number | null, sessionInformationId?: number | null, composition?: Composition | null): Promise<Concept>;
|