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,72 @@
1
+ /**
2
+ * Local Composition Creation Module
3
+ *
4
+ * This module provides functionality to recursively create complex, nested concept compositions
5
+ * from JSON objects in the local storage layer. It transforms JSON structures into interconnected
6
+ * concepts and connections, preserving the hierarchical relationships.
7
+ *
8
+ * @module CreateTheCompositionLocal
9
+ */
1
10
  import { LConcept } from "../../DataStructures/Local/LConcept";
11
+ /**
12
+ * Recursively creates a composition of concepts and connections from a JSON object.
13
+ *
14
+ * This function traverses a JSON object tree and converts each key-value pair into concepts
15
+ * with appropriate connections. It handles nested objects by recursively processing them,
16
+ * creating a graph structure that mirrors the original JSON hierarchy.
17
+ *
18
+ * The function distinguishes between:
19
+ * - Primitive values (string/number): Creates leaf concepts with the value as characterValue
20
+ * - Complex values (object/array): Creates composition concepts and recursively processes children
21
+ *
22
+ * @param json - The JSON object to convert into a concept composition
23
+ * @param ofTheConceptId - The ID of the parent concept (null for root level)
24
+ * @param ofTheConceptUserId - The user ID of the parent concept (null for root level)
25
+ * @param mainKey - The ID of the main/root composition concept (null for root level)
26
+ * @param userId - The user creating the composition (defaults to 999)
27
+ * @param accessId - Access control ID for created concepts (defaults to 999)
28
+ * @param sessionInformationId - Session ID for tracking (defaults to 4)
29
+ *
30
+ * @returns A promise that resolves to the main/root LConcept of the created composition
31
+ *
32
+ * @remarks
33
+ * - First invocation (when ofTheConceptId is null) creates the root concept
34
+ * - Subsequent recursive calls create child concepts connected to their parents
35
+ * - Uses `MakeTheInstanceConceptLocal` to create individual concepts
36
+ * - Uses `CreateTheConnectionLocal` to establish parent-child relationships
37
+ * - Maintains the structure through the mainKey parameter across recursive calls
38
+ * - Handles both object properties and array elements
39
+ *
40
+ * @example
41
+ * ```typescript
42
+ * // Create a composition from a nested JSON structure
43
+ * const userData = {
44
+ * name: "John Doe",
45
+ * age: 30,
46
+ * address: {
47
+ * street: "123 Main St",
48
+ * city: "Boston"
49
+ * }
50
+ * };
51
+ *
52
+ * const mainConcept = await CreateTheCompositionLocal(
53
+ * userData,
54
+ * null, // ofTheConceptId
55
+ * null, // ofTheConceptUserId
56
+ * null, // mainKey
57
+ * 123, // userId
58
+ * 4, // accessId
59
+ * 999 // sessionInformationId
60
+ * );
61
+ *
62
+ * // Result: Creates concepts for "name", "age", "address", "street", "city"
63
+ * // with appropriate connections forming a tree structure
64
+ * console.log(mainConcept.id); // Root concept ID
65
+ * ```
66
+ *
67
+ * @see {@link MakeTheInstanceConceptLocal} - Creates individual concepts
68
+ * @see {@link CreateTheConnectionLocal} - Creates connections between concepts
69
+ * @see {@link CreateDefaultLConcept} - Creates default empty concept
70
+ * @see {@link GetCompositionLocal} - Related function for retrieving compositions
71
+ */
2
72
  export declare function CreateTheCompositionLocal(json: any, ofTheConceptId?: number | null, ofTheConceptUserId?: number | null, mainKey?: number | null, userId?: number | null, accessId?: number | null, sessionInformationId?: number | null): Promise<LConcept>;
@@ -1,2 +1,60 @@
1
+ /**
2
+ * Local Concept Creation Module
3
+ *
4
+ * This module provides functionality to create concepts in the local storage layer of the
5
+ * Concept Connection System (CCS). It handles the instantiation of local concepts with
6
+ * temporary IDs before they are synchronized with the backend.
7
+ *
8
+ * @module CreateTheConceptLocal
9
+ */
1
10
  import { LConcept } from "../../DataStructures/Local/LConcept";
