mftsccs-node 0.0.57 → 0.0.58

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (180) hide show
  1. package/README.md +1148 -11
  2. package/dist/types/Api/Create/CreateTheCharacter.d.ts +42 -0
  3. package/dist/types/Api/Create/CreateTheConceptApi.d.ts +50 -0
  4. package/dist/types/Api/Create/CreateTheConnectionApi.d.ts +51 -0
  5. package/dist/types/Api/Create/CreateTheTextData.d.ts +56 -0
  6. package/dist/types/Api/Delete/DeleteConceptInBackend.d.ts +43 -0
  7. package/dist/types/Api/DeleteConnectionApiBulk.d.ts +55 -0
  8. package/dist/types/Api/DeleteTheConcept.d.ts +64 -0
  9. package/dist/types/Api/DeleteTheConnection.d.ts +76 -0
  10. package/dist/types/Api/GetAiData.d.ts +36 -0
  11. package/dist/types/Api/GetAllConcepts.d.ts +42 -0
  12. package/dist/types/Api/GetAllConceptsByType.d.ts +45 -0
  13. package/dist/types/Api/GetAllConnections.d.ts +48 -0
  14. package/dist/types/Api/GetAllConnectionsOfComposition.d.ts +79 -0
  15. package/dist/types/Api/GetAllConnectionsOfCompositionBulk.d.ts +90 -0
  16. package/dist/types/Api/GetAllLinkerConnectionsFromTheConcept.d.ts +52 -0
  17. package/dist/types/Api/GetAllLinkerConnectionsToTheConcept.d.ts +61 -0
  18. package/dist/types/Api/GetAllPrefetchConnections.d.ts +51 -0
  19. package/dist/types/Api/GetCharacterDataByCharacter.d.ts +31 -0
  20. package/dist/types/Api/GetCompositionConnectionsBetweenTwoConcepts.d.ts +39 -0
  21. package/dist/types/Api/GetConcept.d.ts +47 -0
  22. package/dist/types/Api/GetConceptBulk.d.ts +68 -0
  23. package/dist/types/Api/GetConceptByCharacterAndType.d.ts +75 -0
  24. package/dist/types/Api/GetConceptByCharacterValue.d.ts +47 -0
  25. package/dist/types/Api/GetConnection.d.ts +49 -0
  26. package/dist/types/Api/GetConnectionBulk.d.ts +46 -0
  27. package/dist/types/Api/GetConnectionOfTheConcept.d.ts +50 -0
  28. package/dist/types/Api/GetConnectionToTheConcept.d.ts +56 -0
  29. package/dist/types/Api/GetReservedConnectionIds.d.ts +36 -0
  30. package/dist/types/Api/GetReservedIds.d.ts +37 -0
  31. package/dist/types/Api/Login.d.ts +38 -0
  32. package/dist/types/Api/MakeTheNameInBackend.d.ts +39 -0
  33. package/dist/types/Api/MakeTheTypeConceptApi.d.ts +40 -0
  34. package/dist/types/Api/RecursiveSearch.d.ts +43 -0
  35. package/dist/types/Api/Search/FreeschemaQueryApi.d.ts +46 -0
  36. package/dist/types/Api/Search/Search.d.ts +67 -0
  37. package/dist/types/Api/Search/SearchInternalApi.d.ts +69 -0
  38. package/dist/types/Api/Search/SearchLinkMultipleApi.d.ts +90 -0
  39. package/dist/types/Api/Search/SearchWithLinker.d.ts +97 -0
  40. package/dist/types/Api/SearchConcept/GetConceptByCharacterAndCategoryApi.d.ts +39 -0
  41. package/dist/types/Api/SearchConcept/GetConceptByCharacterAndCategoryDirect.d.ts +47 -0
  42. package/dist/types/Api/Session/CreateSession.d.ts +45 -0
  43. package/dist/types/Api/Session/CreateSessionVisit.d.ts +43 -0
  44. package/dist/types/Api/Signin.d.ts +48 -0
  45. package/dist/types/Api/Signup.d.ts +44 -0
  46. package/dist/types/Api/View/ViewInternalDataApi.d.ts +50 -0
  47. package/dist/types/Constants/ApiConstants.d.ts +226 -0
  48. package/dist/types/Constants/FormatConstants.d.ts +80 -0
  49. package/dist/types/DataStructures/BaseUrl.d.ts +210 -0
  50. package/dist/types/DataStructures/BinaryCharacterTree.d.ts +211 -0
  51. package/dist/types/DataStructures/BinaryTree.d.ts +139 -0
  52. package/dist/types/DataStructures/BinaryTypeTree.d.ts +196 -0
  53. package/dist/types/DataStructures/CharacterRepository.d.ts +109 -0
  54. package/dist/types/DataStructures/Composition/Composition.d.ts +103 -0
  55. package/dist/types/DataStructures/Composition/CompositionBinaryTree.d.ts +104 -0
  56. package/dist/types/DataStructures/Composition/CompositionNode.d.ts +202 -0
  57. package/dist/types/DataStructures/Concept.d.ts +110 -0
  58. package/dist/types/DataStructures/ConceptData.d.ts +292 -0
  59. package/dist/types/DataStructures/ConceptsToDraw.d.ts +168 -0
  60. package/dist/types/DataStructures/Connection.d.ts +76 -0
  61. package/dist/types/DataStructures/ConnectionBinaryTree/ConnectionBinaryTree.d.ts +115 -0
  62. package/dist/types/DataStructures/ConnectionBinaryTree/ConnectionNode.d.ts +169 -0
  63. package/dist/types/DataStructures/ConnectionBinaryTree/ConnectionTypeTree.d.ts +82 -0
  64. package/dist/types/DataStructures/ConnectionData.d.ts +191 -0
  65. package/dist/types/DataStructures/Count/CountInfo.d.ts +73 -0
  66. package/dist/types/DataStructures/FilterSearch.d.ts +84 -0
  67. package/dist/types/DataStructures/IdentifierFlags.d.ts +34 -0
  68. package/dist/types/DataStructures/Local/LConcept.d.ts +105 -0
  69. package/dist/types/DataStructures/Local/LConnection.d.ts +83 -0
  70. package/dist/types/DataStructures/Local/LNode.d.ts +190 -0
  71. package/dist/types/DataStructures/Local/LocalBinaryCharacterTree.d.ts +133 -0
  72. package/dist/types/DataStructures/Local/LocalBinaryTree.d.ts +135 -0
  73. package/dist/types/DataStructures/Local/LocalBinaryTypeTree.d.ts +147 -0
  74. package/dist/types/DataStructures/Local/LocalConceptData.d.ts +100 -0
  75. package/dist/types/DataStructures/Local/LocalConnectionData.d.ts +109 -0
  76. package/dist/types/DataStructures/Local/LocalSyncData.d.ts +89 -0
  77. package/dist/types/DataStructures/PatcherStructure.d.ts +86 -0
  78. package/dist/types/DataStructures/ReferentInfo.d.ts +68 -0
  79. package/dist/types/DataStructures/ReservedIds.d.ts +101 -0
  80. package/dist/types/DataStructures/Responses/ErrorResponse.d.ts +184 -22
  81. package/dist/types/DataStructures/Responses/StandardResponses.d.ts +65 -0
  82. package/dist/types/DataStructures/Returner.d.ts +59 -0
  83. package/dist/types/DataStructures/Search/FreeschemaQuery.d.ts +165 -0
  84. package/dist/types/DataStructures/Search/SearchStructure.d.ts +69 -0
  85. package/dist/types/DataStructures/SearchQuery.d.ts +130 -0
  86. package/dist/types/DataStructures/Security/TokenStorage.d.ts +48 -0
  87. package/dist/types/DataStructures/Session/SessionData.d.ts +118 -0
  88. package/dist/types/DataStructures/SettingData.d.ts +32 -0
  89. package/dist/types/DataStructures/Settings.d.ts +27 -0
  90. package/dist/types/DataStructures/SigninModel.d.ts +50 -0
  91. package/dist/types/DataStructures/SignupModel.d.ts +50 -0
  92. package/dist/types/DataStructures/SyncData.d.ts +206 -0
  93. package/dist/types/DataStructures/TheCharacter.d.ts +87 -0
  94. package/dist/types/DataStructures/TheTexts.d.ts +92 -0
  95. package/dist/types/DataStructures/Transaction/Transaction.d.ts +294 -4
  96. package/dist/types/DataStructures/User/UserBinaryTree.d.ts +117 -0
  97. package/dist/types/DataStructures/User/UserNode.d.ts +130 -0
  98. package/dist/types/Database/GetConceptFromIndexDb.d.ts +9 -0
  99. package/dist/types/Database/NoIndexDb.d.ts +169 -0
  100. package/dist/types/Database/indexdblocal.d.ts +42 -0
  101. package/dist/types/Database/indexeddb.d.ts +43 -0
  102. package/dist/types/Drawing/ConceptDraw.d.ts +28 -0
  103. package/dist/types/Drawing/ConceptEvents.d.ts +46 -0
  104. package/dist/types/Helpers/CheckIfExists.d.ts +159 -0
  105. package/dist/types/Helpers/RemoveFromArray.d.ts +66 -0
  106. package/dist/types/Helpers/UniqueInsert.d.ts +28 -0
  107. package/dist/types/Services/CheckForConnectionDeletion.d.ts +190 -0
  108. package/dist/types/Services/Common/DecodeCountInfo.d.ts +54 -0
  109. package/dist/types/Services/Common/ErrorPosting.d.ts +49 -0
  110. package/dist/types/Services/Common/RegexFunction.d.ts +28 -0
  111. package/dist/types/Services/Composition/BuildComposition.d.ts +37 -0
  112. package/dist/types/Services/Composition/CompositionCache.d.ts +89 -0
  113. package/dist/types/Services/Composition/CreateCompositionCache.d.ts +43 -0
  114. package/dist/types/Services/Conversion/ConvertConcepts.d.ts +83 -0
  115. package/dist/types/Services/CreateBinaryTreeFromData.d.ts +38 -0
  116. package/dist/types/Services/CreateCharacterBinaryTreeFromData.d.ts +42 -0
  117. package/dist/types/Services/CreateConnectionBetweenTwoConcepts.d.ts +206 -0
  118. package/dist/types/Services/CreateDefaultConcept.d.ts +114 -0
  119. package/dist/types/Services/CreateTheComposition.d.ts +101 -0
  120. package/dist/types/Services/CreateTheConcept.d.ts +179 -0
  121. package/dist/types/Services/CreateTheConnection.d.ts +59 -0
  122. package/dist/types/Services/CreateTheConnectionGeneral.d.ts +127 -0
  123. package/dist/types/Services/CreateTypeTreeFromData.d.ts +43 -0
  124. package/dist/types/Services/Delete/DeleteConnectionByType.d.ts +52 -5
  125. package/dist/types/Services/Delete/GetAllConnectionByType.d.ts +57 -9
  126. package/dist/types/Services/DeleteConcept.d.ts +136 -0
  127. package/dist/types/Services/DeleteConnection.d.ts +194 -0
  128. package/dist/types/Services/FindConeceptsFromConnection.d.ts +179 -0
  129. package/dist/types/Services/FindConnectionsOfCompositionBulkInMemory.d.ts +157 -0
  130. package/dist/types/Services/GenerateHexNumber.d.ts +64 -0
  131. package/dist/types/Services/GetComposition.d.ts +331 -0
  132. package/dist/types/Services/GetCompositionBulk.d.ts +251 -3
  133. package/dist/types/Services/GetCompositionList.d.ts +130 -0
  134. package/dist/types/Services/GetConceptByCharacter.d.ts +84 -0
  135. package/dist/types/Services/GetConnections.d.ts +72 -0
  136. package/dist/types/Services/GetDataFromIndexDb.d.ts +79 -0
  137. package/dist/types/Services/GetLink.d.ts +104 -0
  138. package/dist/types/Services/GetLinkerConnectionFromConcept.d.ts +99 -0
  139. package/dist/types/Services/GetMaximumConnectionSyncTime.d.ts +57 -0
  140. package/dist/types/Services/GetRelation.d.ts +162 -0
  141. package/dist/types/Services/GetTheConcept.d.ts +71 -0
  142. package/dist/types/Services/GetTheReferent.d.ts +74 -0
  143. package/dist/types/Services/InitializeSystem.d.ts +119 -0
  144. package/dist/types/Services/Local/CreateDefaultLConcept.d.ts +48 -0
  145. package/dist/types/Services/Local/CreateLocalBinaryTreeFromData.d.ts +49 -0
  146. package/dist/types/Services/Local/CreateLocalBinaryTypeTreeFromData.d.ts +54 -0
  147. package/dist/types/Services/Local/CreateLocalCharacterBinaryTree.d.ts +60 -0
  148. package/dist/types/Services/Local/CreateTheCompositionLocal.d.ts +70 -0
  149. package/dist/types/Services/Local/CreateTheConceptLocal.d.ts +58 -0
  150. package/dist/types/Services/Local/CreateTheConnectionLocal.d.ts +56 -0
  151. package/dist/types/Services/Local/GetCompositionListLocal.d.ts +103 -0
  152. package/dist/types/Services/Local/GetCompositionLocal.d.ts +96 -0
  153. package/dist/types/Services/Local/GetConceptByCharacterLocal.d.ts +57 -0
  154. package/dist/types/Services/Local/MakeTheConceptLocal.d.ts +71 -0
  155. package/dist/types/Services/Local/MakeTheInstanceConceptLocal.d.ts +89 -0
  156. package/dist/types/Services/Local/MakeTheTypeLocal.d.ts +71 -0
  157. package/dist/types/Services/Local/UpdateCompositionLocal.d.ts +101 -0
  158. package/dist/types/Services/MakeTheCharacter.d.ts +74 -0
  159. package/dist/types/Services/MakeTheCharacterData.d.ts +65 -0
  160. package/dist/types/Services/MakeTheInstanceConcept.d.ts +75 -0
  161. package/dist/types/Services/MakeTheName.d.ts +81 -0
  162. package/dist/types/Services/MakeTheTimestamp.d.ts +68 -0
  163. package/dist/types/Services/MakeTheTypeConcept.d.ts +68 -0
  164. package/dist/types/Services/Mqtt/publishMessage.d.ts +27 -0
  165. package/dist/types/Services/Mqtt/subscribeMessage.d.ts +23 -0
  166. package/dist/types/Services/PatchComposition.d.ts +105 -0
  167. package/dist/types/Services/Search/DataIdFormat.d.ts +96 -24
  168. package/dist/types/Services/Search/FormatData.d.ts +92 -17
  169. package/dist/types/Services/Search/JustIdFormat.d.ts +91 -16
  170. package/dist/types/Services/Search/SearchLinkInternal.d.ts +28 -0
  171. package/dist/types/Services/Search/SearchLinkMultiple.d.ts +58 -0
  172. package/dist/types/Services/Search/SearchWithTypeAndLinker.d.ts +91 -24
  173. package/dist/types/Services/Search/orderingConnections.d.ts +34 -0
  174. package/dist/types/Services/SplitStrings.d.ts +50 -0
  175. package/dist/types/Services/UpdateComposition.d.ts +123 -0
  176. package/dist/types/Services/User/UserTranslation.d.ts +102 -0
  177. package/dist/types/Services/View/ViewInternalData.d.ts +32 -0
  178. package/dist/types/WrapperFunctions/SchemaQueryObservable.d.ts +140 -5
  179. package/dist/types/app.d.ts +71 -0
  180. package/package.json +1 -1
