mftsccs-node 0.0.57 → 0.0.59

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.
Files changed (182) hide show
  1. package/README.md +1148 -11
  2. package/dist/bundle.js +1 -1
  3. package/dist/types/Api/Create/CreateTheCharacter.d.ts +42 -0
  4. package/dist/types/Api/Create/CreateTheConceptApi.d.ts +50 -0
  5. package/dist/types/Api/Create/CreateTheConnectionApi.d.ts +51 -0
  6. package/dist/types/Api/Create/CreateTheTextData.d.ts +56 -0
  7. package/dist/types/Api/Delete/DeleteConceptInBackend.d.ts +43 -0
  8. package/dist/types/Api/DeleteConnectionApiBulk.d.ts +55 -0
  9. package/dist/types/Api/DeleteTheConcept.d.ts +64 -0
  10. package/dist/types/Api/DeleteTheConnection.d.ts +76 -0
  11. package/dist/types/Api/GetAiData.d.ts +36 -0
  12. package/dist/types/Api/GetAllConcepts.d.ts +42 -0
  13. package/dist/types/Api/GetAllConceptsByType.d.ts +45 -0
  14. package/dist/types/Api/GetAllConnections.d.ts +48 -0
  15. package/dist/types/Api/GetAllConnectionsOfComposition.d.ts +79 -0
  16. package/dist/types/Api/GetAllConnectionsOfCompositionBulk.d.ts +90 -0
  17. package/dist/types/Api/GetAllLinkerConnectionsFromTheConcept.d.ts +52 -0
  18. package/dist/types/Api/GetAllLinkerConnectionsToTheConcept.d.ts +61 -0
  19. package/dist/types/Api/GetAllPrefetchConnections.d.ts +51 -0
  20. package/dist/types/Api/GetCharacterDataByCharacter.d.ts +31 -0
  21. package/dist/types/Api/GetCompositionConnectionsBetweenTwoConcepts.d.ts +39 -0
  22. package/dist/types/Api/GetConcept.d.ts +47 -0
  23. package/dist/types/Api/GetConceptBulk.d.ts +68 -0
  24. package/dist/types/Api/GetConceptByCharacterAndType.d.ts +75 -0
  25. package/dist/types/Api/GetConceptByCharacterValue.d.ts +47 -0
  26. package/dist/types/Api/GetConnection.d.ts +49 -0
  27. package/dist/types/Api/GetConnectionBulk.d.ts +46 -0
  28. package/dist/types/Api/GetConnectionOfTheConcept.d.ts +50 -0
  29. package/dist/types/Api/GetConnectionToTheConcept.d.ts +56 -0
  30. package/dist/types/Api/GetReservedConnectionIds.d.ts +36 -0
  31. package/dist/types/Api/GetReservedIds.d.ts +37 -0
  32. package/dist/types/Api/Login.d.ts +38 -0
  33. package/dist/types/Api/MakeTheNameInBackend.d.ts +39 -0
  34. package/dist/types/Api/MakeTheTypeConceptApi.d.ts +40 -0
  35. package/dist/types/Api/RecursiveSearch.d.ts +43 -0
  36. package/dist/types/Api/Search/FreeschemaQueryApi.d.ts +46 -0
  37. package/dist/types/Api/Search/Search.d.ts +67 -0
  38. package/dist/types/Api/Search/SearchInternalApi.d.ts +69 -0
  39. package/dist/types/Api/Search/SearchLinkMultipleApi.d.ts +90 -0
  40. package/dist/types/Api/Search/SearchWithLinker.d.ts +97 -0
  41. package/dist/types/Api/SearchConcept/GetConceptByCharacterAndCategoryApi.d.ts +39 -0
  42. package/dist/types/Api/SearchConcept/GetConceptByCharacterAndCategoryDirect.d.ts +47 -0
  43. package/dist/types/Api/Session/CreateSession.d.ts +45 -0
  44. package/dist/types/Api/Session/CreateSessionVisit.d.ts +43 -0
  45. package/dist/types/Api/Signin.d.ts +48 -0
  46. package/dist/types/Api/Signup.d.ts +44 -0
  47. package/dist/types/Api/View/ViewInternalDataApi.d.ts +50 -0
  48. package/dist/types/Constants/ApiConstants.d.ts +226 -0
  49. package/dist/types/Constants/FormatConstants.d.ts +81 -0
  50. package/dist/types/DataStructures/BaseUrl.d.ts +210 -0
  51. package/dist/types/DataStructures/BinaryCharacterTree.d.ts +211 -0
  52. package/dist/types/DataStructures/BinaryTree.d.ts +139 -0
  53. package/dist/types/DataStructures/BinaryTypeTree.d.ts +196 -0
  54. package/dist/types/DataStructures/CharacterRepository.d.ts +109 -0
  55. package/dist/types/DataStructures/Composition/Composition.d.ts +103 -0
  56. package/dist/types/DataStructures/Composition/CompositionBinaryTree.d.ts +104 -0
  57. package/dist/types/DataStructures/Composition/CompositionNode.d.ts +202 -0
  58. package/dist/types/DataStructures/Concept.d.ts +110 -0
  59. package/dist/types/DataStructures/ConceptData.d.ts +292 -0
  60. package/dist/types/DataStructures/ConceptsToDraw.d.ts +168 -0
  61. package/dist/types/DataStructures/Connection.d.ts +76 -0
  62. package/dist/types/DataStructures/ConnectionBinaryTree/ConnectionBinaryTree.d.ts +115 -0
  63. package/dist/types/DataStructures/ConnectionBinaryTree/ConnectionNode.d.ts +169 -0
  64. package/dist/types/DataStructures/ConnectionBinaryTree/ConnectionTypeTree.d.ts +82 -0
  65. package/dist/types/DataStructures/ConnectionData.d.ts +191 -0
  66. package/dist/types/DataStructures/Count/CountInfo.d.ts +73 -0
  67. package/dist/types/DataStructures/FilterSearch.d.ts +84 -0
  68. package/dist/types/DataStructures/IdentifierFlags.d.ts +34 -0
  69. package/dist/types/DataStructures/Local/LConcept.d.ts +105 -0
  70. package/dist/types/DataStructures/Local/LConnection.d.ts +83 -0
  71. package/dist/types/DataStructures/Local/LNode.d.ts +190 -0
  72. package/dist/types/DataStructures/Local/LocalBinaryCharacterTree.d.ts +133 -0
  73. package/dist/types/DataStructures/Local/LocalBinaryTree.d.ts +135 -0
  74. package/dist/types/DataStructures/Local/LocalBinaryTypeTree.d.ts +147 -0
  75. package/dist/types/DataStructures/Local/LocalConceptData.d.ts +100 -0
  76. package/dist/types/DataStructures/Local/LocalConnectionData.d.ts +109 -0
  77. package/dist/types/DataStructures/Local/LocalSyncData.d.ts +89 -0
  78. package/dist/types/DataStructures/PatcherStructure.d.ts +86 -0
  79. package/dist/types/DataStructures/ReferentInfo.d.ts +68 -0
  80. package/dist/types/DataStructures/ReservedIds.d.ts +101 -0
  81. package/dist/types/DataStructures/Responses/ErrorResponse.d.ts +184 -22
  82. package/dist/types/DataStructures/Responses/StandardResponses.d.ts +65 -0
  83. package/dist/types/DataStructures/Returner.d.ts +59 -0
  84. package/dist/types/DataStructures/Search/FreeschemaQuery.d.ts +165 -0
  85. package/dist/types/DataStructures/Search/SearchStructure.d.ts +69 -0
  86. package/dist/types/DataStructures/SearchQuery.d.ts +130 -0
  87. package/dist/types/DataStructures/Security/TokenStorage.d.ts +48 -0
  88. package/dist/types/DataStructures/Session/SessionData.d.ts +118 -0
  89. package/dist/types/DataStructures/SettingData.d.ts +32 -0
  90. package/dist/types/DataStructures/Settings.d.ts +27 -0
  91. package/dist/types/DataStructures/SigninModel.d.ts +50 -0
  92. package/dist/types/DataStructures/SignupModel.d.ts +50 -0
  93. package/dist/types/DataStructures/SyncData.d.ts +206 -0
  94. package/dist/types/DataStructures/TheCharacter.d.ts +87 -0
  95. package/dist/types/DataStructures/TheTexts.d.ts +92 -0
  96. package/dist/types/DataStructures/Transaction/Transaction.d.ts +294 -4
  97. package/dist/types/DataStructures/User/UserBinaryTree.d.ts +117 -0
  98. package/dist/types/DataStructures/User/UserNode.d.ts +130 -0
  99. package/dist/types/Database/GetConceptFromIndexDb.d.ts +9 -0
  100. package/dist/types/Database/NoIndexDb.d.ts +169 -0
  101. package/dist/types/Database/indexdblocal.d.ts +42 -0
  102. package/dist/types/Database/indexeddb.d.ts +43 -0
  103. package/dist/types/Drawing/ConceptDraw.d.ts +28 -0
  104. package/dist/types/Drawing/ConceptEvents.d.ts +46 -0
  105. package/dist/types/Helpers/CheckIfExists.d.ts +159 -0
  106. package/dist/types/Helpers/RemoveFromArray.d.ts +66 -0
  107. package/dist/types/Helpers/UniqueInsert.d.ts +28 -0
  108. package/dist/types/Services/CheckForConnectionDeletion.d.ts +190 -0
  109. package/dist/types/Services/Common/DecodeCountInfo.d.ts +54 -0
  110. package/dist/types/Services/Common/ErrorPosting.d.ts +49 -0
  111. package/dist/types/Services/Common/RegexFunction.d.ts +28 -0
  112. package/dist/types/Services/Composition/BuildComposition.d.ts +37 -0
  113. package/dist/types/Services/Composition/CompositionCache.d.ts +89 -0
  114. package/dist/types/Services/Composition/CreateCompositionCache.d.ts +43 -0
  115. package/dist/types/Services/Conversion/ConvertConcepts.d.ts +83 -0
  116. package/dist/types/Services/CreateBinaryTreeFromData.d.ts +38 -0
  117. package/dist/types/Services/CreateCharacterBinaryTreeFromData.d.ts +42 -0
  118. package/dist/types/Services/CreateConnectionBetweenTwoConcepts.d.ts +206 -0
  119. package/dist/types/Services/CreateDefaultConcept.d.ts +114 -0
  120. package/dist/types/Services/CreateTheComposition.d.ts +101 -0
  121. package/dist/types/Services/CreateTheConcept.d.ts +179 -0
  122. package/dist/types/Services/CreateTheConnection.d.ts +59 -0
  123. package/dist/types/Services/CreateTheConnectionGeneral.d.ts +127 -0
  124. package/dist/types/Services/CreateTypeTreeFromData.d.ts +43 -0
  125. package/dist/types/Services/Delete/DeleteConnectionByType.d.ts +52 -5
  126. package/dist/types/Services/Delete/GetAllConnectionByType.d.ts +57 -9
  127. package/dist/types/Services/DeleteConcept.d.ts +136 -0
  128. package/dist/types/Services/DeleteConnection.d.ts +194 -0
  129. package/dist/types/Services/FindConeceptsFromConnection.d.ts +179 -0
  130. package/dist/types/Services/FindConnectionsOfCompositionBulkInMemory.d.ts +157 -0
  131. package/dist/types/Services/GenerateHexNumber.d.ts +64 -0
  132. package/dist/types/Services/GetComposition.d.ts +331 -0
  133. package/dist/types/Services/GetCompositionBulk.d.ts +251 -3
  134. package/dist/types/Services/GetCompositionList.d.ts +130 -0
  135. package/dist/types/Services/GetConceptByCharacter.d.ts +84 -0
  136. package/dist/types/Services/GetConnections.d.ts +72 -0
  137. package/dist/types/Services/GetDataFromIndexDb.d.ts +79 -0
  138. package/dist/types/Services/GetLink.d.ts +104 -0
  139. package/dist/types/Services/GetLinkerConnectionFromConcept.d.ts +99 -0
  140. package/dist/types/Services/GetMaximumConnectionSyncTime.d.ts +57 -0
  141. package/dist/types/Services/GetRelation.d.ts +162 -0
  142. package/dist/types/Services/GetTheConcept.d.ts +71 -0
  143. package/dist/types/Services/GetTheReferent.d.ts +74 -0
  144. package/dist/types/Services/InitializeSystem.d.ts +119 -0
  145. package/dist/types/Services/Local/CreateDefaultLConcept.d.ts +48 -0
  146. package/dist/types/Services/Local/CreateLocalBinaryTreeFromData.d.ts +49 -0
  147. package/dist/types/Services/Local/CreateLocalBinaryTypeTreeFromData.d.ts +54 -0
  148. package/dist/types/Services/Local/CreateLocalCharacterBinaryTree.d.ts +60 -0
  149. package/dist/types/Services/Local/CreateTheCompositionLocal.d.ts +70 -0
  150. package/dist/types/Services/Local/CreateTheConceptLocal.d.ts +58 -0
  151. package/dist/types/Services/Local/CreateTheConnectionLocal.d.ts +56 -0
  152. package/dist/types/Services/Local/GetCompositionListLocal.d.ts +103 -0
  153. package/dist/types/Services/Local/GetCompositionLocal.d.ts +96 -0
  154. package/dist/types/Services/Local/GetConceptByCharacterLocal.d.ts +57 -0
  155. package/dist/types/Services/Local/MakeTheConceptLocal.d.ts +71 -0
  156. package/dist/types/Services/Local/MakeTheInstanceConceptLocal.d.ts +89 -0
  157. package/dist/types/Services/Local/MakeTheTypeLocal.d.ts +71 -0
  158. package/dist/types/Services/Local/UpdateCompositionLocal.d.ts +101 -0
  159. package/dist/types/Services/MakeTheCharacter.d.ts +74 -0
  160. package/dist/types/Services/MakeTheCharacterData.d.ts +65 -0
  161. package/dist/types/Services/MakeTheInstanceConcept.d.ts +75 -0
  162. package/dist/types/Services/MakeTheName.d.ts +81 -0
  163. package/dist/types/Services/MakeTheTimestamp.d.ts +68 -0
  164. package/dist/types/Services/MakeTheTypeConcept.d.ts +68 -0
  165. package/dist/types/Services/Mqtt/publishMessage.d.ts +27 -0
  166. package/dist/types/Services/Mqtt/subscribeMessage.d.ts +23 -0
  167. package/dist/types/Services/PatchComposition.d.ts +105 -0
  168. package/dist/types/Services/Search/DataIdFormat.d.ts +96 -24
  169. package/dist/types/Services/Search/FormatData.d.ts +92 -17
  170. package/dist/types/Services/Search/JustIdFormat.d.ts +91 -16
  171. package/dist/types/Services/Search/NewFormat.d.ts +4 -0
  172. package/dist/types/Services/Search/SearchLinkInternal.d.ts +28 -0
  173. package/dist/types/Services/Search/SearchLinkMultiple.d.ts +58 -0
  174. package/dist/types/Services/Search/SearchWithTypeAndLinker.d.ts +92 -24
  175. package/dist/types/Services/Search/orderingConnections.d.ts +34 -0
  176. package/dist/types/Services/SplitStrings.d.ts +50 -0
  177. package/dist/types/Services/UpdateComposition.d.ts +123 -0
  178. package/dist/types/Services/User/UserTranslation.d.ts +102 -0
  179. package/dist/types/Services/View/ViewInternalData.d.ts +32 -0
  180. package/dist/types/WrapperFunctions/SchemaQueryObservable.d.ts +140 -5
  181. package/dist/types/app.d.ts +72 -1
  182. package/package.json +1 -1