11
+ /**
12
+ * Creates a new concept in the local storage layer.
13
+ *
14
+ * This function generates a new local concept with a temporary random ID and stores it
15
+ * in both the in-memory data structure and the local IndexedDB database. The concept
16
+ * is marked as temporary and new, indicating it needs to be synchronized with the
17
+ * backend server when online.
18
+ *
19
+ * The function is essential for offline-first functionality, allowing users to create
20
+ * concepts even when disconnected from the backend server.
21
+ *
22
+ * @param referent - The character value or name of the concept being created
23
+ * @param typecharacter - The character representation of the concept's type
24
+ * @param userId - The ID of the user creating the concept
25
+ * @param categoryId - The category this concept belongs to
26
+ * @param typeId - The ID of the type concept that defines this concept's type
27
+ * @param accessId - Access control ID determining permissions for this concept
28
+ * @param referentId - Optional ID linking to a referent concept (defaults to 0)
29
+ *
30
+ * @returns A promise that resolves to the newly created LConcept instance
31
+ *
32
+ * @remarks
33
+ * - Generates a random temporary ID between 0 and 100,000,000
34
+ * - Sets `isTemp` flag to true to indicate this is a local-only concept
35
+ * - Sets `isNew` flag to true to mark it for synchronization
36
+ * - Stores the concept in both memory (LocalConceptsData) and IndexedDB
37
+ * - The temporary ID will be replaced with a backend-generated ID upon sync
38
+ *
39
+ * @example
40
+ * ```typescript
41
+ * // Create a concept with type "the_name" for user 123
42
+ * const concept = await CreateTheConceptLocal(
43
+ * "John Doe", // referent
44
+ * "the_name", // typecharacter
45
+ * 123, // userId
46
+ * 4, // categoryId
47
+ * 51, // typeId
48
+ * 4, // accessId
49
+ * 0 // referentId
50
+ * );
51
+ *
52
+ * console.log(concept.id); // Random ID like 45892371
53
+ * console.log(concept.isTemp); // true
54
+ * ```
55
+ *
56
+ * @see {@link LConcept} - The local concept data structure
57
+ * @see {@link LocalConceptsData.AddConcept} - Adds concept to in-memory storage
58
+ * @see {@link storeToDatabase} - Persists concept to IndexedDB
59
+ */
2
60
  export default function CreateTheConceptLocal(referent: string, typecharacter: string, userId: number, categoryId: number, typeId: number, accessId: number, referentId?: number): Promise<LConcept>;
@@ -1,2 +1,58 @@
1
+ /**
2
+ * Local Connection Creation Module
3
+ *
4
+ * This module provides functionality to create connections between concepts in the local
5
+ * storage layer. Connections represent relationships between concepts, forming the graph
6
+ * structure of the Concept Connection System.
7
+ *
8
+ * @module CreateTheConnectionLocal
9
+ */
1
10
  import { LConnection } from "../../DataStructures/Local/LConnection";
