mftsccs-node 0.2.23 → 0.2.25
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 +41 -29
- package/dist/bundle.js +1 -1
- package/dist/bundle.mjs +1 -0
- package/dist/types/Api/Create/CreateTheConnectionApi.d.ts +4 -9
- package/dist/types/Api/GetAllConcepts.d.ts +0 -4
- package/dist/types/Api/GetAllLinkerConnectionsFromTheConcept.d.ts +1 -1
- package/dist/types/Api/GetAllLinkerConnectionsToTheConcept.d.ts +1 -1
- package/dist/types/Api/GetAllPrefetchConnections.d.ts +0 -3
- package/dist/types/Api/GetConnections/GetConnectionsBetweenApi.d.ts +8 -0
- package/dist/types/Api/GetReservedConnectionIds.d.ts +1 -1
- package/dist/types/Api/RecursiveSearch.d.ts +1 -1
- package/dist/types/Api/Search/FreeschemaQueryApi.d.ts +6 -5
- package/dist/types/Api/Search/Search.d.ts +4 -3
- package/dist/types/Api/Search/SearchInternalApi.d.ts +5 -4
- package/dist/types/Api/Search/SearchLinkMultipleApi.d.ts +4 -4
- package/dist/types/Api/Search/SearchWithLinker.d.ts +5 -4
- package/dist/types/Api/SearchConcept/GetConceptByCharacterAndCategoryApi.d.ts +3 -2
- package/dist/types/Api/SearchConcept/GetConceptByCharacterAndCategoryDirect.d.ts +3 -2
- package/dist/types/Api/View/ViewInternalDataApi.d.ts +3 -4
- package/dist/types/DataStructures/BaseUrl.d.ts +5 -0
- package/dist/types/DataStructures/ConceptData.d.ts +14 -5
- package/dist/types/DataStructures/FetchConnection.d.ts +21 -0
- package/dist/types/DataStructures/ReservedIds.d.ts +11 -16
- package/dist/types/DataStructures/Search/FreeschemaQuery.d.ts +1 -0
- package/dist/types/DataStructures/Transaction/Transaction.d.ts +23 -0
- package/dist/types/DataStructures/User/UserBinaryTree.d.ts +1 -119
- package/dist/types/DataStructures/User/UserNode.d.ts +4 -146
- package/dist/types/Database/NoIndexDb.d.ts +32 -36
- package/dist/types/Services/Common/DecodeCountInfo.d.ts +4 -3
- package/dist/types/Services/Common/ErrorPosting.d.ts +5 -7
- package/dist/types/Services/CreateConnectionBetweenTwoConcepts.d.ts +4 -3
- package/dist/types/Services/CreateTheComposition.d.ts +2 -2
- package/dist/types/Services/CreateTheConnection.d.ts +9 -4
- package/dist/types/Services/CreateTheConnectionGeneral.d.ts +4 -4
- package/dist/types/Services/GetDataFromIndexDb.d.ts +8 -8
- package/dist/types/Services/Http/HttpClient.service.d.ts +7 -0
- package/dist/types/Services/MakeTheTimestamp.d.ts +2 -2
- package/dist/types/Services/PatchComposition.d.ts +10 -15
- package/dist/types/Services/UpdateComposition.d.ts +1 -1
- package/dist/types/app.d.ts +21 -21
- package/package.json +12 -1
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* In-memory database compatibility module for the Node package.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* run without actual database persistence.
|
|
4
|
+
* The original frontend package used IndexedDB. The Node package keeps the same
|
|
5
|
+
* small storage API so existing data structures can run unchanged, but values are
|
|
6
|
+
* stored only in process memory and are lost when the process exits.
|
|
8
7
|
*
|
|
9
8
|
* @module Database/NoIndexDb
|
|
10
9
|
* @see https://documentation.freeschema.com for reference
|
|
11
10
|
*/
|
|
12
11
|
import { SettingData } from "../DataStructures/SettingData";
|
|
13
12
|
/**
|
|
14
|
-
* Opens or returns a reference to the IndexedDB database.
|
|
13
|
+
* Opens or returns a reference to the legacy IndexedDB database handle.
|
|
15
14
|
*
|
|
16
|
-
*
|
|
17
|
-
* from IndexDb without performing any actual initialization.
|
|
15
|
+
* This Node compatibility implementation does not initialize a real database.
|
|
18
16
|
*
|
|
19
17
|
* @param databaseName - The name of the database to open
|
|
20
18
|
* @returns The static IDBDatabase reference from IndexDb.db
|
|
@@ -32,10 +30,10 @@ import { SettingData } from "../DataStructures/SettingData";
|
|
|
32
30
|
*/
|
|
33
31
|
export declare function openDatabase(databaseName: string): IDBDatabase;
|
|
34
32
|
/**
|
|
35
|
-
* Stores an object
|
|
33
|
+
* Stores an object in the in-memory compatibility store.
|
|
36
34
|
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
35
|
+
* Values are not persisted to disk. Use this only as a runtime cache for the
|
|
36
|
+
* current Node process.
|
|
39
37
|
*
|
|
40
38
|
* @param databaseName - The name of the database or object store
|
|
41
39
|
* @param object - The object to store (can be any type)
|
|
@@ -48,15 +46,15 @@ export declare function openDatabase(databaseName: string): IDBDatabase;
|
|
|
48
46
|
* ```
|
|
49
47
|
*
|
|
50
48
|
* @remarks
|
|
51
|
-
* This is
|
|
49
|
+
* This is not durable storage.
|
|
52
50
|
*/
|
|
53
51
|
export declare function storeToDatabase(databaseName: string, object: any): void;
|
|
54
52
|
/**
|
|
55
|
-
* Retrieves statistics and settings from the
|
|
53
|
+
* Retrieves statistics and settings from the in-memory store.
|
|
56
54
|
*
|
|
57
55
|
* Returns a new SettingData instance initialized with default values.
|
|
58
56
|
* This provides a consistent interface for accessing settings even when
|
|
59
|
-
* database functionality is disabled.
|
|
57
|
+
* durable database functionality is disabled.
|
|
60
58
|
*
|
|
61
59
|
* @returns A new SettingData instance with AI features enabled (true)
|
|
62
60
|
*
|
|
@@ -73,10 +71,9 @@ export declare function storeToDatabase(databaseName: string, object: any): void
|
|
|
73
71
|
*/
|
|
74
72
|
export declare function GetStatsFromDatabase(): SettingData;
|
|
75
73
|
/**
|
|
76
|
-
* Updates the AI flag in
|
|
74
|
+
* Updates the AI flag in the in-memory settings store.
|
|
77
75
|
*
|
|
78
|
-
*
|
|
79
|
-
* In this no-op implementation, it does not perform any actual updates.
|
|
76
|
+
* The update is process-local and is not persisted to disk.
|
|
80
77
|
*
|
|
81
78
|
* @param object - The SettingData object containing the new AI flag value
|
|
82
79
|
*
|
|
@@ -88,16 +85,16 @@ export declare function GetStatsFromDatabase(): SettingData;
|
|
|
88
85
|
* ```
|
|
89
86
|
*
|
|
90
87
|
* @remarks
|
|
91
|
-
*
|
|
88
|
+
* Changes are not persisted across process restarts.
|
|
92
89
|
*
|
|
93
90
|
* @see SettingData for the settings data structure
|
|
94
91
|
*/
|
|
95
92
|
export declare function AiUpdateFlag(object: SettingData): void;
|
|
96
93
|
/**
|
|
97
|
-
* Retrieves
|
|
94
|
+
* Retrieves objects from the in-memory store by property and value.
|
|
98
95
|
*
|
|
99
|
-
* This async function
|
|
100
|
-
*
|
|
96
|
+
* This async function mirrors the old IndexedDB API shape while using the
|
|
97
|
+
* process-local compatibility store.
|
|
101
98
|
*
|
|
102
99
|
* @param databaseName - The name of the database or object store
|
|
103
100
|
* @param type - The type of object to retrieve (e.g., 'concept', 'setting')
|
|
@@ -111,14 +108,14 @@ export declare function AiUpdateFlag(object: SettingData): void;
|
|
|
111
108
|
* ```
|
|
112
109
|
*
|
|
113
110
|
* @remarks
|
|
114
|
-
* This is
|
|
111
|
+
* This is not durable storage.
|
|
115
112
|
*/
|
|
116
|
-
export declare function getFromDatabaseWithType(databaseName: string, type: string, id: number): Promise<
|
|
113
|
+
export declare function getFromDatabaseWithType(databaseName: string, type: string, id: number): Promise<any[]>;
|
|
117
114
|
/**
|
|
118
|
-
* Retrieves objects from
|
|
115
|
+
* Retrieves all objects from a named in-memory store.
|
|
119
116
|
*
|
|
120
|
-
* This async function
|
|
121
|
-
*
|
|
117
|
+
* This async function preserves the older IndexedDB-oriented method name while
|
|
118
|
+
* returning data from the process-local compatibility store.
|
|
122
119
|
*
|
|
123
120
|
* @param databaseName - The name of the database or object store
|
|
124
121
|
* @returns Promise resolving to undefined
|
|
@@ -135,12 +132,11 @@ export declare function getFromDatabaseWithType(databaseName: string, type: stri
|
|
|
135
132
|
*
|
|
136
133
|
* @see getFromDatabaseWithType for the current retrieval method
|
|
137
134
|
*/
|
|
138
|
-
export declare function getFromDatabaseWithTypeOld(databaseName: string): Promise<
|
|
135
|
+
export declare function getFromDatabaseWithTypeOld(databaseName: string): Promise<any[]>;
|
|
139
136
|
/**
|
|
140
|
-
* Removes an object from the
|
|
137
|
+
* Removes an object from the in-memory store by ID.
|
|
141
138
|
*
|
|
142
|
-
*
|
|
143
|
-
* implementation, it does not perform any actual deletion.
|
|
139
|
+
* The deletion is process-local and is not persisted to disk.
|
|
144
140
|
*
|
|
145
141
|
* @param databaseName - The name of the database or object store
|
|
146
142
|
* @param id - The numeric ID of the object to remove
|
|
@@ -152,14 +148,14 @@ export declare function getFromDatabaseWithTypeOld(databaseName: string): Promis
|
|
|
152
148
|
* ```
|
|
153
149
|
*
|
|
154
150
|
* @remarks
|
|
155
|
-
* This is
|
|
151
|
+
* This is not durable storage.
|
|
156
152
|
*/
|
|
157
153
|
export declare function removeFromDatabase(databaseName: string, id: number): void;
|
|
158
154
|
/**
|
|
159
|
-
* Retrieves all objects from
|
|
155
|
+
* Retrieves all objects from a local in-memory store.
|
|
160
156
|
*
|
|
161
|
-
* This async function
|
|
162
|
-
*
|
|
157
|
+
* This async function preserves the local IndexedDB API shape while returning
|
|
158
|
+
* process-local data.
|
|
163
159
|
*
|
|
164
160
|
* @param databaseName - The name of the database or object store
|
|
165
161
|
* @returns Promise resolving to undefined
|
|
@@ -171,8 +167,8 @@ export declare function removeFromDatabase(databaseName: string, id: number): vo
|
|
|
171
167
|
* ```
|
|
172
168
|
*
|
|
173
169
|
* @remarks
|
|
174
|
-
* This is
|
|
170
|
+
* This is not durable storage.
|
|
175
171
|
*
|
|
176
172
|
* @see LocalIndexDb for local database operations
|
|
177
173
|
*/
|
|
178
|
-
export declare function getAllFromLocalDb(databaseName: string): Promise<
|
|
174
|
+
export declare function getAllFromLocalDb(databaseName: string): Promise<any[]>;
|
|
@@ -33,7 +33,7 @@ export declare function DecodeCountInfo(countStrings?: string[]): CountInfo[];
|
|
|
33
33
|
*
|
|
34
34
|
* @async
|
|
35
35
|
* @param {CountInfo[]} countInfos - Array of CountInfo objects to process
|
|
36
|
-
* @returns {Promise<any>} A promise that resolves to a dictionary mapping concept IDs to enriched CountInfo objects
|
|
36
|
+
* @returns {Promise<any>} A promise that resolves to a dictionary mapping concept IDs to arrays of enriched CountInfo objects
|
|
37
37
|
*
|
|
38
38
|
* @example
|
|
39
39
|
* ```typescript
|
|
@@ -43,8 +43,8 @@ export declare function DecodeCountInfo(countStrings?: string[]): CountInfo[];
|
|
|
43
43
|
* ];
|
|
44
44
|
* const dictionary = await GetConnectionTypeForCount(countInfos);
|
|
45
45
|
* // dictionary = {
|
|
46
|
-
* // 123: { conceptId: 123, connectionTypeId: 456, count: 42, connectionType: "follows" },
|
|
47
|
-
* // 789: { conceptId: 789, connectionTypeId: 456, count: 15, connectionType: "follows" }
|
|
46
|
+
* // 123: [{ conceptId: 123, connectionTypeId: 456, count: 42, connectionType: "follows" }],
|
|
47
|
+
* // 789: [{ conceptId: 789, connectionTypeId: 456, count: 15, connectionType: "follows" }]
|
|
48
48
|
* // }
|
|
49
49
|
* ```
|
|
50
50
|
*
|
|
@@ -52,6 +52,7 @@ export declare function DecodeCountInfo(countStrings?: string[]): CountInfo[];
|
|
|
52
52
|
* - Fetches concept objects for each connectionTypeId
|
|
53
53
|
* - Adds connectionType (character value) to each CountInfo
|
|
54
54
|
* - Returns dictionary indexed by conceptId for fast lookup
|
|
55
|
+
* - Preserves multiple counts for the same concept across different connection types
|
|
55
56
|
* - Used by formatting functions to add count information
|
|
56
57
|
*/
|
|
57
58
|
export declare function GetConnectionTypeForCount(countInfos: CountInfo[]): Promise<any>;
|
|
@@ -5,25 +5,23 @@
|
|
|
5
5
|
import { HttpResponse } from "../Http/HttpClient.service";
|
|
6
6
|
/**
|
|
7
7
|
* Handles HTTP errors by creating and throwing structured error responses.
|
|
8
|
-
* Specifically handles 401 Unauthorized errors.
|
|
9
8
|
*
|
|
10
|
-
* @param {Response} response - The HTTP
|
|
11
|
-
* @throws {FreeSchemaResponse} Throws a structured error response for
|
|
9
|
+
* @param {Response | HttpResponse} response - The HTTP response object to process
|
|
10
|
+
* @throws {FreeSchemaResponse} Throws a structured error response for any non-OK response
|
|
12
11
|
*
|
|
13
12
|
* @example
|
|
14
13
|
* ```typescript
|
|
15
14
|
* const response = await fetch("https://api.example.com/data");
|
|
16
15
|
* HandleHttpError(response);
|
|
17
|
-
* // Throws FreeSchemaResponse if
|
|
16
|
+
* // Throws FreeSchemaResponse if response.ok is false
|
|
18
17
|
* ```
|
|
19
18
|
*
|
|
20
19
|
* @remarks
|
|
21
|
-
* -
|
|
20
|
+
* - Handles any non-2xx status code
|
|
22
21
|
* - Creates FreeSchemaResponse with status text, success=false, status code, and URL
|
|
23
|
-
* - Other status codes are not handled (function returns normally)
|
|
24
22
|
* - Useful for API call error handling
|
|
25
23
|
*/
|
|
26
|
-
export declare function HandleHttpError(response: Response): void;
|
|
24
|
+
export declare function HandleHttpError(response: Response | HttpResponse): void;
|
|
27
25
|
export declare function HandleHttpErrorHttp(response: HttpResponse): void;
|
|
28
26
|
/**
|
|
29
27
|
* Handles internal application errors by creating and throwing structured error responses.
|
|
@@ -32,7 +32,7 @@ import { Connection } from "../DataStructures/Connection";
|
|
|
32
32
|
* @param both - If true, creates connections in both directions (default: false)
|
|
33
33
|
* @param count - If true, maintains a count of relationships for this linker type (default: false)
|
|
34
34
|
*
|
|
35
|
-
* @returns A promise that resolves to the created forward Connection object
|
|
35
|
+
* @returns A promise that resolves to the created forward Connection object with a reserved ID
|
|
36
36
|
*
|
|
37
37
|
* @example
|
|
38
38
|
* ```typescript
|
|
@@ -71,6 +71,7 @@ import { Connection } from "../DataStructures/Connection";
|
|
|
71
71
|
* - Forward connection type pattern: `{sourceType}_s_{linker}_s`
|
|
72
72
|
* - Backward connection type pattern: `{targetType}_s_{linker}_by`
|
|
73
73
|
* - Count concept pattern: `{type}_s_{linker}_count`
|
|
74
|
+
* - Uses reserved connection IDs for forward and backward connections
|
|
74
75
|
* - Uses session information ID 999 and access level 4 as defaults
|
|
75
76
|
* - Counting creates/updates a separate count concept for relationship analytics
|
|
76
77
|
* - The backward connection is created first if both=true
|
|
@@ -199,12 +200,12 @@ export declare function CountRelationship(linker: string, concept: Concept, pass
|
|
|
199
200
|
* - Uses CreateTheConnectionGeneral for proper ID reservation and persistence
|
|
200
201
|
* - Forward connection type pattern: `{sourceType}_s_{linker}_s`
|
|
201
202
|
* - Backward connection type pattern: `{targetType}_s_{linker}_by`
|
|
202
|
-
* -
|
|
203
|
+
* - Forward and backward connections both use CreateTheConnectionGeneral
|
|
203
204
|
* - Uses session information ID 999, order 1000, and access level 4
|
|
204
205
|
* - Connection is marked for update (toUpdate = true) via CreateTheConnectionGeneral
|
|
205
206
|
* - Recommended for production use over CreateConnectionBetweenTwoConcepts
|
|
206
207
|
*
|
|
207
|
-
* @see {@link CreateConnectionBetweenTwoConcepts} for the
|
|
208
|
+
* @see {@link CreateConnectionBetweenTwoConcepts} for the compatibility export
|
|
208
209
|
* @see {@link CreateTheConnectionGeneral} for the underlying connection creation
|
|
209
210
|
* @see {@link CountRelationship} for relationship counting implementation
|
|
210
211
|
*/
|
|
@@ -90,7 +90,7 @@ import { Concept } from "../DataStructures/Concept";
|
|
|
90
90
|
* - Primitive values (strings, numbers) are stored as characterValue in leaf concepts
|
|
91
91
|
* - Nested objects and arrays are recursively converted into sub-compositions
|
|
92
92
|
* - All concepts are connected using the mainKey (root concept ID) as the connection type
|
|
93
|
-
* - Uses
|
|
93
|
+
* - Uses reserved connection IDs for persistence
|
|
94
94
|
* - Default values: userId=999, accessId=4, sessionInformationId=999
|
|
95
95
|
* - The function modifies SyncData by adding all created concepts and connections
|
|
96
96
|
* - Complex objects become type concepts with isComposition=true
|
|
@@ -98,6 +98,6 @@ import { Concept } from "../DataStructures/Concept";
|
|
|
98
98
|
*
|
|
99
99
|
* @see {@link GetComposition} for reconstructing compositions back to JSON
|
|
100
100
|
* @see {@link MakeTheInstanceConcept} for individual concept creation
|
|
101
|
-
* @see {@link
|
|
101
|
+
* @see {@link CreateTheConnectionGeneral} for connection creation logic
|
|
102
102
|
*/
|
|
103
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>;
|
|
@@ -8,13 +8,18 @@
|
|
|
8
8
|
* @module CreateTheConnection
|
|
9
9
|
*/
|
|
10
10
|
import { Connection } from "../DataStructures/Connection";
|
|
11
|
+
type ConnectionConceptIds = {
|
|
12
|
+
ofTheConceptId: number;
|
|
13
|
+
toTheConceptId: number;
|
|
14
|
+
};
|
|
15
|
+
export declare function validateConnectionConceptIds(ofTheConceptId: number | string, toTheConceptId: number | string): ConnectionConceptIds;
|
|
11
16
|
/**
|
|
12
17
|
* Creates a temporary connection between two concepts with default settings.
|
|
13
18
|
*
|
|
14
19
|
* This function establishes a basic connection relationship between a source concept
|
|
15
20
|
* (ofTheConcept) and a target concept (toTheConcept). The created connection is marked
|
|
16
21
|
* as temporary (isTemp = true) and assigned a random ID. It automatically handles the
|
|
17
|
-
*
|
|
22
|
+
* Self-referencing connections are rejected before they can enter the sync queue.
|
|
18
23
|
*
|
|
19
24
|
* The function uses default values for security (0), access level (4), and order (1),
|
|
20
25
|
* making it suitable for quick connection creation during prototyping or when advanced
|
|
@@ -48,8 +53,7 @@ import { Connection } from "../DataStructures/Connection";
|
|
|
48
53
|
*
|
|
49
54
|
* @remarks
|
|
50
55
|
* - The connection is marked as temporary (isTemp = true) and assigned a random ID
|
|
51
|
-
* - Self-referencing connections
|
|
52
|
-
* specially by setting ofTheConceptId to 0 and toTheConceptId to 1
|
|
56
|
+
* - Self-referencing connections are rejected
|
|
53
57
|
* - Default security level is set to 0 and access level to 4
|
|
54
58
|
* - The connection is automatically added to SyncData for later synchronization
|
|
55
59
|
* - For production use with reserved IDs and more control, consider using CreateTheConnectionGeneral
|
|
@@ -58,4 +62,5 @@ import { Connection } from "../DataStructures/Connection";
|
|
|
58
62
|
* @see {@link Connection} for the connection data structure
|
|
59
63
|
* @see {@link SyncData.AddConnection} for how connections are queued for sync
|
|
60
64
|
*/
|
|
61
|
-
export declare function createTheConnection(ofTheConceptId: number, ofTheConceptUserId: number, toTheConceptId: number, toTheConceptUserId: number, typeId: number, sessionInformationId: number, sessionInformationUserId: number): Connection;
|
|
65
|
+
export declare function createTheConnection(ofTheConceptId: number | string, ofTheConceptUserId: number, toTheConceptId: number | string, toTheConceptUserId: number, typeId: number, sessionInformationId: number, sessionInformationUserId: number): Connection;
|
|
66
|
+
export {};
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @module CreateTheConnectionGeneral
|
|
9
9
|
*/
|
|
10
|
-
import { Concept } from "../
|
|
10
|
+
import type { Concept } from "../DataStructures/Concept";
|
|
11
11
|
import { Connection } from "../DataStructures/Connection";
|
|
12
|
-
import { InnerActions } from "../DataStructures/Transaction/Transaction";
|
|
12
|
+
import type { InnerActions } from "../DataStructures/Transaction/Transaction";
|
|
13
13
|
/**
|
|
14
14
|
* Creates a permanent connection between two concepts with reserved ID and full configuration.
|
|
15
15
|
*
|
|
@@ -61,7 +61,7 @@ import { InnerActions } from "../DataStructures/Transaction/Transaction";
|
|
|
61
61
|
* - Uses reserved IDs from ReservedConnectionIds for guaranteed uniqueness
|
|
62
62
|
* - Connection is marked as non-temporary (isTemp = false) for persistence
|
|
63
63
|
* - Sets toUpdate = true to ensure database synchronization
|
|
64
|
-
* - Self-referencing connections are
|
|
64
|
+
* - Self-referencing connections are rejected before they can enter the sync queue
|
|
65
65
|
* - The connection is added to both SyncData and the provided actions object
|
|
66
66
|
* - If passedUserId is 999, the function defaults to using ofTheConceptUserId
|
|
67
67
|
*
|
|
@@ -69,7 +69,7 @@ import { InnerActions } from "../DataStructures/Transaction/Transaction";
|
|
|
69
69
|
* @see {@link CreateConnection} for a simplified high-level connection API
|
|
70
70
|
* @see {@link ReservedConnectionIds.getId} for ID reservation mechanism
|
|
71
71
|
*/
|
|
72
|
-
export declare function CreateTheConnectionGeneral(ofTheConceptId: number, ofTheConceptUserId: number, toTheConceptId: number, toTheConceptUserId: number, typeId: number, sessionInformationId: number, sessionInformationUserId: number, orderId?: number, accessId?: number, passedUserId?: number, actions?: InnerActions): Promise<Connection>;
|
|
72
|
+
export declare function CreateTheConnectionGeneral(ofTheConceptId: number | string, ofTheConceptUserId: number, toTheConceptId: number | string, toTheConceptUserId: number, typeId: number, sessionInformationId: number, sessionInformationUserId: number, orderId?: number, accessId?: number, passedUserId?: number, actions?: InnerActions): Promise<Connection>;
|
|
73
73
|
/**
|
|
74
74
|
* Creates a connection between two concepts using a type string identifier.
|
|
75
75
|
*
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Runtime Cache Hydration Service
|
|
3
3
|
*
|
|
4
|
-
* This module
|
|
5
|
-
* in-memory data structures. It
|
|
6
|
-
*
|
|
4
|
+
* This module loads data from the Node package's process-local compatibility store
|
|
5
|
+
* into in-memory data structures. It keeps the original IndexedDB-oriented function
|
|
6
|
+
* names used by the frontend package, but it does not provide durable storage.
|
|
7
7
|
*
|
|
8
8
|
* The service supports two data contexts:
|
|
9
|
-
* - Global/synced data: Loaded from
|
|
10
|
-
* - Local data: Loaded from local
|
|
9
|
+
* - Global/synced data: Loaded from the process-local compatibility store
|
|
10
|
+
* - Local data: Loaded from local process memory for API compatibility
|
|
11
11
|
*
|
|
12
12
|
* @module GetDataFromIndexDb
|
|
13
13
|
*/
|
|
14
14
|
/**
|
|
15
|
-
* Loads data from the standard
|
|
15
|
+
* Loads data from the standard process-local stores into memory.
|
|
16
16
|
*
|
|
17
17
|
* This is the main entry point for initializing the application's in-memory data structures
|
|
18
|
-
* from
|
|
18
|
+
* from runtime cache records. Currently focuses on loading connections, with concept
|
|
19
19
|
* loading functionality commented out for optimization or architectural reasons.
|
|
20
20
|
*
|
|
21
21
|
* The function delegates to specialized helpers to load different data types, ensuring
|
|
@@ -100,6 +100,13 @@ export declare class HttpResponse {
|
|
|
100
100
|
* ```
|
|
101
101
|
*/
|
|
102
102
|
export declare function requestWithRetry(method: string, url: string, headers?: Record<string, string>, body?: any, maxRetries?: number): Promise<HttpResponse>;
|
|
103
|
+
/**
|
|
104
|
+
* Fetch-compatible wrapper backed by requestWithRetry.
|
|
105
|
+
*
|
|
106
|
+
* Use this when migrating existing fetch call sites that expect `ok`, `json()`,
|
|
107
|
+
* and `text()` while still needing automatic token refresh on 401.
|
|
108
|
+
*/
|
|
109
|
+
export declare function fetchWithRetry(url: string, init?: RequestInit, maxRetries?: number): Promise<HttpResponse>;
|
|
103
110
|
/**
|
|
104
111
|
* Convenience method for POST requests with automatic retry on 401.
|
|
105
112
|
*
|
|
@@ -30,8 +30,8 @@ import { Concept } from "../DataStructures/Concept";
|
|
|
30
30
|
* - Category ID is fixed at 4 for timestamp concepts
|
|
31
31
|
* - Referent ID is set to 0 (no referent concept)
|
|
32
32
|
* - Security ID is fixed at 999
|
|
33
|
-
* -
|
|
34
|
-
* -
|
|
33
|
+
* - Uses the provided sessionInformationId, defaulting to 999
|
|
34
|
+
* - Uses the provided accessId
|
|
35
35
|
* - All user IDs are derived from the userId parameter
|
|
36
36
|
* - Type concept is created before the timestamp concept
|
|
37
37
|
*
|
|
@@ -20,8 +20,8 @@ import { Concept } from "../DataStructures/Concept";
|
|
|
20
20
|
* @param ofConcept - The source concept from which the connection originates
|
|
21
21
|
* @param MainConcept - The main composition concept that contains both concepts and their connection
|
|
22
22
|
* @param toConcept - The target concept to which the connection points
|
|
23
|
-
* @returns The
|
|
24
|
-
* or
|
|
23
|
+
* @returns The connections between the two concepts within the composition context,
|
|
24
|
+
* or an empty array if no such connection exists
|
|
25
25
|
*
|
|
26
26
|
* @example
|
|
27
27
|
* ```typescript
|
|
@@ -33,8 +33,8 @@ import { Concept } from "../DataStructures/Concept";
|
|
|
33
33
|
* const profileConcept: Concept = { id: 456, type: "profile", ... };
|
|
34
34
|
* const compositionConcept: Concept = { id: 789, type: "composition", ... };
|
|
35
35
|
*
|
|
36
|
-
* const
|
|
37
|
-
* // Returns the
|
|
36
|
+
* const connections = await PatchComposition(userConcept, compositionConcept, profileConcept);
|
|
37
|
+
* // Returns the connections linking user to profile within the composition
|
|
38
38
|
* ```
|
|
39
39
|
*
|
|
40
40
|
* @example
|
|
@@ -44,13 +44,13 @@ import { Concept } from "../DataStructures/Concept";
|
|
|
44
44
|
* const addressConcept = await GetTheConcept(456);
|
|
45
45
|
* const mainComposition = await GetTheConcept(789);
|
|
46
46
|
*
|
|
47
|
-
* const
|
|
47
|
+
* const existingConnections = await PatchComposition(
|
|
48
48
|
* userConcept,
|
|
49
49
|
* mainComposition,
|
|
50
50
|
* addressConcept
|
|
51
51
|
* );
|
|
52
52
|
*
|
|
53
|
-
* if (
|
|
53
|
+
* if (existingConnections.length > 0) {
|
|
54
54
|
* console.log("Connection already exists");
|
|
55
55
|
* } else {
|
|
56
56
|
* console.log("No connection found, can create new one");
|
|
@@ -64,9 +64,9 @@ import { Concept } from "../DataStructures/Concept";
|
|
|
64
64
|
* const toConcept = await GetTheConcept(222);
|
|
65
65
|
* const composition = await GetTheConcept(333);
|
|
66
66
|
*
|
|
67
|
-
* const
|
|
68
|
-
* if (
|
|
69
|
-
* await DeleteConnectionById(
|
|
67
|
+
* const connections = await PatchComposition(fromConcept, composition, toConcept);
|
|
68
|
+
* if (connections.length > 0) {
|
|
69
|
+
* await DeleteConnectionById(connections[0].id);
|
|
70
70
|
* }
|
|
71
71
|
* ```
|
|
72
72
|
*
|
|
@@ -83,11 +83,6 @@ import { Concept } from "../DataStructures/Concept";
|
|
|
83
83
|
* - This prevents retrieving connections from other compositions that might link the same concepts
|
|
84
84
|
* - Provides composition-scoped connection lookup
|
|
85
85
|
*
|
|
86
|
-
* **Return Value:**
|
|
87
|
-
* - The function calls an API method but doesn't explicitly handle the return
|
|
88
|
-
* - The connection variable is assigned but not returned in the current implementation
|
|
89
|
-
* - This may be an incomplete implementation that needs a return statement
|
|
90
|
-
*
|
|
91
86
|
* **Use Cases:**
|
|
92
87
|
* - Verifying if a connection exists before creating a new one
|
|
93
88
|
* - Finding the connection ID for deletion operations
|
|
@@ -104,4 +99,4 @@ import { Concept } from "../DataStructures/Concept";
|
|
|
104
99
|
* @see {@link Connection} for the connection data structure
|
|
105
100
|
* @see {@link UpdateComposition} for composition update operations
|
|
106
101
|
*/
|
|
107
|
-
export default function PatchComposition(ofConcept: Concept, MainConcept: Concept, toConcept: Concept):
|
|
102
|
+
export default function PatchComposition(ofConcept: Concept, MainConcept: Concept, toConcept: Concept): Promise<import("../app").Connection[]>;
|
|
@@ -118,7 +118,7 @@ import { PatcherStructure } from '../DataStructures/PatcherStructure';
|
|
|
118
118
|
* @see {@link CreateTheCompositionWithCache} for creating nested compositions
|
|
119
119
|
* @see {@link GetTheConcept} for concept retrieval
|
|
120
120
|
* @see {@link MakeTheInstanceConcept} for creating new concept instances
|
|
121
|
-
* @see {@link
|
|
121
|
+
* @see {@link CreateTheConnectionGeneral} for creating connections between concepts
|
|
122
122
|
* @see {@link DeleteConnectionById} for connection deletion
|
|
123
123
|
* @see {@link SyncData.SyncDataOnline} for backend synchronization
|
|
124
124
|
*/
|
package/dist/types/app.d.ts
CHANGED
|
@@ -7,31 +7,28 @@
|
|
|
7
7
|
* @see {@link https://documentation.freeschema.com} for detailed documentation
|
|
8
8
|
*/
|
|
9
9
|
export { init, updateAccessToken };
|
|
10
|
-
export { getOAuthToken, refreshOAuthToken
|
|
11
|
-
export {
|
|
10
|
+
export { getOAuthToken, refreshOAuthToken } from './Services/oauth/CallOauth.service';
|
|
11
|
+
export type { OAuthResponse } from './Services/oauth/CallOauth.service';
|
|
12
|
+
export { requestWithRetry, postWithRetry, getWithRetry, putWithRetry, deleteWithRetry, patchWithRetry, fetchWithRetry, HttpResponse, TokenRefreshError } from './Services/Http/HttpClient.service';
|
|
12
13
|
export { SplitStrings } from './Services/SplitStrings';
|
|
13
14
|
export { GetRequestHeader, GetRequestHeaderWithAuthorization } from './Services/Security/GetRequestHeader';
|
|
14
15
|
export { GetCompositionList, GetCompositionListWithId } from './Services/GetCompositionList';
|
|
15
|
-
export { GetCompositionListLocal, GetCompositionListLocalWithId } from './Services/Local/GetCompositionListLocal';
|
|
16
16
|
export { GetAllConnectionsOfComposition } from './Api/GetAllConnectionsOfComposition';
|
|
17
17
|
export { GetComposition, GetCompositionWithId, recursiveFetch, GetCompositionWithAllIds } from './Services/GetComposition';
|
|
18
|
-
export { GetCompositionLocal, GetCompositionLocalWithId } from './Services/Local/GetCompositionLocal';
|
|
19
18
|
export { default as CreateComposition } from './Services/CreateTheComposition';
|
|
20
|
-
export { CreateTheCompositionLocal } from './Services/Local/CreateTheCompositionLocal';
|
|
21
19
|
export { CreateConnectionBetweenTwoConcepts, CreateConnectionBetweenTwoConceptsGeneral } from './Services/CreateConnectionBetweenTwoConcepts';
|
|
22
20
|
export { default as GetTheConcept } from './Services/GetTheConcept';
|
|
23
21
|
export { default as MakeTheInstanceConcept } from './Services/MakeTheInstanceConcept';
|
|
24
|
-
export { MakeTheInstanceConceptLocal } from './Services/Local/MakeTheInstanceConceptLocal';
|
|
25
22
|
export { storeToDatabase, getFromDatabaseWithType, getFromDatabaseWithTypeOld } from './Database/NoIndexDb';
|
|
26
|
-
export { createTheConnection as CreateTheConnection } from './Services/CreateTheConnection';
|
|
27
23
|
export { default as GetConceptByCharacter } from './Services/GetConceptByCharacter';
|
|
28
24
|
export { GetLink, GetLinkRaw } from './Services/GetLink';
|
|
29
25
|
export { CreateDefaultConcept } from './Services/CreateDefaultConcept';
|
|
26
|
+
export { CreateDefaultLConcept } from './Services/Local/CreateDefaultLConcept';
|
|
30
27
|
export { MakeTheTypeConcept } from './Services/MakeTheTypeConcept';
|
|
31
28
|
export { MakeTheTypeConceptApi } from './Api/MakeTheTypeConceptApi';
|
|
32
29
|
export { GetLinkerConnectionFromConcepts, GetLinkerConnectionToConcepts } from './Services/GetLinkerConnectionFromConcept';
|
|
33
30
|
export { DeleteConceptById } from './Services/DeleteConcept';
|
|
34
|
-
export { DeleteConnectionById } from './Services/DeleteConnection';
|
|
31
|
+
export { DeleteConnectionById, DeleteConnectionByIdBulk } from './Services/DeleteConnection';
|
|
35
32
|
export { TrashTheConcept } from './Api/Delete/DeleteConceptInBackend';
|
|
36
33
|
export { GetConnectionById } from './Services/GetConnections';
|
|
37
34
|
export { MakeTheTimestamp } from './Services/MakeTheTimestamp';
|
|
@@ -54,12 +51,9 @@ export {} from './Api/GetConceptByCharacterAndType';
|
|
|
54
51
|
export { GetRelation, GetRelationRaw } from './Services/GetRelation';
|
|
55
52
|
export { recursiveFetchNew } from './Services/Composition/BuildComposition';
|
|
56
53
|
export { CreateTheCompositionWithCache } from './Services/Composition/CreateCompositionCache';
|
|
57
|
-
export { CreateDefaultLConcept } from './Services/Local/CreateDefaultLConcept';
|
|
58
54
|
export { CreateTheConnectionGeneral, CreateConnection } from './Services/CreateTheConnectionGeneral';
|
|
59
|
-
export { CreateTheConnectionLocal } from './Services/Local/CreateTheConnectionLocal';
|
|
60
55
|
export { GetUserGhostId, AddGhostConcept, GetUserGhostConnectionId, AddGhostConnection } from './Services/User/UserTranslation';
|
|
61
56
|
export { SearchLinkMultipleAll, FormatFromConnections } from './Services/Search/SearchLinkMultiple';
|
|
62
|
-
export { UpdateCompositionLocal } from './Services/Local/UpdateCompositionLocal';
|
|
63
57
|
export { GetCompositionFromConnectionsWithDataIdInObject } from './Services/GetCompositionBulk';
|
|
64
58
|
export { ViewInternalData } from './Services/View/ViewInternalData';
|
|
65
59
|
export { convertFromLConceptToConcept } from './Services/Conversion/ConvertConcepts';
|
|
@@ -80,9 +74,9 @@ export { ConceptsData } from './DataStructures/ConceptData';
|
|
|
80
74
|
export { ConnectionData } from './DataStructures/ConnectionData';
|
|
81
75
|
export { BinaryTree } from './DataStructures/BinaryTree';
|
|
82
76
|
export { SearchQuery } from './DataStructures/SearchQuery';
|
|
83
|
-
export { SignupModel } from './DataStructures/SignupModel';
|
|
84
|
-
export { SigninModel } from './DataStructures/SigninModel';
|
|
85
|
-
export { FreeschemaResponse } from './DataStructures/Responses/StandardResponses';
|
|
77
|
+
export type { SignupModel } from './DataStructures/SignupModel';
|
|
78
|
+
export type { SigninModel } from './DataStructures/SigninModel';
|
|
79
|
+
export type { FreeschemaResponse } from './DataStructures/Responses/StandardResponses';
|
|
86
80
|
export { PatcherStructure } from './DataStructures/PatcherStructure';
|
|
87
81
|
export { SessionData } from './DataStructures/Session/SessionData';
|
|
88
82
|
export { Composition } from './DataStructures/Composition/Composition';
|
|
@@ -99,10 +93,15 @@ export { TokenStorage } from './DataStructures/Security/TokenStorage';
|
|
|
99
93
|
export { SchemaQueryListener } from './WrapperFunctions/SchemaQueryObservable';
|
|
100
94
|
export { FreeschemaQuery } from './DataStructures/Search/FreeschemaQuery';
|
|
101
95
|
export { GiveConnection, GetAllTheConnectionsByTypeAndOfTheConcept } from './Services/Delete/GetAllConnectionByType';
|
|
96
|
+
export { GetConnectionsBetweenApi } from './Api/GetConnections/GetConnectionsBetweenApi';
|
|
97
|
+
export { buildFetchConnection } from './DataStructures/FetchConnection';
|
|
98
|
+
export type { FetchConnection, FetchConnectionQuery } from './DataStructures/FetchConnection';
|
|
102
99
|
export { DATAID, NORMAL, JUSTDATA, ALLID, DATAIDDATE, RAW, LISTNORMAL, DATAV2 } from './Constants/FormatConstants';
|
|
103
100
|
export { AccessControlService } from './Services/AccessControl/AccessControlService';
|
|
104
101
|
export { PermissionSet } from './Services/AccessControl/PermissionSet';
|
|
105
102
|
export { Transaction } from './DataStructures/Transaction/Transaction';
|
|
103
|
+
export type { InnerActions } from './DataStructures/Transaction/Transaction';
|
|
104
|
+
export { ReservedIds, ReservedConnectionIds } from './DataStructures/ReservedIds';
|
|
106
105
|
/**
|
|
107
106
|
* Updates the bearer access token used for authenticating API requests to the backend.
|
|
108
107
|
* This token is stored globally and used by all API calls that require authentication.
|
|
@@ -126,11 +125,11 @@ declare function updateAccessToken(accessToken?: string): void;
|
|
|
126
125
|
*
|
|
127
126
|
* 1. Sets up base URLs for the main API and AI services
|
|
128
127
|
* 2. Stores the authentication token for API requests (or obtains one via OAuth)
|
|
129
|
-
* 3. Initializes the system
|
|
128
|
+
* 3. Initializes the system and process-local compatibility store
|
|
130
129
|
* 4. Creates binary trees from concept data for efficient querying (by ID, character, and type)
|
|
131
|
-
* 5. Creates local binary trees for
|
|
132
|
-
* 6. Loads connection data from
|
|
133
|
-
* 7. Loads local connection data
|
|
130
|
+
* 5. Creates local binary trees for compatibility with frontend-origin APIs
|
|
131
|
+
* 6. Loads connection data from process-local storage into memory
|
|
132
|
+
* 7. Loads local connection data from process-local storage
|
|
134
133
|
*
|
|
135
134
|
* All data loading operations run in parallel for optimal performance. The IdentifierFlags
|
|
136
135
|
* are updated as each operation completes to indicate which data structures are ready for use.
|
|
@@ -191,8 +190,9 @@ declare function updateAccessToken(accessToken?: string): void;
|
|
|
191
190
|
* ```
|
|
192
191
|
*
|
|
193
192
|
* @remarks
|
|
194
|
-
* The initialization process
|
|
195
|
-
*
|
|
193
|
+
* The initialization process returns a Promise that resolves after OAuth setup,
|
|
194
|
+
* system initialization, and all cache hydration tasks complete. IdentifierFlags
|
|
195
|
+
* are also updated for consumers that poll readiness:
|
|
196
196
|
* - `isDataLoaded`, `isCharacterLoaded`, `isTypeLoaded` - Remote concept data ready
|
|
197
197
|
* - `isLocalDataLoaded`, `isLocalTypeLoaded`, `isLocalCharacterLoaded` - Local concept data ready
|
|
198
198
|
* - `isConnectionLoaded`, `isConnectionTypeLoaded` - Remote connection data ready
|
|
@@ -204,4 +204,4 @@ declare function updateAccessToken(accessToken?: string): void;
|
|
|
204
204
|
* @see CreateBinaryTreeFromData for concept tree creation
|
|
205
205
|
* @see https://documentation.freeschema.com/#installation for setup guide
|
|
206
206
|
*/
|
|
207
|
-
declare function init(url?: string, nodeUrl?: string, applicationName?: string, config?: CCSConfig): void
|
|
207
|
+
declare function init(url?: string, nodeUrl?: string, applicationName?: string, config?: CCSConfig): Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mftsccs-node",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.25",
|
|
4
4
|
"environment": "production",
|
|
5
5
|
"description": "Full Pack of concept and connection system",
|
|
6
6
|
"main": "dist/bundle.js",
|
|
7
|
+
"module": "dist/bundle.mjs",
|
|
7
8
|
"types": "dist/types/app.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/types/app.d.ts",
|
|
12
|
+
"import": "./dist/bundle.mjs",
|
|
13
|
+
"require": "./dist/bundle.js",
|
|
14
|
+
"default": "./dist/bundle.js"
|
|
15
|
+
},
|
|
16
|
+
"./dist/*": "./dist/*",
|
|
17
|
+
"./package.json": "./package.json"
|
|
18
|
+
},
|
|
8
19
|
"files": [
|
|
9
20
|
"dist",
|
|
10
21
|
"LICENSE",
|