@@ -1,7 +1,90 @@
1
+ /**
2
+ * @module ConvertConcepts
3
+ * @description Provides conversion functions between Concept/Connection and LConcept/LConnection (local versions)
4
+ */
1
5
  import { Concept } from "../../DataStructures/Concept";
2
6
  import { Connection } from "../../DataStructures/Connection";
3
7
  import { LConcept } from "../../DataStructures/Local/LConcept";
4
8
  import { LConnection } from "../../DataStructures/Local/LConnection";
9
+ /**
10
+ * Converts a standard Concept to a Local Concept (LConcept).
11
+ * LConcepts include additional properties for local/optimistic operations.
12
+ *
13
+ * @param {Concept} concept - The standard Concept to convert
14
+ * @returns {LConcept} The converted LConcept with all properties mapped
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * const concept: Concept = {
19
+ * id: 123,
20
+ * characterValue: "John",
21
+ * typeId: 456,
22
+ * ...
23
+ * };
24
+ * const lConcept = convertFromConceptToLConcept(concept);
25
+ * // lConcept includes all concept properties plus isTemp, typeCharacter
26
+ * ```
27
+ *
28
+ * @remarks
29
+ * - Maps all standard Concept properties to LConcept
30
+ * - Sets isTemp to false (not a temporary concept)
31
+ * - Includes typeCharacter from concept.type.characterValue
32
+ * - Used when loading concepts from backend into local cache
33
+ * - LConcepts are used for optimistic UI updates
34
+ */
5
35
  export declare function convertFromConceptToLConcept(concept: Concept): LConcept;
