accounting-tools 1.0.21 → 1.0.23

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.
@@ -1,34 +1,34 @@
1
- import { AxiosRequestConfig } from "axios";
2
- import { CrudServiceManager, StandardIdRequestDefinition } from "itrm-tools";
3
- export interface IAccount {
4
- accountId?: number;
5
- name?: string;
6
- pucCode?: string;
7
- details?: any;
8
- updatedAt?: string;
9
- createdAt?: string;
10
- config?: AxiosRequestConfig;
11
- }
12
- export interface IAccountSearchDetails {
13
- id?: string | number;
14
- name?: string;
15
- pucCode?: string;
16
- details?: any;
17
- values?: IAccount[];
18
- limit?: number;
19
- offset?: number;
20
- config?: AxiosRequestConfig;
21
- }
22
- export declare class AccountManager extends CrudServiceManager<IAccountSearchDetails, IAccount> {
23
- private readonly url;
24
- constructor(url: string);
25
- find(details: IAccountSearchDetails): Promise<IAccount | undefined>;
26
- findById(details: StandardIdRequestDefinition): Promise<IAccount | undefined>;
27
- count(details: IAccountSearchDetails): Promise<number>;
28
- findAll(details: IAccountSearchDetails): Promise<IAccount[] | undefined>;
29
- private buildRequestUrl;
30
- create(details: IAccountSearchDetails): Promise<IAccount | undefined>;
31
- createMany(details: IAccountSearchDetails): Promise<IAccount[] | undefined>;
32
- modify(account: IAccount): Promise<IAccount | undefined>;
33
- destroy(account: IAccount): Promise<void | number>;
34
- }
1
+ import { AxiosRequestConfig } from "axios";
2
+ import { CrudServiceManager, StandardIdRequestDefinition } from "itrm-tools";
3
+ export interface IAccount {
4
+ accountId?: number;
5
+ name?: string;
6
+ pucCode?: string;
7
+ details?: any;
8
+ updatedAt?: string;
9
+ createdAt?: string;
10
+ config?: AxiosRequestConfig;
11
+ }
12
+ export interface IAccountSearchDetails {
13
+ id?: string | number;
14
+ name?: string;
15
+ pucCode?: string;
16
+ details?: any;
17
+ values?: IAccount[];
18
+ limit?: number;
19
+ offset?: number;
20
+ config?: AxiosRequestConfig;
21
+ }
22
+ export declare class AccountManager extends CrudServiceManager<IAccountSearchDetails, IAccount> {
23
+ private readonly url;
24
+ constructor(url: string);
25
+ find(details: IAccountSearchDetails): Promise<IAccount | undefined>;
26
+ findById(details: StandardIdRequestDefinition): Promise<IAccount | undefined>;
27
+ count(details: IAccountSearchDetails): Promise<number>;
28
+ findAll(details: IAccountSearchDetails): Promise<IAccount[] | undefined>;
29
+ private buildRequestUrl;
30
+ create(details: IAccountSearchDetails): Promise<IAccount | undefined>;
31
+ createMany(details: IAccountSearchDetails): Promise<IAccount[] | undefined>;
32
+ modify(account: IAccount): Promise<IAccount | undefined>;
33
+ destroy(account: IAccount): Promise<void | number>;
34
+ }
@@ -1,57 +1,57 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AccountManager = void 0;
4
- const itrm_tools_1 = require("itrm-tools");
5
- class AccountManager extends itrm_tools_1.CrudServiceManager {
6
- url;
7
- constructor(url) {
8
- super();
9
- this.url = url;
10
- }
11
- find(details) {
12
- return this.sendFinding(`${this.url}/accounts?name=${details.name}`, details.config);
13
- }
14
- findById(details) {
15
- return this.sendFinding(`${this.url}/accounts?id=${details.id}`, details.config);
16
- }
17
- async count(details) {
18
- let url = this.buildRequestUrl(`${this.url}/accounts`, details);
19
- return (await this.sendCounting(url, details.config)) ?? 0;
20
- }
21
- async findAll(details) {
22
- let accounts = [];
23
- let url = this.buildRequestUrl(`${this.url}/accounts`, details);
24
- if (details.limit) {
25
- accounts = (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
- accounts = accounts.concat(values);
33
- isEmpty = values == undefined || values.length == 0;
34
- offset += limit;
35
- } while (!isEmpty);
36
- }
37
- return accounts;
38
- }
39
- buildRequestUrl(url, details) {
40
- let suffix = `${details.id ? `&id=${details.id}` : ""}${details.pucCode ? `&pucCode=${details.pucCode}` : ""}${details.name ? `&name=${details.name}` : ""}`;
41
- return `${url}?${suffix.substring(1)}`;
42
- }
43
- create(details) {
44
- return this.sendCreation(`${this.url}/accounts`, { name: details.name, pucCode: details.pucCode, details: details.details }, details.config);
45
- }
46
- createMany(details) {
47
- return this.sendCreationMany(`${this.url}/accounts`, details.values ?? [], details.config);
48
- }
49
- modify(account) {
50
- return this.sendModification(`${this.url}/accounts/${account.accountId}`, { name: account.name, pucCode: account.pucCode, details: account.details }, account.config);
51
- }
52
- destroy(account) {
53
- return this.sendDestruction(`${this.url}/accounts/${account.accountId}`, account.config);
54
- }
55
- }
56
- exports.AccountManager = AccountManager;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AccountManager = void 0;
4
+ const itrm_tools_1 = require("itrm-tools");
5
+ class AccountManager extends itrm_tools_1.CrudServiceManager {
6
+ url;
7
+ constructor(url) {
8
+ super();
9
+ this.url = url;
10
+ }
11
+ find(details) {
12
+ return this.sendFinding(`${this.url}/accounts?name=${details.name}`, details.config);
13
+ }
14
+ findById(details) {
15
+ return this.sendFinding(`${this.url}/accounts?id=${details.id}`, details.config);
16
+ }
17
+ async count(details) {
18
+ let url = this.buildRequestUrl(`${this.url}/accounts`, details);
19
+ return (await this.sendCounting(url, details.config)) ?? 0;
20
+ }
21
+ async findAll(details) {
22
+ let accounts = [];
23
+ let url = this.buildRequestUrl(`${this.url}/accounts`, details);
24
+ if (details.limit) {
25
+ accounts = (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
+ accounts = accounts.concat(values);
33
+ isEmpty = values == undefined || values.length == 0;
34
+ offset += limit;
35
+ } while (!isEmpty);
36
+ }
37
+ return accounts;
38
+ }
39
+ buildRequestUrl(url, details) {
40
+ let suffix = `${details.id ? `&id=${details.id}` : ""}${details.pucCode ? `&pucCode=${details.pucCode}` : ""}${details.name ? `&name=${details.name}` : ""}`;
41
+ return `${url}?${suffix.substring(1)}`;
42
+ }
43
+ create(details) {
44
+ return this.sendCreation(`${this.url}/accounts`, { name: details.name, pucCode: details.pucCode, details: details.details }, details.config);
45
+ }
46
+ createMany(details) {
47
+ return this.sendCreationMany(`${this.url}/accounts`, details.values ?? [], details.config);
48
+ }
49
+ modify(account) {
50
+ return this.sendModification(`${this.url}/accounts/${account.accountId}`, { name: account.name, pucCode: account.pucCode, details: account.details }, account.config);
51
+ }
52
+ destroy(account) {
53
+ return this.sendDestruction(`${this.url}/accounts/${account.accountId}`, account.config);
54
+ }
55
+ }
56
+ exports.AccountManager = AccountManager;
57
57
  //# sourceMappingURL=AccountManager.js.map
