cetus-tools 1.0.51 → 1.0.53
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,41 +1,43 @@
|
|
|
1
|
-
import { AxiosRequestConfig } from "axios";
|
|
2
|
-
import { CrudServiceManager, StandardIdRequestDefinition } from "itrm-tools";
|
|
3
|
-
export interface IExpense {
|
|
4
|
-
expenseId?: number;
|
|
5
|
-
sourceId?: number;
|
|
6
|
-
typeId?: number;
|
|
7
|
-
date?: number;
|
|
8
|
-
fromDate?: number;
|
|
9
|
-
toDate?: number;
|
|
10
|
-
amount?: number;
|
|
11
|
-
reason?: string;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
1
|
+
import { AxiosRequestConfig } from "axios";
|
|
2
|
+
import { CrudServiceManager, StandardIdRequestDefinition } from "itrm-tools";
|
|
3
|
+
export interface IExpense {
|
|
4
|
+
expenseId?: number;
|
|
5
|
+
sourceId?: number;
|
|
6
|
+
typeId?: number;
|
|
7
|
+
date?: number;
|
|
8
|
+
fromDate?: number;
|
|
9
|
+
toDate?: number;
|
|
10
|
+
amount?: number;
|
|
11
|
+
reason?: string;
|
|
12
|
+
details?: any;
|
|
13
|
+
updatedAt?: string;
|
|
14
|
+
createdAt?: string;
|
|
15
|
+
config?: AxiosRequestConfig;
|
|
16
|
+
}
|
|
17
|
+
export interface IExpenseDetails {
|
|
18
|
+
sourceId?: number;
|
|
19
|
+
typeId?: number;
|
|
20
|
+
date?: number;
|
|
21
|
+
fromDate?: number;
|
|
22
|
+
toDate?: number;
|
|
23
|
+
amount?: number;
|
|
24
|
+
reason?: string;
|
|
25
|
+
details?: any;
|
|
26
|
+
limit?: number;
|
|
27
|
+
offset?: number;
|
|
28
|
+
config?: AxiosRequestConfig;
|
|
29
|
+
}
|
|
30
|
+
export declare class ExpenseManager extends CrudServiceManager<IExpenseDetails, IExpense> {
|
|
31
|
+
private url;
|
|
32
|
+
constructor(url: string);
|
|
33
|
+
find(details: IExpenseDetails): Promise<IExpense | undefined>;
|
|
34
|
+
count(details: IExpense): Promise<{
|
|
35
|
+
result: number;
|
|
36
|
+
}>;
|
|
37
|
+
findAll(details: IExpenseDetails): Promise<IExpense[] | undefined>;
|
|
38
|
+
private buildRequestUrl;
|
|
39
|
+
findById(id: StandardIdRequestDefinition): Promise<IExpense | undefined>;
|
|
40
|
+
create(details: IExpenseDetails): Promise<IExpense | undefined>;
|
|
41
|
+
modify(expense: IExpense): Promise<any>;
|
|
42
|
+
destroy(expense: IExpense): Promise<any>;
|
|
43
|
+
}
|
|
@@ -1,82 +1,84 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.ExpenseManager = void 0;
|
|
13
|
-
const itrm_tools_1 = require("itrm-tools");
|
|
14
|
-
class ExpenseManager extends itrm_tools_1.CrudServiceManager {
|
|
15
|
-
constructor(url) {
|
|
16
|
-
super();
|
|
17
|
-
this.url = url;
|
|
18
|
-
}
|
|
19
|
-
find(details) {
|
|
20
|
-
return this.sendFinding(`${this.url}/expenses?sourceId=${details.sourceId}${details.date ? `&date=${details.date}` : ""}`, details.config);
|
|
21
|
-
}
|
|
22
|
-
count(details) {
|
|
23
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
var _a;
|
|
25
|
-
let url = this.buildRequestUrl(`${this.url}/expenses`, details);
|
|
26
|
-
return (_a = (yield this.sendCounting(url, details.config))) !== null && _a !== void 0 ? _a : { result: 0 };
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
findAll(details) {
|
|
30
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
var _a;
|
|
32
|
-
let expenses = [];
|
|
33
|
-
let url = this.buildRequestUrl(`${this.url}/expenses`, details);
|
|
34
|
-
if (details.limit) {
|
|
35
|
-
expenses = (_a = (yield this.sendAllFinding(`${url}${url.indexOf('?') !== -1 ? '&' : '?'}limit=${details.limit}&offset=${details.offset}`, details.config))) !== null && _a !== void 0 ? _a : [];
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
let limit = 5000, offset = 0, isEmpty = false;
|
|
39
|
-
do {
|
|
40
|
-
let values = yield this.sendAllFinding(`${url}${url.indexOf('?') !== -1 ? '&' : '?'}limit=${limit}&offset=${offset}`, details.config);
|
|
41
|
-
if (values)
|
|
42
|
-
expenses = expenses.concat(values);
|
|
43
|
-
isEmpty = values == undefined || values.length == 0;
|
|
44
|
-
offset += limit;
|
|
45
|
-
} while (!isEmpty);
|
|
46
|
-
}
|
|
47
|
-
return expenses;
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
buildRequestUrl(url, details) {
|
|
51
|
-
let suffix = `${details.sourceId ? `&sourceId=${details.sourceId}` : ""}${details.date ? `&date=${details.date}` : ""}${details.fromDate ? `&fromDate=${details.fromDate}` : ""}${details.toDate ? `&toDate=${details.toDate}` : ""}`;
|
|
52
|
-
return `${url}?${suffix.substring(1)}`;
|
|
53
|
-
}
|
|
54
|
-
findById(id) {
|
|
55
|
-
return this.sendFinding(`${this.url}/expenses?id=${id.id}`, id.config);
|
|
56
|
-
}
|
|
57
|
-
create(details) {
|
|
58
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
-
return this.sendCreation(`${this.url}/expenses`, {
|
|
60
|
-
sourceId: details.sourceId,
|
|
61
|
-
typeId: details.typeId,
|
|
62
|
-
date: details.date,
|
|
63
|
-
amount: details.amount,
|
|
64
|
-
reason: details.reason,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ExpenseManager = void 0;
|
|
13
|
+
const itrm_tools_1 = require("itrm-tools");
|
|
14
|
+
class ExpenseManager extends itrm_tools_1.CrudServiceManager {
|
|
15
|
+
constructor(url) {
|
|
16
|
+
super();
|
|
17
|
+
this.url = url;
|
|
18
|
+
}
|
|
19
|
+
find(details) {
|
|
20
|
+
return this.sendFinding(`${this.url}/expenses?sourceId=${details.sourceId}${details.date ? `&date=${details.date}` : ""}`, details.config);
|
|
21
|
+
}
|
|
22
|
+
count(details) {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
var _a;
|
|
25
|
+
let url = this.buildRequestUrl(`${this.url}/expenses`, details);
|
|
26
|
+
return (_a = (yield this.sendCounting(url, details.config))) !== null && _a !== void 0 ? _a : { result: 0 };
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
findAll(details) {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
var _a;
|
|
32
|
+
let expenses = [];
|
|
33
|
+
let url = this.buildRequestUrl(`${this.url}/expenses`, details);
|
|
34
|
+
if (details.limit) {
|
|
35
|
+
expenses = (_a = (yield this.sendAllFinding(`${url}${url.indexOf('?') !== -1 ? '&' : '?'}limit=${details.limit}&offset=${details.offset}`, details.config))) !== null && _a !== void 0 ? _a : [];
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
let limit = 5000, offset = 0, isEmpty = false;
|
|
39
|
+
do {
|
|
40
|
+
let values = yield this.sendAllFinding(`${url}${url.indexOf('?') !== -1 ? '&' : '?'}limit=${limit}&offset=${offset}`, details.config);
|
|
41
|
+
if (values)
|
|
42
|
+
expenses = expenses.concat(values);
|
|
43
|
+
isEmpty = values == undefined || values.length == 0;
|
|
44
|
+
offset += limit;
|
|
45
|
+
} while (!isEmpty);
|
|
46
|
+
}
|
|
47
|
+
return expenses;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
buildRequestUrl(url, details) {
|
|
51
|
+
let suffix = `${details.sourceId ? `&sourceId=${details.sourceId}` : ""}${details.date ? `&date=${details.date}` : ""}${details.fromDate ? `&fromDate=${details.fromDate}` : ""}${details.toDate ? `&toDate=${details.toDate}` : ""}`;
|
|
52
|
+
return `${url}?${suffix.substring(1)}`;
|
|
53
|
+
}
|
|
54
|
+
findById(id) {
|
|
55
|
+
return this.sendFinding(`${this.url}/expenses?id=${id.id}`, id.config);
|
|
56
|
+
}
|
|
57
|
+
create(details) {
|
|
58
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
return this.sendCreation(`${this.url}/expenses`, {
|
|
60
|
+
sourceId: details.sourceId,
|
|
61
|
+
typeId: details.typeId,
|
|
62
|
+
date: details.date,
|
|
63
|
+
amount: details.amount,
|
|
64
|
+
reason: details.reason,
|
|
65
|
+
details: details.details
|
|
66
|
+
}, details.config);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
modify(expense) {
|
|
70
|
+
return this.sendModification(`${this.url}/expenses/${expense.expenseId}`, {
|
|
71
|
+
sourceId: expense.sourceId,
|
|
72
|
+
typeId: expense.typeId,
|
|
73
|
+
date: expense.date,
|
|
74
|
+
amount: expense.amount,
|
|
75
|
+
reason: expense.reason,
|
|
76
|
+
details: expense.details
|
|
77
|
+
}, expense.config);
|
|
78
|
+
}
|
|
79
|
+
destroy(expense) {
|
|
80
|
+
return this.sendDestuction(`${this.url}/expenses/${expense.expenseId}`, expense.config);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
exports.ExpenseManager = ExpenseManager;
|
|
82
84
|
//# sourceMappingURL=ExpenseManager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpenseManager.js","sourceRoot":"","sources":["../../src/crud/ExpenseManager.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,2CAA6E;
|
|
1
|
+
{"version":3,"file":"ExpenseManager.js","sourceRoot":"","sources":["../../src/crud/ExpenseManager.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,2CAA6E;AA+B7E,MAAa,cAAe,SAAQ,+BAA6C;IAG7E,YAAY,GAAW;QACnB,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,G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E,CAAC;IAEY,MAAM,CAAC,OAAwB;;YACxC,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,GAAG,WAAW,EAAE;gBAC7C,QAAQ,EAAE,OAAO,CAAC,QAAQ;gBAC1B,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,OAAO,EAAE,OAAO,CAAC,OAAO;aAC3B,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;QACvB,CAAC;KAAA;IAEM,MAAM,CAAC,OAAiB;QAC3B,OAAO,IAAI,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAAC,GAAG,aAAa,OAAO,CAAC,SAAS,EAAE,EAAE;YACtE,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,OAAO,EAAE,OAAO,CAAC,OAAO;SAC3B,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACvB,CAAC;IAEM,OAAO,CAAC,OAAiB;QAC5B,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,GAAG,aAAa,OAAO,CAAC,SAAS,EAAE,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5F,CAAC;CACJ;AArED,wCAqEC"}
|
|
@@ -6,7 +6,7 @@ export interface IPnl {
|
|
|
6
6
|
assetId?: number;
|
|
7
7
|
date?: number;
|
|
8
8
|
rawValue?: number;
|
|
9
|
-
netValue?:
|
|
9
|
+
netValue?: number;
|
|
10
10
|
details?: any;
|
|
11
11
|
updatedAt?: string;
|
|
12
12
|
createdAt?: string;
|
|
@@ -17,7 +17,7 @@ export interface IPnlDetails {
|
|
|
17
17
|
assetId?: number;
|
|
18
18
|
date?: number;
|
|
19
19
|
rawValue?: number;
|
|
20
|
-
netValue?:
|
|
20
|
+
netValue?: number;
|
|
21
21
|
details?: any;
|
|
22
22
|
limit?: number;
|
|
23
23
|
offset?: number;
|