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,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* No-operation IndexedDB interface module for environments without IndexedDB support.
|
|
3
|
+
*
|
|
4
|
+
* This module provides stub implementations of database operations that are used when
|
|
5
|
+
* IndexedDB is not available or when database functionality needs to be disabled.
|
|
6
|
+
* All functions are no-ops or return default values, allowing the application to
|
|
7
|
+
* run without actual database persistence.
|
|
8
|
+
*
|
|
9
|
+
* @module Database/NoIndexDb
|
|
10
|
+
* @see https://documentation.freeschema.com for reference
|
|
11
|
+
*/
|
|
12
|
+
import { SettingData } from "../DataStructures/SettingData";
|
|
13
|
+
/**
|
|
14
|
+
* Opens or returns a reference to the IndexedDB database.
|
|
15
|
+
*
|
|
16
|
+
* In this no-op implementation, it simply returns the static database reference
|
|
17
|
+
* from IndexDb without performing any actual initialization.
|
|
18
|
+
*
|
|
19
|
+
* @param databaseName - The name of the database to open
|
|
20
|
+
* @returns The static IDBDatabase reference from IndexDb.db
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* const db = openDatabase('concepts-db');
|
|
25
|
+
* // Returns IndexDb.db without initialization
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @remarks
|
|
29
|
+
* This is a stub implementation used when full database functionality is not needed.
|
|
30
|
+
*
|
|
31
|
+
* @see IndexDb for the database singleton
|
|
32
|
+
*/
|
|
33
|
+
export declare function openDatabase(databaseName: string): IDBDatabase;
|
|
34
|
+
/**
|
|
35
|
+
* Stores an object to the database (no-op implementation).
|
|
36
|
+
*
|
|
37
|
+
* This function provides a stub for storing data to IndexedDB. In this no-op
|
|
38
|
+
* implementation, it does not perform any actual storage operations.
|
|
39
|
+
*
|
|
40
|
+
* @param databaseName - The name of the database or object store
|
|
41
|
+
* @param object - The object to store (can be any type)
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* const concept = { id: 1, name: 'Example' };
|
|
46
|
+
* storeToDatabase('concepts', concept);
|
|
47
|
+
* // No actual storage occurs
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @remarks
|
|
51
|
+
* This is a placeholder implementation. Use the full database module for actual persistence.
|
|
52
|
+
*/
|
|
53
|
+
export declare function storeToDatabase(databaseName: string, object: any): void;
|
|
54
|
+
/**
|
|
55
|
+
* Retrieves statistics and settings from the database.
|
|
56
|
+
*
|
|
57
|
+
* Returns a new SettingData instance initialized with default values.
|
|
58
|
+
* This provides a consistent interface for accessing settings even when
|
|
59
|
+
* database functionality is disabled.
|
|
60
|
+
*
|
|
61
|
+
* @returns A new SettingData instance with AI features enabled (true)
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* const stats = GetStatsFromDatabase();
|
|
66
|
+
* // Returns SettingData with default configuration
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* @remarks
|
|
70
|
+
* The returned SettingData is initialized with AI features enabled by default.
|
|
71
|
+
*
|
|
72
|
+
* @see SettingData for the settings data structure
|
|
73
|
+
*/
|
|
74
|
+
export declare function GetStatsFromDatabase(): SettingData;
|
|
75
|
+
/**
|
|
76
|
+
* Updates the AI flag in settings (no-op implementation).
|
|
77
|
+
*
|
|
78
|
+
* This function provides a stub for updating AI-related settings in the database.
|
|
79
|
+
* In this no-op implementation, it does not perform any actual updates.
|
|
80
|
+
*
|
|
81
|
+
* @param object - The SettingData object containing the new AI flag value
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```typescript
|
|
85
|
+
* const settings = new SettingData(false);
|
|
86
|
+
* AiUpdateFlag(settings);
|
|
87
|
+
* // No actual update occurs
|
|
88
|
+
* ```
|
|
89
|
+
*
|
|
90
|
+
* @remarks
|
|
91
|
+
* This is a placeholder implementation. Changes are not persisted.
|
|
92
|
+
*
|
|
93
|
+
* @see SettingData for the settings data structure
|
|
94
|
+
*/
|
|
95
|
+
export declare function AiUpdateFlag(object: SettingData): void;
|
|
96
|
+
/**
|
|
97
|
+
* Retrieves an object from the database by type and ID (no-op implementation).
|
|
98
|
+
*
|
|
99
|
+
* This async function provides a stub for fetching data from IndexedDB based on
|
|
100
|
+
* type and ID. In this no-op implementation, it returns undefined.
|
|
101
|
+
*
|
|
102
|
+
* @param databaseName - The name of the database or object store
|
|
103
|
+
* @param type - The type of object to retrieve (e.g., 'concept', 'setting')
|
|
104
|
+
* @param id - The numeric ID of the object to retrieve
|
|
105
|
+
* @returns Promise resolving to undefined
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```typescript
|
|
109
|
+
* const concept = await getFromDatabaseWithType('concepts', 'concept', 123);
|
|
110
|
+
* // Returns undefined
|
|
111
|
+
* ```
|
|
112
|
+
*
|
|
113
|
+
* @remarks
|
|
114
|
+
* This is a placeholder implementation. Use the full database module for actual retrieval.
|
|
115
|
+
*/
|
|
116
|
+
export declare function getFromDatabaseWithType(databaseName: string, type: string, id: number): Promise<void>;
|
|
117
|
+
/**
|
|
118
|
+
* Retrieves objects from the database using legacy method (no-op implementation).
|
|
119
|
+
*
|
|
120
|
+
* This async function provides a stub for the older method of fetching data from
|
|
121
|
+
* IndexedDB. In this no-op implementation, it returns undefined.
|
|
122
|
+
*
|
|
123
|
+
* @param databaseName - The name of the database or object store
|
|
124
|
+
* @returns Promise resolving to undefined
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```typescript
|
|
128
|
+
* const data = await getFromDatabaseWithTypeOld('concepts');
|
|
129
|
+
* // Returns undefined
|
|
130
|
+
* ```
|
|
131
|
+
*
|
|
132
|
+
* @remarks
|
|
133
|
+
* This is a legacy method maintained for backward compatibility. Use getFromDatabaseWithType
|
|
134
|
+
* for new implementations.
|
|
135
|
+
*
|
|
136
|
+
* @see getFromDatabaseWithType for the current retrieval method
|
|
137
|
+
*/
|
|
138
|
+
export declare function getFromDatabaseWithTypeOld(databaseName: string): Promise<void>;
|
|
139
|
+
/**
|
|
140
|
+
* Removes an object from the database by ID (no-op implementation).
|
|
141
|
+
*
|
|
142
|
+
* This function provides a stub for deleting data from IndexedDB. In this no-op
|
|
143
|
+
* implementation, it does not perform any actual deletion.
|
|
144
|
+
*
|
|
145
|
+
* @param databaseName - The name of the database or object store
|
|
146
|
+
* @param id - The numeric ID of the object to remove
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```typescript
|
|
150
|
+
* removeFromDatabase('concepts', 123);
|
|
151
|
+
* // No actual deletion occurs
|
|
152
|
+
* ```
|
|
153
|
+
*
|
|
154
|
+
* @remarks
|
|
155
|
+
* This is a placeholder implementation. Use the full database module for actual deletion.
|
|
156
|
+
*/
|
|
157
|
+
export declare function removeFromDatabase(databaseName: string, id: number): void;
|
|
158
|
+
/**
|
|
159
|
+
* Retrieves all objects from the local database (no-op implementation).
|
|
160
|
+
*
|
|
161
|
+
* This async function provides a stub for fetching all data from a local IndexedDB
|
|
162
|
+
* object store. In this no-op implementation, it returns undefined.
|
|
163
|
+
*
|
|
164
|
+
* @param databaseName - The name of the database or object store
|
|
165
|
+
* @returns Promise resolving to undefined
|
|
166
|
+
*
|
|
167
|
+
* @example
|
|
168
|
+
* ```typescript
|
|
169
|
+
* const allConcepts = await getAllFromLocalDb('concepts');
|
|
170
|
+
* // Returns undefined
|
|
171
|
+
* ```
|
|
172
|
+
*
|
|
173
|
+
* @remarks
|
|
174
|
+
* This is a placeholder implementation. Use the full database module for actual bulk retrieval.
|
|
175
|
+
*
|
|
176
|
+
* @see LocalIndexDb for local database operations
|
|
177
|
+
*/
|
|
178
|
+
export declare function getAllFromLocalDb(databaseName: string): Promise<void>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local IndexedDB management module for storing concepts locally in the browser.
|
|
3
|
+
*
|
|
4
|
+
* This module provides a singleton class that maintains a static reference to a local
|
|
5
|
+
* IndexedDB database connection. It serves as the primary interface for local browser
|
|
6
|
+
* storage of concept data in the Concept Connection System.
|
|
7
|
+
*
|
|
8
|
+
* @module Database/indexdblocal
|
|
9
|
+
* @see https://documentation.freeschema.com for reference
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Singleton class managing the local IndexedDB database connection.
|
|
13
|
+
*
|
|
14
|
+
* LocalIndexDb provides a static database reference for local browser storage
|
|
15
|
+
* of concepts. This allows the application to maintain offline functionality
|
|
16
|
+
* and cache concept data locally.
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* The static db property is shared across the application and should be initialized
|
|
20
|
+
* before any database operations are performed.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* // Access the local database instance
|
|
25
|
+
* const database = LocalIndexDb.db;
|
|
26
|
+
* if (database) {
|
|
27
|
+
* // Perform database operations
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @see IndexDb for remote database operations
|
|
32
|
+
* @see https://documentation.freeschema.com for concept storage patterns
|
|
33
|
+
*/
|
|
34
|
+
export declare class LocalIndexDb {
|
|
35
|
+
/**
|
|
36
|
+
* Static reference to the local IndexedDB database instance.
|
|
37
|
+
*
|
|
38
|
+
* This property holds the active IDBDatabase connection for local storage.
|
|
39
|
+
* It should be initialized during application startup before any database
|
|
40
|
+
* operations are attempted.
|
|
41
|
+
*
|
|
42
|
+
* @type {IDBDatabase}
|
|
43
|
+
*/
|
|
44
|
+
static db: IDBDatabase;
|
|
45
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IndexedDB management module for the Concept Connection System.
|
|
3
|
+
*
|
|
4
|
+
* This module provides a singleton class that maintains a static reference to an
|
|
5
|
+
* IndexedDB database connection. It serves as the primary interface for browser-based
|
|
6
|
+
* storage of concepts, settings, and other CCS data structures.
|
|
7
|
+
*
|
|
8
|
+
* @module Database/indexeddb
|
|
9
|
+
* @see https://documentation.freeschema.com for reference
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Singleton class managing the IndexedDB database connection.
|
|
13
|
+
*
|
|
14
|
+
* IndexDb provides a static database reference that can be accessed throughout
|
|
15
|
+
* the application for storing and retrieving concept data, settings, and other
|
|
16
|
+
* persistent information in the browser's IndexedDB storage.
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* The static db property is shared across the entire application. It should be
|
|
20
|
+
* initialized during application startup before performing any database operations.
|
|
21
|
+
* The current database schema version is 4.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* // Access the database instance
|
|
26
|
+
* const database = IndexDb.db;
|
|
27
|
+
* if (database) {
|
|
28
|
+
* // Perform database operations
|
|
29
|
+
* const transaction = database.transaction(['concepts'], 'readonly');
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @see LocalIndexDb for local-only database operations
|
|
34
|
+
* @see https://documentation.freeschema.com for database schema details
|
|
35
|
+
*/
|
|
36
|
+
export declare class IndexDb {
|
|
37
|
+
/**
|
|
38
|
+
* Static reference to the IndexedDB database instance.
|
|
39
|
+
*
|
|
40
|
+
* This property holds the active IDBDatabase connection used throughout
|
|
41
|
+
* the application. Must be initialized before use.
|
|
42
|
+
*
|
|
43
|
+
* @type {IDBDatabase}
|
|
44
|
+
*/
|
|
45
|
+
static db: IDBDatabase;
|
|
46
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Concept Draw Module for Concept Connection System (CCS-JS)
|
|
3
|
+
*
|
|
4
|
+
* This module handles the visual rendering of concepts on an HTML5 canvas.
|
|
5
|
+
* It provides a drawing loop that continuously renders concepts as triangles
|
|
6
|
+
* with automatic positioning and animation capabilities.
|
|
7
|
+
*
|
|
8
|
+
* @module Drawing/ConceptDraw
|
|
9
|
+
* @see https://documentation.freeschema.com for visualization reference
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Initializes and starts the main drawing loop for rendering concepts.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* // Start the drawing loop
|
|
17
|
+
* DrawingLoop();
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* Sets up a continuous drawing loop using setInterval that:
|
|
22
|
+
* - Targets 60 FPS (though currently draws at 2 FPS with 500ms interval)
|
|
23
|
+
* - Queries the canvas element with ID 'myCanvas'
|
|
24
|
+
* - Continuously calls MainDraw() to render concepts
|
|
25
|
+
*
|
|
26
|
+
* Note: The FPS and FRAME_RATE variables are declared but not currently used.
|
|
27
|
+
* The actual draw rate is 500ms (2 times per second), not 60 FPS.
|
|
28
|
+
*/
|
|
29
|
+
export declare function DrawingLoop(): void;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Concept Events Module for Concept Connection System (CCS-JS)
|
|
3
|
+
*
|
|
4
|
+
* This module handles user interaction events with visual concepts on the canvas.
|
|
5
|
+
* It provides hit detection and selection functionality for concepts rendered as triangles.
|
|
6
|
+
*
|
|
7
|
+
* @module Drawing/ConceptEvents
|
|
8
|
+
* @see https://documentation.freeschema.com for interaction reference
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Detects and returns a concept at the given mouse coordinates.
|
|
12
|
+
*
|
|
13
|
+
* @param mouse_x_coordinate - The x-coordinate of the mouse position
|
|
14
|
+
* @param mouse_y_coordinate - The y-coordinate of the mouse position
|
|
15
|
+
* @returns The concept at the mouse position, or null if no concept was clicked
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* canvas.addEventListener('click', (event) => {
|
|
20
|
+
* const rect = canvas.getBoundingClientRect();
|
|
21
|
+
* const x = event.clientX - rect.left;
|
|
22
|
+
* const y = event.clientY - rect.top;
|
|
23
|
+
* const selected = selectConceptObject(x, y);
|
|
24
|
+
* if (selected) {
|
|
25
|
+
* console.log('Clicked concept:', selected.id);
|
|
26
|
+
* }
|
|
27
|
+
* });
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* Hit detection uses a rectangular bounding box approach:
|
|
32
|
+
* - Width: 100 pixels (50 pixels on each side from center)
|
|
33
|
+
* - Height: 100 pixels (from y coordinate downward)
|
|
34
|
+
*
|
|
35
|
+
* Boundary calculations:
|
|
36
|
+
* - Left: concept.x - 50
|
|
37
|
+
* - Right: concept.x + 50
|
|
38
|
+
* - Top: concept.y
|
|
39
|
+
* - Bottom: concept.y + 100
|
|
40
|
+
*
|
|
41
|
+
* Note: Although concepts are drawn as triangles, the hit detection uses
|
|
42
|
+
* a rectangular area for simplicity. This means clicks near the corners
|
|
43
|
+
* of the rectangle but outside the actual triangle will still register.
|
|
44
|
+
*
|
|
45
|
+
* @see {@link ConceptsData} for the data store being searched
|
|
46
|
+
*/
|
|
47
|
+
export declare function selectConceptObject(mouse_x_coordinate: number, mouse_y_coordinate: number): import("../app").Concept | null;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check If Exists Helper Module for Concept Connection System (CCS-JS)
|
|
3
|
+
*
|
|
4
|
+
* This module provides utility functions to verify the existence of concepts and connections
|
|
5
|
+
* within arrays. These functions are essential for avoiding duplicates and finding related
|
|
6
|
+
* entities in the CCS data structures.
|
|
7
|
+
*
|
|
8
|
+
* @module Helpers/CheckIfExists
|
|
9
|
+
* @see https://documentation.freeschema.com for data structure reference
|
|
10
|
+
*/
|
|
11
|
+
import { Concept } from "../DataStructures/Concept";
|
|
12
|
+
import { Connection } from "../DataStructures/Connection";
|
|
13
|
+
import { LConcept, LConnection } from "../app";
|
|
14
|
+
/**
|
|
15
|
+
* Checks if a concept exists in an array of concepts by matching IDs.
|
|
16
|
+
*
|
|
17
|
+
* @param conceptList - Array of concepts to search through
|
|
18
|
+
* @param concept - The concept to search for
|
|
19
|
+
* @returns The found concept if it exists, otherwise returns a default concept
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* const concepts = [concept1, concept2, concept3];
|
|
24
|
+
* const found = CheckIfConceptsExistsInArray(concepts, concept2);
|
|
25
|
+
* if (found.id !== 0) {
|
|
26
|
+
* console.log('Concept exists!');
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* Returns a default concept (created via CreateDefaultConcept) if the concept is not found.
|
|
32
|
+
* Always check the returned concept's ID to verify if a match was found.
|
|
33
|
+
*/
|
|
34
|
+
export declare function CheckIfConceptsExistsInArray(conceptList: Concept[] | undefined, concept: Concept): Concept;
|
|
35
|
+
/**
|
|
36
|
+
* Checks if concepts of the same type exist in an array, matching by type ID or character value.
|
|
37
|
+
*
|
|
38
|
+
* @param conceptList - Array of concepts to search through
|
|
39
|
+
* @param concept - The concept whose type to match against
|
|
40
|
+
* @returns Array of all concepts that match the same type
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* const concepts = [concept1, concept2, concept3];
|
|
45
|
+
* const sameType = CheckIfTypeConceptsExistsInArray(concepts, concept1);
|
|
46
|
+
* console.log(`Found ${sameType.length} concepts of the same type`);
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @remarks
|
|
50
|
+
* This function normalizes type character values by ensuring they start with "the_" prefix
|
|
51
|
+
* before comparison. It matches concepts by either:
|
|
52
|
+
* - Exact typeId match
|
|
53
|
+
* - Character value match (with "the_" prefix normalization)
|
|
54
|
+
*/
|
|
55
|
+
export declare function CheckIfTypeConceptsExistsInArray(conceptList: Concept[] | undefined, concept: Concept): Concept[];
|
|
56
|
+
/**
|
|
57
|
+
* Checks if LConcepts (lightweight concepts) of the same type exist in an array.
|
|
58
|
+
*
|
|
59
|
+
* @param conceptList - Array of LConcepts to search through
|
|
60
|
+
* @param concept - The LConcept whose type to match against
|
|
61
|
+
* @returns Array of all LConcepts that match the same type
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* const lconcepts = [lconcept1, lconcept2, lconcept3];
|
|
66
|
+
* const sameType = CheckIfTypeLConceptsExistsInArray(lconcepts, lconcept1);
|
|
67
|
+
* console.log(`Found ${sameType.length} LConcepts of the same type`);
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* @remarks
|
|
71
|
+
* This is the LConcept variant of CheckIfTypeConceptsExistsInArray.
|
|
72
|
+
* LConcept is a lightweight representation that uses typeCharacter instead of type object.
|
|
73
|
+
* The function normalizes type character values by ensuring they start with "the_" prefix.
|
|
74
|
+
*
|
|
75
|
+
* @see {@link CheckIfTypeConceptsExistsInArray}
|
|
76
|
+
*/
|
|
77
|
+
export declare function CheckIfTypeLConceptsExistsInArray(conceptList: LConcept[] | undefined, concept: LConcept): LConcept[];
|
|
78
|
+
/**
|
|
79
|
+
* Checks if a connection exists in an array of connections by matching IDs.
|
|
80
|
+
*
|
|
81
|
+
* @param connectionList - Array of connections to search through
|
|
82
|
+
* @param connection - The connection to search for
|
|
83
|
+
* @returns The found connection if it exists, otherwise returns a default connection with all zeros
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```typescript
|
|
87
|
+
* const connections = [conn1, conn2, conn3];
|
|
88
|
+
* const found = CheckIfConnectionExistsInArray(connections, conn2);
|
|
89
|
+
* if (found.id !== 0) {
|
|
90
|
+
* console.log('Connection exists!');
|
|
91
|
+
* }
|
|
92
|
+
* ```
|
|
93
|
+
*
|
|
94
|
+
* @remarks
|
|
95
|
+
* Returns a new Connection instance with all parameters set to 0 if the connection is not found.
|
|
96
|
+
* Always check the returned connection's ID to verify if a match was found.
|
|
97
|
+
*/
|
|
98
|
+
export declare function CheckIfConnectionExistsInArray(connectionList: Connection[] | undefined, connection: Connection): Connection;
|
|
99
|
+
/**
|
|
100
|
+
* Checks if a connection exists in an array where a concept is either the source or target.
|
|
101
|
+
*
|
|
102
|
+
* @param connectionList - Array of connections to search through
|
|
103
|
+
* @param conceptId - The ID of the concept to find in connections
|
|
104
|
+
* @returns The first connection found where the concept appears as either toTheConceptId or ofTheConceptId
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```typescript
|
|
108
|
+
* const connections = [conn1, conn2, conn3];
|
|
109
|
+
* const found = CheckIfToTheConceptExistsInConnectionArray(connections, 123);
|
|
110
|
+
* if (found.id !== 0) {
|
|
111
|
+
* console.log('Concept is connected!');
|
|
112
|
+
* }
|
|
113
|
+
* ```
|
|
114
|
+
*
|
|
115
|
+
* @remarks
|
|
116
|
+
* This function searches bidirectionally - it finds connections where the concept is either:
|
|
117
|
+
* - The target (toTheConceptId)
|
|
118
|
+
* - The source (ofTheConceptId)
|
|
119
|
+
* If both exist, the ofTheConceptId match takes precedence as it's checked second.
|
|
120
|
+
* Returns a default connection (all zeros) if no match is found.
|
|
121
|
+
*/
|
|
122
|
+
export declare function CheckIfToTheConceptExistsInConnectionArray(connectionList: Connection[] | undefined, conceptId: number): Connection;
|
|
123
|
+
/**
|
|
124
|
+
* Finds all connections in an array where a concept appears as either source or target.
|
|
125
|
+
*
|
|
126
|
+
* @param connectionList - Array of connections to search through
|
|
127
|
+
* @param conceptId - The ID of the concept to find in connections
|
|
128
|
+
* @returns Array of all connections where the concept is connected (up to 2: one as target, one as source)
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* ```typescript
|
|
132
|
+
* const connections = [conn1, conn2, conn3];
|
|
133
|
+
* const found = CheckAllConnectionsConnectedInConnectionArray(connections, 123);
|
|
134
|
+
* console.log(`Concept has ${found.length} connections`);
|
|
135
|
+
* ```
|
|
136
|
+
*
|
|
137
|
+
* @remarks
|
|
138
|
+
* This function finds connections where the concept appears as:
|
|
139
|
+
* - toTheConceptId (target/destination of connection)
|
|
140
|
+
* - ofTheConceptId (source/origin of connection)
|
|
141
|
+
* Note: Uses `find()` which only returns the first match for each direction,
|
|
142
|
+
* so maximum 2 connections will be returned even if more exist.
|
|
143
|
+
*
|
|
144
|
+
* @see {@link CheckAllConnectionsConnectedInLConnectionArray} for the LConnection variant
|
|
145
|
+
*/
|
|
146
|
+
export declare function CheckAllConnectionsConnectedInConnectionArray(connectionList: Connection[] | undefined, conceptId: number): Connection[];
|
|
147
|
+
/**
|
|
148
|
+
* Finds all LConnections (lightweight connections) in an array where a concept appears as either source or target.
|
|
149
|
+
*
|
|
150
|
+
* @param connectionList - Array of LConnections to search through
|
|
151
|
+
* @param conceptId - The ID of the concept to find in connections
|
|
152
|
+
* @returns Array of all LConnections where the concept is connected (up to 2: one as target, one as source)
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ```typescript
|
|
156
|
+
* const lconnections = [lconn1, lconn2, lconn3];
|
|
157
|
+
* const found = CheckAllConnectionsConnectedInLConnectionArray(lconnections, 123);
|
|
158
|
+
* console.log(`Concept has ${found.length} lightweight connections`);
|
|
159
|
+
* ```
|
|
160
|
+
*
|
|
161
|
+
* @remarks
|
|
162
|
+
* This is the LConnection variant of CheckAllConnectionsConnectedInConnectionArray.
|
|
163
|
+
* LConnection is a lightweight representation of connections used for performance optimization.
|
|
164
|
+
* Like its standard counterpart, it uses `find()` which only returns the first match per direction,
|
|
165
|
+
* so maximum 2 connections will be returned.
|
|
166
|
+
*
|
|
167
|
+
* @see {@link CheckAllConnectionsConnectedInConnectionArray}
|
|
168
|
+
*/
|
|
169
|
+
export declare function CheckAllConnectionsConnectedInLConnectionArray(connectionList: LConnection[] | undefined, conceptId: number): LConnection[];
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Remove From Array Helper Module for Concept Connection System (CCS-JS)
|
|
3
|
+
*
|
|
4
|
+
* This module provides utility functions for removing concepts and connections from arrays.
|
|
5
|
+
* These functions mutate the original arrays by splicing out matching elements by ID.
|
|
6
|
+
*
|
|
7
|
+
* @module Helpers/RemoveFromArray
|
|
8
|
+
* @see https://documentation.freeschema.com for data structure reference
|
|
9
|
+
*/
|
|
10
|
+
import { Concept } from "../DataStructures/Concept";
|
|
11
|
+
import { Connection } from "../DataStructures/Connection";
|
|
12
|
+
import { LConnection } from "../app";
|
|
13
|
+
/**
|
|
14
|
+
* Removes a concept from an array by matching its ID.
|
|
15
|
+
*
|
|
16
|
+
* @param conceptList - Array of concepts to remove from (will be mutated)
|
|
17
|
+
* @param concept - The concept to remove from the array
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const concepts = [concept1, concept2, concept3];
|
|
22
|
+
* RemoveConceptFromList(concepts, concept2);
|
|
23
|
+
* console.log(concepts.length); // 2 (concept2 has been removed)
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @remarks
|
|
27
|
+
* This function mutates the original array using splice().
|
|
28
|
+
* If the concept is not found (findIndex returns -1), splice will remove the last element.
|
|
29
|
+
* Ensure the concept exists in the array before calling this function to avoid unintended removals.
|
|
30
|
+
*/
|
|
31
|
+
export declare function RemoveConceptFromList(conceptList: Concept[] | undefined, concept: Concept): void;
|
|
32
|
+
/**
|
|
33
|
+
* Removes a connection from an array by matching its ID.
|
|
34
|
+
*
|
|
35
|
+
* @param connectionList - Array of connections to remove from (will be mutated)
|
|
36
|
+
* @param connection - The connection to remove from the array
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* const connections = [conn1, conn2, conn3];
|
|
41
|
+
* RemoveConnectionFromList(connections, conn2);
|
|
42
|
+
* console.log(connections.length); // 2 (conn2 has been removed)
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @remarks
|
|
46
|
+
* This function mutates the original array using splice().
|
|
47
|
+
* If the connection is not found (findIndex returns -1), splice will remove the last element.
|
|
48
|
+
* Ensure the connection exists in the array before calling this function to avoid unintended removals.
|
|
49
|
+
*/
|
|
50
|
+
export declare function RemoveConnectionFromList(connectionList: Connection[] | undefined, connection: Connection): void;
|
|
51
|
+
/**
|
|
52
|
+
* Removes an LConnection (lightweight connection) from an array by matching its ID.
|
|
53
|
+
*
|
|
54
|
+
* @param connectionList - Array of LConnections to remove from (will be mutated)
|
|
55
|
+
* @param connection - The LConnection to remove from the array
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* const lconnections = [lconn1, lconn2, lconn3];
|
|
60
|
+
* RemoveLConnectionFromList(lconnections, lconn2);
|
|
61
|
+
* console.log(lconnections.length); // 2 (lconn2 has been removed)
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* @remarks
|
|
65
|
+
* This is the LConnection variant of RemoveConnectionFromList.
|
|
66
|
+
* LConnection is a lightweight representation used for performance optimization.
|
|
67
|
+
* This function mutates the original array using splice().
|
|
68
|
+
* If the connection is not found (findIndex returns -1), splice will remove the last element.
|
|
69
|
+
*
|
|
70
|
+
* @see {@link RemoveConnectionFromList}
|
|
71
|
+
*/
|
|
72
|
+
export declare function RemoveLConnectionFromList(connectionList: LConnection[] | undefined, connection: LConnection): void;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unique Insert Helper Module for Concept Connection System (CCS-JS)
|
|
3
|
+
*
|
|
4
|
+
* This module provides utility functions for inserting values into arrays while ensuring uniqueness.
|
|
5
|
+
* It prevents duplicate entries by checking if the value already exists before insertion.
|
|
6
|
+
*
|
|
7
|
+
* @module Helpers/UniqueInsert
|
|
8
|
+
* @see https://documentation.freeschema.com for data structure reference
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Inserts a number into an array only if it doesn't already exist.
|
|
12
|
+
*
|
|
13
|
+
* @param Array - Array of numbers to insert into (will be mutated if insertion occurs)
|
|
14
|
+
* @param toInsert - The number to insert into the array
|
|
15
|
+
* @returns The modified array with the number inserted (or unchanged if it already existed)
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const numbers = [1, 2, 3];
|
|
20
|
+
* InsertUniqueNumber(numbers, 4); // [1, 2, 3, 4]
|
|
21
|
+
* InsertUniqueNumber(numbers, 2); // [1, 2, 3, 4] (2 already exists, no change)
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @remarks
|
|
25
|
+
* This function mutates the original array by pushing the value if it's not found.
|
|
26
|
+
* Uses indexOf() for checking existence, which has O(n) time complexity.
|
|
27
|
+
* For large arrays with frequent insertions, consider using a Set data structure instead.
|
|
28
|
+
*/
|
|
29
|
+
export default function InsertUniqueNumber(Array: number[], toInsert: number): number[];
|