mftsccs-browser 2.2.20-beta → 2.2.22-beta

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 (117) hide show
  1. package/README.md +1073 -11
  2. package/dist/bundle.js +2 -0
  3. package/dist/bundle.js.LICENSE.txt +1 -0
  4. package/dist/main.bundle.js +1 -1
  5. package/dist/serviceWorker.bundle.js +1 -1
  6. package/dist/types/Api/Create/CreateTheCharacter.d.ts +21 -0
  7. package/dist/types/Api/Create/CreateTheConceptApi.d.ts +18 -0
  8. package/dist/types/Api/Create/CreateTheConnectionApi.d.ts +16 -0
  9. package/dist/types/Api/Create/CreateTheGhostConceptApi.d.ts +25 -0
  10. package/dist/types/Api/Create/CreateTheGhostConnectionApi.d.ts +16 -0
  11. package/dist/types/Api/Create/CreateTheTextData.d.ts +16 -0
  12. package/dist/types/Api/Delete/DeleteConceptInBackend.d.ts +13 -0
  13. package/dist/types/Api/Delete/DeleteUserInBackend.d.ts +18 -0
  14. package/dist/types/Api/DeleteConnectionApiBulk.d.ts +1 -0
  15. package/dist/types/Api/DeleteConnectionBulkApi.d.ts +19 -0
  16. package/dist/types/Api/DeleteTheConcept.d.ts +19 -0
  17. package/dist/types/Api/DeleteTheConnection.d.ts +19 -0
  18. package/dist/types/Api/GetAiData.d.ts +9 -0
  19. package/dist/types/Api/GetAllConcepts.d.ts +10 -0
  20. package/dist/types/Api/GetAllConceptsByType.d.ts +11 -0
  21. package/dist/types/Api/GetAllConnections.d.ts +10 -0
  22. package/dist/types/Api/GetAllConnectionsOfComposition.d.ts +20 -0
  23. package/dist/types/Api/GetAllConnectionsOfCompositionBulk.d.ts +20 -0
  24. package/dist/types/Api/GetAllLinkerConnectionsFromTheConcept.d.ts +10 -0
  25. package/dist/types/Api/GetAllLinkerConnectionsToTheConcept.d.ts +10 -0
  26. package/dist/types/Api/GetAllPrefetchConnections.d.ts +11 -0
  27. package/dist/types/Api/GetCharacterDataByCharacter.d.ts +10 -0
  28. package/dist/types/Api/GetCompositionConnectionsBetweenTwoConcepts.d.ts +12 -0
  29. package/dist/types/Api/GetConceptBulk.d.ts +10 -0
  30. package/dist/types/Api/GetConceptByCharacterAndType.d.ts +14 -0
  31. package/dist/types/Api/GetConceptByCharacterValue.d.ts +10 -0
  32. package/dist/types/Api/GetConnection.d.ts +13 -0
  33. package/dist/types/Api/GetConnectionOfTheConcept.d.ts +14 -0
  34. package/dist/types/Api/GetConnectionToTheConcept.d.ts +15 -0
  35. package/dist/types/Api/GetConnections/GetConnectionsByTypeApi.d.ts +12 -0
  36. package/dist/types/Api/GetReservedConnectionIds.d.ts +9 -0
  37. package/dist/types/Api/GetReservedIds.d.ts +9 -0
  38. package/dist/types/Api/Images/GetImages.d.ts +14 -0
  39. package/dist/types/Api/Local/GetLocalConceptByCharacterValue.d.ts +11 -0
  40. package/dist/types/Api/Login.d.ts +77 -0
  41. package/dist/types/Api/MakeTheNameInBackend.d.ts +13 -0
  42. package/dist/types/Api/Prototype/CreatePrototype.d.ts +12 -0
  43. package/dist/types/Api/Prototype/Selector.d.ts +11 -0
  44. package/dist/types/Api/RecursiveSearch.d.ts +61 -0
  45. package/dist/types/Api/Search/FreeschemaQueryApi.d.ts +16 -0
  46. package/dist/types/Api/Search/Search.d.ts +72 -0
  47. package/dist/types/Api/Search/SearchInternalApi.d.ts +25 -0
  48. package/dist/types/Api/Search/SearchLinkMultipleApi.d.ts +13 -0
  49. package/dist/types/Api/Search/SearchWithLinker.d.ts +14 -0
  50. package/dist/types/Api/Search/SearchWithTypeAndLinker.d.ts +12 -0
  51. package/dist/types/Api/SearchConcept/GetConceptByCharacterAndCategoryApi.d.ts +10 -0
  52. package/dist/types/Api/SearchConcept/GetConceptByCharacterAndCategoryDirect.d.ts +11 -0
  53. package/dist/types/Api/SearchConcept/GetTypeConceptByBulk.d.ts +13 -0
  54. package/dist/types/Api/Session/CreateSession.d.ts +14 -0
  55. package/dist/types/Api/Session/CreateSessionVisit.d.ts +11 -0
  56. package/dist/types/Api/Signin.d.ts +21 -0
  57. package/dist/types/Api/Signup.d.ts +53 -11
  58. package/dist/types/Api/Translate/TranslateLocalToReal.d.ts +10 -0
  59. package/dist/types/Api/View/ViewInternalDataApi.d.ts +14 -0
  60. package/dist/types/DataStructures/BaseUrl.d.ts +1 -0
  61. package/dist/types/DataStructures/Transaction/Transaction.d.ts +30 -0
  62. package/dist/types/Services/AccessControl/AccessControlCacheService.d.ts +19 -0
  63. package/dist/types/Services/AccessControl/AccessControlService.d.ts +267 -0
  64. package/dist/types/Services/AccessControl/PermissionSet.d.ts +8 -0
  65. package/dist/types/Services/CreateTheConcept.d.ts +118 -0
  66. package/dist/types/Services/CreateTheConnection.d.ts +59 -6
  67. package/dist/types/Services/Delete/DeleteConnectionByType.d.ts +13 -0
  68. package/dist/types/Services/Delete/GetAllConnectionByType.d.ts +16 -0
  69. package/dist/types/Services/GetComposition.d.ts +64 -7
  70. package/dist/types/Services/GetTheConcept.d.ts +91 -4
  71. package/dist/types/Services/Local/ConvertFromLConceptToConcept.d.ts +39 -0
  72. package/dist/types/Services/Local/ConvertFromLConnectionToConnection.d.ts +45 -0
  73. package/dist/types/Services/Local/CreateConnectionBetweenTwoConceptsLocal.d.ts +41 -0
  74. package/dist/types/Services/Local/CreateDefaultLConcept.d.ts +44 -0
  75. package/dist/types/Services/Local/CreateLocalBinaryTreeFromData.d.ts +6 -1
  76. package/dist/types/Services/Local/CreateLocalBinaryTypeTreeFromData.d.ts +8 -0
  77. package/dist/types/Services/Local/CreateLocalCharacterBinaryTree.d.ts +8 -0
  78. package/dist/types/Services/Local/CreateTheCompositionLocal.d.ts +100 -10
  79. package/dist/types/Services/Local/CreateTheConceptLocal.d.ts +80 -18
  80. package/dist/types/Services/Local/CreateTheConnectionLocal.d.ts +135 -11
  81. package/dist/types/Services/Local/DeleteConceptLocal.d.ts +46 -0
  82. package/dist/types/Services/Local/GetCompositionListLocal.d.ts +31 -8
  83. package/dist/types/Services/Local/GetCompositionLocal.d.ts +95 -0
  84. package/dist/types/Services/Local/GetConceptByCharacterLocal.d.ts +48 -2
  85. package/dist/types/Services/Local/GetConnectionOfTheConceptLocal.d.ts +17 -0
  86. package/dist/types/Services/Local/GetRelationLocal.d.ts +20 -0
  87. package/dist/types/Services/Local/GetTheConceptLocal.d.ts +60 -6
  88. package/dist/types/Services/Local/MakeTheConceptLocal.d.ts +20 -0
  89. package/dist/types/Services/Local/MakeTheInstanceConceptLocal.d.ts +160 -14
  90. package/dist/types/Services/Local/MakeTheTypeLocal.d.ts +29 -9
  91. package/dist/types/Services/Local/UpdateCompositionLocal.d.ts +39 -0
  92. package/dist/types/Services/MakeTheLocalConcept.d.ts +0 -0
  93. package/dist/types/Services/MakeTheName.d.ts +2 -0
  94. package/dist/types/Services/auth/AuthService.d.ts +1 -0
  95. package/dist/types/Widgets/BaseObserver.d.ts +14 -11
  96. package/dist/types/Widgets/BaseWidget.d.ts +24 -11
  97. package/dist/types/Widgets/BuilderSpeceficFunctions.d.ts +9 -0
  98. package/dist/types/Widgets/BuilderStatefulWidget.d.ts +352 -2
  99. package/dist/types/Widgets/CacheWidget.service.d.ts +60 -0
  100. package/dist/types/Widgets/NormalizeStyles.service.d.ts +9 -0
  101. package/dist/types/Widgets/RenderPage.service.d.ts +9 -4
  102. package/dist/types/Widgets/RenderWidgetLibrary.service.d.ts +12 -4
  103. package/dist/types/Widgets/RenderWidgetService.d.ts +158 -21
  104. package/dist/types/Widgets/StatefulWidget.d.ts +94 -29
  105. package/dist/types/Widgets/WidgetBuild.d.ts +41 -0
  106. package/dist/types/Widgets/WidgetTree.d.ts +31 -0
  107. package/dist/types/Widgets/mainView.class.d.ts +21 -0
  108. package/dist/types/WrapperFunctions/DepenedencyObserver.d.ts +48 -27
  109. package/dist/types/WrapperFunctions/GetCompositionListObservable.d.ts +34 -2
  110. package/dist/types/WrapperFunctions/GetCompositionObservable.d.ts +24 -2
  111. package/dist/types/WrapperFunctions/GetLinkListObservable.d.ts +38 -9
  112. package/dist/types/WrapperFunctions/GetLinkObservable.d.ts +30 -12
  113. package/dist/types/WrapperFunctions/RecursiveSearchObservable.d.ts +34 -16
  114. package/dist/types/WrapperFunctions/SchemaQueryObservable.d.ts +41 -5
  115. package/dist/types/WrapperFunctions/SearchLinkMultipleAllObservable.d.ts +24 -3
  116. package/dist/types/app.d.ts +183 -12
  117. package/package.json +1 -1
