mftsccs-node 0.2.13 → 0.2.15

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.
@@ -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';
@@ -89,7 +92,10 @@ 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';
@@ -119,7 +125,7 @@ declare function updateAccessToken(accessToken?: string): void;
119
125
  * It performs the following operations asynchronously:
120
126
  *
121
127
  * 1. Sets up base URLs for the main API and AI services
122
- * 2. Stores the authentication token for API requests
128
+ * 2. Stores the authentication token for API requests (or obtains one via OAuth)
123
129
  * 3. Initializes the system (database setup)
124
130
  * 4. Creates binary trees from concept data for efficient querying (by ID, character, and type)
125
131
  * 5. Creates local binary trees for offline/local concept management
@@ -130,22 +136,54 @@ declare function updateAccessToken(accessToken?: string): void;
130
136
  * are updated as each operation completes to indicate which data structures are ready for use.
131
137
  *
132
138
  * @param url - The base URL for the main backend API endpoint (e.g., 'https://api.example.com')
133
- * @param aiurl - The base URL for the AI service endpoint (e.g., 'https://ai.example.com')
134
- * @param accessToken - The bearer access token for authenticating API requests
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
135
142
  *
136
143
  * @example
137
144
  * ```typescript
138
- * // Initialize the system with backend URLs and auth token
139
- * init(
140
- * 'https://api.freeschema.com',
141
- * 'https://ai.freeschema.com',
142
- * 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
143
- * );
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
+ * ```
144
157
  *
145
- * // After initialization, check if data is loaded before querying
146
- * if (IdentifierFlags.isDataLoaded) {
147
- * // Safe to query concepts
148
- * }
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);
149
187
  * ```
150
188
  *
151
189
  * @remarks
@@ -156,9 +194,10 @@ declare function updateAccessToken(accessToken?: string): void;
156
194
  * - `isConnectionLoaded`, `isConnectionTypeLoaded` - Remote connection data ready
157
195
  * - `isLocalConnectionLoaded` - Local connection data ready
158
196
  *
197
+ * @see CCSConfig for all available configuration options
159
198
  * @see IdentifierFlags for checking initialization status
160
199
  * @see InitializeSystem for database initialization details
161
200
  * @see CreateBinaryTreeFromData for concept tree creation
162
201
  * @see https://documentation.freeschema.com/#installation for setup guide
163
202
  */
164
- declare function init(url?: string, aiurl?: string, accessToken?: string, jwtSecret?: string): void;
203
+ declare function init(url?: string, nodeUrl?: string, applicationName?: string, config?: CCSConfig): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mftsccs-node",
3
- "version": "0.2.13",
3
+ "version": "0.2.15",
4
4
  "environment": "production",
5
5
  "description": "Full Pack of concept and connection system",
6
6
  "main": "dist/bundle.js",
@@ -38,8 +38,6 @@
38
38
  "bl": "^6.0.12",
39
39
  "braces": "^3.0.2",
40
40
  "browserslist": "^4.22.1",
41
- "buffer": "^6.0.3",
42
- "buffer-from": "^1.1.2",
43
41
  "caniuse-lite": "^1.0.30001565",
44
42
  "chalk": "^4.1.2",
45
43
  "chrome-trace-event": "^1.0.3",
@@ -1 +0,0 @@
1
- /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */