mftsccs-node 0.2.24 → 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.
Files changed (34) hide show
  1. package/README.md +41 -29
  2. package/dist/bundle.js +1 -1
  3. package/dist/bundle.mjs +1 -0
  4. package/dist/types/Api/Create/CreateTheConnectionApi.d.ts +4 -9
  5. package/dist/types/Api/GetAllConcepts.d.ts +0 -4
  6. package/dist/types/Api/GetAllLinkerConnectionsFromTheConcept.d.ts +1 -1
  7. package/dist/types/Api/GetAllLinkerConnectionsToTheConcept.d.ts +1 -1
  8. package/dist/types/Api/GetAllPrefetchConnections.d.ts +0 -3
  9. package/dist/types/Api/RecursiveSearch.d.ts +1 -1
  10. package/dist/types/Api/Search/FreeschemaQueryApi.d.ts +6 -5
  11. package/dist/types/Api/Search/Search.d.ts +4 -3
  12. package/dist/types/Api/Search/SearchInternalApi.d.ts +5 -4
  13. package/dist/types/Api/Search/SearchLinkMultipleApi.d.ts +4 -4
  14. package/dist/types/Api/Search/SearchWithLinker.d.ts +5 -4
  15. package/dist/types/Api/SearchConcept/GetConceptByCharacterAndCategoryApi.d.ts +3 -2
  16. package/dist/types/Api/SearchConcept/GetConceptByCharacterAndCategoryDirect.d.ts +3 -2
  17. package/dist/types/Api/View/ViewInternalDataApi.d.ts +3 -4
  18. package/dist/types/DataStructures/ConceptData.d.ts +14 -5
  19. package/dist/types/DataStructures/ReservedIds.d.ts +1 -0
  20. package/dist/types/DataStructures/Search/FreeschemaQuery.d.ts +1 -0
  21. package/dist/types/Database/NoIndexDb.d.ts +32 -36
  22. package/dist/types/Services/Common/DecodeCountInfo.d.ts +4 -3
  23. package/dist/types/Services/Common/ErrorPosting.d.ts +5 -7
  24. package/dist/types/Services/CreateConnectionBetweenTwoConcepts.d.ts +4 -3
  25. package/dist/types/Services/CreateTheComposition.d.ts +2 -2
  26. package/dist/types/Services/CreateTheConnection.d.ts +9 -4
  27. package/dist/types/Services/CreateTheConnectionGeneral.d.ts +4 -4
  28. package/dist/types/Services/GetDataFromIndexDb.d.ts +8 -8
  29. package/dist/types/Services/Http/HttpClient.service.d.ts +7 -0
  30. package/dist/types/Services/MakeTheTimestamp.d.ts +2 -2
  31. package/dist/types/Services/PatchComposition.d.ts +10 -15
  32. package/dist/types/Services/UpdateComposition.d.ts +1 -1
  33. package/dist/types/app.d.ts +19 -22
  34. package/package.json +12 -1
@@ -7,7 +7,7 @@
7
7
  * @module Api/Search/SearchInternalApi
8
8
  * @see https://documentation.freeschema.com for internal composition structure and search patterns
9
9
  */