@@ -0,0 +1,267 @@
1
+ import { PermissionSet } from "./PermissionSet";
2
+ export declare class AccessControlService {
3
+ private static accessCache;
4
+ private static baseUrl;
5
+ private static initialize;
6
+ /**
7
+ * Checks if a user or entity has the specified access for a single concept.
8
+ * @param userId - The user's ID.
9
+ * @param access - The required PermissionSet.
10
+ * @param conceptId - The concept ID to check.
11
+ * @param entityId - Optional entity ID (defaults to userId).
12
+ * @returns Promise<boolean> - True if access is granted, false otherwise.
13
+ */
14
+ static checkAccessOfConcept(userId: number, access: PermissionSet, conceptId: number, entityId?: number): Promise<boolean>;
15
+ /**
16
+ * Checks if a user or entity has the specified access for all concepts in a list.
17
+ * @param userId - The user's ID.
18
+ * @param access - The required PermissionSet.
19
+ * @param conceptIdList - Array of concept IDs to check.
20
+ * @param entityId - Optional entity ID (defaults to userId).
21
+ * @returns Promise<boolean> - True if access is granted for all, false otherwise.
22
+ */
23
+ static checkAccessOfConceptList(userId: number, access: PermissionSet, conceptIdList: number[], entityId?: number): Promise<boolean>;
24
+ /**
25
+ * Filters a list of concept IDs, returning only those for which the user or entity has the specified access.
26
+ * @param userId - The user's ID.
27
+ * @param access - The required PermissionSet.
28
+ * @param conceptIdList - Array of concept IDs to filter.
29
+ * @param entityId - Optional entity ID (defaults to userId).
30
+ * @returns Promise<number[]> - Array of concept IDs with access.
31
+ */
32
+ static filterConceptListByAccess(userId: number, access: PermissionSet, conceptIdList: number[], entityId?: number): Promise<number[]>;
33
+ /**
34
+ * Gets the entity ID for a given user ID.
35
+ * @param userId - The user's ID.
36
+ * @returns number - The entity ID (default: userId).
37
+ */
38
+ private static getEntityIdConceptByUserId;
39
+ /**
40
+ * Assigns access to a specific entity for a concept.
41
+ * @param request - Object containing conceptId, access, entityId, makePublic.
42
+ * @returns Promise<any> - API response.
43
+ */
44
+ static assignAccessToEntity(request: {
45
+ conceptId: number;
46
+ access: string;
47
+ entityId: number;
48
+ makePublic: boolean;
49
+ }): Promise<any>;
50
+ /**
51
+ * Assigns public access to a concept or list of concepts.
52
+ * @param request - Object containing conceptId, accessList, connectionTypeList, nestedAccessLevel, conceptIdList.
53
+ * @returns Promise<any> - API response.
54
+ */
55
+ static assignPublicAccess(request: {
56
+ conceptId: number;
57
+ accessList: string[];
58
+ connectionTypeList?: string[];
59
+ nestedAccessLevel?: number;
60
+ conceptIdList?: number[];
61
+ }): Promise<any>;
62
+ /**
63
+ * Assigns public access to multiple concepts in bulk.
64
+ * @param request - Object containing conceptIdList, accessList, connectionTypeList, nestedAccessLevel, conceptId.
65
+ * @returns Promise<any> - API response.
66
+ */
67
+ static assignPublicAccessBlukConcept(request: {
68
+ conceptIdList: number[];
69
+ accessList: string[];
70
+ connectionTypeList?: string[];
71
+ nestedAccessLevel?: number;
72
+ conceptId?: number;
73
+ }): Promise<any>;
74
+ /**
75
+ * Assigns access to multiple entities and concepts in bulk.
76
+ * @param request - Object containing conceptId, conceptIdList, entityIdList, accessList, connectionTypeList, nestedAccessLevel.
77
+ * @returns Promise<any> - API response.
78
+ */
79
+ static assignAccessToEntityBulk(request: {
80
+ conceptId: number;
81
+ conceptIdList?: number[];
82
+ entityIdList: number[];
83
+ accessList: string[];
84
+ connectionTypeList?: string[];
85
+ nestedAccessLevel?: number;
86
+ }): Promise<any>;
87
+ /**
88
+ * Assigns access to a user for a concept.
89
+ * @param request - Object containing conceptId, access, userId, makePublic.
90
+ * @returns Promise<any> - API response.
91
+ */
92
+ static assignAccessByUser(request: {
93
+ conceptId: number;
94
+ access: string;
95
+ userId: number;
96
+ makePublic: boolean;
97
+ }): Promise<any>;
98
+ /**
99
+ * Revokes access for an entity from a concept.
100
+ * @param params - Object containing conceptId, access, entityId.
101
+ * @returns Promise<any> - API response.
102
+ */
103
+ static revokeAccess(params: {
104
+ conceptId: number;
105
+ access: string;
106
+ entityId: number;
107
+ }): Promise<any>;
108
+ /**
109
+ * Revokes access for multiple entities in bulk.
110
+ * @param request - Object containing conceptId, entityIdList, accessList.
111
+ * @returns Promise<any> - API response.
112
+ */
113
+ static revokeAccessBulk(request: {
114
+ conceptId: number;
115
+ entityIdList: number[];
116
+ accessList: string[];
117
+ }): Promise<any>;
118
+ /**
119
+ * Gets the access list for a concept and user.
120
+ * @param conceptId - The concept ID.
121
+ * @param userId - The user ID.
122
+ * @returns Promise<any> - API response.
123
+ */
124
+ static getAccessList(conceptId: number, userId: number): Promise<any>;
125
+ /**
126
+ * Gets the public access list for a list of concept IDs.
127
+ * @param conceptIdList - Array of concept IDs.
128
+ * @returns Promise<any> - API response.
129
+ */
130
+ static getPublicAccessList(conceptIdList: number[]): Promise<any>;
131
+ /**
132
+ * Revokes public access for a concept.
133
+ * @param request - Object containing conceptId, accessList.
134
+ * @returns Promise<any> - API response.
135
+ */
136
+ static revokePublicAccess(request: {
137
+ conceptId: number;
138
+ accessList: string[];
139
+ }): Promise<any>;
140
+ /**
141
+ * Checks if an entity has a specific permission for a concept.
142
+ * @param params - Object containing conceptId, permission, entityId.
143
+ * @returns Promise<any> - API response.
144
+ */
145
+ static checkAccess(params: {
146
+ conceptId: number;
147
+ permission: string;
148
+ entityId: number;
149
+ }): Promise<any>;
150
+ /**
151
+ * Checks if a user has a specific access for a concept.
152
+ * @param request - Object containing conceptId, access, userId.
153
+ * @returns Promise<any> - API response.
154
+ */
155
+ static checkAccessByUser(request: {
156
+ conceptId: number;
157
+ access: string;
158
+ userId: number;
159
+ }): Promise<any>;
160
+ /**
161
+ * Filters concepts by access for a user.
162
+ * @param request - Object containing userId, access, conceptIdList, connectionIdList.
163
+ * @returns Promise<any> - API response.
164
+ */
165
+ static filterConceptsByAccess(request: {
166
+ userId: number;
167
+ access: string;
168
+ conceptIdList?: number[];
169
+ connectionIdList?: number[];
170
+ }): Promise<any>;
171
+ /**
172
+ * Checks access for a user on multiple concepts in bulk.
173
+ * @param request - Object containing userId, access, conceptIdList.
174
+ * @returns Promise<any> - API response.
175
+ */
176
+ static checkAccessOfConceptBulk(request: {
177
+ userId: number;
178
+ access: string;
179
+ conceptIdList: number[];
180
+ }): Promise<any>;
181
+ /**
182
+ * Gets entities with a specific access for a concept.
183
+ * @param conceptId - The concept ID.
184
+ * @param access - The access type.
185
+ * @returns Promise<any> - API response.
186
+ */
187
+ static getEntitiesByAccess(conceptId: number, access: string): Promise<any>;
188
+ /**
189
+ * Gets all entities with any access for a concept.
190
+ * @param conceptId - The concept ID.
191
+ * @returns Promise<any> - API response.
192
+ */
193
+ static getEntitiesWithAccess(conceptId: number): Promise<any>;
194
+ /**
195
+ * Gets access groups by entity.
196
+ * @param entityId - Optional entity ID.
197
+ * @returns Promise<any> - API response.
198
+ */
199
+ static getAccessGroupByEntity(entityId?: number): Promise<any>;
200
+ /**
201
+ * Gets access groups by user.
202
+ * @param userId - Optional user ID.
203
+ * @returns Promise<any> - API response.
204
+ */
205
+ static getAccessGroupByUser(userId?: number): Promise<any>;
206
+ /**
207
+ * Gets public access by access IDs.
208
+ * @param accessIdList - Array of access IDs.
209
+ * @returns Promise<any> - API response.
210
+ */
211
+ static getPublicAccessByAccessIds(accessIdList: number[]): Promise<any>;
212
+ /**
213
+ * Gets the full access mapping for public users.
214
+ * @returns Promise<any> - API response.
215
+ */
216
+ static getFullAccessMappingForPublic(): Promise<any>;
217
+ /**
218
+ * Assigns public access for all users.
219
+ * @returns Promise<any> - API response.
220
+ */
221
+ static assignPublicAccessForAllUser(): Promise<any>;
222
+ /**
223
+ * Assigns access by connection type for users.
224
+ * @returns Promise<any> - API response.
225
+ */
226
+ static assignAccessByConncetionTypeOfUser(): Promise<any>;
227
+ /**
228
+ * Sets access inheritance for a concept.
229
+ * @param request - Object containing mainConceptId, enable, connectionTypeId.
230
+ * @returns Promise<any> - API response.
231
+ */
232
+ static setAccessInheritance(request: {
233
+ mainConceptId: number;
234
+ enable: boolean;
235
+ connectionTypeId?: number;
236
+ }): Promise<any>;
237
+ /**
238
+ * Gets the status of access inheritance for a concept.
239
+ * @param mainConceptId - The main concept ID.
240
+ * @param connectionTypeId - The connection type ID (default: 999).
241
+ * @returns Promise<any> - API response.
242
+ */
243
+ static getAccessInheritanceStatus(mainConceptId: number, connectionTypeId?: number): Promise<any>;
244
+ /**
245
+ * Performs a GET request to the backend API.
246
+ * @param path - The API path.
247
+ * @param errorMsg - Error message to throw if request fails.
248
+ * @returns Promise<any> - API response.
249
+ */
250
+ private static _get;
251
+ /**
252
+ * Performs a POST request to the backend API.
253
+ * @param path - The API path.
254
+ * @param body - Request body.
255
+ * @param errorMsg - Error message to throw if request fails.
256
+ * @returns Promise<any> - API response.
257
+ */
258
+ private static _post;
259
+ /**
260
+ * Performs a DELETE request to the backend API.
261
+ * @param path - The API path.
262
+ * @param body - Optional request body.
263
+ * @param errorMsg - Error message to throw if request fails.
264
+ * @returns Promise<any> - API response.
265
+ */
266
+ private static _delete;
267
+ }
@@ -0,0 +1,8 @@
1
+ export declare enum PermissionSet {
2
+ None = 0,
3
+ Read = 1,
4
+ Write = 2,
5
+ Execute = 4,
6
+ Delete = 8
7
+ }
8
+ export declare function getPermissionSetFromStrings(permissions: string[]): PermissionSet;
@@ -1,4 +1,122 @@
1
1
  import { Concept } from "../DataStructures/Concept";
2
+ /**
3
+ * Creates a new concept and adds it to the sync queue for backend synchronization.
4
+ *
5
+ * This is the primary function for creating concepts in the system. The concept is:
6
+ * - Assigned a unique ID from the reserved ID pool
7
+ * - Marked as non-temporary (persisted)
8
+ * - Added to the SyncData queue for automatic backend synchronization
9
+ * - Cached locally in IndexedDB for offline access
10
+ *
11
+ * @param {string} referent - The character value (text/name) of the concept. This is the human-readable
12
+ * representation of the concept (e.g., "John Doe", "Project Alpha")
13
+ * @param {number} userId - The ID of the user creating this concept. Used for ownership and access control.
14
+ * @param {number} categoryId - The category classification ID. Used for further classification within a type
15
+ * (e.g., for TYPE_PERSON: 1=Employee, 2=Contractor, 3=Customer)
16
+ * @param {number} typeId - The type classification ID. Defines what kind of concept this is
17
+ * (e.g., 1=Person, 2=Organization, 3=Document)
18
+ * @param {number} referentId - Optional reference to another concept ID. Used for creating instances
19
+ * that reference a type concept. Can be 0 or null if not applicable.
20
+ * @param {number} accessId - Access control level for the concept. Determines who can view/edit
21
+ * (e.g., 1=Public, 2=Private, 3=Shared, 4=Admin)
22
+ * @param {string} typeCharacter - The string representation of the type name (e.g., "Person", "Document").
23
+ * Used for display and filtering purposes.
24
+ *
25
+ * @returns {Promise<Concept>} A promise that resolves to the newly created Concept object with all properties set.
26
+ *
27
+ * @example
28
+ * // Create a person concept
29
+ * const person = await CreateTheConcept(
30
+ * "Alice Smith", // name
31
+ * 101, // userId
32
+ * 1, // categoryId (Employee)
33
+ * 1, // typeId (Person)
34
+ * 0, // referentId (none)
35
+ * 2, // accessId (Private)
36
+ * "Person" // typeCharacter
37
+ * );
38
+ * console.log(person.id); // 12345
39
+ *
40
+ * @see {@link CreateTheConceptTemporary} for creating non-persisted temporary concepts
41
+ * @see {@link CreateTheConceptImmediate} for creating concepts with immediate backend sync
42
+ */
2
43
  export default function CreateTheConcept(referent: string, userId: number, categoryId: number, typeId: number, referentId: number, accessId: number, typeCharacter: string): Promise<Concept>;
