mftsccs-node 0.2.20 → 0.2.22

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.
@@ -75,6 +75,28 @@ export interface ParentAccessInheritanceRequest {
75
75
  parentAccessId: number;
76
76
  childAccessId?: number | null;
77
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
+ }
78
100
  /**
79
101
  * Standard API response wrapper for access control endpoints
80
102
  */
@@ -47,6 +47,8 @@ export declare class CCSConfig {
47
47
  accessToken: string;
48
48
  /** Whether to enable AI features. Defaults to true */
49
49
  enableAi: boolean;
50
+ /** Whether to enable access control checks. Defaults to false (allow all access). */
51
+ enableAccessControl: boolean;
50
52
  /**
51
53
  * Dictionary of feature flags for controlling CCS behavior.
52
54
  * Available flags:
@@ -86,6 +88,7 @@ export declare class CCSConfig {
86
88
  * const config = new CCSConfig({
87
89
  * aiUrl: "https://custom-ai.example.com",
88
90
  * enableAi: false,
91
+ * enableAccessControl: true,
89
92
  * clientId: "123456",
90
93
  * clientSecret: "secret",
91
94
  * flags: {
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This is the TypeScript equivalent of the C# APIClientService class.
8
8
  */
9
- import { AccessRequest, AccessResult, AccessControlAPIResponse, BulkAccessRequest, BulkCheckAccessRequest, AccessInheritanceRequest, SuperAdminRequest, ParentAccessInheritanceRequest } from '../../DataStructures/AccessControl/AccessControlModels';
9
+ import { AccessRequest, AccessResult, AccessControlAPIResponse, BulkAccessRequest, BulkCheckAccessRequest, AccessInheritanceRequest, SuperAdminRequest, ParentAccessInheritanceRequest, ParentAccessInheritanceWithConceptRequest, BulkParentAccessInheritanceWithConceptRequest, BulkParentAccessInheritanceResult, SuperAdminWithConceptRequest, AccessInheritanceWithConceptRequest } from '../../DataStructures/AccessControl/AccessControlModels';
10
10
  export interface IAPIClientService {
11
11
  assignAccessAsync(request: AccessRequest): Promise<AccessControlAPIResponse<AccessResult>>;
12
12
  checkAccessAsync(request: AccessRequest): Promise<AccessControlAPIResponse<AccessResult>>;
@@ -24,6 +24,17 @@ export interface IAPIClientService {
24
24
  removeParentAccessInheritanceAsync(accessId: number, parentAccessId?: number): Promise<AccessControlAPIResponse>;
25
25
  hasParentAccessInheritanceAsync(accessId: number, parentAccessId?: number): Promise<AccessControlAPIResponse>;
26
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>;
27
38
  }
28
39
  export declare class APIClientService implements IAPIClientService {
29
40
  private readonly baseUrl;
@@ -104,4 +115,48 @@ export declare class APIClientService implements IAPIClientService {
104
115
  * Get the parent access ID for a given access ID
105
116
  */
106
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>;
107
162
  }
@@ -11,12 +11,22 @@
11
11
  * This is the TypeScript equivalent of the C# AccessControlService class (v3.4.0).
12
12
  * All methods are static and can be called directly on the class.
13
13
  */
14
- import { AccessResult, BulkAccessRequest } from '../../DataStructures/AccessControl/AccessControlModels';
14
+ import { AccessResult, BulkAccessRequest, BulkParentAccessInheritanceResult } from '../../DataStructures/AccessControl/AccessControlModels';
15
15
  import { PermissionSet } from './PermissionSet';
16
16
  export declare class AccessControlService {
17
17
  private static cacheService;
18
18
  private static apiClient;
19
+ private static isAccessControlEnabled;
19
20
  private static initialize;
21
+ /**
22
+ * Enable or disable access control checks globally.
23
+ * When disabled, checkAccess/checkAccessBulk/getConceptIdsWithPermission allow all input concepts.
24
+ */
25
+ static setEnabled(isEnabled: boolean): void;
26
+ /**
27
+ * Returns whether access control checks are currently enabled.
28
+ */
29
+ static getEnabled(): boolean;
20
30
  /**
21
31
  * Check whether a user/entity has the specified permission on a single concept.
22
32
  * Delegates to checkAccessBulk for full inheritance + group resolution.
@@ -139,26 +149,26 @@ export declare class AccessControlService {
139
149
  * Set parent access inheritance link for a concept
140
150
  *
141
151
  * @param conceptId - The child concept ID
142
- * @param parentAccessId - The parent access ID to inherit from
152
+ * @param parentConceptId - The parent concept ID to inherit from
143
153
  * @returns Promise<number> - The new access ID, or existing access ID
144
154
  */
145
- static setParentAccessInheritance(conceptId: number, parentAccessId: number): Promise<number>;
155
+ static setParentAccessInheritance(conceptId: number, parentConceptId: number): Promise<number>;
146
156
  /**
147
157
  * Remove parent access inheritance link
148
158
  *
149
159
  * @param conceptId - The child concept ID
150
- * @param parentAccessId - Optional parent access ID (removes specific link or all)
160
+ * @param parentConceptId - Optional parent concept ID (removes specific link or all)
151
161
  * @returns Promise<string> - Status message
152
162
  */
153
- static removeParentAccessInheritance(conceptId: number, parentAccessId?: number): Promise<string>;
163
+ static removeParentAccessInheritance(conceptId: number, parentConceptId?: number): Promise<string>;
154
164
  /**
155
165
  * Check if parent access inheritance link exists
156
166
  *
157
167
  * @param conceptId - The child concept ID
158
- * @param parentAccessId - Optional parent access ID to check specific link
168
+ * @param parentConceptId - Optional parent concept ID to check specific link
159
169
  * @returns Promise<boolean> - True if link exists
160
170
  */
161
- static hasParentAccessInheritance(conceptId: number, parentAccessId?: number): Promise<boolean>;
171
+ static hasParentAccessInheritance(conceptId: number, parentConceptId?: number): Promise<boolean>;
162
172
  /**
163
173
  * Get the parent access ID for a concept
164
174
  *
@@ -166,6 +176,22 @@ export declare class AccessControlService {
166
176
  * @returns Promise<number | null> - Parent access ID or null
167
177
  */
168
178
  static getParentAccessId(conceptId: number): Promise<number | null>;
179
+ /**
180
+ * Set parent access inheritance for multiple children with one parent
181
+ *
182
+ * @param childConceptIds - List of child concept IDs
183
+ * @param parentConceptId - The parent concept ID to inherit from
184
+ * @returns Promise<BulkParentAccessInheritanceResult[]> - Results per child
185
+ */
186
+ static setParentAccessInheritanceBulk(childConceptIds: number[], parentConceptId: number): Promise<BulkParentAccessInheritanceResult[]>;
187
+ /**
188
+ * Remove parent access inheritance for multiple children
189
+ *
190
+ * @param childConceptIds - List of child concept IDs
191
+ * @param parentConceptId - Optional parent concept ID
192
+ * @returns Promise<BulkParentAccessInheritanceResult[]> - Results per child
193
+ */
194
+ static removeParentAccessInheritanceBulk(childConceptIds: number[], parentConceptId?: number): Promise<BulkParentAccessInheritanceResult[]>;
169
195
  /**
170
196
  * Check if an entity is a super admin
171
197
  * Uses caching for performance
@@ -212,4 +238,12 @@ export declare class AccessControlService {
212
238
  * Clear super admin cache
213
239
  */
214
240
  static clearSuperAdminCache(): void;
241
+ /**
242
+ * Update access cache entry (for MQTT-driven cache sync)
243
+ */
244
+ static updateAccessCache(accessId: number, permission: string, entityId: number | null | undefined, hasAccess: boolean): void;
245
+ /**
246
+ * Update super admin cache entry (for MQTT-driven cache sync)
247
+ */
248
+ static updateSuperAdminCache(entityId: number, isSuperAdmin: boolean): void;
215
249
  }
@@ -162,7 +162,8 @@ declare function updateAccessToken(accessToken?: string): void;
162
162
  * clientId: '101084838',
163
163
  * clientSecret: 'your-client-secret',
164
164
  * aiUrl: 'https://ai.freeschema.com',
165
- * enableAi: true
165
+ * enableAi: true,
166
+ * enableAccessControl: true
166
167
  * });
167
168
  * init('https://api.freeschema.com', '', 'MyApp', config);
168
169
  * ```
@@ -174,6 +175,7 @@ declare function updateAccessToken(accessToken?: string): void;
174
175
  * aiUrl: 'https://ai.example.com',
175
176
  * accessToken: 'token',
176
177
  * enableAi: true,
178
+ * enableAccessControl: true,
177
179
  * flags: {
178
180
  * logApplication: true,
179
181
  * accessTracker: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mftsccs-node",
3
- "version": "0.2.20",
3
+ "version": "0.2.22",
4
4
  "environment": "production",
5
5
  "description": "Full Pack of concept and connection system",
6
6
  "main": "dist/bundle.js",