mftsccs-node 0.0.60 → 0.0.63
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/dist/bundle.js +1 -1
- package/dist/bundle.js.map +1 -0
- package/dist/types/Api/GetConnections/GetConnectionsBetweenApi.d.ts +8 -0
- package/dist/types/DataStructures/BaseUrl.d.ts +15 -0
- package/dist/types/DataStructures/CCSConfig.d.ts +169 -0
- package/dist/types/DataStructures/FetchConnection.d.ts +21 -0
- package/dist/types/DataStructures/Security/TokenStorage.d.ts +74 -0
- package/dist/types/DataStructures/Transaction/Transaction.d.ts +23 -0
- package/dist/types/Services/AccessControl/AccessControlCacheService.d.ts +19 -0
- package/dist/types/Services/AccessControl/AccessControlService.d.ts +267 -0
- package/dist/types/Services/AccessControl/PermissionSet.d.ts +8 -0
- package/dist/types/Services/Common/ErrorPosting.d.ts +2 -0
- package/dist/types/Services/Http/HttpClient.service.d.ts +205 -0
- package/dist/types/Services/Security/GetRequestHeader.d.ts +58 -10
- package/dist/types/Services/auth/AuthService.d.ts +0 -0
- package/dist/types/Services/oauth/CallOauth.service.d.ts +101 -0
- package/dist/types/app.d.ts +56 -15
- package/package.json +70 -70
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle.js","mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;GAOG;;;;;;;;;;AAE4E;AACtB;AACQ;AACV;AACqB;AACP;AAErE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACI,SAAe,kBAAkB,CAAC,aAA2B;;;QAChE,IAAG,CAAC;YAEE,aAAa,GAAG,oFAAmB,CAAC,YAAY,CAAC,aAAa,CAAC,IAAI,CAAC;YACxE,IAAG,aAAa,CAAC,EAAE,IAAI,CAAC,EAAC,CAAC;gBACxB,IAAI,MAAM,GAAG,MAAM,qFAAgB,EAAE,CAAC;gBACtC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,4DAAO,CA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AC,GAAG,CAAC,yCAAyC,EAAE,OAAO,CAAC,CAAC;QACnE,CAAC,CAAC,CAAC;IAEN,CAAC,CAAC,CAAC;AACN,CAAC;;;;;;;UCpSD;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;UENA;UACA;UACA;UACA","sources":["webpack://mftsccs-node/./src/Api/Create/CreateTheCharacter.ts","webpack://mftsccs-node/./src/Api/Create/CreateTheConceptApi.ts","webpack://mftsccs-node/./src/Api/Create/CreateTheConnectionApi.ts","webpack://mftsccs-node/./src/Api/Create/CreateTheTextData.ts","webpack://mftsccs-node/./src/Api/Delete/DeleteConceptInBackend.ts","webpack://mftsccs-node/./src/Api/DeleteConnectionApiBulk.ts","webpack://mftsccs-node/./src/Api/DeleteTheConcept.ts","webpack://mftsccs-node/./src/Api/DeleteTheConnection.ts","webpack://mftsccs-node/./src/Api/GetAiData.ts","webpack://mftsccs-node/./src/Api/GetAllConceptsByType.ts","webpack://mftsccs-node/./src/Api/GetAllConnectionsOfComposition.ts","webpack://mftsccs-node/./src/Api/GetAllConnectionsOfCompositionBulk.ts","webpack://mftsccs-node/./src/Api/GetAllLinkerConnectionsFromTheConcept.ts","webpack://mftsccs-node/./src/Api/GetAllLinkerConnectionsToTheConcept.ts","webpack://mftsccs-node/./src/Api/GetConcept.ts","webpack://mftsccs-node/./src/Api/GetConceptBulk.ts","webpack://mftsccs-node/./src/Api/GetConceptByCharacterAndType.ts","webpack://mftsccs-node/./src/Api/GetConceptByCharacterValue.ts","webpack://mftsccs-node/./src/Api/GetConnection.ts","webpack://mftsccs-node/./src/Api/GetConnectionBulk.ts","webpack://mftsccs-node/./src/Api/GetConnectionOfTheConcept.ts","webpack://mftsccs-node/./src/Api/GetConnectionToTheConcept.ts","webpack://mftsccs-node/./src/Api/GetReservedConnectionIds.ts","webpack://mftsccs-node/./src/Api/GetReservedIds.ts","webpack://mftsccs-node/./src/Api/Login.ts","webpack://mftsccs-node/./src/Api/MakeTheTypeConceptApi.ts","webpack://mftsccs-node/./src/Api/RecursiveSearch.ts","webpack://mftsccs-node/./src/Api/Search/FreeschemaQueryApi.ts","webpack://mftsccs-node/./src/Api/Search/Search.ts","webpack://mftsccs-node/./src/Api/Search/SearchInternalApi.ts","webpack://mftsccs-node/./src/Api/Search/SearchLinkMultipleApi.ts","webpack://mftsccs-node/./src/Api/Search/SearchWithLinker.ts","webpack://mftsccs-node/./src/Api/SearchConcept/GetConceptByCharacterAndCategoryDirect.ts","webpack://mftsccs-node/./src/Api/Session/CreateSession.ts","webpack://mftsccs-node/./src/Api/Session/CreateSessionVisit.ts","webpack://mftsccs-node/./src/Api/Signin.ts","webpack://mftsccs-node/./src/Api/Signup.ts","webpack://mftsccs-node/./src/Api/View/ViewInternalDataApi.ts","webpack://mftsccs-node/./src/Constants/FormatConstants.ts","webpack://mftsccs-node/./src/DataStructures/BaseUrl.ts","webpack://mftsccs-node/./src/DataStructures/BinaryCharacterTree.ts","webpack://mftsccs-node/./src/DataStructures/BinaryTree.ts","webpack://mftsccs-node/./src/DataStructures/BinaryTypeTree.ts","webpack://mftsccs-node/./src/DataStructures/CCSConfig.ts","webpack://mftsccs-node/./src/DataStructures/CharacterRepository.ts","webpack://mftsccs-node/./src/DataStructures/Composition/Composition.ts","webpack://mftsccs-node/./src/DataStructures/Composition/CompositionBinaryTree.ts","webpack://mftsccs-node/./src/DataStructures/Composition/CompositionNode.ts","webpack://mftsccs-node/./src/DataStructures/Concept.ts","webpack://mftsccs-node/./src/DataStructures/ConceptData.ts","webpack://mftsccs-node/./src/DataStructures/Connection.ts","webpack://mftsccs-node/./src/DataStructures/ConnectionBinaryTree/ConnectionBinaryTree.ts","webpack://mftsccs-node/./src/DataStructures/ConnectionBinaryTree/ConnectionNode.ts","webpack://mftsccs-node/./src/DataStructures/ConnectionBinaryTree/ConnectionTypeTree.ts","webpack://mftsccs-node/./src/DataStructures/ConnectionData.ts","webpack://mftsccs-node/./src/DataStructures/Count/CountInfo.ts","webpack://mftsccs-node/./src/DataStructures/FilterSearch.ts","webpack://mftsccs-node/./src/DataStructures/IdentifierFlags.ts","webpack://mftsccs-node/./src/DataStructures/Local/LConcept.ts","webpack://mftsccs-node/./src/DataStructures/Local/LConnection.ts","webpack://mftsccs-node/./src/DataStructures/Local/LNode.ts","webpack://mftsccs-node/./src/DataStructures/Local/LocalBinaryCharacterTree.ts","webpack://mftsccs-node/./src/DataStructures/Local/LocalBinaryTree.ts","webpack://mftsccs-node/./src/DataStructures/Local/LocalBinaryTypeTree.ts","webpack://mftsccs-node/./src/DataStructures/Local/LocalConceptData.ts","webpack://mftsccs-node/./src/DataStructures/Local/LocalConnectionData.ts","webpack://mftsccs-node/./src/DataStructures/Node.ts","webpack://mftsccs-node/./src/DataStructures/PatcherStructure.ts","webpack://mftsccs-node/./src/DataStructures/ReservedIds.ts","webpack://mftsccs-node/./src/DataStructures/Responses/ErrorResponse.ts","webpack://mftsccs-node/./src/DataStructures/Returner.ts","webpack://mftsccs-node/./src/DataStructures/Search/FreeschemaQuery.ts","webpack://mftsccs-node/./src/DataStructures/Search/SearchStructure.ts","webpack://mftsccs-node/./src/DataStructures/SearchQuery.ts","webpack://mftsccs-node/./src/DataStructures/Security/TokenStorage.ts","webpack://mftsccs-node/./src/DataStructures/Session/SessionData.ts","webpack://mftsccs-node/./src/DataStructures/SettingData.ts","webpack://mftsccs-node/./src/DataStructures/Settings.ts","webpack://mftsccs-node/./src/DataStructures/SyncData.ts","webpack://mftsccs-node/./src/DataStructures/TheCharacter.ts","webpack://mftsccs-node/./src/DataStructures/TheTexts.ts","webpack://mftsccs-node/./src/DataStructures/Transaction/Transaction.ts","webpack://mftsccs-node/./src/DataStructures/User/UserBinaryTree.ts","webpack://mftsccs-node/./src/DataStructures/User/UserNode.ts","webpack://mftsccs-node/./src/Database/NoIndexDb.ts","webpack://mftsccs-node/./src/Database/indexeddb.ts","webpack://mftsccs-node/./src/Helpers/CheckIfExists.ts","webpack://mftsccs-node/./src/Helpers/RemoveFromArray.ts","webpack://mftsccs-node/./src/Helpers/UniqueInsert.ts","webpack://mftsccs-node/./src/Services/AccessControl/AccessControlCacheService.ts","webpack://mftsccs-node/./src/Services/AccessControl/AccessControlService.ts","webpack://mftsccs-node/./src/Services/AccessControl/PermissionSet.ts","webpack://mftsccs-node/./src/Services/CheckForConnectionDeletion.ts","webpack://mftsccs-node/./src/Services/Common/DecodeCountInfo.ts","webpack://mftsccs-node/./src/Services/Common/ErrorPosting.ts","webpack://mftsccs-node/./src/Services/Common/RegexFunction.ts","webpack://mftsccs-node/./src/Services/Composition/BuildComposition.ts","webpack://mftsccs-node/./src/Services/Composition/CompositionCache.ts","webpack://mftsccs-node/./src/Services/Composition/CreateCompositionCache.ts","webpack://mftsccs-node/./src/Services/ConceptFinding/GetConceptByCharacterAndCategory.ts","webpack://mftsccs-node/./src/Services/Conversion/ConvertConcepts.ts","webpack://mftsccs-node/./src/Services/CreateBinaryTreeFromData.ts","webpack://mftsccs-node/./src/Services/CreateConnectionBetweenTwoConcepts.ts","webpack://mftsccs-node/./src/Services/CreateDefaultConcept.ts","webpack://mftsccs-node/./src/Services/CreateTheComposition.ts","webpack://mftsccs-node/./src/Services/CreateTheConcept.ts","webpack://mftsccs-node/./src/Services/CreateTheConnection.ts","webpack://mftsccs-node/./src/Services/CreateTheConnectionGeneral.ts","webpack://mftsccs-node/./src/Services/Delete/DeleteConnectionByType.ts","webpack://mftsccs-node/./src/Services/Delete/GetAllConnectionByType.ts","webpack://mftsccs-node/./src/Services/DeleteConcept.ts","webpack://mftsccs-node/./src/Services/DeleteConnection.ts","webpack://mftsccs-node/./src/Services/FindConeceptsFromConnection.ts","webpack://mftsccs-node/./src/Services/FindConnectionsOfCompositionBulkInMemory.ts","webpack://mftsccs-node/./src/Services/GetComposition.ts","webpack://mftsccs-node/./src/Services/GetCompositionBulk.ts","webpack://mftsccs-node/./src/Services/GetCompositionList.ts","webpack://mftsccs-node/./src/Services/GetConceptByCharacter.ts","webpack://mftsccs-node/./src/Services/GetConnections.ts","webpack://mftsccs-node/./src/Services/GetDataFromIndexDb.ts","webpack://mftsccs-node/./src/Services/GetLink.ts","webpack://mftsccs-node/./src/Services/GetLinkerConnectionFromConcept.ts","webpack://mftsccs-node/./src/Services/GetRelation.ts","webpack://mftsccs-node/./src/Services/GetTheConcept.ts","webpack://mftsccs-node/./src/Services/Http/HttpClient.service.ts","webpack://mftsccs-node/./src/Services/InitializeSystem.ts","webpack://mftsccs-node/./src/Services/Local/CreateDefaultLConcept.ts","webpack://mftsccs-node/./src/Services/Local/CreateLocalBinaryTreeFromData.ts","webpack://mftsccs-node/./src/Services/Local/CreateTheCompositionLocal.ts","webpack://mftsccs-node/./src/Services/Local/CreateTheConceptLocal.ts","webpack://mftsccs-node/./src/Services/Local/CreateTheConnectionLocal.ts","webpack://mftsccs-node/./src/Services/Local/GetCompositionListLocal.ts","webpack://mftsccs-node/./src/Services/Local/GetCompositionLocal.ts","webpack://mftsccs-node/./src/Services/Local/GetConceptByCharacterLocal.ts","webpack://mftsccs-node/./src/Services/Local/MakeTheConceptLocal.ts","webpack://mftsccs-node/./src/Services/Local/MakeTheInstanceConceptLocal.ts","webpack://mftsccs-node/./src/Services/Local/MakeTheTypeLocal.ts","webpack://mftsccs-node/./src/Services/Local/UpdateCompositionLocal.ts","webpack://mftsccs-node/./src/Services/MakeTheCharacter.ts","webpack://mftsccs-node/./src/Services/MakeTheCharacterData.ts","webpack://mftsccs-node/./src/Services/MakeTheConcept.ts","webpack://mftsccs-node/./src/Services/MakeTheInstanceConcept.ts","webpack://mftsccs-node/./src/Services/MakeTheTimestamp.ts","webpack://mftsccs-node/./src/Services/MakeTheTypeConcept.ts","webpack://mftsccs-node/./src/Services/Mqtt/publishMessage.ts","webpack://mftsccs-node/./src/Services/Search/DataIdFormat.ts","webpack://mftsccs-node/./src/Services/Search/FormatData.ts","webpack://mftsccs-node/./src/Services/Search/JustIdFormat.ts","webpack://mftsccs-node/./src/Services/Search/NewFormat.ts","webpack://mftsccs-node/./src/Services/Search/SearchLinkInternal.ts","webpack://mftsccs-node/./src/Services/Search/SearchLinkMultiple.ts","webpack://mftsccs-node/./src/Services/Search/SearchWithTypeAndLinker.ts","webpack://mftsccs-node/./src/Services/Search/orderingConnections.ts","webpack://mftsccs-node/./src/Services/Security/GetRequestHeader.ts","webpack://mftsccs-node/./src/Services/SplitStrings.ts","webpack://mftsccs-node/./src/Services/UpdateComposition.ts","webpack://mftsccs-node/./src/Services/User/UserTranslation.ts","webpack://mftsccs-node/./src/Services/View/ViewInternalData.ts","webpack://mftsccs-node/./src/Services/oauth/CallOauth.service.ts","webpack://mftsccs-node/./src/WrapperFunctions/SchemaQueryObservable.ts","webpack://mftsccs-node/./src/app.ts","webpack://mftsccs-node/webpack/bootstrap","webpack://mftsccs-node/webpack/runtime/define property getters","webpack://mftsccs-node/webpack/runtime/hasOwnProperty shorthand","webpack://mftsccs-node/webpack/runtime/make namespace object","webpack://mftsccs-node/webpack/before-startup","webpack://mftsccs-node/webpack/startup","webpack://mftsccs-node/webpack/after-startup"],"sourcesContent":["/**\r\n * Character creation API module for the Concept Connection System.\r\n * This module handles the creation and persistence of character data in the CCS database,\r\n * managing both local repository caching and remote server synchronization.\r\n *\r\n * @module Api/Create/CreateTheCharacter\r\n * @see https://documentation.freeschema.com for CCS API reference\r\n */\r\n\r\nimport { CharacterRepository } from \"../../DataStructures/CharacterRepository\";\r\nimport { Returner } from \"../../DataStructures/Returner\";\r\nimport { TheCharacter } from \"../../DataStructures/TheCharacter\";\r\nimport { BaseUrl } from \"../../DataStructures/BaseUrl\";\r\nimport { GetRequestHeader } from \"../../Services/Security/GetRequestHeader\";\r\nimport { HandleHttpError } from \"../../Services/Common/ErrorPosting\";\r\n\r\n/**\r\n * Creates a new character in the Concept Connection System database.\r\n * This function checks if the character already exists in the local repository\r\n * before making an API call. If the character doesn't exist (id == 0), it sends\r\n * a POST request to create the character on the server and caches it locally.\r\n * If the character already exists, it returns the existing character data without\r\n * making a network request.\r\n *\r\n * @param characterData - The character object containing the data to be created\r\n * @returns A promise that resolves to a Returner object containing the character ID,\r\n * user ID, and creation status information\r\n *\r\n * @example\r\n * ```typescript\r\n * const newCharacter = new TheCharacter(userId, \"A\", 0, 0, 4, 4, 999, 999, \"\", false);\r\n * const result = await CreateTheCharacter(newCharacter);\r\n * console.log(`Created character with ID: ${result.id}`);\r\n * ```\r\n *\r\n * @remarks\r\n * This function implements a dual-write pattern:\r\n * 1. First checks the local CharacterRepository for existing character\r\n * 2. If not found (id == 0), creates the character on the server via API\r\n * 3. Caches the newly created character in the local repository\r\n * 4. Returns either the new character data or existing character reference\r\n *\r\n * The function uses GetRequestHeader() for authentication and authorization.\r\n * Network errors are logged and handled through the HandleHttpError utility.\r\n *\r\n * @throws Will throw an error if the HTTP request fails or returns a non-OK status\r\n * @see CharacterRepository for local character caching\r\n * @see GetRequestHeader for authentication details\r\n * @see https://documentation.freeschema.com for character data structure\r\n */\r\nexport async function CreateTheCharacter(characterData: TheCharacter){\r\n try{\r\n\r\n var characterData = CharacterRepository.GetCharacter(characterData.data);\r\n if(characterData.id == 0){\r\n var header = await GetRequestHeader();\r\n const response = await fetch(BaseUrl.CreateTheCharacterDataUrl(),{\r\n method: 'POST',\r\n headers:header,\r\n body: JSON.stringify(characterData),\r\n });\r\n if(!response.ok){\r\n HandleHttpError(response);\r\n throw new Error(`Error! status: ${response.status}`);\r\n }\r\n const resultString = await response.json();\r\n const result = resultString as Returner;\r\n var savingCharacter = new TheCharacter(result.userId, characterData.data, 0, 0, 4,4,999,999,\"\",false);\r\n savingCharacter.id = result.id;\r\n CharacterRepository.AddCharacter(savingCharacter);\r\n return result;\r\n }\r\n else{\r\n var returningData = new Returner(characterData.id, characterData.userId, 0, false);\r\n return returningData;\r\n }\r\n\r\n\r\n }\r\n catch (error) {\r\n if (error instanceof Error) {\r\n console.log('create the character error message: ', error.message);\r\n } else {\r\n console.log('create the character unexpected error: ', error);\r\n }\r\n throw error;\r\n }\r\n}","/**\r\n * Concept creation API module for the Concept Connection System.\r\n * This module provides functionality to create new concepts in the CCS database,\r\n * which are the fundamental building blocks of the knowledge graph system.\r\n * Concepts represent individual ideas, entities, or nodes in the connection network.\r\n *\r\n * @module Api/Create/CreateTheConceptApi\r\n * @see https://documentation.freeschema.com for concept structure and API reference\r\n */\r\n\r\nimport { CreateTheConceptUrl } from \"../../Constants/ApiConstants\";\r\nimport { Concept } from \"../../DataStructures/Concept\";\r\nimport { Returner } from \"../../DataStructures/Returner\";\r\nimport { TheCharacter } from \"../../DataStructures/TheCharacter\";\r\nimport { BaseUrl } from \"../../DataStructures/BaseUrl\";\r\nimport { GetRequestHeader } from \"../../Services/Security/GetRequestHeader\";\r\nimport { CreateDefaultConcept, postWithRetry } from \"../../app\";\r\nimport { HandleHttpError, HandleHttpErrorHttp } from \"../../Services/Common/ErrorPosting\";\r\n\r\n/**\r\n * Creates a new concept in the Concept Connection System database.\r\n * This function sends a POST request to the CCS API to persist a new concept.\r\n * Concepts are the core data entities in CCS, representing nodes in the knowledge\r\n * graph that can be connected to other concepts through relationships.\r\n *\r\n * @param conceptData - The concept data object to be created. Can be any valid concept\r\n * structure that conforms to the API requirements\r\n * @returns A promise that resolves to a Concept object containing the created concept\r\n * with its assigned ID and all properties. Returns a default concept if\r\n * the operation fails.\r\n *\r\n * @example\r\n * ```typescript\r\n * const newConcept = {\r\n * userId: 123,\r\n * characterId: 456,\r\n * typeId: 1,\r\n * composition: [],\r\n * // ... other concept properties\r\n * };\r\n * const createdConcept = await CreateTheConceptApi(newConcept);\r\n * console.log(`Concept created with ID: ${createdConcept.id}`);\r\n * ```\r\n *\r\n * @remarks\r\n * This function follows a fail-safe pattern by initializing the result with a\r\n * default concept using CreateDefaultConcept(). This ensures that a valid concept\r\n * structure is always returned, even if the API call fails.\r\n *\r\n * The function uses GetRequestHeader() to include necessary authentication tokens\r\n * and headers in the request. All HTTP errors are handled through the HandleHttpError\r\n * utility and logged to the console with descriptive messages.\r\n *\r\n * @throws Will throw an error if the HTTP request fails or returns a non-OK status,\r\n * after logging the error details\r\n * @see CreateDefaultConcept for the default concept initialization\r\n * @see GetRequestHeader for authentication details\r\n * @see HandleHttpError for error handling\r\n * @see https://documentation.freeschema.com for concept data model\r\n */\r\nexport async function CreateTheConceptApi(conceptData: any){\r\n let result = CreateDefaultConcept();\r\n try{\r\n var header = await GetRequestHeader();\r\n const response = await postWithRetry(BaseUrl.CreateTheConceptUrl(), header,JSON.stringify(conceptData));\r\n if(!response.ok){\r\n HandleHttpErrorHttp(response);\r\n throw new Error(`Error! status: ${response.status}`);\r\n }\r\n const resultString = await response.json();\r\n result = resultString as Concept;\r\n\r\n return result;\r\n }\r\n catch (error) {\r\n if (error instanceof Error) {\r\n console.log('Create the concept api error message: ', error);\r\n } else {\r\n console.log('Create the concept api unexpected error: ', error);\r\n }\r\n throw error;\r\n }\r\n}","/**\r\n * Connection creation API module for the Concept Connection System.\r\n * This module handles the creation of connections (edges) between concepts in the CCS\r\n * knowledge graph. Connections define relationships and associations between concepts,\r\n * forming the network structure that enables knowledge mapping and traversal.\r\n *\r\n * @module Api/Create/CreateTheConnectionApi\r\n * @see https://documentation.freeschema.com for connection structure and relationship types\r\n */\r\n\r\nimport { CreateTheConnectionUrl } from \"../../Constants/ApiConstants\";\r\nimport { Concept } from \"../../DataStructures/Concept\";\r\nimport { Connection } from \"../../DataStructures/Connection\";\r\nimport { BaseUrl } from \"../../DataStructures/BaseUrl\";\r\nimport { GetRequestHeader } from \"../../Services/Security/GetRequestHeader\";\r\nimport { HandleHttpError, HandleHttpErrorHttp } from \"../../Services/Common/ErrorPosting\";\r\nimport { postWithRetry } from \"../../app\";\r\n\r\n/**\r\n * Creates one or more connections between concepts in the Concept Connection System.\r\n * This function sends a batch of connection data to the CCS API to establish\r\n * relationships between concepts. Connections are the edges in the knowledge graph\r\n * that link concepts together, enabling navigation and semantic relationships.\r\n *\r\n * @param connectionData - An array of Connection objects to be created. Each connection\r\n * defines a relationship between two concepts with directional\r\n * and metadata properties\r\n * @returns A promise that resolves to a Connection object. Note that the function\r\n * returns a default connection instance initialized at the start, and the\r\n * actual API response is processed but not returned in success cases\r\n *\r\n * @example\r\n * ```typescript\r\n * const connections = [\r\n * new Connection(userId, ofTheConceptId, toTheConceptId, typeId, ...),\r\n * new Connection(userId, anotherConceptId, targetConceptId, typeId, ...)\r\n * ];\r\n * await CreateTheConnectionApi(connections);\r\n * ```\r\n *\r\n * @remarks\r\n * This function supports batch connection creation by accepting an array of\r\n * Connection objects. The API processes all connections in a single request,\r\n * which is more efficient than creating connections individually.\r\n *\r\n * The function has an asymmetric return pattern:\r\n * - On success: Returns the default connection instance created at function start\r\n * - On error: Logs the error and handles it through HandleHttpError\r\n *\r\n * The connection data is serialized to JSON and sent with authentication headers\r\n * obtained from GetRequestHeader(). All network and HTTP errors are logged to\r\n * the console with descriptive prefixes for debugging.\r\n *\r\n * @throws Will throw an error if the HTTP request fails, after logging error details\r\n * and processing through HandleHttpError\r\n * @see Connection for the connection data structure\r\n * @see GetRequestHeader for authentication details\r\n * @see HandleHttpError for error handling\r\n * @see https://documentation.freeschema.com for connection types and semantics\r\n */\r\nexport async function CreateTheConnectionApi(connectionData: Connection[]){\r\n let result = new Connection(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);\r\n try{\r\n\r\n\r\n var header = await GetRequestHeader();\r\n var jsonData = JSON.stringify(connectionData);\r\n const response = await postWithRetry(BaseUrl.CreateTheConnectionUrl(), header, jsonData);\r\n if(response.ok){\r\n const result = await response.json();\r\n\r\n }\r\n else{\r\n console.log('Create the connection error message: ', response);\r\n HandleHttpErrorHttp(response);\r\n }\r\n return result;\r\n\r\n\r\n }\r\n catch (error) {\r\n if (error instanceof Error) {\r\n console.log('Create the connection error message: ', error.message);\r\n } else {\r\n console.log(' Create the connection unexpected error: ', error);\r\n }\r\n throw error;\r\n }\r\n}","/**\r\n * Text data creation API module for the Concept Connection System.\r\n * This module provides functionality to create and persist text data entries in the\r\n * CCS database. Text data represents the textual content associated with concepts,\r\n * enabling rich descriptions, annotations, and semantic information storage.\r\n *\r\n * @module Api/Create/CreateTheTextData\r\n * @see https://documentation.freeschema.com for text data structure and usage\r\n */\r\n\r\nimport { CreateTheTextDataUrl } from \"../../Constants/ApiConstants\";\r\nimport { TheTexts } from \"../../DataStructures/TheTexts\";\r\nimport { BaseUrl } from \"../../DataStructures/BaseUrl\";\r\nimport { GetRequestHeader } from \"../../Services/Security/GetRequestHeader\";\r\nimport { HandleHttpError } from \"../../Services/Common/ErrorPosting\";\r\n\r\n/**\r\n * Creates a new text data entry in the Concept Connection System database.\r\n * This function sends a POST request to persist text content that can be associated\r\n * with concepts, providing descriptive or explanatory information. Text data is a\r\n * fundamental component for enriching concepts with human-readable content.\r\n *\r\n * @param textData - The TheTexts object containing the text content and metadata\r\n * to be persisted in the database\r\n * @returns A promise that resolves to a TheTexts object containing the created\r\n * text data with its assigned ID and all associated properties\r\n *\r\n * @example\r\n * ```typescript\r\n * const newText = new TheTexts(\r\n * userId,\r\n * characterId,\r\n * conceptId,\r\n * \"Sample text content\",\r\n * languageId,\r\n * typeId\r\n * );\r\n * const createdText = await CreateTextData(newText);\r\n * console.log(`Text data created with ID: ${createdText.id}`);\r\n * ```\r\n *\r\n * @remarks\r\n * This function is essential for adding textual descriptions to concepts in the\r\n * knowledge graph. Text data can include:\r\n * - Concept descriptions and definitions\r\n * - Annotations and notes\r\n * - Multi-language translations\r\n * - Rich content and documentation\r\n *\r\n * The function uses GetRequestHeader() to include authentication credentials\r\n * and necessary headers for the API request. The created text data is returned\r\n * with its server-assigned ID, enabling immediate reference and updates.\r\n *\r\n * All HTTP errors are processed through HandleHttpError and logged with\r\n * descriptive error messages. Errors are propagated to the caller after logging.\r\n *\r\n * @throws Will throw an error if the HTTP request fails or returns a non-OK status,\r\n * after logging the error details to the console\r\n * @see TheTexts for the text data structure\r\n * @see GetRequestHeader for authentication details\r\n * @see HandleHttpError for error handling\r\n * @see https://documentation.freeschema.com for text data model and language support\r\n */\r\nexport async function CreateTextData(textData: TheTexts){\r\n try{\r\n var header = await GetRequestHeader();\r\n const response = await fetch(BaseUrl.CreateTheTextDataUrl(),{\r\n method: 'POST',\r\n headers:header,\r\n body: JSON.stringify(textData),\r\n });\r\n if(!response.ok){\r\n HandleHttpError(response);\r\n throw new Error(`Error! status: ${response.status}`);\r\n }\r\n const resultString = await response.json();\r\n const result = resultString as TheTexts;\r\n\r\n return result;\r\n }\r\n catch (error) {\r\n if (error instanceof Error) {\r\n console.log('Create the text error message: ', error.message);\r\n } else {\r\n console.log('Create the text unexpected error: ', error);\r\n }\r\n throw error;\r\n }\r\n}","/**\r\n * Backend concept deletion API module for the Concept Connection System.\r\n *\r\n * This module provides functionality to permanently delete concepts from the backend database.\r\n * It handles authenticated API requests to remove concept records using the trash/delete endpoint.\r\n *\r\n * @module Api/Delete/DeleteConceptInBackend\r\n * @see https://documentation.freeschema.com for API reference\r\n */\r\n\r\nimport { BaseUrl } from \"../../DataStructures/BaseUrl\"\r\nimport { HandleHttpError } from \"../../Services/Common/ErrorPosting\"\r\n\r\n/**\r\n * Permanently deletes a concept from the backend database using the trash endpoint.\r\n *\r\n * This function sends an authenticated POST request to remove a concept by its ID. It's used\r\n * when a concept needs to be completely removed from the system rather than just marked as deleted.\r\n * The operation requires authentication and will throw errors if the deletion fails.\r\n *\r\n * @param id - The unique identifier of the concept to delete\r\n * @param token - Bearer authentication token for authorizing the deletion request\r\n *\r\n * @returns A promise that resolves when the concept is successfully deleted, or rejects with an error\r\n *\r\n * @throws Will throw an error if the HTTP request fails or returns a non-OK status\r\n * @throws Will re-throw any caught errors after logging them to the console\r\n *\r\n * @example\r\n * ```typescript\r\n * // Delete a concept with authentication\r\n * try {\r\n * await TrashTheConcept(12345, 'your-auth-token-here');\r\n * console.log('Concept deleted successfully');\r\n * } catch (error) {\r\n * console.error('Failed to delete concept:', error);\r\n * }\r\n * ```\r\n *\r\n * @remarks\r\n * This function uses FormData to send the concept ID in the request body. The deletion is permanent\r\n * and cannot be undone. All errors are logged to the console before being re-thrown to allow\r\n * proper error handling by the caller.\r\n *\r\n * @see DeleteTheConcept for an alternative deletion method\r\n * @see BaseUrl.DeleteConceptUrl for the API endpoint configuration\r\n */\r\nexport async function TrashTheConcept(\r\n id: number,\r\n token: string,\r\n ) {\r\n try {\r\n const myHeaders = new Headers()\r\n myHeaders.append('Authorization', 'Bearer ' + token)\r\n const formdata = new FormData()\r\n formdata.append('id', id.toString())\r\n const response = await fetch(BaseUrl.DeleteConceptUrl(), {\r\n method: 'POST',\r\n body: formdata,\r\n headers: myHeaders,\r\n })\r\n if (!response.ok) {\r\n HandleHttpError(response);\r\n throw new Error(`Delete composition Error! status: ${response.status}`)\r\n }\r\n } catch (error) {\r\n if (error instanceof Error) {\r\n console.log('Delete composition error message: ', error.message)\r\n } else {\r\n console.log('Delete composition unexpected error: ', error)\r\n }\r\n throw error;\r\n }\r\n }","/**\r\n * Bulk connection deletion API module for the Concept Connection System.\r\n *\r\n * This module provides functionality to delete multiple connections between concepts in a single API call.\r\n * It optimizes performance by allowing batch deletion operations rather than individual deletions,\r\n * making it ideal for cleanup operations and managing multiple relationships at once.\r\n *\r\n * @module Api/DeleteConnectionApiBulk\r\n * @see https://documentation.freeschema.com for API reference\r\n */\r\n\r\nimport { BaseUrl } from \"../app\";\r\nimport { HandleHttpError } from \"../Services/Common/ErrorPosting\";\r\nimport { GetRequestHeader, GetRequestHeaderWithAuthorization } from \"../Services/Security/GetRequestHeader\";\r\n\r\n/**\r\n * Deletes multiple connections between concepts in a single bulk operation.\r\n *\r\n * This function sends an authenticated POST request to delete multiple connection records\r\n * identified by their IDs. It's particularly useful for cleanup operations, removing outdated\r\n * relationships, or managing connections in bulk rather than one at a time. The function\r\n * returns a boolean indicating success or failure of the bulk deletion.\r\n *\r\n * @param ids - Array of connection IDs to delete in bulk\r\n *\r\n * @returns A promise that resolves to `true` if all connections were successfully deleted,\r\n * `false` if the deletion failed or encountered errors\r\n *\r\n * @example\r\n * ```typescript\r\n * // Delete multiple connections at once\r\n * const connectionIds = [101, 102, 103, 104];\r\n * const success = await DeleteTheConnectionBulkApi(connectionIds);\r\n *\r\n * if (success) {\r\n * console.log('All connections deleted successfully');\r\n * } else {\r\n * console.log('Bulk deletion failed');\r\n * }\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Clean up all connections for a specific concept\r\n * const obsoleteConnections = [45, 67, 89];\r\n * const result = await DeleteTheConnectionBulkApi(obsoleteConnections);\r\n * ```\r\n *\r\n * @remarks\r\n * This function uses authenticated headers retrieved from GetRequestHeaderWithAuthorization().\r\n * The connection IDs are sent as a JSON array in the request body. Unlike individual deletion\r\n * methods, this function does not throw errors but returns false on failure, making it safer\r\n * for batch operations where partial failures should be handled gracefully.\r\n *\r\n * The function logs all errors to the console for debugging purposes but does not re-throw them,\r\n * allowing the calling code to continue execution even if the bulk deletion fails.\r\n *\r\n * @see DeleteTheConnection for single connection deletion\r\n * @see BaseUrl.DeleteTheConnectionBulkUrl for the API endpoint configuration\r\n */\r\nexport default async function DeleteTheConnectionBulkApi(ids:number[]){\r\n let isDeleted = false;\r\n try{\r\n let header = await GetRequestHeaderWithAuthorization();\r\n const response = await fetch(BaseUrl.DeleteTheConnectionBulkUrl(),{\r\n method: 'POST',\r\n headers: header,\r\n body: JSON.stringify(ids)\r\n });\r\n if(!response.ok){\r\n console.log('Delete connection Bulk Api error status: ', response.status);\r\n HandleHttpError(response);\r\n }\r\n else{\r\n const result = await response.json()\r\n isDeleted = result.success;\r\n }\r\n\r\n\r\n\r\n \r\n }\r\n catch (error) {\r\n if (error instanceof Error) {\r\n console.log('Delete connection Bulk Api error message: ', error.message);\r\n } else {\r\n console.log('Delete connection Bulk Api unexpected error: ', error);\r\n }\r\n }\r\n return isDeleted;\r\n}","/**\r\n * Concept deletion API module for the Concept Connection System.\r\n *\r\n * This module provides the primary interface for deleting individual concept records from the system.\r\n * It supports both authenticated and unauthenticated deletion requests, making it flexible for\r\n * different security contexts. The module handles API communication, error management, and\r\n * returns deletion status to the caller.\r\n *\r\n * @module Api/DeleteTheConcept\r\n * @see https://documentation.freeschema.com for API reference\r\n */\r\n\r\nimport { BaseUrl } from \"../DataStructures/BaseUrl\";\r\nimport { Concept } from \"../DataStructures/Concept\";\r\nimport { HandleHttpError } from \"../Services/Common/ErrorPosting\";\r\nimport { GetRequestHeader, GetRequestHeaderWithAuthorization } from \"../Services/Security/GetRequestHeader\";\r\n\r\n/**\r\n * Deletes a single concept from the system by its ID.\r\n *\r\n * This is the primary function for removing individual concepts from the CCS database. It supports\r\n * optional authentication via a bearer token and handles both authenticated and unauthenticated\r\n * deletion scenarios. The function returns a boolean indicating success or failure, and throws\r\n * errors for critical failures that should halt execution.\r\n *\r\n * @param id - The unique identifier of the concept to delete\r\n * @param token - Optional bearer authentication token. Defaults to empty string for unauthenticated requests\r\n *\r\n * @returns A promise that resolves to `true` if the concept was successfully deleted,\r\n * `false` if the deletion failed\r\n *\r\n * @throws Will throw an error if the HTTP request fails with a non-OK status\r\n * @throws Will re-throw any caught errors after logging them to the console\r\n *\r\n * @example\r\n * ```typescript\r\n * // Delete a concept with authentication\r\n * try {\r\n * const success = await DeleteTheConcept(12345, 'your-auth-token');\r\n * if (success) {\r\n * console.log('Concept deleted successfully');\r\n * }\r\n * } catch (error) {\r\n * console.error('Critical deletion error:', error);\r\n * }\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Delete a concept without authentication (using API key)\r\n * const result = await DeleteTheConcept(67890);\r\n * if (result) {\r\n * console.log('Public concept removed');\r\n * }\r\n * ```\r\n *\r\n * @remarks\r\n * The function uses FormData to send the concept ID along with a hardcoded \"nodeserver\" API key.\r\n * When a token is provided, it switches to authenticated headers using GetRequestHeaderWithAuthorization.\r\n * Note that the headers parameter is currently commented out in the fetch call, which may affect\r\n * authentication behavior.\r\n *\r\n * Error handling follows a dual approach: errors are logged to console for debugging and then\r\n * re-thrown to allow the caller to handle critical failures. The function returns the success\r\n * status from the API response JSON.\r\n *\r\n * @see TrashTheConcept for backend-specific concept deletion\r\n * @see BaseUrl.DeleteConceptUrl for the API endpoint configuration\r\n * @see GetRequestHeaderWithAuthorization for authentication header construction\r\n */\r\nexport default async function DeleteTheConcept(id:number, token:string =\"\"){\r\n let isDeleted = false; \r\n try{\r\n let myHeaders = await GetRequestHeaderWithAuthorization('application/x-www-form-urlencoded', token);\r\n const formdata = new FormData();\r\n formdata.append(\"id\", id.toString());\r\n formdata.append(\"apiKey\", \"nodeserver\");\r\n const { \"Content-Type\": _, ...headersWithoutContentType } = myHeaders;\r\n const response = await fetch(BaseUrl.DeleteConceptUrl(),{\r\n method: 'POST',\r\n headers: headersWithoutContentType,\r\n body: formdata\r\n });\r\n if(!response.ok){\r\n HandleHttpError(response);\r\n throw new Error(`Error! status: ${response.status}`);\r\n }\r\n else{\r\n const result = await response.json()\r\n\r\n isDeleted = result.success;\r\n }\r\n\r\n\r\n \r\n }\r\n catch (error) {\r\n if (error instanceof Error) {\r\n console.log('Delete concept error message: ', error.message);\r\n } else {\r\n console.log('Delete concept unexpected error: ', error);\r\n }\r\n throw error;\r\n }\r\n return isDeleted;\r\n}","/**\r\n * Connection deletion API module for the Concept Connection System.\r\n *\r\n * This module provides the primary interface for deleting individual connection records between\r\n * concepts in the system. Connections represent relationships, links, or associations between\r\n * different concepts. This module supports both authenticated and unauthenticated deletion\r\n * requests and handles all aspects of API communication and error management.\r\n *\r\n * @module Api/DeleteTheConnection\r\n * @see https://documentation.freeschema.com for API reference\r\n */\r\n\r\nimport { BaseUrl } from \"../DataStructures/BaseUrl\";\r\nimport { HandleHttpError } from \"../Services/Common/ErrorPosting\";\r\nimport { GetRequestHeader, GetRequestHeaderWithAuthorization } from \"../Services/Security/GetRequestHeader\";\r\n\r\n/**\r\n * Deletes a single connection between concepts by its ID.\r\n *\r\n * This is the primary function for removing individual connections (relationships) between concepts\r\n * in the CCS database. Connections represent links, associations, or relationships between different\r\n * concept nodes. The function supports optional authentication and returns a boolean indicating\r\n * whether the deletion was successful.\r\n *\r\n * @param id - The unique identifier of the connection to delete\r\n * @param token - Optional bearer authentication token. Defaults to empty string for unauthenticated requests\r\n *\r\n * @returns A promise that resolves to `true` if the connection was successfully deleted,\r\n * `false` if the deletion failed or encountered errors\r\n *\r\n * @throws Will re-throw any caught errors after logging them to the console\r\n *\r\n * @example\r\n * ```typescript\r\n * // Delete a connection with authentication\r\n * try {\r\n * const success = await DeleteTheConnection(456, 'your-auth-token');\r\n * if (success) {\r\n * console.log('Connection removed successfully');\r\n * } else {\r\n * console.log('Failed to remove connection');\r\n * }\r\n * } catch (error) {\r\n * console.error('Critical error during deletion:', error);\r\n * }\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Delete a connection without authentication\r\n * const removed = await DeleteTheConnection(789);\r\n * if (removed) {\r\n * console.log('Connection deleted');\r\n * }\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Remove multiple connections sequentially\r\n * const connectionIds = [101, 102, 103];\r\n * for (const connId of connectionIds) {\r\n * await DeleteTheConnection(connId, authToken);\r\n * }\r\n * ```\r\n *\r\n * @remarks\r\n * The function uses FormData to send the connection ID along with a hardcoded \"nodeserver\" API key.\r\n * When a token is provided, authenticated headers are prepared using GetRequestHeaderWithAuthorization,\r\n * though the headers are currently commented out in the fetch call.\r\n *\r\n * The fetch request includes `redirect: \"follow\"` to handle any server-side redirects automatically.\r\n * Error handling logs failures to the console before re-throwing, allowing both debugging and\r\n * proper error propagation to calling code.\r\n *\r\n * Unlike concept deletion, connection deletion typically has fewer cascade effects since connections\r\n * are edges in the concept graph rather than nodes themselves.\r\n *\r\n * @see DeleteTheConnectionBulkApi for bulk connection deletion\r\n * @see BaseUrl.DeleteTheConnectionUrl for the API endpoint configuration\r\n * @see GetRequestHeaderWithAuthorization for authentication header construction\r\n */\r\nexport default async function DeleteTheConnection(id:number, token:string = \"\"){\r\n let isDeleted = false;\r\n try{\r\n const formdata = new FormData();\r\n // Don't set Content-Type for FormData - let browser set it automatically with boundary\r\n let authHeader = await GetRequestHeaderWithAuthorization('', token);\r\n // Only include Authorization header, not Content-Type\r\n let myHeaders: Record<string, string> = {\r\n 'Authorization': authHeader['Authorization'],\r\n 'Accept': 'application/json'\r\n };\r\n formdata.append(\"id\", id.toString());\r\n formdata.append(\"apiKey\", \"nodeserver\");\r\n const response = await fetch(BaseUrl.DeleteTheConnectionUrl(),{\r\n method: 'POST',\r\n headers: myHeaders,\r\n body: formdata,\r\n redirect: \"follow\"\r\n });\r\n if(!response.ok){\r\n console.log('Delete connection error status: ', response.status);\r\n HandleHttpError(response);\r\n }\r\n else{\r\n const result = await response.json()\r\n isDeleted = result.success;\r\n }\r\n\r\n\r\n\r\n \r\n }\r\n catch (error) {\r\n if (error instanceof Error) {\r\n console.log('Delete connection error message: ', error.message);\r\n } else {\r\n console.log('Delete connection unexpected error: ', error);\r\n }\r\n throw error;\r\n }\r\n\r\n return isDeleted;\r\n}","/**\r\n * API module for fetching AI-related concept data from the remote server.\r\n * This module retrieves AI-generated or AI-specific concepts and adds them to the local concept store.\r\n *\r\n * @module Api/GetAiData\r\n * @see https://documentation.freeschema.com for more information on the Concept Connection System\r\n */\r\n\r\nimport { BaseUrl } from '../DataStructures/BaseUrl';\r\nimport { ConceptsData } from '../DataStructures/ConceptData';\r\nimport { HandleHttpError } from '../Services/Common/ErrorPosting';\r\nimport { PurgatoryDatabaseUpdated } from '../Services/InitializeSystem';\r\nimport { GetRequestHeader, GetRequestHeaderWithAuthorization } from '../Services/Security/GetRequestHeader';\r\nimport { BinaryTree } from '../app';\r\nimport { GetAllAiData } from './../Constants/ApiConstants';\r\n\r\n/**\r\n * Fetches all AI-related concept data from the remote server and populates the local concept store.\r\n * This function retrieves AI-generated concepts, AI metadata, or AI-specific data structures\r\n * from the backend and adds them to the ConceptsData singleton for use throughout the application.\r\n *\r\n * The function uses authorized headers to ensure secure access to AI data endpoints.\r\n * All retrieved concepts are automatically added to the local in-memory concept store.\r\n *\r\n * @returns A promise that resolves when all AI data has been fetched and stored locally\r\n *\r\n * @example\r\n * ```typescript\r\n * // Fetch and populate AI data\r\n * await GetAiData();\r\n *\r\n * // AI concepts are now available in ConceptsData\r\n * const aiConcepts = ConceptsData.GetAllConcepts();\r\n * ```\r\n *\r\n * @remarks\r\n * This function requires proper authentication headers via GetRequestHeaderWithAuthorization.\r\n * Errors are logged to the console with the prefix 'Ai Error Message' and are re-thrown\r\n * to allow calling code to handle failures appropriately.\r\n *\r\n * @throws Will throw an error if the network request fails or if the server returns an error response\r\n *\r\n * @see ConceptsData.AddConcept for how concepts are stored locally\r\n * @see GetRequestHeaderWithAuthorization for authentication details\r\n */\r\nexport async function GetAiData(){\r\n try{\r\n // const start = new Date().getTime();\r\n // var header = await GetRequestHeaderWithAuthorization('application/x-www-form-urlencoded');\r\n // const response = await fetch(BaseUrl.GetAllAiData(),{\r\n // method: 'GET',\r\n // headers: header,\r\n // });\r\n // if(!response.ok){\r\n // console.log('Ai Error Message: ', \"Cannot get response\");\r\n // HandleHttpError(response);\r\n // }\r\n // const result = await response.json();\r\n // for(var i=0; i< result.length; i++){\r\n // ConceptsData.AddConcept(result[i]);\r\n // }\r\n //PurgatoryDatabaseUpdated();\r\n\r\n\r\n}\r\ncatch (error) {\r\n if (error instanceof Error) {\r\n console.log('Ai Error Message: ', error.message);\r\n } else {\r\n console.log('Ai Error Message: ', error);\r\n }\r\n // throw error;\r\n }\r\n}","/**\r\n * API module for retrieving concepts filtered by type and user.\r\n * This module fetches concepts of a specific type for a given user from the remote server\r\n * and populates the local concept store.\r\n *\r\n * @module Api/GetAllConceptsByType\r\n * @see https://documentation.freeschema.com for more information on the Concept Connection System\r\n */\r\n\r\nimport { ConceptsData } from \"./../DataStructures/ConceptData\";\r\nimport { GetAllConceptsByTypeUrl } from './../Constants/ApiConstants';\r\nimport { BaseUrl } from \"../DataStructures/BaseUrl\";\r\nimport { GetRequestHeader } from \"../Services/Security/GetRequestHeader\";\r\nimport { HandleHttpError } from \"../Services/Common/ErrorPosting\";\r\n\r\n/**\r\n * Retrieves all concepts of a specific type belonging to a user from the remote server.\r\n * This function allows filtering concepts by their type (e.g., \"person\", \"place\", \"thing\")\r\n * and user ownership, enabling targeted retrieval of specific concept categories.\r\n *\r\n * In the Concept Connection System, concepts can be categorized by type to organize\r\n * different kinds of knowledge. This function fetches only concepts matching the specified\r\n * type for the given user, which is useful for displaying categorized views or performing\r\n * type-specific operations.\r\n *\r\n * @param type - The type category of concepts to retrieve (e.g., \"person\", \"organization\", \"idea\")\r\n * @param userId - The unique identifier of the user whose concepts should be retrieved\r\n *\r\n * @returns A promise that resolves when all matching concepts have been fetched and stored locally\r\n *\r\n * @example\r\n * ```typescript\r\n * // Fetch all \"person\" type concepts for user 123\r\n * await GetAllConceptsByType(\"person\", 123);\r\n *\r\n * // Fetch all \"organization\" type concepts for user 456\r\n * await GetAllConceptsByType(\"organization\", 456);\r\n *\r\n * // Retrieved concepts are now available in ConceptsData\r\n * const concepts = ConceptsData.GetAllConcepts();\r\n * ```\r\n *\r\n * @remarks\r\n * The function uses URLSearchParams to properly encode the request body parameters.\r\n * Errors are logged with the prefix 'GetAllConceptsByType error' and are re-thrown\r\n * to allow calling code to handle failures appropriately.\r\n *\r\n * @throws Will throw an error if the network request fails or if the server returns an error response\r\n *\r\n * @see ConceptsData.AddConcept for how concepts are stored locally\r\n * @see GetRequestHeader for request header configuration\r\n */\r\nexport async function GetAllConceptsByType(type:string,userId: number){\r\n try{\r\n var urlencoded = new URLSearchParams();\r\n urlencoded.append(\"type\", type);\r\n urlencoded.append(\"user_id\", userId.toString());\r\n\r\n var header = await GetRequestHeader('application/x-www-form-urlencoded');\r\n const response = await fetch(BaseUrl.GetAllConceptsByTypeUrl(),{\r\n method: 'POST',\r\n headers: header,\r\n body: urlencoded\r\n });\r\n if(response.ok){\r\n const result = await response.json();\r\n for(var i=0; i< result.length; i++){\r\n ConceptsData.AddConcept(result[i]);\r\n }\r\n }\r\n\r\n console.log(\"GetAllConceptsByType error\", response.status);\r\n HandleHttpError(response);\r\n\r\n }\r\n catch (error) {\r\n if (error instanceof Error) {\r\n console.log('GetAllConceptsByType error message: ', error.message);\r\n } else {\r\n console.log('GetAllConceptsByType unexpected error: ', error);\r\n }\r\n throw error;\r\n }\r\n}","/**\r\n * API module for retrieving connections associated with a specific composition.\r\n * This module handles both local caching and remote fetching of composition connections,\r\n * with automatic synchronization and deletion detection.\r\n *\r\n * @module Api/GetAllConnectionsOfComposition\r\n * @see https://documentation.freeschema.com for more information on the Concept Connection System\r\n */\r\n\r\nimport { Connection } from '../DataStructures/Connection';\r\nimport { ConnectionData } from '../DataStructures/ConnectionData';\r\nimport { GetMaximumConnectionSyncTime } from '../Services/GetMaximumConnectionSyncTime';\r\nimport { GetAllConnectionsOfCompositionUrl } from './../Constants/ApiConstants';\r\nimport { BaseUrl } from \"../DataStructures/BaseUrl\";\r\nimport { ConnectionBinaryTree } from '../DataStructures/ConnectionBinaryTree/ConnectionBinaryTree';\r\nimport { CheckForConnectionDeletion } from '../Services/CheckForConnectionDeletion';\r\nimport { GetRequestHeader } from '../Services/Security/GetRequestHeader';\r\nimport { HandleHttpError } from '../Services/Common/ErrorPosting';\r\n\r\n/**\r\n * Retrieves all connections associated with a specific composition, using local cache when available.\r\n * This function implements a smart caching strategy: it first checks for locally stored connections,\r\n * and if found, fetches fresh data from the server to detect any deletions or changes. If no local\r\n * data exists, it directly fetches from the server.\r\n *\r\n * A composition represents a group or collection of related concepts and their connections.\r\n * This function ensures that all connections within a composition are available and synchronized\r\n * with the remote server.\r\n *\r\n * @param composition_id - The unique identifier of the composition whose connections should be retrieved\r\n *\r\n * @returns A promise that resolves to an array of Connection objects belonging to the composition\r\n *\r\n * @example\r\n * ```typescript\r\n * // Fetch all connections for composition 456\r\n * const connections = await GetAllConnectionsOfComposition(456);\r\n *\r\n * // Process the connections\r\n * connections.forEach(conn => {\r\n * console.log(`Connection: ${conn.id} links concepts`);\r\n * });\r\n * ```\r\n *\r\n * @remarks\r\n * This function implements a two-step synchronization process:\r\n * 1. First fetch: Retrieves from local cache if available\r\n * 2. Online fetch: Always fetches fresh data from server\r\n * 3. Deletion check: Compares old and new data to detect removed connections\r\n *\r\n * This approach ensures data consistency while maintaining local performance benefits.\r\n *\r\n * @see GetAllConnectionsOfCompositionOnline for the underlying server fetch operation\r\n * @see CheckForConnectionDeletion for how deleted connections are detected\r\n * @see ConnectionData.GetConnectionsOfCompositionLocal for local cache access\r\n */\r\nexport async function GetAllConnectionsOfComposition(composition_id: number){\r\n \r\n var connectionList: Connection[] = [];\r\n connectionList = await ConnectionData.GetConnectionsOfCompositionLocal(composition_id);\r\n if(connectionList.length == 0){\r\n var connectionListString = await GetAllConnectionsOfCompositionOnline(composition_id);\r\n connectionList = connectionListString as Connection[];\r\n }\r\n else{\r\n var newConnectionsString = await GetAllConnectionsOfCompositionOnline(composition_id);\r\n var newConnections = newConnectionsString as Connection[];\r\n CheckForConnectionDeletion(newConnections, connectionList);\r\n connectionList = newConnections;\r\n }\r\n return connectionList;\r\n \r\n \r\n}\r\n\r\n/**\r\n * Fetches connections for a specific composition directly from the remote server.\r\n * This function bypasses local caching and always retrieves fresh data from the backend,\r\n * making it suitable for ensuring data accuracy and detecting server-side changes.\r\n *\r\n * All retrieved connections are automatically added to the local ConnectionData store\r\n * for subsequent use throughout the application.\r\n *\r\n * @param composition_id - The unique identifier of the composition whose connections should be fetched\r\n *\r\n * @returns A promise that resolves to an array of Connection objects retrieved from the server\r\n *\r\n * @example\r\n * ```typescript\r\n * // Fetch fresh connections directly from server\r\n * const connections = await GetAllConnectionsOfCompositionOnline(456);\r\n *\r\n * // Compare with cached data\r\n * const cachedConnections = await ConnectionData.GetConnectionsOfCompositionLocal(456);\r\n * ```\r\n *\r\n * @remarks\r\n * This is the underlying server communication function used by GetAllConnectionsOfComposition.\r\n * It should generally not be called directly unless you specifically need to bypass caching\r\n * and force a fresh server fetch.\r\n *\r\n * Each retrieved connection is added to ConnectionData, making it available for local queries\r\n * and reducing the need for subsequent server requests.\r\n *\r\n * @throws Will throw an error if the network request fails or if the server returns an error response\r\n *\r\n * @see GetAllConnectionsOfComposition for the recommended high-level function with caching\r\n * @see ConnectionData.AddConnection for how connections are stored locally\r\n */\r\nexport async function GetAllConnectionsOfCompositionOnline(composition_id: number){\r\n var connectionList: Connection[] = [];\r\n\r\n try{\r\n var header = await GetRequestHeader('application/x-www-form-urlencoded');\r\n const response = await fetch(BaseUrl.GetAllConnectionsOfCompositionUrl(),{\r\n method: 'POST',\r\n headers: header,\r\n body: `composition_id=${composition_id}`\r\n });\r\n if(!response.ok){\r\n HandleHttpError(response);\r\n throw new Error(`Error! status: ${response.status}`);\r\n }\r\n const result = await response.json();\r\n for(var i=0; i< result.length; i++){\r\n ConnectionData.AddConnection(result[i]);\r\n connectionList.push(result[i]);\r\n }\r\n\r\n return connectionList;\r\n }\r\n catch (error) {\r\n if (error instanceof Error) {\r\n console.log('Get all connection of composition error : ', error.message);\r\n } else {\r\n console.log('Get all connection of composition error : ', error);\r\n }\r\n throw error;\r\n }\r\n}","/**\r\n * API module for retrieving connections for multiple compositions in a single bulk operation.\r\n * This module optimizes performance by fetching connections for multiple compositions at once,\r\n * with automatic synchronization, deletion detection, and concept resolution.\r\n *\r\n * @module Api/GetAllConnectionsOfCompositionBulk\r\n * @see https://documentation.freeschema.com for more information on the Concept Connection System\r\n */\r\n\r\nimport { Connection } from '../DataStructures/Connection';\r\nimport { ConnectionData } from '../DataStructures/ConnectionData';\r\nimport { BaseUrl } from \"../DataStructures/BaseUrl\";\r\nimport { FindConceptsFromConnections } from '../Services/FindConeceptsFromConnection';\r\nimport { FindConnectionsOfCompositionsBulkInMemory } from '../Services/FindConnectionsOfCompositionBulkInMemory';\r\nimport { CheckForConnectionDeletion } from '../Services/CheckForConnectionDeletion';\r\nimport { GetRequestHeader } from '../Services/Security/GetRequestHeader';\r\nimport { HandleHttpError } from '../Services/Common/ErrorPosting';\r\n\r\n/**\r\n * Retrieves connections for multiple compositions in a single bulk operation for improved performance.\r\n * This function fetches connections for multiple composition IDs at once, checks for deletions by\r\n * comparing with in-memory data, and automatically resolves all referenced concepts.\r\n *\r\n * Bulk operations are significantly more efficient than individual requests when working with\r\n * multiple compositions, reducing network overhead and improving application responsiveness.\r\n *\r\n * @param composition_ids - Array of composition IDs whose connections should be retrieved. Defaults to empty array.\r\n *\r\n * @returns A promise that resolves to an array of Connection objects from all specified compositions\r\n *\r\n * @example\r\n * ```typescript\r\n * // Fetch connections for multiple compositions at once\r\n * const compositionIds = [100, 200, 300];\r\n * const connections = await GetAllConnectionsOfCompositionBulk(compositionIds);\r\n *\r\n * console.log(`Retrieved ${connections.length} connections`);\r\n *\r\n * // All referenced concepts are automatically fetched\r\n * connections.forEach(conn => {\r\n * console.log(`Connection ${conn.id} is ready with its concepts`);\r\n * });\r\n *\r\n * // Handle empty array case\r\n * const noConnections = await GetAllConnectionsOfCompositionBulk([]);\r\n * console.log(noConnections); // Returns empty array\r\n * ```\r\n *\r\n * @remarks\r\n * This function performs several important operations:\r\n * 1. Early return if composition_ids array is empty\r\n * 2. Retrieves old connections from in-memory storage for comparison\r\n * 3. Fetches fresh connections from server via bulk endpoint\r\n * 4. Detects and handles deleted connections via CheckForConnectionDeletion\r\n * 5. Automatically resolves all concepts referenced by the connections\r\n *\r\n * The automatic concept resolution ensures that all concepts referenced in the connections\r\n * are available locally, preventing the need for additional lookups.\r\n *\r\n * @see GetAllConnectionsOfCompositionOnline for the underlying bulk server fetch\r\n * @see FindConnectionsOfCompositionsBulkInMemory for in-memory lookup\r\n * @see FindConceptsFromConnections for automatic concept resolution\r\n * @see CheckForConnectionDeletion for deletion detection logic\r\n */\r\nexport async function GetAllConnectionsOfCompositionBulk(composition_ids: number[] = []){\r\n \r\n var connectionList: Connection[] = [];\r\n var conceptList: number[] = [];\r\n if(composition_ids.length <= 0){\r\n return connectionList;\r\n }\r\n var oldConnectionList = await FindConnectionsOfCompositionsBulkInMemory(composition_ids);\r\n var connectionListString = await GetAllConnectionsOfCompositionOnline(composition_ids);\r\n connectionList = connectionListString as Connection[];\r\n\r\n CheckForConnectionDeletion(connectionList, oldConnectionList);\r\n await FindConceptsFromConnections(connectionList);\r\n return connectionList;\r\n \r\n \r\n}\r\n\r\n/**\r\n * Fetches connections for multiple compositions directly from the remote server in a single request.\r\n * This function bypasses local caching and retrieves fresh data from the bulk endpoint,\r\n * which is optimized for handling multiple composition IDs efficiently.\r\n *\r\n * All retrieved connections are automatically added to the local ConnectionData store\r\n * for subsequent use throughout the application.\r\n *\r\n * @param composition_ids - Array of composition IDs to fetch connections for. Defaults to empty array.\r\n *\r\n * @returns A promise that resolves to an array of Connection objects retrieved from the server\r\n *\r\n * @example\r\n * ```typescript\r\n * // Fetch connections for multiple compositions from server\r\n * const connections = await GetAllConnectionsOfCompositionOnline([100, 200, 300]);\r\n *\r\n * // Process the bulk results\r\n * console.log(`Fetched ${connections.length} connections from server`);\r\n * ```\r\n *\r\n * @remarks\r\n * This is the underlying server communication function for bulk composition queries.\r\n * It uses JSON serialization for the request body to send the array of composition IDs,\r\n * and the server returns all connections for those compositions in a single response.\r\n *\r\n * The function handles both successful and error responses gracefully, logging appropriate\r\n * error messages with the prefix 'Get all connections of composition bulk error message'.\r\n *\r\n * Each retrieved connection is added to ConnectionData, making it available for local queries.\r\n *\r\n * @throws Will throw an error if the network request fails or if the server returns an error response\r\n *\r\n * @see GetAllConnectionsOfCompositionBulk for the recommended high-level function\r\n * @see ConnectionData.AddConnection for how connections are stored locally\r\n */\r\nexport async function GetAllConnectionsOfCompositionOnline(composition_ids: number[] = []){\r\n var connectionList: Connection[] = [];\r\n\r\n try{\r\n var header = await GetRequestHeader();\r\n const response = await fetch(BaseUrl.GetAllConnectionsOfCompositionBulkUrl(),{\r\n method: 'POST',\r\n headers: header,\r\n body: JSON.stringify(composition_ids)\r\n });\r\n if(response.ok){\r\n const result = await response.json();\r\n for(var i=0; i< result.length; i++){\r\n ConnectionData.AddConnection(result[i]);\r\n connectionList.push(result[i]);\r\n }\r\n }\r\n else{\r\n console.log('Get all connections of composition bulk error message: ', \"Cannot get response\");\r\n HandleHttpError(response);\r\n }\r\n return connectionList;\r\n }\r\n catch (error) {\r\n if (error instanceof Error) {\r\n console.log('Get all connections of composition bulk error message: ', error.message);\r\n } else {\r\n console.log('Get all connections of composition bulk unexpected error: ', error);\r\n }\r\n throw error;\r\n }\r\n}","/**\r\n * API module for retrieving all linker connections originating from a specific concept.\r\n * This module fetches outbound linker connections where the specified concept acts as the source,\r\n * enabling navigation and analysis of concept relationships in the forward direction.\r\n *\r\n * @module Api/GetAllLinkerConnectionsFromTheConcept\r\n * @see https://documentation.freeschema.com for more information on the Concept Connection System\r\n */\r\n\r\nimport { Connection } from \"../DataStructures/Connection\";\r\nimport { HandleHttpError } from \"../Services/Common/ErrorPosting\";\r\nimport { GetRequestHeader } from \"../Services/Security/GetRequestHeader\";\r\nimport { BaseUrl } from \"../app\";\r\n\r\n/**\r\n * Retrieves all linker connections that originate from a specific concept.\r\n * This function fetches connections where the specified concept is the source (from-concept),\r\n * allowing you to discover all concepts that this concept links to or relates with.\r\n *\r\n * Linker connections represent directed relationships in the concept graph, and this function\r\n * specifically returns outbound connections where the given concept acts as the origin point.\r\n * This is essential for graph traversal, relationship discovery, and understanding how a\r\n * concept connects to other parts of the knowledge graph.\r\n *\r\n * @param conceptId - The unique identifier of the concept whose outbound linker connections should be retrieved\r\n *\r\n * @returns A promise that resolves to an array of Connection objects originating from the specified concept\r\n *\r\n * @example\r\n * ```typescript\r\n * // Get all connections from concept 789\r\n * const outboundConnections = await GetAllLinkerConnectionsFromTheConcept(789);\r\n *\r\n * // Discover what this concept links to\r\n * outboundConnections.forEach(connection => {\r\n * console.log(`Concept 789 links to concept ${connection.toConceptId}`);\r\n * });\r\n *\r\n * // Use for graph navigation\r\n * async function traverseFromConcept(conceptId: number) {\r\n * const connections = await GetAllLinkerConnectionsFromTheConcept(conceptId);\r\n * return connections.map(conn => conn.toConceptId);\r\n * }\r\n * ```\r\n *\r\n * @remarks\r\n * This function uses a GET request with the concept ID as a query parameter.\r\n * Unlike some other API functions, it does not automatically add connections to ConnectionData,\r\n * allowing the caller to decide how to handle the returned connections.\r\n *\r\n * The function returns an empty array if the request fails or if no connections are found.\r\n * Errors are logged with the prefix 'Get all linker connection from the concepts error'.\r\n *\r\n * @throws Will throw an error if the network request fails or if the server returns an error response\r\n *\r\n * @see GetAllLinkerConnectionsToTheConcept for retrieving inbound connections to a concept\r\n * @see Connection for the connection data structure\r\n */\r\nexport async function GetAllLinkerConnectionsFromTheConcept(conceptId:number){\r\n var connections: Connection[] = [];\r\n\r\n try{\r\n const start = new Date().getTime();\r\n var header = await GetRequestHeader('application/x-www-form-urlencoded');\r\n const response = await fetch(BaseUrl.GetAllLinkerConnectionOfConceptUrl() + `?conceptId=${conceptId}`,{\r\n method: 'GET',\r\n headers: header,\r\n });\r\n if(response.ok){\r\n const result = await response.json();\r\n\r\n for(var i=0; i<result.length;i++){\r\n var connection = result[i] as Connection;\r\n connections.push(connection);\r\n }\r\n }\r\n else{\r\n console.log(\"Get all linker connection from the concepts error\", \"cannot get respone\" );\r\n HandleHttpError(response);\r\n\r\n }\r\n return connections;\r\n }\r\n catch (error) {\r\n if (error instanceof Error) {\r\n console.log('Get all linker connection from the concepts error: ', error.message);\r\n } else {\r\n console.log('Get all linker connection from the concepts error(Unexpected): ', error);\r\n }\r\n throw error;\r\n }\r\n}","/**\r\n * API module for retrieving all linker connections pointing to a specific concept.\r\n * This module fetches inbound linker connections where the specified concept acts as the target,\r\n * enabling discovery of what other concepts reference or link to the given concept.\r\n *\r\n * @module Api/GetAllLinkerConnectionsToTheConcept\r\n * @see https://documentation.freeschema.com for more information on the Concept Connection System\r\n */\r\n\r\nimport { Connection } from \"../DataStructures/Connection\";\r\nimport { HandleHttpError } from \"../Services/Common/ErrorPosting\";\r\nimport { GetRequestHeader } from \"../Services/Security/GetRequestHeader\";\r\nimport { BaseUrl } from \"../app\";\r\n\r\n/**\r\n * Retrieves all linker connections that point to a specific concept.\r\n * This function fetches connections where the specified concept is the target (to-concept),\r\n * allowing you to discover all concepts that link to or reference this concept.\r\n *\r\n * Linker connections represent directed relationships in the concept graph, and this function\r\n * specifically returns inbound connections where the given concept acts as the destination.\r\n * This is essential for reverse graph traversal, finding references, and understanding what\r\n * other concepts depend on or relate to the specified concept.\r\n *\r\n * @param conceptId - The unique identifier of the concept whose inbound linker connections should be retrieved\r\n *\r\n * @returns A promise that resolves to an array of Connection objects pointing to the specified concept\r\n *\r\n * @example\r\n * ```typescript\r\n * // Get all connections to concept 789\r\n * const inboundConnections = await GetAllLinkerConnectionsToTheConcept(789);\r\n *\r\n * // Discover what links to this concept\r\n * inboundConnections.forEach(connection => {\r\n * console.log(`Concept ${connection.fromConceptId} links to concept 789`);\r\n * });\r\n *\r\n * // Find all references to a concept\r\n * async function findReferences(conceptId: number) {\r\n * const connections = await GetAllLinkerConnectionsToTheConcept(conceptId);\r\n * return connections.map(conn => conn.fromConceptId);\r\n * }\r\n *\r\n * // Check if a concept is referenced\r\n * async function isConceptReferenced(conceptId: number): Promise<boolean> {\r\n * const connections = await GetAllLinkerConnectionsToTheConcept(conceptId);\r\n * return connections.length > 0;\r\n * }\r\n * ```\r\n *\r\n * @remarks\r\n * This function uses a GET request with the concept ID as a query parameter.\r\n * Unlike some other API functions, it does not automatically add connections to ConnectionData,\r\n * allowing the caller to decide how to handle the returned connections.\r\n *\r\n * The function returns an empty array if the request fails or if no connections are found.\r\n * Errors are logged with the prefix 'Get all linker connection To the concepts error'.\r\n *\r\n * This function is the complement to GetAllLinkerConnectionsFromTheConcept - together they\r\n * provide complete bidirectional navigation of the concept graph.\r\n *\r\n * @throws Will throw an error if the network request fails or if the server returns an error response\r\n *\r\n * @see GetAllLinkerConnectionsFromTheConcept for retrieving outbound connections from a concept\r\n * @see Connection for the connection data structure\r\n */\r\nexport async function GetAllLinkerConnectionsToTheConcept(conceptId:number){\r\n var connections: Connection[] = [];\r\n\r\n try{\r\n const start = new Date().getTime();\r\n var header = await GetRequestHeader('application/x-www-form-urlencoded');\r\n const response = await fetch(BaseUrl.GetAllLinkerConnectionToConceptUrl() + `?conceptId=${conceptId}`,{\r\n method: 'GET',\r\n headers: header,\r\n });\r\n if(response.ok){\r\n const result = await response.json();\r\n\r\n for(var i=0; i<result.length;i++){\r\n var connection = result[i] as Connection;\r\n connections.push(connection);\r\n }\r\n }\r\n else{\r\n console.log(\"Get all linker connection To the concepts error\", \"cannot get respone\" );\r\n HandleHttpError(response);\r\n\r\n }\r\n return connections;\r\n }\r\n catch (error) {\r\n if (error instanceof Error) {\r\n console.log('Get all linker connection To the concepts error: ', error.message);\r\n } else {\r\n console.log('Get all linker connection To the concepts error(Unexpected): ', error);\r\n }\r\n throw error;\r\n }\r\n}","/**\r\n * Module for retrieving individual concepts from the CCS system.\r\n * Provides caching and optimized retrieval of Concept objects by their unique identifiers.\r\n *\r\n * @module Api/GetConcept\r\n * @see https://documentation.freeschema.com for concept details\r\n */\r\n\r\nimport { Concept } from \"./../DataStructures/Concept\";\r\nimport { ConceptsData } from \"./../DataStructures/ConceptData\";\r\nimport { GetConceptUrl } from './../Constants/ApiConstants';\r\nimport { BaseUrl } from \"../DataStructures/BaseUrl\";\r\nimport { GetRequestHeader } from \"../Services/Security/GetRequestHeader\";\r\nimport { CreateDefaultConcept } from \"../app\";\r\nimport { HandleHttpError } from \"../Services/Common/ErrorPosting\";\r\n\r\n/**\r\n * Cache for in-flight concept requests to prevent duplicate API calls.\r\n * Maps concept IDs to their pending Promise to enable request deduplication.\r\n */\r\nconst conceptCache = new Map<number, Promise<Concept>>();\r\n\r\n/**\r\n * Retrieves a concept by its unique ID with built-in caching and request deduplication.\r\n * This is the primary function for fetching individual concepts in the CCS system.\r\n *\r\n * @param id - The unique numeric identifier of the concept to retrieve\r\n * @returns A promise that resolves to the Concept object, or a default concept if not found\r\n *\r\n * @example\r\n * ```typescript\r\n * // Fetch a concept by ID\r\n * const concept = await GetConcept(123);\r\n * if (concept.id !== 0) {\r\n * console.log(`Found concept: ${concept.characterValue}`);\r\n * }\r\n * ```\r\n *\r\n * @remarks\r\n * This function implements a sophisticated multi-layer retrieval strategy:\r\n *\r\n * 1. Request Deduplication: If a request for the same ID is already in-flight,\r\n * returns the existing promise instead of making a duplicate API call.\r\n *\r\n * 2. Local Cache Check: First checks ConceptsData for a cached concept or NPC marker.\r\n *\r\n * 3. API Fallback: If not found locally, fetches from the API endpoint.\r\n *\r\n * 4. NPC Tracking: If the API returns a concept with id = 0, marks it as an NPC\r\n * (Non-Persistent Concept) to avoid repeated failed lookups.\r\n *\r\n * 5. Cache Cleanup: The in-flight request cache is automatically cleaned up\r\n * after each request completes (success or failure).\r\n *\r\n * The function always returns a Concept object - either the found concept,\r\n * or a default concept with id = 0 if not found.\r\n *\r\n * @see Concept for the structure of concept objects\r\n * @see ConceptsData.GetConcept for local cache retrieval\r\n * @see CreateDefaultConcept for default concept creation\r\n * @see GetConceptBulk for retrieving multiple concepts efficiently\r\n */\r\nexport async function GetConcept(id: number){\r\n let result = CreateDefaultConcept();\r\n // check the cache\r\n if (conceptCache.has(id)) return conceptCache.get(id) || result;\r\n\r\n const getConceptById = (async () => {\r\n try{\r\n var conceptUse :Concept= await ConceptsData.GetConcept(id);\r\n let isNpc = ConceptsData.GetNpc(id);\r\n if(conceptUse.id != 0 || isNpc){\r\n \r\n return conceptUse;\r\n }\r\n else{\r\n var header = await GetRequestHeader('application/x-www-form-urlencoded');\r\n const response = await fetch(BaseUrl.GetConceptUrl(),{\r\n method: 'POST',\r\n headers:header,\r\n body: `id=${id}`\r\n });\r\n if(response.ok){\r\n result = await response.json() as Concept;\r\n if(result.id > 0){\r\n ConceptsData.AddConcept(result);\r\n }\r\n else{\r\n ConceptsData.AddNpc(id);\r\n }\r\n }\r\n else{\r\n console.log(\"Get the concept error\", response.status, id);\r\n HandleHttpError(response);\r\n }\r\n return result;\r\n \r\n }\r\n } catch (error) {\r\n if (error instanceof Error) {\r\n console.log('Get the concept error message: ', error.message, id);\r\n } else {\r\n console.log('Get the concept unexpected error: ', error, id);\r\n }\r\n throw error;\r\n } finally {\r\n conceptCache.delete(id); // Remove from cache after fetching\r\n }\r\n })()\r\n\r\n conceptCache.set(id, getConceptById);\r\n return getConceptById\r\n}","/**\r\n * Module for bulk retrieval of concepts from the CCS system.\r\n * Provides optimized batch fetching of multiple concepts in a single API request.\r\n *\r\n * @module Api/GetConceptBulk\r\n * @see https://documentation.freeschema.com for bulk operation details\r\n */\r\n\r\nimport { Concept } from \"./../DataStructures/Concept\";\r\nimport { ConceptsData } from \"./../DataStructures/ConceptData\";\r\nimport { GetConceptBulkUrl, GetConceptUrl } from './../Constants/ApiConstants';\r\nimport { BaseUrl } from \"../DataStructures/BaseUrl\";\r\nimport { GetRequestHeader } from \"../Services/Security/GetRequestHeader\";\r\nimport { HandleHttpError } from \"../Services/Common/ErrorPosting\";\r\n\r\n/**\r\n * Retrieves multiple concepts in a single optimized API request.\r\n * This function checks the local cache first and only fetches uncached concepts from the API.\r\n *\r\n * @param conceptIds - Array of concept IDs to retrieve\r\n * @returns A promise that resolves to an array of Concept objects\r\n *\r\n * @example\r\n * ```typescript\r\n * // Fetch multiple concepts at once\r\n * const concepts = await GetConceptBulk([1, 2, 3, 4, 5]);\r\n * concepts.forEach(concept => {\r\n * console.log(`Concept ${concept.id}: ${concept.characterValue}`);\r\n * });\r\n * ```\r\n *\r\n * @remarks\r\n * Performance optimization strategy:\r\n * 1. Checks ConceptsData cache for each requested concept ID\r\n * 2. Immediately returns cached concepts without API call\r\n * 3. Batches all uncached IDs into a single bulk API request\r\n * 4. Caches all newly fetched concepts for future use\r\n * 5. Returns empty array if all concepts are cached or if the API request fails\r\n *\r\n * This is significantly more efficient than calling GetConcept() multiple times\r\n * when you need to retrieve multiple concepts, as it reduces network overhead.\r\n *\r\n * @see Concept for the structure of concept objects\r\n * @see ConceptsData.AddConcept for caching mechanism\r\n * @see GetConcept for single concept retrieval\r\n * @see BulkConceptGetterApi for alternative bulk fetching without cache checking\r\n */\r\nexport async function GetConceptBulk(conceptIds: number[]) {\r\n let result:Concept[] = [];\r\n try{\r\n var bulkConceptFetch = [];\r\n for(let i=0; i<conceptIds.length; i++){\r\n let conceptUse :Concept= await ConceptsData.GetConcept(conceptIds[i]);\r\n if(conceptUse.id == 0){\r\n bulkConceptFetch.push(conceptIds[i]);\r\n } else {\r\n result.push(conceptUse)\r\n }\r\n }\r\n if(bulkConceptFetch.length == 0){\r\n \r\n return result;\r\n }\r\n else{\r\n var header = await GetRequestHeader();\r\n const response = await fetch(BaseUrl.GetConceptBulkUrl(),{\r\n method: 'POST',\r\n headers: header,\r\n body: JSON.stringify(bulkConceptFetch)\r\n });\r\n if(response.ok){\r\n let output = await response.json();\r\n if(output.length > 0){\r\n for(let i=0 ; i<output.length; i++){\r\n let concept = output[i] as Concept;\r\n result.push(concept);\r\n ConceptsData.AddConcept(concept);\r\n }\r\n \r\n }\r\n }\r\n else{\r\n console.log(\"Get Concept Bulk error\", response.status);\r\n HandleHttpError(response);\r\n }\r\n return result;\r\n\r\n }\r\n }\r\n catch (error) {\r\n if (error instanceof Error) {\r\n console.log('Get Concept Bulk error message: ', error.message);\r\n } else {\r\n console.log('Get Concept Bulk unexpected error: ', error);\r\n }\r\n throw error;\r\n }\r\n}\r\n\r\n/**\r\n * Alternative bulk concept fetcher that directly queries the API without pre-checking the cache.\r\n * This function is useful when you want to force-fetch concepts from the API regardless of cache state.\r\n *\r\n * @param bulkConceptFetch - Array of concept IDs to fetch from the API\r\n * @returns A promise that resolves to an array of Concept objects\r\n *\r\n * @example\r\n * ```typescript\r\n * // Force fetch concepts from API bypassing cache check\r\n * const freshConcepts = await BulkConceptGetterApi([10, 20, 30]);\r\n * console.log(`Fetched ${freshConcepts.length} concepts`);\r\n * ```\r\n *\r\n * @remarks\r\n * Differences from GetConceptBulk:\r\n * - Does NOT check ConceptsData cache before making the API request\r\n * - Always makes an API call if IDs are provided (except when array is empty)\r\n * - Still caches the fetched concepts in ConceptsData after retrieval\r\n * - Uses JSON content type for the request\r\n *\r\n * Use this function when:\r\n * - You need the latest data from the server\r\n * - You want to refresh cached concepts\r\n * - Cache invalidation is needed for specific concepts\r\n *\r\n * @see GetConceptBulk for cache-aware bulk retrieval\r\n * @see ConceptsData.AddConcept for caching mechanism\r\n */\r\nexport async function BulkConceptGetterApi(bulkConceptFetch: number[]) {\r\n const conceptList: Concept[] = []\r\n if (bulkConceptFetch.length > 0) {\r\n const myHeaders = await GetRequestHeader()\r\n try {\r\n const response = await fetch(BaseUrl.GetConceptBulkUrl(), {\r\n method: 'POST',\r\n headers: myHeaders,\r\n body: JSON.stringify(bulkConceptFetch),\r\n })\r\n if (response.ok) {\r\n const result = await response.json()\r\n if (result.length > 0) {\r\n for (let i = 0; i < result.length; i++) {\r\n const concept = result[i] as Concept\r\n conceptList.push(concept)\r\n ConceptsData.AddConcept(concept)\r\n }\r\n }\r\n }\r\n else{\r\n HandleHttpError(response);\r\n }\r\n } catch (error) {\r\n if (error instanceof Error) {\r\n console.log('bulk concept getter api error: ', error.message)\r\n } else {\r\n console.log('bulk concept getter api error: ', error)\r\n }\r\n throw error;\r\n }\r\n }\r\n \r\n return conceptList\r\n }\r\n ","/**\r\n * Module for retrieving concepts by their character value and type combination.\r\n * Provides specialized lookup for concepts using both character identifier and type classification.\r\n *\r\n * @module Api/GetConceptByCharacterAndType\r\n * @see https://documentation.freeschema.com for character and type system details\r\n */\r\n\r\nimport { ConceptsData } from \"./../DataStructures/ConceptData\";\r\nimport { GetConceptByCharacterAndTypeUrl } from './../Constants/ApiConstants';\r\nimport { Concept } from \"./../DataStructures/Concept\";\r\nimport { BaseUrl } from \"../DataStructures/BaseUrl\";\r\nimport { GetRequestHeader } from \"../Services/Security/GetRequestHeader\";\r\nimport { HandleHttpError } from \"../Services/Common/ErrorPosting\";\r\nimport { GetConceptBulk } from \"./GetConceptBulk\";\r\n\r\n/**\r\n * Cache for in-flight concept requests keyed by character+type combination.\r\n * Prevents duplicate API calls for the same character-type pair.\r\n */\r\nconst conceptCache = new Map<string, Promise<Concept>>();\r\n\r\n/**\r\n * Retrieves a concept by its character value and type ID combination.\r\n * This provides a more specific lookup than character value alone, useful when the same\r\n * character can represent different concepts of different types.\r\n *\r\n * @param characterValue - The character string identifier of the concept\r\n * @param typeId - The type ID that classifies the concept\r\n * @returns A promise that resolves to the Concept object matching both criteria\r\n *\r\n * @example\r\n * ```typescript\r\n * // Get a specific concept by character and type\r\n * const concept = await GetConceptByCharacterAndType(\"user\", 5);\r\n * if (concept && concept.id !== 0) {\r\n * console.log(`Found concept: ${concept.id}`);\r\n * }\r\n * ```\r\n *\r\n * @remarks\r\n * This function implements a multi-layer lookup strategy:\r\n *\r\n * 1. Request Deduplication: Caches in-flight requests using a composite key\r\n * (characterValue + typeId) to prevent duplicate API calls.\r\n *\r\n * 2. Local Cache Check: First attempts to retrieve from ConceptsData using\r\n * GetConceptByCharacterAndTypeLocal() method.\r\n *\r\n * 3. API Fallback: If not found locally, makes an API request with both\r\n * character_value and type_id as JSON parameters.\r\n *\r\n * 4. Automatic Caching: Successfully retrieved concepts are cached in\r\n * ConceptsData for future lookups.\r\n *\r\n * This is particularly useful in systems where the same character string\r\n * can represent different semantic concepts based on context or type.\r\n *\r\n * @see Concept for the structure of concept objects\r\n * @see ConceptsData.GetConceptByCharacterAndTypeLocal for local cache lookup\r\n * @see GetConceptByCharacterValue for type-agnostic character lookup\r\n * @see GetConceptByTypeBulk for bulk retrieval by type\r\n */\r\nexport async function GetConceptByCharacterAndType(characterValue: string, typeId: number): Promise<Concept>{\r\n let concept:Concept = await ConceptsData.GetConceptByCharacterAndTypeLocal(characterValue,typeId);\r\n let key = characterValue + typeId;\r\n if (conceptCache.has(key)) return conceptCache.get(key) || concept;\r\n\r\n const GetConceptByCharacterAndType = (async () => {\r\n try{\r\n if(concept == null || concept.id == 0){\r\n var json = {\r\n 'character_value': `${characterValue}`,\r\n 'type_id': typeId \r\n };\r\n var toSendJson = JSON.stringify(json);\r\n var header = await GetRequestHeader();\r\n const response = await fetch(BaseUrl.GetConceptByCharacterAndTypeUrl(),{\r\n method: 'POST',\r\n headers: header,\r\n body: toSendJson,\r\n });\r\n if(response.ok){\r\n let conceptString = await response.json() ;\r\n concept = conceptString as Concept;\r\n ConceptsData.AddConcept(concept);\r\n }\r\n else{\r\n // throw new Error(`Error! status: ${response.status}`);\r\n console.log(\"This is the concept by type and character error\", response.status);\r\n HandleHttpError(response);\r\n }\r\n\r\n }\r\n return concept;\r\n\r\n }\r\n catch (error) {\r\n if (error instanceof Error) {\r\n console.log(' This is the concept by type and character error message: ', error.message);\r\n } else {\r\n console.log(' This is the concept by type and character unexpected error: ', error);\r\n }\r\n throw error;\r\n }\r\n finally {\r\n conceptCache.delete(key); // Remove from cache after fetching\r\n }\r\n })()\r\n conceptCache.set(key, GetConceptByCharacterAndType);\r\n return GetConceptByCharacterAndType;\r\n}\r\n\r\n\r\n/**\r\n * Retrieves multiple concepts matching any of the specified connection types in bulk.\r\n * This function first fetches concept IDs by type, then retrieves the full concept data.\r\n *\r\n * @param connectionTypes - Array of connection type strings to match\r\n * @returns A promise that resolves to an array of Concept objects matching the specified types\r\n *\r\n * @example\r\n * ```typescript\r\n * // Get all concepts associated with specific connection types\r\n * const concepts = await GetConceptByTypeBulk([\"friendship\", \"colleague\", \"family\"]);\r\n * console.log(`Found ${concepts.length} concepts`);\r\n * ```\r\n *\r\n * @remarks\r\n * This function performs a two-stage retrieval:\r\n * 1. First API call: Sends connection types to get matching concept IDs\r\n * 2. Second stage: Uses GetConceptBulk to efficiently fetch all concept data\r\n *\r\n * The connection types are sent as a JSON array to the API endpoint.\r\n * This is useful for finding all concepts that participate in connections\r\n * of specific types, enabling type-based concept discovery and filtering.\r\n *\r\n * @see GetConceptBulk for the bulk concept retrieval mechanism\r\n * @see GetConceptByCharacterAndType for single concept lookup by character and type\r\n * @see BaseUrl.GetConceptConnectionByType for the API endpoint\r\n */\r\nexport async function GetConceptByTypeBulk(connectionTypes:string[]): Promise<Concept[]>{\r\n let conceptList:Concept[] = [];\r\n let types = JSON.stringify(connectionTypes);\r\n var header = await GetRequestHeader();\r\n const response = await fetch(BaseUrl.GetConceptConnectionByType(),{\r\n method: 'POST',\r\n headers: header,\r\n body: types,\r\n });\r\n if(response.ok){\r\n let conceptIdsList = await response.json() ;\r\n conceptList = await GetConceptBulk(conceptIdsList);\r\n }\r\n else{\r\n // throw new Error(`Error! status: ${response.status}`);\r\n console.log(\"This is the concept by type and character error\", response.status);\r\n HandleHttpError(response);\r\n }\r\n return conceptList;\r\n}\r\n","/**\r\n * Module for retrieving concepts by their character value string.\r\n * Provides lookup functionality for concepts using their character identifier without type restrictions.\r\n *\r\n * @module Api/GetConceptByCharacterValue\r\n * @see https://documentation.freeschema.com for character value system details\r\n */\r\n\r\nimport { ConceptsData } from \"./../DataStructures/ConceptData\";\r\nimport { GetConceptByCharacterValueUrl } from './../Constants/ApiConstants';\r\nimport { Concept } from \"../DataStructures/Concept\";\r\nimport { BaseUrl } from \"../DataStructures/BaseUrl\";\r\nimport { GetRequestHeader } from \"../Services/Security/GetRequestHeader\";\r\nimport { CreateDefaultConcept } from \"../app\";\r\nimport { HandleHttpError } from \"../Services/Common/ErrorPosting\";\r\n\r\n/**\r\n * Retrieves a concept by its character value string identifier.\r\n * This function performs a type-agnostic lookup, returning the first concept matching the character value.\r\n *\r\n * @param characterValue - The character string identifier of the concept to retrieve\r\n * @returns A promise that resolves to the Concept object, or a default concept if not found\r\n *\r\n * @example\r\n * ```typescript\r\n * // Fetch a concept by its character value\r\n * const concept = await GetConceptByCharacterValue(\"username\");\r\n * if (concept.id > 0) {\r\n * console.log(`Found concept with ID: ${concept.id}`);\r\n * } else {\r\n * console.log(\"Concept not found\");\r\n * }\r\n * ```\r\n *\r\n * @remarks\r\n * This function provides a simplified lookup mechanism:\r\n *\r\n * 1. Makes a direct API call with the character_value parameter\r\n * 2. Does not check local cache before making the request\r\n * 3. Automatically caches successful results in ConceptsData\r\n * 4. Returns a default concept (id = 0) if not found or on error\r\n *\r\n * Key characteristics:\r\n * - Uses form-urlencoded content type for the POST request\r\n * - Only caches concepts with id > 0 (valid concepts)\r\n * - Does not throw errors on HTTP failure, only logs them\r\n * - Simpler than GetConceptByCharacterAndType as it doesn't consider type\r\n *\r\n * Use this when you know the character value uniquely identifies a concept,\r\n * or when type information is not available or relevant.\r\n *\r\n * @see Concept for the structure of concept objects\r\n * @see CreateDefaultConcept for default concept structure\r\n * @see GetConceptByCharacterAndType for character+type lookup\r\n * @see ConceptsData.AddConcept for caching mechanism\r\n */\r\nexport async function GetConceptByCharacterValue(characterValue: string){\r\n let result = CreateDefaultConcept();\r\n try{\r\n var header = await GetRequestHeader('application/x-www-form-urlencoded');\r\n\r\n const response = await fetch(BaseUrl.GetConceptByCharacterValueUrl(),{\r\n method: 'POST',\r\n headers: header,\r\n body: `character_value=${characterValue}`\r\n });\r\n if(response.ok){\r\n result = await response.json() as Concept;\r\n if(result.id > 0){\r\n ConceptsData.AddConcept(result);\r\n }\r\n }\r\n else{\r\n console.log(\"Error in Getting concept by character value Error\", response.status);\r\n HandleHttpError(response);\r\n }\r\n return result;\r\n\r\n\r\n }\r\n catch (error) {\r\n if (error instanceof Error) {\r\n console.log('Error in Getting concept by character value error message: ', error);\r\n } else {\r\n console.log('Error in Getting concept by character value unexpected error: ', error);\r\n }\r\n throw error;\r\n }\r\n}","/**\r\n * Module for retrieving individual connections from the CCS system.\r\n * Provides caching and optimized retrieval of Connection objects by their unique identifiers.\r\n *\r\n * @module Api/GetConnection\r\n * @see https://documentation.freeschema.com for connection details\r\n */\r\n\r\nimport { ConceptsData } from \"./../DataStructures/ConceptData\";\r\nimport { BaseUrl } from \"../DataStructures/BaseUrl\";\r\nimport { ConnectionData } from \"../DataStructures/ConnectionData\";\r\nimport { Connection } from \"../DataStructures/Connection\";\r\nimport { GetRequestHeader } from \"../Services/Security/GetRequestHeader\";\r\nimport { HandleHttpError } from \"../Services/Common/ErrorPosting\";\r\n\r\n/**\r\n * Retrieves a connection by its unique ID with automatic caching.\r\n * Connections represent relationships between concepts in the CCS system.\r\n *\r\n * @param id - The unique numeric identifier of the connection to retrieve\r\n * @returns A promise that resolves to the Connection object\r\n *\r\n * @example\r\n * ```typescript\r\n * // Fetch a connection by ID\r\n * const connection = await GetConnection(456);\r\n * if (connection.id !== 0) {\r\n * console.log(`Connection from ${connection.ofTheConceptId} to ${connection.toTheConceptId}`);\r\n * }\r\n * ```\r\n *\r\n * @remarks\r\n * This function implements a two-tier retrieval strategy:\r\n *\r\n * 1. Local Cache Check: First attempts to retrieve the connection from\r\n * ConnectionData cache using GetConnection().\r\n *\r\n * 2. API Fallback: If not found in cache (id = 0), makes an API request\r\n * to fetch the connection from the server.\r\n *\r\n * 3. Automatic Caching: Successfully retrieved connections are cached in\r\n * ConnectionData for future lookups.\r\n *\r\n * Key characteristics:\r\n * - Uses form-urlencoded content type for POST request\r\n * - Always returns a Connection object (default has id = 0 if not found)\r\n * - Errors are logged but propagated to caller\r\n * - Does not implement request deduplication (unlike GetConcept)\r\n *\r\n * Connections are fundamental to the CCS system, linking concepts together\r\n * and forming the relationship graph that defines knowledge structure.\r\n *\r\n * @see Connection for the structure of connection objects\r\n * @see ConnectionData.GetConnection for cache retrieval\r\n * @see ConnectionData.AddConnection for caching mechanism\r\n * @see GetConnectionBulk for retrieving multiple connections efficiently\r\n */\r\nexport async function GetConnection(id: number){\r\n var result :Connection= await ConnectionData.GetConnection(id);\r\n\r\n try{\r\n if(result.id != 0){\r\n\r\n return result;\r\n }\r\n else{\r\n var header = await GetRequestHeader('application/x-www-form-urlencoded')\r\n const response = await fetch(BaseUrl.GetConnectionUrl(),{\r\n method: 'POST',\r\n headers: header,\r\n body: `id=${id}`\r\n });\r\n if(response.ok){\r\n result = await response.json() as Connection;\r\n ConnectionData.AddConnection(result);\r\n }\r\n else{\r\n console.log(\"Get Connection Error\", response.status);\r\n HandleHttpError(response);\r\n }\r\n return result;\r\n \r\n\r\n }\r\n }\r\n catch (error) {\r\n if (error instanceof Error) {\r\n console.log('Get Connection error message: ', error.message);\r\n } else {\r\n console.log('Get Connection unexpected error: ', error);\r\n }\r\n throw error;\r\n }\r\n}","/**\r\n * Module for bulk retrieval of connections from the CCS system.\r\n * Provides optimized batch fetching of multiple connections in a single API request.\r\n *\r\n * @module Api/GetConnectionBulk\r\n * @see https://documentation.freeschema.com for bulk connection operations\r\n */\r\n\r\nimport { Concept } from \"./../DataStructures/Concept\";\r\nimport { ConnectionData } from \"./../DataStructures/ConnectionData\";\r\nimport { GetConceptBulkUrl, GetConceptUrl } from './../Constants/ApiConstants';\r\nimport { BaseUrl } from \"../DataStructures/BaseUrl\";\r\nimport { Connection } from \"../DataStructures/Connection\";\r\nimport { FindConceptsFromConnections } from \"../Services/FindConeceptsFromConnection\";\r\nimport { GetRequestHeader } from \"../Services/Security/GetRequestHeader\";\r\nimport { HandleHttpError } from \"../Services/Common/ErrorPosting\";\r\n\r\n/**\r\n * Retrieves multiple connections in a single optimized API request.\r\n * This function checks the local cache first and only fetches uncached connections from the API.\r\n *\r\n * @param connectionIds - Array of connection IDs to retrieve (defaults to empty array)\r\n * @returns A promise that resolves to an array of Connection objects\r\n *\r\n * @example\r\n * ```typescript\r\n * // Fetch multiple connections at once\r\n * const connections = await GetConnectionBulk([101, 102, 103, 104]);\r\n * connections.forEach(conn => {\r\n * console.log(`Connection ${conn.id}: ${conn.ofTheConceptId} -> ${conn.toTheConceptId}`);\r\n * });\r\n * ```\r\n *\r\n * @remarks\r\n * Performance optimization strategy:\r\n * 1. Checks ConnectionData cache for each requested connection ID\r\n * 2. Immediately includes cached connections in results\r\n * 3. Batches all uncached IDs into a single bulk API request\r\n * 4. Caches all newly fetched connections for future use\r\n * 5. Automatically fetches related concepts via FindConceptsFromConnections\r\n * 6. Returns empty array if all connections are cached or if none requested\r\n *\r\n * This function provides significant performance benefits:\r\n * - Reduces network overhead by batching API requests\r\n * - Avoids redundant fetches through cache checking\r\n * - Proactively loads related concepts to prevent N+1 query problems\r\n *\r\n * The automatic concept fetching ensures that when you have connections,\r\n * you also have the concepts they connect, enabling immediate relationship\r\n * traversal without additional API calls.\r\n *\r\n * @see Connection for the structure of connection objects\r\n * @see ConnectionData.AddConnection for caching mechanism\r\n * @see GetConnection for single connection retrieval\r\n * @see FindConceptsFromConnections for automatic concept loading\r\n */\r\nexport async function GetConnectionBulk(connectionIds: number[] = []){\r\n var connectionList:Connection[] = [];\r\n\r\n try{\r\n var bulkConnectionFetch = [];\r\n for(let i=0; i<connectionIds.length; i++){\r\n let conceptUse :Connection= await ConnectionData.GetConnection(connectionIds[i]);\r\n if(conceptUse.id == 0){\r\n bulkConnectionFetch.push(connectionIds[i]);\r\n }\r\n else{\r\n connectionList.push(conceptUse);\r\n }\r\n }\r\n if(bulkConnectionFetch.length == 0){\r\n\r\n return connectionList;\r\n }\r\n else{\r\n var header = await GetRequestHeader();\r\n const response = await fetch(BaseUrl.GetConnectionBulkUrl(),{\r\n method: 'POST',\r\n headers: header,\r\n body: JSON.stringify(bulkConnectionFetch)\r\n });\r\n if(response.ok){\r\n const result = await response.json();\r\n if(result.length > 0){\r\n for(let i=0 ; i<result.length; i++){\r\n let connection = result[i] as Connection;\r\n connectionList.push(connection);\r\n ConnectionData.AddConnection(connection);\r\n }\r\n await FindConceptsFromConnections(connectionList);\r\n }\r\n }\r\n else{\r\n console.log(\"Get Connection Bulk error\", response.status);\r\n HandleHttpError(response);\r\n }\r\n\r\n\r\n\r\n return connectionList;\r\n\r\n }\r\n }\r\n catch (error) {\r\n if (error instanceof Error) {\r\n console.log('Get Connection Bulk error message: ', error.message);\r\n } else {\r\n console.log('Get Connection Bulk unexpected error: ', error);\r\n }\r\n throw error;\r\n }\r\n}","/**\r\n * Module for retrieving outgoing connections from a specific concept.\r\n * Provides paginated access to connections where a concept is the source (ofTheConcept).\r\n *\r\n * @module Api/GetConnectionOfTheConcept\r\n * @see https://documentation.freeschema.com for connection direction details\r\n */\r\n\r\nimport { ConceptsData } from \"./../DataStructures/ConceptData\";\r\nimport { GetAllConnectionsOfConceptUrl } from './../Constants/ApiConstants';\r\nimport { Concept } from \"../DataStructures/Concept\";\r\nimport { TheCharacter } from \"../DataStructures/TheCharacter\";\r\nimport { Connection } from \"../DataStructures/Connection\";\r\nimport { BaseUrl } from \"../DataStructures/BaseUrl\";\r\nimport { GetRequestHeader } from \"../Services/Security/GetRequestHeader\";\r\nimport { HandleHttpError } from \"../Services/Common/ErrorPosting\";\r\n\r\n/**\r\n * Retrieves all connections originating from a specific concept with pagination support.\r\n * Returns connections where the specified concept is the source (ofTheConcept).\r\n *\r\n * @param typeId - The type ID to filter connections by connection type\r\n * @param ofTheConceptId - The ID of the source concept whose outgoing connections to retrieve\r\n * @param userId - The user ID for access control and filtering\r\n * @param inpage - Number of connections per page (default: 10)\r\n * @param page - Page number for pagination, 1-indexed (default: 1)\r\n * @returns A promise that resolves to an array of Connection objects\r\n *\r\n * @example\r\n * ```typescript\r\n * // Get first 10 connections of type 5 from concept 100 for user 1\r\n * const connections = await GetConnectionOfTheConcept(5, 100, 1);\r\n * console.log(`Found ${connections.length} outgoing connections`);\r\n *\r\n * // Get second page with 20 connections per page\r\n * const moreConnections = await GetConnectionOfTheConcept(5, 100, 1, 20, 2);\r\n * ```\r\n *\r\n * @remarks\r\n * Connection Direction:\r\n * This function retrieves \"outgoing\" or \"from\" connections where the specified\r\n * concept is the source. In the CCS graph model, these represent relationships\r\n * initiated by or originating from the concept.\r\n *\r\n * Pagination:\r\n * - Uses 1-based page numbering (page 1 is the first page)\r\n * - Results are limited by the inpage parameter\r\n * - Useful for large result sets to avoid loading all connections at once\r\n *\r\n * Filtering:\r\n * - typeId filters connections by their type/relationship kind\r\n * - userId enables user-specific visibility and access control\r\n *\r\n * The function does NOT automatically cache results in ConnectionData,\r\n * unlike GetConnection or GetConnectionBulk. It returns the raw API response.\r\n *\r\n * @see Connection for the structure of connection objects\r\n * @see GetConnectionToTheConcept for retrieving incoming connections\r\n * @see GetConnectionBulk for bulk connection retrieval with caching\r\n */\r\nexport async function GetConnectionOfTheConcept(typeId: number, ofTheConceptId:number, userId:number, inpage:number=10, page:number=1 ){\r\n let connectionList:Connection[] = []; \r\n try{\r\n var urlencoded = new URLSearchParams();\r\n urlencoded.append(\"typeId\", `${typeId}`);\r\n urlencoded.append(\"ofTheConceptId\", `${ofTheConceptId}`);\r\n urlencoded.append(\"userId\", `${userId}`);\r\n urlencoded.append(\"inpage\", `${inpage}`);\r\n urlencoded.append(\"page\", `${page}`);\r\n var header = await GetRequestHeader('application/x-www-form-urlencoded');\r\n const response = await fetch(BaseUrl.GetAllConnectionsOfConceptUrl(),{\r\n method: 'POST',\r\n headers: header,\r\n body: urlencoded\r\n });\r\n if(response.ok){\r\n connectionList = await response.json() as Connection[];\r\n }\r\n else{\r\n console.log(\"Get connection of concept error\", response.status);\r\n HandleHttpError(response);\r\n }\r\n return connectionList;\r\n }\r\n catch (error) {\r\n if (error instanceof Error) {\r\n console.log('Get connection of concept error message: ', error.message);\r\n } else {\r\n console.log('Get connection of concept unexpected error: ', error);\r\n }\r\n throw error;\r\n }\r\n}","/**\r\n * Module for retrieving incoming connections to a specific concept.\r\n * Provides paginated access to connections where a concept is the target (toTheConcept).\r\n *\r\n * @module Api/GetConnectionToTheConcept\r\n * @see https://documentation.freeschema.com for connection direction details\r\n */\r\n\r\nimport { Connection } from \"../DataStructures/Connection\";\r\nimport { BaseUrl } from \"../DataStructures/BaseUrl\";\r\nimport { GetRequestHeader } from \"../Services/Security/GetRequestHeader\";\r\nimport { HandleHttpError } from \"../Services/Common/ErrorPosting\";\r\n\r\n/**\r\n * Retrieves all connections pointing to a specific concept with pagination support.\r\n * Returns connections where the specified concept is the target (toTheConcept).\r\n *\r\n * @param typeId - The type ID to filter connections by connection type\r\n * @param toTheConceptId - The ID of the target concept whose incoming connections to retrieve\r\n * @param userId - The user ID for access control and filtering\r\n * @param inpage - Number of connections per page (default: 10)\r\n * @param page - Page number for pagination, 1-indexed (default: 1)\r\n * @returns A promise that resolves to an array of Connection objects\r\n *\r\n * @example\r\n * ```typescript\r\n * // Get first 10 connections of type 3 pointing to concept 200 for user 1\r\n * const connections = await GetConnectionToTheConcept(3, 200, 1);\r\n * console.log(`Found ${connections.length} incoming connections`);\r\n *\r\n * // Get second page with 20 connections per page\r\n * const moreConnections = await GetConnectionToTheConcept(3, 200, 1, 20, 2);\r\n * ```\r\n *\r\n * @remarks\r\n * Connection Direction:\r\n * This function retrieves \"incoming\" or \"to\" connections where the specified\r\n * concept is the target. In the CCS graph model, these represent relationships\r\n * directed toward or pointing to the concept.\r\n *\r\n * Use Cases:\r\n * - Finding all concepts that reference a specific concept\r\n * - Discovering backlinks or reverse relationships\r\n * - Building bidirectional relationship navigation\r\n * - Analyzing concept dependencies\r\n *\r\n * Pagination:\r\n * - Uses 1-based page numbering (page 1 is the first page)\r\n * - Results are limited by the inpage parameter\r\n * - Useful for large result sets to avoid loading all connections at once\r\n *\r\n * Filtering:\r\n * - typeId filters connections by their type/relationship kind\r\n * - userId enables user-specific visibility and access control\r\n *\r\n * The function does NOT automatically cache results in ConnectionData,\r\n * unlike GetConnection or GetConnectionBulk. It returns the raw API response.\r\n *\r\n * @see Connection for the structure of connection objects\r\n * @see GetConnectionOfTheConcept for retrieving outgoing connections\r\n * @see GetConnectionBulk for bulk connection retrieval with caching\r\n */\r\nexport async function GetConnectionToTheConcept(typeId: number, toTheConceptId:number, userId:number, inpage:number=10, page:number=1 ){\r\n let connectionList:Connection[] = []; \r\n try{\r\n var urlencoded = new URLSearchParams();\r\n urlencoded.append(\"typeId\", `${typeId}`);\r\n urlencoded.append(\"toTheConceptId\", `${toTheConceptId}`);\r\n urlencoded.append(\"userId\", `${userId}`);\r\n urlencoded.append(\"inpage\", `${inpage}`);\r\n urlencoded.append(\"page\", `${page}`);\r\n var header = await GetRequestHeader('application/x-www-form-urlencoded');\r\n const response = await fetch(BaseUrl.GetAllConnectionsToConceptUrl(),{\r\n method: 'POST',\r\n headers: header,\r\n body: urlencoded\r\n });\r\n if(response.ok){\r\n connectionList = await response.json() as Connection[];\r\n }\r\n else{\r\n console.log(\"Get connection of concept error\", response.status);\r\n HandleHttpError(response);\r\n }\r\n return connectionList;\r\n }\r\n catch (error) {\r\n if (error instanceof Error) {\r\n console.log('Get connection of concept error message: ', error.message);\r\n } else {\r\n console.log('Get connection of concept unexpected error: ', error);\r\n }\r\n throw error;\r\n }\r\n}","/**\r\n * API module for fetching reserved connection IDs from the backend.\r\n * Manages a pool of pre-allocated connection IDs to optimize performance when creating connections.\r\n *\r\n * @module Api/GetReservedConnectionIds\r\n * @see https://documentation.freeschema.com for reference\r\n */\r\n\r\nimport { ReservedConnectionIds } from \"../DataStructures/ReservedIds\";\r\nimport { BaseUrl } from \"../DataStructures/BaseUrl\";\r\nimport { GetRequestHeader } from \"../Services/Security/GetRequestHeader\";\r\nimport { HandleHttpError } from \"../Services/Common/ErrorPosting\";\r\n\r\nlet isFetching = false;\r\nlet fetchQueue: any[] = [];\r\n\r\n/**\r\n * Helper method to process the next queued request.\r\n * Ensures sequential processing of fetch requests to prevent race conditions.\r\n *\r\n * @internal\r\n */\r\nconst processNextQueue = () => {\r\n if (fetchQueue.length > 0 && !isFetching) {\r\n const nextRequest = fetchQueue.shift();\r\n nextRequest();\r\n }\r\n};\r\n\r\n/**\r\n * Fetches reserved connection IDs from the backend and stores them in the local pool.\r\n * Uses a queue-based system to prevent simultaneous requests and maintains a minimum\r\n * threshold of available IDs.\r\n *\r\n * This function is critical for maintaining a pool of pre-allocated connection IDs,\r\n * which improves performance by avoiding the need to request IDs individually when\r\n * creating new connections in the Concept Connection System.\r\n *\r\n * @returns A promise that resolves when the IDs are successfully fetched and stored\r\n *\r\n * @example\r\n * ```typescript\r\n * // Ensure reserved connection IDs are available\r\n * await GetReservedConnectionIds();\r\n *\r\n * // Now IDs can be consumed from ReservedConnectionIds.connectionIds\r\n * const id = ReservedConnectionIds.GetId();\r\n * ```\r\n *\r\n * @remarks\r\n * - Skips fetching if more than 10 IDs are already available\r\n * - Uses a queue system to serialize requests and prevent concurrent fetches\r\n * - Automatically refills the pool when it runs low\r\n * - Errors are logged but the promise is rejected to allow proper error handling\r\n *\r\n * @see ReservedConnectionIds for the storage data structure\r\n * @see GetReservedIds for fetching regular concept IDs\r\n */\r\nexport async function GetReservedConnectionIds() {\r\n return new Promise<void>((resolve, reject) => {\r\n // Add request to queue\r\n fetchQueue.push(async () => {\r\n try {\r\n // prevent simultanious request\r\n if (isFetching) return;\r\n isFetching = true;\r\n\r\n // Skip fetching if enough IDs exist\r\n if (ReservedConnectionIds.connectionIds.length > 10) {\r\n isFetching = false; // flag is reset\r\n processNextQueue();\r\n return resolve(); // Resolve & exit\r\n }\r\n\r\n var header = await GetRequestHeader(\"application/x-www-form-urlencoded\");\r\n const response = await fetch(BaseUrl.GetReservedConnectionIdUrl(), {\r\n method: \"GET\",\r\n headers: header,\r\n });\r\n if (!response.ok) {\r\n HandleHttpError(response);\r\n throw new Error(`Error! status: ${response.status}`);\r\n }\r\n const result = await response.json();\r\n for (var i = 0; i < result.length; i++) {\r\n ReservedConnectionIds.AddId(result[i]);\r\n }\r\n\r\n resolve(); // Resolve when done\r\n } catch (error) {\r\n if (error instanceof Error) {\r\n console.log(\"get reserved connection ids error message: \", error.message);\r\n } else console.log(\"get reserved connection ids unexpected error: \", error);\r\n reject(error);\r\n // throw error;\r\n } finally {\r\n // Mark as fetched and process next request\r\n isFetching = false;\r\n processNextQueue();\r\n }\r\n });\r\n\r\n // process the next request in the queue\r\n processNextQueue();\r\n });\r\n}\r\n","/**\r\n * API module for fetching reserved concept IDs from the backend.\r\n * Manages a pool of pre-allocated concept IDs to optimize performance when creating new concepts.\r\n *\r\n * @module Api/GetReservedIds\r\n * @see https://documentation.freeschema.com for reference\r\n */\r\n\r\nimport { ReservedIds } from \"../DataStructures/ReservedIds\";\r\nimport { BaseUrl } from \"../DataStructures/BaseUrl\";\r\nimport { GetRequestHeader } from \"../Services/Security/GetRequestHeader\";\r\nimport { HandleHttpError } from \"../Services/Common/ErrorPosting\";\r\n\r\nlet isFetching = false\r\nlet fetchQueue: any[] = []\r\n\r\n/**\r\n * Helper method to process the next queued request.\r\n * Ensures sequential processing of fetch requests to prevent race conditions.\r\n *\r\n * @internal\r\n */\r\nconst processNextQueue = () => {\r\n if (fetchQueue.length > 0 && !isFetching) {\r\n const nextRequest = fetchQueue.shift()\r\n nextRequest()\r\n }\r\n}\r\n\r\n/**\r\n * Fetches reserved concept IDs from the backend and stores them in the local pool.\r\n * Uses a queue-based system to prevent simultaneous requests and maintains a minimum\r\n * threshold of available IDs.\r\n *\r\n * This function is essential for maintaining a pool of pre-allocated concept IDs,\r\n * which significantly improves performance by avoiding the need to request IDs\r\n * individually when creating new concepts in the Concept Connection System.\r\n *\r\n * @returns A promise that resolves when the IDs are successfully fetched and stored\r\n *\r\n * @example\r\n * ```typescript\r\n * // Ensure reserved concept IDs are available\r\n * await GetReservedIds();\r\n *\r\n * // Now IDs can be consumed from ReservedIds.ids\r\n * const id = ReservedIds.GetId();\r\n * ```\r\n *\r\n * @remarks\r\n * - Skips fetching if more than 10 IDs are already available\r\n * - Uses a queue system to serialize requests and prevent concurrent fetches\r\n * - Automatically refills the pool when it runs low during concept creation\r\n * - Errors are logged with the endpoint URL for debugging purposes\r\n * - The promise is rejected on error to allow proper error handling\r\n *\r\n * @see ReservedIds for the storage data structure\r\n * @see GetReservedConnectionIds for fetching connection IDs\r\n */\r\nexport async function GetReservedIds(){\r\n return new Promise<void>((resolve, reject) => {\r\n console.log('trying to fetch more concepts')\r\n // Add request to queue\r\n fetchQueue.push(async () => {\r\n try {\r\n // prevent simultanious request\r\n if (isFetching) return\r\n isFetching = true\r\n\r\n // Skip fetching if enough IDs exist\r\n if (ReservedIds.ids.length > 10) {\r\n console.log('Enough IDs available, skipping fetch.')\r\n isFetching = false // flag is reset\r\n processNextQueue()\r\n return resolve() // Resolve & exit\r\n }\r\n \r\n var header = await GetRequestHeader(\"application/x-www-form-urlencoded\");\r\n const response = await fetch(BaseUrl.GetReservedIdUrl(), {\r\n method: \"GET\",\r\n headers: header,\r\n });\r\n if (!response.ok) {\r\n HandleHttpError(response);\r\n throw new Error(`Error! status: ${response.status}`);\r\n }\r\n const result = await response.json();\r\n for (var i = 0; i < result.length; i++) {\r\n ReservedIds.AddId(result[i]);\r\n }\r\n \r\n console.log('Ids Fetch Success')\r\n resolve() // Resolve when done\r\n } catch (error) {\r\n if (error instanceof Error) {\r\n console.log(\r\n \"get reserved ids error message: \",\r\n error.message,\r\n BaseUrl.GetReservedConnectionIdUrl()\r\n );\r\n } else console.log(\"get reserved ids unexpected error: \", error);\r\n reject(error)\r\n // throw error;\r\n } finally {\r\n // Mark as fetched and process next request\r\n isFetching = false\r\n processNextQueue()\r\n }\r\n })\r\n\r\n // process the next request in the queue\r\n processNextQueue()\r\n })\r\n}","/**\r\n * API module for user authentication and login functionality.\r\n * Handles user login by validating credentials against the backend and storing the access token.\r\n *\r\n * @module Api/Login\r\n * @see https://documentation.freeschema.com for reference\r\n */\r\n\r\nimport { BaseUrl } from \"../DataStructures/BaseUrl\";\r\nimport { TokenStorage } from '../DataStructures/Security/TokenStorage';\r\nimport { HandleHttpError } from \"../Services/Common/ErrorPosting\";\r\n\r\n/**\r\n * Authenticates a user with the backend using email and password credentials.\r\n * Upon successful authentication, stores the bearer access token for subsequent API requests.\r\n *\r\n * This function is used for logging existing users into the Concept Connection System,\r\n * enabling them to perform authenticated operations such as creating and modifying concepts.\r\n *\r\n * @param email - The user's email address used for authentication\r\n * @param password - The user's password for authentication\r\n * @returns A promise that resolves to the login response containing user data and token, or undefined on error\r\n *\r\n * @example\r\n * ```typescript\r\n * // Login an existing user\r\n * const result = await LoginToBackend('user@example.com', 'securePassword123');\r\n * if (result) {\r\n * console.log('Login successful:', result.data);\r\n * // Token is automatically stored in TokenStorage.BearerAccessToken\r\n * }\r\n * ```\r\n *\r\n * @remarks\r\n * - The bearer access token is automatically stored in TokenStorage.BearerAccessToken upon successful login\r\n * - HTTP errors are handled through HandleHttpError for consistent error reporting\r\n * - The function returns undefined if the response is not OK\r\n * - Errors are logged to console and re-thrown for caller handling\r\n *\r\n * @see Signin for an alternative login implementation\r\n * @see Signup for user registration\r\n * @see TokenStorage for token management\r\n */\r\nexport async function LoginToBackend(email:string, password:string){\r\n try{\r\n var object = {\r\n 'email': email,\r\n 'password': password\r\n }\r\n\r\n var myHeaders = new Headers();\r\n myHeaders.append(\"Content-Type\", \"application/json\");\r\n\r\n var requestObject = JSON.stringify(object);\r\n\r\n const response = await fetch(BaseUrl.LoginUrl(),{\r\n method: 'POST',\r\n headers: myHeaders,\r\n body: requestObject\r\n });\r\n if(response.ok){\r\n const result = await response.json();\r\n TokenStorage.BearerAccessToken = result.data.token;\r\n return result;\r\n\r\n }\r\n else{\r\n console.log('Login tsccs error message: ', response.status);\r\n HandleHttpError(response);\r\n }\r\n\r\n }\r\n catch (error) {\r\n if (error instanceof Error) {\r\n console.log('Login tsccs error message: ', error.message);\r\n } else {\r\n console.log(' Login tsccs unexpected error: ', error);\r\n }\r\n throw error;\r\n }\r\n}","/**\r\n * API module for creating and retrieving type concepts.\r\n * Type concepts define the categories and classifications used in the Concept Connection System.\r\n *\r\n * @module Api/MakeTheTypeConceptApi\r\n * @see https://documentation.freeschema.com for reference\r\n */\r\n\r\nimport { BaseUrl } from \"../DataStructures/BaseUrl\";\r\nimport { GetRequestHeader } from \"../Services/Security/GetRequestHeader\";\r\nimport { Concept } from \"../DataStructures/Concept\";\r\nimport { CreateDefaultConcept } from \"../Services/CreateDefaultConcept\";\r\nimport { ConceptsData, GetConceptByCharacter } from \"../app\";\r\nimport { GetConceptByCharacterAndCategory } from \"../Services/ConceptFinding/GetConceptByCharacterAndCategory\";\r\nimport { HandleHttpError } from \"../Services/Common/ErrorPosting\";\r\n\r\nconst conceptCache = new Map<string, Promise<Concept>>();\r\n\r\n/**\r\n * Retrieves or creates a type concept based on a string identifier.\r\n * Type concepts are special concepts that define categories for other concepts in the system.\r\n *\r\n * This function first attempts to find an existing type concept locally, then queries the backend\r\n * if not found. If the concept doesn't exist in the backend, it creates a new type concept.\r\n * The function uses caching to prevent duplicate requests for the same type.\r\n *\r\n * @param type - The string identifier for the type concept (e.g., \"the_person\", \"the_location\")\r\n * @param userId - The user ID associated with the request\r\n * @returns A promise that resolves to the Concept object representing the type\r\n *\r\n * @example\r\n * ```typescript\r\n * // Get or create a \"person\" type concept\r\n * const personType = await MakeTheTypeConceptApi('the_person', 123);\r\n * console.log('Person type ID:', personType.id);\r\n *\r\n * // Use the type concept when creating new concepts\r\n * const newPerson = await CreateConcept('John Doe', personType.id);\r\n * ```\r\n *\r\n * @remarks\r\n * - Uses local caching to prevent duplicate simultaneous requests\r\n * - First searches for existing concept via GetConceptByCharacterAndCategory\r\n * - Creates new type concept in backend if not found or if typeId is 4 (unknown type)\r\n * - Automatically adds the retrieved concept to ConceptsData for local access\r\n * - Cache entries are cleaned up after the fetch completes\r\n * - Returns a default concept with id=0 if errors occur\r\n *\r\n * @see GetConceptByCharacterAndCategory for local concept searching\r\n * @see MakeTheNameInBackend for creating named concepts\r\n */\r\nexport async function MakeTheTypeConceptApi(type:string, userId:number){\r\n // create a default concept with all defaulting to zero\r\n let concept = CreateDefaultConcept();\r\n\r\n // check the cache\r\n if (conceptCache.has(type)) return conceptCache.get(type) || concept;\r\n\r\n const makeTypeConcept = (async () => {\r\n try{\r\n // get the concept by character and category from the api\r\n concept = await GetConceptByCharacterAndCategory(type);\r\n if(concept.id == 0 || concept.typeId == 4){\r\n var header = await GetRequestHeader('application/x-www-form-urlencoded');\r\n const response = await fetch(BaseUrl.MakeTheTypeConceptUrl(),{\r\n method: 'POST',\r\n headers: header,\r\n body: `type=${type}`\r\n });\r\n if(!response.ok){\r\n HandleHttpError(response);\r\n throw new Error(`Error! status: ${response.status}`);\r\n }\r\n let result = await response.json();\r\n concept = result as Concept;\r\n if(concept.id > 0) ConceptsData.AddConcept(concept);\r\n }\r\n return concept;\r\n }\r\n catch (error) {\r\n if (error instanceof Error) console.log('Make The Type Concept Api error : ', error.message);\r\n else console.log('Make The Type Concept Api error : ', error);\r\n throw error;\r\n }\r\n finally {\r\n conceptCache.delete(type); // Remove from cache after fetching\r\n }\r\n })()\r\n // set the cache when fetching\r\n conceptCache.set(type, makeTypeConcept);\r\n return makeTypeConcept;\r\n}\r\n","/**\r\n * API module for performing recursive searches through concept compositions.\r\n * Enables complex queries that traverse concept relationships and compositions.\r\n *\r\n * @module Api/RecursiveSearch\r\n * @see https://documentation.freeschema.com for reference\r\n */\r\n\r\nimport { Connection } from \"../DataStructures/Connection\";\r\nimport { BaseUrl } from \"../DataStructures/BaseUrl\";\r\nimport { SearchQuery } from \"../DataStructures/SearchQuery\";\r\nimport { GetCompositionFromConnectionsWithDataId } from \"../Services/GetCompositionBulk\";\r\nimport { ConnectionData } from \"../DataStructures/ConnectionData\";\r\nimport { GetRequestHeader } from \"../Services/Security/GetRequestHeader\";\r\nimport { HandleHttpError } from \"../Services/Common/ErrorPosting\";\r\n\r\n/**\r\n * Performs a recursive search through concept compositions using specified filters.\r\n * This function searches through the network of concepts, following composition relationships\r\n * and filtering by linker types and text content.\r\n *\r\n * Recursive search is a powerful feature of the Concept Connection System that allows\r\n * navigation through complex concept hierarchies. It can find all concepts within a composition,\r\n * filtered by specific relationship types (linkers) and text search terms.\r\n *\r\n * @param composition - The composition ID to search within (0 for global search)\r\n * @param listLinkers - Array of linker type strings to filter connections (e.g., ['is_a', 'has_property'])\r\n * @param textSearch - Text string to search for within concept names/properties\r\n * @returns A promise that resolves to an array of concepts matching the search criteria\r\n *\r\n * @example\r\n * ```typescript\r\n * // Search for all concepts within composition 100 that have 'is_a' relationships\r\n * const results = await RecursiveSearchApi(100, ['is_a']);\r\n *\r\n * // Search for concepts containing \"person\" in composition 200\r\n * const personResults = await RecursiveSearchApi(200, [], 'person');\r\n *\r\n * // Combined search with linkers and text\r\n * const filtered = await RecursiveSearchApi(300, ['has_property', 'located_at'], 'building');\r\n * ```\r\n *\r\n * @remarks\r\n * - Returns an empty array if the search fails or no results are found\r\n * - The function retrieves both internal and external connections\r\n * - Results are processed through GetCompositionFromConnectionsWithDataId to build full concept objects\r\n * - HTTP errors are handled through HandleHttpError\r\n * - Errors are logged and re-thrown for caller handling\r\n *\r\n * @see SearchQuery for the query data structure\r\n * @see GetCompositionFromConnectionsWithDataId for result processing\r\n */\r\nexport async function RecursiveSearchApi(composition:number = 0, listLinkers:string[] = [], textSearch:string = \"\"){\r\n var concepts:any[] = [];\r\n\r\ntry{\r\n var searchQuery = new SearchQuery();\r\n searchQuery.composition = composition;\r\n searchQuery.listLinkers = listLinkers;\r\n searchQuery.textSearch = textSearch;\r\n var raw = JSON.stringify(searchQuery);\r\n var Connections :Connection [] = []; \r\n var myHeaders = await GetRequestHeader();\r\n const response = await fetch(BaseUrl.RecursiveSearchUrl(),{\r\n method: 'POST',\r\n headers: myHeaders,\r\n body: raw\r\n });\r\n if(response.ok){\r\n const result = await response.json();\r\n var conceptIds = result.compositionIds;\r\n var connections = result.internalConnections;\r\n var externalConnections = result.externalConnections;\r\n concepts = await GetCompositionFromConnectionsWithDataId(conceptIds,connections);\r\n }\r\n else{\r\n console.log(\"recursive search error \", response.status);\r\n HandleHttpError(response);\r\n }\r\n return concepts;\r\n\r\n}\r\n\r\ncatch (error) {\r\n if (error instanceof Error) {\r\n console.log('recursive search error message: ', error.message);\r\n } else {\r\n console.log('recursive search unexpected error: ', error);\r\n }\r\n throw error;\r\n }\r\n}\r\n","/**\r\n * Freeschema Query API module for executing flexible schema-based queries.\r\n * This module provides functionality to query concepts using the Freeschema query language,\r\n * which allows for dynamic and flexible data retrieval from the Concept Connection System.\r\n *\r\n * @module Api/Search/FreeschemaQueryApi\r\n * @see https://documentation.freeschema.com for Freeschema query syntax and examples\r\n */\r\n\r\nimport { BaseUrl } from \"../../DataStructures/BaseUrl\";\r\nimport { FreeSchemaResponse } from \"../../DataStructures/Responses/ErrorResponse\";\r\nimport { FreeschemaQuery } from \"../../DataStructures/Search/FreeschemaQuery\";\r\nimport {SearchQuery} from '../../DataStructures/SearchQuery';\r\nimport { HandleHttpError, HandleInternalError } from \"../../Services/Common/ErrorPosting\";\r\nimport { GetRequestHeaderWithAuthorization } from \"../../Services/Security/GetRequestHeader\";\r\n\r\n/**\r\n * Executes a Freeschema query to retrieve concepts from the CCS backend.\r\n * This function sends a POST request with a FreeschemaQuery object to perform\r\n * flexible, schema-independent queries on the concept database. The Freeschema\r\n * query language enables complex filtering, nested searches, and dynamic property\r\n * access across different concept types.\r\n *\r\n * @param query - The FreeschemaQuery object containing query parameters, filters, and search criteria\r\n * @param token - Optional authentication token for authorized access (defaults to empty string for public queries)\r\n * @returns Promise resolving to an array of matching concepts, or empty array on error\r\n *\r\n * @example\r\n * ```typescript\r\n * // Search for concepts with specific properties\r\n * const query: FreeschemaQuery = {\r\n * type: \"Person\",\r\n * filters: { age: { $gt: 18 } },\r\n * limit: 10\r\n * };\r\n * const results = await FreeschemaQueryApi(query, \"auth-token-123\");\r\n * console.log(`Found ${results.length} matching concepts`);\r\n * ```\r\n *\r\n * @remarks\r\n * This function handles both HTTP errors and internal exceptions gracefully:\r\n * - HTTP errors are logged and handled via HandleHttpError\r\n * - Internal errors are caught and reported via HandleInternalError\r\n * - Returns empty array on any failure to prevent null reference errors\r\n *\r\n * The Freeschema query system is particularly useful for:\r\n * - Cross-composition searches\r\n * - Dynamic property filtering\r\n * - Complex relationship traversal\r\n * - Type-independent queries\r\n *\r\n * @see SearchAllConcepts for simpler search operations\r\n * @see SearchWithLinker for linked concept searches\r\n */\r\nexport async function FreeschemaQueryApi(query: FreeschemaQuery, token: string=\"\"){\r\n var header = await GetRequestHeaderWithAuthorization(\"application/json\", token);\r\n const queryUrl = BaseUrl.FreeschemaQueryUrl();\r\n const body = JSON.stringify(query);\r\n try{\r\n const response = await fetch(queryUrl,{\r\n method: 'POST',\r\n headers: header,\r\n body: body\r\n });\r\n if(response.ok){\r\n let result = await response.json();\r\n return result;\r\n\r\n }\r\n else{\r\n HandleHttpError(response);\r\n console.log(\"This is the freeschema query error\", response.status);\r\n return [];\r\n\r\n }\r\n\r\n }\r\n catch(ex:any){\r\n console.log(\"This is the freeschema query error others\", ex);\r\n HandleInternalError(ex, queryUrl);\r\n }\r\n}","/**\r\n * Search API module for querying concepts across compositions.\r\n * This module provides the primary search functionality for the Concept Connection System,\r\n * enabling users to search for concepts by type, name, and composition with pagination support.\r\n *\r\n * @module Api/Search/Search\r\n * @see https://documentation.freeschema.com for search query patterns and best practices\r\n */\r\n\r\nimport { GetRequestHeaderWithAuthorization } from \"../../Services/Security/GetRequestHeader\";\r\nimport { BaseUrl } from \"../../DataStructures/BaseUrl\";\r\nimport { HandleHttpError } from \"../../Services/Common/ErrorPosting\";\r\n\r\n/**\r\n * Searches for concepts across specified compositions with pagination.\r\n * This is the primary search function for retrieving concepts based on type,\r\n * search text, and composition. It performs a GET request with URL-encoded\r\n * parameters to find matching concepts in the CCS database.\r\n *\r\n * @param type - The concept type to search for (e.g., \"Person\", \"Organization\", \"Document\")\r\n * @param search - The search text to match against concept names or properties\r\n * @param composition - The composition ID or name to search within\r\n * @param token - Authentication token for authorized access\r\n * @param inpage - Number of results per page (defaults to 10)\r\n * @param page - Page number for pagination, starting from 1 (defaults to 1)\r\n * @returns Promise resolving to an array of matching concepts, or empty array on error\r\n *\r\n * @example\r\n * ```typescript\r\n * // Search for Person concepts in a specific composition\r\n * const results = await SearchAllConcepts(\r\n * \"Person\",\r\n * \"John\",\r\n * \"my-composition-123\",\r\n * \"auth-token-456\",\r\n * 20, // 20 results per page\r\n * 1 // first page\r\n * );\r\n * console.log(`Found ${results.length} matching persons`);\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Search with default pagination\r\n * const results = await SearchAllConcepts(\r\n * \"Document\",\r\n * \"report\",\r\n * \"documents-composition\",\r\n * authToken\r\n * );\r\n * // Returns first 10 results by default\r\n * ```\r\n *\r\n * @remarks\r\n * This function uses URL-encoded parameters for the GET request, which is ideal for\r\n * simple search operations. For more complex queries, consider using FreeschemaQueryApi.\r\n *\r\n * Error handling:\r\n * - HTTP errors are handled via HandleHttpError and logged\r\n * - Network errors are caught, logged, and re-thrown\r\n * - Returns empty array on HTTP errors, throws exception on network errors\r\n *\r\n * Pagination:\r\n * - Results are paginated server-side\r\n * - Use 'inpage' to control page size\r\n * - Use 'page' to navigate through results\r\n * - Page numbers start at 1, not 0\r\n *\r\n * @see FreeschemaQueryApi for complex queries\r\n * @see SearchInternalApi for searching within internal compositions\r\n * @see SearchWithLinker for linked concept searches\r\n */\r\nexport async function SearchAllConcepts(type:string, search:string, composition:string, token:string, inpage: number = 10, page:number =1){\r\n var header = await GetRequestHeaderWithAuthorization('application/x-www-form-urlencoded', token);\r\n var urlencoded = new URLSearchParams();\r\n urlencoded.append(\"type\", type);\r\n urlencoded.append(\"search\", search);\r\n urlencoded.append(\"composition\", composition);\r\n urlencoded.append(\"inpage\", inpage.toString());\r\n urlencoded.append(\"page\", page.toString());\r\n const queryUrl = BaseUrl.SearchCompositionsUrl() + \"?\" + urlencoded.toString();\r\n try{\r\n const response = await fetch(queryUrl,{\r\n method: 'GET',\r\n headers: header\r\n });\r\n if(response.ok){\r\n let result = await response.json();\r\n return result;\r\n\r\n }\r\n else{\r\n HandleHttpError(response);\r\n return [];\r\n }\r\n\r\n }\r\n catch(ex){\r\n console.log(\"This is the searching error\", ex);\r\n throw ex;\r\n }\r\n\r\n\r\n}","/**\r\n * Internal Search API module for querying concepts within nested compositions.\r\n * This module provides specialized search functionality for searching concepts that exist\r\n * within internal (nested) compositions, enabling hierarchical concept retrieval in the\r\n * Concept Connection System.\r\n *\r\n * @module Api/Search/SearchInternalApi\r\n * @see https://documentation.freeschema.com for internal composition structure and search patterns\r\n */\r\n\r\nimport { BaseUrl, SearchStructure } from \"../../app\";\r\nimport { HandleHttpError } from \"../../Services/Common/ErrorPosting\";\r\nimport { GetRequestHeaderWithAuthorization } from \"../../Services/Security/GetRequestHeader\";\r\n\r\n/**\r\n * Searches for concepts within internal (nested) compositions with authentication.\r\n * This function enables searching for concepts that are part of internal compositions,\r\n * which are compositions nested within other compositions. It performs a GET request\r\n * with query parameters to search both the parent composition and internal composition.\r\n *\r\n * @param search - SearchStructure object containing all search parameters including composition, internal composition, type, search text, and pagination\r\n * @param token - Optional authentication token for authorized access (defaults to empty string for public queries)\r\n * @returns Promise resolving to an array of matching concepts from the internal composition, or empty array on error\r\n *\r\n * @example\r\n * ```typescript\r\n * // Search for concepts in an internal composition\r\n * const searchParams: SearchStructure = {\r\n * composition: \"parent-composition-123\",\r\n * internalComposition: \"nested-composition-456\",\r\n * type: \"Task\",\r\n * search: \"urgent\",\r\n * inpage: 15,\r\n * page: 1\r\n * };\r\n * const results = await SearchInternalApi(searchParams, \"auth-token-789\");\r\n * console.log(`Found ${results.length} urgent tasks in nested composition`);\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Search in a deeply nested composition structure\r\n * const searchParams: SearchStructure = {\r\n * composition: \"organization\",\r\n * internalComposition: \"department.team.projects\",\r\n * type: \"Project\",\r\n * search: \"active\",\r\n * inpage: 10,\r\n * page: 1\r\n * };\r\n * const activeProjects = await SearchInternalApi(searchParams, authToken);\r\n * ```\r\n *\r\n * @remarks\r\n * This function is specifically designed for hierarchical concept structures where\r\n * compositions can contain other compositions. It's particularly useful for:\r\n * - Searching within organizational hierarchies\r\n * - Querying nested data structures\r\n * - Accessing concepts in private or protected sub-compositions\r\n * - Filtering results within specific composition contexts\r\n *\r\n * Error handling:\r\n * - HTTP errors are logged with status and handled via HandleHttpError\r\n * - Network errors are caught, logged, and re-thrown\r\n * - Returns empty array on HTTP errors to prevent null reference issues\r\n *\r\n * Query construction:\r\n * - All parameters are URL-encoded as query strings\r\n * - The URL pattern: ?composition=X&search=Y&internalComposition=Z&type=T&inpage=N&page=P\r\n * - Uses authenticated CCS endpoint for secure access\r\n *\r\n * @see SearchAllConcepts for searching in top-level compositions\r\n * @see FreeschemaQueryApi for complex nested queries\r\n */\r\nexport async function SearchInternalApi(search: SearchStructure, token: string = \"\"){\r\n var header = await GetRequestHeaderWithAuthorization(\"application/json\", token);\r\n let queryUrl = BaseUrl.SearchInternalWithAuthenticatedCcsUrl();\r\n queryUrl = queryUrl + '?composition=' + search.composition + '&search=' + search.search + '&internalComposition=' + search.internalComposition + '&type=' + search.type + '&inpage=' + search.inpage + '&page=' + search.page;\r\n try{\r\n const response = await fetch(queryUrl,{\r\n method: 'GET',\r\n headers: header\r\n });\r\n if(response.ok){\r\n let result = await response.json();\r\n return result;\r\n\r\n }\r\n else{\r\n console.log(\"This is the searching internal error\", response.status);\r\n HandleHttpError(response);\r\n return [];\r\n }\r\n\r\n }\r\n catch(ex){\r\n console.log(\"This is the searching internal error\", ex);\r\n throw ex;\r\n }\r\n\r\n\r\n}","/**\r\n * Search Link Multiple API module for executing batch searches across multiple queries.\r\n * This module provides functionality to search for concepts using multiple search queries\r\n * in a single API call, optimizing performance for applications that need to retrieve\r\n * related or linked concepts efficiently.\r\n *\r\n * @module Api/Search/SearchLinkMultipleApi\r\n * @see https://documentation.freeschema.com for batch search patterns and optimization techniques\r\n */\r\n\r\nimport { BaseUrl } from \"../../DataStructures/BaseUrl\";\r\nimport {SearchQuery} from '../../DataStructures/SearchQuery';\r\nimport { HandleHttpError } from \"../../Services/Common/ErrorPosting\";\r\nimport { GetRequestHeaderWithAuthorization } from \"../../Services/Security/GetRequestHeader\";\r\n\r\n/**\r\n * Executes multiple search queries in a single API call to retrieve linked concepts.\r\n * This function sends an array of SearchQuery objects to the backend, which processes\r\n * all queries and returns the combined results. This is significantly more efficient\r\n * than making individual API calls for each query, especially when searching for\r\n * related or linked concepts.\r\n *\r\n * @param searchQuery - Array of SearchQuery objects, each containing search parameters for a specific query\r\n * @param token - Optional authentication token for authorized access (defaults to empty string for public queries)\r\n * @returns Promise resolving to an array of search results (one result set per query), or empty array on error\r\n *\r\n * @example\r\n * ```typescript\r\n * // Search for multiple related concepts simultaneously\r\n * const queries: SearchQuery[] = [\r\n * {\r\n * type: \"Person\",\r\n * search: \"John\",\r\n * composition: \"users\",\r\n * inpage: 10,\r\n * page: 1\r\n * },\r\n * {\r\n * type: \"Organization\",\r\n * search: \"Company\",\r\n * composition: \"organizations\",\r\n * inpage: 5,\r\n * page: 1\r\n * },\r\n * {\r\n * type: \"Document\",\r\n * search: \"contract\",\r\n * composition: \"documents\",\r\n * inpage: 20,\r\n * page: 1\r\n * }\r\n * ];\r\n * const results = await SearchLinkMultipleApi(queries, \"auth-token-123\");\r\n * console.log(`Retrieved ${results.length} result sets`);\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Search for a person and their associated data in one call\r\n * const linkedQueries: SearchQuery[] = [\r\n * { type: \"Person\", search: \"Alice\", composition: \"main\", inpage: 1, page: 1 },\r\n * { type: \"Post\", search: \"Alice\", composition: \"social\", inpage: 10, page: 1 },\r\n * { type: \"Comment\", search: \"Alice\", composition: \"social\", inpage: 10, page: 1 }\r\n * ];\r\n * const [person, posts, comments] = await SearchLinkMultipleApi(linkedQueries, token);\r\n * ```\r\n *\r\n * @remarks\r\n * This function is optimized for scenarios where you need to:\r\n * - Retrieve multiple related concepts in a single request\r\n * - Reduce network round-trips and improve performance\r\n * - Maintain consistency across related queries (all executed at the same time)\r\n * - Search for linked or connected concepts efficiently\r\n *\r\n * Performance benefits:\r\n * - Single HTTP connection instead of multiple\r\n * - Reduced network latency\r\n * - Server-side query optimization\r\n * - Atomic execution of all queries\r\n *\r\n * Error handling:\r\n * - HTTP errors are logged with status and handled via HandleHttpError\r\n * - Network errors are caught, logged, and re-thrown\r\n * - Returns empty array on HTTP errors to prevent null reference issues\r\n * - If any query fails, the entire operation returns an empty array\r\n *\r\n * Query execution:\r\n * - All queries are executed server-side\r\n * - Results maintain the same order as input queries\r\n * - Each query can have different pagination settings\r\n * - Each query is independent but executed atomically\r\n *\r\n * @see SearchWithLinker for alternative batch search with linker functionality\r\n * @see SearchAllConcepts for single concept searches\r\n * @see FreeschemaQueryApi for complex queries\r\n */\r\nexport async function SearchLinkMultipleApi(searchQuery: SearchQuery[], token: string=\"\"){\r\n var header = await GetRequestHeaderWithAuthorization(\"application/json\", token);\r\n const queryUrl = BaseUrl.SearchLinkMultipleAllApiUrl();\r\n const body = JSON.stringify(searchQuery);\r\n try{\r\n const response = await fetch(queryUrl,{\r\n method: 'POST',\r\n headers: header,\r\n body: body\r\n });\r\n if(response.ok){\r\n let result = await response.json();\r\n return result;\r\n\r\n }\r\n else{\r\n console.log(\"This is the searching multiple error\", response.status);\r\n HandleHttpError(response);\r\n return [];\r\n }\r\n\r\n }\r\n catch(ex){\r\n console.log(\"This is the searching multiple error\", ex);\r\n throw ex;\r\n }\r\n}","/**\r\n * Search With Linker API module for executing linked searches across related concepts.\r\n * This module provides functionality to search for concepts with automatic link resolution,\r\n * enabling efficient retrieval of connected concepts and their relationships in the\r\n * Concept Connection System. The linker functionality automatically resolves and includes\r\n * related concepts based on defined relationships.\r\n *\r\n * @module Api/Search/SearchWithLinker\r\n * @see https://documentation.freeschema.com for linker patterns and relationship traversal\r\n */\r\n\r\nimport { BaseUrl } from \"../../DataStructures/BaseUrl\";\r\nimport {SearchQuery} from '../../DataStructures/SearchQuery';\r\nimport { HandleHttpError } from \"../../Services/Common/ErrorPosting\";\r\nimport { GetRequestHeaderWithAuthorization } from \"../../Services/Security/GetRequestHeader\";\r\n\r\n/**\r\n * Executes multiple search queries with automatic link resolution and relationship traversal.\r\n * This function searches for concepts while automatically resolving and including linked\r\n * concepts based on defined relationships. The linker functionality intelligently follows\r\n * concept connections, providing a complete view of related data in a single API call.\r\n *\r\n * @param searchQuery - Array of SearchQuery objects defining search criteria and relationship paths to follow\r\n * @param token - Optional authentication token for authorized access (defaults to empty string for public queries)\r\n * @returns Promise resolving to an array of search results with linked concepts resolved, or empty array on error\r\n *\r\n * @example\r\n * ```typescript\r\n * // Search for a person and automatically include their related concepts\r\n * const queries: SearchQuery[] = [\r\n * {\r\n * type: \"Person\",\r\n * search: \"John Doe\",\r\n * composition: \"users\",\r\n * inpage: 1,\r\n * page: 1\r\n * }\r\n * ];\r\n * // The linker will automatically include related organizations, posts, etc.\r\n * const results = await SearchWithLinker(queries, \"auth-token-123\");\r\n * console.log(\"Person with all linked data:\", results);\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Search for multiple concepts with link resolution\r\n * const queries: SearchQuery[] = [\r\n * {\r\n * type: \"Project\",\r\n * search: \"Alpha\",\r\n * composition: \"projects\",\r\n * inpage: 5,\r\n * page: 1\r\n * },\r\n * {\r\n * type: \"Team\",\r\n * search: \"Engineering\",\r\n * composition: \"teams\",\r\n * inpage: 5,\r\n * page: 1\r\n * }\r\n * ];\r\n * // Results will include projects with linked tasks, team members, etc.\r\n * const linkedResults = await SearchWithLinker(queries, token);\r\n * ```\r\n *\r\n * @remarks\r\n * The SearchWithLinker function differs from SearchLinkMultipleApi by automatically\r\n * resolving concept relationships and including linked concepts in the results.\r\n * This is particularly useful for:\r\n * - Retrieving complete object graphs in one call\r\n * - Following relationship chains automatically\r\n * - Reducing the need for multiple follow-up queries\r\n * - Building comprehensive views of related data\r\n *\r\n * Link resolution behavior:\r\n * - Automatically follows defined relationships between concepts\r\n * - Includes linked concepts in the response\r\n * - Respects composition boundaries and access controls\r\n * - Optimizes server-side to prevent N+1 query problems\r\n *\r\n * Performance considerations:\r\n * - More comprehensive than simple searches but single round-trip\r\n * - Server-side optimization for relationship traversal\r\n * - May return larger payloads due to included linked concepts\r\n * - Ideal for reducing client-side data fetching complexity\r\n *\r\n * Error handling:\r\n * - HTTP errors are logged with status and handled via HandleHttpError\r\n * - Network errors are caught, logged, and re-thrown\r\n * - Returns empty array on HTTP errors to maintain consistent error handling\r\n * - Link resolution errors are handled gracefully server-side\r\n *\r\n * Use cases:\r\n * - Building detailed profile views with all related data\r\n * - Dashboard displays requiring multiple related entities\r\n * - Report generation needing complete relationship graphs\r\n * - Mobile applications minimizing network requests\r\n *\r\n * @see SearchLinkMultipleApi for batch searches without automatic link resolution\r\n * @see SearchAllConcepts for simple single-concept searches\r\n * @see FreeschemaQueryApi for custom relationship queries\r\n */\r\nexport async function SearchWithLinker(searchQuery: SearchQuery[], token: string=\"\"){\r\n var header = await GetRequestHeaderWithAuthorization(\"application/json\", token);\r\n const queryUrl = BaseUrl.SearchLinkMultipleAll();\r\n const body = JSON.stringify(searchQuery);\r\n try{\r\n const response = await fetch(queryUrl,{\r\n method: 'POST',\r\n headers: header,\r\n body: body\r\n });\r\n if(response.ok){\r\n let result = await response.json();\r\n return result;\r\n\r\n }\r\n else{\r\n console.log(\"This is the searching error\", response.status);\r\n HandleHttpError(response);\r\n return [];\r\n }\r\n\r\n }\r\n catch(ex){\r\n console.log(\"This is the searching error\", ex);\r\n throw ex;\r\n }\r\n}","/**\r\n * API module for searching concepts by character value with explicit category specification.\r\n * Provides direct category-based concept retrieval with request caching.\r\n *\r\n * @module Api/SearchConcept/GetConceptByCharacterAndCategoryDirect\r\n * @see https://documentation.freeschema.com for reference\r\n */\r\n\r\nimport { ConceptsData } from \"./../../DataStructures/ConceptData\";\r\nimport { GetConceptByCharacterAndTypeUrl } from './../../Constants/ApiConstants';\r\nimport { Concept } from \"./../../DataStructures/Concept\";\r\nimport { BaseUrl } from \"../../DataStructures/BaseUrl\";\r\nimport { GetRequestHeader } from \"../../Services/Security/GetRequestHeader\";\r\nimport { CreateDefaultConcept } from \"../../app\";\r\nimport { HandleHttpError } from \"../../Services/Common/ErrorPosting\";\r\n\r\nconst conceptCache = new Map<string, Promise<Concept>>();\r\n\r\n/**\r\n * Retrieves a concept from the backend by its character value and specific category ID.\r\n * This is a more precise search than GetConceptByCharacterAndCategoryApi as it requires\r\n * an explicit category ID.\r\n *\r\n * The function uses request caching to prevent duplicate simultaneous requests for the\r\n * same character-category combination. Retrieved concepts are automatically added to\r\n * the local ConceptsData cache.\r\n *\r\n * @param characterValue - The character string identifying the concept (e.g., \"john_doe\", \"building_a\")\r\n * @param category_id - The specific category ID to search within\r\n * @returns A promise that resolves to the matching Concept object, or a default concept if not found\r\n *\r\n * @example\r\n * ```typescript\r\n * // Find a specific person concept in category 5\r\n * const person = await GetConceptByCharacterAndCategoryDirectApi('john_doe', 5);\r\n * if (person.id !== 0) {\r\n * console.log('Found person:', person);\r\n * }\r\n *\r\n * // Simultaneous calls for the same concept will use the same cached promise\r\n * const promise1 = GetConceptByCharacterAndCategoryDirectApi('jane_doe', 5);\r\n * const promise2 = GetConceptByCharacterAndCategoryDirectApi('jane_doe', 5);\r\n * // Both will resolve to the same result without making duplicate API calls\r\n * ```\r\n *\r\n * @remarks\r\n * - Uses local caching (conceptCache) to prevent duplicate simultaneous requests\r\n * - Cache key is the concatenation of characterValue and category_id\r\n * - Returns a default concept (id=0) if the concept is not found or an error occurs\r\n * - Automatically caches the retrieved concept in ConceptsData for subsequent use\r\n * - Cache entries are cleaned up in the finally block after fetch completes\r\n * - HTTP errors are handled through HandleHttpError but do not throw\r\n * - Errors are logged with full diagnostic information including the endpoint URL\r\n *\r\n * @see GetConceptByCharacterAndCategoryApi for searching without explicit category\r\n * @see CreateDefaultConcept for the default concept structure\r\n * @see ConceptsData for the local concept cache\r\n */\r\nexport async function GetConceptByCharacterAndCategoryDirectApi(characterValue: string, category_id: number): Promise<Concept>{\r\n let concept = CreateDefaultConcept();\r\n if (conceptCache.has(characterValue + category_id)) return conceptCache.get(characterValue + category_id) || concept;\r\n const GetConceptByCharacterAndCategoryDirect = (async () => {\r\n try{\r\n var header = await GetRequestHeader('application/x-www-form-urlencoded');\r\n const response = await fetch(BaseUrl.GetConceptByCharacterAndCategoryDirectUrl(),{\r\n method: 'POST',\r\n headers: header,\r\n body: `character_value=${characterValue}&category_id=${category_id}`,\r\n });\r\n if(response.ok){\r\n let conceptString = await response.json() ;\r\n concept = conceptString as Concept;\r\n ConceptsData.AddConcept(concept);\r\n }\r\n else{\r\n // throw new Error(`Error! status: ${response.status}`);\r\n console.log(\"This is the concept by category and character direct api error\", response.status);\r\n HandleHttpError(response);\r\n }\r\n\r\n return concept;\r\n\r\n }\r\n catch (error) {\r\n if (error instanceof Error) {\r\n console.log(' This is the concept by category and character direct api error message: ', error.message, characterValue, category_id,BaseUrl.GetConceptByCharacterAndCategoryDirectUrl() );\r\n } else {\r\n console.log(' This is the concept by category and character unexpected direct api error: ', error,characterValue, category_id,BaseUrl.GetConceptByCharacterAndCategoryDirectUrl());\r\n }\r\n throw error;\r\n }\r\n finally{\r\n conceptCache.delete(characterValue + category_id); // Remove from cache after fetching\r\n }\r\n\r\n })()\r\n conceptCache.set(characterValue + category_id, GetConceptByCharacterAndCategoryDirect);\r\n return GetConceptByCharacterAndCategoryDirect;\r\n\r\n}","/**\r\n * API module for creating user session records.\r\n * Tracks user sessions for analytics and activity monitoring purposes.\r\n *\r\n * @module Api/Session/CreateSession\r\n * @see https://documentation.freeschema.com for reference\r\n */\r\n\r\nimport { GetRequestHeader } from \"../../Services/Security/GetRequestHeader\";\r\nimport { BaseUrl } from \"../../DataStructures/BaseUrl\";\r\nimport { SessionData } from \"../../app\";\r\nimport { HandleHttpError } from \"../../Services/Common/ErrorPosting\";\r\n\r\n/**\r\n * Creates a new session record in the backend for tracking user activity.\r\n * Sessions are used to monitor user interactions, track analytics, and maintain\r\n * activity logs within the Concept Connection System.\r\n *\r\n * This function initiates a new session with the provided session data, which\r\n * typically includes user information, timestamps, and session metadata.\r\n *\r\n * @param sessionData - The session data object containing session initialization information\r\n * @returns A promise that resolves to the created session response, or null if creation fails\r\n *\r\n * @example\r\n * ```typescript\r\n * // Create a new user session\r\n * const sessionInfo: SessionData = {\r\n * userId: 123,\r\n * startTime: new Date().toISOString(),\r\n * userAgent: navigator.userAgent\r\n * };\r\n *\r\n * const session = await CreateSession(sessionInfo);\r\n * if (session) {\r\n * console.log('Session created:', session.sessionId);\r\n * } else {\r\n * console.log('Session creation failed');\r\n * }\r\n * ```\r\n *\r\n * @remarks\r\n * - Returns null if the session creation fails\r\n * - HTTP errors are handled through HandleHttpError\r\n * - Requires authentication via GetRequestHeader\r\n * - Error details are logged to console for debugging\r\n * - Errors are re-thrown for caller handling\r\n *\r\n * @see CreateSessionVisit for tracking URL visits within a session\r\n * @see SessionData for the session data structure\r\n */\r\nexport async function CreateSession(sessionData: SessionData){\r\n try{\r\n var header = await GetRequestHeader();\r\n const body = JSON.stringify(sessionData);\r\n const response = await fetch(BaseUrl.CreateSessionId(),{\r\n method: 'POST',\r\n headers:header,\r\n body: body\r\n });\r\n if(response.ok){\r\n return response.json();\r\n }\r\n console.log(\"Creating session failed\", await response.json());\r\n HandleHttpError(response);\r\n return null;\r\n }\r\n catch(ex){\r\n console.log(\"Creating session failed\", ex);\r\n throw ex;\r\n }\r\n}","/**\r\n * API module for tracking URL visits within user sessions.\r\n * Records individual page/URL visits as part of session activity tracking.\r\n *\r\n * @module Api/Session/CreateSessionVisit\r\n * @see https://documentation.freeschema.com for reference\r\n */\r\n\r\nimport { BaseUrl } from \"../../DataStructures/BaseUrl\";\r\nimport { HandleHttpError } from \"../../Services/Common/ErrorPosting\";\r\nimport { GetRequestHeader } from \"../../Services/Security/GetRequestHeader\";\r\n\r\n/**\r\n * Records a URL visit within an existing session for activity tracking.\r\n * This function creates a session visit record that tracks which URLs a user\r\n * accesses during their session, useful for analytics and navigation tracking.\r\n *\r\n * Session visits help build a complete picture of user activity by recording\r\n * each page or resource accessed during a session in the Concept Connection System.\r\n *\r\n * @param sessionId - The unique identifier of the session to associate this visit with\r\n * @param url - The URL that was visited (page path or full URL)\r\n * @returns A promise that resolves to the created visit response, or null if creation fails\r\n *\r\n * @example\r\n * ```typescript\r\n * // Track a page visit within a session\r\n * const visit = await CreateSessionVisit(456, '/concepts/dashboard');\r\n * if (visit) {\r\n * console.log('Visit tracked:', visit);\r\n * }\r\n *\r\n * // Track multiple visits in sequence\r\n * await CreateSessionVisit(456, '/concepts/search');\r\n * await CreateSessionVisit(456, '/concepts/create');\r\n * await CreateSessionVisit(456, '/concepts/view/123');\r\n * ```\r\n *\r\n * @remarks\r\n * - Returns null if the visit creation fails\r\n * - HTTP errors are handled through HandleHttpError\r\n * - Requires authentication via GetRequestHeader\r\n * - Uses URL-encoded form data for the request body\r\n * - Error details are logged to console for debugging\r\n * - Errors are re-thrown for caller handling\r\n *\r\n * @see CreateSession for creating the initial session\r\n */\r\nexport async function CreateSessionVisit(sessionId: number, url: string){\r\n try{\r\n var header = await GetRequestHeader(\"application/x-www-form-urlencoded\");\r\n const urlencoded = new URLSearchParams();\r\n urlencoded.append(\"sessionId\", sessionId.toString());\r\n urlencoded.append(\"url\", url);\r\n const response = await fetch(BaseUrl.CreateSessionVisitUrl(),{\r\n method: 'POST',\r\n headers:header,\r\n body: urlencoded\r\n });\r\n if(response.ok){\r\n return response.json();\r\n }\r\n console.log(\"Creating session url failed\", await response.json());\r\n HandleHttpError(response);\r\n return null;\r\n }\r\n catch(ex){\r\n console.log(\"Creating session url failed\", ex);\r\n throw ex;\r\n }\r\n}","/**\r\n * API module for user sign-in operations.\r\n * Provides standardized authentication with structured response handling.\r\n *\r\n * @module Api/Signin\r\n * @see https://documentation.freeschema.com for reference\r\n */\r\n\r\nimport { FreeschemaResponse } from \"../DataStructures/Responses/StandardResponses\"\r\nimport { SigninModel } from \"../DataStructures/SigninModel\"\r\nimport { HandleHttpError } from \"../Services/Common/ErrorPosting\"\r\nimport { BaseUrl } from \"../app\"\r\n\r\n/**\r\n * Authenticates a user and returns a standardized Freeschema response.\r\n * This function provides a more structured authentication approach compared to LoginToBackend,\r\n * returning a FreeschemaResponse object with consistent status and data fields.\r\n *\r\n * The signin process validates user credentials and returns authentication data including\r\n * tokens and user information in a standardized response format.\r\n *\r\n * @param signinInfo - The signin model containing user credentials (email and password)\r\n * @returns A promise that resolves to a FreeschemaResponse containing authentication data\r\n *\r\n * @example\r\n * ```typescript\r\n * // Sign in a user with standardized response\r\n * const signinData: SigninModel = {\r\n * email: 'user@example.com',\r\n * password: 'securePassword123'\r\n * };\r\n *\r\n * const response = await Signin(signinData);\r\n * if (response.status && response.statusCode === 200) {\r\n * console.log('Signin successful:', response.data);\r\n * // Use response.data.token for subsequent API calls\r\n * } else {\r\n * console.error('Signin failed:', response.message);\r\n * }\r\n * ```\r\n *\r\n * @remarks\r\n * - Returns a FreeschemaResponse with status, statusCode, message, and data fields\r\n * - On success: status=true, statusCode=200, data contains authentication information\r\n * - On failure: status=false, statusCode and message indicate the error\r\n * - HTTP errors are handled through HandleHttpError\r\n * - Errors are logged to console and re-thrown for caller handling\r\n * - Uses JSON content-type for request body\r\n *\r\n * @see LoginToBackend for alternative login implementation\r\n * @see Signup for user registration\r\n * @see SigninModel for the signin data structure\r\n * @see FreeschemaResponse for the response structure\r\n */\r\nexport default async function Signin(signinInfo: SigninModel) {\r\n const raw = JSON.stringify({\r\n email: signinInfo.email,\r\n password: signinInfo.password,\r\n })\r\n let freeschemaRes: FreeschemaResponse = {\r\n message: 'success',\r\n status: false,\r\n statusCode: 200,\r\n data: '',\r\n }\r\n const myHeaders = new Headers()\r\n myHeaders.append('Content-Type', 'application/json')\r\n const url = BaseUrl.LoginUrl();\r\n try {\r\n const response = await fetch(url, {\r\n method: 'POST',\r\n headers: myHeaders,\r\n body: raw,\r\n redirect: 'follow',\r\n })\r\n const output = await response.json()\r\n if (response.ok) {\r\n const dataObject = output?.data\r\n freeschemaRes = {\r\n message: 'success',\r\n status: true,\r\n statusCode: 200,\r\n data: dataObject,\r\n }\r\n } else {\r\n HandleHttpError(response);\r\n }\r\n return freeschemaRes\r\n } catch (error) {\r\n console.log('Sign in api error', error)\r\n\r\n throw error;\r\n }\r\n}\r\n","/**\r\n * API module for user registration and signup operations.\r\n * Handles new user account creation with standardized response handling.\r\n *\r\n * @module Api/Signup\r\n * @see https://documentation.freeschema.com for reference\r\n */\r\n\r\nimport { FreeschemaResponse } from \"../DataStructures/Responses/StandardResponses\";\r\nimport { SignupModel } from \"../DataStructures/SignupModel\"\r\nimport { HandleHttpError } from \"../Services/Common/ErrorPosting\";\r\nimport { BaseUrl } from \"../app\"\r\n\r\n/**\r\n * Registers a new user account in the Concept Connection System.\r\n * This function creates a new user with the provided signup information and returns\r\n * a standardized response containing registration results.\r\n *\r\n * @param signupModel - The signup model containing user registration information (name, email, password, etc.)\r\n * @returns A promise that resolves to a FreeschemaResponse indicating success or failure\r\n *\r\n * @example\r\n * ```typescript\r\n * // Register a new user\r\n * const newUser: SignupModel = {\r\n * name: 'John Doe',\r\n * email: 'john@example.com',\r\n * password: 'securePassword123'\r\n * };\r\n *\r\n * const response = await Signup(newUser);\r\n * if (response.status && response.statusCode === 200) {\r\n * console.log('Signup successful:', response.data);\r\n * } else {\r\n * console.error('Signup failed:', response.message);\r\n * }\r\n * ```\r\n *\r\n * @remarks\r\n * - Returns a FreeschemaResponse with status, statusCode, message, and data fields\r\n * - On success: status=true, statusCode=200, data contains user information\r\n * - On failure: status=false with error details\r\n * - HTTP errors are handled through HandleHttpError\r\n * - Errors are logged to console and re-thrown for caller handling\r\n *\r\n * @see Signin for user authentication after signup\r\n * @see LoginToBackend for alternative login\r\n * @see SignupModel for the signup data structure\r\n * @see FreeschemaResponse for the response structure\r\n */\r\nexport default async function Signup(signupModel: SignupModel){\r\n const signupResponse = await postData(BaseUrl.SignupUrl(), signupModel);\r\n return signupResponse;\r\n}\r\n\r\n/**\r\n * Internal helper function for posting signup data to the backend.\r\n * Handles the HTTP request with proper headers and CORS configuration.\r\n *\r\n * @param url - The signup endpoint URL\r\n * @param data - The signup data to be sent\r\n * @returns A promise that resolves to a FreeschemaResponse\r\n *\r\n * @internal\r\n */\r\nasync function postData(url = '', data = {}) {\r\n let freeschemaRes: FreeschemaResponse = {\r\n message: 'success',\r\n status: false,\r\n statusCode: 200,\r\n data: '',\r\n }\r\n // Default options are marked with *\r\n try{\r\n const response = await fetch(url, {\r\n method: 'POST', // *GET, POST, PUT, DELETE, etc.\r\n mode: 'cors', // no-cors, *cors, same-origin\r\n cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached\r\n credentials: 'same-origin', // include, *same-origin, omit\r\n headers: {\r\n 'Content-Type': 'application/json',\r\n // 'Content-Type': 'application/x-www-form-urlencoded',\r\n },\r\n redirect: 'follow', // manual, *follow, error\r\n referrerPolicy: 'no-referrer', // no-referrer, *no-referrer-when-downgrade, origin, origin-when-cross-origin, same-origin, strict-origin, strict-origin-when-cross-origin, unsafe-url\r\n body: JSON.stringify(data), // body data type must match \"Content-Type\" header\r\n })\r\n const output = await response.json()\r\n if(response.ok){\r\n freeschemaRes = {\r\n message: 'success',\r\n status: true,\r\n statusCode: 200,\r\n data: output,\r\n }\r\n }\r\n else{\r\n HandleHttpError(response);\r\n }\r\n return freeschemaRes\r\n }\r\n catch(error){\r\n console.log('Signup Error: ', error);\r\n throw error;\r\n }\r\n\r\n }","/**\r\n * API module for viewing internal concept data and connections.\r\n * Retrieves detailed internal structure including connections for specified concepts.\r\n *\r\n * @module Api/View/ViewInternalDataApi\r\n * @see https://documentation.freeschema.com for reference\r\n */\r\n\r\nimport { BaseUrl } from \"../../DataStructures/BaseUrl\";\r\nimport { HandleHttpError } from \"../../Services/Common/ErrorPosting\";\r\nimport { GetRequestHeader } from \"../../Services/Security/GetRequestHeader\";\r\nimport { Connection, CreateDefaultConcept, GetConceptBulk } from \"../../app\";\r\n\r\n/**\r\n * Retrieves internal data and connections for a list of concept IDs.\r\n * This function fetches the internal composition structure of concepts, including all\r\n * sub-concepts and their interconnections, providing a complete view of concept internals.\r\n *\r\n * In the Concept Connection System, concepts can contain other concepts as part of their\r\n * internal structure (composition). This function retrieves those internal concepts and\r\n * the connections between them, returning a dictionary mapping concept IDs to their\r\n * internal connection lists.\r\n *\r\n * @param ids - Array of concept IDs to retrieve internal data for\r\n * @returns A promise that resolves to a dictionary mapping concept IDs to their internal connections,\r\n * or an empty connection list if the request fails\r\n *\r\n * @example\r\n * ```typescript\r\n * // View internal data for multiple concepts\r\n * const conceptIds = [100, 101, 102];\r\n * const internalData = await ViewInternalDataApi(conceptIds);\r\n *\r\n * // Access connections for a specific concept\r\n * const concept100Connections = internalData[100];\r\n * if (concept100Connections) {\r\n * console.log('Concept 100 has', concept100Connections.length, 'internal connections');\r\n * }\r\n *\r\n * // Process all internal structures\r\n * for (const [conceptId, connections] of Object.entries(internalData)) {\r\n * console.log(`Concept ${conceptId}:`, connections);\r\n * }\r\n * ```\r\n *\r\n * @remarks\r\n * - Returns an object where keys are concept IDs and values are arrays of Connection objects\r\n * - Automatically fetches and caches all sub-concepts via GetConceptBulk\r\n * - Returns an empty connection list on error\r\n * - HTTP errors are handled through HandleHttpError but do not throw\r\n * - Requires authentication via GetRequestHeader\r\n * - Errors are logged to console and re-thrown for caller handling\r\n *\r\n * @see GetConceptBulk for bulk concept retrieval\r\n * @see Connection for the connection data structure\r\n */\r\nexport async function ViewInternalDataApi(ids: number[]){\r\n let connectionList: Connection[] = [];\r\n try{\r\n var header = await GetRequestHeader();\r\n\r\n const response = await fetch(BaseUrl.ViewInternalDataUrl(),{\r\n method: 'POST',\r\n headers: header,\r\n body: JSON.stringify(ids)\r\n });\r\n if(response.ok){\r\n let conceptString = await response.json() ;\r\n let connectionDictionary : any = {};\r\n for(let i=0; i < conceptString.length; i++){\r\n let conceptList: number[] = conceptString[i].concepts;\r\n connectionList = conceptString[i].connections;\r\n let id = conceptString[i].id;\r\n GetConceptBulk(conceptList);\r\n connectionDictionary[id] = connectionList;\r\n }\r\n\r\n return connectionDictionary;\r\n\r\n }\r\n else{\r\n // throw new Error(`Error! status: ${response.status}`);\r\n console.log(\"View Internal Data error\", response.status);\r\n HandleHttpError(response);\r\n }\r\n return connectionList;\r\n\r\n }\r\n catch (error) {\r\n if (error instanceof Error) {\r\n console.log(' This is the view internal data error message: ', error.message);\r\n } else {\r\n console.log(' This is the view internal data unexpected error: ', error);\r\n }\r\n throw error;\r\n }\r\n}","/**\r\n * Format Constants Module for Concept Connection System (CCS-JS)\r\n *\r\n * This module defines constants for different data format types used throughout the system.\r\n * These format types determine how data structures (concepts, connections, etc.) are serialized\r\n * and presented when retrieved from the API or displayed in the application.\r\n *\r\n * @module Constants/FormatConstants\r\n * @see https://documentation.freeschema.com for format specifications\r\n */\r\n\r\n/**\r\n * Standard normal format for data representation.\r\n * This format includes essential data fields without additional metadata.\r\n *\r\n * @example\r\n * ```typescript\r\n * import { NORMAL } from './FormatConstants';\r\n * const format = NORMAL; // 1\r\n * ```\r\n */\r\nexport const NORMAL = 1;\r\n\r\n/**\r\n * Data with ID format.\r\n * This format includes the data along with its unique identifier.\r\n *\r\n * @example\r\n * ```typescript\r\n * import { DATAID } from './FormatConstants';\r\n * const format = DATAID; // 2\r\n * ```\r\n */\r\nexport const DATAID = 2;\r\n\r\n/**\r\n * Just data format without any metadata.\r\n * This format returns only the core data fields, excluding IDs and timestamps.\r\n *\r\n * @example\r\n * ```typescript\r\n * import { JUSTDATA } from './FormatConstants';\r\n * const format = JUSTDATA; // 3\r\n * ```\r\n */\r\nexport const JUSTDATA = 3;\r\n\r\n/**\r\n * Data with ID and date format.\r\n * This format includes the data, its ID, and associated timestamp information.\r\n *\r\n * @example\r\n * ```typescript\r\n * import { DATAIDDATE } from './FormatConstants';\r\n * const format = DATAIDDATE; // 4\r\n * ```\r\n */\r\nexport const DATAIDDATE = 4;\r\n\r\n/**\r\n * Raw data format.\r\n * This format returns data in its raw form as stored in the database without any processing.\r\n *\r\n * @example\r\n * ```typescript\r\n * import { RAW } from './FormatConstants';\r\n * const format = RAW; // 5\r\n * ```\r\n */\r\nexport const RAW = 5;\r\n\r\n/**\r\n * All IDs format.\r\n * This format includes all related IDs (concept IDs, type IDs, user IDs, etc.).\r\n *\r\n * @example\r\n * ```typescript\r\n * import { ALLID } from './FormatConstants';\r\n * const format = ALLID; // 6\r\n * ```\r\n */\r\nexport const ALLID = 6;\r\n\r\n/**\r\n * List normal format.\r\n * This format is used for representing lists or arrays of data in standard format.\r\n *\r\n * @example\r\n * ```typescript\r\n * import { LISTNORMAL } from './FormatConstants';\r\n * const format = LISTNORMAL; // 7\r\n * ```\r\n */\r\nexport const LISTNORMAL = 7;\r\n\r\n\r\nexport const DATAV2 = 8;","/**\r\n * @fileoverview BaseUrl module for managing API endpoints and service URLs in CCS-JS.\r\n * This module provides centralized configuration for all backend API endpoints,\r\n * MQTT connections, and external services.\r\n * @module DataStructures/BaseUrl\r\n */\r\n\r\nimport { CompositionBinaryTree } from './Composition/CompositionBinaryTree';\r\n\r\n/**\r\n * Centralized configuration for all backend API endpoints and service URLs.\r\n * Provides methods to generate fully qualified URLs for various API operations.\r\n *\r\n * @class BaseUrl\r\n * @example\r\n * ```typescript\r\n * // Get concept API URL\r\n * const url = BaseUrl.GetConceptUrl();\r\n * fetch(url, { ... });\r\n *\r\n * // Change base URL for different environment\r\n * BaseUrl.BASE_URL = \"https://api.production.com/\";\r\n * ```\r\n *\r\n * @remarks\r\n * All URL methods return fully qualified URLs by combining BASE_URL with the endpoint path.\r\n * Static properties can be modified to point to different environments or services.\r\n */\r\nexport class BaseUrl{\r\n /** Base URL for the main CCS backend API server */\r\n static BASE_URL: string = \"https://localhost:7053/\";\r\n\r\n /** URL for AI service endpoints */\r\n static AI_URL: string =\"https://ai.freeschema.com\";\r\n\r\n /** MQTT broker URL for real-time messaging */\r\n static MQTT_URL: string = '192.168.1.249';\r\n\r\n /** Node.js service URL for additional backend operations */\r\n static NODE_URL: string = 'http://localhost:5001/';\r\n\r\n /** Active MQTT connection instance */\r\n static MQTT_CONNECTION:any ;\r\n\r\n\r\n\r\n // static GetConceptUrl:string = this.BASE_URL + '/api/getConcept';\r\n\r\n /**\r\n * Returns the URL for retrieving a single concept by ID.\r\n * @returns {string} The concept retrieval API endpoint\r\n */\r\n static GetConceptUrl(){\r\n return this.BASE_URL + '/api/getConcept';\r\n }\r\n\r\n /**\r\n * Returns the URL for retrieving a single connection by ID.\r\n * @returns {string} The connection retrieval API endpoint\r\n */\r\n static GetConnectionUrl(){\r\n return this.BASE_URL + '/api/get-connection-by-id';\r\n }\r\n\r\n /**\r\n * Returns the URL for retrieving multiple concepts in bulk.\r\n * @returns {string} The bulk concept retrieval API endpoint\r\n */\r\n static GetConceptBulkUrl(){\r\n return this.BASE_URL + '/api/get_concept_bulk';\r\n }\r\n\r\n /**\r\n * Returns the URL for retrieving multiple connections in bulk.\r\n * @returns {string} The bulk connection retrieval API endpoint\r\n */\r\n static GetConnectionBulkUrl(){\r\n return this.BASE_URL + '/api/get_connection_bulk';\r\n }\r\n\r\n /**\r\n * Returns the URL for retrieving all concepts belonging to a user.\r\n * @returns {string} The user concepts retrieval API endpoint\r\n */\r\n static GetAllConceptsOfUserUrl(){\r\n return this.BASE_URL + '/api/get_all_concepts_of_user';\r\n }\r\n\r\n /**\r\n * Returns the URL for retrieving all connections belonging to a user.\r\n * @returns {string} The user connections retrieval API endpoint\r\n */\r\n static GetAllConnectionsOfUserUrl(){\r\n return this.BASE_URL + '/api/get_all_connections_of_user';\r\n }\r\n\r\n /**\r\n * Returns the URL for retrieving all connections of a composition.\r\n * @returns {string} The composition connections retrieval API endpoint\r\n */\r\n static GetAllConnectionsOfCompositionUrl(){\r\n return this.BASE_URL + '/api/get_all_connections_of_composition';\r\n }\r\n\r\n /**\r\n * Returns the URL for retrieving composition connections in bulk.\r\n * @returns {string} The bulk composition connections retrieval API endpoint\r\n */\r\n static GetAllConnectionsOfCompositionBulkUrl(){\r\n return this.BASE_URL + '/api/get_all_connections_of_composition_bulk';\r\n }\r\n \r\n /**\r\n * Returns the URL for retrieving a concept by its character value.\r\n * @returns {string} The character value search API endpoint\r\n */\r\n static GetConceptByCharacterValueUrl(){\r\n return this.BASE_URL + '/api/get_concept_by_character_value';\r\n }\r\n\r\n /**\r\n * Returns the URL for retrieving a concept by both character value and type.\r\n * @returns {string} The character and type search API endpoint\r\n */\r\n static GetConceptByCharacterAndTypeUrl(){\r\n return this.BASE_URL + '/api/get_concept_by_character_and_type';\r\n }\r\n\r\n /**\r\n * Returns the URL for retrieving a concept by character value and category.\r\n * @returns {string} The character and category search API endpoint\r\n */\r\n static GetConceptByCharacterAndCategoryUrl(){\r\n return this.BASE_URL + '/api/get_concept_by_character_and_category';\r\n }\r\n\r\n /**\r\n * Returns the URL for direct retrieval by character and category.\r\n * @returns {string} The direct character and category search API endpoint\r\n */\r\n static GetConceptByCharacterAndCategoryDirectUrl(){\r\n return this.BASE_URL + '/api/get_concept_by_character_and_category_direct';\r\n }\r\n\r\n /**\r\n * Returns the URL for retrieving character information by character value.\r\n * @returns {string} The character search API endpoint\r\n */\r\n static GetCharacterByCharacterUrl(){\r\n return this.BASE_URL + '/api/get_character_by_character';\r\n }\r\n\r\n /**\r\n * Returns the URL for retrieving all concepts of a specific type.\r\n * @returns {string} The type-based concept search API endpoint\r\n */\r\n static GetAllConceptsByTypeUrl(){\r\n return this.BASE_URL + '/api/get_all_concepts_by_type';\r\n }\r\n\r\n /**\r\n * Returns the URL for retrieving all outgoing connections from a concept.\r\n * @returns {string} The concept outgoing connections API endpoint\r\n */\r\n static GetAllConnectionsOfConceptUrl(){\r\n return this.BASE_URL + '/api/get-link-connections';\r\n }\r\n\r\n /**\r\n * Returns the URL for retrieving all incoming connections to a concept.\r\n * @returns {string} The concept incoming connections API endpoint\r\n */\r\n static GetAllConnectionsToConceptUrl(){\r\n return this.BASE_URL + '/api/get-link-reverse-connections';\r\n }\r\n\r\n /**\r\n * Returns the URL for retrieving AI-preloaded concept data.\r\n * @returns {string} The AI preloaded concepts API endpoint\r\n */\r\n static GetAllAiData(){\r\n return this.BASE_URL + '/api/get-preloaded-concepts';\r\n // return this.AI_URL + '/api/get_ranked_type_id?inpage=300' || process.env.AI_URL || 'https://ai.freeschema.com/api/get_ranked_type_id?inpage=300';\r\n }\r\n\r\n /**\r\n * Returns the URL for prefetching user connections with pagination.\r\n * @returns {string} The prefetch connections API endpoint with inpage parameter\r\n */\r\n static GetAllPrefetchConnectionsUrl(){\r\n return this.BASE_URL + '/api/get_all_connections_of_user?inpage=500';\r\n }\r\n\r\n /**\r\n * Returns the URL for retrieving all linker connections from a concept.\r\n * @returns {string} The concept linkers API endpoint\r\n */\r\n static GetAllLinkerConnectionOfConceptUrl(){\r\n return this.BASE_URL + '/api/get-all-linkers-from-concept';\r\n }\r\n\r\n /**\r\n * Returns the URL for retrieving all linker connections to a concept.\r\n * @returns {string} The reverse concept linkers API endpoint\r\n */\r\n static GetAllLinkerConnectionToConceptUrl(){\r\n return this.BASE_URL + '/api/get-all-linkers-to-concept';\r\n }\r\n\r\n /**\r\n * Returns the URL for deleting a concept.\r\n * @returns {string} The concept deletion API endpoint\r\n */\r\n static DeleteConceptUrl(){\r\n return this.BASE_URL + '/api/delete_concept';\r\n }\r\n\r\n /**\r\n * Returns the URL for recursive search of concepts and connections.\r\n * @returns {string} The recursive search API endpoint\r\n */\r\n static RecursiveSearchUrl(){\r\n return this.BASE_URL + '/api/recursivesearch-concept-connection';\r\n }\r\n\r\n /**\r\n * Returns the URL for searching multiple links in CCS format.\r\n * @returns {string} The multiple link search API endpoint\r\n */\r\n static SearchLinkMultipleAllApiUrl(){\r\n return this.BASE_URL + '/api/Connection/search-link-multiple-all-ccs';\r\n }\r\n\r\n /**\r\n * Returns the URL for creating names in the backend.\r\n * @returns {string} The name creation API endpoint\r\n */\r\n static MakeTheNameInBackendUrl(){\r\n return this.BASE_URL + '/api/make-name-from-frontend';\r\n }\r\n\r\n /**\r\n * Returns the URL for user login authentication.\r\n * @returns {string} The login API endpoint\r\n */\r\n static LoginUrl(){\r\n return this.BASE_URL + '/api/auth/login';\r\n }\r\n\r\n /**\r\n * Returns the URL for user signup/registration.\r\n * @returns {string} The signup API endpoint\r\n */\r\n static SignupUrl(){\r\n return this.BASE_URL + '/api/auth/signup';\r\n }\r\n\r\n /**\r\n * Returns the URL for getting composition connections between two concepts.\r\n * @returns {string} The composition connection API endpoint\r\n */\r\n static GetCompositionConnectionBetweenTwoConceptsUrl(){\r\n return this.BASE_URL + '/api/get-composition-connection-between-two-concepts';\r\n }\r\n\r\n /**\r\n * Returns the URL for searching compositions.\r\n * @returns {string} The composition search API endpoint\r\n */\r\n static SearchCompositionsUrl(){\r\n return this.BASE_URL + '/api/search-compositions';\r\n }\r\n\r\n /**\r\n * Returns the URL for searching multiple links.\r\n * @returns {string} The multiple link search API endpoint\r\n */\r\n static SearchLinkMultipleAll(){\r\n return this.BASE_URL + '/api/Connection/search-link-multiple-all';\r\n }\r\n\r\n /**\r\n * Returns the URL for creating remote session IDs.\r\n * @returns {string} The session ID creation API endpoint\r\n */\r\n static CreateSessionId(){\r\n return this.BASE_URL + '/api/create-session-id-remote'\r\n }\r\n\r\n /**\r\n * Returns the URL for recording remote session visits.\r\n * @returns {string} The session visit recording API endpoint\r\n */\r\n static CreateSessionVisitUrl(){\r\n return this.BASE_URL + '/api/create-remote-session-visit'\r\n }\r\n\r\n\r\n // ========================================================================\r\n // INTERNAL DATA API ENDPOINTS\r\n // ========================================================================\r\n\r\n /**\r\n * Returns the URL for viewing internal CCS data in bulk.\r\n * @returns {string} The internal data viewing API endpoint\r\n */\r\n static ViewInternalDataUrl(){\r\n return this.BASE_URL + '/api/view-api-internal-data-ccs-id-bulk'\r\n }\r\n\r\n /**\r\n * Returns the URL for searching internal authenticated CCS compositions.\r\n * @returns {string} The authenticated internal search API endpoint\r\n */\r\n static SearchInternalWithAuthenticatedCcsUrl(){\r\n return this.BASE_URL + '/api/search-composition-internal-authenticated-ccs';\r\n }\r\n\r\n // ========================================================================\r\n // RESERVED IDS API ENDPOINTS\r\n // ========================================================================\r\n\r\n /**\r\n * Returns the URL for retrieving reserved concept IDs.\r\n * @returns {string} The reserved IDs API endpoint\r\n */\r\n static GetReservedIdUrl(){\r\n return this.BASE_URL + '/api/get_reserved_ids';\r\n }\r\n\r\n /**\r\n * Returns the URL for retrieving reserved connection IDs.\r\n * @returns {string} The reserved connection IDs API endpoint\r\n */\r\n static GetReservedConnectionIdUrl(){\r\n return this.BASE_URL + '/api/get_reserved_connection_ids';\r\n }\r\n\r\n // ========================================================================\r\n // DATA CREATION API ENDPOINTS\r\n // ========================================================================\r\n\r\n /**\r\n * Returns the URL for creating text data.\r\n * @returns {string} The text data creation API endpoint\r\n */\r\n static CreateTheTextDataUrl(){\r\n return this.BASE_URL + '/api/create_text_data';\r\n }\r\n\r\n /**\r\n * Returns the URL for creating character data.\r\n * @returns {string} The character data creation API endpoint\r\n */\r\n static CreateTheCharacterDataUrl(){\r\n return this.BASE_URL + '/api/create_character_data';\r\n }\r\n\r\n /**\r\n * Returns the URL for creating concepts.\r\n * @returns {string} The concept creation API endpoint\r\n */\r\n static CreateTheConceptUrl(){\r\n return this.BASE_URL + '/api/create_the_concept';\r\n\r\n }\r\n\r\n /**\r\n * Returns the URL for creating connections.\r\n * @returns {string} The connection creation API endpoint\r\n */\r\n static CreateTheConnectionUrl(){\r\n return this.BASE_URL + '/api/create_the_connection';\r\n }\r\n\r\n /**\r\n * Returns the URL for creating connections using the new endpoint.\r\n * @returns {string} The new connection creation API endpoint\r\n */\r\n static CreateTheConnectionNewUrl(){\r\n return this.BASE_URL + '/api/create_the_connection_new';\r\n }\r\n\r\n /**\r\n * Returns the URL for creating type concepts.\r\n * @returns {string} The type concept creation API endpoint\r\n */\r\n static MakeTheTypeConceptUrl(){\r\n return this.BASE_URL + '/api/make_the_type_concept';\r\n }\r\n\r\n // ========================================================================\r\n // DATA DELETION API ENDPOINTS\r\n // ========================================================================\r\n\r\n /**\r\n * Returns the URL for deleting a single connection.\r\n * @returns {string} The connection deletion API endpoint\r\n */\r\n static DeleteTheConnectionUrl(){\r\n return this.BASE_URL + '/api/delete_connection';\r\n }\r\n\r\n /**\r\n * Returns the URL for deleting multiple connections in bulk.\r\n * @returns {string} The bulk connection deletion API endpoint\r\n */\r\n static DeleteTheConnectionBulkUrl(){\r\n return this.BASE_URL + '/api/delete_connection_bulk';\r\n }\r\n\r\n // ========================================================================\r\n // FREESCHEMA QUERY API ENDPOINTS\r\n // ========================================================================\r\n\r\n /**\r\n * Returns the URL for executing FreeSchema queries.\r\n * @returns {string} The FreeSchema query API endpoint\r\n */\r\n static FreeschemaQueryUrl(){\r\n return this.BASE_URL + '/api/freeschema-query';\r\n }\r\n\r\n // ========================================================================\r\n // TYPE BULK API ENDPOINTS\r\n // ========================================================================\r\n\r\n /**\r\n * Returns the URL for retrieving type concepts by character in bulk.\r\n * @returns {string} The bulk type concept retrieval API endpoint\r\n */\r\n static GetConceptConnectionByType(){\r\n return this.BASE_URL + '/api/get_type_concept_by_character_bulk';\r\n }\r\n\r\n // ========================================================================\r\n // OAUTH API ENDPOINTS\r\n // ========================================================================\r\n\r\n /**\r\n * Returns the URL for OAuth token requests.\r\n * @returns {string} The OAuth token API endpoint\r\n */\r\n static OAuthTokenUrl(){\r\n return this.BASE_URL + '/api/oauth/token';\r\n }\r\n\r\n /**\r\n * Returns the URL for OAuth token refresh requests.\r\n * @returns {string} The OAuth token refresh API endpoint\r\n */\r\n static OAuthRefreshUrl(){\r\n return this.BASE_URL + '/api/oauth/refresh';\r\n }\r\n\r\n\r\n\r\n\r\n}","/**\r\n * @fileoverview BinaryCharacterTree module providing self-balancing AVL tree for concept storage by character value.\r\n * This module implements an AVL tree structure for efficient concept retrieval using string-based keys\r\n * with support for variant nodes (multiple concepts with the same character value).\r\n * @module DataStructures/BinaryCharacterTree\r\n */\r\n\r\nimport { Concept } from \"../DataStructures/Concept\";\r\nimport { IdentifierFlags } from \"./IdentifierFlags\";\r\nimport { Node } from \"./Node\";\r\n\r\n/**\r\n * Self-balancing AVL binary tree for storing and retrieving concepts by their character value.\r\n * Supports multiple concepts with the same character value through variant nodes.\r\n * Provides O(log n) time complexity for insertions, deletions, and lookups.\r\n *\r\n * @class BinaryCharacterTree\r\n * @example\r\n * ```typescript\r\n * // Add a concept to the tree\r\n * BinaryCharacterTree.addConceptToTree(myConcept);\r\n *\r\n * // Retrieve a concept by character value\r\n * const node = BinaryCharacterTree.getNodeFromTree(\"Apple\");\r\n * if (node) {\r\n * console.log(\"Found:\", node.value.id);\r\n * }\r\n *\r\n * // Get concept by character and type\r\n * const specificNode = await BinaryCharacterTree.getCharacterAndTypeFromTree(\"Apple\", 5);\r\n * ```\r\n *\r\n * @remarks\r\n * This class uses static methods and maintains a single root node for the entire tree.\r\n * When multiple concepts share the same character value, they are stored as variants.\r\n */\r\nexport class BinaryCharacterTree{\r\n /** Root node of the character-based binary tree, null if tree is empty */\r\n static characterRoot: Node | null = null;\r\n\r\n\r\n /**\r\n * Waits for the character data loading flag to be set before proceeding.\r\n * Used for synchronization when loading initial data.\r\n *\r\n * @returns {Promise<string>} Resolves with \"done\" when data is loaded, rejects with \"not\" after 25 seconds\r\n *\r\n * @example\r\n * ```typescript\r\n * try {\r\n * await BinaryCharacterTree.waitForDataToLoad();\r\n * console.log(\"Character data loaded\");\r\n * } catch (error) {\r\n * console.log(\"Character data load timeout\");\r\n * }\r\n * ```\r\n *\r\n * @remarks\r\n * Uses IdentifierFlags.isCharacterLoaded to determine when data is ready.\r\n * Times out after 25 seconds to prevent infinite waiting.\r\n */\r\n static async waitForDataToLoad(){\r\n return new Promise((resolve,reject) => {\r\n this.checkFlag(resolve);\r\n setTimeout(()=>{\r\n reject(\"not\")},25000);\r\n });\r\n }\r\n\r\n\r\n /**\r\n * Recursively checks if the character data loaded flag is set.\r\n * Internal helper method for waitForDataToLoad.\r\n *\r\n * @param {any} resolve - Promise resolve function\r\n *\r\n * @remarks\r\n * Checks IdentifierFlags.isCharacterLoaded every 1000ms until it's true.\r\n * This is an internal method used by waitForDataToLoad.\r\n */\r\n static checkFlag(resolve:any){\r\n\r\n if(IdentifierFlags.isCharacterLoaded){\r\n return resolve(\"done\");\r\n }\r\n else{\r\n setTimeout(BinaryCharacterTree.checkFlag, 1000, resolve);\r\n }\r\n };\r\n /**\r\n * Adds a node to the character-based binary tree, maintaining AVL balance.\r\n * Supports adding variant nodes for concepts with the same character value.\r\n *\r\n * @param {Node} node - The node to add to the tree\r\n * @returns {Promise<Node>} The new root node after insertion and balancing\r\n *\r\n * @example\r\n * ```typescript\r\n * const node = new Node(\"Apple\", myConcept, null, null);\r\n * await BinaryCharacterTree.addNodeToTree(node);\r\n * ```\r\n *\r\n * @remarks\r\n * If the tree is empty, the node becomes the root.\r\n * If a node with the same character value exists, the new concept is added as a variant.\r\n */\r\n static async addNodeToTree(node:Node){\r\n if(this.characterRoot == null){\r\n this.characterRoot = node;\r\n return this.characterRoot;\r\n }\r\n else{\r\n this.characterRoot = this.characterRoot.addCharacterNode(node,this.characterRoot,this.characterRoot.height);\r\n }\r\n return this.characterRoot;\r\n }\r\n\r\n /**\r\n * Removes a specific concept from a character node by character value and concept ID.\r\n *\r\n * @param {string} character - The character value to search for\r\n * @param {number} id - The concept ID to remove\r\n *\r\n * @example\r\n * ```typescript\r\n * await BinaryCharacterTree.removeNodeByCharacter(\"Apple\", 123);\r\n * ```\r\n *\r\n * @remarks\r\n * If multiple concepts share the same character value, only the one with matching ID is removed.\r\n * Does nothing if the tree is empty.\r\n */\r\n static async removeNodeByCharacter(character:string, id:number){\r\n if(this.characterRoot){\r\n this.characterRoot.removeNodeWithVariants(this.characterRoot,character,id);\r\n }\r\n }\r\n\r\n\r\n\r\n /**\r\n * Counts the total number of nodes in the character tree.\r\n *\r\n * @returns {number} The total count of nodes in the tree\r\n *\r\n * @example\r\n * ```typescript\r\n * const nodeCount = BinaryCharacterTree.countNumberOfNodes();\r\n * console.log(`Tree contains ${nodeCount} character nodes`);\r\n * ```\r\n *\r\n * @remarks\r\n * Recursively traverses the entire tree to count nodes.\r\n * Returns 0 if the tree is empty.\r\n */\r\n static countNumberOfNodes(){\r\n if(this.characterRoot){\r\n return this.characterRoot.countNodeBelow(this.characterRoot);\r\n\r\n }\r\n return 0;\r\n }\r\n\r\n /**\r\n * Convenience method to add a concept to the character tree.\r\n *\r\n * @param {Concept} concept - The concept to add to the tree\r\n *\r\n * @example\r\n * ```typescript\r\n * BinaryCharacterTree.addConceptToTree(myConcept);\r\n * ```\r\n *\r\n * @remarks\r\n * Only adds concepts with non-empty character values.\r\n * Creates a node with the concept's character value as the key.\r\n */\r\n static addConceptToTree(concept:Concept){\r\n if(concept.characterValue != \"\"){\r\n var node: Node = new Node(concept.characterValue, concept, null, null);\r\n this.addNodeToTree(node);\r\n }\r\n\r\n }\r\n\r\n /**\r\n * Retrieves a node from the tree by its character value.\r\n *\r\n * @param {string} value - The character value to search for\r\n * @returns {Node | null} The node if found, null otherwise\r\n *\r\n * @example\r\n * ```typescript\r\n * const node = BinaryCharacterTree.getNodeFromTree(\"Apple\");\r\n * if (node) {\r\n * const concept = node.value as Concept;\r\n * console.log(concept.id);\r\n * }\r\n * ```\r\n *\r\n * @remarks\r\n * Uses binary search for O(log n) time complexity.\r\n * Returns the main node; access variants through node.variants property.\r\n */\r\n static getNodeFromTree(value:string){\r\n if(this.characterRoot){\r\n var Node = this.characterRoot.getCharacterFromNode(value, this.characterRoot);\r\n return Node;\r\n }\r\n return this.characterRoot;\r\n }\r\n\r\n /**\r\n * Retrieves a node from the tree by its character value (updated version).\r\n * Currently identical to getNodeFromTree.\r\n *\r\n * @param {string} value - The character value to search for\r\n * @returns {Node | null} The node if found, null otherwise\r\n *\r\n * @example\r\n * ```typescript\r\n * const node = BinaryCharacterTree.getNodeFromTreeUpdated(\"Apple\");\r\n * ```\r\n *\r\n * @remarks\r\n * This method may be deprecated or merged with getNodeFromTree in future versions.\r\n */\r\n static getNodeFromTreeUpdated(value:string){\r\n if(this.characterRoot){\r\n var Node = this.characterRoot.getCharacterFromNode(value, this.characterRoot);\r\n return Node;\r\n }\r\n return this.characterRoot;\r\n }\r\n\r\n /**\r\n * Retrieves a node matching both character value and type ID.\r\n * Searches through variants to find the specific type match.\r\n *\r\n * @param {string} value - The character value to search for\r\n * @param {number} typeId - The type ID to filter by\r\n * @returns {Promise<Node | null>} The node matching both criteria, null if not found\r\n *\r\n * @example\r\n * ```typescript\r\n * const node = await BinaryCharacterTree.getCharacterAndTypeFromTree(\"Apple\", 5);\r\n * if (node) {\r\n * console.log(\"Found Apple of type 5\");\r\n * }\r\n * ```\r\n *\r\n * @remarks\r\n * First finds the character node, then searches through variants for matching type.\r\n * Returns null if no match is found.\r\n */\r\n static async getCharacterAndTypeFromTree(value:string, typeId: number){\r\n\r\n // try{\r\n // var data = await this.waitForDataToLoad();\r\n // }\r\n // catch(exception){\r\n // return null;\r\n // }\r\n if(this.characterRoot){\r\n var Node = this.characterRoot.getFromNodeWithCharacterAndType(value, typeId,this.characterRoot);\r\n return Node;\r\n } \r\n return this.characterRoot;\r\n }\r\n\r\n /**\r\n * Retrieves a node matching both character value and category ID.\r\n * Searches through variants to find the specific category match.\r\n *\r\n * @param {string} value - The character value to search for\r\n * @param {number} categoryId - The category ID to filter by\r\n * @returns {Promise<Node | null>} The node matching both criteria, null if not found\r\n *\r\n * @example\r\n * ```typescript\r\n * const node = await BinaryCharacterTree.getCharacterAndCategoryFromTree(\"Apple\", 3);\r\n * if (node) {\r\n * console.log(\"Found Apple in category 3\");\r\n * }\r\n * ```\r\n *\r\n * @remarks\r\n * First finds the character node, then searches through variants for matching category.\r\n * Returns null if no match is found.\r\n */\r\n static async getCharacterAndCategoryFromTree(value:string, categoryId: number){\r\n\r\n // try{\r\n // var data = await this.waitForDataToLoad();\r\n // }\r\n // catch(exception){\r\n // return null;\r\n // }\r\n if(this.characterRoot){\r\n var Node = this.characterRoot.getFromNodeWithCharacterAndCategory(value, categoryId,this.characterRoot);\r\n return Node;\r\n } \r\n return this.characterRoot;\r\n }\r\n\r\n\r\n \r\n\r\n\r\n /**\r\n * Removes a concept from the character tree by its ID.\r\n *\r\n * @param {number} id - The concept ID to remove\r\n *\r\n * @example\r\n * ```typescript\r\n * BinaryCharacterTree.removeConceptCharacter(123);\r\n * ```\r\n *\r\n * @remarks\r\n * After removal, the tree is automatically rebalanced to maintain AVL properties.\r\n * Does nothing if the tree is empty.\r\n */\r\n static removeConceptCharacter(id:number){\r\n if(this.characterRoot){\r\n this.characterRoot = this.characterRoot.removeNode(this.characterRoot,id);\r\n\r\n }\r\n }\r\n\r\n}","/**\r\n * @fileoverview BinaryTree module providing self-balancing AVL tree for concept storage by ID.\r\n * This module implements an AVL (Adelson-Velsky and Landis) tree structure for efficient\r\n * concept retrieval with O(log n) time complexity.\r\n * @module DataStructures/BinaryTree\r\n */\r\n\r\nimport { BinaryCharacterTree } from \"./BinaryCharacterTree\";\r\nimport { Concept } from \"../DataStructures/Concept\";\r\nimport { Node } from \"./Node\";\r\nimport { IdentifierFlags } from \"./IdentifierFlags\";\r\n\r\n/**\r\n * Self-balancing AVL binary tree for storing and retrieving concepts by their numeric ID.\r\n * Provides O(log n) time complexity for insertions, deletions, and lookups.\r\n *\r\n * @class BinaryTree\r\n * @example\r\n * ```typescript\r\n * // Add a concept to the tree\r\n * BinaryTree.addConceptToTree(myConcept);\r\n *\r\n * // Retrieve a concept by ID\r\n * const node = await BinaryTree.getNodeFromTree(123);\r\n * if (node) {\r\n * console.log(\"Found:\", node.value.characterValue);\r\n * }\r\n *\r\n * // Count all nodes\r\n * const count = BinaryTree.countNumberOfNodes();\r\n * ```\r\n *\r\n * @remarks\r\n * This class uses static methods and maintains a single root node for the entire tree.\r\n * The tree automatically balances itself using AVL rotations to maintain optimal search performance.\r\n */\r\nexport class BinaryTree{\r\n /** Root node of the binary tree, null if tree is empty */\r\n static root: Node | null = null;\r\n\r\n /**\r\n * Adds a node to the binary tree, maintaining AVL balance.\r\n *\r\n * @param {Node} node - The node to add to the tree\r\n * @returns {Node} The new root node after insertion and balancing\r\n *\r\n * @example\r\n * ```typescript\r\n * const node = new Node(123, myConcept, null, null);\r\n * BinaryTree.addNodeToTree(node);\r\n * ```\r\n *\r\n * @remarks\r\n * If the tree is empty, the node becomes the root.\r\n * Otherwise, the node is inserted and the tree is automatically balanced.\r\n */\r\n static addNodeToTree(node:Node){\r\n if(this.root == null){\r\n this.root = node;\r\n return this.root;\r\n }\r\n else{\r\n this.root = this.root.addNode(node,this.root,this.root.height);\r\n }\r\n }\r\n\r\n /**\r\n * Waits for the data loading flag to be set before proceeding.\r\n * Used for synchronization when loading initial data.\r\n *\r\n * @returns {Promise<string>} Resolves with \"done\" when data is loaded, rejects with \"not\" after 25 seconds\r\n *\r\n * @example\r\n * ```typescript\r\n * try {\r\n * await BinaryTree.waitForDataToLoad();\r\n * console.log(\"Data loaded successfully\");\r\n * } catch (error) {\r\n * console.log(\"Data load timeout\");\r\n * }\r\n * ```\r\n *\r\n * @remarks\r\n * Uses IdentifierFlags.isDataLoaded to determine when data is ready.\r\n * Times out after 25 seconds to prevent infinite waiting.\r\n */\r\n static async waitForDataToLoad(){\r\n return new Promise((resolve,reject) => {\r\n this.checkFlag(resolve);\r\n setTimeout(()=>{\r\n reject(\"not\")},25000);\r\n });\r\n }\r\n\r\n\r\n /**\r\n * Recursively checks if the data loaded flag is set.\r\n * Internal helper method for waitForDataToLoad.\r\n *\r\n * @param {any} resolve - Promise resolve function\r\n *\r\n * @remarks\r\n * Checks IdentifierFlags.isDataLoaded every 1000ms until it's true.\r\n * This is an internal method used by waitForDataToLoad.\r\n */\r\n static checkFlag(resolve:any){\r\n\r\n if(IdentifierFlags.isDataLoaded){\r\n return resolve(\"done\");\r\n }\r\n else{\r\n setTimeout(BinaryTree.checkFlag, 1000, resolve);\r\n }\r\n };\r\n\r\n /**\r\n * Convenience method to add a concept to both the ID tree and character tree.\r\n *\r\n * @param {Concept} concept - The concept to add to the tree\r\n *\r\n * @example\r\n * ```typescript\r\n * BinaryTree.addConceptToTree(myConcept);\r\n * ```\r\n *\r\n * @remarks\r\n * Creates a node with the concept's ID as the key and adds it to this tree.\r\n * Also creates a node with the concept's character value and adds it to BinaryCharacterTree.\r\n */\r\n static addConceptToTree(concept:Concept){\r\n var node: Node = new Node(concept.id, concept, null, null);\r\n var characterNode: Node = new Node(concept.characterValue, concept, null,null);\r\n BinaryCharacterTree.addNodeToTree(characterNode);\r\n this.addNodeToTree(node);\r\n }\r\n\r\n /**\r\n * Retrieves a node from the tree by its ID.\r\n *\r\n * @param {number} id - The concept ID to search for\r\n * @returns {Promise<Node | null>} The node if found, null otherwise\r\n *\r\n * @example\r\n * ```typescript\r\n * const node = await BinaryTree.getNodeFromTree(123);\r\n * if (node) {\r\n * const concept = node.value as Concept;\r\n * console.log(concept.characterValue);\r\n * }\r\n * ```\r\n *\r\n * @remarks\r\n * Uses binary search for O(log n) time complexity.\r\n * Returns null if the tree is empty or the node is not found.\r\n */\r\n static async getNodeFromTree(id:number){\r\n\r\n // try{\r\n // var data = await this.waitForDataToLoad();\r\n // }\r\n // catch(exception){\r\n // return null;\r\n // }\r\n if(this.root){\r\n var Node = this.root.getFromNode(id, this.root);\r\n return Node;\r\n }\r\n return null;\r\n }\r\n \r\n\r\n /**\r\n * Removes a node from the tree by its ID.\r\n *\r\n * @param {number} id - The concept ID to remove\r\n *\r\n * @example\r\n * ```typescript\r\n * await BinaryTree.removeNodeFromTree(123);\r\n * ```\r\n *\r\n * @remarks\r\n * After removal, the tree is automatically rebalanced to maintain AVL properties.\r\n * Does nothing if the tree is empty.\r\n */\r\n static async removeNodeFromTree(id:number){\r\n if(this.root){\r\n this.root = this.root.removeNode(this.root,id);\r\n }\r\n }\r\n\r\n\r\n\r\n\r\n /**\r\n * Counts the total number of nodes in the tree.\r\n *\r\n * @returns {number} The total count of nodes in the tree\r\n *\r\n * @example\r\n * ```typescript\r\n * const nodeCount = BinaryTree.countNumberOfNodes();\r\n * console.log(`Tree contains ${nodeCount} concepts`);\r\n * ```\r\n *\r\n * @remarks\r\n * Recursively traverses the entire tree to count nodes.\r\n * Returns 0 if the tree is empty.\r\n */\r\n static countNumberOfNodes(){\r\n if(this.root){\r\n return this.root.countNodeBelow(this.root);\r\n\r\n }\r\n return 0;\r\n }\r\n\r\n\r\n\r\n\r\n\r\n}","/**\r\n * @fileoverview BinaryTypeTree module providing self-balancing AVL tree for concept storage by type ID.\r\n * This module implements an AVL tree structure for efficient concept retrieval by type\r\n * with support for variant nodes (multiple concepts of the same type).\r\n * @module DataStructures/BinaryTypeTree\r\n */\r\n\r\nimport { Concept } from \"../DataStructures/Concept\";\r\nimport { CreateDefaultConcept } from \"../Services/CreateDefaultConcept\";\r\nimport { IdentifierFlags } from \"./IdentifierFlags\";\r\nimport { Node } from \"./Node\";\r\n\r\n/**\r\n * Self-balancing AVL binary tree for storing and retrieving concepts by their type ID.\r\n * Supports multiple concepts with the same type through variant nodes.\r\n * Provides O(log n) time complexity for insertions, deletions, and lookups.\r\n *\r\n * @class BinaryTypeTree\r\n * @example\r\n * ```typescript\r\n * // Add a concept to the type tree\r\n * BinaryTypeTree.addConceptToTree(myConcept);\r\n *\r\n * // Get all concepts of a specific type\r\n * const concepts = BinaryTypeTree.getTypeVariantsFromTree(5);\r\n * console.log(`Found ${concepts.length} concepts of type 5`);\r\n *\r\n * // Get concepts by type and user\r\n * const userConcepts = await BinaryTypeTree.getTypeVariantsFromTreeWithUserId(5, 1);\r\n * ```\r\n *\r\n * @remarks\r\n * This class uses static methods and maintains a single root node for the entire tree.\r\n * Multiple concepts with the same type ID are stored as variants for efficient batch retrieval.\r\n */\r\nexport class BinaryTypeTree{\r\n /** Root node of the type-based binary tree, null if tree is empty */\r\n static typeRoot: Node | null = null;\r\n\r\n /**\r\n * Adds a node to the type-based binary tree, maintaining AVL balance.\r\n * Supports adding variant nodes for concepts with the same type ID.\r\n *\r\n * @param {Node} node - The node to add to the tree\r\n * @returns {Promise<Node>} The new root node after insertion and balancing\r\n *\r\n * @example\r\n * ```typescript\r\n * const node = new Node(5, myConcept, null, null);\r\n * await BinaryTypeTree.addNodeToTree(node);\r\n * ```\r\n *\r\n * @remarks\r\n * If the tree is empty, the node becomes the root.\r\n * If a node with the same type ID exists, the new concept is added as a variant.\r\n */\r\n static async addNodeToTree(node:Node){\r\n if(this.typeRoot == null){\r\n this.typeRoot = node;\r\n return this.typeRoot;\r\n }\r\n else{\r\n this.typeRoot = this.typeRoot.addTypeNode(node,this.typeRoot,this.typeRoot.height);\r\n }\r\n return this.typeRoot;\r\n }\r\n\r\n /**\r\n * Convenience method to add a concept to the type tree.\r\n *\r\n * @param {Concept} concept - The concept to add to the tree\r\n *\r\n * @example\r\n * ```typescript\r\n * BinaryTypeTree.addConceptToTree(myConcept);\r\n * ```\r\n *\r\n * @remarks\r\n * Only adds concepts with valid type IDs (typeId != 0).\r\n * Creates a node with the concept's type ID as the key.\r\n */\r\n static addConceptToTree(concept:Concept){\r\n if(concept.typeId != 0){\r\n var node: Node = new Node(concept.typeId, concept, null, null);\r\n this.addNodeToTree(node);\r\n }\r\n }\r\n\r\n /**\r\n * Removes a specific concept from a type node by type ID and concept ID.\r\n *\r\n * @param {number} typeId - The type ID to search for\r\n * @param {number} id - The concept ID to remove\r\n *\r\n * @example\r\n * ```typescript\r\n * BinaryTypeTree.removeTypeConcept(5, 123);\r\n * ```\r\n *\r\n * @remarks\r\n * If multiple concepts share the same type ID, only the one with matching concept ID is removed.\r\n * Does nothing if the tree is empty.\r\n */\r\n static removeTypeConcept(typeId:number,id:number){\r\n if(this.typeRoot){\r\n this.typeRoot = this.typeRoot.removeNodeWithVariants(this.typeRoot,typeId,id);\r\n\r\n }\r\n }\r\n\r\n\r\n\r\n\r\n /**\r\n * Retrieves a node from the tree by its type ID.\r\n *\r\n * @param {number} id - The type ID to search for\r\n * @returns {Node | null} The node if found, null otherwise\r\n *\r\n * @example\r\n * ```typescript\r\n * const node = BinaryTypeTree.getNodeFromTree(5);\r\n * if (node) {\r\n * console.log(\"Found type node with\", node.variants.length, \"variants\");\r\n * }\r\n * ```\r\n *\r\n * @remarks\r\n * Uses binary search for O(log n) time complexity.\r\n * Returns the main node; access all concepts of this type through node.value and node.variants.\r\n */\r\n static getNodeFromTree(id:number){\r\n if(this.typeRoot){\r\n var Node = this.typeRoot.getFromNode(id, this.typeRoot);\r\n return Node;\r\n }\r\n return this.typeRoot;\r\n }\r\n\r\n /**\r\n * Retrieves all concepts of a specific type ID as an array.\r\n * Includes both the main concept and all variants.\r\n *\r\n * @param {number} typeId - The type ID to search for\r\n * @returns {Concept[]} Array of all concepts with the specified type ID\r\n *\r\n * @example\r\n * ```typescript\r\n * const concepts = BinaryTypeTree.getTypeVariantsFromTree(5);\r\n * concepts.forEach(concept => {\r\n * console.log(concept.characterValue);\r\n * });\r\n * ```\r\n *\r\n * @remarks\r\n * Returns an empty array if no concepts of the type are found.\r\n * Useful for batch operations on all concepts of a type.\r\n */\r\n static getTypeVariantsFromTree(typeId:number){\r\n\r\n\r\n var Node = this.getNodeFromTree(typeId);\r\n var concepts : Concept[] = [];\r\n \r\n if(Node){\r\n concepts.push(Node?.value);\r\n for(let i=0; i< Node.variants.length; i++){\r\n concepts.push(Node.variants[i].value);\r\n }\r\n \r\n return concepts;\r\n }\r\n\r\n\r\n }\r\n\r\n /**\r\n * Waits for the type data loading flag to be set before proceeding.\r\n * Used for synchronization when loading initial data.\r\n *\r\n * @returns {Promise<string>} Resolves with \"done\" when data is loaded, rejects with \"not\" after 25 seconds\r\n *\r\n * @example\r\n * ```typescript\r\n * try {\r\n * await BinaryTypeTree.waitForDataToLoad();\r\n * console.log(\"Type data loaded\");\r\n * } catch (error) {\r\n * console.log(\"Type data load timeout\");\r\n * }\r\n * ```\r\n *\r\n * @remarks\r\n * Uses IdentifierFlags.isTypeLoaded to determine when data is ready.\r\n * Times out after 25 seconds to prevent infinite waiting.\r\n */\r\n static async waitForDataToLoad(){\r\n return new Promise((resolve,reject) => {\r\n this.checkFlag(resolve);\r\n setTimeout(()=>{\r\n reject(\"not\")},25000);\r\n });\r\n }\r\n\r\n\r\n /**\r\n * Recursively checks if the type data loaded flag is set.\r\n * Internal helper method for waitForDataToLoad.\r\n *\r\n * @param {any} resolve - Promise resolve function\r\n *\r\n * @remarks\r\n * Checks IdentifierFlags.isTypeLoaded every 1000ms until it's true.\r\n * This is an internal method used by waitForDataToLoad.\r\n */\r\n static checkFlag(resolve:any){\r\n\r\n if(IdentifierFlags.isTypeLoaded){\r\n return resolve(\"done\");\r\n }\r\n else{\r\n setTimeout(BinaryTypeTree.checkFlag, 1000, resolve);\r\n }\r\n };\r\n\r\n\r\n /**\r\n * Retrieves all concepts of a specific type ID filtered by user ID.\r\n * Includes both the main concept and all variants belonging to the specified user.\r\n *\r\n * @param {number} typeId - The type ID to search for\r\n * @param {number} userId - The user ID to filter by\r\n * @returns {Promise<Concept[]>} Array of concepts matching both type and user\r\n *\r\n * @example\r\n * ```typescript\r\n * const userConcepts = await BinaryTypeTree.getTypeVariantsFromTreeWithUserId(5, 1);\r\n * console.log(`User 1 has ${userConcepts.length} concepts of type 5`);\r\n * ```\r\n *\r\n * @remarks\r\n * Returns an empty array if no matching concepts are found.\r\n * Automatically deduplicates concepts with the same ID.\r\n */\r\n static async getTypeVariantsFromTreeWithUserId(typeId:number, userId:number){\r\n var concepts : Concept[] = [];\r\n // try{\r\n // var data = await this.waitForDataToLoad();\r\n // }\r\n // catch(exception){\r\n // return concepts;\r\n // }\r\n var Node = this.getNodeFromTree(typeId);\r\n \r\n if(Node){\r\n if(Node.value.userId == userId ){\r\n concepts.push(Node?.value);\r\n }\r\n for(let i=0; i< Node.variants.length; i++){\r\n if(Node.variants[i].value.userId == userId ){\r\n var isPresent = false;\r\n\r\n for(let j=0; j<concepts.length;j++){\r\n if(concepts[j].id == Node.variants[i].value.id){\r\n isPresent = true;\r\n }\r\n }\r\n if(!isPresent){\r\n concepts.push(Node.variants[i].value);\r\n\r\n }\r\n\r\n }\r\n }\r\n }\r\n return concepts;\r\n }\r\n\r\n /**\r\n * Retrieves a concept matching both type ID and character value.\r\n * Searches through all concepts of the type for a matching character value.\r\n *\r\n * @param {string} characterValue - The character value to search for\r\n * @param {number} typeId - The type ID to filter by\r\n * @returns {Promise<Concept>} The concept matching both criteria, or a default concept if not found\r\n *\r\n * @example\r\n * ```typescript\r\n * const concept = await BinaryTypeTree.getTypeVariantsWithCharacterValue(\"Apple\", 5);\r\n * if (concept.id !== 0) {\r\n * console.log(\"Found Apple of type 5\");\r\n * }\r\n * ```\r\n *\r\n * @remarks\r\n * Returns a default concept (id = 0) if no match is found.\r\n * More efficient than searching by character first when type is known.\r\n */\r\n static async getTypeVariantsWithCharacterValue( characterValue:string,typeId:number,){\r\n let concept = CreateDefaultConcept();\r\n // try{\r\n // var data = await this.waitForDataToLoad();\r\n // }\r\n // catch(exception){\r\n // return concept;\r\n // }\r\n var Node = this.getNodeFromTree(typeId);\r\n if(Node){\r\n if(Node.value.characterValue == characterValue ){\r\n concept = Node.value;\r\n }\r\n for(let i=0; i< Node.variants.length; i++){\r\n if(Node.variants[i].value.characterValue == characterValue ){\r\n concept = Node.variants[i].value;\r\n }\r\n }\r\n }\r\n return concept;\r\n }\r\n\r\n /**\r\n * Counts the total number of nodes in the type tree.\r\n *\r\n * @returns {number} The total count of nodes in the tree\r\n *\r\n * @example\r\n * ```typescript\r\n * const nodeCount = BinaryTypeTree.countNumberOfNodes();\r\n * console.log(`Tree contains ${nodeCount} type nodes`);\r\n * ```\r\n *\r\n * @remarks\r\n * Recursively traverses the entire tree to count nodes.\r\n * Returns 0 if the tree is empty.\r\n */\r\n static countNumberOfNodes(){\r\n if(this.typeRoot){\r\n return this.typeRoot.countNodeBelow(this.typeRoot);\r\n\r\n }\r\n return 0;\r\n }\r\n\r\n\r\n\r\n\r\n}","/**\r\n * @fileoverview Configuration class for CCS initialization.\r\n * This module provides a clean way to manage optional CCS configuration parameters.\r\n * @module DataStructures/CCSConfig\r\n */\r\n\r\n/**\r\n * Configuration class for CCS initialization.\r\n *\r\n * This class holds all optional configuration parameters for the CCS library,\r\n * keeping the init() function clean with only essential parameters.\r\n *\r\n * @class CCSConfig\r\n *\r\n * @example\r\n * ```typescript\r\n * const config = new CCSConfig({\r\n * aiUrl: \"https://ai.example.com\",\r\n * accessToken: \"jwt-token\",\r\n * enableAi: true,\r\n * flags: { logApplication: true },\r\n * storagePath: \"./data/ccs/\"\r\n * });\r\n *\r\n * await init(\r\n * \"https://api.example.com\",\r\n * \"http://localhost:5001\",\r\n * \"MyApp\",\r\n * config\r\n * );\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Minimal configuration with OAuth\r\n * const config = new CCSConfig({\r\n * clientId: \"101084838\",\r\n * clientSecret: \"your-secret\"\r\n * });\r\n *\r\n * await init(\"https://api.example.com\", \"\", \"MyApp\", config);\r\n * ```\r\n */\r\nexport class CCSConfig {\r\n /** URL for the AI service. Defaults to \"https://ai.freeschema.com\" */\r\n aiUrl: string = \"https://ai.freeschema.com\";\r\n\r\n /** JWT bearer token for authentication. Can be set later via updateAccessToken() */\r\n accessToken: string = \"\";\r\n\r\n /** Whether to enable AI features. Defaults to true */\r\n enableAi: boolean = true;\r\n\r\n /**\r\n * Dictionary of feature flags for controlling CCS behavior.\r\n * Available flags:\r\n * - logApplication: Enable application-level logging\r\n * - logPackage: Enable package-level logging\r\n * - accessTracker: Enable access tracking\r\n * - isTest: Enable test mode\r\n */\r\n flags?: Record<string, boolean>;\r\n\r\n /**\r\n * Dictionary of additional parameters.\r\n * Example: { logserver: \"https://logs.example.com\" }\r\n */\r\n parameters?: Record<string, string>;\r\n\r\n /** Path for storing local data (ID counters, cached data, etc.) */\r\n storagePath?: string;\r\n\r\n /** OAuth client ID for authentication */\r\n clientId?: string;\r\n\r\n /** OAuth client secret for authentication */\r\n clientSecret?: string;\r\n\r\n /** Application name for OAuth and logging purposes */\r\n applicationName?: string;\r\n\r\n /**\r\n * Creates a new CCSConfig instance.\r\n *\r\n * @param options - Partial configuration options to override defaults\r\n *\r\n * @example\r\n * ```typescript\r\n * // Use default values\r\n * const config = new CCSConfig();\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Override specific values\r\n * const config = new CCSConfig({\r\n * aiUrl: \"https://custom-ai.example.com\",\r\n * enableAi: false,\r\n * clientId: \"123456\",\r\n * clientSecret: \"secret\",\r\n * flags: {\r\n * logApplication: true,\r\n * accessTracker: true\r\n * }\r\n * });\r\n * ```\r\n */\r\n constructor(options?: Partial<CCSConfig>) {\r\n if (options) {\r\n Object.assign(this, options);\r\n }\r\n }\r\n\r\n /**\r\n * Returns true if OAuth credentials are configured.\r\n * @returns {boolean} Whether both clientId and clientSecret are set\r\n */\r\n hasOAuthCredentials(): boolean {\r\n return !!(this.clientId && this.clientSecret);\r\n }\r\n\r\n /**\r\n * Returns true if an access token is configured.\r\n * @returns {boolean} Whether accessToken is set\r\n */\r\n hasAccessToken(): boolean {\r\n return this.accessToken !== \"\";\r\n }\r\n\r\n /**\r\n * Get a specific flag value with a default fallback.\r\n *\r\n * @param flagName - The name of the flag to retrieve\r\n * @param defaultValue - Default value if flag is not set\r\n * @returns {boolean} The flag value or default\r\n *\r\n * @example\r\n * ```typescript\r\n * const config = new CCSConfig({\r\n * flags: { logApplication: true }\r\n * });\r\n * config.getFlag('logApplication', false); // returns true\r\n * config.getFlag('unknownFlag', false); // returns false\r\n * ```\r\n */\r\n getFlag(flagName: string, defaultValue: boolean = false): boolean {\r\n return this.flags?.[flagName] ?? defaultValue;\r\n }\r\n\r\n /**\r\n * Get a specific parameter value with a default fallback.\r\n *\r\n * @param paramName - The name of the parameter to retrieve\r\n * @param defaultValue - Default value if parameter is not set\r\n * @returns {string} The parameter value or default\r\n *\r\n * @example\r\n * ```typescript\r\n * const config = new CCSConfig({\r\n * parameters: { logserver: \"https://logs.example.com\" }\r\n * });\r\n * config.getParameter('logserver', ''); // returns \"https://logs.example.com\"\r\n * config.getParameter('unknown', ''); // returns \"\"\r\n * ```\r\n */\r\n getParameter(paramName: string, defaultValue: string = \"\"): string {\r\n return this.parameters?.[paramName] ?? defaultValue;\r\n }\r\n\r\n /**\r\n * Set a flag value.\r\n *\r\n * @param flagName - The name of the flag to set\r\n * @param value - The boolean value to set\r\n *\r\n * @example\r\n * ```typescript\r\n * const config = new CCSConfig();\r\n * config.setFlag('logApplication', true);\r\n * ```\r\n */\r\n setFlag(flagName: string, value: boolean): void {\r\n if (!this.flags) {\r\n this.flags = {};\r\n }\r\n this.flags[flagName] = value;\r\n }\r\n\r\n /**\r\n * Set a parameter value.\r\n *\r\n * @param paramName - The name of the parameter to set\r\n * @param value - The string value to set\r\n *\r\n * @example\r\n * ```typescript\r\n * const config = new CCSConfig();\r\n * config.setParameter('logserver', 'https://logs.example.com');\r\n * ```\r\n */\r\n setParameter(paramName: string, value: string): void {\r\n if (!this.parameters) {\r\n this.parameters = {};\r\n }\r\n this.parameters[paramName] = value;\r\n }\r\n}\r\n","/**\r\n * @fileoverview Static repository for managing character data in the CCS-JS system.\r\n * @module DataStructures/CharacterRepository\r\n */\r\n\r\nimport { TheCharacter } from \"./TheCharacter\";\r\n\r\n/**\r\n * Manages a static collection of character entities with indexed storage and retrieval.\r\n *\r\n * @remarks\r\n * CharacterRepository provides a centralized, static repository for storing and retrieving\r\n * TheCharacter instances. Characters are stored in an array indexed by their ID for fast\r\n * access. The class also provides lookup functionality to find characters by their data value.\r\n *\r\n * This repository uses static methods and properties, meaning the character collection is\r\n * shared across all instances of the class. The instance method `name` is provided for\r\n * identification purposes only.\r\n *\r\n * @example\r\n * ```typescript\r\n * // Add a character to the repository\r\n * const char = new TheCharacter(1, \"A\", 100, 1, 200, 1, 300, 1, \"2025-10-30\", false);\r\n * CharacterRepository.AddCharacter(char);\r\n *\r\n * // Retrieve character by data value\r\n * const found = CharacterRepository.GetCharacter(\"A\");\r\n * if (found.id !== 0) {\r\n * console.log('Found character:', found.data);\r\n * }\r\n * ```\r\n */\r\nexport class CharacterRepository{\r\n /**\r\n * Descriptive name for this character repository.\r\n * @defaultValue \"character Repository\"\r\n */\r\n name: string;\r\n\r\n /**\r\n * Creates a new CharacterRepository instance.\r\n *\r\n * @remarks\r\n * While the class can be instantiated, the primary functionality is accessed\r\n * through static methods. Instances are mainly useful for accessing the descriptive\r\n * name property.\r\n *\r\n * @example\r\n * ```typescript\r\n * const repo = new CharacterRepository();\r\n * console.log(repo.name); // \"character Repository\"\r\n * ```\r\n */\r\n constructor(){\r\n this.name = \"character Repository\";\r\n }\r\n\r\n /**\r\n * Static array holding all character data indexed by character ID.\r\n *\r\n * @remarks\r\n * Characters are stored at index positions corresponding to their ID values.\r\n * This provides O(1) access time when retrieving characters by ID, but may\r\n * result in sparse arrays if character IDs are not sequential.\r\n *\r\n * This array should be managed through the static methods provided by the class.\r\n */\r\n static characterData:TheCharacter[] = [];\r\n\r\n /**\r\n * Adds a character to the repository, indexed by its ID.\r\n *\r\n * @param character - The character to add to the repository\r\n *\r\n * @remarks\r\n * The character is stored at the array index matching its ID value. If a character\r\n * with the same ID already exists, it will be overwritten. This indexed approach\r\n * allows for fast retrieval by ID but may create sparse arrays.\r\n *\r\n * @example\r\n * ```typescript\r\n * const char1 = new TheCharacter(1, \"A\", 100, 1, 200, 1, 300, 1, \"2025-10-30\", false);\r\n * const char2 = new TheCharacter(5, \"B\", 100, 1, 200, 1, 300, 1, \"2025-10-30\", false);\r\n *\r\n * CharacterRepository.AddCharacter(char1);\r\n * CharacterRepository.AddCharacter(char2);\r\n *\r\n * // char1 is at index 1, char2 is at index 5\r\n * console.log(CharacterRepository.characterData[1].data); // \"A\"\r\n * ```\r\n */\r\n static AddCharacter(character: TheCharacter){\r\n this.characterData[character.id] = character;\r\n }\r\n\r\n /**\r\n * Retrieves a character from the repository by matching its data value.\r\n *\r\n * @param value - The data string to search for\r\n * @returns The matching TheCharacter instance, or a default empty character if not found\r\n *\r\n * @remarks\r\n * Performs a linear search through the entire characterData array to find a character\r\n * whose `data` property matches the provided value. If no match is found, returns a\r\n * default TheCharacter instance with ID 0 and data \"0\".\r\n *\r\n * Note: The default character returned has all numeric fields set to 0, data set to \"0\",\r\n * and isNew set to false. Callers should check the ID to determine if a valid character\r\n * was found (a valid character should have a non-zero ID).\r\n *\r\n * @example\r\n * ```typescript\r\n * const char = new TheCharacter(1, \"A\", 100, 1, 200, 1, 300, 1, \"2025-10-30\", false);\r\n * CharacterRepository.AddCharacter(char);\r\n *\r\n * // Find existing character\r\n * const found = CharacterRepository.GetCharacter(\"A\");\r\n * console.log(found.id); // 1\r\n *\r\n * // Search for non-existent character\r\n * const notFound = CharacterRepository.GetCharacter(\"Z\");\r\n * console.log(notFound.id); // 0 (default)\r\n * console.log(notFound.data); // \"0\" (default)\r\n * ```\r\n */\r\n static GetCharacter(value: string){\r\n var theCharacter: TheCharacter = new TheCharacter(0,\"0\",0,0,0,0,0,0,\"0\",false);\r\n for(var i=0 ;i <this.characterData.length; i++){\r\n if(this.characterData[i].data == value){\r\n theCharacter = this.characterData[i];\r\n }\r\n }\r\n return theCharacter;\r\n }\r\n}","/**\r\n * @fileoverview Composition data structure for managing complex concept relationships.\r\n * This module provides the core Composition class for building and managing hierarchical\r\n * concept structures with caching and distributed system synchronization.\r\n * @module DataStructures/Composition/Composition\r\n */\r\n\r\nimport { recursiveFetchNew } from '../../Services/Composition/BuildComposition';\r\nimport { Connection } from '../../DataStructures/Connection';\r\nimport { Concept } from '../../DataStructures/Concept';\r\nimport { CreateDefaultConcept } from '../../Services/CreateDefaultConcept';\r\nimport { publishMessage } from '../../Services/Mqtt/publishMessage';\r\n\r\n/**\r\n * Represents a composition of concepts and their relationships.\r\n *\r\n * @remarks\r\n * A Composition is a hierarchical structure that combines multiple concepts through connections.\r\n * It supports caching for performance optimization and can synchronize updates across distributed systems\r\n * via MQTT messaging. Compositions can contain subcompositions for complex nested structures.\r\n *\r\n * @example\r\n * ```typescript\r\n * const composition = new Composition();\r\n * composition.id = 123;\r\n * composition.mainConcept = myConcept;\r\n * await composition.updateCache();\r\n * const data = composition.GetDataCache();\r\n * ```\r\n */\r\nexport class Composition {\r\n /**\r\n * Unique identifier for this composition.\r\n */\r\n id: number = 0\r\n\r\n /**\r\n * The primary concept at the root of this composition.\r\n * Defaults to a default concept if not set.\r\n */\r\n mainConcept: Concept = CreateDefaultConcept()\r\n\r\n /**\r\n * Array of connections between concepts in this composition.\r\n */\r\n connections: Connection[] = []\r\n\r\n /**\r\n * Array of all concepts included in this composition.\r\n */\r\n concepts: Concept[] = []\r\n\r\n /**\r\n * Array of IDs referencing nested subcompositions.\r\n */\r\n subcompositions: number[] = []\r\n\r\n /**\r\n * Cached composition data for performance optimization.\r\n * Stores the processed composition structure.\r\n */\r\n cached: any = {}\r\n\r\n /**\r\n * Updates the composition cache by recursively fetching related data.\r\n *\r\n * @returns A promise that resolves when the cache is updated\r\n *\r\n * @remarks\r\n * This method performs the following operations:\r\n * 1. Sets the mainConcept if not already set (by matching ID with concepts array)\r\n * 2. Recursively fetches all related concepts, connections, and subcompositions\r\n * 3. Stores the result in the cached property for fast retrieval\r\n *\r\n * @example\r\n * ```typescript\r\n * await composition.updateCache();\r\n * console.log(\"Cache updated:\", composition.cached);\r\n * ```\r\n */\r\n async updateCache() {\r\n if (this.mainConcept.id == 0)\r\n for (let i = 0; i < this.concepts.length; i++) {\r\n if (this.concepts[i].id == this.id) {\r\n this.mainConcept = this.concepts[i]\r\n }\r\n }\r\n let visitedConcepts: number[] = [];\r\n this.cached = await recursiveFetchNew(\r\n this.id,\r\n this.connections,\r\n this.concepts,\r\n this.subcompositions,\r\n visitedConcepts\r\n )\r\n }\r\n\r\n /**\r\n * Publishes a composition update message to the distributed system.\r\n *\r\n * @remarks\r\n * This method broadcasts an update notification via MQTT to inform other\r\n * system components that this composition has been modified. Only publishes\r\n * if the composition has a valid (non-zero) ID.\r\n *\r\n * @example\r\n * ```typescript\r\n * composition.UpdateAcrossDistributedSystem();\r\n * // Other system nodes will receive the update notification\r\n * ```\r\n */\r\n UpdateAcrossDistributedSystem() {\r\n try {\r\n if (this.id != 0) {\r\n publishMessage('compositionUpdate', this.id?.toString())\r\n }\r\n } catch (ex) {\r\n console.log('Error while publishing message', ex)\r\n }\r\n }\r\n\r\n /**\r\n * Triggers a distributed system update notification.\r\n *\r\n * @remarks\r\n * This is a convenience method that calls UpdateAcrossDistributedSystem.\r\n * Indicates that the composition is being updated and needs to notify other system nodes.\r\n *\r\n * @example\r\n * ```typescript\r\n * composition.isUpdating();\r\n * ```\r\n */\r\n isUpdating() {\r\n this.UpdateAcrossDistributedSystem()\r\n }\r\n\r\n /**\r\n * Retrieves the cached composition data in a structured format.\r\n *\r\n * @returns An object containing the formatted cache data with the composition ID\r\n *\r\n * @remarks\r\n * The returned object has the following structure:\r\n * - `data`: An object keyed by the main concept's type characterValue\r\n * - `id`: The composition's ID\r\n *\r\n * @example\r\n * ```typescript\r\n * const cacheData = composition.GetDataCache();\r\n * console.log(\"Composition ID:\", cacheData.id);\r\n * console.log(\"Cached data:\", cacheData.data);\r\n * ```\r\n */\r\n GetDataCache() {\r\n const returnOutput: any = {}\r\n const mainString = this.mainConcept?.type?.characterValue ?? ''\r\n returnOutput[mainString] = this.cached\r\n const FinalReturn: any = {}\r\n FinalReturn['data'] = returnOutput\r\n FinalReturn['id'] = this.id\r\n return FinalReturn\r\n }\r\n}\r\n","/**\r\n * @fileoverview Binary tree data structure for managing compositions.\r\n * This module provides an efficient AVL tree implementation for storing and retrieving compositions.\r\n * @module DataStructures/Composition/CompositionBinaryTree\r\n */\r\n\r\nimport { Composition } from './Composition'\r\nimport { CompositionNode } from './CompositionNode'\r\n\r\n/**\r\n * Binary tree data structure for managing compositions with automatic expiration.\r\n *\r\n * @remarks\r\n * This class implements an AVL tree specifically designed for storing Composition objects.\r\n * Each node in the tree has an expiration time, allowing automatic cache invalidation.\r\n * The tree provides O(log n) operations for insert, search, and delete.\r\n *\r\n * @example\r\n * ```typescript\r\n * const composition = new Composition();\r\n * composition.id = 123;\r\n * CompositionBinaryTree.addCompositionToTree(composition);\r\n * const node = await CompositionBinaryTree.getNodeFromTree(123);\r\n * ```\r\n */\r\nexport class CompositionBinaryTree {\r\n /**\r\n * The root node of the composition binary tree.\r\n * Null if the tree is empty.\r\n */\r\n static root: CompositionNode | null = null\r\n\r\n /**\r\n * Adds a composition node to the binary tree.\r\n *\r\n * @param node - The CompositionNode to be added to the tree\r\n * @returns The root node after insertion\r\n *\r\n * @remarks\r\n * If the tree is empty, the provided node becomes the root.\r\n * Otherwise, the node is inserted using AVL tree balancing algorithm.\r\n *\r\n * @example\r\n * ```typescript\r\n * const node = new CompositionNode(123, composition, null, null);\r\n * CompositionBinaryTree.addNodeToTree(node);\r\n * ```\r\n */\r\n static addNodeToTree(node: CompositionNode) {\r\n if (this.root == null) {\r\n this.root = node\r\n return this.root\r\n } else {\r\n this.root = this.root.addNode(node, this.root, this.root.height)\r\n }\r\n }\r\n\r\n /**\r\n * Creates a node from a composition and adds it to the tree.\r\n *\r\n * @param composition - The Composition object to be added to the tree\r\n *\r\n * @remarks\r\n * This is a convenience method that wraps the composition in a CompositionNode\r\n * and adds it to the tree. The node is keyed by the composition's ID.\r\n *\r\n * @example\r\n * ```typescript\r\n * const composition = new Composition();\r\n * composition.id = 123;\r\n * CompositionBinaryTree.addCompositionToTree(composition);\r\n * ```\r\n */\r\n static addCompositionToTree(composition: Composition) {\r\n const node: CompositionNode = new CompositionNode(\r\n composition.id,\r\n composition,\r\n null,\r\n null,\r\n )\r\n this.addNodeToTree(node)\r\n }\r\n\r\n /**\r\n * Retrieves a composition node from the tree by its ID.\r\n *\r\n * @param id - The numeric ID of the composition to retrieve\r\n * @returns The CompositionNode if found and valid, null otherwise\r\n *\r\n * @remarks\r\n * This method performs a binary search through the tree.\r\n * The node's validity is checked during retrieval (expiration check).\r\n *\r\n * @example\r\n * ```typescript\r\n * const node = await CompositionBinaryTree.getNodeFromTree(123);\r\n * if (node) {\r\n * console.log(\"Found composition:\", node.value);\r\n * }\r\n * ```\r\n */\r\n static async getNodeFromTree(id: number) {\r\n if (this.root) {\r\n const Node = this.root.getFromNode(id, this.root)\r\n return Node\r\n }\r\n return null\r\n }\r\n\r\n /**\r\n * Removes a composition node from the tree by its ID.\r\n *\r\n * @param id - The numeric ID of the composition to remove\r\n *\r\n * @remarks\r\n * This method removes a node from the tree while maintaining AVL balance.\r\n * The tree is automatically rebalanced after removal.\r\n *\r\n * @example\r\n * ```typescript\r\n * await CompositionBinaryTree.removeNodeFromTree(123);\r\n * ```\r\n */\r\n static async removeNodeFromTree(id: number) {\r\n if (this.root) {\r\n this.root = this.root.removeNode(this.root, id)\r\n }\r\n }\r\n\r\n /**\r\n * Counts the total number of nodes in the tree.\r\n *\r\n * @returns The total number of composition nodes in the tree\r\n *\r\n * @remarks\r\n * This method recursively traverses the entire tree to count all nodes.\r\n * Returns 0 if the tree is empty.\r\n *\r\n * @example\r\n * ```typescript\r\n * const count = CompositionBinaryTree.countNumberOfNodes();\r\n * console.log(`Tree contains ${count} compositions`);\r\n * ```\r\n */\r\n static countNumberOfNodes() {\r\n if (this.root) {\r\n return this.root.countNodeBelow(this.root)\r\n }\r\n return 0\r\n }\r\n}\r\n","/**\r\n * @fileoverview Node implementation for the CompositionBinaryTree.\r\n * This module provides the CompositionNode class with AVL tree operations and automatic expiration.\r\n * @module DataStructures/Composition/CompositionNode\r\n */\r\n\r\nimport { Composition } from './Composition'\r\nimport { CompositionBinaryTree } from './CompositionBinaryTree'\r\n\r\n/**\r\n * Represents a node in the composition binary tree with time-based expiration.\r\n *\r\n * @remarks\r\n * CompositionNode implements an AVL tree node specifically for Composition objects.\r\n * Each node has a 10-minute expiration time for automatic cache invalidation.\r\n * The node supports all standard AVL tree operations including rotations and balancing.\r\n *\r\n * @example\r\n * ```typescript\r\n * const composition = new Composition();\r\n * const node = new CompositionNode(123, composition, null, null);\r\n * if (node.isValid()) {\r\n * console.log(\"Node is still valid\");\r\n * }\r\n * ```\r\n */\r\nexport class CompositionNode {\r\n /**\r\n * The expiration timestamp for this node.\r\n * Defaults to 10 minutes from creation time.\r\n */\r\n expiryTime: Date = new Date(Date.now() + 10 * 60 * 1000)\r\n\r\n /**\r\n * The unique key used for tree ordering (composition ID).\r\n */\r\n key: number\r\n\r\n /**\r\n * The Composition object stored in this node.\r\n */\r\n value: Composition\r\n\r\n /**\r\n * Reference to the left child node.\r\n * Null if no left child exists.\r\n */\r\n leftNode: CompositionNode | null\r\n\r\n /**\r\n * Reference to the right child node.\r\n * Null if no right child exists.\r\n */\r\n rightNode: CompositionNode | null\r\n\r\n /**\r\n * The height of this node in the tree.\r\n * Used for AVL tree balancing calculations.\r\n */\r\n height: number = 1\r\n\r\n /**\r\n * Creates a new CompositionNode.\r\n *\r\n * @param key - The unique identifier for this node (composition ID)\r\n * @param value - The Composition object to store\r\n * @param leftNode - The left child node (or null)\r\n * @param rightNode - The right child node (or null)\r\n *\r\n * @example\r\n * ```typescript\r\n * const node = new CompositionNode(123, composition, null, null);\r\n * ```\r\n */\r\n constructor(\r\n key: number,\r\n value: Composition,\r\n leftNode: CompositionNode | null,\r\n rightNode: CompositionNode | null,\r\n ) {\r\n this.key = key\r\n this.value = value\r\n this.leftNode = leftNode\r\n this.rightNode = rightNode\r\n }\r\n\r\n /**\r\n * Checks if this node is still valid (not expired).\r\n *\r\n * @returns True if the node is valid, false if expired\r\n *\r\n * @remarks\r\n * If the node has expired, it automatically removes itself from the tree.\r\n * This ensures automatic cache invalidation after 10 minutes.\r\n *\r\n * @example\r\n * ```typescript\r\n * if (node.isValid()) {\r\n * console.log(\"Node data is still fresh\");\r\n * } else {\r\n * console.log(\"Node has expired and been removed\");\r\n * }\r\n * ```\r\n */\r\n public isValid() {\r\n const currentTime = new Date(Date.now())\r\n if (this.expiryTime < currentTime) {\r\n CompositionBinaryTree.removeNodeFromTree(this.key)\r\n return false\r\n }\r\n return true\r\n }\r\n\r\n /**\r\n * Saves data to the composition's cache.\r\n *\r\n * @param data - The data to be cached in the composition\r\n *\r\n * @remarks\r\n * This is a convenience method to update the cached property of the stored composition.\r\n *\r\n * @example\r\n * ```typescript\r\n * node.saveToCache({ processed: true, data: [...] });\r\n * ```\r\n */\r\n public saveToCache(data: any) {\r\n this.value.cached = data\r\n }\r\n\r\n /**\r\n * Adds a new node to the tree with AVL balancing.\r\n *\r\n * @param passedNode - The node to be added\r\n * @param node - The current node being evaluated\r\n * @param height - The height of the current node\r\n * @returns The root node after insertion and balancing\r\n *\r\n * @remarks\r\n * This method implements the AVL tree insertion algorithm with automatic balancing.\r\n * Performs left and right rotations as needed to maintain O(log n) performance.\r\n * Also validates nodes during insertion to remove expired entries.\r\n *\r\n * @example\r\n * ```typescript\r\n * const newNode = new CompositionNode(456, newComposition, null, null);\r\n * node.addNode(newNode, node, node.height);\r\n * ```\r\n */\r\n public addNode(\r\n passedNode: CompositionNode,\r\n node: CompositionNode | null,\r\n height: number,\r\n ) {\r\n if (node == null) {\r\n node = passedNode\r\n return node\r\n }\r\n\r\n const LeftNode = node.leftNode\r\n const RightNode = node.rightNode\r\n\r\n if (node.key > passedNode.key) {\r\n node.leftNode = this.addNode(passedNode, LeftNode, height)\r\n } else if (node.key < passedNode.key) {\r\n node.rightNode = this.addNode(passedNode, RightNode, height)\r\n }\r\n\r\n // else if (node.key == passedNode.key && node.key != \"\"){\r\n // node.currentNode = passedNode;\r\n // }\r\n else {\r\n this.isValid()\r\n node = passedNode\r\n return node\r\n }\r\n\r\n node.height =\r\n 1 +\r\n Math.max(this.getHeight(node.leftNode), this.getHeight(node.rightNode))\r\n\r\n const balancingFactor = this.getBalanceFactor(node)\r\n if (balancingFactor > 1) {\r\n if (node.leftNode) {\r\n if (passedNode.key < node.leftNode.key) {\r\n return this.rightRotate(node)\r\n } else if (passedNode.key > node.leftNode.key) {\r\n node.leftNode = this.leftRotate(node.leftNode)\r\n return this.rightRotate(node)\r\n }\r\n }\r\n }\r\n\r\n if (balancingFactor < -1) {\r\n if (node.rightNode) {\r\n if (passedNode.key > node.rightNode.key) {\r\n return this.leftRotate(node)\r\n } else if (passedNode.key < node.rightNode.key) {\r\n node.rightNode = this.rightRotate(node.rightNode)\r\n return this.leftRotate(node)\r\n }\r\n }\r\n }\r\n this.isValid()\r\n return node\r\n }\r\n\r\n /**\r\n * Performs a right rotation on the given node.\r\n *\r\n * @param y - The node to rotate right\r\n * @returns The new root node after rotation\r\n *\r\n * @remarks\r\n * Right rotation is an AVL tree operation used to rebalance the tree when\r\n * the left subtree is too heavy. Updates heights after rotation.\r\n */\r\n public rightRotate(y: CompositionNode | null) {\r\n if (y) {\r\n const x = y.leftNode\r\n if (x) {\r\n const T2 = x.rightNode\r\n\r\n y.leftNode = T2\r\n\r\n x.rightNode = y\r\n y.height =\r\n Math.max(this.getHeight(y.leftNode), this.getHeight(y.rightNode)) + 1\r\n\r\n x.height =\r\n Math.max(this.getHeight(x.leftNode), this.getHeight(x.rightNode)) + 1\r\n return x\r\n }\r\n // return x;\r\n }\r\n return y\r\n }\r\n\r\n /**\r\n * Performs a left rotation on the given node.\r\n *\r\n * @param x - The node to rotate left\r\n * @returns The new root node after rotation\r\n *\r\n * @remarks\r\n * Left rotation is an AVL tree operation used to rebalance the tree when\r\n * the right subtree is too heavy. Updates heights after rotation.\r\n */\r\n public leftRotate(x: CompositionNode | null) {\r\n if (x) {\r\n const y = x.rightNode\r\n if (y) {\r\n const T2 = y.leftNode\r\n y.leftNode = x\r\n x.rightNode = T2\r\n x.height = Math.max(\r\n this.getHeight(x.leftNode),\r\n this.getHeight(x.rightNode)\r\n ) + 1;\r\n y.height = Math.max(\r\n this.getHeight(y.leftNode),\r\n this.getHeight(x.rightNode)\r\n ) + 1;\r\n return y\r\n }\r\n //return y;\r\n }\r\n return x\r\n }\r\n\r\n /**\r\n * Gets the height of a node.\r\n *\r\n * @param node - The node to get the height from\r\n * @returns The height of the node, or 0 if null\r\n *\r\n * @remarks\r\n * Height is used for AVL tree balancing calculations.\r\n */\r\n public getHeight(node: CompositionNode | null) {\r\n if (node) {\r\n return node.height\r\n }\r\n return 0\r\n }\r\n\r\n /**\r\n * Calculates the balance factor of a node.\r\n *\r\n * @param N - The node to calculate the balance factor for\r\n * @returns The balance factor (difference between left and right heights)\r\n *\r\n * @remarks\r\n * Balance factor is used to determine if rotations are needed.\r\n * Values > 1 or < -1 indicate an unbalanced tree.\r\n */\r\n public getBalanceFactor(N: CompositionNode | null) {\r\n if (N == null) {\r\n return 0\r\n }\r\n\r\n return this.getHeight(N.leftNode) - this.getHeight(N.rightNode)\r\n }\r\n\r\n /**\r\n * Retrieves a node from the tree by its ID.\r\n *\r\n * @param id - The composition ID to search for\r\n * @param node - The current node being evaluated\r\n * @returns The matching CompositionNode if found and valid, null otherwise\r\n *\r\n * @remarks\r\n * Performs a binary search through the tree. Validates nodes during retrieval.\r\n *\r\n * @example\r\n * ```typescript\r\n * const foundNode = node.getFromNode(123, rootNode);\r\n * ```\r\n */\r\n public getFromNode(\r\n id: number,\r\n node: CompositionNode | null,\r\n ): CompositionNode | null {\r\n if (node) {\r\n if (id == node.key && node.isValid()) {\r\n return node\r\n } else if (id < node.key) {\r\n return this.getFromNode(id, node.leftNode)\r\n } else if (id > node.key) {\r\n return this.getFromNode(id, node.rightNode)\r\n }\r\n return node\r\n }\r\n return node\r\n }\r\n\r\n /**\r\n * Removes a node from the tree by its ID.\r\n *\r\n * @param passedNode - The current node being evaluated\r\n * @param id - The composition ID to remove\r\n * @returns The root node after removal\r\n *\r\n * @remarks\r\n * Implements standard BST deletion with in-order successor replacement.\r\n * Maintains tree structure by replacing removed nodes with their successors.\r\n *\r\n * @example\r\n * ```typescript\r\n * const newRoot = node.removeNode(rootNode, 123);\r\n * ```\r\n */\r\n public removeNode(passedNode: CompositionNode | null, id: number) {\r\n if (passedNode == null) {\r\n return passedNode\r\n }\r\n if (passedNode.key > id) {\r\n passedNode.leftNode = this.removeNode(passedNode.leftNode, id)\r\n return passedNode\r\n } else if (passedNode.key < id) {\r\n passedNode.rightNode = this.removeNode(passedNode.rightNode, id)\r\n return passedNode\r\n }\r\n\r\n if (passedNode.leftNode == null) {\r\n const temp = passedNode.rightNode\r\n passedNode = null\r\n return temp\r\n } else if (passedNode.rightNode == null) {\r\n const temp = passedNode.leftNode\r\n passedNode = null\r\n return temp\r\n } else {\r\n // passing the rightNode to the inOrderSuccessor gives the immediate successor of the node\r\n const immediateSuccessor = this.inOrderSuccessor(passedNode.rightNode)\r\n passedNode.value = immediateSuccessor.value\r\n passedNode.key = immediateSuccessor.key\r\n passedNode.rightNode = this.removeNode(\r\n passedNode.rightNode,\r\n immediateSuccessor.key,\r\n )\r\n return passedNode\r\n }\r\n }\r\n\r\n /**\r\n * Counts all nodes below and including the given node.\r\n *\r\n * @param root - The root node to start counting from\r\n * @returns The total number of nodes in the subtree\r\n *\r\n * @remarks\r\n * Recursively traverses the entire subtree to count all nodes.\r\n *\r\n * @example\r\n * ```typescript\r\n * const count = node.countNodeBelow(rootNode);\r\n * console.log(`Subtree contains ${count} nodes`);\r\n * ```\r\n */\r\n countNodeBelow(root: CompositionNode | null): number {\r\n if (root == null) {\r\n return 0\r\n }\r\n\r\n //recursive call to left child and right child and\r\n // add the result of these with 1 ( 1 for counting the root)\r\n return (\r\n 1 +\r\n this.countNodeBelow(root.leftNode) +\r\n this.countNodeBelow(root.rightNode)\r\n )\r\n }\r\n\r\n /**\r\n * Finds the in-order successor of a node.\r\n *\r\n * @param root - The node to find the successor from\r\n * @returns The in-order successor node (leftmost node in right subtree)\r\n *\r\n * @remarks\r\n * Used during node deletion to find the replacement node.\r\n * Traverses left until finding a node with no left child.\r\n */\r\n inOrderSuccessor(root: CompositionNode) {\r\n while (root.leftNode != null) {\r\n root = root.leftNode\r\n }\r\n return root\r\n }\r\n}\r\n","/**\r\n * Core data structure representing a Concept in the Freeschema system.\r\n * A Concept is the fundamental unit of knowledge/data with metadata for typing,\r\n * categorization, security, and relationships. Concepts can reference other concepts\r\n * through type, category, and referent relationships.\r\n *\r\n * @module DataStructures/Concept\r\n * @see https://documentation.freeschema.com/#concept for concept documentation\r\n */\r\n\r\nimport { ConceptsData } from \"./ConceptData\";\r\n\r\n/**\r\n * Represents a concept with all its metadata and relationships.\r\n * A Concept is a typed, categorized piece of data with security controls,\r\n * timestamps, and the ability to reference other concepts.\r\n *\r\n * @class Concept\r\n *\r\n * @property id - Unique identifier for this concept\r\n * @property ghostId - Ghost identifier used for local/offline concepts before backend sync\r\n * @property userId - The ID of the user who owns/created this concept\r\n * @property typeId - The ID of the concept that defines this concept's type\r\n * @property typeUserId - The user ID of the type concept owner\r\n * @property categoryId - The ID of the concept that categorizes this concept\r\n * @property categoryUserId - The user ID of the category concept owner\r\n * @property referentId - The ID of the concept this concept refers to (0 if none)\r\n * @property referentUserId - The user ID of the referent concept owner\r\n * @property characterValue - The string/text content representing this concept's value\r\n * @property securityId - The ID of the security concept controlling access rules\r\n * @property securityUserId - The user ID of the security concept owner\r\n * @property accessId - The ID of the access concept defining permissions\r\n * @property accessUserId - The user ID of the access concept owner\r\n * @property sessionInformationId - The ID of the session concept for tracking\r\n * @property sessionInformationUserId - The user ID of the session concept owner\r\n * @property entryTimeStamp - Timestamp when this concept was created\r\n * @property updatedTimeStamp - Timestamp when this concept was last updated\r\n * @property referent - Reference to the actual Concept object this concept refers to (lazy loaded)\r\n * @property type - Reference to the actual Concept object defining this concept's type (lazy loaded)\r\n * @property isNew - Flag indicating if this concept is newly created and needs backend sync\r\n * @property updateRecursion - Flag enabling recursive updates through composition hierarchies\r\n * @property isTemp - Flag indicating if this is a temporary concept (not persisted to backend)\r\n * @property x - X coordinate for UI visualization/drawing\r\n * @property y - Y coordinate for UI visualization/drawing\r\n *\r\n * @example\r\n * ```typescript\r\n * // Create a concept representing a person\r\n * const person = new Concept(\r\n * 1001, // id\r\n * 1, // userId\r\n * 20, 1, // typeId (Person type), typeUserId\r\n * 10, 1, // categoryId (People category), categoryUserId\r\n * 0, 0, // referentId (no referent), referentUserId\r\n * 'John Doe', // characterValue\r\n * 30, 1, // securityId, securityUserId\r\n * 40, 1, // accessId, accessUserId\r\n * 50, 1, // sessionInformationId, sessionInformationUserId\r\n * true, // isNew\r\n * new Date(), // entryTimeStamp\r\n * new Date() // updatedTimeStamp\r\n * );\r\n *\r\n * console.log(person.characterValue); // 'John Doe'\r\n * console.log(person.isNew); // true\r\n * person.getType(); // Logs the typeId\r\n * ```\r\n *\r\n * @remarks\r\n * The Concept class implements a flexible, self-describing data model where:\r\n * - Every concept has a type (which is itself a concept)\r\n * - Every concept belongs to a category (which is itself a concept)\r\n * - Concepts can refer to other concepts via the referent relationship\r\n * - Security and access control are handled through concept references\r\n * - All metadata is versioned with timestamps\r\n * - Concepts support both backend-synced and local-only (temporary) modes\r\n *\r\n * @see ConceptsData for the global concept storage and management\r\n * @see CreateTheConcept for creating new concepts\r\n * @see https://documentation.freeschema.com/#concept for detailed concept documentation\r\n */\r\nexport class Concept{\r\n x: number;\r\n y: number;\r\n id: number;\r\n ghostId: number; \r\n userId: number;\r\n typeId: number;\r\n typeUserId: number;\r\n categoryId: number;\r\n categoryUserId: number;\r\n referentId: number;\r\n referentUserId: number;\r\n characterValue: string;\r\n securityId: number;\r\n securityUserId: number;\r\n accessId: number;\r\n accessUserId: number;\r\n sessionInformationId: number;\r\n sessionInformationUserId: number;\r\n entryTimeStamp: Date|string;\r\n updatedTimeStamp:Date|string;\r\n referent: Concept| null | void = null;\r\n type: Concept | null | void;\r\n isNew: boolean;\r\n updateRecursion: boolean = false;\r\n isTemp: boolean = false;\r\n\r\n\r\n /**\r\n * Creates a new Concept instance with all required metadata.\r\n *\r\n * @param id - Unique identifier for this concept\r\n * @param userId - The ID of the user who owns this concept\r\n * @param typeId - The ID of the type concept defining this concept's type\r\n * @param typeUserId - The user ID of the type concept owner\r\n * @param categoryId - The ID of the category concept this belongs to\r\n * @param categoryUserId - The user ID of the category concept owner\r\n * @param referentId - The ID of the referent concept (0 if none)\r\n * @param referentUserId - The user ID of the referent concept owner\r\n * @param characterValue - The string value representing this concept\r\n * @param securityId - The ID of the security concept for access control\r\n * @param securityUserId - The user ID of the security concept owner\r\n * @param accessId - The ID of the access concept defining permissions\r\n * @param accessUserId - The user ID of the access concept owner\r\n * @param sessionId - The ID of the session concept for tracking\r\n * @param sessionUserId - The user ID of the session concept owner\r\n * @param isNew - Whether this is a newly created concept needing sync (default: false)\r\n * @param entryTimeStamp - Creation timestamp\r\n * @param updatedTimeStamp - Last update timestamp\r\n */\r\n constructor(id: number, userId: number, typeId:number, typeUserId:number, categoryId:number, categoryUserId:number,\r\n referentId:number, referentUserId:number, characterValue:string,\r\n securityId:number, securityUserId:number, accessId:number, accessUserId:number, sessionId:number,\r\n sessionUserId:number, isNew:boolean=false, entryTimeStamp: Date|string, updatedTimeStamp:Date|string){\r\n this.id = id;\r\n this.userId = userId;\r\n this.typeId = typeId;\r\n this.typeUserId = typeUserId;\r\n this.ghostId = id;\r\n this.categoryId = categoryId;\r\n this.categoryUserId = categoryUserId;\r\n this.referentId = referentId;\r\n this.referentUserId = referentUserId;\r\n this.characterValue = `${characterValue}`;\r\n this.securityId = securityId;\r\n this.securityUserId = securityUserId;\r\n this.accessId = accessId;\r\n this.accessUserId = accessUserId;\r\n this.sessionInformationId = sessionId;\r\n this.sessionInformationUserId = sessionUserId;\r\n this.x = 0;\r\n this.y = 0;\r\n this.type = null;\r\n this.isNew = isNew;\r\n this.entryTimeStamp = entryTimeStamp;\r\n this.updatedTimeStamp = updatedTimeStamp;\r\n // ConceptsData.AddConcept(this);\r\n }\r\n\r\n /**\r\n * Logs the typeId of this concept to the console.\r\n * This is a utility method for debugging and inspecting the concept's type.\r\n *\r\n * @example\r\n * ```typescript\r\n * const concept = new Concept(...);\r\n * concept.getType(); // Logs the typeId to console\r\n * ```\r\n */\r\n getType(){\r\n console.log(this.typeId);\r\n }\r\n\r\n \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n}","/**\r\n * @fileoverview ConceptsData module for managing concept storage and retrieval in CCS-JS.\r\n * This module provides centralized management of concepts using multiple indexing strategies\r\n * including binary trees, character-based trees, and type-based trees for efficient lookups.\r\n * @module DataStructures/ConceptData\r\n */\r\n\r\nimport { GetConcept } from \"../Api/GetConcept\";\r\nimport { Concept } from \"./Concept\";\r\nimport { getFromDatabaseWithType, getFromDatabaseWithTypeOld, removeFromDatabase, storeToDatabase } from \"../Database/NoIndexDb\";\r\nimport { BinaryTree } from \"./BinaryTree\";\r\nimport { BinaryCharacterTree } from \"./BinaryCharacterTree\";\r\nimport { BinaryTypeTree } from \"./BinaryTypeTree\";\r\nimport { CreateDefaultConcept } from \"../Services/CreateDefaultConcept\";\r\n\r\n/**\r\n * Central repository for managing all concepts in the CCS system.\r\n * Provides multiple indexing strategies (ID-based, character-based, type-based) for efficient concept retrieval.\r\n * Maintains both in-memory (tree structures) and persistent (IndexedDB) storage.\r\n *\r\n * @class ConceptsData\r\n * @example\r\n * ```typescript\r\n * // Add a concept to the system\r\n * ConceptsData.AddConcept(myConcept);\r\n *\r\n * // Retrieve a concept by ID\r\n * const concept = await ConceptsData.GetConcept(123);\r\n *\r\n * // Get concepts by type\r\n * const concepts = ConceptsData.GetConceptsByTypeId(10);\r\n * ```\r\n *\r\n * @remarks\r\n * This class uses static methods and properties, functioning as a singleton data store.\r\n * It coordinates multiple indexing strategies for optimized query performance.\r\n */\r\nexport class ConceptsData{\r\n\r\n /** Name identifier for this data structure */\r\n name: string;\r\n\r\n /**\r\n * Creates a new ConceptsData instance.\r\n * @remarks This is rarely instantiated as the class primarily uses static methods.\r\n */\r\n constructor(){\r\n this.name = \"conceptsArray\";\r\n }\r\n\r\n /** Legacy array storage for concepts (deprecated in favor of tree structures) */\r\n static conceptsArray:Concept[] = [];\r\n\r\n /**\r\n * NPC (Non-Persistent Concepts) cache for temporarily tracking accessed concept IDs.\r\n * Limited to 10 entries for memory management.\r\n */\r\n static NPC: number[] = [];\r\n\r\n /** Dictionary-style storage for quick concept lookups by ID */\r\n static conceptDictionary:Concept[] = [];\r\n\r\n /**\r\n * Checks if a concept already exists in the concepts array.\r\n *\r\n * @param {Concept} concept - The concept to check for existence\r\n * @returns {boolean} True if the concept exists, false otherwise\r\n *\r\n * @example\r\n * ```typescript\r\n * const exists = ConceptsData.CheckContains(myConcept);\r\n * if (!exists) {\r\n * // Add the concept\r\n * }\r\n * ```\r\n */\r\n static CheckContains(concept: Concept){\r\n var contains = false;\r\n for(var i=0; i<this.conceptsArray.length; i++){\r\n if(this.conceptsArray[i].id == concept.id){\r\n contains = true;\r\n }\r\n }\r\n\r\n return contains;\r\n }\r\n\r\n /**\r\n * Adds a concept ID to the Non-Persistent Concepts (NPC) cache.\r\n * Used for tracking recently accessed concepts. Automatically clears when exceeding 10 entries.\r\n *\r\n * @param {number} id - The concept ID to add to NPC cache\r\n *\r\n * @example\r\n * ```typescript\r\n * ConceptsData.AddNpc(123);\r\n * ```\r\n */\r\n static AddNpc(id: number){\r\n if(!this.NPC.includes(id)){\r\n if(this.NPC.length > 10){\r\n this.NPC = [];\r\n }\r\n this.NPC.push(id);\r\n }\r\n }\r\n\r\n /**\r\n * Checks if a concept ID exists in the NPC cache.\r\n *\r\n * @param {number} id - The concept ID to check\r\n * @returns {boolean} True if the ID is in the NPC cache, false otherwise\r\n *\r\n * @example\r\n * ```typescript\r\n * if (ConceptsData.GetNpc(123)) {\r\n * console.log(\"Concept recently accessed\");\r\n * }\r\n * ```\r\n */\r\n static GetNpc(id: number){\r\n if(this.NPC.includes(id)){\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * Adds a concept to persistent storage (IndexedDB) only.\r\n * Does not update in-memory tree structures.\r\n *\r\n * @param {Concept} concept - The concept to store persistently\r\n *\r\n * @example\r\n * ```typescript\r\n * ConceptsData.AddConceptToStorage(myConcept);\r\n * ```\r\n *\r\n * @remarks Only stores concepts with valid IDs (id > 0)\r\n */\r\n static AddConceptToStorage(concept: Concept){\r\n if(concept.id > 0){\r\n storeToDatabase(\"concept\",concept);\r\n }\r\n }\r\n\r\n /**\r\n * Adds a concept to both persistent storage and all in-memory tree indexes.\r\n * This is the primary method for adding concepts to the system.\r\n *\r\n * @param {Concept} concept - The concept to add\r\n *\r\n * @example\r\n * ```typescript\r\n * const newConcept = new Concept(...);\r\n * ConceptsData.AddConcept(newConcept);\r\n * ```\r\n *\r\n * @remarks\r\n * Updates three tree structures:\r\n * - BinaryTree (ID-based lookup)\r\n * - BinaryTypeTree (type-based lookup)\r\n * - BinaryCharacterTree (character value lookup)\r\n * Only processes concepts with valid IDs (id > 0)\r\n */\r\n static AddConcept(concept: Concept){\r\n if(concept.id > 0){\r\n //var contains = this.CheckContains(concept);\r\n // this.conceptDictionary[concept.id] = concept;\r\n \r\n // if(contains){\r\n // this.RemoveConcept(concept);\r\n // }\r\n storeToDatabase(\"concept\",concept);\r\n BinaryTree.addConceptToTree(concept);\r\n BinaryTypeTree.addConceptToTree(concept);\r\n BinaryCharacterTree.addConceptToTree(concept);\r\n }\r\n\r\n }\r\n\r\n /**\r\n * Adds a concept to in-memory tree structures only, without persisting to storage.\r\n * Useful for temporary concepts or when storage is handled separately.\r\n *\r\n * @param {Concept} concept - The concept to add to memory\r\n *\r\n * @example\r\n * ```typescript\r\n * ConceptsData.AddConceptToMemory(temporaryConcept);\r\n * ```\r\n *\r\n * @remarks\r\n * Updates three tree structures without touching IndexedDB.\r\n * Only processes concepts with valid IDs (id > 0)\r\n */\r\n static AddConceptToMemory(concept: Concept){\r\n if(concept.id > 0){\r\n //var contains = this.CheckContains(concept);\r\n // this.conceptDictionary[concept.id] = concept;\r\n \r\n // if(contains){\r\n // this.RemoveConcept(concept);\r\n // }\r\n BinaryTree.addConceptToTree(concept);\r\n BinaryTypeTree.addConceptToTree(concept);\r\n BinaryCharacterTree.addConceptToTree(concept);\r\n }\r\n\r\n }\r\n\r\n /**\r\n * Adds a concept to the legacy array storage temporarily.\r\n * Removes existing duplicates before adding.\r\n *\r\n * @param {Concept} concept - The concept to add temporarily\r\n *\r\n * @example\r\n * ```typescript\r\n * ConceptsData.AddConceptTemporary(tempConcept);\r\n * ```\r\n *\r\n * @remarks\r\n * This method uses the legacy conceptsArray and conceptDictionary.\r\n * Consider using AddConceptToMemory for new implementations.\r\n */\r\n static AddConceptTemporary(concept: Concept){\r\n var contains = this.CheckContains(concept);\r\n this.conceptDictionary[concept.id] = concept;\r\n \r\n if(contains){\r\n this.RemoveConcept(concept);\r\n }\r\n this.conceptsArray.push(concept);\r\n }\r\n\r\n /**\r\n * Removes a concept from all storage locations (memory trees and persistent storage).\r\n *\r\n * @param {Concept} concept - The concept to remove\r\n *\r\n * @example\r\n * ```typescript\r\n * ConceptsData.RemoveConcept(obsoleteConcept);\r\n * ```\r\n *\r\n * @remarks\r\n * Removes from:\r\n * - Legacy conceptsArray\r\n * - BinaryTree (ID index)\r\n * - IndexedDB persistent storage\r\n */\r\n static RemoveConcept(concept: Concept){\r\n for(var i=0; i<this.conceptsArray.length; i++){\r\n if(this.conceptsArray[i].id == concept.id){\r\n this.conceptsArray.splice(i, 1);\r\n }\r\n }\r\n BinaryTree.removeNodeFromTree(concept.id);\r\n\r\n removeFromDatabase(\"concept\",concept.id);\r\n }\r\n\r\n /**\r\n * Retrieves a concept by its ID from the binary tree index.\r\n *\r\n * @param {number} id - The concept ID to retrieve\r\n * @returns {Promise<Concept>} The concept if found, or a default concept if not found\r\n *\r\n * @example\r\n * ```typescript\r\n * const concept = await ConceptsData.GetConcept(123);\r\n * if (concept.id !== 0) {\r\n * console.log(\"Found:\", concept.characterValue);\r\n * }\r\n * ```\r\n *\r\n * @remarks\r\n * Returns a default concept (id = 0) if the concept is not found.\r\n * Uses BinaryTree for O(log n) lookup performance.\r\n */\r\n static async GetConcept(id: number){\r\n var myConcept: Concept = CreateDefaultConcept();\r\n var node = await BinaryTree.getNodeFromTree(id);\r\n if(node?.value){\r\n var returnedConcept = node.value;\r\n if(returnedConcept){\r\n myConcept = returnedConcept as Concept;\r\n }\r\n }\r\n // if(myConcept.id == 0 || myConcept == null){\r\n // for(var i=0; i<this.conceptsArray.length; i++){\r\n // if(this.conceptsArray[i].id == id){\r\n // myConcept = this.conceptsArray[i];\r\n // }\r\n // }\r\n // }\r\n return myConcept;\r\n }\r\n\r\n /**\r\n * Retrieves a concept by its character value from the character tree index.\r\n *\r\n * @param {string} characterValue - The character value to search for\r\n * @returns {Promise<Concept>} The concept if found, or a default concept if not found\r\n *\r\n * @example\r\n * ```typescript\r\n * const concept = await ConceptsData.GetConceptByCharacter(\"Hello\");\r\n * ```\r\n *\r\n * @remarks\r\n * Uses BinaryCharacterTree for efficient character-based lookups.\r\n * Returns a default concept if not found.\r\n */\r\n static async GetConceptByCharacter(characterValue: string){\r\n var concept: Concept = CreateDefaultConcept();\r\n\r\n var Node = BinaryCharacterTree.getNodeFromTree(characterValue);\r\n if(Node){\r\n concept = Node.value;\r\n }\r\n\r\n\r\n return concept;\r\n }\r\n\r\n /**\r\n * Retrieves a concept by its character value (updated version).\r\n * Currently identical to GetConceptByCharacter.\r\n *\r\n * @param {string} characterValue - The character value to search for\r\n * @returns {Promise<Concept>} The concept if found, or a default concept if not found\r\n *\r\n * @example\r\n * ```typescript\r\n * const concept = await ConceptsData.GetConceptByCharacterUpdated(\"Hello\");\r\n * ```\r\n *\r\n * @remarks\r\n * This method may be deprecated or merged with GetConceptByCharacter in future versions.\r\n */\r\n static async GetConceptByCharacterUpdated(characterValue: string){\r\n var concept: Concept = CreateDefaultConcept();\r\n\r\n var Node = BinaryCharacterTree.getNodeFromTree(characterValue);\r\n if(Node){\r\n concept = Node.value;\r\n }\r\n\r\n\r\n return concept;\r\n }\r\n\r\n\r\n /**\r\n * Retrieves a concept by both its character value and type ID from local storage.\r\n * Provides more specific matching than character-only searches.\r\n *\r\n * @param {string} character_value - The character value to search for\r\n * @param {number} typeId - The type ID to filter by\r\n * @returns {Promise<Concept>} The concept matching both criteria, or a default concept if not found\r\n *\r\n * @example\r\n * ```typescript\r\n * const concept = await ConceptsData.GetConceptByCharacterAndTypeLocal(\"Apple\", 5);\r\n * ```\r\n *\r\n * @remarks\r\n * Uses BinaryTypeTree for efficient combined character and type lookups.\r\n * More specific than GetConceptByCharacter as it filters by type.\r\n */\r\n static async GetConceptByCharacterAndTypeLocal(character_value:string, typeId: number){\r\n var concept: Concept = CreateDefaultConcept();\r\n //var Node = await BinaryCharacterTree.getCharacterAndTypeFromTree(character_value,typeId);\r\n concept = await BinaryTypeTree.getTypeVariantsWithCharacterValue(character_value,typeId);\r\n // if(Node){\r\n\r\n // concept = Node.value;\r\n // console.log(\"found the output\");\r\n // console.log(concept);\r\n // }\r\n return concept;\r\n\r\n }\r\n\r\n /**\r\n * Retrieves a concept by both its character value and category ID from local storage.\r\n *\r\n * @param {string} character_value - The character value to search for\r\n * @param {number} categoryId - The category ID to filter by\r\n * @returns {Promise<Concept>} The concept matching both criteria, or a default concept if not found\r\n *\r\n * @example\r\n * ```typescript\r\n * const concept = await ConceptsData.GetConceptByCharacterAndCategoryLocal(\"Fruit\", 3);\r\n * ```\r\n *\r\n * @remarks\r\n * Uses BinaryCharacterTree with category filtering for specific lookups.\r\n */\r\n static async GetConceptByCharacterAndCategoryLocal(character_value:string, categoryId: number){\r\n var concept: Concept = CreateDefaultConcept();\r\n\r\n var Node = await BinaryCharacterTree.getCharacterAndCategoryFromTree(character_value,categoryId);\r\n if(Node){\r\n\r\n concept = Node.value;\r\n }\r\n return concept;\r\n\r\n }\r\n\r\n /**\r\n * Retrieves all concepts of a specific type ID from local storage.\r\n *\r\n * @param {number} typeId - The type ID to filter by\r\n * @returns {Concept[]} Array of concepts with the specified type\r\n *\r\n * @example\r\n * ```typescript\r\n * const fruits = ConceptsData.GetConceptsByTypeId(5);\r\n * console.log(`Found ${fruits.length} fruits`);\r\n * ```\r\n *\r\n * @remarks\r\n * Currently searches the legacy conceptsArray.\r\n * Consider using GetConceptsByTypeIdAndUser for more specific queries.\r\n */\r\n static GetConceptsByTypeId(typeId: number){\r\n var myConcept: Concept|null;\r\n let ConceptList: Concept[] = [];\r\n myConcept = null;\r\n for(var i=0; i<this.conceptsArray.length; i++){\r\n if(this.conceptsArray[i].typeId == typeId){\r\n ConceptList.push(this.conceptsArray[i]);\r\n }\r\n }\r\n // getFromDatabaseWithType(\"concept\",\"typeId\",typeId).then(conceptList=>{\r\n // console.log(\"thi sis my list\");\r\n // });\r\n // var dbConceptList = await getFromDatabaseWithTypeOld(\"concept\",\"typeId\", typeId);\r\n // console.log(dbConceptList);\r\n // if(Array.isArray(dbConceptList)){\r\n // console.log(dbConceptList);\r\n // console.log(dbConceptList.length);\r\n // for(var i=0; i< dbConceptList.length; i++){\r\n // console.log(\"here to push firsts\");\r\n // var contains: boolean = false;\r\n // for(var j=0; j< ConceptList.length; j++){\r\n // if(dbConceptList[i].id == ConceptList[j].id){\r\n // contains = true;\r\n // }\r\n // }\r\n // console.log(\"here to push\");\r\n // if(!contains){\r\n // ConceptList.push(dbConceptList[i]);\r\n // }\r\n // }\r\n // }\r\n // console.log(\"this is the concept list\");\r\n // console.log(ConceptList);\r\n return ConceptList;\r\n }\r\n\r\n /**\r\n * Retrieves all concepts of a specific type ID and user ID from the type tree.\r\n *\r\n * @param {number} typeId - The type ID to filter by\r\n * @param {number} userId - The user ID to filter by\r\n * @returns {Promise<Concept[]>} Array of concepts matching both type and user\r\n *\r\n * @example\r\n * ```typescript\r\n * const userConcepts = await ConceptsData.GetConceptsByTypeIdAndUser(5, 1);\r\n * ```\r\n *\r\n * @remarks\r\n * Uses BinaryTypeTree for efficient filtered queries.\r\n * Useful for multi-user systems to get user-specific concepts of a type.\r\n */\r\n static async GetConceptsByTypeIdAndUser(typeId: number, userId: number){\r\n let ConceptList: Concept[] = [];\r\n ConceptList = await BinaryTypeTree.getTypeVariantsFromTreeWithUserId(typeId, userId);\r\n return ConceptList;\r\n }\r\n\r\n /**\r\n * Returns the root node of the binary character tree.\r\n * Used for direct tree traversal or debugging.\r\n *\r\n * @returns {Node | null} The root node of the character tree\r\n *\r\n * @example\r\n * ```typescript\r\n * const tree = ConceptsData.GetBinaryCharacterTree();\r\n * if (tree) {\r\n * console.log(\"Tree root:\", tree.key);\r\n * }\r\n * ```\r\n */\r\n static GetBinaryCharacterTree(){\r\n return BinaryCharacterTree.characterRoot;\r\n }\r\n\r\n\r\n\r\n\r\n /**\r\n * Returns the name identifier of this data structure instance.\r\n *\r\n * @returns {string} The name \"conceptsArray\"\r\n *\r\n * @example\r\n * ```typescript\r\n * const conceptData = new ConceptsData();\r\n * console.log(conceptData.getName()); // \"conceptsArray\"\r\n * ```\r\n */\r\n getName(){\r\n return this.name;\r\n }\r\n}","/**\r\n * @fileoverview Connection module for the Concept Connection System (CCS-JS).\r\n * This module defines the Connection class which represents relationships between concepts.\r\n * @module DataStructures/Connection\r\n */\r\n\r\nimport { CreateDefaultConcept, formatDate } from \"../Services/CreateDefaultConcept\";\r\nimport { Concept } from \"./Concept\";\r\nimport { ConnectionData } from \"./ConnectionData\";\r\n\r\n/**\r\n * Represents a connection (relationship) between two concepts in the CCS system.\r\n * Connections link concepts together and define semantic relationships with type, order, security, and access control.\r\n *\r\n * @class Connection\r\n * @example\r\n * ```typescript\r\n * const connection = new Connection(\r\n * 0, // id\r\n * 123, // ofTheConceptId\r\n * 456, // toTheConceptId\r\n * 1, 1, // userIds\r\n * 1, // userId\r\n * 10, 1, // type\r\n * 0, 0, // order\r\n * 0, 0, // security\r\n * 0, 0, // access\r\n * 0, 0 // sessionInfo\r\n * );\r\n * ```\r\n */\r\nexport class Connection{\r\n /** Unique identifier for this connection */\r\n id: number;\r\n\r\n /** User ID of the connection owner */\r\n userId: number;\r\n\r\n /** Ghost ID for tracking temporary connections before persistence */\r\n ghostId: number;\r\n\r\n /** ID of the source concept in this connection */\r\n ofTheConceptId: number;\r\n\r\n /** ID of the target concept in this connection */\r\n toTheConceptId: number;\r\n\r\n /** User ID of the source concept owner */\r\n ofTheConceptUserId: number;\r\n\r\n /** User ID of the target concept owner */\r\n toTheConceptUserId: number;\r\n\r\n /** Timestamp when the connection was created */\r\n entryTimeStamp: Date|string;\r\n\r\n /** Termination date for the connection (if applicable) */\r\n terminationDateTime: Date;\r\n\r\n /** Type ID defining the semantic meaning of this connection */\r\n typeId: number;\r\n\r\n /** User ID of the type concept owner */\r\n typeUserId: number;\r\n\r\n /** Order ID for sorting connections */\r\n orderId: number;\r\n\r\n /** User ID of the order concept owner */\r\n orderUserId: number;\r\n\r\n /** Security concept ID controlling access permissions */\r\n securityId: number;\r\n\r\n /** User ID of the security concept owner */\r\n securityUserId: number;\r\n\r\n /** Access control concept ID */\r\n accessId: number;\r\n\r\n /** User ID of the access concept owner */\r\n accessUserId: number;\r\n\r\n /** Session information concept ID for tracking connection context */\r\n sessionInformationId: number;\r\n\r\n /** User ID of the session information concept owner */\r\n sessionInformationUserId: number;\r\n\r\n /** Local synchronization timestamp for offline support */\r\n localSyncTime: Date;\r\n\r\n /** Flag indicating if this is a temporary connection not yet persisted */\r\n isTemp:boolean = false;\r\n\r\n /** Flag indicating if this connection needs to be updated */\r\n toUpdate:boolean = false;\r\n\r\n /** The type concept object providing semantic meaning to this connection */\r\n type: Concept = CreateDefaultConcept();\r\n\r\n /**\r\n * Creates a new Connection instance.\r\n *\r\n * @param {number} [id=0] - Unique identifier for the connection\r\n * @param {number} ofTheConceptId - Source concept ID\r\n * @param {number} toTheConceptId - Target concept ID\r\n * @param {number} ofTheConceptUserId - User ID of source concept owner\r\n * @param {number} toTheConceptUserId - User ID of target concept owner\r\n * @param {number} userId - User ID of connection creator\r\n * @param {number} typeId - Connection type ID\r\n * @param {number} typeUserId - User ID of type concept owner\r\n * @param {number} orderId - Order concept ID for sorting\r\n * @param {number} orderUserId - User ID of order concept owner\r\n * @param {number} securityId - Security concept ID\r\n * @param {number} securityUserId - User ID of security concept owner\r\n * @param {number} accessId - Access control concept ID\r\n * @param {number} accessUserId - User ID of access concept owner\r\n * @param {number} sessionInformationId - Session information concept ID\r\n * @param {number} sessionInformationUserId - User ID of session information concept owner\r\n *\r\n * @example\r\n * ```typescript\r\n * const connection = new Connection(\r\n * 1, 100, 200, 1, 1, 1, 5, 1, 0, 0, 0, 0, 0, 0, 0, 0\r\n * );\r\n * ```\r\n */\r\n constructor(id: number = 0, ofTheConceptId: number, toTheConceptId: number, ofTheConceptUserId: number, toTheConceptUserId: number,\r\n userId: number, typeId: number, typeUserId: number, orderId: number, orderUserId: number, securityId: number, securityUserId: number,\r\n accessId: number, accessUserId: number, sessionInformationId: number, sessionInformationUserId: number){\r\n this.id = id;\r\n this.ofTheConceptId = ofTheConceptId;\r\n this.toTheConceptId = toTheConceptId;\r\n this.ofTheConceptUserId = ofTheConceptUserId;\r\n this.toTheConceptUserId = toTheConceptUserId;\r\n this.userId = userId;\r\n this.typeId = typeId;\r\n this.ghostId = id;\r\n this.typeUserId = typeUserId;\r\n this.orderId = orderId;\r\n this.orderUserId = orderUserId;\r\n this.securityId = securityId;\r\n this.securityUserId = securityUserId;\r\n this.accessId = accessId;\r\n this.accessUserId = accessUserId;\r\n this.sessionInformationId = sessionInformationId;\r\n this.sessionInformationUserId = sessionInformationUserId;\r\n this.entryTimeStamp = formatDate(new Date());\r\n this.terminationDateTime = new Date();\r\n this.localSyncTime = new Date();\r\n }\r\n\r\n\r\n}","/**\r\n * @fileoverview Binary tree data structure for managing connections.\r\n * This module provides an AVL tree implementation for efficient storage and retrieval of Connection objects.\r\n * @module DataStructures/ConnectionBinaryTree/ConnectionBinaryTree\r\n */\r\n\r\nimport { Connection } from \"../../DataStructures/Connection\";\r\nimport { IdentifierFlags } from \"../IdentifierFlags\";\r\nimport { ConnectionNode } from \"./ConnectionNode\";\r\n\r\n/**\r\n * Binary tree data structure for managing connections with efficient ID-based lookup.\r\n *\r\n * @remarks\r\n * This class implements a self-balancing AVL tree for storing Connection objects.\r\n * It provides O(log n) search, insertion, and deletion operations. The tree supports\r\n * asynchronous data loading with timeout capabilities and integrates with the\r\n * IdentifierFlags system for data synchronization.\r\n *\r\n * @example\r\n * ```typescript\r\n * const connection = new Connection(123, ...);\r\n * ConnectionBinaryTree.addConnectionToTree(connection);\r\n * const node = await ConnectionBinaryTree.getNodeFromTree(123);\r\n * ```\r\n */\r\nexport class ConnectionBinaryTree{\r\n /**\r\n * The root node of the connection binary tree.\r\n * Null if the tree is empty.\r\n */\r\n static connectionroot: ConnectionNode | null = null;\r\n\r\n /**\r\n * Adds a connection node to the binary tree.\r\n *\r\n * @param node - The ConnectionNode to be added to the tree\r\n * @returns The root node after insertion\r\n *\r\n * @remarks\r\n * If the tree is empty, the provided node becomes the root.\r\n * Otherwise, the node is inserted using the AVL tree balancing algorithm.\r\n *\r\n * @example\r\n * ```typescript\r\n * const node = new ConnectionNode(123, connection, null, null);\r\n * ConnectionBinaryTree.addNodeToTree(node);\r\n * ```\r\n */\r\n static addNodeToTree(node:ConnectionNode){\r\n if(this.connectionroot == null){\r\n this.connectionroot = node;\r\n return this.connectionroot;\r\n }\r\n else{\r\n this.connectionroot = this.connectionroot.addNode(node,this.connectionroot,this.connectionroot.height);\r\n }\r\n }\r\n\r\n /**\r\n * Creates a node from a connection and adds it to the tree.\r\n *\r\n * @param connection - The Connection object to be added to the tree\r\n *\r\n * @remarks\r\n * This is a convenience method that wraps the connection in a ConnectionNode\r\n * and adds it to the tree. The node is keyed by the connection's ID.\r\n *\r\n * @example\r\n * ```typescript\r\n * const connection = new Connection(123, 1, 2, 3, 4, 5);\r\n * ConnectionBinaryTree.addConnectionToTree(connection);\r\n * ```\r\n */\r\n static addConnectionToTree(connection:Connection){\r\n var node: ConnectionNode = new ConnectionNode(connection.id, connection, null, null);\r\n this.addNodeToTree(node);\r\n }\r\n\r\n /**\r\n * Waits for connection data to be loaded into the tree.\r\n *\r\n * @returns A promise that resolves with \"done\" when data is loaded, or rejects with \"not\" after 25 seconds\r\n *\r\n * @remarks\r\n * This method polls the IdentifierFlags.isConnectionLoaded flag every second.\r\n * Useful for ensuring data is ready before performing operations on the tree.\r\n *\r\n * @example\r\n * ```typescript\r\n * try {\r\n * await ConnectionBinaryTree.waitForDataToLoad();\r\n * console.log(\"Connection data loaded\");\r\n * } catch (error) {\r\n * console.log(\"Loading timed out\");\r\n * }\r\n * ```\r\n */\r\n static async waitForDataToLoad(){\r\n return new Promise((resolve,reject) => {\r\n this.checkFlag(resolve);\r\n setTimeout(()=>{\r\n reject(\"not\")},25000);\r\n });\r\n }\r\n\r\n /**\r\n * Periodically checks if connection data has been loaded.\r\n *\r\n * @param resolve - The promise resolve function to call when data is loaded\r\n *\r\n * @remarks\r\n * This method recursively checks the IdentifierFlags.isConnectionLoaded flag every 1000ms.\r\n */\r\n static checkFlag(resolve:any){\r\n\r\n if(IdentifierFlags.isConnectionLoaded){\r\n return resolve(\"done\");\r\n }\r\n else{\r\n setTimeout(ConnectionBinaryTree.checkFlag, 1000, resolve);\r\n }\r\n };\r\n\r\n /**\r\n * Removes a connection node from the tree by its ID.\r\n *\r\n * @param id - The numeric ID of the connection to remove\r\n *\r\n * @remarks\r\n * This method removes a node from the tree while maintaining AVL balance.\r\n * The tree is automatically rebalanced after removal.\r\n *\r\n * @example\r\n * ```typescript\r\n * await ConnectionBinaryTree.removeNodeFromTree(123);\r\n * ```\r\n */\r\n static async removeNodeFromTree(id:number){\r\n if(this.connectionroot){\r\n this.connectionroot = this.connectionroot.removeNode(this.connectionroot,id);\r\n }\r\n }\r\n\r\n /**\r\n * Retrieves a connection node from the tree by its ID.\r\n *\r\n * @param id - The numeric ID of the connection to retrieve\r\n * @returns The ConnectionNode if found, the root node otherwise\r\n *\r\n * @remarks\r\n * This method performs a binary search through the tree using the connection ID as the key.\r\n * The search has O(log n) time complexity in a balanced tree.\r\n *\r\n * @example\r\n * ```typescript\r\n * const node = await ConnectionBinaryTree.getNodeFromTree(123);\r\n * if (node) {\r\n * console.log(\"Found connection:\", node.value);\r\n * }\r\n * ```\r\n */\r\n static async getNodeFromTree(id:number){\r\n // try{\r\n // var data = await this.waitForDataToLoad();\r\n // }\r\n // catch(exception){\r\n // return null;\r\n // }\r\n if(this.connectionroot){\r\n var Node = this.connectionroot.getFromNode(id, this.connectionroot);\r\n return Node;\r\n }\r\n return this.connectionroot;\r\n }\r\n\r\n\r\n\r\n}","/**\r\n * @fileoverview Node implementation for the ConnectionBinaryTree.\r\n * This module provides the ConnectionNode class with AVL tree operations and variant management.\r\n * @module DataStructures/ConnectionBinaryTree/ConnectionNode\r\n */\r\n\r\nimport { Connection } from \"./../Connection\";\r\n\r\n/**\r\n * Represents a node in the connection binary tree with support for variants.\r\n *\r\n * @remarks\r\n * ConnectionNode implements an AVL tree node for Connection objects with special\r\n * support for managing connection variants (multiple connections with the same key).\r\n * Each node can store multiple connection variants in the variants array, allowing\r\n * efficient grouping of related connections by type or other criteria.\r\n *\r\n * @example\r\n * ```typescript\r\n * const connection = new Connection(123, 1, 2, 3, 4, 5);\r\n * const node = new ConnectionNode(123, connection, null, null);\r\n * ```\r\n */\r\nexport class ConnectionNode{\r\n /**\r\n * The key used for tree ordering (typically connection ID or type ID).\r\n */\r\n key:any;\r\n\r\n /**\r\n * The Connection object stored in this node.\r\n */\r\n value:Connection;\r\n\r\n /**\r\n * Reference to the left child node.\r\n */\r\n leftNode: ConnectionNode | null;\r\n\r\n /**\r\n * Reference to the right child node.\r\n */\r\n rightNode: ConnectionNode | null;\r\n\r\n /**\r\n * Reference to current node for variant chaining.\r\n */\r\n currentNode: ConnectionNode | null;\r\n\r\n /**\r\n * Array of variant nodes that share the same key.\r\n * Used for storing multiple connections with the same type or identifier.\r\n */\r\n variants: ConnectionNode [] = [] ;\r\n\r\n /**\r\n * The height of this node in the tree.\r\n * Used for AVL tree balancing calculations.\r\n */\r\n height:number = 1;\r\n\r\n /**\r\n * Creates a new ConnectionNode.\r\n *\r\n * @param key - The key for tree ordering\r\n * @param value - The Connection object to store\r\n * @param leftNode - The left child node (or null)\r\n * @param rightNode - The right child node (or null)\r\n *\r\n * @example\r\n * ```typescript\r\n * const node = new ConnectionNode(123, connection, null, null);\r\n * ```\r\n */\r\n constructor(key:any, value:Connection, leftNode: ConnectionNode | null, rightNode:ConnectionNode| null){\r\n this.key = key;\r\n this.value = value;\r\n this.leftNode = leftNode;\r\n this.rightNode = rightNode;\r\n this.currentNode = null;\r\n }\r\n\r\n /**\r\n * Adds a node to the current node chain by type ID.\r\n *\r\n * @param passedNode - The node to add\r\n * @param node - The current node in the chain\r\n * @returns The updated node chain\r\n *\r\n * @remarks\r\n * Used internally for managing connection variants with different type IDs.\r\n */\r\n public addCurrentNode(passedNode:ConnectionNode, node:ConnectionNode|null){\r\n if(node == null){\r\n node = passedNode;\r\n return node;\r\n }\r\n if(passedNode.value.typeId != node.value.typeId ){\r\n node.currentNode = this.addCurrentNode(passedNode, node.currentNode);\r\n }\r\n return node;\r\n }\r\n\r\n /**\r\n * Adds a connection variant to this node's variants array.\r\n *\r\n * @param passedNode - The variant node to add\r\n * @param node - The current node\r\n * @returns The updated node with the new variant\r\n *\r\n * @remarks\r\n * This method ensures no duplicate connections are added by checking IDs.\r\n * Variants are stored in the variants array for efficient retrieval.\r\n */\r\n public addCurrentNodeType(passedNode:ConnectionNode, node:ConnectionNode|null){\r\n if(node == null){\r\n node = passedNode;\r\n return node;\r\n }\r\n var contains = false;\r\n if(passedNode.value.id == node.value.id){\r\n contains = true;\r\n }\r\n for(let i=0; i<node.variants.length; i++){\r\n if(node.variants[i].value.id == passedNode.value.id){\r\n contains = true;\r\n }\r\n }\r\n if(!contains){\r\n node.variants.push(passedNode);\r\n }\r\n //node.currentNode = this.addCurrentNode(passedNode, node.currentNode);\r\n return node;\r\n }\r\n\r\n /**\r\n * Adds a new node to the tree with AVL balancing.\r\n *\r\n * @param passedNode - The node to be added\r\n * @param node - The current node being evaluated\r\n * @param height - The height of the current node\r\n * @returns The root node after insertion and balancing\r\n *\r\n * @remarks\r\n * Implements AVL tree insertion with automatic balancing through rotations.\r\n */\r\n public addNode(passedNode:ConnectionNode, node:ConnectionNode|null, height:number){\r\n if(node == null){\r\n node = passedNode;\r\n return node;\r\n }\r\n\r\n var LeftNode = node.leftNode;\r\n var RightNode = node.rightNode;\r\n\r\n if(node.key > passedNode.key){\r\n node.leftNode = this.addNode(passedNode,LeftNode,height);\r\n }\r\n\r\n else if(node.key < passedNode.key){\r\n node.rightNode = this.addNode(passedNode,RightNode,height);\r\n }\r\n\r\n // else if (node.key == passedNode.key && node.key != \"\"){\r\n // node.currentNode = passedNode;\r\n // }\r\n else{\r\n return node;\r\n }\r\n\r\n node.height = 1 + Math.max(this.getHeight(node.leftNode), this.getHeight(node.rightNode));\r\n\r\n let balancingFactor = this.getBalanceFactor(node);\r\n if(balancingFactor > 1){\r\n if(node.leftNode){\r\n if(passedNode.key < node.leftNode.key){\r\n return this.rightRotate(node);\r\n }\r\n else if(passedNode.key > node.leftNode.key){\r\n node.leftNode = this.leftRotate(node.leftNode);\r\n return this.rightRotate(node);\r\n }\r\n }\r\n\r\n }\r\n\r\n if(balancingFactor < -1){\r\n if(node.rightNode){\r\n if(passedNode.key > node.rightNode.key){\r\n return this.leftRotate(node);\r\n }\r\n else if (passedNode.key < node.rightNode.key){\r\n node.rightNode = this.rightRotate(node.rightNode);\r\n return this.leftRotate(node);\r\n }\r\n }\r\n }\r\n return node;\r\n \r\n }\r\n\r\n\r\n /**\r\n * Adds a node to the tree indexed by type ID with variant support.\r\n *\r\n * @param passedNode - The node to be added\r\n * @param node - The current node being evaluated\r\n * @param height - The height of the current node\r\n * @returns The root node after insertion and balancing\r\n *\r\n * @remarks\r\n * This method is similar to addNode but specifically handles type-based indexing\r\n * and manages connection variants that share the same type ID.\r\n */\r\n public addTypeNode(passedNode:ConnectionNode, node:ConnectionNode|null, height:number){\r\n var debugFlag = false;\r\n if(passedNode.value.typeId != 0){\r\n\r\n // if(passedNode.value.characterValue == \"Default\"){\r\n // console.log(\"default here\");\r\n // debugFlag = true;\r\n // }\r\n\r\n if(node == null){\r\n if(debugFlag){\r\n console.log(\"equal here\", node);\r\n }\r\n node = passedNode;\r\n return node;\r\n }\r\n\r\n var LeftNode = node.leftNode;\r\n var RightNode = node.rightNode;\r\n\r\n if(node.key > passedNode.key){\r\n if(debugFlag){\r\n console.log(\"left here\", node);\r\n }\r\n node.leftNode = this.addTypeNode(passedNode,LeftNode,height);\r\n }\r\n\r\n else if(node.key < passedNode.key){\r\n if(debugFlag){\r\n console.log(\"right here\", node, RightNode);\r\n }\r\n node.rightNode = this.addTypeNode(passedNode,RightNode,height);\r\n }\r\n\r\n else{\r\n if(debugFlag){\r\n console.log(\"else here\", node, passedNode);\r\n }\r\n if (node.key == passedNode.key && node.key != 0){\r\n node.addCurrentNodeType(passedNode,node);\r\n }\r\n return node;\r\n }\r\n\r\n node.height = 1 + Math.max(this.getHeight(node.leftNode), this.getHeight(node.rightNode));\r\n if(debugFlag){\r\n console.log(\"height here\", node.height);\r\n }\r\n let balancingFactor = this.getBalanceFactor(node);\r\n\r\n if(debugFlag){\r\n console.log(\"balancingFactor here\",balancingFactor);\r\n }\r\n if(balancingFactor > 1){\r\n if(node.leftNode){\r\n if(passedNode.key < node.leftNode.key){\r\n var returner = this.rightRotate(node);\r\n if(debugFlag){\r\n console.log(\"returning here 1 \",returner);\r\n }\r\n return returner;\r\n }\r\n else if(passedNode.key > node.leftNode.key){\r\n node.leftNode = this.leftRotate(node.leftNode);\r\n var returner = this.rightRotate(node);\r\n if(debugFlag){\r\n console.log(\"returning here 2 \",returner);\r\n }\r\n return returner;\r\n }\r\n }\r\n\r\n }\r\n\r\n if(balancingFactor < -1){\r\n if(node.rightNode){\r\n if(passedNode.key > node.rightNode.key){\r\n\r\n var returner = this.leftRotate(node);\r\n if(debugFlag){\r\n console.log(\"returning here 3 \",returner);\r\n }\r\n return returner;\r\n }\r\n else if (passedNode.key < node.rightNode.key){\r\n node.rightNode = this.rightRotate(node.rightNode);\r\n var returner = this.leftRotate(node);\r\n if(debugFlag){\r\n console.log(\"returning here4 \",returner, node);\r\n\r\n }\r\n return returner;\r\n }\r\n }\r\n }\r\n }\r\n else{\r\n if(debugFlag){\r\n console.log(\"what here\", node);\r\n }\r\n }\r\n if(debugFlag){\r\n console.log(\"returning here 6\", node);\r\n }\r\n return node;\r\n\r\n }\r\n\r\n /**\r\n * Performs a right rotation on the given node for AVL balancing.\r\n *\r\n * @param y - The node to rotate right\r\n * @returns The new root node after rotation\r\n */\r\n public rightRotate(y:ConnectionNode | null){\r\n if(y){\r\n let x = y.leftNode;\r\n if(x){\r\n let T2 = x.rightNode;\r\n\r\n y.leftNode = T2;\r\n \r\n x.rightNode = y;\r\n y.height = Math.max(this.getHeight(y.leftNode), this.getHeight(y.rightNode)) + 1;\r\n \r\n x.height = Math.max(this.getHeight(x.leftNode), this.getHeight(x.rightNode)) + 1;\r\n return x;\r\n }\r\n // return x;\r\n }\r\n return y;\r\n\r\n }\r\n\r\n /**\r\n * Performs a left rotation on the given node for AVL balancing.\r\n *\r\n * @param x - The node to rotate left\r\n * @returns The new root node after rotation\r\n */\r\n public leftRotate(x:ConnectionNode | null){\r\n\r\n if(x){\r\n let y = x.rightNode;\r\n if(y){\r\n let T2 = y.leftNode;\r\n y.leftNode = x;\r\n x.rightNode = T2;\r\n x.height = Math.max(this.getHeight(x.leftNode),this.getHeight(x.rightNode)) + 1;\r\n y.height = Math.max(this.getHeight(y.leftNode), this.getHeight(x.rightNode)) + 1;\r\n return y;\r\n }\r\n //return y;\r\n }\r\n return x;\r\n\r\n }\r\n \r\n\r\n /**\r\n * Gets the height of a node.\r\n *\r\n * @param node - The node to get the height from\r\n * @returns The height of the node, or 0 if null\r\n */\r\n public getHeight(node: ConnectionNode| null){\r\n if(node){\r\n return node.height;\r\n }\r\n return 0;\r\n }\r\n\r\n /**\r\n * Calculates the balance factor of a node.\r\n *\r\n * @param N - The node to calculate the balance factor for\r\n * @returns The balance factor (difference between left and right heights)\r\n */\r\n public getBalanceFactor(N: ConnectionNode | null){\r\n if (N == null){\r\n return 0;\r\n }\r\n\r\n return this.getHeight(N.leftNode) - this.getHeight(N.rightNode);\r\n }\r\n\r\n /**\r\n * Retrieves a node from the tree by its numeric ID.\r\n *\r\n * @param id - The connection ID to search for\r\n * @param node - The current node being evaluated\r\n * @returns The matching ConnectionNode if found, null otherwise\r\n */\r\n public getFromNode(id: number, node: ConnectionNode | null) :ConnectionNode | null{\r\n if(node){\r\n if(id == node.key){\r\n return node;\r\n }\r\n else if(id < node.key){\r\n return this.getFromNode(id, node.leftNode);\r\n }\r\n else if (id > node.key) {\r\n return this.getFromNode(id, node.rightNode);\r\n }\r\n return node;\r\n }\r\n return node;\r\n\r\n }\r\n\r\n /**\r\n * Retrieves a node from the tree by its character/string value.\r\n *\r\n * @param value - The character value to search for\r\n * @param node - The current node being evaluated\r\n * @returns The matching ConnectionNode if found, null otherwise\r\n */\r\n public getCharacterFromNode(value: string, node: ConnectionNode | null) :ConnectionNode | null{\r\n if(node){\r\n if(value == node.key){\r\n return node;\r\n }\r\n else if(value < node.key){\r\n return this.getCharacterFromNode(value, node.leftNode);\r\n }\r\n else if (value > node.key) {\r\n return this.getCharacterFromNode(value, node.rightNode);\r\n }\r\n return node;\r\n }\r\n return node;\r\n\r\n }\r\n\r\n\r\n /**\r\n * Removes a node from the tree by its ID.\r\n *\r\n * @param passedNode - The current node being evaluated\r\n * @param id - The connection ID to remove\r\n * @returns The root node after removal\r\n *\r\n * @remarks\r\n * Implements standard BST deletion with in-order successor replacement.\r\n */\r\n public removeNode(passedNode:ConnectionNode|null,id:number){\r\n if(passedNode == null){\r\n return passedNode;\r\n }\r\n if(passedNode.key > id){\r\n passedNode.leftNode = this.removeNode(passedNode.leftNode, id);\r\n return passedNode;\r\n }\r\n else if(passedNode.key < id){\r\n passedNode.rightNode = this.removeNode(passedNode.rightNode,id);\r\n return passedNode;\r\n }\r\n\r\n // if(passedNode.variants.length > 0){\r\n // if(passedNode.value.id == id ){\r\n\r\n // }\r\n // var newNode = passedNode.variants[0];\r\n // if(newNode){\r\n // passedNode.value = newNode.value;\r\n // passedNode.key = newNode.key;\r\n // passedNode.currentNode = newNode.currentNode;\r\n // return passedNode;\r\n\r\n // }\r\n // }\r\n\r\n if(passedNode.leftNode == null){\r\n let temp = passedNode.rightNode;\r\n passedNode = null;\r\n return temp;\r\n }\r\n else if(passedNode.rightNode == null){\r\n let temp = passedNode.leftNode;\r\n passedNode = null;\r\n return temp;\r\n }\r\n else{ \r\n // passing the rightNode to the inOrderSuccessor gives the immediate successor of the node\r\n var immediateSuccessor = this.inOrderSuccessor(passedNode.rightNode);\r\n passedNode.value = immediateSuccessor.value;\r\n passedNode.key = immediateSuccessor.key;\r\n passedNode.variants = immediateSuccessor.variants;\r\n passedNode.currentNode = immediateSuccessor.currentNode;\r\n passedNode.rightNode = this.removeNode(passedNode.rightNode,immediateSuccessor.key);\r\n return passedNode;\r\n\r\n }\r\n\r\n}\r\n\r\n/**\r\n * Removes a specific variant from a node or the entire node if no variants remain.\r\n *\r\n * @param passedNode - The current node being evaluated\r\n * @param typeIdentifier - The type identifier of the node\r\n * @param conceptId - The specific connection ID to remove\r\n * @returns The root node after removal\r\n *\r\n * @remarks\r\n * This method handles removal of connection variants. If the main value matches,\r\n * it's replaced by the first variant. If a variant matches, only that variant is removed.\r\n */\r\npublic removeNodeWithVariants(passedNode:ConnectionNode|null,typeIdentifier:any, conceptId:number){\r\n if(passedNode == null){\r\n return passedNode;\r\n }\r\n if(passedNode.key > typeIdentifier){\r\n passedNode.leftNode = this.removeNodeWithVariants(passedNode.leftNode, typeIdentifier,conceptId);\r\n return passedNode;\r\n }\r\n else if(passedNode.key < typeIdentifier){\r\n passedNode.rightNode = this.removeNodeWithVariants(passedNode.rightNode,typeIdentifier,conceptId);\r\n return passedNode;\r\n }\r\n\r\n if(passedNode.variants.length > 0){\r\n //condition if the main node is equal to the value\r\n if(passedNode.value.id == conceptId ){\r\n var newNode = passedNode.variants[0];\r\n if(newNode){\r\n passedNode.value = newNode.value;\r\n passedNode.key = newNode.key;\r\n passedNode.currentNode = newNode.currentNode;\r\n passedNode.variants.splice(0,1);\r\n return passedNode;\r\n\r\n }\r\n }\r\n else{\r\n\r\n // in the condition that the main node is not equal to the checking value \r\n for(let i=0; i<passedNode.variants.length; i++){\r\n if(conceptId == passedNode.variants[i].value.id){\r\n passedNode.variants.splice(i, 1);\r\n return passedNode;\r\n }\r\n }\r\n }\r\n\r\n }\r\n\r\n if(passedNode.leftNode == null){\r\n let temp = passedNode.rightNode;\r\n passedNode = null;\r\n return temp;\r\n }\r\n else if(passedNode.rightNode == null){\r\n let temp = passedNode.leftNode;\r\n passedNode = null;\r\n return temp;\r\n }\r\n else{ \r\n // passing the rightNode to the inOrderSuccessor gives the immediate successor of the node\r\n var immediateSuccessor = this.inOrderSuccessor(passedNode.rightNode);\r\n passedNode.value = immediateSuccessor.value;\r\n passedNode.key = immediateSuccessor.key;\r\n passedNode.variants = immediateSuccessor.variants;\r\n passedNode.currentNode = immediateSuccessor.currentNode;\r\n passedNode.rightNode = this.removeNodeWithVariants(passedNode.rightNode,immediateSuccessor.key,conceptId);\r\n return passedNode;\r\n\r\n }\r\n\r\n}\r\n\r\n\r\n/**\r\n * Finds the in-order successor of a node.\r\n *\r\n * @param root - The node to find the successor from\r\n * @returns The in-order successor node (leftmost node in right subtree)\r\n *\r\n * @remarks\r\n * Used during node deletion to find the replacement node.\r\n */\r\ninOrderSuccessor(root:ConnectionNode){\r\n while (root.leftNode != null) {\r\n root = root.leftNode;\r\n }\r\n return root;\r\n}\r\n\r\n\r\n\r\n\r\n}","/**\r\n * @fileoverview Binary tree for managing connections indexed by type ID.\r\n * This module provides a specialized tree for efficient type-based connection lookups and variant retrieval.\r\n * @module DataStructures/ConnectionBinaryTree/ConnectionTypeTree\r\n */\r\n\r\nimport { Connection } from \"../../DataStructures/Connection\";\r\nimport { IdentifierFlags } from \"../IdentifierFlags\";\r\nimport { ConnectionNode } from \"./ConnectionNode\";\r\n\r\n/**\r\n * Binary tree data structure for managing connections indexed by type ID.\r\n *\r\n * @remarks\r\n * This class implements an AVL tree optimized for type-based connection lookups.\r\n * It enables efficient retrieval of all connections of a specific type and supports\r\n * variant management for grouping related connections.\r\n *\r\n * @example\r\n * ```typescript\r\n * const connection = new Connection(123, 1, 2, 3, 4, 5);\r\n * ConnectionTypeTree.addConnectionToTree(connection);\r\n * const variants = await ConnectionTypeTree.getTypeVariantsFromTree(5);\r\n * ```\r\n */\r\nexport class ConnectionTypeTree{\r\n /**\r\n * The root node of the type-indexed connection tree.\r\n * Null if the tree is empty.\r\n */\r\n static connectionTypeRoot: ConnectionNode | null = null;\r\n\r\n /**\r\n * Adds a connection node to the type-indexed tree.\r\n *\r\n * @param node - The ConnectionNode to be added\r\n * @returns The root node after insertion\r\n *\r\n * @remarks\r\n * Uses the addTypeNode method for type-based insertion with variant support.\r\n */\r\n static async addNodeToTree(node:ConnectionNode){\r\n if(this.connectionTypeRoot == null){\r\n this.connectionTypeRoot = node;\r\n return this.connectionTypeRoot;\r\n }\r\n else{\r\n this.connectionTypeRoot = this.connectionTypeRoot.addTypeNode(node,this.connectionTypeRoot,this.connectionTypeRoot.height);\r\n }\r\n return this.connectionTypeRoot;\r\n }\r\n\r\n /**\r\n * Waits for connection type data to be loaded.\r\n *\r\n * @returns A promise that resolves when data is loaded, or rejects after 25 seconds\r\n */\r\n static async waitForDataToLoad(){\r\n return new Promise((resolve,reject) => {\r\n this.checkFlag(resolve);\r\n setTimeout(()=>{\r\n reject(\"not\")},25000);\r\n });\r\n }\r\n\r\n /**\r\n * Periodically checks if connection type data has been loaded.\r\n *\r\n * @param resolve - The promise resolve function to call when data is loaded\r\n */\r\n static checkFlag(resolve:any){\r\n\r\n if(IdentifierFlags.isConnectionTypeLoaded){\r\n return resolve(\"done\");\r\n }\r\n else{\r\n setTimeout(ConnectionTypeTree.checkFlag, 1000, resolve);\r\n }\r\n };\r\n\r\n /**\r\n * Creates a node from a connection and adds it to the type tree.\r\n *\r\n * @param connection - The Connection object to be added\r\n *\r\n * @remarks\r\n * Only adds the connection if it has a non-zero typeId.\r\n */\r\n static addConnectionToTree(connection:Connection){\r\n if(connection.typeId != 0){\r\n var node: ConnectionNode = new ConnectionNode(connection.typeId, connection, null, null);\r\n this.addNodeToTree(node);\r\n }\r\n\r\n }\r\n\r\n /**\r\n * Removes a specific connection variant from the tree.\r\n *\r\n * @param typeId - The type ID identifying the node\r\n * @param id - The connection ID to remove\r\n */\r\n static removeTypeConcept(typeId:number,id:number){\r\n if(this.connectionTypeRoot){\r\n this.connectionTypeRoot = this.connectionTypeRoot.removeNodeWithVariants(this.connectionTypeRoot,typeId,id);\r\n\r\n }\r\n }\r\n\r\n /**\r\n * Retrieves a node from the tree by its type ID.\r\n *\r\n * @param id - The numeric type ID to search for\r\n * @returns The ConnectionNode if found, the root node otherwise\r\n */\r\n static getNodeFromTree(id:number){\r\n\r\n\r\n\r\n if(this.connectionTypeRoot){\r\n var Node = this.connectionTypeRoot.getFromNode(id, this.connectionTypeRoot);\r\n return Node;\r\n }\r\n return this.connectionTypeRoot;\r\n }\r\n\r\n /**\r\n * Retrieves all connection variants for a specific type ID.\r\n *\r\n * @param typeId - The type ID to search for\r\n * @returns An array of Connection objects of the specified type\r\n *\r\n * @remarks\r\n * Returns the primary connection and all its variants that share the same type ID.\r\n */\r\n static async getTypeVariantsFromTree(typeId:number){\r\n var connection : Connection[] = [];\r\n\r\n // try{\r\n // var data = await this.waitForDataToLoad();\r\n // }\r\n // catch(exception){\r\n // return connection;\r\n // }\r\n\r\n var Node = this.getNodeFromTree(typeId);\r\n \r\n if(Node){\r\n connection.push(Node?.value);\r\n for(let i=0; i< Node.variants.length; i++){\r\n connection.push(Node.variants[i].value);\r\n }\r\n \r\n return connection;\r\n }\r\n\r\n\r\n }\r\n\r\n\r\n\r\n\r\n\r\n\r\n /**\r\n * Retrieves all connection variants for a specific type ID filtered by user ID.\r\n *\r\n * @param typeId - The type ID to search for\r\n * @param userId - The user ID to filter by\r\n * @returns An array of Connection objects of the specified type belonging to the specified user\r\n *\r\n * @remarks\r\n * Useful for user-specific connection management and filtering.\r\n */\r\n static async getTypeVariantsFromTreeWithUserId(typeId:number, userId:number){\r\n var concepts : Connection[] = [];\r\n\r\n var Node = this.getNodeFromTree(typeId);\r\n \r\n if(Node){\r\n if(Node.value.userId == userId ){\r\n concepts.push(Node?.value);\r\n }\r\n for(let i=0; i< Node.variants.length; i++){\r\n if(Node.variants[i].value.userId == userId ){\r\n concepts.push(Node.variants[i].value);\r\n }\r\n }\r\n }\r\n return concepts;\r\n }\r\n\r\n\r\n\r\n\r\n\r\n}","/**\r\n * @fileoverview ConnectionData module for managing connection storage and retrieval in CCS-JS.\r\n * This module provides centralized management of connections using binary tree indexing\r\n * for efficient ID-based and type-based lookups.\r\n * @module DataStructures/ConnectionData\r\n */\r\n\r\nimport { removeFromDatabase, storeToDatabase } from \"../Database/NoIndexDb\";\r\nimport { BinaryCharacterTree } from \"./BinaryCharacterTree\";\r\nimport { Connection } from \"./Connection\";\r\nimport { ConnectionBinaryTree } from \"./ConnectionBinaryTree/ConnectionBinaryTree\";\r\nimport { ConnectionTypeTree } from \"./ConnectionBinaryTree/ConnectionTypeTree\";\r\n\r\n/**\r\n * Central repository for managing all connections in the CCS system.\r\n * Provides binary tree indexing for efficient connection retrieval by ID and type.\r\n * Maintains both in-memory (tree structures) and persistent (IndexedDB) storage.\r\n *\r\n * @class ConnectionData\r\n * @example\r\n * ```typescript\r\n * // Add a connection to the system\r\n * ConnectionData.AddConnection(myConnection);\r\n *\r\n * // Retrieve a connection by ID\r\n * const connection = await ConnectionData.GetConnection(123);\r\n *\r\n * // Get connections of a composition type\r\n * const connections = await ConnectionData.GetConnectionsOfCompositionLocal(10);\r\n * ```\r\n *\r\n * @remarks\r\n * This class uses static methods and properties, functioning as a singleton data store.\r\n * It coordinates ID-based and type-based indexing for optimized query performance.\r\n */\r\nexport class ConnectionData{\r\n\r\n /** Name identifier for this data structure */\r\n name: string;\r\n\r\n /**\r\n * Creates a new ConnectionData instance.\r\n * @remarks This is rarely instantiated as the class primarily uses static methods.\r\n */\r\n constructor(){\r\n this.name = \"Connection Array\";\r\n }\r\n\r\n /** Legacy array storage for connections (deprecated in favor of tree structures) */\r\n static connectionArray:Connection[] = [];\r\n\r\n /** Dictionary-style storage for quick connection lookups by ID */\r\n static connectionDictionary:Connection[] = [];\r\n\r\n /**\r\n * Checks if a connection already exists in the connections array.\r\n *\r\n * @param {Connection} connection - The connection to check for existence\r\n * @returns {boolean} True if the connection exists, false otherwise\r\n *\r\n * @example\r\n * ```typescript\r\n * const exists = ConnectionData.CheckContains(myConnection);\r\n * if (!exists) {\r\n * // Add the connection\r\n * }\r\n * ```\r\n */\r\n static CheckContains(connection: Connection){\r\n var contains = false;\r\n for(var i=0; i<this.connectionArray.length; i++){\r\n if(this.connectionArray[i].id == connection.id){\r\n contains = true;\r\n }\r\n }\r\n\r\n return contains;\r\n }\r\n\r\n /**\r\n * Adds a connection to persistent storage (IndexedDB) only.\r\n * Does not update in-memory tree structures.\r\n *\r\n * @param {Connection} connection - The connection to store persistently\r\n *\r\n * @example\r\n * ```typescript\r\n * ConnectionData.AddConnectionToStorage(myConnection);\r\n * ```\r\n */\r\n static AddConnectionToStorage(connection:Connection){\r\n storeToDatabase(\"connection\", connection);\r\n }\r\n\r\n\r\n /**\r\n * Adds a connection to both persistent storage and all in-memory tree indexes.\r\n * This is the primary method for adding connections to the system.\r\n *\r\n * @param {Connection} connection - The connection to add\r\n *\r\n * @example\r\n * ```typescript\r\n * const newConnection = new Connection(...);\r\n * ConnectionData.AddConnection(newConnection);\r\n * ```\r\n *\r\n * @remarks\r\n * Updates two tree structures:\r\n * - ConnectionBinaryTree (ID-based lookup)\r\n * - ConnectionTypeTree (type-based lookup)\r\n * Skips temporary connections (isTemp = true)\r\n */\r\n static AddConnection(connection: Connection){\r\n // var contains = this.CheckContains(connection);\r\n // if(contains){\r\n // this.RemoveConnection(connection);\r\n // }\r\n // if(connection.id != 0 || connection.isTemp){\r\n\r\n // storeToDatabase(\"connection\",connection);\r\n // }\r\n // this.connectionArray.push(connection);\r\n if(!connection.isTemp){\r\n storeToDatabase(\"connection\", connection);\r\n ConnectionBinaryTree.addConnectionToTree(connection);\r\n ConnectionTypeTree.addConnectionToTree(connection);\r\n }\r\n\r\n }\r\n\r\n /**\r\n * Adds a connection to in-memory tree structures only, without persisting to storage.\r\n * Useful for temporary connections or when storage is handled separately.\r\n *\r\n * @param {Connection} connection - The connection to add to memory\r\n *\r\n * @example\r\n * ```typescript\r\n * ConnectionData.AddConnectionToMemory(temporaryConnection);\r\n * ```\r\n *\r\n * @remarks\r\n * Updates tree structures without touching IndexedDB.\r\n * Skips temporary connections (isTemp = true)\r\n */\r\n static AddConnectionToMemory(connection:Connection){\r\n if(!connection.isTemp){\r\n ConnectionBinaryTree.addConnectionToTree(connection);\r\n ConnectionTypeTree.addConnectionToTree(connection);\r\n }\r\n }\r\n\r\n /**\r\n * Adds a connection to the dictionary for quick ID-based lookups.\r\n *\r\n * @param {Connection} connection - The connection to add to dictionary\r\n *\r\n * @example\r\n * ```typescript\r\n * ConnectionData.AddToDictionary(myConnection);\r\n * ```\r\n */\r\n static AddToDictionary(connection: Connection){\r\n this.connectionDictionary[connection.id] = connection;\r\n }\r\n\r\n /**\r\n * Removes a connection from all storage locations (memory trees and persistent storage).\r\n *\r\n * @param {Connection} connection - The connection to remove\r\n *\r\n * @example\r\n * ```typescript\r\n * ConnectionData.RemoveConnection(obsoleteConnection);\r\n * ```\r\n *\r\n * @remarks\r\n * Removes from:\r\n * - IndexedDB persistent storage\r\n * - ConnectionBinaryTree (ID index)\r\n * - ConnectionTypeTree (type index)\r\n * Only processes connections with valid IDs (id != 0)\r\n */\r\n static RemoveConnection(connection: Connection){\r\n // for(var i=0; i<this.connectionArray.length; i++){\r\n // if(this.connectionArray[i].id == connection.id){\r\n // this.connectionArray.splice(i, 1);\r\n // }\r\n // }\r\n if(connection.id != 0){\r\n removeFromDatabase(\"connection\",connection.id);\r\n ConnectionBinaryTree.removeNodeFromTree(connection.id);\r\n ConnectionTypeTree.removeTypeConcept(connection.typeId, connection.id);\r\n }\r\n }\r\n\r\n /**\r\n * Returns the root node of the connection binary tree.\r\n * Used for direct tree traversal or debugging.\r\n *\r\n * @returns {Node | null} The root node of the connection tree\r\n *\r\n * @example\r\n * ```typescript\r\n * const tree = ConnectionData.GetConnectionTree();\r\n * if (tree) {\r\n * console.log(\"Tree root:\", tree.key);\r\n * }\r\n * ```\r\n */\r\n static GetConnectionTree(){\r\n return ConnectionBinaryTree.connectionroot;\r\n }\r\n\r\n /**\r\n * Returns the root node of the connection type tree.\r\n * Used for direct tree traversal or debugging.\r\n *\r\n * @returns {Node | null} The root node of the connection type tree\r\n *\r\n * @example\r\n * ```typescript\r\n * const tree = ConnectionData.GetConnectionTypeTree();\r\n * ```\r\n */\r\n static GetConnectionTypeTree(){\r\n return ConnectionTypeTree.connectionTypeRoot;\r\n }\r\n\r\n /**\r\n * Retrieves a connection by its ID from the binary tree index.\r\n *\r\n * @param {number} id - The connection ID to retrieve\r\n * @returns {Promise<Connection>} The connection if found, or a default connection if not found\r\n *\r\n * @example\r\n * ```typescript\r\n * const connection = await ConnectionData.GetConnection(123);\r\n * if (connection.id !== 0) {\r\n * console.log(\"Found connection:\", connection.ofTheConceptId, \"->\", connection.toTheConceptId);\r\n * }\r\n * ```\r\n *\r\n * @remarks\r\n * Returns a default connection (id = 0) if the connection is not found.\r\n * Uses ConnectionBinaryTree for O(log n) lookup performance.\r\n */\r\n static async GetConnection(id: number){\r\n // var myConcept: Connection|null;\r\n // myConcept = null;\r\n // for(var i=0; i<this.connectionArray.length; i++){\r\n // if(this.connectionArray[i].id == id){\r\n // myConcept = this.connectionArray[i];\r\n // }\r\n // }\r\n // return myConcept;\r\n\r\n var myConnection: Connection = new Connection(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);\r\n var node = await ConnectionBinaryTree.getNodeFromTree(id);\r\n if(node?.value){\r\n var returnedConcept = node.value;\r\n if(returnedConcept){\r\n myConnection = returnedConcept as Connection;\r\n }\r\n }\r\n // if(myConcept.id == 0 || myConcept == null){\r\n // for(var i=0; i<this.conceptsArray.length; i++){\r\n // if(this.conceptsArray[i].id == id){\r\n // myConcept = this.conceptsArray[i];\r\n // }\r\n // }\r\n // }\r\n return myConnection;\r\n }\r\n\r\n /**\r\n * Retrieves all connections of a specific composition type ID from the type tree.\r\n * Includes the main connection and all its variants.\r\n *\r\n * @param {number} id - The type ID to filter by\r\n * @returns {Promise<Connection[]>} Array of connections with the specified type\r\n *\r\n * @example\r\n * ```typescript\r\n * const connections = await ConnectionData.GetConnectionsOfCompositionLocal(10);\r\n * console.log(`Found ${connections.length} connections of type 10`);\r\n * ```\r\n *\r\n * @remarks\r\n * Uses ConnectionTypeTree to retrieve the main connection and all variant connections.\r\n * Returns an empty array if no connections are found for the type.\r\n */\r\n static async GetConnectionsOfCompositionLocal(id: number){\r\n var connections :Connection[] = [];\r\n var node = await ConnectionTypeTree.getNodeFromTree(id);\r\n if(node?.value){\r\n var returnedConnection = node.value;\r\n if(returnedConnection){\r\n let myConnection = returnedConnection as Connection;\r\n connections.push(myConnection);\r\n for(let i=0; i<node.variants.length;i++){\r\n connections.push(node.variants[i].value);\r\n }\r\n }\r\n }\r\n // if(myConcept.id == 0 || myConcept == null){\r\n // for(var i=0; i<this.conceptsArray.length; i++){\r\n // if(this.conceptsArray[i].id == id){\r\n // myConcept = this.conceptsArray[i];\r\n // }\r\n // }\r\n // }\r\n return connections;\r\n }\r\n\r\n /**\r\n * Returns the name identifier of this data structure instance.\r\n *\r\n * @returns {string} The name \"Connection Array\"\r\n *\r\n * @example\r\n * ```typescript\r\n * const connectionData = new ConnectionData();\r\n * console.log(connectionData.getName()); // \"Connection Array\"\r\n * ```\r\n */\r\n getName(){\r\n return this.name;\r\n }\r\n}","/**\r\n * @fileoverview Defines the CountInfo class for storing connection count information.\r\n * @module DataStructures/Count/CountInfo\r\n */\r\n\r\n/**\r\n * Represents information about connection counts for a concept.\r\n * This class stores the count of connections of a specific type\r\n * associated with a particular concept, useful for analytics and statistics.\r\n *\r\n * @class CountInfo\r\n *\r\n * @example\r\n * ```typescript\r\n * const countInfo = new CountInfo();\r\n * countInfo.conceptId = 123;\r\n * countInfo.connectionTypeId = 456;\r\n * countInfo.connectionType = \"likes\";\r\n * countInfo.count = 42;\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Tracking follower counts\r\n * const followerCount = new CountInfo();\r\n * followerCount.conceptId = 100; // User ID\r\n * followerCount.connectionType = \"followers\";\r\n * followerCount.count = 1523;\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Multiple connection counts for a post\r\n * const likesCount = new CountInfo();\r\n * likesCount.conceptId = 200; // Post ID\r\n * likesCount.connectionType = \"likes\";\r\n * likesCount.count = 350;\r\n *\r\n * const commentsCount = new CountInfo();\r\n * commentsCount.conceptId = 200; // Same Post ID\r\n * commentsCount.connectionType = \"comments\";\r\n * commentsCount.count = 45;\r\n * ```\r\n */\r\nexport class CountInfo{\r\n /**\r\n * The ID of the concept for which connections are being counted.\r\n * Identifies the entity whose connections are being tracked.\r\n *\r\n * @type {number}\r\n * @default 0\r\n */\r\n conceptId: number = 0;\r\n\r\n /**\r\n * The ID of the connection type being counted.\r\n * Identifies which type of connection this count represents.\r\n *\r\n * @type {number}\r\n * @default 0\r\n */\r\n connectionTypeId: number = 0;\r\n\r\n /**\r\n * The string name/description of the connection type.\r\n * Human-readable identifier for the type of connection being counted.\r\n *\r\n * @type {string}\r\n * @default \"\"\r\n *\r\n * @example \"likes\", \"follows\", \"comments\", \"shares\"\r\n */\r\n connectionType: string = \"\";\r\n\r\n /**\r\n * The number of connections of this type.\r\n * The actual count value representing how many connections exist.\r\n *\r\n * @type {number}\r\n * @default 0\r\n */\r\n count: number = 0;\r\n}","/**\r\n * @fileoverview Defines the FilterSearch class for creating filter criteria in search queries.\r\n * @module DataStructures/FilterSearch\r\n */\r\n\r\n/**\r\n * Represents a single filter criterion for search operations.\r\n * This class encapsulates the conditions for filtering search results based on\r\n * specific fields, values, and logical operators.\r\n *\r\n * @class FilterSearch\r\n *\r\n * @example\r\n * ```typescript\r\n * const filter = new FilterSearch();\r\n * filter.type = \"age\";\r\n * filter.search = \"25\";\r\n * filter.logicoperator = \">=\";\r\n * filter.index = 0;\r\n * filter.composition = true;\r\n * filter.name = \"age_filter\";\r\n * filter.operateon = \"value\";\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // String equality filter\r\n * const nameFilter = new FilterSearch();\r\n * nameFilter.type = \"name\";\r\n * nameFilter.search = \"John\";\r\n * nameFilter.logicoperator = \"=\";\r\n * nameFilter.operateon = \"text\";\r\n * ```\r\n */\r\nexport class FilterSearch{\r\n /**\r\n * The type or field name to filter on.\r\n * Specifies which property of the entity should be evaluated by this filter.\r\n *\r\n * @type {string}\r\n * @default \"\"\r\n */\r\n type:string = \"\";\r\n\r\n /**\r\n * The search value or term to filter against.\r\n * The value that will be compared with the specified field using the logic operator.\r\n *\r\n * @type {string}\r\n * @default \"\"\r\n */\r\n search:string = \"\";\r\n\r\n /**\r\n * The logical operator for comparison.\r\n * Determines how the search value is compared with the field value.\r\n * Common operators include: \"=\", \"!=\", \">\", \"<\", \">=\", \"<=\", \"LIKE\", \"IN\".\r\n *\r\n * @type {string}\r\n * @default \"=\"\r\n */\r\n logicoperator:string = \"=\";\r\n\r\n /**\r\n * The index or position of this filter in a filter array.\r\n * Used for ordering and referencing filters in complex filter combinations.\r\n *\r\n * @type {number}\r\n * @default 0\r\n */\r\n index:number = 0;\r\n\r\n /**\r\n * Flag indicating whether this filter applies to compositions.\r\n * When true, the filter is evaluated within a composition context.\r\n *\r\n * @type {boolean}\r\n * @default true\r\n */\r\n composition:boolean = true;\r\n\r\n /**\r\n * A descriptive name for this filter.\r\n * Useful for identifying and debugging filter operations.\r\n *\r\n * @type {string}\r\n * @default \"\"\r\n */\r\n name: string = \"\";\r\n\r\n /**\r\n * The operand type or target field for the filter operation.\r\n * Specifies what kind of data or field the filter operates on\r\n * (e.g., \"value\", \"text\", \"date\", \"id\").\r\n *\r\n * @type {string}\r\n * @default \"\"\r\n */\r\n operateon: string = \"\";\r\n}","/**\r\n * @fileoverview IdentifierFlags module for tracking data loading states in CCS-JS.\r\n * This module provides centralized flags for synchronizing data loading across different storage structures.\r\n * @module DataStructures/IdentifierFlags\r\n */\r\n\r\n/**\r\n * Centralized flags for tracking the loading state of various data structures.\r\n * Used for synchronization when loading initial data from backend or local storage.\r\n *\r\n * @class IdentifierFlags\r\n * @example\r\n * ```typescript\r\n * // Check if data is loaded\r\n * if (IdentifierFlags.isDataLoaded) {\r\n * console.log(\"Concept data ready\");\r\n * }\r\n *\r\n * // Set flag when loading completes\r\n * IdentifierFlags.isDataLoaded = true;\r\n * ```\r\n *\r\n * @remarks\r\n * All properties are static flags (booleans) used across the application\r\n * to coordinate asynchronous data loading operations.\r\n */\r\nexport class IdentifierFlags{\r\n /** Flag indicating if the type tree has been loaded from backend */\r\n static isTypeLoaded = false;\r\n\r\n /** Flag indicating if the character tree has been loaded from backend */\r\n static isCharacterLoaded =false;\r\n\r\n /** Flag indicating if the main concept data has been loaded from backend */\r\n static isDataLoaded = false;\r\n\r\n /** Flag indicating if local concept data has been loaded from IndexedDB */\r\n static isLocalDataLoaded = false;\r\n\r\n /** Flag indicating if local character tree has been loaded from IndexedDB */\r\n static isLocalCharacterLoaded = false;\r\n\r\n /** Flag indicating if local type tree has been loaded from IndexedDB */\r\n static isLocalTypeLoaded = false;\r\n\r\n /** Flag indicating if connection data has been loaded from backend */\r\n static isConnectionLoaded = false;\r\n\r\n /** Flag indicating if connection type tree has been loaded from backend */\r\n static isConnectionTypeLoaded = false;\r\n\r\n /** Flag indicating if local connection data has been loaded from IndexedDB */\r\n static isLocalConnectionLoaded = false;\r\n}","/**\r\n * @fileoverview Local Concept data structure for the Concept Connection System.\r\n * This module defines the LConcept class which represents a local concept entity\r\n * with various identifiers, timestamps, and metadata properties.\r\n * @module DataStructures/Local/LConcept\r\n */\r\n\r\nimport { Concept } from \"../Concept\";\r\n\r\n/**\r\n * Represents a Local Concept in the Concept Connection System.\r\n * A local concept is a data structure that stores concept information locally\r\n * before or instead of synchronizing with a remote server.\r\n *\r\n * @class LConcept\r\n * @export\r\n */\r\nexport class LConcept{\r\n /**\r\n * Unique identifier for the concept.\r\n * @type {number}\r\n */\r\n id: number;\r\n /**\r\n * Ghost identifier for tracking purposes.\r\n * @type {number}\r\n */\r\n ghostId: number;\r\n /**\r\n * Identifier of the user who owns this concept.\r\n * @type {number}\r\n */\r\n userId: number;\r\n /**\r\n * Type identifier that classifies this concept.\r\n * @type {number}\r\n */\r\n typeId: number;\r\n /**\r\n * Category identifier for grouping concepts.\r\n * @type {number}\r\n */\r\n categoryId: number;\r\n /**\r\n * Access control identifier determining permissions.\r\n * @type {number}\r\n */\r\n accessId: number;\r\n /**\r\n * The character or text value representing this concept.\r\n * @type {string}\r\n */\r\n characterValue: string;\r\n /**\r\n * Character representation of the type.\r\n * @type {string}\r\n */\r\n typeCharacter: string;\r\n /**\r\n * Timestamp when this concept was created or entered.\r\n * @type {Date | string}\r\n */\r\n entryTimeStamp: Date|string;\r\n /**\r\n * Identifier for the referent data.\r\n * @type {number}\r\n */\r\n referentId: number;\r\n /**\r\n * Timestamp when this concept was last updated.\r\n * @type {Date | string}\r\n */\r\n updatedTimeStamp:Date|string;\r\n /**\r\n * Reference to the type concept (can be LConcept or Concept).\r\n * @type {LConcept | null | void | Concept}\r\n */\r\n type: LConcept | null | void | Concept;\r\n /**\r\n * Indicates whether this concept is newly created.\r\n * @type {boolean}\r\n */\r\n isNew: boolean;\r\n /**\r\n * Indicates whether this concept is a composition.\r\n * @type {boolean}\r\n * @default false\r\n */\r\n isComposition: boolean = false;\r\n /**\r\n * Indicates whether this concept is temporary.\r\n * @type {boolean}\r\n * @default false\r\n */\r\n isTemp: boolean = false;\r\n /**\r\n * Application identifier for multi-application support.\r\n * @type {number}\r\n * @default 999\r\n */\r\n applicationId: number = 999;\r\n\r\n /**\r\n * Creates a new LConcept instance.\r\n *\r\n * @constructor\r\n * @param {number} id - Unique identifier for the concept\r\n * @param {number} userId - Identifier of the user who owns this concept\r\n * @param {number} typeId - Type identifier that classifies this concept\r\n * @param {number} categoryId - Category identifier for grouping concepts\r\n * @param {number} accessId - Access control identifier\r\n * @param {string} characterValue - The character or text value of this concept\r\n * @param {string} typeCharacter - Character representation of the type\r\n * @param {boolean} [isNew=false] - Whether this concept is newly created\r\n * @param {Date | string} entryTimeStamp - Creation timestamp\r\n * @param {Date | string} updatedTimeStamp - Last update timestamp\r\n * @param {number} referentId - Identifier for the referent data\r\n * @param {number} [applicationId=999] - Application identifier\r\n */\r\n constructor(id: number, userId: number, typeId:number, categoryId:number,accessId: number, characterValue:string, typeCharacter:string,\r\n isNew:boolean=false, entryTimeStamp: Date|string, updatedTimeStamp:Date|string, referentId: number, applicationId: number = 999){\r\n this.id = id;\r\n this.userId = userId;\r\n this.typeId = typeId;\r\n this.ghostId = id;\r\n this.categoryId = categoryId;\r\n this.characterValue = characterValue;\r\n this.accessId = accessId;\r\n this.type = null;\r\n this.isNew = isNew;\r\n this.typeCharacter = typeCharacter;\r\n this.entryTimeStamp = entryTimeStamp;\r\n this.updatedTimeStamp = updatedTimeStamp;\r\n this.referentId = referentId;\r\n this.applicationId = applicationId;\r\n // ConceptsData.AddConcept(this);\r\n }\r\n\r\n /**\r\n * Logs the type identifier of this concept to the console.\r\n * Used primarily for debugging purposes.\r\n *\r\n * @method getType\r\n * @returns {void}\r\n */\r\n getType(){\r\n console.log(this.typeId);\r\n }\r\n\r\n \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n}","/**\r\n * @fileoverview Local Connection data structure for the Concept Connection System.\r\n * This module defines the LConnection class which represents a connection between\r\n * concepts in the local storage system.\r\n * @module DataStructures/Local/LConnection\r\n */\r\n\r\nimport { formatDate } from \"../../Services/CreateDefaultConcept\";\r\nimport { CreateDefaultLConcept } from \"../../Services/Local/CreateDefaultLConcept\";\r\nimport { Concept } from \"../Concept\";\r\nimport { LConcept } from \"./LConcept\";\r\n\r\n/**\r\n * Represents a Local Connection between concepts in the Concept Connection System.\r\n * A local connection links two concepts and stores metadata about that relationship.\r\n *\r\n * @class LConnection\r\n * @export\r\n */\r\nexport class LConnection{\r\n /**\r\n * Unique identifier for the connection.\r\n * @type {number}\r\n */\r\n id: number;\r\n /**\r\n * Ghost identifier for tracking purposes.\r\n * @type {number}\r\n */\r\n ghostId: number;\r\n /**\r\n * Identifier of the source concept (from concept).\r\n * @type {number}\r\n */\r\n ofTheConceptId: number;\r\n /**\r\n * Identifier of the target concept (to concept).\r\n * @type {number}\r\n */\r\n toTheConceptId: number;\r\n /**\r\n * Timestamp when this connection was created or entered.\r\n * @type {Date | string}\r\n */\r\n entryTimeStamp: Date|string;\r\n /**\r\n * Date and time when this connection is terminated or expires.\r\n * @type {Date}\r\n */\r\n terminationDateTime: Date;\r\n /**\r\n * Access control identifier determining permissions.\r\n * @type {number}\r\n */\r\n accessId: number;\r\n /**\r\n * Type identifier that classifies this connection.\r\n * @type {number}\r\n */\r\n typeId: number;\r\n /**\r\n * Order identifier for sequencing connections.\r\n * @type {number}\r\n */\r\n orderId: number;\r\n /**\r\n * Character representation of the connection type.\r\n * @type {string}\r\n */\r\n typeCharacter: string;\r\n /**\r\n * Timestamp of the last local synchronization.\r\n * @type {Date}\r\n */\r\n localSyncTime: Date;\r\n /**\r\n * Indicates whether this connection is temporary.\r\n * @type {boolean}\r\n * @default false\r\n */\r\n isTemp:boolean = false;\r\n /**\r\n * Application identifier for multi-application support.\r\n * @type {number}\r\n * @default 999\r\n */\r\n applicationId: number = 999;\r\n /**\r\n * Reference to the type concept for this connection.\r\n * @type {LConcept}\r\n */\r\n type: LConcept = CreateDefaultLConcept();\r\n\r\n /**\r\n * Creates a new LConnection instance.\r\n *\r\n * @constructor\r\n * @param {number} [id=0] - Unique identifier for the connection\r\n * @param {number} ofTheConceptId - Identifier of the source concept\r\n * @param {number} toTheConceptId - Identifier of the target concept\r\n * @param {number} typeId - Type identifier that classifies this connection\r\n * @param {number} orderId - Order identifier for sequencing\r\n * @param {number} accessId - Access control identifier\r\n * @param {number} [applicationId=999] - Application identifier\r\n */\r\n constructor(id: number = 0, ofTheConceptId: number, toTheConceptId: number,\r\n typeId: number, orderId: number,\r\n accessId: number, applicationId: number = 999){\r\n this.id = id;\r\n this.ofTheConceptId = ofTheConceptId;\r\n this.toTheConceptId = toTheConceptId;\r\n this.typeId = typeId;\r\n this.ghostId = id;\r\n this.orderId = orderId;\r\n this.typeCharacter = \"\";\r\n this.accessId = accessId;\r\n this.entryTimeStamp = formatDate(new Date());\r\n this.terminationDateTime = new Date();\r\n this.localSyncTime = new Date();\r\n this.applicationId = applicationId;\r\n }\r\n\r\n\r\n}","/**\r\n * @fileoverview Local Node data structure for binary tree operations.\r\n * This module defines the LNode class which represents a node in an AVL\r\n * (self-balancing) binary tree for storing and managing LConcept instances.\r\n * @module DataStructures/Local/LNode\r\n */\r\n\r\nimport { LConcept } from \"./LConcept\";\r\n\r\n/**\r\n * Represents a node in an AVL binary tree for local concepts.\r\n * This class implements self-balancing tree operations including rotations,\r\n * insertions, deletions, and lookups for efficient concept management.\r\n *\r\n * @class LNode\r\n * @export\r\n */\r\nexport class LNode{\r\n /**\r\n * The key used for tree ordering (can be number or string).\r\n * @type {any}\r\n */\r\n key:any;\r\n /**\r\n * The concept value stored in this node.\r\n * @type {LConcept}\r\n */\r\n value:LConcept;\r\n /**\r\n * Reference to the left child node.\r\n * @type {LNode | null}\r\n */\r\n leftNode: LNode | null;\r\n /**\r\n * Reference to the right child node.\r\n * @type {LNode | null}\r\n */\r\n rightNode: LNode | null;\r\n /**\r\n * Reference to current node for linking nodes with same key.\r\n * @type {LNode | null}\r\n */\r\n currentNode: LNode | null;\r\n /**\r\n * Array of variant nodes with same key but different properties.\r\n * @type {LNode[]}\r\n * @default []\r\n */\r\n variants: LNode [] = [] ;\r\n /**\r\n * Height of the node in the tree for AVL balancing.\r\n * @type {number}\r\n * @default 1\r\n */\r\n height:number = 1;\r\n\r\n /**\r\n * Creates a new LNode instance.\r\n *\r\n * @constructor\r\n * @param {any} key - The key used for tree ordering\r\n * @param {LConcept} value - The concept value to store\r\n * @param {LNode | null} leftNode - Reference to left child\r\n * @param {LNode | null} rightNode - Reference to right child\r\n */\r\n constructor(key:any, value:LConcept, leftNode: LNode | null, rightNode:LNode| null){\r\n this.key = key;\r\n this.value = value;\r\n this.leftNode = leftNode;\r\n this.rightNode = rightNode;\r\n this.currentNode = null;\r\n }\r\n\r\n /**\r\n * Adds a current node to the chain based on typeId.\r\n * This method links nodes with different typeIds.\r\n *\r\n * @method addCurrentNode\r\n * @param {LNode} passedNode - The node to add\r\n * @param {LNode | null} node - The current node in the chain\r\n * @returns {LNode | null} The updated node chain\r\n */\r\n public addCurrentNode(passedNode:LNode, node:LNode|null){\r\n if(node == null){\r\n node = passedNode;\r\n return node;\r\n }\r\n if(passedNode.value.typeId != node.value.typeId ){\r\n node.currentNode = this.addCurrentNode(passedNode, node.currentNode);\r\n }\r\n return node;\r\n }\r\n\r\n /**\r\n * Adds a node as a variant if it has the same key but different id.\r\n * This method manages variants (nodes with same key but different properties).\r\n *\r\n * @method addCurrentNodeType\r\n * @param {LNode} passedNode - The node to add as variant\r\n * @param {LNode | null} node - The current node\r\n * @returns {LNode | null} The updated node\r\n */\r\n public addCurrentNodeType(passedNode:LNode, node:LNode|null){\r\n if(node == null){\r\n node = passedNode;\r\n return node;\r\n }\r\n var contains = false;\r\n for(let i=0; i<node.variants.length; i++){\r\n if(node.variants[i].value.id == passedNode.value.id){\r\n contains = true;\r\n }\r\n }\r\n if(!contains){\r\n node.variants.push(passedNode);\r\n }\r\n //node.currentNode = this.addCurrentNode(passedNode, node.currentNode);\r\n return node;\r\n }\r\n\r\n /**\r\n * Adds a node to the AVL tree with automatic balancing.\r\n * This method performs standard AVL insertion with rotations.\r\n *\r\n * @method addNode\r\n * @param {LNode} passedNode - The node to insert\r\n * @param {LNode | null} node - The current node in traversal\r\n * @param {number} height - Current height for balancing\r\n * @returns {LNode | null} The root of the updated subtree\r\n */\r\n public addNode(passedNode:LNode, node:LNode|null, height:number){\r\n if(node == null){\r\n node = passedNode;\r\n return node;\r\n }\r\n\r\n var LeftNode = node.leftNode;\r\n var RightNode = node.rightNode;\r\n\r\n if(node.key > passedNode.key){\r\n node.leftNode = this.addNode(passedNode,LeftNode,height);\r\n }\r\n\r\n else if(node.key < passedNode.key){\r\n node.rightNode = this.addNode(passedNode,RightNode,height);\r\n }\r\n\r\n // else if (node.key == passedNode.key && node.key != \"\"){\r\n // node.currentNode = passedNode;\r\n // }\r\n else{\r\n return node;\r\n }\r\n\r\n node.height = 1 + Math.max(this.getHeight(node.leftNode), this.getHeight(node.rightNode));\r\n\r\n let balancingFactor = this.getBalanceFactor(node);\r\n if(balancingFactor > 1){\r\n if(node.leftNode){\r\n if(passedNode.key < node.leftNode.key){\r\n return this.rightRotate(node);\r\n }\r\n else if(passedNode.key > node.leftNode.key){\r\n node.leftNode = this.leftRotate(node.leftNode);\r\n return this.rightRotate(node);\r\n }\r\n }\r\n\r\n }\r\n\r\n if(balancingFactor < -1){\r\n if(node.rightNode){\r\n if(passedNode.key > node.rightNode.key){\r\n return this.leftRotate(node);\r\n }\r\n else if (passedNode.key < node.rightNode.key){\r\n node.rightNode = this.rightRotate(node.rightNode);\r\n return this.leftRotate(node);\r\n }\r\n }\r\n }\r\n return node;\r\n\r\n }\r\n\r\n /**\r\n * Adds a character node to the tree with variant management.\r\n * Handles nodes with character keys and manages variants for duplicate keys.\r\n *\r\n * @method addCharacterNode\r\n * @param {LNode} passedNode - The node to insert\r\n * @param {LNode | null} node - The current node in traversal\r\n * @param {number} height - Current height for balancing\r\n * @returns {LNode | null} The root of the updated subtree\r\n */\r\n public addCharacterNode(passedNode:LNode, node:LNode|null, height:number){\r\n var debugFlag = false;\r\n if(passedNode.value.characterValue != \"\"){\r\n\r\n // if(passedNode.value.characterValue == \"Default\"){\r\n // console.log(\"default here\");\r\n // debugFlag = true;\r\n // }\r\n\r\n if(node == null){\r\n if(debugFlag){\r\n console.log(\"equal here\", node);\r\n }\r\n node = passedNode;\r\n return node;\r\n }\r\n // if (node.key == passedNode.key && node.key != \"\" ){\r\n // if(passedNode.value.characterValue == \"Default\"){\r\n // console.log(\"equal\");\r\n // }\r\n // node.currentNode = passedNode;\r\n // return node;\r\n // }\r\n\r\n var LeftNode = node.leftNode;\r\n var RightNode = node.rightNode;\r\n\r\n if(node.key > passedNode.key){\r\n if(debugFlag){\r\n console.log(\"left here\", node);\r\n }\r\n node.leftNode = this.addCharacterNode(passedNode,LeftNode,height);\r\n }\r\n\r\n else if(node.key < passedNode.key){\r\n if(debugFlag){\r\n console.log(\"right here\", node, RightNode);\r\n }\r\n node.rightNode = this.addCharacterNode(passedNode,RightNode,height);\r\n }\r\n\r\n // else if (node.key == passedNode.key && node.key != \"\"){\r\n // node.currentNode = passedNode;\r\n // }\r\n else{\r\n if(debugFlag){\r\n console.log(\"else here\", node, passedNode);\r\n }\r\n if (node.key == passedNode.key && node.key != \"\" && node.value.id != passedNode.value.id){\r\n // node.currentNode = this.addCurrentNode(passedNode, node.currentNode);\r\n node.addCurrentNodeType(passedNode,node);\r\n }\r\n return node;\r\n }\r\n\r\n node.height = 1 + Math.max(this.getHeight(node.leftNode), this.getHeight(node.rightNode));\r\n if(debugFlag){\r\n console.log(\"height here\", node.height);\r\n }\r\n let balancingFactor = this.getBalanceFactor(node);\r\n\r\n if(debugFlag){\r\n console.log(\"balancingFactor here\",balancingFactor);\r\n }\r\n if(balancingFactor > 1){\r\n if(node.leftNode){\r\n if(passedNode.key < node.leftNode.key){\r\n var returner = this.rightRotate(node);\r\n if(debugFlag){\r\n console.log(\"returning here 1 \",returner);\r\n }\r\n return returner;\r\n }\r\n else if(passedNode.key > node.leftNode.key){\r\n node.leftNode = this.leftRotate(node.leftNode);\r\n var returner = this.rightRotate(node);\r\n if(debugFlag){\r\n console.log(\"returning here 2 \",returner);\r\n }\r\n return returner;\r\n }\r\n }\r\n\r\n }\r\n\r\n if(balancingFactor < -1){\r\n if(node.rightNode){\r\n if(passedNode.key > node.rightNode.key){\r\n\r\n var returner = this.leftRotate(node);\r\n if(debugFlag){\r\n console.log(\"returning here 3 \",returner);\r\n }\r\n return returner;\r\n }\r\n else if (passedNode.key < node.rightNode.key){\r\n node.rightNode = this.rightRotate(node.rightNode);\r\n var returner = this.leftRotate(node);\r\n if(debugFlag){\r\n console.log(\"returning here4 \",returner, node);\r\n\r\n }\r\n return returner;\r\n }\r\n }\r\n }\r\n }\r\n else{\r\n if(debugFlag){\r\n console.log(\"what here\", node);\r\n }\r\n }\r\n if(debugFlag){\r\n console.log(\"returning here 6\", node);\r\n }\r\n return node;\r\n\r\n }\r\n\r\n /**\r\n * Adds a type node to the tree with variant management.\r\n * Handles nodes with typeId keys and manages variants for duplicate typeIds.\r\n *\r\n * @method addTypeNode\r\n * @param {LNode} passedNode - The node to insert\r\n * @param {LNode | null} node - The current node in traversal\r\n * @param {number} height - Current height for balancing\r\n * @returns {LNode | null} The root of the updated subtree\r\n */\r\n public addTypeNode(passedNode:LNode, node:LNode|null, height:number){\r\n var debugFlag = false;\r\n if(passedNode.value.typeId != 0){\r\n\r\n // if(passedNode.value.characterValue == \"Default\"){\r\n // console.log(\"default here\");\r\n // debugFlag = true;\r\n // }\r\n\r\n if(node == null){\r\n if(debugFlag){\r\n console.log(\"equal here\", node);\r\n }\r\n node = passedNode;\r\n return node;\r\n }\r\n\r\n var LeftNode = node.leftNode;\r\n var RightNode = node.rightNode;\r\n\r\n if(node.key > passedNode.key){\r\n if(debugFlag){\r\n console.log(\"left here\", node);\r\n }\r\n node.leftNode = this.addTypeNode(passedNode,LeftNode,height);\r\n }\r\n\r\n else if(node.key < passedNode.key){\r\n if(debugFlag){\r\n console.log(\"right here\", node, RightNode);\r\n }\r\n node.rightNode = this.addTypeNode(passedNode,RightNode,height);\r\n }\r\n\r\n else{\r\n if(debugFlag){\r\n console.log(\"else here\", node, passedNode);\r\n }\r\n if (node.key == passedNode.key && node.key != 0 && node.value.id != passedNode.value.id){\r\n node.addCurrentNodeType(passedNode,node);\r\n }\r\n return node;\r\n }\r\n\r\n node.height = 1 + Math.max(this.getHeight(node.leftNode), this.getHeight(node.rightNode));\r\n if(debugFlag){\r\n console.log(\"height here\", node.height);\r\n }\r\n let balancingFactor = this.getBalanceFactor(node);\r\n\r\n if(debugFlag){\r\n console.log(\"balancingFactor here\",balancingFactor);\r\n }\r\n if(balancingFactor > 1){\r\n if(node.leftNode){\r\n if(passedNode.key < node.leftNode.key){\r\n var returner = this.rightRotate(node);\r\n if(debugFlag){\r\n console.log(\"returning here 1 \",returner);\r\n }\r\n return returner;\r\n }\r\n else if(passedNode.key > node.leftNode.key){\r\n node.leftNode = this.leftRotate(node.leftNode);\r\n var returner = this.rightRotate(node);\r\n if(debugFlag){\r\n console.log(\"returning here 2 \",returner);\r\n }\r\n return returner;\r\n }\r\n }\r\n\r\n }\r\n\r\n if(balancingFactor < -1){\r\n if(node.rightNode){\r\n if(passedNode.key > node.rightNode.key){\r\n\r\n var returner = this.leftRotate(node);\r\n if(debugFlag){\r\n console.log(\"returning here 3 \",returner);\r\n }\r\n return returner;\r\n }\r\n else if (passedNode.key < node.rightNode.key){\r\n node.rightNode = this.rightRotate(node.rightNode);\r\n var returner = this.leftRotate(node);\r\n if(debugFlag){\r\n console.log(\"returning here4 \",returner, node);\r\n\r\n }\r\n return returner;\r\n }\r\n }\r\n }\r\n }\r\n else{\r\n if(debugFlag){\r\n console.log(\"what here\", node);\r\n }\r\n }\r\n if(debugFlag){\r\n console.log(\"returning here 6\", node);\r\n }\r\n return node;\r\n\r\n }\r\n\r\n /**\r\n * Performs a right rotation for AVL tree balancing.\r\n *\r\n * @method rightRotate\r\n * @param {LNode | null} y - The node to rotate\r\n * @returns {LNode | null} The new root of the rotated subtree\r\n */\r\n public rightRotate(y:LNode | null){\r\n if(y){\r\n let x = y.leftNode;\r\n if(x){\r\n let T2 = x.rightNode;\r\n\r\n y.leftNode = T2;\r\n\r\n x.rightNode = y;\r\n y.height = Math.max(this.getHeight(y.leftNode), this.getHeight(y.rightNode)) + 1;\r\n\r\n x.height = Math.max(this.getHeight(x.leftNode), this.getHeight(x.rightNode)) + 1;\r\n return x;\r\n }\r\n // return x;\r\n }\r\n return y;\r\n\r\n }\r\n\r\n /**\r\n * Performs a left rotation for AVL tree balancing.\r\n *\r\n * @method leftRotate\r\n * @param {LNode | null} x - The node to rotate\r\n * @returns {LNode | null} The new root of the rotated subtree\r\n */\r\n public leftRotate(x:LNode | null){\r\n\r\n if(x){\r\n let y = x.rightNode;\r\n if(y){\r\n let T2 = y.leftNode;\r\n y.leftNode = x;\r\n x.rightNode = T2;\r\n x.height = Math.max(this.getHeight(x.leftNode),this.getHeight(x.rightNode)) + 1;\r\n y.height = Math.max(this.getHeight(y.leftNode), this.getHeight(x.rightNode)) + 1;\r\n return y;\r\n }\r\n //return y;\r\n }\r\n return x;\r\n\r\n }\r\n\r\n\r\n /**\r\n * Gets the height of a node.\r\n *\r\n * @method getHeight\r\n * @param {LNode | null} node - The node to get height from\r\n * @returns {number} The height of the node, or 0 if null\r\n */\r\n public getHeight(node: LNode| null){\r\n if(node){\r\n return node.height;\r\n }\r\n return 0;\r\n }\r\n\r\n /**\r\n * Calculates the balance factor of a node.\r\n * Balance factor = height(left subtree) - height(right subtree)\r\n *\r\n * @method getBalanceFactor\r\n * @param {LNode | null} N - The node to calculate balance factor for\r\n * @returns {number} The balance factor (-2, -1, 0, 1, or 2)\r\n */\r\n public getBalanceFactor(N: LNode | null){\r\n if (N == null){\r\n return 0;\r\n }\r\n\r\n return this.getHeight(N.leftNode) - this.getHeight(N.rightNode);\r\n }\r\n\r\n /**\r\n * Searches for a node by numeric id.\r\n *\r\n * @method getFromNode\r\n * @param {number} id - The id to search for\r\n * @param {LNode | null} node - The current node in traversal\r\n * @returns {LNode | null} The found node or null\r\n */\r\n public getFromNode(id: number, node: LNode | null) :LNode | null{\r\n if(node){\r\n if(id == node.key){\r\n return node;\r\n }\r\n else if(id < node.key){\r\n return this.getFromNode(id, node.leftNode);\r\n }\r\n else if (id > node.key) {\r\n return this.getFromNode(id, node.rightNode);\r\n }\r\n return node;\r\n }\r\n return node;\r\n\r\n }\r\n\r\n /**\r\n * Searches for a node by character value.\r\n *\r\n * @method getCharacterFromNode\r\n * @param {string} value - The character value to search for\r\n * @param {LNode | null} node - The current node in traversal\r\n * @returns {LNode | null} The found node or null\r\n */\r\n public getCharacterFromNode(value: string, node:LNode | null) :LNode | null{\r\n if(node){\r\n if(value == node.key){\r\n return node;\r\n }\r\n else if(value < node.key){\r\n return this.getCharacterFromNode(value, node.leftNode);\r\n }\r\n else if (value > node.key) {\r\n return this.getCharacterFromNode(value, node.rightNode);\r\n }\r\n return node;\r\n }\r\n return node;\r\n\r\n }\r\n\r\n\r\n\r\n\r\n /**\r\n * Searches for a node by both character value and type id.\r\n * This method also searches through variants to find exact matches.\r\n *\r\n * @method getFromNodeWithCharacterAndType\r\n * @param {string} value - The character value to search for\r\n * @param {number} typeId - The type identifier to match\r\n * @param {LNode | null} node - The current node in traversal\r\n * @returns {LNode | null} The found node or null\r\n */\r\n public getFromNodeWithCharacterAndType(value: string, typeId: number, node:LNode | null) :LNode | null{\r\n value = `${value}`;\r\n if(node){\r\n if(value == node.key){\r\n\r\n if( value == node.value.characterValue && typeId == node.value.typeId){\r\n return node;\r\n }\r\n else{\r\n for(let i=0;i<node.variants.length;i++){\r\n if(node.variants[i].value.typeId == typeId){\r\n return node.variants[i];\r\n }\r\n }\r\n // return this.getFromNodeWithCharacterAndType(value, typeId, node.currentNode);\r\n }\r\n }\r\n else if(value < node.key){\r\n return this.getFromNodeWithCharacterAndType(value, typeId, node.leftNode);\r\n }\r\n else if (value > node.key) {\r\n return this.getFromNodeWithCharacterAndType(value,typeId, node.rightNode);\r\n }\r\n return null;\r\n }\r\n return node;\r\n\r\n }\r\n\r\n /**\r\n * Removes a node from the tree by id.\r\n * Uses standard BST deletion with in-order successor replacement.\r\n *\r\n * @method removeNode\r\n * @param {LNode | null} passedNode - The current node in traversal\r\n * @param {number} id - The id of the node to remove\r\n * @returns {LNode | null} The root of the updated subtree\r\n */\r\n public removeNode(passedNode:LNode|null,id:number){\r\n if(passedNode == null){\r\n return passedNode;\r\n }\r\n if(passedNode.key > id){\r\n passedNode.leftNode = this.removeNode(passedNode.leftNode, id);\r\n return passedNode;\r\n }\r\n else if(passedNode.key < id){\r\n passedNode.rightNode = this.removeNode(passedNode.rightNode,id);\r\n return passedNode;\r\n }\r\n\r\n // if(passedNode.variants.length > 0){\r\n // if(passedNode.value.id == id ){\r\n\r\n // }\r\n // var newNode = passedNode.variants[0];\r\n // if(newNode){\r\n // passedNode.value = newNode.value;\r\n // passedNode.key = newNode.key;\r\n // passedNode.currentNode = newNode.currentNode;\r\n // return passedNode;\r\n\r\n // }\r\n // }\r\n\r\n if(passedNode.leftNode == null){\r\n let temp = passedNode.rightNode;\r\n passedNode = null;\r\n return temp;\r\n }\r\n else if(passedNode.rightNode == null){\r\n let temp = passedNode.leftNode;\r\n passedNode = null;\r\n return temp;\r\n }\r\n else{\r\n // passing the rightNode to the inOrderSuccessor gives the immediate successor of the node\r\n var immediateSuccessor = this.inOrderSuccessor(passedNode.rightNode);\r\n passedNode.value = immediateSuccessor.value;\r\n passedNode.key = immediateSuccessor.key;\r\n passedNode.variants = immediateSuccessor.variants;\r\n passedNode.currentNode = immediateSuccessor.currentNode;\r\n passedNode.rightNode = this.removeNode(passedNode.rightNode,immediateSuccessor.key);\r\n return passedNode;\r\n\r\n }\r\n\r\n }\r\n\r\n /**\r\n * Removes a node with variant management.\r\n * If the node has variants, replaces the removed node with first variant.\r\n *\r\n * @method removeNodeWithVariants\r\n * @param {LNode | null} passedNode - The current node in traversal\r\n * @param {any} typeIdentifier - The type identifier (key) to search for\r\n * @param {number} conceptId - The concept id to remove\r\n * @returns {LNode | null} The root of the updated subtree\r\n */\r\n public removeNodeWithVariants(passedNode:LNode|null,typeIdentifier:any, conceptId:number){\r\n if(passedNode == null){\r\n return passedNode;\r\n }\r\n if(passedNode.key > typeIdentifier){\r\n passedNode.leftNode = this.removeNodeWithVariants(passedNode.leftNode, typeIdentifier,conceptId);\r\n return passedNode;\r\n }\r\n else if(passedNode.key < typeIdentifier){\r\n passedNode.rightNode = this.removeNodeWithVariants(passedNode.rightNode,typeIdentifier,conceptId);\r\n return passedNode;\r\n }\r\n\r\n if(passedNode.variants.length > 0){\r\n\r\n //condition if the main node is equal to the value\r\n if(passedNode.value.id == conceptId ){\r\n var newNode = passedNode.variants[0];\r\n if(newNode){\r\n passedNode.value = newNode.value;\r\n passedNode.key = newNode.key;\r\n passedNode.currentNode = newNode.currentNode;\r\n passedNode.variants.splice(0,1);\r\n return passedNode;\r\n\r\n }\r\n }\r\n else{\r\n\r\n // in the condition that the main node is not equal to the checking value\r\n for(let i=0; i<passedNode.variants.length; i++){\r\n if(conceptId == passedNode.variants[i].value.id){\r\n passedNode.variants.splice(i, 1);\r\n return passedNode;\r\n }\r\n }\r\n }\r\n\r\n }\r\n\r\n if(passedNode.leftNode == null){\r\n let temp = passedNode.rightNode;\r\n passedNode = null;\r\n return temp;\r\n }\r\n else if(passedNode.rightNode == null){\r\n let temp = passedNode.leftNode;\r\n passedNode = null;\r\n return temp;\r\n }\r\n else{\r\n // passing the rightNode to the inOrderSuccessor gives the immediate successor of the node\r\n var immediateSuccessor = this.inOrderSuccessor(passedNode.rightNode);\r\n passedNode.value = immediateSuccessor.value;\r\n passedNode.key = immediateSuccessor.key;\r\n passedNode.variants = immediateSuccessor.variants;\r\n passedNode.currentNode = immediateSuccessor.currentNode;\r\n passedNode.rightNode = this.removeNodeWithVariants(passedNode.rightNode,immediateSuccessor.key,conceptId);\r\n return passedNode;\r\n\r\n }\r\n\r\n}\r\n\r\n\r\n /**\r\n * Counts the total number of nodes in the subtree.\r\n *\r\n * @method countNodeBelow\r\n * @param {LNode | null} root - The root of the subtree\r\n * @returns {number} The total count of nodes\r\n */\r\n countNodeBelow(root:LNode|null):number{\r\n if(root==null)\r\n {\r\n return 0;\r\n }\r\n\r\n //recursive call to left child and right child and\r\n // add the result of these with 1 ( 1 for counting the root)\r\n return 1 + this.countNodeBelow(root.leftNode) + this.countNodeBelow(root.rightNode);\r\n }\r\n\r\n /**\r\n * Finds the in-order successor (leftmost node in right subtree).\r\n * Used during node deletion.\r\n *\r\n * @method inOrderSuccessor\r\n * @param {LNode} root - The root to find successor from\r\n * @returns {LNode} The in-order successor node\r\n */\r\n inOrderSuccessor(root:LNode){\r\n while (root.leftNode != null) {\r\n root = root.leftNode;\r\n }\r\n return root;\r\n }\r\n\r\n\r\n\r\n}\r\n","/**\r\n * @fileoverview Local Binary Character Tree for managing concepts indexed by character value.\r\n * This module provides a specialized binary tree implementation for efficient character-based lookups.\r\n * @module DataStructures/Local/LocalBinaryCharacterTree\r\n */\r\n\r\nimport { LConcept } from \"../../DataStructures/Local/LConcept\";\r\nimport { IdentifierFlags } from \"./../IdentifierFlags\";\r\nimport { LNode } from \"./../Local/LNode\";\r\n\r\n/**\r\n * Binary tree data structure for managing local concepts indexed by character values.\r\n *\r\n * @remarks\r\n * This class implements an AVL tree specifically optimized for character-based lookups.\r\n * Unlike LocalBinaryTree which uses numeric IDs, this tree uses character values as keys,\r\n * enabling efficient string-based searches with O(log n) complexity.\r\n *\r\n * @example\r\n * ```typescript\r\n * const concept = new LConcept(123, \"example\", 1);\r\n * LocalBinaryCharacterTree.addConceptToTree(concept);\r\n * const node = LocalBinaryCharacterTree.getNodeFromTree(\"example\");\r\n * ```\r\n */\r\nexport class LocalBinaryCharacterTree{\r\n /**\r\n * The root node of the character-indexed binary tree.\r\n * Null if the tree is empty.\r\n */\r\n static LocalCharacterRoot: LNode | null = null;\r\n\r\n\r\n /**\r\n * Waits for local character data to be loaded into the tree.\r\n *\r\n * @returns A promise that resolves with \"done\" when data is loaded, or rejects with \"not\" after 25 seconds\r\n *\r\n * @remarks\r\n * This method polls the IdentifierFlags.isLocalCharacterLoaded flag every second.\r\n * Useful for ensuring data is ready before performing operations on the tree.\r\n *\r\n * @example\r\n * ```typescript\r\n * try {\r\n * await LocalBinaryCharacterTree.waitForDataToLoad();\r\n * console.log(\"Character data loaded\");\r\n * } catch (error) {\r\n * console.log(\"Loading timed out\");\r\n * }\r\n * ```\r\n */\r\n static async waitForDataToLoad(){\r\n return new Promise((resolve,reject) => {\r\n this.checkFlag(resolve);\r\n setTimeout(()=>{\r\n reject(\"not\")},25000);\r\n });\r\n }\r\n\r\n /**\r\n * Periodically checks if local character data has been loaded.\r\n *\r\n * @param resolve - The promise resolve function to call when data is loaded\r\n *\r\n * @remarks\r\n * This method recursively checks the IdentifierFlags.isLocalCharacterLoaded flag every 1000ms.\r\n */\r\n static checkFlag(resolve:any){\r\n\r\n if(IdentifierFlags.isLocalCharacterLoaded){\r\n return resolve(\"done\");\r\n }\r\n else{\r\n setTimeout(LocalBinaryCharacterTree.checkFlag, 1000, resolve);\r\n }\r\n };\r\n /**\r\n * Adds a node to the character-indexed binary tree.\r\n *\r\n * @param node - The LNode to be added to the tree (keyed by character value)\r\n * @returns The root node after insertion\r\n *\r\n * @remarks\r\n * If the tree is empty, the provided node becomes the root.\r\n * Otherwise, uses the addCharacterNode method for character-based insertion.\r\n *\r\n * @example\r\n * ```typescript\r\n * const node = new LNode(\"example\", concept, null, null);\r\n * await LocalBinaryCharacterTree.addNodeToTree(node);\r\n * ```\r\n */\r\n static async addNodeToTree(node:LNode){\r\n if(this.LocalCharacterRoot == null){\r\n this.LocalCharacterRoot = node;\r\n return this.LocalCharacterRoot;\r\n }\r\n else{\r\n this.LocalCharacterRoot = this.LocalCharacterRoot.addCharacterNode(node,this.LocalCharacterRoot,this.LocalCharacterRoot.height);\r\n }\r\n return this.LocalCharacterRoot;\r\n }\r\n\r\n /**\r\n * Creates a node from a concept and adds it to the character tree.\r\n *\r\n * @param concept - The LConcept object to be added to the tree\r\n *\r\n * @remarks\r\n * Only adds the concept if it has a non-empty characterValue.\r\n * The node is keyed by the concept's character value.\r\n *\r\n * @example\r\n * ```typescript\r\n * const concept = new LConcept(123, \"example\", 1);\r\n * LocalBinaryCharacterTree.addConceptToTree(concept);\r\n * ```\r\n */\r\n static addConceptToTree(concept:LConcept){\r\n if(concept.characterValue != \"\"){\r\n var node: LNode = new LNode(concept.characterValue, concept, null, null);\r\n this.addNodeToTree(node);\r\n }\r\n\r\n }\r\n\r\n /**\r\n * Retrieves a node from the tree by its character value.\r\n *\r\n * @param value - The character string to search for\r\n * @returns The LNode if found, the root node otherwise\r\n *\r\n * @remarks\r\n * Performs a binary search through the tree using the character value as the key.\r\n *\r\n * @example\r\n * ```typescript\r\n * const node = LocalBinaryCharacterTree.getNodeFromTree(\"example\");\r\n * if (node) {\r\n * console.log(\"Found concept:\", node.value);\r\n * }\r\n * ```\r\n */\r\n static getNodeFromTree(value:string){\r\n if(this.LocalCharacterRoot){\r\n var Node = this.LocalCharacterRoot.getCharacterFromNode(value, this.LocalCharacterRoot);\r\n return Node;\r\n }\r\n return this.LocalCharacterRoot;\r\n }\r\n\r\n /**\r\n * Retrieves a node by matching both character value and type ID.\r\n *\r\n * @param value - The character value to search for\r\n * @param typeId - The type ID to match\r\n * @returns The matching LNode if found, the root node otherwise\r\n *\r\n * @remarks\r\n * This method searches for a node that matches both the character value and type ID,\r\n * useful for finding specific concept variants.\r\n *\r\n * @example\r\n * ```typescript\r\n * const node = await LocalBinaryCharacterTree.getCharacterAndTypeFromTree(\"example\", 5);\r\n * if (node) {\r\n * console.log(\"Found matching concept:\", node.value);\r\n * }\r\n * ```\r\n */\r\n static async getCharacterAndTypeFromTree(value:string, typeId: number){\r\n\r\n // try{\r\n // var data = await this.waitForDataToLoad();\r\n // }\r\n // catch(exception){\r\n // return null;\r\n // }\r\n if(this.LocalCharacterRoot){\r\n var Node = this.LocalCharacterRoot.getFromNodeWithCharacterAndType(value, typeId,this.LocalCharacterRoot);\r\n return Node;\r\n }\r\n return this.LocalCharacterRoot;\r\n }\r\n\r\n /**\r\n * Removes a concept variant from the tree.\r\n *\r\n * @param character - The character value identifying the node\r\n * @param id - The concept ID to remove\r\n *\r\n * @remarks\r\n * This method removes a specific variant from a node while maintaining other variants.\r\n * If the node has no remaining variants, the entire node is removed.\r\n *\r\n * @example\r\n * ```typescript\r\n * LocalBinaryCharacterTree.removeConceptType(\"example\", 123);\r\n * ```\r\n */\r\n static removeConceptType(character:string,id:number){\r\n if(this.LocalCharacterRoot){\r\n this.LocalCharacterRoot = this.LocalCharacterRoot.removeNodeWithVariants(this.LocalCharacterRoot,character, id);\r\n }\r\n }\r\n\r\n}","/**\r\n * @fileoverview Local Binary Tree data structure for managing local concepts.\r\n * This module provides a binary tree implementation for storing and retrieving LConcept objects\r\n * using an AVL tree structure for balanced performance.\r\n * @module DataStructures/Local/LocalBinaryTree\r\n */\r\n\r\nimport { LConcept } from \"../../DataStructures/Local/LConcept\";\r\nimport { IdentifierFlags } from \"../IdentifierFlags\";\r\nimport { LNode } from \"./../Local/LNode\";\r\n\r\n/**\r\n * Binary tree data structure for managing local concepts with efficient lookup by ID.\r\n *\r\n * @remarks\r\n * This class implements a self-balancing binary search tree (AVL tree) for storing local concepts.\r\n * It provides O(log n) search, insertion, and deletion operations. The tree is keyed by concept ID\r\n * and supports asynchronous data loading with timeout capabilities.\r\n *\r\n * @example\r\n * ```typescript\r\n * const concept = new LConcept(123, \"example\", 1);\r\n * LocalBinaryTree.addConceptToTree(concept);\r\n * const node = await LocalBinaryTree.getNodeFromTree(123);\r\n * ```\r\n */\r\nexport class LocalBinaryTree{\r\n /**\r\n * The root node of the binary tree.\r\n * Null if the tree is empty.\r\n */\r\n static root: LNode | null = null;\r\n\r\n /**\r\n * Adds a node to the binary tree.\r\n *\r\n * @param node - The LNode to be added to the tree\r\n * @returns The root node after insertion\r\n *\r\n * @remarks\r\n * If the tree is empty, the provided node becomes the root.\r\n * Otherwise, the node is inserted at the appropriate position using the AVL tree algorithm.\r\n *\r\n * @example\r\n * ```typescript\r\n * const node = new LNode(123, concept, null, null);\r\n * LocalBinaryTree.addNodeToTree(node);\r\n * ```\r\n */\r\n static addNodeToTree(node:LNode){\r\n if(this.root == null){\r\n this.root = node;\r\n return this.root;\r\n }\r\n else{\r\n this.root = this.root.addNode(node,this.root,this.root.height);\r\n }\r\n }\r\n\r\n /**\r\n * Creates a node from a concept and adds it to the tree.\r\n *\r\n * @param concept - The LConcept object to be added to the tree\r\n *\r\n * @remarks\r\n * This is a convenience method that creates an LNode from the concept and adds it to the tree.\r\n * The node is keyed by the concept's ID.\r\n *\r\n * @example\r\n * ```typescript\r\n * const concept = new LConcept(123, \"example\", 1);\r\n * LocalBinaryTree.addConceptToTree(concept);\r\n * ```\r\n */\r\n static addConceptToTree(concept:LConcept){\r\n var node: LNode = new LNode(concept.id, concept, null, null);\r\n var characterNode: LNode = new LNode(concept.characterValue, concept, null,null);\r\n this.addNodeToTree(node);\r\n }\r\n\r\n /**\r\n * Waits for local data to be loaded into the tree.\r\n *\r\n * @returns A promise that resolves with \"done\" when data is loaded, or rejects with \"not\" after 25 seconds\r\n *\r\n * @remarks\r\n * This method polls the IdentifierFlags.isLocalDataLoaded flag every second until it's true.\r\n * If data isn't loaded within 25 seconds, the promise is rejected.\r\n *\r\n * @example\r\n * ```typescript\r\n * try {\r\n * await LocalBinaryTree.waitForDataToLoad();\r\n * console.log(\"Data loaded successfully\");\r\n * } catch (error) {\r\n * console.log(\"Data loading timed out\");\r\n * }\r\n * ```\r\n */\r\n static async waitForDataToLoad(){\r\n return new Promise((resolve,reject) => {\r\n this.checkFlag(resolve);\r\n setTimeout(()=>{\r\n reject(\"not\")},25000);\r\n });\r\n }\r\n\r\n /**\r\n * Periodically checks if local data has been loaded.\r\n *\r\n * @param resolve - The promise resolve function to call when data is loaded\r\n *\r\n * @remarks\r\n * This method is called recursively every 1000ms until the data is loaded.\r\n * It checks the IdentifierFlags.isLocalDataLoaded flag.\r\n */\r\n static checkFlag(resolve:any){\r\n\r\n if(IdentifierFlags.isLocalDataLoaded){\r\n return resolve(\"done\");\r\n }\r\n else{\r\n setTimeout(LocalBinaryTree.checkFlag, 1000, resolve);\r\n }\r\n };\r\n\r\n /**\r\n * Retrieves a node from the tree by its ID.\r\n *\r\n * @param id - The numeric ID of the node to retrieve\r\n * @returns The LNode if found, null otherwise\r\n *\r\n * @remarks\r\n * This method performs a binary search through the tree using the concept ID as the key.\r\n * The search has O(log n) time complexity in a balanced tree.\r\n *\r\n * @example\r\n * ```typescript\r\n * const node = await LocalBinaryTree.getNodeFromTree(123);\r\n * if (node) {\r\n * console.log(\"Found concept:\", node.value);\r\n * }\r\n * ```\r\n */\r\n static async getNodeFromTree(id:number){\r\n\r\n\r\n // try{\r\n // var data = await this.waitForDataToLoad();\r\n // }\r\n // catch(exception){\r\n // return null;\r\n // }\r\n if(this.root){\r\n var Node = this.root.getFromNode(id, this.root);\r\n return Node;\r\n }\r\n return null;\r\n }\r\n\r\n\r\n /**\r\n * Retrieves a node by matching both character value and type ID.\r\n *\r\n * @param value - The character value to search for\r\n * @param typeId - The type ID to match\r\n * @returns The matching LNode if found, the root node otherwise\r\n *\r\n * @remarks\r\n * This method searches for a node that matches both the character value and type ID.\r\n * It's useful for finding specific concept variants.\r\n *\r\n * @example\r\n * ```typescript\r\n * const node = LocalBinaryTree.getCharacterAndTypeFromTree(\"example\", 5);\r\n * if (node) {\r\n * console.log(\"Found matching concept:\", node.value);\r\n * }\r\n * ```\r\n */\r\n static getCharacterAndTypeFromTree(value:string, typeId: number){\r\n if(this.root){\r\n var Node = this.root.getFromNodeWithCharacterAndType(value, typeId,this.root);\r\n return Node;\r\n }\r\n return this.root;\r\n }\r\n\r\n /**\r\n * Removes a node from the tree by its ID.\r\n *\r\n * @param id - The numeric ID of the node to remove\r\n *\r\n * @remarks\r\n * This method removes a node from the tree while maintaining the AVL tree balance.\r\n * The tree is automatically rebalanced after removal.\r\n *\r\n * @example\r\n * ```typescript\r\n * await LocalBinaryTree.removeNodeFromTree(123);\r\n * ```\r\n */\r\n static async removeNodeFromTree(id:number){\r\n if(this.root){\r\n this.root = this.root.removeNode(this.root,id);\r\n }\r\n }\r\n}","/**\r\n * @fileoverview Local Binary Type Tree for managing concepts indexed by type ID.\r\n * This module provides a specialized binary tree for efficient type-based concept lookups and variant retrieval.\r\n * @module DataStructures/Local/LocalBinaryTypeTree\r\n */\r\n\r\nimport { LConcept } from \"../../DataStructures/Local/LConcept\";\r\nimport { IdentifierFlags } from \"./../IdentifierFlags\";\r\nimport { LNode } from \"./LNode\";\r\n\r\n/**\r\n * Binary tree data structure for managing local concepts indexed by type ID.\r\n *\r\n * @remarks\r\n * This class implements an AVL tree optimized for type-based lookups, enabling efficient\r\n * retrieval of all concepts of a specific type. It supports variant management, allowing\r\n * multiple concepts to share the same type while being stored efficiently.\r\n *\r\n * @example\r\n * ```typescript\r\n * const concept = new LConcept(123, \"example\", 5);\r\n * LocalBinaryTypeTree.addConceptToTree(concept);\r\n * const variants = LocalBinaryTypeTree.getTypeVariantsFromTree(5);\r\n * ```\r\n */\r\nexport class LocalBinaryTypeTree{\r\n /**\r\n * The root node of the type-indexed binary tree.\r\n * Null if the tree is empty.\r\n */\r\n static LocalTypeRoot: LNode | null = null;\r\n\r\n /**\r\n * Adds a node to the type-indexed binary tree.\r\n *\r\n * @param node - The LNode to be added to the tree (keyed by type ID)\r\n * @returns The root node after insertion\r\n *\r\n * @remarks\r\n * If the tree is empty, the provided node becomes the root.\r\n * Otherwise, uses the addTypeNode method for type-based insertion with variant support.\r\n *\r\n * @example\r\n * ```typescript\r\n * const node = new LNode(5, concept, null, null);\r\n * await LocalBinaryTypeTree.addNodeToTree(node);\r\n * ```\r\n */\r\n static async addNodeToTree(node:LNode){\r\n if(this.LocalTypeRoot == null){\r\n this.LocalTypeRoot = node;\r\n return this.LocalTypeRoot;\r\n }\r\n else{\r\n this.LocalTypeRoot = this.LocalTypeRoot.addTypeNode(node,this.LocalTypeRoot,this.LocalTypeRoot.height);\r\n }\r\n return this.LocalTypeRoot;\r\n }\r\n\r\n /**\r\n * Creates a node from a concept and adds it to the type tree.\r\n *\r\n * @param concept - The LConcept object to be added to the tree\r\n *\r\n * @remarks\r\n * Only adds the concept if it has a non-zero typeId.\r\n * The node is keyed by the concept's type ID.\r\n *\r\n * @example\r\n * ```typescript\r\n * const concept = new LConcept(123, \"example\", 5);\r\n * LocalBinaryTypeTree.addConceptToTree(concept);\r\n * ```\r\n */\r\n static addConceptToTree(concept:LConcept){\r\n if(concept.typeId != 0){\r\n var node: LNode = new LNode(concept.typeId, concept, null, null);\r\n this.addNodeToTree(node);\r\n }\r\n\r\n }\r\n\r\n /**\r\n * Removes a specific concept variant from the tree.\r\n *\r\n * @param typeId - The type ID identifying the node\r\n * @param id - The concept ID to remove\r\n *\r\n * @remarks\r\n * This method removes a specific variant from a node while maintaining other variants.\r\n * If the node has no remaining variants, the entire node is removed.\r\n *\r\n * @example\r\n * ```typescript\r\n * LocalBinaryTypeTree.removeConceptType(5, 123);\r\n * ```\r\n */\r\n static removeConceptType(typeId:number,id:number){\r\n if(this.LocalTypeRoot){\r\n this.LocalTypeRoot = this.LocalTypeRoot.removeNodeWithVariants(this.LocalTypeRoot,typeId, id);\r\n\r\n }\r\n }\r\n\r\n /**\r\n * Retrieves a node from the tree by its type ID.\r\n *\r\n * @param id - The numeric type ID to search for\r\n * @returns The LNode if found, the root node otherwise\r\n *\r\n * @remarks\r\n * Performs a binary search through the tree using the type ID as the key.\r\n *\r\n * @example\r\n * ```typescript\r\n * const node = LocalBinaryTypeTree.getNodeFromTree(5);\r\n * if (node) {\r\n * console.log(\"Found type node with variants:\", node.variants.length);\r\n * }\r\n * ```\r\n */\r\n static getNodeFromTree(id:number){\r\n if(this.LocalTypeRoot){\r\n var Node = this.LocalTypeRoot.getFromNode(id, this.LocalTypeRoot);\r\n return Node;\r\n }\r\n return this.LocalTypeRoot;\r\n }\r\n\r\n /**\r\n * Retrieves all concept variants for a specific type ID.\r\n *\r\n * @param typeId - The type ID to search for\r\n * @returns An array of LConcept objects of the specified type\r\n *\r\n * @remarks\r\n * This method retrieves the primary concept and all its variants that share the same type ID.\r\n * Useful for getting all concepts of a particular type in one operation.\r\n *\r\n * @example\r\n * ```typescript\r\n * const concepts = LocalBinaryTypeTree.getTypeVariantsFromTree(5);\r\n * console.log(`Found ${concepts.length} concepts of type 5`);\r\n * ```\r\n */\r\n static getTypeVariantsFromTree(typeId:number){\r\n\r\n\r\n var Node = this.getNodeFromTree(typeId);\r\n var concepts : LConcept[] = [];\r\n\r\n if(Node){\r\n concepts.push(Node?.value);\r\n for(let i=0; i< Node.variants.length; i++){\r\n concepts.push(Node.variants[i].value);\r\n }\r\n\r\n return concepts;\r\n }\r\n\r\n\r\n }\r\n\r\n /**\r\n * Waits for local type data to be loaded into the tree.\r\n *\r\n * @returns A promise that resolves with \"done\" when data is loaded, or rejects with \"not\" after 25 seconds\r\n *\r\n * @remarks\r\n * This method polls the IdentifierFlags.isLocalTypeLoaded flag every second.\r\n * Ensures type data is ready before performing operations.\r\n *\r\n * @example\r\n * ```typescript\r\n * try {\r\n * await LocalBinaryTypeTree.waitForDataToLoad();\r\n * console.log(\"Type data loaded\");\r\n * } catch (error) {\r\n * console.log(\"Loading timed out\");\r\n * }\r\n * ```\r\n */\r\n static async waitForDataToLoad(){\r\n return new Promise((resolve,reject) => {\r\n this.checkFlag(resolve);\r\n setTimeout(()=>{\r\n reject(\"not\")},25000);\r\n });\r\n }\r\n\r\n /**\r\n * Periodically checks if local type data has been loaded.\r\n *\r\n * @param resolve - The promise resolve function to call when data is loaded\r\n *\r\n * @remarks\r\n * This method recursively checks the IdentifierFlags.isLocalTypeLoaded flag every 1000ms.\r\n */\r\n static checkFlag(resolve:any){\r\n\r\n if(IdentifierFlags.isLocalTypeLoaded){\r\n return resolve(\"done\");\r\n }\r\n else{\r\n setTimeout(LocalBinaryTypeTree.checkFlag, 1000, resolve);\r\n }\r\n };\r\n\r\n\r\n /**\r\n * Retrieves all concept variants for a specific type ID filtered by user ID.\r\n *\r\n * @param typeId - The type ID to search for\r\n * @param userId - The user ID to filter by\r\n * @returns An array of LConcept objects of the specified type belonging to the specified user\r\n *\r\n * @remarks\r\n * This method retrieves all concepts of a given type that belong to a specific user.\r\n * Useful for user-specific concept management and filtering.\r\n *\r\n * @example\r\n * ```typescript\r\n * const userConcepts = await LocalBinaryTypeTree.getTypeVariantsFromTreeWithUserId(5, 42);\r\n * console.log(`Found ${userConcepts.length} concepts of type 5 for user 42`);\r\n * ```\r\n */\r\n static async getTypeVariantsFromTreeWithUserId(typeId:number, userId:number){\r\n var concepts : LConcept[] = [];\r\n // try{\r\n // var data = await this.waitForDataToLoad();\r\n // }\r\n // catch(exception){\r\n // return concepts;\r\n // }\r\n var Node = this.getNodeFromTree(typeId);\r\n\r\n if(Node){\r\n if(Node.value.userId == userId ){\r\n concepts.push(Node?.value);\r\n }\r\n for(let i=0; i< Node.variants.length; i++){\r\n if(Node.variants[i].value.userId == userId ){\r\n concepts.push(Node.variants[i].value);\r\n }\r\n }\r\n }\r\n return concepts;\r\n }\r\n\r\n\r\n\r\n\r\n}","/**\r\n * @fileoverview Local Concepts Data management for the Concept Connection System.\r\n * This module provides static methods for managing local concept data, including\r\n * adding, retrieving, and querying concepts from local binary trees and memory.\r\n * @module DataStructures/Local/LocalConceptData\r\n */\r\n\r\nimport { GetConcept } from \"../../Api/GetConcept\";\r\nimport { LConcept } from \"./../Local/LConcept\";\r\nimport { storeToDatabase } from \"../../Database/NoIndexDb\";\r\nimport { BinaryTree } from \"./../BinaryTree\";\r\nimport { LocalBinaryTree } from \"./LocalBinaryTree\";\r\nimport { LocalBinaryCharacterTree } from \"./LocalBinaryCharacterTree\";\r\nimport { LocalBinaryTypeTree } from \"./LocalBinaryTypeTree\";\r\nimport { CreateDefaultLConcept } from \"../../Services/Local/CreateDefaultLConcept\";\r\n\r\n/**\r\n * Manages local concept data storage and retrieval.\r\n * Provides static methods for managing concepts in memory and across multiple\r\n * binary tree structures for efficient querying.\r\n *\r\n * @class LocalConceptsData\r\n * @export\r\n */\r\nexport class LocalConceptsData{\r\n /**\r\n * Name identifier for this data structure.\r\n * @type {string}\r\n */\r\n name: string;\r\n\r\n /**\r\n * Creates a new LocalConceptsData instance.\r\n *\r\n * @constructor\r\n */\r\n constructor(){\r\n this.name = \"conceptsArray\";\r\n }\r\n\r\n /**\r\n * Static array storing all local concepts in memory.\r\n * @type {LConcept[]}\r\n * @static\r\n */\r\n static localconceptsArray:LConcept[] = [];\r\n\r\n\r\n\r\n /**\r\n * Adds a concept to the local storage system.\r\n * Stores the concept in the database and adds it to all relevant binary trees.\r\n *\r\n * @static\r\n * @method AddConcept\r\n * @param {LConcept} concept - The concept to add\r\n * @returns {void}\r\n */\r\n static AddConcept(concept: LConcept){\r\n if(concept.id > 0){\r\n storeToDatabase(\"localconcept\",concept);\r\n LocalBinaryTree.addConceptToTree(concept);\r\n LocalBinaryCharacterTree.addConceptToTree(concept);\r\n LocalBinaryTypeTree.addConceptToTree(concept);\r\n this.localconceptsArray.push(concept);\r\n }\r\n\r\n }\r\n\r\n /**\r\n * Adds a concept to memory only (without database storage).\r\n * Updates all relevant binary trees for fast lookups.\r\n *\r\n * @static\r\n * @method AddConceptToMemory\r\n * @param {LConcept} concept - The concept to add to memory\r\n * @returns {void}\r\n */\r\n static AddConceptToMemory(concept: LConcept){\r\n if(concept.id > 0){\r\n LocalBinaryTree.addConceptToTree(concept);\r\n LocalBinaryCharacterTree.addConceptToTree(concept);\r\n LocalBinaryTypeTree.addConceptToTree(concept);\r\n }\r\n\r\n }\r\n\r\n\r\n\r\n\r\n\r\n /**\r\n * Retrieves a concept by its ID from the local binary tree.\r\n *\r\n * @static\r\n * @async\r\n * @method GetConcept\r\n * @param {number} id - The ID of the concept to retrieve\r\n * @returns {Promise<LConcept>} The concept if found, otherwise a default concept\r\n */\r\n static async GetConcept(id: number){\r\n var myConcept: LConcept = CreateDefaultLConcept();\r\n var node = await LocalBinaryTree.getNodeFromTree(id);\r\n if(node?.value){\r\n var returnedConcept = node.value;\r\n if(returnedConcept){\r\n myConcept = returnedConcept as LConcept;\r\n }\r\n }\r\n\r\n return myConcept;\r\n }\r\n\r\n /**\r\n * Retrieves a concept by its character value.\r\n *\r\n * @static\r\n * @async\r\n * @method GetConceptByCharacter\r\n * @param {string} characterValue - The character value to search for\r\n * @returns {Promise<LConcept>} The concept if found, otherwise a default concept\r\n */\r\n static async GetConceptByCharacter(characterValue: string){\r\n var concept: LConcept = CreateDefaultLConcept();\r\n // for(var i=0; i<this.conceptsArray.length; i++){\r\n // if(this.conceptsArray[i].characterValue == characterValue){\r\n // concept = this.conceptsArray[i];\r\n // }\r\n // }\r\n\r\n var Node = LocalBinaryCharacterTree.getNodeFromTree(characterValue);\r\n if(Node){\r\n concept = Node.value;\r\n }\r\n return concept;\r\n }\r\n\r\n /**\r\n * Retrieves a concept by both character value and type ID.\r\n * Useful for finding specific concepts when multiple concepts share the same character value.\r\n *\r\n * @static\r\n * @async\r\n * @method GetConceptByCharacterAndTypeLocal\r\n * @param {string} character_value - The character value to search for\r\n * @param {number} typeId - The type ID to match\r\n * @returns {Promise<LConcept>} The concept if found, otherwise a default concept\r\n */\r\n static async GetConceptByCharacterAndTypeLocal(character_value:string, typeId: number){\r\n var concept: LConcept = CreateDefaultLConcept();\r\n // let conceptList:Concept[] = await this.GetConceptsByTypeId(typeId);\r\n // for(var i=0;i<conceptList.length; i++){\r\n\r\n // if(character_value == conceptList[i].characterValue){\r\n // concept = conceptList[i];\r\n // }\r\n // }\r\n\r\n var Node = await LocalBinaryCharacterTree.getCharacterAndTypeFromTree(character_value,typeId);\r\n if(Node){\r\n\r\n concept = Node.value;\r\n }\r\n return concept;\r\n\r\n }\r\n\r\n /**\r\n * Retrieves all concepts of a specific type.\r\n *\r\n * @static\r\n * @method GetConceptsByTypeId\r\n * @param {number} typeId - The type ID to filter by\r\n * @returns {LConcept[]} Array of concepts with the specified type\r\n */\r\n static GetConceptsByTypeId(typeId: number){\r\n var myConcept: LConcept|null;\r\n let ConceptList: LConcept[] = [];\r\n myConcept = null;\r\n for(var i=0; i<this.localconceptsArray.length; i++){\r\n if(this.localconceptsArray[i].typeId == typeId){\r\n ConceptList.push(this.localconceptsArray[i]);\r\n }\r\n }\r\n return ConceptList;\r\n }\r\n\r\n /**\r\n * Retrieves concepts filtered by both type ID and user ID.\r\n * Useful for multi-user environments.\r\n *\r\n * @static\r\n * @async\r\n * @method GetConceptsByTypeIdAndUser\r\n * @param {number} typeId - The type ID to filter by\r\n * @param {number} userId - The user ID to filter by\r\n * @returns {Promise<LConcept[]>} Array of concepts matching both criteria\r\n */\r\n static async GetConceptsByTypeIdAndUser(typeId: number, userId: number){\r\n var myConcept: LConcept|null;\r\n let ConceptList: LConcept[] = [];\r\n // myConcept = null;\r\n // for(var i=0; i<this.conceptsArray.length; i++){\r\n // if(this.conceptsArray[i].typeId == typeId && this.conceptsArray[i].userId == userId){\r\n // ConceptList.push(this.conceptsArray[i]);\r\n // }\r\n // }\r\n ConceptList = await LocalBinaryTypeTree.getTypeVariantsFromTreeWithUserId(typeId, userId);\r\n return ConceptList;\r\n }\r\n\r\n\r\n\r\n\r\n /**\r\n * Gets the name of this data structure.\r\n *\r\n * @method getName\r\n * @returns {string} The name identifier\r\n */\r\n getName(){\r\n return this.name;\r\n }\r\n}\r\n","/**\r\n * @fileoverview Local Connection Data management for the Concept Connection System.\r\n * This module provides static methods for managing local connection data, including\r\n * adding, removing, and retrieving connections from memory and database storage.\r\n * @module DataStructures/Local/LocalConnectionData\r\n */\r\n\r\nimport {storeToDatabase } from \"../../Database/NoIndexDb\";\r\nimport { IdentifierFlags } from \"../IdentifierFlags\";\r\nimport { LConnection } from \"./LConnection\";\r\n\r\n/**\r\n * Manages local connection data storage and retrieval.\r\n * Provides static methods for managing connections in memory and database,\r\n * with support for querying connections by composition and waiting for data loads.\r\n *\r\n * @class LocalConnectionData\r\n * @export\r\n */\r\nexport class LocalConnectionData{\r\n /**\r\n * Name identifier for this data structure.\r\n * @type {string}\r\n */\r\n name: string;\r\n\r\n /**\r\n * Creates a new LocalConnectionData instance.\r\n *\r\n * @constructor\r\n */\r\n constructor(){\r\n this.name = \"Connection Array\";\r\n }\r\n\r\n /**\r\n * Static array storing all local connections in memory.\r\n * @type {LConnection[]}\r\n * @static\r\n */\r\n static connectionArray:LConnection[] = [];\r\n\r\n /**\r\n * Static dictionary/map for fast connection lookups by ID.\r\n * @type {LConnection[]}\r\n * @static\r\n */\r\n static connectionDictionary:LConnection[] = [];\r\n\r\n /**\r\n * Checks if a connection already exists in the array.\r\n *\r\n * @static\r\n * @method CheckContains\r\n * @param {LConnection} connection - The connection to check\r\n * @returns {boolean} True if the connection exists, false otherwise\r\n */\r\n static CheckContains(connection: LConnection){\r\n var contains = false;\r\n for(var i=0; i<this.connectionArray.length; i++){\r\n if(this.connectionArray[i].id == connection.id){\r\n contains = true;\r\n }\r\n }\r\n\r\n return contains;\r\n }\r\n\r\n\r\n /**\r\n * Adds a connection to the local storage system.\r\n * If the connection already exists, it is removed and re-added.\r\n * Stores non-temporary connections with valid IDs to the database.\r\n *\r\n * @static\r\n * @method AddConnection\r\n * @param {LConnection} connection - The connection to add\r\n * @returns {void}\r\n */\r\n static AddConnection(connection: LConnection){\r\n var contains = this.CheckContains(connection);\r\n if(contains){\r\n this.RemoveConnection(connection);\r\n }\r\n if(connection.id != 0 || connection.isTemp){\r\n\r\n storeToDatabase(\"localconnection\",connection);\r\n }\r\n this.connectionArray.push(connection);\r\n }\r\n\r\n /**\r\n * Adds a connection to the fast lookup dictionary.\r\n *\r\n * @static\r\n * @method AddToDictionary\r\n * @param {LConnection} connection - The connection to add to dictionary\r\n * @returns {void}\r\n */\r\n static AddToDictionary(connection: LConnection){\r\n this.connectionDictionary[connection.id] = connection;\r\n }\r\n\r\n /**\r\n * Removes a connection from the local storage system.\r\n * Removes from both the array and the database (if it has a valid ID).\r\n *\r\n * @static\r\n * @method RemoveConnection\r\n * @param {LConnection} connection - The connection to remove\r\n * @returns {void}\r\n */\r\n static RemoveConnection(connection: LConnection){\r\n for(var i=0; i<this.connectionArray.length; i++){\r\n if(this.connectionArray[i].id == connection.id){\r\n this.connectionArray.splice(i, 1);\r\n }\r\n }\r\n if(connection.id != 0){\r\n // removeFromDatabase(\"connection\",connection.id);\r\n\r\n }\r\n }\r\n\r\n /**\r\n * Retrieves a connection by its ID.\r\n *\r\n * @static\r\n * @method GetConnection\r\n * @param {number} id - The ID of the connection to retrieve\r\n * @returns {LConnection | null} The connection if found, null otherwise\r\n */\r\n static GetConnection(id: number){\r\n var myConcept: LConnection|null;\r\n myConcept = null;\r\n for(var i=0; i<this.connectionArray.length; i++){\r\n if(this.connectionArray[i].id == id){\r\n myConcept = this.connectionArray[i];\r\n }\r\n }\r\n return myConcept;\r\n }\r\n\r\n\r\n /**\r\n * Waits for the local connection data to finish loading.\r\n * Uses a polling mechanism to check the loading flag.\r\n *\r\n * @static\r\n * @async\r\n * @method waitForDataToLoad\r\n * @returns {Promise<string>} Resolves with \"done\" when loaded, rejects after 25 seconds\r\n */\r\n static async waitForDataToLoad(){\r\n return new Promise((resolve,reject) => {\r\n this.checkFlag(resolve);\r\n setTimeout(()=>{\r\n reject(\"not\")},25000);\r\n });\r\n }\r\n\r\n\r\n /**\r\n * Polling function that checks if connection data has finished loading.\r\n *\r\n * @static\r\n * @method checkFlag\r\n * @param {Function} resolve - The promise resolve function\r\n * @returns {*} Resolves immediately if loaded, otherwise schedules next check\r\n */\r\n static checkFlag(resolve:any){\r\n\r\n if(IdentifierFlags.isLocalConnectionLoaded){\r\n return resolve(\"done\");\r\n }\r\n else{\r\n setTimeout(LocalConnectionData.checkFlag, 1000, resolve);\r\n }\r\n };\r\n\r\n /**\r\n * Retrieves all connections of a specific composition (by type ID).\r\n * Waits for data to load if necessary.\r\n *\r\n * @static\r\n * @async\r\n * @method GetConnectionsOfCompositionLocal\r\n * @param {number} id - The composition type ID to filter by\r\n * @returns {Promise<LConnection[]>} Array of connections with the specified type\r\n */\r\n static async GetConnectionsOfCompositionLocal(id: number){\r\n var connectionList:LConnection[] = [];\r\n\r\n try{\r\n // var data = await this.waitForDataToLoad();\r\n\r\n for(var i=0; i<this.connectionArray.length; i++){\r\n if(this.connectionArray[i].typeId == id){\r\n connectionList.push(this.connectionArray[i]);\r\n }\r\n }\r\n return connectionList;\r\n }\r\n catch(exception){\r\n return connectionList;\r\n }\r\n }\r\n\r\n /**\r\n * Gets the name of this data structure.\r\n *\r\n * @method getName\r\n * @returns {string} The name identifier\r\n */\r\n getName(){\r\n return this.name;\r\n }\r\n}\r\n","import { Concept } from \"./Concept\";\r\n\r\nexport class Node{\r\n key:any;\r\n value:Concept;\r\n leftNode: Node | null;\r\n rightNode: Node | null;\r\n currentNode: Node | null;\r\n variants: Node [] = [] ;\r\n height:number = 1;\r\n\r\n constructor(key:any, value:Concept, leftNode: Node | null, rightNode:Node| null){\r\n this.key = key;\r\n this.value = value;\r\n this.leftNode = leftNode;\r\n this.rightNode = rightNode;\r\n this.currentNode = null;\r\n }\r\n\r\n public addCurrentNode(passedNode:Node, node:Node|null){\r\n if(node == null){\r\n node = passedNode;\r\n return node;\r\n }\r\n if(passedNode.value.typeId != node.value.typeId ){\r\n node.currentNode = this.addCurrentNode(passedNode, node.currentNode);\r\n }\r\n return node;\r\n }\r\n\r\n public addCurrentNodeType(passedNode:Node, node:Node|null){\r\n if(node == null){\r\n node = passedNode;\r\n return node;\r\n }\r\n var contains = false;\r\n for(let i=0; i<node.variants.length; i++){\r\n if(node.variants[i].value.id == passedNode.value.id){\r\n contains = true;\r\n }\r\n }\r\n if(!contains){\r\n node.variants.push(passedNode);\r\n }\r\n //node.currentNode = this.addCurrentNode(passedNode, node.currentNode);\r\n return node;\r\n }\r\n\r\n public addNode(passedNode:Node, node:Node|null, height:number){\r\n if(node == null){\r\n node = passedNode;\r\n return node;\r\n }\r\n\r\n var LeftNode = node.leftNode;\r\n var RightNode = node.rightNode;\r\n\r\n if(node.key > passedNode.key){\r\n node.leftNode = this.addNode(passedNode,LeftNode,height);\r\n }\r\n\r\n else if(node.key < passedNode.key){\r\n node.rightNode = this.addNode(passedNode,RightNode,height);\r\n }\r\n\r\n // else if (node.key == passedNode.key && node.key != \"\"){\r\n // node.currentNode = passedNode;\r\n // }\r\n else{\r\n return node;\r\n }\r\n\r\n node.height = 1 + Math.max(this.getHeight(node.leftNode), this.getHeight(node.rightNode));\r\n\r\n let balancingFactor = this.getBalanceFactor(node);\r\n if(balancingFactor > 1){\r\n if(node.leftNode){\r\n if(passedNode.key < node.leftNode.key){\r\n return this.rightRotate(node);\r\n }\r\n else if(passedNode.key > node.leftNode.key){\r\n node.leftNode = this.leftRotate(node.leftNode);\r\n return this.rightRotate(node);\r\n }\r\n }\r\n\r\n }\r\n\r\n if(balancingFactor < -1){\r\n if(node.rightNode){\r\n if(passedNode.key > node.rightNode.key){\r\n return this.leftRotate(node);\r\n }\r\n else if (passedNode.key < node.rightNode.key){\r\n node.rightNode = this.rightRotate(node.rightNode);\r\n return this.leftRotate(node);\r\n }\r\n }\r\n }\r\n return node;\r\n \r\n }\r\n\r\n public addCharacterNode(passedNode:Node, node:Node|null, height:number){\r\n var debugFlag = false;\r\n if(passedNode.value.characterValue != \"\"){\r\n\r\n // if(passedNode.value.characterValue == \"Default\"){\r\n // console.log(\"default here\");\r\n // debugFlag = true;\r\n // }\r\n\r\n if(node == null){\r\n if(debugFlag){\r\n console.log(\"equal here\", node);\r\n }\r\n node = passedNode;\r\n return node;\r\n }\r\n // if (node.key == passedNode.key && node.key != \"\" ){\r\n // if(passedNode.value.characterValue == \"Default\"){\r\n // console.log(\"equal\");\r\n // }\r\n // node.currentNode = passedNode;\r\n // return node;\r\n // }\r\n\r\n var LeftNode = node.leftNode;\r\n var RightNode = node.rightNode;\r\n\r\n if(node.key > passedNode.key){\r\n if(debugFlag){\r\n console.log(\"left here\", node);\r\n }\r\n node.leftNode = this.addCharacterNode(passedNode,LeftNode,height);\r\n }\r\n\r\n else if(node.key < passedNode.key){\r\n if(debugFlag){\r\n console.log(\"right here\", node, RightNode);\r\n }\r\n node.rightNode = this.addCharacterNode(passedNode,RightNode,height);\r\n }\r\n\r\n // else if (node.key == passedNode.key && node.key != \"\"){\r\n // node.currentNode = passedNode;\r\n // }\r\n else{\r\n if(debugFlag){\r\n console.log(\"else here\", node, passedNode);\r\n }\r\n if (node.key == passedNode.key && node.key != \"\" && node.value.id != passedNode.value.id){\r\n // node.currentNode = this.addCurrentNode(passedNode, node.currentNode);\r\n node.addCurrentNodeType(passedNode,node);\r\n }\r\n return node;\r\n }\r\n\r\n node.height = 1 + Math.max(this.getHeight(node.leftNode), this.getHeight(node.rightNode));\r\n if(debugFlag){\r\n console.log(\"height here\", node.height);\r\n }\r\n let balancingFactor = this.getBalanceFactor(node);\r\n\r\n if(debugFlag){\r\n console.log(\"balancingFactor here\",balancingFactor);\r\n }\r\n if(balancingFactor > 1){\r\n if(node.leftNode){\r\n if(passedNode.key < node.leftNode.key){\r\n var returner = this.rightRotate(node);\r\n if(debugFlag){\r\n console.log(\"returning here 1 \",returner);\r\n }\r\n return returner;\r\n }\r\n else if(passedNode.key > node.leftNode.key){\r\n node.leftNode = this.leftRotate(node.leftNode);\r\n var returner = this.rightRotate(node);\r\n if(debugFlag){\r\n console.log(\"returning here 2 \",returner);\r\n }\r\n return returner;\r\n }\r\n }\r\n\r\n }\r\n\r\n if(balancingFactor < -1){\r\n if(node.rightNode){\r\n if(passedNode.key > node.rightNode.key){\r\n\r\n var returner = this.leftRotate(node);\r\n if(debugFlag){\r\n console.log(\"returning here 3 \",returner);\r\n }\r\n return returner;\r\n }\r\n else if (passedNode.key < node.rightNode.key){\r\n node.rightNode = this.rightRotate(node.rightNode);\r\n var returner = this.leftRotate(node);\r\n if(debugFlag){\r\n console.log(\"returning here4 \",returner, node);\r\n\r\n }\r\n return returner;\r\n }\r\n }\r\n }\r\n }\r\n else{\r\n if(debugFlag){\r\n console.log(\"what here\", node);\r\n }\r\n }\r\n if(debugFlag){\r\n console.log(\"returning here 6\", node);\r\n }\r\n return node;\r\n\r\n }\r\n\r\n public addTypeNode(passedNode:Node, node:Node|null, height:number){\r\n var debugFlag = false;\r\n if(passedNode.value.typeId != 0){\r\n\r\n // if(passedNode.value.characterValue == \"Default\"){\r\n // console.log(\"default here\");\r\n // debugFlag = true;\r\n // }\r\n\r\n if(node == null){\r\n if(debugFlag){\r\n console.log(\"equal here\", node);\r\n }\r\n node = passedNode;\r\n return node;\r\n }\r\n\r\n var LeftNode = node.leftNode;\r\n var RightNode = node.rightNode;\r\n\r\n if(node.key > passedNode.key){\r\n if(debugFlag){\r\n console.log(\"left here\", node);\r\n }\r\n node.leftNode = this.addTypeNode(passedNode,LeftNode,height);\r\n }\r\n\r\n else if(node.key < passedNode.key){\r\n if(debugFlag){\r\n console.log(\"right here\", node, RightNode);\r\n }\r\n node.rightNode = this.addTypeNode(passedNode,RightNode,height);\r\n }\r\n\r\n else{\r\n if(debugFlag){\r\n console.log(\"else here\", node, passedNode);\r\n }\r\n if (node.key == passedNode.key && node.key != 0 && node.value.id != passedNode.value.id){\r\n node.addCurrentNodeType(passedNode,node);\r\n }\r\n return node;\r\n }\r\n\r\n node.height = 1 + Math.max(this.getHeight(node.leftNode), this.getHeight(node.rightNode));\r\n if(debugFlag){\r\n console.log(\"height here\", node.height);\r\n }\r\n let balancingFactor = this.getBalanceFactor(node);\r\n\r\n if(debugFlag){\r\n console.log(\"balancingFactor here\",balancingFactor);\r\n }\r\n if(balancingFactor > 1){\r\n if(node.leftNode){\r\n if(passedNode.key < node.leftNode.key){\r\n var returner = this.rightRotate(node);\r\n if(debugFlag){\r\n console.log(\"returning here 1 \",returner);\r\n }\r\n return returner;\r\n }\r\n else if(passedNode.key > node.leftNode.key){\r\n node.leftNode = this.leftRotate(node.leftNode);\r\n var returner = this.rightRotate(node);\r\n if(debugFlag){\r\n console.log(\"returning here 2 \",returner);\r\n }\r\n return returner;\r\n }\r\n }\r\n\r\n }\r\n\r\n if(balancingFactor < -1){\r\n if(node.rightNode){\r\n if(passedNode.key > node.rightNode.key){\r\n\r\n var returner = this.leftRotate(node);\r\n if(debugFlag){\r\n console.log(\"returning here 3 \",returner);\r\n }\r\n return returner;\r\n }\r\n else if (passedNode.key < node.rightNode.key){\r\n node.rightNode = this.rightRotate(node.rightNode);\r\n var returner = this.leftRotate(node);\r\n if(debugFlag){\r\n console.log(\"returning here4 \",returner, node);\r\n\r\n }\r\n return returner;\r\n }\r\n }\r\n }\r\n }\r\n else{\r\n if(debugFlag){\r\n console.log(\"what here\", node);\r\n }\r\n }\r\n if(debugFlag){\r\n console.log(\"returning here 6\", node);\r\n }\r\n return node;\r\n\r\n }\r\n\r\n public rightRotate(y:Node | null){\r\n if(y){\r\n let x = y.leftNode;\r\n if(x){\r\n let T2 = x.rightNode;\r\n\r\n y.leftNode = T2;\r\n \r\n x.rightNode = y;\r\n y.height = Math.max(this.getHeight(y.leftNode), this.getHeight(y.rightNode)) + 1;\r\n \r\n x.height = Math.max(this.getHeight(x.leftNode), this.getHeight(x.rightNode)) + 1;\r\n return x;\r\n }\r\n // return x;\r\n }\r\n return y;\r\n\r\n }\r\n\r\n public leftRotate(x:Node | null){\r\n\r\n if(x){\r\n let y = x.rightNode;\r\n if(y){\r\n let T2 = y.leftNode;\r\n y.leftNode = x;\r\n x.rightNode = T2;\r\n x.height = Math.max(this.getHeight(x.leftNode),this.getHeight(x.rightNode)) + 1;\r\n y.height = Math.max(this.getHeight(y.leftNode), this.getHeight(x.rightNode)) + 1;\r\n return y;\r\n }\r\n //return y;\r\n }\r\n return x;\r\n\r\n }\r\n \r\n\r\n public getHeight(node: Node| null){\r\n if(node){\r\n return node.height;\r\n } \r\n return 0;\r\n }\r\n\r\n public getBalanceFactor(N: Node | null){\r\n if (N == null){\r\n return 0;\r\n }\r\n \r\n return this.getHeight(N.leftNode) - this.getHeight(N.rightNode);\r\n }\r\n\r\n public getFromNode(id: number, node: Node | null) :Node | null{\r\n if(node){\r\n if(id == node.key){\r\n return node;\r\n }\r\n else if(id < node.key){\r\n return this.getFromNode(id, node.leftNode);\r\n }\r\n else if (id > node.key) {\r\n return this.getFromNode(id, node.rightNode);\r\n }\r\n return node;\r\n }\r\n return node;\r\n\r\n }\r\n\r\n public getCharacterFromNode(value: string, node: Node | null) :Node | null{\r\n if(node){\r\n if(value == node.key){\r\n return node;\r\n }\r\n else if(value < node.key){\r\n return this.getCharacterFromNode(value, node.leftNode);\r\n }\r\n else if (value > node.key) {\r\n return this.getCharacterFromNode(value, node.rightNode);\r\n }\r\n return node;\r\n }\r\n return node;\r\n\r\n }\r\n\r\n public getCharacterFromNodeUpdated(value: string, node: Node | null) :Node | null{\r\n if(node){\r\n if(value == node.key || node.value?.typeId == 51){\r\n return node;\r\n }\r\n else if(value < node.key){\r\n return this.getCharacterFromNode(value, node.leftNode);\r\n }\r\n else if (value > node.key) {\r\n return this.getCharacterFromNode(value, node.rightNode);\r\n }\r\n return node;\r\n }\r\n return node;\r\n\r\n }\r\n\r\n\r\n\r\n \r\n public getFromNodeWithCharacterAndType(value: string, typeId: number, node: Node | null) :Node | null{\r\n value = `${value}`;\r\n if(node){\r\n if(value == node.key){\r\n\r\n if( value == node.value.characterValue && typeId == node.value.typeId){\r\n return node;\r\n }\r\n else{\r\n for(let i=0;i<node.variants.length;i++){\r\n if(node.variants[i].value.typeId == typeId){\r\n return node.variants[i];\r\n }\r\n }\r\n // return this.getFromNodeWithCharacterAndType(value, typeId, node.currentNode);\r\n }\r\n }\r\n else if(value < node.key){\r\n return this.getFromNodeWithCharacterAndType(value, typeId, node.leftNode);\r\n }\r\n else if (value > node.key) {\r\n return this.getFromNodeWithCharacterAndType(value,typeId, node.rightNode);\r\n }\r\n return null;\r\n }\r\n return node;\r\n\r\n }\r\n\r\n public getFromNodeWithCharacterAndCategory(value: string, categoryId: number, node:Node | null) :Node | null{\r\n value = `${value}`;\r\n if(node){\r\n if(value == node.key){\r\n\r\n if( value == node.value.characterValue && categoryId == node.value.categoryId){\r\n return node;\r\n }\r\n else{\r\n for(let i=0;i<node.variants.length;i++){\r\n if(node.variants[i].value.categoryId == categoryId){\r\n return node.variants[i];\r\n }\r\n }\r\n // return this.getFromNodeWithCharacterAndType(value, typeId, node.currentNode);\r\n }\r\n }\r\n else if(value < node.key){\r\n return this.getFromNodeWithCharacterAndCategory(value, categoryId, node.leftNode);\r\n }\r\n else if (value > node.key) {\r\n return this.getFromNodeWithCharacterAndCategory(value,categoryId, node.rightNode);\r\n }\r\n return null;\r\n }\r\n return node;\r\n\r\n }\r\n\r\n public removeNode(passedNode:Node|null,id:number){\r\n if(passedNode == null){\r\n return passedNode;\r\n }\r\n if(passedNode.key > id){\r\n passedNode.leftNode = this.removeNode(passedNode.leftNode, id);\r\n return passedNode;\r\n }\r\n else if(passedNode.key < id){\r\n passedNode.rightNode = this.removeNode(passedNode.rightNode,id);\r\n return passedNode;\r\n }\r\n\r\n // if(passedNode.variants.length > 0){\r\n // if(passedNode.value.id == id ){\r\n\r\n // }\r\n // var newNode = passedNode.variants[0];\r\n // if(newNode){\r\n // passedNode.value = newNode.value;\r\n // passedNode.key = newNode.key;\r\n // passedNode.currentNode = newNode.currentNode;\r\n // return passedNode;\r\n\r\n // }\r\n // }\r\n\r\n if(passedNode.leftNode == null){\r\n let temp = passedNode.rightNode;\r\n passedNode = null;\r\n return temp;\r\n }\r\n else if(passedNode.rightNode == null){\r\n let temp = passedNode.leftNode;\r\n passedNode = null;\r\n return temp;\r\n }\r\n else{ \r\n // passing the rightNode to the inOrderSuccessor gives the immediate successor of the node\r\n var immediateSuccessor = this.inOrderSuccessor(passedNode.rightNode);\r\n passedNode.value = immediateSuccessor.value;\r\n passedNode.key = immediateSuccessor.key;\r\n passedNode.variants = immediateSuccessor.variants;\r\n passedNode.currentNode = immediateSuccessor.currentNode;\r\n passedNode.rightNode = this.removeNode(passedNode.rightNode,immediateSuccessor.key);\r\n return passedNode;\r\n\r\n }\r\n \r\n }\r\n\r\n public removeNodeWithVariants(passedNode:Node|null,typeIdentifier:any, conceptId:number){\r\n if(passedNode == null){\r\n return passedNode;\r\n }\r\n if(passedNode.key > typeIdentifier){\r\n passedNode.leftNode = this.removeNodeWithVariants(passedNode.leftNode, typeIdentifier,conceptId);\r\n return passedNode;\r\n }\r\n else if(passedNode.key < typeIdentifier){\r\n passedNode.rightNode = this.removeNodeWithVariants(passedNode.rightNode,typeIdentifier,conceptId);\r\n return passedNode;\r\n }\r\n\r\n if(passedNode.variants.length > 0){\r\n\r\n //condition if the main node is equal to the value\r\n if(passedNode.value.id == conceptId ){\r\n var newNode = passedNode.variants[0];\r\n if(newNode){\r\n passedNode.value = newNode.value;\r\n passedNode.key = newNode.key;\r\n passedNode.currentNode = newNode.currentNode;\r\n passedNode.variants.splice(0,1);\r\n return passedNode;\r\n \r\n }\r\n }\r\n else{\r\n\r\n // in the condition that the main node is not equal to the checking value \r\n for(let i=0; i<passedNode.variants.length; i++){\r\n if(conceptId == passedNode.variants[i].value.id){\r\n passedNode.variants.splice(i, 1);\r\n return passedNode;\r\n }\r\n }\r\n }\r\n\r\n }\r\n\r\n if(passedNode.leftNode == null){\r\n let temp = passedNode.rightNode;\r\n passedNode = null;\r\n return temp;\r\n }\r\n else if(passedNode.rightNode == null){\r\n let temp = passedNode.leftNode;\r\n passedNode = null;\r\n return temp;\r\n }\r\n else{ \r\n // passing the rightNode to the inOrderSuccessor gives the immediate successor of the node\r\n var immediateSuccessor = this.inOrderSuccessor(passedNode.rightNode);\r\n passedNode.value = immediateSuccessor.value;\r\n passedNode.key = immediateSuccessor.key;\r\n passedNode.variants = immediateSuccessor.variants;\r\n passedNode.currentNode = immediateSuccessor.currentNode;\r\n passedNode.rightNode = this.removeNodeWithVariants(passedNode.rightNode,immediateSuccessor.key,conceptId);\r\n return passedNode;\r\n\r\n }\r\n\r\n}\r\n\r\n\r\n countNodeBelow(root:Node|null):number{\r\n if(root==null)\r\n {\r\n return 0;\r\n }\r\n\r\n //recursive call to left child and right child and\r\n // add the result of these with 1 ( 1 for counting the root)\r\n return 1 + this.countNodeBelow(root.leftNode) + this.countNodeBelow(root.rightNode);\r\n }\r\n\r\n inOrderSuccessor(root:Node){\r\n while (root.leftNode != null) {\r\n root = root.leftNode;\r\n }\r\n return root;\r\n }\r\n\r\n\r\n\r\n}","/**\r\n * @fileoverview Defines the PatcherStructure class for patching/updating compositions.\r\n * @module DataStructures/PatcherStructure\r\n */\r\n\r\n/**\r\n * Represents a structure for patching or updating composition data.\r\n * This class encapsulates all necessary information for performing partial updates\r\n * on compositions, including identification, permissions, and the actual patch data.\r\n *\r\n * @class PatcherStructure\r\n *\r\n * @example\r\n * ```typescript\r\n * const patcher = new PatcherStructure();\r\n * patcher.compositionId = 123;\r\n * patcher.userId = 1;\r\n * patcher.sessionId = 456;\r\n * patcher.accessId = 4;\r\n * patcher.ofTheCompositionId = 789;\r\n * patcher.patchObject = { name: \"Updated Name\", description: \"New description\" };\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Patching a user profile composition\r\n * const profilePatcher = new PatcherStructure();\r\n * profilePatcher.compositionId = 100;\r\n * profilePatcher.userId = 25;\r\n * profilePatcher.patchObject = {\r\n * email: \"newemail@example.com\",\r\n * bio: \"Updated bio\"\r\n * };\r\n * ```\r\n */\r\nexport class PatcherStructure {\r\n /**\r\n * The ID of the composition to be patched.\r\n * Identifies which composition will receive the update.\r\n *\r\n * @type {number}\r\n * @default 0\r\n */\r\n compositionId: number = 0\r\n\r\n /**\r\n * The ID of the user performing the patch operation.\r\n * Used for access control and audit purposes.\r\n *\r\n * @type {number}\r\n * @default 999\r\n */\r\n userId: number = 999\r\n\r\n /**\r\n * The session ID associated with the patch operation.\r\n * Links the patch to a specific user session for tracking.\r\n *\r\n * @type {number}\r\n * @default 999\r\n */\r\n sessionId: number = 999\r\n\r\n /**\r\n * The access level ID for the patch operation.\r\n * Determines what level of access is required to perform this patch.\r\n *\r\n * @type {number}\r\n * @default 4\r\n */\r\n accessId: number = 4\r\n\r\n /**\r\n * The ID of the parent or related composition.\r\n * Used when patching within a composition hierarchy or relationship.\r\n *\r\n * @type {number}\r\n * @default 0\r\n */\r\n ofTheCompositionId: number = 0\r\n\r\n /**\r\n * The object containing the patch data.\r\n * Contains key-value pairs representing the fields to update and their new values.\r\n * Can be any structure depending on the composition being patched.\r\n *\r\n * @type {any}\r\n * @default {}\r\n *\r\n * @example\r\n * ```typescript\r\n * patchObject = {\r\n * name: \"New Name\",\r\n * age: 30,\r\n * tags: [\"tag1\", \"tag2\"]\r\n * }\r\n * ```\r\n */\r\n patchObject: any = {}\r\n }\r\n ","/**\r\n * @fileoverview ReservedIds module for managing pre-allocated concept and connection IDs.\r\n * This module provides a pool of reserved IDs to avoid database round-trips during bulk operations.\r\n * @module DataStructures/ReservedIds\r\n */\r\n\r\nimport { GetReservedConnectionIds } from \"../Api/GetReservedConnectionIds\";\r\nimport { GetReservedIds } from \"../Api/GetReservedIds\";\r\n\r\n/**\r\n * Manages a pool of pre-allocated concept IDs from the backend.\r\n * Automatically refills the pool when it gets low to ensure smooth operation.\r\n *\r\n * @class ReservedIds\r\n * @example\r\n * ```typescript\r\n * // Get a reserved ID for a new concept\r\n * const newId = await ReservedIds.getId();\r\n *\r\n * // Add an ID to the pool\r\n * ReservedIds.AddId(123);\r\n * ```\r\n *\r\n * @remarks\r\n * Maintains a pool of at least 10 IDs. When the pool has fewer than 10 IDs,\r\n * it automatically requests more from the backend.\r\n */\r\nexport class ReservedIds{\r\n /** Pool of reserved concept IDs */\r\n static ids:number[] = [];\r\n\r\n /**\r\n * Gets the next available reserved ID from the pool.\r\n * Automatically refills the pool if it has fewer than 10 IDs.\r\n *\r\n * @returns {Promise<number>} A unique reserved concept ID\r\n *\r\n * @example\r\n * ```typescript\r\n * const id = await ReservedIds.getId();\r\n * const concept = new Concept(id, ...);\r\n * ```\r\n *\r\n * @remarks\r\n * Uses FIFO (first in, first out) to retrieve IDs.\r\n * Triggers a backend call to GetReservedIds when pool is low.\r\n */\r\n static async getId(){\r\n if(this.ids.length < 10){\r\n var ids = await GetReservedIds();\r\n }\r\n var id = this.ids[0];\r\n this.ids.shift();\r\n return id;\r\n\r\n }\r\n\r\n /**\r\n * Adds an ID to the reserved IDs pool.\r\n *\r\n * @param {number} id - The ID to add to the pool\r\n *\r\n * @example\r\n * ```typescript\r\n * ReservedIds.AddId(123);\r\n * ```\r\n *\r\n * @remarks\r\n * Prevents duplicate IDs from being added to the pool.\r\n */\r\n static AddId(id:number){\r\n if(!this.ids.includes(id)){\r\n this.ids.push(id);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Manages a pool of pre-allocated connection IDs from the backend.\r\n * Automatically refills the pool when it gets low to ensure smooth operation.\r\n *\r\n * @class ReservedConnectionIds\r\n * @example\r\n * ```typescript\r\n * // Get a reserved ID for a new connection\r\n * const newId = await ReservedConnectionIds.getId();\r\n *\r\n * // Add an ID to the pool\r\n * ReservedConnectionIds.AddId(456);\r\n * ```\r\n *\r\n * @remarks\r\n * Maintains a pool of at least 10 IDs. When the pool has fewer than 10 IDs,\r\n * it automatically requests more from the backend.\r\n */\r\nexport class ReservedConnectionIds{\r\n /** Pool of reserved connection IDs */\r\n static connectionIds: number[] = [];\r\n\r\n /**\r\n * Gets the next available reserved connection ID from the pool.\r\n * Automatically refills the pool if it has fewer than 10 IDs.\r\n *\r\n * @returns {Promise<number>} A unique reserved connection ID\r\n *\r\n * @example\r\n * ```typescript\r\n * const id = await ReservedConnectionIds.getId();\r\n * const connection = new Connection(id, ...);\r\n * ```\r\n *\r\n * @remarks\r\n * Uses FIFO (first in, first out) to retrieve IDs.\r\n * Triggers a backend call to GetReservedConnectionIds when pool is low.\r\n */\r\n static async getId(){\r\n if(this.connectionIds.length < 10){\r\n var connectionIds = await GetReservedConnectionIds();\r\n }\r\n var id = this.connectionIds[0];\r\n this.connectionIds.shift();\r\n return id;\r\n\r\n }\r\n\r\n /**\r\n * Adds an ID to the reserved connection IDs pool.\r\n *\r\n * @param {number} id - The ID to add to the pool\r\n *\r\n * @example\r\n * ```typescript\r\n * ReservedConnectionIds.AddId(456);\r\n * ```\r\n *\r\n * @remarks\r\n * Prevents duplicate IDs from being added to the pool.\r\n */\r\n static AddId(id:number){\r\n if(!this.connectionIds.includes(id)){\r\n this.connectionIds.push(id);\r\n }\r\n }\r\n}","/**\r\n * @fileoverview Defines the FreeSchemaResponse class for standardized error and response handling.\r\n * @module DataStructures/Responses/ErrorResponse\r\n */\r\n\r\nimport { BaseUrl } from \"../BaseUrl\";\r\n\r\n/**\r\n * Standardized response class for FreeSchema API operations.\r\n * This class provides a consistent response structure across all API operations,\r\n * eliminating the need to manually handle HTTP response codes. It supports method\r\n * chaining through fluent setters and provides accessors for all response properties.\r\n *\r\n * @class FreeSchemaResponse\r\n *\r\n * @example\r\n * ```typescript\r\n * // Create a success response\r\n * const response = new FreeSchemaResponse(\r\n * \"Data retrieved successfully\",\r\n * true,\r\n * 200,\r\n * { users: [...] }\r\n * );\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Create an error response with chaining\r\n * const errorResponse = new FreeSchemaResponse(\"\", false, 500, null)\r\n * .setMessage(\"Internal server error\")\r\n * .setUrl(\"https://api.example.com/users\");\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Accessing response data\r\n * if (response.getOk()) {\r\n * const data = response.getData();\r\n * console.log(response.getMessage());\r\n * }\r\n * ```\r\n */\r\nexport class FreeSchemaResponse{\r\n /**\r\n * Human-readable message describing the result of the operation.\r\n * @private\r\n * @type {string}\r\n */\r\n private message: string\r\n\r\n /**\r\n * HTTP status code representing the result of the operation.\r\n * Standard codes include: 200 (OK), 401 (Unauthorized), 500 (Internal Server Error), etc.\r\n * @private\r\n * @type {number}\r\n */\r\n private status: number\r\n\r\n /**\r\n * The response data payload.\r\n * Can contain any type of data depending on the operation performed.\r\n * @private\r\n * @type {any}\r\n */\r\n private data: any\r\n\r\n /**\r\n * Boolean flag indicating operation success (true) or failure (false).\r\n * @private\r\n * @type {boolean}\r\n */\r\n private ok: boolean\r\n\r\n /**\r\n * The URL that originated the response or error.\r\n * Defaults to the base API URL.\r\n * @private\r\n * @type {string}\r\n */\r\n private url: string = BaseUrl.BASE_URL;\r\n\r\n\r\n /**\r\n * Creates a new FreeSchemaResponse instance.\r\n *\r\n * @constructor\r\n * @param {string} message - Human-readable message describing the result of the operation\r\n * @param {boolean} ok - Status flag indicating success (true) or failure (false)\r\n * @param {number} status - Standard HTTP status code (e.g., 200 for OK, 500 for internal error)\r\n * @param {any} data - The response data payload, can be any type\r\n *\r\n * @example\r\n * ```typescript\r\n * const response = new FreeSchemaResponse(\r\n * \"User created successfully\",\r\n * true,\r\n * 201,\r\n * { id: 123, username: \"johndoe\" }\r\n * );\r\n * ```\r\n */\r\n constructor(message: string, ok:boolean, status: number, data: any ){\r\n this.message = message;\r\n this.ok = ok;\r\n this.status = status;\r\n this.data = data;\r\n }\r\n\r\n\r\n /**\r\n * Retrieves the response message.\r\n *\r\n * @public\r\n * @returns {string} The human-readable message describing the operation result\r\n *\r\n * @example\r\n * ```typescript\r\n * const message = response.getMessage();\r\n * console.log(message); // \"User created successfully\"\r\n * ```\r\n */\r\n public getMessage(): string{\r\n return this.message;\r\n }\r\n\r\n /**\r\n * Sets the response message. Supports method chaining.\r\n *\r\n * @public\r\n * @param {string} message - The message to set in the FreeSchemaResponse\r\n * @returns {FreeSchemaResponse} The current instance for method chaining\r\n *\r\n * @example\r\n * ```typescript\r\n * response.setMessage(\"Operation completed successfully\")\r\n * .setStatus(200);\r\n * ```\r\n */\r\n public setMessage(message: string): FreeSchemaResponse{\r\n this.message = message;\r\n return this;\r\n }\r\n\r\n /**\r\n * Retrieves the HTTP status code.\r\n *\r\n * @public\r\n * @returns {number} The HTTP status code\r\n *\r\n * @example\r\n * ```typescript\r\n * const statusCode = response.getStatus();\r\n * if (statusCode === 200) {\r\n * // Handle success\r\n * }\r\n * ```\r\n */\r\n public getStatus(): number{\r\n return this.status;\r\n }\r\n\r\n\r\n /**\r\n * Sets the HTTP status code. Supports method chaining.\r\n *\r\n * @public\r\n * @param {number} status - Standard HTTP status code (200 OK, 401 Unauthorized, 500 Internal Server Error, etc.)\r\n * @returns {FreeSchemaResponse} The current instance for method chaining\r\n *\r\n * @example\r\n * ```typescript\r\n * response.setStatus(404)\r\n * .setMessage(\"Resource not found\");\r\n * ```\r\n */\r\n public setStatus(status: number): FreeSchemaResponse{\r\n this.status = status;\r\n return this;\r\n }\r\n\r\n /**\r\n * Retrieves the response data payload.\r\n *\r\n * @public\r\n * @returns {any} The data associated with the response\r\n *\r\n * @example\r\n * ```typescript\r\n * const data = response.getData();\r\n * console.log(data.users);\r\n * ```\r\n */\r\n public getData(): any{\r\n return this.data;\r\n }\r\n\r\n\r\n /**\r\n * Sets the response data payload. Supports method chaining.\r\n *\r\n * @public\r\n * @param {any} data - The data to include in the response (can be of any type)\r\n * @returns {FreeSchemaResponse} The current instance for method chaining\r\n *\r\n * @example\r\n * ```typescript\r\n * response.setData({ users: [...], total: 100 })\r\n * .setOk(true);\r\n * ```\r\n */\r\n public setData(data: any): FreeSchemaResponse{\r\n this.data = data;\r\n return this;\r\n }\r\n\r\n /**\r\n * Retrieves the success status flag.\r\n *\r\n * @public\r\n * @returns {boolean} True if the operation was successful, false otherwise\r\n *\r\n * @example\r\n * ```typescript\r\n * if (response.getOk()) {\r\n * // Process successful response\r\n * } else {\r\n * // Handle error\r\n * }\r\n * ```\r\n */\r\n public getOk(): boolean{\r\n return this.ok;\r\n }\r\n\r\n /**\r\n * Sets the success status flag. Supports method chaining.\r\n *\r\n * @public\r\n * @param {boolean} ok - True if the operation was successful, false if it failed\r\n * @returns {FreeSchemaResponse} The current instance for method chaining\r\n *\r\n * @example\r\n * ```typescript\r\n * response.setOk(false)\r\n * .setStatus(500)\r\n * .setMessage(\"Internal server error\");\r\n * ```\r\n */\r\n public setOk(ok: boolean): FreeSchemaResponse{\r\n this.ok = ok;\r\n return this;\r\n }\r\n\r\n /**\r\n * Retrieves the URL associated with this response.\r\n *\r\n * @public\r\n * @returns {string} The URL from which the response originated\r\n *\r\n * @example\r\n * ```typescript\r\n * const url = response.getUrl();\r\n * console.log(url); // \"https://api.example.com/users\"\r\n * ```\r\n */\r\n public getUrl(){\r\n return this.url;\r\n }\r\n\r\n /**\r\n * Sets the URL associated with this response. Supports method chaining.\r\n *\r\n * @public\r\n * @param {string} url - The URL from which the response or error originates\r\n * @returns {FreeSchemaResponse} The current instance for method chaining\r\n *\r\n * @example\r\n * ```typescript\r\n * response.setUrl(\"https://api.example.com/users/123\")\r\n * .setStatus(404);\r\n * ```\r\n */\r\n public setUrl(url: string): FreeSchemaResponse{\r\n this.url = url;\r\n return this;\r\n }\r\n\r\n\r\n\r\n\r\n}","/**\r\n * @fileoverview Returner data structure for tracking referent relationships in the CCS-JS system.\r\n * @module DataStructures/Returner\r\n */\r\n\r\n/**\r\n * Represents a returner entity that establishes a relationship between a user and a referent.\r\n *\r\n * @remarks\r\n * The Returner class is a lightweight data structure that links entities through referent\r\n * relationships. It tracks which user owns a particular referent reference and whether\r\n * the relationship is newly created. This is commonly used in bidirectional relationship\r\n * tracking within the concept composition system.\r\n *\r\n * @example\r\n * ```typescript\r\n * const returner = new Returner(\r\n * 1001, // id\r\n * 2001, // userId\r\n * 3001, // referentId\r\n * true // isNew\r\n * );\r\n * console.log(returner.referentId); // 3001\r\n * ```\r\n */\r\nexport class Returner{\r\n /**\r\n * Unique identifier for this returner entity.\r\n */\r\n id: number;\r\n\r\n /**\r\n * ID of the user who owns this returner relationship.\r\n */\r\n userId: number;\r\n\r\n /**\r\n * ID of the referent being referenced by this returner.\r\n *\r\n * @remarks\r\n * The referentId typically points to another entity in the system,\r\n * establishing a directional relationship.\r\n */\r\n referentId: number;\r\n\r\n /**\r\n * Flag indicating whether this returner relationship is newly created.\r\n */\r\n isNew: boolean;\r\n\r\n /**\r\n * Creates a new Returner instance.\r\n *\r\n * @param id - Unique identifier for this returner\r\n * @param userId - ID of the user who owns this relationship\r\n * @param referentId - ID of the entity being referenced\r\n * @param isNew - Whether this is a newly created relationship\r\n *\r\n * @example\r\n * ```typescript\r\n * // Create a returner linking user 100 to referent 500\r\n * const returner = new Returner(1, 100, 500, false);\r\n *\r\n * // Check the relationship\r\n * if (!returner.isNew) {\r\n * console.log(`Existing relationship to referent ${returner.referentId}`);\r\n * }\r\n * ```\r\n */\r\n constructor(id:number, userId:number, referentId: number, isNew:boolean){\r\n this.id = id;\r\n this.userId = userId;\r\n this.referentId = referentId;\r\n this.isNew = isNew;\r\n }\r\n}","/**\r\n * @fileoverview Defines the FreeschemaQuery class for complex, flexible query construction.\r\n * @module DataStructures/Search/FreeschemaQuery\r\n */\r\n\r\nimport { ALLID, NORMAL } from \"../../Constants/FormatConstants\";\r\nimport { Concept } from \"../Concept\";\r\nimport { FilterSearch } from \"../FilterSearch\";\r\n\r\n/**\r\n * Represents a flexible, schema-free query structure for complex data retrieval operations.\r\n * This class supports nested queries, filtering, ordering, and various output formats.\r\n * It is designed to handle advanced querying scenarios with multiple concepts and connections.\r\n *\r\n * @class FreeschemaQuery\r\n *\r\n * @example\r\n * ```typescript\r\n * const query = new FreeschemaQuery();\r\n * query.type = \"User\";\r\n * query.inpage = 20;\r\n * query.page = 1;\r\n * query.order = \"ASC\";\r\n * query.filters = [filterSearch1, filterSearch2];\r\n * query.filterLogic = \"AND\";\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Nested query example\r\n * const parentQuery = new FreeschemaQuery();\r\n * const childQuery = new FreeschemaQuery();\r\n * childQuery.type = \"Comment\";\r\n * parentQuery.freeschemaQueries = [childQuery];\r\n * ```\r\n */\r\nexport class FreeschemaQuery{\r\n /**\r\n * The type of entity to query (e.g., \"User\", \"Post\", \"Comment\").\r\n * Determines the primary data structure being queried.\r\n *\r\n * @type {string}\r\n * @default \"\"\r\n */\r\n type: string = \"\";\r\n\r\n /**\r\n * The number of results to return per page (page size).\r\n * Controls pagination by limiting results in the response.\r\n *\r\n * @type {number}\r\n * @default 10\r\n */\r\n inpage: number = 10;\r\n\r\n /**\r\n * The page number to retrieve (1-indexed).\r\n * Used with inpage for paginating through large result sets.\r\n *\r\n * @type {number}\r\n * @default 1\r\n */\r\n page: number = 1;\r\n\r\n /**\r\n * Array of Concept objects to include in the query.\r\n * Contains the actual concept instances used for filtering or joining.\r\n *\r\n * @type {Concept[]}\r\n * @default []\r\n */\r\n concepts: Concept[] = [];\r\n\r\n /**\r\n * Array of concept IDs to filter by.\r\n * Alternative to using full Concept objects when only IDs are needed.\r\n *\r\n * @type {number[]}\r\n * @default []\r\n */\r\n conceptIds: number[] = [];\r\n\r\n /**\r\n * Array of field selectors to include in the query results.\r\n * Specifies which properties should be returned in the response.\r\n *\r\n * @type {string[]}\r\n * @default []\r\n *\r\n * @example\r\n * ```typescript\r\n * query.selectors = [\"id\", \"name\", \"email\"];\r\n * ```\r\n */\r\n selectors: string[] = [];\r\n\r\n /**\r\n * Array of nested FreeschemaQuery objects for complex hierarchical queries.\r\n * Enables querying related data structures in a single operation.\r\n *\r\n * @type {FreeschemaQuery[]}\r\n * @default []\r\n */\r\n freeschemaQueries : FreeschemaQuery[] = [];\r\n\r\n /**\r\n * Array of FilterSearch objects to apply to the query.\r\n * Each filter defines specific criteria for narrowing results.\r\n *\r\n * @type {FilterSearch[]}\r\n * @default []\r\n */\r\n filters: FilterSearch[] = [];\r\n\r\n /**\r\n * The logical operator to combine multiple filters.\r\n * Typically \"AND\" or \"OR\" to determine how filters are applied together.\r\n *\r\n * @type {string}\r\n * @default \"\"\r\n */\r\n filterLogic: string = \"\";\r\n\r\n /**\r\n * The type of connection to query when dealing with relationships.\r\n * Specifies the connection type when traversing between concepts.\r\n *\r\n * @type {string}\r\n * @default \"\"\r\n */\r\n typeConnection: string = \"\";\r\n\r\n /**\r\n * The sort order for query results.\r\n * Determines whether results are sorted in ascending or descending order.\r\n *\r\n * @type {string}\r\n * @default \"DESC\"\r\n */\r\n order: string = \"DESC\";\r\n\r\n /**\r\n * The output format for query results.\r\n * Determines the structure and presentation of returned data.\r\n *\r\n * @type {number}\r\n * @default NORMAL\r\n *\r\n * @see {@link FormatConstants.NORMAL}\r\n * @see {@link FormatConstants.ALLID}\r\n */\r\n outputFormat: number = NORMAL;\r\n\r\n /**\r\n * A descriptive name for this query.\r\n * Useful for identifying or debugging complex nested queries.\r\n *\r\n * @type {string}\r\n * @default \"\"\r\n */\r\n name: string = \"\";\r\n\r\n /**\r\n * Flag indicating whether to reverse the query direction.\r\n * When true, traverses relationships in the opposite direction.\r\n *\r\n * @type {boolean}\r\n * @default false\r\n */\r\n reverse: boolean = false;\r\n\r\n /**\r\n * Flag indicating whether to apply a limit to the query results.\r\n * When true, enforces the page size limit strictly.\r\n *\r\n * @type {boolean}\r\n * @default false\r\n */\r\n limit: boolean = false;\r\n\r\n /**\r\n * Filter criteria applied to ancestor nodes in hierarchical queries.\r\n * Used for filtering based on parent or ancestor relationships.\r\n *\r\n * @type {string}\r\n * @default \"\"\r\n */\r\n filterAncestor: string = \"\";\r\n\r\n /**\r\n * Flag indicating whether to include this query in parent filter operations.\r\n * When true, the query results are considered in parent-level filtering.\r\n *\r\n * @type {boolean}\r\n * @default false\r\n */\r\n includeInFilter: boolean = false;\r\n\r\n /**\r\n * Flag indicating whether to use legacy connection type behavior.\r\n * Maintains backward compatibility with older connection type systems.\r\n *\r\n * @type {boolean}\r\n * @default false\r\n */\r\n isOldConnectionType: boolean = false;\r\n}","/**\r\n * @fileoverview Defines the SearchStructure class for configuring search operations.\r\n * @module DataStructures/Search/SearchStructure\r\n */\r\n\r\n/**\r\n * Represents a search structure configuration for querying data.\r\n * This class encapsulates all parameters needed to perform a search operation,\r\n * including filtering, pagination, and composition settings.\r\n *\r\n * @class SearchStructure\r\n *\r\n * @example\r\n * ```typescript\r\n * const search = new SearchStructure();\r\n * search.type = \"concept\";\r\n * search.search = \"user profile\";\r\n * search.page = 1;\r\n * search.inpage = 20;\r\n * ```\r\n */\r\nexport class SearchStructure{\r\n /**\r\n * The type of entity to search for (e.g., \"concept\", \"connection\").\r\n * Determines which data structure will be queried.\r\n *\r\n * @type {string}\r\n * @default \"\"\r\n */\r\n type: string = \"\";\r\n\r\n /**\r\n * The search term or query string to match against.\r\n * This is the primary search criteria used for filtering results.\r\n *\r\n * @type {string}\r\n * @default \"\"\r\n */\r\n search: string = \"\";\r\n\r\n /**\r\n * The composition identifier or filter for searching within compositions.\r\n * Used to narrow search results to specific composition contexts.\r\n *\r\n * @type {string}\r\n * @default \"\"\r\n */\r\n composition: string = \"\";\r\n\r\n /**\r\n * Internal composition identifier for nested or hierarchical composition searches.\r\n * Allows for more granular filtering within composition structures.\r\n *\r\n * @type {string}\r\n * @default \"\"\r\n */\r\n internalComposition: string = \"\";\r\n\r\n /**\r\n * The user ID associated with the search operation.\r\n * Used for access control and filtering results based on user permissions.\r\n *\r\n * @type {number}\r\n * @default 999\r\n */\r\n userId: number = 999;\r\n\r\n /**\r\n * The number of results to display per page (page size).\r\n * Controls pagination by limiting the number of results returned.\r\n *\r\n * @type {number}\r\n * @default 10\r\n */\r\n inpage: number = 10;\r\n\r\n /**\r\n * The page number to retrieve (1-indexed).\r\n * Used in conjunction with inpage for pagination of search results.\r\n *\r\n * @type {number}\r\n * @default 1\r\n */\r\n page: number = 1;\r\n}","/**\r\n * @fileoverview Defines the SearchQuery class for constructing search queries with filtering and pagination.\r\n * @module DataStructures/SearchQuery\r\n */\r\n\r\nimport { FilterSearch } from \"./FilterSearch\";\r\n\r\n/**\r\n * Represents a search query configuration with support for filtering, linking, and pagination.\r\n * This class provides a comprehensive structure for building complex search operations\r\n * with multiple criteria and logical operators.\r\n *\r\n * @class SearchQuery\r\n *\r\n * @example\r\n * ```typescript\r\n * const query = new SearchQuery();\r\n * query.type = \"Article\";\r\n * query.composition = 123;\r\n * query.textSearch = \"TypeScript tutorial\";\r\n * query.page = 1;\r\n * query.inpage = 25;\r\n * query.logic = \"and\";\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Search with filters\r\n * const query = new SearchQuery();\r\n * query.type = \"Product\";\r\n * query.doFilter = true;\r\n * query.filterSearches = [\r\n * { type: \"price\", search: \"100\", logicoperator: \">\", index: 0, composition: true, name: \"price\", operateon: \"value\" },\r\n * { type: \"category\", search: \"Electronics\", logicoperator: \"=\", index: 1, composition: true, name: \"category\", operateon: \"value\" }\r\n * ];\r\n * ```\r\n */\r\nexport class SearchQuery{\r\n /**\r\n * The composition ID to search within.\r\n * Specifies which composition context the search should be performed in.\r\n *\r\n * @type {number}\r\n * @default 0\r\n */\r\n composition:number = 0;\r\n\r\n /**\r\n * The type of entity to search for.\r\n * Determines the data structure or entity type being queried.\r\n *\r\n * @type {string}\r\n * @default \"\"\r\n */\r\n type: string = \"\";\r\n\r\n /**\r\n * The linker identifier for relationship-based searches.\r\n * Used to specify connection types when traversing relationships.\r\n *\r\n * @type {string}\r\n * @default \"\"\r\n */\r\n linker: string = \"\";\r\n\r\n /**\r\n * The number of results to display per page (page size).\r\n * Controls pagination by limiting the number of results returned.\r\n *\r\n * @type {number}\r\n * @default 10\r\n */\r\n inpage:number = 10;\r\n\r\n /**\r\n * The page number to retrieve (1-indexed).\r\n * Used with inpage for paginating through search results.\r\n *\r\n * @type {number}\r\n * @default 1\r\n */\r\n page:number = 1;\r\n\r\n /**\r\n * Array of linker identifiers for multiple relationship types.\r\n * Allows searching across multiple connection types simultaneously.\r\n *\r\n * @type {string[]}\r\n * @default []\r\n */\r\n listLinkers:string[] = [];\r\n\r\n /**\r\n * Array of complete linker specifications for complex relationship queries.\r\n * Contains fully qualified linker definitions for advanced searches.\r\n *\r\n * @type {string[]}\r\n * @default []\r\n */\r\n fullLinkers:string[] = [];\r\n\r\n /**\r\n * The text search term or query string.\r\n * Primary search criteria for text-based filtering.\r\n *\r\n * @type {string}\r\n * @default \"\"\r\n */\r\n textSearch:string = \"\";\r\n\r\n /**\r\n * The logical operator to combine multiple search criteria.\r\n * Determines how multiple conditions are combined (e.g., \"or\", \"and\").\r\n *\r\n * @type {string}\r\n * @default \"or\"\r\n */\r\n logic: string = \"or\";\r\n\r\n /**\r\n * Flag indicating whether to reverse the search direction.\r\n * When true, traverses relationships in the opposite direction.\r\n *\r\n * @type {boolean}\r\n * @default false\r\n */\r\n reverse: boolean = false;\r\n\r\n /**\r\n * Flag indicating whether to apply filters to the search.\r\n * When true, the filterSearches array is applied to narrow results.\r\n *\r\n * @type {boolean}\r\n * @default false\r\n */\r\n doFilter: boolean = false;\r\n\r\n /**\r\n * Array of FilterSearch objects defining specific filter criteria.\r\n * Each filter specifies conditions that must be met for results to be included.\r\n *\r\n * @type {FilterSearch[]}\r\n * @default []\r\n */\r\n filterSearches:FilterSearch[] = [];\r\n\r\n /**\r\n * Array of field selectors to include in the query results.\r\n * Specifies which properties should be returned in the response.\r\n *\r\n * @type {string[]}\r\n * @default []\r\n *\r\n * @example\r\n * ```typescript\r\n * query.selectors = [\"id\", \"name\", \"createdAt\"];\r\n * ```\r\n */\r\n selectors: string[] = [];\r\n\r\n}","/**\r\n * @fileoverview Defines the TokenStorage class for managing authentication tokens.\r\n * @module DataStructures/Security/TokenStorage\r\n */\r\n\r\n/**\r\n * Centralized storage for authentication tokens.\r\n * This class provides a singleton-like static storage mechanism for managing\r\n * Bearer access tokens across the application. The token is stored as a static\r\n * property, making it accessible throughout the application without instantiation.\r\n *\r\n * @class TokenStorage\r\n *\r\n * @example\r\n * ```typescript\r\n * // Set the access token after authentication\r\n * TokenStorage.BearerAccessToken = \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...\";\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Retrieve the access token for API requests\r\n * const token = TokenStorage.BearerAccessToken;\r\n * const headers = {\r\n * 'Authorization': `Bearer ${token}`\r\n * };\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Clear the token on logout\r\n * TokenStorage.BearerAccessToken = \"\";\r\n * ```\r\n */\r\nexport class TokenStorage{\r\n /**\r\n * The Bearer access token used for authentication.\r\n * This static property stores the JWT or other authentication token\r\n * used for authorizing API requests. The token typically has the format\r\n * \"Bearer <token>\" when included in HTTP headers.\r\n *\r\n * @static\r\n * @type {string}\r\n * @default \"\"\r\n *\r\n * @remarks\r\n * As a static property, this token is shared across all instances and modules.\r\n * Exercise caution when handling this token to prevent security vulnerabilities.\r\n * Consider clearing this value on logout or session expiration.\r\n */\r\n static BearerAccessToken:string = \"\";\r\n\r\n /**\r\n * OAuth client ID for token refresh\r\n * @static\r\n * @type {string}\r\n * @default \"\"\r\n */\r\n static CLIENT_ID: string = \"\";\r\n\r\n /**\r\n * OAuth client secret for token refresh\r\n * @static\r\n * @type {string}\r\n * @default \"\"\r\n */\r\n static CLIENT_SECRET: string = \"\";\r\n\r\n /**\r\n * Application name for OAuth\r\n * @static\r\n * @type {string}\r\n * @default \"\"\r\n */\r\n static APPLICATION_NAME: string = \"\";\r\n\r\n /**\r\n * Token expiration timestamp (Unix timestamp in milliseconds)\r\n * @static\r\n * @type {number}\r\n * @default 0\r\n */\r\n static TOKEN_EXPIRY: number = 0;\r\n\r\n /**\r\n * Buffer time before token expiry to trigger refresh (in milliseconds)\r\n * Default: 5 minutes (300000 ms)\r\n * @static\r\n * @type {number}\r\n */\r\n static EXPIRY_BUFFER_MS: number = 300000; // 5 minutes\r\n\r\n /**\r\n * Gets authorization header object for HTTP requests.\r\n * @returns {Record<string, string>} Headers object with Authorization header if token exists\r\n *\r\n * @example\r\n * ```typescript\r\n * const headers = TokenStorage.getAuthHeader();\r\n * // Returns: { 'Authorization': 'Bearer your-token' } or {}\r\n * ```\r\n */\r\n static getAuthHeader(): Record<string, string> {\r\n if (this.BearerAccessToken) {\r\n return {\r\n 'Authorization': `Bearer ${this.BearerAccessToken}`\r\n };\r\n }\r\n return {};\r\n }\r\n\r\n /**\r\n * Sets the access token and calculates expiry time.\r\n * @param token - The access token\r\n * @param expiresIn - Token lifetime in seconds (optional)\r\n */\r\n static setToken(token: string, expiresIn?: number): void {\r\n this.BearerAccessToken = token;\r\n\r\n if (expiresIn && expiresIn > 0) {\r\n // Calculate expiry timestamp (current time + expires_in seconds)\r\n this.TOKEN_EXPIRY = Date.now() + (expiresIn * 1000);\r\n } else {\r\n // If no expiry provided, assume token is valid for 1 hour\r\n this.TOKEN_EXPIRY = Date.now() + (3600 * 1000);\r\n }\r\n }\r\n\r\n /**\r\n * Checks if the token is expired or near expiry.\r\n * @returns {boolean} True if token is expired or within the buffer window\r\n */\r\n static isTokenExpiredOrNearExpiry(): boolean {\r\n if (!this.TOKEN_EXPIRY) {\r\n return false; // No expiry set, assume valid\r\n }\r\n\r\n const now = Date.now();\r\n const expiryWithBuffer = this.TOKEN_EXPIRY - this.EXPIRY_BUFFER_MS;\r\n\r\n return now >= expiryWithBuffer;\r\n }\r\n\r\n /**\r\n * Gets the remaining time until token expiry in seconds.\r\n * @returns {number} Seconds until expiry, or -1 if expired/no expiry set\r\n */\r\n static getTimeUntilExpiry(): number {\r\n if (!this.TOKEN_EXPIRY) {\r\n return -1;\r\n }\r\n\r\n const now = Date.now();\r\n const remainingMs = this.TOKEN_EXPIRY - now;\r\n\r\n return remainingMs > 0 ? Math.floor(remainingMs / 1000) : -1;\r\n }\r\n\r\n /**\r\n * Checks if OAuth credentials are configured for automatic token refresh.\r\n * @returns {boolean} True if client ID, secret, and app name are all set\r\n */\r\n static hasOAuthCredentials(): boolean {\r\n return !!(this.CLIENT_ID && this.CLIENT_SECRET && this.APPLICATION_NAME);\r\n }\r\n\r\n /**\r\n * Sets OAuth credentials for automatic token refresh.\r\n * @param clientId - OAuth client ID\r\n * @param clientSecret - OAuth client secret\r\n * @param applicationName - Application name\r\n */\r\n static setOAuthCredentials(clientId: string, clientSecret: string, applicationName: string): void {\r\n this.CLIENT_ID = clientId;\r\n this.CLIENT_SECRET = clientSecret;\r\n this.APPLICATION_NAME = applicationName;\r\n }\r\n}","/**\r\n * @fileoverview Defines the SessionData class for storing session information.\r\n * @module DataStructures/Session/SessionData\r\n */\r\n\r\n/**\r\n * Represents session information for a user's connection.\r\n * This class stores comprehensive details about a user's session, including\r\n * network information, server configuration, and user identification data.\r\n * It captures both client and server-side information for session tracking and security purposes.\r\n *\r\n * @class SessionData\r\n *\r\n * @example\r\n * ```typescript\r\n * const session = new SessionData();\r\n * session.id = \"abc123def456\";\r\n * session.userId = \"12345\";\r\n * session.email = \"user@example.com\";\r\n * session.remote_address = \"192.168.1.100\";\r\n * session.http_user_agent = \"Mozilla/5.0...\";\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Populate session data from request\r\n * const session = new SessionData();\r\n * session.remote_address = request.connection.remoteAddress;\r\n * session.server_port = process.env.PORT;\r\n * session.server_name = request.hostname;\r\n * ```\r\n */\r\nexport class SessionData{\r\n /**\r\n * The unique session identifier.\r\n * Used to track and identify individual sessions across requests.\r\n *\r\n * @type {string}\r\n * @default \"0\"\r\n */\r\n id: string = \"0\";\r\n\r\n /**\r\n * The remote IP address of the client.\r\n * Identifies the network address from which the client is connecting.\r\n *\r\n * @type {string}\r\n * @default \"\"\r\n *\r\n * @example \"192.168.1.100\" or \"2001:0db8:85a3:0000:0000:8a2e:0370:7334\"\r\n */\r\n remote_address:string = \"\";\r\n\r\n /**\r\n * The port number on which the server is listening.\r\n * Indicates which server port is handling the connection.\r\n *\r\n * @type {string}\r\n * @default \"\"\r\n *\r\n * @example \"8080\" or \"443\"\r\n */\r\n server_port: string = \"\";\r\n\r\n /**\r\n * The server's IP address.\r\n * Identifies the network address of the server handling the request.\r\n *\r\n * @type {string}\r\n * @default \"\"\r\n */\r\n server_address: string = \"\";\r\n\r\n /**\r\n * The server's hostname or domain name.\r\n * The fully qualified domain name or hostname of the server.\r\n *\r\n * @type {string}\r\n * @default \"\"\r\n *\r\n * @example \"api.example.com\" or \"localhost\"\r\n */\r\n server_name: string = \"\";\r\n\r\n /**\r\n * Information about the server software.\r\n * Identifies the server software and version handling the request.\r\n *\r\n * @type {string}\r\n * @default \"\"\r\n *\r\n * @example \"Apache/2.4.41\" or \"nginx/1.18.0\"\r\n */\r\n server_software: string = \"\";\r\n\r\n /**\r\n * The HTTP User-Agent header from the client.\r\n * Contains information about the client's browser or application making the request.\r\n *\r\n * @type {string}\r\n * @default \"\"\r\n *\r\n * @example \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36...\"\r\n */\r\n http_user_agent: string = \"\";\r\n\r\n /**\r\n * The self-referential identifier or URL.\r\n * May contain a reference to the current script or endpoint.\r\n *\r\n * @type {string}\r\n * @default \"\"\r\n */\r\n self: string = \"\";\r\n\r\n /**\r\n * The client's port number.\r\n * Indicates which port on the client side is being used for the connection.\r\n *\r\n * @type {string}\r\n * @default \"\"\r\n */\r\n port: string = \"\";\r\n\r\n /**\r\n * The user's unique identifier.\r\n * Links the session to a specific user account.\r\n *\r\n * @type {string}\r\n * @default \"\"\r\n */\r\n userId: string = \"\";\r\n\r\n /**\r\n * The user's email address.\r\n * Stores the authenticated user's email for session tracking.\r\n *\r\n * @type {string}\r\n * @default \"\"\r\n */\r\n email: string = \"\";\r\n}","/**\r\n * @fileoverview SettingData module for managing persisted setting data in CCS-JS.\r\n * This module defines the structure for storing user preferences and configuration.\r\n * @module DataStructures/SettingData\r\n */\r\n\r\n/**\r\n * Represents persisted setting data for the application.\r\n * Can be stored in local storage or IndexedDB for user preferences.\r\n *\r\n * @class SettingData\r\n * @example\r\n * ```typescript\r\n * // Create settings with online sync enabled\r\n * const settings = new SettingData(true);\r\n *\r\n * // Store settings\r\n * localStorage.setItem('settings', JSON.stringify(settings));\r\n * ```\r\n */\r\nexport class SettingData{\r\n\r\n /** Unique identifier for the settings record */\r\n public id:number = 1;\r\n\r\n /** Controls whether online synchronization is enabled */\r\n public isOnlineSync: boolean = false;\r\n\r\n /**\r\n * Creates a new SettingData instance.\r\n *\r\n * @param {boolean} isOnlineSync - Whether to enable online synchronization\r\n *\r\n * @example\r\n * ```typescript\r\n * const settings = new SettingData(true);\r\n * console.log(settings.isOnlineSync); // true\r\n * ```\r\n */\r\n constructor(isOnlineSync:boolean){\r\n this.isOnlineSync = isOnlineSync;\r\n }\r\n}","/**\r\n * @fileoverview Settings module for managing global application settings in CCS-JS.\r\n * This module provides centralized configuration flags for application behavior.\r\n * @module DataStructures/Settings\r\n */\r\n\r\n/**\r\n * Global application settings for CCS-JS.\r\n * Controls application-wide behavior such as update status and synchronization mode.\r\n *\r\n * @class Settings\r\n * @example\r\n * ```typescript\r\n * // Enable online sync\r\n * Settings.isOnlineSync = true;\r\n *\r\n * // Check if system is updated\r\n * if (Settings.isUpdated) {\r\n * console.log(\"System is up to date\");\r\n * }\r\n * ```\r\n *\r\n * @remarks\r\n * All properties are static flags used across the application.\r\n * These settings affect how data is synchronized and persisted.\r\n */\r\nexport class Settings{\r\n /** Flag indicating if the system has been updated to the latest version */\r\n static isUpdated = false;\r\n\r\n /** Flag controlling whether changes are synchronized online immediately */\r\n static isOnlineSync = false;\r\n\r\n}","/**\r\n * @fileoverview SyncData module for managing synchronization of concepts and connections in CCS-JS.\r\n * This module provides queuing and batch synchronization of local changes to the backend server,\r\n * with support for transactional operations and rollback capabilities.\r\n * @module DataStructures/SyncData\r\n */\r\n\r\nimport { storeToDatabase } from \"./../Database/NoIndexDb\";\r\nimport { CreateTheConceptApi } from \"../Api/Create/CreateTheConceptApi\";\r\nimport { CreateTheConnectionApi } from \"../Api/Create/CreateTheConnectionApi\";\r\nimport { Concept } from \"./Concept\";\r\nimport { ConceptsData } from \"./ConceptData\";\r\nimport { Connection } from \"./Connection\";\r\nimport { ConnectionData } from \"./ConnectionData\";\r\nimport { ReservedIds } from \"./ReservedIds\";\r\nimport { InnerActions } from \"./Transaction/Transaction\";\r\n\r\n/**\r\n * Container for transactional sync data.\r\n * Stores concepts and connections that are part of a transaction.\r\n */\r\ntype syncContainer = {\r\n /** Unique transaction identifier */\r\n id: string,\r\n /** Transaction data containing concepts and connections */\r\n data: InnerActions\r\n /** ISO timestamp of when the transaction was created */\r\n createdDate: string,\r\n}\r\n\r\n/**\r\n * Manages synchronization of concepts and connections between local storage and backend.\r\n * Provides queuing, batch processing, and transaction support for data synchronization.\r\n *\r\n * @class SyncData\r\n * @example\r\n * ```typescript\r\n * // Add items to sync queue\r\n * SyncData.AddConcept(myConcept);\r\n * SyncData.AddConnection(myConnection);\r\n *\r\n * // Sync to backend\r\n * await SyncData.SyncDataOnline();\r\n *\r\n * // Transaction support\r\n * await SyncData.initializeTransaction(\"txn-123\");\r\n * await SyncData.markTransactionActions(\"txn-123\", actions);\r\n * await SyncData.SyncDataOnline(\"txn-123\");\r\n * ```\r\n *\r\n * @remarks\r\n * This class provides both immediate and batched synchronization modes.\r\n * Transactions are automatically cleaned up after 7 days (604800000 ms).\r\n */\r\nexport class SyncData{\r\n /** Queue of concepts waiting to be synchronized to backend */\r\n static conceptsSyncArray:Concept[] = [];\r\n\r\n /** Queue of connections waiting to be synchronized to backend */\r\n static connectionSyncArray: Connection[] = [];\r\n\r\n /** Collection of transactional sync operations */\r\n static transactionCollections: syncContainer[] = []\r\n\r\n /**\r\n * Checks if a concept already exists in the sync queue.\r\n *\r\n * @param {Concept} concept - The concept to check\r\n * @returns {boolean} True if the concept is in the sync queue, false otherwise\r\n *\r\n * @private\r\n */\r\n static CheckContains(concept: Concept){\r\n var contains = false;\r\n for(var i=0; i<this.conceptsSyncArray.length; i++){\r\n if(this.conceptsSyncArray[i].id == concept.id){\r\n contains = true;\r\n }\r\n }\r\n return contains;\r\n }\r\n\r\n /**\r\n * Removes all sync data related to a specific concept ID.\r\n * Removes the concept and any connections that reference it.\r\n *\r\n * @param {number} id - The concept ID to remove from sync queues\r\n *\r\n * @example\r\n * ```typescript\r\n * SyncData.SyncDataDelete(123);\r\n * ```\r\n *\r\n * @remarks\r\n * Also removes connections where the concept appears as ofTheConceptId, toTheConceptId, or typeId.\r\n */\r\n static SyncDataDelete(id:number){\r\n for(var i=0; i< this.conceptsSyncArray.length;i++){\r\n if(id == this.conceptsSyncArray[i].id){\r\n this.conceptsSyncArray.splice(i, 1);\r\n }\r\n }\r\n for(var i=0;i<this.connectionSyncArray.length; i++){\r\n if(this.connectionSyncArray[i].ofTheConceptId == id || this.connectionSyncArray[i].toTheConceptId == id || this.connectionSyncArray[i].typeId == id){\r\n this.connectionSyncArray.splice(i,1);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Checks if a connection already exists in the sync queue.\r\n *\r\n * @param {Connection} connection - The connection to check\r\n * @returns {boolean} True if the connection is in the sync queue, false otherwise\r\n *\r\n * @private\r\n */\r\n static CheckContainsConnection(connection: Connection){\r\n var contains = false;\r\n for(var i=0; i<this.connectionSyncArray.length; i++){\r\n if(this.connectionSyncArray[i].id == connection.id){\r\n contains = true;\r\n }\r\n }\r\n return contains;\r\n }\r\n\r\n /**\r\n * Adds a concept to the synchronization queue.\r\n *\r\n * @param {Concept} concept - The concept to add to sync queue\r\n *\r\n * @example\r\n * ```typescript\r\n * SyncData.AddConcept(myConcept);\r\n * // Later...\r\n * await SyncData.SyncDataOnline();\r\n * ```\r\n */\r\n static AddConcept(concept: Concept){\r\n var contains = false;\r\n // ConceptsData.AddConceptTemporary(concept);\r\n if(!contains){\r\n this.conceptsSyncArray.push(concept);\r\n }\r\n }\r\n\r\n\r\n\r\n /**\r\n * Removes a concept from the synchronization queue.\r\n *\r\n * @param {Concept} concept - The concept to remove from sync queue\r\n *\r\n * @example\r\n * ```typescript\r\n * SyncData.RemoveConcept(myConcept);\r\n * ```\r\n */\r\n static RemoveConcept(concept: Concept){\r\n for(var i=0; i<this.conceptsSyncArray.length; i++){\r\n if(this.conceptsSyncArray[i].id == concept.id){\r\n this.conceptsSyncArray.splice(i, 1);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Adds a connection to the synchronization queue.\r\n *\r\n * @param {Connection} connection - The connection to add to sync queue\r\n *\r\n * @example\r\n * ```typescript\r\n * SyncData.AddConnection(myConnection);\r\n * // Later...\r\n * await SyncData.SyncDataOnline();\r\n * ```\r\n */\r\n static AddConnection(connection: Connection){\r\n this.connectionSyncArray.push(connection);\r\n }\r\n\r\n /**\r\n * Removes a connection from the synchronization queue.\r\n *\r\n * @param {Connection} connection - The connection to remove from sync queue\r\n *\r\n * @example\r\n * ```typescript\r\n * SyncData.RemoveConnection(myConnection);\r\n * ```\r\n */\r\n static RemoveConnection(connection: Connection){\r\n for(var i=0; i<this.connectionSyncArray.length; i++){\r\n if(this.connectionSyncArray[i].id == connection.id){\r\n this.connectionSyncArray.splice(i, 1);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Synchronizes queued data to the backend server.\r\n * Can sync either a specific transaction or all queued data.\r\n *\r\n * @param {string} [transactionId] - Optional transaction ID to sync specific transaction\r\n * @returns {Promise<string>} Returns \"done\" when synchronization completes\r\n * @throws {Error} If synchronization fails\r\n *\r\n * @example\r\n * ```typescript\r\n * // Sync all queued data\r\n * await SyncData.SyncDataOnline();\r\n *\r\n * // Sync specific transaction\r\n * await SyncData.SyncDataOnline(\"txn-123\");\r\n * ```\r\n *\r\n * @remarks\r\n * - If transactionId is provided, only that transaction is synced and removed from collection\r\n * - Otherwise, all queued concepts and connections are synced\r\n * - Automatically cleans up transactions older than 7 days (604800000 ms)\r\n * - Adds data to permanent storage before sending to backend\r\n */\r\n static async SyncDataOnline(transactionId?:string){\r\n try{\r\n let conceptsArray: Concept[] = [];\r\n let connectionsArray: Connection[] = [];\r\n if (transactionId && this.transactionCollections.some(tran => tran.id == transactionId)) {\r\n const transaction = this.transactionCollections.find(tran => tran.id == transactionId)\r\n // remove current transaction from list\r\n this.transactionCollections = this.transactionCollections.filter(tran => tran.id != transactionId)\r\n // remove old query actions older than 15 days\r\n this.transactionCollections = this.transactionCollections.filter(tran => new Date(tran.createdDate).getTime() > (new Date().getTime() - 604800000 ))\r\n \r\n if (!transaction) return\r\n conceptsArray = transaction.data.concepts.slice();\r\n connectionsArray = transaction.data.connections.slice();\r\n if(conceptsArray.length > 0){\r\n await CreateTheConceptApi(conceptsArray);\r\n }\r\n if(connectionsArray.length > 0){\r\n await CreateTheConnectionApi(connectionsArray);\r\n }\r\n }\r\n else{\r\n for(let i=0;i<this.conceptsSyncArray.length;i++){\r\n ConceptsData.AddConcept(this.conceptsSyncArray[i]);\r\n }\r\n \r\n for(let i=0;i<this.connectionSyncArray.length;i++){\r\n ConnectionData.AddConnection(this.connectionSyncArray[i]);\r\n }\r\n\r\n if(this.conceptsSyncArray.length > 0){\r\n conceptsArray = this.conceptsSyncArray.slice();\r\n this.conceptsSyncArray = [];\r\n await CreateTheConceptApi(conceptsArray);\r\n }\r\n if(this.connectionSyncArray.length > 0){\r\n \r\n // for(let i =0 ; i<this.connectionSyncArray.length ; i++){\r\n // console.log(\"create the connection in backend\", this.connectionSyncArray[i].ofTheConceptId + \"====\" + this.connectionSyncArray[i].toTheConceptId);\r\n // }\r\n connectionsArray = this.connectionSyncArray.slice();\r\n this.connectionSyncArray = [];\r\n await CreateTheConnectionApi(connectionsArray);\r\n }\r\n }\r\n return \"done\";\r\n }\r\n catch(err){\r\n throw err;\r\n }\r\n\r\n\r\n }\r\n\r\n /**\r\n * Initializes a new transaction container for tracking related changes.\r\n *\r\n * @param {string} transactionId - Unique identifier for the transaction\r\n *\r\n * @example\r\n * ```typescript\r\n * await SyncData.initializeTransaction(\"txn-123\");\r\n * // Make changes...\r\n * await SyncData.markTransactionActions(\"txn-123\", actions);\r\n * await SyncData.SyncDataOnline(\"txn-123\");\r\n * ```\r\n *\r\n * @remarks\r\n * Does nothing if a transaction with the same ID already exists.\r\n * Creates an empty container with the current timestamp.\r\n */\r\n static async initializeTransaction(transactionId: string) {\r\n try {\r\n \r\n if (this.transactionCollections.some(item => item.id == transactionId)) return\r\n \r\n this.transactionCollections.push({\r\n id: transactionId,\r\n data: {concepts: [], connections: []},\r\n createdDate: new Date().toISOString()\r\n })\r\n } catch (error) {\r\n console.log('error in initializeTransaction', error)\r\n }\r\n }\r\n\r\n /**\r\n * Marks specific actions as part of a transaction.\r\n * Removes these actions from the general sync queues to prevent duplication.\r\n *\r\n * @param {string} transactionId - The transaction ID\r\n * @param {InnerActions} actions - The concepts and connections to mark as part of transaction\r\n *\r\n * @example\r\n * ```typescript\r\n * const actions = {\r\n * concepts: [concept1, concept2],\r\n * connections: [connection1, connection2]\r\n * };\r\n * await SyncData.markTransactionActions(\"txn-123\", actions);\r\n * ```\r\n *\r\n * @remarks\r\n * - Updates the transaction container with the actions\r\n * - Removes marked items from conceptsSyncArray and connectionSyncArray\r\n * - Matches items by both id and ghostId to handle temporary IDs\r\n */\r\n static async markTransactionActions(transactionId: string, actions: InnerActions) {\r\n // remove marked \r\n try {\r\n \r\n this.transactionCollections = this.transactionCollections.map(tran => {\r\n if (tran.id == transactionId) {\r\n return {\r\n ...tran,\r\n data: JSON.parse(JSON.stringify(actions))\r\n }\r\n } else return tran\r\n })\r\n \r\n this.conceptsSyncArray = this.conceptsSyncArray.filter(concept => !actions.concepts.some(con => con.id == concept.id || con.ghostId == concept.id))\r\n this.connectionSyncArray = this.connectionSyncArray.filter(connection => !actions.connections.some(con => con.id == connection.id || con.ghostId == connection.id))\r\n } catch (error) {\r\n console.log('error in markTransactionActions', error)\r\n }\r\n }\r\n\r\n /**\r\n * Rolls back a transaction by removing it from the transaction collection.\r\n *\r\n * @param {string} transactionId - The transaction ID to rollback\r\n * @param {InnerActions} actions - The actions to rollback (currently unused)\r\n *\r\n * @example\r\n * ```typescript\r\n * await SyncData.rollbackTransaction(\"txn-123\", actions);\r\n * ```\r\n *\r\n * @remarks\r\n * Currently only removes the transaction from collection if it doesn't already exist.\r\n * The logic may need review as it checks for existence before removal.\r\n */\r\n static async rollbackTransaction(transactionId: string, actions: InnerActions) {\r\n try {\r\n if (this.transactionCollections.some(item => item.id == transactionId)) return\r\n this.transactionCollections = this.transactionCollections.filter(tran => tran.id != transactionId)\r\n } catch (err) {console.log('LocalSyncData, roll', err)}\r\n }\r\n\r\n\r\n /**\r\n * Synchronizes queued data to local IndexedDB storage only (not to backend).\r\n *\r\n * @returns {Promise<string>} Returns \"done\" when local sync completes\r\n *\r\n * @example\r\n * ```typescript\r\n * await SyncData.syncDataLocalDb();\r\n * ```\r\n *\r\n * @remarks\r\n * - Stores concepts to \"localconcept\" database\r\n * - Stores connections to \"localconnection\" database\r\n * - Clears the sync queues after storing\r\n * - Used for offline persistence without backend sync\r\n */\r\n static async syncDataLocalDb(){\r\n if(this.conceptsSyncArray.length > 0){\r\n for(let i=0; i< this.conceptsSyncArray.length;i++){\r\n storeToDatabase(\"localconcept\",this.conceptsSyncArray[i]);\r\n }\r\n this.conceptsSyncArray = [];\r\n }\r\n if(this.connectionSyncArray.length > 0){\r\n for(let i=0; i< this.connectionSyncArray.length;i++){\r\n storeToDatabase(\"localconnection\",this.connectionSyncArray[i]);\r\n }\r\n this.connectionSyncArray = [];\r\n }\r\n return \"done\";\r\n }\r\n\r\n\r\n \r\n\r\n\r\n}","/**\r\n * @fileoverview Character data structure for the CCS-JS system.\r\n * @module DataStructures/TheCharacter\r\n */\r\n\r\n/**\r\n * Represents a character entity in the system with associated user, security, access, and session information.\r\n *\r\n * @remarks\r\n * TheCharacter class encapsulates character data along with comprehensive metadata including\r\n * user ownership, security credentials, access control, and session tracking. Each character\r\n * maintains references to multiple user contexts for fine-grained authorization control.\r\n *\r\n * @example\r\n * ```typescript\r\n * const character = new TheCharacter(\r\n * 1001, // userId\r\n * \"A\", // data\r\n * 5001, // securityId\r\n * 1001, // securityUserId\r\n * 6001, // accessId\r\n * 1001, // accessUserId\r\n * 7001, // sessionId\r\n * 1001, // sessionUserId\r\n * \"2025-10-30T12:00:00Z\", // entryTimestamp\r\n * true // isNew\r\n * );\r\n * ```\r\n */\r\nexport class TheCharacter{\r\n /**\r\n * Unique identifier for the character.\r\n * @defaultValue 0\r\n */\r\n id: number = 0;\r\n\r\n /**\r\n * ID of the user who owns this character.\r\n */\r\n userId: number;\r\n\r\n /**\r\n * The actual character data (typically a single character string).\r\n */\r\n data: string;\r\n\r\n /**\r\n * Security level or security context identifier for this character.\r\n */\r\n securityId: number;\r\n\r\n /**\r\n * User ID associated with the security context.\r\n */\r\n securityUserId: number;\r\n\r\n /**\r\n * Access control identifier for this character.\r\n */\r\n accessId: number;\r\n\r\n /**\r\n * User ID associated with the access control.\r\n */\r\n accessUserId: number;\r\n\r\n /**\r\n * Session identifier tracking when this character was accessed.\r\n */\r\n sessionId: number;\r\n\r\n /**\r\n * User ID associated with the session.\r\n */\r\n sessionUserId: number;\r\n\r\n /**\r\n * Flag indicating whether this is a newly created character.\r\n * @defaultValue false\r\n */\r\n isNew: boolean = false;\r\n\r\n /**\r\n * Creates a new TheCharacter instance.\r\n *\r\n * @param userId - The ID of the user who owns this character\r\n * @param data - The character data (will be converted to string)\r\n * @param securityId - Security level or context identifier\r\n * @param securityUserId - User ID for the security context\r\n * @param accessId - Access control identifier\r\n * @param accessUserId - User ID for access control\r\n * @param sessionId - Session tracking identifier\r\n * @param sessionUserId - User ID for the session\r\n * @param entryTimestamp - Timestamp when the character was created/entered (currently unused in initialization)\r\n * @param isNew - Whether this is a newly created character\r\n *\r\n * @remarks\r\n * The data parameter is explicitly converted to a string using template literals.\r\n * The entryTimestamp parameter is accepted but not currently stored in the instance.\r\n *\r\n * @example\r\n * ```typescript\r\n * const char = new TheCharacter(\r\n * 1, \"X\", 100, 1, 200, 1, 300, 1, \"2025-10-30\", true\r\n * );\r\n * console.log(char.data); // \"X\"\r\n * console.log(char.isNew); // true\r\n * ```\r\n */\r\n constructor(userId:number, data:string, securityId: number, securityUserId: number, accessId:number, accessUserId: number,\r\n sessionId: number, sessionUserId: number, entryTimestamp: string, isNew: boolean){\r\n this.userId = userId;\r\n this.data = `${data}`;\r\n this.securityId = securityId;\r\n this.securityUserId = securityUserId;\r\n this.accessId = accessId;\r\n this.accessUserId = accessUserId;\r\n this.sessionId = sessionId;\r\n this.sessionUserId = sessionUserId;\r\n this.isNew = isNew;\r\n }\r\n\r\n\r\n\r\n\r\n\r\n}","/**\r\n * @fileoverview Text data structure for the CCS-JS system.\r\n * @module DataStructures/TheTexts\r\n */\r\n\r\n/**\r\n * Represents a text entity in the system with comprehensive metadata and security tracking.\r\n *\r\n * @remarks\r\n * TheTexts class encapsulates text data along with user ownership, security credentials,\r\n * access control, session tracking, and timestamp information. This class is similar to\r\n * TheCharacter but designed for longer text strings and includes an entry timestamp for\r\n * temporal tracking. It provides complete audit trail capabilities through its multiple\r\n * user context references.\r\n *\r\n * @example\r\n * ```typescript\r\n * const text = new TheTexts(\r\n * 1001, // userId\r\n * \"Hello World\", // data\r\n * 5001, // securityId\r\n * 1001, // securityUserId\r\n * 6001, // accessId\r\n * 1001, // accessUserId\r\n * 7001, // sessionId\r\n * 1001, // sessionUserId\r\n * \"2025-10-30T12:00:00Z\", // entryTimestamp\r\n * true // isNew\r\n * );\r\n * ```\r\n */\r\nexport class TheTexts{\r\n /**\r\n * Unique identifier for the text entity.\r\n * @defaultValue 0\r\n */\r\n id: number = 0;\r\n\r\n /**\r\n * ID of the user who owns this text.\r\n */\r\n userId: number;\r\n\r\n /**\r\n * The actual text data content.\r\n */\r\n data: string;\r\n\r\n /**\r\n * Security level or security context identifier for this text.\r\n */\r\n securityId: number;\r\n\r\n /**\r\n * User ID associated with the security context.\r\n */\r\n securityUserId: number;\r\n\r\n /**\r\n * Access control identifier for this text.\r\n */\r\n accessId: number;\r\n\r\n /**\r\n * User ID associated with the access control.\r\n */\r\n accessUserId: number;\r\n\r\n /**\r\n * Session identifier tracking when this text was accessed.\r\n */\r\n sessionId: number;\r\n\r\n /**\r\n * User ID associated with the session.\r\n */\r\n sessionUserId: number;\r\n\r\n /**\r\n * ISO 8601 timestamp indicating when this text entry was created or modified.\r\n */\r\n entryTimestamp: string;\r\n\r\n /**\r\n * Flag indicating whether this is a newly created text entry.\r\n */\r\n isNew: boolean;\r\n\r\n /**\r\n * Creates a new TheTexts instance.\r\n *\r\n * @param userId - The ID of the user who owns this text\r\n * @param data - The text content\r\n * @param securityId - Security level or context identifier\r\n * @param securityUserId - User ID for the security context\r\n * @param accessId - Access control identifier\r\n * @param accessUserId - User ID for access control\r\n * @param sessionId - Session tracking identifier\r\n * @param sessionUserId - User ID for the session\r\n * @param entryTimestamp - ISO 8601 timestamp when the text was created/entered\r\n * @param isNew - Whether this is a newly created text entry\r\n *\r\n * @remarks\r\n * Unlike TheCharacter, this constructor stores the entryTimestamp property,\r\n * making it suitable for temporal tracking and audit trails.\r\n *\r\n * @example\r\n * ```typescript\r\n * const text = new TheTexts(\r\n * 1, \"Sample text\", 100, 1, 200, 1, 300, 1,\r\n * new Date().toISOString(), true\r\n * );\r\n * console.log(text.data); // \"Sample text\"\r\n * console.log(text.entryTimestamp); // \"2025-10-30T12:00:00.000Z\"\r\n * ```\r\n */\r\n constructor(userId:number, data:string, securityId: number, securityUserId: number, accessId:number, accessUserId: number,\r\n sessionId: number, sessionUserId: number, entryTimestamp: string, isNew: boolean){\r\n this.userId = userId;\r\n this.data = data;\r\n this.securityId = securityId;\r\n this.securityUserId = securityUserId;\r\n this.accessId = accessId;\r\n this.accessUserId = accessUserId;\r\n this.sessionId = sessionId;\r\n this.sessionUserId = sessionUserId;\r\n this.entryTimestamp = entryTimestamp;\r\n this.isNew = isNew;\r\n }\r\n\r\n\r\n\r\n\r\n\r\n}","/**\r\n * @fileoverview Defines the Transaction class for managing transactional operations.\r\n * @module DataStructures/Transaction/Transaction\r\n */\r\n\r\nimport { CreateConnection, CreateTheConnectionGeneral, MakeTheInstanceConcept, MakeTheTypeConcept } from \"../../app\";\r\nimport { Concept } from \"../Concept\";\r\nimport { Connection } from \"../Connection\";\r\nimport { SyncData } from \"../SyncData\";\r\n\r\n/**\r\n * Manages transactional operations for concepts and connections.\r\n * This class provides ACID-like transaction capabilities for creating and managing\r\n * concepts and connections. It supports rollback functionality and ensures data\r\n * consistency by tracking all actions within a transaction context.\r\n *\r\n * @class Transaction\r\n *\r\n * @example\r\n * ```typescript\r\n * const transaction = new Transaction();\r\n * await transaction.initialize();\r\n *\r\n * try {\r\n * const concept = await transaction.MakeTheInstanceConcept(\r\n * \"User\", \"John Doe\", false, 1, 4, 999, 0\r\n * );\r\n * await transaction.commitTransaction();\r\n * } catch (error) {\r\n * await transaction.rollbackTransaction();\r\n * }\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Complex transaction with multiple operations\r\n * const transaction = new Transaction();\r\n * await transaction.initialize();\r\n *\r\n * try {\r\n * const user = await transaction.MakeTheInstanceConcept(\"User\", \"Alice\", false, 1, 4);\r\n * const post = await transaction.MakeTheInstanceConcept(\"Post\", \"My First Post\", false, 1, 4);\r\n * await transaction.CreateConnection(user, post, \"authored\");\r\n * await transaction.commitTransaction();\r\n * } catch (error) {\r\n * console.error(\"Transaction failed:\", error);\r\n * await transaction.rollbackTransaction();\r\n * }\r\n * ```\r\n */\r\nexport class Transaction {\r\n /**\r\n * Unique identifier for this transaction.\r\n * Generated randomly to track transaction operations.\r\n *\r\n * @protected\r\n * @type {string}\r\n */\r\n protected transactionId!: string;\r\n\r\n /**\r\n * Collection of all actions performed within this transaction.\r\n * Tracks concepts and connections created or modified during the transaction.\r\n *\r\n * @type {InnerActions}\r\n */\r\n actions: InnerActions = {\r\n concepts: [],\r\n connections: []\r\n };\r\n\r\n /**\r\n * Flag indicating whether the transaction is still valid.\r\n * Set to false on failure or after rollback to prevent further operations.\r\n *\r\n * @protected\r\n * @type {boolean}\r\n * @default true\r\n */\r\n protected success = true;\r\n\r\n /**\r\n * Creates a new Transaction instance.\r\n * Generates a unique transaction ID for tracking purposes.\r\n *\r\n * @constructor\r\n *\r\n * @example\r\n * ```typescript\r\n * const transaction = new Transaction();\r\n * await transaction.initialize();\r\n * ```\r\n */\r\n constructor() {\r\n this.transactionId = Math.random().toString().substring(5);\r\n }\r\n\r\n /**\r\n * Initializes the transaction in the data store.\r\n * Must be called before performing any transactional operations.\r\n *\r\n * @async\r\n * @returns {Promise<void>}\r\n * @throws {Error} If initialization fails\r\n *\r\n * @example\r\n * ```typescript\r\n * const transaction = new Transaction();\r\n * await transaction.initialize();\r\n * ```\r\n */\r\n async initialize() {\r\n await SyncData.initializeTransaction(this.transactionId);\r\n }\r\n\r\n /**\r\n * Marks and persists the current transaction actions.\r\n * Internal method to save concepts and connections to the transaction collection.\r\n *\r\n * @protected\r\n * @async\r\n * @returns {Promise<void>}\r\n *\r\n * @remarks\r\n * This method is called internally after each concept or connection operation\r\n * to ensure actions are tracked for potential rollback.\r\n */\r\n protected async markAction() {\r\n await SyncData.markTransactionActions(\r\n this.transactionId,\r\n this.actions\r\n );\r\n }\r\n\r\n /**\r\n * Rolls back all operations performed within this transaction.\r\n * Reverts all changes made during the transaction and marks it as expired.\r\n * After rollback, no further operations can be performed on this transaction.\r\n *\r\n * @async\r\n * @returns {Promise<void>}\r\n *\r\n * @example\r\n * ```typescript\r\n * try {\r\n * const concept = await transaction.MakeTheInstanceConcept(...);\r\n * // ... operation that might fail\r\n * } catch (error) {\r\n * await transaction.rollbackTransaction();\r\n * console.error(\"Transaction rolled back due to error:\", error);\r\n * }\r\n * ```\r\n */\r\n async rollbackTransaction() {\r\n // rollback all the changes\r\n\r\n this.success = false;\r\n this.actions = { concepts: [], connections: [] };\r\n await SyncData.rollbackTransaction(this.transactionId, this.actions);\r\n }\r\n\r\n /**\r\n * Commits the transaction, making all changes permanent.\r\n * Synchronizes all transaction data to the online/persistent store.\r\n * After commit, the transaction is marked as expired and cannot be used further.\r\n *\r\n * @async\r\n * @returns {Promise<void>}\r\n * @throws {Error} If the transaction has already expired or failed\r\n *\r\n * @example\r\n * ```typescript\r\n * const transaction = new Transaction();\r\n * await transaction.initialize();\r\n *\r\n * try {\r\n * await transaction.MakeTheInstanceConcept(\"User\", \"Alice\", false, 1, 4);\r\n * await transaction.commitTransaction();\r\n * console.log(\"Transaction committed successfully\");\r\n * } catch (error) {\r\n * await transaction.rollbackTransaction();\r\n * }\r\n * ```\r\n */\r\nasync commitTransaction() {\r\n // Save the data\r\n if (!this.success) throw Error(\"Query Transaction Expired\");\r\n\r\n await SyncData.SyncDataOnline(this.transactionId);\r\n this.actions = { concepts: [], connections: [] };\r\n this.success = false;\r\n }\r\n\r\n\r\n /**\r\n * Creates a new instance concept within the transaction.\r\n * The concept represents a data instance of a specified type with associated metadata.\r\n *\r\n * @async\r\n * @param {string} type - The type of the concept (e.g., \"User\", \"Post\")\r\n * @param {string} referent - The value or name of the concept instance\r\n * @param {boolean} [composition=false] - Whether this is a composition concept\r\n * @param {number} userId - The ID of the user creating the concept\r\n * @param {number} accessId - The access level ID for the concept\r\n * @param {number} [sessionInformationId=999] - The session information ID\r\n * @param {number} [referentId=0] - The referent ID for linking\r\n * @returns {Promise<Concept>} The created concept\r\n * @throws {Error} If the transaction has expired or creation fails\r\n *\r\n * @example\r\n * ```typescript\r\n * const transaction = new Transaction();\r\n * await transaction.initialize();\r\n *\r\n * try {\r\n * const userConcept = await transaction.MakeTheInstanceConcept(\r\n * \"User\",\r\n * \"John Doe\",\r\n * false,\r\n * 123,\r\n * 4,\r\n * 999,\r\n * 0\r\n * );\r\n * await transaction.commitTransaction();\r\n * } catch (error) {\r\n * await transaction.rollbackTransaction();\r\n * }\r\n * ```\r\n */\r\n async MakeTheInstanceConcept(\r\n type: string,\r\n referent: string,\r\n composition: boolean = false,\r\n userId: number,\r\n accessId: number,\r\n sessionInformationId: number = 999,\r\n referentId: number = 0\r\n ) {\r\n try {\r\n if (!this.success) throw Error(\"Query Transaction Expired\");\r\n\r\n const concept = await MakeTheInstanceConcept(\r\n type,\r\n referent,\r\n composition,\r\n userId,\r\n accessId,\r\n sessionInformationId,\r\n referentId,\r\n this.actions\r\n );\r\n await this.markAction();\r\n\r\n return concept;\r\n } catch (err) {\r\n console.log(err);\r\n this.success = false;\r\n throw err;\r\n }\r\n }\r\n \r\n\r\n /**\r\n * Creates a connection between two concepts within the transaction.\r\n * Establishes a typed relationship between source and target concepts.\r\n *\r\n * @async\r\n * @param {Concept} ofTheConcept - The source concept (starting point of the connection)\r\n * @param {Concept} toTheConcept - The target concept (endpoint of the connection)\r\n * @param {string} typeConnection - The type of connection/relationship\r\n * @returns {Promise<Connection>} The created connection\r\n * @throws {Error} If the transaction has expired or creation fails\r\n *\r\n * @example\r\n * ```typescript\r\n * const transaction = new Transaction();\r\n * await transaction.initialize();\r\n *\r\n * try {\r\n * const user = await transaction.MakeTheInstanceConcept(\"User\", \"Alice\", false, 1, 4);\r\n * const post = await transaction.MakeTheInstanceConcept(\"Post\", \"My Post\", false, 1, 4);\r\n * const connection = await transaction.CreateConnection(user, post, \"authored\");\r\n * await transaction.commitTransaction();\r\n * } catch (error) {\r\n * await transaction.rollbackTransaction();\r\n * }\r\n * ```\r\n */\r\n async CreateConnection(\r\n ofTheConcept: Concept,\r\n toTheConcept: Concept,\r\n typeConnection: string\r\n ) {\r\n try {\r\n if (!this.success) throw Error(\"Query Transaction Expired\");\r\n\r\n const connection = await CreateConnection(\r\n ofTheConcept,\r\n toTheConcept,\r\n typeConnection,\r\n this.actions\r\n );\r\n await this.markAction();\r\n\r\n return connection;\r\n } catch (err) {\r\n console.log(err);\r\n this.success = false;\r\n throw err;\r\n }\r\n }\r\n\r\n /**\r\n * Creates a new type concept within the transaction.\r\n * Type concepts define the schema or classification for instance concepts.\r\n *\r\n * @async\r\n * @param {string} typeString - The name of the type to create\r\n * @param {number} sessionId - The session ID\r\n * @param {number} sessionUserId - The session user ID\r\n * @param {number} userId - The ID of the user creating the type\r\n * @returns {Promise<Concept>} The created type concept\r\n * @throws {Error} If the transaction has expired or creation fails\r\n *\r\n * @example\r\n * ```typescript\r\n * const transaction = new Transaction();\r\n * await transaction.initialize();\r\n *\r\n * try {\r\n * const typeConcept = await transaction.MakeTheTypeConcept(\r\n * \"CustomType\",\r\n * 999,\r\n * 1,\r\n * 1\r\n * );\r\n * await transaction.commitTransaction();\r\n * } catch (error) {\r\n * await transaction.rollbackTransaction();\r\n * }\r\n * ```\r\n */\r\n async MakeTheTypeConcept (\r\n typeString: string, sessionId: number, sessionUserId: number, userId: number\r\n ){\r\n try {\r\n if (!this.success) throw Error(\"Query Transaction Expired\");\r\n\r\n const connection = await MakeTheTypeConcept(\r\n typeString,\r\n sessionId,\r\n sessionUserId,\r\n userId,\r\n this.actions\r\n );\r\n await this.markAction();\r\n\r\n return connection;\r\n } catch (err) {\r\n console.log(err);\r\n this.success = false;\r\n throw err;\r\n }\r\n }\r\n\r\n /**\r\n * Creates a connection using concept IDs within the transaction.\r\n * This is a more general method for creating connections when working directly with IDs\r\n * rather than Concept objects. Provides fine-grained control over connection properties.\r\n *\r\n * @async\r\n * @param {number} ofTheConceptId - The ID of the source concept\r\n * @param {number} ofTheConceptUserId - The user ID of the source concept\r\n * @param {number} toTheConceptId - The ID of the target concept\r\n * @param {number} toTheConceptUserId - The user ID of the target concept\r\n * @param {number} typeId - The connection type ID\r\n * @param {number} sessionInformationId - The session information ID\r\n * @param {number} sessionInformationUserId - The session information user ID\r\n * @param {number} [orderId=1] - The order ID for sequencing connections\r\n * @param {number} [accessId=4] - The access level ID\r\n * @param {number} [passedUserId=999] - The passed user ID for permissions\r\n * @returns {Promise<Connection>} The created connection\r\n * @throws {Error} If the transaction has expired or creation fails\r\n *\r\n * @example\r\n * ```typescript\r\n * const transaction = new Transaction();\r\n * await transaction.initialize();\r\n *\r\n * try {\r\n * const connection = await transaction.CreateTheConnectionGeneral(\r\n * 123, 1, // source concept\r\n * 456, 1, // target concept\r\n * 789, // type ID\r\n * 999, 1, // session info\r\n * 1, // order\r\n * 4, // access\r\n * 999 // user\r\n * );\r\n * await transaction.commitTransaction();\r\n * } catch (error) {\r\n * await transaction.rollbackTransaction();\r\n * }\r\n * ```\r\n */\r\nasync CreateTheConnectionGeneral(\r\n ofTheConceptId:number, ofTheConceptUserId:number, toTheConceptId:number, toTheConceptUserId:number,\r\n typeId: number, sessionInformationId: number, sessionInformationUserId: number, orderId: number = 1, accessId = 4, passedUserId:number = 999\r\n ) {\r\n try {\r\n if (!this.success) throw Error(\"Query Transaction Expired\");\r\n\r\n const connection = await CreateTheConnectionGeneral(\r\n ofTheConceptId,\r\n ofTheConceptUserId,\r\n toTheConceptId,\r\n toTheConceptUserId,\r\n typeId,\r\n sessionInformationId,\r\n sessionInformationUserId,\r\n orderId,\r\n accessId,\r\n passedUserId,\r\n this.actions\r\n );\r\n await this.markAction();\r\n\r\n return connection;\r\n } catch (err) {\r\n console.log(err);\r\n this.success = false;\r\n throw err;\r\n }\r\n }\r\n\r\n}\r\n\r\n/**\r\n * Represents the collection of actions within a transaction.\r\n * This interface tracks all concepts and connections created or modified\r\n * during a transaction for rollback and commit purposes.\r\n *\r\n * @interface InnerActions\r\n *\r\n * @example\r\n * ```typescript\r\n * const actions: InnerActions = {\r\n * concepts: [concept1, concept2],\r\n * connections: [connection1, connection2]\r\n * };\r\n * ```\r\n */\r\nexport interface InnerActions {\r\n /**\r\n * Array of concepts created or modified in the transaction.\r\n * @type {Concept[]}\r\n */\r\n concepts: Concept[],\r\n\r\n /**\r\n * Array of connections created or modified in the transaction.\r\n * @type {Connection[]}\r\n */\r\n connections: Connection[]\r\n}","/**\r\n * @fileoverview Binary tree for managing user-specific concepts and connections.\r\n * This module provides a composite-key based tree for efficient user and session-based data storage.\r\n * @module DataStructures/User/UserBinaryTree\r\n */\r\n\r\nimport { LConcept } from \"../../DataStructures/Local/LConcept\";\r\nimport { UserNode } from \"./UserNode\";\r\nimport { IdentifierFlags } from \"./../IdentifierFlags\";\r\nimport { LConnection } from \"../Local/LConnection\";\r\nimport { CreateDefaultLConcept } from \"../../app\";\r\n\r\n/**\r\n * Binary tree data structure for managing user-specific data with composite keys.\r\n *\r\n * @remarks\r\n * This class implements an AVL tree that uses composite keys (userId + sessionId + randomizer)\r\n * to organize user-specific concepts and connections. The composite key enables efficient\r\n * organization and retrieval of data by user, session, and application context.\r\n *\r\n * @example\r\n * ```typescript\r\n * const concept = new LConcept(123, \"example\", 5);\r\n * UserBinaryTree.addConceptToTree(concept, 42, 999);\r\n * const node = await UserBinaryTree.getNodeFromTree(42, 999, 123);\r\n * ```\r\n */\r\nexport class UserBinaryTree{\r\n /**\r\n * The root node of the user data binary tree.\r\n * Null if the tree is empty.\r\n */\r\n static root: UserNode | null = null;\r\n\r\n /**\r\n * Creates a composite key from user ID, session ID, and randomizer.\r\n *\r\n * @param userId - The user ID\r\n * @param sessionId - The session ID\r\n * @param randomizer - Additional identifier (defaults to 999)\r\n * @returns A 12-character hexadecimal composite key\r\n *\r\n * @remarks\r\n * The composite key is formed by concatenating three 4-digit hexadecimal values:\r\n * userHex (4 chars) + sessionHex (4 chars) + randomizerHex (4 chars) = 12 chars total.\r\n * This enables unique identification of data across users, sessions, and applications.\r\n *\r\n * @example\r\n * ```typescript\r\n * const key = UserBinaryTree.compositeKey(42, 999, 123);\r\n * // Returns something like \"002A03E7007B\"\r\n * ```\r\n */\r\n static compositeKey(userId: number, sessionId: number, randomizer: number = 999){\r\n let userHex = ('0000' + userId.toString(16).toUpperCase()).slice(-4);\r\n let sessionHex = ('0000' + sessionId.toString(16).toUpperCase()).slice(-4);\r\n let randomizerHex = ('0000'+ randomizer.toString(16).toUpperCase()).slice(-4);\r\n\r\n return userHex + sessionHex + randomizerHex;\r\n }\r\n\r\n /**\r\n * Adds a user node to the binary tree.\r\n *\r\n * @param node - The UserNode to be added to the tree\r\n *\r\n * @remarks\r\n * If the tree is empty, the provided node becomes the root.\r\n * Otherwise, the node is inserted using the AVL tree balancing algorithm.\r\n */\r\n static addNodeToTree(node:UserNode){\r\n if(this.root == null){\r\n this.root = node;\r\n return this.root;\r\n }\r\n else{\r\n this.root = this.root.addNode(node,this.root,this.root.height);\r\n\r\n }\r\n }\r\n\r\n /**\r\n * Waits for user data to be loaded into the tree.\r\n *\r\n * @returns A promise that resolves with \"done\" when data is loaded, or rejects with \"not\" after 25 seconds\r\n */\r\n static async waitForDataToLoad(){\r\n return new Promise((resolve,reject) => {\r\n this.checkFlag(resolve);\r\n setTimeout(()=>{\r\n reject(\"not\")},25000);\r\n });\r\n }\r\n\r\n /**\r\n * Periodically checks if user data has been loaded.\r\n *\r\n * @param resolve - The promise resolve function to call when data is loaded\r\n */\r\n static checkFlag(resolve:any){\r\n\r\n if(IdentifierFlags.isDataLoaded){\r\n return resolve(\"done\");\r\n }\r\n else{\r\n setTimeout(UserBinaryTree.checkFlag, 1000, resolve);\r\n }\r\n };\r\n\r\n /**\r\n * Creates a node from a concept and adds it to the user tree.\r\n *\r\n * @param concept - The LConcept object to be added\r\n * @param userId - The user ID\r\n * @param sessionId - The session ID (defaults to 999)\r\n *\r\n * @remarks\r\n * Uses the concept's applicationId as the randomizer in the composite key.\r\n */\r\n static addConceptToTree(concept:LConcept, userId:number, sessionId: number = 999){\r\n let key = this.compositeKey(userId, sessionId, concept.applicationId);\r\n let FakeConnection: LConnection = new LConnection(0,0,0,0,0,0);\r\n var node: UserNode = new UserNode(key, concept,FakeConnection, null, null);\r\n this.addNodeToTree(node);\r\n }\r\n\r\n /**\r\n * Creates a node from a connection and adds it to the user tree.\r\n *\r\n * @param connection - The LConnection object to be added\r\n * @param userId - The user ID\r\n * @param sessionId - The session ID (defaults to 999)\r\n *\r\n * @remarks\r\n * Uses the connection's applicationId as the randomizer in the composite key.\r\n */\r\n static addConnectionToTree(connection:LConnection, userId:number, sessionId: number = 999){\r\n let key = this.compositeKey(userId, sessionId, connection.applicationId);\r\n let FakeConcept: LConcept = CreateDefaultLConcept();\r\n var node: UserNode = new UserNode(key, FakeConcept,connection, null, null);\r\n this.addNodeToTree(node);\r\n }\r\n\r\n /**\r\n * Retrieves a node from the tree using composite key components.\r\n *\r\n * @param userId - The user ID\r\n * @param sessionId - The session ID\r\n * @param randomizer - Additional identifier (defaults to 999)\r\n * @returns The UserNode if found, null otherwise\r\n *\r\n * @remarks\r\n * Constructs a composite key from the parameters and performs a binary search.\r\n */\r\n static async getNodeFromTree(userId:number, sessionId: number, randomizer: number=999 ){\r\n // try{\r\n // var data = await this.waitForDataToLoad();\r\n // }\r\n // catch(exception){\r\n // return null;\r\n // }\r\n let key = this.compositeKey(userId, sessionId, randomizer);\r\n if(this.root){\r\n var Node = this.root.getFromNode(key, this.root);\r\n return Node;\r\n }\r\n return null;\r\n }\r\n \r\n\r\n /**\r\n * Removes a node from the tree using composite key components.\r\n *\r\n * @param userId - The user ID\r\n * @param sessionId - The session ID (defaults to 999)\r\n * @param randomizer - Additional identifier (defaults to 999)\r\n *\r\n * @remarks\r\n * Constructs a composite key and removes the matching node while maintaining AVL balance.\r\n */\r\n static async removeNodeFromTree(userId:number, sessionId: number = 999, randomizer = 999){\r\n if(this.root){\r\n let key = this.compositeKey(userId, sessionId, randomizer);\r\n this.root = this.root.removeNode(this.root,key);\r\n }\r\n }\r\n\r\n /**\r\n * Counts the total number of nodes in the tree.\r\n *\r\n * @returns The total number of user nodes in the tree\r\n *\r\n * @remarks\r\n * Recursively traverses the entire tree to count all nodes. Returns 0 if the tree is empty.\r\n *\r\n * @example\r\n * ```typescript\r\n * const count = UserBinaryTree.countNumberOfNodes();\r\n * console.log(`Tree contains ${count} user data nodes`);\r\n * ```\r\n */\r\n static countNumberOfNodes(){\r\n if(this.root){\r\n return this.root.countNodeBelow(this.root);\r\n\r\n }\r\n return 0;\r\n }\r\n\r\n\r\n\r\n\r\n\r\n}","/**\r\n * @fileoverview Node implementation for the UserBinaryTree.\r\n * This module provides the UserNode class for storing user-specific concepts and connections.\r\n * @module DataStructures/User/UserNode\r\n */\r\n\r\nimport { LConcept } from \"../Local/LConcept\";\r\nimport { LConnection } from \"../Local/LConnection\";\r\n\r\n/**\r\n * Represents a node in the user binary tree that stores both concepts and connections.\r\n *\r\n * @remarks\r\n * UserNode implements an AVL tree node that can store multiple concepts and connections\r\n * for a given composite key (userId + sessionId + randomizer). This allows efficient\r\n * storage and retrieval of all user data associated with a specific key combination.\r\n *\r\n * @example\r\n * ```typescript\r\n * const concept = new LConcept(123, \"example\", 5);\r\n * const connection = new LConnection(456, 1, 2, 3, 4, 5);\r\n * const node = new UserNode(\"compositeKey\", concept, connection, null, null);\r\n * ```\r\n */\r\nexport class UserNode{\r\n /**\r\n * The composite key used for tree ordering.\r\n * Typically a hexadecimal string combining userId, sessionId, and randomizer.\r\n */\r\n key:any;\r\n\r\n /**\r\n * Array of connections stored in this node.\r\n * Multiple connections can be associated with the same key.\r\n */\r\n connectionValue: LConnection [] = [];\r\n\r\n /**\r\n * Array of concepts stored in this node.\r\n * Multiple concepts can be associated with the same key.\r\n */\r\n value: LConcept [] = [];\r\n\r\n /**\r\n * Reference to the left child node.\r\n */\r\n leftNode: UserNode | null;\r\n\r\n /**\r\n * Reference to the right child node.\r\n */\r\n rightNode: UserNode | null;\r\n\r\n /**\r\n * The height of this node in the tree.\r\n * Used for AVL tree balancing calculations.\r\n */\r\n height:number = 1;\r\n\r\n /**\r\n * Creates a new UserNode.\r\n *\r\n * @param key - The composite key for tree ordering\r\n * @param value - The LConcept to store (added if ID > 0)\r\n * @param connectionValue - The LConnection to store (added if ID > 0)\r\n * @param leftNode - The left child node (or null)\r\n * @param rightNode - The right child node (or null)\r\n *\r\n * @remarks\r\n * Only adds concepts and connections with valid (> 0) IDs to their respective arrays.\r\n *\r\n * @example\r\n * ```typescript\r\n * const node = new UserNode(\"compositeKey\", concept, connection, null, null);\r\n * ```\r\n */\r\n constructor(key:any, value:LConcept, connectionValue : LConnection, leftNode: UserNode | null, rightNode:UserNode| null){\r\n this.key = key;\r\n if(value.id > 0){\r\n this.value.push(value);\r\n\r\n }\r\n if(connectionValue.id > 0){\r\n this.connectionValue.push(connectionValue);\r\n }\r\n this.leftNode = leftNode;\r\n this.rightNode = rightNode;\r\n }\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n /**\r\n * Adds a new node to the tree with AVL balancing.\r\n *\r\n * @param passedNode - The node to be added\r\n * @param node - The current node being evaluated\r\n * @param height - The height of the current node\r\n * @returns The root node after insertion and balancing\r\n *\r\n * @remarks\r\n * Implements AVL tree insertion. When a node with the same key exists,\r\n * the new node's concepts and connections are added to the existing node's arrays.\r\n */\r\n public addNode(passedNode:UserNode, node:UserNode|null, height:number){\r\n if(node == null){\r\n node = passedNode;\r\n return node;\r\n }\r\n\r\n var LeftNode = node.leftNode;\r\n var RightNode = node.rightNode;\r\n\r\n if(node.key > passedNode.key){\r\n node.leftNode = this.addNode(passedNode,LeftNode,height);\r\n }\r\n\r\n else if(node.key < passedNode.key){\r\n node.rightNode = this.addNode(passedNode,RightNode,height);\r\n }\r\n\r\n else{\r\n node.value.push(...passedNode.value);\r\n node.connectionValue.push(...passedNode.connectionValue);\r\n return node;\r\n }\r\n\r\n node.height = 1 + Math.max(this.getHeight(node.leftNode), this.getHeight(node.rightNode));\r\n\r\n let balancingFactor = this.getBalanceFactor(node);\r\n if(balancingFactor > 1){\r\n if(node.leftNode){\r\n if(passedNode.key < node.leftNode.key){\r\n return this.rightRotate(node);\r\n }\r\n else if(passedNode.key > node.leftNode.key){\r\n node.leftNode = this.leftRotate(node.leftNode);\r\n return this.rightRotate(node);\r\n }\r\n }\r\n\r\n }\r\n\r\n if(balancingFactor < -1){\r\n if(node.rightNode){\r\n if(passedNode.key > node.rightNode.key){\r\n return this.leftRotate(node);\r\n }\r\n else if (passedNode.key < node.rightNode.key){\r\n node.rightNode = this.rightRotate(node.rightNode);\r\n return this.leftRotate(node);\r\n }\r\n }\r\n }\r\n return node;\r\n \r\n }\r\n\r\n\r\n\r\n\r\n /**\r\n * Performs a right rotation on the given node for AVL balancing.\r\n *\r\n * @param y - The node to rotate right\r\n * @returns The new root node after rotation\r\n */\r\n public rightRotate(y:UserNode | null){\r\n if(y){\r\n let x = y.leftNode;\r\n if(x){\r\n let T2 = x.rightNode;\r\n\r\n y.leftNode = T2;\r\n \r\n x.rightNode = y;\r\n y.height = Math.max(this.getHeight(y.leftNode), this.getHeight(y.rightNode)) + 1;\r\n \r\n x.height = Math.max(this.getHeight(x.leftNode), this.getHeight(x.rightNode)) + 1;\r\n return x;\r\n }\r\n // return x;\r\n }\r\n return y;\r\n\r\n }\r\n\r\n /**\r\n * Performs a left rotation on the given node for AVL balancing.\r\n *\r\n * @param x - The node to rotate left\r\n * @returns The new root node after rotation\r\n */\r\n public leftRotate(x:UserNode | null){\r\n\r\n if(x){\r\n let y = x.rightNode;\r\n if(y){\r\n let T2 = y.leftNode;\r\n y.leftNode = x;\r\n x.rightNode = T2;\r\n x.height = Math.max(this.getHeight(x.leftNode),this.getHeight(x.rightNode)) + 1;\r\n y.height = Math.max(this.getHeight(y.leftNode), this.getHeight(x.rightNode)) + 1;\r\n return y;\r\n }\r\n //return y;\r\n }\r\n return x;\r\n\r\n }\r\n \r\n\r\n /**\r\n * Gets the height of a node.\r\n *\r\n * @param node - The node to get the height from\r\n * @returns The height of the node, or 0 if null\r\n */\r\n public getHeight(node: UserNode| null){\r\n if(node){\r\n return node.height;\r\n }\r\n return 0;\r\n }\r\n\r\n /**\r\n * Calculates the balance factor of a node.\r\n *\r\n * @param N - The node to calculate the balance factor for\r\n * @returns The balance factor (difference between left and right heights)\r\n */\r\n public getBalanceFactor(N: UserNode | null){\r\n if (N == null){\r\n return 0;\r\n }\r\n\r\n return this.getHeight(N.leftNode) - this.getHeight(N.rightNode);\r\n }\r\n\r\n /**\r\n * Retrieves a node from the tree by its composite key.\r\n *\r\n * @param id - The composite key string to search for\r\n * @param node - The current node being evaluated\r\n * @returns The matching UserNode if found, null otherwise\r\n */\r\n public getFromNode(id: string, node: UserNode | null) :UserNode | null{\r\n if(node){\r\n if(id == node.key){\r\n return node;\r\n }\r\n else if(id < node.key){\r\n return this.getFromNode(id, node.leftNode);\r\n }\r\n else if (id > node.key) {\r\n return this.getFromNode(id, node.rightNode);\r\n }\r\n return node;\r\n }\r\n return node;\r\n\r\n }\r\n\r\n\r\n\r\n\r\n\r\n \r\n \r\n\r\n /**\r\n * Removes a node from the tree by its composite key.\r\n *\r\n * @param passedNode - The current node being evaluated\r\n * @param id - The composite key string to remove\r\n * @returns The root node after removal\r\n *\r\n * @remarks\r\n * Implements standard BST deletion with in-order successor replacement.\r\n */\r\n public removeNode(passedNode:UserNode|null,id:string){\r\n if(passedNode == null){\r\n return passedNode;\r\n }\r\n if(passedNode.key > id){\r\n passedNode.leftNode = this.removeNode(passedNode.leftNode, id);\r\n return passedNode;\r\n }\r\n else if(passedNode.key < id){\r\n passedNode.rightNode = this.removeNode(passedNode.rightNode,id);\r\n return passedNode;\r\n }\r\n\r\n\r\n if(passedNode.leftNode == null){\r\n let temp = passedNode.rightNode;\r\n passedNode = null;\r\n return temp;\r\n }\r\n else if(passedNode.rightNode == null){\r\n let temp = passedNode.leftNode;\r\n passedNode = null;\r\n return temp;\r\n }\r\n else{ \r\n // passing the rightNode to the inOrderSuccessor gives the immediate successor of the node\r\n var immediateSuccessor = this.inOrderSuccessor(passedNode.rightNode);\r\n passedNode.value = immediateSuccessor.value;\r\n passedNode.key = immediateSuccessor.key;\r\n passedNode.rightNode = this.removeNode(passedNode.rightNode,immediateSuccessor.key);\r\n return passedNode;\r\n\r\n }\r\n \r\n }\r\n\r\n \r\n\r\n\r\n /**\r\n * Counts all nodes below and including the given node.\r\n *\r\n * @param root - The root node to start counting from\r\n * @returns The total number of nodes in the subtree\r\n *\r\n * @remarks\r\n * Recursively traverses the entire subtree to count all nodes.\r\n */\r\n countNodeBelow(root:UserNode|null):number{\r\n if(root==null)\r\n {\r\n return 0;\r\n }\r\n\r\n //recursive call to left child and right child and\r\n // add the result of these with 1 ( 1 for counting the root)\r\n return 1 + this.countNodeBelow(root.leftNode) + this.countNodeBelow(root.rightNode);\r\n }\r\n\r\n /**\r\n * Finds the in-order successor of a node.\r\n *\r\n * @param root - The node to find the successor from\r\n * @returns The in-order successor node (leftmost node in right subtree)\r\n *\r\n * @remarks\r\n * Used during node deletion to find the replacement node.\r\n */\r\n inOrderSuccessor(root:UserNode){\r\n while (root.leftNode != null) {\r\n root = root.leftNode;\r\n }\r\n return root;\r\n }\r\n\r\n\r\n\r\n}","/**\r\n * No-operation IndexedDB interface module for environments without IndexedDB support.\r\n *\r\n * This module provides stub implementations of database operations that are used when\r\n * IndexedDB is not available or when database functionality needs to be disabled.\r\n * All functions are no-ops or return default values, allowing the application to\r\n * run without actual database persistence.\r\n *\r\n * @module Database/NoIndexDb\r\n * @see https://documentation.freeschema.com for reference\r\n */\r\n\r\nimport { SettingData } from \"../DataStructures/SettingData\";\r\nimport { IndexDb } from \"./indexeddb\";\r\n\r\n/**\r\n * Opens or returns a reference to the IndexedDB database.\r\n *\r\n * In this no-op implementation, it simply returns the static database reference\r\n * from IndexDb without performing any actual initialization.\r\n *\r\n * @param databaseName - The name of the database to open\r\n * @returns The static IDBDatabase reference from IndexDb.db\r\n *\r\n * @example\r\n * ```typescript\r\n * const db = openDatabase('concepts-db');\r\n * // Returns IndexDb.db without initialization\r\n * ```\r\n *\r\n * @remarks\r\n * This is a stub implementation used when full database functionality is not needed.\r\n *\r\n * @see IndexDb for the database singleton\r\n */\r\nexport function openDatabase(databaseName:string){\r\n return IndexDb.db;\r\n}\r\n\r\n/**\r\n * Stores an object to the database (no-op implementation).\r\n *\r\n * This function provides a stub for storing data to IndexedDB. In this no-op\r\n * implementation, it does not perform any actual storage operations.\r\n *\r\n * @param databaseName - The name of the database or object store\r\n * @param object - The object to store (can be any type)\r\n *\r\n * @example\r\n * ```typescript\r\n * const concept = { id: 1, name: 'Example' };\r\n * storeToDatabase('concepts', concept);\r\n * // No actual storage occurs\r\n * ```\r\n *\r\n * @remarks\r\n * This is a placeholder implementation. Use the full database module for actual persistence.\r\n */\r\nexport function storeToDatabase(databaseName:string, object:any){\r\n}\r\n\r\n/**\r\n * Retrieves statistics and settings from the database.\r\n *\r\n * Returns a new SettingData instance initialized with default values.\r\n * This provides a consistent interface for accessing settings even when\r\n * database functionality is disabled.\r\n *\r\n * @returns A new SettingData instance with AI features enabled (true)\r\n *\r\n * @example\r\n * ```typescript\r\n * const stats = GetStatsFromDatabase();\r\n * // Returns SettingData with default configuration\r\n * ```\r\n *\r\n * @remarks\r\n * The returned SettingData is initialized with AI features enabled by default.\r\n *\r\n * @see SettingData for the settings data structure\r\n */\r\nexport function GetStatsFromDatabase(){\r\n\r\n var settingsData:SettingData = new SettingData(true);\r\n return settingsData;\r\n}\r\n\r\n/**\r\n * Updates the AI flag in settings (no-op implementation).\r\n *\r\n * This function provides a stub for updating AI-related settings in the database.\r\n * In this no-op implementation, it does not perform any actual updates.\r\n *\r\n * @param object - The SettingData object containing the new AI flag value\r\n *\r\n * @example\r\n * ```typescript\r\n * const settings = new SettingData(false);\r\n * AiUpdateFlag(settings);\r\n * // No actual update occurs\r\n * ```\r\n *\r\n * @remarks\r\n * This is a placeholder implementation. Changes are not persisted.\r\n *\r\n * @see SettingData for the settings data structure\r\n */\r\nexport function AiUpdateFlag(object:SettingData){\r\n}\r\n\r\n/**\r\n * Retrieves an object from the database by type and ID (no-op implementation).\r\n *\r\n * This async function provides a stub for fetching data from IndexedDB based on\r\n * type and ID. In this no-op implementation, it returns undefined.\r\n *\r\n * @param databaseName - The name of the database or object store\r\n * @param type - The type of object to retrieve (e.g., 'concept', 'setting')\r\n * @param id - The numeric ID of the object to retrieve\r\n * @returns Promise resolving to undefined\r\n *\r\n * @example\r\n * ```typescript\r\n * const concept = await getFromDatabaseWithType('concepts', 'concept', 123);\r\n * // Returns undefined\r\n * ```\r\n *\r\n * @remarks\r\n * This is a placeholder implementation. Use the full database module for actual retrieval.\r\n */\r\nexport async function getFromDatabaseWithType(databaseName:string, type:string, id:number){\r\n}\r\n\r\n/**\r\n * Retrieves objects from the database using legacy method (no-op implementation).\r\n *\r\n * This async function provides a stub for the older method of fetching data from\r\n * IndexedDB. In this no-op implementation, it returns undefined.\r\n *\r\n * @param databaseName - The name of the database or object store\r\n * @returns Promise resolving to undefined\r\n *\r\n * @example\r\n * ```typescript\r\n * const data = await getFromDatabaseWithTypeOld('concepts');\r\n * // Returns undefined\r\n * ```\r\n *\r\n * @remarks\r\n * This is a legacy method maintained for backward compatibility. Use getFromDatabaseWithType\r\n * for new implementations.\r\n *\r\n * @see getFromDatabaseWithType for the current retrieval method\r\n */\r\nexport async function getFromDatabaseWithTypeOld(databaseName:string){\r\n}\r\n\r\n/**\r\n * Removes an object from the database by ID (no-op implementation).\r\n *\r\n * This function provides a stub for deleting data from IndexedDB. In this no-op\r\n * implementation, it does not perform any actual deletion.\r\n *\r\n * @param databaseName - The name of the database or object store\r\n * @param id - The numeric ID of the object to remove\r\n *\r\n * @example\r\n * ```typescript\r\n * removeFromDatabase('concepts', 123);\r\n * // No actual deletion occurs\r\n * ```\r\n *\r\n * @remarks\r\n * This is a placeholder implementation. Use the full database module for actual deletion.\r\n */\r\nexport function removeFromDatabase(databaseName:string, id:number){\r\n\r\n}\r\n\r\n/**\r\n * Retrieves all objects from the local database (no-op implementation).\r\n *\r\n * This async function provides a stub for fetching all data from a local IndexedDB\r\n * object store. In this no-op implementation, it returns undefined.\r\n *\r\n * @param databaseName - The name of the database or object store\r\n * @returns Promise resolving to undefined\r\n *\r\n * @example\r\n * ```typescript\r\n * const allConcepts = await getAllFromLocalDb('concepts');\r\n * // Returns undefined\r\n * ```\r\n *\r\n * @remarks\r\n * This is a placeholder implementation. Use the full database module for actual bulk retrieval.\r\n *\r\n * @see LocalIndexDb for local database operations\r\n */\r\nexport async function getAllFromLocalDb(databaseName:string){\r\n}","/**\r\n * IndexedDB management module for the Concept Connection System.\r\n *\r\n * This module provides a singleton class that maintains a static reference to an\r\n * IndexedDB database connection. It serves as the primary interface for browser-based\r\n * storage of concepts, settings, and other CCS data structures.\r\n *\r\n * @module Database/indexeddb\r\n * @see https://documentation.freeschema.com for reference\r\n */\r\n\r\nimport { ConceptsData } from \"../DataStructures/ConceptData\";\r\nimport { Concept } from \"../DataStructures/Concept\";\r\nimport { Settings } from \"../DataStructures/Settings\";\r\nimport { SettingData } from \"../DataStructures/SettingData\";\r\nimport { BaseUrl } from \"../DataStructures/BaseUrl\";\r\n\r\nvar version = 4;\r\n\r\n/**\r\n * Singleton class managing the IndexedDB database connection.\r\n *\r\n * IndexDb provides a static database reference that can be accessed throughout\r\n * the application for storing and retrieving concept data, settings, and other\r\n * persistent information in the browser's IndexedDB storage.\r\n *\r\n * @remarks\r\n * The static db property is shared across the entire application. It should be\r\n * initialized during application startup before performing any database operations.\r\n * The current database schema version is 4.\r\n *\r\n * @example\r\n * ```typescript\r\n * // Access the database instance\r\n * const database = IndexDb.db;\r\n * if (database) {\r\n * // Perform database operations\r\n * const transaction = database.transaction(['concepts'], 'readonly');\r\n * }\r\n * ```\r\n *\r\n * @see LocalIndexDb for local-only database operations\r\n * @see https://documentation.freeschema.com for database schema details\r\n */\r\nexport class IndexDb{\r\n /**\r\n * Static reference to the IndexedDB database instance.\r\n *\r\n * This property holds the active IDBDatabase connection used throughout\r\n * the application. Must be initialized before use.\r\n *\r\n * @type {IDBDatabase}\r\n */\r\n static db:IDBDatabase;\r\n}\r\n\r\n","/**\r\n * Check If Exists Helper Module for Concept Connection System (CCS-JS)\r\n *\r\n * This module provides utility functions to verify the existence of concepts and connections\r\n * within arrays. These functions are essential for avoiding duplicates and finding related\r\n * entities in the CCS data structures.\r\n *\r\n * @module Helpers/CheckIfExists\r\n * @see https://documentation.freeschema.com for data structure reference\r\n */\r\n\r\nimport { Concept } from \"../DataStructures/Concept\"\r\nimport { Connection } from \"../DataStructures/Connection\"\r\nimport { CreateDefaultConcept } from \"../Services/CreateDefaultConcept\"\r\nimport { LConcept, LConnection } from \"../app\"\r\n\r\n\r\n\r\n/**\r\n * Checks if a concept exists in an array of concepts by matching IDs.\r\n *\r\n * @param conceptList - Array of concepts to search through\r\n * @param concept - The concept to search for\r\n * @returns The found concept if it exists, otherwise returns a default concept\r\n *\r\n * @example\r\n * ```typescript\r\n * const concepts = [concept1, concept2, concept3];\r\n * const found = CheckIfConceptsExistsInArray(concepts, concept2);\r\n * if (found.id !== 0) {\r\n * console.log('Concept exists!');\r\n * }\r\n * ```\r\n *\r\n * @remarks\r\n * Returns a default concept (created via CreateDefaultConcept) if the concept is not found.\r\n * Always check the returned concept's ID to verify if a match was found.\r\n */\r\nexport function CheckIfConceptsExistsInArray(\r\n conceptList: Concept[] = [],\r\n concept: Concept,\r\n) {\r\n let foundConcept = CreateDefaultConcept()\r\n if (Array.isArray(conceptList)) {\r\n const check = conceptList.find(c => c.id === concept.id)\r\n if (check) {\r\n foundConcept = check\r\n }\r\n }\r\n return foundConcept\r\n}\r\n\r\n// export function CheckIfTypeConceptExistsInArray(\r\n// conceptList: Concept[] = [],\r\n// concept: Concept,\r\n// ) {\r\n// let newConceptType = concept.type?.characterValue;\r\n// if(!newConceptType?.startsWith(\"the_\")){\r\n// newConceptType = \"the_\" + newConceptType;\r\n// }\r\n// let startsWith = conceptList[i].type?.characterValue;\r\n// if(!startsWith?.startsWith(\"the_\")){\r\n// startsWith = \"the_\" + startsWith;\r\n// }\r\n// let foundConcept = CreateDefaultConcept()\r\n// if (Array.isArray(conceptList)) {\r\n// const check = conceptList.find(c => c.typeId == concept.typeId)\r\n// if (check) {\r\n// foundConcept = check\r\n// }\r\n// }\r\n\r\n// return foundConcept\r\n// }\r\n\r\n/**\r\n * Checks if concepts of the same type exist in an array, matching by type ID or character value.\r\n *\r\n * @param conceptList - Array of concepts to search through\r\n * @param concept - The concept whose type to match against\r\n * @returns Array of all concepts that match the same type\r\n *\r\n * @example\r\n * ```typescript\r\n * const concepts = [concept1, concept2, concept3];\r\n * const sameType = CheckIfTypeConceptsExistsInArray(concepts, concept1);\r\n * console.log(`Found ${sameType.length} concepts of the same type`);\r\n * ```\r\n *\r\n * @remarks\r\n * This function normalizes type character values by ensuring they start with \"the_\" prefix\r\n * before comparison. It matches concepts by either:\r\n * - Exact typeId match\r\n * - Character value match (with \"the_\" prefix normalization)\r\n */\r\nexport function CheckIfTypeConceptsExistsInArray(\r\n conceptList: Concept[] = [],\r\n concept: Concept,\r\n) {\r\n let foundConcepts: Concept[] = [];\r\n let newConceptType = concept.type?.characterValue;\r\n if(!newConceptType?.startsWith(\"the_\")){\r\n newConceptType = \"the_\" + newConceptType;\r\n }\r\n if (Array.isArray(conceptList)) {\r\n for(let i=0 ; i<conceptList.length; i++){\r\n let startsWith = conceptList[i].type?.characterValue;\r\n if(!startsWith?.startsWith(\"the_\")){\r\n startsWith = \"the_\" + startsWith;\r\n }\r\n if (concept.typeId == conceptList[i].typeId || newConceptType == startsWith) {\r\n foundConcepts.push(conceptList[i]);\r\n }\r\n }\r\n\r\n }\r\n\r\n return foundConcepts\r\n}\r\n\r\n\r\n/**\r\n * Checks if LConcepts (lightweight concepts) of the same type exist in an array.\r\n *\r\n * @param conceptList - Array of LConcepts to search through\r\n * @param concept - The LConcept whose type to match against\r\n * @returns Array of all LConcepts that match the same type\r\n *\r\n * @example\r\n * ```typescript\r\n * const lconcepts = [lconcept1, lconcept2, lconcept3];\r\n * const sameType = CheckIfTypeLConceptsExistsInArray(lconcepts, lconcept1);\r\n * console.log(`Found ${sameType.length} LConcepts of the same type`);\r\n * ```\r\n *\r\n * @remarks\r\n * This is the LConcept variant of CheckIfTypeConceptsExistsInArray.\r\n * LConcept is a lightweight representation that uses typeCharacter instead of type object.\r\n * The function normalizes type character values by ensuring they start with \"the_\" prefix.\r\n *\r\n * @see {@link CheckIfTypeConceptsExistsInArray}\r\n */\r\nexport function CheckIfTypeLConceptsExistsInArray(\r\n conceptList: LConcept[] = [],\r\n concept: LConcept,\r\n) {\r\n let foundConcepts: LConcept[] = [];\r\n let newConceptType = concept.typeCharacter;\r\n if(!newConceptType?.startsWith(\"the_\")){\r\n newConceptType = \"the_\" + newConceptType;\r\n }\r\n if (Array.isArray(conceptList)) {\r\n for(let i=0 ; i<conceptList.length; i++){\r\n let startsWith = conceptList[i].typeCharacter;\r\n if(!startsWith?.startsWith(\"the_\")){\r\n startsWith = \"the_\" + startsWith;\r\n }\r\n if (concept.typeId == conceptList[i].typeId || newConceptType == startsWith) {\r\n foundConcepts.push(conceptList[i]);\r\n }\r\n }\r\n\r\n }\r\n\r\n return foundConcepts\r\n}\r\n\r\n\r\n\r\n/**\r\n * Checks if a connection exists in an array of connections by matching IDs.\r\n *\r\n * @param connectionList - Array of connections to search through\r\n * @param connection - The connection to search for\r\n * @returns The found connection if it exists, otherwise returns a default connection with all zeros\r\n *\r\n * @example\r\n * ```typescript\r\n * const connections = [conn1, conn2, conn3];\r\n * const found = CheckIfConnectionExistsInArray(connections, conn2);\r\n * if (found.id !== 0) {\r\n * console.log('Connection exists!');\r\n * }\r\n * ```\r\n *\r\n * @remarks\r\n * Returns a new Connection instance with all parameters set to 0 if the connection is not found.\r\n * Always check the returned connection's ID to verify if a match was found.\r\n */\r\nexport function CheckIfConnectionExistsInArray(\r\n connectionList: Connection[] = [],\r\n connection: Connection,\r\n) {\r\n let foundConnection = new Connection(\r\n 0,\r\n 0,\r\n 0,\r\n 0,\r\n 0,\r\n 0,\r\n 0,\r\n 0,\r\n 0,\r\n 0,\r\n 0,\r\n 0,\r\n 0,\r\n 0,\r\n 0,\r\n 0,\r\n )\r\n if (Array.isArray(connectionList)) {\r\n const check = connectionList.find(c => c.id === connection.id)\r\n if (check) {\r\n foundConnection = check\r\n }\r\n }\r\n return foundConnection\r\n}\r\n\r\n\r\n\r\n/**\r\n * Checks if a connection exists in an array where a concept is either the source or target.\r\n *\r\n * @param connectionList - Array of connections to search through\r\n * @param conceptId - The ID of the concept to find in connections\r\n * @returns The first connection found where the concept appears as either toTheConceptId or ofTheConceptId\r\n *\r\n * @example\r\n * ```typescript\r\n * const connections = [conn1, conn2, conn3];\r\n * const found = CheckIfToTheConceptExistsInConnectionArray(connections, 123);\r\n * if (found.id !== 0) {\r\n * console.log('Concept is connected!');\r\n * }\r\n * ```\r\n *\r\n * @remarks\r\n * This function searches bidirectionally - it finds connections where the concept is either:\r\n * - The target (toTheConceptId)\r\n * - The source (ofTheConceptId)\r\n * If both exist, the ofTheConceptId match takes precedence as it's checked second.\r\n * Returns a default connection (all zeros) if no match is found.\r\n */\r\nexport function CheckIfToTheConceptExistsInConnectionArray(\r\n connectionList: Connection[] = [],\r\n conceptId: number,\r\n) {\r\n let foundConnection = new Connection(\r\n 0,\r\n 0,\r\n 0,\r\n 0,\r\n 0,\r\n 0,\r\n 0,\r\n 0,\r\n 0,\r\n 0,\r\n 0,\r\n 0,\r\n 0,\r\n 0,\r\n 0,\r\n 0,\r\n )\r\n if (Array.isArray(connectionList)) {\r\n const check = connectionList.find(c => c.toTheConceptId === conceptId)\r\n if (check) {\r\n foundConnection = check\r\n }\r\n const toCheck = connectionList.find(c => c.ofTheConceptId === conceptId)\r\n if (toCheck) {\r\n foundConnection = toCheck\r\n }\r\n }\r\n return foundConnection\r\n}\r\n\r\n/**\r\n * Finds all connections in an array where a concept appears as either source or target.\r\n *\r\n * @param connectionList - Array of connections to search through\r\n * @param conceptId - The ID of the concept to find in connections\r\n * @returns Array of all connections where the concept is connected (up to 2: one as target, one as source)\r\n *\r\n * @example\r\n * ```typescript\r\n * const connections = [conn1, conn2, conn3];\r\n * const found = CheckAllConnectionsConnectedInConnectionArray(connections, 123);\r\n * console.log(`Concept has ${found.length} connections`);\r\n * ```\r\n *\r\n * @remarks\r\n * This function finds connections where the concept appears as:\r\n * - toTheConceptId (target/destination of connection)\r\n * - ofTheConceptId (source/origin of connection)\r\n * Note: Uses `find()` which only returns the first match for each direction,\r\n * so maximum 2 connections will be returned even if more exist.\r\n *\r\n * @see {@link CheckAllConnectionsConnectedInLConnectionArray} for the LConnection variant\r\n */\r\nexport function CheckAllConnectionsConnectedInConnectionArray(\r\n connectionList: Connection[] = [],\r\n conceptId: number,\r\n){\r\n let foundConnections = [];\r\n if (Array.isArray(connectionList)) {\r\n const check = connectionList.find(c => c.toTheConceptId == conceptId)\r\n if (check) {\r\n foundConnections.push(check);\r\n }\r\n const toCheck = connectionList.find(c => c.ofTheConceptId == conceptId)\r\n if (toCheck) {\r\n foundConnections.push(toCheck);\r\n }\r\n }\r\n return foundConnections\r\n}\r\n\r\n\r\n\r\n/**\r\n * Finds all LConnections (lightweight connections) in an array where a concept appears as either source or target.\r\n *\r\n * @param connectionList - Array of LConnections to search through\r\n * @param conceptId - The ID of the concept to find in connections\r\n * @returns Array of all LConnections where the concept is connected (up to 2: one as target, one as source)\r\n *\r\n * @example\r\n * ```typescript\r\n * const lconnections = [lconn1, lconn2, lconn3];\r\n * const found = CheckAllConnectionsConnectedInLConnectionArray(lconnections, 123);\r\n * console.log(`Concept has ${found.length} lightweight connections`);\r\n * ```\r\n *\r\n * @remarks\r\n * This is the LConnection variant of CheckAllConnectionsConnectedInConnectionArray.\r\n * LConnection is a lightweight representation of connections used for performance optimization.\r\n * Like its standard counterpart, it uses `find()` which only returns the first match per direction,\r\n * so maximum 2 connections will be returned.\r\n *\r\n * @see {@link CheckAllConnectionsConnectedInConnectionArray}\r\n */\r\nexport function CheckAllConnectionsConnectedInLConnectionArray(\r\n connectionList: LConnection[] = [],\r\n conceptId: number,\r\n){\r\n let foundConnections = [];\r\n if (Array.isArray(connectionList)) {\r\n const check = connectionList.find(c => c.toTheConceptId == conceptId)\r\n if (check) {\r\n foundConnections.push(check);\r\n }\r\n const toCheck = connectionList.find(c => c.ofTheConceptId == conceptId)\r\n if (toCheck) {\r\n foundConnections.push(toCheck);\r\n }\r\n }\r\n return foundConnections\r\n}\r\n\r\n","/**\r\n * Remove From Array Helper Module for Concept Connection System (CCS-JS)\r\n *\r\n * This module provides utility functions for removing concepts and connections from arrays.\r\n * These functions mutate the original arrays by splicing out matching elements by ID.\r\n *\r\n * @module Helpers/RemoveFromArray\r\n * @see https://documentation.freeschema.com for data structure reference\r\n */\r\n\r\nimport { Concept } from \"../DataStructures/Concept\"\r\nimport { Connection } from \"../DataStructures/Connection\"\r\nimport { LConnection } from \"../app\"\r\n\r\n/**\r\n * Removes a concept from an array by matching its ID.\r\n *\r\n * @param conceptList - Array of concepts to remove from (will be mutated)\r\n * @param concept - The concept to remove from the array\r\n *\r\n * @example\r\n * ```typescript\r\n * const concepts = [concept1, concept2, concept3];\r\n * RemoveConceptFromList(concepts, concept2);\r\n * console.log(concepts.length); // 2 (concept2 has been removed)\r\n * ```\r\n *\r\n * @remarks\r\n * This function mutates the original array using splice().\r\n * If the concept is not found (findIndex returns -1), splice will remove the last element.\r\n * Ensure the concept exists in the array before calling this function to avoid unintended removals.\r\n */\r\nexport function RemoveConceptFromList(\r\n conceptList: Concept[] = [],\r\n concept: Concept,\r\n) {\r\n if (Array.isArray(conceptList)) {\r\n conceptList.splice(\r\n conceptList.findIndex(function (i) {\r\n return i.id === concept.id\r\n }),\r\n 1,\r\n )\r\n }\r\n}\r\n\r\n/**\r\n * Removes a connection from an array by matching its ID.\r\n *\r\n * @param connectionList - Array of connections to remove from (will be mutated)\r\n * @param connection - The connection to remove from the array\r\n *\r\n * @example\r\n * ```typescript\r\n * const connections = [conn1, conn2, conn3];\r\n * RemoveConnectionFromList(connections, conn2);\r\n * console.log(connections.length); // 2 (conn2 has been removed)\r\n * ```\r\n *\r\n * @remarks\r\n * This function mutates the original array using splice().\r\n * If the connection is not found (findIndex returns -1), splice will remove the last element.\r\n * Ensure the connection exists in the array before calling this function to avoid unintended removals.\r\n */\r\nexport function RemoveConnectionFromList(\r\n connectionList: Connection[] = [],\r\n connection: Connection,\r\n) {\r\n if (Array.isArray(connectionList)) {\r\n connectionList.splice(\r\n connectionList.findIndex(function (i) {\r\n return i.id === connection.id\r\n }),\r\n 1,\r\n )\r\n }\r\n}\r\n\r\n/**\r\n * Removes an LConnection (lightweight connection) from an array by matching its ID.\r\n *\r\n * @param connectionList - Array of LConnections to remove from (will be mutated)\r\n * @param connection - The LConnection to remove from the array\r\n *\r\n * @example\r\n * ```typescript\r\n * const lconnections = [lconn1, lconn2, lconn3];\r\n * RemoveLConnectionFromList(lconnections, lconn2);\r\n * console.log(lconnections.length); // 2 (lconn2 has been removed)\r\n * ```\r\n *\r\n * @remarks\r\n * This is the LConnection variant of RemoveConnectionFromList.\r\n * LConnection is a lightweight representation used for performance optimization.\r\n * This function mutates the original array using splice().\r\n * If the connection is not found (findIndex returns -1), splice will remove the last element.\r\n *\r\n * @see {@link RemoveConnectionFromList}\r\n */\r\nexport function RemoveLConnectionFromList(\r\n connectionList: LConnection[] = [],\r\n connection: LConnection,\r\n) {\r\n if (Array.isArray(connectionList)) {\r\n connectionList.splice(\r\n connectionList.findIndex(function (i) {\r\n return i.id === connection.id\r\n }),\r\n 1,\r\n )\r\n }\r\n}\r\n","/**\r\n * Unique Insert Helper Module for Concept Connection System (CCS-JS)\r\n *\r\n * This module provides utility functions for inserting values into arrays while ensuring uniqueness.\r\n * It prevents duplicate entries by checking if the value already exists before insertion.\r\n *\r\n * @module Helpers/UniqueInsert\r\n * @see https://documentation.freeschema.com for data structure reference\r\n */\r\n\r\n/**\r\n * Inserts a number into an array only if it doesn't already exist.\r\n *\r\n * @param Array - Array of numbers to insert into (will be mutated if insertion occurs)\r\n * @param toInsert - The number to insert into the array\r\n * @returns The modified array with the number inserted (or unchanged if it already existed)\r\n *\r\n * @example\r\n * ```typescript\r\n * const numbers = [1, 2, 3];\r\n * InsertUniqueNumber(numbers, 4); // [1, 2, 3, 4]\r\n * InsertUniqueNumber(numbers, 2); // [1, 2, 3, 4] (2 already exists, no change)\r\n * ```\r\n *\r\n * @remarks\r\n * This function mutates the original array by pushing the value if it's not found.\r\n * Uses indexOf() for checking existence, which has O(n) time complexity.\r\n * For large arrays with frequent insertions, consider using a Set data structure instead.\r\n */\r\nexport default function InsertUniqueNumber(\r\n Array: number[],\r\n toInsert: number,\r\n ): number[] {\r\n if (Array.indexOf(toInsert) === -1) {\r\n Array.push(toInsert)\r\n }\r\n return Array\r\n }\r\n ","import { PermissionSet, getPermissionSetFromStrings } from './PermissionSet'\r\n\r\nexport class AccessControlCacheService {\r\n private readonly userAccessCache: Map<number, Map<number, PermissionSet>> = new Map()\r\n private readonly publicAccessCache: Map<number, PermissionSet> = new Map()\r\n private readonly baseUrl: string\r\n\r\n constructor() {\r\n this.baseUrl = process.env.ACCESS_CONTROL_BASE_URL || 'http://localhost:3000/api/access-control'\r\n if (!this.baseUrl) throw new Error('ACCESS_CONTROL_BASE_URL is not defined in environment')\r\n console.log('AccessControlCacheService initialized.')\r\n }\r\n\r\n async loadCacheFromApi(entityId?: number): Promise<void> {\r\n try {\r\n let url = `${this.baseUrl}/access-group/by-entity`\r\n if (entityId !== undefined) {\r\n url += `?entityId=${entityId}`\r\n }\r\n\r\n const response = await fetch(url)\r\n if (!response.ok) throw new Error(`Failed to fetch data: ${response.statusText}`)\r\n\r\n const data = await response.json()\r\n this.loadCacheFromJson(data)\r\n } catch (err) {\r\n console.error('[ERROR] loadCacheFromApi failed:', err)\r\n }\r\n }\r\n\r\n loadCacheFromJson(jsonData: any): void {\r\n const data = jsonData?.data\r\n if (!data || typeof data !== 'object') return\r\n\r\n const typedData = data as Record<string, Record<string, string[]>>\r\n for (const [entityKey, userPermissionsMap] of Object.entries(typedData)) {\r\n const entityId = parseInt(entityKey)\r\n if (!this.userAccessCache.has(entityId)) {\r\n this.userAccessCache.set(entityId, new Map())\r\n }\r\n\r\n for (const [conceptIdStr, permissionsList] of Object.entries(userPermissionsMap)) {\r\n const conceptId = parseInt(conceptIdStr)\r\n const permissionSet = getPermissionSetFromStrings(permissionsList)\r\n this.userAccessCache.get(entityId)!.set(conceptId, permissionSet)\r\n }\r\n }\r\n }\r\n\r\n async hasAccess(entityId: number, conceptId: number, required: PermissionSet): Promise<boolean> {\r\n if (await this.hasPublicAccess(conceptId, required)) return true\r\n console.log(\"length of userAccessCache:\", this.userAccessCache.size)\r\n if (!this.userAccessCache.has(entityId)) {\r\n await this.loadCacheFromApi(entityId)\r\n }\r\n\r\n const conceptMap = this.userAccessCache.get(entityId)\r\n const permissions = conceptMap?.get(conceptId)\r\n return permissions !== undefined && (permissions & required) === required\r\n }\r\n\r\n async getAccessibleConcepts(\r\n entityId: number,\r\n conceptIds: number[],\r\n required: PermissionSet\r\n ): Promise<number[]> {\r\n const result: number[] = []\r\n const remaining: number[] = []\r\n\r\n for (const id of conceptIds) {\r\n if (await this.hasPublicAccess(id, required)) {\r\n result.push(id)\r\n } else {\r\n remaining.push(id)\r\n }\r\n }\r\n console.log(\"length of userAccessCache:\", this.userAccessCache.size)\r\n if (remaining.length > 0 && !this.userAccessCache.has(entityId)) {\r\n await this.loadCacheFromApi(entityId)\r\n }\r\n\r\n const conceptMap = this.userAccessCache.get(entityId)\r\n for (const id of remaining) {\r\n const permissions = conceptMap?.get(id)\r\n if (permissions !== undefined && (permissions & required) === required) {\r\n result.push(id)\r\n }\r\n }\r\n\r\n return result\r\n }\r\n\r\n async getAccessByUser(entityId: number): Promise<Map<number, PermissionSet>> {\r\n if (!this.userAccessCache.has(entityId)) {\r\n await this.loadCacheFromApi(entityId)\r\n }\r\n return new Map(this.userAccessCache.get(entityId) ?? [])\r\n }\r\n\r\n async getAccessByConcept(conceptId: number): Promise<Map<number, PermissionSet>> {\r\n const result = new Map<number, PermissionSet>()\r\n\r\n if (this.userAccessCache.size === 0) {\r\n await this.loadCacheFromApi()\r\n }\r\n\r\n for (const [entityId, conceptMap] of this.userAccessCache) {\r\n const permission = conceptMap.get(conceptId)\r\n if (permission !== undefined) {\r\n result.set(entityId, permission)\r\n }\r\n }\r\n\r\n return result\r\n }\r\n\r\n deleteRecordByUserId(entityId: number): void {\r\n this.userAccessCache.delete(entityId)\r\n }\r\n\r\n deletePublicAccessRecordById(conceptId: number): void {\r\n console.log(`Deleting public access for concept ${conceptId}`)\r\n this.publicAccessCache.delete(conceptId)\r\n }\r\n\r\n clearCache(): void {\r\n console.log('Clearing access control cache...')\r\n this.userAccessCache.clear()\r\n this.publicAccessCache.clear()\r\n }\r\n\r\n async getConceptsByPublicAccess(): Promise<Record<number, string[]>> {\r\n const result: Record<number, string[]> = {}\r\n\r\n try {\r\n const response = await fetch(`${this.baseUrl}/concepts/by-public-access`)\r\n if (!response.ok) {\r\n throw new Error(`Failed to fetch public access: ${response.statusText}`)\r\n }\r\n\r\n const apiData = await response.json()\r\n const data = apiData?.data\r\n if (!data || typeof data !== 'object') return result\r\n\r\n for (const [conceptIdStr, perms] of Object.entries(data)) {\r\n const conceptId = parseInt(conceptIdStr)\r\n const permissionSet = getPermissionSetFromStrings(perms as string[])\r\n\r\n this.publicAccessCache.set(conceptId, permissionSet)\r\n result[conceptId] = perms as string[]\r\n }\r\n } catch (err) {\r\n console.error('[ERROR] Failed to fetch public access data:', err)\r\n }\r\n\r\n return result\r\n }\r\n\r\n async hasPublicAccess(conceptId: number, required: PermissionSet): Promise<boolean> {\r\n console.log(\"length of publicAccessCache:\", this.publicAccessCache.size)\r\n if (!this.publicAccessCache.has(conceptId)) {\r\n await this.getConceptsByPublicAccess()\r\n }\r\n\r\n const permissions = this.publicAccessCache.get(conceptId)\r\n return permissions !== undefined && (permissions & required) === required\r\n }\r\n\r\n async getConceptsWithPublicAccess(\r\n conceptIds: number[],\r\n required: PermissionSet\r\n ): Promise<number[]> {\r\n const accessible: number[] = []\r\n const missing: number[] = []\r\n\r\n for (const id of conceptIds) {\r\n const permissions = this.publicAccessCache.get(id)\r\n if (permissions !== undefined) {\r\n if ((permissions & required) === required) {\r\n accessible.push(id)\r\n }\r\n } else {\r\n missing.push(id)\r\n }\r\n }\r\n\r\n if (missing.length > 0) {\r\n await this.getConceptsByPublicAccess()\r\n for (const id of missing) {\r\n const updated = this.publicAccessCache.get(id)\r\n if (updated !== undefined && (updated & required) === required) {\r\n accessible.push(id)\r\n }\r\n }\r\n }\r\n\r\n return accessible\r\n }\r\n}\r\n","/**\r\n * AccessControlService\r\n * \r\n * This class provides a static API for managing access control in the application.\r\n * It wraps all backend access control endpoints, allowing you to:\r\n * - Assign, revoke, and query access for concepts, entities, and users.\r\n * - Check and filter access permissions for concepts and entities.\r\n * - Manage public access, access inheritance, and access groups.\r\n * - Interact with access control cache for efficient permission checks.\r\n * \r\n * Usage:\r\n * All methods are static and can be called directly on the class.\r\n * Example:\r\n * await AccessControlService.assignAccessToEntity({ ... });\r\n * const hasAccess = await AccessControlService.checkAccessOfConcept(...);\r\n * \r\n * Environment:\r\n * The service uses ACCESS_CONTROL_BASE_URL from environment variables, or defaults to 'http://localhost:3000/api/access-control'.\r\n * \r\n * Note:\r\n * This class is stateless and should be used as a singleton utility.\r\n */\r\nimport { BaseUrl, Concept, GetConceptBulk, GetTheConcept } from \"../../app\";\r\nimport { AccessControlCacheService } from \"./AccessControlCacheService\";\r\nimport { PermissionSet } from \"./PermissionSet\";\r\n\r\nexport class AccessControlService {\r\n private static accessCache = new AccessControlCacheService();\r\n private static baseUrl: string;\r\n\r\n // Static constructor\r\n private static initialize() {\r\n this.baseUrl =\r\n process.env.ACCESS_CONTROL_BASE_URL ||\r\n 'http://localhost:3000/api/access-control';\r\n if (!this.baseUrl)\r\n throw new Error('ACCESS_CONTROL_BASE_URL is not defined in environment');\r\n console.log('AccessControlService initialized.');\r\n }\r\n\r\n // Ensure static initialization\r\n static {\r\n AccessControlService.initialize();\r\n }\r\n\r\n /**\r\n * Checks if a user or entity has the specified access for a single concept.\r\n * @param userId - The user's ID.\r\n * @param access - The required PermissionSet.\r\n * @param conceptId - The concept ID to check.\r\n * @param entityId - Optional entity ID (defaults to userId).\r\n * @returns Promise<boolean> - True if access is granted, false otherwise.\r\n */\r\n static async checkAccessOfConcept(\r\n userId: number,\r\n access: PermissionSet,\r\n conceptId: number,\r\n entityId?: number\r\n ): Promise<boolean> {\r\n const concept = await GetTheConcept(conceptId);\r\n if (concept.userId === 999 || concept.userId === userId) {\r\n return true;\r\n }\r\n const accessId = concept.accessId ?? 0;\r\n entityId = entityId ? entityId : this.getEntityIdConceptByUserId(userId);\r\n return await this.accessCache.hasAccess(entityId, accessId, access);\r\n }\r\n\r\n /**\r\n * Checks if a user or entity has the specified access for all concepts in a list.\r\n * @param userId - The user's ID.\r\n * @param access - The required PermissionSet.\r\n * @param conceptIdList - Array of concept IDs to check.\r\n * @param entityId - Optional entity ID (defaults to userId).\r\n * @returns Promise<boolean> - True if access is granted for all, false otherwise.\r\n */\r\n static async checkAccessOfConceptList(\r\n userId: number,\r\n access: PermissionSet,\r\n conceptIdList: number[],\r\n entityId?: number\r\n ): Promise<boolean> {\r\n const conceptList = await GetConceptBulk(conceptIdList);\r\n\r\n const accessIdMap = Array.from(conceptList.values())\r\n .filter((c: Concept) => c.userId !== userId && c.userId !== 999)\r\n .map((c) => c.accessId ?? 0)\r\n .filter((value, index, self) => self.indexOf(value) === index); // Distinct values\r\n\r\n entityId = entityId ? entityId : this.getEntityIdConceptByUserId(userId);\r\n const accessList = await this.accessCache.getAccessibleConcepts(\r\n entityId,\r\n accessIdMap,\r\n access\r\n );\r\n return accessList.length === conceptIdList.length;\r\n }\r\n\r\n /**\r\n * Filters a list of concept IDs, returning only those for which the user or entity has the specified access.\r\n * @param userId - The user's ID.\r\n * @param access - The required PermissionSet.\r\n * @param conceptIdList - Array of concept IDs to filter.\r\n * @param entityId - Optional entity ID (defaults to userId).\r\n * @returns Promise<number[]> - Array of concept IDs with access.\r\n */\r\n static async filterConceptListByAccess(\r\n userId: number,\r\n access: PermissionSet,\r\n conceptIdList: number[],\r\n entityId?: number\r\n ): Promise<number[]> {\r\n const conceptList = await GetConceptBulk(conceptIdList);\r\n\r\n const accessIdMap = Array.from(conceptList.values())\r\n .filter((c) => c.userId !== userId && c.userId !== 999)\r\n .map((c) => c.accessId ?? 0)\r\n .filter((value, index, self) => self.indexOf(value) === index); // Distinct values\r\n\r\n entityId = entityId ? entityId : this.getEntityIdConceptByUserId(userId);\r\n const accessibleAccessIds = new Set(\r\n await this.accessCache.getAccessibleConcepts(entityId, accessIdMap, access)\r\n );\r\n\r\n const filteredList: number[] = [];\r\n for (const concept of conceptList.values()) {\r\n if (\r\n concept.userId === userId ||\r\n concept.userId === 999 ||\r\n accessibleAccessIds.has(concept.accessId ?? 0)\r\n ) {\r\n filteredList.push(concept.id);\r\n }\r\n }\r\n\r\n return filteredList;\r\n }\r\n\r\n /**\r\n * Gets the entity ID for a given user ID.\r\n * @param userId - The user's ID.\r\n * @returns number - The entity ID (default: userId).\r\n */\r\n private static getEntityIdConceptByUserId(userId: number): number {\r\n // TODO: Implement logic to get entity ID based on user ID\r\n return userId; // Placeholder logic\r\n }\r\n\r\n /**\r\n * Assigns access to a specific entity for a concept.\r\n * @param request - Object containing conceptId, access, entityId, makePublic.\r\n * @returns Promise<any> - API response.\r\n */\r\n static async assignAccessToEntity(request: {\r\n conceptId: number;\r\n access: string;\r\n entityId: number;\r\n makePublic: boolean;\r\n }): Promise<any> {\r\n return this._post('/api/access-control/access', request, 'Failed to assign access to entity');\r\n }\r\n\r\n /**\r\n * Assigns public access to a concept or list of concepts.\r\n * @param request - Object containing conceptId, accessList, connectionTypeList, nestedAccessLevel, conceptIdList.\r\n * @returns Promise<any> - API response.\r\n */\r\n static async assignPublicAccess(request: {\r\n conceptId: number;\r\n accessList: string[];\r\n connectionTypeList?: string[];\r\n nestedAccessLevel?: number;\r\n conceptIdList?: number[];\r\n }): Promise<any> {\r\n return this._post(\r\n '/api/access-control/public-access',\r\n {\r\n ...request,\r\n nestedAccessLevel: request.nestedAccessLevel ?? 0,\r\n conceptIdList: request.conceptIdList ?? [],\r\n },\r\n 'Failed to assign public access'\r\n );\r\n }\r\n\r\n /**\r\n * Assigns public access to multiple concepts in bulk.\r\n * @param request - Object containing conceptIdList, accessList, connectionTypeList, nestedAccessLevel, conceptId.\r\n * @returns Promise<any> - API response.\r\n */\r\n static async assignPublicAccessBlukConcept(request: {\r\n conceptIdList: number[];\r\n accessList: string[];\r\n connectionTypeList?: string[];\r\n nestedAccessLevel?: number;\r\n conceptId?: number;\r\n }): Promise<any> {\r\n return this._post(\r\n '/api/access-control/public-access',\r\n {\r\n ...request,\r\n nestedAccessLevel: request.nestedAccessLevel ?? 0,\r\n conceptId: request.conceptId ?? 0,\r\n },\r\n 'Failed to assign public access'\r\n );\r\n }\r\n\r\n /**\r\n * Assigns access to multiple entities and concepts in bulk.\r\n * @param request - Object containing conceptId, conceptIdList, entityIdList, accessList, connectionTypeList, nestedAccessLevel.\r\n * @returns Promise<any> - API response.\r\n */\r\n static async assignAccessToEntityBulk(request: {\r\n conceptId: number;\r\n conceptIdList?: number[];\r\n entityIdList: number[];\r\n accessList: string[];\r\n connectionTypeList?: string[];\r\n nestedAccessLevel?: number;\r\n }): Promise<any> {\r\n return this._post(\r\n '/api/access-control/access/bulk',\r\n {\r\n ...request,\r\n nestedAccessLevel: request.nestedAccessLevel ?? 0,\r\n },\r\n 'Failed to assign access in bulk'\r\n );\r\n }\r\n\r\n /**\r\n * Assigns access to a user for a concept.\r\n * @param request - Object containing conceptId, access, userId, makePublic.\r\n * @returns Promise<any> - API response.\r\n */\r\n static async assignAccessByUser(request: {\r\n conceptId: number;\r\n access: string;\r\n userId: number;\r\n makePublic: boolean;\r\n }): Promise<any> {\r\n return this._post('/api/access-control/user-access', request, 'Failed to assign access by user');\r\n }\r\n\r\n /**\r\n * Revokes access for an entity from a concept.\r\n * @param params - Object containing conceptId, access, entityId.\r\n * @returns Promise<any> - API response.\r\n */\r\n static async revokeAccess(params: {\r\n conceptId: number;\r\n access: string;\r\n entityId: number;\r\n }): Promise<any> {\r\n const { conceptId, access, entityId } = params;\r\n const url = `/api/access-control/access?conceptId=${conceptId}&access=${encodeURIComponent(access)}&entityId=${entityId}`;\r\n return this._delete(url, undefined, 'Failed to revoke access');\r\n }\r\n\r\n /**\r\n * Revokes access for multiple entities in bulk.\r\n * @param request - Object containing conceptId, entityIdList, accessList.\r\n * @returns Promise<any> - API response.\r\n */\r\n static async revokeAccessBulk(request: {\r\n conceptId: number;\r\n entityIdList: number[];\r\n accessList: string[];\r\n }): Promise<any> {\r\n return this._delete('/api/access-control/access/bulk', request, 'Failed to revoke access in bulk');\r\n }\r\n\r\n /**\r\n * Gets the access list for a concept and user.\r\n * @param conceptId - The concept ID.\r\n * @param userId - The user ID.\r\n * @returns Promise<any> - API response.\r\n */\r\n static async getAccessList(conceptId: number, userId: number): Promise<any> {\r\n const url = `/api/access-control/access-list?conceptId=${conceptId}&userId=${userId}`;\r\n return this._get(url, 'Failed to get access list');\r\n }\r\n\r\n /**\r\n * Gets the public access list for a list of concept IDs.\r\n * @param conceptIdList - Array of concept IDs.\r\n * @returns Promise<any> - API response.\r\n */\r\n static async getPublicAccessList(conceptIdList: number[]): Promise<any> {\r\n return this._post('/api/access-control/public-access/by-concept-ids', conceptIdList, 'Failed to get public access list');\r\n }\r\n\r\n /**\r\n * Revokes public access for a concept.\r\n * @param request - Object containing conceptId, accessList.\r\n * @returns Promise<any> - API response.\r\n */\r\n static async revokePublicAccess(request: {\r\n conceptId: number;\r\n accessList: string[];\r\n }): Promise<any> {\r\n return this._delete('/api/access-control/public-access', request, 'Failed to revoke public access');\r\n }\r\n\r\n /**\r\n * Checks if an entity has a specific permission for a concept.\r\n * @param params - Object containing conceptId, permission, entityId.\r\n * @returns Promise<any> - API response.\r\n */\r\n static async checkAccess(params: {\r\n conceptId: number;\r\n permission: string;\r\n entityId: number;\r\n }): Promise<any> {\r\n const url = `/api/access-control/access/check?conceptId=${params.conceptId}&permission=${encodeURIComponent(params.permission)}&entityId=${params.entityId}`;\r\n return this._get(url, 'Failed to check access');\r\n }\r\n\r\n /**\r\n * Checks if a user has a specific access for a concept.\r\n * @param request - Object containing conceptId, access, userId.\r\n * @returns Promise<any> - API response.\r\n */\r\n static async checkAccessByUser(request: {\r\n conceptId: number;\r\n access: string;\r\n userId: number;\r\n }): Promise<any> {\r\n return this._post('/api/access-control/user-access/check', request, 'Failed to check access by user');\r\n }\r\n\r\n /**\r\n * Filters concepts by access for a user.\r\n * @param request - Object containing userId, access, conceptIdList, connectionIdList.\r\n * @returns Promise<any> - API response.\r\n */\r\n static async filterConceptsByAccess(request: {\r\n userId: number;\r\n access: string;\r\n conceptIdList?: number[];\r\n connectionIdList?: number[];\r\n }): Promise<any> {\r\n return this._post('/api/access-control/concepts/filter-by-access', request, 'Failed to filter concepts by access');\r\n }\r\n\r\n /**\r\n * Checks access for a user on multiple concepts in bulk.\r\n * @param request - Object containing userId, access, conceptIdList.\r\n * @returns Promise<any> - API response.\r\n */\r\n static async checkAccessOfConceptBulk(request: {\r\n userId: number;\r\n access: string;\r\n conceptIdList: number[];\r\n }): Promise<any> {\r\n return this._post('/api/access-control/concepts/check-access-bulk', request, 'Failed to check access of concept bulk');\r\n }\r\n\r\n /**\r\n * Gets entities with a specific access for a concept.\r\n * @param conceptId - The concept ID.\r\n * @param access - The access type.\r\n * @returns Promise<any> - API response.\r\n */\r\n static async getEntitiesByAccess(conceptId: number, access: string): Promise<any> {\r\n const url = `/api/access-control/entities/by-access?conceptId=${conceptId}&access=${encodeURIComponent(access)}`;\r\n return this._get(url, 'Failed to get entities by access');\r\n }\r\n\r\n /**\r\n * Gets all entities with any access for a concept.\r\n * @param conceptId - The concept ID.\r\n * @returns Promise<any> - API response.\r\n */\r\n static async getEntitiesWithAccess(conceptId: number): Promise<any> {\r\n const url = `/api/access-control/entities/with-access?conceptId=${conceptId}`;\r\n return this._get(url, 'Failed to get entities with access');\r\n }\r\n\r\n /**\r\n * Gets access groups by entity.\r\n * @param entityId - Optional entity ID.\r\n * @returns Promise<any> - API response.\r\n */\r\n static async getAccessGroupByEntity(entityId?: number): Promise<any> {\r\n const url = `/api/access-control/access-group/by-entity${entityId !== undefined ? `?entityId=${entityId}` : ''}`;\r\n return this._get(url, 'Failed to get access group by entity');\r\n }\r\n\r\n /**\r\n * Gets access groups by user.\r\n * @param userId - Optional user ID.\r\n * @returns Promise<any> - API response.\r\n */\r\n static async getAccessGroupByUser(userId?: number): Promise<any> {\r\n const url = `/api/access-control/access-group/by-user${userId !== undefined ? `?userId=${userId}` : ''}`;\r\n return this._get(url, 'Failed to get access group by user');\r\n }\r\n\r\n /**\r\n * Gets public access by access IDs.\r\n * @param accessIdList - Array of access IDs.\r\n * @returns Promise<any> - API response.\r\n */\r\n static async getPublicAccessByAccessIds(accessIdList: number[]): Promise<any> {\r\n return this._post('/api/access-control/public-access/by-access-ids', accessIdList, 'Failed to get public access by access ids');\r\n }\r\n\r\n /**\r\n * Gets the full access mapping for public users.\r\n * @returns Promise<any> - API response.\r\n */\r\n static async getFullAccessMappingForPublic(): Promise<any> {\r\n return this._get('/api/access-control/concepts/by-public-access', 'Failed to get full access mapping for public');\r\n }\r\n\r\n /**\r\n * Assigns public access for all users.\r\n * @returns Promise<any> - API response.\r\n */\r\n static async assignPublicAccessForAllUser(): Promise<any> {\r\n return this._post('/api/access-control/public-access/assign-for-all-users', undefined, 'Failed to assign public access for all user');\r\n }\r\n\r\n /**\r\n * Assigns access by connection type for users.\r\n * @returns Promise<any> - API response.\r\n */\r\n static async assignAccessByConncetionTypeOfUser(): Promise<any> {\r\n return this._post('/api/access-control/access/by-connection-type', undefined, 'Failed to assign access by connection type of user');\r\n }\r\n\r\n /**\r\n * Sets access inheritance for a concept.\r\n * @param request - Object containing mainConceptId, enable, connectionTypeId.\r\n * @returns Promise<any> - API response.\r\n */\r\n static async setAccessInheritance(request: {\r\n mainConceptId: number;\r\n enable: boolean;\r\n connectionTypeId?: number;\r\n }): Promise<any> {\r\n return this._post('/api/access-control/access-inheritance', request, 'Failed to set access inheritance');\r\n }\r\n\r\n /**\r\n * Gets the status of access inheritance for a concept.\r\n * @param mainConceptId - The main concept ID.\r\n * @param connectionTypeId - The connection type ID (default: 999).\r\n * @returns Promise<any> - API response.\r\n */\r\n static async getAccessInheritanceStatus(mainConceptId: number, connectionTypeId: number = 999): Promise<any> {\r\n const url = `/api/access-control/access-inheritance/status?mainConceptId=${mainConceptId}&connectionTypeId=${connectionTypeId}`;\r\n return this._get(url, 'Failed to get access inheritance status');\r\n }\r\n\r\n // --- Private helper methods ---\r\n /**\r\n * Performs a GET request to the backend API.\r\n * @param path - The API path.\r\n * @param errorMsg - Error message to throw if request fails.\r\n * @returns Promise<any> - API response.\r\n */\r\n private static async _get(path: string, errorMsg: string): Promise<any> {\r\n const response = await fetch(`${this.baseUrl}${path}`, { method: 'GET' });\r\n if (!response.ok) throw new Error(errorMsg);\r\n return response.json();\r\n }\r\n\r\n /**\r\n * Performs a POST request to the backend API.\r\n * @param path - The API path.\r\n * @param body - Request body.\r\n * @param errorMsg - Error message to throw if request fails.\r\n * @returns Promise<any> - API response.\r\n */\r\n private static async _post(path: string, body?: any, errorMsg?: string): Promise<any> {\r\n const response = await fetch(`${this.baseUrl}${path}`, {\r\n method: 'POST',\r\n headers: { 'Content-Type': 'application/json' },\r\n ...(body !== undefined ? { body: JSON.stringify(body) } : {}),\r\n });\r\n if (!response.ok) throw new Error(errorMsg || 'Request failed');\r\n return response.json();\r\n }\r\n\r\n /**\r\n * Performs a DELETE request to the backend API.\r\n * @param path - The API path.\r\n * @param body - Optional request body.\r\n * @param errorMsg - Error message to throw if request fails.\r\n * @returns Promise<any> - API response.\r\n */\r\n private static async _delete(path: string, body?: any, errorMsg?: string): Promise<any> {\r\n const response = await fetch(`${this.baseUrl}${path}`, {\r\n method: 'DELETE',\r\n headers: body ? { 'Content-Type': 'application/json' } : undefined,\r\n ...(body ? { body: JSON.stringify(body) } : {}),\r\n });\r\n if (!response.ok) throw new Error(errorMsg || 'Request failed');\r\n return response.json();\r\n }\r\n}\r\n// function mapToPermissionSet(access: string): PermissionSet {\r\n// // Map access string to PermissionSet\r\n// switch (access.toLowerCase()) {\r\n// case 'read':\r\n// return PermissionSet.Read\r\n// case 'write':\r\n// return PermissionSet.Write\r\n// case 'execute':\r\n// return PermissionSet.Execute\r\n// case 'delete':\r\n// return PermissionSet.Delete\r\n// default:\r\n// throw new Error(`Unknown access type: ${access}`)\r\n// }\r\n// }\r\n","export enum PermissionSet {\r\n None = 0,\r\n Read = 1 << 0,\r\n Write = 1 << 1,\r\n Execute = 1 << 2,\r\n Delete = 1 << 3,\r\n}\r\n\r\nexport function getPermissionSetFromStrings(\r\n permissions: string[],\r\n): PermissionSet {\r\n let result = PermissionSet.None\r\n for (const perm of permissions) {\r\n switch (perm) {\r\n case 'read':\r\n result |= PermissionSet.Read\r\n break\r\n case 'write':\r\n result |= PermissionSet.Write\r\n break\r\n case 'execute':\r\n result |= PermissionSet.Execute\r\n break\r\n case 'delete':\r\n result |= PermissionSet.Delete\r\n break\r\n }\r\n }\r\n return result\r\n}\r\n","/**\r\n * @fileoverview Connection deletion check service for the CCS-JS system.\r\n * This module provides utilities for identifying and removing connections that are no longer\r\n * needed by comparing old and new connection sets. It's essential for maintaining cache\r\n * consistency when compositions are updated or refreshed.\r\n * @module Services/CheckForConnectionDeletion\r\n */\r\n\r\nimport { Connection } from \"../DataStructures/Connection\";\r\nimport { ConnectionData } from \"../DataStructures/ConnectionData\";\r\n\r\n/**\r\n * Identifies and removes connections that exist in the old set but not in the new set.\r\n *\r\n * This function performs a differential check between old and new connection arrays to find\r\n * connections that should be deleted. It's commonly used when updating compositions or\r\n * refreshing data from the backend, ensuring that removed connections are cleaned from\r\n * the local cache.\r\n *\r\n * The function iterates through old connections and checks if each one exists in the new\r\n * connections array by comparing IDs. If a connection is not found in the new array,\r\n * it's removed from the ConnectionData cache.\r\n *\r\n * @param newConnections - Array of current/updated connections. Defaults to empty array.\r\n * @param oldConnections - Array of previous connections to check against. Defaults to empty array.\r\n *\r\n * @example\r\n * ```typescript\r\n * // Check and remove deleted connections after composition update\r\n * import { CheckForConnectionDeletion } from './CheckForConnectionDeletion';\r\n *\r\n * const oldConnections = await getCompositionConnections(compositionId);\r\n * const newConnections = await refreshCompositionFromBackend(compositionId);\r\n *\r\n * CheckForConnectionDeletion(newConnections, oldConnections);\r\n * // Removes any connections that were deleted on the backend\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Handle composition refresh with connection cleanup\r\n * const cachedConnections = composition.connections;\r\n * const freshConnections = await fetchLatestConnections();\r\n *\r\n * CheckForConnectionDeletion(freshConnections, cachedConnections);\r\n * composition.connections = freshConnections;\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Clean up connections when switching between compositions\r\n * const currentCompositionConnections = getCurrentConnections();\r\n * const newCompositionConnections = loadNewComposition();\r\n *\r\n * CheckForConnectionDeletion(newCompositionConnections, currentCompositionConnections);\r\n * ```\r\n *\r\n * @remarks\r\n * **Comparison Logic:**\r\n * - Uses array.find() to check if each old connection exists in new connections\r\n * - Compares connections by ID (obj.id === oldConnections[i].id)\r\n * - Only removes connections that are completely absent from new array\r\n *\r\n * **Safety Check:**\r\n * - Verifies newConnections is an array before comparison\r\n * - This prevents errors if newConnections is null or undefined\r\n * - Skips deletion if newConnections is not a valid array\r\n *\r\n * **Side Effects:**\r\n * - Directly modifies ConnectionData cache by removing connections\r\n * - Permanent removal from cache (cannot be undone)\r\n * - Does not affect backend data, only local cache\r\n *\r\n * **Performance:**\r\n * - O(n*m) complexity where n = oldConnections.length, m = newConnections.length\r\n * - Uses array.find() for each old connection\r\n * - Consider using CheckForConnectionDeletionWithIds for better performance with large arrays\r\n *\r\n * **Use Cases:**\r\n * - Synchronizing local cache with backend state\r\n * - Cleaning up after composition updates\r\n * - Maintaining cache consistency during data refresh\r\n * - Removing orphaned connections\r\n *\r\n * @see {@link CheckForConnectionDeletionWithIds} for ID-based comparison (better performance)\r\n * @see {@link ConnectionData.RemoveConnection} for connection removal implementation\r\n * @see {@link Connection} for connection data structure\r\n */\r\nexport function CheckForConnectionDeletion(newConnections:Connection[] = [], oldConnections:Connection[] = []){\r\n for(let i=0; i<oldConnections.length; i++){\r\n if(Array.isArray(newConnections)){\r\n if(!newConnections.find(obj => obj.id === oldConnections[i].id)){\r\n ConnectionData.RemoveConnection(oldConnections[i]);\r\n }\r\n }\r\n\r\n }\r\n}\r\n\r\n/**\r\n * Identifies and removes connections using ID-based comparison for improved performance.\r\n *\r\n * This function is a more efficient variant of CheckForConnectionDeletion that compares\r\n * connection IDs directly instead of searching through connection objects. It uses\r\n * Array.includes() which is faster than array.find() for ID lookups, making it better\r\n * suited for large datasets.\r\n *\r\n * The function checks each old connection against an array of new connection IDs.\r\n * If an old connection's ID is not in the new ID array, it's removed from the cache.\r\n * This is particularly useful when you already have a list of IDs or when working\r\n * with large numbers of connections.\r\n *\r\n * @param newConnectionIds - Array of current connection IDs. Defaults to empty array.\r\n * @param oldConnections - Array of previous connection objects to check. Defaults to empty array.\r\n *\r\n * @example\r\n * ```typescript\r\n * // Efficient cleanup using ID array\r\n * import { CheckForConnectionDeletionWithIds } from './CheckForConnectionDeletion';\r\n *\r\n * const newConnectionIds = [123, 456, 789];\r\n * const oldConnections = cachedComposition.connections;\r\n *\r\n * CheckForConnectionDeletionWithIds(newConnectionIds, oldConnections);\r\n * // Removes connections whose IDs are not in [123, 456, 789]\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Use when fetching connections from API\r\n * const apiResponse = await getConnectionsFromBackend(compositionId);\r\n * const newIds = apiResponse.map(conn => conn.id);\r\n * const cachedConnections = getLocalConnections();\r\n *\r\n * CheckForConnectionDeletionWithIds(newIds, cachedConnections);\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Cleanup connections for a composition update\r\n * const updatedConnectionIds = composition.connections.map(c => c.id);\r\n * const previousConnections = await getPreviousConnections(composition.id);\r\n *\r\n * CheckForConnectionDeletionWithIds(updatedConnectionIds, previousConnections);\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Filter out deleted connections during sync\r\n * const syncedIds = syncData.connectionIds;\r\n * const localConnections = ConnectionData.GetAllConnections();\r\n *\r\n * CheckForConnectionDeletionWithIds(syncedIds, localConnections);\r\n * // Removes any local connections not present in sync data\r\n * ```\r\n *\r\n * @remarks\r\n * **Performance Advantages:**\r\n * - Uses Array.includes() which is O(n) instead of array.find()\r\n * - More efficient for large connection arrays\r\n * - Better memory usage as only IDs are compared\r\n * - Recommended for datasets with 100+ connections\r\n *\r\n * **Comparison Logic:**\r\n * - Checks if oldConnection.id exists in newConnectionIds array\r\n * - Simple inclusion check without object comparison\r\n * - No need to iterate through connection properties\r\n *\r\n * **No Safety Check:**\r\n * - Does not verify if newConnectionIds is an array\r\n * - Will throw if newConnectionIds is null/undefined\r\n * - Caller should ensure newConnectionIds is a valid array\r\n *\r\n * **Side Effects:**\r\n * - Removes connections from ConnectionData cache\r\n * - Permanent local cache modification\r\n * - Does not affect backend or persistent storage\r\n *\r\n * **When to Use:**\r\n * - Large numbers of connections (100+)\r\n * - When you already have ID arrays\r\n * - Performance-critical operations\r\n * - Batch processing scenarios\r\n *\r\n * **When to Use CheckForConnectionDeletion Instead:**\r\n * - Small datasets (< 100 connections)\r\n * - When you don't have IDs readily available\r\n * - When newConnections might be null/undefined\r\n * - When the array check is needed\r\n *\r\n * **Common Patterns:**\r\n * ```typescript\r\n * // Pattern 1: Extract IDs from API response\r\n * const ids = apiData.map(conn => conn.id);\r\n * CheckForConnectionDeletionWithIds(ids, oldConnections);\r\n *\r\n * // Pattern 2: Use with composition updates\r\n * const validIds = getValidConnectionIds(composition);\r\n * CheckForConnectionDeletionWithIds(validIds, currentConnections);\r\n * ```\r\n *\r\n * @see {@link CheckForConnectionDeletion} for object-based comparison with safety checks\r\n * @see {@link ConnectionData.RemoveConnection} for connection removal implementation\r\n * @see {@link Connection} for connection data structure\r\n */\r\nexport function CheckForConnectionDeletionWithIds(newConnectionIds:number[] = [], oldConnections:Connection[] = []){\r\n for(let i=0; i<oldConnections.length; i++){\r\n if(!newConnectionIds.includes(oldConnections[i].id)){\r\n ConnectionData.RemoveConnection(oldConnections[i]);\r\n }\r\n }\r\n}","/**\r\n * @module DecodeCountInfo\r\n * @description Provides functions to decode and process count information for connections\r\n */\r\n\r\nimport { GetConcept } from \"../../Api/GetConcept\";\r\nimport { Concept, Connection } from \"../../app\";\r\nimport { CountInfo } from \"../../DataStructures/Count/CountInfo\";\r\n\r\n/**\r\n * Decodes an array of count information strings into CountInfo objects.\r\n * Parses encoded count data for connection statistics.\r\n *\r\n * @param {string[]} [countStrings=[]] - Array of count strings in format \"conceptId_connectionTypeId_count\"\r\n * @returns {CountInfo[]} Array of decoded CountInfo objects\r\n *\r\n * @example\r\n * ```typescript\r\n * const countStrings = [\"123_456_42\", \"789_456_15\"];\r\n * const countInfos = DecodeCountInfo(countStrings);\r\n * // countInfos = [\r\n * // { conceptId: 123, connectionTypeId: 456, count: 42 },\r\n * // { conceptId: 789, connectionTypeId: 456, count: 15 }\r\n * // ]\r\n * ```\r\n *\r\n * @remarks\r\n * - Each string must be in format: \"conceptId_connectionTypeId_count\"\r\n * - All three parts must be numeric\r\n * - Returns empty array if no strings provided\r\n * - Throws error if string format is invalid\r\n */\r\nexport function DecodeCountInfo(countStrings: string[] = []){\r\n let countInfos: CountInfo[] = [];\r\n if(countStrings.length > 0){\r\n for(let i=0; i<countStrings?.length; i++){\r\n let countInfo = separateString(countStrings[i]);\r\n countInfos.push(countInfo);\r\n }\r\n }\r\n return countInfos;\r\n}\r\n\r\n/**\r\n * Fetches connection type concepts for count information and creates a dictionary.\r\n * Enriches CountInfo objects with connection type names and indexes them by concept ID.\r\n *\r\n * @async\r\n * @param {CountInfo[]} countInfos - Array of CountInfo objects to process\r\n * @returns {Promise<any>} A promise that resolves to a dictionary mapping concept IDs to enriched CountInfo objects\r\n *\r\n * @example\r\n * ```typescript\r\n * const countInfos: CountInfo[] = [\r\n * { conceptId: 123, connectionTypeId: 456, count: 42 },\r\n * { conceptId: 789, connectionTypeId: 456, count: 15 }\r\n * ];\r\n * const dictionary = await GetConnectionTypeForCount(countInfos);\r\n * // dictionary = {\r\n * // 123: { conceptId: 123, connectionTypeId: 456, count: 42, connectionType: \"follows\" },\r\n * // 789: { conceptId: 789, connectionTypeId: 456, count: 15, connectionType: \"follows\" }\r\n * // }\r\n * ```\r\n *\r\n * @remarks\r\n * - Fetches concept objects for each connectionTypeId\r\n * - Adds connectionType (character value) to each CountInfo\r\n * - Returns dictionary indexed by conceptId for fast lookup\r\n * - Used by formatting functions to add count information\r\n */\r\nexport async function GetConnectionTypeForCount(countInfos: CountInfo[]){\r\n let CountDictionary:any = {};\r\n for(let i =0; i<countInfos.length; i++){\r\n let concept: Concept = await GetConcept(countInfos[i].connectionTypeId);\r\n countInfos[i].connectionType = concept.characterValue;\r\n CountDictionary[countInfos[i].conceptId] = countInfos[i];\r\n }\r\n return CountDictionary;\r\n}\r\n\r\n\r\n/**\r\n * Parses a count information string into a CountInfo object.\r\n * Splits the string by underscores and extracts numeric values.\r\n *\r\n * @param {string} input - String in format \"conceptId_connectionTypeId_count\"\r\n * @returns {CountInfo} Parsed CountInfo object\r\n * @throws {Error} If the string doesn't contain exactly three underscore-separated parts\r\n *\r\n * @example\r\n * ```typescript\r\n * const countString = \"123_456_42\";\r\n * const countInfo = separateString(countString);\r\n * // countInfo = { conceptId: 123, connectionTypeId: 456, count: 42 }\r\n * ```\r\n *\r\n * @remarks\r\n * - Internal helper function for DecodeCountInfo\r\n * - Expects exactly three parts separated by underscores\r\n * - All parts must be convertible to numbers\r\n * - Throws descriptive error if format is invalid\r\n */\r\nfunction separateString(input:string) {\r\n // Split the string by the underscore\r\n const parts = input.split('_');\r\n \r\n // Check if the input has exactly three parts\r\n if (parts.length === 3) {\r\n let countInfo = new CountInfo();\r\n countInfo.conceptId = Number(parts[0]);\r\n countInfo.connectionTypeId = Number(parts[1]);\r\n countInfo.count = Number(parts[2]);\r\n return countInfo;\r\n } else {\r\n throw new Error('Input string must contain exactly three parts separated by underscores.');\r\n }\r\n}","/**\r\n * @module ErrorPosting\r\n * @description Provides error handling functions for HTTP and internal errors with structured error responses\r\n */\r\n\r\nimport { FreeSchemaResponse } from \"../../DataStructures/Responses/ErrorResponse\";\r\nimport { HttpResponse } from \"../Http/HttpClient.service\";\r\n\r\n/**\r\n * Handles HTTP errors by creating and throwing structured error responses.\r\n * Specifically handles 401 Unauthorized errors.\r\n *\r\n * @param {Response} response - The HTTP Response object to process\r\n * @throws {FreeSchemaResponse} Throws a structured error response for unauthorized requests\r\n *\r\n * @example\r\n * ```typescript\r\n * const response = await fetch(\"https://api.example.com/data\");\r\n * HandleHttpError(response);\r\n * // Throws FreeSchemaResponse if status is 401\r\n * ```\r\n *\r\n * @remarks\r\n * - Currently only handles 401 status codes\r\n * - Creates FreeSchemaResponse with status text, success=false, status code, and URL\r\n * - Other status codes are not handled (function returns normally)\r\n * - Useful for API call error handling\r\n */\r\nexport function HandleHttpError(response: Response){\r\n if(response.status >= 400){\r\n let errorResponse = new FreeSchemaResponse(response.statusText, false, response.status, \"\");\r\n errorResponse.setUrl(response.url);\r\n throw errorResponse;\r\n } \r\n}\r\n\r\n\r\nexport function HandleHttpErrorHttp(response: HttpResponse){\r\n if(response.status == 401){\r\n let errorResponse = new FreeSchemaResponse(response.body, false, response.status, \"\");\r\n errorResponse.setUrl(response.headers.url);\r\n throw errorResponse;\r\n }\r\n}\r\n/**\r\n * Handles internal application errors by creating and throwing structured error responses.\r\n * Wraps any error object into a FreeSchemaResponse.\r\n *\r\n * @param {any} error - The error object to process\r\n * @param {string} [url=\"\"] - Optional URL associated with the error\r\n * @throws {FreeSchemaResponse} Always throws a structured error response\r\n *\r\n * @example\r\n * ```typescript\r\n * try {\r\n * // Some operation\r\n * throw new Error(\"Something went wrong\");\r\n * } catch (error) {\r\n * HandleInternalError(error, \"https://api.example.com/data\");\r\n * }\r\n * ```\r\n *\r\n * @remarks\r\n * - Checks if error has a status property to use, defaults to 500\r\n * - Creates FreeSchemaResponse with error message, success=false, status, and stack trace\r\n * - Sets URL if provided\r\n * - Useful for consistent error handling throughout the application\r\n * - Always throws after creating the response (never returns)\r\n */\r\nexport function HandleInternalError(error: any, url: string = \"\"){\r\n if(error.status){\r\n let errorResponse = new FreeSchemaResponse(error.message, false, error.status, error.stack);\r\n errorResponse.setUrl(url);\r\n throw errorResponse;\r\n }\r\n else{\r\n let errorResponse = new FreeSchemaResponse(error.message, false, 500, error.stack);\r\n errorResponse.setUrl(url);\r\n throw errorResponse;\r\n }\r\n throw error;\r\n}","/**\r\n * @module RegexFunction\r\n * @description Provides string manipulation functions for concept type names\r\n */\r\n\r\n/**\r\n * Removes the \"the_\" prefix from a string if it exists.\r\n * Used for cleaning concept type names in the CCS system.\r\n *\r\n * @param {string} inputString - The string to process\r\n * @returns {string} The string with \"the_\" prefix removed, or the original string if prefix not found\r\n *\r\n * @example\r\n * ```typescript\r\n * const typeName = \"the_user\";\r\n * const cleaned = removeThePrefix(typeName);\r\n * // cleaned = \"user\"\r\n *\r\n * const noPrefix = \"post\";\r\n * const unchanged = removeThePrefix(noPrefix);\r\n * // unchanged = \"post\"\r\n * ```\r\n *\r\n * @remarks\r\n * - Only removes prefix if string starts with exactly \"the_\"\r\n * - Case-sensitive matching\r\n * - Returns original string if prefix not found\r\n * - Used throughout formatting functions to clean type names\r\n */\r\nexport function removeThePrefix(inputString:string) {\r\n if (inputString.startsWith(\"the_\")) {\r\n return inputString.slice(4); // Removes the first 4 characters\r\n }\r\n return inputString; // Return as-is if it doesn't start with \"the_\"\r\n}","\r\n/**\r\n * @module BuildComposition\r\n * @description Provides functions to recursively build composition structures from concepts and connections with caching support\r\n */\r\n\r\nimport { ConceptsData } from '../../DataStructures/ConceptData';\r\nimport { Connection } from '../../DataStructures/Connection';\r\nimport { Concept } from '../../DataStructures/Concept';\r\nimport { CreateDefaultConcept } from '../../Services/CreateDefaultConcept';\r\nimport {default as GetTheConcept} from '../../Services/GetTheConcept';\r\n\r\n/**\r\n * Recursively fetches and builds a composition structure from provided concepts and connections.\r\n * Uses passed data rather than querying externally, with backend fallback for missing data.\r\n *\r\n * @async\r\n * @param {number} id - The concept ID to start building the composition from\r\n * @param {Connection[]} connectionList - Array of all connections to use for building\r\n * @param {Concept[]} conceptList - Array of all concepts available for building\r\n * @param {compositionList} compositionList - Array of concept IDs that are compositions (not leaf values)\r\n * @param {number[]} [visitedConcepts=[]] - Array tracking visited concept IDs to prevent circular references\r\n * @returns {Promise<any>} A promise that resolves to the built composition object or character value\r\n *\r\n * @example\r\n * ```typescript\r\n * const conceptId = 123;\r\n * const connections: Connection[] = [...];\r\n * const concepts: Concept[] = [...];\r\n * const compositionIds = [123, 456];\r\n * const visited: number[] = [];\r\n * const result = await recursiveFetchNew(conceptId, connections, concepts, compositionIds, visited);\r\n * // result = { user: { name: \"John\", email: \"john@example.com\" } }\r\n * ```\r\n *\r\n * @remarks\r\n * This function:\r\n * - Works with pre-loaded concepts and connections (no external queries during recursion)\r\n * - Falls back to backend API if concept/connection not found in provided lists\r\n * - Tracks visited concepts to prevent infinite loops in circular relationships\r\n * - Distinguishes between composition nodes (objects/arrays) and leaf values (strings)\r\n * - Removes \"the_\" prefix from type names for cleaner keys\r\n * - Handles numeric types as arrays, string types as objects\r\n * - Returns empty string for concepts not in compositionList (leaf values)\r\n */\r\nexport async function recursiveFetchNew(\r\n id: number,\r\n connectionList: Connection[],\r\n conceptList: Concept[],\r\n compositionList: number[],\r\n visitedConcepts: number[] = []\r\n) {\r\n let output: any = {};\r\n const arroutput: any = []\r\n if (id == 0) {\r\n return ''\r\n }\r\n\r\n\r\n\r\n // get concept from a list of concepts\r\n let concept = getConceptFromList(conceptList, id)\r\n \r\n // if we cannot find the concept from the concept list then find it from the backend\r\n if ((concept == null || concept.id == 0) && id != null && id != undefined) {\r\n // get the concepts tries to find it from the binary tree else from the backend if cannot find it then\r\n // it will become null\r\n const conceptString = await GetTheConcept(id)\r\n concept = conceptString as Concept\r\n }\r\n if (concept.id != 0) {\r\n // if the concept type is non existent then you have to get the type from the backend\r\n if (concept.type == null) {\r\n // get the concept type id from the concept which is stored in typeId\r\n const toConceptTypeId: number = concept.typeId\r\n \r\n //\r\n let toConceptType = getConceptFromList(conceptList, toConceptTypeId)\r\n \r\n concept.type = toConceptType\r\n if (\r\n toConceptType == null &&\r\n toConceptTypeId != null &&\r\n toConceptTypeId != undefined\r\n ) {\r\n const conceptString = await GetTheConcept(toConceptTypeId)\r\n toConceptType = conceptString as Concept\r\n concept.type = toConceptType\r\n }\r\n }\r\n }\r\n \r\n //let mainString = concept?.type?.characterValue ?? ''\r\n \r\n if (!compositionList.includes(id)) {\r\n return concept?.characterValue\r\n } else {\r\n if(visitedConcepts.includes(id)){\r\n return \"\";\r\n }\r\n else{\r\n visitedConcepts.push(id);\r\n }\r\n // loop over all the connections\r\n for (let i = 0; i < connectionList.length; i++) {\r\n // if the connection has the id that has been passed in the recursion\r\n // oftheconceptId -----> toTheConceptId\r\n // this only gives the valid concept id that are inside of this id\r\n if (connectionList[i].ofTheConceptId == id) {\r\n\r\n // then take out the toTheConceptId from the connection\r\n const toConceptId = connectionList[i].toTheConceptId\r\n\r\n if(compositionList.includes(id)){\r\n // convert the toTheConceptId to a real Concept Object\r\n let toConcept = getConceptFromList(conceptList, toConceptId)\r\n \r\n // get the concept\r\n if (\r\n (toConcept == null || toConcept.id == 0) &&\r\n toConceptId != null &&\r\n toConceptId != undefined\r\n ) {\r\n const conceptString = await GetTheConcept(toConceptId)\r\n toConcept = conceptString as Concept\r\n }\r\n // if the toConcept is valid\r\n if (toConcept.id != 0) {\r\n if (toConcept?.type == null) {\r\n // get the type in casee type is not defined\r\n const toConceptTypeId: number = toConcept.typeId\r\n let toConceptType = await ConceptsData.GetConcept(toConceptTypeId)\r\n \r\n toConcept.type = toConceptType\r\n if (\r\n toConceptType == null &&\r\n toConceptTypeId != null &&\r\n toConceptTypeId != undefined\r\n ) {\r\n const conceptString = await GetTheConcept(toConceptTypeId)\r\n toConceptType = conceptString as Concept\r\n toConcept.type = toConceptType\r\n }\r\n }\r\n }\r\n\r\n // the regex to filter out the the_ from the type concepts\r\n const regex = 'the_'\r\n \r\n // then create the key of the key value pair that is the type of the concept\r\n const localmainString = toConcept?.type?.characterValue ?? ''\r\n \r\n // replace the the_ with an empty string\r\n const localKey = localmainString.replace(regex, '')\r\n // if the type is a number then put it inside of an object\r\n if (isNaN(Number(localKey))) {\r\n if (localKey) {\r\n const result = await recursiveFetchNew(\r\n toConceptId,\r\n connectionList,\r\n conceptList,\r\n compositionList,\r\n visitedConcepts\r\n )\r\n output[localKey] = result\r\n\r\n }\r\n } else {\r\n // if the type is a number then put it inside an array\r\n const result = await recursiveFetchNew(\r\n toConceptId,\r\n connectionList,\r\n conceptList,\r\n compositionList,\r\n visitedConcepts\r\n )\r\n arroutput[localKey] = result\r\n output = arroutput\r\n\r\n }\r\n }\r\n \r\n\r\n\r\n }\r\n }\r\n }\r\n return output;\r\n \r\n }\r\n/**\r\n * Retrieves a concept from a list of concepts by matching the concept ID.\r\n *\r\n * @param {Concept[]} conceptList - Array of concepts to search through\r\n * @param {number} conceptId - The ID of the concept to find\r\n * @returns {Concept} The matching concept, or a default empty concept if not found\r\n *\r\n * @example\r\n * ```typescript\r\n * const concepts: Concept[] = [\r\n * { id: 1, characterValue: \"John\" },\r\n * { id: 2, characterValue: \"Jane\" }\r\n * ];\r\n * const concept = getConceptFromList(concepts, 1);\r\n * // concept = { id: 1, characterValue: \"John\" }\r\n * ```\r\n *\r\n * @remarks\r\n * - Returns a default concept (with id: 0) if no match is found\r\n * - Uses linear search through the concept list\r\n * - First match is returned immediately\r\n */\r\nfunction getConceptFromList(conceptList: Concept[], conceptId: number) {\r\n let concept: Concept = CreateDefaultConcept()\r\n for (let i = 0; i < conceptList.length; i++) {\r\n if (conceptId == conceptList[i].id) {\r\n concept = conceptList[i]\r\n return concept\r\n }\r\n }\r\n return concept\r\n }\r\n ","/**\r\n * @module CompositionCache\r\n * @description Provides composition retrieval functions with caching support for improved performance\r\n */\r\n\r\nimport { Concept } from '../../DataStructures/Concept';\r\nimport { Connection } from '../../DataStructures/Connection';\r\nimport { ConceptsData } from '../../DataStructures/ConceptData';\r\nimport { GetAllConnectionsOfComposition } from '../../Api/GetAllConnectionsOfComposition';\r\nimport { GetConnectionBulk } from '../../Api/GetConnectionBulk';\r\nimport { GetConcept } from '../../Api/GetConcept';\r\nimport { recursiveFetchNew } from './BuildComposition'\r\nimport { recursiveFetch } from '../GetComposition';\r\nimport { Composition } from '../../DataStructures/Composition/Composition';\r\nimport { CompositionBinaryTree } from '../../DataStructures/Composition/CompositionBinaryTree';\r\nimport { BulkConceptGetterApi } from '../../Api/GetConceptBulk'\r\n\r\n/**\r\n * Retrieves a composition by ID with caching support, optionally using provided connections.\r\n * Returns a formatted composition object with all internal connections.\r\n *\r\n * @async\r\n * @param {number} id - The composition concept ID to retrieve\r\n * @param {Connection[]} [connectionListPassed=[]] - Optional pre-fetched connections for this composition\r\n * @returns {Promise<any>} A promise that resolves to the formatted composition object\r\n *\r\n * @example\r\n * ```typescript\r\n * // Retrieve composition without pre-loaded connections\r\n * const composition = await GetCompositionWithCache(123);\r\n * // composition = { user: { name: \"John\", email: \"john@example.com\" } }\r\n *\r\n * // Retrieve composition with pre-loaded connections (more efficient)\r\n * const connections: Connection[] = [...]; // Previously fetched\r\n * const composition = await GetCompositionWithCache(123, connections);\r\n * ```\r\n *\r\n * @remarks\r\n * This function:\r\n * - Checks local cache (ConceptsData) before making API calls\r\n * - Uses provided connections if available, otherwise fetches them\r\n * - Builds list of composition IDs and concept IDs from connections\r\n * - Recursively builds the composition structure\r\n * - Returns empty string if concept ID is 0\r\n * - Uses concept type as the root key in returned object\r\n */\r\nexport async function GetCompositionWithCache(\r\n id: number,\r\n connectionListPassed: Connection[] = [],\r\n) {\r\n let connectionList: Connection[] = []\r\n const conceptIdList: number[] = []\r\n let returnOutput: any = {}\r\n let output: any = {}\r\n const compositionList: number[] = []\r\n let concept = await ConceptsData.GetConcept(id)\r\n if (concept.id == 0 && id != null && id != undefined) {\r\n const conceptString = await GetConcept(id)\r\n concept = conceptString as Concept\r\n }\r\n let connectionListString: any = []\r\n if (connectionListPassed.length > 0) {\r\n connectionListString = getMyConnections(id, connectionListPassed)\r\n } else {\r\n connectionListString = await GetAllConnectionsOfComposition(id)\r\n }\r\n connectionList = connectionListString as Connection[]\r\n //connectionList = ConnectionData.GetConnectionsOfComposition(id);\r\n\r\n for (let i = 0; i < connectionList.length; i++) {\r\n if (!compositionList.includes(connectionList[i].ofTheConceptId)) {\r\n compositionList.push(connectionList[i].ofTheConceptId)\r\n conceptIdList.push(connectionList[i].ofTheConceptId)\r\n }\r\n if (!conceptIdList.includes(connectionList[i].toTheConceptId)) {\r\n conceptIdList.push(connectionList[i].toTheConceptId)\r\n }\r\n }\r\n\r\n let visitedConcepts: number [] = []\r\n output = await recursiveFetch(id, connectionList, compositionList, visitedConcepts)\r\n const mainString = concept?.type?.characterValue ?? ''\r\n returnOutput[mainString] = output\r\n\r\n if (concept.id == 0) {\r\n return ''\r\n }\r\n\r\n return returnOutput\r\n }\r\n/**\r\n * Filters a list of connections to find all connections belonging to a specific composition.\r\n *\r\n * @param {number} id - The composition ID (used as typeId in connections)\r\n * @param {Connection[]} connectionList - Array of connections to filter\r\n * @returns {Connection[]} Array of connections that belong to the specified composition\r\n *\r\n * @example\r\n * ```typescript\r\n * const allConnections: Connection[] = [\r\n * { id: 1, typeId: 123, ... },\r\n * { id: 2, typeId: 456, ... },\r\n * { id: 3, typeId: 123, ... }\r\n * ];\r\n * const compositionConnections = getMyConnections(123, allConnections);\r\n * // Returns connections with id 1 and 3\r\n * ```\r\n *\r\n * @remarks\r\n * - Filters connections where typeId matches the provided composition ID\r\n * - Used for bulk connection fetching optimization\r\n * - Returns empty array if no matching connections found\r\n */\r\nfunction getMyConnections(id: number, connectionList: Connection[]) {\r\n const connections: Connection[] = []\r\n for (let i = 0; i < connectionList.length; i++) {\r\n if (connectionList[i].typeId == id) {\r\n connections.push(connectionList[i])\r\n }\r\n }\r\n return connections\r\n }\r\n/**\r\n * Retrieves a composition by ID in DATA-ID format with caching support.\r\n * Returns composition with id, data, and created_at fields.\r\n *\r\n * @async\r\n * @param {number} id - The composition concept ID to retrieve\r\n * @param {Connection[]} [connectionListPassed=[]] - Optional pre-fetched connections for this composition\r\n * @returns {Promise<any>} A promise that resolves to composition object with id, data, and created_at properties\r\n *\r\n * @example\r\n * ```typescript\r\n * const composition = await GetCompositionWithDataIdWithCache(123);\r\n * // composition = {\r\n * // id: 123,\r\n * // data: { user: { name: \"John\", email: \"john@example.com\" } },\r\n * // created_at: \"2023-10-30T12:00:00Z\"\r\n * // }\r\n * ```\r\n *\r\n * @remarks\r\n * Format: DATA-ID - Includes explicit ID and timestamp information\r\n * This function:\r\n * - Similar to GetCompositionWithCache but includes ID metadata\r\n * - Returns object with id, data (composition tree), and created_at\r\n * - Uses caching for improved performance\r\n * - Returns empty string if concept ID is 0\r\n */\r\nexport async function GetCompositionWithDataIdWithCache(\r\n id: number,\r\n connectionListPassed: Connection[] = [],\r\n) {\r\n let FinalReturn: any = {}\r\n let connectionList: Connection[] = []\r\n const conceptIdList: number[] = []\r\n let output: any\r\n const returnOutput: any = {}\r\n\r\n const compositionList: number[] = []\r\n let concept = await ConceptsData.GetConcept(id)\r\n if (concept.id == 0 && id != null && id != undefined) {\r\n const conceptString = await GetConcept(id)\r\n concept = conceptString as Concept\r\n }\r\n\r\n let connectionListString: any = []\r\n if (connectionListPassed.length > 0) {\r\n connectionListString = getMyConnections(id, connectionListPassed)\r\n } else {\r\n connectionListString = await GetAllConnectionsOfComposition(id)\r\n }\r\n connectionList = connectionListString as Connection[]\r\n //connectionList = ConnectionData.GetConnectionsOfComposition(id);\r\n\r\n for (let i = 0; i < connectionList.length; i++) {\r\n if (!compositionList.includes(connectionList[i].ofTheConceptId)) {\r\n compositionList.push(connectionList[i].ofTheConceptId)\r\n conceptIdList.push(connectionList[i].ofTheConceptId)\r\n }\r\n if (!conceptIdList.includes(connectionList[i].toTheConceptId)) {\r\n conceptIdList.push(connectionList[i].toTheConceptId)\r\n }\r\n }\r\n\r\n output = await recursiveFetch(id, connectionList, compositionList)\r\n const mainString = concept?.type?.characterValue ?? ''\r\n returnOutput[mainString] = output\r\n FinalReturn[\"created_at\"] = concept.entryTimeStamp\r\n FinalReturn['data'] = returnOutput\r\n FinalReturn['id'] = id\r\n if (concept.id == 0) {\r\n return ''\r\n }\r\n return FinalReturn\r\n }\r\n/**\r\n * Retrieves multiple compositions in bulk using DATA-ID format.\r\n * Efficiently fetches multiple compositions with their internal connections in one operation.\r\n *\r\n * @async\r\n * @param {number[]} ids - Array of composition concept IDs to retrieve\r\n * @param {number[]} connections - Array of connection IDs for all compositions\r\n * @returns {Promise<any[]>} A promise that resolves to array of composition objects with DATA-ID format\r\n *\r\n * @example\r\n * ```typescript\r\n * const compositionIds = [123, 456, 789];\r\n * const connectionIds = [1, 2, 3, 4, 5];\r\n * const compositions = await GetCompositionWithDataIdBulk(compositionIds, connectionIds);\r\n * // compositions = [\r\n * // { id: 123, data: {...}, created_at: timestamp },\r\n * // { id: 456, data: {...}, created_at: timestamp },\r\n * // { id: 789, data: {...}, created_at: timestamp }\r\n * // ]\r\n * ```\r\n *\r\n * @remarks\r\n * This function:\r\n * - Optimized for bulk operations to reduce API calls\r\n * - Fetches all connections once, then filters per composition\r\n * - Each result includes id, data object, and created_at timestamp\r\n * - Filters out null/undefined compositions from results\r\n * - More efficient than calling GetCompositionWithDataIdWithCache individually\r\n */\r\nexport async function GetCompositionWithDataIdBulk(\r\n ids: number[],\r\n connections: number[],\r\n) {\r\n let connectionList: Connection[] = []\r\n const compositions: any[] = []\r\n const newConnections = await GetConnectionBulk(connections)\r\n connectionList = newConnections as Connection[]\r\n for (let i = 0; i < ids.length; i++) {\r\n const output = await GetCompositionWithDataIdWithCache(ids[i], connectionList)\r\n if (output) {\r\n compositions.push(output)\r\n }\r\n }\r\n return compositions\r\n }\r\n/**\r\n * Saves a composition to the cache (CompositionBinaryTree) for fast retrieval.\r\n * Builds and caches the complete composition structure.\r\n *\r\n * @async\r\n * @param {Concept} concept - The main concept of the composition\r\n * @param {Connection[]} connections - Array of all connections in the composition\r\n * @param {number[]} conceptIdList - Array of all concept IDs involved\r\n * @param {number[]} numbers - Array of subcomposition IDs\r\n *\r\n * @example\r\n * ```typescript\r\n * const mainConcept: Concept = { id: 123, ... };\r\n * const connections: Connection[] = [...];\r\n * const conceptIds = [1, 2, 3, 123];\r\n * const subcompositions = [456, 789];\r\n * await SaveToCompositionCache(mainConcept, connections, conceptIds, subcompositions);\r\n * ```\r\n *\r\n * @remarks\r\n * This function:\r\n * - Fetches all concepts from cache or API in bulk\r\n * - Builds the composition tree using recursiveFetchNew\r\n * - Creates a Composition object with all metadata\r\n * - Stores the composition in CompositionBinaryTree for caching\r\n * - Used internally by composition retrieval functions\r\n * - No return value (void function)\r\n */\r\nasync function SaveToCompositionCache(\r\n concept: Concept,\r\n connections: Connection[],\r\n conceptIdList: number[],\r\n numbers: number[],\r\n) {\r\n const composition = new Composition()\r\n const concepts = await BulkConceptGetter(conceptIdList)\r\n composition.connections = connections\r\n composition.concepts = concepts\r\n composition.id = concept.id\r\n composition.subcompositions = numbers\r\n composition.mainConcept = concept\r\n let visitedConcepts: number[] = [];\r\n const output = await recursiveFetchNew(\r\n concept.id,\r\n connections,\r\n concepts,\r\n numbers,\r\n visitedConcepts\r\n )\r\n composition.cached = output\r\n CompositionBinaryTree.addCompositionToTree(composition)\r\n }\r\n/**\r\n * Retrieves multiple concepts efficiently using cache-first approach with bulk API fallback.\r\n *\r\n * @async\r\n * @param {number[]} conceptIds - Array of concept IDs to retrieve\r\n * @returns {Promise<Concept[]>} A promise that resolves to array of Concept objects\r\n *\r\n * @example\r\n * ```typescript\r\n * const conceptIds = [1, 2, 3, 4, 5];\r\n * const concepts = await BulkConceptGetter(conceptIds);\r\n * // concepts = [Concept1, Concept2, Concept3, Concept4, Concept5]\r\n * ```\r\n *\r\n * @remarks\r\n * This function:\r\n * - First checks local cache (ConceptsData) for each concept\r\n * - Collects IDs of concepts not in cache\r\n * - Fetches missing concepts in bulk from API (single call)\r\n * - Returns combined list of cached and fetched concepts\r\n * - Optimized to minimize API calls\r\n * - Returns empty array if no valid concept IDs provided\r\n */\r\nasync function BulkConceptGetter(conceptIds: number[]) {\r\n let conceptList: Concept[] = []\r\n \r\n const bulkConceptFetch: number[] = []\r\n for (let i = 0; i < conceptIds?.length; i++) {\r\n const conceptUse: Concept = await ConceptsData.GetConcept(conceptIds[i])\r\n if (conceptUse.id == 0) {\r\n bulkConceptFetch.push(conceptIds[i])\r\n } else {\r\n conceptList.push(conceptUse)\r\n }\r\n }\r\n \r\n if (bulkConceptFetch?.length == 0) {\r\n return conceptList\r\n } else {\r\n conceptList = await BulkConceptGetterApi(bulkConceptFetch)\r\n }\r\n return conceptList\r\n }\r\n ","/**\r\n * @module CreateCompositionCache\r\n * @description Provides functionality to create compositions from JSON objects with caching support\r\n */\r\n\r\nimport { Concept } from '../../DataStructures/Concept';\r\nimport { Connection } from '../../DataStructures/Connection';\r\nimport { CreateDefaultConcept } from '../CreateDefaultConcept';\r\nimport { Composition } from '../../DataStructures/Composition/Composition';\r\nimport MakeTheInstanceConcept from '../MakeTheInstanceConcept';\r\nimport { createTheConnection } from '../../Services/CreateTheConnection';\r\n\r\n/**\r\n * Creates a composition from a JSON object with caching mechanism.\r\n * Recursively processes nested objects/arrays to create concepts and connections.\r\n *\r\n * @async\r\n * @param {any} json - The JSON object to convert into a composition\r\n * @param {number | null} [ofTheConceptId=null] - Parent concept ID (null for root)\r\n * @param {number | null} [ofTheConceptUserId=null] - Parent concept's user ID\r\n * @param {number | null} [mainKey=null] - Main composition ID (root concept ID)\r\n * @param {number | null} [userId=null] - User ID creating the composition (defaults to 999)\r\n * @param {number | null} [accessId=null] - Access level ID (defaults to 4)\r\n * @param {number | null} [sessionInformationId=null] - Session ID (defaults to 999)\r\n * @param {Composition | null} [composition=null] - Existing Composition object to populate\r\n * @returns {Promise<Concept>} A promise that resolves to the main (root) Concept of the composition\r\n *\r\n * @example\r\n * ```typescript\r\n * const jsonData = {\r\n * user: {\r\n * name: \"John\",\r\n * email: \"john@example.com\",\r\n * age: 30\r\n * }\r\n * };\r\n * const mainConcept = await CreateTheCompositionWithCache(jsonData, null, null, null, 1, 4, 1);\r\n * // Creates concepts for user, name, email, age with proper connections\r\n * ```\r\n *\r\n * @remarks\r\n * This function:\r\n * - Recursively processes nested JSON structures\r\n * - Creates concepts for each key-value pair\r\n * - Establishes connections between parent and child concepts\r\n * - Distinguishes between composition nodes (objects/arrays) and leaf values (primitives)\r\n * - Populates the Composition object with all concepts and connections\r\n * - Uses caching for improved performance\r\n * - First call (no parent) creates the root concept\r\n * - Subsequent recursive calls create child concepts linked to parents\r\n */\r\nexport async function CreateTheCompositionWithCache(\r\n json: any,\r\n ofTheConceptId: number | null = null,\r\n ofTheConceptUserId: number | null = null,\r\n mainKey: number | null = null,\r\n userId: number | null = null,\r\n accessId: number | null = null,\r\n sessionInformationId: number | null = null,\r\n composition: Composition | null = null,\r\n) {\r\n const localUserId: number = userId ?? 999\r\n const localAccessId: number = accessId ?? 4\r\n const localSessionId: number = sessionInformationId ?? 999\r\n let MainKeyLocal: number = mainKey ?? 0\r\n let MainConcept = CreateDefaultConcept()\r\n if (composition == null) {\r\n // if no composition is passed then create a new composition\r\n composition = new Composition()\r\n }\r\n for (const key in json) {\r\n if( typeof json[key] == 'object' || Array.isArray(json[key])){\r\n const conceptString = await MakeTheInstanceConcept(\r\n key,\r\n '',\r\n true,\r\n localUserId,\r\n localAccessId,\r\n localSessionId,\r\n )\r\n const concept = conceptString as Concept\r\n // if (typeof json[key] != 'string' && typeof json[key] != 'number') {\r\n if (ofTheConceptId == null && ofTheConceptUserId == null) {\r\n // if there is no parent conceptId and conceptUserId passed then we know this is the main concept\r\n // everything is related to this concept.\r\n let localMainKey = MainKeyLocal\r\n MainConcept = concept\r\n localMainKey = concept.id\r\n MainKeyLocal = concept.id\r\n composition.concepts.push(concept)\r\n composition.id = concept.id\r\n await CreateTheCompositionWithCache(\r\n json[key],\r\n concept.id,\r\n concept.userId,\r\n localMainKey,\r\n userId,\r\n accessId,\r\n sessionInformationId,\r\n composition,\r\n )\r\n\r\n } else {\r\n // this is the concept which has parent passed onto it and this is a subcomposition\r\n const ofThe: number = ofTheConceptId ?? 999\r\n const ofTheUser: number = ofTheConceptUserId ?? 999\r\n const localMainKey = MainKeyLocal\r\n\r\n MainConcept = concept;\r\n composition.concepts.push(concept)\r\n const connectionString = await createTheConnection(\r\n ofThe,\r\n ofTheUser,\r\n concept.id,\r\n concept.userId,\r\n localMainKey,\r\n localSessionId,\r\n concept.userId,\r\n )\r\n const connection = connectionString as Connection\r\n composition.connections.push(connection)\r\n await CreateTheCompositionWithCache(\r\n json[key],\r\n concept.id,\r\n concept.userId,\r\n localMainKey,\r\n userId,\r\n accessId,\r\n sessionInformationId,\r\n composition,\r\n )\r\n }\r\n if(json[key] != null && json[key] != undefined){\r\n composition.subcompositions.push(concept.id)\r\n }\r\n } else {\r\n // this is the part where the concept is now a key value pair and has the actual data\r\n const ofThe: number = ofTheConceptId ?? 999\r\n const ofTheUser: number = ofTheConceptUserId ?? 999\r\n const localMainKey = MainKeyLocal\r\n const conceptString = await MakeTheInstanceConcept(\r\n key,\r\n json[key],\r\n false,\r\n localUserId,\r\n localAccessId,\r\n localSessionId,\r\n )\r\n const concept = conceptString as Concept\r\n composition.concepts.push(concept)\r\n const connectionString = await createTheConnection(\r\n ofThe,\r\n ofTheUser,\r\n concept.id,\r\n concept.userId,\r\n localMainKey,\r\n localSessionId,\r\n concept.userId,\r\n )\r\n const connection = connectionString as Connection\r\n composition.connections.push(connection)\r\n\r\n }\r\n }\r\n // return the main concept\r\n return MainConcept\r\n}\r\n","import { GetConceptByCharacterValue } from \"../../Api/GetConceptByCharacterValue\";\r\nimport { GetConceptByCharacterAndCategoryDirectApi } from \"../../Api/SearchConcept/GetConceptByCharacterAndCategoryDirect\";\r\nimport { Concept, ConceptsData, CreateDefaultConcept, SplitStrings } from \"../../app\";\r\n\r\nexport async function GetConceptByCharacterAndCategory(character: string){\r\n let concept: Concept = CreateDefaultConcept();\r\n if(character == \"the\"){\r\n concept.id = 1;\r\n concept.typeId = 5;\r\n concept.characterValue =\"the\";\r\n return concept;\r\n }\r\n let characterLength = character.length;\r\n var splittedStringArray = SplitStrings(character);\r\n if(splittedStringArray.length > 1){\r\n let category = 1;\r\n let prefix = await GetConceptByCharacterAndCategory(splittedStringArray[0])\r\n if(prefix.id != 0){\r\n category = prefix.id;\r\n }\r\n concept = await GetConceptByCharacterAndCategoryFromMemory(character,category);\r\n }\r\n else if(splittedStringArray[0] == character && characterLength == 1){\r\n concept = await GetConceptByCharacterSingle(character);\r\n\r\n }\r\n else if(splittedStringArray[0] == character){\r\n concept = await GetConceptByCharacter(character);\r\n\r\n }\r\n return concept;\r\n}\r\n\r\nexport async function GetConceptByCharacter(characterValue: string){\r\n var concept = await ConceptsData.GetConceptByCharacterAndTypeLocal(characterValue,51);\r\n if(concept.id == 0){\r\n concept = await GetConceptByCharacterValue(characterValue);\r\n }\r\n return concept;\r\n}\r\n\r\nexport async function GetConceptByCharacterSingle(characterValue: string){\r\n console.log(\"inside the character length function\", characterValue);\r\n var concept = await ConceptsData.GetConceptByCharacterAndTypeLocal(characterValue,49);\r\n console.log(\"inside the character length function after\", concept);\r\n if(concept.id == 0){\r\n concept = await GetConceptByCharacterValue(characterValue);\r\n }\r\n return concept;\r\n}\r\n\r\nexport async function GetConceptByCharacterAndCategoryFromMemory(character: string, category: number){\r\n let concept = await ConceptsData.GetConceptByCharacterAndCategoryLocal(character, category);\r\n if(concept.id == 0){\r\n concept = await GetConceptByCharacterAndCategoryDirectApi(character,category);\r\n }\r\n return concept;\r\n}","/**\r\n * @module ConvertConcepts\r\n * @description Provides conversion functions between Concept/Connection and LConcept/LConnection (local versions)\r\n */\r\n\r\nimport { Concept } from \"../../DataStructures/Concept\";\r\nimport { Connection } from \"../../DataStructures/Connection\";\r\nimport { LConcept } from \"../../DataStructures/Local/LConcept\";\r\nimport { LConnection } from \"../../DataStructures/Local/LConnection\";\r\nimport { CreateDefaultConcept } from \"../CreateDefaultConcept\";\r\nimport { CreateDefaultLConcept } from \"../Local/CreateDefaultLConcept\"\r\n\r\n/**\r\n * Converts a standard Concept to a Local Concept (LConcept).\r\n * LConcepts include additional properties for local/optimistic operations.\r\n *\r\n * @param {Concept} concept - The standard Concept to convert\r\n * @returns {LConcept} The converted LConcept with all properties mapped\r\n *\r\n * @example\r\n * ```typescript\r\n * const concept: Concept = {\r\n * id: 123,\r\n * characterValue: \"John\",\r\n * typeId: 456,\r\n * ...\r\n * };\r\n * const lConcept = convertFromConceptToLConcept(concept);\r\n * // lConcept includes all concept properties plus isTemp, typeCharacter\r\n * ```\r\n *\r\n * @remarks\r\n * - Maps all standard Concept properties to LConcept\r\n * - Sets isTemp to false (not a temporary concept)\r\n * - Includes typeCharacter from concept.type.characterValue\r\n * - Used when loading concepts from backend into local cache\r\n * - LConcepts are used for optimistic UI updates\r\n */\r\nexport function convertFromConceptToLConcept(concept: Concept) {\r\n const LConcept: LConcept = CreateDefaultLConcept()\r\n LConcept.id = concept.id\r\n LConcept.ghostId = concept.ghostId\r\n LConcept.userId = concept.userId\r\n LConcept.accessId = concept.accessId\r\n LConcept.categoryId = concept.categoryId\r\n LConcept.characterValue = concept.characterValue\r\n LConcept.entryTimeStamp = concept.entryTimeStamp\r\n LConcept.typeId = concept.typeId\r\n LConcept.type = concept.type\r\n LConcept.isTemp = false\r\n LConcept.typeCharacter = concept?.type?.characterValue ?? \"\";\r\n return LConcept\r\n }\r\n\r\n\r\n/**\r\n * Converts a Local Concept (LConcept) back to a standard Concept.\r\n * Used when persisting local concepts to the backend.\r\n *\r\n * @param {LConcept} lconcept - The LConcept to convert\r\n * @returns {Concept} The converted standard Concept\r\n *\r\n * @example\r\n * ```typescript\r\n * const lConcept: LConcept = {\r\n * id: 123,\r\n * ghostId: 456,\r\n * characterValue: \"John\",\r\n * isTemp: true,\r\n * ...\r\n * };\r\n * const concept = convertFromLConceptToConcept(lConcept);\r\n * // concept is now a standard Concept without local-specific properties\r\n * ```\r\n *\r\n * @remarks\r\n * - Maps LConcept properties back to standard Concept\r\n * - Drops local-specific properties (isTemp, typeCharacter)\r\n * - Used when saving concepts to backend\r\n * - Reverse operation of convertFromConceptToLConcept\r\n */\r\nexport function convertFromLConceptToConcept(lconcept: LConcept){\r\n const concept: Concept = CreateDefaultConcept();\r\n concept. id = lconcept.id\r\n concept.ghostId = lconcept.ghostId;\r\n concept.userId = lconcept.userId;\r\n concept.accessId = lconcept.accessId;\r\n concept.entryTimeStamp = lconcept.entryTimeStamp;\r\n concept.typeId = lconcept.typeId\r\n concept.categoryId = lconcept.categoryId\r\n concept.characterValue = lconcept.characterValue\r\n return concept;\r\n }\r\n \r\n/**\r\n * Converts a standard Connection to a Local Connection (LConnection).\r\n * LConnections include additional properties for local/optimistic operations.\r\n *\r\n * @param {Connection} connection - The standard Connection to convert\r\n * @returns {LConnection} The converted LConnection with all properties mapped\r\n *\r\n * @example\r\n * ```typescript\r\n * const connection: Connection = {\r\n * id: 789,\r\n * ofTheConceptId: 123,\r\n * toTheConceptId: 456,\r\n * typeId: 999,\r\n * ...\r\n * };\r\n * const lConnection = convertFromConnectionToLConnection(connection);\r\n * // lConnection includes all connection properties plus isTemp flag\r\n * ```\r\n *\r\n * @remarks\r\n * - Maps all standard Connection properties to LConnection\r\n * - Sets isTemp to false (not a temporary connection)\r\n * - Used when loading connections from backend into local cache\r\n * - LConnections are used for optimistic UI updates\r\n * - Enables local connection management before backend persistence\r\n */\r\nexport function convertFromConnectionToLConnection(connection: Connection) {\r\n const Lconnection: LConnection = new LConnection(0, 0, 0, 0, 0, 0)\r\n Lconnection.id = connection.id\r\n Lconnection.ghostId = connection.ghostId\r\n Lconnection.accessId = connection.accessId\r\n Lconnection.ofTheConceptId = connection.ofTheConceptId\r\n Lconnection.toTheConceptId = connection.toTheConceptId\r\n Lconnection.entryTimeStamp = connection.entryTimeStamp\r\n Lconnection.typeId = connection.typeId\r\n Lconnection.isTemp = false\r\n return Lconnection\r\n }\r\n ","/**\r\n * Binary Tree Data Loading Service\r\n *\r\n * This module provides functionality for creating and populating binary tree data structures\r\n * from persisted concept data stored in IndexedDB. It loads concept records and adds them\r\n * to in-memory data structures for efficient access and querying.\r\n *\r\n * @module CreateBinaryTreeFromData\r\n */\r\n\r\nimport { BinaryCharacterTree } from \"../DataStructures/BinaryCharacterTree\";\r\nimport { BinaryTree } from \"../DataStructures/BinaryTree\";\r\nimport { Node } from \"../DataStructures/Node\";\r\nimport { getFromDatabaseWithTypeOld } from \"../Database/NoIndexDb\";\r\nimport { ConceptsData } from \"../DataStructures/ConceptData\";\r\n\r\n/**\r\n * Creates and populates a binary tree structure from concept data stored in the database.\r\n *\r\n * This function loads all concept records from IndexedDB and adds them to the in-memory\r\n * ConceptsData structure for fast retrieval and manipulation. It measures the time taken\r\n * to load all concepts for performance monitoring purposes.\r\n *\r\n * The function retrieves all records of type \"concept\" from the database and iterates through\r\n * them, adding each concept to the ConceptsData memory structure. Note that the actual binary\r\n * tree node creation is currently commented out, with only memory storage being active.\r\n *\r\n * @returns A promise that resolves when all concepts have been loaded into memory\r\n *\r\n * @example\r\n * ```typescript\r\n * // Initialize the binary tree with database data\r\n * await CreateBinaryTreeFromData();\r\n * console.log('Binary tree populated from database');\r\n * ```\r\n *\r\n * @remarks\r\n * - Performance is tracked using start and end timestamps\r\n * - The actual BinaryTree node creation (lines 14-15) is commented out in current implementation\r\n * - Only adds concepts to ConceptsData memory structure, not to the BinaryTree itself\r\n * - Time measurement variables (startTime, endTime, time) are calculated but not returned or logged\r\n *\r\n * @see {@link ConceptsData.AddConceptToMemory} for how concepts are stored in memory\r\n * @see {@link getFromDatabaseWithTypeOld} for database retrieval implementation\r\n */\r\nexport default async function CreateBinaryTreeFromData(){\r\n var startTime = new Date().getTime();\r\n var conceptList = await getFromDatabaseWithTypeOld(\"concept\");\r\n if(Array.isArray(conceptList)){\r\n for(var i=0 ;i < conceptList.length ;i++){\r\n let concept = conceptList[i];\r\n ConceptsData.AddConceptToMemory(concept);\r\n // let node = new Node(concept.id, concept, null, null);\r\n // BinaryTree.addNodeToTree(node);\r\n }\r\n\r\n }\r\n var endTime = new Date().getTime();\r\n var time = endTime - startTime;\r\n\r\n}\r\n","/**\r\n * Typed Connection Creation Between Concepts\r\n *\r\n * This module provides specialized functions for creating semantic, bidirectional, and\r\n * counted connections between concepts. It implements a sophisticated connection naming\r\n * scheme that incorporates concept types and relationship semantics, enabling queries\r\n * like \"show all books_s_authored_s_by author\" in the system.\r\n *\r\n * The module supports:\r\n * - Forward and backward (bidirectional) connections\r\n * - Automatic relationship counting\r\n * - Type-aware connection naming patterns\r\n *\r\n * @module CreateConnectionBetweenTwoConcepts\r\n */\r\n\r\nimport { GetAllConnectionsOfCompositionBulk } from \"../Api/GetAllConnectionsOfCompositionBulk\";\r\nimport { GetConnectionOfTheConcept } from \"../Api/GetConnectionOfTheConcept\";\r\nimport { Concept } from \"../DataStructures/Concept\";\r\nimport { ConceptsData } from \"../DataStructures/ConceptData\";\r\nimport { Connection } from \"../DataStructures/Connection\";\r\nimport { SyncData } from \"../DataStructures/SyncData\";\r\nimport { CreateDefaultConcept } from \"./CreateDefaultConcept\";\r\nimport { CreateTheConnectionGeneral } from \"./CreateTheConnectionGeneral\";\r\nimport { DeleteConnectionById } from \"./DeleteConnection\";\r\nimport GetTheConcept from \"./GetTheConcept\";\r\nimport MakeTheInstanceConcept from \"./MakeTheInstanceConcept\";\r\n\r\n/**\r\n * Creates a typed connection between two concepts with optional bidirectionality and counting.\r\n *\r\n * This function establishes semantic connections using a naming pattern that includes the\r\n * concept types. For example, connecting a \"book\" to an \"author\" with linker \"authored\"\r\n * creates a connection of type \"books_s_authored_s\". This enables type-aware querying and\r\n * relationship navigation in the system.\r\n *\r\n * The function can optionally create bidirectional connections (both directions) and\r\n * maintain relationship counts, which is useful for analytics and relationship tracking.\r\n *\r\n * @param ofTheConcept - The source concept from which the connection originates\r\n * @param toTheConcept - The target concept to which the connection points\r\n * @param linker - The semantic relationship name (e.g., \"authored\", \"contains\", \"belongs_to\")\r\n * @param both - If true, creates connections in both directions (default: false)\r\n * @param count - If true, maintains a count of relationships for this linker type (default: false)\r\n *\r\n * @returns A promise that resolves to the created forward Connection object\r\n *\r\n * @example\r\n * ```typescript\r\n * // Create a one-way \"authored\" connection\r\n * const authorConcept = await GetTheConcept(123); // type: \"author\"\r\n * const bookConcept = await GetTheConcept(456); // type: \"book\"\r\n *\r\n * const connection = await CreateConnectionBetweenTwoConcepts(\r\n * authorConcept,\r\n * bookConcept,\r\n * \"authored\",\r\n * false,\r\n * false\r\n * );\r\n * // Creates connection type: \"authors_s_authored_s\"\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Create bidirectional \"friends_with\" connections with counting\r\n * const userConcept1 = await GetTheConcept(789);\r\n * const userConcept2 = await GetTheConcept(101);\r\n *\r\n * await CreateConnectionBetweenTwoConcepts(\r\n * userConcept1,\r\n * userConcept2,\r\n * \"friends_with\",\r\n * true, // Create both directions\r\n * true // Enable counting\r\n * );\r\n * // Creates: \"users_s_friends_with_s\" and \"users_s_friends_with_by\"\r\n * // Maintains count concepts for relationship tracking\r\n * ```\r\n *\r\n * @remarks\r\n * - Forward connection type pattern: `{sourceType}_s_{linker}_s`\r\n * - Backward connection type pattern: `{targetType}_s_{linker}_by`\r\n * - Count concept pattern: `{type}_s_{linker}_count`\r\n * - Uses session information ID 999 and access level 4 as defaults\r\n * - Counting creates/updates a separate count concept for relationship analytics\r\n * - The backward connection is created first if both=true\r\n *\r\n * @see {@link CreateConnectionBetweenTwoConceptsGeneral} for the version using reserved IDs\r\n * @see {@link CountRelationship} for understanding how relationship counting works\r\n * @see {@link MakeTheInstanceConcept} for connection type concept creation\r\n */\r\nexport async function CreateConnectionBetweenTwoConcepts(ofTheConcept: Concept, toTheConcept: Concept, linker:string, both:boolean = false, count:boolean = false){\r\n\r\n var userId:number = ofTheConcept.userId;\r\n var orderUserId: number = userId;\r\n var securityId: number = 999;\r\n var securityUserId: number = userId;\r\n var accessId: number = 4;\r\n var accessUserId: number = userId;\r\n var sessionInformationId = 999;\r\n var sessionInformationUserId = 999;\r\n if(both){\r\n let prefix1: string = toTheConcept.type?.characterValue + \"_s\";\r\n let linkerAdd1 = linker + \"_by\";\r\n let backwardLinker = prefix1 + \"_\" + linkerAdd1; \r\n if(count){\r\n await CountRelationship(linkerAdd1, toTheConcept, userId);\r\n }\r\n var connectionConceptReverse = await MakeTheInstanceConcept(\"connection\",backwardLinker,false,999,999,999);\r\n let newConnection = new Connection(0,toTheConcept.id, ofTheConcept.id,toTheConcept.userId, ofTheConcept.userId, toTheConcept.userId,\r\n connectionConceptReverse.id, connectionConceptReverse.userId, 1000, userId, securityId, securityUserId, accessId, accessUserId,sessionInformationId,sessionInformationUserId );\r\n SyncData.AddConnection(newConnection);\r\n }\r\n let prefix: string = ofTheConcept.type?.characterValue + \"_s\";\r\n let linkerAdd = linker + \"_s\";\r\n let forwardLinker = prefix + \"_\" + linkerAdd;\r\n if(count){\r\n await CountRelationship(linkerAdd, ofTheConcept, userId);\r\n }\r\n var connectionConcept = await MakeTheInstanceConcept(\"connection\",forwardLinker,false,999,999,999);\r\n let newConnection = new Connection(0,ofTheConcept.id, toTheConcept.id,ofTheConcept.userId, toTheConcept.userId, ofTheConcept.userId,\r\n connectionConcept.id, connectionConcept.userId, 1000, userId, securityId, securityUserId, accessId, accessUserId,sessionInformationId,sessionInformationUserId );\r\n SyncData.AddConnection(newConnection);\r\n return newConnection;\r\n }\r\n\r\n/**\r\n * Maintains a count of relationships for a specific connection type on a concept.\r\n *\r\n * This function implements a counting mechanism that tracks how many times a particular\r\n * relationship type has been used with a concept. It retrieves any existing count,\r\n * increments it, creates a new count concept, and connects it to the source concept.\r\n *\r\n * The counting system works by:\r\n * 1. Looking for existing count connections using a special count connection type\r\n * 2. Retrieving the current count value from the connected count concept\r\n * 3. Incrementing the count\r\n * 4. Deleting old count connections\r\n * 5. Creating a new count concept with the updated value\r\n * 6. Connecting the new count concept back to the source\r\n *\r\n * This enables analytics like \"how many books has this author authored?\" or\r\n * \"how many followers does this user have?\"\r\n *\r\n * @param linker - The relationship name being counted (e.g., \"authored_s\", \"follows_s\")\r\n * @param concept - The concept for which relationships are being counted\r\n * @param passedUserId - Optional user ID to use instead of the concept's userId (default: null, uses concept.userId)\r\n *\r\n * @returns A promise that resolves when the count has been updated\r\n *\r\n * @example\r\n * ```typescript\r\n * // Count how many times an author has \"authored\" something\r\n * const authorConcept = await GetTheConcept(123);\r\n * await CountRelationship(\"authored_s\", authorConcept);\r\n *\r\n * // Later, retrieve the count\r\n * const countConnectionType = await GetConceptByCharacter(\"authors_s_authored_s_count\");\r\n * const countConnections = await GetConnectionOfTheConcept(\r\n * countConnectionType.id,\r\n * authorConcept.id,\r\n * authorConcept.userId\r\n * );\r\n * const countConcept = await GetTheConcept(countConnections[0].toTheConceptId);\r\n * console.log(\"Author has written\", countConcept.characterValue, \"books\");\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Count relationships with a specific user ID\r\n * const userConcept = await GetTheConcept(456);\r\n * await CountRelationship(\"follows_s\", userConcept, 999);\r\n * ```\r\n *\r\n * @remarks\r\n * - Count connection type pattern: `{conceptType}_s_{linker}_count`\r\n * - Creates a new \"count\" type concept with the numeric value as characterValue\r\n * - Deletes all previous count connections before creating the new one\r\n * - If no existing count is found, starts from 1\r\n * - If parsing the count value fails, defaults to 0 and increments to 1\r\n * - Uses session information ID 999, access level 4, and security ID 999\r\n * - The count concept itself is of type \"count\"\r\n *\r\n * @see {@link CreateConnectionBetweenTwoConcepts} for functions that use counting\r\n * @see {@link GetConnectionOfTheConcept} for retrieving count connections\r\n * @see {@link MakeTheInstanceConcept} for creating count concepts\r\n */\r\nexport async function CountRelationship(linker: string, concept:Concept, passedUserId: number | null = null){\r\n var concept1:Concept = concept; \r\n var userId:number = passedUserId ?? concept.userId;\r\n var orderUserId: number = userId;\r\n var securityId: number = 999;\r\n var securityUserId: number = userId;\r\n var accessId: number = 4;\r\n var accessUserId: number = userId;\r\n var sessionInformationId = 999;\r\n var sessionInformationUserId = 999;\r\n var forwardLinkerCount:string = linker + \"_count\";\r\n var forwardLinkerCountString = concept.type?.characterValue + \"_s\" + \"_\" + forwardLinkerCount;\r\n var forwardLinkerCountConcept = await MakeTheInstanceConcept(\"connection\",forwardLinkerCountString,false,userId,accessId,sessionInformationId);\r\n\r\n var connectionsString = await GetConnectionOfTheConcept(forwardLinkerCountConcept.id, concept.id, userId, 10, 1);\r\n var connections = connectionsString as Connection[];\r\n var prefetch :number[] = [];\r\n var countConceptList:Concept[] = [];\r\n var countConcept = CreateDefaultConcept();\r\n for(var i=0; i<connections.length; i++){\r\n let toConcept = await GetTheConcept(connections[i].toTheConceptId);\r\n countConceptList.push(toConcept);\r\n }\r\n if(countConceptList.length < 1){\r\n countConcept = await MakeTheInstanceConcept(\"count\", \"1\", false, userId, accessId,sessionInformationId);\r\n\r\n }\r\n else{\r\n var oldcountConcept = countConceptList[0];\r\n let count:number = 0;\r\n try{\r\n count = Number(oldcountConcept.characterValue);\r\n }\r\n catch(ex){\r\n count = 0;\r\n }\r\n count = count + 1;\r\n countConcept = await MakeTheInstanceConcept(\"count\", count.toString(), false, userId, accessId, sessionInformationId );\r\n for(let i=0; i<connections.length; i++){\r\n DeleteConnectionById(connections[i].id);\r\n }\r\n \r\n }\r\n let newConnection = new Connection(0,concept1.id, countConcept.id,concept1.userId, countConcept.userId, concept1.userId,\r\n forwardLinkerCountConcept.id, forwardLinkerCountConcept.userId, 1000, userId, securityId, securityUserId, accessId, accessUserId,sessionInformationId,sessionInformationUserId );\r\n await SyncData.AddConnection(newConnection);\r\n\r\n\r\n}\r\n\r\n/**\r\n * Creates a typed connection with reserved IDs between two concepts.\r\n *\r\n * This is the production-ready version of CreateConnectionBetweenTwoConcepts that uses\r\n * reserved IDs and the CreateTheConnectionGeneral function. It provides the same\r\n * semantic connection naming and bidirectional support, but ensures connections are\r\n * properly persisted with system-reserved IDs.\r\n *\r\n * Unlike the basic version, this function uses CreateTheConnectionGeneral instead of\r\n * directly creating Connection objects, which means connections get proper ID reservation,\r\n * update flags, and transaction tracking.\r\n *\r\n * @param ofTheConcept - The source concept from which the connection originates\r\n * @param toTheConcept - The target concept to which the connection points\r\n * @param linker - The semantic relationship name (e.g., \"authored\", \"contains\", \"belongs_to\")\r\n * @param both - If true, creates connections in both directions (default: false)\r\n * @param count - If true, maintains a count of relationships for this linker type (default: false)\r\n *\r\n * @returns A promise that resolves to the created forward Connection object with reserved ID\r\n *\r\n * @example\r\n * ```typescript\r\n * // Create a production-grade bidirectional \"collaborates_with\" connection\r\n * const researcher1 = await GetTheConcept(123);\r\n * const researcher2 = await GetTheConcept(456);\r\n *\r\n * const connection = await CreateConnectionBetweenTwoConceptsGeneral(\r\n * researcher1,\r\n * researcher2,\r\n * \"collaborates_with\",\r\n * true, // Bidirectional\r\n * true // Track counts\r\n * );\r\n *\r\n * console.log(\"Connection ID:\", connection.id);\r\n * // Both researchers now have collaboration connections and counts\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Create a one-way \"belongs_to\" connection with reserved ID\r\n * const itemConcept = await GetTheConcept(789);\r\n * const categoryConcept = await GetTheConcept(101);\r\n *\r\n * await CreateConnectionBetweenTwoConceptsGeneral(\r\n * itemConcept,\r\n * categoryConcept,\r\n * \"belongs_to\",\r\n * false,\r\n * false\r\n * );\r\n * ```\r\n *\r\n * @remarks\r\n * - Uses CreateTheConnectionGeneral for proper ID reservation and persistence\r\n * - Forward connection type pattern: `{sourceType}_s_{linker}_s`\r\n * - Backward connection type pattern: `{targetType}_s_{linker}_by`\r\n * - Backward connections still use basic Connection creation (not CreateTheConnectionGeneral)\r\n * - Uses session information ID 999, order 1000, and access level 4\r\n * - Connection is marked for update (toUpdate = true) via CreateTheConnectionGeneral\r\n * - Recommended for production use over CreateConnectionBetweenTwoConcepts\r\n *\r\n * @see {@link CreateConnectionBetweenTwoConcepts} for the temporary version\r\n * @see {@link CreateTheConnectionGeneral} for the underlying connection creation\r\n * @see {@link CountRelationship} for relationship counting implementation\r\n */\r\nexport async function CreateConnectionBetweenTwoConceptsGeneral(ofTheConcept: Concept, toTheConcept: Concept, linker:string, both:boolean = false, count:boolean = false){\r\n\r\n var userId:number = ofTheConcept.userId;\r\n var orderUserId: number = userId;\r\n var securityId: number = 999;\r\n var securityUserId: number = userId;\r\n var accessId: number = 4;\r\n var accessUserId: number = userId;\r\n var sessionInformationId = 999;\r\n var sessionInformationUserId = 999;\r\n if(both){\r\n let prefix1: string = toTheConcept.type?.characterValue + \"_s\";\r\n let linkerAdd1 = linker + \"_by\";\r\n let backwardLinker = prefix1 + \"_\" + linkerAdd1; \r\n if(count){\r\n await CountRelationship(linkerAdd1, toTheConcept, userId);\r\n }\r\n var connectionConceptReverse = await MakeTheInstanceConcept(\"connection\",backwardLinker,false,999,999,999);\r\n let newConnection = new Connection(0,toTheConcept.id, ofTheConcept.id,toTheConcept.userId, ofTheConcept.userId, toTheConcept.userId,\r\n connectionConceptReverse.id, connectionConceptReverse.userId, 1000, userId, securityId, securityUserId, accessId, accessUserId,sessionInformationId,sessionInformationUserId );\r\n SyncData.AddConnection(newConnection);\r\n }\r\n let prefix: string = ofTheConcept.type?.characterValue + \"_s\";\r\n let linkerAdd = linker + \"_s\";\r\n let forwardLinker = prefix + \"_\" + linkerAdd;\r\n if(count){\r\n await CountRelationship(linkerAdd, ofTheConcept, userId);\r\n }\r\n var connectionConcept = await MakeTheInstanceConcept(\"connection\",forwardLinker,false,999,999,999);\r\n let newConnection = await CreateTheConnectionGeneral(ofTheConcept.id,ofTheConcept.userId, toTheConcept.id, toTheConcept.userId, \r\n connectionConcept.id, sessionInformationId,sessionInformationId, 1000, accessId);\r\n return newConnection;\r\n }","/**\r\n * Default Concept Factory\r\n *\r\n * This module provides utility functions for creating default/empty concept instances\r\n * and formatting date values. These utilities are used throughout the system when\r\n * initializing concepts or handling date operations.\r\n *\r\n * @module CreateDefaultConcept\r\n */\r\n\r\nimport { Concept } from \"../DataStructures/Concept\";\r\n\r\n/**\r\n * Creates a default concept with zero/empty values and current timestamps.\r\n *\r\n * This factory function is used throughout the system when a concept instance is needed\r\n * but not yet populated with real data. It's particularly useful as a placeholder during\r\n * concept retrieval operations, initialization, or when a null-safe concept object is required.\r\n *\r\n * The created concept has all numeric fields set to 0, characterValue set to \"0\",\r\n * isComposition set to false, and timestamps set to the current date/time.\r\n *\r\n * @returns A new Concept instance with default values\r\n *\r\n * @example\r\n * ```typescript\r\n * // Use as a placeholder during concept retrieval\r\n * let concept = CreateDefaultConcept();\r\n *\r\n * try {\r\n * concept = await GetTheConcept(123);\r\n * } catch (error) {\r\n * console.log(\"Using default concept due to error\");\r\n * }\r\n *\r\n * if (concept.id === 0) {\r\n * console.log(\"Concept not found, using default\");\r\n * }\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Initialize a concept variable before conditional assignment\r\n * let resultConcept = CreateDefaultConcept();\r\n *\r\n * if (useCache) {\r\n * resultConcept = await ConceptsData.GetConcept(id);\r\n * } else {\r\n * resultConcept = await GetConcept(id);\r\n * }\r\n * ```\r\n *\r\n * @remarks\r\n * - All ID fields (id, typeId, userId, etc.) are set to 0\r\n * - characterValue is set to \"0\" string\r\n * - isComposition is set to false\r\n * - created_on and updated_on are set to current date/time using formatDate()\r\n * - The concept is not added to any data store; it's just an instance\r\n * - Commonly used as a null-safe alternative when concept retrieval might fail\r\n *\r\n * @see {@link formatDate} for the date formatting function used\r\n * @see {@link Concept} for the concept data structure\r\n */\r\nexport function CreateDefaultConcept(){\r\n let created_on = formatDate(new Date());\r\n let updated_on = formatDate(new Date());\r\n let concept = new Concept(0,0,0,0,0,0,0,0,\"0\",0,0,0,0,0,0,false,created_on,updated_on);\r\n return concept;\r\n}\r\n\r\n/**\r\n * Formats a Date object into a human-readable string with 12-hour time format.\r\n *\r\n * This utility function converts JavaScript Date objects into a consistent string\r\n * format used throughout the CCS system for timestamps. The format includes the date\r\n * in MM/DD/YYYY format and time in 12-hour format with AM/PM indicator.\r\n *\r\n * The function is primarily used for setting created_on and updated_on timestamps\r\n * on concepts and connections.\r\n *\r\n * @param date - The Date object to format\r\n *\r\n * @returns A formatted date string in the pattern \"M/D/YYYY h:mm:ss AM/PM\"\r\n *\r\n * @example\r\n * ```typescript\r\n * // Format current date\r\n * const now = new Date();\r\n * const formatted = formatDate(now);\r\n * console.log(formatted); // \"1/15/2024 3:45:30 PM\"\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Use when creating a concept\r\n * const concept = new Concept(\r\n * 123,\r\n * 456,\r\n * 999,\r\n * // ... other fields\r\n * formatDate(new Date()), // created_on\r\n * formatDate(new Date()) // updated_on\r\n * );\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Format a specific date\r\n * const specificDate = new Date(2024, 0, 15, 15, 30, 45);\r\n * console.log(formatDate(specificDate)); // \"1/15/2024 3:30:45 PM\"\r\n * ```\r\n *\r\n * @remarks\r\n * - Months are 1-indexed in output (January = 1) but 0-indexed in JavaScript Date\r\n * - Uses 12-hour time format with AM/PM\r\n * - Minutes and seconds are zero-padded to 2 digits\r\n * - Hours are NOT zero-padded (e.g., \"3:05 PM\" not \"03:05 PM\")\r\n * - Date components are NOT zero-padded (e.g., \"1/5/2024\" not \"01/05/2024\")\r\n * - Output format: \"M/D/YYYY h:mm:ss AM/PM\"\r\n * - Midnight (00:00) is represented as \"12:00 AM\"\r\n * - Noon (12:00) is represented as \"12:00 PM\"\r\n *\r\n * @see {@link CreateDefaultConcept} which uses this function for timestamps\r\n */\r\nexport function formatDate(date:Date) {\r\n const month = date.getMonth() + 1; // months are 0-indexed\r\n const day = date.getDate();\r\n const year = date.getFullYear();\r\n\r\n let hours = date.getHours();\r\n const minutes = date.getMinutes();\r\n const seconds = date.getSeconds();\r\n const ampm = hours >= 12 ? 'PM' : 'AM';\r\n\r\n // Convert to 12-hour format\r\n hours = hours % 12;\r\n hours = hours ? hours : 12; // 0 should be 12\r\n\r\n // Pad minutes and seconds\r\n const pad = (n:any) => n.toString().padStart(2, '0');\r\n\r\n return `${month}/${day}/${year} ${hours}:${pad(minutes)}:${pad(seconds)} ${ampm}`;\r\n}","/**\r\n * Composition Creation Service\r\n *\r\n * This module provides functionality for converting JSON objects into interconnected\r\n * concept structures (compositions) in the Concept Connection System. It recursively\r\n * traverses JSON structures and creates corresponding concepts and connections,\r\n * effectively serializing complex data structures into the graph database.\r\n *\r\n * This enables storing and retrieving structured data like user profiles, documents,\r\n * or any hierarchical data within the CCS framework.\r\n *\r\n * @module CreateTheComposition\r\n */\r\n\r\nimport { Concept } from \"../DataStructures/Concept\";\r\nimport { SyncData } from \"../DataStructures/SyncData\";\r\nimport { CreateDefaultConcept } from \"./CreateDefaultConcept\";\r\nimport {createTheConnection} from \"./CreateTheConnection\";\r\nimport MakeTheInstanceConcept from \"./MakeTheInstanceConcept\";\r\n\r\n/**\r\n * Recursively converts a JSON object into a composition of interconnected concepts.\r\n *\r\n * This function is the core serialization mechanism for storing structured data in CCS.\r\n * It traverses a JSON object recursively, creating concepts for each key-value pair and\r\n * establishing connections between them to preserve the hierarchical structure.\r\n *\r\n * The function handles both object structures (which become nested compositions) and\r\n * primitive values (which become leaf concepts with character values). The resulting\r\n * structure can be later reconstructed using GetComposition functions.\r\n *\r\n * The recursion works as follows:\r\n * - Object/nested structures: Create a concept for the key, recurse into the value\r\n * - Primitive values (string/number): Create a concept with the key as type and value as characterValue\r\n * - Root level: If no parent concept is provided, creates a new root concept\r\n *\r\n * @param json - The JSON object to convert into a composition\r\n * @param ofTheConceptId - The ID of the parent concept to connect to (null for root level)\r\n * @param ofTheConceptUserId - The user ID of the parent concept (null for root level)\r\n * @param mainKey - The ID of the root concept, used as connection type throughout the composition\r\n * @param userId - The user ID to assign to all created concepts (default: 999)\r\n * @param accessId - The access level for created concepts (default: 4)\r\n * @param sessionInformationId - The session ID for tracking this operation (default: 999)\r\n *\r\n * @returns A promise that resolves to the main (root) Concept of the created composition\r\n *\r\n * @example\r\n * ```typescript\r\n * // Create a user profile composition\r\n * const userProfile = {\r\n * name: \"Alice Johnson\",\r\n * age: 30,\r\n * address: {\r\n * street: \"123 Main St\",\r\n * city: \"Springfield\",\r\n * country: \"USA\"\r\n * },\r\n * hobbies: [\"reading\", \"hiking\", \"photography\"]\r\n * };\r\n *\r\n * const rootConcept = await CreateTheComposition(\r\n * userProfile,\r\n * null, // No parent, this is root\r\n * null,\r\n * null,\r\n * 999, // User ID\r\n * 4, // Access level\r\n * 999 // Session ID\r\n * );\r\n *\r\n * console.log(\"Profile composition created:\", rootConcept.id);\r\n * // Can later retrieve with: GetComposition(rootConcept.id)\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Add a nested composition to an existing concept\r\n * const parentConcept = await GetTheConcept(456);\r\n * const metadata = {\r\n * created: \"2024-01-15\",\r\n * modified: \"2024-01-20\",\r\n * version: 2\r\n * };\r\n *\r\n * const metadataConcept = await CreateTheComposition(\r\n * metadata,\r\n * parentConcept.id,\r\n * parentConcept.userId,\r\n * parentConcept.id, // Use parent as mainKey\r\n * parentConcept.userId\r\n * );\r\n * ```\r\n *\r\n * @remarks\r\n * - Creates concepts for each JSON key, using the key as the concept's type\r\n * - Primitive values (strings, numbers) are stored as characterValue in leaf concepts\r\n * - Nested objects and arrays are recursively converted into sub-compositions\r\n * - All concepts are connected using the mainKey (root concept ID) as the connection type\r\n * - Uses temporary connections (via createTheConnection) with random IDs\r\n * - Default values: userId=999, accessId=4, sessionInformationId=999\r\n * - The function modifies SyncData by adding all created concepts and connections\r\n * - Complex objects become type concepts with isComposition=true\r\n * - Primitive values become instance concepts with isComposition=false\r\n *\r\n * @see {@link GetComposition} for reconstructing compositions back to JSON\r\n * @see {@link MakeTheInstanceConcept} for individual concept creation\r\n * @see {@link createTheConnection} for connection creation logic\r\n */\r\nexport default async function CreateTheComposition(json: any, ofTheConceptId:number | null=null, ofTheConceptUserId:number | null=null, mainKey: number | null=null, userId: number | null=null, accessId:number | null=null, sessionInformationId:number | null=null)\r\n{\r\n var localUserId:number = userId ?? 999;\r\n var localAccessId: number = accessId ?? 4;\r\n var localSessionId: number = sessionInformationId ?? 999;\r\n var MainKeyLocal: number = mainKey ?? 0;\r\n var MainConcept = CreateDefaultConcept();\r\n for (const key in json) {\r\n if((typeof json[key] != 'string' && typeof json[key] != 'number') ){\r\n if(ofTheConceptId == null && ofTheConceptUserId == null){\r\n\r\n var localMainKey = MainKeyLocal;\r\n let conceptString = await MakeTheInstanceConcept(key, \"\", true, localUserId, localAccessId, localSessionId);\r\n var concept = conceptString as Concept;\r\n MainConcept = concept;\r\n localMainKey = concept.id;\r\n MainKeyLocal = concept.id;\r\n\r\n await CreateTheComposition(json[key], concept.id, concept.userId, localMainKey, userId, accessId, sessionInformationId );\r\n \r\n }\r\n else{\r\n var ofThe:number = ofTheConceptId ?? 999;\r\n var ofTheUser:number = ofTheConceptUserId ?? 999;\r\n var localMainKey = MainKeyLocal;\r\n var conceptString = await MakeTheInstanceConcept(key, \"\", true, localUserId, localAccessId, localSessionId );\r\n var concept = conceptString as Concept;\r\n MainConcept = concept;\r\n await createTheConnection(ofThe, ofTheUser, concept.id, concept.userId, localMainKey, localSessionId, concept.userId);\r\n await CreateTheComposition(json[key], concept.id, concept.userId, localMainKey, userId, accessId, sessionInformationId );\r\n }\r\n }\r\n else{\r\n var ofThe:number = ofTheConceptId ?? 999;\r\n var ofTheUser:number = ofTheConceptUserId ?? 10267;\r\n var localMainKey = MainKeyLocal;\r\n var conceptString = await MakeTheInstanceConcept(key, json[key].toString(), false, localUserId, localAccessId, localSessionId);\r\n var concept = conceptString as Concept;\r\n await createTheConnection(ofThe, ofTheUser, concept.id, concept.userId, localMainKey, localSessionId, concept.userId);\r\n\r\n }\r\n\r\n }\r\n return MainConcept;\r\n}\r\n\r\n","/**\r\n * Concept creation service module.\r\n * Provides functions for creating concepts in different modes: normal, temporary, and immediate.\r\n *\r\n * @module Services/CreateTheConcept\r\n * @see https://documentation.freeschema.com/#concept for concept documentation\r\n */\r\n\r\nimport { CreateTheConceptApi } from \"../Api/Create/CreateTheConceptApi\";\r\nimport { Concept } from \"../DataStructures/Concept\";\r\nimport { ReservedIds } from \"../DataStructures/ReservedIds\";\r\nimport { SyncData } from \"../DataStructures/SyncData\";\r\nimport { InnerActions } from \"../DataStructures/Transaction/Transaction\";\r\nimport { ConceptsData } from \"../app\";\r\n\r\n/**\r\n * Creates a new concept and adds it to the sync queue for backend synchronization.\r\n * This is the standard way to create a concept that will be persisted to the backend.\r\n * The concept is marked as new (isNew=true) and non-temporary (isTemp=false), and\r\n * added to both SyncData (for backend sync) and the transaction actions list.\r\n *\r\n * @param referent - The character/string value representing the concept's content\r\n * @param userId - The ID of the user creating this concept\r\n * @param categoryId - The ID of the category concept this concept belongs to\r\n * @param categoryUserId - The user ID of the category concept owner\r\n * @param typeId - The ID of the type concept that defines this concept's type\r\n * @param typeUserId - The user ID of the type concept owner\r\n * @param referentId - The ID of the referent concept (what this concept refers to)\r\n * @param referentUserId - The user ID of the referent concept owner\r\n * @param securityId - The ID of the security concept controlling access\r\n * @param securityUserId - The user ID of the security concept owner\r\n * @param accessId - The ID of the access concept defining permissions\r\n * @param accessUserId - The user ID of the access concept owner\r\n * @param sessionInformationId - The ID of the session concept for tracking\r\n * @param sessionInformationUserId - The user ID of the session concept owner\r\n * @param actions - Transaction object to track all concepts and connections created in this operation\r\n * @returns A Promise that resolves to the newly created Concept instance\r\n *\r\n * @example\r\n * ```typescript\r\n * // Create a new concept with all required metadata\r\n * const concept = await CreateTheConcept(\r\n * 'John Doe', // referent (the actual value)\r\n * 1, // userId\r\n * 10, 1, // categoryId, categoryUserId\r\n * 20, 1, // typeId, typeUserId (e.g., \"Person\" type)\r\n * 0, 0, // referentId, referentUserId (no referent)\r\n * 30, 1, // securityId, securityUserId\r\n * 40, 1, // accessId, accessUserId\r\n * 50, 1, // sessionInformationId, sessionInformationUserId\r\n * { concepts: [], connections: [] } // transaction actions\r\n * );\r\n *\r\n * console.log(concept.id); // Auto-generated unique ID\r\n * console.log(concept.isNew); // true - will be synced to backend\r\n * console.log(concept.isTemp); // false - permanent concept\r\n * ```\r\n *\r\n * @remarks\r\n * - Automatically generates a unique ID using ReservedIds.getId()\r\n * - Sets creation and update timestamps to current time\r\n * - Marks concept as new (isNew=true) for backend synchronization\r\n * - Marks concept as non-temporary (isTemp=false) for persistence\r\n * - Adds concept to SyncData queue for eventual backend sync\r\n * - Adds concept to transaction actions for tracking within a transaction context\r\n * - Does NOT immediately call the backend API; sync happens separately\r\n *\r\n * @see CreateTheConceptTemporary for creating temporary concepts\r\n * @see CreateTheConceptImmediate for creating concepts with immediate backend sync\r\n * @see Concept for the concept data structure\r\n * @see SyncData for sync queue management\r\n * @see ReservedIds for ID generation\r\n */\r\nexport default async function CreateTheConcept(referent:string, userId:number, categoryId:number, categoryUserId:number,\r\ntypeId:number, typeUserId:number,referentId:number, referentUserId:number,securityId:number, securityUserId:number,\r\naccessId:number, accessUserId:number, sessionInformationId:number, sessionInformationUserId:number, actions: InnerActions = {concepts: [], connections: []}){\r\n\r\nvar id = await ReservedIds.getId();\r\nvar isNew: boolean = true;\r\nlet created_on:Date = new Date();\r\nlet updated_on:Date = new Date();\r\nvar concept = new Concept(id,userId,typeId,typeUserId,categoryId,categoryUserId,referentId, referentUserId, referent, securityId,\r\n securityUserId,accessId, accessUserId,sessionInformationId, sessionInformationUserId,isNew,created_on,updated_on);\r\nconcept.isTemp = false;\r\nSyncData.AddConcept(concept);\r\nactions.concepts.push(concept);\r\nreturn concept;\r\n\r\n}\r\n\r\n/**\r\n * Creates a temporary concept that is NOT added to the sync queue or persisted to backend.\r\n * Temporary concepts are useful for UI state management, draft operations, or transient data\r\n * that doesn't need to be saved. The concept is marked as temporary (isTemp=true) and new (isNew=true).\r\n *\r\n * @param referent - The character/string value representing the concept's content\r\n * @param userId - The ID of the user creating this concept\r\n * @param categoryId - The ID of the category concept this concept belongs to\r\n * @param categoryUserId - The user ID of the category concept owner\r\n * @param typeId - The ID of the type concept that defines this concept's type\r\n * @param typeUserId - The user ID of the type concept owner\r\n * @param referentId - The ID of the referent concept (what this concept refers to)\r\n * @param referentUserId - The user ID of the referent concept owner\r\n * @param securityId - The ID of the security concept controlling access\r\n * @param securityUserId - The user ID of the security concept owner\r\n * @param accessId - The ID of the access concept defining permissions\r\n * @param accessUserId - The user ID of the access concept owner\r\n * @param sessionInformationId - The ID of the session concept for tracking\r\n * @param sessionInformationUserId - The user ID of the session concept owner\r\n * @returns A Promise that resolves to the newly created temporary Concept instance\r\n *\r\n * @example\r\n * ```typescript\r\n * // Create a temporary concept for UI draft state\r\n * const draftConcept = await CreateTheConceptTemporary(\r\n * 'Draft Note', // referent\r\n * 1, // userId\r\n * 10, 1, // categoryId, categoryUserId\r\n * 20, 1, // typeId, typeUserId\r\n * 0, 0, // referentId, referentUserId\r\n * 30, 1, // securityId, securityUserId\r\n * 40, 1, // accessId, accessUserId\r\n * 50, 1 // sessionInformationId, sessionInformationUserId\r\n * );\r\n *\r\n * console.log(draftConcept.isTemp); // true - won't be synced\r\n * console.log(draftConcept.isNew); // true - marked as new\r\n * // This concept will NOT be added to SyncData or saved to backend\r\n * ```\r\n *\r\n * @remarks\r\n * - Automatically generates a unique ID using ReservedIds.getId()\r\n * - Sets creation and update timestamps to current time\r\n * - Marks concept as new (isNew=true) but also temporary (isTemp=true)\r\n * - Does NOT add concept to SyncData (no backend sync)\r\n * - Does NOT add concept to transaction actions\r\n * - Useful for draft states, temporary UI elements, or client-only data\r\n * - The concept exists only in client memory until explicitly converted/saved\r\n *\r\n * @see CreateTheConcept for creating persistent concepts\r\n * @see CreateTheConceptImmediate for creating concepts with immediate backend sync\r\n * @see Concept for the concept data structure\r\n */\r\nexport async function CreateTheConceptTemporary(referent:string, userId:number, categoryId:number, categoryUserId:number,\r\n typeId:number, typeUserId:number,referentId:number, referentUserId:number,securityId:number, securityUserId:number,\r\n accessId:number, accessUserId:number, sessionInformationId:number, sessionInformationUserId:number){\r\n \r\n var id = await ReservedIds.getId();\r\n var isNew: boolean = true;\r\n let created_on:Date = new Date();\r\n let updated_on:Date = new Date();\r\n var concept = new Concept(id,userId,typeId,typeUserId,categoryId,categoryUserId,referentId, referentUserId, referent, securityId,\r\n securityUserId,accessId, accessUserId,sessionInformationId, sessionInformationUserId,isNew,created_on, updated_on);\r\n concept.isTemp = true;\r\n return concept;\r\n \r\n}\r\n\r\n/**\r\n * Creates a concept and immediately adds it to ConceptsData for instant availability in queries.\r\n * Unlike CreateTheConcept, this function adds the concept to the in-memory ConceptsData store\r\n * immediately (not just SyncData), making it instantly searchable. It also sets updateRecursion=true\r\n * to enable recursive updates. The concept is marked as not new (isNew=false) and non-temporary.\r\n *\r\n * @param referent - The character/string value representing the concept's content\r\n * @param userId - The ID of the user creating this concept\r\n * @param categoryId - The ID of the category concept this concept belongs to\r\n * @param categoryUserId - The user ID of the category concept owner\r\n * @param typeId - The ID of the type concept that defines this concept's type\r\n * @param typeUserId - The user ID of the type concept owner\r\n * @param referentId - The ID of the referent concept (what this concept refers to)\r\n * @param referentUserId - The user ID of the referent concept owner\r\n * @param securityId - The ID of the security concept controlling access\r\n * @param securityUserId - The user ID of the security concept owner\r\n * @param accessId - The ID of the access concept defining permissions\r\n * @param accessUserId - The user ID of the access concept owner\r\n * @param sessionInformationId - The ID of the session concept for tracking\r\n * @param sessionInformationUserId - The user ID of the session concept owner\r\n * @param actions - Transaction object to track all concepts and connections created in this operation\r\n * @returns A Promise that resolves to the newly created Concept instance\r\n *\r\n * @example\r\n * ```typescript\r\n * // Create a concept that's immediately available for queries\r\n * const concept = await CreateTheConceptImmediate(\r\n * 'Important User', // referent\r\n * 1, // userId\r\n * 10, 1, // categoryId, categoryUserId\r\n * 20, 1, // typeId, typeUserId\r\n * 0, 0, // referentId, referentUserId\r\n * 30, 1, // securityId, securityUserId\r\n * 40, 1, // accessId, accessUserId\r\n * 50, 1, // sessionInformationId, sessionInformationUserId\r\n * { concepts: [], connections: [] } // transaction actions\r\n * );\r\n *\r\n * // Concept is immediately available in ConceptsData\r\n * const found = ConceptsData.getConceptById(concept.id);\r\n * console.log(found !== null); // true - immediately findable\r\n * console.log(concept.isNew); // false - treated as existing\r\n * console.log(concept.updateRecursion); // true - enables recursive updates\r\n * ```\r\n *\r\n * @remarks\r\n * - Automatically generates a unique ID using ReservedIds.getId()\r\n * - Sets creation and update timestamps to current time\r\n * - Marks concept as NOT new (isNew=false) - treated as existing concept\r\n * - Marks concept as non-temporary (isTemp=false)\r\n * - Adds concept to ConceptsData immediately for instant query availability\r\n * - Sets updateRecursion=true to enable recursive composition updates\r\n * - Adds concept to SyncData for backend synchronization\r\n * - Adds concept to transaction actions for tracking\r\n * - The commented-out line suggests this previously triggered immediate API sync\r\n *\r\n * @see CreateTheConcept for standard concept creation with delayed sync\r\n * @see CreateTheConceptTemporary for creating temporary concepts\r\n * @see ConceptsData for the in-memory concept store\r\n * @see SyncData for sync queue management\r\n */\r\nexport async function CreateTheConceptImmediate(referent:string, userId:number, categoryId:number, categoryUserId:number,\r\n typeId:number, typeUserId:number,referentId:number, referentUserId:number,securityId:number, securityUserId:number,\r\n accessId:number, accessUserId:number, sessionInformationId:number, sessionInformationUserId:number, actions: InnerActions = {concepts: [], connections: []}){\r\n \r\n var id = await ReservedIds.getId();\r\n var isNew: boolean = false;\r\n let created_on:Date = new Date();\r\nlet updated_on:Date = new Date();\r\n var concept = new Concept(id,userId,typeId,typeUserId,categoryId,categoryUserId,referentId, referentUserId, referent, securityId,\r\n securityUserId,accessId, accessUserId,sessionInformationId, sessionInformationUserId,isNew,created_on, updated_on);\r\n ConceptsData.AddConcept(concept);\r\n concept.updateRecursion = true;\r\n //CreateTheConceptApi([concept]);\r\n SyncData.AddConcept(concept);\r\n actions.concepts.push(concept);\r\n return concept;\r\n \r\n}","/**\r\n * Connection Creation Service\r\n *\r\n * This module provides functionality for creating temporary connections between concepts\r\n * in the Concept Connection System. It handles basic connection creation with default\r\n * security and access settings.\r\n *\r\n * @module CreateTheConnection\r\n */\r\n\r\nimport { Connection } from \"../DataStructures/Connection\";\r\nimport { SyncData } from \"../DataStructures/SyncData\";\r\nimport { genHexString } from \"./GenerateHexNumber\";\r\n\r\n/**\r\n * Creates a temporary connection between two concepts with default settings.\r\n *\r\n * This function establishes a basic connection relationship between a source concept\r\n * (ofTheConcept) and a target concept (toTheConcept). The created connection is marked\r\n * as temporary (isTemp = true) and assigned a random ID. It automatically handles the\r\n * special case where a concept connects to itself by setting predefined IDs.\r\n *\r\n * The function uses default values for security (0), access level (4), and order (1),\r\n * making it suitable for quick connection creation during prototyping or when advanced\r\n * configuration is not required.\r\n *\r\n * @param ofTheConceptId - The ID of the source concept from which the connection originates\r\n * @param ofTheConceptUserId - The user ID who owns the source concept\r\n * @param toTheConceptId - The ID of the target concept to which the connection points\r\n * @param toTheConceptUserId - The user ID who owns the target concept\r\n * @param typeId - The ID of the concept that defines the type/nature of this connection\r\n * @param sessionInformationId - The ID of the session in which this connection is created\r\n * @param sessionInformationUserId - The user ID associated with the session information\r\n *\r\n * @returns A new Connection object that has been added to SyncData for synchronization\r\n *\r\n * @example\r\n * ```typescript\r\n * // Create a simple \"likes\" connection between user's concepts\r\n * const likesConcept = await GetConceptByCharacter(\"likes\");\r\n * const connection = createTheConnection(\r\n * userConcept.id,\r\n * userConcept.userId,\r\n * postConcept.id,\r\n * postConcept.userId,\r\n * likesConcept.id,\r\n * 999,\r\n * 999\r\n * );\r\n * console.log(\"Connection created:\", connection.id);\r\n * ```\r\n *\r\n * @remarks\r\n * - The connection is marked as temporary (isTemp = true) and assigned a random ID\r\n * - Self-referencing connections (where ofTheConceptId equals toTheConceptId) are handled\r\n * specially by setting ofTheConceptId to 0 and toTheConceptId to 1\r\n * - Default security level is set to 0 and access level to 4\r\n * - The connection is automatically added to SyncData for later synchronization\r\n * - For production use with reserved IDs and more control, consider using CreateTheConnectionGeneral\r\n *\r\n * @see {@link CreateTheConnectionGeneral} for creating connections with more configuration options\r\n * @see {@link Connection} for the connection data structure\r\n * @see {@link SyncData.AddConnection} for how connections are queued for sync\r\n */\r\nexport function createTheConnection(ofTheConceptId:number, ofTheConceptUserId:number, toTheConceptId:number, toTheConceptUserId:number,\r\n typeId: number, sessionInformationId: number, sessionInformationUserId: number\r\n ):Connection{ \r\n var orderId: number = 1;\r\n var orderUserId: number = ofTheConceptUserId;\r\n var typeUserId: number = ofTheConceptUserId;\r\n var userId : number = ofTheConceptUserId;\r\n var securityId: number = 0;\r\n var securityUserId: number = ofTheConceptUserId;\r\n var accessId : number = 4;\r\n var accessUserId: number = ofTheConceptUserId;\r\n var connection = new Connection(0,ofTheConceptId,toTheConceptId, ofTheConceptUserId,toTheConceptUserId,userId,typeId,\r\n typeUserId, orderId, orderUserId, securityId, securityUserId, accessId, accessUserId, sessionInformationId, sessionInformationUserId);\r\n if(ofTheConceptId == toTheConceptId){\r\n connection.ofTheConceptId = 0;\r\n connection.toTheConceptId = 1;\r\n return connection;\r\n }\r\n connection.isTemp = true;\r\n connection.id = Math.floor(Math.random() * 100000000);\r\n SyncData.AddConnection(connection);\r\n return connection;\r\n \r\n \r\n}","/**\r\n * General Connection Creation Service\r\n *\r\n * This module provides advanced functionality for creating permanent connections between\r\n * concepts with reserved IDs and configurable settings. It supports transaction tracking\r\n * and is designed for production use where connections need to be persisted and updated.\r\n *\r\n * @module CreateTheConnectionGeneral\r\n */\r\n\r\nimport { Concept, MakeTheTypeConceptApi } from \"../app\";\r\nimport { Connection } from \"../DataStructures/Connection\";\r\nimport { ReservedConnectionIds } from \"../DataStructures/ReservedIds\";\r\nimport { SyncData } from \"../DataStructures/SyncData\";\r\nimport { InnerActions } from \"../DataStructures/Transaction/Transaction\";\r\n\r\n/**\r\n * Creates a permanent connection between two concepts with reserved ID and full configuration.\r\n *\r\n * This is the production-ready version of connection creation that uses reserved IDs from\r\n * the system's ID reservation pool. Unlike the basic createTheConnection, this function\r\n * marks connections as non-temporary (isTemp = false) and sets them to update mode\r\n * (toUpdate = true), ensuring they persist properly in the database.\r\n *\r\n * The function provides extensive configurability including custom order, access levels,\r\n * and user assignment. It also supports transaction tracking by accepting an actions\r\n * object where created connections are logged.\r\n *\r\n * @param ofTheConceptId - The ID of the source concept from which the connection originates\r\n * @param ofTheConceptUserId - The user ID who owns the source concept\r\n * @param toTheConceptId - The ID of the target concept to which the connection points\r\n * @param toTheConceptUserId - The user ID who owns the target concept\r\n * @param typeId - The ID of the concept that defines the type/nature of this connection\r\n * @param sessionInformationId - The ID of the session in which this connection is created\r\n * @param sessionInformationUserId - The user ID associated with the session information\r\n * @param orderId - Optional ordering value for the connection (default: 1)\r\n * @param accessId - Optional access level for the connection (default: 4)\r\n * @param passedUserId - Optional specific user ID to assign to the connection (default: 999, uses ofTheConceptUserId if not provided)\r\n * @param actions - Optional transaction tracking object to log created connections (default: empty actions)\r\n *\r\n * @returns A promise that resolves to the created Connection object with a reserved ID\r\n *\r\n * @example\r\n * ```typescript\r\n * // Create a production connection with transaction tracking\r\n * const actions: InnerActions = { concepts: [], connections: [] };\r\n * const connection = await CreateTheConnectionGeneral(\r\n * authorConcept.id,\r\n * authorConcept.userId,\r\n * bookConcept.id,\r\n * bookConcept.userId,\r\n * wroteTypeConcept.id,\r\n * 999,\r\n * 999,\r\n * 1,\r\n * 4,\r\n * authorConcept.userId,\r\n * actions\r\n * );\r\n * console.log(\"Connection ID:\", connection.id);\r\n * console.log(\"Tracked connections:\", actions.connections.length);\r\n * ```\r\n *\r\n * @remarks\r\n * - Uses reserved IDs from ReservedConnectionIds for guaranteed uniqueness\r\n * - Connection is marked as non-temporary (isTemp = false) for persistence\r\n * - Sets toUpdate = true to ensure database synchronization\r\n * - Self-referencing connections are handled by setting ofTheConceptId to 0 and toTheConceptId to 1\r\n * - The connection is added to both SyncData and the provided actions object\r\n * - If passedUserId is 999, the function defaults to using ofTheConceptUserId\r\n *\r\n * @see {@link createTheConnection} for creating temporary connections\r\n * @see {@link CreateConnection} for a simplified high-level connection API\r\n * @see {@link ReservedConnectionIds.getId} for ID reservation mechanism\r\n */\r\nexport async function CreateTheConnectionGeneral(ofTheConceptId:number, ofTheConceptUserId:number, toTheConceptId:number, toTheConceptUserId:number,\r\n typeId: number, sessionInformationId: number, sessionInformationUserId: number, orderId: number = 1, accessId = 4, passedUserId:number = 999, actions: InnerActions = {concepts: [], connections: []}\r\n ){ \r\n let orderUserId: number = ofTheConceptUserId;\r\n let typeUserId: number = ofTheConceptUserId;\r\n let userId : number = ofTheConceptUserId;\r\n\r\n if(passedUserId != 999){\r\n userId = passedUserId;\r\n }\r\n let securityId: number = 0;\r\n let securityUserId: number = ofTheConceptUserId;\r\n let accessUserId: number = ofTheConceptUserId;\r\n let id = await ReservedConnectionIds.getId();\r\n let connection = new Connection(id,ofTheConceptId,toTheConceptId, ofTheConceptUserId,toTheConceptUserId,userId,typeId,\r\n typeUserId, orderId, orderUserId, securityId, securityUserId, accessId, accessUserId, sessionInformationId, sessionInformationUserId);\r\n if(ofTheConceptId == toTheConceptId){\r\n connection.ofTheConceptId = 0;\r\n connection.toTheConceptId = 1;\r\n return connection;\r\n }\r\n // this will cause the connection to go and update the existing with the reserved id\r\n connection.toUpdate = true;\r\n connection.isTemp = false;\r\n SyncData.AddConnection(connection);\r\n actions.connections.push(connection);\r\n return connection;\r\n \r\n \r\n}\r\n\r\n/**\r\n * Creates a connection between two concepts using a type string identifier.\r\n *\r\n * This is a high-level convenience function that simplifies connection creation by\r\n * accepting concept objects directly and a string for the connection type. It automatically\r\n * handles the creation or retrieval of the connection type concept and delegates to\r\n * CreateTheConnectionGeneral for the actual connection creation.\r\n *\r\n * This function is ideal for application-level code where you want to create connections\r\n * using semantic type names (like \"contains\", \"authored\", \"belongs_to\") rather than\r\n * managing type concept IDs manually.\r\n *\r\n * @param ofTheConcept - The source Concept object from which the connection originates\r\n * @param toTheConcept - The target Concept object to which the connection points\r\n * @param connectionTypeString - A string describing the connection type (e.g., \"contains\", \"references\")\r\n * @param actions - Optional transaction tracking object to log created connections (default: empty actions)\r\n *\r\n * @returns A promise that resolves to the created Connection object\r\n *\r\n * @example\r\n * ```typescript\r\n * // Create a \"contains\" connection between a folder and a file\r\n * const folderConcept = await GetTheConcept(123);\r\n * const fileConcept = await GetTheConcept(456);\r\n * const actions: InnerActions = { concepts: [], connections: [] };\r\n *\r\n * const connection = await CreateConnection(\r\n * folderConcept,\r\n * fileConcept,\r\n * \"contains\",\r\n * actions\r\n * );\r\n *\r\n * console.log(`Created ${connectionTypeString} connection:`, connection.id);\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Create an \"authored\" connection between author and book\r\n * const authorConcept = await GetTheConcept(789);\r\n * const bookConcept = await GetTheConcept(101);\r\n *\r\n * const connection = await CreateConnection(\r\n * authorConcept,\r\n * bookConcept,\r\n * \"authored\"\r\n * );\r\n * ```\r\n *\r\n * @remarks\r\n * - Automatically creates or retrieves a type concept for the connectionTypeString\r\n * - Uses default session information ID (999) and order (1000)\r\n * - Access level is set to 4 (standard access)\r\n * - The userId from ofTheConcept is used for the connection\r\n * - The connection is tracked in the provided actions object for transaction management\r\n *\r\n * @see {@link CreateTheConnectionGeneral} for the underlying connection creation logic\r\n * @see {@link MakeTheTypeConceptApi} for how type concepts are created/retrieved\r\n */\r\nexport async function CreateConnection(ofTheConcept:Concept, toTheConcept:Concept, connectionTypeString: string,actions: InnerActions = {concepts: [], connections: []} ){\r\n let typeConcept = await MakeTheTypeConceptApi(connectionTypeString, 999);\r\n let userId : number = ofTheConcept.userId;\r\n return await CreateTheConnectionGeneral(ofTheConcept.id, ofTheConcept.userId, toTheConcept.id, toTheConcept.userId, typeConcept.id, 999,999, 1000, 4, userId, actions);\r\n}","/**\r\n * @module DeleteConnectionByType\r\n * @description Provides functions to delete and retrieve connections by their type\r\n */\r\n\r\nimport { GetAllLinkerConnectionsFromTheConcept } from \"../../Api/GetAllLinkerConnectionsFromTheConcept\";\r\nimport { DeleteConnectionById, GetConceptByTypeBulk } from \"../../app\";\r\n\r\n/**\r\n * Deletes all connections of specified types from a concept.\r\n * Finds connections matching the given linker types and deletes them.\r\n *\r\n * @async\r\n * @param {number} id - The concept ID whose connections should be deleted\r\n * @param {string[]} linkers - Array of connection type names to delete\r\n * @returns {Promise<boolean>} A promise that resolves to true if all deletions successful, false otherwise\r\n *\r\n * @example\r\n * ```typescript\r\n * const conceptId = 123;\r\n * const linkersToDelete = [\"follows\", \"likes\", \"shares\"];\r\n * const success = await DeleteConnectionByTypeBulk(conceptId, linkersToDelete);\r\n * if (success) {\r\n * console.log(\"All connections deleted successfully\");\r\n * }\r\n * ```\r\n *\r\n * @remarks\r\n * This function:\r\n * - Fetches all linker connections from the concept\r\n * - Gets concept objects for the specified linker type names\r\n * - Matches connections by typeId with linker concept IDs\r\n * - Deletes each matching connection\r\n * - Returns false if any deletion fails\r\n * - Uses bulk operations for efficiency\r\n */\r\nexport async function DeleteConnectionByTypeBulk(id: number, linkers: string[]){\r\n let isDeleted: boolean = true;\r\n let externalConnections = await GetAllLinkerConnectionsFromTheConcept(id);\r\n let typeConceptList = await GetConceptByTypeBulk(linkers);\r\n let toDelete: number[] = [];\r\n for(let i=0; i<externalConnections.length; i++){\r\n for(let j=0; j<typeConceptList.length; j++){\r\n if(externalConnections[i].typeId == typeConceptList[j].id){\r\n toDelete.push(externalConnections[i].id);\r\n }\r\n }\r\n\r\n }\r\n\r\n for(let i=0; i<toDelete.length; i++){\r\n let deleted = await DeleteConnectionById(toDelete[i]);\r\n isDeleted = isDeleted && deleted;\r\n }\r\n\r\n return isDeleted;\r\n\r\n}\r\n\r\n\r\n/**\r\n * Retrieves all connection IDs of specified types from a concept without deleting them.\r\n * Useful for querying which connections exist before performing operations.\r\n *\r\n * @async\r\n * @param {number} id - The concept ID whose connections should be retrieved\r\n * @param {string[]} linkers - Array of connection type names to find\r\n * @returns {Promise<number[]>} A promise that resolves to array of matching connection IDs\r\n *\r\n * @example\r\n * ```typescript\r\n * const conceptId = 123;\r\n * const linkersToFind = [\"follows\", \"likes\"];\r\n * const connectionIds = await GetConnectionByTypeBulk(conceptId, linkersToFind);\r\n * // connectionIds = [101, 102, 103, 104]\r\n * console.log(`Found ${connectionIds.length} connections`);\r\n * ```\r\n *\r\n * @remarks\r\n * This function:\r\n * - Similar to DeleteConnectionByTypeBulk but only retrieves IDs\r\n * - Does not modify any data\r\n * - Returns empty array if no matching connections found\r\n * - Useful for counting or inspecting connections before deletion\r\n * - Can be used to check connection existence\r\n */\r\nexport async function GetConnectionByTypeBulk(id: number, linkers:string[]){\r\n let externalConnections = await GetAllLinkerConnectionsFromTheConcept(id);\r\n let typeConceptList = await GetConceptByTypeBulk(linkers);\r\n let toDelete: number[] = [];\r\n for(let i=0; i<externalConnections.length; i++){\r\n for(let j=0; j<typeConceptList.length; j++){\r\n if(externalConnections[i].typeId == typeConceptList[j].id){\r\n toDelete.push(externalConnections[i].id);\r\n }\r\n }\r\n\r\n }\r\n return toDelete;\r\n\r\n}\r\n","/**\r\n * @module GetAllConnectionByType\r\n * @description Provides functions to retrieve connections filtered by type and direction\r\n */\r\n\r\nimport { GetAllLinkerConnectionsFromTheConcept } from \"../../Api/GetAllLinkerConnectionsFromTheConcept\";\r\nimport { GetAllLinkerConnectionsToTheConcept } from \"../../Api/GetAllLinkerConnectionsToTheConcept\";\r\nimport { Connection, ConnectionData, GetConceptByCharacter, MakeTheTypeConceptApi } from \"../../app\";\r\n\r\n/**\r\n * Retrieves all connections of a specific type from or to a concept.\r\n * Supports both forward (from concept) and reverse (to concept) direction.\r\n *\r\n * @async\r\n * @param {number} id - The concept ID to query connections for\r\n * @param {string} linker - The connection type name to filter by\r\n * @param {boolean} [reverse=false] - If true, returns connections TO the concept; if false, returns connections FROM the concept\r\n * @returns {Promise<Connection[]>} A promise that resolves to array of matching Connection objects\r\n *\r\n * @example\r\n * ```typescript\r\n * // Get all \"follows\" connections FROM concept 123\r\n * const followsFrom = await GetAllTheConnectionsByTypeAndOfTheConcept(123, \"follows\", false);\r\n *\r\n * // Get all \"follows\" connections TO concept 123 (reverse)\r\n * const followsTo = await GetAllTheConnectionsByTypeAndOfTheConcept(123, \"follows\", true);\r\n * ```\r\n *\r\n * @remarks\r\n * This function:\r\n * - Forward direction (reverse=false): Returns connections where concept is ofTheConceptId\r\n * - Reverse direction (reverse=true): Returns connections where concept is toTheConceptId\r\n * - Creates or retrieves the linker concept by type name\r\n * - Filters connections by matching typeId\r\n * - Caches forward connections in ConnectionData\r\n * - Returns empty array if no matching connections found\r\n */\r\nexport async function GetAllTheConnectionsByTypeAndOfTheConcept(id: number, linker: string, reverse: boolean = false){\r\n let toDelete: Connection[] = [];\r\n\r\n if(reverse){\r\n let externalConnections = await GetAllLinkerConnectionsToTheConcept(id);\r\n let concept = await MakeTheTypeConceptApi(linker,999);\r\n\r\n for(let i=0; i<externalConnections.length; i++){\r\n if(externalConnections[i].typeId == concept.id){\r\n toDelete.push(externalConnections[i]);\r\n }\r\n }\r\n }\r\n else{\r\n let externalConnections = await GetAllLinkerConnectionsFromTheConcept(id);\r\n for(let i=0 ; i< externalConnections.length; i++){\r\n ConnectionData.AddConnection(externalConnections[i]);\r\n }\r\n let concept = await MakeTheTypeConceptApi(linker,999);\r\n for(let i=0; i<externalConnections.length; i++){\r\n if(externalConnections[i].typeId == concept.id){\r\n toDelete.push(externalConnections[i]);\r\n }\r\n }\r\n }\r\n\r\n return toDelete;\r\n}\r\n\r\n\r\n/**\r\n * Retrieves specific connections between two concepts with a given linker type.\r\n * Filters connections to match both the source, destination, and type.\r\n *\r\n * @async\r\n * @param {number} ofTheConceptId - The source concept ID\r\n * @param {number} toTheConceptId - The destination concept ID\r\n * @param {string} linker - The connection type name\r\n * @param {boolean} [reverse=false] - If true, swaps the direction (queries from toTheConceptId)\r\n * @returns {Promise<Connection[]>} A promise that resolves to array of matching connections\r\n *\r\n * @example\r\n * ```typescript\r\n * // Find all \"follows\" connections from concept 123 to concept 456\r\n * const connections = await GiveConnection(123, 456, \"follows\", false);\r\n *\r\n * // Find all \"follows\" connections from 456 to 123 (reverse direction)\r\n * const reverseConnections = await GiveConnection(123, 456, \"follows\", true);\r\n * ```\r\n *\r\n * @remarks\r\n * This function:\r\n * - First uses GetAllTheConnectionsByTypeAndOfTheConcept to get typed connections\r\n * - Then filters by the destination concept ID\r\n * - Forward (reverse=false): Returns connections from ofTheConceptId to toTheConceptId\r\n * - Reverse (reverse=true): Returns connections from toTheConceptId to ofTheConceptId\r\n * - Useful for finding specific connection instances between two concepts\r\n * - Returns empty array if no matching connections exist\r\n */\r\nexport async function GiveConnection(ofTheConceptId: number, toTheConceptId:number, linker: string, reverse: boolean = false){\r\n let toDelete: Connection[] = [];\r\n let filteredConnections: Connection[] = [];\r\n\r\n if(reverse){\r\n toDelete = await GetAllTheConnectionsByTypeAndOfTheConcept(toTheConceptId, linker, reverse);\r\n }\r\n else{\r\n toDelete = await GetAllTheConnectionsByTypeAndOfTheConcept(ofTheConceptId, linker, reverse);\r\n }\r\n\r\n if(reverse){\r\n for(let i=0; i<toDelete.length; i++){\r\n if(toDelete[i].ofTheConceptId == ofTheConceptId){\r\n filteredConnections.push(toDelete[i]);\r\n }\r\n }\r\n }\r\n else{\r\n for(let i=0; i<toDelete.length; i++){\r\n if(toDelete[i].toTheConceptId == toTheConceptId){\r\n filteredConnections.push(toDelete[i]);\r\n }\r\n }\r\n }\r\n return filteredConnections;\r\n}","/**\r\n * @fileoverview Concept deletion service for the CCS-JS system.\r\n * This module provides comprehensive functionality for deleting concepts from the system,\r\n * including removal from all cache structures (binary trees, type trees, character trees),\r\n * local database cleanup, and backend synchronization.\r\n * @module Services/DeleteConcept\r\n */\r\n\r\nimport DeleteTheConcept from \"../Api/DeleteTheConcept\";\r\nimport { BinaryCharacterTree } from \"../DataStructures/BinaryCharacterTree\";\r\nimport { BinaryTree } from \"../DataStructures/BinaryTree\";\r\nimport { BinaryTypeTree } from \"../DataStructures/BinaryTypeTree\";\r\nimport { removeFromDatabase } from \"../Database/NoIndexDb\";\r\nimport GetTheConcept from \"./GetTheConcept\";\r\n\r\n/**\r\n * Deletes a concept from the entire CCS-JS system, including all caches and the backend.\r\n *\r\n * This function performs a comprehensive deletion of a concept by removing it from multiple\r\n * data structures and storage layers:\r\n * 1. Retrieves the concept to get its metadata (typeId, characterValue)\r\n * 2. Removes the concept from the main BinaryTree index\r\n * 3. Removes it from the BinaryTypeTree (type-based indexing)\r\n * 4. Removes it from the BinaryCharacterTree (character-based indexing)\r\n * 5. Removes it from the local IndexedDB database\r\n * 6. Deletes it from the backend server\r\n *\r\n * This ensures complete cleanup across all layers of the application, maintaining data\r\n * consistency and preventing orphaned references. The deletion is performed in a specific\r\n * order to ensure safe removal from all dependent structures.\r\n *\r\n * @param id - The unique identifier of the concept to delete\r\n * @param token - Optional authentication token for backend deletion. If not provided,\r\n * the function will attempt deletion without authentication\r\n * @returns A promise that resolves to a boolean indicating whether the backend deletion was successful\r\n *\r\n * @example\r\n * ```typescript\r\n * // Delete a concept with authentication\r\n * import { DeleteConceptById } from './DeleteConcept';\r\n *\r\n * const conceptId = 12345;\r\n * const authToken = \"user-auth-token-xyz\";\r\n *\r\n * const isDeleted = await DeleteConceptById(conceptId, authToken);\r\n * if (isDeleted) {\r\n * console.log(\"Concept successfully deleted from all systems\");\r\n * } else {\r\n * console.log(\"Backend deletion failed, but local caches cleared\");\r\n * }\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Delete a concept without authentication token\r\n * const conceptId = 67890;\r\n * const result = await DeleteConceptById(conceptId);\r\n * console.log(`Deletion status: ${result}`);\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Delete multiple concepts in sequence\r\n * const conceptIds = [123, 456, 789];\r\n * const authToken = \"user-token\";\r\n *\r\n * for (const id of conceptIds) {\r\n * const deleted = await DeleteConceptById(id, authToken);\r\n * if (!deleted) {\r\n * console.error(`Failed to delete concept ${id}`);\r\n * }\r\n * }\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Delete concept with error handling\r\n * try {\r\n * const conceptId = 999;\r\n * const isDeleted = await DeleteConceptById(conceptId, \"auth-token\");\r\n *\r\n * if (isDeleted) {\r\n * // Update UI to reflect deletion\r\n * updateConceptList();\r\n * }\r\n * } catch (error) {\r\n * console.error(\"Error during concept deletion:\", error);\r\n * }\r\n * ```\r\n *\r\n * @remarks\r\n * Important implementation details and considerations:\r\n *\r\n * **Deletion Order:**\r\n * The function follows a specific deletion sequence:\r\n * 1. First retrieves concept data (needed for type and character indices)\r\n * 2. Removes from main binary tree (ID-based index)\r\n * 3. Removes from type tree (type-based index)\r\n * 4. Removes from character tree (character-based index)\r\n * 5. Removes from local database (IndexedDB)\r\n * 6. Finally deletes from backend server\r\n *\r\n * **Cache Consistency:**\r\n * - Removes the concept from all three binary tree structures\r\n * - BinaryTree: Main ID-based concept index\r\n * - BinaryTypeTree: Type-categorized concept index\r\n * - BinaryCharacterTree: Character/name-based concept index\r\n * - This ensures no dangling references remain in any cache\r\n *\r\n * **Local Database:**\r\n * - Uses removeFromDatabase to clear from IndexedDB\r\n * - This is synchronous local storage cleanup\r\n * - Ensures offline-first capability remains consistent\r\n *\r\n * **Backend Synchronization:**\r\n * - Calls DeleteTheConcept API to remove from server\r\n * - Uses optional authentication token\r\n * - Returns backend deletion status\r\n * - Local cleanup happens regardless of backend success\r\n *\r\n * **Error Handling:**\r\n * - If GetTheConcept fails, the function will throw\r\n * - Tree removal operations are awaited but may not throw\r\n * - Backend deletion status is returned but doesn't affect local cleanup\r\n * - Consider wrapping in try-catch for production use\r\n *\r\n * **Side Effects:**\r\n * - Permanently removes concept from all storage layers\r\n * - Cannot be undone without re-creating the concept\r\n * - May orphan connections that reference this concept\r\n * - Consider deleting associated connections first\r\n *\r\n * **Performance:**\r\n * - Multiple async operations performed sequentially\r\n * - May take longer for concepts with complex relationships\r\n * - Consider using connection cleanup functions before deletion\r\n *\r\n * @see {@link DeleteTheConcept} for backend deletion API\r\n * @see {@link GetTheConcept} for concept retrieval\r\n * @see {@link BinaryTree} for main concept indexing\r\n * @see {@link BinaryTypeTree} for type-based indexing\r\n * @see {@link BinaryCharacterTree} for character-based indexing\r\n * @see {@link DeleteConnectionById} for deleting associated connections\r\n */\r\nexport async function DeleteConceptById(id:number, token:string = \"\"){\r\n var concept = await GetTheConcept(id);\r\n await BinaryTree.removeNodeFromTree(id);\r\n var typeId = concept.typeId;\r\n var character = concept.characterValue;\r\n await BinaryTypeTree.removeTypeConcept(typeId,id);\r\n await BinaryCharacterTree.removeNodeByCharacter(character,id);\r\n removeFromDatabase(\"concept\",id);\r\n let isDeleted = await DeleteTheConcept(id, token);\r\n return isDeleted;\r\n}","/**\r\n * @fileoverview Connection deletion service for the CCS-JS system.\r\n * This module provides functionality for deleting connections between concepts, supporting both\r\n * individual and bulk deletion operations. It handles removal from cache structures, local\r\n * database, and backend synchronization to maintain system consistency.\r\n * @module Services/DeleteConnection\r\n */\r\n\r\nimport DeleteTheConnectionBulkApi from \"../Api/DeleteConnectionApiBulk\";\r\nimport DeleteTheConnection from \"../Api/DeleteTheConnection\";\r\nimport { ConnectionBinaryTree } from \"../DataStructures/ConnectionBinaryTree/ConnectionBinaryTree\";\r\nimport { ConnectionTypeTree } from \"../DataStructures/ConnectionBinaryTree/ConnectionTypeTree\";\r\nimport { removeFromDatabase } from \"../Database/NoIndexDb\";\r\nimport {GetConnectionById} from \"./GetConnections\";\r\n\r\n/**\r\n * Deletes a single connection from the entire CCS-JS system.\r\n *\r\n * This function performs comprehensive deletion of a connection by removing it from:\r\n * 1. The backend server via API call\r\n * 2. The local IndexedDB database\r\n * 3. The ConnectionBinaryTree (main ID-based index)\r\n * 4. The ConnectionTypeTree (type-based index)\r\n *\r\n * The function first retrieves the connection to obtain its metadata (particularly the typeId),\r\n * then performs deletion across all storage and indexing layers to maintain consistency.\r\n *\r\n * @param id - The unique identifier of the connection to delete\r\n * @param token - Optional authentication token for backend deletion. If empty, will attempt\r\n * deletion without authentication\r\n * @returns A promise that resolves to a boolean indicating whether the backend deletion was successful\r\n *\r\n * @example\r\n * ```typescript\r\n * // Delete a connection with authentication\r\n * import { DeleteConnectionById } from './DeleteConnection';\r\n *\r\n * const connectionId = 12345;\r\n * const authToken = \"user-auth-token-xyz\";\r\n *\r\n * const isDeleted = await DeleteConnectionById(connectionId, authToken);\r\n * if (isDeleted) {\r\n * console.log(\"Connection deleted successfully\");\r\n * } else {\r\n * console.log(\"Backend deletion failed, but local cleanup completed\");\r\n * }\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Delete connection without authentication token\r\n * const result = await DeleteConnectionById(54321);\r\n * console.log(`Deletion status: ${result}`);\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Delete connection as part of composition update\r\n * const oldConnections = [123, 456, 789];\r\n *\r\n * for (const connId of oldConnections) {\r\n * await DeleteConnectionById(connId, userToken);\r\n * }\r\n * ```\r\n *\r\n * @remarks\r\n * **Deletion Process:**\r\n * - Retrieves connection first to access typeId for tree removal\r\n * - Backend deletion is performed before local cleanup\r\n * - Local cleanup occurs regardless of backend deletion success\r\n * - Returns backend deletion status\r\n *\r\n * **Cache Consistency:**\r\n * - Removes from ConnectionBinaryTree (main index)\r\n * - Removes from ConnectionTypeTree (type-based index)\r\n * - Ensures no dangling references in memory\r\n *\r\n * **Data Persistence:**\r\n * - Removes from IndexedDB for offline consistency\r\n * - Backend deletion provides server-side cleanup\r\n *\r\n * @see {@link DeleteTheConnection} for backend deletion API\r\n * @see {@link GetConnectionById} for connection retrieval\r\n * @see {@link DeleteConnectionByIdBulk} for bulk deletion operations\r\n * @see {@link ConnectionBinaryTree} for main connection indexing\r\n * @see {@link ConnectionTypeTree} for type-based indexing\r\n */\r\nexport async function DeleteConnectionById(id:number, token:string=\"\"){\r\n let isDeleted:boolean = false;\r\n var connection = await GetConnectionById(id);\r\n isDeleted = await DeleteTheConnection(id, token);\r\n removeFromDatabase(\"connection\",id);\r\n ConnectionBinaryTree.removeNodeFromTree(id);\r\n ConnectionTypeTree.removeTypeConcept(connection.typeId,id);\r\n return isDeleted;\r\n}\r\n\r\n/**\r\n * Deletes multiple connections in bulk from the CCS-JS system.\r\n *\r\n * This function provides optimized bulk deletion of connections by:\r\n * 1. Making a single API call to delete all connections at once on the backend\r\n * 2. Removing each connection from the ConnectionBinaryTree cache\r\n * 3. Only processing positive IDs (skipping local/temporary connections)\r\n *\r\n * Bulk deletion is significantly more efficient than individual deletions when\r\n * removing multiple connections, as it reduces network overhead and API calls.\r\n * The function currently performs a lighter cleanup compared to single deletion,\r\n * focusing on the main binary tree index.\r\n *\r\n * @param ids - Array of connection IDs to delete. Can include negative (local) IDs which will be skipped\r\n * @returns A promise that resolves to a boolean indicating whether the bulk backend deletion was successful\r\n *\r\n * @example\r\n * ```typescript\r\n * // Delete multiple connections at once\r\n * import { DeleteConnectionByIdBulk } from './DeleteConnection';\r\n *\r\n * const connectionIds = [123, 456, 789, 1011];\r\n * const isDeleted = await DeleteConnectionByIdBulk(connectionIds);\r\n *\r\n * if (isDeleted) {\r\n * console.log(\"All connections deleted successfully\");\r\n * } else {\r\n * console.log(\"Bulk deletion failed\");\r\n * }\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Delete connections when updating composition\r\n * const oldConnectionIds = composition.connections\r\n * .filter(conn => shouldDelete(conn))\r\n * .map(conn => conn.id);\r\n *\r\n * if (oldConnectionIds.length > 0) {\r\n * await DeleteConnectionByIdBulk(oldConnectionIds);\r\n * }\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Delete connections with mixed local and persisted IDs\r\n * const connectionIds = [123, -456, 789, -1011];\r\n * // Only 123 and 789 will be deleted (positive IDs)\r\n * const result = await DeleteConnectionByIdBulk(connectionIds);\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Handle bulk deletion with error checking\r\n * try {\r\n * const idsToDelete = getConnectionsToRemove();\r\n * const success = await DeleteConnectionByIdBulk(idsToDelete);\r\n *\r\n * if (success) {\r\n * updateUIAfterDeletion();\r\n * } else {\r\n * showErrorMessage(\"Failed to delete connections\");\r\n * }\r\n * } catch (error) {\r\n * console.error(\"Error during bulk deletion:\", error);\r\n * }\r\n * ```\r\n *\r\n * @remarks\r\n * Important implementation details:\r\n *\r\n * **Performance Optimization:**\r\n * - Single API call for all deletions (not one per connection)\r\n * - Significantly faster than multiple individual DeleteConnectionById calls\r\n * - Recommended for deleting 2 or more connections\r\n *\r\n * **Partial Cleanup:**\r\n * - Only removes from ConnectionBinaryTree, not ConnectionTypeTree\r\n * - Does not remove from local IndexedDB (commented out)\r\n * - Does not retrieve connection objects to save on queries\r\n * - This is intentional for performance but may leave some cache inconsistencies\r\n *\r\n * **ID Filtering:**\r\n * - Only processes positive IDs (id > 0)\r\n * - Negative IDs represent local/temporary connections not yet persisted\r\n * - Local connections don't exist on backend so they're skipped\r\n *\r\n * **Atomic Backend Operation:**\r\n * - Backend deletion is all-or-nothing via the bulk API\r\n * - If backend deletion succeeds, all local cleanup is performed\r\n * - If backend deletion fails, no local cleanup occurs\r\n *\r\n * **Use Cases:**\r\n * - Cleaning up connections when updating compositions\r\n * - Removing all connections to a deleted concept\r\n * - Batch operations in composition management\r\n * - Performance-critical deletion scenarios\r\n *\r\n * **Trade-offs:**\r\n * - Faster but less thorough cleanup than individual deletions\r\n * - May leave some entries in ConnectionTypeTree\r\n * - May leave some entries in IndexedDB\r\n * - Acceptable for most use cases where cache will be rebuilt\r\n *\r\n * **Commented Code:**\r\n * The function contains commented-out code for:\r\n * - Connection retrieval: `let connection = await GetConnectionById(id);`\r\n * - Database cleanup: `removeFromDatabase(\"connection\",id);`\r\n * These may be intentionally disabled for performance reasons\r\n *\r\n * @see {@link DeleteTheConnectionBulkApi} for bulk backend deletion API\r\n * @see {@link DeleteConnectionById} for single connection deletion with full cleanup\r\n * @see {@link ConnectionBinaryTree} for main connection indexing\r\n * @see {@link ConnectionTypeTree} for type-based connection indexing\r\n */\r\nexport async function DeleteConnectionByIdBulk(ids:number[]){\r\n let isDeleted = await DeleteTheConnectionBulkApi(ids);\r\n if(isDeleted){\r\n for(let i=0; i<ids.length; i++){\r\n let id= ids[i];\r\n if(id > 0){\r\n // let connection = await GetConnectionById(id);\r\n //removeFromDatabase(\"connection\",id);\r\n ConnectionBinaryTree.removeNodeFromTree(id);\r\n }\r\n }\r\n }\r\n\r\n\r\n\r\n return isDeleted;\r\n}","/**\r\n * @fileoverview Concept discovery service from connections for the CCS-JS system.\r\n * This module provides functionality to identify and batch-load all concepts referenced by\r\n * a set of connections. This is essential for efficiently hydrating the concept cache when\r\n * working with compositions and connection graphs.\r\n * @module Services/FindConceptsFromConnection\r\n */\r\n\r\nimport { Connection } from \"../DataStructures/Connection\";\r\nimport { Concept } from \"../DataStructures/Concept\";\r\nimport { GetConceptBulk } from \"../Api/GetConceptBulk\";\r\n\r\n/**\r\n * Discovers and loads all unique concepts referenced by a list of connections.\r\n *\r\n * This function analyzes a list of connections to extract all unique concept IDs (both source\r\n * and target concepts) and loads them into the local cache via a single bulk API call. This is\r\n * a critical optimization function that ensures all concepts needed for a composition or\r\n * connection graph are available locally before processing.\r\n *\r\n * The function performs two main operations:\r\n * 1. Extracts all unique concept IDs from the connection list (both ofTheConceptId and toTheConceptId)\r\n * 2. Fetches all concepts in a single bulk operation and caches them locally\r\n *\r\n * This batch loading approach is significantly more efficient than fetching concepts individually\r\n * as they're needed, reducing network overhead and improving application performance.\r\n *\r\n * @param connectionList - Array of connections to analyze for concept references. Defaults to empty array.\r\n * @returns A promise that resolves when all concepts have been fetched and cached.\r\n * The function does not return the concepts directly; they are stored in the concept cache.\r\n *\r\n * @example\r\n * ```typescript\r\n * // Load concepts for a composition\r\n * import { FindConceptsFromConnections } from './FindConeceptsFromConnection';\r\n *\r\n * const compositionConnections = await GetAllConnectionsOfComposition(123);\r\n * await FindConceptsFromConnections(compositionConnections);\r\n *\r\n * // Now all concepts are cached and can be retrieved synchronously\r\n * const concept = await GetTheConcept(456); // Fast cache lookup\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Prepare concepts for graph visualization\r\n * const connections = await FindConnectionsOfCompositionsBulkInMemory([100, 101, 102]);\r\n * await FindConceptsFromConnections(connections);\r\n *\r\n * // All concepts in the graph are now cached\r\n * connections.forEach(conn => {\r\n * const fromConcept = GetTheConceptSync(conn.ofTheConceptId);\r\n * const toConcept = GetTheConceptSync(conn.toTheConceptId);\r\n * renderConnection(fromConcept, toConcept);\r\n * });\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Hydrate cache before processing composition\r\n * async function loadCompositionWithConcepts(compositionId: number) {\r\n * // First, get all connections\r\n * const connections = await GetAllConnectionsOfComposition(compositionId);\r\n *\r\n * // Then, ensure all concepts are cached\r\n * await FindConceptsFromConnections(connections);\r\n *\r\n * // Now process the composition with all data locally available\r\n * return processComposition(connections);\r\n * }\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Handle empty connection list safely\r\n * const emptyConnections: Connection[] = [];\r\n * await FindConceptsFromConnections(emptyConnections);\r\n * // No API call made, function returns immediately\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Load concepts for multiple compositions\r\n * const compositionIds = [200, 201, 202];\r\n * const allConnections = await FindConnectionsOfCompositionsBulkInMemory(compositionIds);\r\n *\r\n * // Single bulk load for all concepts across all compositions\r\n * await FindConceptsFromConnections(allConnections);\r\n *\r\n * // All concepts are now available\r\n * console.log(\"All concepts loaded for compositions:\", compositionIds);\r\n * ```\r\n *\r\n * @remarks\r\n * Important implementation details and considerations:\r\n *\r\n * **Concept ID Extraction:**\r\n * - Extracts both ofTheConceptId (source concept) and toTheConceptId (target concept)\r\n * - Uses includes() to ensure uniqueness - no duplicate IDs in the final list\r\n * - Maintains insertion order of concept IDs\r\n * - Only adds IDs that haven't been seen before\r\n *\r\n * **Duplicate Prevention:**\r\n * - Checks if concept ID already exists in list before adding\r\n * - Prevents redundant API requests for the same concept\r\n * - Important when connections share common concepts\r\n * - Uses array.includes() which has O(n) complexity per check\r\n *\r\n * **Bulk Loading:**\r\n * - Makes a single API call via GetConceptBulk instead of individual requests\r\n * - Significantly reduces network overhead\r\n * - All concepts are fetched and cached in one operation\r\n * - More efficient for large connection sets\r\n *\r\n * **Cache Population:**\r\n * - GetConceptBulk automatically stores concepts in the local cache\r\n * - Concepts become available for synchronous retrieval after this function completes\r\n * - No need to manually cache the results\r\n * - Persists to IndexedDB for offline availability\r\n *\r\n * **Empty Input Handling:**\r\n * - Returns immediately if connectionList is empty (length === 0)\r\n * - No API call made for empty input\r\n * - Safe to call with empty arrays\r\n *\r\n * **No Return Value:**\r\n * - Function doesn't return the loaded concepts\r\n * - Concepts are stored in the global concept cache\r\n * - Access loaded concepts via GetTheConcept() or similar functions\r\n * - This is intentional for cache-based architecture\r\n *\r\n * **Performance Characteristics:**\r\n * - O(n*m) complexity for duplicate checking where n = connections, m = unique concepts\r\n * - Could be optimized with Set for better performance on large datasets\r\n * - Single API call regardless of number of concepts\r\n * - Network time dominates execution time\r\n *\r\n * **Performance Optimization Alternative:**\r\n * ```typescript\r\n * // More efficient approach using Set\r\n * const conceptIds = new Set<number>();\r\n * connectionList.forEach(conn => {\r\n * conceptIds.add(conn.ofTheConceptId);\r\n * conceptIds.add(conn.toTheConceptId);\r\n * });\r\n * await GetConceptBulk([...conceptIds]);\r\n * ```\r\n *\r\n * **Common Use Cases:**\r\n * - Loading concepts before rendering compositions\r\n * - Hydrating cache for offline-first operations\r\n * - Preparing data for graph analysis\r\n * - Ensuring all dependencies are cached before processing\r\n * - Optimizing batch operations\r\n *\r\n * **Integration Patterns:**\r\n * ```typescript\r\n * // Pattern 1: Composition loading\r\n * async function loadComposition(id: number) {\r\n * const connections = await getConnections(id);\r\n * await FindConceptsFromConnections(connections);\r\n * return buildCompositionObject(connections);\r\n * }\r\n *\r\n * // Pattern 2: Graph preparation\r\n * async function prepareGraph(compositionIds: number[]) {\r\n * const connections = await FindConnectionsOfCompositionsBulkInMemory(compositionIds);\r\n * await FindConceptsFromConnections(connections);\r\n * return buildGraph();\r\n * }\r\n * ```\r\n *\r\n * **Error Handling:**\r\n * - No explicit error handling in current implementation\r\n * - Will throw if GetConceptBulk fails\r\n * - Consider wrapping in try-catch for production use\r\n * - Failed bulk load means concepts won't be cached\r\n *\r\n * @see {@link GetConceptBulk} for bulk concept loading API\r\n * @see {@link Connection} for connection data structure\r\n * @see {@link Concept} for concept data structure\r\n * @see {@link FindConnectionsOfCompositionsBulkInMemory} for bulk connection retrieval\r\n * @see {@link GetTheConcept} for retrieving cached concepts\r\n */\r\nexport async function FindConceptsFromConnections(connectionList:Connection[] = []){\r\n var ConceptList:number[] = [];\r\n if(connectionList.length > 0){\r\n for(let i=0;i < connectionList.length; i++){\r\n\r\n if(!ConceptList.includes(connectionList[i].ofTheConceptId )){\r\n ConceptList.push(connectionList[i].ofTheConceptId);\r\n }\r\n if(!ConceptList.includes(connectionList[i].toTheConceptId)){\r\n ConceptList.push(connectionList[i].toTheConceptId);\r\n }\r\n\r\n }\r\n await GetConceptBulk(ConceptList);\r\n\r\n }\r\n\r\n}","/**\r\n * @fileoverview Bulk composition connection retrieval service for the CCS-JS system.\r\n * This module provides functionality to efficiently retrieve connections for multiple\r\n * compositions from local memory/cache, which is essential for performance optimization\r\n * when working with complex nested compositions.\r\n * @module Services/FindConnectionsOfCompositionBulkInMemory\r\n */\r\n\r\nimport { Connection } from \"../DataStructures/Connection\";\r\nimport { ConnectionData } from \"../DataStructures/ConnectionData\";\r\n\r\n/**\r\n * Retrieves all connections for multiple compositions from local memory in a single operation.\r\n *\r\n * This function is designed for efficient bulk retrieval of connections across multiple\r\n * compositions. Instead of making individual API calls or database queries for each composition,\r\n * it retrieves all connections from the local ConnectionData cache, aggregating results from\r\n * multiple compositions into a single array.\r\n *\r\n * The function iterates through each composition ID, fetches its connections from local cache,\r\n * and accumulates all connections into a unified list. This is particularly useful for:\r\n * - Loading nested composition structures\r\n * - Analyzing relationship graphs across multiple compositions\r\n * - Preparing data for bulk operations\r\n * - Optimizing performance when working with complex composition hierarchies\r\n *\r\n * @param composition_ids - Array of composition IDs to retrieve connections for. Defaults to empty array.\r\n * @returns A promise that resolves to an array containing all connections from all specified compositions.\r\n * The returned array combines connections from all compositions with potential duplicates\r\n * if the same connection belongs to multiple compositions.\r\n *\r\n * @example\r\n * ```typescript\r\n * // Retrieve connections for multiple related compositions\r\n * import { FindConnectionsOfCompositionsBulkInMemory } from './FindConnectionsOfCompositionBulkInMemory';\r\n *\r\n * const compositionIds = [123, 456, 789];\r\n * const allConnections = await FindConnectionsOfCompositionsBulkInMemory(compositionIds);\r\n *\r\n * console.log(`Found ${allConnections.length} total connections`);\r\n * // Returns all connections from compositions 123, 456, and 789\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Load nested composition structure\r\n * const mainComposition = await GetComposition(100);\r\n * const subcompositionIds = mainComposition.subcompositions; // [101, 102, 103]\r\n *\r\n * // Get all connections for the nested structure\r\n * const nestedConnections = await FindConnectionsOfCompositionsBulkInMemory(subcompositionIds);\r\n *\r\n * // Process all connections together\r\n * nestedConnections.forEach(conn => {\r\n * console.log(`Connection: ${conn.ofTheConceptId} -> ${conn.toTheConceptId}`);\r\n * });\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Analyze relationship graph across compositions\r\n * const compositionIds = [200, 201, 202];\r\n * const connections = await FindConnectionsOfCompositionsBulkInMemory(compositionIds);\r\n *\r\n * // Find all unique concepts involved\r\n * const conceptIds = new Set();\r\n * connections.forEach(conn => {\r\n * conceptIds.add(conn.ofTheConceptId);\r\n * conceptIds.add(conn.toTheConceptId);\r\n * });\r\n *\r\n * console.log(`Graph contains ${conceptIds.size} unique concepts`);\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Prepare data for bulk deletion\r\n * const compositionsToDelete = [301, 302, 303];\r\n * const connectionsToRemove = await FindConnectionsOfCompositionsBulkInMemory(compositionsToDelete);\r\n *\r\n * // Delete all connections in bulk\r\n * const connectionIds = connectionsToRemove.map(conn => conn.id);\r\n * await DeleteConnectionByIdBulk(connectionIds);\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Handle empty composition list\r\n * const emptyResult = await FindConnectionsOfCompositionsBulkInMemory([]);\r\n * console.log(emptyResult); // Returns: []\r\n * ```\r\n *\r\n * @remarks\r\n * Important implementation details and considerations:\r\n *\r\n * **Data Source:**\r\n * - Retrieves data from local cache (ConnectionData) only, not from backend\r\n * - Uses GetConnectionsOfCompositionLocal which accesses in-memory storage\r\n * - Does not make network requests or database queries\r\n * - Assumes connections are already cached locally\r\n *\r\n * **Performance Characteristics:**\r\n * - Significantly faster than making individual API calls for each composition\r\n * - Memory-efficient as it uses spread operator to accumulate results\r\n * - Sequential processing (not parallel) but from fast local cache\r\n * - Suitable for real-time operations without network latency\r\n *\r\n * **Connection Aggregation:**\r\n * - Uses spread operator (...) to merge connection arrays\r\n * - Maintains order: connections from first composition ID appear first\r\n * - May include duplicate connections if they belong to multiple compositions\r\n * - Does not deduplicate results\r\n *\r\n * **Duplicate Handling:**\r\n * - Same connection may appear multiple times if it's in multiple compositions\r\n * - Caller should deduplicate if needed using connection IDs\r\n * - Example deduplication: `const unique = [...new Map(connections.map(c => [c.id, c])).values()]`\r\n *\r\n * **Empty Input:**\r\n * - Returns empty array if composition_ids is empty\r\n * - No error thrown for empty input\r\n * - Safe to call with empty array\r\n *\r\n * **Async Behavior:**\r\n * - Function is async due to GetConnectionsOfCompositionLocal being async\r\n * - However, it processes compositions sequentially, not in parallel\r\n * - For better performance with many compositions, consider parallelizing\r\n *\r\n * **Error Handling:**\r\n * - No explicit error handling in current implementation\r\n * - Will throw if GetConnectionsOfCompositionLocal throws\r\n * - Consider wrapping in try-catch for production use\r\n *\r\n * **Use Cases:**\r\n * - Loading nested composition structures\r\n * - Building relationship graphs\r\n * - Preparing bulk operations\r\n * - Analyzing composition hierarchies\r\n * - Offline-first operations\r\n *\r\n * **Limitations:**\r\n * - Only works with cached data (must be loaded first)\r\n * - Does not fetch from backend if cache is empty\r\n * - May return stale data if cache isn't updated\r\n * - No automatic cache validation\r\n *\r\n * **Best Practices:**\r\n * ```typescript\r\n * // Ensure compositions are loaded first\r\n * await loadCompositionsIntoCache(compositionIds);\r\n * const connections = await FindConnectionsOfCompositionsBulkInMemory(compositionIds);\r\n *\r\n * // Deduplicate if needed\r\n * const uniqueConnections = [...new Map(connections.map(c => [c.id, c])).values()];\r\n * ```\r\n *\r\n * @see {@link ConnectionData.GetConnectionsOfCompositionLocal} for single composition connection retrieval\r\n * @see {@link Connection} for connection data structure\r\n * @see {@link FindConceptsFromConnections} for retrieving concepts from connection lists\r\n * @see {@link DeleteConnectionByIdBulk} for bulk connection deletion\r\n */\r\nexport async function FindConnectionsOfCompositionsBulkInMemory(composition_ids:number[] = []){\r\n var FinalConnectionList:Connection[] = [];\r\n for(let i=0; i< composition_ids.length; i++){\r\n var connectionList = await ConnectionData.GetConnectionsOfCompositionLocal(composition_ids[i]);\r\n FinalConnectionList.push(...connectionList);\r\n }\r\n return FinalConnectionList;\r\n\r\n}","/**\r\n * Composition Retrieval and Reconstruction Service\r\n *\r\n * This module provides comprehensive functionality for retrieving compositions (structured\r\n * concept graphs) and reconstructing them into JSON objects. It's the deserialization\r\n * counterpart to CreateTheComposition, converting graph structures back into hierarchical\r\n * data structures.\r\n *\r\n * The module offers multiple variants for different use cases:\r\n * - Basic composition retrieval (from API or memory)\r\n * - Composition with metadata (ID, timestamps)\r\n * - Composition with sub-composition IDs included\r\n * - Bulk operations and optimization strategies\r\n *\r\n * @module GetComposition\r\n */\r\n\r\nimport { GetConcept } from \"../Api/GetConcept\";\r\nimport { GetAllConnectionsOfComposition } from \"../Api/GetAllConnectionsOfComposition\";\r\nimport { Concept } from \"../DataStructures/Concept\";\r\nimport { ConceptsData } from \"../DataStructures/ConceptData\";\r\nimport { Connection } from \"../DataStructures/Connection\";\r\nimport { ConnectionData } from \"../DataStructures/ConnectionData\"\r\n\r\n/**\r\n * Retrieves a composition from the API and reconstructs it as a JSON object.\r\n *\r\n * This function fetches all connections that make up a composition from the API,\r\n * then recursively reconstructs the original hierarchical structure. It's the primary\r\n * function for deserializing compositions that were created using CreateTheComposition.\r\n *\r\n * The returned object has the composition's type as the root key, containing the\r\n * nested data structure.\r\n *\r\n * @param id - The ID of the root concept of the composition\r\n *\r\n * @returns A promise that resolves to an object with the composition data\r\n *\r\n * @example\r\n * ```typescript\r\n * // Retrieve a user profile composition\r\n * const composition = await GetComposition(12345);\r\n * console.log(composition);\r\n * // Output:\r\n * // {\r\n * // \"user_profile\": {\r\n * // \"name\": \"Alice Johnson\",\r\n * // \"age\": \"30\",\r\n * // \"address\": {\r\n * // \"street\": \"123 Main St\",\r\n * // \"city\": \"Springfield\"\r\n * // }\r\n * // }\r\n * // }\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Access specific fields in the composition\r\n * const bookData = await GetComposition(789);\r\n * const book = bookData[\"book\"];\r\n * console.log(\"Title:\", book.title);\r\n * console.log(\"Author:\", book.author);\r\n * console.log(\"ISBN:\", book.isbn);\r\n * ```\r\n *\r\n * @remarks\r\n * - Fetches all connections from the API (not from local cache)\r\n * - Recursively reconstructs the hierarchical structure\r\n * - The root key is the type of the root concept (e.g., \"book\", \"user_profile\")\r\n * - Numeric keys indicate array-like structures\r\n * - Leaf nodes contain their characterValue as strings\r\n * - Uses GetAllConnectionsOfComposition API for data fetching\r\n * - For better performance with cached data, use GetCompositionFromMemory\r\n *\r\n * @see {@link GetCompositionFromMemory} for cached/memory-based retrieval\r\n * @see {@link GetCompositionWithId} for including composition metadata\r\n * @see {@link CreateTheComposition} for the inverse operation (JSON to composition)\r\n * @see {@link recursiveFetch} for the reconstruction algorithm\r\n */\r\nexport async function GetComposition(id:number){\r\n var connectionList:Connection[] = [];\r\n var returnOutput: any = {};\r\n var connectionListString = await GetAllConnectionsOfComposition(id);\r\n connectionList = connectionListString as Connection[];\r\n //connectionList = ConnectionData.GetConnectionsOfComposition(id);\r\n var compositionList:number[] = [];\r\n\r\n for(var i=0; i<connectionList.length; i++){\r\n if(!compositionList.includes(connectionList[i].ofTheConceptId)){\r\n compositionList.push(connectionList[i].ofTheConceptId);\r\n }\r\n }\r\n\r\n var concept = await ConceptsData.GetConcept(id);\r\n if(concept.id == 0 && id != null && id != undefined){\r\n var conceptString = await GetConcept(id);\r\n concept = conceptString as Concept;\r\n }\r\n var output = await recursiveFetch(id, connectionList, compositionList);\r\n var mainString = concept?.type?.characterValue ?? \"\";\r\n returnOutput[mainString] = output;\r\n return returnOutput;\r\n}\r\n\r\n/**\r\n * Retrieves a composition with sub-composition IDs embedded in the structure.\r\n *\r\n * Similar to GetComposition, but includes \"id\" fields for all sub-compositions\r\n * within the returned JSON structure. This is useful when you need to reference\r\n * or update specific parts of the composition later.\r\n *\r\n * @param id - The ID of the root concept of the composition\r\n *\r\n * @returns A promise that resolves to an object with the composition data including IDs\r\n *\r\n * @example\r\n * ```typescript\r\n * // Get composition with IDs for updating specific nodes\r\n * const composition = await GetCompositionWithAllIds(12345);\r\n * console.log(composition);\r\n * // Output includes id fields:\r\n * // {\r\n * // \"user_profile\": {\r\n * // \"id\": 12345,\r\n * // \"address\": {\r\n * // \"id\": 12346,\r\n * // \"street\": \"123 Main St\"\r\n * // }\r\n * // }\r\n * // }\r\n * ```\r\n *\r\n * @remarks\r\n * - Each sub-composition node includes its concept ID\r\n * - Uses recursiveFetchWithSubCompositions instead of recursiveFetch\r\n * - Useful for selective updates or references to composition parts\r\n *\r\n * @see {@link GetComposition} for standard retrieval without IDs\r\n * @see {@link recursiveFetchWithSubCompositions} for the reconstruction algorithm\r\n */\r\nexport async function GetCompositionWithAllIds(id:number){\r\n var connectionList:Connection[] = [];\r\n var returnOutput: any = {};\r\n var connectionListString = await GetAllConnectionsOfComposition(id);\r\n connectionList = connectionListString as Connection[];\r\n //connectionList = ConnectionData.GetConnectionsOfComposition(id);\r\n var compositionList:number[] = [];\r\n\r\n for(var i=0; i<connectionList.length; i++){\r\n if(!compositionList.includes(connectionList[i].ofTheConceptId)){\r\n compositionList.push(connectionList[i].ofTheConceptId);\r\n }\r\n }\r\n\r\n var concept = await ConceptsData.GetConcept(id);\r\n if(concept.id == 0 && id != null && id != undefined){\r\n var conceptString = await GetConcept(id);\r\n concept = conceptString as Concept;\r\n }\r\n var output = await recursiveFetchWithSubCompositions(id, connectionList, compositionList);\r\n var mainString = concept?.type?.characterValue ?? \"\";\r\n returnOutput[mainString] = output;\r\n return returnOutput;\r\n}\r\n\r\n/**\r\n * Retrieves a composition from local memory cache without API calls.\r\n *\r\n * This optimized version retrieves composition data from the local ConnectionData\r\n * cache rather than making API calls. It's significantly faster but requires that\r\n * the connections have been previously cached (e.g., via bulk prefetch operations).\r\n *\r\n * @param id - The ID of the root concept of the composition\r\n *\r\n * @returns A promise that resolves to an object with the composition data\r\n *\r\n * @example\r\n * ```typescript\r\n * // After bulk prefetch, retrieve from memory\r\n * await GetAllConnectionsOfCompositionBulk([123, 456, 789]);\r\n *\r\n * // Now quickly retrieve from cache\r\n * const comp1 = await GetCompositionFromMemory(123);\r\n * const comp2 = await GetCompositionFromMemory(456);\r\n * const comp3 = await GetCompositionFromMemory(789);\r\n * // Much faster than individual API calls\r\n * ```\r\n *\r\n * @remarks\r\n * - Only works if connections are already cached in ConnectionData\r\n * - Returns empty or incomplete data if connections aren't cached\r\n * - Use after bulk prefetch operations for optimal performance\r\n * - Much faster than GetComposition for batch operations\r\n *\r\n * @see {@link GetComposition} for API-based retrieval\r\n * @see {@link GetAllConnectionsOfCompositionBulk} for bulk prefetching\r\n */\r\nexport async function GetCompositionFromMemory(id:number){\r\n var connectionList:Connection[] = [];\r\n var returnOutput: any = {};\r\n connectionList = await ConnectionData.GetConnectionsOfCompositionLocal(id);\r\n //connectionList = ConnectionData.GetConnectionsOfComposition(id);\r\n var compositionList:number[] = [];\r\n\r\n for(var i=0; i<connectionList.length; i++){\r\n if(!compositionList.includes(connectionList[i].ofTheConceptId)){\r\n compositionList.push(connectionList[i].ofTheConceptId);\r\n }\r\n }\r\n\r\n var concept = await ConceptsData.GetConcept(id);\r\n if(concept.id == 0 && id != null && id != undefined){\r\n var conceptString = await GetConcept(id);\r\n concept = conceptString as Concept;\r\n }\r\n var output = await recursiveFetch(id, connectionList, compositionList);\r\n var mainString = concept?.type?.characterValue ?? \"\";\r\n returnOutput[mainString] = output;\r\n return returnOutput;\r\n}\r\n\r\n/**\r\n * Retrieves a composition from memory with metadata wrapper.\r\n *\r\n * Returns composition data wrapped in an object that includes the root concept's\r\n * ID and creation timestamp along with the data. This is useful for tracking\r\n * when compositions were created and referencing them by ID.\r\n *\r\n * @param id - The ID of the root concept of the composition\r\n *\r\n * @returns A promise that resolves to an object with id, created_at, and data fields\r\n *\r\n * @example\r\n * ```typescript\r\n * const result = await GetCompositionWithIdFromMemory(12345);\r\n * console.log(result);\r\n * // Output:\r\n * // {\r\n * // id: 12345,\r\n * // created_at: \"1/15/2024 3:45:30 PM\",\r\n * // data: {\r\n * // \"book\": {\r\n * // \"title\": \"Example Book\",\r\n * // \"author\": \"Jane Doe\"\r\n * // }\r\n * // }\r\n * // }\r\n * ```\r\n *\r\n * @remarks\r\n * - Requires connections to be cached in memory\r\n * - Includes root concept's entryTimeStamp as created_at\r\n * - Data structure: { id, created_at, data }\r\n *\r\n * @see {@link GetCompositionFromMemory} for unwrapped retrieval\r\n * @see {@link GetCompositionWithId} for API-based version\r\n */\r\nexport async function GetCompositionWithIdFromMemory(id:number){\r\n var connectionList:Connection[] = [];\r\n var returnOutput: any = {};\r\n connectionList = await ConnectionData.GetConnectionsOfCompositionLocal(id);\r\n var compositionList:number[] = [];\r\n\r\n for(var i=0; i<connectionList.length; i++){\r\n if(!compositionList.includes(connectionList[i].ofTheConceptId)){\r\n compositionList.push(connectionList[i].ofTheConceptId);\r\n }\r\n }\r\n var concept = await ConceptsData.GetConcept(id);\r\n if(concept.id == 0 && id != null && id != undefined){\r\n var conceptString = await GetConcept(id);\r\n concept = conceptString as Concept;\r\n }\r\n var output = await recursiveFetch(id, connectionList, compositionList);\r\n var mainString = concept?.type?.characterValue ?? \"\";\r\n returnOutput[mainString] = output;\r\n var FinalReturn: any = {};\r\n FinalReturn['created_at'] = concept.entryTimeStamp;\r\n FinalReturn['data'] = returnOutput;\r\n FinalReturn['id'] = id;\r\n\r\n return FinalReturn;\r\n}\r\n\r\n/**\r\n * Retrieves a composition from memory with ID and timestamp metadata.\r\n *\r\n * Similar to GetCompositionWithIdFromMemory but with a slightly different\r\n * field order in the returned object. This variant exists for backward\r\n * compatibility with different parts of the codebase.\r\n *\r\n * @param id - The ID of the root concept of the composition\r\n *\r\n * @returns A promise that resolves to an object with data, id, and created_at fields\r\n *\r\n * @remarks\r\n * - Field order: data, id, created_at (vs id, created_at, data in other variant)\r\n * - Otherwise identical to GetCompositionWithIdFromMemory\r\n *\r\n * @see {@link GetCompositionWithIdFromMemory} for the primary variant\r\n */\r\nexport async function GetCompositionWithIdAndDateFromMemory(id:number){\r\n var connectionList:Connection[] = [];\r\n var returnOutput: any = {};\r\n connectionList = await ConnectionData.GetConnectionsOfCompositionLocal(id);\r\n\r\n var compositionList:number[] = [];\r\n\r\n for(var i=0; i<connectionList.length; i++){\r\n if(!compositionList.includes(connectionList[i].ofTheConceptId)){\r\n compositionList.push(connectionList[i].ofTheConceptId);\r\n }\r\n }\r\n var concept = await ConceptsData.GetConcept(id);\r\n if(concept.id == 0 && id != null && id != undefined){\r\n var conceptString = await GetConcept(id);\r\n concept = conceptString as Concept;\r\n }\r\n var output = await recursiveFetch(id, connectionList, compositionList);\r\n var mainString = concept?.type?.characterValue ?? \"\";\r\n returnOutput[mainString] = output;\r\n var FinalReturn: any = {};\r\n FinalReturn['data'] = returnOutput;\r\n FinalReturn['id'] = id;\r\n FinalReturn['created_at'] = concept.entryTimeStamp;\r\n\r\n\r\n return FinalReturn;\r\n}\r\n\r\n/**\r\n * Reconstructs a composition from a provided list of connections.\r\n *\r\n * This specialized function allows you to reconstruct a composition when you\r\n * already have the connections in memory. Useful for optimized bulk operations\r\n * where connections have been fetched once and reused for multiple compositions.\r\n *\r\n * @param id - The ID of the root concept of the composition\r\n * @param connectionList - Pre-fetched array of Connection objects\r\n *\r\n * @returns A promise that resolves to an object with id, created_at, and data fields\r\n *\r\n * @example\r\n * ```typescript\r\n * // Fetch connections once for multiple compositions\r\n * const connections = await GetAllConnectionsOfCompositionBulk([123, 456]);\r\n *\r\n * // Reconstruct multiple compositions from the same connection set\r\n * const comp1 = await GetCompositionWithIdFromMemoryFromConnections(123, connections);\r\n * const comp2 = await GetCompositionWithIdFromMemoryFromConnections(456, connections);\r\n * ```\r\n *\r\n * @remarks\r\n * - Most efficient when connections are shared across compositions\r\n * - Extracts composition list from provided connections\r\n * - No API or cache lookups for connections\r\n *\r\n * @see {@link GetCompositionFromConnectionsWithDataId} for newer variant\r\n */\r\nexport async function GetCompositionWithIdFromMemoryFromConnections(id:number, connectionList:Connection[]){\r\n // var connectionList:Connection[] = [];\r\n var returnOutput: any = {};\r\n //connectionList = await ConnectionData.GetConnectionsOfCompositionLocal(id);\r\n\r\n var compositionList:number[] = [];\r\n\r\n for(var i=0; i<connectionList.length; i++){\r\n if(!compositionList.includes(connectionList[i].ofTheConceptId)){\r\n compositionList.push(connectionList[i].ofTheConceptId);\r\n }\r\n }\r\n\r\n var concept = await ConceptsData.GetConcept(id);\r\n if(concept.id == 0 && id != null && id != undefined){\r\n var conceptString = await GetConcept(id);\r\n concept = conceptString as Concept;\r\n }\r\n var output = await recursiveFetch(id, connectionList, compositionList);\r\n var mainString = concept?.type?.characterValue ?? \"\";\r\n returnOutput[mainString] = output;\r\n var FinalReturn: any = {};\r\n FinalReturn['created_at'] = concept.entryTimeStamp;\r\n FinalReturn['data'] = returnOutput;\r\n FinalReturn['id'] = id;\r\n\r\n return FinalReturn;\r\n}\r\n\r\n/**\r\n * Reconstructs a composition from connections with optional pre-computed composition list.\r\n *\r\n * An optimized variant that accepts an optional pre-computed list of composition IDs,\r\n * avoiding the need to extract it from connections. This is the most efficient variant\r\n * for bulk operations.\r\n *\r\n * @param id - The ID of the root concept of the composition\r\n * @param connectionList - Pre-fetched array of Connection objects\r\n * @param compositionList - Optional pre-computed array of composition concept IDs (default: empty array)\r\n *\r\n * @returns A promise that resolves to an object with id, created_at, and data fields\r\n *\r\n * @remarks\r\n * - Most efficient variant when composition list is pre-computed\r\n * - If compositionList is empty, computes it from connections\r\n * - Useful in high-performance scenarios with many compositions\r\n *\r\n * @see {@link GetCompositionWithIdFromMemoryFromConnections} for basic variant\r\n */\r\nexport async function GetCompositionWithIdFromMemoryFromConnectionsNew(id:number, connectionList:Connection[], compositionList:number[] = []){\r\n // var connectionList:Connection[] = [];\r\n var returnOutput: any = {};\r\n //connectionList = await ConnectionData.GetConnectionsOfCompositionLocal(id);\r\n\r\n var concept = await ConceptsData.GetConcept(id);\r\n if(concept.id == 0 && id != null && id != undefined){\r\n var conceptString = await GetConcept(id);\r\n concept = conceptString as Concept;\r\n }\r\n var output = await recursiveFetch(id, connectionList, compositionList);\r\n var mainString = concept?.type?.characterValue ?? \"\";\r\n returnOutput[mainString] = output;\r\n var FinalReturn: any = {};\r\n FinalReturn['created_at'] = concept.entryTimeStamp;\r\n FinalReturn['data'] = returnOutput;\r\n FinalReturn['id'] = id;\r\n\r\n return FinalReturn;\r\n}\r\n\r\n/**\r\n * Retrieves a composition from API with metadata wrapper.\r\n *\r\n * Similar to GetComposition but includes the composition ID and wraps the data\r\n * in a structured object. Uses API calls rather than memory cache.\r\n *\r\n * @param id - The ID of the root concept of the composition\r\n *\r\n * @returns A promise that resolves to an object with data and id fields\r\n *\r\n * @example\r\n * ```typescript\r\n * const result = await GetCompositionWithId(12345);\r\n * console.log(\"Composition ID:\", result.id);\r\n * console.log(\"Data:\", result.data);\r\n * ```\r\n *\r\n * @remarks\r\n * - Fetches from API, not from cache\r\n * - Includes composition ID in return structure\r\n * - Data structure: { data, id }\r\n *\r\n * @see {@link GetComposition} for unwrapped version\r\n * @see {@link GetCompositionWithIdFromMemory} for cached version\r\n */\r\nexport async function GetCompositionWithId(id:number){\r\n var connectionList:Connection[] = [];\r\n var returnOutput: any = {};\r\n var connectionListString = await GetAllConnectionsOfComposition(id);\r\n connectionList = connectionListString as Connection[];\r\n var compositionList:number[] = [];\r\n\r\n for(var i=0; i<connectionList.length; i++){\r\n if(!compositionList.includes(connectionList[i].ofTheConceptId)){\r\n compositionList.push(connectionList[i].ofTheConceptId);\r\n }\r\n }\r\n\r\n var concept = await ConceptsData.GetConcept(id);\r\n if(concept.id == 0 && id != null && id != undefined){\r\n var conceptString = await GetConcept(id);\r\n concept = conceptString as Concept;\r\n }\r\n var output = await recursiveFetch(id, connectionList, compositionList);\r\n var mainString = concept?.type?.characterValue ?? \"\";\r\n returnOutput[mainString] = output;\r\n var FinalReturn: any = {};\r\n FinalReturn['data'] = returnOutput;\r\n FinalReturn['id'] = id;\r\n\r\n return FinalReturn;\r\n}\r\n\r\n/**\r\n * Recursively reconstructs a composition structure from connections.\r\n *\r\n * This is the core algorithm that traverses connections and rebuilds the hierarchical\r\n * JSON structure from the graph representation. It handles both object-like structures\r\n * (with string keys) and array-like structures (with numeric keys).\r\n *\r\n * The algorithm works by:\r\n * 1. Checking if the concept is a leaf node (not in compositionList) - returns its value\r\n * 2. For composition nodes, iterating through all outgoing connections\r\n * 3. Recursively processing each connected concept\r\n * 4. Building either an object or array based on key type\r\n * 5. Preventing infinite loops by tracking visited concepts\r\n *\r\n * @param id - The ID of the concept to process\r\n * @param connectionList - All connections in the composition\r\n * @param compositionList - Array of concept IDs that are composition nodes (not leaves)\r\n * @param visitedConcepts - Internal tracker to prevent circular reference loops (default: empty array)\r\n *\r\n * @returns A promise that resolves to the reconstructed data structure (object, array, or primitive value)\r\n *\r\n * @example\r\n * ```typescript\r\n * // This function is typically called internally by GetComposition functions\r\n * // Manual usage:\r\n * const connections = await GetAllConnectionsOfComposition(12345);\r\n * const compositionList = extractCompositionList(connections);\r\n * const result = await recursiveFetch(12345, connections, compositionList);\r\n * ```\r\n *\r\n * @remarks\r\n * - Strips \"the_\" prefix from concept type names when used as keys\r\n * - Numeric keys create array-like structures, string keys create object structures\r\n * - Leaf nodes (not in compositionList) return their characterValue\r\n * - Returns empty string for circular references (visited concepts)\r\n * - Fetches concept type information if not cached\r\n * - Handles null/undefined concept types gracefully\r\n * - Returns null for id=0\r\n *\r\n * @see {@link GetComposition} which uses this function\r\n * @see {@link recursiveFetchWithSubCompositions} for variant that includes IDs\r\n */\r\nexport async function recursiveFetch(id:number, connectionList:Connection[], compositionList:number[], visitedConcepts: number[] = []){\r\n\r\n var output : any= {};\r\n var arroutput: any = [];\r\n if(id == 0){\r\n return null;\r\n }\r\n var concept = await ConceptsData.GetConcept(id);\r\n if((concept == null || concept.id == 0) && id != null && id != undefined){\r\n var conceptString = await GetConcept(id);\r\n concept = conceptString as Concept;\r\n }\r\n\r\n if(concept.id != 0){\r\n if(concept.type == null){\r\n\r\n var toConceptTypeId: number = concept.typeId;\r\n var toConceptType = await ConceptsData.GetConcept(toConceptTypeId);\r\n\r\n concept.type = toConceptType;\r\n if(toConceptType == null && toConceptTypeId != null && toConceptTypeId != undefined){\r\n var conceptString = await GetConcept(toConceptTypeId);\r\n toConceptType = conceptString as Concept;\r\n concept.type = toConceptType;\r\n }\r\n }\r\n }\r\n\r\n var mainString = concept?.type?.characterValue ?? \"\";\r\n if(!compositionList.includes(id)){\r\n\r\n return concept?.characterValue;\r\n }\r\n else{\r\n if(visitedConcepts.includes(id)){\r\n return \"\";\r\n }\r\n else{\r\n visitedConcepts.push(id);\r\n }\r\n\r\n for(var i=0; i<connectionList.length; i++){\r\n\r\n if(connectionList[i].ofTheConceptId == id){\r\n var toConceptId = connectionList[i].toTheConceptId;\r\n \r\n var toConcept = await ConceptsData.GetConcept(toConceptId);\r\n if((toConcept == null || toConcept.id == 0) && toConceptId != null && toConceptId != undefined){\r\n var conceptString = await GetConcept(toConceptId);\r\n toConcept = conceptString as Concept;\r\n }\r\n\r\n\r\n if(toConcept){\r\n if(toConcept?.type == null){\r\n\r\n var toConceptTypeId: number = toConcept.typeId;\r\n var toConceptType = await ConceptsData.GetConcept(toConceptTypeId);\r\n\r\n toConcept.type = toConceptType;\r\n if(toConceptType == null && toConceptTypeId != null && toConceptTypeId != undefined){\r\n var conceptString = await GetConcept(toConceptTypeId);\r\n toConceptType = conceptString as Concept;\r\n toConcept.type = toConceptType;\r\n }\r\n }\r\n }\r\n\r\n var regex = \"the_\";\r\n // console.log(\"To the concept\", connectionList[i].id,connectionList[i].ofTheConceptId, connectionList[i].toTheConceptId, connectionList[i].typeId, toConcept.id, toConcept.typeId, toConcept.characterValue, toConcept.type?.characterValue);\r\n\r\n var localmainString = toConcept?.type?.characterValue ?? \"\";\r\n\r\n var localKey = localmainString.replace(regex, \"\");\r\n\r\n if(isNaN(Number(localKey)) ){\r\n\r\n if(localKey){\r\n const result = await recursiveFetch(toConceptId, connectionList, compositionList, visitedConcepts);\r\n output[localKey] = result;\r\n }\r\n\r\n }\r\n else{\r\n\r\n const result = await recursiveFetch(toConceptId, connectionList, compositionList,visitedConcepts);\r\n arroutput[localKey] = result;\r\n output = arroutput;\r\n\r\n }\r\n\r\n\r\n\r\n } \r\n }\r\n }\r\n\r\n\r\n return output;\r\n\r\n }\r\n\r\n/**\r\n * Recursively reconstructs a composition with concept IDs embedded in the structure.\r\n *\r\n * Similar to recursiveFetch but adds an \"id\" field to each sub-composition node in the\r\n * returned structure. This enables tracking which concept ID corresponds to each part\r\n * of the reconstructed data.\r\n *\r\n * @param id - The ID of the concept to process\r\n * @param connectionList - All connections in the composition\r\n * @param compositionList - Array of concept IDs that are composition nodes\r\n * @param visitedConcepts - Internal tracker to prevent circular loops (default: empty array)\r\n *\r\n * @returns A promise that resolves to the reconstructed structure with embedded IDs\r\n *\r\n * @remarks\r\n * - Each composition node includes an \"id\" field\r\n * - Otherwise identical to recursiveFetch\r\n * - Used by GetCompositionWithAllIds\r\n *\r\n * @see {@link recursiveFetch} for the standard version\r\n * @see {@link GetCompositionWithAllIds} which uses this function\r\n */\r\n export async function recursiveFetchWithSubCompositions(id:number, connectionList:Connection[], compositionList:number[], visitedConcepts: number[] = []){\r\n\r\n var output : any= {};\r\n var arroutput: any = [];\r\n if(id == 0){\r\n return null;\r\n }\r\n var concept = await ConceptsData.GetConcept(id);\r\n if((concept == null || concept.id == 0) && id != null && id != undefined){\r\n var conceptString = await GetConcept(id);\r\n concept = conceptString as Concept;\r\n }\r\n\r\n if(concept.id != 0){\r\n if(concept.type == null){\r\n\r\n var toConceptTypeId: number = concept.typeId;\r\n var toConceptType = await ConceptsData.GetConcept(toConceptTypeId);\r\n\r\n concept.type = toConceptType;\r\n if(toConceptType == null && toConceptTypeId != null && toConceptTypeId != undefined){\r\n var conceptString = await GetConcept(toConceptTypeId);\r\n toConceptType = conceptString as Concept;\r\n concept.type = toConceptType;\r\n }\r\n }\r\n }\r\n\r\n var mainString = concept?.type?.characterValue ?? \"\";\r\n\r\n if(!compositionList.includes(id)){\r\n return concept?.characterValue;\r\n }\r\n else{\r\n if(visitedConcepts.includes(id)){\r\n return \"\";\r\n }\r\n else{\r\n visitedConcepts.push(id);\r\n }\r\n output[\"id\"] = id;\r\n for(var i=0; i<connectionList.length; i++){\r\n\r\n if(connectionList[i].ofTheConceptId == id){\r\n var toConceptId = connectionList[i].toTheConceptId;\r\n\r\n var toConcept = await ConceptsData.GetConcept(toConceptId);\r\n if((toConcept == null || toConcept.id == 0) && toConceptId != null && toConceptId != undefined){\r\n var conceptString = await GetConcept(toConceptId);\r\n toConcept = conceptString as Concept;\r\n }\r\n if(toConcept){\r\n if(toConcept?.type == null){\r\n\r\n var toConceptTypeId: number = toConcept.typeId;\r\n var toConceptType = await ConceptsData.GetConcept(toConceptTypeId);\r\n\r\n toConcept.type = toConceptType;\r\n if(toConceptType == null && toConceptTypeId != null && toConceptTypeId != undefined){\r\n var conceptString = await GetConcept(toConceptTypeId);\r\n toConceptType = conceptString as Concept;\r\n toConcept.type = toConceptType;\r\n }\r\n }\r\n }\r\n\r\n var regex = \"the_\";\r\n\r\n\r\n var localmainString = toConcept?.type?.characterValue ?? \"\";\r\n\r\n var localKey = localmainString.replace(regex, \"\");\r\n\r\n if(isNaN(Number(localKey)) ){\r\n\r\n if(localKey){\r\n const result = await recursiveFetchWithSubCompositions(toConceptId, connectionList, compositionList);\r\n output[localKey] = result;\r\n }\r\n\r\n }\r\n else{\r\n\r\n const result = await recursiveFetchWithSubCompositions(toConceptId, connectionList, compositionList);\r\n arroutput[localKey] = result;\r\n output = arroutput;\r\n\r\n }\r\n\r\n\r\n } \r\n }\r\n }\r\n\r\n\r\n return output;\r\n\r\n }","/**\r\n * Bulk Composition Retrieval Service\r\n *\r\n * This module provides high-performance functions for retrieving multiple compositions\r\n * simultaneously. It implements sophisticated bulk prefetching and caching strategies\r\n * to minimize API calls and optimize performance when dealing with large batches of\r\n * compositions.\r\n *\r\n * The module offers several variants optimized for different scenarios:\r\n * - Basic bulk retrieval\r\n * - Bulk with metadata (IDs and timestamps)\r\n * - Optimized variants using pre-fetched connection data\r\n * - Connection and concept prefetching utilities\r\n *\r\n * @module GetCompositionBulk\r\n */\r\n\r\nimport { GetAllConnectionsOfCompositionBulk } from \"../Api/GetAllConnectionsOfCompositionBulk\";\r\nimport { GetConnectionBulk } from \"../Api/GetConnectionBulk\";\r\nimport { Connection } from \"../DataStructures/Connection\";\r\nimport { ConnectionData, GetConceptBulk } from \"../app\";\r\nimport { CheckForConnectionDeletionWithIds } from \"./CheckForConnectionDeletion\";\r\nimport { FindConnectionsOfCompositionsBulkInMemory } from \"./FindConnectionsOfCompositionBulkInMemory\";\r\nimport { GetCompositionFromMemory, GetCompositionWithIdFromMemory, GetCompositionWithIdFromMemoryFromConnections, GetCompositionWithIdFromMemoryFromConnectionsNew } from \"./GetComposition\";\r\n\r\n/**\r\n * Retrieves multiple compositions in bulk with optimized prefetching.\r\n *\r\n * This function fetches multiple compositions simultaneously by first bulk-prefetching\r\n * all their connections in a single API call, then reconstructing each composition\r\n * from cached data. This is significantly more efficient than fetching compositions\r\n * individually.\r\n *\r\n * @param ids - Array of composition root concept IDs to retrieve (default: empty array)\r\n *\r\n * @returns A promise that resolves to an array of composition objects\r\n *\r\n * @example\r\n * ```typescript\r\n * // Fetch multiple blog posts at once\r\n * const postIds = [123, 456, 789, 101112];\r\n * const posts = await GetCompositionBulk(postIds);\r\n *\r\n * console.log(`Retrieved ${posts.length} posts`);\r\n * posts.forEach((post, index) => {\r\n * console.log(`Post ${postIds[index]}:`, post);\r\n * });\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Load user profiles for a list of users\r\n * const userIds = await getUserIdsFromSearch(\"John\");\r\n * const profiles = await GetCompositionBulk(userIds);\r\n *\r\n * profiles.forEach(profile => {\r\n * const userData = profile[\"user_profile\"];\r\n * console.log(`Name: ${userData.name}, Email: ${userData.email}`);\r\n * });\r\n * ```\r\n *\r\n * @remarks\r\n * - Bulk prefetches all connections in a single API call\r\n * - Reconstructs compositions from cached connection data\r\n * - Much more efficient than individual GetComposition calls\r\n * - Returns compositions in the same order as input IDs\r\n * - Empty compositions returned for invalid IDs\r\n * - Uses GetAllConnectionsOfCompositionBulk for prefetch\r\n * - Uses GetCompositionFromMemory for reconstruction\r\n *\r\n * @see {@link GetCompositionBulkWithDataId} for version with metadata\r\n * @see {@link GetAllConnectionsOfCompositionBulk} for bulk connection prefetch\r\n * @see {@link GetCompositionFromMemory} for individual reconstruction\r\n */\r\nexport async function GetCompositionBulk(ids:number[]=[]){\r\n await GetAllConnectionsOfCompositionBulk(ids);\r\n var compositions: any[] = [];\r\n for(let i=0; i< ids.length;i++){\r\n var comp = await GetCompositionFromMemory(ids[i]);\r\n compositions.push(comp);\r\n }\r\n return compositions;\r\n}\r\n\r\n/**\r\n * Retrieves multiple compositions in bulk with metadata wrappers.\r\n *\r\n * Similar to GetCompositionBulk, but each composition includes metadata (ID and\r\n * creation timestamp) in the returned structure. This is useful when you need to\r\n * track or reference individual compositions while processing bulk data.\r\n *\r\n * @param ids - Array of composition root concept IDs to retrieve (default: empty array)\r\n *\r\n * @returns A promise that resolves to an array of objects with id, created_at, and data fields\r\n *\r\n * @example\r\n * ```typescript\r\n * // Fetch posts with metadata for display\r\n * const postIds = [123, 456, 789];\r\n * const postsWithMeta = await GetCompositionBulkWithDataId(postIds);\r\n *\r\n * postsWithMeta.forEach(post => {\r\n * console.log(`Post ID: ${post.id}`);\r\n * console.log(`Created: ${post.created_at}`);\r\n * console.log(`Title: ${post.data[\"blog_post\"].title}`);\r\n * });\r\n * ```\r\n *\r\n * @remarks\r\n * - Each item includes: { id, created_at, data }\r\n * - Uses bulk prefetch for optimal performance\r\n * - Otherwise identical to GetCompositionBulk\r\n *\r\n * @see {@link GetCompositionBulk} for version without metadata\r\n * @see {@link GetCompositionWithIdFromMemory} for individual retrieval with metadata\r\n */\r\nexport async function GetCompositionBulkWithDataId(ids:number[]=[]){\r\n await GetAllConnectionsOfCompositionBulk(ids);\r\n var compositions: any[] = [];\r\n for(let i=0; i< ids.length;i++){\r\n var comp = await GetCompositionWithIdFromMemory(ids[i]);\r\n compositions.push(comp);\r\n }\r\n return compositions;\r\n}\r\n\r\n/**\r\n * Retrieves compositions using a specific set of connection IDs.\r\n *\r\n * This function fetches compositions but allows you to specify exactly which connections\r\n * to use for reconstruction. It also performs connection deletion checking to ensure\r\n * cached data is up-to-date.\r\n *\r\n * @param ids - Array of composition root concept IDs\r\n * @param connections - Array of specific connection IDs to use (default: empty array)\r\n *\r\n * @returns A promise that resolves to an array of objects with id, created_at, and data fields\r\n *\r\n * @example\r\n * ```typescript\r\n * // Fetch compositions using specific connections\r\n * const compositionIds = [123, 456];\r\n * const connectionIds = [789, 101112, 131415];\r\n *\r\n * const compositions = await GetCompositionFromConnectionsWithDataId(\r\n * compositionIds,\r\n * connectionIds\r\n * );\r\n * ```\r\n *\r\n * @remarks\r\n * - Fetches only specified connections\r\n * - Checks for connection deletions to maintain cache validity\r\n * - Updates cache with newly fetched connections\r\n * - Uses GetCompositionWithIdFromMemory for reconstruction\r\n *\r\n * @see {@link GetCompositionBulkWithDataId} for standard bulk retrieval\r\n * @see {@link CheckForConnectionDeletionWithIds} for deletion checking\r\n */\r\nexport async function GetCompositionFromConnectionsWithDataId(ids:number[]=[], connections:number[] = []){\r\n var newConnections = await GetConnectionBulk(connections);\r\n var myNewConnections = newConnections as Connection[];\r\n var oldConnections = await FindConnectionsOfCompositionsBulkInMemory(ids);\r\n CheckForConnectionDeletionWithIds(connections,oldConnections);\r\n var compositions: any[] = [];\r\n for(let i=0; i< ids.length;i++){\r\n var comp = await GetCompositionWithIdFromMemory(ids[i]);\r\n compositions.push(comp);\r\n }\r\n return compositions;\r\n}\r\n\r\n/**\r\n * Prefetches connections and their related concepts for optimal performance.\r\n *\r\n * This utility function fetches a batch of connections by ID and also prefetches all\r\n * the concepts referenced by those connections (ofTheConcept, toTheConcept, and type).\r\n * This ensures that when you later reconstruct compositions, all necessary data is\r\n * already in the cache.\r\n *\r\n * The function implements a smart caching strategy: it first checks the local cache\r\n * for each connection, then bulk-fetches only the missing ones from the API.\r\n *\r\n * @param connectionIds - Array of connection IDs to prefetch (default: empty array)\r\n *\r\n * @returns A promise that resolves to an array of all prefetched Connection objects\r\n *\r\n * @example\r\n * ```typescript\r\n * // Prefetch connections before processing\r\n * const connectionIds = [123, 456, 789, 101112];\r\n * const connections = await GetConnectionDataPrefetch(connectionIds);\r\n *\r\n * console.log(`Prefetched ${connections.length} connections`);\r\n * // Now all related concepts are also cached\r\n *\r\n * // Subsequent operations will be faster\r\n * for (const conn of connections) {\r\n * const fromConcept = await GetTheConcept(conn.ofTheConceptId); // Fast, from cache\r\n * const toConcept = await GetTheConcept(conn.toTheConceptId); // Fast, from cache\r\n * }\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Use before bulk composition operations\r\n * const compositionIds = [123, 456, 789];\r\n *\r\n * // First, get all connection IDs for these compositions\r\n * const allConnectionIds = await getConnectionIdsForCompositions(compositionIds);\r\n *\r\n * // Prefetch everything\r\n * await GetConnectionDataPrefetch(allConnectionIds);\r\n *\r\n * // Now reconstruct compositions - will be very fast\r\n * const compositions = await Promise.all(\r\n * compositionIds.map(id => GetCompositionFromMemory(id))\r\n * );\r\n * ```\r\n *\r\n * @remarks\r\n * - Checks ConnectionData cache before making API calls\r\n * - Only fetches connections that aren't already cached\r\n * - Automatically prefetches all concepts referenced by connections:\r\n * - ofTheConceptId (source concept)\r\n * - toTheConceptId (target concept)\r\n * - typeId (connection type concept)\r\n * - Uses GetConnectionBulk for efficient batch fetching\r\n * - Uses GetConceptBulk to prefetch all related concepts\r\n * - Returns all connections, both cached and newly fetched\r\n * - Significantly improves performance for composition reconstruction\r\n *\r\n * @see {@link GetConnectionBulk} for bulk connection fetching\r\n * @see {@link GetConceptBulk} for bulk concept prefetching\r\n * @see {@link ConnectionData.GetConnection} for cache lookup\r\n */\r\nexport async function GetConnectionDataPrefetch(connectionIds:number[] = []): Promise<Connection[]>{\r\n\r\n let remainingConnections: number[] = [];\r\n let connectionsAll:Connection[] = [];\r\n let remainingIds: any = {};\r\n for(let i=0; i< connectionIds?.length; i++){\r\n let connection = await ConnectionData.GetConnection(connectionIds[i]);\r\n // console.log(\"this is the connection fetch\", connection);\r\n if(connection.id == 0){\r\n remainingConnections.push(connectionIds[i]);\r\n }\r\n else{\r\n connectionsAll.push(connection);\r\n }\r\n }\r\n for(let i=0; i< remainingConnections.length; i++){\r\n remainingIds[connectionIds[i]] = false;\r\n }\r\n //await ConnectionData.GetConnectionBulkData(connectionIds, connectionsAll, remainingIds);\r\n // for(let key in remainingIds){\r\n // if(remainingIds[key] == false){\r\n // remainingConnections.push(Number(key));\r\n // }\r\n // }\r\n // remainingConnections = connectionIds;\r\n let prefetchConcepts : number [] = [];\r\n let connectionsAllLocal = await GetConnectionBulk(remainingConnections);\r\n connectionsAll = [...connectionsAll,...connectionsAllLocal];\r\n for(let j=0 ; j< connectionsAll.length; j++){\r\n prefetchConcepts.push(connectionsAll[j].ofTheConceptId);\r\n prefetchConcepts.push(connectionsAll[j].toTheConceptId);\r\n prefetchConcepts.push(connectionsAll[j].typeId);\r\n }\r\n await GetConceptBulk(prefetchConcepts);\r\n return connectionsAll;\r\n}\r\n\r\n/**\r\n * Retrieves compositions in bulk with optimized connection reuse, returning an object map.\r\n *\r\n * This is a highly optimized function for retrieving multiple compositions. Instead of\r\n * returning an array, it returns an object where keys are composition IDs and values\r\n * are the composition data. It reuses a single set of connections for all compositions,\r\n * making it extremely efficient for large batches.\r\n *\r\n * The function fetches connections once, then reconstructs all compositions from the\r\n * same connection pool. This approach minimizes memory usage and processing time.\r\n *\r\n * @param ids - Array of composition root concept IDs\r\n * @param connections - Array of connection IDs to use for all compositions (default: empty array)\r\n *\r\n * @returns A promise that resolves to an object mapping composition IDs to their data\r\n *\r\n * @example\r\n * ```typescript\r\n * // Fetch multiple compositions as a map\r\n * const compositionIds = [123, 456, 789];\r\n * const connectionIds = [1001, 1002, 1003, 1004, 1005];\r\n *\r\n * const compositionMap = await GetCompositionFromConnectionsWithDataIdInObject(\r\n * compositionIds,\r\n * connectionIds\r\n * );\r\n *\r\n * // Access by ID\r\n * console.log(\"Composition 123:\", compositionMap[123]);\r\n * console.log(\"Composition 456:\", compositionMap[456]);\r\n * console.log(\"Composition 789:\", compositionMap[789]);\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Efficient lookup for UI rendering\r\n * const ids = [10, 20, 30, 40, 50];\r\n * const connectionIds = await getAllConnectionIds(ids);\r\n * const dataMap = await GetCompositionFromConnectionsWithDataIdInObject(ids, connectionIds);\r\n *\r\n * // Fast random access\r\n * renderComponent(dataMap[20]);\r\n * renderComponent(dataMap[40]);\r\n * ```\r\n *\r\n * @remarks\r\n * - Returns object instead of array for O(1) lookup by ID\r\n * - Fetches connections once and reuses for all compositions\r\n * - Separates cached and non-cached connections for efficiency\r\n * - Computes composition list once and reuses it\r\n * - Each composition includes: { id, created_at, data }\r\n * - Uses GetCompositionWithIdFromMemoryFromConnectionsNew for reconstruction\r\n * - Includes console.time/timeEnd for performance monitoring\r\n * - Most efficient for large batches with shared connections\r\n *\r\n * @see {@link GetCompositionBulkWithDataId} for array-based bulk retrieval\r\n * @see {@link GetConnectionBulk} for connection fetching\r\n * @see {@link GetCompositionWithIdFromMemoryFromConnectionsNew} for reconstruction\r\n */\r\nexport async function GetCompositionFromConnectionsWithDataIdInObject(ids:number[]=[], connections:number[] = []){\r\n let remainingConnections: number[] = [];\r\n let allConnections:Connection[] = [];\r\n for(let i=0; i< connections.length; i++){\r\n let connection = await ConnectionData.GetConnection(connections[i]);\r\n if(connection.id == 0){\r\n remainingConnections.push(connections[i]);\r\n }\r\n else{\r\n allConnections.push(connection);\r\n }\r\n }\r\n let allConnectionsRemaining = await GetConnectionBulk(remainingConnections);\r\n for(let i=0; i<allConnectionsRemaining.length; i++){\r\n allConnections.push(allConnectionsRemaining[i]);\r\n }\r\n let compositions:any = {};\r\n let compositionList:number[] = [];\r\n for(var j=0; j<allConnections.length; j++){\r\n if(!compositionList.includes(allConnections[j].ofTheConceptId)){\r\n compositionList.push(allConnections[j].ofTheConceptId);\r\n }\r\n }\r\n for(let i=0; i< ids.length;i++){\r\n //console.log(\"tHIS IS THE START\", ids[i])\r\n let comp = await GetCompositionWithIdFromMemoryFromConnectionsNew(ids[i], allConnections, compositionList);\r\n compositions[ids[i]] = comp;\r\n }\r\n return compositions;\r\n}","/**\r\n * Composition List Retrieval Service\r\n *\r\n * This module provides functionality for retrieving multiple compositions of the same\r\n * type in paginated batches. It's designed for scenarios where you need to fetch lists\r\n * of structured data, such as \"all user profiles\", \"all blog posts\", or \"all products\".\r\n *\r\n * The module implements bulk prefetching optimizations to minimize API calls and\r\n * improve performance when retrieving multiple compositions.\r\n *\r\n * @module GetCompositionList\r\n */\r\n\r\nimport { GetAllConceptsByType } from \"../Api/GetAllConceptsByType\";\r\nimport { GetAllConnectionsOfCompositionBulk } from \"../Api/GetAllConnectionsOfCompositionBulk\";\r\nimport { ConceptsData } from \"../DataStructures/ConceptData\";\r\nimport { GetComposition, GetCompositionFromMemory, GetCompositionWithId, GetCompositionWithIdFromMemory } from \"./GetComposition\";\r\nimport GetConceptByCharacter from \"./GetConceptByCharacter\";\r\n\r\n/**\r\n * Retrieves a paginated list of compositions by type name.\r\n *\r\n * This function fetches multiple compositions that share the same type (e.g., all \"blog_post\"\r\n * compositions) with pagination support. It implements a bulk prefetch optimization strategy:\r\n * first fetching all concepts of the given type, then bulk-prefetching all their connections,\r\n * and finally reconstructing each composition from cached data.\r\n *\r\n * This approach is much more efficient than fetching compositions individually, especially\r\n * for large lists.\r\n *\r\n * @param compositionName - The type name of compositions to retrieve (e.g., \"blog_post\", \"user_profile\")\r\n * @param userId - The user ID who owns the compositions\r\n * @param inpage - Number of items per page (default: 10)\r\n * @param page - Page number, 1-indexed (default: 1)\r\n *\r\n * @returns A promise that resolves to an array of composition objects\r\n *\r\n * @example\r\n * ```typescript\r\n * // Get the first page of blog posts (10 items)\r\n * const blogPosts = await GetCompositionList(\"blog_post\", 999, 10, 1);\r\n * console.log(`Retrieved ${blogPosts.length} blog posts`);\r\n *\r\n * blogPosts.forEach(post => {\r\n * const postData = post[\"blog_post\"];\r\n * console.log(\"Title:\", postData.title);\r\n * console.log(\"Author:\", postData.author);\r\n * });\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Get the second page of user profiles (20 per page)\r\n * const profiles = await GetCompositionList(\"user_profile\", 456, 20, 2);\r\n * // Returns profiles 21-40\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Implement pagination for all products\r\n * const PAGE_SIZE = 25;\r\n * let currentPage = 1;\r\n * let products = [];\r\n *\r\n * do {\r\n * const pageProducts = await GetCompositionList(\"product\", 999, PAGE_SIZE, currentPage);\r\n * products.push(...pageProducts);\r\n * currentPage++;\r\n * } while (pageProducts.length === PAGE_SIZE);\r\n *\r\n * console.log(`Total products: ${products.length}`);\r\n * ```\r\n *\r\n * @remarks\r\n * - Uses bulk prefetch optimization for better performance\r\n * - First fetches all concepts of the specified type\r\n * - Then bulk-prefetches all connections for the page\r\n * - Finally reconstructs compositions from cached data\r\n * - Pagination is 1-indexed (page 1 is the first page)\r\n * - Returns empty array if composition type doesn't exist\r\n * - Uses GetCompositionFromMemory for fast reconstruction\r\n * - Efficient for large lists due to bulk operations\r\n *\r\n * @see {@link GetCompositionListWithId} for version that includes metadata\r\n * @see {@link GetCompositionFromMemory} for individual composition retrieval\r\n * @see {@link GetAllConceptsByType} for fetching concepts by type\r\n * @see {@link GetAllConnectionsOfCompositionBulk} for bulk connection prefetch\r\n */\r\nexport async function GetCompositionList(compositionName: string,userId:number, inpage:number = 10, page:number =1){\r\n var concept = await GetConceptByCharacter(compositionName);\r\n var CompositionList :any = [];\r\n if(concept){\r\n await GetAllConceptsByType(compositionName, userId);\r\n var conceptList = await ConceptsData.GetConceptsByTypeIdAndUser(concept.id,userId);\r\n var startPage = inpage * (page - 1);\r\n var prefetchComposition:number[] = [];\r\n for(var i=startPage; i< startPage + inpage; i++){\r\n if(conceptList[i]){\r\n \r\n prefetchComposition.push(conceptList[i].id);\r\n }\r\n }\r\n\r\n let myConnectionList = await GetAllConnectionsOfCompositionBulk(prefetchComposition);\r\n\r\n for(var i=startPage; i< startPage + inpage; i++){\r\n if(conceptList[i]){\r\n\r\n var compositionJson= await GetCompositionFromMemory(conceptList[i].id);\r\n CompositionList.push(compositionJson);\r\n }\r\n }\r\n }\r\n return CompositionList;\r\n}\r\n\r\n/**\r\n * Retrieves a paginated list of compositions with metadata wrappers.\r\n *\r\n * Similar to GetCompositionList, but each composition in the returned array includes\r\n * metadata (ID, creation timestamp) in addition to the composition data. This is useful\r\n * when you need to track or reference individual compositions by their IDs.\r\n *\r\n * The function uses the same bulk prefetch optimization strategy for efficient retrieval.\r\n *\r\n * @param compositionName - The type name of compositions to retrieve\r\n * @param userId - The user ID who owns the compositions\r\n * @param inpage - Number of items per page (default: 10)\r\n * @param page - Page number, 1-indexed (default: 1)\r\n *\r\n * @returns A promise that resolves to an array of objects with id, created_at, and data fields\r\n *\r\n * @example\r\n * ```typescript\r\n * // Get blog posts with IDs and timestamps\r\n * const posts = await GetCompositionListWithId(\"blog_post\", 999, 10, 1);\r\n *\r\n * posts.forEach(post => {\r\n * console.log(\"Post ID:\", post.id);\r\n * console.log(\"Created:\", post.created_at);\r\n * console.log(\"Title:\", post.data[\"blog_post\"].title);\r\n * });\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Build a list of editable items with their IDs\r\n * const items = await GetCompositionListWithId(\"task\", 456, 50, 1);\r\n *\r\n * const editableList = items.map(item => ({\r\n * id: item.id,\r\n * name: item.data[\"task\"].name,\r\n * editUrl: `/edit/${item.id}`\r\n * }));\r\n * ```\r\n *\r\n * @remarks\r\n * - Each item includes: { id, created_at, data }\r\n * - Uses bulk prefetch for performance\r\n * - Uses GetCompositionWithIdFromMemory for reconstruction\r\n * - Otherwise identical to GetCompositionList\r\n *\r\n * @see {@link GetCompositionList} for version without metadata\r\n * @see {@link GetCompositionWithIdFromMemory} for individual composition with ID\r\n */\r\nexport async function GetCompositionListWithId(compositionName: string, userId: number, inpage:number = 10, page:number =1){\r\n var concept = await GetConceptByCharacter(compositionName);\r\n var CompositionList :any = [];\r\n if(concept){\r\n await GetAllConceptsByType(compositionName, userId);\r\n var conceptList = await ConceptsData.GetConceptsByTypeIdAndUser(concept.id,userId);\r\n var startPage = inpage * (page - 1);\r\n var prefetchComposition:number[] = [];\r\n for(var i=startPage; i< startPage + inpage; i++){\r\n if(conceptList[i]){\r\n \r\n prefetchComposition.push(conceptList[i].id);\r\n }\r\n }\r\n await GetAllConnectionsOfCompositionBulk(prefetchComposition);\r\n for(var i=startPage; i< startPage + inpage; i++){\r\n if(conceptList[i]){\r\n var compositionJson= await GetCompositionWithIdFromMemory(conceptList[i].id);\r\n CompositionList.push(compositionJson);\r\n }\r\n }\r\n }\r\n return CompositionList;\r\n}\r\n\r\n\r\n\r\n\r\n","/**\r\n * @module GetConceptByCharacter\r\n * @description Retrieves concepts by their character value in the Concept Connection System (CCS).\r\n * This module provides functions to look up concepts based on character strings,\r\n * utilizing both local cache (ConceptsData) and remote API calls for comprehensive\r\n * concept retrieval with automatic fallback mechanisms.\r\n */\r\n\r\nimport { GetConceptByCharacterValue } from \"../Api/GetConceptByCharacterValue\";\r\nimport { Concept } from \"../DataStructures/Concept\";\r\nimport { ConceptsData } from \"../DataStructures/ConceptData\";\r\n\r\n/**\r\n * Retrieves a concept by its character value.\r\n *\r\n * This function performs a two-tier lookup strategy to find concepts:\r\n * 1. First checks the local ConceptsData cache for the concept\r\n * 2. If not found or has invalid ID, calls the API to fetch from remote storage\r\n * 3. After API call, checks the cache again as API updates the cache\r\n *\r\n * This approach optimizes performance by using cached data when available while\r\n * ensuring data consistency through API fallback.\r\n *\r\n * @param characterValue - The character string to search for (e.g., \"the_user\", \"hello\")\r\n *\r\n * @returns Promise resolving to the found Concept, or a Concept with id=0 if not found\r\n *\r\n * @remarks\r\n * - Uses ConceptsData.GetConceptByCharacter for local cache lookup\r\n * - Falls back to GetConceptByCharacterValue API when cache misses\r\n * - API call updates the local cache automatically\r\n * - Returns null-safe with Concept having id=0 when not found\r\n * - Template literal ensures characterValue is treated as string\r\n *\r\n * @example\r\n * ```typescript\r\n * // Retrieve a type concept\r\n * const userType = await GetConceptByCharacter(\"the_user\");\r\n * if (userType.id > 0) {\r\n * console.log(\"Found user type:\", userType);\r\n * }\r\n *\r\n * // Search for a specific name\r\n * const name = await GetConceptByCharacter(\"John Doe\");\r\n *\r\n * // Check for non-existent concept\r\n * const missing = await GetConceptByCharacter(\"nonexistent\");\r\n * console.log(missing.id); // 0\r\n * ```\r\n *\r\n * @see {@link GetConceptByCharacterUpdated} - Alternative implementation with same behavior\r\n * @see {@link ConceptsData.GetConceptByCharacter} - Local cache lookup\r\n * @see {@link GetConceptByCharacterValue} - Remote API lookup\r\n */\r\nexport default async function GetConceptByCharacter(characterValue: string){\r\n var concept = await ConceptsData.GetConceptByCharacter(characterValue);\r\n var literalCharacter = `${characterValue}`;\r\n if((concept == null || concept?.id == 0) && literalCharacter){\r\n await GetConceptByCharacterValue(characterValue);\r\n concept = await ConceptsData.GetConceptByCharacter(characterValue);\r\n }\r\n return concept;\r\n}\r\n\r\n/**\r\n * Retrieves a concept by its character value (updated variant).\r\n *\r\n * This function is functionally identical to GetConceptByCharacter, providing\r\n * an alternative export for the same lookup behavior. It follows the same\r\n * two-tier strategy of checking local cache first, then falling back to API.\r\n *\r\n * The \"Updated\" suffix may indicate a versioning strategy or future enhancement\r\n * point, but currently implements the same logic as the default export.\r\n *\r\n * @param characterValue - The character string to search for (e.g., \"the_user\", \"hello\")\r\n *\r\n * @returns Promise resolving to the found Concept, or a Concept with id=0 if not found\r\n *\r\n * @remarks\r\n * - Identical implementation to GetConceptByCharacter\r\n * - Exported as named export rather than default\r\n * - May be used for API versioning or compatibility\r\n * - Follows same cache-first, API-fallback pattern\r\n *\r\n * @example\r\n * ```typescript\r\n * import { GetConceptByCharacterUpdated } from './GetConceptByCharacter';\r\n *\r\n * // Use updated variant explicitly\r\n * const concept = await GetConceptByCharacterUpdated(\"the_post\");\r\n * if (concept.id > 0) {\r\n * console.log(\"Found concept:\", concept);\r\n * }\r\n * ```\r\n *\r\n * @see {@link GetConceptByCharacter} - Default export with identical behavior\r\n * @see {@link ConceptsData.GetConceptByCharacter} - Local cache lookup\r\n * @see {@link GetConceptByCharacterValue} - Remote API lookup\r\n */\r\nexport async function GetConceptByCharacterUpdated(characterValue: string){\r\n var concept = await ConceptsData.GetConceptByCharacter(characterValue);\r\n var literalCharacter = `${characterValue}`;\r\n if((concept == null || concept?.id == 0) && literalCharacter){\r\n await GetConceptByCharacterValue(characterValue);\r\n concept = await ConceptsData.GetConceptByCharacter(characterValue);\r\n }\r\n return concept;\r\n}","/**\r\n * Connection Retrieval Service\r\n *\r\n * This module provides functions for retrieving connection objects from the system.\r\n * It implements a caching strategy that checks local memory first before falling\r\n * back to API calls, similar to concept retrieval.\r\n *\r\n * @module GetConnections\r\n */\r\n\r\nimport { GetConnection } from \"../Api/GetConnection\";\r\nimport { Concept } from \"../DataStructures/Concept\";\r\nimport { Connection } from \"../DataStructures/Connection\";\r\nimport { ConnectionBinaryTree } from \"../DataStructures/ConnectionBinaryTree/ConnectionBinaryTree\";\r\nimport { ConnectionData } from \"../DataStructures/ConnectionData\";\r\n\r\n/**\r\n * Retrieves a connection by its ID with automatic caching.\r\n *\r\n * This function implements a two-tier lookup strategy for connection retrieval:\r\n * 1. First checks the local cache (ConnectionData)\r\n * 2. Falls back to an API call (GetConnection) if not found in cache\r\n *\r\n * The function ensures that valid connections are returned when available, and\r\n * handles cases where connections don't exist or retrieval fails gracefully.\r\n *\r\n * @param id - The ID of the connection to retrieve\r\n *\r\n * @returns A promise that resolves to the Connection object, or a connection with id=0 if not found\r\n *\r\n * @example\r\n * ```typescript\r\n * // Retrieve a connection and check its type\r\n * const connection = await GetConnectionById(12345);\r\n *\r\n * if (connection.id === 0) {\r\n * console.log(\"Connection not found\");\r\n * } else {\r\n * console.log(\"Connection from:\", connection.ofTheConceptId);\r\n * console.log(\"Connection to:\", connection.toTheConceptId);\r\n * console.log(\"Connection type:\", connection.typeId);\r\n * }\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Use in a connection validation scenario\r\n * const connectionIds = [123, 456, 789];\r\n * const connections = await Promise.all(\r\n * connectionIds.map(id => GetConnectionById(id))\r\n * );\r\n *\r\n * const validConnections = connections.filter(conn => conn.id !== 0);\r\n * console.log(`Found ${validConnections.length} valid connections`);\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Retrieve connection and navigate to connected concepts\r\n * const connection = await GetConnectionById(555);\r\n * if (connection.id !== 0) {\r\n * const fromConcept = await GetTheConcept(connection.ofTheConceptId);\r\n * const toConcept = await GetTheConcept(connection.toTheConceptId);\r\n * console.log(`${fromConcept.characterValue} -> ${toConcept.characterValue}`);\r\n * }\r\n * ```\r\n *\r\n * @remarks\r\n * - First checks ConnectionData cache for optimal performance\r\n * - Makes an API call only if connection is not in cache or has id=0\r\n * - Returns a connection with id=0 if retrieval fails at all levels\r\n * - The function validates that id is not null or undefined before API call\r\n * - Connections are automatically cached by the GetConnection API call\r\n * - This function is null-safe for ID checks but may throw if API fails\r\n *\r\n * @see {@link ConnectionData.GetConnection} for cache lookup\r\n * @see {@link GetConnection} for API-based retrieval\r\n * @see {@link Connection} for the connection data structure\r\n */\r\nexport async function GetConnectionById(id:number){\r\n\r\n var connection = await ConnectionData.GetConnection(id);\r\n if((connection == null || connection.id == 0) && id != null && id != undefined){\r\n var connectionString = await GetConnection(id);\r\n connection = connectionString as Connection;\r\n }\r\n return connection;\r\n\r\n}","/**\r\n * IndexedDB Data Retrieval Service\r\n *\r\n * This module provides comprehensive functionality for loading data from IndexedDB into\r\n * in-memory data structures. It handles both regular and local database data, loading\r\n * connections and concepts into their respective memory structures for efficient access.\r\n *\r\n * The service supports two data contexts:\r\n * - Global/synced data: Loaded from standard IndexedDB stores\r\n * - Local data: Loaded from local-only IndexedDB stores for offline or user-specific data\r\n *\r\n * @module GetDataFromIndexDb\r\n */\r\n\r\nimport { ConceptsData } from \"../DataStructures/ConceptData\";\r\nimport { ConnectionBinaryTree } from \"../DataStructures/ConnectionBinaryTree/ConnectionBinaryTree\";\r\nimport { ConnectionData } from \"../DataStructures/ConnectionData\";\r\nimport { LocalConceptsData } from \"../DataStructures/Local/LocalConceptData\";\r\nimport { LocalConnectionData } from \"../DataStructures/Local/LocalConnectionData\";\r\nimport { getAllFromLocalDb } from \"../Database/NoIndexDb\";\r\nimport { getFromDatabaseWithTypeOld } from \"../Database/NoIndexDb\";\r\n\r\n/**\r\n * Loads data from the standard IndexedDB stores into memory.\r\n *\r\n * This is the main entry point for initializing the application's in-memory data structures\r\n * from persisted database records. Currently focuses on loading connections, with concept\r\n * loading functionality commented out for optimization or architectural reasons.\r\n *\r\n * The function delegates to specialized helpers to load different data types, ensuring\r\n * proper separation of concerns and maintainability.\r\n *\r\n * @returns A promise that resolves when all data has been loaded into memory\r\n *\r\n * @example\r\n * ```typescript\r\n * // Initialize application data from IndexedDB\r\n * await GetDataFromIndexDb();\r\n * console.log('Global data loaded successfully');\r\n *\r\n * // Access loaded connections\r\n * const connections = ConnectionData.getAllConnections();\r\n * console.log('Loaded connections:', connections.length);\r\n * ```\r\n *\r\n * @remarks\r\n * - Concept loading is currently disabled (commented out lines 11-21)\r\n * - Only connections are actively loaded into memory\r\n * - This function is typically called during application initialization\r\n * - Loads from the standard database, not the local-only database\r\n *\r\n * @see {@link GetConnectionsFromIndexDb} for connection loading implementation\r\n * @see {@link GetDataFromIndexDbLocal} for local database equivalent\r\n * @see {@link ConnectionData.AddConnectionToMemory} for how connections are stored\r\n */\r\nexport async function GetDataFromIndexDb(){\r\n\r\n // var conceptList = await getFromDatabaseWithTypeOld(\"concept\");\r\n\r\n GetConnectionsFromIndexDb();\r\n // console.log(conceptList);\r\n\r\n // if(Array.isArray(conceptList)){\r\n // for(var i=0 ;i < conceptList.length ;i++){\r\n // ConceptsData.AddConcept(conceptList[i]);\r\n // }\r\n\r\n // }\r\n }\r\n\r\n/**\r\n * Loads data from the local IndexedDB stores into memory.\r\n *\r\n * This function serves as the local database equivalent of GetDataFromIndexDb, handling\r\n * data that is stored in local-only database stores. This is typically used for user-specific\r\n * data, offline data, or data that should not be synchronized across devices.\r\n *\r\n * Like its global counterpart, concept loading is currently disabled, with only connection\r\n * data being actively loaded into the LocalConnectionData memory structure.\r\n *\r\n * @returns A promise that resolves when all local data has been loaded into memory\r\n *\r\n * @example\r\n * ```typescript\r\n * // Initialize local application data from IndexedDB\r\n * await GetDataFromIndexDbLocal();\r\n * console.log('Local data loaded successfully');\r\n *\r\n * // Access loaded local connections\r\n * const localConnections = LocalConnectionData.getAllConnections();\r\n * console.log('Loaded local connections:', localConnections.length);\r\n * ```\r\n *\r\n * @remarks\r\n * - Concept loading is currently disabled (commented out lines 25-33)\r\n * - Only local connections are actively loaded into memory\r\n * - Uses getAllFromLocalDb instead of getFromDatabaseWithTypeOld for local stores\r\n * - Typically called during initialization for applications supporting offline mode\r\n *\r\n * @see {@link GetConnectionsFromIndexDbLocal} for local connection loading implementation\r\n * @see {@link GetDataFromIndexDb} for standard database equivalent\r\n * @see {@link LocalConnectionData.AddConnection} for how local connections are stored\r\n */\r\n export async function GetDataFromIndexDbLocal(){\r\n // var conceptList = await getAllFromLocalDb(\"localconcept\");\r\n\r\n GetConnectionsFromIndexDbLocal();\r\n // if(Array.isArray(conceptList)){\r\n // for(var i=0 ;i < conceptList.length ;i++){\r\n // LocalConceptsData.AddConcept(conceptList[i]);\r\n // }\r\n\r\n // }\r\n }\r\n\r\n/**\r\n * Loads all connections from the standard IndexedDB database into memory.\r\n *\r\n * This internal helper function retrieves all connection records from the database\r\n * and adds them to the ConnectionData memory structure. Connections represent\r\n * relationships or links between concepts in the system.\r\n *\r\n * This function is called by GetDataFromIndexDb as part of the initialization process,\r\n * ensuring all connection data is available in memory for efficient querying and traversal.\r\n *\r\n * @returns A promise that resolves when all connections have been loaded into memory\r\n *\r\n * @example\r\n * ```typescript\r\n * // This function is typically called internally by GetDataFromIndexDb\r\n * await GetConnectionsFromIndexDb();\r\n *\r\n * // Connections are now available in memory\r\n * const allConnections = ConnectionData.getAllConnections();\r\n * ```\r\n *\r\n * @remarks\r\n * - Retrieves records of type \"connection\" from the database\r\n * - Iterates through all retrieved connections and adds each to ConnectionData\r\n * - Only processes if the retrieved data is an array\r\n * - Internal function, not exported for external use\r\n *\r\n * @see {@link ConnectionData.AddConnectionToMemory} for how connections are stored\r\n * @see {@link getFromDatabaseWithTypeOld} for database query implementation\r\n * @see {@link GetDataFromIndexDb} for the parent initialization function\r\n */\r\n async function GetConnectionsFromIndexDb(){\r\n var connectionList = await getFromDatabaseWithTypeOld(\"connection\");\r\n if(Array.isArray(connectionList)){\r\n for(var i=0 ;i < connectionList.length ;i++){\r\n ConnectionData.AddConnectionToMemory(connectionList[i]);\r\n }\r\n\r\n }\r\n\r\n }\r\n\r\n/**\r\n * Loads all local connections from the local IndexedDB database into memory.\r\n *\r\n * This internal helper function retrieves all connection records from the local database\r\n * stores and adds them to the LocalConnectionData memory structure. Local connections\r\n * represent relationships that are specific to the local context, such as user-created\r\n * connections that haven't been synced or are intentionally kept local.\r\n *\r\n * This function is called by GetDataFromIndexDbLocal as part of the local data\r\n * initialization process, ensuring offline functionality and local-only features work correctly.\r\n *\r\n * @returns A promise that resolves when all local connections have been loaded into memory\r\n *\r\n * @example\r\n * ```typescript\r\n * // This function is typically called internally by GetDataFromIndexDbLocal\r\n * await GetConnectionsFromIndexDbLocal();\r\n *\r\n * // Local connections are now available in memory\r\n * const localConns = LocalConnectionData.getAllConnections();\r\n * ```\r\n *\r\n * @remarks\r\n * - Retrieves records from the \"localconnection\" store using getAllFromLocalDb\r\n * - Different from GetConnectionsFromIndexDb in that it targets local-only stores\r\n * - Iterates through all retrieved connections and adds each to LocalConnectionData\r\n * - Only processes if the retrieved data is an array\r\n * - Internal function, not exported for external use\r\n *\r\n * @see {@link LocalConnectionData.AddConnection} for how local connections are stored\r\n * @see {@link getAllFromLocalDb} for local database query implementation\r\n * @see {@link GetDataFromIndexDbLocal} for the parent local initialization function\r\n */\r\n async function GetConnectionsFromIndexDbLocal(){\r\n var connectionList = await getAllFromLocalDb(\"localconnection\");\r\n\r\n if(Array.isArray(connectionList)){\r\n for(var i=0 ;i < connectionList.length ;i++){\r\n LocalConnectionData.AddConnection(connectionList[i]);\r\n }\r\n }\r\n }\r\n\r\n","/**\r\n * @module GetLink\r\n * @description Retrieves linked concepts in the Concept Connection System (CCS).\r\n * This module provides functions to traverse concept relationships through linkers,\r\n * supporting pagination and both composition-based and raw concept retrieval.\r\n * Linkers are special concepts that define typed relationships between concepts.\r\n */\r\n\r\nimport { Connection } from \"../DataStructures/Connection\";\r\nimport { GetConceptByCharacterAndType } from \"../Api/GetConceptByCharacterAndType\";\r\nimport { GetConnectionOfTheConcept } from \"../Api/GetConnectionOfTheConcept\";\r\nimport { Concept } from \"./../DataStructures/Concept\";\r\nimport { GetCompositionWithIdAndDateFromMemory, GetCompositionWithIdFromMemory } from \"./GetComposition\";\r\nimport GetTheConcept from \"./GetTheConcept\";\r\nimport { GetAllConnectionsOfCompositionBulk } from \"../Api/GetAllConnectionsOfCompositionBulk\";\r\n\r\n/**\r\n * Retrieves linked concepts as compositions through a specified linker.\r\n *\r\n * This function follows a multi-step process to retrieve related concepts:\r\n * 1. Gets the source concept by ID\r\n * 2. Constructs a linker string from the concept's type and provided linker name\r\n * 3. Finds the linker concept (type 16)\r\n * 4. Retrieves all connections using that linker from the source concept\r\n * 5. Prefetches all target concepts for performance\r\n * 6. Converts each target concept to its composition representation\r\n *\r\n * The linker string format is: \"{type}_s_{linker}\" (e.g., \"user_s_posts\").\r\n *\r\n * @param id - The ID of the source concept to find links from\r\n * @param linker - The name of the linker relationship (e.g., \"posts\", \"comments\", \"likes\")\r\n * @param inpage - Number of results per page (default: 10)\r\n * @param page - Page number to retrieve (default: 1)\r\n *\r\n * @returns Promise resolving to an array of compositions representing linked concepts\r\n *\r\n * @remarks\r\n * - Linker concepts have type ID 16\r\n * - Uses bulk prefetching for performance optimization\r\n * - Returns compositions with full connection data\r\n * - Empty array if linker concept not found\r\n * - Linker format: \"{source_type}_s_{linker_name}\"\r\n * - The \"_s\" suffix indicates a plural/collection relationship\r\n *\r\n * @example\r\n * ```typescript\r\n * // Get all posts linked to a user (page 1, 10 per page)\r\n * const userPosts = await GetLink(123, \"posts\");\r\n *\r\n * // Get comments with custom pagination\r\n * const comments = await GetLink(456, \"comments\", 20, 2);\r\n *\r\n * // Get likes for a post\r\n * const likes = await GetLink(789, \"likes\", 50, 1);\r\n *\r\n * // Each result is a composition with connections\r\n * userPosts.forEach(post => {\r\n * console.log(\"Post composition:\", post);\r\n * });\r\n * ```\r\n *\r\n * @see {@link GetLinkRaw} - Returns raw concepts instead of compositions\r\n * @see {@link GetTheConcept} - Retrieves individual concepts\r\n * @see {@link GetCompositionWithIdAndDateFromMemory} - Converts concepts to compositions\r\n * @see {@link GetConnectionOfTheConcept} - Retrieves connections\r\n */\r\nexport async function GetLink(id:number, linker:string, inpage:number=10, page:number=1){\r\n var output: any[] = [];\r\n var concept:Concept = await GetTheConcept(id);\r\n var linkString: string = concept.type?.characterValue + \"_s\" + \"_\" + linker;\r\n var relatedConceptString = await GetConceptByCharacterAndType(linkString, 16);\r\n var relatedConcept = relatedConceptString as Concept;\r\n if(relatedConcept.id > 0){\r\n var connectionsString = await GetConnectionOfTheConcept(relatedConcept.id,concept.id, concept.userId,inpage, page);\r\n var connections = connectionsString as Connection[];\r\n var prefetch :number[] = [];\r\n for(var i=0; i<connections.length; i++){\r\n prefetch.push(connections[i].toTheConceptId);\r\n }\r\n await GetAllConnectionsOfCompositionBulk(prefetch);\r\n for(var i=0; i<connections.length; i++){\r\n let toConceptId = connections[i].toTheConceptId;\r\n let toConcept = await GetTheConcept(toConceptId);\r\n let newComposition = await GetCompositionWithIdAndDateFromMemory(toConcept.id);\r\n output.push(newComposition);\r\n }\r\n }\r\n return output;\r\n}\r\n\r\n/**\r\n * Retrieves linked concepts in raw form through a specified linker.\r\n *\r\n * This function is similar to GetLink but returns raw Concept objects instead\r\n * of compositions. It follows the same linker-based traversal but skips the\r\n * composition conversion step, making it more lightweight when only concept\r\n * data is needed without full connection details.\r\n *\r\n * Unlike GetLink, this function does not call GetAllConnectionsOfCompositionBulk\r\n * since it doesn't need to build compositions.\r\n *\r\n * @param id - The ID of the source concept to find links from\r\n * @param linker - The name of the linker relationship (e.g., \"posts\", \"comments\", \"likes\")\r\n * @param inpage - Number of results per page (default: 10)\r\n * @param page - Page number to retrieve (default: 1)\r\n *\r\n * @returns Promise resolving to an array of raw Concept objects\r\n *\r\n * @remarks\r\n * - Returns Concept objects directly without composition wrapper\r\n * - More lightweight than GetLink - use when compositions not needed\r\n * - Does not prefetch connection data\r\n * - Same linker string format: \"{source_type}_s_{linker_name}\"\r\n * - Empty array if linker concept not found\r\n * - Better performance for simple concept retrieval\r\n *\r\n * @example\r\n * ```typescript\r\n * // Get raw post concepts\r\n * const posts = await GetLinkRaw(123, \"posts\");\r\n * posts.forEach(post => {\r\n * console.log(\"Post ID:\", post.id);\r\n * console.log(\"Post Type:\", post.type);\r\n * });\r\n *\r\n * // Get comments without composition overhead\r\n * const comments = await GetLinkRaw(456, \"comments\", 20, 2);\r\n *\r\n * // Quick check for existence\r\n * const likes = await GetLinkRaw(789, \"likes\", 1, 1);\r\n * const hasLikes = likes.length > 0;\r\n * ```\r\n *\r\n * @see {@link GetLink} - Returns full compositions instead of raw concepts\r\n * @see {@link GetTheConcept} - Retrieves individual concepts\r\n * @see {@link GetConnectionOfTheConcept} - Retrieves connections\r\n */\r\nexport async function GetLinkRaw(id:number, linker:string, inpage:number=10, page:number=1){\r\n var output: Concept[] = [];\r\n var concept:Concept = await GetTheConcept(id);\r\n var linkString: string = concept.type?.characterValue + \"_s\" + \"_\" + linker;\r\n var relatedConceptString = await GetConceptByCharacterAndType(linkString, 16);\r\n var relatedConcept = relatedConceptString as Concept;\r\n if(relatedConcept.id > 0){\r\n var connectionsString = await GetConnectionOfTheConcept(relatedConcept.id,concept.id, concept.userId,inpage, page);\r\n var connections = connectionsString as Connection[];\r\n var prefetch :number[] = [];\r\n for(var i=0; i<connections.length; i++){\r\n prefetch.push(connections[i].toTheConceptId);\r\n }\r\n for(var i=0; i<connections.length; i++){\r\n let toConceptId = connections[i].toTheConceptId;\r\n let toConcept = await GetTheConcept(toConceptId);\r\n output.push(toConcept);\r\n }\r\n }\r\n return output;\r\n}\r\n","/**\r\n * @module GetLinkerConnectionFromConcept\r\n * @description Retrieves linker connections in the Concept Connection System (CCS).\r\n * This module provides functions to fetch all linker-type connections associated with\r\n * a concept, supporting both outgoing (from) and incoming (to) directions. Linker\r\n * connections are special connections that use linker concepts to define typed\r\n * collection relationships between concepts.\r\n */\r\n\r\nimport { GetAllLinkerConnectionsFromTheConcept } from \"../Api/GetAllLinkerConnectionsFromTheConcept\";\r\nimport { GetAllLinkerConnectionsToTheConcept } from \"../Api/GetAllLinkerConnectionsToTheConcept\";\r\nimport { Connection } from \"../DataStructures/Connection\";\r\nimport GetTheConcept from \"./GetTheConcept\";\r\n\r\n/**\r\n * Retrieves all linker connections originating from a concept.\r\n *\r\n * This function fetches all connections where the specified concept is the source\r\n * (ofTheConcept) and the connection type is a linker concept. It enriches each\r\n * connection by fetching and attaching the full type concept, allowing inspection\r\n * of what kind of linker relationship is being used.\r\n *\r\n * Linker connections typically represent collection relationships like \"user_s_posts\"\r\n * where the \"_s\" indicates a plural/collection relationship defined by a linker concept.\r\n *\r\n * @param id - The ID of the concept to get linker connections from\r\n *\r\n * @returns Promise resolving to an array of Connection objects with type concepts attached\r\n *\r\n * @remarks\r\n * - Fetches all linker connections without pagination\r\n * - Each connection's type property is populated with the full Concept\r\n * - Linker connections have special type concepts (typically type ID 16)\r\n * - Iterates through all connections to enrich with type data\r\n * - Connection.type will be a fully populated Concept object\r\n * - Used for traversing collection-based relationships\r\n *\r\n * @example\r\n * ```typescript\r\n * // Get all linker connections from a user\r\n * const userLinkers = await GetLinkerConnectionFromConcepts(123);\r\n * userLinkers.forEach(connection => {\r\n * console.log(\"Linker type:\", connection.type?.characterValue);\r\n * console.log(\"Points to:\", connection.toTheConceptId);\r\n * console.log(\"Connection ID:\", connection.id);\r\n * });\r\n *\r\n * // Find all collection relationships a concept participates in\r\n * const conceptLinkers = await GetLinkerConnectionFromConcepts(456);\r\n * const linkerTypes = conceptLinkers.map(c => c.type?.characterValue);\r\n * console.log(\"This concept has linkers:\", linkerTypes);\r\n * // Output: [\"user_s_posts\", \"user_s_comments\", ...]\r\n * ```\r\n *\r\n * @see {@link GetLinkerConnectionToConcepts} - Gets linker connections pointing to a concept\r\n * @see {@link GetAllLinkerConnectionsFromTheConcept} - API function for fetching connections\r\n * @see {@link GetTheConcept} - Fetches the type concept for each connection\r\n */\r\nexport async function GetLinkerConnectionFromConcepts(id:number){\r\n\r\n var connections = await GetAllLinkerConnectionsFromTheConcept(id);\r\n\r\n for(var i=0;i<connections.length;i++){\r\n let localConnection = connections[i] as Connection;\r\n var connectionIdentifier = localConnection.typeId;\r\n let concept = await GetTheConcept(connectionIdentifier);\r\n localConnection.type = concept;\r\n }\r\n\r\n return connections;\r\n\r\n}\r\n\r\n/**\r\n * Retrieves all linker connections pointing to a concept.\r\n *\r\n * This function fetches all connections where the specified concept is the target\r\n * (toTheConcept) and the connection type is a linker concept. It enriches each\r\n * connection by fetching and attaching the full type concept, allowing inspection\r\n * of what kind of linker relationship is being used.\r\n *\r\n * This is the inverse of GetLinkerConnectionFromConcepts - it finds all collection\r\n * relationships where this concept is included as a member of the collection.\r\n *\r\n * @param id - The ID of the concept to get linker connections to\r\n *\r\n * @returns Promise resolving to an array of Connection objects with type concepts attached\r\n *\r\n * @remarks\r\n * - Fetches all incoming linker connections without pagination\r\n * - Each connection's type property is populated with the full Concept\r\n * - Useful for finding all collections that include this concept\r\n * - Connection.type will be a fully populated Concept object\r\n * - Reverse direction of GetLinkerConnectionFromConcepts\r\n * - Used for reverse traversal of collection relationships\r\n *\r\n * @example\r\n * ```typescript\r\n * // Find all collections that include this post\r\n * const postInCollections = await GetLinkerConnectionToConcepts(789);\r\n * postInCollections.forEach(connection => {\r\n * console.log(\"Included in collection:\", connection.type?.characterValue);\r\n * console.log(\"Collection owner:\", connection.ofTheConceptId);\r\n * });\r\n *\r\n * // Check if a concept is part of any linker collections\r\n * const incomingLinkers = await GetLinkerConnectionToConcepts(456);\r\n * const isInCollections = incomingLinkers.length > 0;\r\n * console.log(\"Is part of collections:\", isInCollections);\r\n *\r\n * // Find what users have this comment in their collection\r\n * const commentCollections = await GetLinkerConnectionToConcepts(123);\r\n * const ownerIds = commentCollections.map(c => c.ofTheConceptId);\r\n * console.log(\"Owned by concepts:\", ownerIds);\r\n * ```\r\n *\r\n * @see {@link GetLinkerConnectionFromConcepts} - Gets linker connections from a concept\r\n * @see {@link GetAllLinkerConnectionsToTheConcept} - API function for fetching connections\r\n * @see {@link GetTheConcept} - Fetches the type concept for each connection\r\n */\r\nexport async function GetLinkerConnectionToConcepts(id:number){\r\n\r\n var connections = await GetAllLinkerConnectionsToTheConcept(id);\r\n\r\n for(var i=0;i<connections.length;i++){\r\n let localConnection = connections[i] as Connection;\r\n var connectionIdentifier = localConnection.typeId;\r\n let concept = await GetTheConcept(connectionIdentifier);\r\n localConnection.type = concept;\r\n }\r\n\r\n return connections;\r\n\r\n}","/**\r\n * @module GetRelation\r\n * @description Retrieves related concepts in the Concept Connection System (CCS).\r\n * This module provides functions to traverse concept relationships, supporting both\r\n * forward and reverse traversal, pagination, and multiple return formats (compositions,\r\n * raw concepts, or connections). Relations define semantic connections between concepts.\r\n */\r\n\r\nimport { Connection } from \"../DataStructures/Connection\";\r\nimport { GetConnectionOfTheConcept } from \"../Api/GetConnectionOfTheConcept\";\r\nimport { Concept } from \"./../DataStructures/Concept\";\r\nimport { GetCompositionWithIdAndDateFromMemory } from \"./GetComposition\";\r\nimport GetTheConcept from \"./GetTheConcept\";\r\nimport { GetAllConnectionsOfCompositionBulk } from \"../Api/GetAllConnectionsOfCompositionBulk\";\r\nimport { GetConceptByCharacterAndCategory } from \"./ConceptFinding/GetConceptByCharacterAndCategory\";\r\nimport { GetConnectionToTheConcept } from \"../Api/GetConnectionToTheConcept\";\r\nimport { GetConceptBulk } from \"../app\";\r\n\r\n/**\r\n * Retrieves related concepts as compositions through a specified relation.\r\n *\r\n * This function traverses concept relationships in either forward or reverse direction:\r\n * - Forward: Finds concepts that the source concept points TO via the relation\r\n * - Reverse: Finds concepts that point TO the source concept via the relation\r\n *\r\n * The process:\r\n * 1. Gets the source concept by ID\r\n * 2. Finds the relation concept by character and category\r\n * 3. Retrieves connections in the specified direction\r\n * 4. Prefetches all related concepts for performance\r\n * 5. Converts each concept to its composition representation\r\n *\r\n * @param id - The ID of the source concept to find relations for\r\n * @param relation - The name of the relation (e.g., \"author\", \"parent\", \"tag\")\r\n * @param inpage - Number of results per page (default: 10)\r\n * @param page - Page number to retrieve (default: 1)\r\n * @param reverse - If true, finds concepts pointing TO this concept; if false, finds concepts this concept points TO (default: false)\r\n *\r\n * @returns Promise resolving to an array of compositions representing related concepts\r\n *\r\n * @remarks\r\n * - Uses GetConceptByCharacterAndCategory to find the relation concept\r\n * - Forward direction uses GetConnectionOfTheConcept (from -> to)\r\n * - Reverse direction uses GetConnectionToTheConcept (to <- from)\r\n * - Uses bulk prefetching for performance optimization\r\n * - Returns compositions with full connection data\r\n * - Empty array if relation concept not found\r\n *\r\n * @example\r\n * ```typescript\r\n * // Get all posts authored by a user (forward relation)\r\n * const userPosts = await GetRelation(123, \"author\", 10, 1, false);\r\n *\r\n * // Get the author of a post (reverse relation)\r\n * const postAuthor = await GetRelation(456, \"author\", 1, 1, true);\r\n *\r\n * // Get tags for an article (forward)\r\n * const tags = await GetRelation(789, \"tag\", 20, 1, false);\r\n *\r\n * // Get all articles with a specific tag (reverse)\r\n * const taggedArticles = await GetRelation(789, \"tag\", 20, 1, true);\r\n *\r\n * // Each result is a composition with connections\r\n * userPosts.forEach(post => {\r\n * console.log(\"Related composition:\", post);\r\n * });\r\n * ```\r\n *\r\n * @see {@link GetRelationRaw} - Returns raw concepts instead of compositions\r\n * @see {@link GetRelationConnections} - Returns connection objects\r\n * @see {@link GetTheConcept} - Retrieves individual concepts\r\n * @see {@link GetCompositionWithIdAndDateFromMemory} - Converts concepts to compositions\r\n */\r\nexport async function GetRelation(id:number, relation:string, inpage:number=10, page:number=1, reverse:boolean = false){\r\n let output: any[] = [];\r\n let concept:Concept = await GetTheConcept(id);\r\n let relatedConceptString = await GetConceptByCharacterAndCategory(relation);\r\n let relatedConcept = relatedConceptString as Concept;\r\n if(relatedConcept.id > 0){\r\n let prefetch :number[] = [];\r\n let connections:Connection[] = [];\r\n if(reverse){\r\n let connectionsString = await GetConnectionToTheConcept(relatedConcept.id,concept.id, concept.userId,inpage, page);\r\n connections = connectionsString as Connection[];\r\n let prefetch :number[] = [];\r\n for(let i=0; i<connections.length; i++){\r\n prefetch.push(connections[i].ofTheConceptId);\r\n }\r\n await GetAllConnectionsOfCompositionBulk(prefetch);\r\n for(let i=0; i<connections.length; i++){\r\n let ofTheConceptId = connections[i].ofTheConceptId;\r\n let ofConcept = await GetTheConcept(ofTheConceptId);\r\n let newComposition = await GetCompositionWithIdAndDateFromMemory(ofConcept.id);\r\n output.push(newComposition);\r\n }\r\n }\r\n else{\r\n let connectionsString = await GetConnectionOfTheConcept(relatedConcept.id,concept.id, concept.userId,inpage, page);\r\n connections = connectionsString as Connection[];\r\n for(let i=0; i<connections.length; i++){\r\n prefetch.push(connections[i].toTheConceptId);\r\n }\r\n await GetAllConnectionsOfCompositionBulk(prefetch);\r\n for(let i=0; i<connections.length; i++){\r\n let toConceptId = connections[i].toTheConceptId;\r\n let toConcept = await GetTheConcept(toConceptId);\r\n let newComposition = await GetCompositionWithIdAndDateFromMemory(toConcept.id);\r\n output.push(newComposition);\r\n }\r\n }\r\n\r\n\r\n }\r\n return output;\r\n}\r\n\r\n/**\r\n * Retrieves related concepts in raw form through a specified relation.\r\n *\r\n * This function is similar to GetRelation but returns raw Concept objects instead\r\n * of compositions. It supports both forward and reverse traversal and uses bulk\r\n * concept retrieval for optimal performance. This is more lightweight when only\r\n * concept data is needed without full composition details.\r\n *\r\n * @param id - The ID of the source concept to find relations for\r\n * @param relation - The name of the relation (e.g., \"author\", \"parent\", \"tag\")\r\n * @param inpage - Number of results per page (default: 10)\r\n * @param page - Page number to retrieve (default: 1)\r\n * @param reverse - If true, finds concepts pointing TO this concept; if false, finds concepts this concept points TO (default: false)\r\n *\r\n * @returns Promise resolving to an array of raw Concept objects\r\n *\r\n * @remarks\r\n * - Returns Concept objects directly without composition wrapper\r\n * - More lightweight than GetRelation - use when compositions not needed\r\n * - Uses GetConceptBulk for efficient bulk retrieval\r\n * - Supports both forward and reverse traversal\r\n * - Empty array if relation concept not found\r\n * - Better performance for simple concept retrieval\r\n *\r\n * @example\r\n * ```typescript\r\n * // Get raw author concepts\r\n * const authors = await GetRelationRaw(123, \"author\", 10, 1, true);\r\n * authors.forEach(author => {\r\n * console.log(\"Author ID:\", author.id);\r\n * console.log(\"Author Type:\", author.type);\r\n * });\r\n *\r\n * // Get related tags without composition overhead\r\n * const tags = await GetRelationRaw(456, \"tag\", 20, 1, false);\r\n *\r\n * // Quick check for existence\r\n * const parents = await GetRelationRaw(789, \"parent\", 1, 1, false);\r\n * const hasParent = parents.length > 0;\r\n * ```\r\n *\r\n * @see {@link GetRelation} - Returns full compositions instead of raw concepts\r\n * @see {@link GetRelationConnections} - Returns connection objects\r\n * @see {@link GetConceptBulk} - Bulk concept retrieval\r\n */\r\nexport async function GetRelationRaw(id:number, relation:string, inpage:number=10, page:number=1, reverse:boolean = false){\r\n let output: Concept[] = [];\r\n let concept:Concept = await GetTheConcept(id);\r\n let relatedConceptString = await GetConceptByCharacterAndCategory(relation);\r\n let relatedConcept = relatedConceptString as Concept;\r\n let connections:Connection[] = [];\r\n let prefetch :number[] = [];\r\n\r\n if(relatedConcept.id > 0){\r\n if(reverse){\r\n let connectionsString = await GetConnectionToTheConcept(relatedConcept.id,concept.id, concept.userId,inpage, page);\r\n connections = connectionsString as Connection[];\r\n for(let i=0; i<connections.length; i++){\r\n prefetch.push(connections[i].ofTheConceptId);\r\n }\r\n }\r\n else{\r\n let connectionsString = await GetConnectionOfTheConcept(relatedConcept.id,concept.id, concept.userId,inpage, page);\r\n connections = connectionsString as Connection[];\r\n for(let i=0; i<connections.length; i++){\r\n prefetch.push(connections[i].toTheConceptId);\r\n }\r\n }\r\n output = await GetConceptBulk(prefetch);\r\n }\r\n return output;\r\n}\r\n\r\n/**\r\n * Retrieves connection objects for a specified relation.\r\n *\r\n * This function returns the actual Connection objects that link concepts through\r\n * a relation, rather than the related concepts themselves. This is useful when\r\n * you need to inspect or manipulate the connection metadata, timestamps, or\r\n * relationship properties directly.\r\n *\r\n * Unlike GetRelation and GetRelationRaw which return concepts, this returns the\r\n * connections that define the relationships, allowing access to connection-specific\r\n * data like creation time, sync status, and connection properties.\r\n *\r\n * @param id - The ID of the source concept to find relation connections for\r\n * @param relation - The name of the relation (e.g., \"author\", \"parent\", \"tag\")\r\n * @param inpage - Number of results per page (default: 10)\r\n * @param page - Page number to retrieve (default: 1)\r\n * @param reverse - If true, finds connections pointing TO this concept; if false, finds connections FROM this concept (default: false)\r\n *\r\n * @returns Promise resolving to an array of Connection objects\r\n *\r\n * @remarks\r\n * - Returns Connection objects, not Concept objects\r\n * - Provides access to connection metadata and properties\r\n * - Supports both forward and reverse traversal\r\n * - Does not fetch or return the actual concepts being connected\r\n * - Empty array if relation concept not found\r\n * - Useful for connection-level operations and analysis\r\n * - Connection objects contain: typeId, ofTheConceptId, toTheConceptId, etc.\r\n *\r\n * @example\r\n * ```typescript\r\n * // Get connection objects for author relations\r\n * const authorConnections = await GetRelationConnections(123, \"author\", 10, 1, false);\r\n * authorConnections.forEach(conn => {\r\n * console.log(\"Connection Type ID:\", conn.typeId);\r\n * console.log(\"From Concept:\", conn.ofTheConceptId);\r\n * console.log(\"To Concept:\", conn.toTheConceptId);\r\n * console.log(\"Created:\", conn.localSyncTime);\r\n * });\r\n *\r\n * // Get tag connections in reverse\r\n * const tagConnections = await GetRelationConnections(456, \"tag\", 20, 1, true);\r\n *\r\n * // Check connection metadata\r\n * const parentConnections = await GetRelationConnections(789, \"parent\", 1, 1, false);\r\n * if (parentConnections.length > 0) {\r\n * console.log(\"Parent connection exists\");\r\n * console.log(\"Connection details:\", parentConnections[0]);\r\n * }\r\n * ```\r\n *\r\n * @see {@link GetRelation} - Returns related concepts as compositions\r\n * @see {@link GetRelationRaw} - Returns related concepts as raw objects\r\n * @see {@link Connection} - Connection data structure\r\n */\r\nexport async function GetRelationConnections(id:number, relation:string, inpage:number=10, page:number=1, reverse:boolean = false){\r\n let output: Concept[] = [];\r\n let concept:Concept = await GetTheConcept(id);\r\n let relatedConceptString = await GetConceptByCharacterAndCategory(relation);\r\n let relatedConcept = relatedConceptString as Concept;\r\n let connections:Connection[] = [];\r\n let prefetch :number[] = [];\r\n if(relatedConcept.id > 0){\r\n if(reverse){\r\n let connectionsString = await GetConnectionToTheConcept(relatedConcept.id,concept.id, concept.userId,inpage, page);\r\n connections = connectionsString as Connection[];\r\n }\r\n else{\r\n let connectionsString = await GetConnectionOfTheConcept(relatedConcept.id,concept.id, concept.userId,inpage, page);\r\n connections = connectionsString as Connection[];\r\n }\r\n }\r\n return connections;\r\n}\r\n","/**\r\n * Concept Retrieval Service\r\n *\r\n * This module provides the primary interface for retrieving concepts from the system.\r\n * It implements a multi-tier caching strategy that checks local memory first, then\r\n * falls back to API calls. It also handles special ghost concepts (negative IDs) and\r\n * ensures concept type information is properly populated.\r\n *\r\n * @module GetTheConcept\r\n */\r\n\r\nimport { GetConcept } from \"../Api/GetConcept\";\r\nimport { convertFromLConceptToConcept, GetUserGhostId, LConcept, UserBinaryTree } from \"../app\";\r\nimport { Concept } from \"../DataStructures/Concept\";\r\nimport { ConceptsData } from \"../DataStructures/ConceptData\";\r\nimport { CreateDefaultConcept } from \"./CreateDefaultConcept\";\r\n\r\n/**\r\n * Retrieves a concept by ID with automatic caching and type population.\r\n *\r\n * This is the primary function for concept retrieval in the CCS system. It implements\r\n * a sophisticated multi-tier lookup strategy:\r\n * 1. For negative IDs: Retrieves ghost concepts from user-specific storage\r\n * 2. For positive IDs: Checks local cache (ConceptsData) first\r\n * 3. Falls back to API call (GetConcept) if not in cache\r\n * 4. Ensures the concept's type information is populated\r\n * 5. Returns default concept if all retrieval attempts fail\r\n *\r\n * Ghost concepts (negative IDs) are special user-specific concepts that exist in\r\n * local storage rather than the main database. They're converted from LConcept format\r\n * to standard Concept format during retrieval.\r\n *\r\n * @param id - The ID of the concept to retrieve (negative IDs are ghost concepts)\r\n * @param userId - The user ID for ghost concept lookup (default: 999)\r\n *\r\n * @returns A promise that resolves to the retrieved Concept, or a default concept if not found\r\n *\r\n * @example\r\n * ```typescript\r\n * // Retrieve a regular concept\r\n * const concept = await GetTheConcept(12345);\r\n * console.log(\"Concept type:\", concept.type?.characterValue);\r\n * console.log(\"Concept value:\", concept.characterValue);\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Retrieve a ghost concept (negative ID)\r\n * const ghostConcept = await GetTheConcept(-100, 456);\r\n * console.log(\"Ghost concept:\", ghostConcept.characterValue);\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Check if concept was found\r\n * const concept = await GetTheConcept(99999);\r\n * if (concept.id === 0) {\r\n * console.log(\"Concept not found, using default\");\r\n * } else {\r\n * console.log(\"Found concept:\", concept.id);\r\n * }\r\n * ```\r\n *\r\n * @remarks\r\n * - Negative IDs indicate ghost concepts stored in user-specific storage\r\n * - Ghost concepts are converted from LConcept to Concept format\r\n * - The function checks local cache (ConceptsData) before making API calls\r\n * - If a concept is found but has no type populated, fetches and attaches the type\r\n * - Type concepts are also cached for efficiency\r\n * - Returns a default concept (id=0) if retrieval fails at all levels\r\n * - The function is null-safe; always returns a Concept instance\r\n * - Automatically populates concept.type if it's null but typeId exists\r\n *\r\n * @see {@link CreateDefaultConcept} for the default concept structure\r\n * @see {@link ConceptsData.GetConcept} for cache lookup\r\n * @see {@link GetConcept} for API-based retrieval\r\n * @see {@link GetUserGhostId} for ghost concept retrieval\r\n */\r\nexport default async function GetTheConcept(id: number, userId: number = 999){\r\n var concept = CreateDefaultConcept();\r\n if(id < 0){\r\n let lconcept:LConcept = await GetUserGhostId(userId, id);\r\n concept = convertFromLConceptToConcept(lconcept)\r\n return concept;\r\n }\r\n concept = await ConceptsData.GetConcept(id);\r\n if((concept == null || concept.id == 0) && id != null && id != undefined){\r\n var conceptString = await GetConcept(id);\r\n \r\n concept = conceptString as Concept;\r\n }\r\n if( concept.id != 0){\r\n\r\n if(concept.type == null) {\r\n\r\n var conceptType = await ConceptsData.GetConcept(concept.typeId);\r\n if(conceptType == null && concept.typeId != null && concept.typeId != undefined){\r\n var typeConceptString = await GetConcept(concept.typeId);\r\n var typeConcept = typeConceptString as Concept;\r\n concept.type = typeConcept;\r\n }\r\n }\r\n }\r\n\r\n return concept;\r\n}","/**\r\n * @fileoverview HTTP Client - Handles API requests with automatic token refresh on 401 errors.\r\n * This module provides a robust HTTP client that automatically refreshes OAuth tokens\r\n * when receiving 401 Unauthorized responses, ensuring seamless API access.\r\n * @module Services/Http/HttpClient\r\n */\r\n\r\nimport { TokenStorage } from '../../DataStructures/Security/TokenStorage';\r\nimport { getOAuthToken } from '../oauth/CallOauth.service';\r\n\r\n/**\r\n * Custom error thrown when token refresh fails.\r\n */\r\nexport class TokenRefreshError extends Error {\r\n constructor(message: string) {\r\n super(message);\r\n this.name = 'TokenRefreshError';\r\n }\r\n}\r\n\r\n/**\r\n * Container for HTTP response data.\r\n * Provides convenient methods to parse response body as JSON or text.\r\n */\r\nexport class HttpResponse {\r\n /**\r\n * Creates a new HttpResponse instance.\r\n * @param status - HTTP status code\r\n * @param body - Response body as string\r\n * @param headers - Response headers\r\n */\r\n constructor(\r\n public status: number,\r\n public body: string,\r\n public headers: Record<string, string>\r\n ) {}\r\n\r\n /**\r\n * Parse response body as JSON.\r\n * @returns {Promise<any>} Parsed JSON object\r\n *\r\n * @example\r\n * ```typescript\r\n * const response = await requestWithRetry('GET', url);\r\n * const data = await response.json();\r\n * console.log(data.id);\r\n * ```\r\n */\r\n async json(): Promise<any> {\r\n return JSON.parse(this.body);\r\n }\r\n\r\n /**\r\n * Get response body as text.\r\n * @returns {Promise<string>} Response body as string\r\n *\r\n * @example\r\n * ```typescript\r\n * const response = await requestWithRetry('GET', url);\r\n * const text = await response.text();\r\n * console.log(text);\r\n * ```\r\n */\r\n async text(): Promise<string> {\r\n return this.body;\r\n }\r\n\r\n /**\r\n * Checks if the response status indicates success (200-299).\r\n * @returns {boolean} True if status is in the 2xx range\r\n */\r\n get ok(): boolean {\r\n return this.status >= 200 && this.status < 300;\r\n }\r\n}\r\n\r\n/**\r\n * Attempt to refresh the OAuth token using stored credentials.\r\n *\r\n * @returns {Promise<boolean>} True if token refresh was successful, false otherwise.\r\n *\r\n * @example\r\n * ```typescript\r\n * const success = await refreshOAuthTokenInternal();\r\n * if (success) {\r\n * console.log('Token refreshed successfully');\r\n * }\r\n * ```\r\n */\r\nasync function refreshOAuthTokenInternal(): Promise<boolean> {\r\n // Check if we have OAuth credentials stored\r\n if (!TokenStorage.hasOAuthCredentials()) {\r\n return false;\r\n }\r\n\r\n try {\r\n const oauthResponse = await getOAuthToken(\r\n TokenStorage.CLIENT_ID,\r\n TokenStorage.CLIENT_SECRET,\r\n TokenStorage.APPLICATION_NAME,\r\n true\r\n );\r\n\r\n return oauthResponse.success;\r\n } catch (error) {\r\n console.error('Token refresh failed:', error);\r\n return false;\r\n }\r\n}\r\n\r\n/**\r\n * Make an HTTP request with automatic retry on 401 Unauthorized.\r\n *\r\n * If a 401 error occurs and OAuth credentials are available, this function\r\n * will automatically refresh the token and retry the request once.\r\n *\r\n * @async\r\n * @param {string} method - HTTP method (GET, POST, PUT, DELETE, etc.)\r\n * @param {string} url - The URL to request\r\n * @param {Record<string, string>} [headers] - Optional headers dict\r\n * @param {any} [body] - Optional request body (JSON will be stringified)\r\n * @param {number} [maxRetries=1] - Maximum number of retries on 401\r\n * @returns {Promise<HttpResponse>} HttpResponse object with status, body, and headers\r\n * @throws {TokenRefreshError} If token refresh fails\r\n * @throws {Error} For other network errors\r\n *\r\n * @example\r\n * ```typescript\r\n * const headers = { \"Content-Type\": \"application/json\" };\r\n * const response = await requestWithRetry(\r\n * \"POST\",\r\n * url,\r\n * headers,\r\n * { id: 123 }\r\n * );\r\n * if (response.ok) {\r\n * const data = await response.json();\r\n * console.log(data);\r\n * }\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Automatic token refresh on 401\r\n * try {\r\n * const response = await requestWithRetry(\"GET\", url);\r\n * // If receives 401, will automatically refresh token and retry\r\n * } catch (error) {\r\n * if (error instanceof TokenRefreshError) {\r\n * console.error('Authentication failed:', error.message);\r\n * }\r\n * }\r\n * ```\r\n */\r\nexport async function requestWithRetry(\r\n method: string,\r\n url: string,\r\n headers?: Record<string, string>,\r\n body?: any,\r\n maxRetries: number = 1\r\n): Promise<HttpResponse> {\r\n const requestHeaders: Record<string, string> = {\r\n ...headers,\r\n ...TokenStorage.getAuthHeader()\r\n };\r\n\r\n for (let attempt = 0; attempt <= maxRetries; attempt++) {\r\n try {\r\n // Prepare fetch options\r\n const fetchOptions: RequestInit = {\r\n method,\r\n headers: requestHeaders,\r\n };\r\n\r\n // Add body if provided\r\n if (body !== undefined) {\r\n if (typeof body === 'object') {\r\n // If body is an object and no Content-Type is set, assume JSON\r\n if (!requestHeaders['Content-Type'] && !requestHeaders['content-type']) {\r\n requestHeaders['Content-Type'] = 'application/json';\r\n }\r\n\r\n // If Content-Type is JSON, stringify the body\r\n if (requestHeaders['Content-Type']?.includes('application/json') ||\r\n requestHeaders['content-type']?.includes('application/json')) {\r\n fetchOptions.body = JSON.stringify(body);\r\n } else {\r\n fetchOptions.body = body;\r\n }\r\n } else {\r\n fetchOptions.body = body;\r\n }\r\n }\r\n\r\n fetchOptions.headers = requestHeaders;\r\n\r\n // Make the request\r\n const response = await fetch(url, fetchOptions);\r\n\r\n // Read the response body\r\n const responseBody = await response.text();\r\n const responseHeaders: Record<string, string> = {};\r\n response.headers.forEach((value, key) => {\r\n responseHeaders[key] = value;\r\n });\r\n\r\n // If successful or not a 401, return the response\r\n if (response.status !== 401) {\r\n return new HttpResponse(\r\n response.status,\r\n responseBody,\r\n responseHeaders\r\n );\r\n }\r\n\r\n // On 401, attempt token refresh (only on first retry)\r\n if (attempt < maxRetries) {\r\n console.log('Received 401 Unauthorized, attempting token refresh...');\r\n\r\n const refreshSuccess = await refreshOAuthTokenInternal();\r\n\r\n if (refreshSuccess) {\r\n console.log('Token refreshed successfully, retrying request...');\r\n // Update headers with new token\r\n Object.assign(requestHeaders, TokenStorage.getAuthHeader());\r\n // Loop will retry the request\r\n continue;\r\n } else {\r\n throw new TokenRefreshError(\r\n 'Token refresh failed. Please check OAuth credentials.'\r\n );\r\n }\r\n } else {\r\n // Max retries reached, return the 401 response\r\n return new HttpResponse(\r\n response.status,\r\n responseBody,\r\n responseHeaders\r\n );\r\n }\r\n } catch (error) {\r\n // If it's already a TokenRefreshError, rethrow it\r\n if (error instanceof TokenRefreshError) {\r\n throw error;\r\n }\r\n\r\n // For other errors, if we've exhausted retries, throw the error\r\n if (attempt >= maxRetries) {\r\n throw error;\r\n }\r\n\r\n // Otherwise, continue to retry\r\n console.error(`Request failed (attempt ${attempt + 1}/${maxRetries + 1}):`, error);\r\n }\r\n }\r\n\r\n // This should never be reached, but TypeScript needs it\r\n throw new Error('Request failed after all retry attempts');\r\n}\r\n\r\n/**\r\n * Convenience method for POST requests with automatic retry on 401.\r\n *\r\n * @async\r\n * @param {string} url - The URL to request\r\n * @param {Record<string, string>} [headers] - Optional headers dict\r\n * @param {any} [body] - Optional request body (will be JSON stringified if object)\r\n * @returns {Promise<HttpResponse>} HttpResponse object\r\n *\r\n * @example\r\n * ```typescript\r\n * const response = await postWithRetry(\r\n * \"https://api.example.com/concepts\",\r\n * { \"Content-Type\": \"application/json\" },\r\n * { name: \"Test\", value: 123 }\r\n * );\r\n * if (response.ok) {\r\n * const data = await response.json();\r\n * console.log('Created:', data);\r\n * }\r\n * ```\r\n */\r\nexport async function postWithRetry(\r\n url: string,\r\n headers?: Record<string, string>,\r\n body?: any\r\n): Promise<HttpResponse> {\r\n return requestWithRetry('POST', url, headers, body);\r\n}\r\n\r\n/**\r\n * Convenience method for GET requests with automatic retry on 401.\r\n *\r\n * @async\r\n * @param {string} url - The URL to request\r\n * @param {Record<string, string>} [headers] - Optional headers dict\r\n * @param {Record<string, any>} [params] - Optional query parameters\r\n * @returns {Promise<HttpResponse>} HttpResponse object\r\n *\r\n * @example\r\n * ```typescript\r\n * const response = await getWithRetry(\r\n * \"https://api.example.com/concepts\",\r\n * undefined,\r\n * { id: 123, type: \"test\" }\r\n * );\r\n * if (response.ok) {\r\n * const data = await response.json();\r\n * console.log(data);\r\n * }\r\n * ```\r\n */\r\nexport async function getWithRetry(\r\n url: string,\r\n headers?: Record<string, string>,\r\n params?: Record<string, any>\r\n): Promise<HttpResponse> {\r\n let finalUrl = url;\r\n\r\n // Build query string if params provided\r\n if (params) {\r\n const queryParts: string[] = [];\r\n for (const key in params) {\r\n if (params.hasOwnProperty(key)) {\r\n queryParts.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(params[key]))}`);\r\n }\r\n }\r\n\r\n if (queryParts.length > 0) {\r\n finalUrl = `${url}?${queryParts.join('&')}`;\r\n }\r\n }\r\n\r\n return requestWithRetry('GET', finalUrl, headers);\r\n}\r\n\r\n/**\r\n * Convenience method for PUT requests with automatic retry on 401.\r\n *\r\n * @async\r\n * @param {string} url - The URL to request\r\n * @param {Record<string, string>} [headers] - Optional headers dict\r\n * @param {any} [body] - Optional request body\r\n * @returns {Promise<HttpResponse>} HttpResponse object\r\n *\r\n * @example\r\n * ```typescript\r\n * const response = await putWithRetry(\r\n * \"https://api.example.com/concepts/123\",\r\n * { \"Content-Type\": \"application/json\" },\r\n * { name: \"Updated Name\" }\r\n * );\r\n * ```\r\n */\r\nexport async function putWithRetry(\r\n url: string,\r\n headers?: Record<string, string>,\r\n body?: any\r\n): Promise<HttpResponse> {\r\n return requestWithRetry('PUT', url, headers, body);\r\n}\r\n\r\n/**\r\n * Convenience method for DELETE requests with automatic retry on 401.\r\n *\r\n * @async\r\n * @param {string} url - The URL to request\r\n * @param {Record<string, string>} [headers] - Optional headers dict\r\n * @returns {Promise<HttpResponse>} HttpResponse object\r\n *\r\n * @example\r\n * ```typescript\r\n * const response = await deleteWithRetry(\r\n * \"https://api.example.com/concepts/123\"\r\n * );\r\n * if (response.ok) {\r\n * console.log('Deleted successfully');\r\n * }\r\n * ```\r\n */\r\nexport async function deleteWithRetry(\r\n url: string,\r\n headers?: Record<string, string>\r\n): Promise<HttpResponse> {\r\n return requestWithRetry('DELETE', url, headers);\r\n}\r\n\r\n/**\r\n * Convenience method for PATCH requests with automatic retry on 401.\r\n *\r\n * @async\r\n * @param {string} url - The URL to request\r\n * @param {Record<string, string>} [headers] - Optional headers dict\r\n * @param {any} [body] - Optional request body\r\n * @returns {Promise<HttpResponse>} HttpResponse object\r\n *\r\n * @example\r\n * ```typescript\r\n * const response = await patchWithRetry(\r\n * \"https://api.example.com/concepts/123\",\r\n * { \"Content-Type\": \"application/json\" },\r\n * { status: \"active\" }\r\n * );\r\n * ```\r\n */\r\nexport async function patchWithRetry(\r\n url: string,\r\n headers?: Record<string, string>,\r\n body?: any\r\n): Promise<HttpResponse> {\r\n return requestWithRetry('PATCH', url, headers, body);\r\n}\r\n","/**\r\n * System Initialization Service\r\n *\r\n * This module provides core initialization functionality for the CCS-JS system, handling\r\n * the startup sequence including settings retrieval, AI data synchronization, and system\r\n * configuration. It manages both the initial system bootstrap and subsequent synchronization\r\n * status updates.\r\n *\r\n * The initialization process ensures that all necessary data structures, settings, and\r\n * AI-related data are properly loaded before the application becomes fully operational.\r\n *\r\n * @module InitializeSystem\r\n */\r\n\r\nimport { GetAiData } from \"../Api/GetAiData\";\r\nimport { GetAllPrefetchConnections } from \"../Api/GetAllPrefetchConnections\";\r\nimport { BinaryTree } from \"../DataStructures/BinaryTree\";\r\nimport { SettingData } from \"../DataStructures/SettingData\";\r\nimport { Settings } from \"../DataStructures/Settings\";\r\nimport { AiUpdateFlag, GetStatsFromDatabase } from \"../Database/NoIndexDb\";\r\n\r\n/**\r\n * Initializes the CCS-JS system by loading settings and AI data.\r\n *\r\n * This is the primary initialization function that bootstraps the application by:\r\n * 1. Retrieving system statistics and settings from the database\r\n * 2. Loading AI-related data through the GetAiData API call\r\n * 3. Returning a success indicator to confirm initialization completion\r\n *\r\n * This function should be called once during application startup before any other\r\n * operations are performed. It ensures the system is in a ready state with all\r\n * necessary configuration and data loaded.\r\n *\r\n * @returns A promise that resolves to true when initialization is complete\r\n *\r\n * @example\r\n * ```typescript\r\n * // Initialize the system at application startup\r\n * const initialized = await InitializeSystem();\r\n * if (initialized) {\r\n * console.log('System initialized successfully');\r\n * // Proceed with application logic\r\n * }\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Use in an async initialization flow\r\n * async function startApplication() {\r\n * try {\r\n * await InitializeSystem();\r\n * // Load additional data structures\r\n * await CreateBinaryTreeFromData();\r\n * console.log('Application ready');\r\n * } catch (error) {\r\n * console.error('Initialization failed:', error);\r\n * }\r\n * }\r\n * ```\r\n *\r\n * @remarks\r\n * - Should be called once during application bootstrap\r\n * - Loads statsData from database and casts it to SettingData type\r\n * - Retrieves AI data from external API or data source\r\n * - Always returns true upon successful completion\r\n * - Does not handle errors explicitly; calling code should wrap in try-catch if needed\r\n *\r\n * @see {@link GetStatsFromDatabase} for statistics and settings retrieval\r\n * @see {@link GetAiData} for AI data loading implementation\r\n * @see {@link SettingData} for the settings data structure\r\n * @see {@link PurgatoryDatabaseUpdated} for post-sync initialization\r\n */\r\nexport default async function InitializeSystem(){\r\n var statsData = await GetStatsFromDatabase();\r\n var settings = statsData as SettingData;\r\n await GetAiData();\r\n return true;\r\n\r\n}\r\n\r\n/**\r\n * Updates the system settings to reflect that the purgatory database has been synchronized.\r\n *\r\n * This function is called after the purgatory database (a staging or temporary database)\r\n * has been successfully updated or synchronized with the main system. It marks the system\r\n * as being in an online sync state and persists this status to the database.\r\n *\r\n * The purgatory database concept typically represents a temporary holding area for data\r\n * that needs to be processed, reviewed, or synchronized before being committed to the\r\n * main data structures. This function signals that such synchronization has completed.\r\n *\r\n * @returns A promise that resolves when the sync flag has been updated in the database\r\n *\r\n * @example\r\n * ```typescript\r\n * // After synchronizing the purgatory database\r\n * async function syncPurgatoryData() {\r\n * // ... perform synchronization logic ...\r\n *\r\n * // Update the system to reflect successful sync\r\n * await PurgatoryDatabaseUpdated();\r\n * console.log('System marked as synced');\r\n * }\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Use in a data migration or sync workflow\r\n * async function migrateDataFromPurgatory() {\r\n * try {\r\n * // Migrate concepts and connections\r\n * await migratePurgatoryData();\r\n *\r\n * // Mark the operation as complete\r\n * await PurgatoryDatabaseUpdated();\r\n *\r\n * console.log('Purgatory sync complete, system online');\r\n * } catch (error) {\r\n * console.error('Sync failed:', error);\r\n * }\r\n * }\r\n * ```\r\n *\r\n * @remarks\r\n * - Sets Settings.isOnlineSync to true, indicating the system is in sync\r\n * - Creates a new SettingData instance with the updated sync status\r\n * - Persists the updated settings to the database via AiUpdateFlag\r\n * - Should be called after completing purgatory database synchronization\r\n * - Part of the data synchronization lifecycle management\r\n *\r\n * @see {@link AiUpdateFlag} for database update implementation\r\n * @see {@link SettingData} for the settings data structure\r\n * @see {@link Settings} for the global settings object\r\n * @see {@link InitializeSystem} for system initialization\r\n */\r\nexport async function PurgatoryDatabaseUpdated(){\r\n Settings.isOnlineSync = true;\r\n var settingData = new SettingData(Settings.isOnlineSync);\r\n AiUpdateFlag(settingData);\r\n \r\n}","/**\r\n * Default Local Concept Creation Module\r\n *\r\n * This module provides a factory function for creating empty/default local concepts.\r\n * These default concepts are useful as placeholders, initial values, or for representing\r\n * \"not found\" states in the Concept Connection System.\r\n *\r\n * @module CreateDefaultLConcept\r\n */\r\n\r\nimport { LConcept } from \"../../DataStructures/Local/LConcept\";\r\n\r\n/**\r\n * Creates a default empty local concept with all fields initialized to zero or default values.\r\n *\r\n * This function generates a placeholder concept that can be used for initialization,\r\n * default return values, or to represent the absence of a concept. All numeric fields\r\n * are set to 0, and string fields are set to \"0\", which allows calling code to check\r\n * for validity (e.g., `if (concept.id === 0)` to detect a default concept).\r\n *\r\n * @returns A new LConcept instance with all fields set to default/zero values\r\n *\r\n * @remarks\r\n * - All numeric IDs (id, userId, typeId, categoryId, accessId, referentId) are set to 0\r\n * - Character fields (referent, typecharacter) are set to \"0\"\r\n * - isNew flag is set to false (not a new concept)\r\n * - created_on and updated_on are set to current timestamp\r\n * - Commonly used as a null object pattern to avoid null checks\r\n *\r\n * @example\r\n * ```typescript\r\n * // Use as a default return value when concept is not found\r\n * function findConcept(id: number): LConcept {\r\n * const found = database.find(id);\r\n * return found || CreateDefaultLConcept();\r\n * }\r\n *\r\n * const concept = findConcept(123);\r\n * if (concept.id === 0) {\r\n * console.log(\"Concept not found\");\r\n * }\r\n *\r\n * // Use as initial value for variables\r\n * let mainConcept = CreateDefaultLConcept();\r\n * // ... later assign actual concept\r\n * mainConcept = await fetchConcept();\r\n * ```\r\n *\r\n * @see {@link LConcept} - The local concept data structure\r\n * @see {@link CreateTheConceptLocal} - Creates actual concepts with real data\r\n */\r\nexport function CreateDefaultLConcept(){\r\n let created_on = new Date();\r\n let updated_on = new Date();\r\n let concept = new LConcept(0,0,0,0,0,\"0\",\"0\",false,created_on,updated_on,0);\r\n return concept;\r\n}","/**\r\n * Local Binary Tree Initialization Module\r\n *\r\n * This module handles the initialization of the in-memory binary tree data structure\r\n * from persisted local concepts stored in IndexedDB. It loads all concepts from the\r\n * database and populates the in-memory cache for fast access.\r\n *\r\n * @module CreateLocalBinaryTreeFromData\r\n */\r\n\r\nimport { LocalConceptsData } from \"../../DataStructures/Local/LocalConceptData\";\r\nimport { getAllFromLocalDb } from \"../../Database/NoIndexDb\";\r\n\r\n/**\r\n * Initializes the local binary tree structure by loading concepts from IndexedDB.\r\n *\r\n * This function retrieves all locally stored concepts from the IndexedDB database\r\n * and populates the in-memory LocalConceptsData structure. This is typically called\r\n * during application initialization to hydrate the memory cache from persistent storage.\r\n *\r\n * The function ensures that all previously created local concepts are available in\r\n * memory for fast lookup operations without needing to query the database repeatedly.\r\n *\r\n * @returns A promise that resolves when all concepts have been loaded into memory\r\n *\r\n * @remarks\r\n * - Retrieves all concepts from the \"localconcept\" store in IndexedDB\r\n * - Uses `LocalConceptsData.AddConceptToMemory` to add each concept to the in-memory structure\r\n * - The commented code suggests this originally used a traditional binary tree (Node-based)\r\n * but now uses a more efficient data structure via LocalConceptsData\r\n * - Safe to call multiple times; duplicate concepts will be handled by AddConceptToMemory\r\n * - This is a synchronization step from persistent storage to volatile memory\r\n *\r\n * @example\r\n * ```typescript\r\n * // During application initialization\r\n * async function initializeApp() {\r\n * console.log(\"Loading local concepts...\");\r\n * await CreateLocalBinaryTreeFromData();\r\n * console.log(\"Local concepts loaded into memory\");\r\n *\r\n * // Now concepts can be accessed quickly from memory\r\n * const concept = await LocalConceptsData.GetConcept(123);\r\n * }\r\n *\r\n * initializeApp();\r\n * ```\r\n *\r\n * @see {@link LocalConceptsData.AddConceptToMemory} - Adds concepts to in-memory storage\r\n * @see {@link getAllFromLocalDb} - Retrieves all records from IndexedDB\r\n * @see {@link CreateLocalBinaryTypeTreeFromData} - Similar function for type-indexed tree\r\n * @see {@link CreateLocalCharacterBinaryTreeFromData} - Similar function for character-indexed tree\r\n */\r\nexport default async function CreateLocalBinaryTreeFromData(){\r\n var conceptList = await getAllFromLocalDb(\"localconcept\");\r\n if(Array.isArray(conceptList)){\r\n for(var i=0 ;i < conceptList.length ;i++){\r\n let concept = conceptList[i];\r\n LocalConceptsData.AddConceptToMemory(concept);\r\n // let node = new Node(concept.id, concept, null, null);\r\n // LocalBinaryTree.addNodeToTree(node);\r\n }\r\n\r\n }\r\n\r\n\r\n}\r\n","/**\r\n * Local Composition Creation Module\r\n *\r\n * This module provides functionality to recursively create complex, nested concept compositions\r\n * from JSON objects in the local storage layer. It transforms JSON structures into interconnected\r\n * concepts and connections, preserving the hierarchical relationships.\r\n *\r\n * @module CreateTheCompositionLocal\r\n */\r\n\r\nimport { LConcept } from \"../../DataStructures/Local/LConcept\";\r\nimport { CreateDefaultLConcept } from \"../Local/CreateDefaultLConcept\";\r\nimport {CreateTheConnectionLocal} from \"./CreateTheConnectionLocal\";\r\nimport {MakeTheInstanceConceptLocal} from \"./MakeTheInstanceConceptLocal\";\r\n\r\n/**\r\n * Recursively creates a composition of concepts and connections from a JSON object.\r\n *\r\n * This function traverses a JSON object tree and converts each key-value pair into concepts\r\n * with appropriate connections. It handles nested objects by recursively processing them,\r\n * creating a graph structure that mirrors the original JSON hierarchy.\r\n *\r\n * The function distinguishes between:\r\n * - Primitive values (string/number): Creates leaf concepts with the value as characterValue\r\n * - Complex values (object/array): Creates composition concepts and recursively processes children\r\n *\r\n * @param json - The JSON object to convert into a concept composition\r\n * @param ofTheConceptId - The ID of the parent concept (null for root level)\r\n * @param ofTheConceptUserId - The user ID of the parent concept (null for root level)\r\n * @param mainKey - The ID of the main/root composition concept (null for root level)\r\n * @param userId - The user creating the composition (defaults to 999)\r\n * @param accessId - Access control ID for created concepts (defaults to 999)\r\n * @param sessionInformationId - Session ID for tracking (defaults to 4)\r\n *\r\n * @returns A promise that resolves to the main/root LConcept of the created composition\r\n *\r\n * @remarks\r\n * - First invocation (when ofTheConceptId is null) creates the root concept\r\n * - Subsequent recursive calls create child concepts connected to their parents\r\n * - Uses `MakeTheInstanceConceptLocal` to create individual concepts\r\n * - Uses `CreateTheConnectionLocal` to establish parent-child relationships\r\n * - Maintains the structure through the mainKey parameter across recursive calls\r\n * - Handles both object properties and array elements\r\n *\r\n * @example\r\n * ```typescript\r\n * // Create a composition from a nested JSON structure\r\n * const userData = {\r\n * name: \"John Doe\",\r\n * age: 30,\r\n * address: {\r\n * street: \"123 Main St\",\r\n * city: \"Boston\"\r\n * }\r\n * };\r\n *\r\n * const mainConcept = await CreateTheCompositionLocal(\r\n * userData,\r\n * null, // ofTheConceptId\r\n * null, // ofTheConceptUserId\r\n * null, // mainKey\r\n * 123, // userId\r\n * 4, // accessId\r\n * 999 // sessionInformationId\r\n * );\r\n *\r\n * // Result: Creates concepts for \"name\", \"age\", \"address\", \"street\", \"city\"\r\n * // with appropriate connections forming a tree structure\r\n * console.log(mainConcept.id); // Root concept ID\r\n * ```\r\n *\r\n * @see {@link MakeTheInstanceConceptLocal} - Creates individual concepts\r\n * @see {@link CreateTheConnectionLocal} - Creates connections between concepts\r\n * @see {@link CreateDefaultLConcept} - Creates default empty concept\r\n * @see {@link GetCompositionLocal} - Related function for retrieving compositions\r\n */\r\nexport async function CreateTheCompositionLocal(json: any, ofTheConceptId:number | null=null, ofTheConceptUserId:number | null=null, mainKey: number | null=null, userId: number | null=null, accessId:number | null=null, sessionInformationId:number | null=null)\r\n{\r\n var localUserId:number = userId ?? 999;\r\n var localAccessId: number = accessId ?? 999;\r\n var localSessionId: number = sessionInformationId ?? 4;\r\n var MainKeyLocal: number = mainKey ?? 0;\r\n var MainConcept = CreateDefaultLConcept();\r\n for (const key in json) {\r\n if(typeof json[key] != 'string' && typeof json[key] != 'number' ){\r\n if(ofTheConceptId == null && ofTheConceptUserId == null){\r\n\r\n var localMainKey = MainKeyLocal;\r\n let conceptString = await MakeTheInstanceConceptLocal(key, \"\", true, localUserId, localAccessId, localSessionId);\r\n var concept = conceptString as LConcept;\r\n MainConcept = concept;\r\n localMainKey = concept.id;\r\n MainKeyLocal = concept.id;\r\n\r\n await CreateTheCompositionLocal(json[key], concept.id, concept.userId, localMainKey, userId, accessId, sessionInformationId );\r\n \r\n }\r\n else{\r\n var ofThe:number = ofTheConceptId ?? 999;\r\n var ofTheUser:number = ofTheConceptUserId ?? 999;\r\n var localMainKey = MainKeyLocal;\r\n var conceptString = await MakeTheInstanceConceptLocal(key, \"\", true, localUserId, localAccessId, localSessionId );\r\n var concept = conceptString as LConcept;\r\n await CreateTheConnectionLocal(ofThe, concept.id, localMainKey);\r\n await CreateTheCompositionLocal(json[key], concept.id, concept.userId, localMainKey, userId, accessId, sessionInformationId );\r\n }\r\n }\r\n else{\r\n var ofThe:number = ofTheConceptId ?? 999;\r\n var ofTheUser:number = ofTheConceptUserId ?? 999;\r\n var localMainKey = MainKeyLocal;\r\n var conceptString = await MakeTheInstanceConceptLocal(key, json[key].toString(), false, localUserId, localAccessId, localSessionId);\r\n var concept = conceptString as LConcept;\r\n await CreateTheConnectionLocal(ofThe, concept.id, localMainKey);\r\n\r\n }\r\n\r\n }\r\n return MainConcept;\r\n}\r\n\r\n","/**\r\n * Local Concept Creation Module\r\n *\r\n * This module provides functionality to create concepts in the local storage layer of the\r\n * Concept Connection System (CCS). It handles the instantiation of local concepts with\r\n * temporary IDs before they are synchronized with the backend.\r\n *\r\n * @module CreateTheConceptLocal\r\n */\r\n\r\nimport { CreateTheConceptApi } from \"../../Api/Create/CreateTheConceptApi\";\r\nimport { LConcept } from \"../../DataStructures/Local/LConcept\";\r\nimport { LocalConceptsData } from \"../../DataStructures/Local/LocalConceptData\";\r\nimport { ReservedIds } from \"../../DataStructures/ReservedIds\";\r\nimport { SyncData } from \"../../DataStructures/SyncData\";\r\nimport { storeToDatabase } from \"../../Database/NoIndexDb\";\r\n\r\n/**\r\n * Creates a new concept in the local storage layer.\r\n *\r\n * This function generates a new local concept with a temporary random ID and stores it\r\n * in both the in-memory data structure and the local IndexedDB database. The concept\r\n * is marked as temporary and new, indicating it needs to be synchronized with the\r\n * backend server when online.\r\n *\r\n * The function is essential for offline-first functionality, allowing users to create\r\n * concepts even when disconnected from the backend server.\r\n *\r\n * @param referent - The character value or name of the concept being created\r\n * @param typecharacter - The character representation of the concept's type\r\n * @param userId - The ID of the user creating the concept\r\n * @param categoryId - The category this concept belongs to\r\n * @param typeId - The ID of the type concept that defines this concept's type\r\n * @param accessId - Access control ID determining permissions for this concept\r\n * @param referentId - Optional ID linking to a referent concept (defaults to 0)\r\n *\r\n * @returns A promise that resolves to the newly created LConcept instance\r\n *\r\n * @remarks\r\n * - Generates a random temporary ID between 0 and 100,000,000\r\n * - Sets `isTemp` flag to true to indicate this is a local-only concept\r\n * - Sets `isNew` flag to true to mark it for synchronization\r\n * - Stores the concept in both memory (LocalConceptsData) and IndexedDB\r\n * - The temporary ID will be replaced with a backend-generated ID upon sync\r\n *\r\n * @example\r\n * ```typescript\r\n * // Create a concept with type \"the_name\" for user 123\r\n * const concept = await CreateTheConceptLocal(\r\n * \"John Doe\", // referent\r\n * \"the_name\", // typecharacter\r\n * 123, // userId\r\n * 4, // categoryId\r\n * 51, // typeId\r\n * 4, // accessId\r\n * 0 // referentId\r\n * );\r\n *\r\n * console.log(concept.id); // Random ID like 45892371\r\n * console.log(concept.isTemp); // true\r\n * ```\r\n *\r\n * @see {@link LConcept} - The local concept data structure\r\n * @see {@link LocalConceptsData.AddConcept} - Adds concept to in-memory storage\r\n * @see {@link storeToDatabase} - Persists concept to IndexedDB\r\n */\r\nexport default async function CreateTheConceptLocal(referent:string, typecharacter:string, userId:number, categoryId:number,\r\ntypeId:number,\r\naccessId:number, referentId:number = 0){\r\n\r\nvar id = Math.floor(Math.random() * 100000000);\r\nvar isNew: boolean = true;\r\nlet created_on:Date = new Date();\r\nlet updated_on:Date = new Date();\r\nvar concept = new LConcept(id,userId,typeId,categoryId,accessId, referent,typecharacter, isNew,created_on,updated_on, referentId);\r\nconcept.isTemp = true;\r\nLocalConceptsData.AddConcept(concept);\r\nstoreToDatabase(\"localconcept\",concept);\r\nreturn concept;\r\n\r\n}","/**\r\n * Local Connection Creation Module\r\n *\r\n * This module provides functionality to create connections between concepts in the local\r\n * storage layer. Connections represent relationships between concepts, forming the graph\r\n * structure of the Concept Connection System.\r\n *\r\n * @module CreateTheConnectionLocal\r\n */\r\n\r\nimport { LConnection } from \"../../DataStructures/Local/LConnection\";\r\nimport { LocalConnectionData } from \"../../DataStructures/Local/LocalConnectionData\";\r\nimport { SyncData } from \"../../DataStructures/SyncData\";\r\nimport { storeToDatabase } from \"../../Database/NoIndexDb\";\r\n\r\n/**\r\n * Creates a connection between two concepts in the local storage layer.\r\n *\r\n * This function establishes a directed relationship from one concept to another,\r\n * storing it in both memory and IndexedDB. The connection is marked as temporary\r\n * until synchronized with the backend server.\r\n *\r\n * The function includes validation to prevent self-referential connections\r\n * (a concept connecting to itself), returning an empty connection object in such cases.\r\n *\r\n * @param ofTheConceptId - The ID of the source concept (from which the connection originates)\r\n * @param toTheConceptId - The ID of the target concept (to which the connection points)\r\n * @param typeId - The ID of the type concept defining the relationship type\r\n * @param orderId - The order/sequence number for this connection (defaults to 1)\r\n *\r\n * @returns The newly created LConnection instance, or an empty connection if validation fails\r\n *\r\n * @remarks\r\n * - Automatically assigns accessId of 4 (default access level)\r\n * - Generates a random temporary ID between 0 and 100,000,000\r\n * - Sets `isTemp` flag to true for synchronization tracking\r\n * - Prevents self-referential connections (where ofTheConceptId === toTheConceptId)\r\n * - Stores the connection in both memory (LocalConnectionData) and IndexedDB\r\n *\r\n * @example\r\n * ```typescript\r\n * // Create a connection from concept 100 to concept 200 with type 51\r\n * const connection = CreateTheConnectionLocal(\r\n * 100, // ofTheConceptId (source)\r\n * 200, // toTheConceptId (target)\r\n * 51, // typeId (relationship type)\r\n * 1 // orderId (optional, defaults to 1)\r\n * );\r\n *\r\n * console.log(connection.id); // Random ID like 78234561\r\n * console.log(connection.isTemp); // true\r\n *\r\n * // This will return an empty connection (0,0,0,0,0,0)\r\n * const selfConnection = CreateTheConnectionLocal(100, 100, 51);\r\n * console.log(selfConnection.id); // 0\r\n * ```\r\n *\r\n * @see {@link LConnection} - The local connection data structure\r\n * @see {@link LocalConnectionData.AddConnection} - Adds connection to in-memory storage\r\n * @see {@link storeToDatabase} - Persists connection to IndexedDB\r\n * @see {@link CreateTheConceptLocal} - Related function for creating concepts\r\n */\r\nexport function CreateTheConnectionLocal(ofTheConceptId:number, toTheConceptId:number,\r\n typeId: number,orderId:number = 1,\r\n ){\r\n var accessId : number = 4;\r\n let randomid = Math.floor(Math.random() * 100000000);\r\n let realOfTheConceptId = 0;\r\n let realToTheConceptId = 0;\r\n let realTypeId = 0;\r\n realOfTheConceptId = ofTheConceptId;\r\n realToTheConceptId = toTheConceptId;\r\n realTypeId = typeId;\r\n let connection = new LConnection(0,0,0,0,0,0);\r\n if(ofTheConceptId != toTheConceptId){\r\n connection = new LConnection(0, ofTheConceptId, toTheConceptId, typeId, orderId, accessId);\r\n connection.isTemp = true;\r\n connection.id = Math.floor(Math.random() * 100000000);\r\n LocalConnectionData.AddConnection(connection);\r\n storeToDatabase(\"localconnection\", connection);\r\n }\r\n return connection;\r\n\r\n\r\n}","/**\r\n * Local Composition List Retrieval Module\r\n *\r\n * This module provides functionality to retrieve multiple compositions of the same type\r\n * from local storage. It enables batch retrieval of all compositions that match a specific\r\n * type and belong to a particular user.\r\n *\r\n * @module GetCompositionListLocal\r\n */\r\n\r\nimport { LocalConceptsData } from \"../../DataStructures/Local/LocalConceptData\";\r\nimport { GetCompositionLocal, GetCompositionLocalWithId } from \"./GetCompositionLocal\";\r\nimport GetConceptByCharacterLocal from \"./GetConceptByCharacterLocal\";\r\n\r\n/**\r\n * Retrieves all compositions of a specific type for a given user.\r\n *\r\n * This function finds all concept instances of a specified type (by name) that belong\r\n * to a particular user, then fetches and reconstructs each composition as JSON.\r\n * The result is an array of composition objects.\r\n *\r\n * @param compositionName - The character/name of the composition type to retrieve (e.g., \"the_user\")\r\n * @param userId - The ID of the user whose compositions to retrieve\r\n *\r\n * @returns A promise that resolves to an array of composition JSON objects\r\n *\r\n * @remarks\r\n * - First looks up the type concept by its character value\r\n * - Then queries all concepts of that type belonging to the user\r\n * - Fetches complete composition data for each matching concept\r\n * - Returns an empty array if the type concept doesn't exist\r\n * - Each element in the returned array is a complete composition object\r\n *\r\n * @example\r\n * ```typescript\r\n * // Retrieve all user compositions for user 123\r\n * const users = await GetCompositionListLocal(\"the_user\", 123);\r\n *\r\n * // Output might look like:\r\n * // [\r\n * // { \"the_user\": { name: \"John\", age: 30 } },\r\n * // { \"the_user\": { name: \"Jane\", age: 25 } },\r\n * // { \"the_user\": { name: \"Bob\", age: 35 } }\r\n * // ]\r\n *\r\n * console.log(`Found ${users.length} users`);\r\n * users.forEach(user => {\r\n * console.log(user.the_user.name);\r\n * });\r\n *\r\n * // Retrieve all product compositions\r\n * const products = await GetCompositionListLocal(\"the_product\", 123);\r\n * ```\r\n *\r\n * @see {@link GetCompositionListLocalWithId} - Similar function that includes concept IDs\r\n * @see {@link GetCompositionLocal} - Retrieves a single composition\r\n * @see {@link GetConceptByCharacterLocal} - Looks up type concept by name\r\n * @see {@link LocalConceptsData.GetConceptsByTypeIdAndUser} - Queries concepts by type and user\r\n */\r\nexport async function GetCompositionListLocal(compositionName: string,userId:number){\r\n var concept = await GetConceptByCharacterLocal(compositionName);\r\n var CompositionList :any = [];\r\n if(concept){\r\n var conceptList = await LocalConceptsData.GetConceptsByTypeIdAndUser(concept.id,userId);\r\n for(var i=0; i< conceptList.length; i++){\r\n var compositionJson= await GetCompositionLocal(conceptList[i].id);\r\n CompositionList.push(compositionJson);\r\n }\r\n }\r\n return CompositionList;\r\n}\r\n\r\n/**\r\n * Retrieves all compositions of a specific type with their IDs included in results.\r\n *\r\n * Similar to GetCompositionListLocal, but each composition in the returned array\r\n * includes both the composition data and its root concept ID. This is useful when\r\n * you need to perform operations on the compositions and need to track their IDs.\r\n *\r\n * @param compositionName - The character/name of the composition type to retrieve\r\n * @param userId - The ID of the user whose compositions to retrieve\r\n *\r\n * @returns A promise that resolves to an array of objects with 'data' and 'id' properties\r\n *\r\n * @remarks\r\n * - Each element in the array has structure: { data: {composition}, id: conceptId }\r\n * - Useful for update or delete operations where you need the concept ID\r\n * - Uses GetCompositionLocalWithId internally for each composition\r\n * - Returns empty array if the type concept doesn't exist\r\n *\r\n * @example\r\n * ```typescript\r\n * // Retrieve all users with their IDs\r\n * const usersWithIds = await GetCompositionListLocalWithId(\"the_user\", 123);\r\n *\r\n * // Output structure:\r\n * // [\r\n * // { data: { \"the_user\": { name: \"John\" } }, id: 1001 },\r\n * // { data: { \"the_user\": { name: \"Jane\" } }, id: 1002 }\r\n * // ]\r\n *\r\n * // Update each user\r\n * for (const userObj of usersWithIds) {\r\n * console.log(`Updating user ${userObj.id}`);\r\n * const userData = userObj.data.the_user;\r\n * await updateComposition(userObj.id, { ...userData, updated: true });\r\n * }\r\n *\r\n * // Filter and process\r\n * const specificUser = usersWithIds.find(u =>\r\n * u.data.the_user.name === \"John\"\r\n * );\r\n * if (specificUser) {\r\n * console.log(`John's ID is ${specificUser.id}`);\r\n * }\r\n * ```\r\n *\r\n * @see {@link GetCompositionListLocal} - Similar function without IDs\r\n * @see {@link GetCompositionLocalWithId} - Retrieves single composition with ID\r\n * @see {@link UpdateCompositionLocal} - Uses this format for updates\r\n */\r\nexport async function GetCompositionListLocalWithId(compositionName: string, userId: number){\r\n var concept = await GetConceptByCharacterLocal(compositionName);\r\n var CompositionList :any = [];\r\n if(concept){\r\n var conceptList = await LocalConceptsData.GetConceptsByTypeIdAndUser(concept.id,userId);\r\n for(var i=0; i< conceptList.length; i++){\r\n var compositionJson= await GetCompositionLocalWithId(conceptList[i].id);\r\n CompositionList.push(compositionJson);\r\n }\r\n }\r\n return CompositionList;\r\n}\r\n\r\n\r\n\r\n\r\n","/**\r\n * Local Composition Retrieval Module\r\n *\r\n * This module provides functionality to retrieve and reconstruct concept compositions from\r\n * local storage. It converts the graph structure of interconnected concepts and connections\r\n * back into hierarchical JSON objects, making them easy to work with in application code.\r\n *\r\n * @module GetCompositionLocal\r\n */\r\n\r\nimport { GetConcept } from \"../../Api/GetConcept\";\r\nimport { GetAllConnectionsOfComposition } from \"../../Api/GetAllConnectionsOfComposition\";\r\nimport { Concept } from \"../../DataStructures/Concept\";\r\nimport { LocalConceptsData } from \"../../DataStructures/Local/LocalConceptData\";\r\nimport { LConnection } from \"../../DataStructures/Local/LConnection\";\r\nimport { LocalConnectionData } from \"../../DataStructures/Local/LocalConnectionData\";\r\n\r\n/**\r\n * Retrieves a composition and converts it to a JSON object structure.\r\n *\r\n * This function fetches a concept composition by its ID and recursively reconstructs\r\n * the original hierarchical JSON structure from the graph of concepts and connections.\r\n * The root concept's type becomes the top-level key in the returned object.\r\n *\r\n * @param id - The ID of the root concept of the composition to retrieve\r\n *\r\n * @returns A promise that resolves to a JSON object representing the composition hierarchy\r\n *\r\n * @remarks\r\n * - Fetches all connections associated with the composition\r\n * - Identifies all concepts involved in the composition\r\n * - Recursively traverses the graph to rebuild the JSON structure\r\n * - The returned object has the root concept's type as its key\r\n * - Uses helper function `recursiveFetchLocal` for tree traversal\r\n *\r\n * @example\r\n * ```typescript\r\n * // Retrieve a user composition by ID\r\n * const userJson = await GetCompositionLocal(12345);\r\n *\r\n * // Output might look like:\r\n * // {\r\n * // \"the_user\": {\r\n * // \"name\": \"John Doe\",\r\n * // \"age\": 30,\r\n * // \"address\": {\r\n * // \"street\": \"123 Main St\",\r\n * // \"city\": \"Boston\"\r\n * // }\r\n * // }\r\n * // }\r\n *\r\n * console.log(userJson.the_user.name); // \"John Doe\"\r\n * ```\r\n *\r\n * @see {@link GetCompositionLocalWithId} - Similar function that includes the composition ID\r\n * @see {@link recursiveFetchLocal} - Helper function for recursive traversal\r\n * @see {@link CreateTheCompositionLocal} - Related function for creating compositions\r\n */\r\nexport async function GetCompositionLocal(id:number){\r\n var connectionList:LConnection[] = [];\r\n var returnOutput: any = {};\r\n connectionList = await LocalConnectionData.GetConnectionsOfCompositionLocal(id);\r\n //connectionList = ConnectionData.GetConnectionsOfComposition(id);\r\n var compositionList:number[] = [];\r\n\r\n for(var i=0; i<connectionList.length; i++){\r\n if(!compositionList.includes(connectionList[i].ofTheConceptId)){\r\n compositionList.push(connectionList[i].ofTheConceptId);\r\n }\r\n }\r\n\r\n var concept = await LocalConceptsData.GetConcept(id);\r\n var output = await recursiveFetchLocal(id, connectionList, compositionList);\r\n var mainString = concept?.type?.characterValue ?? \"top\";\r\n returnOutput[mainString] = output;\r\n return returnOutput;\r\n}\r\n\r\n/**\r\n * Retrieves a composition with its ID included in the result.\r\n *\r\n * Similar to GetCompositionLocal, but wraps the result in an object that includes\r\n * both the composition data and the root concept ID. This is useful when you need\r\n * to track which composition the data came from.\r\n *\r\n * @param id - The ID of the root concept of the composition to retrieve\r\n *\r\n * @returns A promise that resolves to an object with 'data' and 'id' properties\r\n *\r\n * @remarks\r\n * - Returns an object with two properties: 'data' (the composition JSON) and 'id' (the root concept ID)\r\n * - Useful when working with multiple compositions and need to track their origins\r\n * - Only includes data if the concept exists (concept.id !== 0)\r\n * - Uses the same recursive fetching logic as GetCompositionLocal\r\n *\r\n * @example\r\n * ```typescript\r\n * const result = await GetCompositionLocalWithId(12345);\r\n *\r\n * // Output structure:\r\n * // {\r\n * // data: {\r\n * // \"the_user\": { name: \"John\", age: 30 }\r\n * // },\r\n * // id: 12345\r\n * // }\r\n *\r\n * console.log(result.id); // 12345\r\n * console.log(result.data.the_user.name); // \"John\"\r\n *\r\n * // Useful for batch operations\r\n * const compositions = await Promise.all([\r\n * GetCompositionLocalWithId(100),\r\n * GetCompositionLocalWithId(200)\r\n * ]);\r\n * compositions.forEach(comp => {\r\n * console.log(`Composition ${comp.id}:`, comp.data);\r\n * });\r\n * ```\r\n *\r\n * @see {@link GetCompositionLocal} - Similar function without ID in result\r\n * @see {@link recursiveFetchLocal} - Helper function for recursive traversal\r\n */\r\nexport async function GetCompositionLocalWithId(id:number){\r\n var connectionList:LConnection[] = [];\r\n var returnOutput: any = {};\r\n connectionList = await LocalConnectionData.GetConnectionsOfCompositionLocal(id);\r\n var compositionList:number[] = [];\r\n\r\n for(var i=0; i<connectionList.length; i++){\r\n if(!compositionList.includes(connectionList[i].ofTheConceptId)){\r\n compositionList.push(connectionList[i].ofTheConceptId);\r\n }\r\n }\r\n\r\n var concept = await LocalConceptsData.GetConcept(id);\r\n if(concept.id != 0){\r\n var output = await recursiveFetchLocal(id, connectionList, compositionList);\r\n var mainString = concept?.type?.characterValue ?? \"top\";\r\n returnOutput[mainString] = output;\r\n var FinalReturn: any = {};\r\n }\r\n\r\n FinalReturn['data'] = returnOutput;\r\n FinalReturn['id'] = id;\r\n\r\n return FinalReturn;\r\n}\r\n\r\n/**\r\n * Recursively fetches and reconstructs composition data from interconnected concepts.\r\n *\r\n * This internal helper function traverses the concept graph depth-first, following\r\n * connections from parent to child concepts, and rebuilds the JSON structure.\r\n * It handles both leaf nodes (primitive values) and branch nodes (nested objects/arrays).\r\n *\r\n * @param id - The ID of the current concept being processed\r\n * @param connectionList - Complete list of connections in the composition\r\n * @param compositionList - List of concept IDs that have child connections\r\n * @param visitedConcepts - Array tracking visited concepts to prevent circular references\r\n *\r\n * @returns A promise that resolves to the reconstructed JSON value (object, array, or primitive)\r\n *\r\n * @remarks\r\n * - For leaf concepts (not in compositionList), returns the characterValue directly\r\n * - For branch concepts, recursively processes all child connections\r\n * - Strips \"the_\" prefix from type names when building JSON keys\r\n * - Handles both object properties (string keys) and array elements (numeric keys)\r\n * - Implements cycle detection via visitedConcepts to prevent infinite loops\r\n * - Ensures type information is loaded for each concept if not already present\r\n * - Returns empty string for circular references\r\n *\r\n * @example\r\n * ```typescript\r\n * // Internal usage example (called by GetCompositionLocal)\r\n * const connections = await LocalConnectionData.GetConnectionsOfCompositionLocal(100);\r\n * const compositionList = [100, 101, 102]; // IDs with children\r\n *\r\n * const result = await recursiveFetchLocal(100, connections, compositionList);\r\n * // Returns: { name: \"John\", address: { city: \"Boston\" } }\r\n *\r\n * // Handles arrays\r\n * // If concept types are \"the_0\", \"the_1\", \"the_2\", result is an array\r\n * // Returns: [\"item1\", \"item2\", \"item3\"]\r\n * ```\r\n *\r\n * @see {@link GetCompositionLocal} - Public function that uses this helper\r\n * @see {@link LocalConceptsData.GetConcept} - Fetches individual concepts\r\n * @see {@link LocalConnectionData.GetConnectionsOfCompositionLocal} - Fetches connections\r\n */\r\n async function recursiveFetchLocal(id:number, connectionList:LConnection[], compositionList:number[], visitedConcepts: number[] = []){\r\n\r\n var output : any= {};\r\n var arroutput: any = [];\r\n var concept = await LocalConceptsData.GetConcept(id);\r\n\r\n if(concept.id != 0){\r\n if(concept.type == null){\r\n\r\n var toConceptTypeId: number = concept.typeId;\r\n var toConceptType = await LocalConceptsData.GetConcept(toConceptTypeId);\r\n\r\n concept.type = toConceptType;\r\n }\r\n }\r\n\r\n var mainString = concept?.type?.characterValue ?? \"top\";\r\n\r\n if(!compositionList.includes(id)){\r\n return concept?.characterValue;\r\n }\r\n else{\r\n if(visitedConcepts.includes(id)){\r\n return \"\";\r\n }\r\n else{\r\n visitedConcepts.push(id);\r\n }\r\n for(var i=0; i<connectionList.length; i++){\r\n\r\n if(connectionList[i].ofTheConceptId == id){\r\n var toConceptId = connectionList[i].toTheConceptId;\r\n\r\n var toConcept = await LocalConceptsData.GetConcept(toConceptId);\r\n if(toConcept.id != 0){\r\n if(toConcept?.type == null){\r\n\r\n var toConceptTypeId: number = toConcept.typeId;\r\n var toConceptType = await LocalConceptsData.GetConcept(toConceptTypeId);\r\n\r\n toConcept.type = toConceptType;\r\n }\r\n }\r\n\r\n var regex = \"the_\";\r\n\r\n\r\n var localmainString = toConcept?.type?.characterValue ?? \"top\";\r\n\r\n var localKey = localmainString.replace(regex, \"\");\r\n\r\n if(isNaN(Number(localKey)) ){\r\n\r\n if(localKey){\r\n const result = await recursiveFetchLocal(toConceptId, connectionList, compositionList);\r\n output[localKey] = result;\r\n }\r\n\r\n }\r\n else{\r\n\r\n const result = await recursiveFetchLocal(toConceptId, connectionList, compositionList);\r\n arroutput[localKey] = result;\r\n output = arroutput;\r\n\r\n }\r\n\r\n\r\n } \r\n }\r\n }\r\n\r\n\r\n return output;\r\n\r\n }","/**\r\n * Local Concept Character Lookup Module\r\n *\r\n * This module provides a simple interface for retrieving concepts by their character value\r\n * (string content/name) from local storage. It's commonly used to look up type concepts\r\n * or find concepts by their textual representation.\r\n *\r\n * @module GetConceptByCharacterLocal\r\n */\r\n\r\nimport { LocalConceptsData } from \"../../DataStructures/Local/LocalConceptData\";\r\n\r\n/**\r\n * Retrieves a concept from local storage by its character value.\r\n *\r\n * This function performs a lookup to find a concept whose characterValue (string content)\r\n * matches the provided string. This is particularly useful for finding type concepts\r\n * by their names (e.g., \"the_user\", \"the_product\") or for locating concepts by their\r\n * textual representation.\r\n *\r\n * @param characterValue - The character/string value to search for\r\n *\r\n * @returns A promise that resolves to the matching LConcept, or a default concept if not found\r\n *\r\n * @remarks\r\n * - Performs case-sensitive exact string matching\r\n * - Utilizes LocalConceptsData's internal indexing for efficient lookup\r\n * - If using character binary tree, lookup is O(log n), otherwise may be O(n)\r\n * - Returns a default/empty concept if no match is found (check concept.id === 0)\r\n * - Commonly used to look up type concepts before creating instances\r\n *\r\n * @example\r\n * ```typescript\r\n * // Look up a type concept\r\n * const userType = await GetConceptByCharacterLocal(\"the_user\");\r\n * if (userType.id !== 0) {\r\n * console.log(`Found user type with ID: ${userType.id}`);\r\n * }\r\n *\r\n * // Look up a concept by name\r\n * const johnConcept = await GetConceptByCharacterLocal(\"John Doe\");\r\n * if (johnConcept.id !== 0) {\r\n * console.log(`John exists with ID ${johnConcept.id}`);\r\n * } else {\r\n * console.log(\"John not found in local storage\");\r\n * }\r\n *\r\n * // Use in composition retrieval\r\n * async function getUserCompositions(userId: number) {\r\n * const typeId = (await GetConceptByCharacterLocal(\"the_user\")).id;\r\n * if (typeId === 0) return [];\r\n * return await LocalConceptsData.GetConceptsByTypeIdAndUser(typeId, userId);\r\n * }\r\n * ```\r\n *\r\n * @see {@link LocalConceptsData.GetConceptByCharacter} - Underlying lookup method\r\n * @see {@link CreateLocalCharacterBinaryTreeFromData} - Initializes character-based indexing\r\n * @see {@link MakeTheTypeLocal} - Uses this function to check for existing types\r\n * @see {@link GetCompositionListLocal} - Uses this to find type concepts\r\n */\r\nexport default async function GetConceptByCharacterLocal(characterValue: string){\r\n var concept = await LocalConceptsData.GetConceptByCharacter(characterValue);\r\n return concept;\r\n}","/**\r\n * Local Concept Creation with Uniqueness Check Module\r\n *\r\n * This module provides \"get-or-create\" functionality for concepts in local storage.\r\n * It checks if a concept with the specified character value and type already exists,\r\n * and only creates a new one if it doesn't, preventing duplicate concepts.\r\n *\r\n * @module MakeTheConceptLocal\r\n */\r\n\r\nimport { LConcept } from \"../../DataStructures/Local/LConcept\";\r\nimport { LocalConceptsData } from \"../../DataStructures/Local/LocalConceptData\";\r\nimport CreateTheConceptLocal from \"./CreateTheConceptLocal\";\r\n\r\n/**\r\n * Gets an existing concept or creates a new one if it doesn't exist.\r\n *\r\n * This function implements a \"get-or-create\" pattern by first checking if a concept\r\n * with the given character value and type already exists in local storage. If found,\r\n * it returns the existing concept; otherwise, it creates and returns a new one.\r\n *\r\n * This prevents duplicate concepts from being created for the same character value\r\n * and type combination, maintaining data integrity and uniqueness constraints.\r\n *\r\n * @param referent - The character value/name for the concept\r\n * @param typeCharacter - The character representation of the concept's type\r\n * @param userId - The ID of the user creating/owning the concept\r\n * @param categoryId - The category ID for the concept\r\n * @param typeId - The ID of the type concept\r\n *\r\n * @returns A promise that resolves to the found or newly created LConcept\r\n *\r\n * @remarks\r\n * - First queries for existing concept using character value and type ID\r\n * - Only creates a new concept if no match is found (concept.id === 0)\r\n * - Automatically uses accessId of 4 (default access level) for new concepts\r\n * - Ensures referent uniqueness within the same type\r\n * - Particularly useful for maintaining referential integrity\r\n *\r\n * @example\r\n * ```typescript\r\n * // First call creates the concept\r\n * const concept1 = await MakeTheConceptLocal(\r\n * \"John Doe\", // referent\r\n * \"the_name\", // typeCharacter\r\n * 123, // userId\r\n * 4, // categoryId\r\n * 51 // typeId\r\n * );\r\n * console.log(`Created concept with ID: ${concept1.id}`);\r\n *\r\n * // Second call returns the same concept (no duplicate)\r\n * const concept2 = await MakeTheConceptLocal(\r\n * \"John Doe\", // same referent\r\n * \"the_name\", // same typeCharacter\r\n * 123, // userId\r\n * 4, // categoryId\r\n * 51 // same typeId\r\n * );\r\n * console.log(concept1.id === concept2.id); // true\r\n *\r\n * // Different type allows same referent\r\n * const concept3 = await MakeTheConceptLocal(\r\n * \"John Doe\", // same referent\r\n * \"the_company\", // different type\r\n * 123,\r\n * 4,\r\n * 52 // different typeId\r\n * );\r\n * console.log(concept3.id !== concept1.id); // true\r\n * ```\r\n *\r\n * @see {@link CreateTheConceptLocal} - Creates new concepts\r\n * @see {@link LocalConceptsData.GetConceptByCharacterAndTypeLocal} - Checks for existing concepts\r\n * @see {@link MakeTheInstanceConceptLocal} - Higher-level concept creation with type handling\r\n */\r\nexport default async function MakeTheConceptLocal(referent:string, typeCharacter:string, userId:number, categoryId:number,\r\ntypeId:number){\r\n\r\n var conceptString = await LocalConceptsData.GetConceptByCharacterAndTypeLocal(referent,typeId);\r\n var concept = conceptString as LConcept;\r\n let accessId = 4;\r\n if(concept.id == 0){\r\n\r\n conceptString = await CreateTheConceptLocal(referent,typeCharacter,userId,categoryId,typeId,accessId );\r\n\r\n concept = conceptString as LConcept;\r\n }\r\n\r\n return concept;\r\n\r\n\r\n}","/**\r\n * Local Instance Concept Creation Module\r\n *\r\n * This module provides high-level functionality for creating instance concepts with\r\n * automatic type management. It handles type creation, naming conventions (the_ prefix),\r\n * and different scenarios like compositions, large text values, and standard concepts.\r\n *\r\n * @module MakeTheInstanceConceptLocal\r\n */\r\n\r\nimport { CreateTextData } from \"../../Api/Create/CreateTheTextData\";\r\nimport { GetConceptByCharacterAndType } from \"../../Api/GetConceptByCharacterAndType\";\r\nimport { LConcept } from \"../../DataStructures/Local/LConcept\";\r\nimport { TheTexts } from \"../../DataStructures/TheTexts\";\r\nimport CreateTheConcept from \"../CreateTheConcept\";\r\nimport CreateTheConceptLocal from \"./CreateTheConceptLocal\";\r\nimport { MakeTheName } from \"../MakeTheName\";\r\nimport MakeTheTypeConceptLocal from \"./MakeTheTypeLocal\";\r\nimport { LocalConceptsData } from \"../../DataStructures/Local/LocalConceptData\";\r\n\r\n/**\r\n * Creates an instance concept with automatic type handling and smart referent management.\r\n *\r\n * This high-level function handles the complete process of creating a concept instance,\r\n * including:\r\n * - Ensuring the type concept exists (creates if needed)\r\n * - Adding \"the_\" prefix to types if not present\r\n * - Handling composition concepts (nested objects)\r\n * - Managing long text values (> 255 characters)\r\n * - Preventing duplicate concepts with get-or-create logic\r\n *\r\n * @param type - The type name for the concept (e.g., \"user\", \"product\")\r\n * @param referent - The string value/content of the concept\r\n * @param composition - Whether this is a composition concept (has nested structure)\r\n * @param userId - The ID of the user creating the concept\r\n * @param accessId - Access control ID for the concept\r\n * @param sessionInformationId - Session tracking ID (defaults to 999)\r\n * @param referentId - Optional ID linking to another concept (defaults to 0)\r\n *\r\n * @returns A promise that resolves to the created or found LConcept with its type attached\r\n *\r\n * @remarks\r\n * - Automatically prepends \"the_\" to type names if not already present\r\n * - For compositions: Always creates a new concept regardless of existing ones\r\n * - For text > 255 chars: Creates concept with full text stored\r\n * - For text <= 255 chars: Uses get-or-create logic to prevent duplicates\r\n * - Always ensures the type concept exists before creating the instance\r\n * - Sets category ID to 4 by default\r\n * - Returns concept with its type property populated for immediate use\r\n *\r\n * @example\r\n * ```typescript\r\n * // Create a simple string concept\r\n * const nameConcept = await MakeTheInstanceConceptLocal(\r\n * \"name\", // type (becomes \"the_name\")\r\n * \"John Doe\", // referent\r\n * false, // not a composition\r\n * 123, // userId\r\n * 4, // accessId\r\n * 999 // sessionInformationId\r\n * );\r\n * console.log(nameConcept.type.characterValue); // \"the_name\"\r\n *\r\n * // Create a composition concept for nested objects\r\n * const addressConcept = await MakeTheInstanceConceptLocal(\r\n * \"address\", // type (becomes \"the_address\")\r\n * \"\", // empty referent for compositions\r\n * true, // is a composition\r\n * 123,\r\n * 4,\r\n * 999\r\n * );\r\n *\r\n * // Handle long text\r\n * const longText = \"A\".repeat(300);\r\n * const articleConcept = await MakeTheInstanceConceptLocal(\r\n * \"article\",\r\n * longText, // > 255 characters\r\n * false,\r\n * 123,\r\n * 4,\r\n * 999\r\n * );\r\n *\r\n * // Type name with \"the_\" prefix already included\r\n * const userConcept = await MakeTheInstanceConceptLocal(\r\n * \"the_user\", // already has \"the_\" prefix\r\n * \"user123\",\r\n * false,\r\n * 123,\r\n * 4,\r\n * 999\r\n * );\r\n * ```\r\n *\r\n * @see {@link MakeTheTypeConceptLocal} - Creates or retrieves type concepts\r\n * @see {@link CreateTheConceptLocal} - Creates the actual concept instance\r\n * @see {@link LocalConceptsData.GetConceptByCharacterAndTypeLocal} - Checks for existing concepts\r\n * @see {@link CreateTheCompositionLocal} - Uses this function to create composition elements\r\n */\r\nexport async function MakeTheInstanceConceptLocal(type:string, referent:string, composition:boolean=false, userId: number,\r\n accessId:number, sessionInformationId: number=999, referentId: number = 0){\r\n var sessionInformationId: number = 999;\r\n var categoryId: number = 4;\r\n userId = composition ? userId : 999;\r\n var sessionInformationUserId: number = userId;\r\n // change this\r\n var accessId: number = 4;\r\n\r\n var stringToCheck: string = \"\";\r\n\r\n var stringLength:number = referent.length;\r\n var typeConcept;\r\n var concept: LConcept;\r\n var startsWithThe = type.startsWith(\"the_\");\r\n\r\n if(startsWithThe){\r\n stringToCheck = type;\r\n }\r\n else{\r\n stringToCheck = \"the_\" + type;\r\n }\r\n\r\n if(composition){\r\n var typeConceptString = await MakeTheTypeConceptLocal(type, sessionInformationId, userId, userId );\r\n typeConcept = typeConceptString as LConcept;\r\n \r\n var conceptString = await CreateTheConceptLocal(referent,type,userId, categoryId, typeConcept.id,accessId, referentId );\r\n\r\n concept = conceptString as LConcept;\r\n }\r\n else if(stringLength > 255){\r\n\r\n var typeConceptString = await MakeTheTypeConceptLocal(stringToCheck, sessionInformationId, sessionInformationUserId, userId);\r\n typeConcept = typeConceptString as LConcept;\r\n var conceptString = await CreateTheConceptLocal(referent,stringToCheck,userId, categoryId, typeConcept.id,accessId );\r\n\r\n concept = conceptString as LConcept;\r\n\r\n\r\n\r\n }\r\n else{\r\n var typeConceptString = await MakeTheTypeConceptLocal(stringToCheck, sessionInformationId, sessionInformationUserId, userId);\r\n typeConcept = typeConceptString as LConcept;\r\n var conceptByCharTypeString = await LocalConceptsData.GetConceptByCharacterAndTypeLocal(referent,typeConcept.id);\r\n var conceptTypeCharacter = conceptByCharTypeString as LConcept;\r\n // var makeTheNameString = await MakeTheName(referent,userId, securityId, securityUserId, accessId, accessUserId, sessionInformationId, sessionInformationUserId,typeConcept.id, typeConcept.userId,conceptTypeCharacter );\r\n // var makeTheNameConcept = makeTheNameString as Concept;\r\n concept = conceptTypeCharacter;\r\n if(conceptTypeCharacter.id == 0 && conceptTypeCharacter.userId == 0){\r\n var conceptString = await CreateTheConceptLocal(referent, stringToCheck, userId, categoryId, typeConcept.id,accessId );\r\n concept = conceptString as LConcept;\r\n }\r\n }\r\n\r\n concept.type = typeConcept;\r\n return concept;\r\n\r\n}","/**\r\n * Local Type Concept Creation Module\r\n *\r\n * This module handles the creation of type concepts in the local storage layer.\r\n * Type concepts define the schema and categorization of other concepts in the system.\r\n * It supports hierarchical type creation through recursive processing of composite type names.\r\n *\r\n * @module MakeTheTypeLocal\r\n */\r\n\r\nimport { LConcept } from \"../../DataStructures/Local/LConcept\";\r\nimport CreateTheConceptLocal from \"./CreateTheConceptLocal\";\r\nimport GetConceptByCharacterLocal from \"./GetConceptByCharacterLocal\";\r\nimport { SplitStrings } from \"../SplitStrings\";\r\nimport MakeTheConceptLocal from \"./MakeTheConceptLocal\";\r\n\r\n/**\r\n * Creates or retrieves a type concept with support for hierarchical type structures.\r\n *\r\n * This function ensures that a type concept exists in the local storage. If the type\r\n * doesn't exist, it creates it, handling both simple types and composite types.\r\n * Composite types (e.g., \"the_category_type\") are split and processed recursively\r\n * to establish proper type hierarchies.\r\n *\r\n * The function implements get-or-create logic to prevent duplicate type concepts\r\n * and maintains the type system's integrity through proper categorization.\r\n *\r\n * @param typeString - The name of the type to create or retrieve (e.g., \"the_user\", \"the_product\")\r\n * @param sessionId - Session information ID for tracking\r\n * @param sessionUserId - User ID associated with the session\r\n * @param userId - The ID of the user creating/owning the type\r\n *\r\n * @returns A promise that resolves to the type concept (existing or newly created)\r\n *\r\n * @remarks\r\n * - First checks if type concept already exists by character value\r\n * - If not found or invalid (id === 0), proceeds with creation logic\r\n * - For simple types: Creates with typeId 51 (base \"the\" type) and category 4\r\n * - For composite types: Splits on underscore and recursively creates category and type\r\n * - Example: \"the_category_type\" splits into \"the_category\" (category) and \"type\" (type)\r\n * - Uses accessId of 4 (default access level) for new types\r\n * - The base type \"the\" (typeId 51) is the root of the type hierarchy\r\n *\r\n * @example\r\n * ```typescript\r\n * // Create a simple type\r\n * const userType = await MakeTheTypeConceptLocal(\r\n * \"the_user\",\r\n * 999, // sessionId\r\n * 123, // sessionUserId\r\n * 123 // userId\r\n * );\r\n * console.log(userType.characterValue); // \"the_user\"\r\n * console.log(userType.typeId); // 51 (the base \"the\" type)\r\n *\r\n * // Create a composite type (creates category and type recursively)\r\n * const productType = await MakeTheTypeConceptLocal(\r\n * \"the_ecommerce_product\",\r\n * 999,\r\n * 123,\r\n * 123\r\n * );\r\n * // This creates:\r\n * // 1. \"the_ecommerce\" as category\r\n * // 2. \"product\" as type\r\n * // 3. \"the_ecommerce_product\" as final type\r\n *\r\n * // Subsequent calls return existing type (no duplicate)\r\n * const sameType = await MakeTheTypeConceptLocal(\"the_user\", 999, 123, 123);\r\n * console.log(sameType.id === userType.id); // true\r\n * ```\r\n *\r\n * @see {@link GetConceptByCharacterLocal} - Checks if type already exists\r\n * @see {@link MakeTheConceptLocal} - Creates concepts with uniqueness check\r\n * @see {@link CreateTheConceptLocal} - Low-level concept creation\r\n * @see {@link SplitStrings} - Splits composite type names\r\n * @see {@link MakeTheInstanceConceptLocal} - Uses this to create types for instances\r\n */\r\nexport default async function MakeTheTypeConceptLocal(typeString: string, sessionId: number, sessionUserId: number, userId: number,\r\n )\r\n{\r\n var accessId: number = 4;\r\n\r\n var existingConcept = await GetConceptByCharacterLocal(typeString);\r\n\r\n if(existingConcept){\r\n if(existingConcept.id == 0 || existingConcept.userId == 0){\r\n var splittedStringArray = SplitStrings(typeString);\r\n if(splittedStringArray[0] == typeString){\r\n var concept = await MakeTheConceptLocal(typeString,\"the\", userId, 4, 51);\r\n existingConcept = concept as LConcept;\r\n\r\n } \r\n else{\r\n var categoryId:number = 1;\r\n var categoryConcept = await MakeTheTypeConceptLocal(splittedStringArray[0], sessionId, sessionUserId, userId);\r\n var typeConcept = await MakeTheTypeConceptLocal(splittedStringArray[1], sessionId, sessionUserId, userId );\r\n\r\n if(typeConcept){\r\n \r\n var concept = await CreateTheConceptLocal(typeString,splittedStringArray[1], userId, categoryConcept.id, typeConcept.id, accessId );\r\n existingConcept = concept as LConcept;\r\n }\r\n\r\n\r\n }\r\n }\r\n\r\n }\r\n return existingConcept;\r\n\r\n\r\n}","/**\r\n * Local Composition Update Module\r\n *\r\n * This module provides functionality to update existing compositions in local storage\r\n * by patching them with new data. It handles the complex process of modifying a graph\r\n * structure, including replacing existing concepts, creating new ones, and managing\r\n * connections while maintaining data integrity.\r\n *\r\n * @module UpdateCompositionLocal\r\n */\r\n\r\nimport { Connection } from '../../DataStructures/Connection';\r\nimport { Concept } from '../../DataStructures/Concept';\r\nimport InsertUniqueNumber from '../../Helpers/UniqueInsert'\r\nimport {\r\n CheckAllConnectionsConnectedInConnectionArray,\r\n CheckAllConnectionsConnectedInLConnectionArray,\r\n CheckIfTypeConceptsExistsInArray,\r\n CheckIfTypeLConceptsExistsInArray,\r\n} from '../../Helpers/CheckIfExists'\r\n\r\nimport {\r\n RemoveConceptFromList,\r\n RemoveConnectionFromList,\r\n} from '../../Helpers/RemoveFromArray'\r\nimport { PatcherStructure } from '../../DataStructures/PatcherStructure'\r\nimport { CreateDefaultConcept } from './../CreateDefaultConcept';\r\nimport { GetAllConnectionsOfComposition } from '../../Api/GetAllConnectionsOfComposition';\r\nimport GetTheConcept from './../GetTheConcept';\r\nimport MakeTheInstanceConcept from './../MakeTheInstanceConcept';\r\nimport { createTheConnection } from './../CreateTheConnection';\r\nimport { DeleteConnectionById } from './../DeleteConnection';\r\nimport { SyncData } from '../../DataStructures/SyncData';\r\nimport { Composition } from '../../DataStructures/Composition/Composition';\r\nimport { CreateTheCompositionLocal } from './CreateTheCompositionLocal';\r\nimport { MakeTheInstanceConceptLocal } from './MakeTheInstanceConceptLocal';\r\nimport { CreateDefaultLConcept, CreateTheConnectionLocal, LConcept, LConnection } from '../../app';\r\nimport { convertFromConceptToLConcept, convertFromConnectionToLConnection } from '../Conversion/ConvertConcepts';\r\n\r\n/**\r\n * Updates an existing composition by patching it with new data.\r\n *\r\n * This function performs a sophisticated update operation on a composition by:\r\n * 1. Fetching the current composition structure from the backend\r\n * 2. Identifying concepts that need to be replaced (same type, different value)\r\n * 3. Creating new concepts for the patch data\r\n * 4. Removing old connections and concepts that are being replaced\r\n * 5. Creating new connections for the updated structure\r\n * 6. Triggering synchronization with the backend\r\n *\r\n * The function handles both simple property updates and complex nested composition updates.\r\n *\r\n * @param patcherStructure - Object containing update instructions\r\n * @param patcherStructure.compositionId - ID of the root composition to update\r\n * @param patcherStructure.ofTheCompositionId - ID of immediate parent (for nested updates)\r\n * @param patcherStructure.patchObject - The new data to patch into the composition\r\n * @param patcherStructure.userId - ID of the user performing the update\r\n * @param patcherStructure.sessionId - Session tracking ID\r\n * @param patcherStructure.accessId - Access control ID\r\n *\r\n * @returns A promise that resolves when the update is complete\r\n *\r\n * @remarks\r\n * - Fetches latest composition data from backend to ensure consistency\r\n * - Identifies existing concepts by type and marks them for deletion\r\n * - Creates new concepts with the updated values\r\n * - Establishes proper connections between parent and new concepts\r\n * - Deletes old connections associated with replaced concepts\r\n * - Triggers online synchronization via SyncData.SyncDataOnline()\r\n * - Handles both primitive values and nested compositions (objects/arrays)\r\n * - For nested compositions, recursively creates the structure\r\n * - Converts backend Concept/Connection types to local LConcept/LConnection types\r\n *\r\n * @example\r\n * ```typescript\r\n * // Update a user's name and age\r\n * const patcher: PatcherStructure = {\r\n * compositionId: 12345, // User composition ID\r\n * ofTheCompositionId: null, // No immediate parent (root level)\r\n * patchObject: {\r\n * name: \"Jane Doe\", // Updated name\r\n * age: 31 // Updated age\r\n * },\r\n * userId: 123,\r\n * sessionId: 999,\r\n * accessId: 4\r\n * };\r\n *\r\n * await UpdateCompositionLocal(patcher);\r\n * // Result: Old name/age concepts replaced with new ones\r\n *\r\n * // Update nested property\r\n * const nestedPatcher: PatcherStructure = {\r\n * compositionId: 12345,\r\n * ofTheCompositionId: 12350, // Address composition ID\r\n * patchObject: {\r\n * city: \"New York\" // Update city within address\r\n * },\r\n * userId: 123,\r\n * sessionId: 999,\r\n * accessId: 4\r\n * };\r\n *\r\n * await UpdateCompositionLocal(nestedPatcher);\r\n *\r\n * // Update with complex nested structure\r\n * const complexPatcher: PatcherStructure = {\r\n * compositionId: 12345,\r\n * ofTheCompositionId: null,\r\n * patchObject: {\r\n * address: { // Nested composition\r\n * street: \"123 Main St\",\r\n * city: \"Boston\"\r\n * }\r\n * },\r\n * userId: 123,\r\n * sessionId: 999,\r\n * accessId: 4\r\n * };\r\n *\r\n * await UpdateCompositionLocal(complexPatcher);\r\n * ```\r\n *\r\n * @see {@link PatcherStructure} - Structure defining update parameters\r\n * @see {@link MakeTheInstanceConceptLocal} - Creates new concepts during update\r\n * @see {@link CreateTheCompositionLocal} - Handles nested composition creation\r\n * @see {@link CreateTheConnectionLocal} - Creates connections for new concepts\r\n * @see {@link DeleteConnectionById} - Removes old connections\r\n * @see {@link SyncData.SyncDataOnline} - Synchronizes changes with backend\r\n */\r\nexport async function UpdateCompositionLocal(\r\n patcherStructure: PatcherStructure,\r\n) {\r\n // get all the default userId, sessionId, accessId passed by the patcherStructure\r\nconst userId = patcherStructure.userId\r\nconst sessionId = patcherStructure.sessionId\r\nconst accessId = patcherStructure.accessId\r\nlet connectionList: LConnection[] = []\r\nconst conceptList: LConcept[] = []\r\nlet composition: LConcept = CreateDefaultLConcept()\r\nlet parentConcept: LConcept = CreateDefaultLConcept()\r\nconst toDeleteConcepts: LConcept[] = []\r\n// the main composition Id that has the data that needs to be patched\r\nconst compositionId = patcherStructure.compositionId\r\n\r\n// if you want to edit the subcompositions of the composition then you have to pass to this\r\nconst ofTheConceptId = patcherStructure.ofTheCompositionId\r\nlet toDeleteConnections: LConnection[] = []\r\n\r\n// get all connections from the backend because it needs latest data\r\nconst connectionListString = await GetAllConnectionsOfComposition(compositionId)\r\nlet connectionListOriginal = connectionListString as Connection[]\r\nfor(let i=0 ;i < connectionListOriginal.length; i++){\r\n connectionList.push(convertFromConnectionToLConnection(connectionListOriginal[i]));\r\n}\r\nconst conceptIdList: number[] = []\r\nconst compositionList: number[] = []\r\n// put this in the upper section before updating because this will tell all other distributed\r\n//servers to destroy the copy of the composition that they have as new composition is coming up\r\n\r\n// get all the connections that are inside of the composition and store them in\r\nlet allConcepts = [];\r\nfor (let i = 0; i < connectionList.length; i++) {\r\n InsertUniqueNumber(compositionList, connectionList[i].ofTheConceptId)\r\n InsertUniqueNumber(conceptIdList, connectionList[i].ofTheConceptId)\r\n InsertUniqueNumber(conceptIdList, connectionList[i].toTheConceptId)\r\n allConcepts.push(connectionList[i].ofTheConceptId);\r\n}\r\n\r\n// get all the concepts that are inside of the composition and store them in a conceptList\r\nfor (let i = 0; i < conceptIdList.length; i++) {\r\n const conceptString = await GetTheConcept(conceptIdList[i])\r\n const concept = conceptString as Concept\r\n if (compositionId == conceptIdList[i]) {\r\n composition = convertFromConceptToLConcept(concept)\r\n }\r\n if (ofTheConceptId == conceptIdList[i]) {\r\n parentConcept = convertFromConceptToLConcept(concept)\r\n }\r\n conceptList.push(convertFromConceptToLConcept(concept))\r\n}\r\n\r\n// now trying to patch the new object into the composition\r\nconst object = patcherStructure.patchObject\r\nfor (const key in object) {\r\n let insertingConcept: LConcept = CreateDefaultLConcept();\r\n const value = object[key]\r\n let localConcept = composition\r\n\r\n // if the immedidate parent exists in the composition (i.e. for multilevel composition)\r\n if (parentConcept.id > 0) {\r\n localConcept = parentConcept\r\n }\r\n\r\n if(Array.isArray(value) || typeof value == 'object'){\r\n insertingConcept = await MakeTheInstanceConceptLocal(key, \"\", true, composition.userId, 4, 999);\r\n await CreateTheCompositionLocal(object[key], insertingConcept.id, insertingConcept.userId, composition.id, composition.userId, 4, 999);\r\n }\r\n else{\r\n // make the new concept in the object\r\n insertingConcept = await MakeTheInstanceConceptLocal(\r\n key,\r\n value,\r\n false,\r\n userId,\r\n accessId,\r\n sessionId,\r\n )\r\n }\r\n\r\n\r\n // check if the concept exists in the concept list because if it exists then we have to delete old connection\r\n const ExistingConcepts: LConcept[] = CheckIfTypeLConceptsExistsInArray(\r\n conceptList,\r\n insertingConcept,\r\n )\r\n\r\n // if the existing concept then start the process for deleting the concept in the list\r\n for(let i=0 ; i< ExistingConcepts.length; i++){\r\n if (ExistingConcepts[i].id > 0) {\r\n const deletingConnections: LConnection[] =\r\n CheckAllConnectionsConnectedInLConnectionArray(\r\n connectionList,\r\n ExistingConcepts[i].id,\r\n )\r\n\r\n toDeleteConnections = toDeleteConnections.concat(deletingConnections);\r\n toDeleteConcepts.push(ExistingConcepts[i]);\r\n }\r\n \r\n }\r\n\r\n\r\n\r\n \r\n\r\n\r\n // create the connection between the new concept and the old composition\r\n const connectionString = await CreateTheConnectionLocal(\r\n localConcept.id,\r\n insertingConcept.id,\r\n composition.id,\r\n 2\r\n )\r\n const connection = connectionString as LConnection\r\n conceptList.push(insertingConcept)\r\n\r\n }\r\n // now you have to delete the connection in bulk\r\n for (let j = 0; j < toDeleteConnections.length; j++) {\r\n // remove from the cache list\r\n // delete the connection in the backend\r\n DeleteConnectionById(toDeleteConnections[j].id)\r\n }\r\n\r\n\r\nSyncData.SyncDataOnline()\r\n}\r\n","/**\r\n * @module MakeTheCharacter\r\n * @description Creates character-based concepts in the Concept Connection System (CCS).\r\n * This module handles the creation of concepts representing character data, with special\r\n * handling for single characters (using ASCII codes) versus multi-character strings.\r\n * It serves as a fundamental building block for text and string representation in CCS.\r\n */\r\n\r\nimport { GetConceptByCharacterAndType } from \"../Api/GetConceptByCharacterAndType\";\r\nimport { Concept } from \"../DataStructures/Concept\";\r\nimport { Returner } from \"../DataStructures/Returner\";\r\nimport MakeTheCharacterData from \"./MakeTheCharacterData\";\r\nimport MakeTheConcept from \"./MakeTheConcept\";\r\n\r\n/**\r\n * Creates a character concept for the given character data.\r\n *\r\n * This function creates concepts that represent character data in the CCS system.\r\n * It handles two distinct cases based on the length of the input:\r\n *\r\n * 1. Single character: Uses the ASCII character code as the referent ID and type 49\r\n * 2. Multiple characters: Uses character data ID as referent and type 51\r\n *\r\n * Both cases first create the underlying character data before creating the concept.\r\n *\r\n * @param the_character_data - The character string to create a concept for (e.g., \"a\", \"hello\")\r\n * @param userId - The ID of the user creating this character concept\r\n * @param securityId - The security control ID for access management\r\n * @param accessId - The access control ID determining visibility\r\n * @param accessUserId - The user ID for access control\r\n * @param sessionId - The session ID for tracking this operation\r\n *\r\n * @returns Promise resolving to the created character Concept\r\n *\r\n * @remarks\r\n * - Single characters use ASCII charCodeAt(0) as their referent ID\r\n * - Single characters are typed with ID 49 (character type)\r\n * - Multi-character strings are typed with ID 51 (character data type)\r\n * - Multi-character strings reference the created character data as referent\r\n * - Category ID is always 4 for character concepts\r\n * - Always creates new character data before creating the concept\r\n *\r\n * @example\r\n * ```typescript\r\n * // Create a single character concept\r\n * const charA = await MakeTheCharacter(\r\n * \"a\",\r\n * 1,\r\n * 999,\r\n * 100,\r\n * 1,\r\n * 999\r\n * );\r\n * // Uses ASCII code 97 as referent ID\r\n *\r\n * // Create a multi-character concept\r\n * const hello = await MakeTheCharacter(\r\n * \"hello\",\r\n * 1,\r\n * 999,\r\n * 100,\r\n * 1,\r\n * 999\r\n * );\r\n * // Creates character data first, then references it\r\n *\r\n * // Create a type string\r\n * const typeName = await MakeTheCharacter(\r\n * \"the_user\",\r\n * 1,\r\n * 999,\r\n * 100,\r\n * 1,\r\n * 999\r\n * );\r\n * ```\r\n *\r\n * @see {@link MakeTheCharacterData} - Creates the underlying character data\r\n * @see {@link MakeTheConcept} - Creates the concept entity\r\n * @see {@link Returner} - Return type for character data creation\r\n */\r\nexport default async function MakeTheCharacter(the_character_data:string, userId: number, securityId: number, \r\n accessId:number, accessUserId:number, sessionId:number){\r\n var categoryUserId: number = userId;\r\n var securityUserId: number = userId;\r\n var accessUserId: number = userId;\r\n var categoryId: number = 4;\r\n var typeId: number = 51;\r\n var typeUserId: number = userId;\r\n var sessionUserId: number = userId;\r\n var referentUserId: number = userId;\r\n\r\n var lengthOfCharacters: number = the_character_data.length;\r\n var concept;\r\n if(lengthOfCharacters == 1){\r\n var referentId:number = the_character_data.charCodeAt(0);\r\n var typeIdForCharacter:number = 49;\r\n var characterDataString = await MakeTheCharacterData(the_character_data, userId, securityId,accessId, sessionId);\r\n\r\n concept = MakeTheConcept(the_character_data, userId, categoryId, categoryUserId,\r\n referentId, referentUserId, typeIdForCharacter, typeUserId,\r\n securityId, securityUserId, accessId, accessUserId,\r\n sessionId, sessionUserId);\r\n }\r\n else{\r\n var characterDataString = await MakeTheCharacterData(the_character_data, userId, securityId,accessId, sessionId);\r\n var characterData = characterDataString as Returner;\r\n if(characterData.isNew){\r\n var conceptString = await MakeTheConcept(the_character_data, userId, categoryId, categoryUserId, typeId, typeUserId, characterData.id, characterData.userId,\r\n securityId, securityUserId, accessId, accessUserId, sessionId, sessionUserId);\r\n\r\n concept = conceptString as Concept;\r\n\r\n }\r\n else{\r\n var conceptString = await MakeTheConcept(the_character_data, userId, categoryId, categoryUserId, typeId, typeUserId, characterData.id, characterData.userId,\r\n securityId, securityUserId, accessId, accessUserId, sessionId, sessionUserId);\r\n\r\n concept = conceptString as Concept;\r\n\r\n }\r\n\r\n }\r\n\r\n return concept;\r\n\r\n }","/**\r\n * @module MakeTheCharacterData\r\n * @description Creates character data entries in the Concept Connection System (CCS).\r\n * This module handles the storage of character strings as data entities that can be\r\n * referenced by concepts. It creates TheCharacter objects and persists them through\r\n * the API, providing metadata about whether the character data is newly created.\r\n */\r\n\r\nimport { CreateTheCharacter } from \"../Api/Create/CreateTheCharacter\";\r\nimport { GetCharacterByCharacter } from \"../Api/GetCharacterDataByCharacter\";\r\nimport { Returner } from \"../DataStructures/Returner\";\r\nimport { TheCharacter } from \"../DataStructures/TheCharacter\";\r\n\r\n/**\r\n * Creates or retrieves character data for a given character string.\r\n *\r\n * This function creates a TheCharacter data object with the provided character string\r\n * and persists it to the database through the API. The character data serves as a\r\n * storage mechanism for string values that can be referenced by multiple concepts.\r\n *\r\n * The created character data includes all necessary metadata for access control,\r\n * security, and session tracking. The Returner object indicates whether the\r\n * character data was newly created or already existed.\r\n *\r\n * @param the_character_data - The character string to store (e.g., \"hello\", \"user_name\")\r\n * @param userId - The ID of the user creating this character data\r\n * @param securityId - The security control ID for access management\r\n * @param accessId - The access control ID determining visibility\r\n * @param sessionId - The session ID for tracking this operation\r\n *\r\n * @returns Promise resolving to a Returner object containing the character data ID,\r\n * user ID, and a flag indicating if it was newly created\r\n *\r\n * @remarks\r\n * - Creates a TheCharacter object with empty string for last parameter\r\n * - Sets isNew flag to false initially in TheCharacter constructor\r\n * - The actual isNew status comes from the API response in Returner\r\n * - All user IDs (category, access, security, session) are set to the same userId\r\n * - Character data is immutable once created and can be shared across concepts\r\n *\r\n * @example\r\n * ```typescript\r\n * // Create character data for a username\r\n * const result = await MakeTheCharacterData(\r\n * \"john_doe\",\r\n * 1,\r\n * 999,\r\n * 100,\r\n * 999\r\n * );\r\n * console.log(result.id); // Character data ID\r\n * console.log(result.isNew); // true if newly created\r\n *\r\n * // Create character data for a type name\r\n * const typeData = await MakeTheCharacterData(\r\n * \"the_user\",\r\n * 1,\r\n * 999,\r\n * 100,\r\n * 999\r\n * );\r\n *\r\n * // Use in character concept creation\r\n * const charData = await MakeTheCharacterData(\"hello\", 1, 999, 100, 999);\r\n * // charData.id can now be used as a referent in concept creation\r\n * ```\r\n *\r\n * @see {@link CreateTheCharacter} - API function that persists the character data\r\n * @see {@link TheCharacter} - Data structure representing character data\r\n * @see {@link Returner} - Return type containing ID and creation status\r\n */\r\nexport default async function MakeTheCharacterData(the_character_data: string, userId: number, securityId: number , accessId: number,\r\n sessionId:number){\r\n var categoryUserId : number = userId;\r\n var accessUserId: number = userId;\r\n var securityUserId: number = userId;\r\n var sessionInformationUserId: number = userId;\r\n\r\n var theCharacter = new TheCharacter(userId, the_character_data, securityId, securityUserId, accessId, accessUserId,\r\n sessionId, sessionInformationUserId,\"\",false);\r\n var output = await CreateTheCharacter(theCharacter);\r\n var returner = output as Returner;\r\n\r\n return returner;\r\n\r\n}","import { GetConceptByCharacterAndType } from \"../Api/GetConceptByCharacterAndType\";\r\nimport { Concept } from \"../DataStructures/Concept\";\r\nimport { ReservedIds } from \"../DataStructures/ReservedIds\";\r\nimport CreateTheConcept from \"./CreateTheConcept\";\r\n\r\nexport default async function MakeTheConcept(referent:string, userId:number, categoryId:number, categoryUserId:number,\r\ntypeId:number, typeUserId:number,referentId:number, referentUserId:number,securityId:number, securityUserId:number,\r\naccessId:number, accessUserId:number, sessionInformationId:number, sessionInformationUserId:number){\r\n\r\n var conceptString = await GetConceptByCharacterAndType(referent, typeId);\r\n var concept = conceptString as Concept;\r\n\r\n if(concept.id == 0){\r\n\r\n conceptString = await CreateTheConcept(referent,userId,categoryId,categoryUserId,typeId, typeUserId, referentId, referentUserId, securityId,\r\n securityUserId, accessId, accessUserId, sessionInformationId, sessionInformationUserId);\r\n\r\n concept = conceptString as Concept;\r\n }\r\n\r\n return concept;\r\n\r\n\r\n}","/**\r\n * @module MakeTheInstanceConcept\r\n * @description Creates instance concepts in the Concept Connection System (CCS).\r\n * This module handles the creation of concepts with specific types and referents,\r\n * managing various scenarios including compositions, text data, and character concepts.\r\n * It serves as a core factory function for instantiating typed concepts in the system.\r\n */\r\n\r\nimport { CreateTextData } from \"../Api/Create/CreateTheTextData\";\r\nimport { GetConceptByCharacterAndType } from \"../Api/GetConceptByCharacterAndType\";\r\nimport { MakeTheNameInBackend } from \"../Api/MakeTheNameInBackend\";\r\nimport { Concept } from \"../DataStructures/Concept\";\r\nimport { TheTexts } from \"../DataStructures/TheTexts\";\r\nimport { InnerActions } from \"../DataStructures/Transaction/Transaction\";\r\nimport { MakeTheTypeConceptApi } from \"../app\";\r\nimport { CreateDefaultConcept } from \"./CreateDefaultConcept\";\r\nimport CreateTheConcept, { CreateTheConceptImmediate, CreateTheConceptTemporary } from \"./CreateTheConcept\";\r\nimport { MakeTheName } from \"./MakeTheName\";\r\nimport { MakeTheTimestamp } from \"./MakeTheTimestamp\";\r\nimport {MakeTheTypeConcept} from \"./MakeTheTypeConcept\";\r\n\r\n/**\r\n * Creates an instance concept with a specific type and referent.\r\n *\r\n * This function is the primary factory for creating typed concepts in the CCS system.\r\n * It handles three main scenarios:\r\n * 1. Composition concepts - Creates concepts using the composition pattern\r\n * 2. Text concepts - Creates concepts for strings longer than 255 characters, storing them as text data\r\n * 3. Standard concepts - Creates or retrieves existing concepts for standard character values\r\n *\r\n * The function automatically prefixes type names with \"the_\" if not already present and\r\n * manages all necessary associations (category, type, referent, security, access, session).\r\n *\r\n * @param type - The type identifier for the concept (e.g., \"user\", \"post\", \"comment\").\r\n * Will be automatically prefixed with \"the_\" if not present.\r\n * @param referent - The actual value or data for the concept (e.g., username, post content)\r\n * @param composition - If true, creates a composition concept bypassing character checks\r\n * @param userId - The ID of the user creating this concept\r\n * @param passedAccessId - The access control ID determining who can access this concept\r\n * @param passedSessionId - The session ID for tracking this operation (default: 999)\r\n * @param referentId - Optional ID of a referent concept (default: 0)\r\n * @param actions - Transaction actions for batch operations (default: empty actions)\r\n *\r\n * @returns Promise resolving to the created or retrieved Concept with type information populated\r\n *\r\n * @remarks\r\n * - For composition concepts, bypasses character lookup and creates immediately\r\n * - For strings > 255 chars, creates both a concept and a separate text data entry\r\n * - For standard concepts, checks for existing concepts by character and type before creating\r\n * - Includes performance timing logs (commented out) for optimization analysis\r\n * - The type concept is always attached to the returned concept for reference\r\n *\r\n * @example\r\n * ```typescript\r\n * // Create a standard user concept\r\n * const userConcept = await MakeTheInstanceConcept(\r\n * \"user\",\r\n * \"john_doe\",\r\n * false,\r\n * 1,\r\n * 100,\r\n * 999\r\n * );\r\n *\r\n * // Create a composition concept\r\n * const compositionConcept = await MakeTheInstanceConcept(\r\n * \"custom_type\",\r\n * \"complex_data\",\r\n * true,\r\n * 1,\r\n * 100\r\n * );\r\n *\r\n * // Create a text concept for long content\r\n * const longText = \"Lorem ipsum...\".repeat(100);\r\n * const textConcept = await MakeTheInstanceConcept(\r\n * \"article\",\r\n * longText,\r\n * false,\r\n * 1,\r\n * 100\r\n * );\r\n * ```\r\n *\r\n * @see {@link MakeTheTypeConceptApi} - Creates or retrieves type concepts\r\n * @see {@link CreateTheConcept} - Creates the actual concept entity\r\n * @see {@link GetConceptByCharacterAndType} - Retrieves existing concepts\r\n * @see {@link CreateTextData} - Stores long text separately\r\n */\r\nexport default async function MakeTheInstanceConcept(type:string, referent:string, composition:boolean=false, userId: number, \r\n passedAccessId:number, passedSessionId: number=999, referentId: number = 0, actions: InnerActions = {concepts: [], connections: []}){\r\n userId = composition ? userId : 999;\r\n let sessionInformationId: number = passedSessionId;\r\n let categoryId: number = 4;\r\n let categoryUserId: number = userId; \r\n let referentUserId: number = 999;\r\n let securityId: number = 999;\r\n let securityUserId: number = userId;\r\n let sessionInformationUserId: number = userId;\r\n // change this\r\n let accessId: number = passedAccessId;\r\n let accessUserId: number = userId;\r\n\r\n let stringToCheck: string = \"\";\r\n\r\n let stringLength:number = referent.length;\r\n let typeConcept = CreateDefaultConcept();\r\n let concept: Concept;\r\n let startsWithThe = type.startsWith(\"the_\");\r\n\r\n if(startsWithThe){\r\n stringToCheck = type;\r\n }\r\n else{\r\n stringToCheck = \"the_\" + type;\r\n }\r\n let startTime = new Date().getTime();\r\n\r\n if(composition){\r\n let typeConceptString = await MakeTheTypeConceptApi(type, userId);\r\n typeConcept = typeConceptString as Concept;\r\n let conceptString = await CreateTheConcept(referent,userId, categoryId, userId, typeConcept.id, typeConcept.userId,\r\n referentId, referentUserId, securityId, securityUserId, accessId, accessUserId, sessionInformationId, sessionInformationUserId, actions );\r\n concept = conceptString as Concept;\r\n let end = new Date().getTime();\r\n let time = end - startTime;\r\n // console.log('Execution time in type test for composition: ' + time + \"--------\" + type);\r\n }\r\n else if(stringLength > 255){\r\n\r\n let typeConceptString = await MakeTheTypeConceptApi(stringToCheck, userId);\r\n typeConcept = typeConceptString as Concept;\r\n let conceptString = await CreateTheConcept(referent,userId, categoryId, userId, typeConcept.id, typeConcept.userId,\r\n referentId, referentUserId, securityId, securityUserId, accessId, accessUserId, sessionInformationId, sessionInformationUserId, actions );\r\n \r\n concept = conceptString as Concept;\r\n\r\n let TheTextsData = new TheTexts(userId,referent,securityId,securityUserId, accessId, accessUserId, sessionInformationId, sessionInformationUserId,\r\n Date.now().toString(),true);\r\n\r\n CreateTextData(TheTextsData);\r\n let end = new Date().getTime();\r\n let time = end - startTime;\r\n // console.log('Execution time in type test for text: ' + time + \"--------\" + type);\r\n\r\n }\r\n else{\r\n let typeConceptString = await MakeTheTypeConceptApi(stringToCheck, userId);\r\n typeConcept = typeConceptString as Concept;\r\n let conceptByCharTypeString = await GetConceptByCharacterAndType(referent,typeConcept.id);\r\n let conceptTypeCharacter = conceptByCharTypeString as Concept;\r\n concept = conceptTypeCharacter;\r\n if(conceptTypeCharacter.id == 0 && conceptTypeCharacter.userId == 0){\r\n // let makeTheNameString = await MakeTheName(referent,userId, securityId, securityUserId, accessId, accessUserId, sessionInformationId, sessionInformationUserId,typeConcept.id, typeConcept.userId,conceptTypeCharacter );\r\n // let makeTheNameConcept = makeTheNameString as Concept;\r\n // concept = conceptTypeCharacter;\r\n let conceptString = await CreateTheConceptImmediate(referent,userId, categoryId, userId, typeConcept.id, typeConcept.userId,\r\n 12, 12, securityId, securityUserId, accessId, accessUserId, sessionInformationId, sessionInformationUserId, actions );\r\n concept = conceptString as Concept;\r\n // MakeTheNameInBackend(concept.id, `${referent}`, typeConcept.id, userId);\r\n\r\n }\r\n let end = new Date().getTime();\r\n let time = end - startTime;\r\n // console.log('Execution time in type test: ' + time + \"--------\" + type);\r\n }\r\n // if(concept){\r\n // if(concept.type == null){\r\n // let conceptType = ConceptsData.GetConcept(concept.typeId);\r\n // if(conceptType == null && concept.typeId != null && concept.typeId != undefined){\r\n // let typeConceptStringNew = await GetConcept(concept.typeId);\r\n // let newTypeConcept = typeConceptStringNew as Concept;\r\n // concept.type = newTypeConcept;\r\n // }\r\n // }\r\n // }\r\n concept.type = typeConcept;\r\n return concept;\r\n}","/**\r\n * @module MakeTheTimestamp\r\n * @description Creates timestamp concepts in the Concept Connection System (CCS).\r\n * This module provides a specialized function for creating concepts that represent\r\n * timestamps or time-based data. It ensures proper type prefixing and creates\r\n * concepts with standardized metadata for temporal tracking within the system.\r\n */\r\n\r\nimport { Concept } from \"../DataStructures/Concept\";\r\nimport { MakeTheTypeConceptApi } from \"../app\";\r\nimport { CreateDefaultConcept } from \"./CreateDefaultConcept\";\r\nimport MakeTheConcept from \"./MakeTheConcept\";\r\nimport {MakeTheTypeConcept} from \"./MakeTheTypeConcept\";\r\n\r\n/**\r\n * Creates a timestamp concept with the specified type and referent.\r\n *\r\n * This function creates concepts specifically designed for representing timestamps\r\n * and temporal data in the CCS system. It follows a simplified creation flow compared\r\n * to MakeTheInstanceConcept, focusing on straightforward type-referent associations.\r\n *\r\n * The function automatically ensures the type string is prefixed with \"the_\" if not\r\n * already present, then creates the type concept and associates it with a new concept\r\n * containing the timestamp referent value.\r\n *\r\n * @param type - The type identifier for the timestamp concept (e.g., \"created_at\", \"updated_at\").\r\n * Will be automatically prefixed with \"the_\" if not present.\r\n * @param referent - The timestamp value or temporal data (e.g., ISO date string, Unix timestamp)\r\n * @param userId - The ID of the user creating this timestamp concept\r\n * @param accessId - The access control ID determining visibility\r\n * @param sessionInformationId - The session ID for tracking this operation (default: 999)\r\n *\r\n * @returns Promise resolving to the created timestamp Concept\r\n *\r\n * @remarks\r\n * - Category ID is fixed at 4 for timestamp concepts\r\n * - Referent ID is set to 0 (no referent concept)\r\n * - Security ID is fixed at 999\r\n * - Session information ID is overridden to 999 regardless of parameter\r\n * - Access ID is overridden to 4 regardless of parameter\r\n * - All user IDs are derived from the userId parameter\r\n * - Type concept is created before the timestamp concept\r\n *\r\n * @example\r\n * ```typescript\r\n * // Create a timestamp for creation time\r\n * const createdAt = await MakeTheTimestamp(\r\n * \"created_at\",\r\n * new Date().toISOString(),\r\n * 1,\r\n * 100\r\n * );\r\n *\r\n * // Create a timestamp with explicit session\r\n * const updatedAt = await MakeTheTimestamp(\r\n * \"the_updated_at\",\r\n * Date.now().toString(),\r\n * 1,\r\n * 100,\r\n * 999\r\n * );\r\n *\r\n * // Create a custom temporal concept\r\n * const expiryTime = await MakeTheTimestamp(\r\n * \"expires_at\",\r\n * \"2025-12-31T23:59:59Z\",\r\n * 1,\r\n * 100\r\n * );\r\n * ```\r\n *\r\n * @see {@link MakeTheTypeConceptApi} - Creates or retrieves the type concept\r\n * @see {@link MakeTheConcept} - Creates the actual concept entity\r\n * @see {@link CreateDefaultConcept} - Creates a default concept structure\r\n */\r\nexport async function MakeTheTimestamp(type:string, referent:string, userId: number, \r\n accessId:number, sessionInformationId: number=999){\r\n\r\n var sessionInformationId: number = 999;\r\n var categoryId: number = 4;\r\n var categoryUserId: number = userId; \r\n var referentId: number = 0;\r\n var referentUserId: number = 999;\r\n var securityId: number = 999;\r\n var securityUserId: number = userId;\r\n var sessionInformationUserId: number = userId;\r\n // change this\r\n var accessId: number = 4;\r\n var accessUserId: number = userId;\r\n var stringToCheck: string = \"\";\r\n var startsWithThe = type.startsWith(\"the_\");\r\n var typeConcept = CreateDefaultConcept();\r\n var concept: Concept;\r\n if(startsWithThe){\r\n stringToCheck = type;\r\n }\r\n else{\r\n stringToCheck = \"the_\" + type;\r\n }\r\n var typeConceptString = await MakeTheTypeConceptApi(stringToCheck, userId);\r\n typeConcept = typeConceptString as Concept;\r\n var conceptString = await MakeTheConcept(referent,userId, categoryId, userId, typeConcept.id, typeConcept.userId,\r\n referentId, referentUserId, securityId, securityUserId, accessId, accessUserId, sessionInformationId, sessionInformationUserId );\r\n\r\n concept = conceptString as Concept;\r\n return concept;\r\n}","/**\r\n * @module MakeTheTypeConcept\r\n * @description Creates type concepts in the Concept Connection System (CCS).\r\n * This module handles the creation of type concepts which define the structure and\r\n * categorization of instance concepts. It supports both simple types and composite\r\n * types using recursive parsing and creation strategies.\r\n */\r\n\r\nimport { CreateTextData } from \"../Api/Create/CreateTheTextData\";\r\nimport { GetCharacterByCharacter } from \"../Api/GetCharacterDataByCharacter\";\r\nimport { Concept } from \"../DataStructures/Concept\";\r\nimport { TheTexts } from \"../DataStructures/TheTexts\";\r\nimport { InnerActions } from \"../DataStructures/Transaction/Transaction\";\r\nimport CreateTheConcept, { CreateTheConceptImmediate } from \"./CreateTheConcept\";\r\nimport GetConceptByCharacter from \"./GetConceptByCharacter\";\r\nimport MakeTheCharacter from \"./MakeTheCharacter\";\r\nimport { SplitStrings } from \"./SplitStrings\";\r\n\r\n/**\r\n * Creates or retrieves a type concept in the CCS system.\r\n *\r\n * This function manages the creation of type concepts which define the structure\r\n * and classification for instance concepts. It uses a recursive approach to handle\r\n * composite types by splitting type strings and creating category and type hierarchies.\r\n *\r\n * The function follows this logic:\r\n * 1. First checks if a concept with the given character value exists\r\n * 2. If not found, splits the type string to determine if it's a composite type\r\n * 3. For simple types, creates a character-based concept\r\n * 4. For composite types (e.g., \"category_typename\"), recursively creates both parts\r\n *\r\n * @param typeString - The string identifier for the type (e.g., \"user\", \"post\", \"the_category_type\")\r\n * @param sessionId - The session ID for tracking this operation\r\n * @param sessionUserId - The user ID associated with the session\r\n * @param userId - The ID of the user creating this type concept\r\n * @param actions - Transaction actions for batch operations (default: empty actions)\r\n *\r\n * @returns Promise resolving to the created or retrieved type Concept\r\n *\r\n * @remarks\r\n * - Uses SplitStrings to parse composite type names\r\n * - Recursively creates type hierarchies for composite types\r\n * - The first part of a split becomes the category, the second part becomes the type\r\n * - Simple types (no split) are created as character concepts\r\n * - Includes debug logging for split string arrays\r\n *\r\n * @example\r\n * ```typescript\r\n * // Create a simple type\r\n * const userType = await MakeTheTypeConcept(\r\n * \"the_user\",\r\n * 999,\r\n * 1,\r\n * 1\r\n * );\r\n *\r\n * // Create a composite type\r\n * const compositeType = await MakeTheTypeConcept(\r\n * \"category_typename\",\r\n * 999,\r\n * 1,\r\n * 1\r\n * );\r\n *\r\n * // With transaction actions\r\n * const typeWithActions = await MakeTheTypeConcept(\r\n * \"the_post\",\r\n * 999,\r\n * 1,\r\n * 1,\r\n * { concepts: [], connections: [] }\r\n * );\r\n * ```\r\n *\r\n * @see {@link GetConceptByCharacter} - Checks for existing type concepts\r\n * @see {@link MakeTheCharacter} - Creates character-based concepts for simple types\r\n * @see {@link SplitStrings} - Parses composite type strings\r\n * @see {@link CreateTheConceptImmediate} - Creates the concept entity for composite types\r\n */\r\nexport async function MakeTheTypeConcept(typeString: string, sessionId: number, sessionUserId: number, userId: number,actions: InnerActions = {concepts: [], connections: []}\r\n )\r\n{\r\n var referentId: number = 999;\r\n var securityId: number = 999;\r\n var sessionInformationUserId: number = 999;\r\n var accessId: number = 999;\r\n var securityUserId: number = userId;\r\n var accessUserId: number = userId;\r\n var categoryUserId: number = userId;\r\n var securityUserId: number = userId;\r\n\r\n var existingConcept = await GetConceptByCharacter(typeString);\r\n\r\n\r\n if(existingConcept){\r\n if(existingConcept.id == 0 || existingConcept.userId == 0){\r\n var splittedStringArray = SplitStrings(typeString);\r\n if(splittedStringArray.length > 0){\r\n console.log(splittedStringArray);\r\n if(splittedStringArray[0] == typeString){\r\n var conceptString = await MakeTheCharacter(typeString, userId, securityId, accessId, accessUserId, sessionId);\r\n existingConcept = conceptString as Concept;\r\n \r\n } \r\n else{\r\n var categoryId:number = 1;\r\n var categoryConcept = await MakeTheTypeConcept(splittedStringArray[0], sessionId, sessionUserId, userId, actions);\r\n var typeConcept = await MakeTheTypeConcept(splittedStringArray[1], sessionId, sessionUserId, userId, actions );\r\n if(typeConcept){\r\n \r\n var concept = await CreateTheConceptImmediate(typeString, userId, categoryConcept.id, userId,typeConcept.id, userId, referentId, userId,\r\n securityId, userId,accessId, userId, sessionId, userId, actions );\r\n existingConcept = concept as Concept;\r\n }\r\n \r\n \r\n }\r\n }\r\n\r\n }\r\n\r\n }\r\n return existingConcept;\r\n\r\n\r\n}","/**\r\n * @module publishMessage\r\n * @description Provides MQTT message publishing functionality for real-time communication\r\n */\r\n\r\nimport { BaseUrl } from \"../../DataStructures/BaseUrl\";\r\n\r\n/**\r\n * Publishes a message to an MQTT topic if a connection is established.\r\n * Used for real-time notifications and updates across the system.\r\n *\r\n * @param {string} topic - The MQTT topic to publish to\r\n * @param {any} message - The message payload to publish\r\n *\r\n * @example\r\n * ```typescript\r\n * // Publish a composition update notification\r\n * publishMessage(\"compositionUpdate\", \"123\");\r\n *\r\n * // Publish a complex message\r\n * publishMessage(\"user/notifications\", { type: \"follow\", userId: 456 });\r\n * ```\r\n *\r\n * @remarks\r\n * - Only publishes if BaseUrl.MQTT_CONNECTION is available\r\n * - No-op if MQTT connection is not established\r\n * - No return value (void function)\r\n * - Message format depends on subscriber expectations\r\n * - Used for cache invalidation and real-time updates\r\n */\r\nexport function publishMessage(topic:string, message: any){\r\n if(BaseUrl.MQTT_CONNECTION){\r\n BaseUrl.MQTT_CONNECTION.publish(topic, message);\r\n }\r\n\r\n}","/**\r\n * @module DataIdFormat\r\n * @description Provides formatting functions for DATA-ID format output, which includes both data and ID information for each concept\r\n */\r\n\r\nimport { Connection, GetTheConcept } from \"../../app\";\r\nimport { removeThePrefix } from \"../Common/RegexFunction\";\r\n\r\n/**\r\n * Converts connections to single-level objects in DATA-ID format, preparing data for stitching.\r\n * Creates objects with both ID and data properties for each concept.\r\n *\r\n * @async\r\n * @param {Connection[]} connections - Array of Connection objects to process\r\n * @param {any[]} compositionData - Array/dictionary that stores composition data indexed by concept ID\r\n * @param {number[]} [reverse=[]] - Array of connection IDs for reverse direction processing\r\n * @returns {Promise<any[]>} A promise that resolves to the updated compositionData with ID and data structure\r\n *\r\n * @example\r\n * ```typescript\r\n * const connections: Connection[] = [...];\r\n * const compositionData = [];\r\n * const reverse = [102];\r\n * const result = await FormatFunctionDataForData(connections, compositionData, reverse);\r\n * // result = { 123: { user: { name: { id: 1, data: { type: \"John\" } } } } }\r\n * ```\r\n *\r\n * @remarks\r\n * Format: DATA-ID - First pass formatting with ID information\r\n * This function:\r\n * - Processes connections in order without sorting\r\n * - Creates nested data structure with explicit ID and data fields\r\n * - Handles numeric linkers as arrays\r\n * - Uses linker character or concept type (with prefix removed) as key\r\n * - Skips \"_s_\" type linkers\r\n * - Supports reverse connections with \"_reverse\" suffix\r\n */\r\nexport async function FormatFunctionDataForData(connections:Connection[], compositionData: any[], reverse: number [] = []){\r\n let myConcepts: number[] = [];\r\n for(let i=0 ; i< connections.length; i++){\r\n myConcepts.push(connections[i].toTheConceptId);\r\n myConcepts.push(connections[i].ofTheConceptId)\r\n myConcepts.push(connections[i].typeId);\r\n }\r\n for(let i=0 ; i< connections.length; i++){\r\n let reverseFlag = false;\r\n let ofTheConcept = await GetTheConcept(connections[i].ofTheConceptId);\r\n let toTheConcept = await GetTheConcept(connections[i].toTheConceptId);\r\n if(reverse.includes(connections[i].id)){\r\n reverseFlag = true;\r\n }\r\n if(reverseFlag == true){\r\n \r\n if(ofTheConcept.id != 0 && toTheConcept.id != 0){\r\n let newData: any;\r\n let linkerConcept = await GetTheConcept(connections[i].typeId);\r\n let key = toTheConcept.type?.characterValue ?? \"self\";\r\n if(connections[i].toTheConceptId in compositionData){\r\n \r\n newData = compositionData[connections[i].toTheConceptId]\r\n if(!(key in newData)){\r\n newData[key] = {};\r\n }\r\n }\r\n else{\r\n newData = {};\r\n newData[key] = {};\r\n compositionData[connections[i].toTheConceptId] = newData;\r\n }\r\n try{\r\n let mytype = ofTheConcept?.type?.characterValue ?? \"none\";\r\n let value = ofTheConcept.characterValue;\r\n let dataCharacter = linkerConcept.characterValue;\r\n \r\n // if there is not connection type defined then put the type of the destination concept.\r\n if(dataCharacter == \"\"){\r\n dataCharacter = mytype;\r\n dataCharacter = removeThePrefix(dataCharacter);\r\n }\r\n let data = {\r\n \"id\": ofTheConcept.id,\r\n \"data\": {\r\n [mytype] : value\r\n }\r\n }\r\n let reverseCharater = dataCharacter + \"_reverse\";\r\n \r\n if(reverseCharater.includes(\"_s_\")){\r\n // do nothing\r\n }\r\n else{\r\n if(typeof newData[key] == \"string\"){\r\n newData[key] = {};\r\n }\r\n newData[key][reverseCharater] = data;\r\n }\r\n \r\n \r\n }\r\n catch(ex){\r\n console.log(\"this is error\", ex);\r\n }\r\n }\r\n }\r\n else\r\n {\r\n if(ofTheConcept.id != 0 && toTheConcept.id != 0){\r\n let newData: any;\r\n let linkerConcept = await GetTheConcept(connections[i].typeId);\r\n let key = ofTheConcept.type?.characterValue ?? \"self\";\r\n if(connections[i].ofTheConceptId in compositionData){\r\n newData = compositionData[connections[i].ofTheConceptId]\r\n if(!(key in newData)){\r\n newData[key] = {};\r\n }\r\n }\r\n else{\r\n newData = {};\r\n newData[key] = {};\r\n compositionData[connections[i].ofTheConceptId] = newData;\r\n }\r\n try{\r\n let mytype = toTheConcept?.type?.characterValue ?? \"none\";\r\n let value = toTheConcept.characterValue;\r\n let dataCharacter = linkerConcept.characterValue;\r\n let isComp = false;\r\n // if there is not connection type defined then put the type of the destination concept.\r\n if (dataCharacter == \"\")\r\n {\r\n dataCharacter = mytype;\r\n dataCharacter = removeThePrefix(dataCharacter);\r\n isComp = true;\r\n }\r\n let data = {\r\n \"id\": toTheConcept.id,\r\n \"data\": {\r\n [mytype] : value\r\n }\r\n }\r\n if(isNaN(Number(dataCharacter))){\r\n if(dataCharacter.includes(\"_s_\")){\r\n // do nothing\r\n }\r\n else{\r\n if(typeof newData[key] == \"string\"){\r\n newData[key] = {};\r\n }\r\n newData[key][dataCharacter] = data;\r\n }\r\n\r\n }\r\n else{\r\n if(Array.isArray(newData[key])){\r\n newData[key].push(data);\r\n \r\n }else{\r\n newData[key] = [];\r\n newData[key].push(data);\r\n }\r\n }\r\n\r\n \r\n }\r\n catch(ex){\r\n console.log(\"this is error\", ex);\r\n }\r\n \r\n }\r\n }\r\n \r\n }\r\n return compositionData;\r\n }\r\n\r\n\r\n\r\n/**\r\n * Formats concepts and connections for list views in DATA-ID format, stitching together multiple compositions.\r\n * Each result includes concept ID, nested data object, and creation timestamp.\r\n *\r\n * @async\r\n * @param {Connection[]} connections - Array of type connections (external connections) to process\r\n * @param {any[]} compositionData - Dictionary format with all built compositions indexed by ID\r\n * @param {any} newCompositionData - New composition data to be populated (unused parameter)\r\n * @param {number[]} mainComposition - Array of main composition IDs that build the tree\r\n * @param {number[]} [reverse=[]] - Array of connection IDs for reverse direction (to -> from)\r\n * @param {any[]} CountDictionary - Dictionary containing count information for connections\r\n * @returns {Promise<any[]>} A promise that resolves to an array of formatted main compositions with DATA-ID structure\r\n *\r\n * @example\r\n * ```typescript\r\n * const connections: Connection[] = [...];\r\n * const compositionData = { 123: { user: \"data\" } };\r\n * const mainIds = [123];\r\n * const result = await FormatFromConnectionsAlteredArrayExternal(\r\n * connections,\r\n * compositionData,\r\n * {},\r\n * mainIds,\r\n * [],\r\n * {}\r\n * );\r\n * // result = [{ id: 123, data: {...}, created_on: timestamp }]\r\n * ```\r\n *\r\n * @remarks\r\n * Format: DATA-ID - Used for list views with full ID and data information\r\n * This function:\r\n * - Processes type connections to link compositions\r\n * - Creates objects with id, data, and created_on properties\r\n * - Handles both \"_s_\" (array) and regular (object) linker types\r\n * - Supports reverse connections with \"_reverse\" suffix\r\n * - Includes creation timestamp for each linked concept\r\n * - Returns array of formatted main compositions\r\n */\r\nexport async function FormatFromConnectionsAlteredArrayExternal(connections:Connection[], compositionData: any[], newCompositionData: any, mainComposition: number[], reverse: number [] = [],CountDictionary: any[] ){\r\n let startTime = new Date().getTime();\r\n let mainData: any[] = [] ;\r\n let myConcepts: number[] = [];\r\n for(let i=0 ; i< connections.length; i++){\r\n myConcepts.push(connections[i].toTheConceptId);\r\n myConcepts.push(connections[i].ofTheConceptId)\r\n myConcepts.push(connections[i].typeId);\r\n }\r\n for(let i=0 ; i< connections.length; i++){\r\n let reverseFlag = false;\r\n let ofTheConcept = await GetTheConcept(connections[i].ofTheConceptId);\r\n let toTheConcept = await GetTheConcept(connections[i].toTheConceptId);\r\n if(reverse.includes(connections[i].id)){\r\n reverseFlag = true;\r\n }\r\n if(reverseFlag == true){\r\n \r\n if(ofTheConcept.id != 0 && toTheConcept.id != 0){\r\n if(toTheConcept.id in compositionData){\r\n let newData: any;\r\n let linkerConcept = await GetTheConcept(connections[i].typeId);\r\n let key = toTheConcept.type?.characterValue ?? \"self\";\r\n let flag: boolean = false;\r\n if(connections[i].toTheConceptId in compositionData){\r\n flag = true;\r\n\r\n }\r\n if(connections[i].toTheConceptId in compositionData){\r\n newData = compositionData[connections[i].toTheConceptId]\r\n let newType = typeof newData[key];\r\n if(newType == \"string\"){\r\n newData[key] = {};\r\n }\r\n }\r\n else{\r\n newData = {};\r\n newData[key] = {};\r\n compositionData[connections[i].toTheConceptId] = newData;\r\n }\r\n try{\r\n let isComp = compositionData[connections[i].ofTheConceptId];\r\n if(isComp){\r\n let data = {\r\n \"id\": ofTheConcept.id,\r\n \"data\": compositionData[connections[i].ofTheConceptId],\r\n \"created_on\": connections[i].entryTimeStamp\r\n }\r\n let reverseCharater = linkerConcept.characterValue + \"_reverse\";\r\n if(Array.isArray(newData[key][reverseCharater])){\r\n newData[key][reverseCharater].push(data);\r\n }\r\n else{\r\n\r\n if(reverseCharater.includes(\"_s_\")){\r\n\r\n newData[key][reverseCharater] = [];\r\n newData[key][reverseCharater].push(data);\r\n }\r\n else{\r\n newData[key][reverseCharater] = data;\r\n }\r\n \r\n \r\n }\r\n }\r\n\r\n \r\n \r\n }\r\n catch(ex){\r\n console.log(\"this is error\", ex);\r\n }\r\n }\r\n }\r\n }\r\n else\r\n {\r\n if(ofTheConcept.id != 0 && toTheConcept.id != 0){\r\n if(ofTheConcept.id in compositionData){\r\n let newData: any;\r\n let linkerConcept = await GetTheConcept(connections[i].typeId);\r\n let key = ofTheConcept.type?.characterValue ?? \"self\";\r\n let flag: boolean = false;\r\n if(connections[i].toTheConceptId in compositionData){\r\n flag = true;\r\n \r\n }\r\n if(connections[i].ofTheConceptId in compositionData){\r\n newData = compositionData[connections[i].ofTheConceptId]\r\n let newType = typeof newData[key];\r\n if(newType == \"string\"){\r\n newData[key] = {};\r\n }\r\n }\r\n else{\r\n newData = {};\r\n newData[key] = {};\r\n compositionData[connections[i].ofTheConceptId] = newData;\r\n }\r\n let isComp = true;\r\n let linkerConceptValue = linkerConcept.characterValue;\r\n if(linkerConceptValue == \"\"){\r\n linkerConceptValue = toTheConcept.characterValue;\r\n isComp = true;\r\n }\r\n if(linkerConceptValue == \"\"){\r\n linkerConceptValue = toTheConcept?.type?.characterValue ?? \"\";\r\n }\r\n try{\r\n let mytype = toTheConcept?.type?.characterValue ?? \"none\";\r\n let myData = compositionData[connections[i].toTheConceptId];\r\n if(myData){\r\n let data = {\r\n \"id\": toTheConcept.id,\r\n \"data\": compositionData[connections[i].toTheConceptId],\r\n \"created_on\": connections[i].entryTimeStamp\r\n }\r\n if(Array.isArray(newData[key])){\r\n if(isComp){\r\n newData[key].push(myData);\r\n }\r\n else{\r\n newData[key].push(myData);\r\n }\r\n }\r\n else{\r\n if(Array.isArray(newData[key][linkerConceptValue])){\r\n newData[key][linkerConcept.characterValue].push(data);\r\n }\r\n else{\r\n\r\n if(linkerConceptValue.includes(\"_s_\")){\r\n newData[key][linkerConceptValue] = [];\r\n newData[key][linkerConceptValue].push(data);\r\n }\r\n else{\r\n newData[key][linkerConceptValue] = data;\r\n }\r\n \r\n }\r\n }\r\n \r\n\r\n }\r\n \r\n \r\n }\r\n catch(ex){\r\n console.log(\"this is error\", ex);\r\n }\r\n }\r\n \r\n \r\n }\r\n }\r\n \r\n }\r\n for(let i=0 ; i< mainComposition.length; i++){\r\n let mymainData: any = {};\r\n mymainData[\"id\"] = mainComposition[i];\r\n mymainData[\"data\"] = compositionData[mainComposition[i]];\r\n mainData.push(mymainData);\r\n \r\n }\r\n return mainData;\r\n }\r\n\r\n\r\n/**\r\n * Converts connections to initial single-level concept objects in DATA-ID format.\r\n * This is the first pass that creates the basic concept structure before data nesting.\r\n *\r\n * @async\r\n * @param {Connection[]} connections - Array of Connection objects to process\r\n * @param {any[]} compositionData - Array/dictionary that stores composition data indexed by concept ID\r\n * @param {number[]} [reverse=[]] - Array of connection IDs for reverse direction processing\r\n * @returns {Promise<any[]>} A promise that resolves to the updated compositionData with initial structure\r\n *\r\n * @example\r\n * ```typescript\r\n * const connections: Connection[] = [...];\r\n * const compositionData = [];\r\n * const reverse = [];\r\n * const result = await FormatFunctionData(connections, compositionData, reverse);\r\n * // result = { 123: { user: {} }, 456: { post: {} } }\r\n * ```\r\n *\r\n * @remarks\r\n * Format: DATA-ID - Initial pass for concept creation\r\n * This function:\r\n * - Creates empty concept structures indexed by ID\r\n * - Sets up the foundation for subsequent data population\r\n * - Handles \"_s_\" type linkers by storing basic concept info\r\n * - Does not add nested data (handled by FormatFunctionDataForData)\r\n * - Supports reverse connections\r\n */\r\nexport async function FormatFunctionData(connections:Connection[], compositionData: any[], reverse: number [] = []){\r\n let myConcepts: number[] = [];\r\n for(let i=0 ; i< connections.length; i++){\r\n myConcepts.push(connections[i].toTheConceptId);\r\n myConcepts.push(connections[i].ofTheConceptId)\r\n myConcepts.push(connections[i].typeId);\r\n }\r\n\r\n for(let i=0 ; i< connections.length; i++){\r\n let reverseFlag = false;\r\n let ofTheConcept = await GetTheConcept(connections[i].ofTheConceptId);\r\n let toTheConcept = await GetTheConcept(connections[i].toTheConceptId);\r\n if(reverse.includes(connections[i].id)){\r\n reverseFlag = true;\r\n }\r\n if(reverseFlag == true){\r\n \r\n if(ofTheConcept.id != 0 && toTheConcept.id != 0){\r\n let newData: any;\r\n let linkerConcept = await GetTheConcept(connections[i].typeId);\r\n let key = toTheConcept.type?.characterValue ?? \"self\";\r\n if(connections[i].toTheConceptId in compositionData){\r\n newData = compositionData[connections[i].toTheConceptId]\r\n }\r\n else{\r\n newData = {};\r\n newData[key] = {};\r\n compositionData[connections[i].toTheConceptId] = newData;\r\n }\r\n try{\r\n let mytype = ofTheConcept?.type?.characterValue ?? \"none\";\r\n let value = ofTheConcept.characterValue;\r\n let reverseCharater = linkerConcept.characterValue + \"_reverse\";\r\n\r\n if(reverseCharater.includes(\"_s_\")){\r\n if(!(ofTheConcept.id in compositionData)){\r\n compositionData[ofTheConcept.id] = {};\r\n }\r\n compositionData[ofTheConcept.id][mytype] = value;\r\n\r\n }\r\n compositionData[toTheConcept.id] = {};\r\n\r\n\r\n \r\n \r\n }\r\n catch(ex){\r\n console.log(\"this is error\", ex);\r\n }\r\n }\r\n }\r\n else\r\n {\r\n if(ofTheConcept.id != 0 && toTheConcept.id != 0){\r\n let newData: any;\r\n let linkerConcept = await GetTheConcept(connections[i].typeId);\r\n let key = ofTheConcept.type?.characterValue ?? \"self\";\r\n if(connections[i].ofTheConceptId in compositionData){\r\n newData = compositionData[connections[i].ofTheConceptId]\r\n }\r\n else{\r\n newData = {};\r\n newData[key] = {};\r\n compositionData[connections[i].ofTheConceptId] = newData;\r\n }\r\n try{\r\n let mytype = toTheConcept?.type?.characterValue ?? \"none\";\r\n let value = toTheConcept.characterValue;\r\n if(linkerConcept.characterValue.includes(\"_s_\")){\r\n if(!(toTheConcept.id in compositionData)){\r\n compositionData[toTheConcept.id] = {};\r\n }\r\n compositionData[toTheConcept.id][mytype] = value;\r\n }\r\n compositionData[ofTheConcept.id] = {};\r\n\r\n }\r\n catch(ex){\r\n console.log(\"this is error\", ex);\r\n }\r\n \r\n }\r\n }\r\n \r\n }\r\n return compositionData;\r\n }\r\n","/**\r\n * @module FormatData\r\n * @description Provides functions to format connection data into structured composition objects for Normal format output\r\n */\r\n\r\nimport { Connection, GetTheConcept } from \"../../app\";\r\nimport { removeThePrefix } from \"../Common/RegexFunction\";\r\n\r\n/**\r\n * Converts connections to single-level objects by processing concepts and their relationships.\r\n * This is the initial builder function that creates the foundation for composition arrays/objects.\r\n *\r\n * @async\r\n * @param {Connection[]} connections - Array of Connection objects to process\r\n * @param {any} compositionData - Dictionary object that stores composition data indexed by concept ID\r\n * @param {number[]} reverse - Array of connection IDs that should be processed in reverse direction\r\n * @returns {Promise<any>} A promise that resolves to the updated compositionData dictionary\r\n *\r\n * @example\r\n * ```typescript\r\n * const connections: Connection[] = [...];\r\n * const compositionData = {};\r\n * const reverse = [102];\r\n * const result = await formatFunction(connections, compositionData, reverse);\r\n * // result = { 123: { type: \"value\" }, 456: { type: \"data\" } }\r\n * ```\r\n *\r\n * @remarks\r\n * Format: Normal - First pass formatting\r\n * This function:\r\n * - Processes each connection to extract concepts\r\n * - Handles both forward (of->to) and reverse (to->of) directions\r\n * - Creates initial concept structures without nested data\r\n * - Special handling for \"_s_\" linker types (skipped in output)\r\n */\r\nexport async function formatFunction(connections: Connection[], compositionData: any, reverse: number[]){\r\n let myConcepts: number[] = [];\r\n for(let i=0 ; i< connections.length; i++){\r\n myConcepts.push(connections[i].toTheConceptId);\r\n myConcepts.push(connections[i].ofTheConceptId)\r\n myConcepts.push(connections[i].typeId);\r\n }\r\n\r\n \r\n for(let i=0 ; i< connections.length; i++){\r\n let reverseFlag = false;\r\n if(reverse.includes(connections[i].id)){\r\n reverseFlag = true;\r\n }\r\n \r\n let ofTheConcept = await GetTheConcept(connections[i].ofTheConceptId);\r\n let toTheConcept = await GetTheConcept(connections[i].toTheConceptId);\r\n if(reverseFlag == true){\r\n \r\n if(ofTheConcept.id != 0 && toTheConcept.id != 0){\r\n let newData: any;\r\n let key = toTheConcept.type?.characterValue ?? \"self\";\r\n \r\n if(connections[i].toTheConceptId in compositionData){\r\n newData = compositionData[connections[i].toTheConceptId]\r\n }\r\n else{\r\n newData = {};\r\n newData[key] = {};\r\n compositionData[connections[i].toTheConceptId] = newData;\r\n \r\n }\r\n let linkerConcept = await GetTheConcept(connections[i].typeId);\r\n try{\r\n let mytype = ofTheConcept?.type?.characterValue ?? \"none\";\r\n let value = ofTheConcept.characterValue;\r\n let data = {\r\n [mytype] : value\r\n }\r\n let reverseCharater = linkerConcept.characterValue + \"_reverse\";\r\n\r\n if(linkerConcept.characterValue.includes(\"_s_\")){\r\n if(!(ofTheConcept.id in compositionData)){\r\n compositionData[ofTheConcept.id] = {};\r\n }\r\n compositionData[ofTheConcept.id][mytype] = value;\r\n }\r\n compositionData[toTheConcept.id] = {};\r\n }\r\n catch(ex){\r\n console.log(\"this is error\", ex);\r\n }\r\n }\r\n }\r\n else\r\n {\r\n if(ofTheConcept.id != 0 && toTheConcept.id != 0){\r\n let newData: any;\r\n \r\n let key = ofTheConcept.type?.characterValue ?? \"self\";\r\n \r\n if(connections[i].ofTheConceptId in compositionData){\r\n newData = compositionData[connections[i].ofTheConceptId]\r\n }\r\n else{\r\n newData = {};\r\n newData[key] = {};\r\n compositionData[connections[i].ofTheConceptId] = newData;\r\n }\r\n \r\n let linkerConcept = await GetTheConcept(connections[i].typeId);\r\n try{\r\n let mytype = toTheConcept?.type?.characterValue ?? \"none\";\r\n let value = toTheConcept.characterValue;\r\n\r\n if(linkerConcept.characterValue.includes(\"_s_\")){\r\n if(!(toTheConcept.id in compositionData)){\r\n compositionData[toTheConcept.id] = {};\r\n }\r\n compositionData[toTheConcept.id][mytype] = value;\r\n }\r\n compositionData[ofTheConcept.id] = {};\r\n \r\n \r\n }\r\n catch(ex){\r\n console.log(\"this is error\", ex);\r\n }\r\n \r\n }\r\n }\r\n \r\n }\r\n return compositionData;\r\n\r\n }\r\n\r\n\r\n/**\r\n * Converts connections to single-level objects with nested data relationships.\r\n * This is the second pass that adds detailed data properties to the composition structure.\r\n *\r\n * @async\r\n * @param {Connection[]} connections - Array of Connection objects to process\r\n * @param {any} compositionData - Dictionary object that stores composition data indexed by concept ID\r\n * @param {number[]} reverse - Array of connection IDs that should be processed in reverse direction\r\n * @returns {Promise<any>} A promise that resolves to the updated compositionData dictionary with nested data\r\n *\r\n * @example\r\n * ```typescript\r\n * const connections: Connection[] = [...];\r\n * const compositionData = { 123: { user: {} } };\r\n * const reverse = [];\r\n * const result = await formatFunctionForData(connections, compositionData, reverse);\r\n * // result = { 123: { user: { name: { type: \"John\" } } } }\r\n * ```\r\n *\r\n * @remarks\r\n * Format: Normal - Second pass formatting with data nesting\r\n * This function:\r\n * - Sorts connections by ID in descending order\r\n * - Adds nested data properties to concepts\r\n * - Handles numeric vs string linker types differently\r\n * - Numeric linkers create arrays, string linkers create objects\r\n * - Uses linker character value as property key or removes prefix if empty\r\n * - Skips \"_s_\" type linkers in the output\r\n */\r\nexport async function formatFunctionForData(connections: Connection[], compositionData: any, reverse: number[]){\r\n\r\n let myConcepts: number[] = [];\r\n for(let i=0 ; i< connections.length; i++){\r\n myConcepts.push(connections[i].toTheConceptId);\r\n myConcepts.push(connections[i].ofTheConceptId)\r\n myConcepts.push(connections[i].typeId);\r\n }\r\n connections.sort(function(x: Connection, y:Connection){\r\n return y.id - x.id;\r\n })\r\n \r\n for(let i=0 ; i< connections.length; i++){\r\n let reverseFlag = false;\r\n if(reverse.includes(connections[i].id)){\r\n reverseFlag = true;\r\n }\r\n \r\n let ofTheConcept = await GetTheConcept(connections[i].ofTheConceptId);\r\n let toTheConcept = await GetTheConcept(connections[i].toTheConceptId);\r\n if(reverseFlag == true){\r\n \r\n if(ofTheConcept.id != 0 && toTheConcept.id != 0){\r\n let newData: any;\r\n let key = toTheConcept.type?.characterValue ?? \"self\";\r\n \r\n if(connections[i].toTheConceptId in compositionData){\r\n newData = compositionData[connections[i].toTheConceptId]\r\n if(!(key in newData)){\r\n newData[key] = {};\r\n }\r\n }\r\n else{\r\n newData = {};\r\n newData[key] = {};\r\n compositionData[connections[i].toTheConceptId] = newData;\r\n \r\n }\r\n let linkerConcept = await GetTheConcept(connections[i].typeId);\r\n try{\r\n let mytype = ofTheConcept?.type?.characterValue ?? \"none\";\r\n let value = ofTheConcept.characterValue;\r\n let dataCharacter = linkerConcept.characterValue;\r\n if (dataCharacter == \"\")\r\n {\r\n dataCharacter = mytype;\r\n dataCharacter = removeThePrefix(dataCharacter);\r\n }\r\n let data = {\r\n [mytype] : value\r\n }\r\n let reverseCharater = dataCharacter + \"_reverse\";\r\n\r\n if(linkerConcept.characterValue.includes(\"_s_\")){\r\n // do nothing\r\n }\r\n else{\r\n if(typeof newData[key] == \"string\"){\r\n newData[key] = {};\r\n }\r\n newData[key][reverseCharater] = data;\r\n }\r\n }\r\n catch(ex){\r\n console.log(\"this is error\", ex);\r\n }\r\n }\r\n }\r\n else\r\n {\r\n if(ofTheConcept.id != 0 && toTheConcept.id != 0){\r\n let newData: any;\r\n \r\n let key = ofTheConcept.type?.characterValue ?? \"self\";\r\n \r\n if(connections[i].ofTheConceptId in compositionData){\r\n newData = compositionData[connections[i].ofTheConceptId]\r\n if(!(key in newData)){\r\n newData[key] = {};\r\n }\r\n }\r\n else{\r\n newData = {};\r\n newData[key] = {};\r\n compositionData[connections[i].ofTheConceptId] = newData;\r\n }\r\n let linkerConcept = await GetTheConcept(connections[i].typeId);\r\n try{\r\n let mytype = toTheConcept?.type?.characterValue ?? \"none\";\r\n let value = toTheConcept.characterValue;\r\n let dataCharacter = linkerConcept.characterValue;\r\n let originalDataCharacter = linkerConcept.characterValue;\r\n let isComp = false;\r\n if (dataCharacter == \"\")\r\n {\r\n dataCharacter = mytype;\r\n dataCharacter = removeThePrefix(dataCharacter);\r\n isComp = true;\r\n }\r\n let data = {\r\n [mytype] : value\r\n }\r\n\r\n if(isNaN(Number(dataCharacter))){\r\n if(linkerConcept.characterValue.includes(\"_s_\")){\r\n // do nothing\r\n }\r\n else{\r\n if(typeof newData[key] == \"string\"){\r\n newData[key] = {};\r\n }\r\n if(isComp){\r\n newData[key][dataCharacter] = value;\r\n\r\n }\r\n else{\r\n newData[key][dataCharacter] = data;\r\n\r\n }\r\n }\r\n }\r\n else{\r\n if(Array.isArray(newData[key])){\r\n newData[key].push(value);\r\n\r\n }else{\r\n newData[key] = [];\r\n newData[key].push(value);\r\n }\r\n }\r\n\r\n \r\n \r\n }\r\n catch(ex){\r\n console.log(\"this is error\", ex);\r\n }\r\n \r\n }\r\n }\r\n \r\n }\r\n return compositionData;\r\n\r\n }\r\n\r\n\r\n/**\r\n * Formats concepts and connections for list views in Normal format, stitching together multiple compositions.\r\n * This function handles type connections and builds a tree structure from multiple main compositions.\r\n *\r\n * @async\r\n * @param {Connection[]} [connections=[]] - Array of type connections (external connections) to process\r\n * @param {any[]} [compositionData=[]] - Dictionary format with all built compositions indexed by ID\r\n * @param {number[]} [mainComposition=[]] - Array of main composition IDs that build the tree\r\n * @param {any} newCompositionData - New composition data to be populated (unused parameter)\r\n * @param {number[]} [reverse=[]] - Array of connection IDs for reverse direction (to -> from)\r\n * @returns {Promise<any[]>} A promise that resolves to an array of formatted main composition objects\r\n *\r\n * @example\r\n * ```typescript\r\n * const connections: Connection[] = [...];\r\n * const compositionData = { 123: { user: \"data\" }, 456: { post: \"info\" } };\r\n * const mainIds = [123, 456];\r\n * const result = await FormatConceptsAndConnectionsNormalList(\r\n * connections,\r\n * compositionData,\r\n * mainIds,\r\n * {},\r\n * []\r\n * );\r\n * // result = [{ id: 123, user: \"data\" }, { id: 456, post: \"info\" }]\r\n * ```\r\n *\r\n * @remarks\r\n * Format: Normal - Used for listing multiple compositions\r\n * This function:\r\n * - Processes type connections to link compositions together\r\n * - Sorts connections by ID in descending order\r\n * - Handles both \"_s_\" (array) and regular (object) linker types\r\n * - Supports reverse connections with \"_reverse\" suffix\r\n * - Returns an array of main compositions with their linked data\r\n * - Useful for list views where multiple compositions need to be queried efficiently\r\n */\r\nexport async function FormatConceptsAndConnectionsNormalList(connections: Connection[] = [],compositionData: any[] = [], mainComposition: number[] = [], newCompositionData: any, reverse: number [] = []){\r\n let mainData: any[] = [] ;\r\n let myConcepts: number[] = [];\r\n for(let i=0 ; i< connections.length; i++){\r\n myConcepts.push(connections[i].toTheConceptId);\r\n myConcepts.push(connections[i].ofTheConceptId)\r\n myConcepts.push(connections[i].typeId);\r\n }\r\n connections.sort(function(x: Connection, y:Connection){\r\n return y.id - x.id;\r\n })\r\n \r\n for(let i=0 ; i< connections.length; i++){\r\n let reverseFlag = false;\r\n if(reverse.includes(connections[i].id)){\r\n reverseFlag = true;\r\n }\r\n \r\n let ofTheConcept = await GetTheConcept(connections[i].ofTheConceptId);\r\n let toTheConcept = await GetTheConcept(connections[i].toTheConceptId);\r\n if(reverseFlag == true){\r\n \r\n if(ofTheConcept.id != 0 && toTheConcept.id != 0){\r\n if(toTheConcept.id in compositionData){\r\n let newData: any;\r\n let key = toTheConcept.type?.characterValue ?? \"self\";\r\n if(connections[i].toTheConceptId in compositionData){\r\n newData = compositionData[connections[i].toTheConceptId]\r\n }\r\n else{\r\n newData = {};\r\n newData[key] = {};\r\n compositionData[connections[i].toTheConceptId] = newData;\r\n }\r\n let linkerConcept = await GetTheConcept(connections[i].typeId);\r\n try{\r\n let reverseCharater = linkerConcept.characterValue + \"_reverse\";\r\n let data = compositionData[connections[i].ofTheConceptId];\r\n if(data){\r\n if(Array.isArray(newData[key][reverseCharater])){\r\n newData[key][reverseCharater].push(data);\r\n\r\n }\r\n else{\r\n if(linkerConcept.characterValue.includes(\"_s_\")){\r\n newData[key][reverseCharater] = [];\r\n newData[key][reverseCharater].push(data);\r\n\r\n }\r\n else{\r\n newData[key][reverseCharater] = data;\r\n }\r\n }\r\n }\r\n\r\n }\r\n catch(ex){\r\n console.log(\"this is error\", ex);\r\n }\r\n }\r\n\r\n }\r\n }\r\n else\r\n {\r\n if(ofTheConcept.id != 0 && toTheConcept.id != 0){\r\n if(ofTheConcept.id in compositionData){\r\n let newData: any;\r\n \r\n let key = ofTheConcept.type?.characterValue ?? \"self\";\r\n if(connections[i].ofTheConceptId in compositionData){\r\n newData = compositionData[connections[i].ofTheConceptId];\r\n let newType = typeof newData[key];\r\n if(newType == \"string\"){\r\n newData[key] = {};\r\n }\r\n }\r\n else{\r\n newData = {};\r\n newData[key] = {};\r\n compositionData[connections[i].ofTheConceptId] = newData;\r\n }\r\n let linkerConcept = await GetTheConcept(connections[i].typeId);\r\n let isComp = false;\r\n let linkerConceptValue = linkerConcept.characterValue;\r\n if(linkerConceptValue == \"\"){\r\n linkerConceptValue = toTheConcept.characterValue;\r\n isComp = true;\r\n }\r\n if(linkerConceptValue == \"\"){\r\n linkerConceptValue = toTheConcept?.type?.characterValue ?? \"\";\r\n }\r\n\r\n try{\r\n let data = compositionData[connections[i].toTheConceptId]\r\n if(data){\r\n if(Array.isArray(newData[key])){\r\n if(isComp){\r\n newData[key].push(data[linkerConceptValue]);\r\n \r\n }\r\n else{\r\n newData[key].push(data);\r\n \r\n }\r\n \r\n }\r\n else{\r\n if(Array.isArray(newData[key][linkerConceptValue])){\r\n newData[key][linkerConceptValue].push(data);\r\n }\r\n else{\r\n \r\n if(linkerConceptValue.includes(\"_s_\")){\r\n newData[key][linkerConceptValue] = [];\r\n if(isComp){\r\n newData[key][linkerConceptValue].push(data[linkerConceptValue]);\r\n }\r\n else{\r\n newData[key][linkerConceptValue].push(data);\r\n \r\n }\r\n }\r\n else{\r\n if(isComp){\r\n newData[key][linkerConceptValue] = data[linkerConceptValue];\r\n \r\n }\r\n else{\r\n newData[key][linkerConceptValue] = data;\r\n \r\n }\r\n \r\n }\r\n \r\n }\r\n }\r\n }\r\n\r\n\r\n\r\n \r\n }\r\n catch(ex){\r\n console.log(\"this is error\", ex);\r\n }\r\n }\r\n\r\n \r\n }\r\n }\r\n \r\n }\r\n for(let i=0 ; i< mainComposition.length; i++){\r\n let mymainData = compositionData[mainComposition[i]];\r\n if(mymainData){\r\n mymainData[\"id\"] = mainComposition[i];\r\n mainData.push(mymainData);\r\n }\r\n\r\n \r\n }\r\n\r\n return mainData;\r\n \r\n }\r\n","/**\r\n * @module JustIdFormat\r\n * @description Provides formatting functions for JustId format output, which includes simplified ID-based data structures\r\n */\r\n\r\nimport { Connection } from \"../../app\";\r\nimport { CountInfo } from \"../../DataStructures/Count/CountInfo\";\r\nimport { removeThePrefix } from \"../Common/RegexFunction\";\r\nimport GetTheConcept from \"../GetTheConcept\";\r\n\r\n/**\r\n * Converts connections to single-level objects in JustId format, preparing simplified data for stitching.\r\n * Creates lightweight objects with ID and essential data properties.\r\n *\r\n * @async\r\n * @param {Connection[]} connections - Array of Connection objects to process\r\n * @param {any[]} compositionData - Array/dictionary that stores composition data indexed by concept ID\r\n * @param {number[]} [reverse=[]] - Array of connection IDs for reverse direction processing\r\n * @returns {Promise<any[]>} A promise that resolves to the updated compositionData with JustId structure\r\n *\r\n * @example\r\n * ```typescript\r\n * const connections: Connection[] = [...];\r\n * const compositionData = [];\r\n * const reverse = [];\r\n * const result = await FormatFunctionDataForDataJustId(connections, compositionData, reverse);\r\n * // result = { 123: { user: { name: { id: 1, data: \"John\", created_on: timestamp } } } }\r\n * ```\r\n *\r\n * @remarks\r\n * Format: JustId - Lightweight formatting with minimal data\r\n * This function:\r\n * - Creates simplified data structure with ID, data value, and timestamp\r\n * - Handles numeric linkers as arrays\r\n * - Uses linker character or concept type (with prefix removed) as key\r\n * - Skips \"_s_\" type linkers\r\n * - Supports reverse connections with \"_reverse\" suffix\r\n * - Optimized for list views and reduced data transfer\r\n */\r\nexport async function FormatFunctionDataForDataJustId(connections:Connection[], compositionData: any[], reverse: number [] = []){\r\n let myConcepts: number[] = [];\r\n for(let i=0 ; i< connections.length; i++){\r\n myConcepts.push(connections[i].toTheConceptId);\r\n myConcepts.push(connections[i].ofTheConceptId)\r\n myConcepts.push(connections[i].typeId);\r\n }\r\n for(let i=0 ; i< connections.length; i++){\r\n let reverseFlag = false;\r\n let ofTheConcept = await GetTheConcept(connections[i].ofTheConceptId);\r\n let toTheConcept = await GetTheConcept(connections[i].toTheConceptId);\r\n if(reverse.includes(connections[i].id)){\r\n reverseFlag = true;\r\n }\r\n if(reverseFlag == true){\r\n \r\n if(ofTheConcept.id != 0 && toTheConcept.id != 0){\r\n let newData: any;\r\n let linkerConcept = await GetTheConcept(connections[i].typeId);\r\n let key = toTheConcept.type?.characterValue ?? \"self\";\r\n if(connections[i].toTheConceptId in compositionData){\r\n \r\n newData = compositionData[connections[i].toTheConceptId]\r\n if(!(key in newData)){\r\n newData[key] = {};\r\n }\r\n }\r\n else{\r\n newData = {};\r\n newData[key] = {};\r\n compositionData[connections[i].toTheConceptId] = newData;\r\n }\r\n try{\r\n let mytype = ofTheConcept?.type?.characterValue ?? \"none\";\r\n let value = ofTheConcept.characterValue;\r\n let dataCharacter = linkerConcept.characterValue;\r\n \r\n // if there is not connection type defined then put the type of the destination concept.\r\n if(dataCharacter == \"\"){\r\n dataCharacter = mytype;\r\n dataCharacter = removeThePrefix(dataCharacter);\r\n }\r\n let data = {\r\n \"id\": ofTheConcept.id,\r\n [mytype] : value\r\n }\r\n let reverseCharater = dataCharacter + \"_reverse\";\r\n \r\n if(reverseCharater.includes(\"_s_\")){\r\n // do nothing\r\n }\r\n else{\r\n if(typeof newData[key] == \"string\"){\r\n newData[key] = {};\r\n }\r\n newData[key][reverseCharater] = data;\r\n }\r\n \r\n \r\n }\r\n catch(ex){\r\n console.log(\"this is error\", ex);\r\n }\r\n }\r\n }\r\n else\r\n {\r\n if(ofTheConcept.id != 0 && toTheConcept.id != 0){\r\n let newData: any;\r\n let linkerConcept = await GetTheConcept(connections[i].typeId);\r\n let key = ofTheConcept.type?.characterValue ?? \"self\";\r\n if(connections[i].ofTheConceptId in compositionData){\r\n newData = compositionData[connections[i].ofTheConceptId]\r\n if(!(key in newData)){\r\n newData[key] = {};\r\n }\r\n }\r\n else{\r\n newData = {};\r\n newData[key] = {};\r\n compositionData[connections[i].ofTheConceptId] = newData;\r\n \r\n }\r\n \r\n\r\n try{\r\n let mytype = toTheConcept?.type?.characterValue ?? \"none\";\r\n let value = toTheConcept.characterValue;\r\n let dataCharacter = linkerConcept.characterValue;\r\n let isComp = false;\r\n // if there is not connection type defined then put the type of the destination concept.\r\n if (dataCharacter == \"\")\r\n {\r\n dataCharacter = mytype;\r\n dataCharacter = removeThePrefix(dataCharacter);\r\n isComp = true;\r\n }\r\n // let data = {\r\n // \"id\": toTheConcept.id,\r\n // [mytype] : value\r\n // }\r\n let data:any = {};\r\n data[mytype] = {\r\n \"id\": toTheConcept.id,\r\n \"data\": value,\r\n \"created_on\": connections[i].entryTimeStamp\r\n\r\n }\r\n if(isNaN(Number(dataCharacter))){\r\n if(dataCharacter.includes(\"_s_\")){\r\n // do nothing\r\n }\r\n else{\r\n if(typeof newData[key] == \"string\"){\r\n newData[key] = {};\r\n }\r\n if(isComp){\r\n newData[key][dataCharacter] = data[mytype];\r\n\r\n }\r\n else{\r\n newData[key][dataCharacter] = data;\r\n\r\n }\r\n \r\n }\r\n }\r\n else{\r\n if(Array.isArray(newData[key])){\r\n newData[key].push(data[mytype]);\r\n \r\n }else{\r\n newData[key] = [];\r\n newData[key].push(data[mytype]);\r\n }\r\n }\r\n \r\n\r\n \r\n }\r\n catch(ex){\r\n console.log(\"this is error\", ex);\r\n }\r\n \r\n }\r\n }\r\n \r\n }\r\n return compositionData;\r\n }\r\n\r\n\r\n/**\r\n * Formats concepts and connections for list views in JustId format, stitching together multiple compositions.\r\n * Creates lightweight list view with ID, data, and timestamp for each concept.\r\n *\r\n * @async\r\n * @param {Connection[]} connections - Array of type connections (external connections) to process\r\n * @param {any[]} compositionData - Dictionary format with all built compositions indexed by ID\r\n * @param {number[]} mainComposition - Array of main composition IDs that build the tree\r\n * @param {number[]} [reverse=[]] - Array of connection IDs for reverse direction (to -> from)\r\n * @param {any[]} CountDictionary - Dictionary containing count information for connections by concept ID\r\n * @returns {Promise<any[]>} A promise that resolves to an array of formatted main compositions with JustId structure\r\n *\r\n * @example\r\n * ```typescript\r\n * const connections: Connection[] = [...];\r\n * const compositionData = { 123: { user: \"data\" } };\r\n * const mainIds = [123];\r\n * const countDict = { 123: { count: 5, connectionType: \"follows\" } };\r\n * const result = await FormatFromConnectionsAlteredArrayExternalJustId(\r\n * connections,\r\n * compositionData,\r\n * mainIds,\r\n * [],\r\n * countDict\r\n * );\r\n * // result = [{ id: 123, user: { id: 1, data: \"value\", created_on: timestamp }, follows_count: 5 }]\r\n * ```\r\n *\r\n * @remarks\r\n * Format: JustId - Used for list views with lightweight ID-based structure\r\n * This function:\r\n * - Processes type connections to link compositions\r\n * - Creates objects with id, data, and created_on properties\r\n * - Handles both \"_s_\" (array) and regular (object) linker types\r\n * - Supports reverse connections with \"_reverse\" suffix\r\n * - Adds count information from CountDictionary (e.g., \"follows_count\")\r\n * - Optimized for performance with minimal data payload\r\n * - Useful for paginated lists and mobile applications\r\n */\r\nexport async function FormatFromConnectionsAlteredArrayExternalJustId(connections:Connection[], compositionData: any[], mainComposition: number[], reverse: number [] = [], CountDictionary: any[]){\r\n let startTime = new Date().getTime();\r\n let mainData: any[] = [] ;\r\n let myConcepts: number[] = [];\r\n for(let i=0 ; i< connections.length; i++){\r\n myConcepts.push(connections[i].toTheConceptId);\r\n myConcepts.push(connections[i].ofTheConceptId)\r\n myConcepts.push(connections[i].typeId);\r\n }\r\n for(let i=0 ; i< connections.length; i++){\r\n let reverseFlag = false;\r\n let ofTheConcept = await GetTheConcept(connections[i].ofTheConceptId);\r\n let toTheConcept = await GetTheConcept(connections[i].toTheConceptId);\r\n if(reverse.includes(connections[i].id)){\r\n reverseFlag = true;\r\n }\r\n if(reverseFlag == true){\r\n \r\n if(ofTheConcept.id != 0 && toTheConcept.id != 0){\r\n if(toTheConcept.id in compositionData){\r\n let newData: any;\r\n let linkerConcept = await GetTheConcept(connections[i].typeId);\r\n let key = toTheConcept.type?.characterValue ?? \"self\";\r\n let flag: boolean = false;\r\n if(connections[i].toTheConceptId in compositionData){\r\n flag = true;\r\n \r\n }\r\n if(connections[i].toTheConceptId in compositionData){\r\n newData = compositionData[connections[i].toTheConceptId]\r\n let newType = typeof newData[key];\r\n if(newType == \"string\"){\r\n newData[key] = {};\r\n }\r\n }\r\n else{\r\n newData = {};\r\n newData[key] = {};\r\n compositionData[connections[i].toTheConceptId] = newData;\r\n }\r\n try{\r\n let isComp = compositionData[connections[i].ofTheConceptId];\r\n if(isComp){\r\n let data = compositionData[connections[i].ofTheConceptId]\r\n if(data){\r\n data[\"id\"] = ofTheConcept.id;\r\n data[\"created_on\"] = ofTheConcept.entryTimeStamp;\r\n }\r\n \r\n let reverseCharater = linkerConcept.characterValue + \"_reverse\";\r\n if(Array.isArray(newData[key][reverseCharater])){\r\n newData[key][reverseCharater].push(data);\r\n }\r\n else{\r\n \r\n if(reverseCharater.includes(\"_s_\")){\r\n \r\n newData[key][reverseCharater] = [];\r\n newData[key][reverseCharater].push(data);\r\n }\r\n else{\r\n newData[key][reverseCharater] = data;\r\n }\r\n \r\n \r\n }\r\n }\r\n \r\n \r\n \r\n }\r\n catch(ex){\r\n console.log(\"this is error\", ex);\r\n }\r\n }\r\n }\r\n }\r\n else\r\n {\r\n if(ofTheConcept.id != 0 && toTheConcept.id != 0){\r\n if(ofTheConcept.id in compositionData){\r\n let newData: any;\r\n let linkerConcept = await GetTheConcept(connections[i].typeId);\r\n let key = ofTheConcept.type?.characterValue ?? \"self\";\r\n let flag: boolean = false;\r\n if(connections[i].toTheConceptId in compositionData){\r\n flag = true;\r\n \r\n }\r\n if(connections[i].ofTheConceptId in compositionData){\r\n newData = compositionData[connections[i].ofTheConceptId]\r\n let newType = typeof newData[key];\r\n if(newType == \"string\"){\r\n newData[key] = {};\r\n }\r\n }\r\n else{\r\n newData = {};\r\n newData[key] = {};\r\n compositionData[connections[i].ofTheConceptId] = newData;\r\n }\r\n\r\n\r\n AddCount(ofTheConcept.id, CountDictionary, newData);\r\n let isComp = false;\r\n let linkerConceptValue = linkerConcept.characterValue;\r\n if(linkerConceptValue == \"\"){\r\n linkerConceptValue = toTheConcept.characterValue;\r\n isComp = true;\r\n }\r\n if(linkerConceptValue == \"\"){\r\n linkerConceptValue = toTheConcept?.type?.characterValue ?? \"\";\r\n }\r\n try{\r\n let mytype = toTheConcept?.type?.characterValue ?? \"none\";\r\n let myData = compositionData[connections[i].toTheConceptId];\r\n if(myData){\r\n let testData:any = {};\r\n testData[mytype] = {\r\n \"data\": myData[mytype],\r\n \"id\": toTheConcept.id,\r\n \"created_on\": connections[i].entryTimeStamp\r\n };\r\n if(Array.isArray(newData[key])){\r\n if(isComp){\r\n newData[key].push(myData[linkerConceptValue]);\r\n\r\n }else{\r\n newData[key].push(myData);\r\n\r\n }\r\n }\r\n else{\r\n \r\n if(Array.isArray(newData[key][linkerConceptValue])){\r\n newData[key][linkerConceptValue].push(testData);\r\n }\r\n else{\r\n \r\n if(linkerConceptValue.includes(\"_s_\")){\r\n newData[key][linkerConceptValue] = [];\r\n if(isComp){\r\n newData[key][linkerConceptValue].push(testData[mytype]);\r\n\r\n }\r\n else{\r\n newData[key][linkerConceptValue].push(testData);\r\n\r\n }\r\n }\r\n else{\r\n if(isComp){\r\n newData[key][linkerConceptValue] = testData[mytype];\r\n\r\n }else{\r\n newData[key][linkerConceptValue] = testData;\r\n \r\n\r\n\r\n }\r\n }\r\n \r\n }\r\n }\r\n\r\n AddCount(toTheConcept.id, CountDictionary, testData);\r\n\r\n }\r\n\r\n\r\n \r\n\r\n \r\n \r\n }\r\n catch(ex){\r\n console.log(\"this is error\", ex);\r\n }\r\n }\r\n \r\n \r\n }\r\n }\r\n \r\n }\r\n console.log(\"this is the main compositions\", mainComposition);\r\n for(let i=0 ; i< mainComposition.length; i++){\r\n let mymainData: any = {};\r\n console.log(\"this is the main compositions DATA\", compositionData[mainComposition[i]]);\r\n \r\n mymainData = compositionData[mainComposition[i]];\r\n if(mymainData){\r\n mymainData[\"id\"] = mainComposition[i];\r\n \r\n }\r\n mainData.push(mymainData);\r\n \r\n }\r\n return mainData;\r\n}\r\n\r\n\r\n/**\r\n * Adds count information to the concept data based on the CountDictionary.\r\n * Appends a \"_count\" suffix to the connection type name.\r\n *\r\n * @param {number} ofTheConceptId - The ID of the concept to add count information for\r\n * @param {any} CountDictionary - Dictionary containing count information indexed by concept ID\r\n * @param {any} newData - The data object to add count information to\r\n *\r\n * @example\r\n * ```typescript\r\n * const conceptId = 123;\r\n * const countDict = { 123: { connectionType: \"follows\", count: 42 } };\r\n * const data = { user: \"data\" };\r\n * AddCount(conceptId, countDict, data);\r\n * // data now includes: { user: \"data\", follows_count: 42 }\r\n * ```\r\n *\r\n * @remarks\r\n * This function mutates the newData object by adding a count property\r\n * The count property name format is: \"{connectionType}_count\"\r\n * If the concept ID is not in CountDictionary, no changes are made\r\n */\r\nexport function AddCount(ofTheConceptId: number, CountDictionary: any, newData:any){\r\n // algorith for count addition\r\n if(ofTheConceptId in CountDictionary){\r\n let countInfo: CountInfo = CountDictionary[ofTheConceptId];\r\n console.log(\"this is the count info\",countInfo);\r\n\r\n if(countInfo){\r\n let connType = countInfo.connectionType + \"_count\";\r\n newData[connType] = countInfo.count;\r\n console.log(\"this is the data updated\", newData);\r\n }\r\n }\r\n}\r\n ","import { Connection, GetTheConcept } from \"../../app\";\r\nimport { removeThePrefix } from \"../Common/RegexFunction\";\r\nimport { AddCount } from \"./JustIdFormat\";\r\n\r\n\r\nexport async function FormatFunctionDataV2(\r\n connections: Connection[],\r\n compositionData: Record<number, any> = {},\r\n reverse: number[] = []\r\n) {\r\n\r\n for (const connection of connections) {\r\n const reverseFlag = reverse.includes(connection.id);\r\n\r\n const ofTheConcept = await GetTheConcept(connection.ofTheConceptId);\r\n const toTheConcept = await GetTheConcept(connection.toTheConceptId);\r\n const linkerConcept = await GetTheConcept(connection.typeId);\r\n\r\n if (ofTheConcept.id === 0 || toTheConcept.id === 0) continue;\r\n\r\n const sourceConcept = reverseFlag ? toTheConcept : ofTheConcept;\r\n const targetConcept = reverseFlag ? ofTheConcept : toTheConcept;\r\n const key = sourceConcept.type?.characterValue ?? \"self\";\r\n const valueType = targetConcept.type?.characterValue ?? \"none\";\r\n const value = targetConcept.characterValue;\r\n const isSpecial = linkerConcept.characterValue?.includes(\"_s_\");\r\n // Initialize source if it doesn't exist\r\n if (!compositionData[sourceConcept.id]) {\r\n compositionData[sourceConcept.id] = {};\r\n }\r\n\r\n // Ensure key exists\r\n if (!compositionData[sourceConcept.id][key]) {\r\n compositionData[sourceConcept.id][key] = {};\r\n }\r\n\r\n // Apply value if special\r\n if (!compositionData[targetConcept.id]) {\r\n compositionData[targetConcept.id] = {};\r\n }\r\n compositionData[targetConcept.id][valueType] = value;\r\n }\r\n\r\n return compositionData;\r\n}\r\n\r\n\r\nexport async function FormatFunctionDataForDataV2(\r\n connections: Connection[],\r\n compositionData: Record<number, any> = {},\r\n reverse: number[] = []\r\n) {\r\n \r\n for (const connection of connections) {\r\n const reverseFlag = reverse.includes(connection.id);\r\n\r\n const fromConcept = await GetTheConcept(connection.ofTheConceptId);\r\n const toConcept = await GetTheConcept(connection.toTheConceptId);\r\n const linkerConcept = await GetTheConcept(connection.typeId);\r\n\r\n if (fromConcept.id === 0 || toConcept.id === 0) continue;\r\n\r\n const source = reverseFlag ? toConcept : fromConcept;\r\n const target = reverseFlag ? fromConcept : toConcept;\r\n\r\n const key = source.type?.characterValue ?? \"self\";\r\n const valueType = target.type?.characterValue ?? \"none\";\r\n const value = target.characterValue;\r\n const typeCharacterRaw = linkerConcept.characterValue ?? \"\";\r\n let dataCharacter = typeCharacterRaw === \"\" ? removeThePrefix(valueType) : typeCharacterRaw;\r\n const isSpecial = dataCharacter.includes(\"_s_\");\r\n const isNumeric = !isNaN(Number(dataCharacter));\r\n // Prepare data object\r\n const data = {\r\n id: target.id,\r\n data: {\r\n [valueType]: value,\r\n },\r\n };\r\n\r\n // Initialize storage\r\n if (!compositionData[source.id]) {\r\n compositionData[source.id] = {};\r\n }\r\n\r\n if (!(key in compositionData[source.id]) || typeof compositionData[source.id][key] === \"string\") {\r\n compositionData[source.id][key] = isNumeric ? [] : {};\r\n }\r\n\r\n try {\r\n if (isSpecial) {\r\n // Do nothing for _s_ types\r\n continue;\r\n }\r\n\r\n if (isNumeric) {\r\n (compositionData[source.id][key] as any[]).push(data);\r\n } else {\r\n compositionData[source.id][key][reverseFlag ? `${dataCharacter}_reverse` : dataCharacter] = data;\r\n }\r\n\r\n } catch (ex) {\r\n console.error(\"Error formatting concept data:\", ex);\r\n }\r\n }\r\n\r\n return compositionData;\r\n}\r\n\r\n\r\n\r\nexport async function FormatFromConnectionsAlteredArrayExternalV2(\r\n connections: Connection[],\r\n compositionData: Record<number, any>,\r\n mainComposition: number[],\r\n reverse: number[] = [],\r\n CountDictionary: Record<number, any>\r\n) {\r\n const mainData: any[] = [];\r\n for (const conn of connections) {\r\n const isReversed = reverse.includes(conn.id);\r\n\r\n const ofConcept = await GetTheConcept(conn.ofTheConceptId);\r\n const toConcept = await GetTheConcept(conn.toTheConceptId);\r\n const linkerConcept = await GetTheConcept(conn.typeId);\r\n\r\n if (ofConcept.id === 0 || toConcept.id === 0) continue;\r\n\r\n const source = isReversed ? toConcept : ofConcept;\r\n const target = isReversed ? ofConcept : toConcept;\r\n const sourceId = source.id;\r\n const targetId = target.id;\r\n\r\n const sourceKey = source.type?.characterValue ?? \"self\";\r\n const reverseKey = linkerConcept.characterValue + \"_reverse\";\r\n const linkerKey = linkerConcept.characterValue || target.characterValue || target.type?.characterValue || \"\";\r\n if(compositionData[sourceId]){\r\n const sourceData = compositionData[sourceId][sourceKey];\r\n const targetData = compositionData[targetId];\r\n const dataPackage = {\r\n id: target.id,\r\n data: targetData,\r\n created_on: conn.entryTimeStamp,\r\n };\r\n\r\n AddCount(sourceId, CountDictionary, compositionData[sourceId]);\r\n if(!targetData){\r\n\r\n }\r\n try {\r\n // Handle reverse connection\r\n if (isReversed) {\r\n // in the reverse condition if the array is already defined.\r\n if (Array.isArray(sourceData[reverseKey])) {\r\n sourceData[reverseKey].push(dataPackage);\r\n } else {\r\n\r\n // in the reverse condition the data is always an array.\r\n sourceData[reverseKey] = [dataPackage];\r\n }\r\n }\r\n else{\r\n // Normal connection\r\n if (Array.isArray(sourceData)) {\r\n sourceData.push(targetData);\r\n } else if (Array.isArray(sourceData[linkerKey])) {\r\n // this is the condition in which the data placeholder is already an array\r\n sourceData[linkerKey].push(dataPackage);\r\n } else {\r\n // this is the condition where the data includes _s_ which denotes that this must be an array or multiple values.\r\n // this is the condition in which the placeholder for the data is not an array but multiple values are already assigned to value\r\n if (linkerKey.includes(\"_s_\")) {\r\n sourceData[linkerKey] = [];\r\n sourceData[linkerKey].push(dataPackage);\r\n } else {\r\n // this is the condition in which the placeholder for the data is undefined till now\r\n sourceData[linkerKey] = [dataPackage];\r\n }\r\n }\r\n }\r\n\r\n\r\n AddCount(targetId, CountDictionary, dataPackage);\r\n \r\n } catch (err) {\r\n console.error(\"Error processing connection:\", err);\r\n }\r\n }\r\n else{\r\n console.log(\"This is the error in the source\");\r\n }\r\n\r\n\r\n }\r\n\r\n // Assemble main data\r\n for (const id of mainComposition) {\r\n const mainConcept = await GetTheConcept(id);\r\n mainData.push({\r\n id,\r\n data: compositionData[id],\r\n created_on: mainConcept.entryTimeStamp,\r\n });\r\n }\r\n\r\n return mainData;\r\n}\r\n","/**\r\n * @module SearchLinkInternal\r\n * @description Provides functionality to search for internal links within concepts and return formatted data\r\n */\r\n\r\nimport { SearchInternalApi } from \"../../Api/Search/SearchInternalApi\";\r\nimport { SearchStructure, ViewInternalData } from \"../../app\";\r\n\r\n/**\r\n * Searches for internal links within concepts based on the provided search query\r\n * and returns the formatted internal data view.\r\n *\r\n * @async\r\n * @param {SearchStructure} searchQuery - The search query structure containing search criteria\r\n * @param {string} [token=\"\"] - Optional authentication token for API requests\r\n * @returns {Promise<any[]>} A promise that resolves to an array of formatted concept connections\r\n *\r\n * @example\r\n * ```typescript\r\n * const searchQuery: SearchStructure = {\r\n * composition: 123,\r\n * linker: 456\r\n * };\r\n * const results = await SearchLinkInternal(searchQuery, \"auth-token\");\r\n * console.log(results);\r\n * ```\r\n *\r\n * @remarks\r\n * This function performs a two-step process:\r\n * 1. Fetches internal concept connections using the SearchInternalApi\r\n * 2. Formats the connections into a readable view using ViewInternalData\r\n */\r\nexport async function SearchLinkInternal(searchQuery: SearchStructure, token: string=\"\"){\r\n var conceptsConnections = await SearchInternalApi(searchQuery, token);\r\n let out = await ViewInternalData(conceptsConnections);\r\n return out;\r\n }","/**\r\n * @module SearchLinkMultiple\r\n * @description Provides functionality to search for multiple links across compositions and format the results\r\n */\r\n\r\nimport { SearchLinkMultipleApi } from \"../../Api/Search/SearchLinkMultipleApi\";\r\nimport { SearchQuery } from \"../../DataStructures/SearchQuery\";\r\nimport { Connection, GetConnectionBulk, GetTheConcept } from \"../../app\";\r\nimport { GetCompositionFromConnectionsWithDataIdInObject } from \"../GetCompositionBulk\";\r\n\r\n/**\r\n * Searches for multiple links across compositions based on an array of search queries.\r\n * Returns formatted data with all linked concepts and their relationships.\r\n *\r\n * @async\r\n * @param {SearchQuery[]} searchQuery - Array of search query objects containing composition and link criteria\r\n * @param {string} [token=\"\"] - Optional authentication token for API requests\r\n * @returns {Promise<any>} A promise that resolves to formatted composition data with all linked concepts\r\n *\r\n * @example\r\n * ```typescript\r\n * const queries: SearchQuery[] = [\r\n * { composition: 123, linker: 456, reverse: false },\r\n * { composition: 789, linker: 456, reverse: true }\r\n * ];\r\n * const result = await SearchLinkMultipleAll(queries, \"auth-token\");\r\n * console.log(result);\r\n * ```\r\n *\r\n * @remarks\r\n * This function:\r\n * 1. Fetches multiple linked compositions from the API\r\n * 2. Retrieves all related concepts and connections\r\n * 3. Formats the data structure with proper linker relationships\r\n * 4. Handles both forward and reverse link directions\r\n */\r\nexport async function SearchLinkMultipleAll(searchQuery: SearchQuery[], token: string=\"\"){\r\n let concepts:any[] = [];\r\n let conceptsConnections = await SearchLinkMultipleApi(searchQuery, token);\r\n let mainCompositionId = searchQuery[0].composition;\r\n const result = conceptsConnections;\r\n let conceptIds = result.compositionIds;\r\n let connections = result.internalConnections;\r\n let linkers = result.linkers;\r\n let reverse = result.reverse;\r\n concepts = await GetCompositionFromConnectionsWithDataIdInObject(conceptIds,connections);\r\n let out = await FormatFromConnections(linkers, concepts, mainCompositionId, reverse);\r\n return out;\r\n}\r\n\r\n/**\r\n * Formats composition data from connection linkers, organizing concepts into a hierarchical structure.\r\n * Handles both forward and reverse relationships between concepts.\r\n *\r\n * @async\r\n * @param {number[]} linkers - Array of connection IDs that link concepts together\r\n * @param {any[]} compositionData - Dictionary of composition data indexed by concept ID\r\n * @param {number} mainComposition - The ID of the main composition to return\r\n * @param {number[]} [reverse=[]] - Array of connection IDs that should be treated as reverse connections\r\n * @returns {Promise<any>} A promise that resolves to the formatted main composition data with all linked concepts\r\n *\r\n * @example\r\n * ```typescript\r\n * const linkers = [101, 102, 103];\r\n * const compositionData = { 123: { type: \"data\" }, 456: { type: \"info\" } };\r\n * const mainId = 123;\r\n * const reverseConnections = [102];\r\n * const result = await FormatFromConnections(linkers, compositionData, mainId, reverseConnections);\r\n * ```\r\n *\r\n * @remarks\r\n * This function:\r\n * - Fetches all connections from the provided linker IDs\r\n * - Processes each connection to build relationships\r\n * - Handles reverse connections (to -> from instead of from -> to)\r\n * - Uses the linker concept's character value as the relationship key\r\n * - Appends \"_reverse\" suffix for reverse relationships\r\n */\r\nexport async function FormatFromConnections(linkers:number[], compositionData: any[], mainComposition: number, reverse: number [] = []){\r\n let mainData: any = {};\r\n let connections = await GetConnectionBulk(linkers);\r\n for(let i=0 ; i< connections.length; i++){\r\n let reverseFlag = false;\r\n if(reverse.includes(connections[i].id)){\r\n reverseFlag = true;\r\n }\r\n if(reverseFlag == true){\r\n\r\n if(compositionData[connections[i].ofTheConceptId] && compositionData[connections[i].toTheConceptId]){\r\n let mydata = compositionData[connections[i].toTheConceptId];\r\n let linkerConcept = await GetTheConcept(connections[i].typeId);\r\n let newData = mydata?.data;\r\n let key = Object.keys(newData)[0];\r\n try{\r\n let reverseCharater = linkerConcept.characterValue + \"_reverse\";\r\n if(typeof newData === \"string\"){\r\n newData = {};\r\n }\r\n if(Array.isArray(newData[key][reverseCharater])){\r\n newData[key][reverseCharater].push(compositionData[connections[i].ofTheConceptId]);\r\n }\r\n else{\r\n if(typeof newData[key] === \"string\"){\r\n \r\n newData[key] = {};\r\n }\r\n newData[key][reverseCharater] = [];\r\n newData[key][reverseCharater].push(compositionData[connections[i].ofTheConceptId]);\r\n }\r\n\r\n \r\n }\r\n catch(ex){\r\n console.log(\"this is error\", ex);\r\n }\r\n }\r\n }\r\n else\r\n {\r\n if(compositionData[connections[i].ofTheConceptId] && compositionData[connections[i].toTheConceptId]){\r\n let mydata = compositionData[connections[i].ofTheConceptId];\r\n let linkerConcept = await GetTheConcept(connections[i].typeId);\r\n let newData = mydata?.data;\r\n let key = Object.keys(newData)[0];\r\n try{\r\n \r\n if(typeof newData === \"string\"){\r\n newData = {};\r\n }\r\n if(Array.isArray(newData[key][linkerConcept.characterValue])){\r\n newData[key][linkerConcept.characterValue].push(compositionData[connections[i].toTheConceptId]);\r\n }\r\n else{\r\n if(typeof newData[key] === \"string\"){\r\n \r\n newData[key] = {};\r\n }\r\n \r\n newData[key][linkerConcept.characterValue] = [];\r\n newData[key][linkerConcept.characterValue].push(compositionData[connections[i].toTheConceptId]);\r\n }\r\n \r\n }\r\n catch(ex){\r\n console.log(\"this is error\", ex);\r\n }\r\n \r\n }\r\n }\r\n\r\n }\r\n mainData = compositionData[mainComposition];\r\n return mainData;\r\n}\r\n\r\n\r\n","/**\r\n * @module SearchWithTypeAndLinker\r\n * @description Provides various formatting functions for search results with different output formats (Normal, DATA-ID, JustId)\r\n */\r\n\r\nimport { CountInfo } from \"../../DataStructures/Count/CountInfo\";\r\nimport { GetConnectionTypeForCount } from \"../Common/DecodeCountInfo\";\r\nimport { GetConnectionDataPrefetch } from \"../GetCompositionBulk\";\r\nimport { FormatFromConnectionsAlteredArrayExternal, FormatFunctionData, FormatFunctionDataForData } from \"./DataIdFormat\";\r\nimport { FormatConceptsAndConnectionsNormalList, formatFunction, formatFunctionForData } from \"./FormatData\";\r\nimport { FormatFromConnectionsAlteredArrayExternalJustId, FormatFunctionDataForDataJustId } from \"./JustIdFormat\";\r\nimport { FormatFromConnectionsAlteredArrayExternalV2, FormatFunctionDataForDataV2, FormatFunctionDataV2 } from \"./NewFormat\";\r\nimport { orderTheConnections } from \"./orderingConnections\";\r\n\r\n/**\r\n * Formats connections in the Normal format by fetching connections, converting them to single-level objects,\r\n * and stitching them together to create a complex JSON structure or array.\r\n *\r\n * @async\r\n * @param {number[]} linkers - Array of connection IDs that act as linkers between concepts\r\n * @param {number[]} conceptIds - Array of concept IDs involved in the connections\r\n * @param {number[]} mainCompositionIds - Array of main composition IDs to format\r\n * @param {number[]} reverse - Array of connection IDs that should be treated as reverse connections\r\n * @param {CountInfo[]} countInfos - Array of count information objects for connection statistics\r\n * @returns {Promise<any[]>} A promise that resolves to an array of formatted composition data\r\n *\r\n * @example\r\n * ```typescript\r\n * const linkers = [101, 102];\r\n * const conceptIds = [1, 2, 3];\r\n * const mainIds = [100];\r\n * const reverse = [102];\r\n * const countInfos: CountInfo[] = [];\r\n * const result = await formatConnections(linkers, conceptIds, mainIds, reverse, countInfos);\r\n * ```\r\n *\r\n * @remarks\r\n * Format: Normal - This format is used for standard composition retrieval\r\n * Process:\r\n * 1. Fetches all connections using the provided linker IDs\r\n * 2. Orders the connections (descending by default)\r\n * 3. Formats connections to single-level objects\r\n * 4. Formats data connections\r\n * 5. Combines and stitches all data into a complex structure\r\n */\r\nexport async function formatConnections(linkers: number[], conceptIds: number [], mainCompositionIds: number[], reverse: number[],countInfos: CountInfo[]){\r\n \r\n let prefetchConnections = await GetConnectionDataPrefetch(linkers);\r\n prefetchConnections = orderTheConnections(prefetchConnections);\r\n let compositionData: any [] = [];\r\n let newCompositionData: any [] = [];\r\n compositionData = await formatFunction(prefetchConnections, compositionData, reverse);\r\n compositionData = await formatFunctionForData(prefetchConnections, compositionData, reverse);\r\n let output:any = await FormatConceptsAndConnectionsNormalList(prefetchConnections, compositionData, mainCompositionIds, newCompositionData, reverse );\r\n return output;\r\n}\r\n\r\n\r\n/**\r\n * Formats connections in the DATA-ID format, which includes both data and ID information for each concept.\r\n * Fetches connections, converts them to single-level objects, and stitches them together.\r\n *\r\n * @async\r\n * @param {number[]} linkers - Array of connection IDs that act as linkers between concepts\r\n * @param {number[]} conceptIds - Array of concept IDs involved in the connections\r\n * @param {number[]} mainCompositionIds - Array of main composition IDs to format\r\n * @param {number[]} reverse - Array of connection IDs that should be treated as reverse connections\r\n * @param {CountInfo[]} countInfos - Array of count information objects for connection statistics\r\n * @param {string} [order=\"DESC\"] - Sort order for connections (\"ASC\" or \"DESC\")\r\n * @returns {Promise<any[]>} A promise that resolves to an array of formatted composition data with ID and data fields\r\n *\r\n * @example\r\n * ```typescript\r\n * const result = await formatConnectionsDataId(\r\n * [101, 102],\r\n * [1, 2, 3],\r\n * [100],\r\n * [102],\r\n * [],\r\n * \"ASC\"\r\n * );\r\n * // Result format: [{ id: 100, data: {...}, created_on: timestamp }]\r\n * ```\r\n *\r\n * @remarks\r\n * Format: DATA-ID - Each result includes concept ID, data object, and creation timestamp\r\n * This format is useful when you need to track both the identity and content of concepts\r\n * The order parameter allows sorting connections by ID in ascending or descending order\r\n */\r\nexport async function formatConnectionsDataId(linkers: number[], conceptIds: number [], mainCompositionIds: number[], reverse: number[], countInfos: CountInfo[], order:string = \"DESC\"){\r\n let prefetchConnections = await GetConnectionDataPrefetch(linkers);\r\n let CountDictionary:any = await GetConnectionTypeForCount(countInfos);\r\n prefetchConnections = orderTheConnections(prefetchConnections, order);\r\n let compositionData: any [] = [];\r\n let newCompositionData: any [] = [];\r\n compositionData = await FormatFunctionData(prefetchConnections, compositionData, reverse);\r\n compositionData = await FormatFunctionDataForData(prefetchConnections, compositionData, reverse);\r\n let output:any = await FormatFromConnectionsAlteredArrayExternal(prefetchConnections, compositionData,newCompositionData, mainCompositionIds, reverse, CountDictionary );\r\n return output;\r\n}\r\n\r\n\r\n\r\n/**\r\n * Formats connections in the JustId format, which provides a simplified view with IDs and minimal data.\r\n * Fetches connections, converts them to single-level objects, and stitches them together.\r\n *\r\n * @async\r\n * @param {number[]} linkers - Array of connection IDs that act as linkers between concepts\r\n * @param {number[]} conceptIds - Array of concept IDs involved in the connections\r\n * @param {number[]} mainCompositionIds - Array of main composition IDs to format\r\n * @param {number[]} reverse - Array of connection IDs that should be treated as reverse connections\r\n * @param {CountInfo[]} countInfos - Array of count information objects for connection statistics\r\n * @param {string} [order=\"DESC\"] - Sort order for connections (\"ASC\" or \"DESC\")\r\n * @returns {Promise<any[]>} A promise that resolves to an array of formatted composition data with simplified ID structure\r\n *\r\n * @example\r\n * ```typescript\r\n * const result = await formatConnectionsJustId(\r\n * [101, 102],\r\n * [1, 2, 3],\r\n * [100],\r\n * [],\r\n * [],\r\n * \"DESC\"\r\n * );\r\n * // Result format: [{ id: 100, type: { id: 1, data: \"value\", created_on: timestamp } }]\r\n * ```\r\n *\r\n * @remarks\r\n * Format: JustId - This format provides a lightweight representation with IDs and essential data\r\n * Useful for list views and when you need to minimize data transfer\r\n * Each linked concept includes: ID, data value, and creation timestamp\r\n */\r\nexport async function formatConnectionsJustId(linkers: number[], conceptIds: number [], mainCompositionIds: number[], reverse: number[], countInfos: CountInfo[], order:string = \"DESC\"){\r\n \r\n let prefetchConnections = await GetConnectionDataPrefetch(linkers);\r\n let CountDictionary:any = await GetConnectionTypeForCount(countInfos);\r\n prefetchConnections = orderTheConnections(prefetchConnections, order);\r\n\r\n let compositionData: any [] = [];\r\n let newCompositionData: any [] = [];\r\n compositionData = await formatFunction(prefetchConnections, compositionData, reverse);\r\n compositionData = await FormatFunctionDataForDataJustId(prefetchConnections, compositionData, reverse);\r\n let output:any = await FormatFromConnectionsAlteredArrayExternalJustId(prefetchConnections, compositionData, mainCompositionIds, reverse, CountDictionary);\r\n return output;\r\n}\r\n\r\nexport async function formatConnectionsV2(linkers: number[], conceptIds:number[], mainCompositionIds: number[], reverse: number[], countInfos:CountInfo[], order:string=\"DESC\"){\r\n\r\n let prefetchConnections = await GetConnectionDataPrefetch(linkers);\r\n let CountDictionary:any = await GetConnectionTypeForCount(countInfos);\r\n prefetchConnections = orderTheConnections(prefetchConnections, order);\r\n let compositionData: Record<number, any> = {};\r\n compositionData = await FormatFunctionDataV2(prefetchConnections, compositionData, reverse);\r\n compositionData = await FormatFunctionDataForDataV2(prefetchConnections, compositionData, reverse);\r\n let output:any = await FormatFromConnectionsAlteredArrayExternalV2(prefetchConnections, compositionData, mainCompositionIds, reverse, CountDictionary );\r\n return output;\r\n}","/**\r\n * @module orderingConnections\r\n * @description Provides functionality to sort connections by ID in ascending or descending order\r\n */\r\n\r\nimport { Connection } from \"../../app\";\r\n\r\n/**\r\n * Sorts an array of connections by their ID in the specified order.\r\n *\r\n * @param {Connection[]} connections - Array of Connection objects to sort\r\n * @param {string} [order=\"DESC\"] - Sort order: \"ASC\" for ascending, \"DESC\" for descending\r\n * @returns {Connection[]} The sorted array of connections (mutates the original array)\r\n *\r\n * @example\r\n * ```typescript\r\n * const connections: Connection[] = [\r\n * { id: 103, ... },\r\n * { id: 101, ... },\r\n * { id: 102, ... }\r\n * ];\r\n *\r\n * // Sort in descending order (newest first)\r\n * const sorted = orderTheConnections(connections, \"DESC\");\r\n * // Result: [{ id: 103 }, { id: 102 }, { id: 101 }]\r\n *\r\n * // Sort in ascending order (oldest first)\r\n * const sortedAsc = orderTheConnections(connections, \"ASC\");\r\n * // Result: [{ id: 101 }, { id: 102 }, { id: 103 }]\r\n * ```\r\n *\r\n * @remarks\r\n * - This function mutates the original array in place\r\n * - Default order is \"DESC\" (descending, newest first)\r\n * - Uses the connection ID for sorting\r\n * - Any value other than \"ASC\" will result in descending order\r\n */\r\nexport function orderTheConnections(connections: Connection[], order: string = \"DESC\"){\r\n console.log(\"this is the order\", order);\r\n if(order == \"ASC\"){\r\n\r\n connections.sort(function(x: Connection, y:Connection){\r\n return x.id - y.id;\r\n })\r\n }\r\n else{\r\n connections.sort(function(x: Connection, y:Connection){\r\n return y.id - x.id;\r\n })\r\n }\r\n return connections;\r\n}","import { TokenStorage } from \"../../DataStructures/Security/TokenStorage\";\r\nimport { getOAuthToken } from \"../oauth/CallOauth.service\";\r\n\r\n// export function GetRequestHeader(contentType:string ='application/json',\r\n// Accept: string = 'application/json'\r\n// ){\r\n// var headers = {\r\n// 'Content-Type':contentType,\r\n// 'Authorization': \"Bearer \" + TokenStorage.BearerAccessToken,\r\n// 'Accept': Accept,\r\n// };\r\n\r\n// return headers;\r\n// }\r\n\r\n// export function GetRequestHeaderWithAuthorization(contentType:string ='application/json',\r\n// token: string = \"\",Accept: string = 'application/json',\r\n// ){\r\n// if(token == \"\"){\r\n// token = TokenStorage.BearerAccessToken;\r\n// }\r\n// var headers = {\r\n// 'Content-Type':contentType,\r\n// 'Authorization': \"Bearer \" + token,\r\n// 'Accept': Accept,\r\n// };\r\n\r\n// return headers;\r\n// }\r\n\r\n/**\r\n * Gets request headers with automatic token refresh if expired or near expiry.\r\n * This is the async version that checks token expiry and refreshes if needed.\r\n *\r\n * @async\r\n * @param {string} [contentType='application/json'] - Content-Type header value\r\n * @param {string} [Accept='application/json'] - Accept header value\r\n * @returns {Promise<Record<string, string>>} Headers object with refreshed token if needed\r\n *\r\n * @example\r\n * ```typescript\r\n * // Automatically refreshes token if expired/near expiry\r\n * const headers = await GetRequestHeaderWithRefresh();\r\n * const response = await fetch(url, { headers });\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // With custom content type\r\n * const headers = await GetRequestHeaderWithRefresh('application/x-www-form-urlencoded');\r\n * ```\r\n */\r\nexport async function GetRequestHeader(\r\n contentType: string = 'application/json',\r\n Accept: string = 'application/json'\r\n): Promise<Record<string, string>> {\r\n // Check if token is expired or near expiry\r\n if (TokenStorage.isTokenExpiredOrNearExpiry() && TokenStorage.hasOAuthCredentials()) {\r\n console.log('Token expired or near expiry, refreshing...');\r\n\r\n const refreshResult = await getOAuthToken(\r\n TokenStorage.CLIENT_ID,\r\n TokenStorage.CLIENT_SECRET,\r\n TokenStorage.APPLICATION_NAME,\r\n true\r\n );\r\n\r\n if (!refreshResult.success) {\r\n console.error('Failed to refresh token:', refreshResult.error);\r\n // Continue with existing token\r\n } else {\r\n console.log('Token refreshed successfully');\r\n }\r\n }\r\n\r\n return {\r\n 'Content-Type': contentType,\r\n 'Authorization': \"Bearer \" + TokenStorage.BearerAccessToken,\r\n 'Accept': Accept,\r\n };\r\n}\r\n\r\n/**\r\n * Gets request headers with automatic token refresh and custom token override.\r\n * This is the async version that checks token expiry and refreshes if needed.\r\n *\r\n * @async\r\n * @param {string} [contentType='application/json'] - Content-Type header value\r\n * @param {string} [token=''] - Optional token override. If empty, uses TokenStorage token\r\n * @param {string} [Accept='application/json'] - Accept header value\r\n * @returns {Promise<Record<string, string>>} Headers object with refreshed token if needed\r\n *\r\n * @example\r\n * ```typescript\r\n * // Use stored token with automatic refresh\r\n * const headers = await GetRequestHeaderWithAuthorizationAndRefresh();\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Use custom token (no refresh)\r\n * const headers = await GetRequestHeaderWithAuthorizationAndRefresh(\r\n * 'application/json',\r\n * 'custom-token-here'\r\n * );\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Check token expiry status\r\n * const timeRemaining = TokenStorage.getTimeUntilExpiry();\r\n * console.log(`Token expires in ${timeRemaining} seconds`);\r\n *\r\n * const headers = await GetRequestHeaderWithAuthorizationAndRefresh();\r\n * ```\r\n */\r\nexport async function GetRequestHeaderWithAuthorization(\r\n contentType: string = 'application/json',\r\n token: string = \"\",\r\n Accept: string = 'application/json'\r\n): Promise<Record<string, string>> {\r\n // If custom token provided, use it without refresh\r\n if (token !== \"\") {\r\n return {\r\n 'Content-Type': contentType,\r\n 'Authorization': \"Bearer \" + token,\r\n 'Accept': Accept,\r\n };\r\n }\r\n\r\n // Check if token is expired or near expiry\r\n if (TokenStorage.isTokenExpiredOrNearExpiry() && TokenStorage.hasOAuthCredentials()) {\r\n console.log('Token expired or near expiry, refreshing...');\r\n\r\n const refreshResult = await getOAuthToken(\r\n TokenStorage.CLIENT_ID,\r\n TokenStorage.CLIENT_SECRET,\r\n TokenStorage.APPLICATION_NAME,\r\n true\r\n );\r\n\r\n if (!refreshResult.success) {\r\n console.error('Failed to refresh token:', refreshResult.error);\r\n // Continue with existing token\r\n } else {\r\n console.log('Token refreshed successfully');\r\n }\r\n }\r\n\r\n return {\r\n 'Content-Type': contentType,\r\n 'Authorization': \"Bearer \" + TokenStorage.BearerAccessToken,\r\n 'Accept': Accept,\r\n };\r\n}","/**\r\n * @fileoverview String utility module for splitting type strings in the CCS-JS system.\r\n * This module provides functionality to parse type strings that follow a naming convention\r\n * with underscore separators, commonly used for identifying concept types and their relationships.\r\n * @module Services/SplitStrings\r\n */\r\n\r\n/**\r\n * Splits a type string into component parts based on the last underscore delimiter.\r\n *\r\n * This function is used throughout the CCS-JS system to parse type identifiers that follow\r\n * a naming convention where the last underscore separates the base type from its suffix.\r\n * For example, \"concept_type_123\" would be split into [\"concept_type\", \"123\"].\r\n *\r\n * The function uses the last occurrence of underscore as the split point, which allows\r\n * for type names that contain underscores themselves. If no underscore is found, the\r\n * original string is returned as a single-element array.\r\n *\r\n * @param typeString - The type identifier string to be split\r\n * @returns An array containing the split components. Returns a two-element array [prefix, suffix]\r\n * if an underscore is found, or a single-element array [typeString] if no underscore exists.\r\n *\r\n * @example\r\n * ```typescript\r\n * // Split a composite type string\r\n * const result = SplitStrings(\"user_profile_123\");\r\n * // Returns: [\"user_profile\", \"123\"]\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Handle string without underscore\r\n * const result = SplitStrings(\"simpleType\");\r\n * // Returns: [\"simpleType\"]\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Split concept type identifier\r\n * const result = SplitStrings(\"concept_type\");\r\n * // Returns: [\"concept\", \"type\"]\r\n * ```\r\n *\r\n * @remarks\r\n * The function specifically uses `lastIndexOf(\"_\")` to find the splitting point, which means:\r\n * - Only the last underscore is considered for splitting\r\n * - All underscores before the last one remain part of the first element\r\n * - The position check (pos > 0) ensures underscore is not the first character\r\n *\r\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf | String.lastIndexOf}\r\n */\r\nexport function SplitStrings(typeString: string)\r\n{\r\n const pos = typeString.lastIndexOf(\"_\");\r\n let SplittedStrings:string[] = [];\r\n if(pos > 0){\r\n var rest = typeString.substring(0, pos);\r\n var last = typeString.substring(pos + 1, typeString.length);\r\n\r\n SplittedStrings = [rest, last];\r\n }\r\n else{\r\n SplittedStrings = [typeString];\r\n }\r\n\r\n\r\n return SplittedStrings;\r\n}","/**\r\n * @fileoverview Composition update service for the CCS-JS system.\r\n * This module provides comprehensive functionality for updating composition structures,\r\n * managing the complex process of patching objects into compositions, handling nested\r\n * compositions, updating caches, and synchronizing changes with the backend.\r\n * @module Services/UpdateComposition\r\n */\r\n\r\n import { Connection } from '../DataStructures/Connection';\r\n import { Concept } from '../DataStructures/Concept';\r\n import InsertUniqueNumber from '../Helpers/UniqueInsert'\r\n import {\r\n CheckAllConnectionsConnectedInConnectionArray,\r\n CheckIfTypeConceptsExistsInArray,\r\n } from '../Helpers/CheckIfExists'\r\n\r\n import {\r\n RemoveConceptFromList,\r\n RemoveConnectionFromList,\r\n } from '../Helpers/RemoveFromArray'\r\nimport { PatcherStructure } from '../DataStructures/PatcherStructure'\r\nimport { CreateDefaultConcept } from './CreateDefaultConcept';\r\nimport { GetAllConnectionsOfComposition } from '../Api/GetAllConnectionsOfComposition';\r\nimport GetTheConcept from './GetTheConcept';\r\nimport MakeTheInstanceConcept from './MakeTheInstanceConcept';\r\nimport { createTheConnection } from './CreateTheConnection';\r\nimport { DeleteConnectionById } from './DeleteConnection';\r\nimport { SyncData } from '../DataStructures/SyncData';\r\nimport { CompositionBinaryTree } from '../DataStructures/Composition/CompositionBinaryTree';\r\nimport { Composition } from '../DataStructures/Composition/Composition';\r\nimport {CreateTheCompositionWithCache} from './Composition/CreateCompositionCache';\r\n\r\n /**\r\n * Updates an existing composition by patching new data into it while maintaining cache consistency.\r\n *\r\n * This is a core function in the CCS-JS system that handles the complex process of updating\r\n * compositions. It performs the following operations:\r\n * 1. Retrieves the current composition and all its connections from the backend\r\n * 2. Processes the patch object to create new concepts and connections\r\n * 3. Identifies and removes outdated concepts and connections\r\n * 4. Updates the composition cache and binary tree structure\r\n * 5. Synchronizes changes with the backend\r\n *\r\n * The function handles both simple value updates and complex nested composition updates.\r\n * It ensures data consistency by managing connection deletions, concept replacements, and\r\n * cache invalidation across distributed servers.\r\n *\r\n * @param patcherStructure - Structure containing all necessary information for the update operation\r\n * including compositionId, patchObject, userId, sessionId, and accessId\r\n * @returns A promise that resolves to the updated composition cache data, or null if the composition\r\n * cannot be found or updated. The returned data includes the updated concepts, connections,\r\n * and subcompositions.\r\n *\r\n * @example\r\n * ```typescript\r\n * // Update a simple composition with new values\r\n * import UpdateComposition from './UpdateComposition';\r\n * import { PatcherStructure } from '../DataStructures/PatcherStructure';\r\n *\r\n * const patcher: PatcherStructure = {\r\n * compositionId: 123,\r\n * patchObject: { name: \"Updated Name\", age: 30 },\r\n * userId: 456,\r\n * sessionId: 999,\r\n * accessId: 4\r\n * };\r\n *\r\n * const result = await UpdateComposition(patcher);\r\n * console.log(result); // Updated composition data\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Update a nested composition\r\n * const patcher: PatcherStructure = {\r\n * compositionId: 123,\r\n * ofTheCompositionId: 789, // Parent concept ID for nested update\r\n * patchObject: {\r\n * profile: {\r\n * firstName: \"John\",\r\n * lastName: \"Doe\"\r\n * },\r\n * settings: {\r\n * theme: \"dark\"\r\n * }\r\n * },\r\n * userId: 456,\r\n * sessionId: 999,\r\n * accessId: 4\r\n * };\r\n *\r\n * const result = await UpdateComposition(patcher);\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Handle local concept conversion (negative ID to positive ID)\r\n * const patcher: PatcherStructure = {\r\n * compositionId: -123, // Local concept ID\r\n * patchObject: { status: \"active\" },\r\n * userId: 456,\r\n * sessionId: 999,\r\n * accessId: 4\r\n * };\r\n *\r\n * const result = await UpdateComposition(patcher);\r\n * // Function will convert local ID to server ID before updating\r\n * ```\r\n *\r\n * @remarks\r\n * Complex behavior and important considerations:\r\n *\r\n * **Local Concept Handling:**\r\n * - If compositionId is negative (local concept), the function attempts to find the persisted version\r\n * - Returns null if the local concept hasn't been synced to the server yet\r\n *\r\n * **Cache Management:**\r\n * - Marks the composition as \"updating\" to signal distributed servers to invalidate their cache\r\n * - Rebuilds the composition cache with all updated concepts and connections\r\n * - Updates the CompositionBinaryTree for fast access\r\n *\r\n * **Connection Management:**\r\n * - Identifies existing concepts that match the new concepts being added\r\n * - Removes old connections to those concepts before creating new ones\r\n * - Deletes connections in bulk for efficiency\r\n *\r\n * **Nested Compositions:**\r\n * - Supports updating subcompositions via the ofTheCompositionId parameter\r\n * - Creates new composition concepts for object/array values\r\n * - Recursively processes nested structures\r\n *\r\n * **Synchronization:**\r\n * - Calls SyncData.SyncDataOnline() to push changes to the backend\r\n * - Ensures consistency across distributed system\r\n *\r\n * **Performance Considerations:**\r\n * - Fetches all connections from backend for latest data\r\n * - Processes deletions and additions in batch\r\n * - Uses caching to minimize redundant database queries\r\n *\r\n * @see {@link PatcherStructure} for the structure of the patcher parameter\r\n * @see {@link CreateTheCompositionWithCache} for creating nested compositions\r\n * @see {@link GetTheConcept} for concept retrieval\r\n * @see {@link MakeTheInstanceConcept} for creating new concept instances\r\n * @see {@link createTheConnection} for creating connections between concepts\r\n * @see {@link DeleteConnectionById} for connection deletion\r\n * @see {@link SyncData.SyncDataOnline} for backend synchronization\r\n */\r\n export default async function UpdateComposition(\r\n patcherStructure: PatcherStructure,\r\n ) {\r\n // get all the default userId, sessionId, accessId passed by the patcherStructure\r\n const userId = patcherStructure.userId\r\n const sessionId = patcherStructure.sessionId\r\n const accessId = patcherStructure.accessId\r\n let connectionList: Connection[] = []\r\n const conceptList: Concept[] = []\r\n let composition: Concept = CreateDefaultConcept()\r\n let parentConcept: Concept = CreateDefaultConcept()\r\n const toDeleteConcepts: Concept[] = []\r\n // the main composition Id that has the data that needs to be patched\r\n let compositionId = patcherStructure.compositionId\r\n\r\n // if you want to edit the subcompositions of the composition then you have to pass to this\r\n const ofTheConceptId = patcherStructure.ofTheCompositionId\r\n let toDeleteConnections: Connection[] = []\r\n if(compositionId < 0){\r\n let localConcept = await GetTheConcept(compositionId, userId);\r\n if(localConcept.id > 0){\r\n compositionId = localConcept.id;\r\n }\r\n else{\r\n return null;\r\n }\r\n }\r\n\r\n\r\n // get all connections from the backend because it needs latest data\r\n const connectionListString = await GetAllConnectionsOfComposition(compositionId)\r\n connectionList = connectionListString as Connection[]\r\n const conceptIdList: number[] = []\r\n const compositionCache = new Composition()\r\n const compositionList: number[] = []\r\n compositionCache.id = compositionId\r\n // put this in the upper section before updating because this will tell all other distributed\r\n //servers to destroy the copy of the composition that they have as new composition is coming up\r\n compositionCache.isUpdating()\r\n\r\n // get all the connections that are inside of the composition and store them in\r\n let allConcepts = [];\r\n for (let i = 0; i < connectionList.length; i++) {\r\n InsertUniqueNumber(compositionList, connectionList[i].ofTheConceptId)\r\n InsertUniqueNumber(conceptIdList, connectionList[i].ofTheConceptId)\r\n InsertUniqueNumber(conceptIdList, connectionList[i].toTheConceptId)\r\n allConcepts.push(connectionList[i].ofTheConceptId);\r\n }\r\n compositionCache.subcompositions = compositionList\r\n compositionCache.connections = connectionList\r\n // get all the concepts that are inside of the composition and store them in a conceptList\r\n for (let i = 0; i < conceptIdList.length; i++) {\r\n const conceptString = await GetTheConcept(conceptIdList[i])\r\n const concept = conceptString as Concept\r\n if (compositionId == conceptIdList[i]) {\r\n composition = concept\r\n }\r\n if (ofTheConceptId == conceptIdList[i]) {\r\n parentConcept = concept\r\n }\r\n conceptList.push(concept)\r\n }\r\n\r\n // now trying to patch the new object into the composition\r\n const object = patcherStructure.patchObject\r\n for (const key in object) {\r\n let insertingConcept: Concept = CreateDefaultConcept();\r\n const value = object[key]\r\n let localConcept = composition\r\n\r\n // if the immedidate parent exists in the composition (i.e. for multilevel composition)\r\n if (parentConcept.id > 0) {\r\n localConcept = parentConcept\r\n }\r\n\r\n if(Array.isArray(value) || typeof value == 'object'){\r\n\r\n insertingConcept = await MakeTheInstanceConcept(key, \"\", true, composition.userId, 4, 999);\r\n compositionCache.subcompositions.push(insertingConcept.id);\r\n // check if the concept exists in the concept list because if it exists then we have to delete old connection\r\n const ExistingConcepts: Concept[] = CheckIfTypeConceptsExistsInArray(\r\n conceptList,\r\n insertingConcept,\r\n )\r\n // if the existing concept then start the process for deleting the concept in the list\r\n for(let i=0 ; i< ExistingConcepts.length; i++){\r\n if (ExistingConcepts[i].id > 0) {\r\n const deletingConnections: Connection[] =\r\n CheckAllConnectionsConnectedInConnectionArray(\r\n compositionCache.connections,\r\n ExistingConcepts[i].id,\r\n )\r\n toDeleteConnections = toDeleteConnections.concat(deletingConnections);\r\n toDeleteConcepts.push(ExistingConcepts[i]);\r\n }\r\n \r\n }\r\n await CreateTheCompositionWithCache(object[key], insertingConcept.id, insertingConcept.userId, composition.id, composition.userId, 4, 999,compositionCache);\r\n\r\n\r\n\r\n }\r\n else{\r\n // make the new concept in the object\r\n insertingConcept = await MakeTheInstanceConcept(\r\n key,\r\n value,\r\n false,\r\n userId,\r\n accessId,\r\n sessionId,\r\n )\r\n \r\n\r\n\r\n // check if the concept exists in the concept list because if it exists then we have to delete old connection\r\n const ExistingConcepts: Concept[] = CheckIfTypeConceptsExistsInArray(\r\n conceptList,\r\n insertingConcept,\r\n )\r\n // if the existing concept then start the process for deleting the concept in the list\r\n for(let i=0 ; i< ExistingConcepts.length; i++){\r\n if (ExistingConcepts[i].id > 0) {\r\n const deletingConnections: Connection[] =\r\n CheckAllConnectionsConnectedInConnectionArray(\r\n compositionCache.connections,\r\n ExistingConcepts[i].id,\r\n )\r\n\r\n toDeleteConnections = toDeleteConnections.concat(deletingConnections);\r\n toDeleteConcepts.push(ExistingConcepts[i]);\r\n }\r\n \r\n }\r\n\r\n }\r\n // create the connection between the new concept and the old composition\r\n const connectionString = await createTheConnection(\r\n localConcept.id,\r\n localConcept.userId,\r\n insertingConcept.id,\r\n insertingConcept.userId,\r\n composition.id,\r\n sessionId,\r\n userId,\r\n )\r\n const connection = connectionString as Connection\r\n conceptList.push(insertingConcept)\r\n compositionCache.connections.push(connection);\r\n }\r\n // now you have to delete the connection in bulk\r\n for (let j = 0; j < toDeleteConnections.length; j++) {\r\n // remove from the cache list\r\n RemoveConnectionFromList(compositionCache.connections, toDeleteConnections[j])\r\n // delete the connection in the backend\r\n DeleteConnectionById(toDeleteConnections[j].id)\r\n }\r\n\r\n\r\n\r\n // also delete the existing concept from the cache.\r\n\r\n for (let k = 0; k < toDeleteConcepts.length; k++) {\r\n // remove concept from the cache concept list\r\n RemoveConceptFromList(conceptList, toDeleteConcepts[k])\r\n }\r\n // now create a composition cache object to cache it into node server\r\n compositionCache.concepts = compositionCache.concepts.concat(conceptList);\r\n compositionCache.mainConcept = composition\r\n compositionCache.id = composition.id\r\n // // create a cache\r\n await compositionCache.updateCache()\r\n // update it the binary tree\r\n CompositionBinaryTree.addCompositionToTree(compositionCache)\r\n await SyncData.SyncDataOnline()\r\n let x = compositionCache.GetDataCache()\r\n return x;\r\n }\r\n ","/**\r\n * @module UserTranslation\r\n * @description Provides functions to translate between ghost IDs and real IDs for user-specific concepts and connections\r\n */\r\n\r\nimport { CreateDefaultLConcept } from './../../Services/Local/CreateDefaultLConcept';\r\nimport { LConcept } from './../../DataStructures/Local/LConcept';\r\nimport { UserBinaryTree } from './../../DataStructures/User/UserBinaryTree';\r\nimport { LConnection } from '../../app';\r\n\r\n/**\r\n * Retrieves a local concept (LConcept) by its ghost ID for a specific user.\r\n * Ghost IDs are temporary IDs used before concepts are persisted.\r\n *\r\n * @async\r\n * @param {number} userId - The user ID who owns the concept\r\n * @param {number} ghostId - The temporary ghost ID of the concept\r\n * @param {number} [sessionId=999] - The session ID (defaults to 999)\r\n * @param {number} [randomizer=999] - Additional randomizer for tree lookup (defaults to 999)\r\n * @returns {Promise<LConcept>} A promise that resolves to the LConcept, or default empty concept if not found\r\n *\r\n * @example\r\n * ```typescript\r\n * const userId = 1;\r\n * const ghostId = 12345;\r\n * const concept = await GetUserGhostId(userId, ghostId);\r\n * if (concept.id !== 0) {\r\n * console.log(\"Found concept with real ID:\", concept.id);\r\n * }\r\n * ```\r\n *\r\n * @remarks\r\n * - Searches the UserBinaryTree for the user's concepts\r\n * - Returns default empty LConcept if user or concept not found\r\n * - Used during concept creation before IDs are assigned\r\n * - Ghost IDs are temporary until persisted to backend\r\n */\r\nexport async function GetUserGhostId(userId:number, ghostId:number, sessionId:number = 999, randomizer: number = 999){\r\n\r\n let userNode = await UserBinaryTree.getNodeFromTree(userId, sessionId, randomizer);\r\n let realConcept: LConcept = CreateDefaultLConcept();\r\n if(userNode){\r\n for(let i=0 ; i<userNode.value.length; i++ ){\r\n let testConcept: LConcept = userNode.value[i];\r\n if(testConcept.ghostId == ghostId){\r\n realConcept = testConcept;\r\n\r\n }\r\n }\r\n }\r\n return realConcept;\r\n}\r\n\r\n/**\r\n * Retrieves a local connection (LConnection) by its ghost ID for a specific user.\r\n * Ghost IDs are temporary IDs used before connections are persisted.\r\n *\r\n * @async\r\n * @param {number} userId - The user ID who owns the connection\r\n * @param {number} ghostId - The temporary ghost ID of the connection\r\n * @param {number} [sessionId=999] - The session ID (defaults to 999)\r\n * @param {number} [randomizer=999] - Additional randomizer for tree lookup (defaults to 999)\r\n * @returns {Promise<LConnection>} A promise that resolves to the LConnection, or default empty connection if not found\r\n *\r\n * @example\r\n * ```typescript\r\n * const userId = 1;\r\n * const connectionGhostId = 67890;\r\n * const connection = await GetUserGhostConnectionId(userId, connectionGhostId);\r\n * if (connection.id !== 0) {\r\n * console.log(\"Found connection with real ID:\", connection.id);\r\n * }\r\n * ```\r\n *\r\n * @remarks\r\n * - Similar to GetUserGhostId but for connections instead of concepts\r\n * - Searches UserBinaryTree's connection values\r\n * - Returns default empty LConnection if not found\r\n * - Used during connection creation before IDs are assigned\r\n */\r\nexport async function GetUserGhostConnectionId(userId:number, ghostId:number, sessionId:number = 999, randomizer: number = 999){\r\n\r\n let userNode = await UserBinaryTree.getNodeFromTree(userId, sessionId, randomizer);\r\n let realConnection: LConnection = new LConnection(0,0,0,0,0,0);\r\n if(userNode){\r\n for(let i=0 ; i<userNode.connectionValue.length; i++ ){\r\n let testConnection: LConnection = userNode.connectionValue[i];\r\n if(testConnection.ghostId == ghostId){\r\n realConnection = testConnection;\r\n\r\n }\r\n }\r\n }\r\n return realConnection;\r\n}\r\n\r\n/**\r\n * Adds a ghost concept to the UserBinaryTree for temporary storage.\r\n * Stores concepts with ghost IDs before they are persisted.\r\n *\r\n * @async\r\n * @param {LConcept} concept - The local concept to add\r\n * @param {number} userId - The user ID who owns the concept\r\n * @param {number} [sessionId=999] - The session ID (defaults to 999)\r\n *\r\n * @example\r\n * ```typescript\r\n * const ghostConcept: LConcept = {\r\n * ghostId: 12345,\r\n * characterValue: \"Test\",\r\n * ...\r\n * };\r\n * await AddGhostConcept(ghostConcept, 1, 999);\r\n * ```\r\n *\r\n * @remarks\r\n * - Stores concept in UserBinaryTree indexed by userId and sessionId\r\n * - Used for optimistic UI updates before backend persistence\r\n * - No return value (void function)\r\n */\r\nexport async function AddGhostConcept(concept: LConcept, userId: number, sessionId: number = 999){\r\n UserBinaryTree.addConceptToTree(concept,userId, sessionId);\r\n}\r\n\r\n/**\r\n * Adds a ghost connection to the UserBinaryTree for temporary storage.\r\n * Stores connections with ghost IDs before they are persisted.\r\n *\r\n * @async\r\n * @param {LConnection} connection - The local connection to add\r\n * @param {number} userId - The user ID who owns the connection\r\n * @param {number} [sessionId=999] - The session ID (defaults to 999)\r\n *\r\n * @example\r\n * ```typescript\r\n * const ghostConnection: LConnection = new LConnection(0, 12345, 123, 456, 999, 999);\r\n * await AddGhostConnection(ghostConnection, 1, 999);\r\n * ```\r\n *\r\n * @remarks\r\n * - Stores connection in UserBinaryTree indexed by userId and sessionId\r\n * - Used for optimistic UI updates before backend persistence\r\n * - No return value (void function)\r\n */\r\nexport async function AddGhostConnection(connection: LConnection, userId: number, sessionId: number = 999){\r\n UserBinaryTree.addConnectionToTree(connection,userId, sessionId);\r\n}","/**\r\n * @module ViewInternalData\r\n * @description Provides functionality to view and format internal composition data for multiple concepts\r\n */\r\n\r\nimport { ViewInternalDataApi } from \"../../Api/View/ViewInternalDataApi\";\r\nimport { Concept, Connection, FormatFromConnections, GetTheConcept, recursiveFetch } from \"../../app\";\r\n\r\n/**\r\n * Retrieves and formats internal data for multiple concepts by their IDs.\r\n * Fetches internal connections and builds composition structures for each concept.\r\n *\r\n * @async\r\n * @param {number[]} ids - Array of concept IDs to retrieve internal data for\r\n * @returns {Promise<any[]>} A promise that resolves to array of formatted composition objects with id and data fields\r\n *\r\n * @example\r\n * ```typescript\r\n * const conceptIds = [123, 456, 789];\r\n * const internalData = await ViewInternalData(conceptIds);\r\n * // internalData = [\r\n * // { id: 123, data: { user: { name: \"John\", email: \"john@example.com\" } } },\r\n * // { id: 456, data: { post: { title: \"Hello\", content: \"World\" } } },\r\n * // { id: 789, data: { type: \"value\" } }\r\n * // ]\r\n * ```\r\n *\r\n * @remarks\r\n * This function:\r\n * - Fetches internal connections for all provided concept IDs\r\n * - For concepts with connections: builds composition structure using recursiveFetch\r\n * - For concepts without connections: returns concept's type and character value\r\n * - Each result includes id field and data field\r\n * - Handles missing connections gracefully\r\n * - Useful for viewing composition internals in list format\r\n */\r\nexport async function ViewInternalData(ids: number[]){\r\n let connections = await ViewInternalDataApi(ids);\r\n\r\n let output :any[] = [];\r\n for(let i=0; i<ids.length; i++){\r\n let id = ids[i];\r\n let localConnections = connections[id];\r\n\r\n if(id && localConnections){\r\n let concepts: number[] = [];\r\n let formattedOutput :any = {};\r\n for(let j=0 ; j< localConnections.length; j++){\r\n\r\n if(!concepts.includes(localConnections[j].ofTheConceptId)){\r\n concepts.push(localConnections[j].ofTheConceptId);\r\n }\r\n }\r\n let out = await recursiveFetch(id,localConnections, concepts);\r\n formattedOutput.data = out;\r\n formattedOutput.id = id;\r\n\r\n output.push(formattedOutput);\r\n }\r\n else{\r\n let formattedOutput: any = {};\r\n formattedOutput.id = id;\r\n let concept: Concept = await GetTheConcept(id);\r\n let noconn: any = {};\r\n if(concept.type){\r\n noconn[concept?.type?.characterValue] = concept.characterValue;\r\n formattedOutput.data = noconn;\r\n output.push(formattedOutput)\r\n }\r\n\r\n }\r\n\r\n }\r\n\r\n return output;\r\n}","/**\r\n * @fileoverview OAuth API - Handles OAuth token requests for authentication.\r\n * This module provides functions for obtaining and refreshing OAuth access tokens\r\n * from the authentication server.\r\n * @module Services/oauth/CallOauth\r\n */\r\n\r\nimport { BaseUrl } from '../../DataStructures/BaseUrl';\r\nimport { TokenStorage } from '../../DataStructures/Security/TokenStorage';\r\n\r\n/**\r\n * Response from OAuth token request.\r\n * Contains either successful token data or error information.\r\n *\r\n * @interface OAuthResponse\r\n */\r\nexport interface OAuthResponse {\r\n /** Whether the OAuth request was successful */\r\n success: boolean;\r\n /** The OAuth access token (empty if request failed) */\r\n access_token?: string;\r\n /** The token type (typically \"Bearer\") */\r\n token_type?: string;\r\n /** Number of seconds until the token expires */\r\n expires_in?: number;\r\n /** Error message if the request failed */\r\n error?: string;\r\n}\r\n\r\n/**\r\n * Request an OAuth access token from the server.\r\n *\r\n * This function authenticates with the OAuth endpoint using client credentials\r\n * and returns an access token that can be used for API requests.\r\n *\r\n * @async\r\n * @param {string} client_id - The OAuth client ID.\r\n * @param {string} client_secret - The OAuth client secret.\r\n * @param {string} application_name - The name of the application requesting the token.\r\n * @param {boolean} [auto_set_token=true] - If true, automatically sets the token in TokenStorage\r\n * for subsequent API calls.\r\n * @returns {Promise<OAuthResponse>} OAuthResponse with the access token if successful,\r\n * or error details if failed.\r\n *\r\n * @example\r\n * ```typescript\r\n * import { getOAuthToken } from './Services/oauth/CallOauth.service';\r\n *\r\n * const response = await getOAuthToken(\r\n * \"101084838\",\r\n * \"your-client-secret\",\r\n * \"myapp\"\r\n * );\r\n * if (response.success) {\r\n * console.log(`Token: ${response.access_token}`);\r\n * } else {\r\n * console.log(`Error: ${response.error}`);\r\n * }\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Get token without auto-setting\r\n * const response = await getOAuthToken(\r\n * \"101084838\",\r\n * \"secret\",\r\n * \"myapp\",\r\n * false\r\n * );\r\n * // Manually set token later\r\n * if (response.success) {\r\n * TokenStorage.BearerAccessToken = response.access_token || \"\";\r\n * }\r\n * ```\r\n */\r\nexport async function getOAuthToken(\r\n client_id: string,\r\n client_secret: string,\r\n application_name: string,\r\n auto_set_token: boolean = true\r\n): Promise<OAuthResponse> {\r\n try {\r\n const url = BaseUrl.OAuthTokenUrl();\r\n\r\n // Create form data\r\n const formData = new URLSearchParams();\r\n formData.append('client_id', client_id);\r\n formData.append('client_secret', client_secret);\r\n formData.append('application_name', application_name);\r\n\r\n const response = await fetch(url, {\r\n method: 'POST',\r\n headers: {\r\n 'Content-Type': 'application/x-www-form-urlencoded',\r\n },\r\n body: formData.toString(),\r\n });\r\n\r\n if (response.ok) {\r\n let access_token = '';\r\n let token_type = 'Bearer';\r\n let expires_in = 0;\r\n\r\n // Try to parse as JSON first\r\n const contentType = response.headers.get('content-type');\r\n if (contentType && contentType.includes('application/json')) {\r\n try {\r\n const json_data = await response.json();\r\n access_token = json_data.access_token || '';\r\n token_type = json_data.token_type || 'Bearer';\r\n expires_in = json_data.expires_in || 0;\r\n } catch {\r\n // If JSON parsing fails, treat response as the token itself\r\n access_token = await response.text();\r\n }\r\n } else {\r\n // If not JSON, treat response as the token itself\r\n access_token = await response.text();\r\n }\r\n\r\n if (access_token) {\r\n // Auto-set token if requested\r\n if (auto_set_token) {\r\n TokenStorage.setToken(access_token, expires_in);\r\n }\r\n\r\n return {\r\n success: true,\r\n access_token,\r\n token_type,\r\n expires_in,\r\n };\r\n } else {\r\n return {\r\n success: false,\r\n error: 'No access token in response',\r\n };\r\n }\r\n } else {\r\n const error_text = await response.text();\r\n return {\r\n success: false,\r\n error: `HTTP ${response.status}: ${error_text}`,\r\n };\r\n }\r\n } catch (error) {\r\n if (error instanceof TypeError) {\r\n // Network errors\r\n return {\r\n success: false,\r\n error: `Network error: ${error.message}`,\r\n };\r\n } else {\r\n // Other unexpected errors\r\n return {\r\n success: false,\r\n error: `Unexpected error: ${error instanceof Error ? error.message : String(error)}`,\r\n };\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Refresh an OAuth access token using a refresh token.\r\n *\r\n * This function uses a refresh token from a previous authentication to obtain\r\n * a new access token without requiring the user to re-authenticate.\r\n *\r\n * @async\r\n * @param {string} client_id - The OAuth client ID.\r\n * @param {string} client_secret - The OAuth client secret.\r\n * @param {string} refresh_token - The refresh token from a previous authentication.\r\n * @param {boolean} [auto_set_token=true] - If true, automatically sets the new token in TokenStorage.\r\n * @returns {Promise<OAuthResponse>} OAuthResponse with the new access token if successful.\r\n *\r\n * @example\r\n * ```typescript\r\n * import { refreshOAuthToken } from './Services/oauth/CallOauth.service';\r\n *\r\n * const response = await refreshOAuthToken(\r\n * \"101084838\",\r\n * \"your-client-secret\",\r\n * \"your-refresh-token\"\r\n * );\r\n * if (response.success) {\r\n * console.log(`New Token: ${response.access_token}`);\r\n * } else {\r\n * console.log(`Error: ${response.error}`);\r\n * }\r\n * ```\r\n */\r\nexport async function refreshOAuthToken(\r\n client_id: string,\r\n client_secret: string,\r\n refresh_token: string,\r\n auto_set_token: boolean = true\r\n): Promise<OAuthResponse> {\r\n try {\r\n const url = BaseUrl.OAuthRefreshUrl();\r\n\r\n // Create form data\r\n const formData = new URLSearchParams();\r\n formData.append('client_id', client_id);\r\n formData.append('client_secret', client_secret);\r\n formData.append('refresh_token', refresh_token);\r\n formData.append('grant_type', 'refresh_token');\r\n\r\n const response = await fetch(url, {\r\n method: 'POST',\r\n headers: {\r\n 'Content-Type': 'application/x-www-form-urlencoded',\r\n },\r\n body: formData.toString(),\r\n });\r\n\r\n if (response.ok) {\r\n let access_token = '';\r\n let token_type = 'Bearer';\r\n let expires_in = 0;\r\n\r\n // Try to parse as JSON first\r\n const contentType = response.headers.get('content-type');\r\n if (contentType && contentType.includes('application/json')) {\r\n try {\r\n const json_data = await response.json();\r\n access_token = json_data.access_token || '';\r\n token_type = json_data.token_type || 'Bearer';\r\n expires_in = json_data.expires_in || 0;\r\n } catch {\r\n // If JSON parsing fails, treat response as the token itself\r\n access_token = await response.text();\r\n }\r\n } else {\r\n // If not JSON, treat response as the token itself\r\n access_token = await response.text();\r\n }\r\n\r\n if (access_token) {\r\n // Auto-set token if requested\r\n if (auto_set_token) {\r\n TokenStorage.setToken(access_token, expires_in);\r\n }\r\n\r\n return {\r\n success: true,\r\n access_token,\r\n token_type,\r\n expires_in,\r\n };\r\n } else {\r\n return {\r\n success: false,\r\n error: 'No access token in response',\r\n };\r\n }\r\n } else {\r\n const error_text = await response.text();\r\n return {\r\n success: false,\r\n error: `HTTP ${response.status}: ${error_text}`,\r\n };\r\n }\r\n } catch (error) {\r\n if (error instanceof TypeError) {\r\n // Network errors\r\n return {\r\n success: false,\r\n error: `Network error: ${error.message}`,\r\n };\r\n } else {\r\n // Other unexpected errors\r\n return {\r\n success: false,\r\n error: `Unexpected error: ${error instanceof Error ? error.message : String(error)}`,\r\n };\r\n }\r\n }\r\n}\r\n","/**\r\n * @fileoverview Observable wrapper for schema query operations in the CCS-JS system.\r\n * @module WrapperFunctions/SchemaQueryObservable\r\n */\r\n\r\nimport { FreeschemaQueryApi } from \"../Api/Search/FreeschemaQueryApi\";\r\nimport { ALLID, DATAID, DATAV2, JUSTDATA, NORMAL } from \"../Constants/FormatConstants\";\r\nimport { FreeschemaQuery } from \"../DataStructures/Search/FreeschemaQuery\";\r\nimport { DecodeCountInfo } from \"../Services/Common/DecodeCountInfo\";\r\nimport { formatConnections, formatConnectionsDataId, formatConnectionsJustId, formatConnectionsV2 } from \"../Services/Search/SearchWithTypeAndLinker\";\r\n\r\n/**\r\n * Observable wrapper for handling multiple linked concept searches.\r\n *\r\n * @remarks\r\n * SearchLinkMultipleAllObservable encapsulates the state and configuration for executing\r\n * schema queries that retrieve multiple linked concepts. It maintains query parameters,\r\n * formatting options, and the results of API calls including concept IDs, internal\r\n * connections, linkers, and other relationship data.\r\n *\r\n * This class is designed to work with the FreeschemaQuery system and can format results\r\n * in various output formats (NORMAL, DATAID, JUSTDATA, ALLID).\r\n *\r\n * @example\r\n * ```typescript\r\n * const query = new FreeschemaQuery();\r\n * query.outputFormat = DATAID;\r\n * query.order = \"ASC\";\r\n *\r\n * const observable = new SearchLinkMultipleAllObservable(query, \"auth-token\");\r\n * console.log(observable.format); // DATAID\r\n * console.log(observable.order); // \"ASC\"\r\n * ```\r\n */\r\nexport class SearchLinkMultipleAllObservable{\r\n /**\r\n * Array of main composition IDs retrieved from the query.\r\n * @defaultValue []\r\n */\r\n mainCompositionIds: number [] =[];\r\n\r\n /**\r\n * The FreeschemaQuery object containing query parameters and configuration.\r\n * @defaultValue new FreeschemaQuery()\r\n */\r\n query: FreeschemaQuery = new FreeschemaQuery();\r\n\r\n /**\r\n * Array of encoded count information strings returned from the API.\r\n * @defaultValue []\r\n */\r\n countInfoStrings: string [] = [];\r\n\r\n /**\r\n * Sort order for the query results.\r\n * @defaultValue \"DESC\"\r\n */\r\n order: string = \"DESC\";\r\n\r\n /**\r\n * Output format for the query results.\r\n * @defaultValue DATAID\r\n *\r\n * @remarks\r\n * Valid values include NORMAL, DATAID, JUSTDATA, and ALLID from FormatConstants.\r\n */\r\n format: number = DATAID;\r\n\r\n /**\r\n * Flag indicating whether data has been loaded from the API.\r\n * @defaultValue false\r\n */\r\n isDataLoaded: boolean = false;\r\n\r\n /**\r\n * Array of concept IDs retrieved from the query.\r\n * @defaultValue []\r\n */\r\n conceptIds:number[] =[];\r\n\r\n /**\r\n * Array of internal connection IDs showing relationships between concepts.\r\n * @defaultValue []\r\n */\r\n internalConnections:number[] = [];\r\n\r\n /**\r\n * Array of linker IDs representing the types of connections.\r\n * @defaultValue []\r\n */\r\n linkers:number[] = [];\r\n\r\n /**\r\n * Array of reverse relationship indicators.\r\n * @defaultValue []\r\n */\r\n reverse: number[] = [];\r\n\r\n /**\r\n * The processed data result from the query.\r\n *\r\n * @remarks\r\n * The structure and content of this property depends on the format setting.\r\n */\r\n data:any;\r\n\r\n /**\r\n * Creates a new SearchLinkMultipleAllObservable instance.\r\n *\r\n * @param query - The FreeschemaQuery object containing query parameters\r\n * @param token - Authentication token for API requests (currently unused in constructor)\r\n *\r\n * @remarks\r\n * The constructor initializes the observable with the provided query and extracts\r\n * the output format and order settings from the query object. The token parameter\r\n * is accepted but not currently stored or used within the constructor.\r\n *\r\n * @example\r\n * ```typescript\r\n * const query = new FreeschemaQuery();\r\n * query.outputFormat = JUSTDATA;\r\n * query.order = \"ASC\";\r\n *\r\n * const observable = new SearchLinkMultipleAllObservable(query, \"my-token\");\r\n * console.log(observable.format); // JUSTDATA\r\n * console.log(observable.order); // \"ASC\"\r\n * ```\r\n */\r\n constructor(query: FreeschemaQuery, token: string){\r\n this.query = query;\r\n this.format = query.outputFormat;\r\n this.order = query.order;\r\n }\r\n\r\n // async bind() {\r\n // this.isDataLoaded = true;\r\n // this.query.outputFormat = ALLID;\r\n // let result:any = await FreeschemaQueryApi(this.query, \"\");\r\n // this.conceptIds = result.conceptIds;\r\n // this.internalConnections = result.internalConnections;\r\n // this.linkers = result.linkers;\r\n // this.reverse = result.reverse;\r\n // this.mainCompositionIds = result.mainCompositionIds;\r\n // this.countInfoStrings = result.countinfo;\r\n // return await this.build();\r\n // }\r\n\r\n\r\n\r\n}\r\n\r\n\r\n/**\r\n * Executes a schema query and formats the results according to the specified output format.\r\n *\r\n * @param query - The FreeschemaQuery object containing query parameters and configuration\r\n * @param token - Authentication token for API requests\r\n * @returns Promise resolving to formatted query results (structure varies by output format)\r\n *\r\n * @remarks\r\n * This function serves as the main entry point for executing schema queries. It performs\r\n * the following operations:\r\n * 1. Temporarily changes the output format to ALLID to retrieve all relationship data\r\n * 2. Calls the FreeschemaQueryApi to execute the query\r\n * 3. Extracts concept IDs, connections, linkers, and metadata from the result\r\n * 4. Decodes count information strings\r\n * 5. Formats the data according to the original output format setting\r\n *\r\n * The function supports three output formats:\r\n * - DATAID: Formatted with data IDs included\r\n * - JUSTDATA: Formatted with only data, no IDs\r\n * - NORMAL (or any other value): Standard formatting\r\n *\r\n * @example\r\n * ```typescript\r\n * // Create and configure a query\r\n * const query = new FreeschemaQuery();\r\n * query.outputFormat = DATAID;\r\n * query.order = \"DESC\";\r\n * // ... set other query parameters\r\n *\r\n * // Execute the query\r\n * const results = await SchemaQueryListener(query, \"auth-token\");\r\n * console.log(results); // Formatted results based on DATAID format\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Query with JUSTDATA format\r\n * const query = new FreeschemaQuery();\r\n * query.outputFormat = JUSTDATA;\r\n * query.order = \"ASC\";\r\n *\r\n * const results = await SchemaQueryListener(query, \"my-token\");\r\n * // Results contain only data without IDs\r\n * ```\r\n */\r\nexport async function SchemaQueryListener(query: FreeschemaQuery, token: string){\r\n let format = query.outputFormat;\r\n query.outputFormat = ALLID;\r\n let result:any = await FreeschemaQueryApi(query, \"\");\r\n let conceptIds = result.conceptIds;\r\n let internalConnections = result.internalConnections;\r\n let linkers = result.linkers;\r\n let reverse = result.reverse;\r\n let mainCompositionIds = result.mainCompositionIds;\r\n let countInfoStrings = result.countinfo;\r\n let order = query.order;\r\n let data:any;\r\n let countInfos = DecodeCountInfo(countInfoStrings);\r\n\r\n if(format == DATAID){\r\n data = await formatConnectionsDataId(linkers, conceptIds,mainCompositionIds, reverse,countInfos,order);\r\n }\r\n else if(format == JUSTDATA){\r\n data = await formatConnectionsJustId(linkers, conceptIds, mainCompositionIds, reverse, countInfos, order);\r\n }\r\n else if(format == DATAV2){\r\n data = await formatConnectionsV2(linkers, conceptIds,mainCompositionIds, reverse, countInfos,order );\r\n }\r\n else{\r\n\r\n data = await formatConnections(linkers, conceptIds, mainCompositionIds, reverse, countInfos);\r\n\r\n}\r\nreturn data;\r\n}","/**\r\n * Main application module for the Concept Connection System (CCS-JS).\r\n * This module serves as the primary entry point and exports all public-facing APIs,\r\n * data structures, and utilities for managing concepts, connections, and compositions.\r\n *\r\n * @module app\r\n * @see {@link https://documentation.freeschema.com} for detailed documentation\r\n */\r\n\r\nexport {init, updateAccessToken};\r\nexport {getOAuthToken, refreshOAuthToken, OAuthResponse} from './Services/oauth/CallOauth.service';\r\nexport {\r\n requestWithRetry,\r\n postWithRetry,\r\n getWithRetry,\r\n putWithRetry,\r\n deleteWithRetry,\r\n patchWithRetry,\r\n HttpResponse,\r\n TokenRefreshError\r\n} from './Services/Http/HttpClient.service';\r\n\r\nimport CreateBinaryTreeFromData from './Services/CreateBinaryTreeFromData';\r\n\r\nimport { IdentifierFlags } from './DataStructures/IdentifierFlags';\r\n\r\nexport { SplitStrings} from './Services/SplitStrings';\r\nexport { GetRequestHeader, GetRequestHeaderWithAuthorization } from './Services/Security/GetRequestHeader'; \r\nexport { GetCompositionList,GetCompositionListWithId } from './Services/GetCompositionList';\r\nexport { GetCompositionListLocal, GetCompositionListLocalWithId} from './Services/Local/GetCompositionListLocal';\r\nexport {GetAllConnectionsOfComposition} from './Api/GetAllConnectionsOfComposition';\r\nexport {GetComposition,GetCompositionWithId, recursiveFetch,GetCompositionWithAllIds} from './Services/GetComposition';\r\nexport {GetCompositionLocal, GetCompositionLocalWithId} from './Services/Local/GetCompositionLocal';\r\nexport {default as CreateComposition} from './Services/CreateTheComposition';\r\nexport { CreateTheCompositionLocal } from './Services/Local/CreateTheCompositionLocal';\r\nexport {CreateConnectionBetweenTwoConcepts,CreateConnectionBetweenTwoConceptsGeneral} from './Services/CreateConnectionBetweenTwoConcepts';\r\nexport { default as GetTheConcept} from './Services/GetTheConcept';\r\nexport { default as MakeTheInstanceConcept} from './Services/MakeTheInstanceConcept';\r\nexport { MakeTheInstanceConceptLocal} from './Services/Local/MakeTheInstanceConceptLocal';\r\nexport { storeToDatabase,getFromDatabaseWithType,getFromDatabaseWithTypeOld } from './Database/NoIndexDb';\r\nexport { createTheConnection as CreateTheConnection} from './Services/CreateTheConnection';\r\nexport { default as GetConceptByCharacter } from './Services/GetConceptByCharacter';\r\nexport { GetLink,GetLinkRaw } from './Services/GetLink';\r\nexport {CreateDefaultConcept} from './Services/CreateDefaultConcept';\r\nexport {MakeTheTypeConcept} from './Services/MakeTheTypeConcept';\r\nexport {MakeTheTypeConceptApi} from './Api/MakeTheTypeConceptApi';\r\nexport { GetLinkerConnectionFromConcepts, GetLinkerConnectionToConcepts} from './Services/GetLinkerConnectionFromConcept';\r\nexport { DeleteConceptById } from './Services/DeleteConcept';\r\nexport { DeleteConnectionById } from './Services/DeleteConnection';\r\nexport { TrashTheConcept } from './Api/Delete/DeleteConceptInBackend'\r\nexport { GetConnectionById } from './Services/GetConnections';\r\nexport {MakeTheTimestamp} from './Services/MakeTheTimestamp';\r\nexport {RecursiveSearchApi} from './Api/RecursiveSearch';\r\nexport {GetCompositionBulkWithDataId,GetCompositionBulk,GetCompositionFromConnectionsWithDataId} from './Services/GetCompositionBulk';\r\nexport { GetConceptBulk } from './Api/GetConceptBulk';\r\nexport { GetConnectionBulk } from './Api/GetConnectionBulk';\r\nexport {GetAllConnectionsOfCompositionBulk} from './Api/GetAllConnectionsOfCompositionBulk';\r\nexport { LoginToBackend } from './Api/Login';\r\nexport {GetConnectionOfTheConcept} from './Api/GetConnectionOfTheConcept';\r\nexport {default as Signup} from './Api/Signup';\r\nexport { default as Signin} from './Api/Signin';\r\nexport { default as UpdateComposition} from './Services/UpdateComposition';\r\nexport {SearchAllConcepts} from './Api/Search/Search';\r\nexport {SearchWithLinker} from './Api/Search/SearchWithLinker';\r\nexport {GetCompositionWithCache, GetCompositionWithDataIdWithCache, GetCompositionWithDataIdBulk} from './Services/Composition/CompositionCache';\r\nexport {CreateSession} from './Api/Session/CreateSession';\r\nexport {CreateSessionVisit} from './Api/Session/CreateSessionVisit';\r\nexport { } from './Api/GetConceptByCharacterAndType';\r\nexport {GetRelation, GetRelationRaw} from './Services/GetRelation';\r\nexport { recursiveFetchNew} from './Services/Composition/BuildComposition'\r\nexport {CreateTheCompositionWithCache} from './Services/Composition/CreateCompositionCache';\r\nexport {CreateDefaultLConcept} from './Services/Local/CreateDefaultLConcept';\r\nexport { CreateTheConnectionGeneral,CreateConnection} from './Services/CreateTheConnectionGeneral';\r\nexport {CreateTheConnectionLocal} from './Services/Local/CreateTheConnectionLocal';\r\nexport {GetUserGhostId,AddGhostConcept, GetUserGhostConnectionId,AddGhostConnection} from './Services/User/UserTranslation';\r\nexport {SearchLinkMultipleAll,FormatFromConnections} from './Services/Search/SearchLinkMultiple';\r\nexport {UpdateCompositionLocal} from './Services/Local/UpdateCompositionLocal';\r\nexport {GetCompositionFromConnectionsWithDataIdInObject} from './Services/GetCompositionBulk';\r\nexport {ViewInternalData} from './Services/View/ViewInternalData';\r\nexport {convertFromLConceptToConcept} from './Services/Conversion/ConvertConcepts';\r\nexport {SearchLinkInternal} from './Services/Search/SearchLinkInternal';\r\nexport { HandleHttpError } from './Services/Common/ErrorPosting'; \r\nexport {GetConceptByCharacterAndType} from './Api/GetConceptByCharacterAndType';\r\nexport {GetConceptByCharacterAndCategoryDirectApi} from './Api/SearchConcept/GetConceptByCharacterAndCategoryDirect';\r\nexport {SearchLinkMultipleApi} from './Api/Search/SearchLinkMultipleApi';\r\nexport {GetCompositionWithIdFromMemoryFromConnections, GetCompositionWithIdFromMemory} from './Services/GetComposition';\r\nexport {GetConceptByTypeBulk} from './Api/GetConceptByCharacterAndType';\r\nexport {DeleteConnectionByTypeBulk,GetConnectionByTypeBulk} from './Services/Delete/DeleteConnectionByType';\r\n\r\nexport {SyncData} from './DataStructures/SyncData';\r\nexport {Concept} from './DataStructures/Concept';\r\nexport {LConcept} from './DataStructures/Local/LConcept';\r\nexport {LConnection} from './DataStructures/Local/LConnection';\r\nexport {Connection} from './DataStructures/Connection';\r\nexport {ConceptsData} from './DataStructures/ConceptData';\r\nexport { ConnectionData } from './DataStructures/ConnectionData';\r\nexport {BinaryTree} from './DataStructures/BinaryTree';\r\nexport {SearchQuery} from './DataStructures/SearchQuery';\r\nexport {SignupModel} from './DataStructures/SignupModel';\r\nexport {SigninModel} from './DataStructures/SigninModel';\r\nexport {FreeschemaResponse} from './DataStructures/Responses/StandardResponses'\r\nexport {PatcherStructure} from './DataStructures/PatcherStructure';\r\nexport {SessionData} from './DataStructures/Session/SessionData';\r\nexport {Composition} from './DataStructures/Composition/Composition';\r\nexport {CompositionBinaryTree} from './DataStructures/Composition/CompositionBinaryTree';\r\nexport {CompositionNode} from './DataStructures/Composition/CompositionNode';\r\nexport {UserBinaryTree} from './DataStructures/User/UserBinaryTree';\r\nexport {FilterSearch} from './DataStructures/FilterSearch';\r\nexport {SearchStructure} from './DataStructures/Search/SearchStructure';\r\nexport {FreeSchemaResponse} from './DataStructures/Responses/ErrorResponse';\r\nexport {CCSConfig} from './DataStructures/CCSConfig';\r\nimport {GetDataFromIndexDb,GetDataFromIndexDbLocal} from './Services/GetDataFromIndexDb';\r\nimport CreateLocalBinaryTreeFromData from './Services/Local/CreateLocalBinaryTreeFromData';\r\nimport InitializeSystem from './Services/InitializeSystem';\r\nimport { BaseUrl } from './DataStructures/BaseUrl';\r\nimport { TokenStorage } from './DataStructures/Security/TokenStorage';\r\nimport { AccessControlService } from './Services/AccessControl/AccessControlService';\r\nimport { getOAuthToken } from './Services/oauth/CallOauth.service';\r\nimport { CCSConfig } from './DataStructures/CCSConfig';\r\nexport {BaseUrl} from './DataStructures/BaseUrl';\r\nexport {TokenStorage} from './DataStructures/Security/TokenStorage';\r\nexport {SchemaQueryListener} from './WrapperFunctions/SchemaQueryObservable';\r\nexport {FreeschemaQuery} from './DataStructures/Search/FreeschemaQuery';\r\nexport {GiveConnection,GetAllTheConnectionsByTypeAndOfTheConcept} from'./Services/Delete/GetAllConnectionByType';\r\nexport {DATAID, NORMAL, JUSTDATA,ALLID,DATAIDDATE,RAW,LISTNORMAL, DATAV2} from './Constants/FormatConstants';\r\n// export { CheckAccessOfConcept, CheckAccessOfConceptList, FilterConceptListByAccess } from './Services/AccessControl/AccessControlService';\r\nexport { AccessControlService } from './Services/AccessControl/AccessControlService';\r\nexport { PermissionSet } from './Services/AccessControl/PermissionSet';\r\n\r\n\r\nexport {Transaction} from './DataStructures/Transaction/Transaction';\r\n/**\r\n * Updates the bearer access token used for authenticating API requests to the backend.\r\n * This token is stored globally and used by all API calls that require authentication.\r\n *\r\n * @param accessToken - The new bearer access token to use for API authentication. Defaults to empty string if not provided.\r\n *\r\n * @example\r\n * ```typescript\r\n * // Update the access token after user login\r\n * updateAccessToken('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...');\r\n * ```\r\n *\r\n * @see TokenStorage for token storage implementation\r\n * @see https://documentation.freeschema.com for authentication details\r\n */\r\nfunction updateAccessToken(accessToken:string = \"\"){\r\n TokenStorage.BearerAccessToken = accessToken;\r\n}\r\n\r\n/**\r\n * Initializes the Concept Connection System with backend URLs and authentication.\r\n * This is the primary initialization function that must be called before using any CCS features.\r\n * It performs the following operations asynchronously:\r\n *\r\n * 1. Sets up base URLs for the main API and AI services\r\n * 2. Stores the authentication token for API requests (or obtains one via OAuth)\r\n * 3. Initializes the system (database setup)\r\n * 4. Creates binary trees from concept data for efficient querying (by ID, character, and type)\r\n * 5. Creates local binary trees for offline/local concept management\r\n * 6. Loads connection data from IndexedDB into memory\r\n * 7. Loads local connection data for offline operations\r\n *\r\n * All data loading operations run in parallel for optimal performance. The IdentifierFlags\r\n * are updated as each operation completes to indicate which data structures are ready for use.\r\n *\r\n * @param url - The base URL for the main backend API endpoint (e.g., 'https://api.example.com')\r\n * @param nodeUrl - The base URL for the Node.js service endpoint (optional)\r\n * @param applicationName - The name of the application (used for OAuth and logging)\r\n * @param config - Optional CCSConfig object containing all optional configuration parameters\r\n *\r\n * @example\r\n * ```typescript\r\n * // Simple initialization with just URL\r\n * init('https://api.freeschema.com');\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Initialize with access token\r\n * const config = new CCSConfig({\r\n * accessToken: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'\r\n * });\r\n * init('https://api.freeschema.com', '', 'MyApp', config);\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Initialize with OAuth credentials\r\n * const config = new CCSConfig({\r\n * clientId: '101084838',\r\n * clientSecret: 'your-client-secret',\r\n * aiUrl: 'https://ai.freeschema.com',\r\n * enableAi: true\r\n * });\r\n * init('https://api.freeschema.com', '', 'MyApp', config);\r\n * ```\r\n *\r\n * @example\r\n * ```typescript\r\n * // Full configuration\r\n * const config = new CCSConfig({\r\n * aiUrl: 'https://ai.example.com',\r\n * accessToken: 'token',\r\n * enableAi: true,\r\n * flags: {\r\n * logApplication: true,\r\n * accessTracker: true\r\n * },\r\n * parameters: {\r\n * logserver: 'https://logs.example.com'\r\n * },\r\n * storagePath: './data/ccs/'\r\n * });\r\n * init('https://api.example.com', 'http://localhost:5001', 'MyApp', config);\r\n * ```\r\n *\r\n * @remarks\r\n * The initialization process is asynchronous but does not return a Promise. Instead,\r\n * it uses IdentifierFlags to signal when different components are ready:\r\n * - `isDataLoaded`, `isCharacterLoaded`, `isTypeLoaded` - Remote concept data ready\r\n * - `isLocalDataLoaded`, `isLocalTypeLoaded`, `isLocalCharacterLoaded` - Local concept data ready\r\n * - `isConnectionLoaded`, `isConnectionTypeLoaded` - Remote connection data ready\r\n * - `isLocalConnectionLoaded` - Local connection data ready\r\n *\r\n * @see CCSConfig for all available configuration options\r\n * @see IdentifierFlags for checking initialization status\r\n * @see InitializeSystem for database initialization details\r\n * @see CreateBinaryTreeFromData for concept tree creation\r\n * @see https://documentation.freeschema.com/#installation for setup guide\r\n */\r\nfunction init(\r\n url: string = \"\",\r\n nodeUrl: string = \"\",\r\n applicationName: string = \"CCSApp\",\r\n config?: CCSConfig\r\n){\r\n // Apply configuration or use defaults\r\n const cfg = config || new CCSConfig();\r\n\r\n // Set base URLs\r\n BaseUrl.BASE_URL = url;\r\n BaseUrl.AI_URL = cfg.aiUrl;\r\n\r\n if (nodeUrl) {\r\n BaseUrl.NODE_URL = nodeUrl;\r\n }\r\n\r\n console.log(\"This is the base url\", BaseUrl.BASE_URL);\r\n\r\n // Handle authentication: OAuth takes precedence over direct token\r\n if (cfg.hasOAuthCredentials()) {\r\n const appName = cfg.applicationName || applicationName;\r\n\r\n // Store OAuth credentials for automatic token refresh\r\n TokenStorage.setOAuthCredentials(cfg.clientId!, cfg.clientSecret!, appName);\r\n\r\n // Get initial token\r\n getOAuthToken(cfg.clientId!, cfg.clientSecret!, appName, true);\r\n } else if (cfg.hasAccessToken()) {\r\n TokenStorage.BearerAccessToken = cfg.accessToken;\r\n }\r\n\r\n InitializeSystem().then(()=>{\r\n const start = new Date().getTime();\r\n CreateBinaryTreeFromData().then(()=>{\r\n IdentifierFlags.isDataLoaded= true;\r\n IdentifierFlags.isCharacterLoaded= true;\r\n IdentifierFlags.isTypeLoaded= true;\r\n let elapsed = new Date().getTime() - start;\r\n console.log(\"The time taken to prepare concept data is \", elapsed);\r\n });\r\n\r\n CreateLocalBinaryTreeFromData().then(()=>{\r\n IdentifierFlags.isLocalDataLoaded = true;\r\n IdentifierFlags.isLocalTypeLoaded = true;\r\n IdentifierFlags.isLocalCharacterLoaded = true;\r\n let elapsed = new Date().getTime() - start;\r\n console.log(\"The time taken to prepare local concept \", elapsed);\r\n });\r\n\r\n GetDataFromIndexDbLocal().then(()=>{\r\n IdentifierFlags.isLocalConnectionLoaded = true;\r\n });\r\n GetDataFromIndexDb().then(()=>{\r\n IdentifierFlags.isConnectionLoaded = true;\r\n IdentifierFlags.isConnectionTypeLoaded = true;\r\n let elapsed = new Date().getTime() - start;\r\n console.log(\"The time taken to prepare connections \", elapsed);\r\n });\r\n\r\n });\r\n}\r\n\r\n\r\n\r\n\r\n\r\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(\"./src/app.ts\");\n",""],"names":[],"sourceRoot":""}
|