11
+ /**
12
+ * Creates a connection between two concepts in the local storage layer.
13
+ *
14
+ * This function establishes a directed relationship from one concept to another,
15
+ * storing it in both memory and IndexedDB. The connection is marked as temporary
16
+ * until synchronized with the backend server.
17
+ *
18
+ * The function includes validation to prevent self-referential connections
19
+ * (a concept connecting to itself), returning an empty connection object in such cases.
20
+ *
21
+ * @param ofTheConceptId - The ID of the source concept (from which the connection originates)
22
+ * @param toTheConceptId - The ID of the target concept (to which the connection points)
23
+ * @param typeId - The ID of the type concept defining the relationship type
24
+ * @param orderId - The order/sequence number for this connection (defaults to 1)
25
+ *
26
+ * @returns The newly created LConnection instance, or an empty connection if validation fails
27
+ *
28
+ * @remarks
29
+ * - Automatically assigns accessId of 4 (default access level)
30
+ * - Generates a random temporary ID between 0 and 100,000,000
31
+ * - Sets `isTemp` flag to true for synchronization tracking
32
+ * - Prevents self-referential connections (where ofTheConceptId === toTheConceptId)
33
+ * - Stores the connection in both memory (LocalConnectionData) and IndexedDB
34
+ *
35
+ * @example
36
+ * ```typescript
37
+ * // Create a connection from concept 100 to concept 200 with type 51
38
+ * const connection = CreateTheConnectionLocal(
39
+ * 100, // ofTheConceptId (source)
40
+ * 200, // toTheConceptId (target)
41
+ * 51, // typeId (relationship type)
42
+ * 1 // orderId (optional, defaults to 1)
43
+ * );
44
+ *
45
+ * console.log(connection.id); // Random ID like 78234561
46
+ * console.log(connection.isTemp); // true
47
+ *
48
+ * // This will return an empty connection (0,0,0,0,0,0)
49
+ * const selfConnection = CreateTheConnectionLocal(100, 100, 51);
50
+ * console.log(selfConnection.id); // 0
51
+ * ```
52
+ *
53
+ * @see {@link LConnection} - The local connection data structure
54
+ * @see {@link LocalConnectionData.AddConnection} - Adds connection to in-memory storage
55
+ * @see {@link storeToDatabase} - Persists connection to IndexedDB
56
+ * @see {@link CreateTheConceptLocal} - Related function for creating concepts
57
+ */
2
58
  export declare function CreateTheConnectionLocal(ofTheConceptId: number, toTheConceptId: number, typeId: number, orderId?: number): LConnection;
@@ -1,2 +1,105 @@
1
+ /**
2
+ * Local Composition List Retrieval Module
3
+ *
4
+ * This module provides functionality to retrieve multiple compositions of the same type
5
+ * from local storage. It enables batch retrieval of all compositions that match a specific
6
+ * type and belong to a particular user.
7
+ *
8
+ * @module GetCompositionListLocal
9
+ */
10
+ /**
11
+ * Retrieves all compositions of a specific type for a given user.
12
+ *
13
+ * This function finds all concept instances of a specified type (by name) that belong
14
+ * to a particular user, then fetches and reconstructs each composition as JSON.
15
+ * The result is an array of composition objects.
16
+ *
17
+ * @param compositionName - The character/name of the composition type to retrieve (e.g., "the_user")
18
+ * @param userId - The ID of the user whose compositions to retrieve
19
+ *
20
+ * @returns A promise that resolves to an array of composition JSON objects
21
+ *
22
+ * @remarks
23
+ * - First looks up the type concept by its character value
24
+ * - Then queries all concepts of that type belonging to the user
25
+ * - Fetches complete composition data for each matching concept
26
+ * - Returns an empty array if the type concept doesn't exist
27
+ * - Each element in the returned array is a complete composition object
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * // Retrieve all user compositions for user 123
32
+ * const users = await GetCompositionListLocal("the_user", 123);
33
+ *
34
+ * // Output might look like:
35
+ * // [
36
+ * // { "the_user": { name: "John", age: 30 } },
37
+ * // { "the_user": { name: "Jane", age: 25 } },
38
+ * // { "the_user": { name: "Bob", age: 35 } }
39
+ * // ]
40
+ *
41
+ * console.log(`Found ${users.length} users`);
42
+ * users.forEach(user => {
43
+ * console.log(user.the_user.name);
44
+ * });
45
+ *
46
+ * // Retrieve all product compositions
47
+ * const products = await GetCompositionListLocal("the_product", 123);
48
+ * ```
49
+ *
50
+ * @see {@link GetCompositionListLocalWithId} - Similar function that includes concept IDs
51
+ * @see {@link GetCompositionLocal} - Retrieves a single composition
52
+ * @see {@link GetConceptByCharacterLocal} - Looks up type concept by name
53
+ * @see {@link LocalConceptsData.GetConceptsByTypeIdAndUser} - Queries concepts by type and user
54
+ */
1
55
  export declare function GetCompositionListLocal(compositionName: string, userId: number): Promise<any>;