@@ -1,5 +1,184 @@
1
+ /**
2
+ * Concept creation service module.
3
+ * Provides functions for creating concepts in different modes: normal, temporary, and immediate.
4
+ *
5
+ * @module Services/CreateTheConcept
6
+ * @see https://documentation.freeschema.com/#concept for concept documentation
7
+ */
1
8
  import { Concept } from "../DataStructures/Concept";
2
9
  import { InnerActions } from "../DataStructures/Transaction/Transaction";
10
+ /**
11
+ * Creates a new concept and adds it to the sync queue for backend synchronization.
12
+ * This is the standard way to create a concept that will be persisted to the backend.
13
+ * The concept is marked as new (isNew=true) and non-temporary (isTemp=false), and
14
+ * added to both SyncData (for backend sync) and the transaction actions list.
15
+ *
16
+ * @param referent - The character/string value representing the concept's content
17
+ * @param userId - The ID of the user creating this concept
18
+ * @param categoryId - The ID of the category concept this concept belongs to
19
+ * @param categoryUserId - The user ID of the category concept owner
20
+ * @param typeId - The ID of the type concept that defines this concept's type
21
+ * @param typeUserId - The user ID of the type concept owner
22
+ * @param referentId - The ID of the referent concept (what this concept refers to)
23
+ * @param referentUserId - The user ID of the referent concept owner
24
+ * @param securityId - The ID of the security concept controlling access
25
+ * @param securityUserId - The user ID of the security concept owner
26
+ * @param accessId - The ID of the access concept defining permissions
27
+ * @param accessUserId - The user ID of the access concept owner
28
+ * @param sessionInformationId - The ID of the session concept for tracking
29
+ * @param sessionInformationUserId - The user ID of the session concept owner
30
+ * @param actions - Transaction object to track all concepts and connections created in this operation
31
+ * @returns A Promise that resolves to the newly created Concept instance
32
+ *
33
+ * @example
34
+ * ```typescript
35
+ * // Create a new concept with all required metadata
36
+ * const concept = await CreateTheConcept(
37
+ * 'John Doe', // referent (the actual value)
38
+ * 1, // userId
39
+ * 10, 1, // categoryId, categoryUserId
40
+ * 20, 1, // typeId, typeUserId (e.g., "Person" type)
41
+ * 0, 0, // referentId, referentUserId (no referent)
42
+ * 30, 1, // securityId, securityUserId
43
+ * 40, 1, // accessId, accessUserId
44
+ * 50, 1, // sessionInformationId, sessionInformationUserId
45
+ * { concepts: [], connections: [] } // transaction actions
46
+ * );
47
+ *
48
+ * console.log(concept.id); // Auto-generated unique ID
49
+ * console.log(concept.isNew); // true - will be synced to backend
50
+ * console.log(concept.isTemp); // false - permanent concept
51
+ * ```
52
+ *
53
+ * @remarks
54
+ * - Automatically generates a unique ID using ReservedIds.getId()
55
+ * - Sets creation and update timestamps to current time
56
+ * - Marks concept as new (isNew=true) for backend synchronization
57
+ * - Marks concept as non-temporary (isTemp=false) for persistence
58
+ * - Adds concept to SyncData queue for eventual backend sync
59
+ * - Adds concept to transaction actions for tracking within a transaction context
60
+ * - Does NOT immediately call the backend API; sync happens separately
61
+ *
62
+ * @see CreateTheConceptTemporary for creating temporary concepts
63
+ * @see CreateTheConceptImmediate for creating concepts with immediate backend sync
64
+ * @see Concept for the concept data structure
65
+ * @see SyncData for sync queue management
66
+ * @see ReservedIds for ID generation
67
+ */
3
68
  export default function CreateTheConcept(referent: string, userId: number, categoryId: number, categoryUserId: number, typeId: number, typeUserId: number, referentId: number, referentUserId: number, securityId: number, securityUserId: number, accessId: number, accessUserId: number, sessionInformationId: number, sessionInformationUserId: number, actions?: InnerActions): Promise<Concept>;
