mftsccs-node 0.0.76 → 0.0.78-dev
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/dist/bundle.js +1 -1
- package/dist/bundle.mjs +1 -1
- package/dist/types/Api/MakeTheTypeConceptApi.d.ts +1 -30
- package/dist/types/DataStructures/BaseUrl.d.ts +11 -0
- package/dist/types/DataStructures/CCSConfig.d.ts +13 -2
- package/dist/types/DataStructures/Transaction/Transaction.d.ts +2 -0
- package/dist/types/Services/CreateReferentConcept.d.ts +3 -0
- package/dist/types/Services/CreateTypeConcept.d.ts +3 -0
- package/dist/types/Services/cacheService.d.ts +6 -0
- package/dist/types/app.d.ts +3 -0
- package/package.json +1 -1
|
@@ -8,35 +8,6 @@
|
|
|
8
8
|
import { Concept } from "../DataStructures/Concept";
|
|
9
9
|
/**
|
|
10
10
|
* Retrieves or creates a type concept based on a string identifier.
|
|
11
|
-
* Type concepts
|
|
12
|
-
*
|
|
13
|
-
* This function first attempts to find an existing type concept locally, then queries the backend
|
|
14
|
-
* if not found. If the concept doesn't exist in the backend, it creates a new type concept.
|
|
15
|
-
* The function uses caching to prevent duplicate requests for the same type.
|
|
16
|
-
*
|
|
17
|
-
* @param type - The string identifier for the type concept (e.g., "the_person", "the_location")
|
|
18
|
-
* @param userId - The user ID associated with the request
|
|
19
|
-
* @returns A promise that resolves to the Concept object representing the type
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```typescript
|
|
23
|
-
* // Get or create a "person" type concept
|
|
24
|
-
* const personType = await MakeTheTypeConceptApi('the_person', 123);
|
|
25
|
-
* console.log('Person type ID:', personType.id);
|
|
26
|
-
*
|
|
27
|
-
* // Use the type concept when creating new concepts
|
|
28
|
-
* const newPerson = await CreateConcept('John Doe', personType.id);
|
|
29
|
-
* ```
|
|
30
|
-
*
|
|
31
|
-
* @remarks
|
|
32
|
-
* - Uses local caching to prevent duplicate simultaneous requests
|
|
33
|
-
* - First searches for existing concept via GetConceptByCharacterAndCategory
|
|
34
|
-
* - Creates new type concept in backend if not found or if typeId is 4 (unknown type)
|
|
35
|
-
* - Automatically adds the retrieved concept to ConceptsData for local access
|
|
36
|
-
* - Cache entries are cleaned up after the fetch completes
|
|
37
|
-
* - Returns a default concept with id=0 if errors occur
|
|
38
|
-
*
|
|
39
|
-
* @see GetConceptByCharacterAndCategory for local concept searching
|
|
40
|
-
* @see MakeTheNameInBackend for creating named concepts
|
|
11
|
+
* Type concepts define categories and classifications used in the Concept Connection System.
|
|
41
12
|
*/
|
|
42
13
|
export declare function MakeTheTypeConceptApi(type: string, userId: number): Promise<Concept>;
|
|
@@ -26,6 +26,12 @@
|
|
|
26
26
|
export declare class BaseUrl {
|
|
27
27
|
/** Base URL for the main CCS backend API server */
|
|
28
28
|
static BASE_URL: string;
|
|
29
|
+
/** Current cache server URL used for read-heavy concept and connection endpoints */
|
|
30
|
+
static NODE_CACHE_URL: string;
|
|
31
|
+
/** Ordered cache servers, nearest first. Falls back to BASE_URL when exhausted. */
|
|
32
|
+
static CACHE_SERVERS: string[];
|
|
33
|
+
/** Indicates whether the current cache server is still the nearest configured server */
|
|
34
|
+
static isNearestCache: boolean;
|
|
29
35
|
/** URL for AI service endpoints */
|
|
30
36
|
static AI_URL: string;
|
|
31
37
|
/** MQTT broker URL for real-time messaging */
|
|
@@ -34,6 +40,10 @@ export declare class BaseUrl {
|
|
|
34
40
|
static NODE_URL: string;
|
|
35
41
|
/** Active MQTT connection instance */
|
|
36
42
|
static MQTT_CONNECTION: any;
|
|
43
|
+
static setNodeCacheUrl(cacheServerUrl?: string): void;
|
|
44
|
+
static setCacheServers(cacheServers?: string[]): void;
|
|
45
|
+
static GetReadBaseUrl(): string;
|
|
46
|
+
static GetReadBaseUrlCandidates(): string[];
|
|
37
47
|
/**
|
|
38
48
|
* Returns the URL for retrieving a single concept by ID.
|
|
39
49
|
* @returns {string} The concept retrieval API endpoint
|
|
@@ -244,6 +254,7 @@ export declare class BaseUrl {
|
|
|
244
254
|
* @returns {string} The type concept creation API endpoint
|
|
245
255
|
*/
|
|
246
256
|
static MakeTheTypeConceptUrl(): string;
|
|
257
|
+
static CreateTypeConceptUrl(): string;
|
|
247
258
|
/**
|
|
248
259
|
* Returns the URL for deleting a single connection.
|
|
249
260
|
* @returns {string} The connection deletion API endpoint
|
|
@@ -40,9 +40,19 @@
|
|
|
40
40
|
* await init("https://api.example.com", "", "MyApp", config);
|
|
41
41
|
* ```
|
|
42
42
|
*/
|
|
43
|
+
type CCSConfigOptions = Partial<Omit<CCSConfig, "cacheServers">> & {
|
|
44
|
+
cacheServers?: string[] | string;
|
|
45
|
+
cacheServerUrl?: string;
|
|
46
|
+
cacheServer?: string;
|
|
47
|
+
cache_servers?: string[] | string;
|
|
48
|
+
};
|
|
43
49
|
export declare class CCSConfig {
|
|
44
50
|
/** URL for the AI service. Defaults to "https://ai.freeschema.com" */
|
|
45
51
|
aiUrl: string;
|
|
52
|
+
/** Single cache server URL for read-heavy concept and connection endpoints */
|
|
53
|
+
cacheServerUrl: string;
|
|
54
|
+
/** Ordered cache server URLs, nearest first */
|
|
55
|
+
cacheServers: string[];
|
|
46
56
|
/** JWT bearer token for authentication. Can be set later via updateAccessToken() */
|
|
47
57
|
accessToken: string;
|
|
48
58
|
/** Whether to enable AI features. Defaults to true */
|
|
@@ -58,7 +68,7 @@ export declare class CCSConfig {
|
|
|
58
68
|
flags?: Record<string, boolean>;
|
|
59
69
|
/**
|
|
60
70
|
* Dictionary of additional parameters.
|
|
61
|
-
* Example: { logserver: "https://logs.example.com" }
|
|
71
|
+
* Example: { logserver: "https://logs.example.com", cacheServers: "https://cache-1.example.com,https://cache-2.example.com" }
|
|
62
72
|
*/
|
|
63
73
|
parameters?: Record<string, string>;
|
|
64
74
|
/** Path for storing local data (ID counters, cached data, etc.) */
|
|
@@ -95,7 +105,7 @@ export declare class CCSConfig {
|
|
|
95
105
|
* });
|
|
96
106
|
* ```
|
|
97
107
|
*/
|
|
98
|
-
constructor(options?:
|
|
108
|
+
constructor(options?: CCSConfigOptions);
|
|
99
109
|
/**
|
|
100
110
|
* Returns true if OAuth credentials are configured.
|
|
101
111
|
* @returns {boolean} Whether both clientId and clientSecret are set
|
|
@@ -167,3 +177,4 @@ export declare class CCSConfig {
|
|
|
167
177
|
*/
|
|
168
178
|
setParameter(paramName: string, value: string): void;
|
|
169
179
|
}
|
|
180
|
+
export {};
|
|
@@ -214,6 +214,8 @@ export declare class Transaction {
|
|
|
214
214
|
* ```
|
|
215
215
|
*/
|
|
216
216
|
MakeTheInstanceConcept(type: string, referent: string, composition: boolean | undefined, userId: number, accessId: number, sessionInformationId?: number, referentId?: number): Promise<Concept>;
|
|
217
|
+
CreateReferentConcept(type: string, referentConcept: Concept | number, characterValue?: string, userId?: number, accessId?: number, sessionInformationId?: number): Promise<Concept>;
|
|
218
|
+
CreateTypeConcept(typeConcept: Concept | number, characterValue: string, userId?: number, accessId?: number, sessionInformationId?: number): Promise<Concept>;
|
|
217
219
|
/**
|
|
218
220
|
* Creates a connection between two concepts within the transaction.
|
|
219
221
|
* Establishes a typed relationship between source and target concepts.
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Concept } from "../DataStructures/Concept";
|
|
2
|
+
import { InnerActions } from "../DataStructures/Transaction/Transaction";
|
|
3
|
+
export declare function CreateReferentConcept(type: string, referentConcept: Concept | number, characterValue?: string, userId?: number, accessId?: number, sessionInformationId?: number, actions?: InnerActions): Promise<Concept>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Concept } from "../DataStructures/Concept";
|
|
2
|
+
import { InnerActions } from "../DataStructures/Transaction/Transaction";
|
|
3
|
+
export declare function CreateTypeConcept(typeConcept: Concept | number, characterValue: string, userId?: number, accessId?: number, sessionInformationId?: number, actions?: InnerActions): Promise<Concept>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { HttpResponse } from "./Http/HttpClient.service";
|
|
2
|
+
/**
|
|
3
|
+
* Fetch from the nearest configured cache server first, then rotate through the
|
|
4
|
+
* remaining cache servers and finally the main backend when a cache server is down.
|
|
5
|
+
*/
|
|
6
|
+
export declare function fetchWithCacheServerFallback(path: string, init?: RequestInit, maxRetries?: number): Promise<HttpResponse>;
|
package/dist/types/app.d.ts
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export { init, updateAccessToken };
|
|
10
10
|
export { getOAuthToken, refreshOAuthToken } from './Services/oauth/CallOauth.service';
|
|
11
|
+
export { fetchWithCacheServerFallback } from './Services/cacheService';
|
|
11
12
|
export type { OAuthResponse } from './Services/oauth/CallOauth.service';
|
|
12
13
|
export { requestWithRetry, postWithRetry, getWithRetry, putWithRetry, deleteWithRetry, patchWithRetry, fetchWithRetry, HttpResponse, TokenRefreshError } from './Services/Http/HttpClient.service';
|
|
13
14
|
export { SplitStrings } from './Services/SplitStrings';
|
|
@@ -19,6 +20,8 @@ export { default as CreateComposition } from './Services/CreateTheComposition';
|
|
|
19
20
|
export { CreateConnectionBetweenTwoConcepts, CreateConnectionBetweenTwoConceptsGeneral } from './Services/CreateConnectionBetweenTwoConcepts';
|
|
20
21
|
export { default as GetTheConcept } from './Services/GetTheConcept';
|
|
21
22
|
export { default as MakeTheInstanceConcept } from './Services/MakeTheInstanceConcept';
|
|
23
|
+
export { CreateReferentConcept } from './Services/CreateReferentConcept';
|
|
24
|
+
export { CreateTypeConcept } from './Services/CreateTypeConcept';
|
|
22
25
|
export { storeToDatabase, getFromDatabaseWithType, getFromDatabaseWithTypeOld } from './Database/NoIndexDb';
|
|
23
26
|
export { default as GetConceptByCharacter } from './Services/GetConceptByCharacter';
|
|
24
27
|
export { GetLink, GetLinkRaw } from './Services/GetLink';
|