56
+ /**
57
+ * Retrieves all compositions of a specific type with their IDs included in results.
58
+ *
59
+ * Similar to GetCompositionListLocal, but each composition in the returned array
60
+ * includes both the composition data and its root concept ID. This is useful when
61
+ * you need to perform operations on the compositions and need to track their IDs.
62
+ *
63
+ * @param compositionName - The character/name of the composition type to retrieve
64
+ * @param userId - The ID of the user whose compositions to retrieve
65
+ *
66
+ * @returns A promise that resolves to an array of objects with 'data' and 'id' properties
67
+ *
68
+ * @remarks
69
+ * - Each element in the array has structure: { data: {composition}, id: conceptId }
70
+ * - Useful for update or delete operations where you need the concept ID
71
+ * - Uses GetCompositionLocalWithId internally for each composition
72
+ * - Returns empty array if the type concept doesn't exist
73
+ *
74
+ * @example
75
+ * ```typescript
76
+ * // Retrieve all users with their IDs
77
+ * const usersWithIds = await GetCompositionListLocalWithId("the_user", 123);
78
+ *
79
+ * // Output structure:
80
+ * // [
81
+ * // { data: { "the_user": { name: "John" } }, id: 1001 },
82
+ * // { data: { "the_user": { name: "Jane" } }, id: 1002 }
83
+ * // ]
84
+ *
85
+ * // Update each user
86
+ * for (const userObj of usersWithIds) {
87
+ * console.log(`Updating user ${userObj.id}`);
88
+ * const userData = userObj.data.the_user;
89
+ * await updateComposition(userObj.id, { ...userData, updated: true });
90
+ * }
91
+ *
92
+ * // Filter and process
93
+ * const specificUser = usersWithIds.find(u =>
94
+ * u.data.the_user.name === "John"
95
+ * );
96
+ * if (specificUser) {
97
+ * console.log(`John's ID is ${specificUser.id}`);
98
+ * }
99
+ * ```
100
+ *
101
+ * @see {@link GetCompositionListLocal} - Similar function without IDs
102
+ * @see {@link GetCompositionLocalWithId} - Retrieves single composition with ID
103
+ * @see {@link UpdateCompositionLocal} - Uses this format for updates
104
+ */
2
105
  export declare function GetCompositionListLocalWithId(compositionName: string, userId: number): Promise<any>;
@@ -1,2 +1,98 @@
1
+ /**
2
+ * Local Composition Retrieval Module
3
+ *
4
+ * This module provides functionality to retrieve and reconstruct concept compositions from
5
+ * local storage. It converts the graph structure of interconnected concepts and connections
6
+ * back into hierarchical JSON objects, making them easy to work with in application code.
7
+ *
8
+ * @module GetCompositionLocal
9
+ */
10
+ /**
11
+ * Retrieves a composition and converts it to a JSON object structure.
12
+ *
13
+ * This function fetches a concept composition by its ID and recursively reconstructs
14
+ * the original hierarchical JSON structure from the graph of concepts and connections.
15
+ * The root concept's type becomes the top-level key in the returned object.
16
+ *
17
+ * @param id - The ID of the root concept of the composition to retrieve
18
+ *
19
+ * @returns A promise that resolves to a JSON object representing the composition hierarchy
20
+ *
21
+ * @remarks
22
+ * - Fetches all connections associated with the composition
23
+ * - Identifies all concepts involved in the composition
24
+ * - Recursively traverses the graph to rebuild the JSON structure
25
+ * - The returned object has the root concept's type as its key
26
+ * - Uses helper function `recursiveFetchLocal` for tree traversal
27
+ *
28
+ * @example
29
+ * ```typescript
30
+ * // Retrieve a user composition by ID
31
+ * const userJson = await GetCompositionLocal(12345);
32
+ *
33
+ * // Output might look like:
34
+ * // {
35
+ * // "the_user": {
36
+ * // "name": "John Doe",
37
+ * // "age": 30,
38
+ * // "address": {
39
+ * // "street": "123 Main St",
40
+ * // "city": "Boston"
41
+ * // }
42
+ * // }
43
+ * // }
44
+ *
45
+ * console.log(userJson.the_user.name); // "John Doe"
46
+ * ```
47
+ *
48
+ * @see {@link GetCompositionLocalWithId} - Similar function that includes the composition ID
49
+ * @see {@link recursiveFetchLocal} - Helper function for recursive traversal
50
+ * @see {@link CreateTheCompositionLocal} - Related function for creating compositions
51
+ */
1
52
  export declare function GetCompositionLocal(id: number): Promise<any>;
