mftsccs-node 0.2.7 → 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 (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,2 +1,73 @@
1
+ /**
2
+ * Local Type Concept Creation Module
3
+ *
4
+ * This module handles the creation of type concepts in the local storage layer.
5
+ * Type concepts define the schema and categorization of other concepts in the system.
6
+ * It supports hierarchical type creation through recursive processing of composite type names.
7
+ *
8
+ * @module MakeTheTypeLocal
9
+ */
1
10
  import { LConcept } from "../../DataStructures/Local/LConcept";
11
+ /**
12
+ * Creates or retrieves a type concept with support for hierarchical type structures.
13
+ *
14
+ * This function ensures that a type concept exists in the local storage. If the type
15
+ * doesn't exist, it creates it, handling both simple types and composite types.
16
+ * Composite types (e.g., "the_category_type") are split and processed recursively
17
+ * to establish proper type hierarchies.
18
+ *
19
+ * The function implements get-or-create logic to prevent duplicate type concepts
20
+ * and maintains the type system's integrity through proper categorization.
21
+ *
22
+ * @param typeString - The name of the type to create or retrieve (e.g., "the_user", "the_product")
23
+ * @param sessionId - Session information ID for tracking
24
+ * @param sessionUserId - User ID associated with the session
25
+ * @param userId - The ID of the user creating/owning the type
26
+ *
27
+ * @returns A promise that resolves to the type concept (existing or newly created)
28
+ *
29
+ * @remarks
30
+ * - First checks if type concept already exists by character value
31
+ * - If not found or invalid (id === 0), proceeds with creation logic
32
+ * - For simple types: Creates with typeId 51 (base "the" type) and category 4
33
+ * - For composite types: Splits on underscore and recursively creates category and type
34
+ * - Example: "the_category_type" splits into "the_category" (category) and "type" (type)
35
+ * - Uses accessId of 4 (default access level) for new types
36
+ * - The base type "the" (typeId 51) is the root of the type hierarchy
37
+ *
38
+ * @example
39
+ * ```typescript
40
+ * // Create a simple type
41
+ * const userType = await MakeTheTypeConceptLocal(
42
+ * "the_user",
43
+ * 999, // sessionId
44
+ * 123, // sessionUserId
45
+ * 123 // userId
46
+ * );
47
+ * console.log(userType.characterValue); // "the_user"
48
+ * console.log(userType.typeId); // 51 (the base "the" type)
49
+ *
50
+ * // Create a composite type (creates category and type recursively)
51
+ * const productType = await MakeTheTypeConceptLocal(
52
+ * "the_ecommerce_product",
53
+ * 999,
54
+ * 123,
55
+ * 123
56
+ * );
57
+ * // This creates:
58
+ * // 1. "the_ecommerce" as category
59
+ * // 2. "product" as type
60
+ * // 3. "the_ecommerce_product" as final type
61
+ *
62
+ * // Subsequent calls return existing type (no duplicate)
63
+ * const sameType = await MakeTheTypeConceptLocal("the_user", 999, 123, 123);
64
+ * console.log(sameType.id === userType.id); // true
65
+ * ```
66
+ *
67
+ * @see {@link GetConceptByCharacterLocal} - Checks if type already exists
68
+ * @see {@link MakeTheConceptLocal} - Creates concepts with uniqueness check
69
+ * @see {@link CreateTheConceptLocal} - Low-level concept creation
70
+ * @see {@link SplitStrings} - Splits composite type names
71
+ * @see {@link MakeTheInstanceConceptLocal} - Uses this to create types for instances
72
+ */
2
73
  export default function MakeTheTypeConceptLocal(typeString: string, sessionId: number, sessionUserId: number, userId: number): Promise<LConcept>;
@@ -1,2 +1,103 @@
1
+ /**
2
+ * Local Composition Update Module
3
+ *
4
+ * This module provides functionality to update existing compositions in local storage
5
+ * by patching them with new data. It handles the complex process of modifying a graph
6
+ * structure, including replacing existing concepts, creating new ones, and managing
7
+ * connections while maintaining data integrity.
8
+ *
9
+ * @module UpdateCompositionLocal
10
+ */
1
11
  import { PatcherStructure } from '../../DataStructures/PatcherStructure';
12
+ /**
13
+ * Updates an existing composition by patching it with new data.
14
+ *
15
+ * This function performs a sophisticated update operation on a composition by:
16
+ * 1. Fetching the current composition structure from the backend
17
+ * 2. Identifying concepts that need to be replaced (same type, different value)
18
+ * 3. Creating new concepts for the patch data
19
+ * 4. Removing old connections and concepts that are being replaced
20
+ * 5. Creating new connections for the updated structure
21
+ * 6. Triggering synchronization with the backend
22
+ *
23
+ * The function handles both simple property updates and complex nested composition updates.
24
+ *
25
+ * @param patcherStructure - Object containing update instructions
26
+ * @param patcherStructure.compositionId - ID of the root composition to update
27
+ * @param patcherStructure.ofTheCompositionId - ID of immediate parent (for nested updates)
28
+ * @param patcherStructure.patchObject - The new data to patch into the composition
29
+ * @param patcherStructure.userId - ID of the user performing the update
30
+ * @param patcherStructure.sessionId - Session tracking ID
31
+ * @param patcherStructure.accessId - Access control ID
32
+ *
33
+ * @returns A promise that resolves when the update is complete
34
+ *
35
+ * @remarks
36
+ * - Fetches latest composition data from backend to ensure consistency
37
+ * - Identifies existing concepts by type and marks them for deletion
38
+ * - Creates new concepts with the updated values
39
+ * - Establishes proper connections between parent and new concepts
40
+ * - Deletes old connections associated with replaced concepts
41
+ * - Triggers online synchronization via SyncData.SyncDataOnline()
42
+ * - Handles both primitive values and nested compositions (objects/arrays)
43
+ * - For nested compositions, recursively creates the structure
44
+ * - Converts backend Concept/Connection types to local LConcept/LConnection types
45
+ *
46
+ * @example
47
+ * ```typescript
48
+ * // Update a user's name and age
49
+ * const patcher: PatcherStructure = {
50
+ * compositionId: 12345, // User composition ID
51
+ * ofTheCompositionId: null, // No immediate parent (root level)
52
+ * patchObject: {
53
+ * name: "Jane Doe", // Updated name
54
+ * age: 31 // Updated age
55
+ * },
56
+ * userId: 123,
57
+ * sessionId: 999,
58
+ * accessId: 4
59
+ * };
60
+ *
61
+ * await UpdateCompositionLocal(patcher);
62
+ * // Result: Old name/age concepts replaced with new ones
63
+ *
64
+ * // Update nested property
65
+ * const nestedPatcher: PatcherStructure = {
66
+ * compositionId: 12345,
67
+ * ofTheCompositionId: 12350, // Address composition ID
68
+ * patchObject: {
69
+ * city: "New York" // Update city within address
70
+ * },
71
+ * userId: 123,
72
+ * sessionId: 999,
73
+ * accessId: 4
74
+ * };
75
+ *
76
+ * await UpdateCompositionLocal(nestedPatcher);
77
+ *
78
+ * // Update with complex nested structure
79
+ * const complexPatcher: PatcherStructure = {
80
+ * compositionId: 12345,
81
+ * ofTheCompositionId: null,
82
+ * patchObject: {
83
+ * address: { // Nested composition
84
+ * street: "123 Main St",
85
+ * city: "Boston"
86
+ * }
87
+ * },
88
+ * userId: 123,
89
+ * sessionId: 999,
90
+ * accessId: 4
91
+ * };
92
+ *
93
+ * await UpdateCompositionLocal(complexPatcher);
94
+ * ```
95
+ *
96
+ * @see {@link PatcherStructure} - Structure defining update parameters
97
+ * @see {@link MakeTheInstanceConceptLocal} - Creates new concepts during update
98
+ * @see {@link CreateTheCompositionLocal} - Handles nested composition creation
99
+ * @see {@link CreateTheConnectionLocal} - Creates connections for new concepts
100
+ * @see {@link DeleteConnectionById} - Removes old connections
101
+ * @see {@link SyncData.SyncDataOnline} - Synchronizes changes with backend
102
+ */
2
103
  export declare function UpdateCompositionLocal(patcherStructure: PatcherStructure): Promise<void>;
@@ -1,2 +1,76 @@
1
+ /**
2
+ * @module MakeTheCharacter
3
+ * @description Creates character-based concepts in the Concept Connection System (CCS).
4
+ * This module handles the creation of concepts representing character data, with special
5
+ * handling for single characters (using ASCII codes) versus multi-character strings.
6
+ * It serves as a fundamental building block for text and string representation in CCS.
7
+ */
1
8
  import { Concept } from "../DataStructures/Concept";
9
+ /**
10
+ * Creates a character concept for the given character data.
11
+ *
12
+ * This function creates concepts that represent character data in the CCS system.
13
+ * It handles two distinct cases based on the length of the input:
14
+ *
15
+ * 1. Single character: Uses the ASCII character code as the referent ID and type 49
16
+ * 2. Multiple characters: Uses character data ID as referent and type 51
17
+ *
18
+ * Both cases first create the underlying character data before creating the concept.
19
+ *
20
+ * @param the_character_data - The character string to create a concept for (e.g., "a", "hello")
21
+ * @param userId - The ID of the user creating this character concept
22
+ * @param securityId - The security control ID for access management
23
+ * @param accessId - The access control ID determining visibility
24
+ * @param accessUserId - The user ID for access control
25
+ * @param sessionId - The session ID for tracking this operation
26
+ *
27
+ * @returns Promise resolving to the created character Concept
28
+ *
29
+ * @remarks
30
+ * - Single characters use ASCII charCodeAt(0) as their referent ID
31
+ * - Single characters are typed with ID 49 (character type)
32
+ * - Multi-character strings are typed with ID 51 (character data type)
33
+ * - Multi-character strings reference the created character data as referent
34
+ * - Category ID is always 4 for character concepts
35
+ * - Always creates new character data before creating the concept
36
+ *
37
+ * @example
38
+ * ```typescript
39
+ * // Create a single character concept
40
+ * const charA = await MakeTheCharacter(
41
+ * "a",
42
+ * 1,
43
+ * 999,
44
+ * 100,
45
+ * 1,
46
+ * 999
47
+ * );
48
+ * // Uses ASCII code 97 as referent ID
49
+ *
50
+ * // Create a multi-character concept
51
+ * const hello = await MakeTheCharacter(
52
+ * "hello",
53
+ * 1,
54
+ * 999,
55
+ * 100,
56
+ * 1,
57
+ * 999
58
+ * );
59
+ * // Creates character data first, then references it
60
+ *
61
+ * // Create a type string
62
+ * const typeName = await MakeTheCharacter(
63
+ * "the_user",
64
+ * 1,
65
+ * 999,
66
+ * 100,
67
+ * 1,
68
+ * 999
69
+ * );
70
+ * ```
71
+ *
72
+ * @see {@link MakeTheCharacterData} - Creates the underlying character data
73
+ * @see {@link MakeTheConcept} - Creates the concept entity
74
+ * @see {@link Returner} - Return type for character data creation
75
+ */
2
76
  export default function MakeTheCharacter(the_character_data: string, userId: number, securityId: number, accessId: number, accessUserId: number, sessionId: number): Promise<Concept>;
@@ -1,2 +1,67 @@
1
+ /**
2
+ * @module MakeTheCharacterData
3
+ * @description Creates character data entries in the Concept Connection System (CCS).
4
+ * This module handles the storage of character strings as data entities that can be
5
+ * referenced by concepts. It creates TheCharacter objects and persists them through
6
+ * the API, providing metadata about whether the character data is newly created.
7
+ */
1
8
  import { Returner } from "../DataStructures/Returner";
9
+ /**
10
+ * Creates or retrieves character data for a given character string.
11
+ *
12
+ * This function creates a TheCharacter data object with the provided character string
13
+ * and persists it to the database through the API. The character data serves as a
14
+ * storage mechanism for string values that can be referenced by multiple concepts.
15
+ *
16
+ * The created character data includes all necessary metadata for access control,
17
+ * security, and session tracking. The Returner object indicates whether the
18
+ * character data was newly created or already existed.
19
+ *
20
+ * @param the_character_data - The character string to store (e.g., "hello", "user_name")
21
+ * @param userId - The ID of the user creating this character data
22
+ * @param securityId - The security control ID for access management
23
+ * @param accessId - The access control ID determining visibility
24
+ * @param sessionId - The session ID for tracking this operation
25
+ *
26
+ * @returns Promise resolving to a Returner object containing the character data ID,
27
+ * user ID, and a flag indicating if it was newly created
28
+ *
29
+ * @remarks
30
+ * - Creates a TheCharacter object with empty string for last parameter
31
+ * - Sets isNew flag to false initially in TheCharacter constructor
32
+ * - The actual isNew status comes from the API response in Returner
33
+ * - All user IDs (category, access, security, session) are set to the same userId
34
+ * - Character data is immutable once created and can be shared across concepts
35
+ *
36
+ * @example
37
+ * ```typescript
38
+ * // Create character data for a username
39
+ * const result = await MakeTheCharacterData(
40
+ * "john_doe",
41
+ * 1,
42
+ * 999,
43
+ * 100,
44
+ * 999
45
+ * );
46
+ * console.log(result.id); // Character data ID
47
+ * console.log(result.isNew); // true if newly created
48
+ *
49
+ * // Create character data for a type name
50
+ * const typeData = await MakeTheCharacterData(
51
+ * "the_user",
52
+ * 1,
53
+ * 999,
54
+ * 100,
55
+ * 999
56
+ * );
57
+ *
58
+ * // Use in character concept creation
59
+ * const charData = await MakeTheCharacterData("hello", 1, 999, 100, 999);
60
+ * // charData.id can now be used as a referent in concept creation
61
+ * ```
62
+ *
63
+ * @see {@link CreateTheCharacter} - API function that persists the character data
64
+ * @see {@link TheCharacter} - Data structure representing character data
65
+ * @see {@link Returner} - Return type containing ID and creation status
66
+ */
2
67
  export default function MakeTheCharacterData(the_character_data: string, userId: number, securityId: number, accessId: number, sessionId: number): Promise<Returner>;
@@ -1,3 +1,78 @@
1
+ /**
2
+ * @module MakeTheInstanceConcept
3
+ * @description Creates instance concepts in the Concept Connection System (CCS).
4
+ * This module handles the creation of concepts with specific types and referents,
5
+ * managing various scenarios including compositions, text data, and character concepts.
6
+ * It serves as a core factory function for instantiating typed concepts in the system.
7
+ */
1
8
  import { Concept } from "../DataStructures/Concept";
2
9
  import { InnerActions } from "../DataStructures/Transaction/Transaction";
10
+ /**
11
+ * Creates an instance concept with a specific type and referent.
12
+ *
13
+ * This function is the primary factory for creating typed concepts in the CCS system.
14
+ * It handles three main scenarios:
15
+ * 1. Composition concepts - Creates concepts using the composition pattern
16
+ * 2. Text concepts - Creates concepts for strings longer than 255 characters, storing them as text data
17
+ * 3. Standard concepts - Creates or retrieves existing concepts for standard character values
18
+ *
19
+ * The function automatically prefixes type names with "the_" if not already present and
20
+ * manages all necessary associations (category, type, referent, security, access, session).
21
+ *
22
+ * @param type - The type identifier for the concept (e.g., "user", "post", "comment").
23
+ * Will be automatically prefixed with "the_" if not present.
24
+ * @param referent - The actual value or data for the concept (e.g., username, post content)
25
+ * @param composition - If true, creates a composition concept bypassing character checks
26
+ * @param userId - The ID of the user creating this concept
27
+ * @param passedAccessId - The access control ID determining who can access this concept
28
+ * @param passedSessionId - The session ID for tracking this operation (default: 999)
29
+ * @param referentId - Optional ID of a referent concept (default: 0)
30
+ * @param actions - Transaction actions for batch operations (default: empty actions)
31
+ *
32
+ * @returns Promise resolving to the created or retrieved Concept with type information populated
33
+ *
34
+ * @remarks
35
+ * - For composition concepts, bypasses character lookup and creates immediately
36
+ * - For strings > 255 chars, creates both a concept and a separate text data entry
37
+ * - For standard concepts, checks for existing concepts by character and type before creating
38
+ * - Includes performance timing logs (commented out) for optimization analysis
39
+ * - The type concept is always attached to the returned concept for reference
40
+ *
41
+ * @example
42
+ * ```typescript
43
+ * // Create a standard user concept
44
+ * const userConcept = await MakeTheInstanceConcept(
45
+ * "user",
46
+ * "john_doe",
47
+ * false,
48
+ * 1,
49
+ * 100,
50
+ * 999
51
+ * );
52
+ *
53
+ * // Create a composition concept
54
+ * const compositionConcept = await MakeTheInstanceConcept(
55
+ * "custom_type",
56
+ * "complex_data",
57
+ * true,
58
+ * 1,
59
+ * 100
60
+ * );
61
+ *
62
+ * // Create a text concept for long content
63
+ * const longText = "Lorem ipsum...".repeat(100);
64
+ * const textConcept = await MakeTheInstanceConcept(
65
+ * "article",
66
+ * longText,
67
+ * false,
68
+ * 1,
69
+ * 100
70
+ * );
71
+ * ```
72
+ *
73
+ * @see {@link MakeTheTypeConceptApi} - Creates or retrieves type concepts
74
+ * @see {@link CreateTheConcept} - Creates the actual concept entity
75
+ * @see {@link GetConceptByCharacterAndType} - Retrieves existing concepts
76
+ * @see {@link CreateTextData} - Stores long text separately
77
+ */
3
78
  export default function MakeTheInstanceConcept(type: string, referent: string, composition: boolean | undefined, userId: number, passedAccessId: number, passedSessionId?: number, referentId?: number, actions?: InnerActions): Promise<Concept>;
@@ -1,2 +1,83 @@
1
+ /**
2
+ * @module MakeTheName
3
+ * @description Creates name concepts in the Concept Connection System (CCS).
4
+ * This module provides functionality for creating concepts that represent names,
5
+ * utilizing character concepts as referents. It handles both existing concepts
6
+ * (by retrieving their referent) and new concepts (by creating character concepts).
7
+ */
1
8
  import { Concept } from "../DataStructures/Concept";
9
+ /**
10
+ * Creates a name concept with character data as its referent.
11
+ *
12
+ * This function creates concepts specifically designed to represent names in the CCS system.
13
+ * It has two execution paths based on whether an existing concept is provided:
14
+ *
15
+ * 1. Existing concept (id > 0): Retrieves the referent of the existing concept and uses it
16
+ * 2. New concept: Creates a new character concept and uses it as the referent for the name
17
+ *
18
+ * Name concepts are typed with ID 12 (name type) and use character concepts as their
19
+ * referent, establishing a link between the name and its character representation.
20
+ *
21
+ * @param theCharacterData - The character string representing the name (e.g., "John Doe", "Product Name")
22
+ * @param userId - The ID of the user creating this name concept
23
+ * @param securityId - The security control ID for access management
24
+ * @param securityUserId - The user ID for security control
25
+ * @param accessId - The access control ID determining visibility
26
+ * @param accessUserId - The user ID for access control
27
+ * @param sessionInformationId - The session ID for tracking this operation
28
+ * @param sessionInformationUserId - The user ID associated with the session
29
+ * @param typeId - The type ID for the concept (used when creating from existing)
30
+ * @param typeUserId - The user ID associated with the type
31
+ * @param existingConcept - An existing concept to use as base (or empty concept to create new)
32
+ *
33
+ * @returns Promise resolving to the created or updated name Concept
34
+ *
35
+ * @remarks
36
+ * - Name type ID is fixed at 12
37
+ * - Category ID is fixed at 4
38
+ * - Session ID defaults to 999 if not provided (using nullish coalescing)
39
+ * - Access ID defaults to 4 if not provided
40
+ * - For existing concepts with valid ID, retrieves and reuses the referent
41
+ * - For new concepts, creates a character concept first, then creates the name concept
42
+ * - Category user ID is always 999
43
+ *
44
+ * @example
45
+ * ```typescript
46
+ * // Create a new name concept
47
+ * const emptyExisting = new Concept();
48
+ * const nameConcept = await MakeTheName(
49
+ * "John Doe",
50
+ * 1,
51
+ * 999,
52
+ * 1,
53
+ * 100,
54
+ * 1,
55
+ * 999,
56
+ * 999,
57
+ * 12,
58
+ * 1,
59
+ * emptyExisting
60
+ * );
61
+ *
62
+ * // Update existing concept with name
63
+ * const existing = await GetConcept(123);
64
+ * const updatedName = await MakeTheName(
65
+ * "Jane Smith",
66
+ * 1,
67
+ * 999,
68
+ * 1,
69
+ * 100,
70
+ * 1,
71
+ * 999,
72
+ * 999,
73
+ * 12,
74
+ * 1,
75
+ * existing
76
+ * );
77
+ * ```
78
+ *
79
+ * @see {@link MakeTheCharacter} - Creates the character concept used as referent
80
+ * @see {@link GetTheReferent} - Retrieves the referent from existing concepts
81
+ * @see {@link MakeTheConcept} - Creates the actual name concept entity
82
+ */
2
83
  export declare function MakeTheName(theCharacterData: string, userId: number, securityId: number, securityUserId: number, accessId: number, accessUserId: number, sessionInformationId: number, sessionInformationUserId: number, typeId: number, typeUserId: number, existingConcept: Concept): Promise<Concept>;
@@ -1,2 +1,70 @@
1
+ /**
2
+ * @module MakeTheTimestamp
3
+ * @description Creates timestamp concepts in the Concept Connection System (CCS).
4
+ * This module provides a specialized function for creating concepts that represent
5
+ * timestamps or time-based data. It ensures proper type prefixing and creates
6
+ * concepts with standardized metadata for temporal tracking within the system.
7
+ */
1
8
  import { Concept } from "../DataStructures/Concept";
9
+ /**
10
+ * Creates a timestamp concept with the specified type and referent.
11
+ *
12
+ * This function creates concepts specifically designed for representing timestamps
13
+ * and temporal data in the CCS system. It follows a simplified creation flow compared
14
+ * to MakeTheInstanceConcept, focusing on straightforward type-referent associations.
15
+ *
16
+ * The function automatically ensures the type string is prefixed with "the_" if not
17
+ * already present, then creates the type concept and associates it with a new concept
18
+ * containing the timestamp referent value.
19
+ *
20
+ * @param type - The type identifier for the timestamp concept (e.g., "created_at", "updated_at").
21
+ * Will be automatically prefixed with "the_" if not present.
22
+ * @param referent - The timestamp value or temporal data (e.g., ISO date string, Unix timestamp)
23
+ * @param userId - The ID of the user creating this timestamp concept
24
+ * @param accessId - The access control ID determining visibility
25
+ * @param sessionInformationId - The session ID for tracking this operation (default: 999)
26
+ *
27
+ * @returns Promise resolving to the created timestamp Concept
28
+ *
29
+ * @remarks
30
+ * - Category ID is fixed at 4 for timestamp concepts
31
+ * - Referent ID is set to 0 (no referent concept)
32
+ * - Security ID is fixed at 999
33
+ * - Session information ID is overridden to 999 regardless of parameter
34
+ * - Access ID is overridden to 4 regardless of parameter
35
+ * - All user IDs are derived from the userId parameter
36
+ * - Type concept is created before the timestamp concept
37
+ *
38
+ * @example
39
+ * ```typescript
40
+ * // Create a timestamp for creation time
41
+ * const createdAt = await MakeTheTimestamp(
42
+ * "created_at",
43
+ * new Date().toISOString(),
44
+ * 1,
45
+ * 100
46
+ * );
47
+ *
48
+ * // Create a timestamp with explicit session
49
+ * const updatedAt = await MakeTheTimestamp(
50
+ * "the_updated_at",
51
+ * Date.now().toString(),
52
+ * 1,
53
+ * 100,
54
+ * 999
55
+ * );
56
+ *
57
+ * // Create a custom temporal concept
58
+ * const expiryTime = await MakeTheTimestamp(
59
+ * "expires_at",
60
+ * "2025-12-31T23:59:59Z",
61
+ * 1,
62
+ * 100
63
+ * );
64
+ * ```
65
+ *
66
+ * @see {@link MakeTheTypeConceptApi} - Creates or retrieves the type concept
67
+ * @see {@link MakeTheConcept} - Creates the actual concept entity
68
+ * @see {@link CreateDefaultConcept} - Creates a default concept structure
69
+ */
2
70
  export declare function MakeTheTimestamp(type: string, referent: string, userId: number, accessId: number, sessionInformationId?: number): Promise<Concept>;
@@ -1,3 +1,71 @@
1
+ /**
2
+ * @module MakeTheTypeConcept
3
+ * @description Creates type concepts in the Concept Connection System (CCS).
4
+ * This module handles the creation of type concepts which define the structure and
5
+ * categorization of instance concepts. It supports both simple types and composite
6
+ * types using recursive parsing and creation strategies.
7
+ */
1
8
  import { Concept } from "../DataStructures/Concept";
2
9
  import { InnerActions } from "../DataStructures/Transaction/Transaction";
10
+ /**
11
+ * Creates or retrieves a type concept in the CCS system.
12
+ *
13
+ * This function manages the creation of type concepts which define the structure
14
+ * and classification for instance concepts. It uses a recursive approach to handle
15
+ * composite types by splitting type strings and creating category and type hierarchies.
16
+ *
17
+ * The function follows this logic:
18
+ * 1. First checks if a concept with the given character value exists
19
+ * 2. If not found, splits the type string to determine if it's a composite type
20
+ * 3. For simple types, creates a character-based concept
21
+ * 4. For composite types (e.g., "category_typename"), recursively creates both parts
22
+ *
23
+ * @param typeString - The string identifier for the type (e.g., "user", "post", "the_category_type")
24
+ * @param sessionId - The session ID for tracking this operation
25
+ * @param sessionUserId - The user ID associated with the session
26
+ * @param userId - The ID of the user creating this type concept
27
+ * @param actions - Transaction actions for batch operations (default: empty actions)
28
+ *
29
+ * @returns Promise resolving to the created or retrieved type Concept
30
+ *
31
+ * @remarks
32
+ * - Uses SplitStrings to parse composite type names
33
+ * - Recursively creates type hierarchies for composite types
34
+ * - The first part of a split becomes the category, the second part becomes the type
35
+ * - Simple types (no split) are created as character concepts
36
+ * - Includes debug logging for split string arrays
37
+ *
38
+ * @example
39
+ * ```typescript
40
+ * // Create a simple type
41
+ * const userType = await MakeTheTypeConcept(
42
+ * "the_user",
43
+ * 999,
44
+ * 1,
45
+ * 1
46
+ * );
47
+ *
48
+ * // Create a composite type
49
+ * const compositeType = await MakeTheTypeConcept(
50
+ * "category_typename",
51
+ * 999,
52
+ * 1,
53
+ * 1
54
+ * );
55
+ *
56
+ * // With transaction actions
57
+ * const typeWithActions = await MakeTheTypeConcept(
58
+ * "the_post",
59
+ * 999,
60
+ * 1,
61
+ * 1,
62
+ * { concepts: [], connections: [] }
63
+ * );
64
+ * ```
65
+ *
66
+ * @see {@link GetConceptByCharacter} - Checks for existing type concepts
67
+ * @see {@link MakeTheCharacter} - Creates character-based concepts for simple types
68
+ * @see {@link SplitStrings} - Parses composite type strings
69
+ * @see {@link CreateTheConceptImmediate} - Creates the concept entity for composite types
70
+ */
3
71
  export declare function MakeTheTypeConcept(typeString: string, sessionId: number, sessionUserId: number, userId: number, actions?: InnerActions): Promise<Concept>;
@@ -1 +1,28 @@
1
+ /**
2
+ * @module publishMessage
3
+ * @description Provides MQTT message publishing functionality for real-time communication
4
+ */
5
+ /**
6
+ * Publishes a message to an MQTT topic if a connection is established.
7
+ * Used for real-time notifications and updates across the system.
8
+ *
9
+ * @param {string} topic - The MQTT topic to publish to
10
+ * @param {any} message - The message payload to publish
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * // Publish a composition update notification
15
+ * publishMessage("compositionUpdate", "123");
16
+ *
17
+ * // Publish a complex message
18
+ * publishMessage("user/notifications", { type: "follow", userId: 456 });
19
+ * ```
20
+ *
21
+ * @remarks
22
+ * - Only publishes if BaseUrl.MQTT_CONNECTION is available
23
+ * - No-op if MQTT connection is not established
24
+ * - No return value (void function)
25
+ * - Message format depends on subscriber expectations
26
+ * - Used for cache invalidation and real-time updates
27
+ */
1
28
  export declare function publishMessage(topic: string, message: any): void;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @module subscribeMessage
3
+ * @description Provides MQTT message subscription functionality for real-time cache invalidation (Currently commented out/unused)
4
+ */
5
+ /**
6
+ * MQTT message subscription handler (Currently disabled).
7
+ * When enabled, this function would subscribe to MQTT topics and handle incoming messages.
8
+ *
9
+ * @remarks
10
+ * This functionality is currently commented out and not in use.
11
+ * When enabled, it would:
12
+ * - Subscribe to MQTT message events
13
+ * - Listen for "compositionUpdate" topic
14
+ * - Parse composition IDs from messages
15
+ * - Remove compositions from cache (CompositionBinaryTree)
16
+ * - Provide real-time cache invalidation when compositions change
17
+ *
18
+ * To enable:
19
+ * 1. Uncomment the function code
20
+ * 2. Ensure global.mqttconn is properly initialized
21
+ * 3. Import CompositionBinaryTree
22
+ * 4. Set up proper MQTT connection management
23
+ */