mftsccs-node 0.2.6 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1148 -11
- package/dist/bundle.js +1 -1
- package/dist/types/Api/Create/CreateTheCharacter.d.ts +42 -0
- package/dist/types/Api/Create/CreateTheConceptApi.d.ts +50 -0
- package/dist/types/Api/Create/CreateTheConnectionApi.d.ts +51 -0
- package/dist/types/Api/Create/CreateTheTextData.d.ts +56 -0
- package/dist/types/Api/Delete/DeleteConceptInBackend.d.ts +43 -0
- package/dist/types/Api/DeleteConnectionApiBulk.d.ts +55 -0
- package/dist/types/Api/DeleteTheConcept.d.ts +64 -0
- package/dist/types/Api/DeleteTheConnection.d.ts +76 -0
- package/dist/types/Api/GetAiData.d.ts +36 -0
- package/dist/types/Api/GetAllConcepts.d.ts +42 -0
- package/dist/types/Api/GetAllConceptsByType.d.ts +45 -0
- package/dist/types/Api/GetAllConnections.d.ts +48 -0
- package/dist/types/Api/GetAllConnectionsOfComposition.d.ts +79 -0
- package/dist/types/Api/GetAllConnectionsOfCompositionBulk.d.ts +90 -0
- package/dist/types/Api/GetAllLinkerConnectionsFromTheConcept.d.ts +52 -0
- package/dist/types/Api/GetAllLinkerConnectionsToTheConcept.d.ts +61 -0
- package/dist/types/Api/GetAllPrefetchConnections.d.ts +51 -0
- package/dist/types/Api/GetCharacterDataByCharacter.d.ts +31 -0
- package/dist/types/Api/GetCompositionConnectionsBetweenTwoConcepts.d.ts +39 -0
- package/dist/types/Api/GetConcept.d.ts +47 -0
- package/dist/types/Api/GetConceptBulk.d.ts +68 -0
- package/dist/types/Api/GetConceptByCharacterAndType.d.ts +75 -0
- package/dist/types/Api/GetConceptByCharacterValue.d.ts +47 -0
- package/dist/types/Api/GetConnection.d.ts +49 -0
- package/dist/types/Api/GetConnectionBulk.d.ts +46 -0
- package/dist/types/Api/GetConnectionOfTheConcept.d.ts +50 -0
- package/dist/types/Api/GetConnectionToTheConcept.d.ts +56 -0
- package/dist/types/Api/GetReservedConnectionIds.d.ts +36 -0
- package/dist/types/Api/GetReservedIds.d.ts +37 -0
- package/dist/types/Api/Login.d.ts +38 -0
- package/dist/types/Api/MakeTheNameInBackend.d.ts +39 -0
- package/dist/types/Api/MakeTheTypeConceptApi.d.ts +40 -0
- package/dist/types/Api/RecursiveSearch.d.ts +43 -0
- package/dist/types/Api/Search/FreeschemaQueryApi.d.ts +46 -0
- package/dist/types/Api/Search/Search.d.ts +67 -0
- package/dist/types/Api/Search/SearchInternalApi.d.ts +69 -0
- package/dist/types/Api/Search/SearchLinkMultipleApi.d.ts +90 -0
- package/dist/types/Api/Search/SearchWithLinker.d.ts +97 -0
- package/dist/types/Api/SearchConcept/GetConceptByCharacterAndCategoryApi.d.ts +39 -0
- package/dist/types/Api/SearchConcept/GetConceptByCharacterAndCategoryDirect.d.ts +47 -0
- package/dist/types/Api/Session/CreateSession.d.ts +45 -0
- package/dist/types/Api/Session/CreateSessionVisit.d.ts +43 -0
- package/dist/types/Api/Signin.d.ts +48 -0
- package/dist/types/Api/Signup.d.ts +44 -0
- package/dist/types/Api/View/ViewInternalDataApi.d.ts +50 -0
- package/dist/types/Constants/ApiConstants.d.ts +226 -0
- package/dist/types/Constants/FormatConstants.d.ts +81 -0
- package/dist/types/DataStructures/BaseUrl.d.ts +210 -0
- package/dist/types/DataStructures/BinaryCharacterTree.d.ts +211 -0
- package/dist/types/DataStructures/BinaryTree.d.ts +139 -0
- package/dist/types/DataStructures/BinaryTypeTree.d.ts +196 -0
- package/dist/types/DataStructures/CharacterRepository.d.ts +109 -0
- package/dist/types/DataStructures/Composition/Composition.d.ts +103 -0
- package/dist/types/DataStructures/Composition/CompositionBinaryTree.d.ts +104 -0
- package/dist/types/DataStructures/Composition/CompositionNode.d.ts +202 -0
- package/dist/types/DataStructures/Concept.d.ts +110 -0
- package/dist/types/DataStructures/ConceptData.d.ts +292 -0
- package/dist/types/DataStructures/ConceptsToDraw.d.ts +168 -0
- package/dist/types/DataStructures/Connection.d.ts +76 -0
- package/dist/types/DataStructures/ConnectionBinaryTree/ConnectionBinaryTree.d.ts +115 -0
- package/dist/types/DataStructures/ConnectionBinaryTree/ConnectionNode.d.ts +169 -0
- package/dist/types/DataStructures/ConnectionBinaryTree/ConnectionTypeTree.d.ts +82 -0
- package/dist/types/DataStructures/ConnectionData.d.ts +191 -0
- package/dist/types/DataStructures/Count/CountInfo.d.ts +73 -0
- package/dist/types/DataStructures/FilterSearch.d.ts +84 -0
- package/dist/types/DataStructures/IdentifierFlags.d.ts +34 -0
- package/dist/types/DataStructures/Local/LConcept.d.ts +105 -0
- package/dist/types/DataStructures/Local/LConnection.d.ts +83 -0
- package/dist/types/DataStructures/Local/LNode.d.ts +190 -0
- package/dist/types/DataStructures/Local/LocalBinaryCharacterTree.d.ts +133 -0
- package/dist/types/DataStructures/Local/LocalBinaryTree.d.ts +135 -0
- package/dist/types/DataStructures/Local/LocalBinaryTypeTree.d.ts +147 -0
- package/dist/types/DataStructures/Local/LocalConceptData.d.ts +100 -0
- package/dist/types/DataStructures/Local/LocalConnectionData.d.ts +109 -0
- package/dist/types/DataStructures/Local/LocalSyncData.d.ts +89 -0
- package/dist/types/DataStructures/PatcherStructure.d.ts +86 -0
- package/dist/types/DataStructures/ReferentInfo.d.ts +68 -0
- package/dist/types/DataStructures/ReservedIds.d.ts +101 -0
- package/dist/types/DataStructures/Responses/ErrorResponse.d.ts +184 -22
- package/dist/types/DataStructures/Responses/StandardResponses.d.ts +65 -0
- package/dist/types/DataStructures/Returner.d.ts +59 -0
- package/dist/types/DataStructures/Search/FreeschemaQuery.d.ts +165 -0
- package/dist/types/DataStructures/Search/SearchStructure.d.ts +69 -0
- package/dist/types/DataStructures/SearchQuery.d.ts +130 -0
- package/dist/types/DataStructures/Security/TokenStorage.d.ts +48 -0
- package/dist/types/DataStructures/Session/SessionData.d.ts +118 -0
- package/dist/types/DataStructures/SettingData.d.ts +32 -0
- package/dist/types/DataStructures/Settings.d.ts +27 -0
- package/dist/types/DataStructures/SigninModel.d.ts +50 -0
- package/dist/types/DataStructures/SignupModel.d.ts +50 -0
- package/dist/types/DataStructures/SyncData.d.ts +206 -0
- package/dist/types/DataStructures/TheCharacter.d.ts +87 -0
- package/dist/types/DataStructures/TheTexts.d.ts +92 -0
- package/dist/types/DataStructures/Transaction/Transaction.d.ts +294 -4
- package/dist/types/DataStructures/User/UserBinaryTree.d.ts +117 -0
- package/dist/types/DataStructures/User/UserNode.d.ts +130 -0
- package/dist/types/Database/GetConceptFromIndexDb.d.ts +9 -0
- package/dist/types/Database/NoIndexDb.d.ts +169 -0
- package/dist/types/Database/indexdblocal.d.ts +42 -0
- package/dist/types/Database/indexeddb.d.ts +43 -0
- package/dist/types/Drawing/ConceptDraw.d.ts +28 -0
- package/dist/types/Drawing/ConceptEvents.d.ts +46 -0
- package/dist/types/Helpers/CheckIfExists.d.ts +159 -0
- package/dist/types/Helpers/RemoveFromArray.d.ts +66 -0
- package/dist/types/Helpers/UniqueInsert.d.ts +28 -0
- package/dist/types/Services/CheckForConnectionDeletion.d.ts +190 -0
- package/dist/types/Services/Common/DecodeCountInfo.d.ts +54 -0
- package/dist/types/Services/Common/ErrorPosting.d.ts +49 -0
- package/dist/types/Services/Common/RegexFunction.d.ts +28 -0
- package/dist/types/Services/Composition/BuildComposition.d.ts +37 -0
- package/dist/types/Services/Composition/CompositionCache.d.ts +89 -0
- package/dist/types/Services/Composition/CreateCompositionCache.d.ts +43 -0
- package/dist/types/Services/Conversion/ConvertConcepts.d.ts +83 -0
- package/dist/types/Services/CreateBinaryTreeFromData.d.ts +38 -0
- package/dist/types/Services/CreateCharacterBinaryTreeFromData.d.ts +42 -0
- package/dist/types/Services/CreateConnectionBetweenTwoConcepts.d.ts +206 -0
- package/dist/types/Services/CreateDefaultConcept.d.ts +114 -0
- package/dist/types/Services/CreateTheComposition.d.ts +101 -0
- package/dist/types/Services/CreateTheConcept.d.ts +179 -0
- package/dist/types/Services/CreateTheConnection.d.ts +59 -0
- package/dist/types/Services/CreateTheConnectionGeneral.d.ts +127 -0
- package/dist/types/Services/CreateTypeTreeFromData.d.ts +43 -0
- package/dist/types/Services/Delete/DeleteConnectionByType.d.ts +52 -5
- package/dist/types/Services/Delete/GetAllConnectionByType.d.ts +57 -9
- package/dist/types/Services/DeleteConcept.d.ts +136 -0
- package/dist/types/Services/DeleteConnection.d.ts +194 -0
- package/dist/types/Services/FindConeceptsFromConnection.d.ts +179 -0
- package/dist/types/Services/FindConnectionsOfCompositionBulkInMemory.d.ts +157 -0
- package/dist/types/Services/GenerateHexNumber.d.ts +64 -0
- package/dist/types/Services/GetComposition.d.ts +331 -0
- package/dist/types/Services/GetCompositionBulk.d.ts +251 -3
- package/dist/types/Services/GetCompositionList.d.ts +130 -0
- package/dist/types/Services/GetConceptByCharacter.d.ts +84 -0
- package/dist/types/Services/GetConnections.d.ts +72 -0
- package/dist/types/Services/GetDataFromIndexDb.d.ts +79 -0
- package/dist/types/Services/GetLink.d.ts +104 -0
- package/dist/types/Services/GetLinkerConnectionFromConcept.d.ts +99 -0
- package/dist/types/Services/GetMaximumConnectionSyncTime.d.ts +57 -0
- package/dist/types/Services/GetRelation.d.ts +162 -0
- package/dist/types/Services/GetTheConcept.d.ts +71 -0
- package/dist/types/Services/GetTheReferent.d.ts +74 -0
- package/dist/types/Services/InitializeSystem.d.ts +119 -0
- package/dist/types/Services/Local/CreateDefaultLConcept.d.ts +48 -0
- package/dist/types/Services/Local/CreateLocalBinaryTreeFromData.d.ts +49 -0
- package/dist/types/Services/Local/CreateLocalBinaryTypeTreeFromData.d.ts +54 -0
- package/dist/types/Services/Local/CreateLocalCharacterBinaryTree.d.ts +60 -0
- package/dist/types/Services/Local/CreateTheCompositionLocal.d.ts +70 -0
- package/dist/types/Services/Local/CreateTheConceptLocal.d.ts +58 -0
- package/dist/types/Services/Local/CreateTheConnectionLocal.d.ts +56 -0
- package/dist/types/Services/Local/GetCompositionListLocal.d.ts +103 -0
- package/dist/types/Services/Local/GetCompositionLocal.d.ts +96 -0
- package/dist/types/Services/Local/GetConceptByCharacterLocal.d.ts +57 -0
- package/dist/types/Services/Local/MakeTheConceptLocal.d.ts +71 -0
- package/dist/types/Services/Local/MakeTheInstanceConceptLocal.d.ts +89 -0
- package/dist/types/Services/Local/MakeTheTypeLocal.d.ts +71 -0
- package/dist/types/Services/Local/UpdateCompositionLocal.d.ts +101 -0
- package/dist/types/Services/MakeTheCharacter.d.ts +74 -0
- package/dist/types/Services/MakeTheCharacterData.d.ts +65 -0
- package/dist/types/Services/MakeTheInstanceConcept.d.ts +75 -0
- package/dist/types/Services/MakeTheName.d.ts +81 -0
- package/dist/types/Services/MakeTheTimestamp.d.ts +68 -0
- package/dist/types/Services/MakeTheTypeConcept.d.ts +68 -0
- package/dist/types/Services/Mqtt/publishMessage.d.ts +27 -0
- package/dist/types/Services/Mqtt/subscribeMessage.d.ts +23 -0
- package/dist/types/Services/PatchComposition.d.ts +105 -0
- package/dist/types/Services/Search/DataIdFormat.d.ts +96 -24
- package/dist/types/Services/Search/FormatData.d.ts +92 -17
- package/dist/types/Services/Search/JustIdFormat.d.ts +91 -16
- package/dist/types/Services/Search/SearchLinkInternal.d.ts +28 -0
- package/dist/types/Services/Search/SearchLinkMultiple.d.ts +58 -0
- package/dist/types/Services/Search/SearchWithTypeAndLinker.d.ts +92 -24
- package/dist/types/Services/Search/orderingConnections.d.ts +34 -0
- package/dist/types/Services/SplitStrings.d.ts +50 -0
- package/dist/types/Services/UpdateComposition.d.ts +123 -0
- package/dist/types/Services/User/UserTranslation.d.ts +102 -0
- package/dist/types/Services/View/ViewInternalData.d.ts +32 -0
- package/dist/types/WrapperFunctions/SchemaQueryObservable.d.ts +140 -5
- package/dist/types/app.d.ts +72 -1
- package/package.json +1 -1
- package/dist/main.bundle.js +0 -2
- package/dist/main.bundle.js.LICENSE.txt +0 -1
- package/dist/serviceWorker.bundle.js +0 -2
- package/dist/serviceWorker.bundle.js.LICENSE.txt +0 -1
- package/dist/types/AccessTracker/accessTracker.d.ts +0 -67
- package/dist/types/Anomaly/anomaly.d.ts +0 -103
- package/dist/types/Api/Create/CreateTheGhostConceptApi.d.ts +0 -3
- package/dist/types/Api/Create/CreateTheGhostConnectionApi.d.ts +0 -2
- package/dist/types/Api/Delete/DeleteUserInBackend.d.ts +0 -1
- package/dist/types/Api/DeleteConnectionBulkApi.d.ts +0 -1
- package/dist/types/Api/GetConnections/GetConnectionsByTypeApi.d.ts +0 -3
- package/dist/types/Api/Images/GetImages.d.ts +0 -1
- package/dist/types/Api/Local/GetLocalConceptByCharacterValue.d.ts +0 -2
- package/dist/types/Api/Prototype/CreatePrototype.d.ts +0 -2
- package/dist/types/Api/Prototype/Selector.d.ts +0 -15
- package/dist/types/Api/Search/SearchWithTypeAndLinker.d.ts +0 -2
- package/dist/types/Api/SearchConcept/GetTypeConceptByBulk.d.ts +0 -2
- package/dist/types/Api/Translate/TranslateLocalToReal.d.ts +0 -2
- package/dist/types/Constants/AccessConstants.d.ts +0 -3
- package/dist/types/Constants/ckeditorCSS.d.ts +0 -1
- package/dist/types/Constants/general.const.d.ts +0 -6
- package/dist/types/Constants/page.const.d.ts +0 -5
- package/dist/types/DataStructures/ConnectionBinaryTree/ConnectionOfNode.d.ts +0 -10
- package/dist/types/DataStructures/ConnectionBinaryTree/ConnectionOfTheTree.d.ts +0 -24
- package/dist/types/DataStructures/ConnectionBinaryTree/ConnectionTypeNode.d.ts +0 -10
- package/dist/types/DataStructures/ConnectionBinaryTree/NodePrimitive.d.ts +0 -15
- package/dist/types/DataStructures/ConnectionByType/GetConnectionByType.d.ts +0 -4
- package/dist/types/DataStructures/Local/LocalGhostIdTree.d.ts +0 -11
- package/dist/types/DataStructures/Local/LocalId.d.ts +0 -19
- package/dist/types/DataStructures/Prototype/Prototype.d.ts +0 -19
- package/dist/types/DataStructures/Prototype/PrototypeOption.d.ts +0 -4
- package/dist/types/DataStructures/Prototype/QuerySelector.d.ts +0 -4
- package/dist/types/DataStructures/TypeLibrary.d.ts +0 -19
- package/dist/types/DataStructures/TypeNode.d.ts +0 -18
- package/dist/types/DataStructures/WidgetCache/WidgetCache.d.ts +0 -10
- package/dist/types/DataStructures/WidgetCache/WidgetDetails.d.ts +0 -9
- package/dist/types/DataStructures/WidgetCache/WidgetNode.d.ts +0 -18
- package/dist/types/Database/IndexUpdate.d.ts +0 -47
- package/dist/types/Middleware/ApplicationMonitor.d.ts +0 -14
- package/dist/types/Middleware/ErrorHandling.d.ts +0 -0
- package/dist/types/Middleware/logger.service.d.ts +0 -144
- package/dist/types/ServiceWorker/actions/connectionActions.d.ts +0 -2
- package/dist/types/ServiceWorker/actions/createActions.d.ts +0 -2
- package/dist/types/ServiceWorker/actions/deleteActions.d.ts +0 -2
- package/dist/types/ServiceWorker/actions/getActions.d.ts +0 -2
- package/dist/types/ServiceWorker/actions/index.d.ts +0 -15
- package/dist/types/ServiceWorker/actions/searchActions.d.ts +0 -2
- package/dist/types/ServiceWorker/actions/syncActions.d.ts +0 -2
- package/dist/types/ServiceWorker/actions/updateActions.d.ts +0 -2
- package/dist/types/ServiceWorker/index.d.ts +0 -11
- package/dist/types/Services/AccessControl/AccessControl.d.ts +0 -218
- package/dist/types/Services/Common/DelayFunction.d.ts +0 -7
- package/dist/types/Services/Common/MergeArrays.d.ts +0 -7
- package/dist/types/Services/Common/RemoveAllChild.d.ts +0 -1
- package/dist/types/Services/CreateConnection/CreateConnectionEntity.d.ts +0 -2
- package/dist/types/Services/DeleteConnectionByType.d.ts +0 -22
- package/dist/types/Services/GetConnectionBetweenTwoConceptsLinker.d.ts +0 -11
- package/dist/types/Services/Local/ConvertFromLConceptToConcept.d.ts +0 -2
- package/dist/types/Services/Local/ConvertFromLConnectionToConnection.d.ts +0 -2
- package/dist/types/Services/Local/CreateConnectionBetweenTwoConceptsLocal.d.ts +0 -3
- package/dist/types/Services/Local/DeleteConceptLocal.d.ts +0 -1
- package/dist/types/Services/Local/GetConnectionOfTheConceptLocal.d.ts +0 -2
- package/dist/types/Services/Local/GetRelationLocal.d.ts +0 -1
- package/dist/types/Services/Local/GetTheConceptLocal.d.ts +0 -9
- package/dist/types/Services/Logs/LogEvent.d.ts +0 -1
- package/dist/types/Services/Mail.d.ts +0 -18
- package/dist/types/Services/Transaction/LocalTransaction.d.ts +0 -45
- package/dist/types/Services/Upload.d.ts +0 -33
- package/dist/types/Services/User/UserFromLocalStorage.d.ts +0 -6
- package/dist/types/Services/assets/GetImageService.d.ts +0 -14
- package/dist/types/Services/automated/automated-concept-connection.d.ts +0 -7
- package/dist/types/Services/cacheService.d.ts +0 -1
- package/dist/types/Validator/constant.d.ts +0 -3
- package/dist/types/Validator/interface.d.ts +0 -19
- package/dist/types/Validator/utils.d.ts +0 -7
- package/dist/types/Validator/validator.d.ts +0 -37
- package/dist/types/Visualize/ConceptCircle.d.ts +0 -35
- package/dist/types/Visualize/ConceptCircleList.d.ts +0 -9
- package/dist/types/Visualize/ConnectionLine.d.ts +0 -21
- package/dist/types/Visualize/ConnectionLineList.d.ts +0 -6
- package/dist/types/Visualize/drawExistingConcepts.d.ts +0 -8
- package/dist/types/Visualize/helper.d.ts +0 -15
- package/dist/types/Visualize/index.d.ts +0 -0
- package/dist/types/Widgets/BaseObserver.d.ts +0 -22
- package/dist/types/Widgets/BaseWidget.d.ts +0 -24
- package/dist/types/Widgets/BuilderSpeceficFunctions.d.ts +0 -2
- package/dist/types/Widgets/BuilderStatefulWidget.d.ts +0 -42
- package/dist/types/Widgets/CacheWidget.service.d.ts +0 -17
- package/dist/types/Widgets/NormalizeStyles.service.d.ts +0 -1
- package/dist/types/Widgets/RenderPage.service.d.ts +0 -12
- package/dist/types/Widgets/RenderWidgetLibrary.service.d.ts +0 -14
- package/dist/types/Widgets/RenderWidgetService.d.ts +0 -50
- package/dist/types/Widgets/StatefulWidget.d.ts +0 -102
- package/dist/types/Widgets/WidgetBuild.d.ts +0 -4
- package/dist/types/Widgets/WidgetTree.d.ts +0 -29
- package/dist/types/Widgets/mainView.class.d.ts +0 -6
- package/dist/types/WrapperFunctions/DepenedencyObserver.d.ts +0 -73
- package/dist/types/WrapperFunctions/GetCompositionListObservable.d.ts +0 -19
- package/dist/types/WrapperFunctions/GetCompositionObservable.d.ts +0 -13
- package/dist/types/WrapperFunctions/GetLinkListObservable.d.ts +0 -28
- package/dist/types/WrapperFunctions/GetLinkObservable.d.ts +0 -32
- package/dist/types/WrapperFunctions/RecursiveSearchObservable.d.ts +0 -37
- package/dist/types/WrapperFunctions/SearchLinkMultipleAllObservable.d.ts +0 -15
- package/dist/types/prototype/getPrototype.service.d.ts +0 -2
- package/dist/types/prototype/prototype.service.d.ts +0 -25
- package/dist/types/service-worker.d.ts +0 -1
|
@@ -1,8 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Static repository for managing character data in the CCS-JS system.
|
|
3
|
+
* @module DataStructures/CharacterRepository
|
|
4
|
+
*/
|
|
1
5
|
import { TheCharacter } from "./TheCharacter";
|
|
6
|
+
/**
|
|
7
|
+
* Manages a static collection of character entities with indexed storage and retrieval.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* CharacterRepository provides a centralized, static repository for storing and retrieving
|
|
11
|
+
* TheCharacter instances. Characters are stored in an array indexed by their ID for fast
|
|
12
|
+
* access. The class also provides lookup functionality to find characters by their data value.
|
|
13
|
+
*
|
|
14
|
+
* This repository uses static methods and properties, meaning the character collection is
|
|
15
|
+
* shared across all instances of the class. The instance method `name` is provided for
|
|
16
|
+
* identification purposes only.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* // Add a character to the repository
|
|
21
|
+
* const char = new TheCharacter(1, "A", 100, 1, 200, 1, 300, 1, "2025-10-30", false);
|
|
22
|
+
* CharacterRepository.AddCharacter(char);
|
|
23
|
+
*
|
|
24
|
+
* // Retrieve character by data value
|
|
25
|
+
* const found = CharacterRepository.GetCharacter("A");
|
|
26
|
+
* if (found.id !== 0) {
|
|
27
|
+
* console.log('Found character:', found.data);
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
2
31
|
export declare class CharacterRepository {
|
|
32
|
+
/**
|
|
33
|
+
* Descriptive name for this character repository.
|
|
34
|
+
* @defaultValue "character Repository"
|
|
35
|
+
*/
|
|
3
36
|
name: string;
|
|
37
|
+
/**
|
|
38
|
+
* Creates a new CharacterRepository instance.
|
|
39
|
+
*
|
|
40
|
+
* @remarks
|
|
41
|
+
* While the class can be instantiated, the primary functionality is accessed
|
|
42
|
+
* through static methods. Instances are mainly useful for accessing the descriptive
|
|
43
|
+
* name property.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```typescript
|
|
47
|
+
* const repo = new CharacterRepository();
|
|
48
|
+
* console.log(repo.name); // "character Repository"
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
4
51
|
constructor();
|
|
52
|
+
/**
|
|
53
|
+
* Static array holding all character data indexed by character ID.
|
|
54
|
+
*
|
|
55
|
+
* @remarks
|
|
56
|
+
* Characters are stored at index positions corresponding to their ID values.
|
|
57
|
+
* This provides O(1) access time when retrieving characters by ID, but may
|
|
58
|
+
* result in sparse arrays if character IDs are not sequential.
|
|
59
|
+
*
|
|
60
|
+
* This array should be managed through the static methods provided by the class.
|
|
61
|
+
*/
|
|
5
62
|
static characterData: TheCharacter[];
|
|
63
|
+
/**
|
|
64
|
+
* Adds a character to the repository, indexed by its ID.
|
|
65
|
+
*
|
|
66
|
+
* @param character - The character to add to the repository
|
|
67
|
+
*
|
|
68
|
+
* @remarks
|
|
69
|
+
* The character is stored at the array index matching its ID value. If a character
|
|
70
|
+
* with the same ID already exists, it will be overwritten. This indexed approach
|
|
71
|
+
* allows for fast retrieval by ID but may create sparse arrays.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```typescript
|
|
75
|
+
* const char1 = new TheCharacter(1, "A", 100, 1, 200, 1, 300, 1, "2025-10-30", false);
|
|
76
|
+
* const char2 = new TheCharacter(5, "B", 100, 1, 200, 1, 300, 1, "2025-10-30", false);
|
|
77
|
+
*
|
|
78
|
+
* CharacterRepository.AddCharacter(char1);
|
|
79
|
+
* CharacterRepository.AddCharacter(char2);
|
|
80
|
+
*
|
|
81
|
+
* // char1 is at index 1, char2 is at index 5
|
|
82
|
+
* console.log(CharacterRepository.characterData[1].data); // "A"
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
6
85
|
static AddCharacter(character: TheCharacter): void;
|
|
86
|
+
/**
|
|
87
|
+
* Retrieves a character from the repository by matching its data value.
|
|
88
|
+
*
|
|
89
|
+
* @param value - The data string to search for
|
|
90
|
+
* @returns The matching TheCharacter instance, or a default empty character if not found
|
|
91
|
+
*
|
|
92
|
+
* @remarks
|
|
93
|
+
* Performs a linear search through the entire characterData array to find a character
|
|
94
|
+
* whose `data` property matches the provided value. If no match is found, returns a
|
|
95
|
+
* default TheCharacter instance with ID 0 and data "0".
|
|
96
|
+
*
|
|
97
|
+
* Note: The default character returned has all numeric fields set to 0, data set to "0",
|
|
98
|
+
* and isNew set to false. Callers should check the ID to determine if a valid character
|
|
99
|
+
* was found (a valid character should have a non-zero ID).
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```typescript
|
|
103
|
+
* const char = new TheCharacter(1, "A", 100, 1, 200, 1, 300, 1, "2025-10-30", false);
|
|
104
|
+
* CharacterRepository.AddCharacter(char);
|
|
105
|
+
*
|
|
106
|
+
* // Find existing character
|
|
107
|
+
* const found = CharacterRepository.GetCharacter("A");
|
|
108
|
+
* console.log(found.id); // 1
|
|
109
|
+
*
|
|
110
|
+
* // Search for non-existent character
|
|
111
|
+
* const notFound = CharacterRepository.GetCharacter("Z");
|
|
112
|
+
* console.log(notFound.id); // 0 (default)
|
|
113
|
+
* console.log(notFound.data); // "0" (default)
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
7
116
|
static GetCharacter(value: string): TheCharacter;
|
|
8
117
|
}
|
|
@@ -1,14 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Composition data structure for managing complex concept relationships.
|
|
3
|
+
* This module provides the core Composition class for building and managing hierarchical
|
|
4
|
+
* concept structures with caching and distributed system synchronization.
|
|
5
|
+
* @module DataStructures/Composition/Composition
|
|
6
|
+
*/
|
|
1
7
|
import { Connection } from '../../DataStructures/Connection';
|
|
2
8
|
import { Concept } from '../../DataStructures/Concept';
|
|
9
|
+
/**
|
|
10
|
+
* Represents a composition of concepts and their relationships.
|
|
11
|
+
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* A Composition is a hierarchical structure that combines multiple concepts through connections.
|
|
14
|
+
* It supports caching for performance optimization and can synchronize updates across distributed systems
|
|
15
|
+
* via MQTT messaging. Compositions can contain subcompositions for complex nested structures.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const composition = new Composition();
|
|
20
|
+
* composition.id = 123;
|
|
21
|
+
* composition.mainConcept = myConcept;
|
|
22
|
+
* await composition.updateCache();
|
|
23
|
+
* const data = composition.GetDataCache();
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
3
26
|
export declare class Composition {
|
|
27
|
+
/**
|
|
28
|
+
* Unique identifier for this composition.
|
|
29
|
+
*/
|
|
4
30
|
id: number;
|
|
31
|
+
/**
|
|
32
|
+
* The primary concept at the root of this composition.
|
|
33
|
+
* Defaults to a default concept if not set.
|
|
34
|
+
*/
|
|
5
35
|
mainConcept: Concept;
|
|
36
|
+
/**
|
|
37
|
+
* Array of connections between concepts in this composition.
|
|
38
|
+
*/
|
|
6
39
|
connections: Connection[];
|
|
40
|
+
/**
|
|
41
|
+
* Array of all concepts included in this composition.
|
|
42
|
+
*/
|
|
7
43
|
concepts: Concept[];
|
|
44
|
+
/**
|
|
45
|
+
* Array of IDs referencing nested subcompositions.
|
|
46
|
+
*/
|
|
8
47
|
subcompositions: number[];
|
|
48
|
+
/**
|
|
49
|
+
* Cached composition data for performance optimization.
|
|
50
|
+
* Stores the processed composition structure.
|
|
51
|
+
*/
|
|
9
52
|
cached: any;
|
|
53
|
+
/**
|
|
54
|
+
* Updates the composition cache by recursively fetching related data.
|
|
55
|
+
*
|
|
56
|
+
* @returns A promise that resolves when the cache is updated
|
|
57
|
+
*
|
|
58
|
+
* @remarks
|
|
59
|
+
* This method performs the following operations:
|
|
60
|
+
* 1. Sets the mainConcept if not already set (by matching ID with concepts array)
|
|
61
|
+
* 2. Recursively fetches all related concepts, connections, and subcompositions
|
|
62
|
+
* 3. Stores the result in the cached property for fast retrieval
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```typescript
|
|
66
|
+
* await composition.updateCache();
|
|
67
|
+
* console.log("Cache updated:", composition.cached);
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
10
70
|
updateCache(): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* Publishes a composition update message to the distributed system.
|
|
73
|
+
*
|
|
74
|
+
* @remarks
|
|
75
|
+
* This method broadcasts an update notification via MQTT to inform other
|
|
76
|
+
* system components that this composition has been modified. Only publishes
|
|
77
|
+
* if the composition has a valid (non-zero) ID.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```typescript
|
|
81
|
+
* composition.UpdateAcrossDistributedSystem();
|
|
82
|
+
* // Other system nodes will receive the update notification
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
11
85
|
UpdateAcrossDistributedSystem(): void;
|
|
86
|
+
/**
|
|
87
|
+
* Triggers a distributed system update notification.
|
|
88
|
+
*
|
|
89
|
+
* @remarks
|
|
90
|
+
* This is a convenience method that calls UpdateAcrossDistributedSystem.
|
|
91
|
+
* Indicates that the composition is being updated and needs to notify other system nodes.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```typescript
|
|
95
|
+
* composition.isUpdating();
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
12
98
|
isUpdating(): void;
|
|
99
|
+
/**
|
|
100
|
+
* Retrieves the cached composition data in a structured format.
|
|
101
|
+
*
|
|
102
|
+
* @returns An object containing the formatted cache data with the composition ID
|
|
103
|
+
*
|
|
104
|
+
* @remarks
|
|
105
|
+
* The returned object has the following structure:
|
|
106
|
+
* - `data`: An object keyed by the main concept's type characterValue
|
|
107
|
+
* - `id`: The composition's ID
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```typescript
|
|
111
|
+
* const cacheData = composition.GetDataCache();
|
|
112
|
+
* console.log("Composition ID:", cacheData.id);
|
|
113
|
+
* console.log("Cached data:", cacheData.data);
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
13
116
|
GetDataCache(): any;
|
|
14
117
|
}
|
|
@@ -1,10 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Binary tree data structure for managing compositions.
|
|
3
|
+
* This module provides an efficient AVL tree implementation for storing and retrieving compositions.
|
|
4
|
+
* @module DataStructures/Composition/CompositionBinaryTree
|
|
5
|
+
*/
|
|
1
6
|
import { Composition } from './Composition';
|
|
2
7
|
import { CompositionNode } from './CompositionNode';
|
|
8
|
+
/**
|
|
9
|
+
* Binary tree data structure for managing compositions with automatic expiration.
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* This class implements an AVL tree specifically designed for storing Composition objects.
|
|
13
|
+
* Each node in the tree has an expiration time, allowing automatic cache invalidation.
|
|
14
|
+
* The tree provides O(log n) operations for insert, search, and delete.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const composition = new Composition();
|
|
19
|
+
* composition.id = 123;
|
|
20
|
+
* CompositionBinaryTree.addCompositionToTree(composition);
|
|
21
|
+
* const node = await CompositionBinaryTree.getNodeFromTree(123);
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
3
24
|
export declare class CompositionBinaryTree {
|
|
25
|
+
/**
|
|
26
|
+
* The root node of the composition binary tree.
|
|
27
|
+
* Null if the tree is empty.
|
|
28
|
+
*/
|
|
4
29
|
static root: CompositionNode | null;
|
|
30
|
+
/**
|
|
31
|
+
* Adds a composition node to the binary tree.
|
|
32
|
+
*
|
|
33
|
+
* @param node - The CompositionNode to be added to the tree
|
|
34
|
+
* @returns The root node after insertion
|
|
35
|
+
*
|
|
36
|
+
* @remarks
|
|
37
|
+
* If the tree is empty, the provided node becomes the root.
|
|
38
|
+
* Otherwise, the node is inserted using AVL tree balancing algorithm.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* const node = new CompositionNode(123, composition, null, null);
|
|
43
|
+
* CompositionBinaryTree.addNodeToTree(node);
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
5
46
|
static addNodeToTree(node: CompositionNode): CompositionNode | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Creates a node from a composition and adds it to the tree.
|
|
49
|
+
*
|
|
50
|
+
* @param composition - The Composition object to be added to the tree
|
|
51
|
+
*
|
|
52
|
+
* @remarks
|
|
53
|
+
* This is a convenience method that wraps the composition in a CompositionNode
|
|
54
|
+
* and adds it to the tree. The node is keyed by the composition's ID.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```typescript
|
|
58
|
+
* const composition = new Composition();
|
|
59
|
+
* composition.id = 123;
|
|
60
|
+
* CompositionBinaryTree.addCompositionToTree(composition);
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
6
63
|
static addCompositionToTree(composition: Composition): void;
|
|
64
|
+
/**
|
|
65
|
+
* Retrieves a composition node from the tree by its ID.
|
|
66
|
+
*
|
|
67
|
+
* @param id - The numeric ID of the composition to retrieve
|
|
68
|
+
* @returns The CompositionNode if found and valid, null otherwise
|
|
69
|
+
*
|
|
70
|
+
* @remarks
|
|
71
|
+
* This method performs a binary search through the tree.
|
|
72
|
+
* The node's validity is checked during retrieval (expiration check).
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```typescript
|
|
76
|
+
* const node = await CompositionBinaryTree.getNodeFromTree(123);
|
|
77
|
+
* if (node) {
|
|
78
|
+
* console.log("Found composition:", node.value);
|
|
79
|
+
* }
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
7
82
|
static getNodeFromTree(id: number): Promise<CompositionNode | null>;
|
|
83
|
+
/**
|
|
84
|
+
* Removes a composition node from the tree by its ID.
|
|
85
|
+
*
|
|
86
|
+
* @param id - The numeric ID of the composition to remove
|
|
87
|
+
*
|
|
88
|
+
* @remarks
|
|
89
|
+
* This method removes a node from the tree while maintaining AVL balance.
|
|
90
|
+
* The tree is automatically rebalanced after removal.
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```typescript
|
|
94
|
+
* await CompositionBinaryTree.removeNodeFromTree(123);
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
8
97
|
static removeNodeFromTree(id: number): Promise<void>;
|
|
98
|
+
/**
|
|
99
|
+
* Counts the total number of nodes in the tree.
|
|
100
|
+
*
|
|
101
|
+
* @returns The total number of composition nodes in the tree
|
|
102
|
+
*
|
|
103
|
+
* @remarks
|
|
104
|
+
* This method recursively traverses the entire tree to count all nodes.
|
|
105
|
+
* Returns 0 if the tree is empty.
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```typescript
|
|
109
|
+
* const count = CompositionBinaryTree.countNumberOfNodes();
|
|
110
|
+
* console.log(`Tree contains ${count} compositions`);
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
9
113
|
static countNumberOfNodes(): number;
|
|
10
114
|
}
|
|
@@ -1,21 +1,223 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Node implementation for the CompositionBinaryTree.
|
|
3
|
+
* This module provides the CompositionNode class with AVL tree operations and automatic expiration.
|
|
4
|
+
* @module DataStructures/Composition/CompositionNode
|
|
5
|
+
*/
|
|
1
6
|
import { Composition } from './Composition';
|
|
7
|
+
/**
|
|
8
|
+
* Represents a node in the composition binary tree with time-based expiration.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* CompositionNode implements an AVL tree node specifically for Composition objects.
|
|
12
|
+
* Each node has a 10-minute expiration time for automatic cache invalidation.
|
|
13
|
+
* The node supports all standard AVL tree operations including rotations and balancing.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const composition = new Composition();
|
|
18
|
+
* const node = new CompositionNode(123, composition, null, null);
|
|
19
|
+
* if (node.isValid()) {
|
|
20
|
+
* console.log("Node is still valid");
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
2
24
|
export declare class CompositionNode {
|
|
25
|
+
/**
|
|
26
|
+
* The expiration timestamp for this node.
|
|
27
|
+
* Defaults to 10 minutes from creation time.
|
|
28
|
+
*/
|
|
3
29
|
expiryTime: Date;
|
|
30
|
+
/**
|
|
31
|
+
* The unique key used for tree ordering (composition ID).
|
|
32
|
+
*/
|
|
4
33
|
key: number;
|
|
34
|
+
/**
|
|
35
|
+
* The Composition object stored in this node.
|
|
36
|
+
*/
|
|
5
37
|
value: Composition;
|
|
38
|
+
/**
|
|
39
|
+
* Reference to the left child node.
|
|
40
|
+
* Null if no left child exists.
|
|
41
|
+
*/
|
|
6
42
|
leftNode: CompositionNode | null;
|
|
43
|
+
/**
|
|
44
|
+
* Reference to the right child node.
|
|
45
|
+
* Null if no right child exists.
|
|
46
|
+
*/
|
|
7
47
|
rightNode: CompositionNode | null;
|
|
48
|
+
/**
|
|
49
|
+
* The height of this node in the tree.
|
|
50
|
+
* Used for AVL tree balancing calculations.
|
|
51
|
+
*/
|
|
8
52
|
height: number;
|
|
53
|
+
/**
|
|
54
|
+
* Creates a new CompositionNode.
|
|
55
|
+
*
|
|
56
|
+
* @param key - The unique identifier for this node (composition ID)
|
|
57
|
+
* @param value - The Composition object to store
|
|
58
|
+
* @param leftNode - The left child node (or null)
|
|
59
|
+
* @param rightNode - The right child node (or null)
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```typescript
|
|
63
|
+
* const node = new CompositionNode(123, composition, null, null);
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
9
66
|
constructor(key: number, value: Composition, leftNode: CompositionNode | null, rightNode: CompositionNode | null);
|
|
67
|
+
/**
|
|
68
|
+
* Checks if this node is still valid (not expired).
|
|
69
|
+
*
|
|
70
|
+
* @returns True if the node is valid, false if expired
|
|
71
|
+
*
|
|
72
|
+
* @remarks
|
|
73
|
+
* If the node has expired, it automatically removes itself from the tree.
|
|
74
|
+
* This ensures automatic cache invalidation after 10 minutes.
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```typescript
|
|
78
|
+
* if (node.isValid()) {
|
|
79
|
+
* console.log("Node data is still fresh");
|
|
80
|
+
* } else {
|
|
81
|
+
* console.log("Node has expired and been removed");
|
|
82
|
+
* }
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
10
85
|
isValid(): boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Saves data to the composition's cache.
|
|
88
|
+
*
|
|
89
|
+
* @param data - The data to be cached in the composition
|
|
90
|
+
*
|
|
91
|
+
* @remarks
|
|
92
|
+
* This is a convenience method to update the cached property of the stored composition.
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```typescript
|
|
96
|
+
* node.saveToCache({ processed: true, data: [...] });
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
11
99
|
saveToCache(data: any): void;
|
|
100
|
+
/**
|
|
101
|
+
* Adds a new node to the tree with AVL balancing.
|
|
102
|
+
*
|
|
103
|
+
* @param passedNode - The node to be added
|
|
104
|
+
* @param node - The current node being evaluated
|
|
105
|
+
* @param height - The height of the current node
|
|
106
|
+
* @returns The root node after insertion and balancing
|
|
107
|
+
*
|
|
108
|
+
* @remarks
|
|
109
|
+
* This method implements the AVL tree insertion algorithm with automatic balancing.
|
|
110
|
+
* Performs left and right rotations as needed to maintain O(log n) performance.
|
|
111
|
+
* Also validates nodes during insertion to remove expired entries.
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```typescript
|
|
115
|
+
* const newNode = new CompositionNode(456, newComposition, null, null);
|
|
116
|
+
* node.addNode(newNode, node, node.height);
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
12
119
|
addNode(passedNode: CompositionNode, node: CompositionNode | null, height: number): CompositionNode | null;
|
|
120
|
+
/**
|
|
121
|
+
* Performs a right rotation on the given node.
|
|
122
|
+
*
|
|
123
|
+
* @param y - The node to rotate right
|
|
124
|
+
* @returns The new root node after rotation
|
|
125
|
+
*
|
|
126
|
+
* @remarks
|
|
127
|
+
* Right rotation is an AVL tree operation used to rebalance the tree when
|
|
128
|
+
* the left subtree is too heavy. Updates heights after rotation.
|
|
129
|
+
*/
|
|
13
130
|
rightRotate(y: CompositionNode | null): CompositionNode | null;
|
|
131
|
+
/**
|
|
132
|
+
* Performs a left rotation on the given node.
|
|
133
|
+
*
|
|
134
|
+
* @param x - The node to rotate left
|
|
135
|
+
* @returns The new root node after rotation
|
|
136
|
+
*
|
|
137
|
+
* @remarks
|
|
138
|
+
* Left rotation is an AVL tree operation used to rebalance the tree when
|
|
139
|
+
* the right subtree is too heavy. Updates heights after rotation.
|
|
140
|
+
*/
|
|
14
141
|
leftRotate(x: CompositionNode | null): CompositionNode | null;
|
|
142
|
+
/**
|
|
143
|
+
* Gets the height of a node.
|
|
144
|
+
*
|
|
145
|
+
* @param node - The node to get the height from
|
|
146
|
+
* @returns The height of the node, or 0 if null
|
|
147
|
+
*
|
|
148
|
+
* @remarks
|
|
149
|
+
* Height is used for AVL tree balancing calculations.
|
|
150
|
+
*/
|
|
15
151
|
getHeight(node: CompositionNode | null): number;
|
|
152
|
+
/**
|
|
153
|
+
* Calculates the balance factor of a node.
|
|
154
|
+
*
|
|
155
|
+
* @param N - The node to calculate the balance factor for
|
|
156
|
+
* @returns The balance factor (difference between left and right heights)
|
|
157
|
+
*
|
|
158
|
+
* @remarks
|
|
159
|
+
* Balance factor is used to determine if rotations are needed.
|
|
160
|
+
* Values > 1 or < -1 indicate an unbalanced tree.
|
|
161
|
+
*/
|
|
16
162
|
getBalanceFactor(N: CompositionNode | null): number;
|
|
163
|
+
/**
|
|
164
|
+
* Retrieves a node from the tree by its ID.
|
|
165
|
+
*
|
|
166
|
+
* @param id - The composition ID to search for
|
|
167
|
+
* @param node - The current node being evaluated
|
|
168
|
+
* @returns The matching CompositionNode if found and valid, null otherwise
|
|
169
|
+
*
|
|
170
|
+
* @remarks
|
|
171
|
+
* Performs a binary search through the tree. Validates nodes during retrieval.
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* ```typescript
|
|
175
|
+
* const foundNode = node.getFromNode(123, rootNode);
|
|
176
|
+
* ```
|
|
177
|
+
*/
|
|
17
178
|
getFromNode(id: number, node: CompositionNode | null): CompositionNode | null;
|
|
179
|
+
/**
|
|
180
|
+
* Removes a node from the tree by its ID.
|
|
181
|
+
*
|
|
182
|
+
* @param passedNode - The current node being evaluated
|
|
183
|
+
* @param id - The composition ID to remove
|
|
184
|
+
* @returns The root node after removal
|
|
185
|
+
*
|
|
186
|
+
* @remarks
|
|
187
|
+
* Implements standard BST deletion with in-order successor replacement.
|
|
188
|
+
* Maintains tree structure by replacing removed nodes with their successors.
|
|
189
|
+
*
|
|
190
|
+
* @example
|
|
191
|
+
* ```typescript
|
|
192
|
+
* const newRoot = node.removeNode(rootNode, 123);
|
|
193
|
+
* ```
|
|
194
|
+
*/
|
|
18
195
|
removeNode(passedNode: CompositionNode | null, id: number): CompositionNode | null;
|
|
196
|
+
/**
|
|
197
|
+
* Counts all nodes below and including the given node.
|
|
198
|
+
*
|
|
199
|
+
* @param root - The root node to start counting from
|
|
200
|
+
* @returns The total number of nodes in the subtree
|
|
201
|
+
*
|
|
202
|
+
* @remarks
|
|
203
|
+
* Recursively traverses the entire subtree to count all nodes.
|
|
204
|
+
*
|
|
205
|
+
* @example
|
|
206
|
+
* ```typescript
|
|
207
|
+
* const count = node.countNodeBelow(rootNode);
|
|
208
|
+
* console.log(`Subtree contains ${count} nodes`);
|
|
209
|
+
* ```
|
|
210
|
+
*/
|
|
19
211
|
countNodeBelow(root: CompositionNode | null): number;
|
|
212
|
+
/**
|
|
213
|
+
* Finds the in-order successor of a node.
|
|
214
|
+
*
|
|
215
|
+
* @param root - The node to find the successor from
|
|
216
|
+
* @returns The in-order successor node (leftmost node in right subtree)
|
|
217
|
+
*
|
|
218
|
+
* @remarks
|
|
219
|
+
* Used during node deletion to find the replacement node.
|
|
220
|
+
* Traverses left until finding a node with no left child.
|
|
221
|
+
*/
|
|
20
222
|
inOrderSuccessor(root: CompositionNode): CompositionNode;
|
|
21
223
|
}
|
|
@@ -1,3 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core data structure representing a Concept in the Freeschema system.
|
|
3
|
+
* A Concept is the fundamental unit of knowledge/data with metadata for typing,
|
|
4
|
+
* categorization, security, and relationships. Concepts can reference other concepts
|
|
5
|
+
* through type, category, and referent relationships.
|
|
6
|
+
*
|
|
7
|
+
* @module DataStructures/Concept
|
|
8
|
+
* @see https://documentation.freeschema.com/#concept for concept documentation
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Represents a concept with all its metadata and relationships.
|
|
12
|
+
* A Concept is a typed, categorized piece of data with security controls,
|
|
13
|
+
* timestamps, and the ability to reference other concepts.
|
|
14
|
+
*
|
|
15
|
+
* @class Concept
|
|
16
|
+
*
|
|
17
|
+
* @property id - Unique identifier for this concept
|
|
18
|
+
* @property ghostId - Ghost identifier used for local/offline concepts before backend sync
|
|
19
|
+
* @property userId - The ID of the user who owns/created this concept
|
|
20
|
+
* @property typeId - The ID of the concept that defines this concept's type
|
|
21
|
+
* @property typeUserId - The user ID of the type concept owner
|
|
22
|
+
* @property categoryId - The ID of the concept that categorizes this concept
|
|
23
|
+
* @property categoryUserId - The user ID of the category concept owner
|
|
24
|
+
* @property referentId - The ID of the concept this concept refers to (0 if none)
|
|
25
|
+
* @property referentUserId - The user ID of the referent concept owner
|
|
26
|
+
* @property characterValue - The string/text content representing this concept's value
|
|
27
|
+
* @property securityId - The ID of the security concept controlling access rules
|
|
28
|
+
* @property securityUserId - The user ID of the security concept owner
|
|
29
|
+
* @property accessId - The ID of the access concept defining permissions
|
|
30
|
+
* @property accessUserId - The user ID of the access concept owner
|
|
31
|
+
* @property sessionInformationId - The ID of the session concept for tracking
|
|
32
|
+
* @property sessionInformationUserId - The user ID of the session concept owner
|
|
33
|
+
* @property entryTimeStamp - Timestamp when this concept was created
|
|
34
|
+
* @property updatedTimeStamp - Timestamp when this concept was last updated
|
|
35
|
+
* @property referent - Reference to the actual Concept object this concept refers to (lazy loaded)
|
|
36
|
+
* @property type - Reference to the actual Concept object defining this concept's type (lazy loaded)
|
|
37
|
+
* @property isNew - Flag indicating if this concept is newly created and needs backend sync
|
|
38
|
+
* @property updateRecursion - Flag enabling recursive updates through composition hierarchies
|
|
39
|
+
* @property isTemp - Flag indicating if this is a temporary concept (not persisted to backend)
|
|
40
|
+
* @property x - X coordinate for UI visualization/drawing
|
|
41
|
+
* @property y - Y coordinate for UI visualization/drawing
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* // Create a concept representing a person
|
|
46
|
+
* const person = new Concept(
|
|
47
|
+
* 1001, // id
|
|
48
|
+
* 1, // userId
|
|
49
|
+
* 20, 1, // typeId (Person type), typeUserId
|
|
50
|
+
* 10, 1, // categoryId (People category), categoryUserId
|
|
51
|
+
* 0, 0, // referentId (no referent), referentUserId
|
|
52
|
+
* 'John Doe', // characterValue
|
|
53
|
+
* 30, 1, // securityId, securityUserId
|
|
54
|
+
* 40, 1, // accessId, accessUserId
|
|
55
|
+
* 50, 1, // sessionInformationId, sessionInformationUserId
|
|
56
|
+
* true, // isNew
|
|
57
|
+
* new Date(), // entryTimeStamp
|
|
58
|
+
* new Date() // updatedTimeStamp
|
|
59
|
+
* );
|
|
60
|
+
*
|
|
61
|
+
* console.log(person.characterValue); // 'John Doe'
|
|
62
|
+
* console.log(person.isNew); // true
|
|
63
|
+
* person.getType(); // Logs the typeId
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* @remarks
|
|
67
|
+
* The Concept class implements a flexible, self-describing data model where:
|
|
68
|
+
* - Every concept has a type (which is itself a concept)
|
|
69
|
+
* - Every concept belongs to a category (which is itself a concept)
|
|
70
|
+
* - Concepts can refer to other concepts via the referent relationship
|
|
71
|
+
* - Security and access control are handled through concept references
|
|
72
|
+
* - All metadata is versioned with timestamps
|
|
73
|
+
* - Concepts support both backend-synced and local-only (temporary) modes
|
|
74
|
+
*
|
|
75
|
+
* @see ConceptsData for the global concept storage and management
|
|
76
|
+
* @see CreateTheConcept for creating new concepts
|
|
77
|
+
* @see https://documentation.freeschema.com/#concept for detailed concept documentation
|
|
78
|
+
*/
|
|
1
79
|
export declare class Concept {
|
|
2
80
|
x: number;
|
|
3
81
|
y: number;
|
|
@@ -24,6 +102,38 @@ export declare class Concept {
|
|
|
24
102
|
isNew: boolean;
|
|
25
103
|
updateRecursion: boolean;
|
|
26
104
|
isTemp: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Creates a new Concept instance with all required metadata.
|
|
107
|
+
*
|
|
108
|
+
* @param id - Unique identifier for this concept
|
|
109
|
+
* @param userId - The ID of the user who owns this concept
|
|
110
|
+
* @param typeId - The ID of the type concept defining this concept's type
|
|
111
|
+
* @param typeUserId - The user ID of the type concept owner
|
|
112
|
+
* @param categoryId - The ID of the category concept this belongs to
|
|
113
|
+
* @param categoryUserId - The user ID of the category concept owner
|
|
114
|
+
* @param referentId - The ID of the referent concept (0 if none)
|
|
115
|
+
* @param referentUserId - The user ID of the referent concept owner
|
|
116
|
+
* @param characterValue - The string value representing this concept
|
|
117
|
+
* @param securityId - The ID of the security concept for access control
|
|
118
|
+
* @param securityUserId - The user ID of the security concept owner
|
|
119
|
+
* @param accessId - The ID of the access concept defining permissions
|
|
120
|
+
* @param accessUserId - The user ID of the access concept owner
|
|
121
|
+
* @param sessionId - The ID of the session concept for tracking
|
|
122
|
+
* @param sessionUserId - The user ID of the session concept owner
|
|
123
|
+
* @param isNew - Whether this is a newly created concept needing sync (default: false)
|
|
124
|
+
* @param entryTimeStamp - Creation timestamp
|
|
125
|
+
* @param updatedTimeStamp - Last update timestamp
|
|
126
|
+
*/
|
|
27
127
|
constructor(id: number, userId: number, typeId: number, typeUserId: number, categoryId: number, categoryUserId: number, referentId: number, referentUserId: number, characterValue: string, securityId: number, securityUserId: number, accessId: number, accessUserId: number, sessionId: number, sessionUserId: number, isNew: boolean | undefined, entryTimeStamp: Date | string, updatedTimeStamp: Date | string);
|
|
128
|
+
/**
|
|
129
|
+
* Logs the typeId of this concept to the console.
|
|
130
|
+
* This is a utility method for debugging and inspecting the concept's type.
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* ```typescript
|
|
134
|
+
* const concept = new Concept(...);
|
|
135
|
+
* concept.getType(); // Logs the typeId to console
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
28
138
|
getType(): void;
|
|
29
139
|
}
|