@@ -1,50 +1,53 @@
1
- import { AxiosRequestConfig } from "axios";
2
- import { CrudServiceManager, StandardIdRequestDefinition } from "itrm-tools";
3
- import { Regime } from "../types/types";
4
- export interface IContact {
5
- contactId?: number;
6
- name?: string;
7
- identificationNumber?: string;
8
- details?: IContactDetails;
9
- updatedAt?: string;
10
- createdAt?: string;
11
- config?: AxiosRequestConfig;
12
- }
13
- export interface IContactDetails {
14
- identificationType?: string;
15
- kindOfPerson?: string;
16
- regime?: Regime;
17
- email?: string;
18
- primaryPhone?: string;
19
- street?: string;
20
- city?: string;
21
- department?: string;
22
- country?: string;
23
- users?: string[];
24
- isVerified?: boolean;
25
- isApproved?: boolean;
26
- approvedBy?: string;
27
- }
28
- export interface IContactSearchDetails {
29
- id?: string | number;
30
- name?: string;
31
- identificationNumber?: string;
32
- details?: IContactDetails;
33
- values?: IContact[];
34
- limit?: number;
35
- offset?: number;
36
- config?: AxiosRequestConfig;
37
- }
38
- export declare class ContactManager extends CrudServiceManager<IContactSearchDetails, IContact> {
39
- private readonly url;
40
- constructor(url: string);
41
- find(details: IContactSearchDetails): Promise<IContact | undefined>;
42
- findById(details: StandardIdRequestDefinition): Promise<IContact | undefined>;
43
- count(details: IContactSearchDetails): Promise<number>;
44
- findAll(details: IContactSearchDetails): Promise<IContact[] | undefined>;
45
- private buildRequestUrl;
46
- create(details: IContactSearchDetails): Promise<IContact | undefined>;
47
- createMany(details: IContactSearchDetails): Promise<IContact[] | undefined>;
48
- modify(contact: IContact): Promise<IContact | undefined>;
49
- destroy(contact: IContact): Promise<void | number>;
50
- }
1
+ import { AxiosRequestConfig } from "axios";
2
+ import { CrudServiceManager, StandardIdRequestDefinition } from "itrm-tools";
3
+ import { ContactType, Regime } from "../types/types";
4
+ export interface IContact {
5
+ contactId?: number;
6
+ name?: string;
7
+ identificationNumber?: string;
8
+ details?: IContactDetails;
9
+ updatedAt?: string;
10
+ createdAt?: string;
11
+ config?: AxiosRequestConfig;
12
+ }
13
+ export interface IContactDetails {
14
+ identificationType?: string;
15
+ kindOfPerson?: string;
16
+ regime?: Regime;
17
+ iva?: boolean;
18
+ contactType?: ContactType;
19
+ email?: string;
20
+ primaryPhone?: string;
21
+ street?: string;
22
+ city?: string;
23
+ department?: string;
24
+ country?: string;
25
+ users?: string[];
26
+ isVerified?: boolean;
27
+ isApproved?: boolean;
28
+ approvedBy?: string;
29
+ error?: string;
30
+ }
31
+ export interface IContactSearchDetails {
32
+ id?: string | number;
33
+ name?: string;
34
+ identificationNumber?: string;
35
+ details?: IContactDetails;
36
+ values?: IContact[];
37
+ limit?: number;
38
+ offset?: number;
39
+ config?: AxiosRequestConfig;
40
+ }
41
+ export declare class ContactManager extends CrudServiceManager<IContactSearchDetails, IContact> {
42
+ private readonly url;
43
+ constructor(url: string);
44
+ find(details: IContactSearchDetails): Promise<IContact | undefined>;
45
+ findById(details: StandardIdRequestDefinition): Promise<IContact | undefined>;
46
+ count(details: IContactSearchDetails): Promise<number>;
47
+ findAll(details: IContactSearchDetails): Promise<IContact[] | undefined>;
48
+ private buildRequestUrl;
49
+ create(details: IContactSearchDetails): Promise<IContact | undefined>;
50
+ createMany(details: IContactSearchDetails): Promise<IContact[] | undefined>;
51
+ modify(contact: IContact): Promise<IContact | undefined>;
52
+ destroy(contact: IContact): Promise<void | number>;
53
+ }
@@ -1,57 +1,57 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ContactManager = void 0;
4
- const itrm_tools_1 = require("itrm-tools");
5
- class ContactManager extends itrm_tools_1.CrudServiceManager {
6
- url;
7
- constructor(url) {
8
- super();
9
- this.url = url;
10
- }
11
- find(details) {
12
- return this.sendFinding(`${this.url}/contacts?identificationNumber=${details.identificationNumber}`, details.config);
13
- }
14
- findById(details) {
15
- return this.sendFinding(`${this.url}/contacts?id=${details.id}`, details.config);
16
- }
17
- async count(details) {
18
- let url = this.buildRequestUrl(`${this.url}/contacts`, details);
19
- return (await this.sendCounting(url, details.config)) ?? 0;
20
- }
21
- async findAll(details) {
22
- let contacts = [];
23
- let url = this.buildRequestUrl(`${this.url}/contacts`, details);
24
- if (details.limit) {
25
- contacts = (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
- contacts = contacts.concat(values);
33
- isEmpty = values == undefined || values.length == 0;
34
- offset += limit;
35
- } while (!isEmpty);
36
- }
37
- return contacts;
38
- }
39
- buildRequestUrl(url, details) {
40
- let suffix = `${details.id ? `&id=${details.id}` : ""}${details.identificationNumber ? `&identificationNumber=${details.identificationNumber}` : ""}${details.name ? `&name=${details.name}` : ""}`;
41
- return `${url}?${suffix.substring(1)}`;
42
- }
43
- create(details) {
44
- return this.sendCreation(`${this.url}/contacts`, { name: details.name, identificationNumber: details.identificationNumber, details: details.details }, details.config);
45
- }
46
- createMany(details) {
47
- return this.sendCreationMany(`${this.url}/contacts`, details.values ?? [], details.config);
48
- }
49
- modify(contact) {
50
- return this.sendModification(`${this.url}/contacts/${contact.contactId}`, { name: contact.name, identificationNumber: contact.identificationNumber, details: contact.details }, contact.config);
51
- }
52
- destroy(contact) {
53
- return this.sendDestruction(`${this.url}/contacts/${contact.contactId}`, contact.config);
54
- }
55
- }
56
- exports.ContactManager = ContactManager;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ContactManager = void 0;
4
+ const itrm_tools_1 = require("itrm-tools");
5
+ class ContactManager extends itrm_tools_1.CrudServiceManager {
6
+ url;
7
+ constructor(url) {
8
+ super();
9
+ this.url = url;
10
+ }
11
+ find(details) {
12
+ return this.sendFinding(`${this.url}/contacts?identificationNumber=${details.identificationNumber}`, details.config);
13
+ }
14
+ findById(details) {
15
+ return this.sendFinding(`${this.url}/contacts?id=${details.id}`, details.config);
16
+ }
17
+ async count(details) {
18
+ let url = this.buildRequestUrl(`${this.url}/contacts`, details);
19
+ return (await this.sendCounting(url, details.config)) ?? 0;
20
+ }
21
+ async findAll(details) {
22
+ let contacts = [];
23
+ let url = this.buildRequestUrl(`${this.url}/contacts`, details);
24
+ if (details.limit) {
25
+ contacts = (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
+ contacts = contacts.concat(values);
33
+ isEmpty = values == undefined || values.length == 0;
34
+ offset += limit;
35
+ } while (!isEmpty);
36
+ }
37
+ return contacts;
38
+ }
39
+ buildRequestUrl(url, details) {
40
+ let suffix = `${details.id ? `&id=${details.id}` : ""}${details.identificationNumber ? `&identificationNumber=${details.identificationNumber}` : ""}${details.name ? `&name=${details.name}` : ""}`;
41
+ return `${url}?${suffix.substring(1)}`;
42
+ }
43
+ create(details) {
44
+ return this.sendCreation(`${this.url}/contacts`, { name: details.name, identificationNumber: details.identificationNumber, details: details.details }, details.config);
45
+ }
46
+ createMany(details) {
47
+ return this.sendCreationMany(`${this.url}/contacts`, details.values ?? [], details.config);
48
+ }
49
+ modify(contact) {
50
+ return this.sendModification(`${this.url}/contacts/${contact.contactId}`, { name: contact.name, identificationNumber: contact.identificationNumber, details: contact.details }, contact.config);
51
+ }
52
+ destroy(contact) {
53
+ return this.sendDestruction(`${this.url}/contacts/${contact.contactId}`, contact.config);
54
+ }
55
+ }
56
+ exports.ContactManager = ContactManager;
57
57
  //# sourceMappingURL=ContactManager.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ContactManager.js","sourceRoot":"","sources":["../../src/crud/ContactManager.ts"],"names":[],"mappings":";;;AACA,2CAA6E;AAwC7E,MAAa,cAAe,SAAQ,+BAAmD;IACpE,GAAG,CAAS;IAE7B,YAAY,GAAW;QACrB,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAEM,IAAI,CAAC,OAA8B;QACxC,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,GAAG,kCAAkC,OAAO,CAAC,oBAAoB,EAAE,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACvH,CAAC;IAEM,QAAQ,CAAC,OAAoC;QAClD,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,GAAG,gBAAgB,OAAO,CAAC,EAAE,EAAE,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACnF,CAAC;IAEM,KAAK,CAAC,KAAK,CAAC,OAA8B;QAC/C,IAAI,GAAG,GAAG,IAAI,CAAC,eAAe,C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import { AxiosRequestConfig } from "axios";
