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,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
|
|
@@ -259,4 +264,14 @@ export declare class BaseUrl {
|
|
|
259
264
|
* @returns {string} The bulk type concept retrieval API endpoint
|
|
260
265
|
*/
|
|
261
266
|
static GetConceptConnectionByType(): string;
|
|
267
|
+
/**
|
|
268
|
+
* Returns the URL for OAuth token requests.
|
|
269
|
+
* @returns {string} The OAuth token API endpoint
|
|
270
|
+
*/
|
|
271
|
+
static OAuthTokenUrl(): string;
|
|
272
|
+
/**
|
|
273
|
+
* Returns the URL for OAuth token refresh requests.
|
|
274
|
+
* @returns {string} The OAuth token refresh API endpoint
|
|
275
|
+
*/
|
|
276
|
+
static OAuthRefreshUrl(): string;
|
|
262
277
|
}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Configuration class for CCS initialization.
|
|
3
|
+
* This module provides a clean way to manage optional CCS configuration parameters.
|
|
4
|
+
* @module DataStructures/CCSConfig
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Configuration class for CCS initialization.
|
|
8
|
+
*
|
|
9
|
+
* This class holds all optional configuration parameters for the CCS library,
|
|
10
|
+
* keeping the init() function clean with only essential parameters.
|
|
11
|
+
*
|
|
12
|
+
* @class CCSConfig
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const config = new CCSConfig({
|
|
17
|
+
* aiUrl: "https://ai.example.com",
|
|
18
|
+
* accessToken: "jwt-token",
|
|
19
|
+
* enableAi: true,
|
|
20
|
+
* flags: { logApplication: true },
|
|
21
|
+
* storagePath: "./data/ccs/"
|
|
22
|
+
* });
|
|
23
|
+
*
|
|
24
|
+
* await init(
|
|
25
|
+
* "https://api.example.com",
|
|
26
|
+
* "http://localhost:5001",
|
|
27
|
+
* "MyApp",
|
|
28
|
+
* config
|
|
29
|
+
* );
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* // Minimal configuration with OAuth
|
|
35
|
+
* const config = new CCSConfig({
|
|
36
|
+
* clientId: "101084838",
|
|
37
|
+
* clientSecret: "your-secret"
|
|
38
|
+
* });
|
|
39
|
+
*
|
|
40
|
+
* await init("https://api.example.com", "", "MyApp", config);
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare class CCSConfig {
|
|
44
|
+
/** URL for the AI service. Defaults to "https://ai.freeschema.com" */
|
|
45
|
+
aiUrl: string;
|
|
46
|
+
/** JWT bearer token for authentication. Can be set later via updateAccessToken() */
|
|
47
|
+
accessToken: string;
|
|
48
|
+
/** Whether to enable AI features. Defaults to true */
|
|
49
|
+
enableAi: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Dictionary of feature flags for controlling CCS behavior.
|
|
52
|
+
* Available flags:
|
|
53
|
+
* - logApplication: Enable application-level logging
|
|
54
|
+
* - logPackage: Enable package-level logging
|
|
55
|
+
* - accessTracker: Enable access tracking
|
|
56
|
+
* - isTest: Enable test mode
|
|
57
|
+
*/
|
|
58
|
+
flags?: Record<string, boolean>;
|
|
59
|
+
/**
|
|
60
|
+
* Dictionary of additional parameters.
|
|
61
|
+
* Example: { logserver: "https://logs.example.com" }
|
|
62
|
+
*/
|
|
63
|
+
parameters?: Record<string, string>;
|
|
64
|
+
/** Path for storing local data (ID counters, cached data, etc.) */
|
|
65
|
+
storagePath?: string;
|
|
66
|
+
/** OAuth client ID for authentication */
|
|
67
|
+
clientId?: string;
|
|
68
|
+
/** OAuth client secret for authentication */
|
|
69
|
+
clientSecret?: string;
|
|
70
|
+
/** Application name for OAuth and logging purposes */
|
|
71
|
+
applicationName?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Creates a new CCSConfig instance.
|
|
74
|
+
*
|
|
75
|
+
* @param options - Partial configuration options to override defaults
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```typescript
|
|
79
|
+
* // Use default values
|
|
80
|
+
* const config = new CCSConfig();
|
|
81
|
+
* ```
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```typescript
|
|
85
|
+
* // Override specific values
|
|
86
|
+
* const config = new CCSConfig({
|
|
87
|
+
* aiUrl: "https://custom-ai.example.com",
|
|
88
|
+
* enableAi: false,
|
|
89
|
+
* clientId: "123456",
|
|
90
|
+
* clientSecret: "secret",
|
|
91
|
+
* flags: {
|
|
92
|
+
* logApplication: true,
|
|
93
|
+
* accessTracker: true
|
|
94
|
+
* }
|
|
95
|
+
* });
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
constructor(options?: Partial<CCSConfig>);
|
|
99
|
+
/**
|
|
100
|
+
* Returns true if OAuth credentials are configured.
|
|
101
|
+
* @returns {boolean} Whether both clientId and clientSecret are set
|
|
102
|
+
*/
|
|
103
|
+
hasOAuthCredentials(): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Returns true if an access token is configured.
|
|
106
|
+
* @returns {boolean} Whether accessToken is set
|
|
107
|
+
*/
|
|
108
|
+
hasAccessToken(): boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Get a specific flag value with a default fallback.
|
|
111
|
+
*
|
|
112
|
+
* @param flagName - The name of the flag to retrieve
|
|
113
|
+
* @param defaultValue - Default value if flag is not set
|
|
114
|
+
* @returns {boolean} The flag value or default
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```typescript
|
|
118
|
+
* const config = new CCSConfig({
|
|
119
|
+
* flags: { logApplication: true }
|
|
120
|
+
* });
|
|
121
|
+
* config.getFlag('logApplication', false); // returns true
|
|
122
|
+
* config.getFlag('unknownFlag', false); // returns false
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
getFlag(flagName: string, defaultValue?: boolean): boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Get a specific parameter value with a default fallback.
|
|
128
|
+
*
|
|
129
|
+
* @param paramName - The name of the parameter to retrieve
|
|
130
|
+
* @param defaultValue - Default value if parameter is not set
|
|
131
|
+
* @returns {string} The parameter value or default
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```typescript
|
|
135
|
+
* const config = new CCSConfig({
|
|
136
|
+
* parameters: { logserver: "https://logs.example.com" }
|
|
137
|
+
* });
|
|
138
|
+
* config.getParameter('logserver', ''); // returns "https://logs.example.com"
|
|
139
|
+
* config.getParameter('unknown', ''); // returns ""
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
getParameter(paramName: string, defaultValue?: string): string;
|
|
143
|
+
/**
|
|
144
|
+
* Set a flag value.
|
|
145
|
+
*
|
|
146
|
+
* @param flagName - The name of the flag to set
|
|
147
|
+
* @param value - The boolean value to set
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```typescript
|
|
151
|
+
* const config = new CCSConfig();
|
|
152
|
+
* config.setFlag('logApplication', true);
|
|
153
|
+
* ```
|
|
154
|
+
*/
|
|
155
|
+
setFlag(flagName: string, value: boolean): void;
|
|
156
|
+
/**
|
|
157
|
+
* Set a parameter value.
|
|
158
|
+
*
|
|
159
|
+
* @param paramName - The name of the parameter to set
|
|
160
|
+
* @param value - The string value to set
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* ```typescript
|
|
164
|
+
* const config = new CCSConfig();
|
|
165
|
+
* config.setParameter('logserver', 'https://logs.example.com');
|
|
166
|
+
* ```
|
|
167
|
+
*/
|
|
168
|
+
setParameter(paramName: string, value: string): void;
|
|
169
|
+
}
|
|
@@ -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;
|
|
@@ -48,4 +48,78 @@ export declare class TokenStorage {
|
|
|
48
48
|
* Consider clearing this value on logout or session expiration.
|
|
49
49
|
*/
|
|
50
50
|
static BearerAccessToken: string;
|
|
51
|
+
/**
|
|
52
|
+
* OAuth client ID for token refresh
|
|
53
|
+
* @static
|
|
54
|
+
* @type {string}
|
|
55
|
+
* @default ""
|
|
56
|
+
*/
|
|
57
|
+
static CLIENT_ID: string;
|
|
58
|
+
/**
|
|
59
|
+
* OAuth client secret for token refresh
|
|
60
|
+
* @static
|
|
61
|
+
* @type {string}
|
|
62
|
+
* @default ""
|
|
63
|
+
*/
|
|
64
|
+
static CLIENT_SECRET: string;
|
|
65
|
+
/**
|
|
66
|
+
* Application name for OAuth
|
|
67
|
+
* @static
|
|
68
|
+
* @type {string}
|
|
69
|
+
* @default ""
|
|
70
|
+
*/
|
|
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;
|
|
86
|
+
/**
|
|
87
|
+
* Gets authorization header object for HTTP requests.
|
|
88
|
+
* @returns {Record<string, string>} Headers object with Authorization header if token exists
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```typescript
|
|
92
|
+
* const headers = TokenStorage.getAuthHeader();
|
|
93
|
+
* // Returns: { 'Authorization': 'Bearer your-token' } or {}
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
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;
|
|
113
|
+
/**
|
|
114
|
+
* Checks if OAuth credentials are configured for automatic token refresh.
|
|
115
|
+
* @returns {boolean} True if client ID, secret, and app name are all set
|
|
116
|
+
*/
|
|
117
|
+
static hasOAuthCredentials(): boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Sets OAuth credentials for automatic token refresh.
|
|
120
|
+
* @param clientId - OAuth client ID
|
|
121
|
+
* @param clientSecret - OAuth client secret
|
|
122
|
+
* @param applicationName - Application name
|
|
123
|
+
*/
|
|
124
|
+
static setOAuthCredentials(clientId: string, clientSecret: string, applicationName: string): void;
|
|
51
125
|
}
|
|
@@ -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
|
+
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* @module ErrorPosting
|
|
3
3
|
* @description Provides error handling functions for HTTP and internal errors with structured error responses
|
|
4
4
|
*/
|
|
5
|
+
import { HttpResponse } from "../Http/HttpClient.service";
|
|
5
6
|
/**
|
|
6
7
|
* Handles HTTP errors by creating and throwing structured error responses.
|
|
7
8
|
* Specifically handles 401 Unauthorized errors.
|
|
@@ -23,6 +24,7 @@
|
|
|
23
24
|
* - Useful for API call error handling
|
|
24
25
|
*/
|
|
25
26
|
export declare function HandleHttpError(response: Response): void;
|
|
27
|
+
export declare function HandleHttpErrorHttp(response: HttpResponse): void;
|
|
26
28
|
/**
|
|
27
29
|
* Handles internal application errors by creating and throwing structured error responses.
|
|
28
30
|
* Wraps any error object into a FreeSchemaResponse.
|