mftsccs-node 0.2.1 → 0.2.3

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.
@@ -16,6 +16,7 @@ export declare class FreeschemaQuery {
16
16
  name: string;
17
17
  reverse: boolean;
18
18
  limit: boolean;
19
+ filterAncestor: string;
19
20
  includeInFilter: boolean;
20
21
  isOldConnectionType: boolean;
21
22
  }
@@ -1,8 +1,15 @@
1
1
  import { Concept } from "./Concept";
2
2
  import { Connection } from "./Connection";
3
+ import { InnerActions } from "./Transaction/Transaction";
4
+ type syncContainer = {
5
+ id: string;
6
+ data: InnerActions;
7
+ createdDate: string;
8
+ };
3
9
  export declare class SyncData {
4
10
  static conceptsSyncArray: Concept[];
5
11
  static connectionSyncArray: Connection[];
12
+ static transactionCollections: syncContainer[];
6
13
  static CheckContains(concept: Concept): boolean;
7
14
  static SyncDataDelete(id: number): void;
8
15
  static CheckContainsConnection(connection: Connection): boolean;
@@ -10,6 +17,10 @@ export declare class SyncData {
10
17
  static RemoveConcept(concept: Concept): void;
11
18
  static AddConnection(connection: Connection): void;
12
19
  static RemoveConnection(connection: Connection): void;
13
- static SyncDataOnline(): Promise<string>;
20
+ static SyncDataOnline(transactionId?: string): Promise<"done" | undefined>;
21
+ static initializeTransaction(transactionId: string): Promise<void>;
22
+ static markTransactionActions(transactionId: string, actions: InnerActions): Promise<void>;
23
+ static rollbackTransaction(transactionId: string, actions: InnerActions): Promise<void>;
14
24
  static syncDataLocalDb(): Promise<string>;
15
25
  }
26
+ export {};
@@ -0,0 +1,30 @@
1
+ import { Concept } from "../Concept";
2
+ import { Connection } from "../Connection";
3
+ export declare class Transaction {
4
+ protected transactionId: string;
5
+ actions: InnerActions;
6
+ protected success: boolean;
7
+ constructor();
8
+ initialize(): Promise<void>;
9
+ /**
10
+ * Method to move concepts and connection to transaction collection
11
+ * @param concept Concept
12
+ */
13
+ protected markAction(): Promise<void>;
14
+ /**
15
+ * Method to rollback all the tranctions occured
16
+ */
17
+ rollbackTransaction(): Promise<void>;
18
+ commitTransaction(): Promise<void>;
19
+ /**
20
+ * Concepts
21
+ */
22
+ MakeTheInstanceConcept(type: string, referent: string, composition: boolean | undefined, userId: number, accessId: number, sessionInformationId?: number, referentId?: number): Promise<Concept>;
23
+ CreateConnection(ofTheConcept: Concept, toTheConcept: Concept, typeConnection: string): Promise<Connection>;
24
+ MakeTheTypeConcept(typeString: string, sessionId: number, sessionUserId: number, userId: number): Promise<Concept>;
25
+ CreateTheConnectionGeneral(ofTheConceptId: number, ofTheConceptUserId: number, toTheConceptId: number, toTheConceptUserId: number, typeId: number, sessionInformationId: number, sessionInformationUserId: number, orderId?: number, accessId?: number, passedUserId?: number): Promise<Connection>;
26
+ }
27
+ export interface InnerActions {
28
+ concepts: Concept[];
29
+ connections: Connection[];
30
+ }
@@ -2,16 +2,18 @@ import { PermissionSet } from './PermissionSet';
2
2
  export declare class AccessControlCacheService {
3
3
  private readonly userAccessCache;
4
4
  private readonly publicAccessCache;
5
+ private readonly baseUrl;
5
6
  constructor();
6
7
  loadCacheFromApi(entityId?: number): Promise<void>;
7
8
  loadCacheFromJson(jsonData: any): void;
8
- hasAccess(entityId: number, conceptId: number, required: PermissionSet): boolean;
9
- getAccessibleConcepts(entityId: number, conceptIds: number[], required: PermissionSet): number[];
10
- getAccessByUser(entityId: number): Map<number, PermissionSet>;
11
- getAccessByConcept(conceptId: number): Map<number, PermissionSet>;
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>>;
12
13
  deleteRecordByUserId(entityId: number): void;
14
+ deletePublicAccessRecordById(conceptId: number): void;
13
15
  clearCache(): void;
14
- getConceptsByPublicAccess(conceptIds: number[]): Promise<void>;
15
- hasPublicAccess(conceptId: number, required: PermissionSet): boolean;
16
+ getConceptsByPublicAccess(): Promise<Record<number, string[]>>;
17
+ hasPublicAccess(conceptId: number, required: PermissionSet): Promise<boolean>;
16
18
  getConceptsWithPublicAccess(conceptIds: number[], required: PermissionSet): Promise<number[]>;
17
19
  }
@@ -1,4 +1,267 @@
1
- import { PermissionSet } from './PermissionSet';
2
- export declare function CheckAccessOfConcept(userId: number, access: PermissionSet, conceptId: number): Promise<boolean>;
3
- export declare function CheckAccessOfConceptList(userId: number, access: PermissionSet, conceptIdList: number[]): Promise<boolean>;
4
- export declare function FilterConceptListByAccess(userId: number, access: PermissionSet, conceptIdList: number[]): Promise<number[]>;
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,4 +1,5 @@
1
1
  import { Concept } from "../DataStructures/Concept";
2
- export default function CreateTheConcept(referent: string, userId: number, categoryId: number, categoryUserId: number, typeId: number, typeUserId: number, referentId: number, referentUserId: number, securityId: number, securityUserId: number, accessId: number, accessUserId: number, sessionInformationId: number, sessionInformationUserId: number): Promise<Concept>;
2
+ import { InnerActions } from "../DataStructures/Transaction/Transaction";
3
+ export default function CreateTheConcept(referent: string, userId: number, categoryId: number, categoryUserId: number, typeId: number, typeUserId: number, referentId: number, referentUserId: number, securityId: number, securityUserId: number, accessId: number, accessUserId: number, sessionInformationId: number, sessionInformationUserId: number, actions?: InnerActions): Promise<Concept>;
3
4
  export declare function CreateTheConceptTemporary(referent: string, userId: number, categoryId: number, categoryUserId: number, typeId: number, typeUserId: number, referentId: number, referentUserId: number, securityId: number, securityUserId: number, accessId: number, accessUserId: number, sessionInformationId: number, sessionInformationUserId: number): Promise<Concept>;
4
- export declare function CreateTheConceptImmediate(referent: string, userId: number, categoryId: number, categoryUserId: number, typeId: number, typeUserId: number, referentId: number, referentUserId: number, securityId: number, securityUserId: number, accessId: number, accessUserId: number, sessionInformationId: number, sessionInformationUserId: number): Promise<Concept>;
5
+ export declare function CreateTheConceptImmediate(referent: string, userId: number, categoryId: number, categoryUserId: number, typeId: number, typeUserId: number, referentId: number, referentUserId: number, securityId: number, securityUserId: number, accessId: number, accessUserId: number, sessionInformationId: number, sessionInformationUserId: number, actions?: InnerActions): Promise<Concept>;
@@ -1,4 +1,5 @@
1
1
  import { Concept } from "../app";
2
2
  import { Connection } from "../DataStructures/Connection";
3
- export declare function CreateTheConnectionGeneral(ofTheConceptId: number, ofTheConceptUserId: number, toTheConceptId: number, toTheConceptUserId: number, typeId: number, sessionInformationId: number, sessionInformationUserId: number, orderId?: number, accessId?: number, passedUserId?: number): Promise<Connection>;
4
- export declare function CreateConnection(ofTheConcept: Concept, toTheConcept: Concept, connectionTypeString: string): Promise<Connection>;
3
+ import { InnerActions } from "../DataStructures/Transaction/Transaction";
4
+ export declare function CreateTheConnectionGeneral(ofTheConceptId: number, ofTheConceptUserId: number, toTheConceptId: number, toTheConceptUserId: number, typeId: number, sessionInformationId: number, sessionInformationUserId: number, orderId?: number, accessId?: number, passedUserId?: number, actions?: InnerActions): Promise<Connection>;
5
+ export declare function CreateConnection(ofTheConcept: Concept, toTheConcept: Concept, connectionTypeString: string, actions?: InnerActions): Promise<Connection>;
@@ -1,2 +1,3 @@
1
1
  import { Concept } from "../DataStructures/Concept";
2
- export default function MakeTheInstanceConcept(type: string, referent: string, composition: boolean | undefined, userId: number, passedAccessId: number, passedSessionId?: number, referentId?: number): Promise<Concept>;
2
+ import { InnerActions } from "../DataStructures/Transaction/Transaction";
3
+ export default function MakeTheInstanceConcept(type: string, referent: string, composition: boolean | undefined, userId: number, passedAccessId: number, passedSessionId?: number, referentId?: number, actions?: InnerActions): Promise<Concept>;
@@ -1,2 +1,3 @@
1
1
  import { Concept } from "../DataStructures/Concept";
2
- export declare function MakeTheTypeConcept(typeString: string, sessionId: number, sessionUserId: number, userId: number): Promise<Concept>;
2
+ import { InnerActions } from "../DataStructures/Transaction/Transaction";
3
+ export declare function MakeTheTypeConcept(typeString: string, sessionId: number, sessionUserId: number, userId: number, actions?: InnerActions): Promise<Concept>;
@@ -56,6 +56,8 @@ export { SearchLinkInternal } from './Services/Search/SearchLinkInternal';
56
56
  export { HandleHttpError } from './Services/Common/ErrorPosting';
57
57
  export { GetConceptByCharacterAndType } from './Api/GetConceptByCharacterAndType';
58
58
  export { GetConceptByCharacterAndCategoryDirectApi } from './Api/SearchConcept/GetConceptByCharacterAndCategoryDirect';
59
+ export { SearchLinkMultipleApi } from './Api/Search/SearchLinkMultipleApi';
60
+ export { GetCompositionWithIdFromMemoryFromConnections, GetCompositionWithIdFromMemory } from './Services/GetComposition';
59
61
  export { SyncData } from './DataStructures/SyncData';
60
62
  export { Concept } from './DataStructures/Concept';
61
63
  export { LConcept } from './DataStructures/Local/LConcept';
@@ -82,7 +84,8 @@ export { SchemaQueryListener } from './WrapperFunctions/SchemaQueryObservable';
82
84
  export { FreeschemaQuery } from './DataStructures/Search/FreeschemaQuery';
83
85
  export { GiveConnection, GetAllTheConnectionsByTypeAndOfTheConcept } from './Services/Delete/GetAllConnectionByType';
84
86
  export { DATAID, NORMAL, JUSTDATA, ALLID, DATAIDDATE, RAW, LISTNORMAL } from './Constants/FormatConstants';
85
- export { CheckAccessOfConcept, CheckAccessOfConceptList, FilterConceptListByAccess } from './Services/AccessControl/AccessControlService';
87
+ export { AccessControlService } from './Services/AccessControl/AccessControlService';
86
88
  export { PermissionSet } from './Services/AccessControl/PermissionSet';
89
+ export { Transaction } from './DataStructures/Transaction/Transaction';
87
90
  declare function updateAccessToken(accessToken?: string): void;
88
91
  declare function init(url?: string, aiurl?: string, accessToken?: string, jwtSecret?: string): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mftsccs-node",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "environment": "production",
5
5
  "description": "Full Pack of concept and connection system",
6
6
  "main": "dist/bundle.js",