mftsccs-node 0.0.62 → 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 +5 -0
- package/dist/types/DataStructures/FetchConnection.d.ts +21 -0
- package/dist/types/DataStructures/Security/TokenStorage.d.ts +30 -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/Security/GetRequestHeader.d.ts +58 -10
- package/dist/types/Services/auth/AuthService.d.ts +0 -0
- package/dist/types/app.d.ts +4 -1
- package/package.json +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FetchConnection } from "../../DataStructures/FetchConnection";
|
|
2
|
+
/**
|
|
3
|
+
* Fetches connection IDs matching one or more connection queries.
|
|
4
|
+
*
|
|
5
|
+
* Each item is resolved independently by the backend and returned with
|
|
6
|
+
* connectionIds populated.
|
|
7
|
+
*/
|
|
8
|
+
export declare function GetConnectionsBetweenApi(fetchConnections: FetchConnection[]): Promise<FetchConnection[]>;
|
|
@@ -64,6 +64,11 @@ export declare class BaseUrl {
|
|
|
64
64
|
* @returns {string} The user connections retrieval API endpoint
|
|
65
65
|
*/
|
|
66
66
|
static GetAllConnectionsOfUserUrl(): string;
|
|
67
|
+
/**
|
|
68
|
+
* Returns the URL for retrieving connection IDs matching connection filters.
|
|
69
|
+
* @returns {string} The connection filtering API endpoint
|
|
70
|
+
*/
|
|
71
|
+
static GetConnectionsBetweenUrl(): string;
|
|
67
72
|
/**
|
|
68
73
|
* Returns the URL for retrieving all connections of a composition.
|
|
69
74
|
* @returns {string} The composition connections retrieval API endpoint
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Request/response shape for POST /api/get-connection-between.
|
|
3
|
+
*
|
|
4
|
+
* Use only the fields relevant to the query and leave the rest at their
|
|
5
|
+
* zero/empty defaults. The backend resolves typeId from type when typeId is 0.
|
|
6
|
+
*/
|
|
7
|
+
export interface FetchConnection {
|
|
8
|
+
ofTheConceptId: number;
|
|
9
|
+
toTheConceptId: number;
|
|
10
|
+
typeId: number;
|
|
11
|
+
type: string;
|
|
12
|
+
oldType: string;
|
|
13
|
+
reverse: boolean;
|
|
14
|
+
isComposition: boolean;
|
|
15
|
+
connectionIds: number[];
|
|
16
|
+
}
|
|
17
|
+
export type FetchConnectionQuery = Omit<FetchConnection, 'connectionIds'>;
|
|
18
|
+
/**
|
|
19
|
+
* Builds a complete FetchConnection request object from a partial query.
|
|
20
|
+
*/
|
|
21
|
+
export declare function buildFetchConnection(query: Partial<FetchConnectionQuery>): FetchConnection;
|
|
@@ -69,6 +69,20 @@ export declare class TokenStorage {
|
|
|
69
69
|
* @default ""
|
|
70
70
|
*/
|
|
71
71
|
static APPLICATION_NAME: string;
|
|
72
|
+
/**
|
|
73
|
+
* Token expiration timestamp (Unix timestamp in milliseconds)
|
|
74
|
+
* @static
|
|
75
|
+
* @type {number}
|
|
76
|
+
* @default 0
|
|
77
|
+
*/
|
|
78
|
+
static TOKEN_EXPIRY: number;
|
|
79
|
+
/**
|
|
80
|
+
* Buffer time before token expiry to trigger refresh (in milliseconds)
|
|
81
|
+
* Default: 5 minutes (300000 ms)
|
|
82
|
+
* @static
|
|
83
|
+
* @type {number}
|
|
84
|
+
*/
|
|
85
|
+
static EXPIRY_BUFFER_MS: number;
|
|
72
86
|
/**
|
|
73
87
|
* Gets authorization header object for HTTP requests.
|
|
74
88
|
* @returns {Record<string, string>} Headers object with Authorization header if token exists
|
|
@@ -80,6 +94,22 @@ export declare class TokenStorage {
|
|
|
80
94
|
* ```
|
|
81
95
|
*/
|
|
82
96
|
static getAuthHeader(): Record<string, string>;
|
|
97
|
+
/**
|
|
98
|
+
* Sets the access token and calculates expiry time.
|
|
99
|
+
* @param token - The access token
|
|
100
|
+
* @param expiresIn - Token lifetime in seconds (optional)
|
|
101
|
+
*/
|
|
102
|
+
static setToken(token: string, expiresIn?: number): void;
|
|
103
|
+
/**
|
|
104
|
+
* Checks if the token is expired or near expiry.
|
|
105
|
+
* @returns {boolean} True if token is expired or within the buffer window
|
|
106
|
+
*/
|
|
107
|
+
static isTokenExpiredOrNearExpiry(): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Gets the remaining time until token expiry in seconds.
|
|
110
|
+
* @returns {number} Seconds until expiry, or -1 if expired/no expiry set
|
|
111
|
+
*/
|
|
112
|
+
static getTimeUntilExpiry(): number;
|
|
83
113
|
/**
|
|
84
114
|
* Checks if OAuth credentials are configured for automatic token refresh.
|
|
85
115
|
* @returns {boolean} True if client ID, secret, and app name are all set
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { Concept } from "../Concept";
|
|
6
6
|
import { Connection } from "../Connection";
|
|
7
|
+
import { FetchConnectionQuery } from "../FetchConnection";
|
|
7
8
|
/**
|
|
8
9
|
* Manages transactional operations for concepts and connections.
|
|
9
10
|
* This class provides ACID-like transaction capabilities for creating and managing
|
|
@@ -69,6 +70,14 @@ export declare class Transaction {
|
|
|
69
70
|
* @default true
|
|
70
71
|
*/
|
|
71
72
|
protected success: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Connection IDs queued for deletion when the transaction commits.
|
|
75
|
+
* Rollback clears this list without touching the backend.
|
|
76
|
+
*
|
|
77
|
+
* @protected
|
|
78
|
+
* @type {number[]}
|
|
79
|
+
*/
|
|
80
|
+
protected pendingConnectionDeletions: number[];
|
|
72
81
|
/**
|
|
73
82
|
* Creates a new Transaction instance.
|
|
74
83
|
* Generates a unique transaction ID for tracking purposes.
|
|
@@ -154,6 +163,20 @@ export declare class Transaction {
|
|
|
154
163
|
* ```
|
|
155
164
|
*/
|
|
156
165
|
commitTransaction(): Promise<void>;
|
|
166
|
+
/**
|
|
167
|
+
* Queues connections matching one query for deletion on commit.
|
|
168
|
+
*
|
|
169
|
+
* Nothing is deleted until commitTransaction() is called. Calling
|
|
170
|
+
* rollbackTransaction() discards the queued IDs.
|
|
171
|
+
*/
|
|
172
|
+
DeleteConnectionsBetween(query: Partial<FetchConnectionQuery>): Promise<number[]>;
|
|
173
|
+
/**
|
|
174
|
+
* Queues connections matching multiple queries for deletion on commit.
|
|
175
|
+
*
|
|
176
|
+
* The queries are resolved in one API call, then their connection IDs are
|
|
177
|
+
* merged into this transaction's pending deletion queue.
|
|
178
|
+
*/
|
|
179
|
+
DeleteConnectionsBetweenBulk(queries: Partial<FetchConnectionQuery>[]): Promise<number[]>;
|
|
157
180
|
/**
|
|
158
181
|
* Creates a new instance concept within the transaction.
|
|
159
182
|
* The concept represents a data instance of a specified type with associated metadata.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { PermissionSet } from './PermissionSet';
|
|
2
|
+
export declare class AccessControlCacheService {
|
|
3
|
+
private readonly userAccessCache;
|
|
4
|
+
private readonly publicAccessCache;
|
|
5
|
+
private readonly baseUrl;
|
|
6
|
+
constructor();
|
|
7
|
+
loadCacheFromApi(entityId?: number): Promise<void>;
|
|
8
|
+
loadCacheFromJson(jsonData: any): void;
|
|
9
|
+
hasAccess(entityId: number, conceptId: number, required: PermissionSet): Promise<boolean>;
|
|
10
|
+
getAccessibleConcepts(entityId: number, conceptIds: number[], required: PermissionSet): Promise<number[]>;
|
|
11
|
+
getAccessByUser(entityId: number): Promise<Map<number, PermissionSet>>;
|
|
12
|
+
getAccessByConcept(conceptId: number): Promise<Map<number, PermissionSet>>;
|
|
13
|
+
deleteRecordByUserId(entityId: number): void;
|
|
14
|
+
deletePublicAccessRecordById(conceptId: number): void;
|
|
15
|
+
clearCache(): void;
|
|
16
|
+
getConceptsByPublicAccess(): Promise<Record<number, string[]>>;
|
|
17
|
+
hasPublicAccess(conceptId: number, required: PermissionSet): Promise<boolean>;
|
|
18
|
+
getConceptsWithPublicAccess(conceptIds: number[], required: PermissionSet): Promise<number[]>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { PermissionSet } from "./PermissionSet";
|
|
2
|
+
export declare class AccessControlService {
|
|
3
|
+
private static accessCache;
|
|
4
|
+
private static baseUrl;
|
|
5
|
+
private static initialize;
|
|
6
|
+
/**
|
|
7
|
+
* Checks if a user or entity has the specified access for a single concept.
|
|
8
|
+
* @param userId - The user's ID.
|
|
9
|
+
* @param access - The required PermissionSet.
|
|
10
|
+
* @param conceptId - The concept ID to check.
|
|
11
|
+
* @param entityId - Optional entity ID (defaults to userId).
|
|
12
|
+
* @returns Promise<boolean> - True if access is granted, false otherwise.
|
|
13
|
+
*/
|
|
14
|
+
static checkAccessOfConcept(userId: number, access: PermissionSet, conceptId: number, entityId?: number): Promise<boolean>;
|
|
15
|
+
/**
|
|
16
|
+
* Checks if a user or entity has the specified access for all concepts in a list.
|
|
17
|
+
* @param userId - The user's ID.
|
|
18
|
+
* @param access - The required PermissionSet.
|
|
19
|
+
* @param conceptIdList - Array of concept IDs to check.
|
|
20
|
+
* @param entityId - Optional entity ID (defaults to userId).
|
|
21
|
+
* @returns Promise<boolean> - True if access is granted for all, false otherwise.
|
|
22
|
+
*/
|
|
23
|
+
static checkAccessOfConceptList(userId: number, access: PermissionSet, conceptIdList: number[], entityId?: number): Promise<boolean>;
|
|
24
|
+
/**
|
|
25
|
+
* Filters a list of concept IDs, returning only those for which the user or entity has the specified access.
|
|
26
|
+
* @param userId - The user's ID.
|
|
27
|
+
* @param access - The required PermissionSet.
|
|
28
|
+
* @param conceptIdList - Array of concept IDs to filter.
|
|
29
|
+
* @param entityId - Optional entity ID (defaults to userId).
|
|
30
|
+
* @returns Promise<number[]> - Array of concept IDs with access.
|
|
31
|
+
*/
|
|
32
|
+
static filterConceptListByAccess(userId: number, access: PermissionSet, conceptIdList: number[], entityId?: number): Promise<number[]>;
|
|
33
|
+
/**
|
|
34
|
+
* Gets the entity ID for a given user ID.
|
|
35
|
+
* @param userId - The user's ID.
|
|
36
|
+
* @returns number - The entity ID (default: userId).
|
|
37
|
+
*/
|
|
38
|
+
private static getEntityIdConceptByUserId;
|
|
39
|
+
/**
|
|
40
|
+
* Assigns access to a specific entity for a concept.
|
|
41
|
+
* @param request - Object containing conceptId, access, entityId, makePublic.
|
|
42
|
+
* @returns Promise<any> - API response.
|
|
43
|
+
*/
|
|
44
|
+
static assignAccessToEntity(request: {
|
|
45
|
+
conceptId: number;
|
|
46
|
+
access: string;
|
|
47
|
+
entityId: number;
|
|
48
|
+
makePublic: boolean;
|
|
49
|
+
}): Promise<any>;
|
|
50
|
+
/**
|
|
51
|
+
* Assigns public access to a concept or list of concepts.
|
|
52
|
+
* @param request - Object containing conceptId, accessList, connectionTypeList, nestedAccessLevel, conceptIdList.
|
|
53
|
+
* @returns Promise<any> - API response.
|
|
54
|
+
*/
|
|
55
|
+
static assignPublicAccess(request: {
|
|
56
|
+
conceptId: number;
|
|
57
|
+
accessList: string[];
|
|
58
|
+
connectionTypeList?: string[];
|
|
59
|
+
nestedAccessLevel?: number;
|
|
60
|
+
conceptIdList?: number[];
|
|
61
|
+
}): Promise<any>;
|
|
62
|
+
/**
|
|
63
|
+
* Assigns public access to multiple concepts in bulk.
|
|
64
|
+
* @param request - Object containing conceptIdList, accessList, connectionTypeList, nestedAccessLevel, conceptId.
|
|
65
|
+
* @returns Promise<any> - API response.
|
|
66
|
+
*/
|
|
67
|
+
static assignPublicAccessBlukConcept(request: {
|
|
68
|
+
conceptIdList: number[];
|
|
69
|
+
accessList: string[];
|
|
70
|
+
connectionTypeList?: string[];
|
|
71
|
+
nestedAccessLevel?: number;
|
|
72
|
+
conceptId?: number;
|
|
73
|
+
}): Promise<any>;
|
|
74
|
+
/**
|
|
75
|
+
* Assigns access to multiple entities and concepts in bulk.
|
|
76
|
+
* @param request - Object containing conceptId, conceptIdList, entityIdList, accessList, connectionTypeList, nestedAccessLevel.
|
|
77
|
+
* @returns Promise<any> - API response.
|
|
78
|
+
*/
|
|
79
|
+
static assignAccessToEntityBulk(request: {
|
|
80
|
+
conceptId: number;
|
|
81
|
+
conceptIdList?: number[];
|
|
82
|
+
entityIdList: number[];
|
|
83
|
+
accessList: string[];
|
|
84
|
+
connectionTypeList?: string[];
|
|
85
|
+
nestedAccessLevel?: number;
|
|
86
|
+
}): Promise<any>;
|
|
87
|
+
/**
|
|
88
|
+
* Assigns access to a user for a concept.
|
|
89
|
+
* @param request - Object containing conceptId, access, userId, makePublic.
|
|
90
|
+
* @returns Promise<any> - API response.
|
|
91
|
+
*/
|
|
92
|
+
static assignAccessByUser(request: {
|
|
93
|
+
conceptId: number;
|
|
94
|
+
access: string;
|
|
95
|
+
userId: number;
|
|
96
|
+
makePublic: boolean;
|
|
97
|
+
}): Promise<any>;
|
|
98
|
+
/**
|
|
99
|
+
* Revokes access for an entity from a concept.
|
|
100
|
+
* @param params - Object containing conceptId, access, entityId.
|
|
101
|
+
* @returns Promise<any> - API response.
|
|
102
|
+
*/
|
|
103
|
+
static revokeAccess(params: {
|
|
104
|
+
conceptId: number;
|
|
105
|
+
access: string;
|
|
106
|
+
entityId: number;
|
|
107
|
+
}): Promise<any>;
|
|
108
|
+
/**
|
|
109
|
+
* Revokes access for multiple entities in bulk.
|
|
110
|
+
* @param request - Object containing conceptId, entityIdList, accessList.
|
|
111
|
+
* @returns Promise<any> - API response.
|
|
112
|
+
*/
|
|
113
|
+
static revokeAccessBulk(request: {
|
|
114
|
+
conceptId: number;
|
|
115
|
+
entityIdList: number[];
|
|
116
|
+
accessList: string[];
|
|
117
|
+
}): Promise<any>;
|
|
118
|
+
/**
|
|
119
|
+
* Gets the access list for a concept and user.
|
|
120
|
+
* @param conceptId - The concept ID.
|
|
121
|
+
* @param userId - The user ID.
|
|
122
|
+
* @returns Promise<any> - API response.
|
|
123
|
+
*/
|
|
124
|
+
static getAccessList(conceptId: number, userId: number): Promise<any>;
|
|
125
|
+
/**
|
|
126
|
+
* Gets the public access list for a list of concept IDs.
|
|
127
|
+
* @param conceptIdList - Array of concept IDs.
|
|
128
|
+
* @returns Promise<any> - API response.
|
|
129
|
+
*/
|
|
130
|
+
static getPublicAccessList(conceptIdList: number[]): Promise<any>;
|
|
131
|
+
/**
|
|
132
|
+
* Revokes public access for a concept.
|
|
133
|
+
* @param request - Object containing conceptId, accessList.
|
|
134
|
+
* @returns Promise<any> - API response.
|
|
135
|
+
*/
|
|
136
|
+
static revokePublicAccess(request: {
|
|
137
|
+
conceptId: number;
|
|
138
|
+
accessList: string[];
|
|
139
|
+
}): Promise<any>;
|
|
140
|
+
/**
|
|
141
|
+
* Checks if an entity has a specific permission for a concept.
|
|
142
|
+
* @param params - Object containing conceptId, permission, entityId.
|
|
143
|
+
* @returns Promise<any> - API response.
|
|
144
|
+
*/
|
|
145
|
+
static checkAccess(params: {
|
|
146
|
+
conceptId: number;
|
|
147
|
+
permission: string;
|
|
148
|
+
entityId: number;
|
|
149
|
+
}): Promise<any>;
|
|
150
|
+
/**
|
|
151
|
+
* Checks if a user has a specific access for a concept.
|
|
152
|
+
* @param request - Object containing conceptId, access, userId.
|
|
153
|
+
* @returns Promise<any> - API response.
|
|
154
|
+
*/
|
|
155
|
+
static checkAccessByUser(request: {
|
|
156
|
+
conceptId: number;
|
|
157
|
+
access: string;
|
|
158
|
+
userId: number;
|
|
159
|
+
}): Promise<any>;
|
|
160
|
+
/**
|
|
161
|
+
* Filters concepts by access for a user.
|
|
162
|
+
* @param request - Object containing userId, access, conceptIdList, connectionIdList.
|
|
163
|
+
* @returns Promise<any> - API response.
|
|
164
|
+
*/
|
|
165
|
+
static filterConceptsByAccess(request: {
|
|
166
|
+
userId: number;
|
|
167
|
+
access: string;
|
|
168
|
+
conceptIdList?: number[];
|
|
169
|
+
connectionIdList?: number[];
|
|
170
|
+
}): Promise<any>;
|
|
171
|
+
/**
|
|
172
|
+
* Checks access for a user on multiple concepts in bulk.
|
|
173
|
+
* @param request - Object containing userId, access, conceptIdList.
|
|
174
|
+
* @returns Promise<any> - API response.
|
|
175
|
+
*/
|
|
176
|
+
static checkAccessOfConceptBulk(request: {
|
|
177
|
+
userId: number;
|
|
178
|
+
access: string;
|
|
179
|
+
conceptIdList: number[];
|
|
180
|
+
}): Promise<any>;
|
|
181
|
+
/**
|
|
182
|
+
* Gets entities with a specific access for a concept.
|
|
183
|
+
* @param conceptId - The concept ID.
|
|
184
|
+
* @param access - The access type.
|
|
185
|
+
* @returns Promise<any> - API response.
|
|
186
|
+
*/
|
|
187
|
+
static getEntitiesByAccess(conceptId: number, access: string): Promise<any>;
|
|
188
|
+
/**
|
|
189
|
+
* Gets all entities with any access for a concept.
|
|
190
|
+
* @param conceptId - The concept ID.
|
|
191
|
+
* @returns Promise<any> - API response.
|
|
192
|
+
*/
|
|
193
|
+
static getEntitiesWithAccess(conceptId: number): Promise<any>;
|
|
194
|
+
/**
|
|
195
|
+
* Gets access groups by entity.
|
|
196
|
+
* @param entityId - Optional entity ID.
|
|
197
|
+
* @returns Promise<any> - API response.
|
|
198
|
+
*/
|
|
199
|
+
static getAccessGroupByEntity(entityId?: number): Promise<any>;
|
|
200
|
+
/**
|
|
201
|
+
* Gets access groups by user.
|
|
202
|
+
* @param userId - Optional user ID.
|
|
203
|
+
* @returns Promise<any> - API response.
|
|
204
|
+
*/
|
|
205
|
+
static getAccessGroupByUser(userId?: number): Promise<any>;
|
|
206
|
+
/**
|
|
207
|
+
* Gets public access by access IDs.
|
|
208
|
+
* @param accessIdList - Array of access IDs.
|
|
209
|
+
* @returns Promise<any> - API response.
|
|
210
|
+
*/
|
|
211
|
+
static getPublicAccessByAccessIds(accessIdList: number[]): Promise<any>;
|
|
212
|
+
/**
|
|
213
|
+
* Gets the full access mapping for public users.
|
|
214
|
+
* @returns Promise<any> - API response.
|
|
215
|
+
*/
|
|
216
|
+
static getFullAccessMappingForPublic(): Promise<any>;
|
|
217
|
+
/**
|
|
218
|
+
* Assigns public access for all users.
|
|
219
|
+
* @returns Promise<any> - API response.
|
|
220
|
+
*/
|
|
221
|
+
static assignPublicAccessForAllUser(): Promise<any>;
|
|
222
|
+
/**
|
|
223
|
+
* Assigns access by connection type for users.
|
|
224
|
+
* @returns Promise<any> - API response.
|
|
225
|
+
*/
|
|
226
|
+
static assignAccessByConncetionTypeOfUser(): Promise<any>;
|
|
227
|
+
/**
|
|
228
|
+
* Sets access inheritance for a concept.
|
|
229
|
+
* @param request - Object containing mainConceptId, enable, connectionTypeId.
|
|
230
|
+
* @returns Promise<any> - API response.
|
|
231
|
+
*/
|
|
232
|
+
static setAccessInheritance(request: {
|
|
233
|
+
mainConceptId: number;
|
|
234
|
+
enable: boolean;
|
|
235
|
+
connectionTypeId?: number;
|
|
236
|
+
}): Promise<any>;
|
|
237
|
+
/**
|
|
238
|
+
* Gets the status of access inheritance for a concept.
|
|
239
|
+
* @param mainConceptId - The main concept ID.
|
|
240
|
+
* @param connectionTypeId - The connection type ID (default: 999).
|
|
241
|
+
* @returns Promise<any> - API response.
|
|
242
|
+
*/
|
|
243
|
+
static getAccessInheritanceStatus(mainConceptId: number, connectionTypeId?: number): Promise<any>;
|
|
244
|
+
/**
|
|
245
|
+
* Performs a GET request to the backend API.
|
|
246
|
+
* @param path - The API path.
|
|
247
|
+
* @param errorMsg - Error message to throw if request fails.
|
|
248
|
+
* @returns Promise<any> - API response.
|
|
249
|
+
*/
|
|
250
|
+
private static _get;
|
|
251
|
+
/**
|
|
252
|
+
* Performs a POST request to the backend API.
|
|
253
|
+
* @param path - The API path.
|
|
254
|
+
* @param body - Request body.
|
|
255
|
+
* @param errorMsg - Error message to throw if request fails.
|
|
256
|
+
* @returns Promise<any> - API response.
|
|
257
|
+
*/
|
|
258
|
+
private static _post;
|
|
259
|
+
/**
|
|
260
|
+
* Performs a DELETE request to the backend API.
|
|
261
|
+
* @param path - The API path.
|
|
262
|
+
* @param body - Optional request body.
|
|
263
|
+
* @param errorMsg - Error message to throw if request fails.
|
|
264
|
+
* @returns Promise<any> - API response.
|
|
265
|
+
*/
|
|
266
|
+
private static _delete;
|
|
267
|
+
}
|
|
@@ -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
|
package/dist/types/app.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export { init, updateAccessToken };
|
|
|
10
10
|
export { getOAuthToken, refreshOAuthToken, OAuthResponse } from './Services/oauth/CallOauth.service';
|
|
11
11
|
export { requestWithRetry, postWithRetry, getWithRetry, putWithRetry, deleteWithRetry, patchWithRetry, HttpResponse, TokenRefreshError } from './Services/Http/HttpClient.service';
|
|
12
12
|
export { SplitStrings } from './Services/SplitStrings';
|
|
13
|
+
export { GetRequestHeader, GetRequestHeaderWithAuthorization } from './Services/Security/GetRequestHeader';
|
|
13
14
|
export { GetCompositionList, GetCompositionListWithId } from './Services/GetCompositionList';
|
|
14
15
|
export { GetCompositionListLocal, GetCompositionListLocalWithId } from './Services/Local/GetCompositionListLocal';
|
|
15
16
|
export { GetAllConnectionsOfComposition } from './Api/GetAllConnectionsOfComposition';
|
|
@@ -30,7 +31,7 @@ export { MakeTheTypeConcept } from './Services/MakeTheTypeConcept';
|
|
|
30
31
|
export { MakeTheTypeConceptApi } from './Api/MakeTheTypeConceptApi';
|
|
31
32
|
export { GetLinkerConnectionFromConcepts, GetLinkerConnectionToConcepts } from './Services/GetLinkerConnectionFromConcept';
|
|
32
33
|
export { DeleteConceptById } from './Services/DeleteConcept';
|
|
33
|
-
export { DeleteConnectionById } from './Services/DeleteConnection';
|
|
34
|
+
export { DeleteConnectionById, DeleteConnectionByIdBulk } from './Services/DeleteConnection';
|
|
34
35
|
export { TrashTheConcept } from './Api/Delete/DeleteConceptInBackend';
|
|
35
36
|
export { GetConnectionById } from './Services/GetConnections';
|
|
36
37
|
export { MakeTheTimestamp } from './Services/MakeTheTimestamp';
|
|
@@ -98,6 +99,8 @@ export { TokenStorage } from './DataStructures/Security/TokenStorage';
|
|
|
98
99
|
export { SchemaQueryListener } from './WrapperFunctions/SchemaQueryObservable';
|
|
99
100
|
export { FreeschemaQuery } from './DataStructures/Search/FreeschemaQuery';
|
|
100
101
|
export { GiveConnection, GetAllTheConnectionsByTypeAndOfTheConcept } from './Services/Delete/GetAllConnectionByType';
|
|
102
|
+
export { GetConnectionsBetweenApi } from './Api/GetConnections/GetConnectionsBetweenApi';
|
|
103
|
+
export { FetchConnection, FetchConnectionQuery, buildFetchConnection } from './DataStructures/FetchConnection';
|
|
101
104
|
export { DATAID, NORMAL, JUSTDATA, ALLID, DATAIDDATE, RAW, LISTNORMAL, DATAV2 } from './Constants/FormatConstants';
|
|
102
105
|
export { Transaction } from './DataStructures/Transaction/Transaction';
|
|
103
106
|
/**
|