44
+ /**
45
+ * Creates a temporary concept that is NOT persisted to the database or synced to the backend.
46
+ *
47
+ * Use this function when you need a transient concept that exists only in memory during the
48
+ * current session. Temporary concepts are useful for:
49
+ * - UI state management
50
+ * - Draft content before finalization
51
+ * - Calculations or intermediate results
52
+ * - Testing without affecting the database
53
+ *
54
+ * Temporary concepts are marked with `isTemp = true` and will not be saved when the application
55
+ * closes or refreshes. They are NOT added to the SyncData queue.
56
+ *
57
+ * @param referent - The character value (text/name) of the concept
58
+ * @param userId - The ID of the user creating this concept
59
+ * @param categoryId - The category classification ID
60
+ * @param typeId - The type classification ID
61
+ * @param referentId - Optional reference to another concept ID
62
+ * @param accessId - Access control level for the concept
63
+ * @param typeCharacter - The string representation of the type name
64
+ *
65
+ * @returns Promise resolving to the temporary Concept object
66
+ *
67
+ * @example
68
+ * // Create a temporary draft note
69
+ * const draftNote = await CreateTheConceptTemporary(
70
+ * "Draft: Meeting Notes",
71
+ * 101,
72
+ * 1,
73
+ * 3, // Document type
74
+ * 0,
75
+ * 2,
76
+ * "Document"
77
+ * );
78
+ * console.log(draftNote.isTemp); // true
79
+ *
80
+ * @see {@link CreateTheConcept} for creating persistent concepts
81
+ */
3
82
  export declare function CreateTheConceptTemporary(referent: string, userId: number, categoryId: number, typeId: number, referentId: number, accessId: number, typeCharacter: string): Promise<Concept>;