53
+ /**
54
+ * Retrieves a composition with its ID included in the result.
55
+ *
56
+ * Similar to GetCompositionLocal, but wraps the result in an object that includes
57
+ * both the composition data and the root concept ID. This is useful when you need
58
+ * to track which composition the data came from.
59
+ *
60
+ * @param id - The ID of the root concept of the composition to retrieve
61
+ *
62
+ * @returns A promise that resolves to an object with 'data' and 'id' properties
63
+ *
64
+ * @remarks
65
+ * - Returns an object with two properties: 'data' (the composition JSON) and 'id' (the root concept ID)
66
+ * - Useful when working with multiple compositions and need to track their origins
67
+ * - Only includes data if the concept exists (concept.id !== 0)
68
+ * - Uses the same recursive fetching logic as GetCompositionLocal
69
+ *
70
+ * @example
71
+ * ```typescript
72
+ * const result = await GetCompositionLocalWithId(12345);
73
+ *
74
+ * // Output structure:
75
+ * // {
76
+ * // data: {
77
+ * // "the_user": { name: "John", age: 30 }
78
+ * // },
79
+ * // id: 12345
80
+ * // }
81
+ *
82
+ * console.log(result.id); // 12345
83
+ * console.log(result.data.the_user.name); // "John"
84
+ *
85
+ * // Useful for batch operations
86
+ * const compositions = await Promise.all([
87
+ * GetCompositionLocalWithId(100),
88
+ * GetCompositionLocalWithId(200)
89
+ * ]);
90
+ * compositions.forEach(comp => {
91
+ * console.log(`Composition ${comp.id}:`, comp.data);
92
+ * });
93
+ * ```
94
+ *
95
+ * @see {@link GetCompositionLocal} - Similar function without ID in result
96
+ * @see {@link recursiveFetchLocal} - Helper function for recursive traversal
97
+ */
2
98
  export declare function GetCompositionLocalWithId(id: number): Promise<any>;
@@ -1 +1,58 @@
1
+ /**
2
+ * Local Concept Character Lookup Module
3
+ *
4
+ * This module provides a simple interface for retrieving concepts by their character value
5
+ * (string content/name) from local storage. It's commonly used to look up type concepts
6
+ * or find concepts by their textual representation.
7
+ *
8
+ * @module GetConceptByCharacterLocal
9
+ */
10
+ /**
11
+ * Retrieves a concept from local storage by its character value.
12
+ *
13
+ * This function performs a lookup to find a concept whose characterValue (string content)
14
+ * matches the provided string. This is particularly useful for finding type concepts
15
+ * by their names (e.g., "the_user", "the_product") or for locating concepts by their
16
+ * textual representation.
17
+ *
18
+ * @param characterValue - The character/string value to search for
19
+ *
20
+ * @returns A promise that resolves to the matching LConcept, or a default concept if not found
21
+ *
22
+ * @remarks
23
+ * - Performs case-sensitive exact string matching
24
+ * - Utilizes LocalConceptsData's internal indexing for efficient lookup
25
+ * - If using character binary tree, lookup is O(log n), otherwise may be O(n)
26
+ * - Returns a default/empty concept if no match is found (check concept.id === 0)
27
+ * - Commonly used to look up type concepts before creating instances
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * // Look up a type concept
32
+ * const userType = await GetConceptByCharacterLocal("the_user");
33
+ * if (userType.id !== 0) {
34
+ * console.log(`Found user type with ID: ${userType.id}`);
35
+ * }
36
+ *
37
+ * // Look up a concept by name
38
+ * const johnConcept = await GetConceptByCharacterLocal("John Doe");
39
+ * if (johnConcept.id !== 0) {
40
+ * console.log(`John exists with ID ${johnConcept.id}`);
41
+ * } else {
42
+ * console.log("John not found in local storage");
43
+ * }
44
+ *
45
+ * // Use in composition retrieval
46
+ * async function getUserCompositions(userId: number) {
47
+ * const typeId = (await GetConceptByCharacterLocal("the_user")).id;
48
+ * if (typeId === 0) return [];
49
+ * return await LocalConceptsData.GetConceptsByTypeIdAndUser(typeId, userId);
50
+ * }
51
+ * ```
52
+ *
53
+ * @see {@link LocalConceptsData.GetConceptByCharacter} - Underlying lookup method
54
+ * @see {@link CreateLocalCharacterBinaryTreeFromData} - Initializes character-based indexing
55
+ * @see {@link MakeTheTypeLocal} - Uses this function to check for existing types
56
+ * @see {@link GetCompositionListLocal} - Uses this to find type concepts
57
+ */
1
58
  export default function GetConceptByCharacterLocal(characterValue: string): Promise<import("../../app").LConcept>;