69
+ /**
70
+ * Creates a temporary concept that is NOT added to the sync queue or persisted to backend.
71
+ * Temporary concepts are useful for UI state management, draft operations, or transient data
72
+ * that doesn't need to be saved. The concept is marked as temporary (isTemp=true) and new (isNew=true).
73
+ *
74
+ * @param referent - The character/string value representing the concept's content
75
+ * @param userId - The ID of the user creating this concept
76
+ * @param categoryId - The ID of the category concept this concept belongs to
77
+ * @param categoryUserId - The user ID of the category concept owner
78
+ * @param typeId - The ID of the type concept that defines this concept's type
79
+ * @param typeUserId - The user ID of the type concept owner
80
+ * @param referentId - The ID of the referent concept (what this concept refers to)
81
+ * @param referentUserId - The user ID of the referent concept owner
82
+ * @param securityId - The ID of the security concept controlling access
83
+ * @param securityUserId - The user ID of the security concept owner
84
+ * @param accessId - The ID of the access concept defining permissions
85
+ * @param accessUserId - The user ID of the access concept owner
86
+ * @param sessionInformationId - The ID of the session concept for tracking
87
+ * @param sessionInformationUserId - The user ID of the session concept owner
88
+ * @returns A Promise that resolves to the newly created temporary Concept instance
89
+ *
90
+ * @example
91
+ * ```typescript
92
+ * // Create a temporary concept for UI draft state
93
+ * const draftConcept = await CreateTheConceptTemporary(
94
+ * 'Draft Note', // referent
95
+ * 1, // userId
96
+ * 10, 1, // categoryId, categoryUserId
97
+ * 20, 1, // typeId, typeUserId
98
+ * 0, 0, // referentId, referentUserId
99
+ * 30, 1, // securityId, securityUserId
100
+ * 40, 1, // accessId, accessUserId
101
+ * 50, 1 // sessionInformationId, sessionInformationUserId
102
+ * );
103
+ *
104
+ * console.log(draftConcept.isTemp); // true - won't be synced
105
+ * console.log(draftConcept.isNew); // true - marked as new
106
+ * // This concept will NOT be added to SyncData or saved to backend
107
+ * ```
108
+ *
109
+ * @remarks
110
+ * - Automatically generates a unique ID using ReservedIds.getId()
111
+ * - Sets creation and update timestamps to current time
112
+ * - Marks concept as new (isNew=true) but also temporary (isTemp=true)
113
+ * - Does NOT add concept to SyncData (no backend sync)
114
+ * - Does NOT add concept to transaction actions
115
+ * - Useful for draft states, temporary UI elements, or client-only data
116
+ * - The concept exists only in client memory until explicitly converted/saved
117
+ *
118
+ * @see CreateTheConcept for creating persistent concepts
119
+ * @see CreateTheConceptImmediate for creating concepts with immediate backend sync
120
+ * @see Concept for the concept data structure
121
+ */
4
122
  export declare function CreateTheConceptTemporary(referent: string, userId: number, categoryId: number, categoryUserId: number, typeId: number, typeUserId: number, referentId: number, referentUserId: number, securityId: number, securityUserId: number, accessId: number, accessUserId: number, sessionInformationId: number, sessionInformationUserId: number): Promise<Concept>;