83
+ /**
84
+ * Creates a concept and immediately sends it to the backend API, bypassing the sync queue.
85
+ *
86
+ * This function is useful when you need guaranteed immediate synchronization to the backend,
87
+ * such as for critical operations that must be persisted right away. Unlike the standard
88
+ * CreateTheConcept, this function:
89
+ * - Calls the backend API directly (CreateTheConceptApi)
90
+ * - Does NOT use the SyncData queue (bypasses batch synchronization)
91
+ * - Adds the concept to local ConceptsData immediately
92
+ * - Marks the concept as NOT new (isNew = false)
93
+ *
94
+ * Use this for time-sensitive operations where you cannot wait for the next sync cycle.
95
+ *
96
+ * @param referent - The character value (text/name) of the concept
97
+ * @param userId - The ID of the user creating this concept
98
+ * @param categoryId - The category classification ID
99
+ * @param typeId - The type classification ID
100
+ * @param referentId - Optional reference to another concept ID (can be null)
101
+ * @param accessId - Access control level for the concept
102
+ * @param typeCharacter - The string representation of the type name
103
+ *
104
+ * @returns Promise resolving to the created Concept object
105
+ *
106
+ * @example
107
+ * // Create a critical log entry that must be saved immediately
108
+ * const logEntry = await CreateTheConceptImmediate(
109
+ * "Critical Error: System Failure",
110
+ * 101,
111
+ * 5, // Log category
112
+ * 7, // Log type
113
+ * null,
114
+ * 1, // Public access
115
+ * "LogEntry"
116
+ * );
117
+ * // Concept is immediately sent to backend
118
+ *
119
+ * @see {@link CreateTheConcept} for standard queued creation
120
+ * @see {@link CreateTheConceptApi} for the backend API call
121
+ */
4
122
  export declare function CreateTheConceptImmediate(referent: string, userId: number, categoryId: number, typeId: number, referentId: number | null, accessId: number, typeCharacter: string): Promise<Concept>;
