itrm-tools 1.3.17 → 1.3.19-beta.1

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.
Files changed (51) hide show
  1. package/dist/api/alegra/AlegraConnectionManager.d.ts +30 -30
  2. package/dist/api/check/route/CorsCheckApiRouter.js +1 -1
  3. package/dist/api/check/route/CorsCheckApiRouter.js.map +1 -1
  4. package/dist/api/check/route/SimpleCheckableAPIRouter.js +4 -1
  5. package/dist/api/check/route/SimpleCheckableAPIRouter.js.map +1 -1
  6. package/dist/api/express/ExpressStandardConfiguration.js +7 -2
  7. package/dist/api/express/ExpressStandardConfiguration.js.map +1 -1
  8. package/dist/api/request/crud/CrudManager.d.ts +11 -11
  9. package/dist/api/request/crud/CrudServiceManager.d.ts +28 -28
  10. package/dist/api/request/crud/CrudServiceManager.js +98 -98
  11. package/dist/api/request/crud/CrudServiceManager.js.map +1 -1
  12. package/dist/api/request/crud/common/ActivityHistoryManager.d.ts +38 -38
  13. package/dist/api/request/crud/common/ActivityHistoryManager.js +68 -68
  14. package/dist/api/request/crud/common/ApplicationManager.d.ts +37 -37
  15. package/dist/api/request/crud/common/ApplicationManager.js +56 -56
  16. package/dist/api/request/crud/common/AvailablePlatformManager.d.ts +38 -38
  17. package/dist/api/request/crud/common/AvailablePlatformManager.js +68 -68
  18. package/dist/api/request/crud/common/ComponentManager.d.ts +51 -48
  19. package/dist/api/request/crud/common/ComponentManager.js +62 -62
  20. package/dist/api/request/crud/common/ComponentManager.js.map +1 -1
  21. package/dist/api/request/crud/common/KeyManager.d.ts +41 -41
  22. package/dist/api/request/crud/common/KeyManager.js +69 -69
  23. package/dist/api/request/crud/common/PlatformManager.d.ts +44 -41
  24. package/dist/api/request/crud/common/PlatformManager.js +59 -59
  25. package/dist/api/request/crud/common/PlatformManager.js.map +1 -1
  26. package/dist/api/request/crud/common/RoleManager.d.ts +41 -40
  27. package/dist/api/request/crud/common/RoleManager.js +56 -56
  28. package/dist/api/request/crud/common/RoleManager.js.map +1 -1
  29. package/dist/api/request/crud/common/ServiceSessionManager.d.ts +29 -0
  30. package/dist/api/request/crud/common/ServiceSessionManager.js +224 -0
  31. package/dist/api/request/crud/common/ServiceSessionManager.js.map +1 -0
  32. package/dist/api/request/crud/common/StatusManager.d.ts +32 -32
  33. package/dist/api/request/crud/common/StatusManager.js +56 -56
  34. package/dist/api/request/crud/common/TypeManager.d.ts +32 -32
  35. package/dist/api/request/crud/common/TypeManager.js +56 -56
  36. package/dist/api/request/crud/common/UserCredentialsManager.d.ts +37 -37
  37. package/dist/api/request/crud/common/UserCredentialsManager.js +66 -66
  38. package/dist/api/request/crud/common/UserManager.d.ts +38 -38
  39. package/dist/api/request/crud/common/UserManager.js +62 -62
  40. package/dist/api/utils/Response.d.ts +25 -25
  41. package/dist/api/utils/Response.js +85 -85
  42. package/dist/cryptography/jwt/JwtUtils.d.ts +18 -18
  43. package/dist/cryptography/jwt/JwtUtils.js +36 -36
  44. package/dist/cryptography/password/PasswordUtils.d.ts +6 -6
  45. package/dist/cryptography/password/PasswordUtils.js +34 -34
  46. package/dist/index.d.ts +63 -62
  47. package/dist/index.js +128 -126
  48. package/dist/index.js.map +1 -1
  49. package/dist/types/api.d.ts +21 -21
  50. package/dist/types/api.js +2 -2
  51. package/package.json +6 -6