123
+ /**
124
+ * Creates a concept and immediately adds it to ConceptsData for instant availability in queries.
125
+ * Unlike CreateTheConcept, this function adds the concept to the in-memory ConceptsData store
126
+ * immediately (not just SyncData), making it instantly searchable. It also sets updateRecursion=true
127
+ * to enable recursive updates. The concept is marked as not new (isNew=false) and non-temporary.
128
+ *
129
+ * @param referent - The character/string value representing the concept's content
130
+ * @param userId - The ID of the user creating this concept
131
+ * @param categoryId - The ID of the category concept this concept belongs to
132
+ * @param categoryUserId - The user ID of the category concept owner
133
+ * @param typeId - The ID of the type concept that defines this concept's type
134
+ * @param typeUserId - The user ID of the type concept owner
135
+ * @param referentId - The ID of the referent concept (what this concept refers to)
136
+ * @param referentUserId - The user ID of the referent concept owner
137
+ * @param securityId - The ID of the security concept controlling access
138
+ * @param securityUserId - The user ID of the security concept owner
139
+ * @param accessId - The ID of the access concept defining permissions
140
+ * @param accessUserId - The user ID of the access concept owner
141
+ * @param sessionInformationId - The ID of the session concept for tracking
142
+ * @param sessionInformationUserId - The user ID of the session concept owner
143
+ * @param actions - Transaction object to track all concepts and connections created in this operation
144
+ * @returns A Promise that resolves to the newly created Concept instance
145
+ *
146
+ * @example
147
+ * ```typescript
148
+ * // Create a concept that's immediately available for queries
149
+ * const concept = await CreateTheConceptImmediate(
150
+ * 'Important User', // referent
151
+ * 1, // userId
152
+ * 10, 1, // categoryId, categoryUserId
153
+ * 20, 1, // typeId, typeUserId
154
+ * 0, 0, // referentId, referentUserId
155
+ * 30, 1, // securityId, securityUserId
156
+ * 40, 1, // accessId, accessUserId
157
+ * 50, 1, // sessionInformationId, sessionInformationUserId
158
+ * { concepts: [], connections: [] } // transaction actions
159
+ * );
160
+ *
161
+ * // Concept is immediately available in ConceptsData
162
+ * const found = ConceptsData.getConceptById(concept.id);
163
+ * console.log(found !== null); // true - immediately findable
164
+ * console.log(concept.isNew); // false - treated as existing
165
+ * console.log(concept.updateRecursion); // true - enables recursive updates
166
+ * ```
167
+ *
168
+ * @remarks
169
+ * - Automatically generates a unique ID using ReservedIds.getId()
170
+ * - Sets creation and update timestamps to current time
171
+ * - Marks concept as NOT new (isNew=false) - treated as existing concept
172
+ * - Marks concept as non-temporary (isTemp=false)
173
+ * - Adds concept to ConceptsData immediately for instant query availability
174
+ * - Sets updateRecursion=true to enable recursive composition updates
175
+ * - Adds concept to SyncData for backend synchronization
176
+ * - Adds concept to transaction actions for tracking
177
+ * - The commented-out line suggests this previously triggered immediate API sync
178
+ *
179
+ * @see CreateTheConcept for standard concept creation with delayed sync
180
+ * @see CreateTheConceptTemporary for creating temporary concepts
181
+ * @see ConceptsData for the in-memory concept store
182
+ * @see SyncData for sync queue management
183
+ */
5
184
  export declare function CreateTheConceptImmediate(referent: string, userId: number, categoryId: number, categoryUserId: number, typeId: number, typeUserId: number, referentId: number, referentUserId: number, securityId: number, securityUserId: number, accessId: number, accessUserId: number, sessionInformationId: number, sessionInformationUserId: number, actions?: InnerActions): Promise<Concept>;
