@fintekkers/ledger-models 0.1.60 → 0.1.61
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/babel.config.js +3 -1
- package/index.js +1 -15
- package/index.js.map +1 -1
- package/index.ts +1 -19
- package/jest.config.js +4 -0
- package/node/fintekkers/models/security/security_pb.test.js +29 -30
- package/node/fintekkers/models/security/security_pb.test.js.map +1 -0
- package/node/fintekkers/models/security/security_pb.test.ts +33 -0
- package/node/wrappers/models/security/security.js +1 -1
- package/node/wrappers/models/security/security.js.map +1 -1
- package/node/wrappers/models/security/security.ts +1 -1
- package/node/wrappers/models/transaction/transaction.js +10 -8
- package/node/wrappers/models/transaction/transaction.js.map +1 -1
- package/node/wrappers/models/transaction/transaction.test.js +26 -0
- package/node/wrappers/models/transaction/transaction.test.js.map +1 -0
- package/node/wrappers/models/transaction/transaction.test.ts +37 -0
- package/node/wrappers/models/transaction/transaction.ts +13 -11
- package/node/wrappers/models/transaction/transaction_type.js +45 -0
- package/node/wrappers/models/transaction/transaction_type.js.map +1 -0
- package/node/wrappers/models/transaction/transaction_type.ts +47 -0
- package/node/wrappers/models/utils/date.js +25 -0
- package/node/wrappers/models/utils/date.js.map +1 -0
- package/node/wrappers/models/utils/date.ts +31 -0
- package/node/wrappers/models/utils/datetime.js +4 -4
- package/node/wrappers/models/utils/datetime.js.map +1 -1
- package/node/wrappers/models/utils/datetime.ts +4 -4
- package/node/wrappers/models/utils/serialization.test.js +14 -54
- package/node/wrappers/models/utils/serialization.test.js.map +1 -1
- package/node/wrappers/models/utils/serialization.test.ts +11 -7
- package/node/wrappers/services/portfolio-service/PortfolioService.js +2 -5
- package/node/wrappers/services/portfolio-service/PortfolioService.js.map +1 -1
- package/node/wrappers/services/portfolio-service/PortfolioService.ts +2 -5
- package/node/wrappers/{portfolio.test.js → services/portfolio-service/portfolio.test.js} +10 -9
- package/node/wrappers/services/portfolio-service/portfolio.test.js.map +1 -0
- package/node/wrappers/{portfolio.test.ts → services/portfolio-service/portfolio.test.ts} +15 -11
- package/node/wrappers/services/position-service/PositionService.js +2 -5
- package/node/wrappers/services/position-service/PositionService.js.map +1 -1
- package/node/wrappers/services/position-service/PositionService.ts +2 -5
- package/node/wrappers/{position.test.js → services/position-service/position.test.js} +17 -20
- package/node/wrappers/services/position-service/position.test.js.map +1 -0
- package/node/wrappers/{position.test.ts → services/position-service/position.test.ts} +21 -28
- package/node/wrappers/services/security-service/SecurityService.js +2 -5
- package/node/wrappers/services/security-service/SecurityService.js.map +1 -1
- package/node/wrappers/services/security-service/SecurityService.ts +2 -5
- package/node/wrappers/{security.test.js → services/security-service/security.test.js} +15 -16
- package/node/wrappers/services/security-service/security.test.js.map +1 -0
- package/node/wrappers/{security.test.ts → services/security-service/security.test.ts} +19 -17
- package/node/wrappers/services/transaction-service/TransactionService.js +2 -6
- package/node/wrappers/services/transaction-service/TransactionService.js.map +1 -1
- package/node/wrappers/services/transaction-service/TransactionService.ts +2 -7
- package/node/wrappers/{transaction.test.js → services/transaction-service/transaction.test.js} +17 -18
- package/node/wrappers/services/transaction-service/transaction.test.js.map +1 -0
- package/node/wrappers/{transaction.test.ts → services/transaction-service/transaction.test.ts} +22 -25
- package/package.json +3 -2
- package/node/wrappers/portfolio.test.js.map +0 -1
- package/node/wrappers/position.test.js.map +0 -1
- package/node/wrappers/security.test.js.map +0 -1
- package/node/wrappers/transaction.test.js.map +0 -1
|
@@ -1,64 +1,24 @@
|
|
|
1
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
|
-
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.testSerialization = void 0;
|
|
40
3
|
var serialization_1 = require("./serialization");
|
|
41
4
|
var uuid_1 = require("./uuid");
|
|
42
5
|
var assert = require("assert");
|
|
6
|
+
test('test creating a security against the api.fintekkers.org portfolio service', function () {
|
|
7
|
+
testSerialization();
|
|
8
|
+
});
|
|
43
9
|
function testSerialization() {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
deserializedTimestamp = serialization_1.ProtoSerializationUtil.deserialize(serializedTimestamp);
|
|
56
|
-
console.log(deserializedTimestamp);
|
|
57
|
-
return [2 /*return*/];
|
|
58
|
-
});
|
|
59
|
-
});
|
|
10
|
+
checkUUID();
|
|
11
|
+
//TODO: Make these tests more robust
|
|
12
|
+
var serializedDate = serialization_1.ProtoSerializationUtil.serialize(new Date());
|
|
13
|
+
assert(serializedDate.toString().indexOf('2023') > -1);
|
|
14
|
+
var deserializedDate = serialization_1.ProtoSerializationUtil.deserialize(serializedDate);
|
|
15
|
+
assert(deserializedDate.toString().indexOf('2023') > -1);
|
|
16
|
+
var obj = new Date();
|
|
17
|
+
var serializedTimestamp = serialization_1.ProtoSerializationUtil.serialize(obj);
|
|
18
|
+
assert(serializedTimestamp.toString().indexOf('2023') > -1);
|
|
19
|
+
var deserializedTimestamp = serialization_1.ProtoSerializationUtil.deserialize(serializedTimestamp);
|
|
20
|
+
assert(deserializedTimestamp.toString().indexOf('2023') > -1);
|
|
60
21
|
}
|
|
61
|
-
exports.testSerialization = testSerialization;
|
|
62
22
|
function checkUUID() {
|
|
63
23
|
var uuid = uuid_1.UUID.random();
|
|
64
24
|
var serializedUUID = serialization_1.ProtoSerializationUtil.serialize(uuid);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialization.test.js","sourceRoot":"","sources":["serialization.test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"serialization.test.js","sourceRoot":"","sources":["serialization.test.ts"],"names":[],"mappings":";;AAEA,iDAAyD;AACzD,+BAA8B;AAE9B,+BAAkC;AAClC,IAAI,CAAC,2EAA2E,EAAE;IAC9E,iBAAiB,EAAE,CAAC;AACtB,CAAC,CAAC,CAAC;AAEL,SAAS,iBAAiB;IACtB,SAAS,EAAE,CAAC;IAEZ,oCAAoC;IAEpC,IAAM,cAAc,GAAQ,sCAAsB,CAAC,SAAS,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;IACzE,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAEvD,IAAM,gBAAgB,GAAQ,sCAAsB,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IACjF,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAEzD,IAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IACvB,IAAM,mBAAmB,GAAQ,sCAAsB,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IACvE,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAE5D,IAAM,qBAAqB,GAAQ,sCAAsB,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;IAC3F,MAAM,CAAC,qBAAqB,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAClE,CAAC;AAED,SAAS,SAAS;IACd,IAAM,IAAI,GAAS,WAAI,CAAC,MAAM,EAAE,CAAC;IACjC,IAAM,cAAc,GAAc,sCAAsB,CAAC,SAAS,CAAC,IAAI,CAAc,CAAC;IACtF,IAAM,QAAQ,GAAS,sCAAsB,CAAC,WAAW,CAAC,cAAc,CAAS,CAAC;IAElF,IAAM,UAAU,GAAW,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC3C,IAAM,cAAc,GAAW,QAAQ,CAAC,QAAQ,EAAE,CAAC;IAEnD,MAAM,CAAC,KAAK,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;IACzC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;AACzD,CAAC"}
|
|
@@ -1,28 +1,32 @@
|
|
|
1
|
+
import { LocalDateProto } from '../../../fintekkers/models/util/local_date_pb';
|
|
1
2
|
import { UUIDProto } from '../../../fintekkers/models/util/uuid_pb';
|
|
2
3
|
import { ProtoSerializationUtil } from './serialization';
|
|
3
4
|
import { UUID } from './uuid';
|
|
4
5
|
|
|
5
6
|
import assert = require('assert');
|
|
7
|
+
test('test creating a security against the api.fintekkers.org portfolio service', () => {
|
|
8
|
+
testSerialization();
|
|
9
|
+
});
|
|
6
10
|
|
|
7
|
-
|
|
11
|
+
function testSerialization(): void {
|
|
8
12
|
checkUUID();
|
|
9
13
|
|
|
14
|
+
//TODO: Make these tests more robust
|
|
15
|
+
|
|
10
16
|
const serializedDate: any = ProtoSerializationUtil.serialize(new Date());
|
|
11
|
-
|
|
17
|
+
assert(serializedDate.toString().indexOf('2023') > -1);
|
|
12
18
|
|
|
13
19
|
const deserializedDate: any = ProtoSerializationUtil.deserialize(serializedDate);
|
|
14
|
-
|
|
20
|
+
assert(deserializedDate.toString().indexOf('2023') > -1);
|
|
15
21
|
|
|
16
22
|
const obj = new Date();
|
|
17
23
|
const serializedTimestamp: any = ProtoSerializationUtil.serialize(obj);
|
|
18
|
-
|
|
24
|
+
assert(serializedTimestamp.toString().indexOf('2023') > -1);
|
|
19
25
|
|
|
20
26
|
const deserializedTimestamp: any = ProtoSerializationUtil.deserialize(serializedTimestamp);
|
|
21
|
-
|
|
27
|
+
assert(deserializedTimestamp.toString().indexOf('2023') > -1);
|
|
22
28
|
}
|
|
23
29
|
|
|
24
|
-
export { testSerialization };
|
|
25
|
-
|
|
26
30
|
function checkUUID() {
|
|
27
31
|
const uuid: UUID = UUID.random();
|
|
28
32
|
const serializedUUID: UUIDProto = ProtoSerializationUtil.serialize(uuid) as UUIDProto;
|
|
@@ -48,8 +48,8 @@ var query_portfolio_request_pb_1 = require("../../../fintekkers/requests/portfol
|
|
|
48
48
|
var create_portfolio_request_pb_1 = require("../../../fintekkers/requests/portfolio/create_portfolio_request_pb");
|
|
49
49
|
var PortfolioService = /** @class */ (function () {
|
|
50
50
|
function PortfolioService() {
|
|
51
|
-
|
|
52
|
-
this.client = new
|
|
51
|
+
this.client = new portfolio_service_grpc_pb_1.PortfolioClient('api.fintekkers.org:8082', grpc.credentials.createSsl());
|
|
52
|
+
// this.client = new PortfolioClient('localhost:8082', grpc.credentials.createInsecure());
|
|
53
53
|
}
|
|
54
54
|
PortfolioService.prototype.validateCreatePortfolio = function (portfolio) {
|
|
55
55
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -98,14 +98,11 @@ var PortfolioService = /** @class */ (function () {
|
|
|
98
98
|
stream2 = tmpClient.search(searchRequest);
|
|
99
99
|
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
100
100
|
stream2.on('data', function (response) {
|
|
101
|
-
console.log('Result of the portfolio search call');
|
|
102
|
-
console.log('Response:', response);
|
|
103
101
|
response.getPortfolioResponseList().forEach(function (portfolio) {
|
|
104
102
|
listPortfolios.push(portfolio);
|
|
105
103
|
});
|
|
106
104
|
});
|
|
107
105
|
stream2.on('end', function () {
|
|
108
|
-
console.log('Stream ended.');
|
|
109
106
|
resolve(listPortfolios);
|
|
110
107
|
});
|
|
111
108
|
stream2.on('error', function (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PortfolioService.js","sourceRoot":"","sources":["PortfolioService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oCAAsC;AACtC,6BAAiC;AAIjC,gDAA8D;AAI9D,cAAc;AACd,6FAA6F;AAG7F,sBAAsB;AACtB,sHAA2G;AAC3G,gHAA+G;AAE/G,kHAAiH;AAGjH;IAGE;QACE,
|
|
1
|
+
{"version":3,"file":"PortfolioService.js","sourceRoot":"","sources":["PortfolioService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oCAAsC;AACtC,6BAAiC;AAIjC,gDAA8D;AAI9D,cAAc;AACd,6FAA6F;AAG7F,sBAAsB;AACtB,sHAA2G;AAC3G,gHAA+G;AAE/G,kHAAiH;AAGjH;IAGE;QACE,IAAI,CAAC,MAAM,GAAG,IAAI,2CAAe,CAAC,yBAAyB,EAAE,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,CAAC,CAAC;QAC3F,0FAA0F;IAC5F,CAAC;IAEK,kDAAuB,GAA7B,UAA8B,SAAyB;;;;;;wBAC/C,aAAa,GAAG,IAAI,yDAA2B,EAAE,CAAC;wBACxD,aAAa,CAAC,cAAc,CAAC,kBAAkB,CAAC,CAAC;wBACjD,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;wBAClC,aAAa,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;wBAE3C,2BAA2B,GAAG,IAAA,gBAAS,EAAC,IAAI,CAAC,MAAM,CAAC,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;wBACnF,qBAAM,2BAA2B,CAAC,aAAa,CAAC,EAAA;;wBAA3D,QAAQ,GAAG,SAAgD;wBACjE,sBAAO,QAAQ,EAAC;;;;KACjB;IAEK,0CAAe,GAArB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AAG,IAAI,uDAA0B,EAAE,CAAC;wBACvD,aAAa,CAAC,cAAc,CAAC,kBAAkB,CAAC,CAAC;wBACjD,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;wBAClC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;wBAGtB,cAAc,GAAG,IAAI,wCAAmB,EAAE,CAAC;wBACjD,cAAc,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC;wBAChD,cAAc,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;wBAEnC,IAAI,UAAU,IAAI,UAAU,EAAE;4BACtB,aAAa,GAAG,IAAA,0BAAmB,EAAC,UAAU,EAAE,UAAU,CAAC,CAAC;4BAClE,cAAc,CAAC,cAAc,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC;yBAChD;wBAED,aAAa,CAAC,uBAAuB,CAAC,cAAc,CAAC,CAAC;wBAEhD,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC;wBAExB,cAAc,GAAqB,EAAE,CAAC;wBAuBrC,qBAAM,0BAA0B,EAAE,EAAA;4BAAzC,sBAAO,SAAkC,EAAC;;;;KAC3C;IACH,uBAAC;AAAD,CAAC,AA5ED,IA4EC;AAEQ,4CAAgB"}
|
|
@@ -22,8 +22,8 @@ class PortfolioService {
|
|
|
22
22
|
private client: PortfolioClient;
|
|
23
23
|
|
|
24
24
|
constructor() {
|
|
25
|
-
|
|
26
|
-
this.client = new PortfolioClient('localhost:8082', grpc.credentials.createInsecure());
|
|
25
|
+
this.client = new PortfolioClient('api.fintekkers.org:8082', grpc.credentials.createSsl());
|
|
26
|
+
// this.client = new PortfolioClient('localhost:8082', grpc.credentials.createInsecure());
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
async validateCreatePortfolio(portfolio: PortfolioProto): Promise<SummaryProto> {
|
|
@@ -76,15 +76,12 @@ class PortfolioService {
|
|
|
76
76
|
|
|
77
77
|
return new Promise<PortfolioProto[]>((resolve, reject) => {
|
|
78
78
|
stream2.on('data', (response:QueryPortfolioResponseProto) => {
|
|
79
|
-
console.log('Result of the portfolio search call');
|
|
80
|
-
console.log('Response:', response);
|
|
81
79
|
response.getPortfolioResponseList().forEach((portfolio) => {
|
|
82
80
|
listPortfolios.push(portfolio);
|
|
83
81
|
});
|
|
84
82
|
});
|
|
85
83
|
|
|
86
84
|
stream2.on('end', () => {
|
|
87
|
-
console.log('Stream ended.');
|
|
88
85
|
resolve(listPortfolios);
|
|
89
86
|
});
|
|
90
87
|
|
|
@@ -39,12 +39,16 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
39
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
40
|
exports.testPortfolio = void 0;
|
|
41
41
|
// Model Utils
|
|
42
|
-
var field_pb_1 = require("
|
|
43
|
-
var uuid = require("
|
|
44
|
-
var dt = require("
|
|
42
|
+
var field_pb_1 = require("../../../fintekkers/models/position/field_pb");
|
|
43
|
+
var uuid = require("../../models/utils/uuid");
|
|
44
|
+
var dt = require("../../models/utils/datetime");
|
|
45
45
|
//Requests & Services
|
|
46
|
-
var PortfolioService_1 = require("./
|
|
47
|
-
var portfolio_pb_1 = require("
|
|
46
|
+
var PortfolioService_1 = require("./PortfolioService");
|
|
47
|
+
var portfolio_pb_1 = require("../../../fintekkers/models/portfolio/portfolio_pb");
|
|
48
|
+
test('test creating a portfolio against the api.fintekkers.org portfolio service', function () {
|
|
49
|
+
var isTrue = testPortfolio();
|
|
50
|
+
expect(isTrue).resolves.toBe(true);
|
|
51
|
+
}, 30000);
|
|
48
52
|
function testPortfolio() {
|
|
49
53
|
return __awaiter(this, void 0, void 0, function () {
|
|
50
54
|
var id_proto, now, portfolioService, portfolio, validationSummary, createPortfolioResponse, searchResults;
|
|
@@ -63,16 +67,13 @@ function testPortfolio() {
|
|
|
63
67
|
return [4 /*yield*/, portfolioService.validateCreatePortfolio(portfolio)];
|
|
64
68
|
case 1:
|
|
65
69
|
validationSummary = _a.sent();
|
|
66
|
-
console.log(validationSummary);
|
|
67
70
|
return [4 /*yield*/, portfolioService.createPortfolio(portfolio)];
|
|
68
71
|
case 2:
|
|
69
72
|
createPortfolioResponse = _a.sent();
|
|
70
|
-
console.log(createPortfolioResponse);
|
|
71
73
|
return [4 /*yield*/, portfolioService.searchPortfolio(now.to_date_proto(), field_pb_1.FieldProto.PORTFOLIO_NAME, 'Federal Reserve SOMA Holdings')];
|
|
72
74
|
case 3:
|
|
73
75
|
searchResults = _a.sent();
|
|
74
|
-
|
|
75
|
-
return [2 /*return*/];
|
|
76
|
+
return [2 /*return*/, true];
|
|
76
77
|
}
|
|
77
78
|
});
|
|
78
79
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portfolio.test.js","sourceRoot":"","sources":["portfolio.test.ts"],"names":[],"mappings":";AAAA,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAET,cAAc;AACd,yEAA0E;AAC1E,8CAAgD;AAChD,gDAAkD;AAElD,qBAAqB;AACrB,uDAAsD;AACtD,kFAAmF;AAInF,IAAI,CAAC,4EAA4E,EAAE;IACjF,IAAM,MAAM,GAAG,aAAa,EAAE,CAAC;IAC/B,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACrC,CAAC,EAAE,KAAK,CAAC,CAAC;AAEV,SAAsB,aAAa;;;;;;oBAC3B,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,CAAC;oBAC5C,GAAG,GAAG,EAAE,CAAC,aAAa,CAAC,GAAG,EAAE,CAAC;oBAE7B,gBAAgB,GAAG,IAAI,mCAAgB,EAAE,CAAC;oBAE1C,SAAS,GAAG,IAAI,6BAAc,EAAE,CAAC;oBACvC,SAAS,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;oBACtC,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;oBAC9B,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;oBAC5B,SAAS,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;oBAC7C,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC,CAAC;oBAEf,qBAAM,gBAAgB,CAAC,uBAAuB,CAAC,SAAS,CAAC,EAAA;;oBAA7E,iBAAiB,GAAG,SAAyD;oBAEtB,qBAAM,gBAAgB,CAAC,eAAe,CAAC,SAAS,CAAC,EAAA;;oBAAxG,uBAAuB,GAAgC,SAAiD;oBAExF,qBAAM,gBAAgB,CAAC,eAAe,CAAC,GAAG,CAAC,aAAa,EAAE,EAAE,qBAAU,CAAC,cAAc,EAAE,+BAA+B,CAAC,EAAA;;oBAAvI,aAAa,GAAG,SAAuH;oBAE3I,sBAAO,IAAI,EAAC;;;;CACb;AApBD,sCAoBC"}
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
// Models
|
|
2
2
|
|
|
3
3
|
// Model Utils
|
|
4
|
-
import { FieldProto } from '
|
|
5
|
-
import * as uuid from '
|
|
6
|
-
import * as dt from '
|
|
4
|
+
import { FieldProto } from '../../../fintekkers/models/position/field_pb';
|
|
5
|
+
import * as uuid from '../../models/utils/uuid';
|
|
6
|
+
import * as dt from '../../models/utils/datetime';
|
|
7
7
|
|
|
8
8
|
//Requests & Services
|
|
9
|
-
import { PortfolioService } from './
|
|
10
|
-
import { PortfolioProto } from '
|
|
11
|
-
import { CreatePortfolioResponseProto } from '
|
|
9
|
+
import { PortfolioService } from './PortfolioService';
|
|
10
|
+
import { PortfolioProto } from '../../../fintekkers/models/portfolio/portfolio_pb';
|
|
11
|
+
import { CreatePortfolioResponseProto } from '../../../fintekkers/requests/portfolio/create_portfolio_response_pb';
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
|
|
14
|
+
test('test creating a portfolio against the api.fintekkers.org portfolio service', () => {
|
|
15
|
+
const isTrue = testPortfolio();
|
|
16
|
+
expect(isTrue).resolves.toBe(true);
|
|
17
|
+
}, 30000);
|
|
18
|
+
|
|
19
|
+
export async function testPortfolio(): Promise<boolean> {
|
|
14
20
|
const id_proto = uuid.UUID.random().toUUIDProto();
|
|
15
21
|
const now = dt.ZonedDateTime.now();
|
|
16
22
|
|
|
@@ -24,13 +30,11 @@ async function testPortfolio(): Promise<void> {
|
|
|
24
30
|
portfolio.setAsOf(now.to_date_proto());
|
|
25
31
|
|
|
26
32
|
var validationSummary = await portfolioService.validateCreatePortfolio(portfolio);
|
|
27
|
-
console.log(validationSummary);
|
|
28
33
|
|
|
29
34
|
var createPortfolioResponse:CreatePortfolioResponseProto = await portfolioService.createPortfolio(portfolio);
|
|
30
|
-
console.log(createPortfolioResponse);
|
|
31
35
|
|
|
32
36
|
var searchResults = await portfolioService.searchPortfolio(now.to_date_proto(), FieldProto.PORTFOLIO_NAME, 'Federal Reserve SOMA Holdings');
|
|
33
|
-
|
|
37
|
+
|
|
38
|
+
return true;
|
|
34
39
|
}
|
|
35
40
|
|
|
36
|
-
export { testPortfolio };
|
|
@@ -42,8 +42,8 @@ var grpc = require("@grpc/grpc-js");
|
|
|
42
42
|
var position_service_grpc_pb_1 = require("../../../fintekkers/services/position-service/position_service_grpc_pb");
|
|
43
43
|
var PositionService = /** @class */ (function () {
|
|
44
44
|
function PositionService() {
|
|
45
|
-
|
|
46
|
-
this.client = new
|
|
45
|
+
this.client = new position_service_grpc_pb_1.PositionClient('api.fintekkers.org:8082', grpc.credentials.createSsl());
|
|
46
|
+
// this.client = new PositionClient('localhost:8082', grpc.credentials.createInsecure());
|
|
47
47
|
}
|
|
48
48
|
PositionService.prototype.search = function (request) {
|
|
49
49
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -54,14 +54,11 @@ var PositionService = /** @class */ (function () {
|
|
|
54
54
|
stream2 = tmpClient.search(request);
|
|
55
55
|
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
56
56
|
stream2.on('data', function (response) {
|
|
57
|
-
console.log('Result of the position search call');
|
|
58
|
-
console.log('Response:', response);
|
|
59
57
|
response.getPositionsList().forEach(function (position) {
|
|
60
58
|
listPositions.push(position);
|
|
61
59
|
});
|
|
62
60
|
});
|
|
63
61
|
stream2.on('end', function () {
|
|
64
|
-
console.log('Stream ended.');
|
|
65
62
|
resolve(listPositions);
|
|
66
63
|
});
|
|
67
64
|
stream2.on('error', function (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PositionService.js","sourceRoot":"","sources":["PositionService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oCAAsC;AAgBtC,sBAAsB;AACtB,mHAAwG;AAUxG;IAGE;QACE,
|
|
1
|
+
{"version":3,"file":"PositionService.js","sourceRoot":"","sources":["PositionService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oCAAsC;AAgBtC,sBAAsB;AACtB,mHAAwG;AAUxG;IAGE;QACE,IAAI,CAAC,MAAM,GAAG,IAAI,yCAAc,CAAC,yBAAyB,EAAE,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,CAAC,CAAC;QAC1F,yFAAyF;IAC3F,CAAC;IAEK,gCAAM,GAAZ,UAAa,OAAiC;;YAI5C,SAAe,0BAA0B;;;;wBACjC,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;wBAE1C,sBAAO,IAAI,OAAO,CAAkB,UAAC,OAAO,EAAE,MAAM;gCAClD,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,UAAC,QAAmC;oCACrD,QAAQ,CAAC,gBAAgB,EAAE,CAAC,OAAO,CAAC,UAAC,QAAQ;wCAC3C,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;oCAC/B,CAAC,CAAC,CAAC;gCACL,CAAC,CAAC,CAAC;gCAEH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE;oCAChB,OAAO,CAAC,aAAa,CAAC,CAAC;gCACzB,CAAC,CAAC,CAAC;gCAEH,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,UAAC,GAAG;oCACtB,OAAO,CAAC,KAAK,CAAC,sBAAsB,EAAE,GAAG,CAAC,CAAC;oCAC3C,MAAM,CAAC,GAAG,CAAC,CAAC;gCACd,CAAC,CAAC,CAAC;4BACL,CAAC,CAAC,EAAC;;;aACJ;;;;;wBAtBK,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC;wBACxB,aAAa,GAAoB,EAAE,CAAC;wBAuBnC,qBAAM,0BAA0B,EAAE,EAAA;4BAAzC,sBAAO,SAAkC,EAAC;;;;KAC3C;IACH,sBAAC;AAAD,CAAC,AAnCD,IAmCC;AAEQ,0CAAe"}
|
|
@@ -29,8 +29,8 @@ class PositionService {
|
|
|
29
29
|
private client: PositionClient;
|
|
30
30
|
|
|
31
31
|
constructor() {
|
|
32
|
-
|
|
33
|
-
this.client = new PositionClient('localhost:8082', grpc.credentials.createInsecure());
|
|
32
|
+
this.client = new PositionClient('api.fintekkers.org:8082', grpc.credentials.createSsl());
|
|
33
|
+
// this.client = new PositionClient('localhost:8082', grpc.credentials.createInsecure());
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
async search(request:QueryPositionRequestProto) {
|
|
@@ -42,15 +42,12 @@ class PositionService {
|
|
|
42
42
|
|
|
43
43
|
return new Promise<PositionProto[]>((resolve, reject) => {
|
|
44
44
|
stream2.on('data', (response:QueryPositionResponseProto) => {
|
|
45
|
-
console.log('Result of the position search call');
|
|
46
|
-
console.log('Response:', response);
|
|
47
45
|
response.getPositionsList().forEach((position) => {
|
|
48
46
|
listPositions.push(position);
|
|
49
47
|
});
|
|
50
48
|
});
|
|
51
49
|
|
|
52
50
|
stream2.on('end', () => {
|
|
53
|
-
console.log('Stream ended.');
|
|
54
51
|
resolve(listPositions);
|
|
55
52
|
});
|
|
56
53
|
|
|
@@ -37,23 +37,24 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
|
|
40
|
+
var identifier_pb_1 = require("../../../fintekkers/models/security/identifier/identifier_pb");
|
|
41
|
+
var position_pb_1 = require("../../../fintekkers/models/position/position_pb");
|
|
42
|
+
var measure_pb_1 = require("../../../fintekkers/models/position/measure_pb");
|
|
41
43
|
// Model Utils
|
|
42
|
-
var field_pb_1 = require("
|
|
43
|
-
|
|
44
|
-
var
|
|
45
|
-
var
|
|
46
|
-
var
|
|
47
|
-
var position_pb_1 = require("../fintekkers/models/position/position_pb");
|
|
48
|
-
var query_position_request_pb_1 = require("../fintekkers/requests/position/query_position_request_pb");
|
|
49
|
-
var identifier_pb_1 = require("../fintekkers/models/security/identifier/identifier_pb");
|
|
44
|
+
var field_pb_1 = require("../../../fintekkers/models/position/field_pb");
|
|
45
|
+
var position_util_pb_1 = require("../../../fintekkers/models/position/position_util_pb");
|
|
46
|
+
var position_filter_pb_1 = require("../../../fintekkers/models/position/position_filter_pb");
|
|
47
|
+
var datetime_1 = require("../../models/utils/datetime");
|
|
48
|
+
var util_1 = require("../../models/utils/util");
|
|
50
49
|
var any_pb_1 = require("google-protobuf/google/protobuf/any_pb");
|
|
51
|
-
|
|
52
|
-
var
|
|
53
|
-
var
|
|
54
|
-
var
|
|
55
|
-
|
|
56
|
-
|
|
50
|
+
//Requests & Services
|
|
51
|
+
var PortfolioService_1 = require("../../services/portfolio-service/PortfolioService");
|
|
52
|
+
var PositionService_1 = require("../../services/position-service/PositionService");
|
|
53
|
+
var query_position_request_pb_1 = require("../../../fintekkers/requests/position/query_position_request_pb");
|
|
54
|
+
test('test getting a position against the api.fintekkers.org position service', function () {
|
|
55
|
+
var isTrue = testPosition();
|
|
56
|
+
expect(isTrue).resolves.toBe(true);
|
|
57
|
+
}, 30000);
|
|
57
58
|
function get_position(security, portfolio, measures, position_type, fields, additional_filters, as_of) {
|
|
58
59
|
if (fields === void 0) { fields = [field_pb_1.FieldProto.PORTFOLIO, field_pb_1.FieldProto.SECURITY]; }
|
|
59
60
|
if (additional_filters === void 0) { additional_filters = []; }
|
|
@@ -118,13 +119,9 @@ function testPosition() {
|
|
|
118
119
|
return [4 /*yield*/, get_position(null, fedReservePortfolio, [measure_pb_1.MeasureProto.DIRECTED_QUANTITY], position_pb_1.PositionTypeProto.TRANSACTION, [field_pb_1.FieldProto.PORTFOLIO_NAME, field_pb_1.FieldProto.SECURITY_ID], [], now)];
|
|
119
120
|
case 2:
|
|
120
121
|
positions = _a.sent();
|
|
121
|
-
|
|
122
|
-
positions[0].getMeasuresList().forEach(function (measure) { console.log(measure); });
|
|
123
|
-
console.log(positions);
|
|
124
|
-
return [2 /*return*/];
|
|
122
|
+
return [2 /*return*/, true];
|
|
125
123
|
}
|
|
126
124
|
});
|
|
127
125
|
});
|
|
128
126
|
}
|
|
129
|
-
exports.testPosition = testPosition;
|
|
130
127
|
//# sourceMappingURL=position.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"position.test.js","sourceRoot":"","sources":["position.test.ts"],"names":[],"mappings":";AAAA,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAET,8FAA+F;AAC/F,+EAAuG;AAEvG,6EAA8E;AAG9E,cAAc;AACd,yEAA0E;AAC1E,yFAAqF;AACrF,6FAA6F;AAC7F,wDAA4D;AAE5D,gDAA4D;AAC5D,iEAA6D;AAE7D,qBAAqB;AACrB,sFAAqF;AACrF,mFAAkF;AAClF,6GAA4G;AAE5G,IAAI,CAAC,yEAAyE,EAAE;IAC9E,IAAM,MAAM,GAAG,YAAY,EAAE,CAAC;IAC9B,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACrC,CAAC,EAAE,KAAK,CAAC,CAAC;AAEV,SAAe,YAAY,CAAC,QAAsB,EACtC,SAAwB,EACxB,QAAuB,EACvB,aAA+B,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U,CAAC,cAAc,EAAE,qBAAU,CAAC,WAAW,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC,EAAA;;oBAH3D,SAAS,GAAG,SAG+C;oBAE/D,sBAAO,IAAI,EAAC;;;;CACb"}
|
|
@@ -1,32 +1,29 @@
|
|
|
1
1
|
// Models
|
|
2
2
|
|
|
3
|
+
import { IdentifierProto } from '../../../fintekkers/models/security/identifier/identifier_pb';
|
|
4
|
+
import { PositionTypeProto, PositionViewProto } from '../../../fintekkers/models/position/position_pb';
|
|
5
|
+
import { SecurityProto } from '../../../fintekkers/models/security/security_pb';
|
|
6
|
+
import { MeasureProto } from '../../../fintekkers/models/position/measure_pb';
|
|
7
|
+
import { PortfolioProto } from '../../../fintekkers/models/portfolio/portfolio_pb';
|
|
8
|
+
|
|
3
9
|
// Model Utils
|
|
4
|
-
import { FieldProto } from '
|
|
5
|
-
import
|
|
6
|
-
import
|
|
10
|
+
import { FieldProto } from '../../../fintekkers/models/position/field_pb';
|
|
11
|
+
import { FieldMapEntry } from '../../../fintekkers/models/position/position_util_pb';
|
|
12
|
+
import { PositionFilterProto } from '../../../fintekkers/models/position/position_filter_pb';
|
|
13
|
+
import { ZonedDateTime } from '../../models/utils/datetime';
|
|
7
14
|
|
|
8
|
-
|
|
9
|
-
import { PortfolioService } from './services/portfolio-service/PortfolioService';
|
|
10
|
-
import { PortfolioProto } from '../fintekkers/models/portfolio/portfolio_pb';
|
|
11
|
-
import { QueryPortfolioRequestProto } from '../fintekkers/requests/portfolio/query_portfolio_request_pb';
|
|
12
|
-
|
|
13
|
-
import { packStringIntoAny } from './models/utils/util';
|
|
14
|
-
import { PositionService } from './services/position-service/PositionService';
|
|
15
|
-
import { PositionProto, PositionTypeProto, PositionViewProto } from '../fintekkers/models/position/position_pb';
|
|
16
|
-
import { QueryPositionRequestProto } from '../fintekkers/requests/position/query_position_request_pb';
|
|
17
|
-
import { CreatePortfolioResponseProto } from '../fintekkers/requests/portfolio/create_portfolio_response_pb';
|
|
18
|
-
import { IdentifierProto } from '../fintekkers/models/security/identifier/identifier_pb';
|
|
15
|
+
import { packStringIntoAny } from '../../models/utils/util';
|
|
19
16
|
import { Any } from 'google-protobuf/google/protobuf/any_pb';
|
|
20
|
-
import { FieldMapEntry } from '../fintekkers/models/position/position_util_pb';
|
|
21
|
-
import { PositionFilterProto } from '../fintekkers/models/position/position_filter_pb';
|
|
22
|
-
import { ZonedDateTime } from './models/utils/datetime';
|
|
23
|
-
import { SecurityProto } from '../fintekkers/models/security/security_pb';
|
|
24
|
-
import { MeasureProto } from '../fintekkers/models/position/measure_pb';
|
|
25
|
-
import { SecurityService } from './services/security-service/SecurityService';
|
|
26
17
|
|
|
27
|
-
//
|
|
18
|
+
//Requests & Services
|
|
19
|
+
import { PortfolioService } from '../../services/portfolio-service/PortfolioService';
|
|
20
|
+
import { PositionService } from '../../services/position-service/PositionService';
|
|
21
|
+
import { QueryPositionRequestProto } from '../../../fintekkers/requests/position/query_position_request_pb';
|
|
28
22
|
|
|
29
|
-
|
|
23
|
+
test('test getting a position against the api.fintekkers.org position service', () => {
|
|
24
|
+
const isTrue = testPosition();
|
|
25
|
+
expect(isTrue).resolves.toBe(true);
|
|
26
|
+
}, 30000);
|
|
30
27
|
|
|
31
28
|
async function get_position(security:SecurityProto,
|
|
32
29
|
portfolio:PortfolioProto,
|
|
@@ -83,7 +80,7 @@ async function get_position(security:SecurityProto,
|
|
|
83
80
|
return positions;
|
|
84
81
|
}
|
|
85
82
|
|
|
86
|
-
async function testPosition(): Promise<
|
|
83
|
+
async function testPosition(): Promise<boolean> {
|
|
87
84
|
//Get the Federal Reserve portfolio
|
|
88
85
|
const now = ZonedDateTime.now();
|
|
89
86
|
|
|
@@ -100,10 +97,6 @@ async function testPosition(): Promise<void> {
|
|
|
100
97
|
PositionTypeProto.TRANSACTION,
|
|
101
98
|
[FieldProto.PORTFOLIO_NAME, FieldProto.SECURITY_ID], [], now);
|
|
102
99
|
|
|
103
|
-
|
|
104
|
-
positions[0].getFieldsList().forEach((field) => { console.log(field); });
|
|
105
|
-
positions[0].getMeasuresList().forEach((measure) => { console.log(measure); });
|
|
106
|
-
console.log(positions);
|
|
100
|
+
return true;
|
|
107
101
|
}
|
|
108
102
|
|
|
109
|
-
export { testPosition };
|
|
@@ -49,8 +49,8 @@ var create_security_request_pb_1 = require("../../../fintekkers/requests/securit
|
|
|
49
49
|
var security_1 = require("../../models/security/security");
|
|
50
50
|
var SecurityService = /** @class */ (function () {
|
|
51
51
|
function SecurityService() {
|
|
52
|
-
|
|
53
|
-
this.client = new
|
|
52
|
+
this.client = new security_service_grpc_pb_1.SecurityClient('api.fintekkers.org:8082', grpc.credentials.createSsl());
|
|
53
|
+
// this.client = new SecurityClient('localhost:8082', grpc.credentials.createInsecure());
|
|
54
54
|
}
|
|
55
55
|
SecurityService.prototype.validateCreateSecurity = function (security) {
|
|
56
56
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -99,14 +99,11 @@ var SecurityService = /** @class */ (function () {
|
|
|
99
99
|
stream2 = tmpClient.search(searchRequest);
|
|
100
100
|
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
101
101
|
stream2.on('data', function (response) {
|
|
102
|
-
console.log('Result of the security search call');
|
|
103
|
-
console.log('Response:', response);
|
|
104
102
|
response.getSecurityResponseList().forEach(function (security) {
|
|
105
103
|
listSecurities.push(new security_1.default(security));
|
|
106
104
|
});
|
|
107
105
|
});
|
|
108
106
|
stream2.on('end', function () {
|
|
109
|
-
console.log('Stream ended.');
|
|
110
107
|
resolve(listSecurities);
|
|
111
108
|
});
|
|
112
109
|
stream2.on('error', function (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SecurityService.js","sourceRoot":"","sources":["SecurityService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oCAAsC;AACtC,6BAAiC;AAIjC,gDAA8D;AAI9D,cAAc;AACd,6FAA6F;AAG7F,sBAAsB;AAC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IAAI,wCAAmB,EAAE,CAAC;wBACjD,cAAc,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC;wBAChD,cAAc,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;wBAE7B,aAAa,GAAG,IAAA,0BAAmB,EAAC,UAAU,EAAE,UAAU,CAAC,CAAC;wBAClE,cAAc,CAAC,cAAc,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC;wBAE/C,aAAa,CAAC,sBAAsB,CAAC,cAAc,CAAC,CAAC;wBAE/C,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC;wBAExB,cAAc,GAAe,EAAE,CAAC;wBAuB/B,qBAAM,0BAA0B,EAAE,EAAA;4BAAzC,sBAAO,SAAkC,EAAC;;;;KAC3C;IACH,sBAAC;AAAD,CAAC,AAxED,IAwEC;AAEQ,0CAAe"}
|
|
@@ -23,8 +23,8 @@ class SecurityService {
|
|
|
23
23
|
private client: SecurityClient;
|
|
24
24
|
|
|
25
25
|
constructor() {
|
|
26
|
-
|
|
27
|
-
this.client = new SecurityClient('localhost:8082', grpc.credentials.createInsecure());
|
|
26
|
+
this.client = new SecurityClient('api.fintekkers.org:8082', grpc.credentials.createSsl());
|
|
27
|
+
// this.client = new SecurityClient('localhost:8082', grpc.credentials.createInsecure());
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
async validateCreateSecurity(security: SecurityProto): Promise<SummaryProto> {
|
|
@@ -73,15 +73,12 @@ class SecurityService {
|
|
|
73
73
|
|
|
74
74
|
return new Promise<Security[]>((resolve, reject) => {
|
|
75
75
|
stream2.on('data', (response:QuerySecurityResponseProto) => {
|
|
76
|
-
console.log('Result of the security search call');
|
|
77
|
-
console.log('Response:', response);
|
|
78
76
|
response.getSecurityResponseList().forEach((security) => {
|
|
79
77
|
listSecurities.push(new Security(security));
|
|
80
78
|
});
|
|
81
79
|
});
|
|
82
80
|
|
|
83
81
|
stream2.on('end', () => {
|
|
84
|
-
console.log('Stream ended.');
|
|
85
82
|
resolve(listSecurities);
|
|
86
83
|
});
|
|
87
84
|
|