@@ -1,57 +1,57 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TypeManager = void 0;
4
- const CrudServiceManager_1 = require("../CrudServiceManager");
5
- class TypeManager extends CrudServiceManager_1.CrudServiceManager {
6
- url;
7
- constructor(url) {
8
- super();
9
- this.url = url;
10
- }
11
- find(details) {
12
- return this.sendFinding(`${this.url}/types?type=${details.type}`, details.config);
13
- }
14
- findById(details) {
15
- return this.sendFinding(`${this.url}/types?id=${details.id}`, details.config);
16
- }
17
- async count(details) {
18
- let url = this.buildRequestUrl(`${this.url}/types`, details);
19
- return (await this.sendCounting(url, details.config)) ?? 0;
20
- }
21
- async findAll(details) {
22
- let types = [];
23
- let url = this.buildRequestUrl(`${this.url}/types`, details);
24
- if (details.limit) {
25
- types = (await this.sendAllFinding(`${url}${url.indexOf('?') !== -1 ? '&' : '?'}limit=${details.limit}&offset=${details.offset}`, details.config)) ?? [];
26
- }
27
- else {
28
- let limit = 5000, offset = 0, isEmpty = false;
29
- do {
30
- let values = await this.sendAllFinding(`${url}${url.indexOf('?') !== -1 ? '&' : '?'}limit=${limit}&offset=${offset}`, details.config);
31
- if (values)
32
- types = types.concat(values);
33
- isEmpty = values == undefined || values.length == 0;
34
- offset += limit;
35
- } while (!isEmpty);
36
- }
37
- return types;
38
- }
39
- buildRequestUrl(url, details) {
40
- let suffix = `${details.id ? `&id=${details.id}` : ""}${details.type ? `&type=${details.type}` : ""}`;
41
- return `${url}?${suffix.substring(1)}`;
42
- }
43
- create(details) {
44
- return this.sendCreation(`${this.url}/types`, { type: details.type, details: details.details ?? {} }, details.config);
45
- }
46
- createMany(details) {
47
- return this.sendCreationMany(`${this.url}/types`, details.values ?? [], details.config);
48
- }
49
- modify(type) {
50
- return this.sendModification(`${this.url}/types/${type.typeId}`, { type: type.type, details: type.details ?? {} }, type.config);
51
- }
52
- destroy(type) {
53
- return this.sendDestruction(`${this.url}/types/${type.typeId}`, type.config);
54
- }
55
- }
56
- exports.TypeManager = TypeManager;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TypeManager = void 0;
4
+ const CrudServiceManager_1 = require("../CrudServiceManager");
5
+ class TypeManager extends CrudServiceManager_1.CrudServiceManager {
6
+ url;
7
+ constructor(url) {
8
+ super();
9
+ this.url = url;
10
+ }
11
+ find(details) {
12
+ return this.sendFinding(`${this.url}/types?type=${details.type}`, details.config);
13
+ }
14
+ findById(details) {
15
+ return this.sendFinding(`${this.url}/types?id=${details.id}`, details.config);
16
+ }
17
+ async count(details) {
18
+ let url = this.buildRequestUrl(`${this.url}/types`, details);
19
+ return (await this.sendCounting(url, details.config)) ?? 0;
20
+ }
21
+ async findAll(details) {
22
+ let types = [];
23
+ let url = this.buildRequestUrl(`${this.url}/types`, details);
24
+ if (details.limit) {
25
+ types = (await this.sendAllFinding(`${url}${url.indexOf('?') !== -1 ? '&' : '?'}limit=${details.limit}&offset=${details.offset}`, details.config)) ?? [];
26
+ }
27
+ else {
28
+ let limit = 5000, offset = 0, isEmpty = false;
29
+ do {
30
+ let values = await this.sendAllFinding(`${url}${url.indexOf('?') !== -1 ? '&' : '?'}limit=${limit}&offset=${offset}`, details.config);
31
+ if (values)
32
+ types = types.concat(values);
33
+ isEmpty = values == undefined || values.length == 0;
34
+ offset += limit;
35
+ } while (!isEmpty);
36
+ }
37
+ return types;
38
+ }
39
+ buildRequestUrl(url, details) {
40
+ let suffix = `${details.id ? `&id=${details.id}` : ""}${details.type ? `&type=${details.type}` : ""}`;
41
+ return `${url}?${suffix.substring(1)}`;
42
+ }
43
+ create(details) {
44
+ return this.sendCreation(`${this.url}/types`, { type: details.type, details: details.details ?? {} }, details.config);
45
+ }
46
+ createMany(details) {
47
+ return this.sendCreationMany(`${this.url}/types`, details.values ?? [], details.config);
48
+ }
49
+ modify(type) {
50
+ return this.sendModification(`${this.url}/types/${type.typeId}`, { type: type.type, details: type.details ?? {} }, type.config);
51
+ }
52
+ destroy(type) {
53
+ return this.sendDestruction(`${this.url}/types/${type.typeId}`, type.config);
54
+ }
55
+ }
56
+ exports.TypeManager = TypeManager;
57
57
  //# sourceMappingURL=TypeManager.js.map