@@ -1,2 +1,61 @@
1
+ /**
2
+ * Connection Creation Service
3
+ *
4
+ * This module provides functionality for creating temporary connections between concepts
5
+ * in the Concept Connection System. It handles basic connection creation with default
6
+ * security and access settings.
7
+ *
8
+ * @module CreateTheConnection
9
+ */
1
10
  import { Connection } from "../DataStructures/Connection";
11
+ /**
12
+ * Creates a temporary connection between two concepts with default settings.
13
+ *
14
+ * This function establishes a basic connection relationship between a source concept
15
+ * (ofTheConcept) and a target concept (toTheConcept). The created connection is marked
16
+ * as temporary (isTemp = true) and assigned a random ID. It automatically handles the
17
+ * special case where a concept connects to itself by setting predefined IDs.
18
+ *
19
+ * The function uses default values for security (0), access level (4), and order (1),
20
+ * making it suitable for quick connection creation during prototyping or when advanced
21
+ * configuration is not required.
22
+ *
23
+ * @param ofTheConceptId - The ID of the source concept from which the connection originates
24
+ * @param ofTheConceptUserId - The user ID who owns the source concept
25
+ * @param toTheConceptId - The ID of the target concept to which the connection points
26
+ * @param toTheConceptUserId - The user ID who owns the target concept
27
+ * @param typeId - The ID of the concept that defines the type/nature of this connection
28
+ * @param sessionInformationId - The ID of the session in which this connection is created
29
+ * @param sessionInformationUserId - The user ID associated with the session information
30
+ *
31
+ * @returns A new Connection object that has been added to SyncData for synchronization
32
+ *
33
+ * @example
34
+ * ```typescript
35
+ * // Create a simple "likes" connection between user's concepts
36
+ * const likesConcept = await GetConceptByCharacter("likes");
37
+ * const connection = createTheConnection(
38
+ * userConcept.id,
39
+ * userConcept.userId,
40
+ * postConcept.id,
41
+ * postConcept.userId,
42
+ * likesConcept.id,
43
+ * 999,
44
+ * 999
45
+ * );
46
+ * console.log("Connection created:", connection.id);
47
+ * ```
48
+ *
49
+ * @remarks
50
+ * - The connection is marked as temporary (isTemp = true) and assigned a random ID
51
+ * - Self-referencing connections (where ofTheConceptId equals toTheConceptId) are handled
52
+ * specially by setting ofTheConceptId to 0 and toTheConceptId to 1
53
+ * - Default security level is set to 0 and access level to 4
54
+ * - The connection is automatically added to SyncData for later synchronization
55
+ * - For production use with reserved IDs and more control, consider using CreateTheConnectionGeneral
56
+ *
57
+ * @see {@link CreateTheConnectionGeneral} for creating connections with more configuration options
58
+ * @see {@link Connection} for the connection data structure
59
+ * @see {@link SyncData.AddConnection} for how connections are queued for sync
60
+ */
2
61
  export declare function createTheConnection(ofTheConceptId: number, ofTheConceptUserId: number, toTheConceptId: number, toTheConceptUserId: number, typeId: number, sessionInformationId: number, sessionInformationUserId: number): Connection;
