mftsccs-node 0.0.78-dev → 0.0.80-dev
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/README.md +60 -50
- package/dist/bundle.js +1 -1
- package/dist/bundle.mjs +1 -1
- package/dist/types/DataStructures/AccessControl/AccessControlModels.d.ts +176 -0
- package/dist/types/DataStructures/BaseUrl.d.ts +1 -0
- package/dist/types/DataStructures/CCSConfig.d.ts +7 -0
- package/dist/types/DataStructures/Transaction/Transaction.d.ts +7 -5
- package/dist/types/Services/AccessControl/APIClientService.d.ts +162 -0
- package/dist/types/Services/AccessControl/AccessControlCacheService.d.ts +76 -18
- package/dist/types/Services/AccessControl/AccessControlService.d.ts +223 -237
- package/dist/types/Services/AccessControl/PermissionSet.d.ts +18 -3
- package/dist/types/Services/AccessControl/index.d.ts +15 -0
- package/dist/types/Services/CreateTypeConcept.d.ts +1 -2
- package/dist/types/Services/UpdateComposition.d.ts +1 -4
- package/dist/types/app.d.ts +7 -2
- package/package.json +8 -3
- package/dist/types/Services/CreateReferentConcept.d.ts +0 -3
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Data models for V1 Access Control Service
|
|
3
|
+
* These models mirror the C# FreeSchema.Models.AccessControl types
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Permission set enum (bitwise flags)
|
|
7
|
+
* Mirrors C# PermissionSet enum
|
|
8
|
+
*/
|
|
9
|
+
export declare enum PermissionSet {
|
|
10
|
+
None = 0,
|
|
11
|
+
Read = 1,// 1
|
|
12
|
+
Write = 2,// 2
|
|
13
|
+
Execute = 4,// 4
|
|
14
|
+
Delete = 8
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Request model for single access operations (check, assign, revoke)
|
|
18
|
+
*/
|
|
19
|
+
export interface AccessRequest {
|
|
20
|
+
accessId?: number | null;
|
|
21
|
+
permission: string;
|
|
22
|
+
entityId?: number | null;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Result model for access operations
|
|
26
|
+
*/
|
|
27
|
+
export interface AccessResult {
|
|
28
|
+
accessId: number;
|
|
29
|
+
permission: string;
|
|
30
|
+
entityId?: number | null;
|
|
31
|
+
hasAccess: boolean;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Target for bulk access operations
|
|
35
|
+
*/
|
|
36
|
+
export interface BulkAccessTarget {
|
|
37
|
+
entityId?: number | null;
|
|
38
|
+
permissions: string[];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Request model for bulk access operations
|
|
42
|
+
*/
|
|
43
|
+
export interface BulkAccessRequest {
|
|
44
|
+
accessId?: number | null;
|
|
45
|
+
targets: BulkAccessTarget[];
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Request model for bulk check access operations
|
|
49
|
+
* Mirrors C# BulkCheckAccessRequest
|
|
50
|
+
*/
|
|
51
|
+
export interface BulkCheckAccessRequest {
|
|
52
|
+
accessIds: number[];
|
|
53
|
+
permission: string;
|
|
54
|
+
entityId?: number | null;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Request model for access inheritance operations
|
|
58
|
+
*/
|
|
59
|
+
export interface AccessInheritanceRequest {
|
|
60
|
+
accessId?: number | null;
|
|
61
|
+
connectionTypeId?: number;
|
|
62
|
+
enable?: boolean;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Request model for super admin operations
|
|
66
|
+
*/
|
|
67
|
+
export interface SuperAdminRequest {
|
|
68
|
+
accessId?: number | null;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Request model for parent access inheritance operations
|
|
72
|
+
* Mirrors C# ParentAccessInheritanceRequest
|
|
73
|
+
*/
|
|
74
|
+
export interface ParentAccessInheritanceRequest {
|
|
75
|
+
parentAccessId: number;
|
|
76
|
+
childAccessId?: number | null;
|
|
77
|
+
}
|
|
78
|
+
export interface ParentAccessInheritanceWithConceptRequest {
|
|
79
|
+
parentConceptId: number;
|
|
80
|
+
childConceptId?: number | null;
|
|
81
|
+
}
|
|
82
|
+
export interface BulkParentAccessInheritanceWithConceptRequest {
|
|
83
|
+
parentConceptId: number;
|
|
84
|
+
childConceptIds: number[];
|
|
85
|
+
}
|
|
86
|
+
export interface BulkParentAccessInheritanceResult {
|
|
87
|
+
childConceptId: number;
|
|
88
|
+
accessId: number;
|
|
89
|
+
success: boolean;
|
|
90
|
+
message?: string;
|
|
91
|
+
}
|
|
92
|
+
export interface SuperAdminWithConceptRequest {
|
|
93
|
+
conceptId: number;
|
|
94
|
+
}
|
|
95
|
+
export interface AccessInheritanceWithConceptRequest {
|
|
96
|
+
conceptId: number;
|
|
97
|
+
connectionTypeId?: number;
|
|
98
|
+
enable?: boolean;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Standard API response wrapper for access control endpoints
|
|
102
|
+
*/
|
|
103
|
+
export interface AccessControlAPIResponse<T = unknown> {
|
|
104
|
+
status: boolean;
|
|
105
|
+
message?: string;
|
|
106
|
+
data?: T;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Valid permissions for validation
|
|
110
|
+
*/
|
|
111
|
+
export declare const VALID_PERMISSIONS: Set<string>;
|
|
112
|
+
/**
|
|
113
|
+
* Check if a permission string is valid
|
|
114
|
+
*/
|
|
115
|
+
export declare function isValidPermission(permission: string): boolean;
|
|
116
|
+
/**
|
|
117
|
+
* Request model for adding access by entity
|
|
118
|
+
* Mirrors C# AddAccessByEntityRequest
|
|
119
|
+
*/
|
|
120
|
+
export interface AddAccessByEntityRequest {
|
|
121
|
+
conceptId: number;
|
|
122
|
+
access: string;
|
|
123
|
+
entityId: number;
|
|
124
|
+
makePublic: boolean;
|
|
125
|
+
nestedAccessLevel: number;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Request model for adding public access to concept
|
|
129
|
+
* Mirrors C# AddPublicAccessToConcept
|
|
130
|
+
*/
|
|
131
|
+
export interface AddPublicAccessToConcept {
|
|
132
|
+
conceptId: number;
|
|
133
|
+
conceptIdList: number[];
|
|
134
|
+
accessList: string[];
|
|
135
|
+
nestedAccessLevel: number;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Request model for bulk adding access by entity
|
|
139
|
+
* Mirrors C# AddAccessByEntityBulkRequest
|
|
140
|
+
*/
|
|
141
|
+
export interface AddAccessByEntityBulkRequest {
|
|
142
|
+
conceptId: number;
|
|
143
|
+
conceptIdList: number[];
|
|
144
|
+
entityIdList: number[];
|
|
145
|
+
accessList: string[];
|
|
146
|
+
nestedAccessLevel: number;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Request model for adding access by user
|
|
150
|
+
* Mirrors C# AddAccessByUserRequest
|
|
151
|
+
*/
|
|
152
|
+
export interface AddAccessByUserRequest {
|
|
153
|
+
conceptId: number;
|
|
154
|
+
access: string;
|
|
155
|
+
userId: number;
|
|
156
|
+
makePublic: boolean;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Request model for checking bulk access
|
|
160
|
+
* Mirrors C# CheckAccessBulk
|
|
161
|
+
*/
|
|
162
|
+
export interface CheckAccessBulk {
|
|
163
|
+
userId: number;
|
|
164
|
+
access: string;
|
|
165
|
+
conceptIdList: number[];
|
|
166
|
+
connectionIdList: number[];
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Alternative API response format
|
|
170
|
+
* Mirrors C# AccessControlApiResponse
|
|
171
|
+
*/
|
|
172
|
+
export interface AccessControlApiResponse {
|
|
173
|
+
success?: boolean | null;
|
|
174
|
+
data?: unknown;
|
|
175
|
+
message?: string | null;
|
|
176
|
+
}
|
|
@@ -43,6 +43,7 @@ export declare class BaseUrl {
|
|
|
43
43
|
static setNodeCacheUrl(cacheServerUrl?: string): void;
|
|
44
44
|
static setCacheServers(cacheServers?: string[]): void;
|
|
45
45
|
static GetReadBaseUrl(): string;
|
|
46
|
+
static GetNodeBaseUrl(): string;
|
|
46
47
|
static GetReadBaseUrlCandidates(): string[];
|
|
47
48
|
/**
|
|
48
49
|
* Returns the URL for retrieving a single concept by ID.
|
|
@@ -46,6 +46,7 @@ type CCSConfigOptions = Partial<Omit<CCSConfig, "cacheServers">> & {
|
|
|
46
46
|
cacheServer?: string;
|
|
47
47
|
cache_servers?: string[] | string;
|
|
48
48
|
};
|
|
49
|
+
export declare function normalizeCacheServers(cacheServers?: string[] | string): any[];
|
|
49
50
|
export declare class CCSConfig {
|
|
50
51
|
/** URL for the AI service. Defaults to "https://ai.freeschema.com" */
|
|
51
52
|
aiUrl: string;
|
|
@@ -57,6 +58,10 @@ export declare class CCSConfig {
|
|
|
57
58
|
accessToken: string;
|
|
58
59
|
/** Whether to enable AI features. Defaults to true */
|
|
59
60
|
enableAi: boolean;
|
|
61
|
+
/** Whether to enable access control checks. Defaults to false (allow all access). */
|
|
62
|
+
enableAccessControl: boolean;
|
|
63
|
+
/** Base URL for Access Control API. Falls back to env/default when not provided. */
|
|
64
|
+
accessControlBaseUrl?: string;
|
|
60
65
|
/**
|
|
61
66
|
* Dictionary of feature flags for controlling CCS behavior.
|
|
62
67
|
* Available flags:
|
|
@@ -96,6 +101,8 @@ export declare class CCSConfig {
|
|
|
96
101
|
* const config = new CCSConfig({
|
|
97
102
|
* aiUrl: "https://custom-ai.example.com",
|
|
98
103
|
* enableAi: false,
|
|
104
|
+
* enableAccessControl: true,
|
|
105
|
+
* accessControlBaseUrl: "https://access.example.com/api/access-control",
|
|
99
106
|
* clientId: "123456",
|
|
100
107
|
* clientSecret: "secret",
|
|
101
108
|
* flags: {
|
|
@@ -171,12 +171,15 @@ export declare class Transaction {
|
|
|
171
171
|
*/
|
|
172
172
|
DeleteConnectionsBetween(query: Partial<FetchConnectionQuery>): Promise<number[]>;
|
|
173
173
|
/**
|
|
174
|
-
* Queues connections matching multiple queries for deletion on commit
|
|
174
|
+
* Queues connections matching multiple queries for deletion on commit, plus
|
|
175
|
+
* any already-known connection IDs passed directly.
|
|
175
176
|
*
|
|
176
|
-
* The queries are resolved in one API call
|
|
177
|
-
* merged into this transaction's pending
|
|
177
|
+
* The queries (if any) are resolved in one API call; their connection IDs
|
|
178
|
+
* are merged with `knownConnectionIds` into this transaction's pending
|
|
179
|
+
* deletion queue. Pass an empty `queries` array to queue only IDs you
|
|
180
|
+
* already have, with no extra lookup call.
|
|
178
181
|
*/
|
|
179
|
-
DeleteConnectionsBetweenBulk(queries: Partial<FetchConnectionQuery>[]): Promise<number[]>;
|
|
182
|
+
DeleteConnectionsBetweenBulk(queries: Partial<FetchConnectionQuery>[], knownConnectionIds?: number[]): Promise<number[]>;
|
|
180
183
|
/**
|
|
181
184
|
* Creates a new instance concept within the transaction.
|
|
182
185
|
* The concept represents a data instance of a specified type with associated metadata.
|
|
@@ -214,7 +217,6 @@ export declare class Transaction {
|
|
|
214
217
|
* ```
|
|
215
218
|
*/
|
|
216
219
|
MakeTheInstanceConcept(type: string, referent: string, composition: boolean | undefined, userId: number, accessId: number, sessionInformationId?: number, referentId?: number): Promise<Concept>;
|
|
217
|
-
CreateReferentConcept(type: string, referentConcept: Concept | number, characterValue?: string, userId?: number, accessId?: number, sessionInformationId?: number): Promise<Concept>;
|
|
218
220
|
CreateTypeConcept(typeConcept: Concept | number, characterValue: string, userId?: number, accessId?: number, sessionInformationId?: number): Promise<Concept>;
|
|
219
221
|
/**
|
|
220
222
|
* Creates a connection between two concepts within the transaction.
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* APIClientService
|
|
3
|
+
*
|
|
4
|
+
* API client service for Access Control endpoints.
|
|
5
|
+
* Provides typed HTTP methods for all access control API operations.
|
|
6
|
+
*
|
|
7
|
+
* This is the TypeScript equivalent of the C# APIClientService class.
|
|
8
|
+
*/
|
|
9
|
+
import { AccessRequest, AccessResult, AccessControlAPIResponse, BulkAccessRequest, BulkCheckAccessRequest, AccessInheritanceRequest, SuperAdminRequest, ParentAccessInheritanceRequest, ParentAccessInheritanceWithConceptRequest, BulkParentAccessInheritanceWithConceptRequest, BulkParentAccessInheritanceResult, SuperAdminWithConceptRequest, AccessInheritanceWithConceptRequest } from '../../DataStructures/AccessControl/AccessControlModels';
|
|
10
|
+
export interface IAPIClientService {
|
|
11
|
+
assignAccessAsync(request: AccessRequest): Promise<AccessControlAPIResponse<AccessResult>>;
|
|
12
|
+
checkAccessAsync(request: AccessRequest): Promise<AccessControlAPIResponse<AccessResult>>;
|
|
13
|
+
revokeAccessAsync(request: AccessRequest): Promise<AccessControlAPIResponse<AccessResult>>;
|
|
14
|
+
assignAccessBulkAsync(request: BulkAccessRequest): Promise<AccessControlAPIResponse<AccessResult[]>>;
|
|
15
|
+
revokeAccessBulkAsync(request: BulkAccessRequest): Promise<AccessControlAPIResponse<AccessResult[]>>;
|
|
16
|
+
checkAccessBulkAsync(request: BulkCheckAccessRequest): Promise<AccessControlAPIResponse<AccessResult[]>>;
|
|
17
|
+
getAccessByIdAsync(accessId: number): Promise<AccessControlAPIResponse<AccessResult[]>>;
|
|
18
|
+
setAccessInheritanceAsync(request: AccessInheritanceRequest): Promise<AccessControlAPIResponse>;
|
|
19
|
+
getAccessInheritanceStatusAsync(accessId: number, connectionTypeId?: number): Promise<AccessControlAPIResponse>;
|
|
20
|
+
assignSuperAdminAccessAsync(request: SuperAdminRequest): Promise<AccessControlAPIResponse>;
|
|
21
|
+
revokeSuperAdminAccessAsync(request: SuperAdminRequest): Promise<AccessControlAPIResponse>;
|
|
22
|
+
checkSuperAdminStatusAsync(accessId: number): Promise<AccessControlAPIResponse>;
|
|
23
|
+
setParentAccessInheritanceAsync(request: ParentAccessInheritanceRequest): Promise<AccessControlAPIResponse>;
|
|
24
|
+
removeParentAccessInheritanceAsync(accessId: number, parentAccessId?: number): Promise<AccessControlAPIResponse>;
|
|
25
|
+
hasParentAccessInheritanceAsync(accessId: number, parentAccessId?: number): Promise<AccessControlAPIResponse>;
|
|
26
|
+
getParentAccessIdAsync(accessId: number): Promise<AccessControlAPIResponse>;
|
|
27
|
+
setParentAccessInheritanceByConceptAsync(request: ParentAccessInheritanceWithConceptRequest): Promise<AccessControlAPIResponse>;
|
|
28
|
+
setParentAccessInheritanceBulkByConceptAsync(request: BulkParentAccessInheritanceWithConceptRequest): Promise<AccessControlAPIResponse<BulkParentAccessInheritanceResult[]>>;
|
|
29
|
+
removeParentAccessInheritanceByConceptAsync(childConceptId: number, parentConceptId?: number): Promise<AccessControlAPIResponse>;
|
|
30
|
+
removeParentAccessInheritanceBulkByConceptAsync(request: BulkParentAccessInheritanceWithConceptRequest): Promise<AccessControlAPIResponse<BulkParentAccessInheritanceResult[]>>;
|
|
31
|
+
hasParentAccessInheritanceByConceptAsync(childConceptId: number, parentConceptId?: number): Promise<AccessControlAPIResponse>;
|
|
32
|
+
getParentAccessIdByConceptAsync(childConceptId: number): Promise<AccessControlAPIResponse>;
|
|
33
|
+
assignSuperAdminByConceptAsync(request: SuperAdminWithConceptRequest): Promise<AccessControlAPIResponse>;
|
|
34
|
+
revokeSuperAdminByConceptAsync(request: SuperAdminWithConceptRequest): Promise<AccessControlAPIResponse>;
|
|
35
|
+
checkSuperAdminByConceptAsync(conceptId: number): Promise<AccessControlAPIResponse>;
|
|
36
|
+
setAccessInheritanceByConceptAsync(request: AccessInheritanceWithConceptRequest): Promise<AccessControlAPIResponse>;
|
|
37
|
+
getAccessInheritanceStatusByConceptAsync(conceptId: number, connectionTypeId?: number): Promise<AccessControlAPIResponse>;
|
|
38
|
+
}
|
|
39
|
+
export declare class APIClientService implements IAPIClientService {
|
|
40
|
+
private readonly baseUrl;
|
|
41
|
+
constructor(baseUrl?: string);
|
|
42
|
+
/**
|
|
43
|
+
* Perform a GET request and return typed response
|
|
44
|
+
*/
|
|
45
|
+
private getAsync;
|
|
46
|
+
/**
|
|
47
|
+
* Perform a POST request with JSON body and return typed response
|
|
48
|
+
*/
|
|
49
|
+
private postAsync;
|
|
50
|
+
/**
|
|
51
|
+
* Perform a DELETE request with optional JSON body and return typed response
|
|
52
|
+
*/
|
|
53
|
+
private deleteAsync;
|
|
54
|
+
/**
|
|
55
|
+
* Assign access to an entity
|
|
56
|
+
*/
|
|
57
|
+
assignAccessAsync(request: AccessRequest): Promise<AccessControlAPIResponse<AccessResult>>;
|
|
58
|
+
/**
|
|
59
|
+
* Check if an entity has access
|
|
60
|
+
*/
|
|
61
|
+
checkAccessAsync(request: AccessRequest): Promise<AccessControlAPIResponse<AccessResult>>;
|
|
62
|
+
/**
|
|
63
|
+
* Revoke access from an entity
|
|
64
|
+
*/
|
|
65
|
+
revokeAccessAsync(request: AccessRequest): Promise<AccessControlAPIResponse<AccessResult>>;
|
|
66
|
+
/**
|
|
67
|
+
* Assign access to multiple targets in bulk
|
|
68
|
+
*/
|
|
69
|
+
assignAccessBulkAsync(request: BulkAccessRequest): Promise<AccessControlAPIResponse<AccessResult[]>>;
|
|
70
|
+
/**
|
|
71
|
+
* Revoke access from multiple targets in bulk
|
|
72
|
+
*/
|
|
73
|
+
revokeAccessBulkAsync(request: BulkAccessRequest): Promise<AccessControlAPIResponse<AccessResult[]>>;
|
|
74
|
+
/**
|
|
75
|
+
* Check access for multiple targets in bulk
|
|
76
|
+
*/
|
|
77
|
+
checkAccessBulkAsync(request: BulkCheckAccessRequest): Promise<AccessControlAPIResponse<AccessResult[]>>;
|
|
78
|
+
/**
|
|
79
|
+
* Get all access entries for a specific accessId
|
|
80
|
+
*/
|
|
81
|
+
getAccessByIdAsync(accessId: number): Promise<AccessControlAPIResponse<AccessResult[]>>;
|
|
82
|
+
/**
|
|
83
|
+
* Set access inheritance for an access ID
|
|
84
|
+
*/
|
|
85
|
+
setAccessInheritanceAsync(request: AccessInheritanceRequest): Promise<AccessControlAPIResponse>;
|
|
86
|
+
/**
|
|
87
|
+
* Get access inheritance status
|
|
88
|
+
*/
|
|
89
|
+
getAccessInheritanceStatusAsync(accessId: number, connectionTypeId?: number): Promise<AccessControlAPIResponse>;
|
|
90
|
+
/**
|
|
91
|
+
* Assign super admin access
|
|
92
|
+
*/
|
|
93
|
+
assignSuperAdminAccessAsync(request: SuperAdminRequest): Promise<AccessControlAPIResponse>;
|
|
94
|
+
/**
|
|
95
|
+
* Revoke super admin access
|
|
96
|
+
*/
|
|
97
|
+
revokeSuperAdminAccessAsync(request: SuperAdminRequest): Promise<AccessControlAPIResponse>;
|
|
98
|
+
/**
|
|
99
|
+
* Check super admin status
|
|
100
|
+
*/
|
|
101
|
+
checkSuperAdminStatusAsync(accessId: number): Promise<AccessControlAPIResponse>;
|
|
102
|
+
/**
|
|
103
|
+
* Set parent access inheritance link
|
|
104
|
+
*/
|
|
105
|
+
setParentAccessInheritanceAsync(request: ParentAccessInheritanceRequest): Promise<AccessControlAPIResponse>;
|
|
106
|
+
/**
|
|
107
|
+
* Remove parent access inheritance link
|
|
108
|
+
*/
|
|
109
|
+
removeParentAccessInheritanceAsync(accessId: number, parentAccessId?: number): Promise<AccessControlAPIResponse>;
|
|
110
|
+
/**
|
|
111
|
+
* Check if parent access inheritance link exists
|
|
112
|
+
*/
|
|
113
|
+
hasParentAccessInheritanceAsync(accessId: number, parentAccessId?: number): Promise<AccessControlAPIResponse>;
|
|
114
|
+
/**
|
|
115
|
+
* Get the parent access ID for a given access ID
|
|
116
|
+
*/
|
|
117
|
+
getParentAccessIdAsync(accessId: number): Promise<AccessControlAPIResponse>;
|
|
118
|
+
/**
|
|
119
|
+
* Set parent access inheritance by concept IDs (server resolves conceptId → accessId)
|
|
120
|
+
*/
|
|
121
|
+
setParentAccessInheritanceByConceptAsync(request: ParentAccessInheritanceWithConceptRequest): Promise<AccessControlAPIResponse>;
|
|
122
|
+
/**
|
|
123
|
+
* Set parent access inheritance for multiple children with one parent (concept-based)
|
|
124
|
+
*/
|
|
125
|
+
setParentAccessInheritanceBulkByConceptAsync(request: BulkParentAccessInheritanceWithConceptRequest): Promise<AccessControlAPIResponse<BulkParentAccessInheritanceResult[]>>;
|
|
126
|
+
/**
|
|
127
|
+
* Remove parent access inheritance by concept IDs
|
|
128
|
+
*/
|
|
129
|
+
removeParentAccessInheritanceByConceptAsync(childConceptId: number, parentConceptId?: number): Promise<AccessControlAPIResponse>;
|
|
130
|
+
/**
|
|
131
|
+
* Remove parent access inheritance for multiple children (concept-based)
|
|
132
|
+
*/
|
|
133
|
+
removeParentAccessInheritanceBulkByConceptAsync(request: BulkParentAccessInheritanceWithConceptRequest): Promise<AccessControlAPIResponse<BulkParentAccessInheritanceResult[]>>;
|
|
134
|
+
/**
|
|
135
|
+
* Check if parent access inheritance exists by concept IDs
|
|
136
|
+
*/
|
|
137
|
+
hasParentAccessInheritanceByConceptAsync(childConceptId: number, parentConceptId?: number): Promise<AccessControlAPIResponse>;
|
|
138
|
+
/**
|
|
139
|
+
* Get the parent access ID by child concept ID
|
|
140
|
+
*/
|
|
141
|
+
getParentAccessIdByConceptAsync(childConceptId: number): Promise<AccessControlAPIResponse>;
|
|
142
|
+
/**
|
|
143
|
+
* Assign super admin by concept ID
|
|
144
|
+
*/
|
|
145
|
+
assignSuperAdminByConceptAsync(request: SuperAdminWithConceptRequest): Promise<AccessControlAPIResponse>;
|
|
146
|
+
/**
|
|
147
|
+
* Revoke super admin by concept ID
|
|
148
|
+
*/
|
|
149
|
+
revokeSuperAdminByConceptAsync(request: SuperAdminWithConceptRequest): Promise<AccessControlAPIResponse>;
|
|
150
|
+
/**
|
|
151
|
+
* Check super admin status by concept ID
|
|
152
|
+
*/
|
|
153
|
+
checkSuperAdminByConceptAsync(conceptId: number): Promise<AccessControlAPIResponse>;
|
|
154
|
+
/**
|
|
155
|
+
* Set access inheritance by concept ID
|
|
156
|
+
*/
|
|
157
|
+
setAccessInheritanceByConceptAsync(request: AccessInheritanceWithConceptRequest): Promise<AccessControlAPIResponse>;
|
|
158
|
+
/**
|
|
159
|
+
* Get access inheritance status by concept ID
|
|
160
|
+
*/
|
|
161
|
+
getAccessInheritanceStatusByConceptAsync(conceptId: number, connectionTypeId?: number): Promise<AccessControlAPIResponse>;
|
|
162
|
+
}
|
|
@@ -1,19 +1,77 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
/**
|
|
2
|
+
* CacheService
|
|
3
|
+
*
|
|
4
|
+
* Thread-safe in-memory cache for access checks with TTL-based expiration.
|
|
5
|
+
* Supports single and bulk queries with secondary indexes.
|
|
6
|
+
* Key format: "{accessId}:{permission}:{entityId}"
|
|
7
|
+
* Value: CacheEntry { value: boolean, expiresAt: number }
|
|
8
|
+
*
|
|
9
|
+
* This is the TypeScript equivalent of the C# CacheService class.
|
|
10
|
+
*/
|
|
11
|
+
export interface ICacheService {
|
|
12
|
+
get(accessId: number, permission: string, entityId?: number | null): boolean | null;
|
|
13
|
+
set(accessId: number, permission: string, entityId: number | null | undefined, hasAccess: boolean): void;
|
|
14
|
+
remove(accessId: number, permission: string, entityId?: number | null): void;
|
|
15
|
+
clear(): void;
|
|
16
|
+
getPermissionsByAccessAndEntity(accessId: number, entityId?: number | null): Map<string, boolean>;
|
|
17
|
+
getPermissionsByAccess(accessId: number): Map<string, boolean>;
|
|
18
|
+
getPermissionsByEntity(entityId: number): Map<string, boolean>;
|
|
19
|
+
getSuperAdmin(entityId: number): boolean | null;
|
|
20
|
+
setSuperAdmin(entityId: number, isSuperAdmin: boolean): void;
|
|
21
|
+
clearSuperAdminCache(): void;
|
|
22
|
+
}
|
|
23
|
+
export declare class CacheService implements ICacheService {
|
|
24
|
+
private readonly accessCache;
|
|
25
|
+
private readonly accessIndex;
|
|
26
|
+
private readonly entityIndex;
|
|
27
|
+
private static readonly superAdminCache;
|
|
28
|
+
private setCounter;
|
|
29
|
+
/**
|
|
30
|
+
* Generate a cache key from accessId, permission, and entityId
|
|
31
|
+
*/
|
|
32
|
+
private generateKey;
|
|
33
|
+
/**
|
|
34
|
+
* Get cached access. Returns true/false if present and not expired, null if not cached or expired.
|
|
35
|
+
*/
|
|
36
|
+
get(accessId: number, permission: string, entityId?: number | null): boolean | null;
|
|
37
|
+
/**
|
|
38
|
+
* Set or update cached access with TTL
|
|
39
|
+
*/
|
|
40
|
+
set(accessId: number, permission: string, entityId: number | null | undefined, hasAccess: boolean): void;
|
|
41
|
+
/**
|
|
42
|
+
* Remove a cached entry (e.g., after revoke)
|
|
43
|
+
*/
|
|
44
|
+
remove(accessId: number, permission: string, entityId?: number | null): void;
|
|
45
|
+
/**
|
|
46
|
+
* Clear all cached access entries
|
|
47
|
+
*/
|
|
48
|
+
clear(): void;
|
|
49
|
+
/**
|
|
50
|
+
* Sweep all expired entries from access cache, indexes, and super admin cache
|
|
51
|
+
*/
|
|
52
|
+
private sweepExpired;
|
|
53
|
+
/**
|
|
54
|
+
* Get all permissions for a specific accessId + entityId (excludes expired entries)
|
|
55
|
+
*/
|
|
56
|
+
getPermissionsByAccessAndEntity(accessId: number, entityId?: number | null): Map<string, boolean>;
|
|
57
|
+
/**
|
|
58
|
+
* Get all permissions for a specific accessId across all entities (excludes expired entries)
|
|
59
|
+
*/
|
|
60
|
+
getPermissionsByAccess(accessId: number): Map<string, boolean>;
|
|
61
|
+
/**
|
|
62
|
+
* Get all permissions for a specific entity across all accessIds (excludes expired entries)
|
|
63
|
+
*/
|
|
64
|
+
getPermissionsByEntity(entityId: number): Map<string, boolean>;
|
|
65
|
+
/**
|
|
66
|
+
* Get cached super admin status for an entity (returns null if expired or not cached)
|
|
67
|
+
*/
|
|
68
|
+
getSuperAdmin(entityId: number): boolean | null;
|
|
69
|
+
/**
|
|
70
|
+
* Set super admin status for an entity with TTL
|
|
71
|
+
*/
|
|
72
|
+
setSuperAdmin(entityId: number, isSuperAdmin: boolean): void;
|
|
73
|
+
/**
|
|
74
|
+
* Clear the super admin cache
|
|
75
|
+
*/
|
|
76
|
+
clearSuperAdminCache(): void;
|
|
19
77
|
}
|