36
+ /**
37
+ * Converts a Local Concept (LConcept) back to a standard Concept.
38
+ * Used when persisting local concepts to the backend.
39
+ *
40
+ * @param {LConcept} lconcept - The LConcept to convert
41
+ * @returns {Concept} The converted standard Concept
42
+ *
43
+ * @example
44
+ * ```typescript
45
+ * const lConcept: LConcept = {
46
+ * id: 123,
47
+ * ghostId: 456,
48
+ * characterValue: "John",
49
+ * isTemp: true,
50
+ * ...
51
+ * };
52
+ * const concept = convertFromLConceptToConcept(lConcept);
53
+ * // concept is now a standard Concept without local-specific properties
54
+ * ```
55
+ *
56
+ * @remarks
57
+ * - Maps LConcept properties back to standard Concept
58
+ * - Drops local-specific properties (isTemp, typeCharacter)
59
+ * - Used when saving concepts to backend
60
+ * - Reverse operation of convertFromConceptToLConcept
61
+ */
6
62
  export declare function convertFromLConceptToConcept(lconcept: LConcept): Concept;
63
+ /**
64
+ * Converts a standard Connection to a Local Connection (LConnection).
65
+ * LConnections include additional properties for local/optimistic operations.
66
+ *
67
+ * @param {Connection} connection - The standard Connection to convert
68
+ * @returns {LConnection} The converted LConnection with all properties mapped
69
+ *
70
+ * @example
71
+ * ```typescript
72
+ * const connection: Connection = {
73
+ * id: 789,
74
+ * ofTheConceptId: 123,
75
+ * toTheConceptId: 456,
76
+ * typeId: 999,
77
+ * ...
78
+ * };
79
+ * const lConnection = convertFromConnectionToLConnection(connection);
80
+ * // lConnection includes all connection properties plus isTemp flag
81
+ * ```
82
+ *
83
+ * @remarks
84
+ * - Maps all standard Connection properties to LConnection
85
+ * - Sets isTemp to false (not a temporary connection)
86
+ * - Used when loading connections from backend into local cache
87
+ * - LConnections are used for optimistic UI updates
88
+ * - Enables local connection management before backend persistence
89
+ */
7
90
  export declare function convertFromConnectionToLConnection(connection: Connection): LConnection;