@@ -1,5 +1,132 @@
1
+ /**
2
+ * General Connection Creation Service
3
+ *
4
+ * This module provides advanced functionality for creating permanent connections between
5
+ * concepts with reserved IDs and configurable settings. It supports transaction tracking
6
+ * and is designed for production use where connections need to be persisted and updated.
7
+ *
8
+ * @module CreateTheConnectionGeneral
9
+ */
1
10
  import { Concept } from "../app";
2
11
  import { Connection } from "../DataStructures/Connection";
3
12
  import { InnerActions } from "../DataStructures/Transaction/Transaction";
13
+ /**
14
+ * Creates a permanent connection between two concepts with reserved ID and full configuration.
15
+ *
16
+ * This is the production-ready version of connection creation that uses reserved IDs from
17
+ * the system's ID reservation pool. Unlike the basic createTheConnection, this function
18
+ * marks connections as non-temporary (isTemp = false) and sets them to update mode
19
+ * (toUpdate = true), ensuring they persist properly in the database.
20
+ *
21
+ * The function provides extensive configurability including custom order, access levels,
22
+ * and user assignment. It also supports transaction tracking by accepting an actions
23
+ * object where created connections are logged.
24
+ *
25
+ * @param ofTheConceptId - The ID of the source concept from which the connection originates
26
+ * @param ofTheConceptUserId - The user ID who owns the source concept
27
+ * @param toTheConceptId - The ID of the target concept to which the connection points
28
+ * @param toTheConceptUserId - The user ID who owns the target concept
29
+ * @param typeId - The ID of the concept that defines the type/nature of this connection
30
+ * @param sessionInformationId - The ID of the session in which this connection is created
31
+ * @param sessionInformationUserId - The user ID associated with the session information
32
+ * @param orderId - Optional ordering value for the connection (default: 1)
33
+ * @param accessId - Optional access level for the connection (default: 4)
34
+ * @param passedUserId - Optional specific user ID to assign to the connection (default: 999, uses ofTheConceptUserId if not provided)
35
+ * @param actions - Optional transaction tracking object to log created connections (default: empty actions)
36
+ *
37
+ * @returns A promise that resolves to the created Connection object with a reserved ID
38
+ *
39
+ * @example
40
+ * ```typescript
41
+ * // Create a production connection with transaction tracking
42
+ * const actions: InnerActions = { concepts: [], connections: [] };
43
+ * const connection = await CreateTheConnectionGeneral(
44
+ * authorConcept.id,
45
+ * authorConcept.userId,
46
+ * bookConcept.id,
47
+ * bookConcept.userId,
48
+ * wroteTypeConcept.id,
49
+ * 999,
50
+ * 999,
51
+ * 1,
52
+ * 4,
53
+ * authorConcept.userId,
54
+ * actions
55
+ * );
56
+ * console.log("Connection ID:", connection.id);
57
+ * console.log("Tracked connections:", actions.connections.length);
58
+ * ```
59
+ *
60
+ * @remarks
61
+ * - Uses reserved IDs from ReservedConnectionIds for guaranteed uniqueness
62
+ * - Connection is marked as non-temporary (isTemp = false) for persistence
63
+ * - Sets toUpdate = true to ensure database synchronization
64
+ * - Self-referencing connections are handled by setting ofTheConceptId to 0 and toTheConceptId to 1
65
+ * - The connection is added to both SyncData and the provided actions object
66
+ * - If passedUserId is 999, the function defaults to using ofTheConceptUserId
67
+ *
68
+ * @see {@link createTheConnection} for creating temporary connections
69
+ * @see {@link CreateConnection} for a simplified high-level connection API
70
+ * @see {@link ReservedConnectionIds.getId} for ID reservation mechanism
71
+ */
4
72
  export declare function CreateTheConnectionGeneral(ofTheConceptId: number, ofTheConceptUserId: number, toTheConceptId: number, toTheConceptUserId: number, typeId: number, sessionInformationId: number, sessionInformationUserId: number, orderId?: number, accessId?: number, passedUserId?: number, actions?: InnerActions): Promise<Connection>;