10
- import { SearchStructure } from "../../app";
10
+ import { SearchStructure } from "../../DataStructures/Search/SearchStructure";
11
11
  /**
12
12
  * Searches for concepts within internal (nested) compositions with authentication.
13
13
  * This function enables searching for concepts that are part of internal compositions,
@@ -16,7 +16,8 @@ import { SearchStructure } from "../../app";
16
16
  *
17
17
  * @param search - SearchStructure object containing all search parameters including composition, internal composition, type, search text, and pagination
18
18
  * @param token - Optional authentication token for authorized access (defaults to empty string for public queries)
19
- * @returns Promise resolving to an array of matching concepts from the internal composition, or empty array on error
19
+ * @returns Promise resolving to an array of matching concepts from the internal composition. A valid empty result is returned as an empty array.
20
+ * @throws Will throw if the request fails or the backend returns a non-OK response.
20
21
  *
21
22
  * @example
22
23
  * ```typescript
@@ -56,9 +57,9 @@ import { SearchStructure } from "../../app";
56
57
  * - Filtering results within specific composition contexts
57
58
  *
58
59
  * Error handling:
59
- * - HTTP errors are logged with status and handled via HandleHttpError
60
+ * - HTTP errors are handled via HandleHttpError and thrown
60
61
  * - Network errors are caught, logged, and re-thrown
61
- * - Returns empty array on HTTP errors to prevent null reference issues
62
+ * - Empty arrays represent valid empty results, not failed requests
62
63
  *
63
64
  * Query construction:
64
65
  * - All parameters are URL-encoded as query strings
@@ -17,7 +17,8 @@ import { SearchQuery } from '../../DataStructures/SearchQuery';
17
17
  *
18
18
  * @param searchQuery - Array of SearchQuery objects, each containing search parameters for a specific query
19
19
  * @param token - Optional authentication token for authorized access (defaults to empty string for public queries)
20
- * @returns Promise resolving to an array of search results (one result set per query), or empty array on error
20
+ * @returns Promise resolving to an array of search results, one result set per query. A valid empty result is returned as an empty array.
21
+ * @throws Will throw if the request fails or the backend returns a non-OK response.
21
22
  *
22
23
  * @example
23
24
  * ```typescript
@@ -74,10 +75,9 @@ import { SearchQuery } from '../../DataStructures/SearchQuery';
74
75
  * - Atomic execution of all queries
75
76
  *
76
77
  * Error handling:
77
- * - HTTP errors are logged with status and handled via HandleHttpError
78
+ * - HTTP errors are handled via HandleHttpError and thrown
78
79
  * - Network errors are caught, logged, and re-thrown
79
- * - Returns empty array on HTTP errors to prevent null reference issues
80
- * - If any query fails, the entire operation returns an empty array
80
+ * - Empty arrays represent valid empty results, not failed requests
81
81
  *
82
82
  * Query execution:
83
83
  * - All queries are executed server-side
@@ -17,7 +17,8 @@ import { SearchQuery } from '../../DataStructures/SearchQuery';
17
17
  *
18
18
  * @param searchQuery - Array of SearchQuery objects defining search criteria and relationship paths to follow
19
19
  * @param token - Optional authentication token for authorized access (defaults to empty string for public queries)
20
- * @returns Promise resolving to an array of search results with linked concepts resolved, or empty array on error
20
+ * @returns Promise resolving to an array of search results with linked concepts resolved. A valid empty result is returned as an empty array.
21
+ * @throws Will throw if the request fails or the backend returns a non-OK response.
21
22
  *
22
23
  * @example
23
24
  * ```typescript
@@ -81,10 +82,10 @@ import { SearchQuery } from '../../DataStructures/SearchQuery';
81
82
  * - Ideal for reducing client-side data fetching complexity
82
83
  *
83
84
  * Error handling:
84
- * - HTTP errors are logged with status and handled via HandleHttpError
85
+ * - HTTP errors are handled via HandleHttpError and thrown
85
86
  * - Network errors are caught, logged, and re-thrown
86
- * - Returns empty array on HTTP errors to maintain consistent error handling
87
- * - Link resolution errors are handled gracefully server-side
87
+ * - Empty arrays represent valid empty results, not failed requests
88
+ * - Link resolution errors are handled by the backend response contract
88
89
  *
89
90
  * Use cases:
90
91
  * - Building detailed profile views with all related data
@@ -16,6 +16,7 @@ import { Concept } from "../../DataStructures/Concept";
16
16
  *
17
17
  * @param characterValue - The character string identifying the concept (e.g., "the_person", "john_doe")
18
18
  * @returns A promise that resolves to the matching Concept object, or a default concept if not found
19
+ * @throws Will throw if the request fails or the backend returns a non-OK response.
19
20
  *
20
21
  * @example
21
22
  * ```typescript
@@ -29,9 +30,9 @@ import { Concept } from "../../DataStructures/Concept";
29
30
  * ```
30
31
  *
31
32
  * @remarks
32
- * - Returns a default concept (id=0) if the concept is not found or an error occurs
33
+ * - Returns a default concept (id=0) if the concept is not found
33
34
  * - Automatically caches the retrieved concept in ConceptsData
34
- * - HTTP errors are handled through HandleHttpError but do not throw
35
+ * - HTTP errors are handled through HandleHttpError and thrown
35
36
  * - Errors are logged to console and re-thrown for caller handling
36
37
  *
37
38
  * @see GetConceptByCharacterAndCategoryDirectApi for searching with explicit category
@@ -18,6 +18,7 @@ import { Concept } from "./../../DataStructures/Concept";
18
18
  * @param characterValue - The character string identifying the concept (e.g., "john_doe", "building_a")
19
19
  * @param category_id - The specific category ID to search within
20
20
  * @returns A promise that resolves to the matching Concept object, or a default concept if not found
21
+ * @throws Will throw if the request fails or the backend returns a non-OK response.
21
22
  *
22
23
  * @example
23
24
  * ```typescript
@@ -36,10 +37,10 @@ import { Concept } from "./../../DataStructures/Concept";
36
37
  * @remarks
37
38
  * - Uses local caching (conceptCache) to prevent duplicate simultaneous requests
38
39
  * - Cache key is the concatenation of characterValue and category_id
39
- * - Returns a default concept (id=0) if the concept is not found or an error occurs
40
+ * - Returns a default concept (id=0) if the concept is not found
40
41
  * - Automatically caches the retrieved concept in ConceptsData for subsequent use
41
42
  * - Cache entries are cleaned up in the finally block after fetch completes
42
- * - HTTP errors are handled through HandleHttpError but do not throw
43
+ * - HTTP errors are handled through HandleHttpError and thrown
43
44
  * - Errors are logged with full diagnostic information including the endpoint URL
44
45
  *
45
46
  * @see GetConceptByCharacterAndCategoryApi for searching without explicit category
@@ -16,8 +16,8 @@
16
16
  * internal connection lists.
17
17
  *
18
18
  * @param ids - Array of concept IDs to retrieve internal data for
19
- * @returns A promise that resolves to a dictionary mapping concept IDs to their internal connections,
20
- * or an empty connection list if the request fails
19
+ * @returns A promise that resolves to a dictionary mapping concept IDs to their internal connections.
20
+ * @throws Will throw if the request fails or the backend returns a non-OK response.
21
21
  *
22
22
  * @example
23
23
  * ```typescript
@@ -40,8 +40,7 @@
40
40
  * @remarks
41
41
  * - Returns an object where keys are concept IDs and values are arrays of Connection objects
42
42
  * - Automatically fetches and caches all sub-concepts via GetConceptBulk
43
- * - Returns an empty connection list on error
44
- * - HTTP errors are handled through HandleHttpError but do not throw
43
+ * - HTTP errors are handled through HandleHttpError and thrown
45
44
  * - Requires authentication via GetRequestHeader
46
45
  * - Errors are logged to console and re-thrown for caller handling
47
46
  *
@@ -38,10 +38,19 @@ export declare class ConceptsData {
38
38
  /** Legacy array storage for concepts (deprecated in favor of tree structures) */