3
- export interface IStatus {
4
- statusId?: number;
5
- status?: string;
6
- details?: Record<string, Record<string, any> | string>;
7
- updatedAt?: string;
8
- createdAt?: string;
9
- config?: AxiosRequestConfig;
10
- }
11
- export interface IStatusSearchDetails {
12
- id?: string | number;
13
- status?: string;
14
- details?: any;
15
- values?: IStatus[];
16
- limit?: number;
17
- offset?: number;
18
- config?: AxiosRequestConfig;
19
- }
20
- export declare class StatusManager extends CrudServiceManager<IStatusSearchDetails, IStatus> {
21
- private readonly url;
22
- constructor(url: string);
23
- find(details: IStatusSearchDetails): Promise<IStatus | undefined>;
24
- findById(details: StandardIdRequestDefinition): Promise<IStatus | undefined>;
25
- count(details: IStatusSearchDetails): Promise<number>;
26
- findAll(details: IStatusSearchDetails): Promise<IStatus[] | undefined>;
27
- private buildRequestUrl;
28
- create(details: IStatusSearchDetails): Promise<IStatus | undefined>;
29
- createMany(details: IStatusSearchDetails): Promise<IStatus[] | undefined>;
30
- modify(status: IStatus): Promise<IStatus | undefined>;
31
- destroy(status: IStatus): Promise<void | number>;
32
- }
1
+ import { CrudServiceManager, StandardIdRequestDefinition } from "itrm-tools";
2
+ import { AxiosRequestConfig } from "axios";
3
+ export interface IStatus {
4
+ statusId?: number;
5
+ status?: string;
6
+ details?: Record<string, Record<string, any> | string>;
7
+ updatedAt?: string;
8
+ createdAt?: string;
9
+ config?: AxiosRequestConfig;
10
+ }
11
+ export interface IStatusSearchDetails {
12
+ id?: string | number;
13
+ status?: string;
14
+ details?: any;
15
+ values?: IStatus[];
16
+ limit?: number;
17
+ offset?: number;
18
+ config?: AxiosRequestConfig;
19
+ }
20
+ export declare class StatusManager extends CrudServiceManager<IStatusSearchDetails, IStatus> {
21
+ private readonly url;
22
+ constructor(url: string);
23
+ find(details: IStatusSearchDetails): Promise<IStatus | undefined>;
24
+ findById(details: StandardIdRequestDefinition): Promise<IStatus | undefined>;
25
+ count(details: IStatusSearchDetails): Promise<number>;
26
+ findAll(details: IStatusSearchDetails): Promise<IStatus[] | undefined>;
27
+ private buildRequestUrl;
28
+ create(details: IStatusSearchDetails): Promise<IStatus | undefined>;
29
+ createMany(details: IStatusSearchDetails): Promise<IStatus[] | undefined>;
30
+ modify(status: IStatus): Promise<IStatus | undefined>;
31
+ destroy(status: IStatus): Promise<void | number>;
32
+ }
@@ -1,57 +1,57 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StatusManager = void 0;
4
- const itrm_tools_1 = require("itrm-tools");
5
- class StatusManager extends itrm_tools_1.CrudServiceManager {
6
- url;
7
- constructor(url) {
8
- super();
9
- this.url = url;
10
- }
11
- find(details) {
12
- return this.sendFinding(`${this.url}/status?status=${details.status}`, details.config);
13
- }
14
- findById(details) {
15
- return this.sendFinding(`${this.url}/status?id=${details.id}`, details.config);
16
- }
17
- async count(details) {
18
- let url = this.buildRequestUrl(`${this.url}/status`, details);
19
- return (await this.sendCounting(url, details.config)) ?? 0;
20
- }
21
- async findAll(details) {
22
- let status = [];
23
- let url = this.buildRequestUrl(`${this.url}/status`, details);
24
- if (details.limit) {
25
- status = (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
- status = status.concat(values);
33
- isEmpty = values == undefined || values.length == 0;
34
- offset += limit;
35
- } while (!isEmpty);
36
- }
37
- return status;
38
- }
39
- buildRequestUrl(url, details) {
40
- let suffix = `${details.id ? `&id=${details.id}` : ""}${details.status ? `&status=${details.status}` : ""}`;
41
- return `${url}?${suffix.substring(1)}`;
42
- }
43
- create(details) {
44
- return this.sendCreation(`${this.url}/status`, { status: details.status, details: details.details }, details.config);
45
- }
46
- createMany(details) {
47
- return this.sendCreationMany(`${this.url}/status`, details.values ?? [], details.config);
48
- }
49
- modify(status) {
50
- return this.sendModification(`${this.url}/status/${status.statusId}`, { status: status.status, details: status.details }, status.config);
51
- }
52
- destroy(status) {
53
- return this.sendDestruction(`${this.url}/status/${status.statusId}`, status.config);
54
- }
55
- }
56
- exports.StatusManager = StatusManager;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StatusManager = void 0;
4
+ const itrm_tools_1 = require("itrm-tools");
5
+ class StatusManager extends itrm_tools_1.CrudServiceManager {
6
+ url;
7
+ constructor(url) {
8
+ super();
9
+ this.url = url;
10
+ }
11
+ find(details) {
12
+ return this.sendFinding(`${this.url}/status?status=${details.status}`, details.config);
13
+ }
14
+ findById(details) {
15
+ return this.sendFinding(`${this.url}/status?id=${details.id}`, details.config);
16
+ }
17
+ async count(details) {
18
+ let url = this.buildRequestUrl(`${this.url}/status`, details);
19
+ return (await this.sendCounting(url, details.config)) ?? 0;
20
+ }
21
+ async findAll(details) {
22
+ let status = [];
23
+ let url = this.buildRequestUrl(`${this.url}/status`, details);
24
+ if (details.limit) {
25
+ status = (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
+ status = status.concat(values);
33
+ isEmpty = values == undefined || values.length == 0;
34
+ offset += limit;
35
+ } while (!isEmpty);
36
+ }
37
+ return status;
38
+ }
39
+ buildRequestUrl(url, details) {
40
+ let suffix = `${details.id ? `&id=${details.id}` : ""}${details.status ? `&status=${details.status}` : ""}`;
41
+ return `${url}?${suffix.substring(1)}`;
42
+ }
43
+ create(details) {
44
+ return this.sendCreation(`${this.url}/status`, { status: details.status, details: details.details }, details.config);
45
+ }
46
+ createMany(details) {
47
+ return this.sendCreationMany(`${this.url}/status`, details.values ?? [], details.config);
48
+ }
49
+ modify(status) {
50
+ return this.sendModification(`${this.url}/status/${status.statusId}`, { status: status.status, details: status.details }, status.config);
51
+ }
52
+ destroy(status) {
53
+ return this.sendDestruction(`${this.url}/status/${status.statusId}`, status.config);
54
+ }
55
+ }
56
+ exports.StatusManager = StatusManager;
57
57
  //# sourceMappingURL=StatusManager.js.map