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.
- package/README.md +1148 -11
- package/dist/bundle.js +1 -1
- package/dist/types/Api/Create/CreateTheCharacter.d.ts +42 -0
- package/dist/types/Api/Create/CreateTheConceptApi.d.ts +50 -0
- package/dist/types/Api/Create/CreateTheConnectionApi.d.ts +51 -0
- package/dist/types/Api/Create/CreateTheTextData.d.ts +56 -0
- package/dist/types/Api/Delete/DeleteConceptInBackend.d.ts +43 -0
- package/dist/types/Api/DeleteConnectionApiBulk.d.ts +55 -0
- package/dist/types/Api/DeleteTheConcept.d.ts +64 -0
- package/dist/types/Api/DeleteTheConnection.d.ts +76 -0
- package/dist/types/Api/GetAiData.d.ts +36 -0
- package/dist/types/Api/GetAllConcepts.d.ts +42 -0
- package/dist/types/Api/GetAllConceptsByType.d.ts +45 -0
- package/dist/types/Api/GetAllConnections.d.ts +48 -0
- package/dist/types/Api/GetAllConnectionsOfComposition.d.ts +79 -0
- package/dist/types/Api/GetAllConnectionsOfCompositionBulk.d.ts +90 -0
- package/dist/types/Api/GetAllLinkerConnectionsFromTheConcept.d.ts +52 -0
- package/dist/types/Api/GetAllLinkerConnectionsToTheConcept.d.ts +61 -0
- package/dist/types/Api/GetAllPrefetchConnections.d.ts +51 -0
- package/dist/types/Api/GetCharacterDataByCharacter.d.ts +31 -0
- package/dist/types/Api/GetCompositionConnectionsBetweenTwoConcepts.d.ts +39 -0
- package/dist/types/Api/GetConcept.d.ts +47 -0
- package/dist/types/Api/GetConceptBulk.d.ts +68 -0
- package/dist/types/Api/GetConceptByCharacterAndType.d.ts +75 -0
- package/dist/types/Api/GetConceptByCharacterValue.d.ts +47 -0
- package/dist/types/Api/GetConnection.d.ts +49 -0
- package/dist/types/Api/GetConnectionBulk.d.ts +46 -0
- package/dist/types/Api/GetConnectionOfTheConcept.d.ts +50 -0
- package/dist/types/Api/GetConnectionToTheConcept.d.ts +56 -0
- package/dist/types/Api/GetReservedConnectionIds.d.ts +36 -0
- package/dist/types/Api/GetReservedIds.d.ts +37 -0
- package/dist/types/Api/Login.d.ts +38 -0
- package/dist/types/Api/MakeTheNameInBackend.d.ts +39 -0
- package/dist/types/Api/MakeTheTypeConceptApi.d.ts +40 -0
- package/dist/types/Api/RecursiveSearch.d.ts +43 -0
- package/dist/types/Api/Search/FreeschemaQueryApi.d.ts +46 -0
- package/dist/types/Api/Search/Search.d.ts +67 -0
- package/dist/types/Api/Search/SearchInternalApi.d.ts +69 -0
- package/dist/types/Api/Search/SearchLinkMultipleApi.d.ts +90 -0
- package/dist/types/Api/Search/SearchWithLinker.d.ts +97 -0
- package/dist/types/Api/SearchConcept/GetConceptByCharacterAndCategoryApi.d.ts +39 -0
- package/dist/types/Api/SearchConcept/GetConceptByCharacterAndCategoryDirect.d.ts +47 -0
- package/dist/types/Api/Session/CreateSession.d.ts +45 -0
- package/dist/types/Api/Session/CreateSessionVisit.d.ts +43 -0
- package/dist/types/Api/Signin.d.ts +48 -0
- package/dist/types/Api/Signup.d.ts +44 -0
- package/dist/types/Api/View/ViewInternalDataApi.d.ts +50 -0
- package/dist/types/Constants/ApiConstants.d.ts +226 -0
- package/dist/types/Constants/FormatConstants.d.ts +81 -0
- package/dist/types/DataStructures/BaseUrl.d.ts +210 -0
- package/dist/types/DataStructures/BinaryCharacterTree.d.ts +211 -0
- package/dist/types/DataStructures/BinaryTree.d.ts +139 -0
- package/dist/types/DataStructures/BinaryTypeTree.d.ts +196 -0
- package/dist/types/DataStructures/CharacterRepository.d.ts +109 -0
- package/dist/types/DataStructures/Composition/Composition.d.ts +103 -0
- package/dist/types/DataStructures/Composition/CompositionBinaryTree.d.ts +104 -0
- package/dist/types/DataStructures/Composition/CompositionNode.d.ts +202 -0
- package/dist/types/DataStructures/Concept.d.ts +110 -0
- package/dist/types/DataStructures/ConceptData.d.ts +292 -0
- package/dist/types/DataStructures/ConceptsToDraw.d.ts +168 -0
- package/dist/types/DataStructures/Connection.d.ts +76 -0
- package/dist/types/DataStructures/ConnectionBinaryTree/ConnectionBinaryTree.d.ts +115 -0
- package/dist/types/DataStructures/ConnectionBinaryTree/ConnectionNode.d.ts +169 -0
- package/dist/types/DataStructures/ConnectionBinaryTree/ConnectionTypeTree.d.ts +82 -0
- package/dist/types/DataStructures/ConnectionData.d.ts +191 -0
- package/dist/types/DataStructures/Count/CountInfo.d.ts +73 -0
- package/dist/types/DataStructures/FilterSearch.d.ts +84 -0
- package/dist/types/DataStructures/IdentifierFlags.d.ts +34 -0
- package/dist/types/DataStructures/Local/LConcept.d.ts +105 -0
- package/dist/types/DataStructures/Local/LConnection.d.ts +83 -0
- package/dist/types/DataStructures/Local/LNode.d.ts +190 -0
- package/dist/types/DataStructures/Local/LocalBinaryCharacterTree.d.ts +133 -0
- package/dist/types/DataStructures/Local/LocalBinaryTree.d.ts +135 -0
- package/dist/types/DataStructures/Local/LocalBinaryTypeTree.d.ts +147 -0
- package/dist/types/DataStructures/Local/LocalConceptData.d.ts +100 -0
- package/dist/types/DataStructures/Local/LocalConnectionData.d.ts +109 -0
- package/dist/types/DataStructures/Local/LocalSyncData.d.ts +89 -0
- package/dist/types/DataStructures/PatcherStructure.d.ts +86 -0
- package/dist/types/DataStructures/ReferentInfo.d.ts +68 -0
- package/dist/types/DataStructures/ReservedIds.d.ts +101 -0
- package/dist/types/DataStructures/Responses/ErrorResponse.d.ts +184 -22
- package/dist/types/DataStructures/Responses/StandardResponses.d.ts +65 -0
- package/dist/types/DataStructures/Returner.d.ts +59 -0
- package/dist/types/DataStructures/Search/FreeschemaQuery.d.ts +165 -0
- package/dist/types/DataStructures/Search/SearchStructure.d.ts +69 -0
- package/dist/types/DataStructures/SearchQuery.d.ts +130 -0
- package/dist/types/DataStructures/Security/TokenStorage.d.ts +48 -0
- package/dist/types/DataStructures/Session/SessionData.d.ts +118 -0
- package/dist/types/DataStructures/SettingData.d.ts +32 -0
- package/dist/types/DataStructures/Settings.d.ts +27 -0
- package/dist/types/DataStructures/SigninModel.d.ts +50 -0
- package/dist/types/DataStructures/SignupModel.d.ts +50 -0
- package/dist/types/DataStructures/SyncData.d.ts +206 -0
- package/dist/types/DataStructures/TheCharacter.d.ts +87 -0
- package/dist/types/DataStructures/TheTexts.d.ts +92 -0
- package/dist/types/DataStructures/Transaction/Transaction.d.ts +294 -4
- package/dist/types/DataStructures/User/UserBinaryTree.d.ts +117 -0
- package/dist/types/DataStructures/User/UserNode.d.ts +130 -0
- package/dist/types/Database/GetConceptFromIndexDb.d.ts +9 -0
- package/dist/types/Database/NoIndexDb.d.ts +169 -0
- package/dist/types/Database/indexdblocal.d.ts +42 -0
- package/dist/types/Database/indexeddb.d.ts +43 -0
- package/dist/types/Drawing/ConceptDraw.d.ts +28 -0
- package/dist/types/Drawing/ConceptEvents.d.ts +46 -0
- package/dist/types/Helpers/CheckIfExists.d.ts +159 -0
- package/dist/types/Helpers/RemoveFromArray.d.ts +66 -0
- package/dist/types/Helpers/UniqueInsert.d.ts +28 -0
- package/dist/types/Services/CheckForConnectionDeletion.d.ts +190 -0
- package/dist/types/Services/Common/DecodeCountInfo.d.ts +54 -0
- package/dist/types/Services/Common/ErrorPosting.d.ts +49 -0
- package/dist/types/Services/Common/RegexFunction.d.ts +28 -0
- package/dist/types/Services/Composition/BuildComposition.d.ts +37 -0
- package/dist/types/Services/Composition/CompositionCache.d.ts +89 -0
- package/dist/types/Services/Composition/CreateCompositionCache.d.ts +43 -0
- package/dist/types/Services/Conversion/ConvertConcepts.d.ts +83 -0
- package/dist/types/Services/CreateBinaryTreeFromData.d.ts +38 -0
- package/dist/types/Services/CreateCharacterBinaryTreeFromData.d.ts +42 -0
- package/dist/types/Services/CreateConnectionBetweenTwoConcepts.d.ts +206 -0
- package/dist/types/Services/CreateDefaultConcept.d.ts +114 -0
- package/dist/types/Services/CreateTheComposition.d.ts +101 -0
- package/dist/types/Services/CreateTheConcept.d.ts +179 -0
- package/dist/types/Services/CreateTheConnection.d.ts +59 -0
- package/dist/types/Services/CreateTheConnectionGeneral.d.ts +127 -0
- package/dist/types/Services/CreateTypeTreeFromData.d.ts +43 -0
- package/dist/types/Services/Delete/DeleteConnectionByType.d.ts +52 -5
- package/dist/types/Services/Delete/GetAllConnectionByType.d.ts +57 -9
- package/dist/types/Services/DeleteConcept.d.ts +136 -0
- package/dist/types/Services/DeleteConnection.d.ts +194 -0
- package/dist/types/Services/FindConeceptsFromConnection.d.ts +179 -0
- package/dist/types/Services/FindConnectionsOfCompositionBulkInMemory.d.ts +157 -0
- package/dist/types/Services/GenerateHexNumber.d.ts +64 -0
- package/dist/types/Services/GetComposition.d.ts +331 -0
- package/dist/types/Services/GetCompositionBulk.d.ts +251 -3
- package/dist/types/Services/GetCompositionList.d.ts +130 -0
- package/dist/types/Services/GetConceptByCharacter.d.ts +84 -0
- package/dist/types/Services/GetConnections.d.ts +72 -0
- package/dist/types/Services/GetDataFromIndexDb.d.ts +79 -0
- package/dist/types/Services/GetLink.d.ts +104 -0
- package/dist/types/Services/GetLinkerConnectionFromConcept.d.ts +99 -0
- package/dist/types/Services/GetMaximumConnectionSyncTime.d.ts +57 -0
- package/dist/types/Services/GetRelation.d.ts +162 -0
- package/dist/types/Services/GetTheConcept.d.ts +71 -0
- package/dist/types/Services/GetTheReferent.d.ts +74 -0
- package/dist/types/Services/InitializeSystem.d.ts +119 -0
- package/dist/types/Services/Local/CreateDefaultLConcept.d.ts +48 -0
- package/dist/types/Services/Local/CreateLocalBinaryTreeFromData.d.ts +49 -0
- package/dist/types/Services/Local/CreateLocalBinaryTypeTreeFromData.d.ts +54 -0
- package/dist/types/Services/Local/CreateLocalCharacterBinaryTree.d.ts +60 -0
- package/dist/types/Services/Local/CreateTheCompositionLocal.d.ts +70 -0
- package/dist/types/Services/Local/CreateTheConceptLocal.d.ts +58 -0
- package/dist/types/Services/Local/CreateTheConnectionLocal.d.ts +56 -0
- package/dist/types/Services/Local/GetCompositionListLocal.d.ts +103 -0
- package/dist/types/Services/Local/GetCompositionLocal.d.ts +96 -0
- package/dist/types/Services/Local/GetConceptByCharacterLocal.d.ts +57 -0
- package/dist/types/Services/Local/MakeTheConceptLocal.d.ts +71 -0
- package/dist/types/Services/Local/MakeTheInstanceConceptLocal.d.ts +89 -0
- package/dist/types/Services/Local/MakeTheTypeLocal.d.ts +71 -0
- package/dist/types/Services/Local/UpdateCompositionLocal.d.ts +101 -0
- package/dist/types/Services/MakeTheCharacter.d.ts +74 -0
- package/dist/types/Services/MakeTheCharacterData.d.ts +65 -0
- package/dist/types/Services/MakeTheInstanceConcept.d.ts +75 -0
- package/dist/types/Services/MakeTheName.d.ts +81 -0
- package/dist/types/Services/MakeTheTimestamp.d.ts +68 -0
- package/dist/types/Services/MakeTheTypeConcept.d.ts +68 -0
- package/dist/types/Services/Mqtt/publishMessage.d.ts +27 -0
- package/dist/types/Services/Mqtt/subscribeMessage.d.ts +23 -0
- package/dist/types/Services/PatchComposition.d.ts +105 -0
- package/dist/types/Services/Search/DataIdFormat.d.ts +96 -24
- package/dist/types/Services/Search/FormatData.d.ts +92 -17
- package/dist/types/Services/Search/JustIdFormat.d.ts +91 -16
- package/dist/types/Services/Search/NewFormat.d.ts +4 -0
- package/dist/types/Services/Search/SearchLinkInternal.d.ts +28 -0
- package/dist/types/Services/Search/SearchLinkMultiple.d.ts +58 -0
- package/dist/types/Services/Search/SearchWithTypeAndLinker.d.ts +92 -24
- package/dist/types/Services/Search/orderingConnections.d.ts +34 -0
- package/dist/types/Services/SplitStrings.d.ts +50 -0
- package/dist/types/Services/UpdateComposition.d.ts +123 -0
- package/dist/types/Services/User/UserTranslation.d.ts +102 -0
- package/dist/types/Services/View/ViewInternalData.d.ts +32 -0
- package/dist/types/WrapperFunctions/SchemaQueryObservable.d.ts +140 -5
- package/dist/types/app.d.ts +72 -1
- package/package.json +1 -1
|
@@ -1,34 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module SearchWithTypeAndLinker
|
|
3
|
+
* @description Provides various formatting functions for search results with different output formats (Normal, DATA-ID, JustId)
|
|
4
|
+
*/
|
|
1
5
|
import { CountInfo } from "../../DataStructures/Count/CountInfo";
|
|
2
6
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* @
|
|
7
|
-
* @param
|
|
8
|
-
* @param
|
|
9
|
-
* @param
|
|
10
|
-
* @
|
|
7
|
+
* Formats connections in the Normal format by fetching connections, converting them to single-level objects,
|
|
8
|
+
* and stitching them together to create a complex JSON structure or array.
|
|
9
|
+
*
|
|
10
|
+
* @async
|
|
11
|
+
* @param {number[]} linkers - Array of connection IDs that act as linkers between concepts
|
|
12
|
+
* @param {number[]} conceptIds - Array of concept IDs involved in the connections
|
|
13
|
+
* @param {number[]} mainCompositionIds - Array of main composition IDs to format
|
|
14
|
+
* @param {number[]} reverse - Array of connection IDs that should be treated as reverse connections
|
|
15
|
+
* @param {CountInfo[]} countInfos - Array of count information objects for connection statistics
|
|
16
|
+
* @returns {Promise<any[]>} A promise that resolves to an array of formatted composition data
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* const linkers = [101, 102];
|
|
21
|
+
* const conceptIds = [1, 2, 3];
|
|
22
|
+
* const mainIds = [100];
|
|
23
|
+
* const reverse = [102];
|
|
24
|
+
* const countInfos: CountInfo[] = [];
|
|
25
|
+
* const result = await formatConnections(linkers, conceptIds, mainIds, reverse, countInfos);
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @remarks
|
|
29
|
+
* Format: Normal - This format is used for standard composition retrieval
|
|
30
|
+
* Process:
|
|
31
|
+
* 1. Fetches all connections using the provided linker IDs
|
|
32
|
+
* 2. Orders the connections (descending by default)
|
|
33
|
+
* 3. Formats connections to single-level objects
|
|
34
|
+
* 4. Formats data connections
|
|
35
|
+
* 5. Combines and stitches all data into a complex structure
|
|
11
36
|
*/
|
|
12
37
|
export declare function formatConnections(linkers: number[], conceptIds: number[], mainCompositionIds: number[], reverse: number[], countInfos: CountInfo[]): Promise<any>;
|
|
13
38
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* @
|
|
18
|
-
* @param
|
|
19
|
-
* @param
|
|
20
|
-
* @param
|
|
21
|
-
* @
|
|
39
|
+
* Formats connections in the DATA-ID format, which includes both data and ID information for each concept.
|
|
40
|
+
* Fetches connections, converts them to single-level objects, and stitches them together.
|
|
41
|
+
*
|
|
42
|
+
* @async
|
|
43
|
+
* @param {number[]} linkers - Array of connection IDs that act as linkers between concepts
|
|
44
|
+
* @param {number[]} conceptIds - Array of concept IDs involved in the connections
|
|
45
|
+
* @param {number[]} mainCompositionIds - Array of main composition IDs to format
|
|
46
|
+
* @param {number[]} reverse - Array of connection IDs that should be treated as reverse connections
|
|
47
|
+
* @param {CountInfo[]} countInfos - Array of count information objects for connection statistics
|
|
48
|
+
* @param {string} [order="DESC"] - Sort order for connections ("ASC" or "DESC")
|
|
49
|
+
* @returns {Promise<any[]>} A promise that resolves to an array of formatted composition data with ID and data fields
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* const result = await formatConnectionsDataId(
|
|
54
|
+
* [101, 102],
|
|
55
|
+
* [1, 2, 3],
|
|
56
|
+
* [100],
|
|
57
|
+
* [102],
|
|
58
|
+
* [],
|
|
59
|
+
* "ASC"
|
|
60
|
+
* );
|
|
61
|
+
* // Result format: [{ id: 100, data: {...}, created_on: timestamp }]
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* @remarks
|
|
65
|
+
* Format: DATA-ID - Each result includes concept ID, data object, and creation timestamp
|
|
66
|
+
* This format is useful when you need to track both the identity and content of concepts
|
|
67
|
+
* The order parameter allows sorting connections by ID in ascending or descending order
|
|
22
68
|
*/
|
|
23
69
|
export declare function formatConnectionsDataId(linkers: number[], conceptIds: number[], mainCompositionIds: number[], reverse: number[], countInfos: CountInfo[], order?: string): Promise<any>;
|
|
24
70
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* @
|
|
29
|
-
* @param
|
|
30
|
-
* @param
|
|
31
|
-
* @param
|
|
32
|
-
* @
|
|
71
|
+
* Formats connections in the JustId format, which provides a simplified view with IDs and minimal data.
|
|
72
|
+
* Fetches connections, converts them to single-level objects, and stitches them together.
|
|
73
|
+
*
|
|
74
|
+
* @async
|
|
75
|
+
* @param {number[]} linkers - Array of connection IDs that act as linkers between concepts
|
|
76
|
+
* @param {number[]} conceptIds - Array of concept IDs involved in the connections
|
|
77
|
+
* @param {number[]} mainCompositionIds - Array of main composition IDs to format
|
|
78
|
+
* @param {number[]} reverse - Array of connection IDs that should be treated as reverse connections
|
|
79
|
+
* @param {CountInfo[]} countInfos - Array of count information objects for connection statistics
|
|
80
|
+
* @param {string} [order="DESC"] - Sort order for connections ("ASC" or "DESC")
|
|
81
|
+
* @returns {Promise<any[]>} A promise that resolves to an array of formatted composition data with simplified ID structure
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```typescript
|
|
85
|
+
* const result = await formatConnectionsJustId(
|
|
86
|
+
* [101, 102],
|
|
87
|
+
* [1, 2, 3],
|
|
88
|
+
* [100],
|
|
89
|
+
* [],
|
|
90
|
+
* [],
|
|
91
|
+
* "DESC"
|
|
92
|
+
* );
|
|
93
|
+
* // Result format: [{ id: 100, type: { id: 1, data: "value", created_on: timestamp } }]
|
|
94
|
+
* ```
|
|
95
|
+
*
|
|
96
|
+
* @remarks
|
|
97
|
+
* Format: JustId - This format provides a lightweight representation with IDs and essential data
|
|
98
|
+
* Useful for list views and when you need to minimize data transfer
|
|
99
|
+
* Each linked concept includes: ID, data value, and creation timestamp
|
|
33
100
|
*/
|
|
34
101
|
export declare function formatConnectionsJustId(linkers: number[], conceptIds: number[], mainCompositionIds: number[], reverse: number[], countInfos: CountInfo[], order?: string): Promise<any>;
|
|
102
|
+
export declare function formatConnectionsV2(linkers: number[], conceptIds: number[], mainCompositionIds: number[], reverse: number[], countInfos: CountInfo[], order?: string): Promise<any>;
|
|
@@ -1,2 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module orderingConnections
|
|
3
|
+
* @description Provides functionality to sort connections by ID in ascending or descending order
|
|
4
|
+
*/
|
|
1
5
|
import { Connection } from "../../app";
|
|
6
|
+
/**
|
|
7
|
+
* Sorts an array of connections by their ID in the specified order.
|
|
8
|
+
*
|
|
9
|
+
* @param {Connection[]} connections - Array of Connection objects to sort
|
|
10
|
+
* @param {string} [order="DESC"] - Sort order: "ASC" for ascending, "DESC" for descending
|
|
11
|
+
* @returns {Connection[]} The sorted array of connections (mutates the original array)
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const connections: Connection[] = [
|
|
16
|
+
* { id: 103, ... },
|
|
17
|
+
* { id: 101, ... },
|
|
18
|
+
* { id: 102, ... }
|
|
19
|
+
* ];
|
|
20
|
+
*
|
|
21
|
+
* // Sort in descending order (newest first)
|
|
22
|
+
* const sorted = orderTheConnections(connections, "DESC");
|
|
23
|
+
* // Result: [{ id: 103 }, { id: 102 }, { id: 101 }]
|
|
24
|
+
*
|
|
25
|
+
* // Sort in ascending order (oldest first)
|
|
26
|
+
* const sortedAsc = orderTheConnections(connections, "ASC");
|
|
27
|
+
* // Result: [{ id: 101 }, { id: 102 }, { id: 103 }]
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* - This function mutates the original array in place
|
|
32
|
+
* - Default order is "DESC" (descending, newest first)
|
|
33
|
+
* - Uses the connection ID for sorting
|
|
34
|
+
* - Any value other than "ASC" will result in descending order
|
|
35
|
+
*/
|
|
2
36
|
export declare function orderTheConnections(connections: Connection[], order?: string): Connection[];
|
|
@@ -1 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview String utility module for splitting type strings in the CCS-JS system.
|
|
3
|
+
* This module provides functionality to parse type strings that follow a naming convention
|
|
4
|
+
* with underscore separators, commonly used for identifying concept types and their relationships.
|
|
5
|
+
* @module Services/SplitStrings
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Splits a type string into component parts based on the last underscore delimiter.
|
|
9
|
+
*
|
|
10
|
+
* This function is used throughout the CCS-JS system to parse type identifiers that follow
|
|
11
|
+
* a naming convention where the last underscore separates the base type from its suffix.
|
|
12
|
+
* For example, "concept_type_123" would be split into ["concept_type", "123"].
|
|
13
|
+
*
|
|
14
|
+
* The function uses the last occurrence of underscore as the split point, which allows
|
|
15
|
+
* for type names that contain underscores themselves. If no underscore is found, the
|
|
16
|
+
* original string is returned as a single-element array.
|
|
17
|
+
*
|
|
18
|
+
* @param typeString - The type identifier string to be split
|
|
19
|
+
* @returns An array containing the split components. Returns a two-element array [prefix, suffix]
|
|
20
|
+
* if an underscore is found, or a single-element array [typeString] if no underscore exists.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* // Split a composite type string
|
|
25
|
+
* const result = SplitStrings("user_profile_123");
|
|
26
|
+
* // Returns: ["user_profile", "123"]
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* // Handle string without underscore
|
|
32
|
+
* const result = SplitStrings("simpleType");
|
|
33
|
+
* // Returns: ["simpleType"]
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* // Split concept type identifier
|
|
39
|
+
* const result = SplitStrings("concept_type");
|
|
40
|
+
* // Returns: ["concept", "type"]
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @remarks
|
|
44
|
+
* The function specifically uses `lastIndexOf("_")` to find the splitting point, which means:
|
|
45
|
+
* - Only the last underscore is considered for splitting
|
|
46
|
+
* - All underscores before the last one remain part of the first element
|
|
47
|
+
* - The position check (pos > 0) ensures underscore is not the first character
|
|
48
|
+
*
|
|
49
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf | String.lastIndexOf}
|
|
50
|
+
*/
|
|
1
51
|
export declare function SplitStrings(typeString: string): string[];
|
|
@@ -1,2 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Composition update service for the CCS-JS system.
|
|
3
|
+
* This module provides comprehensive functionality for updating composition structures,
|
|
4
|
+
* managing the complex process of patching objects into compositions, handling nested
|
|
5
|
+
* compositions, updating caches, and synchronizing changes with the backend.
|
|
6
|
+
* @module Services/UpdateComposition
|
|
7
|
+
*/
|
|
1
8
|
import { PatcherStructure } from '../DataStructures/PatcherStructure';
|
|
9
|
+
/**
|
|
10
|
+
* Updates an existing composition by patching new data into it while maintaining cache consistency.
|
|
11
|
+
*
|
|
12
|
+
* This is a core function in the CCS-JS system that handles the complex process of updating
|
|
13
|
+
* compositions. It performs the following operations:
|
|
14
|
+
* 1. Retrieves the current composition and all its connections from the backend
|
|
15
|
+
* 2. Processes the patch object to create new concepts and connections
|
|
16
|
+
* 3. Identifies and removes outdated concepts and connections
|
|
17
|
+
* 4. Updates the composition cache and binary tree structure
|
|
18
|
+
* 5. Synchronizes changes with the backend
|
|
19
|
+
*
|
|
20
|
+
* The function handles both simple value updates and complex nested composition updates.
|
|
21
|
+
* It ensures data consistency by managing connection deletions, concept replacements, and
|
|
22
|
+
* cache invalidation across distributed servers.
|
|
23
|
+
*
|
|
24
|
+
* @param patcherStructure - Structure containing all necessary information for the update operation
|
|
25
|
+
* including compositionId, patchObject, userId, sessionId, and accessId
|
|
26
|
+
* @returns A promise that resolves to the updated composition cache data, or null if the composition
|
|
27
|
+
* cannot be found or updated. The returned data includes the updated concepts, connections,
|
|
28
|
+
* and subcompositions.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* // Update a simple composition with new values
|
|
33
|
+
* import UpdateComposition from './UpdateComposition';
|
|
34
|
+
* import { PatcherStructure } from '../DataStructures/PatcherStructure';
|
|
35
|
+
*
|
|
36
|
+
* const patcher: PatcherStructure = {
|
|
37
|
+
* compositionId: 123,
|
|
38
|
+
* patchObject: { name: "Updated Name", age: 30 },
|
|
39
|
+
* userId: 456,
|
|
40
|
+
* sessionId: 999,
|
|
41
|
+
* accessId: 4
|
|
42
|
+
* };
|
|
43
|
+
*
|
|
44
|
+
* const result = await UpdateComposition(patcher);
|
|
45
|
+
* console.log(result); // Updated composition data
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
50
|
+
* // Update a nested composition
|
|
51
|
+
* const patcher: PatcherStructure = {
|
|
52
|
+
* compositionId: 123,
|
|
53
|
+
* ofTheCompositionId: 789, // Parent concept ID for nested update
|
|
54
|
+
* patchObject: {
|
|
55
|
+
* profile: {
|
|
56
|
+
* firstName: "John",
|
|
57
|
+
* lastName: "Doe"
|
|
58
|
+
* },
|
|
59
|
+
* settings: {
|
|
60
|
+
* theme: "dark"
|
|
61
|
+
* }
|
|
62
|
+
* },
|
|
63
|
+
* userId: 456,
|
|
64
|
+
* sessionId: 999,
|
|
65
|
+
* accessId: 4
|
|
66
|
+
* };
|
|
67
|
+
*
|
|
68
|
+
* const result = await UpdateComposition(patcher);
|
|
69
|
+
* ```
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```typescript
|
|
73
|
+
* // Handle local concept conversion (negative ID to positive ID)
|
|
74
|
+
* const patcher: PatcherStructure = {
|
|
75
|
+
* compositionId: -123, // Local concept ID
|
|
76
|
+
* patchObject: { status: "active" },
|
|
77
|
+
* userId: 456,
|
|
78
|
+
* sessionId: 999,
|
|
79
|
+
* accessId: 4
|
|
80
|
+
* };
|
|
81
|
+
*
|
|
82
|
+
* const result = await UpdateComposition(patcher);
|
|
83
|
+
* // Function will convert local ID to server ID before updating
|
|
84
|
+
* ```
|
|
85
|
+
*
|
|
86
|
+
* @remarks
|
|
87
|
+
* Complex behavior and important considerations:
|
|
88
|
+
*
|
|
89
|
+
* **Local Concept Handling:**
|
|
90
|
+
* - If compositionId is negative (local concept), the function attempts to find the persisted version
|
|
91
|
+
* - Returns null if the local concept hasn't been synced to the server yet
|
|
92
|
+
*
|
|
93
|
+
* **Cache Management:**
|
|
94
|
+
* - Marks the composition as "updating" to signal distributed servers to invalidate their cache
|
|
95
|
+
* - Rebuilds the composition cache with all updated concepts and connections
|
|
96
|
+
* - Updates the CompositionBinaryTree for fast access
|
|
97
|
+
*
|
|
98
|
+
* **Connection Management:**
|
|
99
|
+
* - Identifies existing concepts that match the new concepts being added
|
|
100
|
+
* - Removes old connections to those concepts before creating new ones
|
|
101
|
+
* - Deletes connections in bulk for efficiency
|
|
102
|
+
*
|
|
103
|
+
* **Nested Compositions:**
|
|
104
|
+
* - Supports updating subcompositions via the ofTheCompositionId parameter
|
|
105
|
+
* - Creates new composition concepts for object/array values
|
|
106
|
+
* - Recursively processes nested structures
|
|
107
|
+
*
|
|
108
|
+
* **Synchronization:**
|
|
109
|
+
* - Calls SyncData.SyncDataOnline() to push changes to the backend
|
|
110
|
+
* - Ensures consistency across distributed system
|
|
111
|
+
*
|
|
112
|
+
* **Performance Considerations:**
|
|
113
|
+
* - Fetches all connections from backend for latest data
|
|
114
|
+
* - Processes deletions and additions in batch
|
|
115
|
+
* - Uses caching to minimize redundant database queries
|
|
116
|
+
*
|
|
117
|
+
* @see {@link PatcherStructure} for the structure of the patcher parameter
|
|
118
|
+
* @see {@link CreateTheCompositionWithCache} for creating nested compositions
|
|
119
|
+
* @see {@link GetTheConcept} for concept retrieval
|
|
120
|
+
* @see {@link MakeTheInstanceConcept} for creating new concept instances
|
|
121
|
+
* @see {@link createTheConnection} for creating connections between concepts
|
|
122
|
+
* @see {@link DeleteConnectionById} for connection deletion
|
|
123
|
+
* @see {@link SyncData.SyncDataOnline} for backend synchronization
|
|
124
|
+
*/
|
|
2
125
|
export default function UpdateComposition(patcherStructure: PatcherStructure): Promise<any>;
|
|
@@ -1,6 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module UserTranslation
|
|
3
|
+
* @description Provides functions to translate between ghost IDs and real IDs for user-specific concepts and connections
|
|
4
|
+
*/
|
|
1
5
|
import { LConcept } from './../../DataStructures/Local/LConcept';
|
|
2
6
|
import { LConnection } from '../../app';
|
|
7
|
+
/**
|
|
8
|
+
* Retrieves a local concept (LConcept) by its ghost ID for a specific user.
|
|
9
|
+
* Ghost IDs are temporary IDs used before concepts are persisted.
|
|
10
|
+
*
|
|
11
|
+
* @async
|
|
12
|
+
* @param {number} userId - The user ID who owns the concept
|
|
13
|
+
* @param {number} ghostId - The temporary ghost ID of the concept
|
|
14
|
+
* @param {number} [sessionId=999] - The session ID (defaults to 999)
|
|
15
|
+
* @param {number} [randomizer=999] - Additional randomizer for tree lookup (defaults to 999)
|
|
16
|
+
* @returns {Promise<LConcept>} A promise that resolves to the LConcept, or default empty concept if not found
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* const userId = 1;
|
|
21
|
+
* const ghostId = 12345;
|
|
22
|
+
* const concept = await GetUserGhostId(userId, ghostId);
|
|
23
|
+
* if (concept.id !== 0) {
|
|
24
|
+
* console.log("Found concept with real ID:", concept.id);
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @remarks
|
|
29
|
+
* - Searches the UserBinaryTree for the user's concepts
|
|
30
|
+
* - Returns default empty LConcept if user or concept not found
|
|
31
|
+
* - Used during concept creation before IDs are assigned
|
|
32
|
+
* - Ghost IDs are temporary until persisted to backend
|
|
33
|
+
*/
|
|
3
34
|
export declare function GetUserGhostId(userId: number, ghostId: number, sessionId?: number, randomizer?: number): Promise<LConcept>;
|
|
35
|
+
/**
|
|
36
|
+
* Retrieves a local connection (LConnection) by its ghost ID for a specific user.
|
|
37
|
+
* Ghost IDs are temporary IDs used before connections are persisted.
|
|
38
|
+
*
|
|
39
|
+
* @async
|
|
40
|
+
* @param {number} userId - The user ID who owns the connection
|
|
41
|
+
* @param {number} ghostId - The temporary ghost ID of the connection
|
|
42
|
+
* @param {number} [sessionId=999] - The session ID (defaults to 999)
|
|
43
|
+
* @param {number} [randomizer=999] - Additional randomizer for tree lookup (defaults to 999)
|
|
44
|
+
* @returns {Promise<LConnection>} A promise that resolves to the LConnection, or default empty connection if not found
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```typescript
|
|
48
|
+
* const userId = 1;
|
|
49
|
+
* const connectionGhostId = 67890;
|
|
50
|
+
* const connection = await GetUserGhostConnectionId(userId, connectionGhostId);
|
|
51
|
+
* if (connection.id !== 0) {
|
|
52
|
+
* console.log("Found connection with real ID:", connection.id);
|
|
53
|
+
* }
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* @remarks
|
|
57
|
+
* - Similar to GetUserGhostId but for connections instead of concepts
|
|
58
|
+
* - Searches UserBinaryTree's connection values
|
|
59
|
+
* - Returns default empty LConnection if not found
|
|
60
|
+
* - Used during connection creation before IDs are assigned
|
|
61
|
+
*/
|
|
4
62
|
export declare function GetUserGhostConnectionId(userId: number, ghostId: number, sessionId?: number, randomizer?: number): Promise<LConnection>;
|
|
63
|
+
/**
|
|
64
|
+
* Adds a ghost concept to the UserBinaryTree for temporary storage.
|
|
65
|
+
* Stores concepts with ghost IDs before they are persisted.
|
|
66
|
+
*
|
|
67
|
+
* @async
|
|
68
|
+
* @param {LConcept} concept - The local concept to add
|
|
69
|
+
* @param {number} userId - The user ID who owns the concept
|
|
70
|
+
* @param {number} [sessionId=999] - The session ID (defaults to 999)
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```typescript
|
|
74
|
+
* const ghostConcept: LConcept = {
|
|
75
|
+
* ghostId: 12345,
|
|
76
|
+
* characterValue: "Test",
|
|
77
|
+
* ...
|
|
78
|
+
* };
|
|
79
|
+
* await AddGhostConcept(ghostConcept, 1, 999);
|
|
80
|
+
* ```
|
|
81
|
+
*
|
|
82
|
+
* @remarks
|
|
83
|
+
* - Stores concept in UserBinaryTree indexed by userId and sessionId
|
|
84
|
+
* - Used for optimistic UI updates before backend persistence
|
|
85
|
+
* - No return value (void function)
|
|
86
|
+
*/
|
|
5
87
|
export declare function AddGhostConcept(concept: LConcept, userId: number, sessionId?: number): Promise<void>;
|
|
88
|
+
/**
|
|
89
|
+
* Adds a ghost connection to the UserBinaryTree for temporary storage.
|
|
90
|
+
* Stores connections with ghost IDs before they are persisted.
|
|
91
|
+
*
|
|
92
|
+
* @async
|
|
93
|
+
* @param {LConnection} connection - The local connection to add
|
|
94
|
+
* @param {number} userId - The user ID who owns the connection
|
|
95
|
+
* @param {number} [sessionId=999] - The session ID (defaults to 999)
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```typescript
|
|
99
|
+
* const ghostConnection: LConnection = new LConnection(0, 12345, 123, 456, 999, 999);
|
|
100
|
+
* await AddGhostConnection(ghostConnection, 1, 999);
|
|
101
|
+
* ```
|
|
102
|
+
*
|
|
103
|
+
* @remarks
|
|
104
|
+
* - Stores connection in UserBinaryTree indexed by userId and sessionId
|
|
105
|
+
* - Used for optimistic UI updates before backend persistence
|
|
106
|
+
* - No return value (void function)
|
|
107
|
+
*/
|
|
6
108
|
export declare function AddGhostConnection(connection: LConnection, userId: number, sessionId?: number): Promise<void>;
|
|
@@ -1 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module ViewInternalData
|
|
3
|
+
* @description Provides functionality to view and format internal composition data for multiple concepts
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Retrieves and formats internal data for multiple concepts by their IDs.
|
|
7
|
+
* Fetches internal connections and builds composition structures for each concept.
|
|
8
|
+
*
|
|
9
|
+
* @async
|
|
10
|
+
* @param {number[]} ids - Array of concept IDs to retrieve internal data for
|
|
11
|
+
* @returns {Promise<any[]>} A promise that resolves to array of formatted composition objects with id and data fields
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const conceptIds = [123, 456, 789];
|
|
16
|
+
* const internalData = await ViewInternalData(conceptIds);
|
|
17
|
+
* // internalData = [
|
|
18
|
+
* // { id: 123, data: { user: { name: "John", email: "john@example.com" } } },
|
|
19
|
+
* // { id: 456, data: { post: { title: "Hello", content: "World" } } },
|
|
20
|
+
* // { id: 789, data: { type: "value" } }
|
|
21
|
+
* // ]
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @remarks
|
|
25
|
+
* This function:
|
|
26
|
+
* - Fetches internal connections for all provided concept IDs
|
|
27
|
+
* - For concepts with connections: builds composition structure using recursiveFetch
|
|
28
|
+
* - For concepts without connections: returns concept's type and character value
|
|
29
|
+
* - Each result includes id field and data field
|
|
30
|
+
* - Handles missing connections gracefully
|
|
31
|
+
* - Useful for viewing composition internals in list format
|
|
32
|
+
*/
|
|
1
33
|
export declare function ViewInternalData(ids: number[]): Promise<any[]>;
|
|
@@ -1,24 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Observable wrapper for schema query operations in the CCS-JS system.
|
|
3
|
+
* @module WrapperFunctions/SchemaQueryObservable
|
|
4
|
+
*/
|
|
1
5
|
import { FreeschemaQuery } from "../DataStructures/Search/FreeschemaQuery";
|
|
6
|
+
/**
|
|
7
|
+
* Observable wrapper for handling multiple linked concept searches.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* SearchLinkMultipleAllObservable encapsulates the state and configuration for executing
|
|
11
|
+
* schema queries that retrieve multiple linked concepts. It maintains query parameters,
|
|
12
|
+
* formatting options, and the results of API calls including concept IDs, internal
|
|
13
|
+
* connections, linkers, and other relationship data.
|
|
14
|
+
*
|
|
15
|
+
* This class is designed to work with the FreeschemaQuery system and can format results
|
|
16
|
+
* in various output formats (NORMAL, DATAID, JUSTDATA, ALLID).
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* const query = new FreeschemaQuery();
|
|
21
|
+
* query.outputFormat = DATAID;
|
|
22
|
+
* query.order = "ASC";
|
|
23
|
+
*
|
|
24
|
+
* const observable = new SearchLinkMultipleAllObservable(query, "auth-token");
|
|
25
|
+
* console.log(observable.format); // DATAID
|
|
26
|
+
* console.log(observable.order); // "ASC"
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
2
29
|
export declare class SearchLinkMultipleAllObservable {
|
|
30
|
+
/**
|
|
31
|
+
* Array of main composition IDs retrieved from the query.
|
|
32
|
+
* @defaultValue []
|
|
33
|
+
*/
|
|
3
34
|
mainCompositionIds: number[];
|
|
35
|
+
/**
|
|
36
|
+
* The FreeschemaQuery object containing query parameters and configuration.
|
|
37
|
+
* @defaultValue new FreeschemaQuery()
|
|
38
|
+
*/
|
|
4
39
|
query: FreeschemaQuery;
|
|
40
|
+
/**
|
|
41
|
+
* Array of encoded count information strings returned from the API.
|
|
42
|
+
* @defaultValue []
|
|
43
|
+
*/
|
|
5
44
|
countInfoStrings: string[];
|
|
45
|
+
/**
|
|
46
|
+
* Sort order for the query results.
|
|
47
|
+
* @defaultValue "DESC"
|
|
48
|
+
*/
|
|
6
49
|
order: string;
|
|
50
|
+
/**
|
|
51
|
+
* Output format for the query results.
|
|
52
|
+
* @defaultValue DATAID
|
|
53
|
+
*
|
|
54
|
+
* @remarks
|
|
55
|
+
* Valid values include NORMAL, DATAID, JUSTDATA, and ALLID from FormatConstants.
|
|
56
|
+
*/
|
|
7
57
|
format: number;
|
|
58
|
+
/**
|
|
59
|
+
* Flag indicating whether data has been loaded from the API.
|
|
60
|
+
* @defaultValue false
|
|
61
|
+
*/
|
|
8
62
|
isDataLoaded: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Array of concept IDs retrieved from the query.
|
|
65
|
+
* @defaultValue []
|
|
66
|
+
*/
|
|
9
67
|
conceptIds: number[];
|
|
68
|
+
/**
|
|
69
|
+
* Array of internal connection IDs showing relationships between concepts.
|
|
70
|
+
* @defaultValue []
|
|
71
|
+
*/
|
|
10
72
|
internalConnections: number[];
|
|
73
|
+
/**
|
|
74
|
+
* Array of linker IDs representing the types of connections.
|
|
75
|
+
* @defaultValue []
|
|
76
|
+
*/
|
|
11
77
|
linkers: number[];
|
|
78
|
+
/**
|
|
79
|
+
* Array of reverse relationship indicators.
|
|
80
|
+
* @defaultValue []
|
|
81
|
+
*/
|
|
12
82
|
reverse: number[];
|
|
83
|
+
/**
|
|
84
|
+
* The processed data result from the query.
|
|
85
|
+
*
|
|
86
|
+
* @remarks
|
|
87
|
+
* The structure and content of this property depends on the format setting.
|
|
88
|
+
*/
|
|
13
89
|
data: any;
|
|
90
|
+
/**
|
|
91
|
+
* Creates a new SearchLinkMultipleAllObservable instance.
|
|
92
|
+
*
|
|
93
|
+
* @param query - The FreeschemaQuery object containing query parameters
|
|
94
|
+
* @param token - Authentication token for API requests (currently unused in constructor)
|
|
95
|
+
*
|
|
96
|
+
* @remarks
|
|
97
|
+
* The constructor initializes the observable with the provided query and extracts
|
|
98
|
+
* the output format and order settings from the query object. The token parameter
|
|
99
|
+
* is accepted but not currently stored or used within the constructor.
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```typescript
|
|
103
|
+
* const query = new FreeschemaQuery();
|
|
104
|
+
* query.outputFormat = JUSTDATA;
|
|
105
|
+
* query.order = "ASC";
|
|
106
|
+
*
|
|
107
|
+
* const observable = new SearchLinkMultipleAllObservable(query, "my-token");
|
|
108
|
+
* console.log(observable.format); // JUSTDATA
|
|
109
|
+
* console.log(observable.order); // "ASC"
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
14
112
|
constructor(query: FreeschemaQuery, token: string);
|
|
15
113
|
}
|
|
16
114
|
/**
|
|
115
|
+
* Executes a schema query and formats the results according to the specified output format.
|
|
116
|
+
*
|
|
117
|
+
* @param query - The FreeschemaQuery object containing query parameters and configuration
|
|
118
|
+
* @param token - Authentication token for API requests
|
|
119
|
+
* @returns Promise resolving to formatted query results (structure varies by output format)
|
|
120
|
+
*
|
|
121
|
+
* @remarks
|
|
122
|
+
* This function serves as the main entry point for executing schema queries. It performs
|
|
123
|
+
* the following operations:
|
|
124
|
+
* 1. Temporarily changes the output format to ALLID to retrieve all relationship data
|
|
125
|
+
* 2. Calls the FreeschemaQueryApi to execute the query
|
|
126
|
+
* 3. Extracts concept IDs, connections, linkers, and metadata from the result
|
|
127
|
+
* 4. Decodes count information strings
|
|
128
|
+
* 5. Formats the data according to the original output format setting
|
|
129
|
+
*
|
|
130
|
+
* The function supports three output formats:
|
|
131
|
+
* - DATAID: Formatted with data IDs included
|
|
132
|
+
* - JUSTDATA: Formatted with only data, no IDs
|
|
133
|
+
* - NORMAL (or any other value): Standard formatting
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```typescript
|
|
137
|
+
* // Create and configure a query
|
|
138
|
+
* const query = new FreeschemaQuery();
|
|
139
|
+
* query.outputFormat = DATAID;
|
|
140
|
+
* query.order = "DESC";
|
|
141
|
+
* // ... set other query parameters
|
|
142
|
+
*
|
|
143
|
+
* // Execute the query
|
|
144
|
+
* const results = await SchemaQueryListener(query, "auth-token");
|
|
145
|
+
* console.log(results); // Formatted results based on DATAID format
|
|
146
|
+
* ```
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```typescript
|
|
150
|
+
* // Query with JUSTDATA format
|
|
151
|
+
* const query = new FreeschemaQuery();
|
|
152
|
+
* query.outputFormat = JUSTDATA;
|
|
153
|
+
* query.order = "ASC";
|
|
17
154
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* @param page the page which needs to be displayed as per the inpage parameter
|
|
22
|
-
* @param format the format in which the output should be displayed (NORMAL, DATAID,JUSTDATA,DATAIDDATE)
|
|
155
|
+
* const results = await SchemaQueryListener(query, "my-token");
|
|
156
|
+
* // Results contain only data without IDs
|
|
157
|
+
* ```
|
|
23
158
|
*/
|
|
24
159
|
export declare function SchemaQueryListener(query: FreeschemaQuery, token: string): Promise<any>;
|