73
+ /**
74
+ * Creates a connection between two concepts using a type string identifier.
75
+ *
76
+ * This is a high-level convenience function that simplifies connection creation by
77
+ * accepting concept objects directly and a string for the connection type. It automatically
78
+ * handles the creation or retrieval of the connection type concept and delegates to
79
+ * CreateTheConnectionGeneral for the actual connection creation.
80
+ *
81
+ * This function is ideal for application-level code where you want to create connections
82
+ * using semantic type names (like "contains", "authored", "belongs_to") rather than
83
+ * managing type concept IDs manually.
84
+ *
85
+ * @param ofTheConcept - The source Concept object from which the connection originates
86
+ * @param toTheConcept - The target Concept object to which the connection points
87
+ * @param connectionTypeString - A string describing the connection type (e.g., "contains", "references")
88
+ * @param actions - Optional transaction tracking object to log created connections (default: empty actions)
89
+ *
90
+ * @returns A promise that resolves to the created Connection object
91
+ *
92
+ * @example
93
+ * ```typescript
94
+ * // Create a "contains" connection between a folder and a file
95
+ * const folderConcept = await GetTheConcept(123);
96
+ * const fileConcept = await GetTheConcept(456);
97
+ * const actions: InnerActions = { concepts: [], connections: [] };
98
+ *
99
+ * const connection = await CreateConnection(
100
+ * folderConcept,
101
+ * fileConcept,
102
+ * "contains",
103
+ * actions
104
+ * );
105
+ *
106
+ * console.log(`Created ${connectionTypeString} connection:`, connection.id);
107
+ * ```
108
+ *
109
+ * @example
110
+ * ```typescript
111
+ * // Create an "authored" connection between author and book
112
+ * const authorConcept = await GetTheConcept(789);
113
+ * const bookConcept = await GetTheConcept(101);
114
+ *
115
+ * const connection = await CreateConnection(
116
+ * authorConcept,
117
+ * bookConcept,
118
+ * "authored"
119
+ * );
120
+ * ```
121
+ *
122
+ * @remarks
123
+ * - Automatically creates or retrieves a type concept for the connectionTypeString
124
+ * - Uses default session information ID (999) and order (1000)
125
+ * - Access level is set to 4 (standard access)
126
+ * - The userId from ofTheConcept is used for the connection
127
+ * - The connection is tracked in the provided actions object for transaction management
128
+ *
129
+ * @see {@link CreateTheConnectionGeneral} for the underlying connection creation logic
130
+ * @see {@link MakeTheTypeConceptApi} for how type concepts are created/retrieved
131
+ */
5
132
  export declare function CreateConnection(ofTheConcept: Concept, toTheConcept: Concept, connectionTypeString: string, actions?: InnerActions): Promise<Connection>;
@@ -1 +1,44 @@
1
+ /**
2
+ * Type-Based Binary Tree Data Loading Service
3
+ *
4
+ * This module provides functionality for creating and populating a type-based binary tree
5
+ * data structure from persisted concept data. The tree is organized by type identifiers,
6
+ * enabling efficient type-based categorization, filtering, and retrieval of concepts.
7
+ *
8
+ * @module CreateTypeTreeFromData
9
+ */
10
+ /**
11
+ * Creates and populates a type-based binary tree from concept data stored in the database.
12
+ *
13
+ * This function retrieves all concept records from IndexedDB and constructs a binary tree
14
+ * where nodes are organized by their type identifiers (typeId). This organization enables
15
+ * efficient grouping and retrieval of concepts by their type classification.
16
+ *
17
+ * The BinaryTypeTree structure is essential for type-based queries and operations, allowing
18
+ * the system to quickly find all concepts of a particular type without scanning the entire
19
+ * dataset. Performance metrics are tracked to monitor loading times.
20
+ *
21
+ * @returns A promise that resolves when the type binary tree has been fully populated
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * // Build the type-based binary tree from database
26
+ * await CreateTypeTreeFromData();
27
+ *
28
+ * // The tree can now be used for type-based queries
29
+ * const conceptsOfType = BinaryTypeTree.getByType(42);
30
+ * console.log('All concepts of type 42:', conceptsOfType);
31
+ * ```
32
+ *
33
+ * @remarks
34
+ * - Tracks execution time for performance monitoring (startTime, endTime, time variables)
35
+ * - Each concept is wrapped in a Node using its typeId property as the organizational key
36
+ * - The tree is built sequentially by iterating through all retrieved concepts
37
+ * - Type identifiers determine node placement in the binary tree structure
38
+ * - Time measurements are calculated but not currently returned or logged
39
+ *
40
+ * @see {@link BinaryTypeTree.addNodeToTree} for how nodes are inserted into the tree
41
+ * @see {@link Node} for the node data structure used in the tree
42
+ * @see {@link getFromDatabaseWithTypeOld} for database retrieval implementation
43
+ */
1
44
  export declare function CreateTypeTreeFromData(): Promise<void>;
@@ -1,13 +1,60 @@
1
1
  /**
2
+ * @module DeleteConnectionByType
3
+ * @description Provides functions to delete and retrieve connections by their type
4
+ */
5
+ /**
6
+ * Deletes all connections of specified types from a concept.
7
+ * Finds connections matching the given linker types and deletes them.
8
+ *
9
+ * @async
10
+ * @param {number} id - The concept ID whose connections should be deleted
11
+ * @param {string[]} linkers - Array of connection type names to delete
12
+ * @returns {Promise<boolean>} A promise that resolves to true if all deletions successful, false otherwise
2
13
  *
3
- * @param id the id of the concept whose connection needs to be returned
4
- * @param linkers the connection types whose connection id need to be found
14
+ * @example
15
+ * ```typescript
16
+ * const conceptId = 123;
17
+ * const linkersToDelete = ["follows", "likes", "shares"];
18
+ * const success = await DeleteConnectionByTypeBulk(conceptId, linkersToDelete);
19
+ * if (success) {
20
+ * console.log("All connections deleted successfully");
21
+ * }
22
+ * ```
23
+ *
24
+ * @remarks
25
+ * This function:
26
+ * - Fetches all linker connections from the concept
27
+ * - Gets concept objects for the specified linker type names
28
+ * - Matches connections by typeId with linker concept IDs
29
+ * - Deletes each matching connection
30
+ * - Returns false if any deletion fails
31
+ * - Uses bulk operations for efficiency
5
32
  */