@@ -1 +1,39 @@
1
+ /**
2
+ * Binary Tree Data Loading Service
3
+ *
4
+ * This module provides functionality for creating and populating binary tree data structures
5
+ * from persisted concept data stored in IndexedDB. It loads concept records and adds them
6
+ * to in-memory data structures for efficient access and querying.
7
+ *
8
+ * @module CreateBinaryTreeFromData
9
+ */
10
+ /**
11
+ * Creates and populates a binary tree structure from concept data stored in the database.
12
+ *
13
+ * This function loads all concept records from IndexedDB and adds them to the in-memory
14
+ * ConceptsData structure for fast retrieval and manipulation. It measures the time taken
15
+ * to load all concepts for performance monitoring purposes.
16
+ *
17
+ * The function retrieves all records of type "concept" from the database and iterates through
18
+ * them, adding each concept to the ConceptsData memory structure. Note that the actual binary
19
+ * tree node creation is currently commented out, with only memory storage being active.
20
+ *
21
+ * @returns A promise that resolves when all concepts have been loaded into memory
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * // Initialize the binary tree with database data
26
+ * await CreateBinaryTreeFromData();
27
+ * console.log('Binary tree populated from database');
28
+ * ```
29
+ *
30
+ * @remarks
31
+ * - Performance is tracked using start and end timestamps
32
+ * - The actual BinaryTree node creation (lines 14-15) is commented out in current implementation
33
+ * - Only adds concepts to ConceptsData memory structure, not to the BinaryTree itself
34
+ * - Time measurement variables (startTime, endTime, time) are calculated but not returned or logged
35
+ *
36
+ * @see {@link ConceptsData.AddConceptToMemory} for how concepts are stored in memory
37
+ * @see {@link getFromDatabaseWithTypeOld} for database retrieval implementation
38
+ */
1
39
  export default function CreateBinaryTreeFromData(): Promise<void>;
@@ -1 +1,43 @@
1
+ /**
2
+ * Character-Based Binary Tree Data Loading Service
3
+ *
4
+ * This module provides functionality for creating and populating a character-based binary tree
5
+ * data structure from persisted concept data. The tree is organized by character values,
6
+ * allowing for efficient character-based searching and retrieval of concepts.
7
+ *
8
+ * @module CreateCharacterBinaryTreeFromData
9
+ */
10
+ /**
11
+ * Creates and populates a character-based binary tree from concept data stored in the database.
12
+ *
13
+ * This function retrieves all concept records from IndexedDB and constructs a binary tree
14
+ * where nodes are organized by their character values. Each concept is wrapped in a Node
15
+ * with its characterValue as the key, enabling efficient character-based lookups and searches.
16
+ *
17
+ * The BinaryCharacterTree allows for alphabetical or character-based organization of concepts,
18
+ * which is useful for features like autocomplete, search suggestions, or character-based
19
+ * filtering of concept data.
20
+ *
21
+ * @returns A promise that resolves when the character binary tree has been fully populated
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * // Build the character-based binary tree from database
26
+ * await CreateCharacterBinaryTreeFromData();
27
+ *
28
+ * // The tree can now be used for character-based searches
29
+ * const results = BinaryCharacterTree.search('a');
30
+ * console.log('Concepts starting with "a":', results);
31
+ * ```
32
+ *
33
+ * @remarks
34
+ * - Creates a new BinaryCharacterTree instance at the start of execution
35
+ * - Each concept is converted to a Node using its characterValue property as the key
36
+ * - The tree is built incrementally by adding one node at a time
37
+ * - Character values determine the position in the binary tree for O(log n) search performance
38
+ *
39
+ * @see {@link BinaryCharacterTree.addNodeToTree} for how nodes are inserted into the tree
40
+ * @see {@link Node} for the node data structure used in the tree
41
+ * @see {@link getFromDatabaseWithTypeOld} for database retrieval implementation
42
+ */
1
43
  export declare function CreateCharacterBinaryTreeFromData(): Promise<void>;
@@ -1,5 +1,211 @@
1
+ /**
2
+ * Typed Connection Creation Between Concepts
3
+ *
4
+ * This module provides specialized functions for creating semantic, bidirectional, and
5
+ * counted connections between concepts. It implements a sophisticated connection naming
6
+ * scheme that incorporates concept types and relationship semantics, enabling queries
7
+ * like "show all books_s_authored_s_by author" in the system.
8
+ *
9
+ * The module supports:
10
+ * - Forward and backward (bidirectional) connections
11
+ * - Automatic relationship counting
12
+ * - Type-aware connection naming patterns
13
+ *
14
+ * @module CreateConnectionBetweenTwoConcepts
15
+ */
1
16
  import { Concept } from "../DataStructures/Concept";
2
17
  import { Connection } from "../DataStructures/Connection";
18
+ /**
19
+ * Creates a typed connection between two concepts with optional bidirectionality and counting.
20
+ *
21
+ * This function establishes semantic connections using a naming pattern that includes the
22
+ * concept types. For example, connecting a "book" to an "author" with linker "authored"
23
+ * creates a connection of type "books_s_authored_s". This enables type-aware querying and
24
+ * relationship navigation in the system.
25
+ *
26
+ * The function can optionally create bidirectional connections (both directions) and
27
+ * maintain relationship counts, which is useful for analytics and relationship tracking.
28
+ *
29
+ * @param ofTheConcept - The source concept from which the connection originates
30
+ * @param toTheConcept - The target concept to which the connection points
31
+ * @param linker - The semantic relationship name (e.g., "authored", "contains", "belongs_to")
32
+ * @param both - If true, creates connections in both directions (default: false)
33
+ * @param count - If true, maintains a count of relationships for this linker type (default: false)
34
+ *
35
+ * @returns A promise that resolves to the created forward Connection object
36
+ *
37
+ * @example
38
+ * ```typescript
39
+ * // Create a one-way "authored" connection
40
+ * const authorConcept = await GetTheConcept(123); // type: "author"
41
+ * const bookConcept = await GetTheConcept(456); // type: "book"
42
+ *
43
+ * const connection = await CreateConnectionBetweenTwoConcepts(
44
+ * authorConcept,
45
+ * bookConcept,
46
+ * "authored",
47
+ * false,
48
+ * false
49
+ * );
50
+ * // Creates connection type: "authors_s_authored_s"
51
+ * ```
52
+ *
53
+ * @example
54
+ * ```typescript
55
+ * // Create bidirectional "friends_with" connections with counting
56
+ * const userConcept1 = await GetTheConcept(789);
57
+ * const userConcept2 = await GetTheConcept(101);
58
+ *
59
+ * await CreateConnectionBetweenTwoConcepts(
60
+ * userConcept1,
61
+ * userConcept2,
62
+ * "friends_with",
63
+ * true, // Create both directions
64
+ * true // Enable counting
65
+ * );
66
+ * // Creates: "users_s_friends_with_s" and "users_s_friends_with_by"
67
+ * // Maintains count concepts for relationship tracking
68
+ * ```
69
+ *
70
+ * @remarks
71
+ * - Forward connection type pattern: `{sourceType}_s_{linker}_s`
72
+ * - Backward connection type pattern: `{targetType}_s_{linker}_by`
73
+ * - Count concept pattern: `{type}_s_{linker}_count`
74
+ * - Uses session information ID 999 and access level 4 as defaults
75
+ * - Counting creates/updates a separate count concept for relationship analytics
76
+ * - The backward connection is created first if both=true
77
+ *
78
+ * @see {@link CreateConnectionBetweenTwoConceptsGeneral} for the version using reserved IDs
79
+ * @see {@link CountRelationship} for understanding how relationship counting works
80
+ * @see {@link MakeTheInstanceConcept} for connection type concept creation
81
+ */
3
82
  export declare function CreateConnectionBetweenTwoConcepts(ofTheConcept: Concept, toTheConcept: Concept, linker: string, both?: boolean, count?: boolean): Promise<Connection>;
