mftsccs-node 0.2.6 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (287) 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/SearchLinkInternal.d.ts +28 -0
  172. package/dist/types/Services/Search/SearchLinkMultiple.d.ts +58 -0
  173. package/dist/types/Services/Search/SearchWithTypeAndLinker.d.ts +92 -24
  174. package/dist/types/Services/Search/orderingConnections.d.ts +34 -0
  175. package/dist/types/Services/SplitStrings.d.ts +50 -0
  176. package/dist/types/Services/UpdateComposition.d.ts +123 -0
  177. package/dist/types/Services/User/UserTranslation.d.ts +102 -0
  178. package/dist/types/Services/View/ViewInternalData.d.ts +32 -0
  179. package/dist/types/WrapperFunctions/SchemaQueryObservable.d.ts +140 -5
  180. package/dist/types/app.d.ts +72 -1
  181. package/package.json +1 -1
  182. package/dist/main.bundle.js +0 -2
  183. package/dist/main.bundle.js.LICENSE.txt +0 -1
  184. package/dist/serviceWorker.bundle.js +0 -2
  185. package/dist/serviceWorker.bundle.js.LICENSE.txt +0 -1
  186. package/dist/types/AccessTracker/accessTracker.d.ts +0 -67
  187. package/dist/types/Anomaly/anomaly.d.ts +0 -103
  188. package/dist/types/Api/Create/CreateTheGhostConceptApi.d.ts +0 -3
  189. package/dist/types/Api/Create/CreateTheGhostConnectionApi.d.ts +0 -2
  190. package/dist/types/Api/Delete/DeleteUserInBackend.d.ts +0 -1
  191. package/dist/types/Api/DeleteConnectionBulkApi.d.ts +0 -1
  192. package/dist/types/Api/GetConnections/GetConnectionsByTypeApi.d.ts +0 -3
  193. package/dist/types/Api/Images/GetImages.d.ts +0 -1
  194. package/dist/types/Api/Local/GetLocalConceptByCharacterValue.d.ts +0 -2
  195. package/dist/types/Api/Prototype/CreatePrototype.d.ts +0 -2
  196. package/dist/types/Api/Prototype/Selector.d.ts +0 -15
  197. package/dist/types/Api/Search/SearchWithTypeAndLinker.d.ts +0 -2
  198. package/dist/types/Api/SearchConcept/GetTypeConceptByBulk.d.ts +0 -2
  199. package/dist/types/Api/Translate/TranslateLocalToReal.d.ts +0 -2
  200. package/dist/types/Constants/AccessConstants.d.ts +0 -3
  201. package/dist/types/Constants/ckeditorCSS.d.ts +0 -1
  202. package/dist/types/Constants/general.const.d.ts +0 -6
  203. package/dist/types/Constants/page.const.d.ts +0 -5
  204. package/dist/types/DataStructures/ConnectionBinaryTree/ConnectionOfNode.d.ts +0 -10
  205. package/dist/types/DataStructures/ConnectionBinaryTree/ConnectionOfTheTree.d.ts +0 -24
  206. package/dist/types/DataStructures/ConnectionBinaryTree/ConnectionTypeNode.d.ts +0 -10
  207. package/dist/types/DataStructures/ConnectionBinaryTree/NodePrimitive.d.ts +0 -15
  208. package/dist/types/DataStructures/ConnectionByType/GetConnectionByType.d.ts +0 -4
  209. package/dist/types/DataStructures/Local/LocalGhostIdTree.d.ts +0 -11
  210. package/dist/types/DataStructures/Local/LocalId.d.ts +0 -19
  211. package/dist/types/DataStructures/Prototype/Prototype.d.ts +0 -19
  212. package/dist/types/DataStructures/Prototype/PrototypeOption.d.ts +0 -4
  213. package/dist/types/DataStructures/Prototype/QuerySelector.d.ts +0 -4
  214. package/dist/types/DataStructures/TypeLibrary.d.ts +0 -19
  215. package/dist/types/DataStructures/TypeNode.d.ts +0 -18
  216. package/dist/types/DataStructures/WidgetCache/WidgetCache.d.ts +0 -10
  217. package/dist/types/DataStructures/WidgetCache/WidgetDetails.d.ts +0 -9
  218. package/dist/types/DataStructures/WidgetCache/WidgetNode.d.ts +0 -18
  219. package/dist/types/Database/IndexUpdate.d.ts +0 -47
  220. package/dist/types/Middleware/ApplicationMonitor.d.ts +0 -14
  221. package/dist/types/Middleware/ErrorHandling.d.ts +0 -0
  222. package/dist/types/Middleware/logger.service.d.ts +0 -144
  223. package/dist/types/ServiceWorker/actions/connectionActions.d.ts +0 -2
  224. package/dist/types/ServiceWorker/actions/createActions.d.ts +0 -2
  225. package/dist/types/ServiceWorker/actions/deleteActions.d.ts +0 -2
  226. package/dist/types/ServiceWorker/actions/getActions.d.ts +0 -2
  227. package/dist/types/ServiceWorker/actions/index.d.ts +0 -15
  228. package/dist/types/ServiceWorker/actions/searchActions.d.ts +0 -2
  229. package/dist/types/ServiceWorker/actions/syncActions.d.ts +0 -2
  230. package/dist/types/ServiceWorker/actions/updateActions.d.ts +0 -2
  231. package/dist/types/ServiceWorker/index.d.ts +0 -11
  232. package/dist/types/Services/AccessControl/AccessControl.d.ts +0 -218
  233. package/dist/types/Services/Common/DelayFunction.d.ts +0 -7
  234. package/dist/types/Services/Common/MergeArrays.d.ts +0 -7
  235. package/dist/types/Services/Common/RemoveAllChild.d.ts +0 -1
  236. package/dist/types/Services/CreateConnection/CreateConnectionEntity.d.ts +0 -2
  237. package/dist/types/Services/DeleteConnectionByType.d.ts +0 -22
  238. package/dist/types/Services/GetConnectionBetweenTwoConceptsLinker.d.ts +0 -11
  239. package/dist/types/Services/Local/ConvertFromLConceptToConcept.d.ts +0 -2
  240. package/dist/types/Services/Local/ConvertFromLConnectionToConnection.d.ts +0 -2
  241. package/dist/types/Services/Local/CreateConnectionBetweenTwoConceptsLocal.d.ts +0 -3
  242. package/dist/types/Services/Local/DeleteConceptLocal.d.ts +0 -1
  243. package/dist/types/Services/Local/GetConnectionOfTheConceptLocal.d.ts +0 -2
  244. package/dist/types/Services/Local/GetRelationLocal.d.ts +0 -1
  245. package/dist/types/Services/Local/GetTheConceptLocal.d.ts +0 -9
  246. package/dist/types/Services/Logs/LogEvent.d.ts +0 -1
  247. package/dist/types/Services/Mail.d.ts +0 -18
  248. package/dist/types/Services/Transaction/LocalTransaction.d.ts +0 -45
  249. package/dist/types/Services/Upload.d.ts +0 -33
  250. package/dist/types/Services/User/UserFromLocalStorage.d.ts +0 -6
  251. package/dist/types/Services/assets/GetImageService.d.ts +0 -14
  252. package/dist/types/Services/automated/automated-concept-connection.d.ts +0 -7
  253. package/dist/types/Services/cacheService.d.ts +0 -1
  254. package/dist/types/Validator/constant.d.ts +0 -3
  255. package/dist/types/Validator/interface.d.ts +0 -19
  256. package/dist/types/Validator/utils.d.ts +0 -7
  257. package/dist/types/Validator/validator.d.ts +0 -37
  258. package/dist/types/Visualize/ConceptCircle.d.ts +0 -35
  259. package/dist/types/Visualize/ConceptCircleList.d.ts +0 -9
  260. package/dist/types/Visualize/ConnectionLine.d.ts +0 -21
  261. package/dist/types/Visualize/ConnectionLineList.d.ts +0 -6
  262. package/dist/types/Visualize/drawExistingConcepts.d.ts +0 -8
  263. package/dist/types/Visualize/helper.d.ts +0 -15
  264. package/dist/types/Visualize/index.d.ts +0 -0
  265. package/dist/types/Widgets/BaseObserver.d.ts +0 -22
  266. package/dist/types/Widgets/BaseWidget.d.ts +0 -24
  267. package/dist/types/Widgets/BuilderSpeceficFunctions.d.ts +0 -2
  268. package/dist/types/Widgets/BuilderStatefulWidget.d.ts +0 -42
  269. package/dist/types/Widgets/CacheWidget.service.d.ts +0 -17
  270. package/dist/types/Widgets/NormalizeStyles.service.d.ts +0 -1
  271. package/dist/types/Widgets/RenderPage.service.d.ts +0 -12
  272. package/dist/types/Widgets/RenderWidgetLibrary.service.d.ts +0 -14
  273. package/dist/types/Widgets/RenderWidgetService.d.ts +0 -50
  274. package/dist/types/Widgets/StatefulWidget.d.ts +0 -102
  275. package/dist/types/Widgets/WidgetBuild.d.ts +0 -4
  276. package/dist/types/Widgets/WidgetTree.d.ts +0 -29
  277. package/dist/types/Widgets/mainView.class.d.ts +0 -6
  278. package/dist/types/WrapperFunctions/DepenedencyObserver.d.ts +0 -73
  279. package/dist/types/WrapperFunctions/GetCompositionListObservable.d.ts +0 -19
  280. package/dist/types/WrapperFunctions/GetCompositionObservable.d.ts +0 -13
  281. package/dist/types/WrapperFunctions/GetLinkListObservable.d.ts +0 -28
  282. package/dist/types/WrapperFunctions/GetLinkObservable.d.ts +0 -32
  283. package/dist/types/WrapperFunctions/RecursiveSearchObservable.d.ts +0 -37
  284. package/dist/types/WrapperFunctions/SearchLinkMultipleAllObservable.d.ts +0 -15
  285. package/dist/types/prototype/getPrototype.service.d.ts +0 -2
  286. package/dist/types/prototype/prototype.service.d.ts +0 -25
  287. package/dist/types/service-worker.d.ts +0 -1