39
39
  static conceptsArray: Concept[];
40
40
  /**
41
- * NPC (Non-Persistent Concepts) cache for temporarily tracking accessed concept IDs.
42
- * Limited to 10 entries for memory management.
41
+ * NPC (Non-Persistent Concepts) cache for concept IDs that are currently in cooldown.
43
42
  */
44
43
  static NPC: number[];
44
+ /**
45
+ * Per-NPC cooldown state. Each failed backend lookup increases the cooldown by
46
+ * 30 seconds: first miss = 30s, second miss = 60s, third miss = 90s, etc.
47
+ */
48
+ static NPCMeta: Map<number, {
49
+ attempts: number;
50
+ expiresAt: number;
51
+ }>;
52
+ static NPC_BACKOFF_SECONDS: number;
53
+ static RemoveExpiredNpc(now?: number): void;
45
54
  /** Dictionary-style storage for quick concept lookups by ID */
46
55
  static conceptDictionary: Concept[];
47
56
  /**
@@ -61,7 +70,7 @@ export declare class ConceptsData {
61
70
  static CheckContains(concept: Concept): boolean;
62
71
  /**
63
72
  * Adds a concept ID to the Non-Persistent Concepts (NPC) cache.
64
- * Used for tracking recently accessed concepts. Automatically clears when exceeding 10 entries.
73
+ * Used for tracking recently missed concepts with a growing retry cooldown.
65
74
  *
66
75
  * @param {number} id - The concept ID to add to NPC cache
67
76
  *
@@ -72,10 +81,10 @@ export declare class ConceptsData {
72
81
  */
73
82
  static AddNpc(id: number): void;
74
83
  /**
75
- * Checks if a concept ID exists in the NPC cache.
84
+ * Checks if a concept ID exists in the NPC cache and is still inside its cooldown.
76
85
  *
77
86
  * @param {number} id - The concept ID to check
78
- * @returns {boolean} True if the ID is in the NPC cache, false otherwise
87
+ * @returns {boolean} True if the ID is currently in NPC cooldown, false otherwise
79
88
  *
80
89
  * @example
81
90
  * ```typescript
@@ -24,6 +24,7 @@
24
24
  export declare class ReservedIds {
25
25
  /** Pool of reserved concept IDs */