@@ -1,10 +1,63 @@
1
1
  import { Connection } from "../DataStructures/Connection";
2
2
  /**
3
- * This function is used to create a connection that is internal(inside of a composition)
4
- * @param ofTheConceptId Start of the connection
5
- * @param userId user id fo the user creating the connection
6
- * @param toTheConceptId the end of the connection
7
- * @param typeId this is the type of the connection
8
- * @returns
3
+ * Creates a connection (relationship) between two concepts and adds it to the sync queue.
4
+ *
5
+ * This is the primary function for establishing relationships in the knowledge graph.
6
+ * Connections are directed edges that link two concepts together, representing relationships
7
+ * like "works at", "belongs to", "authored by", etc.
8
+ *
9
+ * **Connection Structure:**
10
+ * - FROM concept (ofTheConceptId) → TO concept (toTheConceptId)
11
+ * - The relationship is directional
12
+ * - Type ID classifies what kind of relationship it is
13
+ * - Order ID allows sorting when multiple connections of the same type exist
14
+ *
15
+ * **Important Behaviors:**
16
+ * - Connections are marked as temporary (isTemp = true) for internal compositions
17
+ * - Added to SyncData queue for backend synchronization
18
+ * - Assigned a random temporary ID until persisted
19
+ * - Self-connections (same from/to) are prevented (returns invalid connection)
20
+ * - Default access level is 4 (typically means "admin" or "restricted")
21
+ *
22
+ * @param ofTheConceptId - The source concept ID (start of the relationship).
23
+ * This is where the connection originates FROM.
24
+ * @param userId - The ID of the user creating this connection. Used for ownership and permissions.
25
+ * @param toTheConceptId - The target concept ID (end of the relationship).
26
+ * This is where the connection points TO.
27
+ * @param typeId - The type classification for this connection. Defines the nature of the relationship.
28
+ * (e.g., 5="works_at", 6="manages", 7="member_of")
29
+ *
30
+ * @returns The created Connection object with all properties set, including a temporary ID
31
+ *
32
+ * @example
33
+ * // Create a "works at" relationship
34
+ * const connection = createTheConnection(
35
+ * aliceId, // Alice (person)
36
+ * 101, // user creating this
37
+ * companyId, // Tech Corp (organization)
38
+ * 5 // "works at" connection type
39
+ * );
40
+ * // Result: Alice → works_at → Tech Corp
41
+ *
42
+ * @example
43
+ * // Create a hierarchical relationship
44
+ * const managerConnection = createTheConnection(
45
+ * managerId, // Manager concept
46
+ * 101, // user
47
+ * employeeId, // Employee concept
48
+ * 6 // "manages" connection type
49
+ * );
50
+ * // Result: Manager → manages → Employee
51
+ *
52
+ * @example
53
+ * // Attempting self-connection (will return invalid connection)
54
+ * const selfConn = createTheConnection(123, 101, 123, 5);
55
+ * console.log(selfConn.ofTheConceptId); // 0 (invalid)
56
+ * console.log(selfConn.toTheConceptId); // 1 (invalid)
57
+ *
58
+ * @throws Errors are caught and logged via HandleInternalError but don't prevent return
59
+ *
60
+ * @see {@link CreateTheConnectionGeneral} for alternative connection creation
61
+ * @see {@link CreateTheConnectionApi} for direct backend API connection creation
9
62
  */
