mftsccs-node 0.0.60 → 0.0.63
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.js.map +1 -0
- package/dist/types/Api/GetConnections/GetConnectionsBetweenApi.d.ts +8 -0
- package/dist/types/DataStructures/BaseUrl.d.ts +15 -0
- package/dist/types/DataStructures/CCSConfig.d.ts +169 -0
- package/dist/types/DataStructures/FetchConnection.d.ts +21 -0
- package/dist/types/DataStructures/Security/TokenStorage.d.ts +74 -0
- package/dist/types/DataStructures/Transaction/Transaction.d.ts +23 -0
- package/dist/types/Services/AccessControl/AccessControlCacheService.d.ts +19 -0
- package/dist/types/Services/AccessControl/AccessControlService.d.ts +267 -0
- package/dist/types/Services/AccessControl/PermissionSet.d.ts +8 -0
- package/dist/types/Services/Common/ErrorPosting.d.ts +2 -0
- package/dist/types/Services/Http/HttpClient.service.d.ts +205 -0
- package/dist/types/Services/Security/GetRequestHeader.d.ts +58 -10
- package/dist/types/Services/auth/AuthService.d.ts +0 -0
- package/dist/types/Services/oauth/CallOauth.service.d.ts +101 -0
- package/dist/types/app.d.ts +56 -15
- package/package.json +70 -70
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview HTTP Client - Handles API requests with automatic token refresh on 401 errors.
|
|
3
|
+
* This module provides a robust HTTP client that automatically refreshes OAuth tokens
|
|
4
|
+
* when receiving 401 Unauthorized responses, ensuring seamless API access.
|
|
5
|
+
* @module Services/Http/HttpClient
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Custom error thrown when token refresh fails.
|
|
9
|
+
*/
|
|
10
|
+
export declare class TokenRefreshError extends Error {
|
|
11
|
+
constructor(message: string);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Container for HTTP response data.
|
|
15
|
+
* Provides convenient methods to parse response body as JSON or text.
|
|
16
|
+
*/
|
|
17
|
+
export declare class HttpResponse {
|
|
18
|
+
status: number;
|
|
19
|
+
body: string;
|
|
20
|
+
headers: Record<string, string>;
|
|
21
|
+
/**
|
|
22
|
+
* Creates a new HttpResponse instance.
|
|
23
|
+
* @param status - HTTP status code
|
|
24
|
+
* @param body - Response body as string
|
|
25
|
+
* @param headers - Response headers
|
|
26
|
+
*/
|
|
27
|
+
constructor(status: number, body: string, headers: Record<string, string>);
|
|
28
|
+
/**
|
|
29
|
+
* Parse response body as JSON.
|
|
30
|
+
* @returns {Promise<any>} Parsed JSON object
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* const response = await requestWithRetry('GET', url);
|
|
35
|
+
* const data = await response.json();
|
|
36
|
+
* console.log(data.id);
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
json(): Promise<any>;
|
|
40
|
+
/**
|
|
41
|
+
* Get response body as text.
|
|
42
|
+
* @returns {Promise<string>} Response body as string
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```typescript
|
|
46
|
+
* const response = await requestWithRetry('GET', url);
|
|
47
|
+
* const text = await response.text();
|
|
48
|
+
* console.log(text);
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
text(): Promise<string>;
|
|
52
|
+
/**
|
|
53
|
+
* Checks if the response status indicates success (200-299).
|
|
54
|
+
* @returns {boolean} True if status is in the 2xx range
|
|
55
|
+
*/
|
|
56
|
+
get ok(): boolean;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Make an HTTP request with automatic retry on 401 Unauthorized.
|
|
60
|
+
*
|
|
61
|
+
* If a 401 error occurs and OAuth credentials are available, this function
|
|
62
|
+
* will automatically refresh the token and retry the request once.
|
|
63
|
+
*
|
|
64
|
+
* @async
|
|
65
|
+
* @param {string} method - HTTP method (GET, POST, PUT, DELETE, etc.)
|
|
66
|
+
* @param {string} url - The URL to request
|
|
67
|
+
* @param {Record<string, string>} [headers] - Optional headers dict
|
|
68
|
+
* @param {any} [body] - Optional request body (JSON will be stringified)
|
|
69
|
+
* @param {number} [maxRetries=1] - Maximum number of retries on 401
|
|
70
|
+
* @returns {Promise<HttpResponse>} HttpResponse object with status, body, and headers
|
|
71
|
+
* @throws {TokenRefreshError} If token refresh fails
|
|
72
|
+
* @throws {Error} For other network errors
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```typescript
|
|
76
|
+
* const headers = { "Content-Type": "application/json" };
|
|
77
|
+
* const response = await requestWithRetry(
|
|
78
|
+
* "POST",
|
|
79
|
+
* url,
|
|
80
|
+
* headers,
|
|
81
|
+
* { id: 123 }
|
|
82
|
+
* );
|
|
83
|
+
* if (response.ok) {
|
|
84
|
+
* const data = await response.json();
|
|
85
|
+
* console.log(data);
|
|
86
|
+
* }
|
|
87
|
+
* ```
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```typescript
|
|
91
|
+
* // Automatic token refresh on 401
|
|
92
|
+
* try {
|
|
93
|
+
* const response = await requestWithRetry("GET", url);
|
|
94
|
+
* // If receives 401, will automatically refresh token and retry
|
|
95
|
+
* } catch (error) {
|
|
96
|
+
* if (error instanceof TokenRefreshError) {
|
|
97
|
+
* console.error('Authentication failed:', error.message);
|
|
98
|
+
* }
|
|
99
|
+
* }
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
export declare function requestWithRetry(method: string, url: string, headers?: Record<string, string>, body?: any, maxRetries?: number): Promise<HttpResponse>;
|
|
103
|
+
/**
|
|
104
|
+
* Convenience method for POST requests with automatic retry on 401.
|
|
105
|
+
*
|
|
106
|
+
* @async
|
|
107
|
+
* @param {string} url - The URL to request
|
|
108
|
+
* @param {Record<string, string>} [headers] - Optional headers dict
|
|
109
|
+
* @param {any} [body] - Optional request body (will be JSON stringified if object)
|
|
110
|
+
* @returns {Promise<HttpResponse>} HttpResponse object
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```typescript
|
|
114
|
+
* const response = await postWithRetry(
|
|
115
|
+
* "https://api.example.com/concepts",
|
|
116
|
+
* { "Content-Type": "application/json" },
|
|
117
|
+
* { name: "Test", value: 123 }
|
|
118
|
+
* );
|
|
119
|
+
* if (response.ok) {
|
|
120
|
+
* const data = await response.json();
|
|
121
|
+
* console.log('Created:', data);
|
|
122
|
+
* }
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
export declare function postWithRetry(url: string, headers?: Record<string, string>, body?: any): Promise<HttpResponse>;
|
|
126
|
+
/**
|
|
127
|
+
* Convenience method for GET requests with automatic retry on 401.
|
|
128
|
+
*
|
|
129
|
+
* @async
|
|
130
|
+
* @param {string} url - The URL to request
|
|
131
|
+
* @param {Record<string, string>} [headers] - Optional headers dict
|
|
132
|
+
* @param {Record<string, any>} [params] - Optional query parameters
|
|
133
|
+
* @returns {Promise<HttpResponse>} HttpResponse object
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```typescript
|
|
137
|
+
* const response = await getWithRetry(
|
|
138
|
+
* "https://api.example.com/concepts",
|
|
139
|
+
* undefined,
|
|
140
|
+
* { id: 123, type: "test" }
|
|
141
|
+
* );
|
|
142
|
+
* if (response.ok) {
|
|
143
|
+
* const data = await response.json();
|
|
144
|
+
* console.log(data);
|
|
145
|
+
* }
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
148
|
+
export declare function getWithRetry(url: string, headers?: Record<string, string>, params?: Record<string, any>): Promise<HttpResponse>;
|
|
149
|
+
/**
|
|
150
|
+
* Convenience method for PUT requests with automatic retry on 401.
|
|
151
|
+
*
|
|
152
|
+
* @async
|
|
153
|
+
* @param {string} url - The URL to request
|
|
154
|
+
* @param {Record<string, string>} [headers] - Optional headers dict
|
|
155
|
+
* @param {any} [body] - Optional request body
|
|
156
|
+
* @returns {Promise<HttpResponse>} HttpResponse object
|
|
157
|
+
*
|
|
158
|
+
* @example
|
|
159
|
+
* ```typescript
|
|
160
|
+
* const response = await putWithRetry(
|
|
161
|
+
* "https://api.example.com/concepts/123",
|
|
162
|
+
* { "Content-Type": "application/json" },
|
|
163
|
+
* { name: "Updated Name" }
|
|
164
|
+
* );
|
|
165
|
+
* ```
|
|
166
|
+
*/
|
|
167
|
+
export declare function putWithRetry(url: string, headers?: Record<string, string>, body?: any): Promise<HttpResponse>;
|
|
168
|
+
/**
|
|
169
|
+
* Convenience method for DELETE requests with automatic retry on 401.
|
|
170
|
+
*
|
|
171
|
+
* @async
|
|
172
|
+
* @param {string} url - The URL to request
|
|
173
|
+
* @param {Record<string, string>} [headers] - Optional headers dict
|
|
174
|
+
* @returns {Promise<HttpResponse>} HttpResponse object
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* ```typescript
|
|
178
|
+
* const response = await deleteWithRetry(
|
|
179
|
+
* "https://api.example.com/concepts/123"
|
|
180
|
+
* );
|
|
181
|
+
* if (response.ok) {
|
|
182
|
+
* console.log('Deleted successfully');
|
|
183
|
+
* }
|
|
184
|
+
* ```
|
|
185
|
+
*/
|
|
186
|
+
export declare function deleteWithRetry(url: string, headers?: Record<string, string>): Promise<HttpResponse>;
|
|
187
|
+
/**
|
|
188
|
+
* Convenience method for PATCH requests with automatic retry on 401.
|
|
189
|
+
*
|
|
190
|
+
* @async
|
|
191
|
+
* @param {string} url - The URL to request
|
|
192
|
+
* @param {Record<string, string>} [headers] - Optional headers dict
|
|
193
|
+
* @param {any} [body] - Optional request body
|
|
194
|
+
* @returns {Promise<HttpResponse>} HttpResponse object
|
|
195
|
+
*
|
|
196
|
+
* @example
|
|
197
|
+
* ```typescript
|
|
198
|
+
* const response = await patchWithRetry(
|
|
199
|
+
* "https://api.example.com/concepts/123",
|
|
200
|
+
* { "Content-Type": "application/json" },
|
|
201
|
+
* { status: "active" }
|
|
202
|
+
* );
|
|
203
|
+
* ```
|
|
204
|
+
*/
|
|
205
|
+
export declare function patchWithRetry(url: string, headers?: Record<string, string>, body?: any): Promise<HttpResponse>;
|
|
@@ -1,10 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Gets request headers with automatic token refresh if expired or near expiry.
|
|
3
|
+
* This is the async version that checks token expiry and refreshes if needed.
|
|
4
|
+
*
|
|
5
|
+
* @async
|
|
6
|
+
* @param {string} [contentType='application/json'] - Content-Type header value
|
|
7
|
+
* @param {string} [Accept='application/json'] - Accept header value
|
|
8
|
+
* @returns {Promise<Record<string, string>>} Headers object with refreshed token if needed
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* // Automatically refreshes token if expired/near expiry
|
|
13
|
+
* const headers = await GetRequestHeaderWithRefresh();
|
|
14
|
+
* const response = await fetch(url, { headers });
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* // With custom content type
|
|
20
|
+
* const headers = await GetRequestHeaderWithRefresh('application/x-www-form-urlencoded');
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare function GetRequestHeader(contentType?: string, Accept?: string): Promise<Record<string, string>>;
|
|
24
|
+
/**
|
|
25
|
+
* Gets request headers with automatic token refresh and custom token override.
|
|
26
|
+
* This is the async version that checks token expiry and refreshes if needed.
|
|
27
|
+
*
|
|
28
|
+
* @async
|
|
29
|
+
* @param {string} [contentType='application/json'] - Content-Type header value
|
|
30
|
+
* @param {string} [token=''] - Optional token override. If empty, uses TokenStorage token
|
|
31
|
+
* @param {string} [Accept='application/json'] - Accept header value
|
|
32
|
+
* @returns {Promise<Record<string, string>>} Headers object with refreshed token if needed
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* // Use stored token with automatic refresh
|
|
37
|
+
* const headers = await GetRequestHeaderWithAuthorizationAndRefresh();
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* // Use custom token (no refresh)
|
|
43
|
+
* const headers = await GetRequestHeaderWithAuthorizationAndRefresh(
|
|
44
|
+
* 'application/json',
|
|
45
|
+
* 'custom-token-here'
|
|
46
|
+
* );
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```typescript
|
|
51
|
+
* // Check token expiry status
|
|
52
|
+
* const timeRemaining = TokenStorage.getTimeUntilExpiry();
|
|
53
|
+
* console.log(`Token expires in ${timeRemaining} seconds`);
|
|
54
|
+
*
|
|
55
|
+
* const headers = await GetRequestHeaderWithAuthorizationAndRefresh();
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export declare function GetRequestHeaderWithAuthorization(contentType?: string, token?: string, Accept?: string): Promise<Record<string, string>>;
|
|
File without changes
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview OAuth API - Handles OAuth token requests for authentication.
|
|
3
|
+
* This module provides functions for obtaining and refreshing OAuth access tokens
|
|
4
|
+
* from the authentication server.
|
|
5
|
+
* @module Services/oauth/CallOauth
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Response from OAuth token request.
|
|
9
|
+
* Contains either successful token data or error information.
|
|
10
|
+
*
|
|
11
|
+
* @interface OAuthResponse
|
|
12
|
+
*/
|
|
13
|
+
export interface OAuthResponse {
|
|
14
|
+
/** Whether the OAuth request was successful */
|
|
15
|
+
success: boolean;
|
|
16
|
+
/** The OAuth access token (empty if request failed) */
|
|
17
|
+
access_token?: string;
|
|
18
|
+
/** The token type (typically "Bearer") */
|
|
19
|
+
token_type?: string;
|
|
20
|
+
/** Number of seconds until the token expires */
|
|
21
|
+
expires_in?: number;
|
|
22
|
+
/** Error message if the request failed */
|
|
23
|
+
error?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Request an OAuth access token from the server.
|
|
27
|
+
*
|
|
28
|
+
* This function authenticates with the OAuth endpoint using client credentials
|
|
29
|
+
* and returns an access token that can be used for API requests.
|
|
30
|
+
*
|
|
31
|
+
* @async
|
|
32
|
+
* @param {string} client_id - The OAuth client ID.
|
|
33
|
+
* @param {string} client_secret - The OAuth client secret.
|
|
34
|
+
* @param {string} application_name - The name of the application requesting the token.
|
|
35
|
+
* @param {boolean} [auto_set_token=true] - If true, automatically sets the token in TokenStorage
|
|
36
|
+
* for subsequent API calls.
|
|
37
|
+
* @returns {Promise<OAuthResponse>} OAuthResponse with the access token if successful,
|
|
38
|
+
* or error details if failed.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* import { getOAuthToken } from './Services/oauth/CallOauth.service';
|
|
43
|
+
*
|
|
44
|
+
* const response = await getOAuthToken(
|
|
45
|
+
* "101084838",
|
|
46
|
+
* "your-client-secret",
|
|
47
|
+
* "myapp"
|
|
48
|
+
* );
|
|
49
|
+
* if (response.success) {
|
|
50
|
+
* console.log(`Token: ${response.access_token}`);
|
|
51
|
+
* } else {
|
|
52
|
+
* console.log(`Error: ${response.error}`);
|
|
53
|
+
* }
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```typescript
|
|
58
|
+
* // Get token without auto-setting
|
|
59
|
+
* const response = await getOAuthToken(
|
|
60
|
+
* "101084838",
|
|
61
|
+
* "secret",
|
|
62
|
+
* "myapp",
|
|
63
|
+
* false
|
|
64
|
+
* );
|
|
65
|
+
* // Manually set token later
|
|
66
|
+
* if (response.success) {
|
|
67
|
+
* TokenStorage.BearerAccessToken = response.access_token || "";
|
|
68
|
+
* }
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
export declare function getOAuthToken(client_id: string, client_secret: string, application_name: string, auto_set_token?: boolean): Promise<OAuthResponse>;
|
|
72
|
+
/**
|
|
73
|
+
* Refresh an OAuth access token using a refresh token.
|
|
74
|
+
*
|
|
75
|
+
* This function uses a refresh token from a previous authentication to obtain
|
|
76
|
+
* a new access token without requiring the user to re-authenticate.
|
|
77
|
+
*
|
|
78
|
+
* @async
|
|
79
|
+
* @param {string} client_id - The OAuth client ID.
|
|
80
|
+
* @param {string} client_secret - The OAuth client secret.
|
|
81
|
+
* @param {string} refresh_token - The refresh token from a previous authentication.
|
|
82
|
+
* @param {boolean} [auto_set_token=true] - If true, automatically sets the new token in TokenStorage.
|
|
83
|
+
* @returns {Promise<OAuthResponse>} OAuthResponse with the new access token if successful.
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```typescript
|
|
87
|
+
* import { refreshOAuthToken } from './Services/oauth/CallOauth.service';
|
|
88
|
+
*
|
|
89
|
+
* const response = await refreshOAuthToken(
|
|
90
|
+
* "101084838",
|
|
91
|
+
* "your-client-secret",
|
|
92
|
+
* "your-refresh-token"
|
|
93
|
+
* );
|
|
94
|
+
* if (response.success) {
|
|
95
|
+
* console.log(`New Token: ${response.access_token}`);
|
|
96
|
+
* } else {
|
|
97
|
+
* console.log(`Error: ${response.error}`);
|
|
98
|
+
* }
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
export declare function refreshOAuthToken(client_id: string, client_secret: string, refresh_token: string, auto_set_token?: boolean): Promise<OAuthResponse>;
|
package/dist/types/app.d.ts
CHANGED
|
@@ -7,7 +7,10 @@
|
|
|
7
7
|
* @see {@link https://documentation.freeschema.com} for detailed documentation
|
|
8
8
|
*/
|
|
9
9
|
export { init, updateAccessToken };
|
|
10
|
+
export { getOAuthToken, refreshOAuthToken, OAuthResponse } from './Services/oauth/CallOauth.service';
|
|
11
|
+
export { requestWithRetry, postWithRetry, getWithRetry, putWithRetry, deleteWithRetry, patchWithRetry, HttpResponse, TokenRefreshError } from './Services/Http/HttpClient.service';
|
|
10
12
|
export { SplitStrings } from './Services/SplitStrings';
|
|
13
|
+
export { GetRequestHeader, GetRequestHeaderWithAuthorization } from './Services/Security/GetRequestHeader';
|
|
11
14
|
export { GetCompositionList, GetCompositionListWithId } from './Services/GetCompositionList';
|
|
12
15
|
export { GetCompositionListLocal, GetCompositionListLocalWithId } from './Services/Local/GetCompositionListLocal';
|
|
13
16
|
export { GetAllConnectionsOfComposition } from './Api/GetAllConnectionsOfComposition';
|
|
@@ -28,7 +31,7 @@ export { MakeTheTypeConcept } from './Services/MakeTheTypeConcept';
|
|
|
28
31
|
export { MakeTheTypeConceptApi } from './Api/MakeTheTypeConceptApi';
|
|
29
32
|
export { GetLinkerConnectionFromConcepts, GetLinkerConnectionToConcepts } from './Services/GetLinkerConnectionFromConcept';
|
|
30
33
|
export { DeleteConceptById } from './Services/DeleteConcept';
|
|
31
|
-
export { DeleteConnectionById } from './Services/DeleteConnection';
|
|
34
|
+
export { DeleteConnectionById, DeleteConnectionByIdBulk } from './Services/DeleteConnection';
|
|
32
35
|
export { TrashTheConcept } from './Api/Delete/DeleteConceptInBackend';
|
|
33
36
|
export { GetConnectionById } from './Services/GetConnections';
|
|
34
37
|
export { MakeTheTimestamp } from './Services/MakeTheTimestamp';
|
|
@@ -89,10 +92,15 @@ export { UserBinaryTree } from './DataStructures/User/UserBinaryTree';
|
|
|
89
92
|
export { FilterSearch } from './DataStructures/FilterSearch';
|
|
90
93
|
export { SearchStructure } from './DataStructures/Search/SearchStructure';
|
|
91
94
|
export { FreeSchemaResponse } from './DataStructures/Responses/ErrorResponse';
|
|
95
|
+
export { CCSConfig } from './DataStructures/CCSConfig';
|
|
96
|
+
import { CCSConfig } from './DataStructures/CCSConfig';
|
|
92
97
|
export { BaseUrl } from './DataStructures/BaseUrl';
|
|
98
|
+
export { TokenStorage } from './DataStructures/Security/TokenStorage';
|
|
93
99
|
export { SchemaQueryListener } from './WrapperFunctions/SchemaQueryObservable';
|
|
94
100
|
export { FreeschemaQuery } from './DataStructures/Search/FreeschemaQuery';
|
|
95
101
|
export { GiveConnection, GetAllTheConnectionsByTypeAndOfTheConcept } from './Services/Delete/GetAllConnectionByType';
|
|
102
|
+
export { GetConnectionsBetweenApi } from './Api/GetConnections/GetConnectionsBetweenApi';
|
|
103
|
+
export { FetchConnection, FetchConnectionQuery, buildFetchConnection } from './DataStructures/FetchConnection';
|
|
96
104
|
export { DATAID, NORMAL, JUSTDATA, ALLID, DATAIDDATE, RAW, LISTNORMAL, DATAV2 } from './Constants/FormatConstants';
|
|
97
105
|
export { Transaction } from './DataStructures/Transaction/Transaction';
|
|
98
106
|
/**
|
|
@@ -117,7 +125,7 @@ declare function updateAccessToken(accessToken?: string): void;
|
|
|
117
125
|
* It performs the following operations asynchronously:
|
|
118
126
|
*
|
|
119
127
|
* 1. Sets up base URLs for the main API and AI services
|
|
120
|
-
* 2. Stores the authentication token for API requests
|
|
128
|
+
* 2. Stores the authentication token for API requests (or obtains one via OAuth)
|
|
121
129
|
* 3. Initializes the system (database setup)
|
|
122
130
|
* 4. Creates binary trees from concept data for efficient querying (by ID, character, and type)
|
|
123
131
|
* 5. Creates local binary trees for offline/local concept management
|
|
@@ -128,22 +136,54 @@ declare function updateAccessToken(accessToken?: string): void;
|
|
|
128
136
|
* are updated as each operation completes to indicate which data structures are ready for use.
|
|
129
137
|
*
|
|
130
138
|
* @param url - The base URL for the main backend API endpoint (e.g., 'https://api.example.com')
|
|
131
|
-
* @param
|
|
132
|
-
* @param
|
|
139
|
+
* @param nodeUrl - The base URL for the Node.js service endpoint (optional)
|
|
140
|
+
* @param applicationName - The name of the application (used for OAuth and logging)
|
|
141
|
+
* @param config - Optional CCSConfig object containing all optional configuration parameters
|
|
133
142
|
*
|
|
134
143
|
* @example
|
|
135
144
|
* ```typescript
|
|
136
|
-
* //
|
|
137
|
-
* init(
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
145
|
+
* // Simple initialization with just URL
|
|
146
|
+
* init('https://api.freeschema.com');
|
|
147
|
+
* ```
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```typescript
|
|
151
|
+
* // Initialize with access token
|
|
152
|
+
* const config = new CCSConfig({
|
|
153
|
+
* accessToken: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
|
|
154
|
+
* });
|
|
155
|
+
* init('https://api.freeschema.com', '', 'MyApp', config);
|
|
156
|
+
* ```
|
|
142
157
|
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
158
|
+
* @example
|
|
159
|
+
* ```typescript
|
|
160
|
+
* // Initialize with OAuth credentials
|
|
161
|
+
* const config = new CCSConfig({
|
|
162
|
+
* clientId: '101084838',
|
|
163
|
+
* clientSecret: 'your-client-secret',
|
|
164
|
+
* aiUrl: 'https://ai.freeschema.com',
|
|
165
|
+
* enableAi: true
|
|
166
|
+
* });
|
|
167
|
+
* init('https://api.freeschema.com', '', 'MyApp', config);
|
|
168
|
+
* ```
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* ```typescript
|
|
172
|
+
* // Full configuration
|
|
173
|
+
* const config = new CCSConfig({
|
|
174
|
+
* aiUrl: 'https://ai.example.com',
|
|
175
|
+
* accessToken: 'token',
|
|
176
|
+
* enableAi: true,
|
|
177
|
+
* flags: {
|
|
178
|
+
* logApplication: true,
|
|
179
|
+
* accessTracker: true
|
|
180
|
+
* },
|
|
181
|
+
* parameters: {
|
|
182
|
+
* logserver: 'https://logs.example.com'
|
|
183
|
+
* },
|
|
184
|
+
* storagePath: './data/ccs/'
|
|
185
|
+
* });
|
|
186
|
+
* init('https://api.example.com', 'http://localhost:5001', 'MyApp', config);
|
|
147
187
|
* ```
|
|
148
188
|
*
|
|
149
189
|
* @remarks
|
|
@@ -154,9 +194,10 @@ declare function updateAccessToken(accessToken?: string): void;
|
|
|
154
194
|
* - `isConnectionLoaded`, `isConnectionTypeLoaded` - Remote connection data ready
|
|
155
195
|
* - `isLocalConnectionLoaded` - Local connection data ready
|
|
156
196
|
*
|
|
197
|
+
* @see CCSConfig for all available configuration options
|
|
157
198
|
* @see IdentifierFlags for checking initialization status
|
|
158
199
|
* @see InitializeSystem for database initialization details
|
|
159
200
|
* @see CreateBinaryTreeFromData for concept tree creation
|
|
160
201
|
* @see https://documentation.freeschema.com/#installation for setup guide
|
|
161
202
|
*/
|
|
162
|
-
declare function init(url?: string,
|
|
203
|
+
declare function init(url?: string, nodeUrl?: string, applicationName?: string, config?: CCSConfig): void;
|