@fintekkers/ledger-models 0.1.96 → 0.1.97
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.
- package/node/fintekkers/models/portfolio/portfolio_grpc_pb.js +1 -0
- package/node/fintekkers/models/position/field_grpc_pb.js +1 -0
- package/node/fintekkers/models/position/measure_grpc_pb.js +1 -0
- package/node/fintekkers/models/position/position_filter_grpc_pb.js +1 -0
- package/node/fintekkers/models/position/position_grpc_pb.js +1 -0
- package/node/fintekkers/models/position/position_status_grpc_pb.js +1 -0
- package/node/fintekkers/models/position/position_util_grpc_pb.js +1 -0
- package/node/fintekkers/models/price/price_grpc_pb.js +1 -0
- package/node/fintekkers/models/security/bond/auction_type_grpc_pb.js +1 -0
- package/node/fintekkers/models/security/bond/issuance_grpc_pb.js +1 -0
- package/node/fintekkers/models/security/coupon_frequency_grpc_pb.js +1 -0
- package/node/fintekkers/models/security/coupon_type_grpc_pb.js +1 -0
- package/node/fintekkers/models/security/identifier/identifier_grpc_pb.js +1 -0
- package/node/fintekkers/models/security/identifier/identifier_type_grpc_pb.js +1 -0
- package/node/fintekkers/models/security/security_grpc_pb.js +1 -0
- package/node/fintekkers/models/security/security_pb.test.d.ts +1 -0
- package/node/fintekkers/models/security/security_pb.test.js +10 -10
- package/node/fintekkers/models/security/security_pb.test.js.map +1 -1
- package/node/fintekkers/models/security/security_quantity_type_grpc_pb.js +1 -0
- package/node/fintekkers/models/security/security_type_grpc_pb.js +1 -0
- package/node/fintekkers/models/security/tenor_grpc_pb.js +1 -0
- package/node/fintekkers/models/security/tenor_type_grpc_pb.js +1 -0
- package/node/fintekkers/models/strategy/strategy_allocation_grpc_pb.js +1 -0
- package/node/fintekkers/models/strategy/strategy_grpc_pb.js +1 -0
- package/node/fintekkers/models/transaction/transaction_grpc_pb.js +1 -0
- package/node/fintekkers/models/transaction/transaction_type_grpc_pb.js +1 -0
- package/node/fintekkers/models/util/api/api_key_grpc_pb.js +1 -0
- package/node/fintekkers/models/util/date_range_grpc_pb.js +1 -0
- package/node/fintekkers/models/util/date_range_pb.d.ts +43 -0
- package/node/fintekkers/models/util/date_range_pb.js +310 -0
- package/node/fintekkers/models/util/decimal_value_grpc_pb.js +1 -0
- package/node/fintekkers/models/util/endpoint_grpc_pb.js +1 -0
- package/node/fintekkers/models/util/local_date_grpc_pb.js +1 -0
- package/node/fintekkers/models/util/local_timestamp_grpc_pb.js +1 -0
- package/node/fintekkers/models/util/lock/node_partition_grpc_pb.js +1 -0
- package/node/fintekkers/models/util/lock/node_state_grpc_pb.js +1 -0
- package/node/fintekkers/models/util/uuid_grpc_pb.js +1 -0
- package/node/fintekkers/requests/portfolio/create_portfolio_request_grpc_pb.js +1 -0
- package/node/fintekkers/requests/portfolio/create_portfolio_response_grpc_pb.js +1 -0
- package/node/fintekkers/requests/portfolio/query_portfolio_request_grpc_pb.js +1 -0
- package/node/fintekkers/requests/portfolio/query_portfolio_response_grpc_pb.js +1 -0
- package/node/fintekkers/requests/position/query_position_request_grpc_pb.js +1 -0
- package/node/fintekkers/requests/position/query_position_response_grpc_pb.js +1 -0
- package/node/fintekkers/requests/price/create_price_request_grpc_pb.js +1 -0
- package/node/fintekkers/requests/price/create_price_response_grpc_pb.js +1 -0
- package/node/fintekkers/requests/price/query_price_request_grpc_pb.js +1 -0
- package/node/fintekkers/requests/price/query_price_request_pb.d.ts +47 -0
- package/node/fintekkers/requests/price/query_price_request_pb.js +190 -2
- package/node/fintekkers/requests/price/query_price_response_grpc_pb.js +1 -0
- package/node/fintekkers/requests/security/create_security_request_grpc_pb.js +1 -0
- package/node/fintekkers/requests/security/create_security_response_grpc_pb.js +1 -0
- package/node/fintekkers/requests/security/get_field_values_request_grpc_pb.js +1 -0
- package/node/fintekkers/requests/security/get_field_values_request_pb.js +238 -0
- package/node/fintekkers/requests/security/get_field_values_response_grpc_pb.js +1 -0
- package/node/fintekkers/requests/security/get_field_values_response_pb.js +268 -0
- package/node/fintekkers/requests/security/get_fields_response_grpc_pb.js +1 -0
- package/node/fintekkers/requests/security/get_fields_response_pb.js +266 -0
- package/node/fintekkers/requests/security/query_security_request_grpc_pb.js +1 -0
- package/node/fintekkers/requests/security/query_security_response_grpc_pb.js +1 -0
- package/node/fintekkers/requests/transaction/create_transaction_request_grpc_pb.js +1 -0
- package/node/fintekkers/requests/transaction/create_transaction_response_grpc_pb.js +1 -0
- package/node/fintekkers/requests/transaction/query_transaction_request_grpc_pb.js +1 -0
- package/node/fintekkers/requests/transaction/query_transaction_response_grpc_pb.js +1 -0
- package/node/fintekkers/requests/util/errors/error_grpc_pb.js +1 -0
- package/node/fintekkers/requests/util/errors/message_grpc_pb.js +1 -0
- package/node/fintekkers/requests/util/errors/summary_grpc_pb.js +1 -0
- package/node/fintekkers/requests/util/lock/lock_request_grpc_pb.js +1 -0
- package/node/fintekkers/requests/util/lock/lock_request_pb.js +54 -1
- package/node/fintekkers/requests/util/lock/lock_response_grpc_pb.js +1 -0
- package/node/fintekkers/requests/util/operation_grpc_pb.js +1 -0
- package/node/fintekkers/requests/valuation/valuation_request_grpc_pb.js +1 -0
- package/node/fintekkers/requests/valuation/valuation_response_grpc_pb.js +1 -0
- package/node/wrappers/models/portfolio/portfolio.d.ts +15 -0
- package/node/wrappers/models/portfolio/portfolio.js +26 -21
- package/node/wrappers/models/portfolio/portfolio.js.map +1 -1
- package/node/wrappers/models/portfolio/portfolio.ts +6 -2
- package/node/wrappers/models/position/field.d.ts +7 -0
- package/node/wrappers/models/position/field.js +10 -14
- package/node/wrappers/models/position/field.js.map +1 -1
- package/node/wrappers/models/position/field.test.d.ts +1 -0
- package/node/wrappers/models/position/field.test.js +10 -48
- package/node/wrappers/models/position/field.test.js.map +1 -1
- package/node/wrappers/models/position/field.ts +1 -2
- package/node/wrappers/models/position/position.d.ts +32 -0
- package/node/wrappers/models/position/position.js +89 -83
- package/node/wrappers/models/position/position.js.map +1 -1
- package/node/wrappers/models/position/position.test.d.ts +1 -0
- package/node/wrappers/models/position/position.test.js +128 -198
- package/node/wrappers/models/position/position.test.js.map +1 -1
- package/node/wrappers/models/position/position.test.ts +1 -1
- package/node/wrappers/models/position/position.ts +19 -12
- package/node/wrappers/models/position/positionfilter.d.ts +24 -0
- package/node/wrappers/models/position/positionfilter.js +19 -20
- package/node/wrappers/models/position/positionfilter.js.map +1 -1
- package/node/wrappers/models/position/positionfilter.ts +1 -1
- package/node/wrappers/models/security/security.d.ts +23 -0
- package/node/wrappers/models/security/security.js +55 -44
- package/node/wrappers/models/security/security.js.map +1 -1
- package/node/wrappers/models/security/security.test.d.ts +1 -0
- package/node/wrappers/models/security/security.test.js +14 -11
- package/node/wrappers/models/security/security.test.js.map +1 -1
- package/node/wrappers/models/security/security.ts +13 -6
- package/node/wrappers/models/transaction/transaction.d.ts +36 -0
- package/node/wrappers/models/transaction/transaction.js +98 -68
- package/node/wrappers/models/transaction/transaction.js.map +1 -1
- package/node/wrappers/models/transaction/transaction.test.d.ts +1 -0
- package/node/wrappers/models/transaction/transaction.test.js +12 -9
- package/node/wrappers/models/transaction/transaction.test.js.map +1 -1
- package/node/wrappers/models/transaction/transaction.ts +30 -12
- package/node/wrappers/models/transaction/transaction_type.d.ts +17 -0
- package/node/wrappers/models/transaction/transaction_type.js +12 -12
- package/node/wrappers/models/transaction/transaction_type.js.map +1 -1
- package/node/wrappers/models/transaction/transaction_type.ts +5 -5
- package/node/wrappers/models/utils/date.d.ts +11 -0
- package/node/wrappers/models/utils/date.js +16 -17
- package/node/wrappers/models/utils/date.js.map +1 -1
- package/node/wrappers/models/utils/date.test.d.ts +1 -0
- package/node/wrappers/models/utils/date.test.js +28 -58
- package/node/wrappers/models/utils/date.test.js.map +1 -1
- package/node/wrappers/models/utils/date.ts +1 -1
- package/node/wrappers/models/utils/datetime.d.ts +14 -0
- package/node/wrappers/models/utils/datetime.js +41 -34
- package/node/wrappers/models/utils/datetime.js.map +1 -1
- package/node/wrappers/models/utils/datetime.test.d.ts +1 -0
- package/node/wrappers/models/utils/datetime.test.js +40 -70
- package/node/wrappers/models/utils/datetime.test.js.map +1 -1
- package/node/wrappers/models/utils/datetime.ts +13 -8
- package/node/wrappers/models/utils/protoEnum.d.ts +12 -0
- package/node/wrappers/models/utils/protoEnum.js +22 -24
- package/node/wrappers/models/utils/protoEnum.js.map +1 -1
- package/node/wrappers/models/utils/protoEnum.test.d.ts +1 -0
- package/node/wrappers/models/utils/protoEnum.test.js +13 -13
- package/node/wrappers/models/utils/protoEnum.test.js.map +1 -1
- package/node/wrappers/models/utils/requestcontext.d.ts +13 -0
- package/node/wrappers/models/utils/requestcontext.js +52 -44
- package/node/wrappers/models/utils/requestcontext.js.map +1 -1
- package/node/wrappers/models/utils/requestcontext.ts +15 -15
- package/node/wrappers/models/utils/requestcontext_d.d.ts +6 -0
- package/node/wrappers/models/utils/requestcontext_d.js +1 -0
- package/node/wrappers/models/utils/serialization.d.ts +12 -0
- package/node/wrappers/models/utils/serialization.js +19 -22
- package/node/wrappers/models/utils/serialization.js.map +1 -1
- package/node/wrappers/models/utils/serialization.test.d.ts +1 -0
- package/node/wrappers/models/utils/serialization.test.js +14 -14
- package/node/wrappers/models/utils/serialization.test.js.map +1 -1
- package/node/wrappers/models/utils/serialization.ts +1 -1
- package/node/wrappers/models/utils/serialization.util.d.ts +4 -0
- package/node/wrappers/models/utils/serialization.util.js +25 -25
- package/node/wrappers/models/utils/serialization.util.js.map +1 -1
- package/node/wrappers/models/utils/serialization.util.test.d.ts +1 -0
- package/node/wrappers/models/utils/serialization.util.test.js +15 -15
- package/node/wrappers/models/utils/serialization.util.test.js.map +1 -1
- package/node/wrappers/models/utils/serialization.util.ts +5 -5
- package/node/wrappers/models/utils/uuid.d.ts +13 -0
- package/node/wrappers/models/utils/uuid.js +53 -31
- package/node/wrappers/models/utils/uuid.js.map +1 -1
- package/node/wrappers/models/utils/uuid.test.d.ts +1 -0
- package/node/wrappers/models/utils/uuid.test.js +7 -7
- package/node/wrappers/models/utils/uuid.test.js.map +1 -1
- package/node/wrappers/models/utils/uuid.ts +1 -1
- package/node/wrappers/requests/position/QueryPositionRequest.d.ts +19 -0
- package/node/wrappers/requests/position/QueryPositionRequest.js +19 -20
- package/node/wrappers/requests/position/QueryPositionRequest.js.map +1 -1
- package/node/wrappers/services/portfolio-service/PortfolioService.d.ts +15 -0
- package/node/wrappers/services/portfolio-service/PortfolioService.js +58 -109
- package/node/wrappers/services/portfolio-service/PortfolioService.js.map +1 -1
- package/node/wrappers/services/portfolio-service/PortfolioService.ts +2 -2
- package/node/wrappers/services/portfolio-service/portfolioService.test.d.ts +1 -0
- package/node/wrappers/services/portfolio-service/portfolioService.test.js +47 -64
- package/node/wrappers/services/portfolio-service/portfolioService.test.js.map +1 -1
- package/node/wrappers/services/position-service/PositionService.d.ts +10 -0
- package/node/wrappers/services/position-service/PositionService.js +45 -83
- package/node/wrappers/services/position-service/PositionService.js.map +1 -1
- package/node/wrappers/services/position-service/position.test.d.ts +1 -0
- package/node/wrappers/services/position-service/position.test.js +52 -118
- package/node/wrappers/services/position-service/position.test.js.map +1 -1
- package/node/wrappers/services/position-service/position.test.ts +7 -1
- package/node/wrappers/services/security-service/SecurityService.d.ts +15 -0
- package/node/wrappers/services/security-service/SecurityService.js +86 -117
- package/node/wrappers/services/security-service/SecurityService.js.map +1 -1
- package/node/wrappers/services/security-service/SecurityService.ts +2 -2
- package/node/wrappers/services/security-service/security.maturityLadder.test.d.ts +1 -0
- package/node/wrappers/services/security-service/security.maturityLadder.test.js +40 -75
- package/node/wrappers/services/security-service/security.maturityLadder.test.js.map +1 -1
- package/node/wrappers/services/security-service/security.maturityLadder.test.ts +1 -1
- package/node/wrappers/services/security-service/security.test.d.ts +1 -0
- package/node/wrappers/services/security-service/security.test.js +88 -114
- package/node/wrappers/services/security-service/security.test.js.map +1 -1
- package/node/wrappers/services/security-service/security.test.ts +2 -2
- package/node/wrappers/services/transaction-service/TransactionService.d.ts +13 -0
- package/node/wrappers/services/transaction-service/TransactionService.js +53 -98
- package/node/wrappers/services/transaction-service/TransactionService.js.map +1 -1
- package/node/wrappers/services/transaction-service/TransactionService.ts +2 -2
- package/node/wrappers/services/transaction-service/transaction.search.test.d.ts +1 -0
- package/node/wrappers/services/transaction-service/transaction.search.test.js +51 -70
- package/node/wrappers/services/transaction-service/transaction.search.test.js.map +1 -1
- package/node/wrappers/services/transaction-service/transaction.test.d.ts +1 -0
- package/node/wrappers/services/transaction-service/transaction.test.js +127 -171
- package/node/wrappers/services/transaction-service/transaction.test.js.map +1 -1
- package/node/wrappers/services/transaction-service/transaction.test.ts +3 -1
- package/package.json +4 -1
- package/tsconfig.json +15 -6
|
@@ -8,231 +8,161 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
test('test the enum Serialization',
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
})
|
|
67
|
-
test('test
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
case 0: return [4 /*yield*/, testSerialization()];
|
|
72
|
-
case 1:
|
|
73
|
-
isTrue = _a.sent();
|
|
74
|
-
expect(isTrue).toBe(true);
|
|
75
|
-
return [2 /*return*/];
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
}); });
|
|
79
|
-
test('test JSON Serialization', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
80
|
-
var isTrue;
|
|
81
|
-
return __generator(this, function (_a) {
|
|
82
|
-
switch (_a.label) {
|
|
83
|
-
case 0: return [4 /*yield*/, testJsonSerialization()];
|
|
84
|
-
case 1:
|
|
85
|
-
isTrue = _a.sent();
|
|
86
|
-
expect(isTrue).toBe(true);
|
|
87
|
-
return [2 /*return*/];
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
}); });
|
|
91
|
-
test('test deserialization of an unknown enum type', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
92
|
-
var isTrue;
|
|
93
|
-
return __generator(this, function (_a) {
|
|
94
|
-
switch (_a.label) {
|
|
95
|
-
case 0: return [4 /*yield*/, testDeSerializationWithUnknownProto()];
|
|
96
|
-
case 1:
|
|
97
|
-
isTrue = _a.sent();
|
|
98
|
-
expect(isTrue).toBe(true);
|
|
99
|
-
return [2 /*return*/];
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
}); });
|
|
12
|
+
const uuid_1 = require("../utils/uuid");
|
|
13
|
+
const any_pb_1 = require("google-protobuf/google/protobuf/any_pb");
|
|
14
|
+
const decimal_value_pb_1 = require("../../../fintekkers/models/util/decimal_value_pb");
|
|
15
|
+
const position_pb_1 = require("../../../fintekkers/models/position/position_pb");
|
|
16
|
+
const position_util_pb_1 = require("../../../fintekkers/models/position/position_util_pb");
|
|
17
|
+
const field_pb_1 = require("../../../fintekkers/models/position/field_pb");
|
|
18
|
+
const measure_pb_1 = require("../../../fintekkers/models/position/measure_pb");
|
|
19
|
+
const security_pb_1 = require("../../../fintekkers/models/security/security_pb");
|
|
20
|
+
const portfolio_pb_1 = require("../../../fintekkers/models/portfolio/portfolio_pb");
|
|
21
|
+
const position_1 = require("./position");
|
|
22
|
+
const date_1 = require("../utils/date");
|
|
23
|
+
const position_status_pb_1 = require("../../../fintekkers/models/position/position_status_pb");
|
|
24
|
+
const transaction_type_pb_1 = require("../../../fintekkers/models/transaction/transaction_type_pb");
|
|
25
|
+
const price_pb_1 = require("../../../fintekkers/models/price/price_pb");
|
|
26
|
+
const tenor_pb_1 = require("../../../fintekkers/models/security/tenor_pb");
|
|
27
|
+
const tenor_type_pb_1 = require("../../../fintekkers/models/security/tenor_type_pb");
|
|
28
|
+
test('test the enum Serialization', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
29
|
+
let isTrue = yield testEnumSerialization();
|
|
30
|
+
expect(isTrue).toBe(true);
|
|
31
|
+
}));
|
|
32
|
+
test('test the serialization position wrapper', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
33
|
+
let isTrue = yield testSerialization();
|
|
34
|
+
expect(isTrue).toBe(true);
|
|
35
|
+
}));
|
|
36
|
+
test('test JSON Serialization', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
37
|
+
let isTrue = yield testJsonSerialization();
|
|
38
|
+
expect(isTrue).toBe(true);
|
|
39
|
+
}));
|
|
40
|
+
test('test deserialization of an unknown enum type', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
41
|
+
let isTrue = yield testDeSerializationWithUnknownProto();
|
|
42
|
+
expect(isTrue).toBe(true);
|
|
43
|
+
}));
|
|
103
44
|
function testEnumSerialization() {
|
|
104
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
position.getMeasures().forEach(function (measureMapEntry) {
|
|
121
|
-
measureMapEntry.getMeasure().toString();
|
|
122
|
-
});
|
|
123
|
-
expect(position.getMeasureValue(measure_pb_1.MeasureProto.DIRECTED_QUANTITY)).toBe(1.55);
|
|
124
|
-
return [2 /*return*/, true];
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
let positionProto = new position_pb_1.PositionProto();
|
|
47
|
+
positionProto.setFieldsList([
|
|
48
|
+
new position_util_pb_1.FieldMapEntry().setField(field_pb_1.FieldProto.POSITION_STATUS).setEnumValue(position_status_pb_1.PositionStatusProto.EXECUTED)
|
|
49
|
+
]);
|
|
50
|
+
let measureValue = new decimal_value_pb_1.DecimalValueProto().setArbitraryPrecisionValue("1.55");
|
|
51
|
+
positionProto.setMeasuresList([
|
|
52
|
+
new position_util_pb_1.MeasureMapEntry().setMeasure(measure_pb_1.MeasureProto.DIRECTED_QUANTITY).setMeasureDecimalValue(measureValue)
|
|
53
|
+
]);
|
|
54
|
+
let position = new position_1.Position(positionProto);
|
|
55
|
+
let status = position.getFieldValue(field_pb_1.FieldProto.POSITION_STATUS);
|
|
56
|
+
expect(status.getEnumValueName()).toBe("EXECUTED");
|
|
57
|
+
expect(status.getEnumValue()).toBe(position_status_pb_1.PositionStatusProto.EXECUTED);
|
|
58
|
+
expect(status.getEnumDescriptor()).toBe(position_status_pb_1.PositionStatusProto);
|
|
59
|
+
position.getMeasures().forEach(measureMapEntry => {
|
|
60
|
+
measureMapEntry.getMeasure().toString();
|
|
125
61
|
});
|
|
62
|
+
expect(position.getMeasureValue(measure_pb_1.MeasureProto.DIRECTED_QUANTITY)).toBe(1.55);
|
|
63
|
+
return true;
|
|
126
64
|
});
|
|
127
65
|
}
|
|
128
66
|
function testJsonSerialization() {
|
|
129
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
expect(position2.getFieldValue(field_pb_1.FieldProto.SECURITY_DESCRIPTION)).toBe("Dummy");
|
|
158
|
-
return [2 /*return*/, true];
|
|
159
|
-
});
|
|
67
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
let tradeDate = date_1.LocalDate.today().toDate();
|
|
69
|
+
let productType = "Test product type";
|
|
70
|
+
let id = new uuid_1.UUID(uuid_1.UUID.random().toBytes());
|
|
71
|
+
const tradeDatePacked = new any_pb_1.Any();
|
|
72
|
+
tradeDatePacked.setTypeUrl(`DUMMYTYPE_DATE`);
|
|
73
|
+
tradeDatePacked.setValue(date_1.LocalDate.from(tradeDate).toProto().serializeBinary());
|
|
74
|
+
const idPacked = new any_pb_1.Any();
|
|
75
|
+
idPacked.setTypeUrl(`DUMMYTYPE_ID`);
|
|
76
|
+
idPacked.setValue(id.toUUIDProto().serializeBinary());
|
|
77
|
+
let positionProto = new position_pb_1.PositionProto();
|
|
78
|
+
positionProto.setFieldsList([
|
|
79
|
+
// new FieldMapEntry().setField(FieldProto.SECURITY).setFieldValuePacked(security),
|
|
80
|
+
new position_util_pb_1.FieldMapEntry().setField(field_pb_1.FieldProto.TRADE_DATE).setFieldValuePacked(tradeDatePacked),
|
|
81
|
+
new position_util_pb_1.FieldMapEntry().setField(field_pb_1.FieldProto.POSITION_STATUS).setEnumValue(position_status_pb_1.PositionStatusProto.EXECUTED),
|
|
82
|
+
new position_util_pb_1.FieldMapEntry().setField(field_pb_1.FieldProto.PRODUCT_TYPE).setStringValue(productType),
|
|
83
|
+
new position_util_pb_1.FieldMapEntry().setField(field_pb_1.FieldProto.SECURITY_DESCRIPTION).setStringValue("Dummy"),
|
|
84
|
+
new position_util_pb_1.FieldMapEntry().setField(field_pb_1.FieldProto.ID).setFieldValuePacked(idPacked),
|
|
85
|
+
]);
|
|
86
|
+
let position = new position_1.Position(positionProto);
|
|
87
|
+
let position2 = position_1.Position.fromJSON(position.toJSON());
|
|
88
|
+
let tradeDatePosition = position2.getFieldValue(field_pb_1.FieldProto.TRADE_DATE);
|
|
89
|
+
expect(tradeDate.getFullYear()).toBe(tradeDatePosition.getFullYear());
|
|
90
|
+
expect(tradeDate.getMonth()).toBe(tradeDatePosition.getMonth());
|
|
91
|
+
expect(tradeDate.getDay()).toBe(tradeDatePosition.getDay());
|
|
92
|
+
expect(tradeDate.getMonth()).toBe(tradeDatePosition.getMonth());
|
|
93
|
+
expect(position2.getFieldValue(field_pb_1.FieldProto.SECURITY_DESCRIPTION)).toBe("Dummy");
|
|
94
|
+
return true;
|
|
160
95
|
});
|
|
161
96
|
}
|
|
162
97
|
function testSerialization() {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
return [2 /*return*/, true];
|
|
185
|
-
});
|
|
98
|
+
var _a;
|
|
99
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
100
|
+
let { position, tradeDate, security, portfolio, productType, id } = getPosition(false);
|
|
101
|
+
let tradeDatePosition = position.getFieldValue(field_pb_1.FieldProto.TRADE_DATE);
|
|
102
|
+
expect(tradeDate.getFullYear()).toBe(tradeDatePosition.getFullYear());
|
|
103
|
+
expect(tradeDate.getMonth()).toBe(tradeDatePosition.getMonth());
|
|
104
|
+
expect(tradeDate.getDay()).toBe(tradeDatePosition.getDay());
|
|
105
|
+
let securityPosition = position.getFieldValue(field_pb_1.FieldProto.SECURITY);
|
|
106
|
+
expect(securityPosition.getAssetClass()).toBe(security.getAssetClass());
|
|
107
|
+
let portfolioPosition = position.getFieldValue(field_pb_1.FieldProto.PORTFOLIO);
|
|
108
|
+
expect(portfolioPosition.getPortfolioName()).toBe(portfolio.getPortfolioName());
|
|
109
|
+
expect(position.getFieldValue(field_pb_1.FieldProto.PRODUCT_TYPE)).toBe(productType);
|
|
110
|
+
let positionID = position.getFieldValue(field_pb_1.FieldProto.ID);
|
|
111
|
+
expect(positionID.toString()).toBe(id.toString());
|
|
112
|
+
expect(position.getFieldValue(field_pb_1.FieldProto.POSITION_STATUS).toString()).toBe("EXECUTED");
|
|
113
|
+
expect(position.getMeasureValue(measure_pb_1.MeasureProto.DIRECTED_QUANTITY)).toBe(1);
|
|
114
|
+
let price = position.getFieldValue(field_pb_1.FieldProto.PRICE);
|
|
115
|
+
expect((_a = price.getPrice()) === null || _a === void 0 ? void 0 : _a.getArbitraryPrecisionValue()).toBe("1.0");
|
|
116
|
+
let tenor = position.getFieldValue(field_pb_1.FieldProto.TENOR);
|
|
117
|
+
expect(tenor.getTermValue()).toBe("3M");
|
|
118
|
+
return true;
|
|
186
119
|
});
|
|
187
120
|
}
|
|
188
121
|
function testDeSerializationWithUnknownProto() {
|
|
189
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
expect(position.getFieldValue(field_pb_1.FieldProto.POSITION_STATUS).toString()).toBe("UNKNOWN");
|
|
194
|
-
return [2 /*return*/, true];
|
|
195
|
-
});
|
|
122
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
123
|
+
let { position } = getPosition(true);
|
|
124
|
+
expect(position.getFieldValue(field_pb_1.FieldProto.POSITION_STATUS).toString()).toBe("UNKNOWN");
|
|
125
|
+
return true;
|
|
196
126
|
});
|
|
197
127
|
}
|
|
198
128
|
function getPosition(includeUnknownEnumValue) {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
129
|
+
let security = new security_pb_1.SecurityProto().setAssetClass("Test");
|
|
130
|
+
let portfolio = new portfolio_pb_1.PortfolioProto().setPortfolioName("Test portfolio");
|
|
131
|
+
let tradeDate = date_1.LocalDate.today().toDate();
|
|
132
|
+
let productType = "Test product type";
|
|
133
|
+
let id = new uuid_1.UUID(uuid_1.UUID.random().toBytes());
|
|
134
|
+
let price = new price_pb_1.PriceProto()
|
|
205
135
|
.setPrice(new decimal_value_pb_1.DecimalValueProto().setArbitraryPrecisionValue("1.0"))
|
|
206
136
|
.setUuid(id.toUUIDProto())
|
|
207
137
|
.setSecurity(security);
|
|
208
|
-
|
|
138
|
+
let tenor = new tenor_pb_1.TenorProto()
|
|
209
139
|
.setTenorType(tenor_type_pb_1.TenorTypeProto.TERM)
|
|
210
140
|
.setTermValue("3M");
|
|
211
141
|
;
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
tradeDatePacked.setTypeUrl(
|
|
142
|
+
let measure = measure_pb_1.MeasureProto.DIRECTED_QUANTITY;
|
|
143
|
+
let measureValue = new decimal_value_pb_1.DecimalValueProto().setArbitraryPrecisionValue("1.0");
|
|
144
|
+
const tradeDatePacked = new any_pb_1.Any();
|
|
145
|
+
tradeDatePacked.setTypeUrl(`DUMMYTYPE_DATE`);
|
|
216
146
|
tradeDatePacked.setValue(date_1.LocalDate.from(tradeDate).toProto().serializeBinary());
|
|
217
|
-
|
|
218
|
-
idPacked.setTypeUrl(
|
|
147
|
+
const idPacked = new any_pb_1.Any();
|
|
148
|
+
idPacked.setTypeUrl(`DUMMYTYPE_ID`);
|
|
219
149
|
idPacked.setValue(id.toUUIDProto().serializeBinary());
|
|
220
|
-
|
|
221
|
-
pricePacked.setTypeUrl(
|
|
150
|
+
const pricePacked = new any_pb_1.Any();
|
|
151
|
+
pricePacked.setTypeUrl(`DUMMYTYPE_PRICE`);
|
|
222
152
|
pricePacked.setValue(price.serializeBinary());
|
|
223
|
-
|
|
224
|
-
tenorPacked.setTypeUrl(
|
|
153
|
+
const tenorPacked = new any_pb_1.Any();
|
|
154
|
+
tenorPacked.setTypeUrl(`DUMMYTYPE_TENOR`);
|
|
225
155
|
tenorPacked.setValue(tenor.serializeBinary());
|
|
226
|
-
|
|
227
|
-
securityPacked.setTypeUrl(
|
|
156
|
+
const securityPacked = new any_pb_1.Any();
|
|
157
|
+
securityPacked.setTypeUrl(`DUMMYTYPE_SECURITY`);
|
|
228
158
|
securityPacked.setValue(security.serializeBinary());
|
|
229
|
-
|
|
230
|
-
portfolioPacked.setTypeUrl(
|
|
159
|
+
const portfolioPacked = new any_pb_1.Any();
|
|
160
|
+
portfolioPacked.setTypeUrl(`DUMMYTYPE_PORTFOLIO`);
|
|
231
161
|
portfolioPacked.setValue(portfolio.serializeBinary());
|
|
232
|
-
|
|
162
|
+
let positionStatus = includeUnknownEnumValue ?
|
|
233
163
|
new position_util_pb_1.FieldMapEntry().setField(field_pb_1.FieldProto.POSITION_STATUS).setEnumValue(position_status_pb_1.PositionStatusProto.UNKNOWN) :
|
|
234
164
|
new position_util_pb_1.FieldMapEntry().setField(field_pb_1.FieldProto.POSITION_STATUS).setEnumValue(position_status_pb_1.PositionStatusProto.EXECUTED);
|
|
235
|
-
|
|
165
|
+
let positionProto = new position_pb_1.PositionProto();
|
|
236
166
|
positionProto.setFieldsList([
|
|
237
167
|
new position_util_pb_1.FieldMapEntry().setField(field_pb_1.FieldProto.SECURITY).setFieldValuePacked(securityPacked),
|
|
238
168
|
new position_util_pb_1.FieldMapEntry().setField(field_pb_1.FieldProto.PORTFOLIO).setFieldValuePacked(portfolioPacked),
|
|
@@ -247,7 +177,7 @@ function getPosition(includeUnknownEnumValue) {
|
|
|
247
177
|
positionProto.setMeasuresList([
|
|
248
178
|
new position_util_pb_1.MeasureMapEntry().setMeasure(measure).setMeasureDecimalValue(measureValue)
|
|
249
179
|
]);
|
|
250
|
-
|
|
251
|
-
return { position
|
|
180
|
+
let position = new position_1.Position(positionProto);
|
|
181
|
+
return { position, tradeDate, security, portfolio, productType, id };
|
|
252
182
|
}
|
|
253
183
|
//# sourceMappingURL=position.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"position.test.js","sourceRoot":"","sources":["position.test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"position.test.js","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AI,mBAAQ,CAAC,aAAa,CAAC,CAAC;IAC3C,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC;AACzE,CAAC"}
|
|
@@ -126,7 +126,7 @@ async function testSerialization(): Promise<boolean> {
|
|
|
126
126
|
expect(position.getMeasureValue(MeasureProto.DIRECTED_QUANTITY)).toBe(1);
|
|
127
127
|
|
|
128
128
|
let price: PriceProto = position.getFieldValue(FieldProto.PRICE);
|
|
129
|
-
expect(price.getPrice()
|
|
129
|
+
expect(price.getPrice()?.getArbitraryPrecisionValue()).toBe("1.0");
|
|
130
130
|
|
|
131
131
|
let tenor: TenorProto = position.getFieldValue(FieldProto.TENOR);
|
|
132
132
|
expect(tenor.getTermValue()).toBe("3M");
|
|
@@ -121,7 +121,9 @@ export class Position {
|
|
|
121
121
|
} else if (value instanceof Portfolio) {
|
|
122
122
|
return value.getPortfolioName();
|
|
123
123
|
} else if (value instanceof PriceProto) {
|
|
124
|
-
|
|
124
|
+
const uuid = value.getUuid();
|
|
125
|
+
if (!uuid) throw new Error("Price UUID is required");
|
|
126
|
+
return UUID.fromU8Array(uuid.getRawUuid_asU8()).toString();
|
|
125
127
|
} else if (value instanceof Transaction) {
|
|
126
128
|
return value.toString();
|
|
127
129
|
} else if (value instanceof UUID) {
|
|
@@ -138,6 +140,7 @@ export class Position {
|
|
|
138
140
|
default:
|
|
139
141
|
return "Can't display this field: " + fieldToGet.getField();
|
|
140
142
|
}
|
|
143
|
+
return "Unknown field type";
|
|
141
144
|
}
|
|
142
145
|
|
|
143
146
|
public getMeasures(): MeasureMapEntry[] {
|
|
@@ -166,14 +169,18 @@ export class Position {
|
|
|
166
169
|
}
|
|
167
170
|
|
|
168
171
|
public static unpackField(fieldToUnpack: FieldMapEntry): any {
|
|
172
|
+
const packedValue = fieldToUnpack.getFieldValuePacked();
|
|
173
|
+
if (!packedValue) throw new Error("Field value is required");
|
|
174
|
+
const binaryValue = packedValue.getValue() as Uint8Array;
|
|
175
|
+
|
|
169
176
|
switch (fieldToUnpack.getField()) {
|
|
170
177
|
case FieldProto.PORTFOLIO_ID:
|
|
171
178
|
case FieldProto.SECURITY_ID:
|
|
172
179
|
case FieldProto.PRICE_ID:
|
|
173
180
|
case FieldProto.ID:
|
|
174
|
-
return UUIDProto.deserializeBinary(
|
|
181
|
+
return UUIDProto.deserializeBinary(binaryValue);
|
|
175
182
|
case FieldProto.AS_OF:
|
|
176
|
-
return LocalTimestampProto.deserializeBinary(
|
|
183
|
+
return LocalTimestampProto.deserializeBinary(binaryValue);
|
|
177
184
|
case FieldProto.TRADE_DATE:
|
|
178
185
|
case FieldProto.MATURITY_DATE:
|
|
179
186
|
case FieldProto.ISSUE_DATE:
|
|
@@ -181,15 +188,15 @@ export class Position {
|
|
|
181
188
|
case FieldProto.TAX_LOT_OPEN_DATE:
|
|
182
189
|
case FieldProto.TAX_LOT_CLOSE_DATE:
|
|
183
190
|
case FieldProto.EFFECTIVE_DATE:
|
|
184
|
-
return LocalDateProto.deserializeBinary(
|
|
191
|
+
return LocalDateProto.deserializeBinary(binaryValue);
|
|
185
192
|
case FieldProto.IDENTIFIER:
|
|
186
|
-
return IdentifierProto.deserializeBinary(
|
|
193
|
+
return IdentifierProto.deserializeBinary(binaryValue);
|
|
187
194
|
case FieldProto.STRATEGY:
|
|
188
|
-
return StrategyProto.deserializeBinary(
|
|
195
|
+
return StrategyProto.deserializeBinary(binaryValue);
|
|
189
196
|
case FieldProto.TENOR:
|
|
190
|
-
return TenorProto.deserializeBinary(
|
|
197
|
+
return TenorProto.deserializeBinary(binaryValue);
|
|
191
198
|
case FieldProto.PRICE:
|
|
192
|
-
return PriceProto.deserializeBinary(
|
|
199
|
+
return PriceProto.deserializeBinary(binaryValue);
|
|
193
200
|
case FieldProto.TRANSACTION_TYPE:
|
|
194
201
|
case FieldProto.POSITION_STATUS:
|
|
195
202
|
return fieldToUnpack;
|
|
@@ -200,15 +207,15 @@ export class Position {
|
|
|
200
207
|
case FieldProto.PRODUCT_TYPE:
|
|
201
208
|
case FieldProto.PRODUCT_CLASS:
|
|
202
209
|
case FieldProto.ASSET_CLASS:
|
|
203
|
-
return StringValue.deserializeBinary(
|
|
210
|
+
return StringValue.deserializeBinary(binaryValue);
|
|
204
211
|
case FieldProto.PORTFOLIO:
|
|
205
|
-
return PortfolioProto.deserializeBinary(
|
|
212
|
+
return PortfolioProto.deserializeBinary(binaryValue);
|
|
206
213
|
case FieldProto.SECURITY:
|
|
207
214
|
case FieldProto.CASH_IMPACT_SECURITY:
|
|
208
|
-
return SecurityProto.deserializeBinary(
|
|
215
|
+
return SecurityProto.deserializeBinary(binaryValue);
|
|
209
216
|
case FieldProto.IS_CANCELLED:
|
|
210
217
|
console.log("Need to check that IS_CANCELLED IS SUPPORTED CORRECTLY");
|
|
211
|
-
return
|
|
218
|
+
return packedValue;
|
|
212
219
|
default:
|
|
213
220
|
throw new Error(`Field not found. Could not unpack ${FieldProto[fieldToUnpack.getField()]}. Mapping missing`);
|
|
214
221
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { FieldMapEntry, PositionFilterOperator } from '../../../fintekkers/models/position/position_util_pb';
|
|
2
|
+
import { FieldProto } from '../../../fintekkers/models/position/field_pb';
|
|
3
|
+
import { PositionFilterProto } from '../../../fintekkers/models/position/position_filter_pb';
|
|
4
|
+
export declare class PositionFilter {
|
|
5
|
+
filters: FieldMapEntry[];
|
|
6
|
+
constructor();
|
|
7
|
+
/**
|
|
8
|
+
* @param {*} field FieldProto.ASSET_CLASS, as an example
|
|
9
|
+
* @param {*} fieldValueString The appropriate value for the FieldProto, e.g. FieldProto.ASSET_CLASS would have a string fieldValue
|
|
10
|
+
*/
|
|
11
|
+
addEqualsStringFilter(field: FieldProto, fieldValueString: string): PositionFilter;
|
|
12
|
+
/**
|
|
13
|
+
* @param {*} field FieldProto.ASSET_CLASS, as an example
|
|
14
|
+
* @param {*} fieldValue The appropriate value for the FieldProto, e.g. FieldProto.ASSET_CLASS would have a string fieldValue
|
|
15
|
+
*/
|
|
16
|
+
addEqualsFilter(field: FieldProto, fieldValue: any): PositionFilter;
|
|
17
|
+
/**
|
|
18
|
+
* @param {*} field FieldProto.ASSET_CLASS, as an example
|
|
19
|
+
* @param {*} fieldValue The appropriate value for the FieldProto, e.g. FieldProto.ASSET_CLASS would have a string fieldValue
|
|
20
|
+
*/
|
|
21
|
+
addFilter(field: FieldProto, operator: PositionFilterOperator, fieldValue?: any, fieldValueString?: string): PositionFilter;
|
|
22
|
+
getFilters(): Array<FieldMapEntry>;
|
|
23
|
+
toProto(): PositionFilterProto;
|
|
24
|
+
}
|
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PositionFilter = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
const position_util_pb_1 = require("../../../fintekkers/models/position/position_util_pb");
|
|
5
|
+
const serialization_util_1 = require("../utils/serialization.util");
|
|
6
|
+
const position_filter_pb_1 = require("../../../fintekkers/models/position/position_filter_pb");
|
|
7
|
+
class PositionFilter {
|
|
8
|
+
constructor() {
|
|
9
9
|
this.filters = [];
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
12
|
* @param {*} field FieldProto.ASSET_CLASS, as an example
|
|
13
13
|
* @param {*} fieldValueString The appropriate value for the FieldProto, e.g. FieldProto.ASSET_CLASS would have a string fieldValue
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
addEqualsStringFilter(field, fieldValueString) {
|
|
16
16
|
return this.addFilter(field, position_util_pb_1.PositionFilterOperator.EQUALS, null, fieldValueString);
|
|
17
|
-
}
|
|
17
|
+
}
|
|
18
18
|
/**
|
|
19
19
|
* @param {*} field FieldProto.ASSET_CLASS, as an example
|
|
20
20
|
* @param {*} fieldValue The appropriate value for the FieldProto, e.g. FieldProto.ASSET_CLASS would have a string fieldValue
|
|
21
21
|
*/
|
|
22
|
-
|
|
22
|
+
addEqualsFilter(field, fieldValue) {
|
|
23
23
|
if (typeof fieldValue === 'string') {
|
|
24
24
|
return this.addEqualsStringFilter(field, fieldValue);
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
27
|
-
return this.addFilter(field, position_util_pb_1.PositionFilterOperator.EQUALS, fieldValue,
|
|
27
|
+
return this.addFilter(field, position_util_pb_1.PositionFilterOperator.EQUALS, fieldValue, undefined);
|
|
28
28
|
}
|
|
29
|
-
}
|
|
29
|
+
}
|
|
30
30
|
/**
|
|
31
31
|
* @param {*} field FieldProto.ASSET_CLASS, as an example
|
|
32
32
|
* @param {*} fieldValue The appropriate value for the FieldProto, e.g. FieldProto.ASSET_CLASS would have a string fieldValue
|
|
33
33
|
*/
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
addFilter(field, operator, fieldValue, fieldValueString) {
|
|
35
|
+
const fieldMapEntry = new position_util_pb_1.FieldMapEntry();
|
|
36
36
|
fieldMapEntry.setField(field); //FieldProto.ASSET_CLASS);
|
|
37
37
|
fieldMapEntry.setOperator(operator);
|
|
38
38
|
if (fieldValueString)
|
|
@@ -45,18 +45,17 @@ var PositionFilter = /** @class */ (function () {
|
|
|
45
45
|
}
|
|
46
46
|
this.filters.push(fieldMapEntry);
|
|
47
47
|
return this;
|
|
48
|
-
}
|
|
49
|
-
|
|
48
|
+
}
|
|
49
|
+
getFilters() {
|
|
50
50
|
return this.filters;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
}
|
|
52
|
+
toProto() {
|
|
53
|
+
const positionFilterProto = new position_filter_pb_1.PositionFilterProto();
|
|
54
54
|
positionFilterProto.setObjectClass('PositionFilter');
|
|
55
55
|
positionFilterProto.setVersion('0.0.1');
|
|
56
56
|
positionFilterProto.setFiltersList(this.filters);
|
|
57
57
|
return positionFilterProto;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
}());
|
|
58
|
+
}
|
|
59
|
+
}
|
|
61
60
|
exports.PositionFilter = PositionFilter;
|
|
62
61
|
//# sourceMappingURL=positionfilter.js.map
|