10
63
  export declare function createTheConnection(ofTheConceptId: number, userId: number, toTheConceptId: number, typeId: number): Connection;
@@ -0,0 +1,13 @@
1
+ /**
2
+ *
3
+ * @param id the id of the concept whose connection needs to be returned
4
+ * @param linkers the connection types whose connection id need to be found
5
+ */
6
+ export declare function DeleteConnectionByTypeBulk(id: number, linkers: string[]): Promise<boolean>;
7
+ /**
8
+ *
9
+ * @param id the id of the concept whose connection needs to be returned
10
+ * @param linkers the connection types whose connection id need to be found
11
+ * @returns list of ids of the connection
12
+ */
13
+ export declare function GetConnectionByTypeBulk(id: number, linkers: string[]): Promise<number[]>;
@@ -0,0 +1,16 @@
1
+ import { Connection } from "../../app";
2
+ /**
3
+ * This function returns all the connections from the ofTheConceptId and connection type
4
+ * @param id ofTheConceptId
5
+ * @param linker the connection type
6
+ * @param reverse if you put in reverse true then the reverse connections are returned.
7
+ * @returns Array of connections
8
+ */
9
+ export declare function GetAllTheConnectionsByTypeAndOfTheConcept(id: number, linker: string, reverse?: boolean): Promise<Connection[]>;
10
+ /**
11
+ * This function returns all the connections from the ofTheConceptId with toTheConceptId and linkers as given, the reverse is also true.
12
+ * @param id ofTheConceptId
13
+ * @param linker the connection type
14
+ * @returns Array of connections
15
+ */
16
+ export declare function GiveConnection(ofTheConceptId: number, toTheConceptId: number, linker: string, reverse?: boolean): Promise<Connection[]>;
@@ -32,13 +32,70 @@ export declare function RecursiveFetchBuildLayerDataId(id: number, connectionLis
32
32
  */
33
33
  export declare function RecursiveFetchBuildLayerNormal(id: number, connectionList: Connection[], compositionList: number[]): Promise<any>;
34
34
  /**
35
- * ## format JUSTDATA ##
36
- * this function builds the composition with the main id as the point of building.
37
- * This just requires the id
38
- * @param id id of the main composition that you want to build
39
- * @param connectionList list of connections
40
- * @param compositionList list of of_the_concept_ids for all the connections.
41
- * @returns
35
+ * Retrieves a complete composition structure for a given concept ID in JUSTDATA format.
36
+ *
37
+ * This is a primary composition retrieval function that builds a hierarchical structure
38
+ * containing the main concept, all its connections, and recursively fetched related concepts.
39
+ * The result is formatted as a nested object organized by concept types.
40
+ *
41
+ * **What is a Composition?**
42
+ * A composition represents a concept along with its connected relationships and sub-structures.
43
+ * Think of it as getting a "full profile" of a concept including everything connected to it.
44
+ *
45
+ * **Process:**
46
+ * 1. Fetches all connections associated with the concept
47
+ * 2. Identifies all related concept IDs from those connections
48
+ * 3. Recursively builds the composition tree
49
+ * 4. Fetches the main concept details
50
+ * 5. Organizes output by concept type (e.g., result["Person"] = {...})
51
+ * 6. Routes through service worker if enabled for better performance
52
+ *
53
+ * **Output Format (JUSTDATA):**
54
+ * Returns an object keyed by the main concept's type character value:
55
+ * ```
56
+ * {
57
+ * "Person": {
58
+ * id: 123,
59
+ * characterValue: "Alice",
60
+ * connections: [...],
61
+ * relatedConcepts: {...}
62
+ * }
63
+ * }
64
+ * ```
65
+ *
66
+ * @param id - The unique identifier of the concept for which to build the composition.
67
+ * This becomes the root of the composition tree.
68
+ *
69
+ * @returns Promise resolving to an object containing the composition data organized by
70
+ * the main concept's type. Returns empty object if concept not found or on error.
71
+ *
72
+ * @example
73
+ * // Get composition for a person concept
74
+ * const composition = await GetComposition(12345);
75
+ * console.log(composition["Person"]);
76
+ * // {
77
+ * // id: 12345,
78
+ * // characterValue: "Alice Smith",
79
+ * // connections: [... all connections],
80
+ * // Company: { ... related company data },
81
+ * // Projects: { ... related projects }
82
+ * // }
83
+ *
84
+ * @example
85
+ * // Get composition for an organization
86
+ * const orgComposition = await GetComposition(456);
87
+ * console.log(orgComposition["Organization"]);
88
+ * // Contains the organization and all connected employees, departments, etc.
89
+ *
90
+ * @example
91
+ * // Use with service worker (automatic if enabled)
92
+ * // Service worker handles the heavy lifting in background
93
+ * const result = await GetComposition(789);
94
+ *
95
+ * @see {@link GetCompositionWithId} for composition with ID and timestamp (DATAID format)
96
+ * @see {@link GetCompositionBulk} for fetching multiple compositions efficiently
97
+ * @see {@link GetCompositionWithCache} for cached composition retrieval
98
+ * @see {@link recursiveFetch} for the recursive building logic
42
99
  */
43
100
  export declare function GetComposition(id: number): Promise<any>;
44
101
  export declare function GetCompositionWithAllIds(id: number): Promise<any>;