@@ -1,37 +1,37 @@
1
- import { CrudServiceManager, StandardIdRequestDefinition } from "../CrudServiceManager";
2
- import { AxiosRequestConfig } from "axios";
3
- export interface IUserCredentials {
4
- userCredentialId?: number;
5
- userName?: string;
6
- password?: string;
7
- email?: string;
8
- metadata?: Record<string, boolean>;
9
- updatedAt?: string;
10
- createdAt?: string;
11
- config?: AxiosRequestConfig;
12
- }
13
- export interface IUserCredentialsSearchDetails {
14
- id?: string | number;
15
- userName?: string;
16
- password?: string;
17
- email?: string;
18
- metadata?: any;
19
- credentialsId?: number;
20
- values?: IUserCredentials[];
21
- limit?: number;
22
- offset?: number;
23
- config?: AxiosRequestConfig;
24
- }
25
- export declare class UserCredentialsManager extends CrudServiceManager<IUserCredentialsSearchDetails, IUserCredentials> {
26
- private readonly url;
27
- constructor(url: string);
28
- find(details: IUserCredentialsSearchDetails): Promise<IUserCredentials | undefined>;
29
- findById(details: StandardIdRequestDefinition): Promise<IUserCredentials | undefined>;
30
- count(details: IUserCredentialsSearchDetails): Promise<number>;
31
- findAll(details: IUserCredentialsSearchDetails): Promise<IUserCredentials[] | undefined>;
32
- private buildRequestUrl;
33
- create(details: IUserCredentialsSearchDetails): Promise<IUserCredentials | undefined>;
34
- createMany(details: IUserCredentialsSearchDetails): Promise<IUserCredentials[] | undefined>;
35
- modify(user: IUserCredentials): Promise<IUserCredentials | undefined>;
36
- destroy(user: IUserCredentials): Promise<number | void>;
37
- }
1
+ import { CrudServiceManager, StandardIdRequestDefinition } from "../CrudServiceManager";
2
+ import { AxiosRequestConfig } from "axios";
3
+ export interface IUserCredentials {
4
+ userCredentialId?: number;
5
+ userName?: string;
6
+ password?: string;
7
+ email?: string;
8
+ metadata?: Record<string, boolean>;
9
+ updatedAt?: string;
10
+ createdAt?: string;
11
+ config?: AxiosRequestConfig;
12
+ }
13
+ export interface IUserCredentialsSearchDetails {
14
+ id?: string | number;
15
+ userName?: string;
16
+ password?: string;
17
+ email?: string;
18
+ metadata?: any;
19
+ credentialsId?: number;
20
+ values?: IUserCredentials[];
21
+ limit?: number;
22
+ offset?: number;
23
+ config?: AxiosRequestConfig;
24
+ }
25
+ export declare class UserCredentialsManager extends CrudServiceManager<IUserCredentialsSearchDetails, IUserCredentials> {
26
+ private readonly url;
27
+ constructor(url: string);
28
+ find(details: IUserCredentialsSearchDetails): Promise<IUserCredentials | undefined>;
29
+ findById(details: StandardIdRequestDefinition): Promise<IUserCredentials | undefined>;
30
+ count(details: IUserCredentialsSearchDetails): Promise<number>;
31
+ findAll(details: IUserCredentialsSearchDetails): Promise<IUserCredentials[] | undefined>;
32
+ private buildRequestUrl;
33
+ create(details: IUserCredentialsSearchDetails): Promise<IUserCredentials | undefined>;
34
+ createMany(details: IUserCredentialsSearchDetails): Promise<IUserCredentials[] | undefined>;
35
+ modify(user: IUserCredentials): Promise<IUserCredentials | undefined>;
36
+ destroy(user: IUserCredentials): Promise<number | void>;
37
+ }
@@ -1,67 +1,67 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UserCredentialsManager = void 0;
4
- const CrudServiceManager_1 = require("../CrudServiceManager");
5
- class UserCredentialsManager extends CrudServiceManager_1.CrudServiceManager {
6
- url;
7
- constructor(url) {
8
- super();
9
- this.url = url;
10
- }
11
- find(details) {
12
- return this.sendFinding(`${this.url}/userCredentials?email=${details.email}`, details.config);
13
- }
14
- findById(details) {
15
- return this.sendFinding(`${this.url}/userCredentials?id=${details.id}`, details.config);
16
- }
17
- async count(details) {
18
- let url = this.buildRequestUrl(`${this.url}/userCredentials`, details);
19
- return (await this.sendCounting(url, details.config)) ?? 0;
20
- }
21
- async findAll(details) {
22
- let users = [];
23
- let url = this.buildRequestUrl(`${this.url}/userCredentials`, details);
24
- if (details.limit) {
25
- users = (await this.sendAllFinding(`${url}${url.indexOf('?') !== -1 ? '&' : '?'}limit=${details.limit}&offset=${details.offset}`, details.config)) ?? [];
26
- }
27
- else {
28
- let limit = 5000, offset = 0, isEmpty = false;
29
- do {
30
- let values = await this.sendAllFinding(`${url}${url.indexOf('?') !== -1 ? '&' : '?'}limit=${limit}&offset=${offset}`, details.config);
31
- if (values)
32
- users = users.concat(values);
33
- isEmpty = values == undefined || values.length == 0;
34
- offset += limit;
35
- } while (!isEmpty);
36
- }
37
- return users;
38
- }
39
- buildRequestUrl(url, details) {
40
- let suffix = `${details.id ? `&id=${details.id}` : ""}${details.email ? `&email=${details.email}` : ""}`;
41
- return `${url}?${suffix.substring(1)}`;
42
- }
43
- create(details) {
44
- return this.sendCreation(`${this.url}/userCredentials`, {
45
- userName: details.userName,
46
- password: details.password,
47
- email: details.email,
48
- metadata: details.metadata
49
- }, details.config);
50
- }
51
- createMany(details) {
52
- return this.sendCreationMany(`${this.url}/userCredentials`, details.values ?? [], details.config);
53
- }
54
- modify(user) {
55
- return this.sendModification(`${this.url}/userCredentials/${user.userCredentialId}`, {
56
- userName: user.userName,
57
- password: user.password,
58
- email: user.email,
59
- metadata: user.metadata
60
- }, user.config);
61
- }
62
- destroy(user) {
63
- return this.sendDestruction(`${this.url}/userCredentials/${user.userCredentialId}`, user.config);
64
- }
65
- }
66
- exports.UserCredentialsManager = UserCredentialsManager;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UserCredentialsManager = void 0;
4
+ const CrudServiceManager_1 = require("../CrudServiceManager");
5
+ class UserCredentialsManager extends CrudServiceManager_1.CrudServiceManager {
6
+ url;
7
+ constructor(url) {
8
+ super();
9
+ this.url = url;
10
+ }
11
+ find(details) {
12
+ return this.sendFinding(`${this.url}/userCredentials?email=${details.email}`, details.config);
13
+ }
14
+ findById(details) {
15
+ return this.sendFinding(`${this.url}/userCredentials?id=${details.id}`, details.config);
16
+ }
17
+ async count(details) {
18
+ let url = this.buildRequestUrl(`${this.url}/userCredentials`, details);
19
+ return (await this.sendCounting(url, details.config)) ?? 0;
20
+ }
21
+ async findAll(details) {
22
+ let users = [];
23
+ let url = this.buildRequestUrl(`${this.url}/userCredentials`, details);
24
+ if (details.limit) {
25
+ users = (await this.sendAllFinding(`${url}${url.indexOf('?') !== -1 ? '&' : '?'}limit=${details.limit}&offset=${details.offset}`, details.config)) ?? [];
26
+ }
27
+ else {
28
+ let limit = 5000, offset = 0, isEmpty = false;
29
+ do {
30
+ let values = await this.sendAllFinding(`${url}${url.indexOf('?') !== -1 ? '&' : '?'}limit=${limit}&offset=${offset}`, details.config);
31
+ if (values)
32
+ users = users.concat(values);
33
+ isEmpty = values == undefined || values.length == 0;
34
+ offset += limit;
35
+ } while (!isEmpty);
36
+ }
37
+ return users;
38
+ }
39
+ buildRequestUrl(url, details) {
40
+ let suffix = `${details.id ? `&id=${details.id}` : ""}${details.email ? `&email=${details.email}` : ""}`;
41
+ return `${url}?${suffix.substring(1)}`;
42
+ }
43
+ create(details) {
44
+ return this.sendCreation(`${this.url}/userCredentials`, {
45
+ userName: details.userName,
46
+ password: details.password,
47
+ email: details.email,
48
+ metadata: details.metadata
49
+ }, details.config);
50
+ }
51
+ createMany(details) {
52
+ return this.sendCreationMany(`${this.url}/userCredentials`, details.values ?? [], details.config);
53
+ }
54
+ modify(user) {
55
+ return this.sendModification(`${this.url}/userCredentials/${user.userCredentialId}`, {
56
+ userName: user.userName,
57
+ password: user.password,
58
+ email: user.email,
59
+ metadata: user.metadata
60
+ }, user.config);
61
+ }
62
+ destroy(user) {
63
+ return this.sendDestruction(`${this.url}/userCredentials/${user.userCredentialId}`, user.config);
64
+ }
65
+ }
66
+ exports.UserCredentialsManager = UserCredentialsManager;
67
67
  //# sourceMappingURL=UserCredentialsManager.js.map