package/README.md CHANGED
@@ -1,24 +1,1161 @@
1
- "# tsccs-dev"
1
+ # CCS-JS (Concept Connection System)
2
2
 
3
- ## Environment
3
+ **mftsccs-node** - Full Pack of Concept and Connection System
4
4
 
5
- create file `.env.development` or `.env.production` for developement and production respectively from `.env.example`
5
+ A powerful TypeScript library for building knowledge graphs and managing complex relationships between concepts. CCS-JS provides a complete solution for creating, querying, and managing concepts and connections with support for offline-first architecture, transactions, and flexible schema querying.
6
6
 
7
- ## Start
7
+ [![npm version](https://img.shields.io/npm/v/mftsccs-node.svg)](https://www.npmjs.com/package/mftsccs-node)
8
+ [![License: ISC](https://img.shields.io/badge/License-ISC-blue.svg)](https://opensource.org/licenses/ISC)
8
9
 
9
- This command is used to start the bundle in production mode.
10
+ ## 📚 Documentation
10
11
 
11
- ```npm start```
12
+ Full documentation available at: [https://documentation.freeschema.com](https://documentation.freeschema.com)
12
13
 
14
+ ## 🚀 Installation
13
15
 
14
- This command is used to start the bundle in development mode.
16
+ ```bash
17
+ npm install mftsccs-node
18
+ ```
15
19
 
16
- ```npm run dev```
20
+ ## 📋 Table of Contents
17
21
 
18
- ## Build
22
+ - [Quick Start](#quick-start)
23
+ - [Core Concepts](#core-concepts)
24
+ - [Key Features](#key-features)
25
+ - [API Reference](#api-reference)
26
+ - [Initialization](#initialization)
27
+ - [Session Management](#session-management)
28
+ - [Creating Concepts](#creating-concepts-maketheinstanceconcept)
29
+ - [Creating Connections](#creating-connections-createconnection)
30
+ - [Querying with FreeschemaQuery](#querying-with-freeschemaquery)
31
+ - [Using Transactions](#using-transactions)
32
+ - [Advanced Usage](#advanced-usage)
33
+ - [Development](#development)
34
+ - [Contributing](#contributing)
35
+ - [License](#license)
19
36
 
20
- This command is used to create the bundle in production mode.
37
+ ---
21
38
 
22
- ```npm run build```
39
+ ## 🎯 Quick Start
40
+
41
+ ```typescript
42
+ import { init, MakeTheInstanceConcept, CreateConnection, Transaction } from 'mftsccs-node';
43
+
44
+ // Initialize the system
45
+ init(
46
+ 'https://api.freeschema.com', // API URL
47
+ 'https://ai.freeschema.com', // AI URL
48
+ 'your-access-token' // Authentication token
49
+ );
50
+
51
+ // Create concepts
52
+ const user = await MakeTheInstanceConcept(
53
+ "user", // type
54
+ "john_doe", // referent (value)
55
+ false, // composition flag
56
+ 1, // userId
57
+ 4, // accessId
58
+ 999 // sessionId
59
+ );
60
+
61
+ const post = await MakeTheInstanceConcept(
62
+ "post",
63
+ "My First Post",
64
+ false,
65
+ 1,
66
+ 4,
67
+ 999
68
+ );
69
+
70
+ // Create a connection
71
+ const connection = await CreateConnection(
72
+ user,
73
+ post,
74
+ "authored" // relationship type
75
+ );
76
+
77
+ console.log('Concept and connection created successfully!');
78
+ ```
79
+
80
+ ---
81
+
82
+ ## 💡 Core Concepts
83
+
84
+ ### Concept
85
+ A **Concept** is the fundamental unit of knowledge in CCS-JS. It represents any entity, idea, or data point with:
86
+ - **Type**: Classification of the concept (e.g., "user", "post", "comment")
87
+ - **Referent**: The actual value or content
88
+ - **Metadata**: User ownership, access control, timestamps
89
+ - **Relationships**: References to category, type, and other concepts
90
+
91
+ ### Connection
92
+ A **Connection** represents a directed relationship between two concepts:
93
+ - Links concepts together with semantic meaning
94
+ - Typed relationships (e.g., "authored", "contains", "belongs_to")
95
+ - Supports ordering, security, and access control
96
+ - Can be queried bidirectionally
97
+
98
+ ### Composition
99
+ A **Composition** is a hierarchical structure of related concepts and connections:
100
+ - Nested concept graphs
101
+ - Recursive data structures
102
+ - JSON-like organization
103
+ - Efficient serialization/deserialization
104
+
105
+ ---
106
+
107
+ ## ✨ Key Features
108
+
109
+ - 🔄 **Offline-First Architecture**: Local IndexedDB storage with backend synchronization
110
+ - 🔐 **Security & Access Control**: Fine-grained permissions per concept/connection
111
+ - 🌳 **Binary Tree Indexing**: O(log n) lookups by ID, character, and type
112
+ - 📦 **Transactions**: ACID-like operations with rollback support
113
+ - 🔍 **Flexible Querying**: Multiple search strategies including FreeschemaQuery
114
+ - 🚀 **Performance Optimized**: Request deduplication, caching, and bulk operations
115
+ - 📡 **Real-time Sync**: MQTT support for distributed updates
116
+ - 🎯 **Type-Safe**: Full TypeScript support with comprehensive type definitions
117
+
118
+ ---
119
+
120
+ ## 📖 API Reference
121
+
122
+ ### Initialization
123
+
124
+ Initialize the CCS system before performing any operations:
125
+
126
+ ```typescript
127
+ import { init, updateAccessToken } from 'mftsccs-node';
128
+
129
+ // Initialize with backend URLs and auth token
130
+ init(
131
+ 'https://api.freeschema.com', // Base API URL
132
+ 'https://ai.freeschema.com', // AI service URL
133
+ 'your-bearer-access-token' // Authentication token
134
+ );
135
+
136
+ // Update token later if needed
137
+ updateAccessToken('new-access-token');
138
+ ```
139
+
140
+ **Important**:
141
+ - Call `init()` once at application startup
142
+ - System loads data from IndexedDB asynchronously
143
+ - Check `IdentifierFlags` to ensure data is loaded before queries
144
+
145
+ ```typescript
146
+ import { IdentifierFlags } from 'mftsccs-node';
147
+
148
+ // Wait for data to load
149
+ if (IdentifierFlags.isDataLoaded) {
150
+ // Safe to query concepts
151
+ }
152
+ ```
153
+
154
+ ---
155
+
156
+ ### Session Management
157
+
158
+ CCS-JS includes built-in session tracking capabilities that monitor user activity and enable analytics. The system uses the `X-SESSION-ID` header to track sessions across requests, which is particularly useful when integrating with backend middleware.
159
+
160
+ #### How Session Management Works
161
+
162
+ 1. **Automatic Session Creation**: When your application initializes, a session ID is automatically fetched or created
163
+ 2. **Session Tracking**: The `X-SESSION-ID` header is included in API requests to track user activity
164
+ 3. **Middleware Integration**: Your backend middleware can intercept and use this header for session management
165
+ 4. **Session Analytics**: Track user behavior, page visits, and interaction patterns
166
+
167
+ #### Session Data Structure
168
+
169
+ ```typescript
170
+ import { SessionData } from 'mftsccs-node';
171
+
172
+ const session = new SessionData();
173
+ session.id = "unique-session-id";
174
+ session.userId = "123";
175
+ session.email = "user@example.com";
176
+ session.remote_address = "192.168.1.100";
177
+ session.http_user_agent = navigator.userAgent;
178
+ session.server_name = "api.example.com";
179
+ ```
180
+
181
+ #### Creating a Session
182
+
183
+ ```typescript
184
+ import { CreateSession, SessionData } from 'mftsccs-node';
185
+
186
+ // Initialize session data
187
+ const sessionData = new SessionData();
188
+ sessionData.userId = "123";
189
+ sessionData.email = "user@example.com";
190
+ sessionData.remote_address = "192.168.1.100";
191
+ sessionData.http_user_agent = navigator.userAgent;
192
+ sessionData.server_port = "443";
193
+ sessionData.server_name = "api.example.com";
194
+
195
+ // Create session in backend
196
+ const session = await CreateSession(sessionData);
197
+ if (session) {
198
+ console.log('Session created:', session.id);
199
+ // Store session ID for subsequent requests
200
+ localStorage.setItem('sessionId', session.id);
201
+ }
202
+ ```
203
+
204
+ #### Tracking Session Visits
205
+
206
+ Track specific URL visits within a session:
207
+
208
+ ```typescript
209
+ import { CreateSessionVisit } from 'mftsccs-node';
210
+
211
+ // Track page visit
212
+ await CreateSessionVisit(
213
+ sessionId,
214
+ '/dashboard'
215
+ );
216
+
217
+ // Track another page
218
+ await CreateSessionVisit(
219
+ sessionId,
220
+ '/products/123'
221
+ );
222
+ ```
223
+
224
+ #### Middleware Integration Example
225
+
226
+ On your backend, you can use middleware to intercept the `X-SESSION-ID` header:
227
+
228
+ ```javascript
229
+ // Express.js middleware example
230
+ app.use((req, res, next) => {
231
+ const sessionId = req.headers['x-session-id'];
232
+
233
+ if (!sessionId) {
234
+ // Create new session
235
+ const newSessionId = generateSessionId();
236
+ res.setHeader('X-SESSION-ID', newSessionId);
237
+ req.sessionId = newSessionId;
238
+ } else {
239
+ // Use existing session
240
+ req.sessionId = sessionId;
241
+ }
242
+
243
+ next();
244
+ });
245
+ ```
246
+
247
+ #### Session Lifecycle
248
+
249
+ ```typescript
250
+ import { CreateSession, CreateSessionVisit, SessionData } from 'mftsccs-node';
251
+
252
+ // 1. Initialize session on app load
253
+ async function initializeSession() {
254
+ let sessionId = localStorage.getItem('sessionId');
255
+
256
+ if (!sessionId) {
257
+ // Create new session
258
+ const sessionData = new SessionData();
259
+ sessionData.userId = getCurrentUserId();
260
+ sessionData.email = getCurrentUserEmail();
261
+ sessionData.http_user_agent = navigator.userAgent;
262
+
263
+ const session = await CreateSession(sessionData);
264
+ if (session) {
265
+ sessionId = session.id;
266
+ localStorage.setItem('sessionId', sessionId);
267
+ }
268
+ }
269
+
270
+ return sessionId;
271
+ }
272
+
273
+ // 2. Track navigation
274
+ async function trackPageVisit(url: string) {
275
+ const sessionId = localStorage.getItem('sessionId');
276
+ if (sessionId) {
277
+ await CreateSessionVisit(sessionId, url);
278
+ }
279
+ }
280
+
281
+ // 3. Use in application
282
+ const sessionId = await initializeSession();
283
+
284
+ // Track page views
285
+ trackPageVisit(window.location.pathname);
286
+
287
+ // Track on navigation
288
+ window.addEventListener('popstate', () => {
289
+ trackPageVisit(window.location.pathname);
290
+ });
291
+ ```
292
+
293
+ #### Session Properties
294
+
295
+ The SessionData class captures comprehensive session information:
296
+
297
+ | Property | Type | Description |
298
+ |----------|------|-------------|
299
+ | `id` | `string` | Unique session identifier |
300
+ | `userId` | `string` | User ID associated with session |
301
+ | `email` | `string` | User's email address |
302
+ | `remote_address` | `string` | Client's IP address |
303
+ | `server_port` | `string` | Server port number |
304
+ | `server_address` | `string` | Server IP address |
305
+ | `server_name` | `string` | Server hostname/domain |
306
+ | `server_software` | `string` | Server software version |
307
+ | `http_user_agent` | `string` | Client browser/app information |
308
+ | `self` | `string` | Self-referential identifier |
309
+ | `port` | `string` | Client port number |
310
+
311
+ #### Benefits of Session Management
312
+
313
+ - ✅ **User Analytics**: Track user behavior and interaction patterns
314
+ - ✅ **Session Persistence**: Maintain state across multiple requests
315
+ - ✅ **Security**: Monitor and validate session authenticity
316
+ - ✅ **Debugging**: Trace user actions for troubleshooting
317
+ - ✅ **Personalization**: Enable session-based customization
318
+ - ✅ **Automatic Integration**: Works seamlessly with middleware
319
+
320
+ #### Best Practices
321
+
322
+ 1. **Initialize Early**: Create sessions during application bootstrap
323
+ 2. **Persist Session ID**: Store in localStorage or sessionStorage
324
+ 3. **Track Key Events**: Log important user interactions
325
+ 4. **Respect Privacy**: Comply with data protection regulations
326
+ 5. **Session Expiry**: Implement timeout mechanisms on backend
327
+ 6. **Secure Transmission**: Always use HTTPS for session data
328
+
329
+ ---
330
+
331
+ ### Creating Concepts: MakeTheInstanceConcept
332
+
333
+ The primary method for creating typed concepts in the system.
334
+
335
+ #### Signature
336
+
337
+ ```typescript
338
+ MakeTheInstanceConcept(
339
+ type: string,
340
+ referent: string,
341
+ composition: boolean = false,
342
+ userId: number,
343
+ accessId: number,
344
+ sessionId: number = 999,
345
+ referentId: number = 0,
346
+ actions?: InnerActions
347
+ ): Promise<Concept>
348
+ ```
349
+
350
+ #### Parameters
351
+
352
+ | Parameter | Type | Description |
353
+ |-----------|------|-------------|
354
+ | `type` | `string` | The type identifier (automatically prefixed with "the_" if needed) |
355
+ | `referent` | `string` | The actual value/content of the concept |
356
+ | `composition` | `boolean` | Whether this is a composition concept (default: `false`) |
357
+ | `userId` | `number` | ID of the user creating the concept |
358
+ | `accessId` | `number` | Access control level |
359
+ | `sessionId` | `number` | Session tracking ID (default: `999`) |
360
+ | `referentId` | `number` | Optional referent concept ID (default: `0`) |
361
+ | `actions` | `InnerActions` | Optional transaction actions tracker |
362
+
363
+ #### Examples
364
+
365
+ **Basic Concept Creation:**
366
+
367
+ ```typescript
368
+ import { MakeTheInstanceConcept } from 'mftsccs-node';
369
+
370
+ // Create a user concept
371
+ const user = await MakeTheInstanceConcept(
372
+ "user",
373
+ "alice@example.com",
374
+ false,
375
+ 1, // userId
376
+ 4, // accessId
377
+ 999 // sessionId
378
+ );
379
+
380
+ console.log('User created:', user.id);
381
+ ```
382
+
383
+ **Creating Different Types:**
384
+
385
+ ```typescript
386
+ // Create a product
387
+ const product = await MakeTheInstanceConcept(
388
+ "product",
389
+ "Premium Laptop",
390
+ false,
391
+ 1,
392
+ 4
393
+ );
394
+
395
+ // Create a category
396
+ const category = await MakeTheInstanceConcept(
397
+ "category",
398
+ "Electronics",
399
+ false,
400
+ 1,
401
+ 4
402
+ );
403
+
404
+ // Create a review
405
+ const review = await MakeTheInstanceConcept(
406
+ "review",
407
+ "Great product! Highly recommend.",
408
+ false,
409
+ 1,
410
+ 4
411
+ );
412
+ ```
413
+
414
+ **Long Text Handling:**
415
+
416
+ ```typescript
417
+ // Strings > 255 characters are automatically stored as text data
418
+ const longArticle = "Lorem ipsum...".repeat(100); // > 255 chars
419
+
420
+ const article = await MakeTheInstanceConcept(
421
+ "article",
422
+ longArticle,
423
+ false,
424
+ 1,
425
+ 4
426
+ );
427
+ // Automatically creates both concept and separate text data entry
428
+ ```
429
+
430
+ **Composition Concepts:**
431
+
432
+ ```typescript
433
+ // Create a composition concept for complex hierarchical data
434
+ const complexData = await MakeTheInstanceConcept(
435
+ "order",
436
+ "ORDER-123",
437
+ true, // composition = true
438
+ 1,
439
+ 4
440
+ );
441
+ ```
442
+
443
+ #### Key Features
444
+
445
+ - ✅ **Automatic type prefixing**: Type "user" becomes "the_user"
446
+ - ✅ **Deduplication**: Checks for existing concepts by character and type
447
+ - ✅ **Text overflow handling**: Strings > 255 chars stored separately
448
+ - ✅ **Type concept creation**: Automatically creates/retrieves type concepts
449
+ - ✅ **Immediate availability**: Returns concept with type information populated
450
+
451
+ ---
452
+
453
+ ### Creating Connections: CreateConnection
454
+
455
+ Creates typed connections between concepts with semantic relationships.
456
+
457
+ #### Signature
458
+
459
+ ```typescript
460
+ CreateConnection(
461
+ ofTheConcept: Concept,
462
+ toTheConcept: Concept,
463
+ typeConnection: string,
464
+ actions?: InnerActions
465
+ ): Promise<Connection>
466
+ ```
467
+
468
+ #### Parameters
469
+
470
+ | Parameter | Type | Description |
471
+ |-----------|------|-------------|
472
+ | `ofTheConcept` | `Concept` | Source concept (from) |
473
+ | `toTheConcept` | `Concept` | Target concept (to) |
474
+ | `typeConnection` | `string` | Relationship type name |
475
+ | `actions` | `InnerActions` | Optional transaction actions tracker |
476
+
477
+ #### Examples
478
+
479
+ **Simple Connection:**
480
+
481
+ ```typescript
482
+ import { CreateConnection } from 'mftsccs-node';
483
+
484
+ const author = await MakeTheInstanceConcept("user", "jane_doe", false, 1, 4);
485
+ const book = await MakeTheInstanceConcept("book", "TypeScript Guide", false, 1, 4);
486
+
487
+ // Create "authored" connection
488
+ const connection = await CreateConnection(
489
+ author,
490
+ book,
491
+ "authored"
492
+ );
493
+
494
+ console.log('Connection created:', connection.id);
495
+ ```
496
+
497
+ **Building a Knowledge Graph:**
498
+
499
+ ```typescript
500
+ // Create concepts
501
+ const company = await MakeTheInstanceConcept("company", "TechCorp", false, 1, 4);
502
+ const employee = await MakeTheInstanceConcept("employee", "Bob Smith", false, 1, 4);
503
+ const project = await MakeTheInstanceConcept("project", "Project Alpha", false, 1, 4);
504
+
505
+ // Create relationships
506
+ await CreateConnection(employee, company, "works_at");
507
+ await CreateConnection(employee, project, "assigned_to");
508
+ await CreateConnection(project, company, "owned_by");
509
+ ```
510
+
511
+ #### Advanced Connection Options
512
+
513
+ **Bidirectional Connections with Counting:**
514
+
515
+ ```typescript
516
+ import { CreateConnectionBetweenTwoConcepts } from 'mftsccs-node';
517
+
518
+ // Create bidirectional "friends_with" connection
519
+ await CreateConnectionBetweenTwoConcepts(
520
+ user1,
521
+ user2,
522
+ "friends_with",
523
+ true, // both directions
524
+ true // enable counting
525
+ );
526
+
527
+ // Creates connections:
528
+ // - "users_s_friends_with_s" (forward)
529
+ // - "users_s_friends_with_by" (backward)
530
+ // - Maintains count concepts for analytics
531
+ ```
532
+
533
+ **Type-Aware Connection Naming:**
534
+
535
+ ```typescript
536
+ // Connection types include concept types in the name
537
+ const author = await MakeTheInstanceConcept("author", "John Doe", false, 1, 4);
538
+ const book = await MakeTheInstanceConcept("book", "My Book", false, 1, 4);
539
+
540
+ await CreateConnectionBetweenTwoConcepts(
541
+ author,
542
+ book,
543
+ "authored"
544
+ );
545
+ // Creates connection type: "authors_s_authored_s"
546
+
547
+ // This enables queries like:
548
+ // "Show all books_s_authored_s_by author"
549
+ ```
550
+
551
+ ---
552
+
553
+ ### Querying with FreeschemaQuery
554
+
555
+ Perform flexible, schema-independent queries on concepts.
556
+
557
+ #### Signature
558
+
559
+ ```typescript
560
+ FreeschemaQueryApi(
561
+ query: FreeschemaQuery,
562
+ token?: string
563
+ ): Promise<Concept[]>
564
+ ```
565
+
566
+ #### FreeschemaQuery Structure
567
+
568
+ ```typescript
569
+ interface FreeschemaQuery {
570
+ type?: string; // Concept type filter
571
+ search?: string; // Text search term
572
+ composition?: number; // Composition ID
573
+ inpage?: number; // Results per page
574
+ page?: number; // Page number
575
+ userId?: number; // User ID filter
576
+ format?: number; // Response format (1-7)
577
+ linker?: string[]; // Relationship filters
578
+ selectConnectionLinker?: string[];
579
+ selectionType?: string[];
580
+ conceptType?: string;
581
+ filterSearch?: FilterSearch[]; // Complex filters
582
+ connectionSelectionLinker?: string[];
583
+ connectionOfTheLinker?: string[];
584
+ excludeCompositionIds?: number[];
585
+ includeCompositionIds?: number[];
586
+ nestedSelectionLinker?: string[][];
587
+ excludeConnectionIds?: number[];
588
+ createdTime?: string;
589
+ updatedTime?: string;
590
+ }
591
+ ```
592
+
593
+ #### Examples
594
+
595
+ **Basic Search:**
596
+
597
+ ```typescript
598
+ import { FreeschemaQueryApi } from 'mftsccs-node';
599
+
600
+ // Search for users
601
+ const query = {
602
+ type: "user",
603
+ inpage: 20,
604
+ page: 1
605
+ };
606
+
607
+ const users = await FreeschemaQueryApi(query, "auth-token");
608
+ console.log(`Found ${users.length} users`);
609
+ ```
610
+
611
+ **Text Search:**
612
+
613
+ ```typescript
614
+ // Search for posts containing "typescript"
615
+ const query = {
616
+ type: "post",
617
+ search: "typescript",
618
+ inpage: 10
619
+ };
620
+
621
+ const posts = await FreeschemaQueryApi(query, "auth-token");
622
+ ```
623
+
624
+ **Composition Query:**
625
+
626
+ ```typescript
627
+ // Get all concepts within a specific composition
628
+ const query = {
629
+ composition: 12345,
630
+ format: 2, // DATAID format
631
+ inpage: 50
632
+ };
633
+
634
+ const concepts = await FreeschemaQueryApi(query, "auth-token");
635
+ ```
636
+
637
+ **Advanced Filtering:**
638
+
639
+ ```typescript
640
+ // Complex query with filters
641
+ const query = {
642
+ type: "product",
643
+ filterSearch: [
644
+ {
645
+ type: "price",
646
+ search: "100",
647
+ logicoperator: "less_than",
648
+ composition: 0,
649
+ index: 0,
650
+ name: "price_filter",
651
+ operateon: "number"
652
+ }
653
+ ],
654
+ linker: ["category_s"],
655
+ inpage: 20
656
+ };
657
+
658
+ const affordableProducts = await FreeschemaQueryApi(query, "auth-token");
659
+ ```
660
+
661
+ **Cross-Composition Search:**
662
+
663
+ ```typescript
664
+ // Search across multiple compositions
665
+ const query = {
666
+ type: "document",
667
+ includeCompositionIds: [100, 200, 300],
668
+ excludeCompositionIds: [150],
669
+ search: "important",
670
+ inpage: 50
671
+ };
672
+
673
+ const documents = await FreeschemaQueryApi(query, "auth-token");
674
+ ```
675
+
676
+ #### Response Formats
677
+
678
+ Use the `format` parameter to control response structure:
679
+
680
+ ```typescript
681
+ import { NORMAL, DATAID, JUSTDATA, ALLID, DATAIDDATE, RAW, LISTNORMAL } from 'mftsccs-node';
682
+
683
+ const query = {
684
+ type: "user",
685
+ format: DATAID // format = 2
686
+ };
687
+ ```
688
+
689
+ | Format | Value | Description |
690
+ |--------|-------|-------------|
691
+ | `NORMAL` | 1 | Standard format with all concept data |
692
+ | `DATAID` | 2 | Includes ID and metadata wrapper |
693
+ | `JUSTDATA` | 3 | Only the data without metadata |
694
+ | `ALLID` | 6 | All IDs format |
695
+ | `DATAIDDATE` | 4 | Data with ID and date |
696
+ | `RAW` | 5 | Raw data format |
697
+ | `LISTNORMAL` | 7 | List normal format |
698
+
699
+ ---
700
+
701
+ ### Using Transactions
702
+
703
+ Transactions provide ACID-like guarantees for batch operations with rollback support.
704
+
705
+ #### Transaction Class
706
+
707
+ ```typescript
708
+ class Transaction {
709
+ initialize(): Promise<void>;
710
+ MakeTheInstanceConcept(...): Promise<Concept>;
711
+ CreateConnection(...): Promise<Connection>;
712
+ MakeTheTypeConcept(...): Promise<Concept>;
713
+ CreateTheConnectionGeneral(...): Promise<Connection>;
714
+ commitTransaction(): Promise<void>;
715
+ rollbackTransaction(): Promise<void>;
716
+ }
717
+ ```
718
+
719
+ #### Basic Transaction Usage
720
+
721
+ ```typescript
722
+ import { Transaction } from 'mftsccs-node';
723
+
724
+ const transaction = new Transaction();
725
+ await transaction.initialize();
726
+
727
+ try {
728
+ // Create multiple concepts
729
+ const user = await transaction.MakeTheInstanceConcept(
730
+ "user",
731
+ "alice@example.com",
732
+ false,
733
+ 1,
734
+ 4
735
+ );
736
+
737
+ const profile = await transaction.MakeTheInstanceConcept(
738
+ "profile",
739
+ "Alice's Profile",
740
+ false,
741
+ 1,
742
+ 4
743
+ );
744
+
745
+ // Create connection
746
+ await transaction.CreateConnection(user, profile, "has_profile");
747
+
748
+ // Commit all changes
749
+ await transaction.commitTransaction();
750
+ console.log('Transaction committed successfully');
751
+
752
+ } catch (error) {
753
+ // Rollback on error
754
+ await transaction.rollbackTransaction();
755
+ console.error('Transaction rolled back:', error);
756
+ }
757
+ ```
758
+
759
+ #### Complex Transaction Example
760
+
761
+ ```typescript
762
+ const transaction = new Transaction();
763
+ await transaction.initialize();
764
+
765
+ try {
766
+ // Create a blog post with author, tags, and comments
767
+ const author = await transaction.MakeTheInstanceConcept(
768
+ "author",
769
+ "John Doe",
770
+ false,
771
+ 1,
772
+ 4
773
+ );
774
+
775
+ const post = await transaction.MakeTheInstanceConcept(
776
+ "post",
777
+ "Introduction to CCS-JS",
778
+ false,
779
+ 1,
780
+ 4
781
+ );
782
+
783
+ const tag1 = await transaction.MakeTheInstanceConcept(
784
+ "tag",
785
+ "typescript",
786
+ false,
787
+ 1,
788
+ 4
789
+ );
790
+
791
+ const tag2 = await transaction.MakeTheInstanceConcept(
792
+ "tag",
793
+ "tutorial",
794
+ false,
795
+ 1,
796
+ 4
797
+ );
798
+
799
+ // Create all relationships
800
+ await transaction.CreateConnection(author, post, "authored");
801
+ await transaction.CreateConnection(post, tag1, "tagged_with");
802
+ await transaction.CreateConnection(post, tag2, "tagged_with");
803
+
804
+ // Commit the entire graph
805
+ await transaction.commitTransaction();
806
+
807
+ } catch (error) {
808
+ await transaction.rollbackTransaction();
809
+ console.error('Failed to create blog post:', error);
810
+ }
811
+ ```
812
+
813
+ #### Transaction with Error Handling
814
+
815
+ ```typescript
816
+ async function createUserWithProfile(email: string, profileData: string) {
817
+ const transaction = new Transaction();
818
+ await transaction.initialize();
819
+
820
+ try {
821
+ // Create user
822
+ const user = await transaction.MakeTheInstanceConcept(
823
+ "user",
824
+ email,
825
+ false,
826
+ 1,
827
+ 4
828
+ );
829
+
830
+ // Validate user creation
831
+ if (!user || user.id === 0) {
832
+ throw new Error('Failed to create user');
833
+ }
834
+
835
+ // Create profile
836
+ const profile = await transaction.MakeTheInstanceConcept(
837
+ "profile",
838
+ profileData,
839
+ false,
840
+ 1,
841
+ 4
842
+ );
843
+
844
+ // Link them
845
+ await transaction.CreateConnection(user, profile, "has_profile");
846
+
847
+ // Commit
848
+ await transaction.commitTransaction();
849
+ return { user, profile };
850
+
851
+ } catch (error) {
852
+ // Automatic rollback
853
+ await transaction.rollbackTransaction();
854
+ throw new Error(`Transaction failed: ${error}`);
855
+ }
856
+ }
857
+ ```
858
+
859
+ #### Benefits of Transactions
860
+
861
+ - ✅ **Atomicity**: All operations succeed or all fail
862
+ - ✅ **Consistency**: Data remains in valid state
863
+ - ✅ **Rollback Support**: Automatic cleanup on failure
864
+ - ✅ **Batch Tracking**: All changes tracked together
865
+ - ✅ **Error Recovery**: Graceful handling of failures
866
+
867
+ ---
868
+
869
+ ## 🔧 Advanced Usage
870
+
871
+ ### Compositions
872
+
873
+ Create and query hierarchical data structures:
874
+
875
+ ```typescript
876
+ import { CreateComposition, GetComposition } from 'mftsccs-node';
877
+
878
+ // Create nested composition
879
+ const data = {
880
+ user: "john_doe",
881
+ profile: {
882
+ name: "John Doe",
883
+ email: "john@example.com",
884
+ settings: {
885
+ theme: "dark",
886
+ notifications: true
887
+ }
888
+ },
889
+ posts: ["post1", "post2"]
890
+ };
891
+
892
+ const composition = await CreateComposition(
893
+ data,
894
+ "user_profile",
895
+ 1,
896
+ 4,
897
+ 999
898
+ );
899
+
900
+ // Retrieve and reconstruct
901
+ const retrieved = await GetComposition(composition.id);
902
+ console.log(retrieved); // Full nested structure
903
+ ```
904
+
905
+ ### Local Storage (Offline Support)
906
+
907
+ Work with local concepts for offline functionality:
908
+
909
+ ```typescript
910
+ import {
911
+ CreateTheConceptLocal,
912
+ GetCompositionLocal,
913
+ MakeTheInstanceConceptLocal
914
+ } from 'mftsccs-node';
915
+
916
+ // Create local concept (survives offline)
917
+ const localConcept = await MakeTheInstanceConceptLocal(
918
+ "note",
919
+ "Offline note",
920
+ 1,
921
+ 4
922
+ );
923
+
924
+ // Retrieve from local storage
925
+ const composition = await GetCompositionLocal(
926
+ localConcept.id,
927
+ localConcept.userId
928
+ );
929
+ ```
930
+
931
+ ### Bulk Operations
932
+
933
+ Optimize performance with bulk operations:
934
+
935
+ ```typescript
936
+ import {
937
+ GetConceptBulk,
938
+ GetConnectionBulk
939
+ } from 'mftsccs-node';
940
+
941
+ // Fetch multiple concepts at once
942
+ const conceptIds = [123, 456, 789];
943
+ const concepts = await GetConceptBulk(conceptIds);
944
+
945
+ // Fetch multiple connections
946
+ const connectionIds = [1, 2, 3, 4, 5];
947
+ const connections = await GetConnectionBulk(connectionIds);
948
+ ```
949
+
950
+ ### Relationship Queries
951
+
952
+ Navigate relationships between concepts:
953
+
954
+ ```typescript
955
+ import {
956
+ GetLink,
957
+ GetRelation,
958
+ GetConnectionOfTheConcept
959
+ } from 'mftsccs-node';
960
+
961
+ // Get all "authored" books by an author
962
+ const books = await GetLink(
963
+ "the_book",
964
+ "authored",
965
+ authorId,
966
+ userId
967
+ );
968
+
969
+ // Get reverse relationship (books to authors)
970
+ const authors = await GetRelation(
971
+ "the_author",
972
+ "authored",
973
+ bookId,
974
+ userId
975
+ );
976
+
977
+ // Get connections from a concept
978
+ const connections = await GetConnectionOfTheConcept(
979
+ connectionTypeId,
980
+ conceptId,
981
+ userId,
982
+ 10, // inpage
983
+ 1 // page
984
+ );
985
+ ```
986
+
987
+ ---
988
+
989
+ ## 🛠️ Development
990
+
991
+ ### Prerequisites
992
+
993
+ - Node.js 14+
994
+ - npm or yarn
995
+ - TypeScript 5.3+
996
+
997
+ ### Environment Setup
998
+
999
+ Create environment files from the example:
1000
+
1001
+ ```bash
1002
+ # For development
1003
+ cp .env.example .env.development
1004
+
1005
+ # For production
1006
+ cp .env.example .env.production
1007
+ ```
1008
+
1009
+ ### Build from Source
1010
+
1011
+ ```bash
1012
+ # Clone the repository
1013
+ git clone https://github.com/Mentor-Friends/tsccs-dev.git
1014
+ cd tsccs-dev
1015
+
1016
+ # Install dependencies
1017
+ npm install
1018
+
1019
+ # Build the project
1020
+ npm run build
1021
+
1022
+ # Run in development mode
1023
+ npm run dev
1024
+ ```
1025
+
1026
+ ### Project Structure
1027
+
1028
+ ```
1029
+ ccs-js/
1030
+ ├── src/
1031
+ │ ├── Api/ # Backend API integration (45 files)
1032
+ │ ├── Services/ # Business logic layer (73+ files)
1033
+ │ ├── DataStructures/ # Core data models (70+ files)
1034
+ │ ├── Database/ # IndexedDB persistence (4 files)
1035
+ │ ├── Constants/ # Configuration (2 files)
1036
+ │ ├── Helpers/ # Utility functions (3 files)
1037
+ │ ├── Drawing/ # UI visualization (2 files)
1038
+ │ ├── WrapperFunctions/ # Observable wrappers (1 file)
1039
+ │ └── app.ts # Main entry point
1040
+ ├── dist/ # Compiled output
1041
+ ├── webpack.config.js # Build configuration
1042
+ ├── tsconfig.json # TypeScript config
1043
+ └── package.json
1044
+ ```
1045
+
1046
+ ### Scripts
1047
+
1048
+ ```bash
1049
+ npm start # Build with webpack (production)
1050
+ npm run dev # Development build with watch mode
1051
+ npm run build # Production build
1052
+ ```
1053
+
1054
+ ---
1055
+
1056
+ ## 📝 Examples
1057
+
1058
+ ### E-commerce System
1059
+
1060
+ ```typescript
1061
+ // Create product catalog
1062
+ const electronics = await MakeTheInstanceConcept("category", "Electronics", false, 1, 4);
1063
+ const laptop = await MakeTheInstanceConcept("product", "Premium Laptop", false, 1, 4);
1064
+ const review = await MakeTheInstanceConcept("review", "Great product!", false, 1, 4);
1065
+
1066
+ // Build relationships
1067
+ await CreateConnection(laptop, electronics, "belongs_to");
1068
+ await CreateConnection(review, laptop, "reviews");
1069
+ ```
1070
+
1071
+ ### Social Network
1072
+
1073
+ ```typescript
1074
+ const transaction = new Transaction();
1075
+ await transaction.initialize();
1076
+
1077
+ try {
1078
+ const user1 = await transaction.MakeTheInstanceConcept("user", "alice", false, 1, 4);
1079
+ const user2 = await transaction.MakeTheInstanceConcept("user", "bob", false, 1, 4);
1080
+ const post = await transaction.MakeTheInstanceConcept("post", "Hello World", false, 1, 4);
1081
+
1082
+ await transaction.CreateConnection(user1, user2, "follows");
1083
+ await transaction.CreateConnection(user1, post, "created");
1084
+ await transaction.CreateConnection(user2, post, "liked");
1085
+
1086
+ await transaction.commitTransaction();
1087
+ } catch (error) {
1088
+ await transaction.rollbackTransaction();
1089
+ }
1090
+ ```
1091
+
1092
+ ### Document Management
1093
+
1094
+ ```typescript
1095
+ // Create document hierarchy
1096
+ const folder = await MakeTheInstanceConcept("folder", "Projects", false, 1, 4);
1097
+ const doc = await MakeTheInstanceConcept("document", "README", false, 1, 4);
1098
+ const version = await MakeTheInstanceConcept("version", "v1.0", false, 1, 4);
1099
+
1100
+ await CreateConnection(doc, folder, "contained_in");
1101
+ await CreateConnection(version, doc, "version_of");
1102
+
1103
+ // Query documents
1104
+ const query = {
1105
+ type: "document",
1106
+ linker: ["contained_in_s"],
1107
+ composition: folder.id
1108
+ };
1109
+ const documents = await FreeschemaQueryApi(query, "token");
1110
+ ```
1111
+
1112
+ ---
1113
+
1114
+ ## 🤝 Contributing
1115
+
1116
+ Contributions are welcome! Please follow these steps:
1117
+
1118
+ 1. Fork the repository
1119
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
1120
+ 3. Commit your changes (`git commit -m 'Add amazing feature'`)
1121
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
1122
+ 5. Open a Pull Request
1123
+
1124
+ ### Coding Standards
1125
+
1126
+ - Follow TypeScript best practices
1127
+ - Add JSDoc comments for all public APIs
1128
+ - Write unit tests for new features
1129
+ - Update documentation as needed
1130
+
1131
+ ---
1132
+
1133
+ ## 📄 License
1134
+
1135
+ This project is licensed under the ISC License.
1136
+
1137
+ ---
1138
+
1139
+ ## 🔗 Links
1140
+
1141
+ - **Documentation**: [https://documentation.freeschema.com](https://documentation.freeschema.com)
1142
+ - **GitHub**: [https://github.com/Mentor-Friends/tsccs-dev](https://github.com/Mentor-Friends/tsccs-dev)
1143
+ - **Issues**: [https://github.com/Mentor-Friends/tsccs-dev/issues](https://github.com/Mentor-Friends/tsccs-dev/issues)
1144
+ - **npm Package**: [https://www.npmjs.com/package/mftsccs-node](https://www.npmjs.com/package/mftsccs-node)
1145
+
1146
+ ---
1147
+
1148
+ ## 📞 Support
1149
+
1150
+ For questions and support:
1151
+ - Open an issue on GitHub
1152
+ - Check the documentation at [documentation.freeschema.com](https://documentation.freeschema.com)
1153
+ - Contact: Mentor Friends
1154
+
1155
+ ---
1156
+
1157
+ **Made with ❤️ by Mentor Friends**
1158
+
1159
+ *Version 0.0.52*
23
1160
 
24
1161