mftsccs-node 0.0.56 → 0.0.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1148 -11
- package/dist/bundle.js +1 -0
- package/dist/types/Api/Create/CreateTheCharacter.d.ts +45 -0
- package/dist/types/Api/Create/CreateTheConceptApi.d.ts +52 -0
- package/dist/types/Api/Create/CreateTheConnectionApi.d.ts +53 -0
- package/dist/types/Api/Create/CreateTheTextData.d.ts +58 -0
- package/dist/types/Api/Delete/DeleteConceptInBackend.d.ts +44 -0
- package/dist/types/Api/DeleteConnectionApiBulk.d.ts +56 -0
- package/dist/types/Api/DeleteTheConcept.d.ts +65 -0
- package/dist/types/Api/DeleteTheConnection.d.ts +77 -0
- package/dist/types/Api/GetAiData.d.ts +37 -0
- package/dist/types/Api/GetAllConcepts.d.ts +43 -0
- package/dist/types/Api/GetAllConceptsByType.d.ts +46 -0
- package/dist/types/Api/GetAllConnections.d.ts +49 -0
- package/dist/types/Api/GetAllConnectionsOfComposition.d.ts +82 -0
- package/dist/types/Api/GetAllConnectionsOfCompositionBulk.d.ts +93 -0
- package/dist/types/Api/GetAllLinkerConnectionsFromTheConcept.d.ts +54 -0
- package/dist/types/Api/GetAllLinkerConnectionsToTheConcept.d.ts +63 -0
- package/dist/types/Api/GetAllPrefetchConnections.d.ts +52 -0
- package/dist/types/Api/GetCharacterDataByCharacter.d.ts +33 -0
- package/dist/types/Api/GetCompositionConnectionsBetweenTwoConcepts.d.ts +41 -0
- package/dist/types/Api/GetConcept.d.ts +49 -0
- package/dist/types/Api/GetConceptBulk.d.ts +71 -0
- package/dist/types/Api/GetConceptByCharacterAndType.d.ts +78 -0
- package/dist/types/Api/GetConceptByCharacterValue.d.ts +49 -0
- package/dist/types/Api/GetConnection.d.ts +51 -0
- package/dist/types/Api/GetConnectionBulk.d.ts +48 -0
- package/dist/types/Api/GetConnectionOfTheConcept.d.ts +52 -0
- package/dist/types/Api/GetConnectionToTheConcept.d.ts +58 -0
- package/dist/types/Api/GetReservedConnectionIds.d.ts +37 -0
- package/dist/types/Api/GetReservedIds.d.ts +38 -0
- package/dist/types/Api/Login.d.ts +39 -0
- package/dist/types/Api/MakeTheNameInBackend.d.ts +40 -0
- package/dist/types/Api/MakeTheTypeConceptApi.d.ts +42 -0
- package/dist/types/Api/RecursiveSearch.d.ts +44 -0
- package/dist/types/Api/Search/FreeschemaQueryApi.d.ts +48 -0
- package/dist/types/Api/Search/Search.d.ts +68 -0
- package/dist/types/Api/Search/SearchInternalApi.d.ts +71 -0
- package/dist/types/Api/Search/SearchLinkMultipleApi.d.ts +92 -0
- package/dist/types/Api/Search/SearchWithLinker.d.ts +99 -0
- package/dist/types/Api/SearchConcept/GetConceptByCharacterAndCategoryApi.d.ts +41 -0
- package/dist/types/Api/SearchConcept/GetConceptByCharacterAndCategoryDirect.d.ts +49 -0
- package/dist/types/Api/Session/CreateSession.d.ts +47 -0
- package/dist/types/Api/Session/CreateSessionVisit.d.ts +44 -0
- package/dist/types/Api/Signin.d.ts +51 -0
- package/dist/types/Api/Signup.d.ts +47 -0
- package/dist/types/Api/View/ViewInternalDataApi.d.ts +51 -0
- package/dist/types/Constants/ApiConstants.d.ts +249 -0
- package/dist/types/Constants/FormatConstants.d.ts +87 -0
- package/dist/types/DataStructures/BaseUrl.d.ts +262 -0
- package/dist/types/DataStructures/BinaryCharacterTree.d.ts +227 -0
- package/dist/types/DataStructures/BinaryTree.d.ts +151 -0
- package/dist/types/DataStructures/BinaryTypeTree.d.ts +211 -0
- package/dist/types/DataStructures/CharacterRepository.d.ts +117 -0
- package/dist/types/DataStructures/Composition/Composition.d.ts +117 -0
- package/dist/types/DataStructures/Composition/CompositionBinaryTree.d.ts +114 -0
- package/dist/types/DataStructures/Composition/CompositionNode.d.ts +223 -0
- package/dist/types/DataStructures/Concept.d.ts +139 -0
- package/dist/types/DataStructures/ConceptData.d.ts +317 -0
- package/dist/types/DataStructures/ConceptsToDraw.d.ts +179 -0
- package/dist/types/DataStructures/Connection.d.ts +103 -0
- package/dist/types/DataStructures/ConnectionBinaryTree/ConnectionBinaryTree.d.ts +126 -0
- package/dist/types/DataStructures/ConnectionBinaryTree/ConnectionNode.d.ts +193 -0
- package/dist/types/DataStructures/ConnectionBinaryTree/ConnectionTypeTree.d.ts +95 -0
- package/dist/types/DataStructures/ConnectionData.d.ts +209 -0
- package/dist/types/DataStructures/Count/CountInfo.d.ts +79 -0
- package/dist/types/DataStructures/FilterSearch.d.ts +93 -0
- package/dist/types/DataStructures/IdentifierFlags.d.ts +45 -0
- package/dist/types/DataStructures/Local/LConcept.d.ts +126 -0
- package/dist/types/DataStructures/Local/LConnection.d.ts +101 -0
- package/dist/types/DataStructures/Local/LNode.d.ts +217 -0
- package/dist/types/DataStructures/Local/LocalBinaryCharacterTree.d.ts +145 -0
- package/dist/types/DataStructures/Local/LocalBinaryTree.d.ts +147 -0
- package/dist/types/DataStructures/Local/LocalBinaryTypeTree.d.ts +160 -0
- package/dist/types/DataStructures/Local/LocalConceptData.d.ts +114 -0
- package/dist/types/DataStructures/Local/LocalConnectionData.d.ts +125 -0
- package/dist/types/DataStructures/Local/LocalSyncData.d.ts +103 -0
- package/dist/types/DataStructures/Node.d.ts +29 -0
- package/dist/types/DataStructures/PatcherStructure.d.ts +94 -0
- package/dist/types/DataStructures/ReferentInfo.d.ts +75 -0
- package/dist/types/DataStructures/ReservedIds.d.ts +111 -0
- package/dist/types/DataStructures/Responses/ErrorResponse.d.ts +236 -0
- package/dist/types/DataStructures/Responses/StandardResponses.d.ts +71 -0
- package/dist/types/DataStructures/Returner.d.ts +66 -0
- package/dist/types/DataStructures/Search/FreeschemaQuery.d.ts +187 -0
- package/dist/types/DataStructures/Search/SearchStructure.d.ts +78 -0
- package/dist/types/DataStructures/SearchQuery.d.ts +146 -0
- package/dist/types/DataStructures/Security/TokenStorage.d.ts +51 -0
- package/dist/types/DataStructures/Session/SessionData.d.ts +131 -0
- package/dist/types/DataStructures/SettingData.d.ts +37 -0
- package/dist/types/DataStructures/Settings.d.ts +31 -0
- package/dist/types/DataStructures/SigninModel.d.ts +54 -0
- package/dist/types/DataStructures/SignupModel.d.ts +54 -0
- package/dist/types/DataStructures/SyncData.d.ts +232 -0
- package/dist/types/DataStructures/TheCharacter.d.ts +100 -0
- package/dist/types/DataStructures/TheTexts.d.ts +106 -0
- package/dist/types/DataStructures/Transaction/Transaction.d.ts +320 -0
- package/dist/types/DataStructures/User/UserBinaryTree.d.ts +132 -0
- package/dist/types/DataStructures/User/UserNode.d.ts +150 -0
- package/dist/types/Database/GetConceptFromIndexDb.d.ts +9 -0
- package/dist/types/Database/NoIndexDb.d.ts +178 -0
- package/dist/types/Database/indexdblocal.d.ts +45 -0
- package/dist/types/Database/indexeddb.d.ts +46 -0
- package/dist/types/Drawing/ConceptDraw.d.ts +29 -0
- package/dist/types/Drawing/ConceptEvents.d.ts +47 -0
- package/dist/types/Helpers/CheckIfExists.d.ts +169 -0
- package/dist/types/Helpers/RemoveFromArray.d.ts +72 -0
- package/dist/types/Helpers/UniqueInsert.d.ts +29 -0
- package/dist/types/Services/CheckForConnectionDeletion.d.ts +193 -0
- package/dist/types/Services/Common/DecodeCountInfo.d.ts +57 -0
- package/dist/types/Services/Common/ErrorPosting.d.ts +51 -0
- package/dist/types/Services/Common/RegexFunction.d.ts +29 -0
- package/dist/types/Services/Composition/BuildComposition.d.ts +40 -0
- package/dist/types/Services/Composition/CompositionCache.d.ts +93 -0
- package/dist/types/Services/Composition/CreateCompositionCache.d.ts +46 -0
- package/dist/types/Services/ConceptFinding/GetConceptByCharacterAndCategory.d.ts +5 -0
- package/dist/types/Services/Conversion/ConvertConcepts.d.ts +90 -0
- package/dist/types/Services/CreateBinaryTreeFromData.d.ts +39 -0
- package/dist/types/Services/CreateCharacterBinaryTreeFromData.d.ts +43 -0
- package/dist/types/Services/CreateConnectionBetweenTwoConcepts.d.ts +211 -0
- package/dist/types/Services/CreateDefaultConcept.d.ts +117 -0
- package/dist/types/Services/CreateTheComposition.d.ts +103 -0
- package/dist/types/Services/CreateTheConcept.d.ts +184 -0
- package/dist/types/Services/CreateTheConnection.d.ts +61 -0
- package/dist/types/Services/CreateTheConnectionGeneral.d.ts +132 -0
- package/dist/types/Services/CreateTypeTreeFromData.d.ts +44 -0
- package/dist/types/Services/Delete/DeleteConnectionByType.d.ts +60 -0
- package/dist/types/Services/Delete/GetAllConnectionByType.d.ts +64 -0
- package/dist/types/Services/DeleteConcept.d.ts +137 -0
- package/dist/types/Services/DeleteConnection.d.ts +196 -0
- package/dist/types/Services/FindConeceptsFromConnection.d.ts +181 -0
- package/dist/types/Services/FindConnectionsOfCompositionBulkInMemory.d.ts +159 -0
- package/dist/types/Services/GenerateHexNumber.d.ts +65 -0
- package/dist/types/Services/GetAccessIdOfUser.d.ts +0 -0
- package/dist/types/Services/GetComposition.d.ts +342 -0
- package/dist/types/Services/GetCompositionBulk.d.ts +259 -0
- package/dist/types/Services/GetCompositionList.d.ts +132 -0
- package/dist/types/Services/GetConceptByCharacter.d.ts +87 -0
- package/dist/types/Services/GetConnections.d.ts +74 -0
- package/dist/types/Services/GetDataFromIndexDb.d.ts +81 -0
- package/dist/types/Services/GetLink.d.ts +107 -0
- package/dist/types/Services/GetLinkerConnectionFromConcept.d.ts +102 -0
- package/dist/types/Services/GetMaximumConnectionSyncTime.d.ts +59 -0
- package/dist/types/Services/GetRelation.d.ts +167 -0
- package/dist/types/Services/GetTheConcept.d.ts +73 -0
- package/dist/types/Services/GetTheReferent.d.ts +76 -0
- package/dist/types/Services/InitializeSystem.d.ts +121 -0
- package/dist/types/Services/Local/CreateConnectionListFromDatat.d.ts +0 -0
- package/dist/types/Services/Local/CreateDefaultLConcept.d.ts +50 -0
- package/dist/types/Services/Local/CreateLocalBinaryTreeFromData.d.ts +50 -0
- package/dist/types/Services/Local/CreateLocalBinaryTypeTreeFromData.d.ts +55 -0
- package/dist/types/Services/Local/CreateLocalCharacterBinaryTree.d.ts +61 -0
- package/dist/types/Services/Local/CreateTheCompositionLocal.d.ts +72 -0
- package/dist/types/Services/Local/CreateTheConceptLocal.d.ts +60 -0
- package/dist/types/Services/Local/CreateTheConnectionLocal.d.ts +58 -0
- package/dist/types/Services/Local/GetCompositionListLocal.d.ts +105 -0
- package/dist/types/Services/Local/GetCompositionLocal.d.ts +98 -0
- package/dist/types/Services/Local/GetConceptByCharacterLocal.d.ts +58 -0
- package/dist/types/Services/Local/MakeTheConceptLocal.d.ts +73 -0
- package/dist/types/Services/Local/MakeTheInstanceConceptLocal.d.ts +91 -0
- package/dist/types/Services/Local/MakeTheTypeLocal.d.ts +73 -0
- package/dist/types/Services/Local/UpdateCompositionLocal.d.ts +103 -0
- package/dist/types/Services/MakeTheCharacter.d.ts +76 -0
- package/dist/types/Services/MakeTheCharacterData.d.ts +67 -0
- package/dist/types/Services/MakeTheConcept.d.ts +2 -0
- package/dist/types/Services/MakeTheInstanceConcept.d.ts +78 -0
- package/dist/types/Services/MakeTheLocalConcept.d.ts +0 -0
- package/dist/types/Services/MakeTheName.d.ts +83 -0
- package/dist/types/Services/MakeTheTimestamp.d.ts +70 -0
- package/dist/types/Services/MakeTheTypeConcept.d.ts +71 -0
- package/dist/types/Services/Mqtt/publishMessage.d.ts +28 -0
- package/dist/types/Services/Mqtt/subscribeMessage.d.ts +23 -0
- package/dist/types/Services/PatchComposition.d.ts +107 -0
- package/dist/types/Services/Search/DataIdFormat.d.ts +104 -0
- package/dist/types/Services/Search/FormatData.d.ts +101 -0
- package/dist/types/Services/Search/JustIdFormat.d.ts +98 -0
- package/dist/types/Services/Search/SearchLinkInternal.d.ts +30 -0
- package/dist/types/Services/Search/SearchLinkMultiple.d.ts +61 -0
- package/dist/types/Services/Search/SearchWithTypeAndLinker.d.ts +101 -0
- package/dist/types/Services/Search/orderingConnections.d.ts +36 -0
- package/dist/types/Services/Security/GetRequestHeader.d.ts +10 -0
- package/dist/types/Services/SplitStrings.d.ts +51 -0
- package/dist/types/Services/UpdateComposition.d.ts +125 -0
- package/dist/types/Services/User/UserTranslation.d.ts +108 -0
- package/dist/types/Services/View/ViewInternalData.d.ts +33 -0
- package/dist/types/WrapperFunctions/SchemaQueryObservable.d.ts +159 -0
- package/dist/types/app.d.ts +162 -0
- package/package.json +1 -1
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Static repository for managing concepts to be drawn/rendered in the CCS-JS system.
|
|
3
|
+
* @module DataStructures/ConceptsToDraw
|
|
4
|
+
*/
|
|
5
|
+
import { Concept } from "./Concept";
|
|
6
|
+
/**
|
|
7
|
+
* Manages a static collection of concepts that need to be drawn or rendered.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* ConceptsToDraw acts as a singleton-like repository using static methods and properties
|
|
11
|
+
* to manage a collection of Concept instances. It provides functionality to add, remove,
|
|
12
|
+
* check existence, and retrieve concepts by ID. This is typically used for maintaining
|
|
13
|
+
* a render queue or active concept list in visualization components.
|
|
14
|
+
*
|
|
15
|
+
* The class uses static methods for all operations, meaning the concept array is shared
|
|
16
|
+
* across all instances of the class. The instance method `getName()` is provided for
|
|
17
|
+
* identification purposes.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* // Add concepts to the collection
|
|
22
|
+
* const concept1 = new Concept(...);
|
|
23
|
+
* ConceptsToDraw.AddConcept(concept1);
|
|
24
|
+
*
|
|
25
|
+
* // Check if a concept exists
|
|
26
|
+
* if (ConceptsToDraw.CheckContains(concept1)) {
|
|
27
|
+
* console.log('Concept is in the draw queue');
|
|
28
|
+
* }
|
|
29
|
+
*
|
|
30
|
+
* // Retrieve a concept by ID
|
|
31
|
+
* const retrieved = ConceptsToDraw.GetConcept(concept1.id);
|
|
32
|
+
*
|
|
33
|
+
* // Remove when done
|
|
34
|
+
* ConceptsToDraw.RemoveConcept(concept1);
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare class ConceptsToDraw {
|
|
38
|
+
/**
|
|
39
|
+
* Descriptive name for this concepts collection.
|
|
40
|
+
* @defaultValue "concepts To Draw"
|
|
41
|
+
*/
|
|
42
|
+
name: string;
|
|
43
|
+
/**
|
|
44
|
+
* Creates a new ConceptsToDraw instance.
|
|
45
|
+
*
|
|
46
|
+
* @remarks
|
|
47
|
+
* While the class can be instantiated, the primary functionality is accessed
|
|
48
|
+
* through static methods. Instances are mainly useful for accessing the `name`
|
|
49
|
+
* property via the `getName()` method.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* const conceptsToDraw = new ConceptsToDraw();
|
|
54
|
+
* console.log(conceptsToDraw.getName()); // "concepts To Draw"
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
constructor();
|
|
58
|
+
/**
|
|
59
|
+
* Static array holding all concepts that are queued to be drawn.
|
|
60
|
+
*
|
|
61
|
+
* @remarks
|
|
62
|
+
* This array is shared across all instances and should be managed through
|
|
63
|
+
* the static methods provided by the class. Direct manipulation is not recommended.
|
|
64
|
+
*/
|
|
65
|
+
static conceptsArray: Concept[];
|
|
66
|
+
/**
|
|
67
|
+
* Checks whether a concept already exists in the collection.
|
|
68
|
+
*
|
|
69
|
+
* @param concept - The concept to check for existence
|
|
70
|
+
* @returns `true` if the concept exists (matched by ID), `false` otherwise
|
|
71
|
+
*
|
|
72
|
+
* @remarks
|
|
73
|
+
* Performs a linear search through the conceptsArray comparing concept IDs.
|
|
74
|
+
* This method is used internally by `AddConcept` to prevent duplicates.
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```typescript
|
|
78
|
+
* const concept = new Concept(...);
|
|
79
|
+
* ConceptsToDraw.AddConcept(concept);
|
|
80
|
+
*
|
|
81
|
+
* if (ConceptsToDraw.CheckContains(concept)) {
|
|
82
|
+
* console.log('Concept already exists');
|
|
83
|
+
* }
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
static CheckContains(concept: Concept): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Adds a concept to the collection if it doesn't already exist.
|
|
89
|
+
*
|
|
90
|
+
* @param concept - The concept to add to the collection
|
|
91
|
+
*
|
|
92
|
+
* @remarks
|
|
93
|
+
* This method ensures no duplicate concepts are added by first checking
|
|
94
|
+
* existence via `CheckContains`. Only concepts with unique IDs will be added.
|
|
95
|
+
* If a concept with the same ID already exists, the method silently returns
|
|
96
|
+
* without adding the duplicate.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```typescript
|
|
100
|
+
* const concept1 = new Concept(...);
|
|
101
|
+
* const concept2 = new Concept(...);
|
|
102
|
+
*
|
|
103
|
+
* ConceptsToDraw.AddConcept(concept1);
|
|
104
|
+
* ConceptsToDraw.AddConcept(concept2);
|
|
105
|
+
* ConceptsToDraw.AddConcept(concept1); // Won't add duplicate
|
|
106
|
+
*
|
|
107
|
+
* console.log(ConceptsToDraw.conceptsArray.length); // 2
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
static AddConcept(concept: Concept): void;
|
|
111
|
+
/**
|
|
112
|
+
* Removes a concept from the collection by matching its ID.
|
|
113
|
+
*
|
|
114
|
+
* @param concept - The concept to remove from the collection
|
|
115
|
+
*
|
|
116
|
+
* @remarks
|
|
117
|
+
* Performs a linear search to find and remove the concept with a matching ID.
|
|
118
|
+
* Uses `Array.splice()` to remove the element. If multiple concepts with the
|
|
119
|
+
* same ID exist (which shouldn't happen with proper usage of AddConcept), only
|
|
120
|
+
* the first match is removed.
|
|
121
|
+
*
|
|
122
|
+
* If the concept doesn't exist in the array, the method completes without error.
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```typescript
|
|
126
|
+
* const concept = new Concept(...);
|
|
127
|
+
* ConceptsToDraw.AddConcept(concept);
|
|
128
|
+
*
|
|
129
|
+
* // Later, when no longer needed
|
|
130
|
+
* ConceptsToDraw.RemoveConcept(concept);
|
|
131
|
+
*
|
|
132
|
+
* // Verify removal
|
|
133
|
+
* console.log(ConceptsToDraw.CheckContains(concept)); // false
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
static RemoveConcept(concept: Concept): void;
|
|
137
|
+
/**
|
|
138
|
+
* Retrieves a concept from the collection by its ID.
|
|
139
|
+
*
|
|
140
|
+
* @param id - The unique identifier of the concept to retrieve
|
|
141
|
+
* @returns The Concept object if found, or `null` if no matching concept exists
|
|
142
|
+
*
|
|
143
|
+
* @remarks
|
|
144
|
+
* Performs a linear search through the conceptsArray to find a concept with
|
|
145
|
+
* the matching ID. Returns the first match found. If no concept with the
|
|
146
|
+
* specified ID exists, returns `null`.
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```typescript
|
|
150
|
+
* const concept = new Concept(...);
|
|
151
|
+
* ConceptsToDraw.AddConcept(concept);
|
|
152
|
+
*
|
|
153
|
+
* // Retrieve by ID
|
|
154
|
+
* const retrieved = ConceptsToDraw.GetConcept(concept.id);
|
|
155
|
+
* if (retrieved) {
|
|
156
|
+
* console.log('Found concept:', retrieved.id);
|
|
157
|
+
* } else {
|
|
158
|
+
* console.log('Concept not found');
|
|
159
|
+
* }
|
|
160
|
+
* ```
|
|
161
|
+
*/
|
|
162
|
+
static GetConcept(id: number): Concept | null;
|
|
163
|
+
/**
|
|
164
|
+
* Gets the descriptive name of this concepts collection.
|
|
165
|
+
*
|
|
166
|
+
* @returns The name string "concepts To Draw"
|
|
167
|
+
*
|
|
168
|
+
* @remarks
|
|
169
|
+
* This is an instance method (unlike the other methods which are static),
|
|
170
|
+
* so it requires an instance of ConceptsToDraw to call.
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* ```typescript
|
|
174
|
+
* const conceptsToDraw = new ConceptsToDraw();
|
|
175
|
+
* console.log(conceptsToDraw.getName()); // "concepts To Draw"
|
|
176
|
+
* ```
|
|
177
|
+
*/
|
|
178
|
+
getName(): string;
|
|
179
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Connection module for the Concept Connection System (CCS-JS).
|
|
3
|
+
* This module defines the Connection class which represents relationships between concepts.
|
|
4
|
+
* @module DataStructures/Connection
|
|
5
|
+
*/
|
|
6
|
+
import { Concept } from "./Concept";
|
|
7
|
+
/**
|
|
8
|
+
* Represents a connection (relationship) between two concepts in the CCS system.
|
|
9
|
+
* Connections link concepts together and define semantic relationships with type, order, security, and access control.
|
|
10
|
+
*
|
|
11
|
+
* @class Connection
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const connection = new Connection(
|
|
15
|
+
* 0, // id
|
|
16
|
+
* 123, // ofTheConceptId
|
|
17
|
+
* 456, // toTheConceptId
|
|
18
|
+
* 1, 1, // userIds
|
|
19
|
+
* 1, // userId
|
|
20
|
+
* 10, 1, // type
|
|
21
|
+
* 0, 0, // order
|
|
22
|
+
* 0, 0, // security
|
|
23
|
+
* 0, 0, // access
|
|
24
|
+
* 0, 0 // sessionInfo
|
|
25
|
+
* );
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare class Connection {
|
|
29
|
+
/** Unique identifier for this connection */
|
|
30
|
+
id: number;
|
|
31
|
+
/** User ID of the connection owner */
|
|
32
|
+
userId: number;
|
|
33
|
+
/** Ghost ID for tracking temporary connections before persistence */
|
|
34
|
+
ghostId: number;
|
|
35
|
+
/** ID of the source concept in this connection */
|
|
36
|
+
ofTheConceptId: number;
|
|
37
|
+
/** ID of the target concept in this connection */
|
|
38
|
+
toTheConceptId: number;
|
|
39
|
+
/** User ID of the source concept owner */
|
|
40
|
+
ofTheConceptUserId: number;
|
|
41
|
+
/** User ID of the target concept owner */
|
|
42
|
+
toTheConceptUserId: number;
|
|
43
|
+
/** Timestamp when the connection was created */
|
|
44
|
+
entryTimeStamp: Date | string;
|
|
45
|
+
/** Termination date for the connection (if applicable) */
|
|
46
|
+
terminationDateTime: Date;
|
|
47
|
+
/** Type ID defining the semantic meaning of this connection */
|
|
48
|
+
typeId: number;
|
|
49
|
+
/** User ID of the type concept owner */
|
|
50
|
+
typeUserId: number;
|
|
51
|
+
/** Order ID for sorting connections */
|
|
52
|
+
orderId: number;
|
|
53
|
+
/** User ID of the order concept owner */
|
|
54
|
+
orderUserId: number;
|
|
55
|
+
/** Security concept ID controlling access permissions */
|
|
56
|
+
securityId: number;
|
|
57
|
+
/** User ID of the security concept owner */
|
|
58
|
+
securityUserId: number;
|
|
59
|
+
/** Access control concept ID */
|
|
60
|
+
accessId: number;
|
|
61
|
+
/** User ID of the access concept owner */
|
|
62
|
+
accessUserId: number;
|
|
63
|
+
/** Session information concept ID for tracking connection context */
|
|
64
|
+
sessionInformationId: number;
|
|
65
|
+
/** User ID of the session information concept owner */
|
|
66
|
+
sessionInformationUserId: number;
|
|
67
|
+
/** Local synchronization timestamp for offline support */
|
|
68
|
+
localSyncTime: Date;
|
|
69
|
+
/** Flag indicating if this is a temporary connection not yet persisted */
|
|
70
|
+
isTemp: boolean;
|
|
71
|
+
/** Flag indicating if this connection needs to be updated */
|
|
72
|
+
toUpdate: boolean;
|
|
73
|
+
/** The type concept object providing semantic meaning to this connection */
|
|
74
|
+
type: Concept;
|
|
75
|
+
/**
|
|
76
|
+
* Creates a new Connection instance.
|
|
77
|
+
*
|
|
78
|
+
* @param {number} [id=0] - Unique identifier for the connection
|
|
79
|
+
* @param {number} ofTheConceptId - Source concept ID
|
|
80
|
+
* @param {number} toTheConceptId - Target concept ID
|
|
81
|
+
* @param {number} ofTheConceptUserId - User ID of source concept owner
|
|
82
|
+
* @param {number} toTheConceptUserId - User ID of target concept owner
|
|
83
|
+
* @param {number} userId - User ID of connection creator
|
|
84
|
+
* @param {number} typeId - Connection type ID
|
|
85
|
+
* @param {number} typeUserId - User ID of type concept owner
|
|
86
|
+
* @param {number} orderId - Order concept ID for sorting
|
|
87
|
+
* @param {number} orderUserId - User ID of order concept owner
|
|
88
|
+
* @param {number} securityId - Security concept ID
|
|
89
|
+
* @param {number} securityUserId - User ID of security concept owner
|
|
90
|
+
* @param {number} accessId - Access control concept ID
|
|
91
|
+
* @param {number} accessUserId - User ID of access concept owner
|
|
92
|
+
* @param {number} sessionInformationId - Session information concept ID
|
|
93
|
+
* @param {number} sessionInformationUserId - User ID of session information concept owner
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```typescript
|
|
97
|
+
* const connection = new Connection(
|
|
98
|
+
* 1, 100, 200, 1, 1, 1, 5, 1, 0, 0, 0, 0, 0, 0, 0, 0
|
|
99
|
+
* );
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
constructor(id: number | undefined, ofTheConceptId: number, toTheConceptId: number, ofTheConceptUserId: number, toTheConceptUserId: number, userId: number, typeId: number, typeUserId: number, orderId: number, orderUserId: number, securityId: number, securityUserId: number, accessId: number, accessUserId: number, sessionInformationId: number, sessionInformationUserId: number);
|
|
103
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Binary tree data structure for managing connections.
|
|
3
|
+
* This module provides an AVL tree implementation for efficient storage and retrieval of Connection objects.
|
|
4
|
+
* @module DataStructures/ConnectionBinaryTree/ConnectionBinaryTree
|
|
5
|
+
*/
|
|
6
|
+
import { Connection } from "../../DataStructures/Connection";
|
|
7
|
+
import { ConnectionNode } from "./ConnectionNode";
|
|
8
|
+
/**
|
|
9
|
+
* Binary tree data structure for managing connections with efficient ID-based lookup.
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* This class implements a self-balancing AVL tree for storing Connection objects.
|
|
13
|
+
* It provides O(log n) search, insertion, and deletion operations. The tree supports
|
|
14
|
+
* asynchronous data loading with timeout capabilities and integrates with the
|
|
15
|
+
* IdentifierFlags system for data synchronization.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const connection = new Connection(123, ...);
|
|
20
|
+
* ConnectionBinaryTree.addConnectionToTree(connection);
|
|
21
|
+
* const node = await ConnectionBinaryTree.getNodeFromTree(123);
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare class ConnectionBinaryTree {
|
|
25
|
+
/**
|
|
26
|
+
* The root node of the connection binary tree.
|
|
27
|
+
* Null if the tree is empty.
|
|
28
|
+
*/
|
|
29
|
+
static connectionroot: ConnectionNode | null;
|
|
30
|
+
/**
|
|
31
|
+
* Adds a connection node to the binary tree.
|
|
32
|
+
*
|
|
33
|
+
* @param node - The ConnectionNode 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 the AVL tree balancing algorithm.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* const node = new ConnectionNode(123, connection, null, null);
|
|
43
|
+
* ConnectionBinaryTree.addNodeToTree(node);
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
static addNodeToTree(node: ConnectionNode): ConnectionNode | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Creates a node from a connection and adds it to the tree.
|
|
49
|
+
*
|
|
50
|
+
* @param connection - The Connection object to be added to the tree
|
|
51
|
+
*
|
|
52
|
+
* @remarks
|
|
53
|
+
* This is a convenience method that wraps the connection in a ConnectionNode
|
|
54
|
+
* and adds it to the tree. The node is keyed by the connection's ID.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```typescript
|
|
58
|
+
* const connection = new Connection(123, 1, 2, 3, 4, 5);
|
|
59
|
+
* ConnectionBinaryTree.addConnectionToTree(connection);
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
static addConnectionToTree(connection: Connection): void;
|
|
63
|
+
/**
|
|
64
|
+
* Waits for connection data to be loaded into the tree.
|
|
65
|
+
*
|
|
66
|
+
* @returns A promise that resolves with "done" when data is loaded, or rejects with "not" after 25 seconds
|
|
67
|
+
*
|
|
68
|
+
* @remarks
|
|
69
|
+
* This method polls the IdentifierFlags.isConnectionLoaded flag every second.
|
|
70
|
+
* Useful for ensuring data is ready before performing operations on the tree.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```typescript
|
|
74
|
+
* try {
|
|
75
|
+
* await ConnectionBinaryTree.waitForDataToLoad();
|
|
76
|
+
* console.log("Connection data loaded");
|
|
77
|
+
* } catch (error) {
|
|
78
|
+
* console.log("Loading timed out");
|
|
79
|
+
* }
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
static waitForDataToLoad(): Promise<unknown>;
|
|
83
|
+
/**
|
|
84
|
+
* Periodically checks if connection data has been loaded.
|
|
85
|
+
*
|
|
86
|
+
* @param resolve - The promise resolve function to call when data is loaded
|
|
87
|
+
*
|
|
88
|
+
* @remarks
|
|
89
|
+
* This method recursively checks the IdentifierFlags.isConnectionLoaded flag every 1000ms.
|
|
90
|
+
*/
|
|
91
|
+
static checkFlag(resolve: any): any;
|
|
92
|
+
/**
|
|
93
|
+
* Removes a connection node from the tree by its ID.
|
|
94
|
+
*
|
|
95
|
+
* @param id - The numeric ID of the connection to remove
|
|
96
|
+
*
|
|
97
|
+
* @remarks
|
|
98
|
+
* This method removes a node from the tree while maintaining AVL balance.
|
|
99
|
+
* The tree is automatically rebalanced after removal.
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```typescript
|
|
103
|
+
* await ConnectionBinaryTree.removeNodeFromTree(123);
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
static removeNodeFromTree(id: number): Promise<void>;
|
|
107
|
+
/**
|
|
108
|
+
* Retrieves a connection node from the tree by its ID.
|
|
109
|
+
*
|
|
110
|
+
* @param id - The numeric ID of the connection to retrieve
|
|
111
|
+
* @returns The ConnectionNode if found, the root node otherwise
|
|
112
|
+
*
|
|
113
|
+
* @remarks
|
|
114
|
+
* This method performs a binary search through the tree using the connection ID as the key.
|
|
115
|
+
* The search has O(log n) time complexity in a balanced tree.
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```typescript
|
|
119
|
+
* const node = await ConnectionBinaryTree.getNodeFromTree(123);
|
|
120
|
+
* if (node) {
|
|
121
|
+
* console.log("Found connection:", node.value);
|
|
122
|
+
* }
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
static getNodeFromTree(id: number): Promise<ConnectionNode | null>;
|
|
126
|
+
}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Node implementation for the ConnectionBinaryTree.
|
|
3
|
+
* This module provides the ConnectionNode class with AVL tree operations and variant management.
|
|
4
|
+
* @module DataStructures/ConnectionBinaryTree/ConnectionNode
|
|
5
|
+
*/
|
|
6
|
+
import { Connection } from "./../Connection";
|
|
7
|
+
/**
|
|
8
|
+
* Represents a node in the connection binary tree with support for variants.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* ConnectionNode implements an AVL tree node for Connection objects with special
|
|
12
|
+
* support for managing connection variants (multiple connections with the same key).
|
|
13
|
+
* Each node can store multiple connection variants in the variants array, allowing
|
|
14
|
+
* efficient grouping of related connections by type or other criteria.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const connection = new Connection(123, 1, 2, 3, 4, 5);
|
|
19
|
+
* const node = new ConnectionNode(123, connection, null, null);
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare class ConnectionNode {
|
|
23
|
+
/**
|
|
24
|
+
* The key used for tree ordering (typically connection ID or type ID).
|
|
25
|
+
*/
|
|
26
|
+
key: any;
|
|
27
|
+
/**
|
|
28
|
+
* The Connection object stored in this node.
|
|
29
|
+
*/
|
|
30
|
+
value: Connection;
|
|
31
|
+
/**
|
|
32
|
+
* Reference to the left child node.
|
|
33
|
+
*/
|
|
34
|
+
leftNode: ConnectionNode | null;
|
|
35
|
+
/**
|
|
36
|
+
* Reference to the right child node.
|
|
37
|
+
*/
|
|
38
|
+
rightNode: ConnectionNode | null;
|
|
39
|
+
/**
|
|
40
|
+
* Reference to current node for variant chaining.
|
|
41
|
+
*/
|
|
42
|
+
currentNode: ConnectionNode | null;
|
|
43
|
+
/**
|
|
44
|
+
* Array of variant nodes that share the same key.
|
|
45
|
+
* Used for storing multiple connections with the same type or identifier.
|
|
46
|
+
*/
|
|
47
|
+
variants: ConnectionNode[];
|
|
48
|
+
/**
|
|
49
|
+
* The height of this node in the tree.
|
|
50
|
+
* Used for AVL tree balancing calculations.
|
|
51
|
+
*/
|
|
52
|
+
height: number;
|
|
53
|
+
/**
|
|
54
|
+
* Creates a new ConnectionNode.
|
|
55
|
+
*
|
|
56
|
+
* @param key - The key for tree ordering
|
|
57
|
+
* @param value - The Connection 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 ConnectionNode(123, connection, null, null);
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
constructor(key: any, value: Connection, leftNode: ConnectionNode | null, rightNode: ConnectionNode | null);
|
|
67
|
+
/**
|
|
68
|
+
* Adds a node to the current node chain by type ID.
|
|
69
|
+
*
|
|
70
|
+
* @param passedNode - The node to add
|
|
71
|
+
* @param node - The current node in the chain
|
|
72
|
+
* @returns The updated node chain
|
|
73
|
+
*
|
|
74
|
+
* @remarks
|
|
75
|
+
* Used internally for managing connection variants with different type IDs.
|
|
76
|
+
*/
|
|
77
|
+
addCurrentNode(passedNode: ConnectionNode, node: ConnectionNode | null): ConnectionNode;
|
|
78
|
+
/**
|
|
79
|
+
* Adds a connection variant to this node's variants array.
|
|
80
|
+
*
|
|
81
|
+
* @param passedNode - The variant node to add
|
|
82
|
+
* @param node - The current node
|
|
83
|
+
* @returns The updated node with the new variant
|
|
84
|
+
*
|
|
85
|
+
* @remarks
|
|
86
|
+
* This method ensures no duplicate connections are added by checking IDs.
|
|
87
|
+
* Variants are stored in the variants array for efficient retrieval.
|
|
88
|
+
*/
|
|
89
|
+
addCurrentNodeType(passedNode: ConnectionNode, node: ConnectionNode | null): ConnectionNode;
|
|
90
|
+
/**
|
|
91
|
+
* Adds a new node to the tree with AVL balancing.
|
|
92
|
+
*
|
|
93
|
+
* @param passedNode - The node to be added
|
|
94
|
+
* @param node - The current node being evaluated
|
|
95
|
+
* @param height - The height of the current node
|
|
96
|
+
* @returns The root node after insertion and balancing
|
|
97
|
+
*
|
|
98
|
+
* @remarks
|
|
99
|
+
* Implements AVL tree insertion with automatic balancing through rotations.
|
|
100
|
+
*/
|
|
101
|
+
addNode(passedNode: ConnectionNode, node: ConnectionNode | null, height: number): ConnectionNode | null;
|
|
102
|
+
/**
|
|
103
|
+
* Adds a node to the tree indexed by type ID with variant support.
|
|
104
|
+
*
|
|
105
|
+
* @param passedNode - The node to be added
|
|
106
|
+
* @param node - The current node being evaluated
|
|
107
|
+
* @param height - The height of the current node
|
|
108
|
+
* @returns The root node after insertion and balancing
|
|
109
|
+
*
|
|
110
|
+
* @remarks
|
|
111
|
+
* This method is similar to addNode but specifically handles type-based indexing
|
|
112
|
+
* and manages connection variants that share the same type ID.
|
|
113
|
+
*/
|
|
114
|
+
addTypeNode(passedNode: ConnectionNode, node: ConnectionNode | null, height: number): ConnectionNode | null;
|
|
115
|
+
/**
|
|
116
|
+
* Performs a right rotation on the given node for AVL balancing.
|
|
117
|
+
*
|
|
118
|
+
* @param y - The node to rotate right
|
|
119
|
+
* @returns The new root node after rotation
|
|
120
|
+
*/
|
|
121
|
+
rightRotate(y: ConnectionNode | null): ConnectionNode | null;
|
|
122
|
+
/**
|
|
123
|
+
* Performs a left rotation on the given node for AVL balancing.
|
|
124
|
+
*
|
|
125
|
+
* @param x - The node to rotate left
|
|
126
|
+
* @returns The new root node after rotation
|
|
127
|
+
*/
|
|
128
|
+
leftRotate(x: ConnectionNode | null): ConnectionNode | null;
|
|
129
|
+
/**
|
|
130
|
+
* Gets the height of a node.
|
|
131
|
+
*
|
|
132
|
+
* @param node - The node to get the height from
|
|
133
|
+
* @returns The height of the node, or 0 if null
|
|
134
|
+
*/
|
|
135
|
+
getHeight(node: ConnectionNode | null): number;
|
|
136
|
+
/**
|
|
137
|
+
* Calculates the balance factor of a node.
|
|
138
|
+
*
|
|
139
|
+
* @param N - The node to calculate the balance factor for
|
|
140
|
+
* @returns The balance factor (difference between left and right heights)
|
|
141
|
+
*/
|
|
142
|
+
getBalanceFactor(N: ConnectionNode | null): number;
|
|
143
|
+
/**
|
|
144
|
+
* Retrieves a node from the tree by its numeric ID.
|
|
145
|
+
*
|
|
146
|
+
* @param id - The connection ID to search for
|
|
147
|
+
* @param node - The current node being evaluated
|
|
148
|
+
* @returns The matching ConnectionNode if found, null otherwise
|
|
149
|
+
*/
|
|
150
|
+
getFromNode(id: number, node: ConnectionNode | null): ConnectionNode | null;
|
|
151
|
+
/**
|
|
152
|
+
* Retrieves a node from the tree by its character/string value.
|
|
153
|
+
*
|
|
154
|
+
* @param value - The character value to search for
|
|
155
|
+
* @param node - The current node being evaluated
|
|
156
|
+
* @returns The matching ConnectionNode if found, null otherwise
|
|
157
|
+
*/
|
|
158
|
+
getCharacterFromNode(value: string, node: ConnectionNode | null): ConnectionNode | null;
|
|
159
|
+
/**
|
|
160
|
+
* Removes a node from the tree by its ID.
|
|
161
|
+
*
|
|
162
|
+
* @param passedNode - The current node being evaluated
|
|
163
|
+
* @param id - The connection ID to remove
|
|
164
|
+
* @returns The root node after removal
|
|
165
|
+
*
|
|
166
|
+
* @remarks
|
|
167
|
+
* Implements standard BST deletion with in-order successor replacement.
|
|
168
|
+
*/
|
|
169
|
+
removeNode(passedNode: ConnectionNode | null, id: number): ConnectionNode | null;
|
|
170
|
+
/**
|
|
171
|
+
* Removes a specific variant from a node or the entire node if no variants remain.
|
|
172
|
+
*
|
|
173
|
+
* @param passedNode - The current node being evaluated
|
|
174
|
+
* @param typeIdentifier - The type identifier of the node
|
|
175
|
+
* @param conceptId - The specific connection ID to remove
|
|
176
|
+
* @returns The root node after removal
|
|
177
|
+
*
|
|
178
|
+
* @remarks
|
|
179
|
+
* This method handles removal of connection variants. If the main value matches,
|
|
180
|
+
* it's replaced by the first variant. If a variant matches, only that variant is removed.
|
|
181
|
+
*/
|
|
182
|
+
removeNodeWithVariants(passedNode: ConnectionNode | null, typeIdentifier: any, conceptId: number): ConnectionNode | null;
|
|
183
|
+
/**
|
|
184
|
+
* Finds the in-order successor of a node.
|
|
185
|
+
*
|
|
186
|
+
* @param root - The node to find the successor from
|
|
187
|
+
* @returns The in-order successor node (leftmost node in right subtree)
|
|
188
|
+
*
|
|
189
|
+
* @remarks
|
|
190
|
+
* Used during node deletion to find the replacement node.
|
|
191
|
+
*/
|
|
192
|
+
inOrderSuccessor(root: ConnectionNode): ConnectionNode;
|
|
193
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Binary tree for managing connections indexed by type ID.
|
|
3
|
+
* This module provides a specialized tree for efficient type-based connection lookups and variant retrieval.
|
|
4
|
+
* @module DataStructures/ConnectionBinaryTree/ConnectionTypeTree
|
|
5
|
+
*/
|
|
6
|
+
import { Connection } from "../../DataStructures/Connection";
|
|
7
|
+
import { ConnectionNode } from "./ConnectionNode";
|
|
8
|
+
/**
|
|
9
|
+
* Binary tree data structure for managing connections indexed by type ID.
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* This class implements an AVL tree optimized for type-based connection lookups.
|
|
13
|
+
* It enables efficient retrieval of all connections of a specific type and supports
|
|
14
|
+
* variant management for grouping related connections.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const connection = new Connection(123, 1, 2, 3, 4, 5);
|
|
19
|
+
* ConnectionTypeTree.addConnectionToTree(connection);
|
|
20
|
+
* const variants = await ConnectionTypeTree.getTypeVariantsFromTree(5);
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare class ConnectionTypeTree {
|
|
24
|
+
/**
|
|
25
|
+
* The root node of the type-indexed connection tree.
|
|
26
|
+
* Null if the tree is empty.
|
|
27
|
+
*/
|
|
28
|
+
static connectionTypeRoot: ConnectionNode | null;
|
|
29
|
+
/**
|
|
30
|
+
* Adds a connection node to the type-indexed tree.
|
|
31
|
+
*
|
|
32
|
+
* @param node - The ConnectionNode to be added
|
|
33
|
+
* @returns The root node after insertion
|
|
34
|
+
*
|
|
35
|
+
* @remarks
|
|
36
|
+
* Uses the addTypeNode method for type-based insertion with variant support.
|
|
37
|
+
*/
|
|
38
|
+
static addNodeToTree(node: ConnectionNode): Promise<ConnectionNode | null>;
|
|
39
|
+
/**
|
|
40
|
+
* Waits for connection type data to be loaded.
|
|
41
|
+
*
|
|
42
|
+
* @returns A promise that resolves when data is loaded, or rejects after 25 seconds
|
|
43
|
+
*/
|
|
44
|
+
static waitForDataToLoad(): Promise<unknown>;
|
|
45
|
+
/**
|
|
46
|
+
* Periodically checks if connection type data has been loaded.
|
|
47
|
+
*
|
|
48
|
+
* @param resolve - The promise resolve function to call when data is loaded
|
|
49
|
+
*/
|
|
50
|
+
static checkFlag(resolve: any): any;
|
|
51
|
+
/**
|
|
52
|
+
* Creates a node from a connection and adds it to the type tree.
|
|
53
|
+
*
|
|
54
|
+
* @param connection - The Connection object to be added
|
|
55
|
+
*
|
|
56
|
+
* @remarks
|
|
57
|
+
* Only adds the connection if it has a non-zero typeId.
|
|
58
|
+
*/
|
|
59
|
+
static addConnectionToTree(connection: Connection): void;
|
|
60
|
+
/**
|
|
61
|
+
* Removes a specific connection variant from the tree.
|
|
62
|
+
*
|
|
63
|
+
* @param typeId - The type ID identifying the node
|
|
64
|
+
* @param id - The connection ID to remove
|
|
65
|
+
*/
|
|
66
|
+
static removeTypeConcept(typeId: number, id: number): void;
|
|
67
|
+
/**
|
|
68
|
+
* Retrieves a node from the tree by its type ID.
|
|
69
|
+
*
|
|
70
|
+
* @param id - The numeric type ID to search for
|
|
71
|
+
* @returns The ConnectionNode if found, the root node otherwise
|
|
72
|
+
*/
|
|
73
|
+
static getNodeFromTree(id: number): ConnectionNode | null;
|
|
74
|
+
/**
|
|
75
|
+
* Retrieves all connection variants for a specific type ID.
|
|
76
|
+
*
|
|
77
|
+
* @param typeId - The type ID to search for
|
|
78
|
+
* @returns An array of Connection objects of the specified type
|
|
79
|
+
*
|
|
80
|
+
* @remarks
|
|
81
|
+
* Returns the primary connection and all its variants that share the same type ID.
|
|
82
|
+
*/
|
|
83
|
+
static getTypeVariantsFromTree(typeId: number): Promise<Connection[] | undefined>;
|
|
84
|
+
/**
|
|
85
|
+
* Retrieves all connection variants for a specific type ID filtered by user ID.
|
|
86
|
+
*
|
|
87
|
+
* @param typeId - The type ID to search for
|
|
88
|
+
* @param userId - The user ID to filter by
|
|
89
|
+
* @returns An array of Connection objects of the specified type belonging to the specified user
|
|
90
|
+
*
|
|
91
|
+
* @remarks
|
|
92
|
+
* Useful for user-specific connection management and filtering.
|
|
93
|
+
*/
|
|
94
|
+
static getTypeVariantsFromTreeWithUserId(typeId: number, userId: number): Promise<Connection[]>;
|
|
95
|
+
}
|