83
+ /**
84
+ * Maintains a count of relationships for a specific connection type on a concept.
85
+ *
86
+ * This function implements a counting mechanism that tracks how many times a particular
87
+ * relationship type has been used with a concept. It retrieves any existing count,
88
+ * increments it, creates a new count concept, and connects it to the source concept.
89
+ *
90
+ * The counting system works by:
91
+ * 1. Looking for existing count connections using a special count connection type
92
+ * 2. Retrieving the current count value from the connected count concept
93
+ * 3. Incrementing the count
94
+ * 4. Deleting old count connections
95
+ * 5. Creating a new count concept with the updated value
96
+ * 6. Connecting the new count concept back to the source
97
+ *
98
+ * This enables analytics like "how many books has this author authored?" or
99
+ * "how many followers does this user have?"
100
+ *
101
+ * @param linker - The relationship name being counted (e.g., "authored_s", "follows_s")
102
+ * @param concept - The concept for which relationships are being counted
103
+ * @param passedUserId - Optional user ID to use instead of the concept's userId (default: null, uses concept.userId)
104
+ *
105
+ * @returns A promise that resolves when the count has been updated
106
+ *
107
+ * @example
108
+ * ```typescript
109
+ * // Count how many times an author has "authored" something
110
+ * const authorConcept = await GetTheConcept(123);
111
+ * await CountRelationship("authored_s", authorConcept);
112
+ *
113
+ * // Later, retrieve the count
114
+ * const countConnectionType = await GetConceptByCharacter("authors_s_authored_s_count");
115
+ * const countConnections = await GetConnectionOfTheConcept(
116
+ * countConnectionType.id,
117
+ * authorConcept.id,
118
+ * authorConcept.userId
119
+ * );
120
+ * const countConcept = await GetTheConcept(countConnections[0].toTheConceptId);
121
+ * console.log("Author has written", countConcept.characterValue, "books");
122
+ * ```
123
+ *
124
+ * @example
125
+ * ```typescript
126
+ * // Count relationships with a specific user ID
127
+ * const userConcept = await GetTheConcept(456);
128
+ * await CountRelationship("follows_s", userConcept, 999);
129
+ * ```
130
+ *
131
+ * @remarks
132
+ * - Count connection type pattern: `{conceptType}_s_{linker}_count`
133
+ * - Creates a new "count" type concept with the numeric value as characterValue
134
+ * - Deletes all previous count connections before creating the new one
135
+ * - If no existing count is found, starts from 1
136
+ * - If parsing the count value fails, defaults to 0 and increments to 1
137
+ * - Uses session information ID 999, access level 4, and security ID 999
138
+ * - The count concept itself is of type "count"
139
+ *
140
+ * @see {@link CreateConnectionBetweenTwoConcepts} for functions that use counting
141
+ * @see {@link GetConnectionOfTheConcept} for retrieving count connections
142
+ * @see {@link MakeTheInstanceConcept} for creating count concepts
143
+ */
4
144
  export declare function CountRelationship(linker: string, concept: Concept, passedUserId?: number | null): Promise<void>;
145
+ /**
146
+ * Creates a typed connection with reserved IDs between two concepts.
147
+ *
148
+ * This is the production-ready version of CreateConnectionBetweenTwoConcepts that uses
149
+ * reserved IDs and the CreateTheConnectionGeneral function. It provides the same
150
+ * semantic connection naming and bidirectional support, but ensures connections are
151
+ * properly persisted with system-reserved IDs.
152
+ *
153
+ * Unlike the basic version, this function uses CreateTheConnectionGeneral instead of
154
+ * directly creating Connection objects, which means connections get proper ID reservation,
155
+ * update flags, and transaction tracking.
156
+ *
157
+ * @param ofTheConcept - The source concept from which the connection originates
158
+ * @param toTheConcept - The target concept to which the connection points
159
+ * @param linker - The semantic relationship name (e.g., "authored", "contains", "belongs_to")
160
+ * @param both - If true, creates connections in both directions (default: false)
161
+ * @param count - If true, maintains a count of relationships for this linker type (default: false)
162
+ *
163
+ * @returns A promise that resolves to the created forward Connection object with reserved ID
164
+ *
165
+ * @example
166
+ * ```typescript
167
+ * // Create a production-grade bidirectional "collaborates_with" connection
168
+ * const researcher1 = await GetTheConcept(123);
169
+ * const researcher2 = await GetTheConcept(456);
170
+ *
171
+ * const connection = await CreateConnectionBetweenTwoConceptsGeneral(
172
+ * researcher1,
173
+ * researcher2,
174
+ * "collaborates_with",
175
+ * true, // Bidirectional
176
+ * true // Track counts
177
+ * );
178
+ *
179
+ * console.log("Connection ID:", connection.id);
180
+ * // Both researchers now have collaboration connections and counts
181
+ * ```
182
+ *
183
+ * @example
184
+ * ```typescript
185
+ * // Create a one-way "belongs_to" connection with reserved ID
186
+ * const itemConcept = await GetTheConcept(789);
187
+ * const categoryConcept = await GetTheConcept(101);
188
+ *
189
+ * await CreateConnectionBetweenTwoConceptsGeneral(
190
+ * itemConcept,
191
+ * categoryConcept,
192
+ * "belongs_to",
193
+ * false,
194
+ * false
195
+ * );
196
+ * ```
197
+ *
198
+ * @remarks
199
+ * - Uses CreateTheConnectionGeneral for proper ID reservation and persistence
200
+ * - Forward connection type pattern: `{sourceType}_s_{linker}_s`
201
+ * - Backward connection type pattern: `{targetType}_s_{linker}_by`
202
+ * - Backward connections still use basic Connection creation (not CreateTheConnectionGeneral)
203
+ * - Uses session information ID 999, order 1000, and access level 4
204
+ * - Connection is marked for update (toUpdate = true) via CreateTheConnectionGeneral
205
+ * - Recommended for production use over CreateConnectionBetweenTwoConcepts
206
+ *
207
+ * @see {@link CreateConnectionBetweenTwoConcepts} for the temporary version
208
+ * @see {@link CreateTheConnectionGeneral} for the underlying connection creation
209
+ * @see {@link CountRelationship} for relationship counting implementation
210
+ */
5
211
  export declare function CreateConnectionBetweenTwoConceptsGeneral(ofTheConcept: Concept, toTheConcept: Concept, linker: string, both?: boolean, count?: boolean): Promise<Connection>;