@@ -1,38 +1,38 @@
1
- import { AxiosRequestConfig } from "axios";
2
- import { CrudServiceManager, StandardIdRequestDefinition } from "../CrudServiceManager";
3
- import { IStatus } from "./StatusManager";
4
- import { IUserCredentials } from "./UserCredentialsManager";
5
- export interface IUser {
6
- userId?: string;
7
- statusId?: number;
8
- credentialsId?: number;
9
- updatedAt?: string;
10
- createdAt?: string;
11
- status?: IStatus;
12
- userCredentials?: IUserCredentials;
13
- config?: AxiosRequestConfig;
14
- }
15
- export interface IUserSearchDetails {
16
- id?: string;
17
- credentials?: boolean;
18
- userId?: string;
19
- statusId?: number;
20
- credentialsId?: number;
21
- values?: IUser[];
22
- limit?: number;
23
- offset?: number;
24
- config?: AxiosRequestConfig;
25
- }
26
- export declare class UserManager extends CrudServiceManager<IUserSearchDetails, IUser> {
27
- private readonly url;
28
- constructor(url: string);
29
- find(details: IUserSearchDetails): Promise<IUser | undefined>;
30
- findById(details: StandardIdRequestDefinition): Promise<IUser | undefined>;
31
- count(details: IUserSearchDetails): Promise<number>;
32
- findAll(details: IUserSearchDetails): Promise<IUser[] | undefined>;
33
- private buildRequestUrl;
34
- create(details: IUserSearchDetails): Promise<IUser | undefined>;
35
- createMany(details: IUserSearchDetails): Promise<IUser[] | undefined>;
36
- modify(user: IUser): Promise<IUser | undefined>;
37
- destroy(user: IUser): Promise<number | void>;
38
- }
1
+ import { AxiosRequestConfig } from "axios";
2
+ import { CrudServiceManager, StandardIdRequestDefinition } from "../CrudServiceManager";
3
+ import { IStatus } from "./StatusManager";
4
+ import { IUserCredentials } from "./UserCredentialsManager";
5
+ export interface IUser {
6
+ userId?: string;
7
+ statusId?: number;
8
+ credentialsId?: number;
9
+ updatedAt?: string;
10
+ createdAt?: string;
11
+ status?: IStatus;
12
+ userCredentials?: IUserCredentials;
13
+ config?: AxiosRequestConfig;
14
+ }
15
+ export interface IUserSearchDetails {
16
+ id?: string;
17
+ credentials?: boolean;
18
+ userId?: string;
19
+ statusId?: number;
20
+ credentialsId?: number;
21
+ values?: IUser[];
22
+ limit?: number;
23
+ offset?: number;
24
+ config?: AxiosRequestConfig;
25
+ }
26
+ export declare class UserManager extends CrudServiceManager<IUserSearchDetails, IUser> {
27
+ private readonly url;
28
+ constructor(url: string);
29
+ find(details: IUserSearchDetails): Promise<IUser | undefined>;
30
+ findById(details: StandardIdRequestDefinition): Promise<IUser | undefined>;
31
+ count(details: IUserSearchDetails): Promise<number>;
32
+ findAll(details: IUserSearchDetails): Promise<IUser[] | undefined>;
33
+ private buildRequestUrl;
34
+ create(details: IUserSearchDetails): Promise<IUser | undefined>;
35
+ createMany(details: IUserSearchDetails): Promise<IUser[] | undefined>;
36
+ modify(user: IUser): Promise<IUser | undefined>;
37
+ destroy(user: IUser): Promise<number | void>;
38
+ }
@@ -1,63 +1,63 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UserManager = void 0;
4
- const CrudServiceManager_1 = require("../CrudServiceManager");
5
- class UserManager extends CrudServiceManager_1.CrudServiceManager {
6
- url;
7
- constructor(url) {
8
- super();
9
- this.url = url;
10
- }
11
- find(details) {
12
- return this.sendFinding(`${this.url}/users?credentialsId=${details.credentialsId}`, details.config);
13
- }
14
- findById(details) {
15
- return this.sendFinding(`${this.url}/users?id=${details.id}`, details.config);
16
- }
17
- async count(details) {
18
- let url = this.buildRequestUrl(`${this.url}/users`, details);
19
- return (await this.sendCounting(url, details.config)) ?? 0;
20
- }
21
- async findAll(details) {
22
- let users = [];
23
- let url = this.buildRequestUrl(`${this.url}/users`, details);
24
- if (details.limit) {
25
- users = (await this.sendAllFinding(`${url}${url.indexOf('?') !== -1 ? '&' : '?'}limit=${details.limit}&offset=${details.offset}`, details.config)) ?? [];
26
- }
27
- else {
28
- let limit = 5000, offset = 0, isEmpty = false;
29
- do {
30
- let values = await this.sendAllFinding(`${url}${url.indexOf('?') !== -1 ? '&' : '?'}limit=${limit}&offset=${offset}`, details.config);
31
- if (values)
32
- users = users.concat(values);
33
- isEmpty = values == undefined || values.length == 0;
34
- offset += limit;
35
- } while (!isEmpty);
36
- }
37
- return users;
38
- }
39
- buildRequestUrl(url, details) {
40
- let suffix = `${details.id ? `&id=${details.id}` : ""}${details.credentials ? `&credentials=${details.credentials}` : ""}${details.credentialsId ? `&credentialsId=${details.credentialsId}` : ""}`;
41
- return `${url}?${suffix.substring(1)}`;
42
- }
43
- create(details) {
44
- return this.sendCreation(`${this.url}/users`, {
45
- statusId: details.statusId,
46
- credentialsId: details.credentialsId
47
- }, details.config);
48
- }
49
- createMany(details) {
50
- return this.sendCreationMany(`${this.url}/users`, details.values ?? [], details.config);
51
- }
52
- modify(user) {
53
- return this.sendModification(`${this.url}/users/${user.userId}`, {
54
- statusId: user.statusId,
55
- credentialsId: user.credentialsId
56
- }, user.config);
57
- }
58
- destroy(user) {
59
- return this.sendDestruction(`${this.url}/users/${user.userId}`, user.config);
60
- }
61
- }
62
- exports.UserManager = UserManager;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UserManager = void 0;
4
+ const CrudServiceManager_1 = require("../CrudServiceManager");
5
+ class UserManager extends CrudServiceManager_1.CrudServiceManager {
6
+ url;
7
+ constructor(url) {
8
+ super();
9
+ this.url = url;
10
+ }
11
+ find(details) {
12
+ return this.sendFinding(`${this.url}/users?credentialsId=${details.credentialsId}`, details.config);
13
+ }
14
+ findById(details) {
15
+ return this.sendFinding(`${this.url}/users?id=${details.id}`, details.config);
16
+ }
17
+ async count(details) {
18
+ let url = this.buildRequestUrl(`${this.url}/users`, details);
19
+ return (await this.sendCounting(url, details.config)) ?? 0;
20
+ }
21
+ async findAll(details) {
22
+ let users = [];
23
+ let url = this.buildRequestUrl(`${this.url}/users`, details);
24
+ if (details.limit) {
25
+ users = (await this.sendAllFinding(`${url}${url.indexOf('?') !== -1 ? '&' : '?'}limit=${details.limit}&offset=${details.offset}`, details.config)) ?? [];
26
+ }
27
+ else {
28
+ let limit = 5000, offset = 0, isEmpty = false;
29
+ do {
30
+ let values = await this.sendAllFinding(`${url}${url.indexOf('?') !== -1 ? '&' : '?'}limit=${limit}&offset=${offset}`, details.config);
31
+ if (values)
32
+ users = users.concat(values);
33
+ isEmpty = values == undefined || values.length == 0;
34
+ offset += limit;
35
+ } while (!isEmpty);
36
+ }
37
+ return users;
38
+ }
39
+ buildRequestUrl(url, details) {
40
+ let suffix = `${details.id ? `&id=${details.id}` : ""}${details.credentials ? `&credentials=${details.credentials}` : ""}${details.credentialsId ? `&credentialsId=${details.credentialsId}` : ""}`;
41
+ return `${url}?${suffix.substring(1)}`;
42
+ }
43
+ create(details) {
44
+ return this.sendCreation(`${this.url}/users`, {
45
+ statusId: details.statusId,
46
+ credentialsId: details.credentialsId
47
+ }, details.config);
48
+ }
49
+ createMany(details) {
50
+ return this.sendCreationMany(`${this.url}/users`, details.values ?? [], details.config);
51
+ }
52
+ modify(user) {
53
+ return this.sendModification(`${this.url}/users/${user.userId}`, {
54
+ statusId: user.statusId,
55
+ credentialsId: user.credentialsId
56
+ }, user.config);
57
+ }
58
+ destroy(user) {
59
+ return this.sendDestruction(`${this.url}/users/${user.userId}`, user.config);
60
+ }
61
+ }
62
+ exports.UserManager = UserManager;
63
63
  //# sourceMappingURL=UserManager.js.map