6
33
  export declare function DeleteConnectionByTypeBulk(id: number, linkers: string[]): Promise<boolean>;
7
34
  /**
35
+ * Retrieves all connection IDs of specified types from a concept without deleting them.
36
+ * Useful for querying which connections exist before performing operations.
37
+ *
38
+ * @async
39
+ * @param {number} id - The concept ID whose connections should be retrieved
40
+ * @param {string[]} linkers - Array of connection type names to find
41
+ * @returns {Promise<number[]>} A promise that resolves to array of matching connection IDs
42
+ *
43
+ * @example
44
+ * ```typescript
45
+ * const conceptId = 123;
46
+ * const linkersToFind = ["follows", "likes"];
47
+ * const connectionIds = await GetConnectionByTypeBulk(conceptId, linkersToFind);
48
+ * // connectionIds = [101, 102, 103, 104]
49
+ * console.log(`Found ${connectionIds.length} connections`);
50
+ * ```
8
51
  *
9
- * @param id the id of the concept whose connection needs to be returned
10
- * @param linkers the connection types whose connection id need to be found
11
- * @returns list of ids of the connection
52
+ * @remarks
53
+ * This function:
54
+ * - Similar to DeleteConnectionByTypeBulk but only retrieves IDs
55
+ * - Does not modify any data
56
+ * - Returns empty array if no matching connections found
57
+ * - Useful for counting or inspecting connections before deletion
58
+ * - Can be used to check connection existence
12
59
  */
13
60
  export declare function GetConnectionByTypeBulk(id: number, linkers: string[]): Promise<number[]>;
@@ -1,16 +1,64 @@
1
+ /**
2
+ * @module GetAllConnectionByType
3
+ * @description Provides functions to retrieve connections filtered by type and direction
4
+ */
1
5
  import { Connection } from "../../app";
2
6
  /**
3
- * This function returns all the connections from the ofTheConceptId and connection type
4
- * @param id ofTheConceptId
5
- * @param linker the connection type
6
- * @param reverse if you put in reverse true then the reverse connections are returned.
7
- * @returns Array of connections
7
+ * Retrieves all connections of a specific type from or to a concept.
8
+ * Supports both forward (from concept) and reverse (to concept) direction.
9
+ *
10
+ * @async
11
+ * @param {number} id - The concept ID to query connections for
12
+ * @param {string} linker - The connection type name to filter by
13
+ * @param {boolean} [reverse=false] - If true, returns connections TO the concept; if false, returns connections FROM the concept
14
+ * @returns {Promise<Connection[]>} A promise that resolves to array of matching Connection objects
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * // Get all "follows" connections FROM concept 123
19
+ * const followsFrom = await GetAllTheConnectionsByTypeAndOfTheConcept(123, "follows", false);
20
+ *
21
+ * // Get all "follows" connections TO concept 123 (reverse)
22
+ * const followsTo = await GetAllTheConnectionsByTypeAndOfTheConcept(123, "follows", true);
23
+ * ```
24
+ *
25
+ * @remarks
26
+ * This function:
27
+ * - Forward direction (reverse=false): Returns connections where concept is ofTheConceptId
28
+ * - Reverse direction (reverse=true): Returns connections where concept is toTheConceptId
29
+ * - Creates or retrieves the linker concept by type name
30
+ * - Filters connections by matching typeId
31
+ * - Caches forward connections in ConnectionData
32
+ * - Returns empty array if no matching connections found
8
33
  */
9
34
  export declare function GetAllTheConnectionsByTypeAndOfTheConcept(id: number, linker: string, reverse?: boolean): Promise<Connection[]>;
10
35
  /**
11
- * This function returns all the connections from the ofTheConceptId with toTheConceptId and linkers as given, the reverse is also true.
12
- * @param id ofTheConceptId
13
- * @param linker the connection type
14
- * @returns Array of connections
36
+ * Retrieves specific connections between two concepts with a given linker type.
37
+ * Filters connections to match both the source, destination, and type.
38
+ *
39
+ * @async
40
+ * @param {number} ofTheConceptId - The source concept ID
41
+ * @param {number} toTheConceptId - The destination concept ID
42
+ * @param {string} linker - The connection type name
43
+ * @param {boolean} [reverse=false] - If true, swaps the direction (queries from toTheConceptId)
44
+ * @returns {Promise<Connection[]>} A promise that resolves to array of matching connections
45
+ *
46
+ * @example
47
+ * ```typescript
48
+ * // Find all "follows" connections from concept 123 to concept 456
49
+ * const connections = await GiveConnection(123, 456, "follows", false);
50
+ *
51
+ * // Find all "follows" connections from 456 to 123 (reverse direction)
52
+ * const reverseConnections = await GiveConnection(123, 456, "follows", true);
53
+ * ```
54
+ *
55
+ * @remarks
56
+ * This function:
57
+ * - First uses GetAllTheConnectionsByTypeAndOfTheConcept to get typed connections
58
+ * - Then filters by the destination concept ID
59
+ * - Forward (reverse=false): Returns connections from ofTheConceptId to toTheConceptId
60
+ * - Reverse (reverse=true): Returns connections from toTheConceptId to ofTheConceptId
61
+ * - Useful for finding specific connection instances between two concepts
62
+ * - Returns empty array if no matching connections exist
15
63
  */
16
64
  export declare function GiveConnection(ofTheConceptId: number, toTheConceptId: number, linker: string, reverse?: boolean): Promise<Connection[]>;