@@ -1,3 +1,117 @@
1
+ /**
2
+ * Default Concept Factory
3
+ *
4
+ * This module provides utility functions for creating default/empty concept instances
5
+ * and formatting date values. These utilities are used throughout the system when
6
+ * initializing concepts or handling date operations.
7
+ *
8
+ * @module CreateDefaultConcept
9
+ */
1
10
  import { Concept } from "../DataStructures/Concept";
11
+ /**
12
+ * Creates a default concept with zero/empty values and current timestamps.
13
+ *
14
+ * This factory function is used throughout the system when a concept instance is needed
15
+ * but not yet populated with real data. It's particularly useful as a placeholder during
16
+ * concept retrieval operations, initialization, or when a null-safe concept object is required.
17
+ *
18
+ * The created concept has all numeric fields set to 0, characterValue set to "0",
19
+ * isComposition set to false, and timestamps set to the current date/time.
20
+ *
21
+ * @returns A new Concept instance with default values
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * // Use as a placeholder during concept retrieval
26
+ * let concept = CreateDefaultConcept();
27
+ *
28
+ * try {
29
+ * concept = await GetTheConcept(123);
30
+ * } catch (error) {
31
+ * console.log("Using default concept due to error");
32
+ * }
33
+ *
34
+ * if (concept.id === 0) {
35
+ * console.log("Concept not found, using default");
36
+ * }
37
+ * ```
38
+ *
39
+ * @example
40
+ * ```typescript
41
+ * // Initialize a concept variable before conditional assignment
42
+ * let resultConcept = CreateDefaultConcept();
43
+ *
44
+ * if (useCache) {
45
+ * resultConcept = await ConceptsData.GetConcept(id);
46
+ * } else {
47
+ * resultConcept = await GetConcept(id);
48
+ * }
49
+ * ```
50
+ *
51
+ * @remarks
52
+ * - All ID fields (id, typeId, userId, etc.) are set to 0
53
+ * - characterValue is set to "0" string
54
+ * - isComposition is set to false
55
+ * - created_on and updated_on are set to current date/time using formatDate()
56
+ * - The concept is not added to any data store; it's just an instance
57
+ * - Commonly used as a null-safe alternative when concept retrieval might fail
58
+ *
59
+ * @see {@link formatDate} for the date formatting function used
60
+ * @see {@link Concept} for the concept data structure
61
+ */
2
62
  export declare function CreateDefaultConcept(): Concept;
63
+ /**
64
+ * Formats a Date object into a human-readable string with 12-hour time format.
65
+ *
66
+ * This utility function converts JavaScript Date objects into a consistent string
67
+ * format used throughout the CCS system for timestamps. The format includes the date
68
+ * in MM/DD/YYYY format and time in 12-hour format with AM/PM indicator.
69
+ *
70
+ * The function is primarily used for setting created_on and updated_on timestamps
71
+ * on concepts and connections.
72
+ *
73
+ * @param date - The Date object to format
74
+ *
75
+ * @returns A formatted date string in the pattern "M/D/YYYY h:mm:ss AM/PM"
76
+ *
77
+ * @example
78
+ * ```typescript
79
+ * // Format current date
80
+ * const now = new Date();
81
+ * const formatted = formatDate(now);
82
+ * console.log(formatted); // "1/15/2024 3:45:30 PM"
83
+ * ```
84
+ *
85
+ * @example
86
+ * ```typescript
87
+ * // Use when creating a concept
88
+ * const concept = new Concept(
89
+ * 123,
90
+ * 456,
91
+ * 999,
92
+ * // ... other fields
93
+ * formatDate(new Date()), // created_on
94
+ * formatDate(new Date()) // updated_on
95
+ * );
96
+ * ```
97
+ *
98
+ * @example
99
+ * ```typescript
100
+ * // Format a specific date
101
+ * const specificDate = new Date(2024, 0, 15, 15, 30, 45);
102
+ * console.log(formatDate(specificDate)); // "1/15/2024 3:30:45 PM"
103
+ * ```
104
+ *
105
+ * @remarks
106
+ * - Months are 1-indexed in output (January = 1) but 0-indexed in JavaScript Date
107
+ * - Uses 12-hour time format with AM/PM
108
+ * - Minutes and seconds are zero-padded to 2 digits
109
+ * - Hours are NOT zero-padded (e.g., "3:05 PM" not "03:05 PM")
110
+ * - Date components are NOT zero-padded (e.g., "1/5/2024" not "01/05/2024")
111
+ * - Output format: "M/D/YYYY h:mm:ss AM/PM"
112
+ * - Midnight (00:00) is represented as "12:00 AM"
113
+ * - Noon (12:00) is represented as "12:00 PM"
114
+ *
115
+ * @see {@link CreateDefaultConcept} which uses this function for timestamps
116
+ */
3
117
  export declare function formatDate(date: Date): string;