@@ -1,2 +1,73 @@
1
+ /**
2
+ * Local Concept Creation with Uniqueness Check Module
3
+ *
4
+ * This module provides "get-or-create" functionality for concepts in local storage.
5
+ * It checks if a concept with the specified character value and type already exists,
6
+ * and only creates a new one if it doesn't, preventing duplicate concepts.
7
+ *
8
+ * @module MakeTheConceptLocal
9
+ */
1
10
  import { LConcept } from "../../DataStructures/Local/LConcept";
11
+ /**
12
+ * Gets an existing concept or creates a new one if it doesn't exist.
13
+ *
14
+ * This function implements a "get-or-create" pattern by first checking if a concept
15
+ * with the given character value and type already exists in local storage. If found,
16
+ * it returns the existing concept; otherwise, it creates and returns a new one.
17
+ *
18
+ * This prevents duplicate concepts from being created for the same character value
19
+ * and type combination, maintaining data integrity and uniqueness constraints.
20
+ *
21
+ * @param referent - The character value/name for the concept
22
+ * @param typeCharacter - The character representation of the concept's type
23
+ * @param userId - The ID of the user creating/owning the concept
24
+ * @param categoryId - The category ID for the concept
25
+ * @param typeId - The ID of the type concept
26
+ *
27
+ * @returns A promise that resolves to the found or newly created LConcept
28
+ *
29
+ * @remarks
30
+ * - First queries for existing concept using character value and type ID
31
+ * - Only creates a new concept if no match is found (concept.id === 0)
32
+ * - Automatically uses accessId of 4 (default access level) for new concepts
33
+ * - Ensures referent uniqueness within the same type
34
+ * - Particularly useful for maintaining referential integrity
35
+ *
36
+ * @example
37
+ * ```typescript
38
+ * // First call creates the concept
39
+ * const concept1 = await MakeTheConceptLocal(
40
+ * "John Doe", // referent
41
+ * "the_name", // typeCharacter
42
+ * 123, // userId
43
+ * 4, // categoryId
44
+ * 51 // typeId
45
+ * );
46
+ * console.log(`Created concept with ID: ${concept1.id}`);
47
+ *
48
+ * // Second call returns the same concept (no duplicate)
49
+ * const concept2 = await MakeTheConceptLocal(
50
+ * "John Doe", // same referent
51
+ * "the_name", // same typeCharacter
52
+ * 123, // userId
53
+ * 4, // categoryId
54
+ * 51 // same typeId
55
+ * );
56
+ * console.log(concept1.id === concept2.id); // true
57
+ *
58
+ * // Different type allows same referent
59
+ * const concept3 = await MakeTheConceptLocal(
60
+ * "John Doe", // same referent
61
+ * "the_company", // different type
62
+ * 123,
63
+ * 4,
64
+ * 52 // different typeId
65
+ * );
66
+ * console.log(concept3.id !== concept1.id); // true
67
+ * ```
68
+ *
69
+ * @see {@link CreateTheConceptLocal} - Creates new concepts
70
+ * @see {@link LocalConceptsData.GetConceptByCharacterAndTypeLocal} - Checks for existing concepts
71
+ * @see {@link MakeTheInstanceConceptLocal} - Higher-level concept creation with type handling
72
+ */
2
73
  export default function MakeTheConceptLocal(referent: string, typeCharacter: string, userId: number, categoryId: number, typeId: number): Promise<LConcept>;
