elemento-alpha-tools 1.1.23 → 1.1.25
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.
|
@@ -11,19 +11,21 @@ export interface IType {
|
|
|
11
11
|
export interface ITypeSearchDetails {
|
|
12
12
|
type?: string;
|
|
13
13
|
details?: any;
|
|
14
|
+
limit?: number;
|
|
15
|
+
offset?: number;
|
|
14
16
|
config?: AxiosRequestConfig;
|
|
15
17
|
}
|
|
16
18
|
export declare class TypeManager extends CrudServiceManager<ITypeSearchDetails, IType> {
|
|
17
19
|
private url;
|
|
18
20
|
constructor(url: string);
|
|
19
21
|
find(details: ITypeSearchDetails): Promise<IType | undefined>;
|
|
22
|
+
count(details: ITypeSearchDetails): Promise<{
|
|
23
|
+
result: number;
|
|
24
|
+
}>;
|
|
20
25
|
findAll(details: ITypeSearchDetails): Promise<IType[] | undefined>;
|
|
26
|
+
private buildRequestUrl;
|
|
21
27
|
findById(id: StandardIdRequestDefinition): Promise<IType | undefined>;
|
|
22
28
|
create(details: ITypeSearchDetails): Promise<IType | undefined>;
|
|
23
29
|
modify(type: IType): Promise<any>;
|
|
24
30
|
destroy(type: IType): Promise<any>;
|
|
25
|
-
count(details: IType): Promise<{
|
|
26
|
-
result: number;
|
|
27
|
-
}>;
|
|
28
|
-
private buildRequestUrl;
|
|
29
31
|
}
|
package/dist/crud/TypeManager.js
CHANGED
|
@@ -21,19 +21,38 @@ class TypeManager extends itrm_tools_1.CrudServiceManager {
|
|
|
21
21
|
return this.sendFinding(`${this.url}/types?type=${details.type}`, details.config);
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
+
count(details) {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
var _a;
|
|
27
|
+
let url = this.buildRequestUrl(`${this.url}/types`, details);
|
|
28
|
+
return (_a = (yield this.sendCounting(url, details.config))) !== null && _a !== void 0 ? _a : { result: 0 };
|
|
29
|
+
});
|
|
30
|
+
}
|
|
24
31
|
findAll(details) {
|
|
25
32
|
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
var _a;
|
|
34
|
+
let types = [];
|
|
35
|
+
let url = this.buildRequestUrl(`${this.url}/types`, details);
|
|
36
|
+
if (details.limit) {
|
|
37
|
+
types = (_a = (yield this.sendAllFinding(`${url}${url.indexOf('?') !== -1 ? '&' : '?'}limit=${details.limit}&offset=${details.offset}`, details.config))) !== null && _a !== void 0 ? _a : [];
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
let limit = 5000, offset = 0, isEmpty = false;
|
|
41
|
+
do {
|
|
42
|
+
let values = yield this.sendAllFinding(`${url}${url.indexOf('?') !== -1 ? '&' : '?'}limit=${limit}&offset=${offset}`, details.config);
|
|
43
|
+
if (values)
|
|
44
|
+
types = types.concat(values);
|
|
45
|
+
isEmpty = values == undefined || values.length == 0;
|
|
46
|
+
offset += limit;
|
|
47
|
+
} while (!isEmpty);
|
|
48
|
+
}
|
|
34
49
|
return types;
|
|
35
50
|
});
|
|
36
51
|
}
|
|
52
|
+
buildRequestUrl(url, details) {
|
|
53
|
+
let suffix = `${details.type ? `&type=${details.type}` : ""}`;
|
|
54
|
+
return `${url}?${suffix.substring(1)}`;
|
|
55
|
+
}
|
|
37
56
|
findById(id) {
|
|
38
57
|
return this.sendFinding(`${this.url}/types?id=${id.id}`, id.config);
|
|
39
58
|
}
|
|
@@ -48,17 +67,6 @@ class TypeManager extends itrm_tools_1.CrudServiceManager {
|
|
|
48
67
|
destroy(type) {
|
|
49
68
|
return this.sendDestruction(`${this.url}/types/${type.typeId}`, type.config);
|
|
50
69
|
}
|
|
51
|
-
count(details) {
|
|
52
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
-
var _a;
|
|
54
|
-
let url = this.buildRequestUrl(`${this.url}/business`, details);
|
|
55
|
-
return (_a = (yield this.sendCounting(url, details.config))) !== null && _a !== void 0 ? _a : { result: 0 };
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
buildRequestUrl(url, details) {
|
|
59
|
-
let suffix = `${details.type ? `&type=${details.type}` : ""}`;
|
|
60
|
-
return `${url}?${suffix.substring(1)}`;
|
|
61
|
-
}
|
|
62
70
|
}
|
|
63
71
|
exports.TypeManager = TypeManager;
|
|
64
72
|
//# sourceMappingURL=TypeManager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeManager.js","sourceRoot":"","sources":["../../src/crud/TypeManager.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,2CAA6E;
|
|
1
|
+
{"version":3,"file":"TypeManager.js","sourceRoot":"","sources":["../../src/crud/TypeManager.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,2CAA6E;AAmB7E,MAAa,WAAY,SAAQ,+BAA6C;IAG1E,YAAY,GAAW;QACnB,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACnB,CAAC;IAEY,IAAI,CAAC,OAA2B;;YACzC,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,GAAG,eAAe,OAAO,CAAC,IAAI,EAAE,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;QACtF,CAAC;KAAA;IAEY,KAAK,CAAC,OAA2B;;;YAC1C,IAAI,GAAG,GAAG,IAAI,CAAC,eAAe,CAAC,GAAG,IAAI,CAAC,GAAG,QAAQ,EAAE,OAAO,CAAC,CAAC;YAC7D,OAAO,MAAA,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,mCAAI,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;QAC3E,CAAC;KAAA;IAEY,OAAO,CAAC,OAA2B;;;YAC5C,IAAI,KAAK,GAAY,EAAE,CAAC;YACxB,IAAI,GAAG,GAAG,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,CAAC;QAC9D,OAAO,GAAG,GAAG,IAAI,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3C,CAAC;IAEM,QAAQ,CAAC,EAA+B;QAC3C,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,GAAG,aAAa,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC;IACxE,CAAC;IAEM,MAAM,CAAC,OAA2B;;QACrC,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,GAAG,QAAQ,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,MAAA,OAAO,CAAC,OAAO,mCAAI,EAAE,EAAE,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1H,CAAC;IAEM,MAAM,CAAC,IAAW;;QACrB,OAAO,IAAI,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAAC,GAAG,UAAU,IAAI,CAAC,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,MAAA,IAAI,CAAC,OAAO,mCAAI,EAAE,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACpI,CAAC;IAEM,OAAO,CAAC,IAAW;QACtB,OAAO,IAAI,CAAC,eAAe,CAAC,GAAG,IAAI,CAAC,GAAG,UAAU,IAAI,CAAC,MAAM,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACjF,CAAC;CACJ;AAvDD,kCAuDC"}
|
|
@@ -2,7 +2,7 @@ import { CrudServiceManager, StandardIdRequestDefinition } from "itrm-tools";
|
|
|
2
2
|
import { AxiosRequestConfig } from "axios";
|
|
3
3
|
export interface IUser {
|
|
4
4
|
userId?: number;
|
|
5
|
-
statusId
|
|
5
|
+
statusId?: number;
|
|
6
6
|
credentialsId?: number;
|
|
7
7
|
businessId?: number | string;
|
|
8
8
|
updatedAt?: string;
|