@@ -1,2 +1,103 @@
1
+ /**
2
+ * Composition Creation Service
3
+ *
4
+ * This module provides functionality for converting JSON objects into interconnected
5
+ * concept structures (compositions) in the Concept Connection System. It recursively
6
+ * traverses JSON structures and creates corresponding concepts and connections,
7
+ * effectively serializing complex data structures into the graph database.
8
+ *
9
+ * This enables storing and retrieving structured data like user profiles, documents,
10
+ * or any hierarchical data within the CCS framework.
11
+ *
12
+ * @module CreateTheComposition
13
+ */
1
14
  import { Concept } from "../DataStructures/Concept";
15
+ /**
16
+ * Recursively converts a JSON object into a composition of interconnected concepts.
17
+ *
18
+ * This function is the core serialization mechanism for storing structured data in CCS.
19
+ * It traverses a JSON object recursively, creating concepts for each key-value pair and
20
+ * establishing connections between them to preserve the hierarchical structure.
21
+ *
22
+ * The function handles both object structures (which become nested compositions) and
23
+ * primitive values (which become leaf concepts with character values). The resulting
24
+ * structure can be later reconstructed using GetComposition functions.
25
+ *
26
+ * The recursion works as follows:
27
+ * - Object/nested structures: Create a concept for the key, recurse into the value
28
+ * - Primitive values (string/number): Create a concept with the key as type and value as characterValue
29
+ * - Root level: If no parent concept is provided, creates a new root concept
30
+ *
31
+ * @param json - The JSON object to convert into a composition
32
+ * @param ofTheConceptId - The ID of the parent concept to connect to (null for root level)
33
+ * @param ofTheConceptUserId - The user ID of the parent concept (null for root level)
34
+ * @param mainKey - The ID of the root concept, used as connection type throughout the composition
35
+ * @param userId - The user ID to assign to all created concepts (default: 999)
36
+ * @param accessId - The access level for created concepts (default: 4)
37
+ * @param sessionInformationId - The session ID for tracking this operation (default: 999)
38
+ *
39
+ * @returns A promise that resolves to the main (root) Concept of the created composition
40
+ *
41
+ * @example
42
+ * ```typescript
43
+ * // Create a user profile composition
44
+ * const userProfile = {
45
+ * name: "Alice Johnson",
46
+ * age: 30,
47
+ * address: {
48
+ * street: "123 Main St",
49
+ * city: "Springfield",
50
+ * country: "USA"
51
+ * },
52
+ * hobbies: ["reading", "hiking", "photography"]
53
+ * };
54
+ *
55
+ * const rootConcept = await CreateTheComposition(
56
+ * userProfile,
57
+ * null, // No parent, this is root
58
+ * null,
59
+ * null,
60
+ * 999, // User ID
61
+ * 4, // Access level
62
+ * 999 // Session ID
63
+ * );
64
+ *
65
+ * console.log("Profile composition created:", rootConcept.id);
66
+ * // Can later retrieve with: GetComposition(rootConcept.id)
67
+ * ```
68
+ *
69
+ * @example
70
+ * ```typescript
71
+ * // Add a nested composition to an existing concept
72
+ * const parentConcept = await GetTheConcept(456);
73
+ * const metadata = {
74
+ * created: "2024-01-15",
75
+ * modified: "2024-01-20",
76
+ * version: 2
77
+ * };
78
+ *
79
+ * const metadataConcept = await CreateTheComposition(
80
+ * metadata,
81
+ * parentConcept.id,
82
+ * parentConcept.userId,
83
+ * parentConcept.id, // Use parent as mainKey
84
+ * parentConcept.userId
85
+ * );
86
+ * ```
87
+ *
88
+ * @remarks
89
+ * - Creates concepts for each JSON key, using the key as the concept's type
90
+ * - Primitive values (strings, numbers) are stored as characterValue in leaf concepts
91
+ * - Nested objects and arrays are recursively converted into sub-compositions
92
+ * - All concepts are connected using the mainKey (root concept ID) as the connection type
93
+ * - Uses temporary connections (via createTheConnection) with random IDs
94
+ * - Default values: userId=999, accessId=4, sessionInformationId=999
95
+ * - The function modifies SyncData by adding all created concepts and connections
96
+ * - Complex objects become type concepts with isComposition=true
97
+ * - Primitive values become instance concepts with isComposition=false
98
+ *
99
+ * @see {@link GetComposition} for reconstructing compositions back to JSON
100
+ * @see {@link MakeTheInstanceConcept} for individual concept creation
101
+ * @see {@link createTheConnection} for connection creation logic
102
+ */
2
103
  export default function CreateTheComposition(json: any, ofTheConceptId?: number | null, ofTheConceptUserId?: number | null, mainKey?: number | null, userId?: number | null, accessId?: number | null, sessionInformationId?: number | null): Promise<Concept>;