@@ -1,2 +1,91 @@
1
+ /**
2
+ * Local Instance Concept Creation Module
3
+ *
4
+ * This module provides high-level functionality for creating instance concepts with
5
+ * automatic type management. It handles type creation, naming conventions (the_ prefix),
6
+ * and different scenarios like compositions, large text values, and standard concepts.
7
+ *
8
+ * @module MakeTheInstanceConceptLocal
9
+ */
1
10
  import { LConcept } from "../../DataStructures/Local/LConcept";
11
+ /**
12
+ * Creates an instance concept with automatic type handling and smart referent management.
13
+ *
14
+ * This high-level function handles the complete process of creating a concept instance,
15
+ * including:
16
+ * - Ensuring the type concept exists (creates if needed)
17
+ * - Adding "the_" prefix to types if not present
18
+ * - Handling composition concepts (nested objects)
19
+ * - Managing long text values (> 255 characters)
20
+ * - Preventing duplicate concepts with get-or-create logic
21
+ *
22
+ * @param type - The type name for the concept (e.g., "user", "product")
23
+ * @param referent - The string value/content of the concept
24
+ * @param composition - Whether this is a composition concept (has nested structure)
25
+ * @param userId - The ID of the user creating the concept
26
+ * @param accessId - Access control ID for the concept
27
+ * @param sessionInformationId - Session tracking ID (defaults to 999)
28
+ * @param referentId - Optional ID linking to another concept (defaults to 0)
29
+ *
30
+ * @returns A promise that resolves to the created or found LConcept with its type attached
31
+ *
32
+ * @remarks
33
+ * - Automatically prepends "the_" to type names if not already present
34
+ * - For compositions: Always creates a new concept regardless of existing ones
35
+ * - For text > 255 chars: Creates concept with full text stored
36
+ * - For text <= 255 chars: Uses get-or-create logic to prevent duplicates
37
+ * - Always ensures the type concept exists before creating the instance
38
+ * - Sets category ID to 4 by default
39
+ * - Returns concept with its type property populated for immediate use
40
+ *
41
+ * @example
42
+ * ```typescript
43
+ * // Create a simple string concept
44
+ * const nameConcept = await MakeTheInstanceConceptLocal(
45
+ * "name", // type (becomes "the_name")
46
+ * "John Doe", // referent
47
+ * false, // not a composition
48
+ * 123, // userId
49
+ * 4, // accessId
50
+ * 999 // sessionInformationId
51
+ * );
52
+ * console.log(nameConcept.type.characterValue); // "the_name"
53
+ *
54
+ * // Create a composition concept for nested objects
55
+ * const addressConcept = await MakeTheInstanceConceptLocal(
56
+ * "address", // type (becomes "the_address")
57
+ * "", // empty referent for compositions
58
+ * true, // is a composition
59
+ * 123,
60
+ * 4,
61
+ * 999
62
+ * );
63
+ *
64
+ * // Handle long text
65
+ * const longText = "A".repeat(300);
66
+ * const articleConcept = await MakeTheInstanceConceptLocal(
67
+ * "article",
68
+ * longText, // > 255 characters
69
+ * false,
70
+ * 123,
71
+ * 4,
72
+ * 999
73
+ * );
74
+ *
75
+ * // Type name with "the_" prefix already included
76
+ * const userConcept = await MakeTheInstanceConceptLocal(
77
+ * "the_user", // already has "the_" prefix
78
+ * "user123",
79
+ * false,
80
+ * 123,
81
+ * 4,
82
+ * 999
83
+ * );
84
+ * ```
85
+ *
86
+ * @see {@link MakeTheTypeConceptLocal} - Creates or retrieves type concepts
87
+ * @see {@link CreateTheConceptLocal} - Creates the actual concept instance
88
+ * @see {@link LocalConceptsData.GetConceptByCharacterAndTypeLocal} - Checks for existing concepts
89
+ * @see {@link CreateTheCompositionLocal} - Uses this function to create composition elements
90
+ */
2
91
  export declare function MakeTheInstanceConceptLocal(type: string, referent: string, composition: boolean | undefined, userId: number, accessId: number, sessionInformationId?: number, referentId?: number): Promise<LConcept>;