@@ -1,25 +1,25 @@
1
- import { ApiResponse, PaginationMeta } from "../../types/api";
2
- export declare class ApiServiceError extends Error {
3
- readonly httpStatus: number;
4
- readonly code: string;
5
- readonly details?: any | undefined;
6
- constructor(httpStatus: number, code: string, message: string, details?: any | undefined);
7
- }
8
- export declare class ResponseUtils {
9
- static success<T = null>(payload: T, message?: string, meta?: Partial<ApiResponse['meta']>): ApiResponse<T>;
10
- static error(apiError: ApiServiceError, meta?: Partial<ApiResponse['meta']>): ApiResponse<null>;
11
- static paginated<T>(payload: T[], pagination: PaginationMeta, message?: string): ApiResponse<T[]>;
12
- }
13
- export declare function mapErrorCodeToHttpStatus(code: string): number;
14
- export declare enum HttpCode {
15
- OK = 200,
16
- CREATED = 201,
17
- NO_CONTENT = 204,
18
- BAD_REQUEST = 400,
19
- UNAUTHORIZED = 401,
20
- FORBIDDEN = 403,
21
- NOT_FOUND = 404,
22
- CONFLICT = 409,
23
- INTERNAL_SERVER_ERROR = 500,
24
- SERVICE_UNAVAILABLE = 503
25
- }
1
+ import { ApiResponse, PaginationMeta } from "../../types/api";
2
+ export declare class ApiServiceError extends Error {
3
+ readonly httpStatus: number;
4
+ readonly code: string;
5
+ readonly details?: any | undefined;
6
+ constructor(httpStatus: number, code: string, message: string, details?: any | undefined);
7
+ }
8
+ export declare class ResponseUtils {
9
+ static success<T = null>(payload: T, message?: string, meta?: Partial<ApiResponse['meta']>): ApiResponse<T>;
10
+ static error(apiError: ApiServiceError, meta?: Partial<ApiResponse['meta']>): ApiResponse<null>;
11
+ static paginated<T>(payload: T[], pagination: PaginationMeta, message?: string): ApiResponse<T[]>;
12
+ }
13
+ export declare function mapErrorCodeToHttpStatus(code: string): number;
14
+ export declare enum HttpCode {
15
+ OK = 200,
16
+ CREATED = 201,
17
+ NO_CONTENT = 204,
18
+ BAD_REQUEST = 400,
19
+ UNAUTHORIZED = 401,
20
+ FORBIDDEN = 403,
21
+ NOT_FOUND = 404,
22
+ CONFLICT = 409,
23
+ INTERNAL_SERVER_ERROR = 500,
24
+ SERVICE_UNAVAILABLE = 503
25
+ }