26
26
  static ids: number[];
27
+ private static pendingFetch;
27
28
  /**
28
29
  * Gets the next available reserved ID from the pool.
29
30
  * Automatically refills the pool if it has fewer than 10 IDs.
@@ -184,4 +184,5 @@ export declare class FreeschemaQuery {
184
184
  * @default false
185
185
  */
186
186
  isOldConnectionType: boolean;
187
+ usePipelineQuery: boolean;
187
188
  }
@@ -1,20 +1,18 @@
1
1
  /**
2
- * No-operation IndexedDB interface module for environments without IndexedDB support.
2
+ * In-memory database compatibility module for the Node package.
3
3
  *
4
- * This module provides stub implementations of database operations that are used when
5
- * IndexedDB is not available or when database functionality needs to be disabled.
6
- * All functions are no-ops or return default values, allowing the application to
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
- * In this no-op implementation, it simply returns the static database reference
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 to the database (no-op implementation).
33
+ * Stores an object in the in-memory compatibility store.
36
34
  *
37
- * This function provides a stub for storing data to IndexedDB. In this no-op
38
- * implementation, it does not perform any actual storage operations.
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 a placeholder implementation. Use the full database module for actual persistence.
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 database.
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 settings (no-op implementation).
74
+ * Updates the AI flag in the in-memory settings store.
77
75
  *
78
- * This function provides a stub for updating AI-related settings in the database.
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
- * This is a placeholder implementation. Changes are not persisted.
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 an object from the database by type and ID (no-op implementation).
94
+ * Retrieves objects from the in-memory store by property and value.
98
95
  *
99
- * This async function provides a stub for fetching data from IndexedDB based on
100
- * type and ID. In this no-op implementation, it returns undefined.
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 a placeholder implementation. Use the full database module for actual retrieval.
111
+ * This is not durable storage.
115
112
  */
116
- export declare function getFromDatabaseWithType(databaseName: string, type: string, id: number): Promise<void>;
113
+ export declare function getFromDatabaseWithType(databaseName: string, type: string, id: number): Promise<any[]>;
117
114
  /**
118
- * Retrieves objects from the database using legacy method (no-op implementation).
115
+ * Retrieves all objects from a named in-memory store.
119
116
  *
120
- * This async function provides a stub for the older method of fetching data from
121
- * IndexedDB. In this no-op implementation, it returns undefined.
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<void>;
135
+ export declare function getFromDatabaseWithTypeOld(databaseName: string): Promise<any[]>;
139
136
  /**
140
- * Removes an object from the database by ID (no-op implementation).
137
+ * Removes an object from the in-memory store by ID.
141
138
  *
142
- * This function provides a stub for deleting data from IndexedDB. In this no-op
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 a placeholder implementation. Use the full database module for actual deletion.
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 the local database (no-op implementation).
155
+ * Retrieves all objects from a local in-memory store.
160
156
  *
161
- * This async function provides a stub for fetching all data from a local IndexedDB
162
- * object store. In this no-op implementation, it returns undefined.
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 a placeholder implementation. Use the full database module for actual bulk retrieval.
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<void>;
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 Response object to process
11
- * @throws {FreeSchemaResponse} Throws a structured error response for unauthorized requests
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 status is 401
16
+ * // Throws FreeSchemaResponse if response.ok is false
18
17
  * ```
19
18
  *
20
19
  * @remarks
21
- * - Currently only handles 401 status codes
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
- * - Backward connections still use basic Connection creation (not CreateTheConnectionGeneral)
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 temporary version
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 temporary connections (via createTheConnection) with random IDs
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 createTheConnection} for connection creation logic
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
- * special case where a concept connects to itself by setting predefined IDs.
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 (where ofTheConceptId equals toTheConceptId) are handled
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 "../app";
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 handled by setting ofTheConceptId to 0 and toTheConceptId to 1
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
- * IndexedDB Data Retrieval Service
2
+ * Runtime Cache Hydration Service
3
3
  *
4
- * This module provides comprehensive functionality for loading data from IndexedDB into
5
- * in-memory data structures. It handles both regular and local database data, loading
6
- * connections and concepts into their respective memory structures for efficient access.
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 standard IndexedDB stores
10
- * - Local data: Loaded from local-only IndexedDB stores for offline or user-specific data
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 IndexedDB stores into memory.
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 persisted database records. Currently focuses on loading connections, with concept
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
- * - Session information ID is overridden to 999 regardless of parameter
34
- * - Access ID is overridden to 4 regardless of parameter
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
  *