@fintekkers/ledger-models 0.1.71 → 0.1.73

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.
Files changed (46) hide show
  1. package/.env +1 -1
  2. package/node/wrappers/models/position/field.js +27 -0
  3. package/node/wrappers/models/position/field.js.map +1 -0
  4. package/node/wrappers/models/position/field.test.js +63 -0
  5. package/node/wrappers/models/position/field.test.js.map +1 -0
  6. package/node/wrappers/models/position/field.test.ts +13 -0
  7. package/node/wrappers/models/position/field.ts +25 -0
  8. package/node/wrappers/models/position/hardcoded.position.js +10 -4
  9. package/node/wrappers/models/position/hardcoded.position.js.map +1 -1
  10. package/node/wrappers/models/position/hardcoded.position.ts +12 -79
  11. package/node/wrappers/models/position/position.js +16 -14
  12. package/node/wrappers/models/position/position.js.map +1 -1
  13. package/node/wrappers/models/position/position.test copy.js +107 -0
  14. package/node/wrappers/models/position/position.test copy.js.map +1 -0
  15. package/node/wrappers/models/position/position.test.js +40 -44
  16. package/node/wrappers/models/position/position.test.js.map +1 -1
  17. package/node/wrappers/models/position/position.test.ts +34 -66
  18. package/node/wrappers/models/position/position.ts +17 -18
  19. package/node/wrappers/models/utils/date.js +4 -1
  20. package/node/wrappers/models/utils/date.js.map +1 -1
  21. package/node/wrappers/models/utils/date.ts +5 -1
  22. package/node/wrappers/models/utils/protoEnum.js +50 -0
  23. package/node/wrappers/models/utils/protoEnum.js.map +1 -0
  24. package/node/wrappers/models/utils/protoEnum.test.js +21 -0
  25. package/node/wrappers/models/utils/protoEnum.test.js.map +1 -0
  26. package/node/wrappers/models/utils/protoEnum.test.ts +23 -0
  27. package/node/wrappers/models/utils/protoEnum.ts +54 -0
  28. package/node/wrappers/models/utils/serialization.js +7 -0
  29. package/node/wrappers/models/utils/serialization.js.map +1 -1
  30. package/node/wrappers/models/utils/serialization.ts +7 -0
  31. package/node/wrappers/services/portfolio-service/portfolio.test.js +0 -1
  32. package/node/wrappers/services/portfolio-service/portfolio.test.js.map +1 -1
  33. package/node/wrappers/services/portfolio-service/portfolio.test.ts +0 -1
  34. package/node/wrappers/services/position-service/PositionService.js +2 -2
  35. package/node/wrappers/services/position-service/PositionService.js.map +1 -1
  36. package/node/wrappers/services/position-service/PositionService.ts +1 -1
  37. package/node/wrappers/services/position-service/position.test.js +18 -63
  38. package/node/wrappers/services/position-service/position.test.js.map +1 -1
  39. package/node/wrappers/services/position-service/position.test.ts +8 -73
  40. package/node/wrappers/services/security-service/security.maturityLadder.test.js +0 -1
  41. package/node/wrappers/services/security-service/security.maturityLadder.test.js.map +1 -1
  42. package/node/wrappers/services/security-service/security.maturityLadder.test.ts +0 -2
  43. package/node/wrappers/services/transaction-service/transaction.search.test.js +0 -1
  44. package/node/wrappers/services/transaction-service/transaction.search.test.js.map +1 -1
  45. package/node/wrappers/services/transaction-service/transaction.search.test.ts +0 -2
  46. package/package.json +2 -2
@@ -33,5 +33,4 @@ test('test creating a portfolio against the api.fintekkers.org portfolio service
33
33
 
34
34
  var searchResults = await portfolioService.searchPortfolio(now.toProto(), new PositionFilter().addEqualsFilter(FieldProto.PORTFOLIO_NAME, 'Federal Reserve SOMA Holdings'));
35
35
  expect(searchResults.length > 0).toBe(true);
36
- console.log(searchResults[0].getPortfolioName());
37
36
  }, 30000);
@@ -38,7 +38,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.PositionService = void 0;
40
40
  // Models
41
- var hardcoded_position_1 = require("../../models/position/hardcoded.position");
41
+ var position_1 = require("../../models/position/position");
42
42
  // Requests & Services
43
43
  var position_service_grpc_pb_1 = require("../../../fintekkers/services/position-service/position_service_grpc_pb");
44
44
  //Utils
@@ -57,7 +57,7 @@ var PositionService = /** @class */ (function () {
57
57
  return [2 /*return*/, new Promise(function (resolve, reject) {
58
58
  stream2.on('data', function (response) {
59
59
  response.getPositionsList().forEach(function (position) {
60
- listPositions.push(new hardcoded_position_1.Position(position));
60
+ listPositions.push(new position_1.Position(position));
61
61
  });
62
62
  });
63
63
  stream2.on('end', function () {
@@ -1 +1 @@
1
- {"version":3,"file":"PositionService.js","sourceRoot":"","sources":["PositionService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS;AACT,+EAAoE;AAMpE,sBAAsB;AACtB,mHAAwG;AAExG,OAAO;AACP,oEAA0D;AAE1D;IAGE;QACE,IAAI,CAAC,MAAM,GAAG,IAAI,yCAAc,CAAC,wBAAS,CAAC,MAAM,EAAE,wBAAS,CAAC,cAAc,CAAC,CAAC;IAC/E,CAAC;IAEK,gCAAM,GAAZ,UAAa,OAAkC;;YAI7C,SAAe,0BAA0B;;;;wBACjC,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;wBAE1C,sBAAO,IAAI,OAAO,CAAa,UAAC,OAAO,EAAE,MAAM;gCAC7C,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,UAAC,QAAoC;oCACtD,QAAQ,CAAC,gBAAgB,EAAE,CAAC,OAAO,CAAC,UAAC,QAAQ;wCAC3C,aAAa,CAAC,IAAI,CAAC,IAAI,6BAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;oCAC7C,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,GAAe,EAAE,CAAC;wBAuB9B,q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,MAAM,CAAC;wBACxB,aAAa,GAAe,EAAE,CAAC;wBAuB9B,qBAAM,0BAA0B,EAAE,EAAA;4BAAzC,sBAAO,SAAkC,EAAC;;;;KAC3C;IACH,sBAAC;AAAD,CAAC,AAlCD,IAkCC;AAEQ,0CAAe"}
@@ -1,5 +1,5 @@
1
1
  // Models
2
- import { Position } from '../../models/position/hardcoded.position';
2
+ import { Position } from '../../models/position/position';
3
3
 
4
4
  // Requests
5
5
  import { QueryPositionRequestProto } from '../../../fintekkers/requests/position/query_position_request_pb';
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- // Models
3
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -37,76 +36,30 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
36
  }
38
37
  };
39
38
  Object.defineProperty(exports, "__esModule", { value: true });
40
- var identifier_pb_1 = require("../../../fintekkers/models/security/identifier/identifier_pb");
39
+ // Models
41
40
  var position_pb_1 = require("../../../fintekkers/models/position/position_pb");
42
41
  var measure_pb_1 = require("../../../fintekkers/models/position/measure_pb");
43
- var position_filter_pb_1 = require("../../../fintekkers/models/position/position_filter_pb");
44
42
  // Model Utils
45
43
  var field_pb_1 = require("../../../fintekkers/models/position/field_pb");
46
- var position_util_pb_1 = require("../../../fintekkers/models/position/position_util_pb");
47
44
  var datetime_1 = require("../../models/utils/datetime");
48
- var serialization_util_1 = require("../../models/utils/serialization.util");
49
- var any_pb_1 = require("google-protobuf/google/protobuf/any_pb");
50
45
  //Requests & Services
51
46
  var PositionService_1 = require("../../services/position-service/PositionService");
52
47
  var query_position_request_pb_1 = require("../../../fintekkers/requests/position/query_position_request_pb");
53
48
  test('test getting a position against the api.fintekkers.org position service', function () { return __awaiter(void 0, void 0, void 0, function () {
49
+ var isTrue;
54
50
  return __generator(this, function (_a) {
55
- return [2 /*return*/];
51
+ switch (_a.label) {
52
+ case 0: return [4 /*yield*/, testPosition()];
53
+ case 1:
54
+ isTrue = _a.sent();
55
+ expect(isTrue).toBe(true);
56
+ return [2 /*return*/];
57
+ }
56
58
  });
57
59
  }); }, 30000);
58
- function get_position(security, portfolio, measures, position_type, fields, additional_filters, as_of) {
59
- if (fields === void 0) { fields = [field_pb_1.FieldProto.PORTFOLIO, field_pb_1.FieldProto.SECURITY]; }
60
- if (additional_filters === void 0) { additional_filters = []; }
61
- if (as_of === void 0) { as_of = datetime_1.ZonedDateTime.now(); }
62
- return __awaiter(this, void 0, void 0, function () {
63
- var filters, id_proto, security_id_packed, fieldMapEntry, fieldMapEntry, filter_fields, as_of_proto, request, position_service, positions;
64
- return __generator(this, function (_a) {
65
- switch (_a.label) {
66
- case 0:
67
- filters = [];
68
- if (security !== null && security !== undefined) {
69
- id_proto = new identifier_pb_1.IdentifierProto();
70
- id_proto.setIdentifierValue(security.getIdentifier().getIdentifierValue());
71
- id_proto.setIdentifierType(security.getIdentifier().getIdentifierType());
72
- security_id_packed = new any_pb_1.Any();
73
- security_id_packed.pack(id_proto);
74
- fieldMapEntry = new position_util_pb_1.FieldMapEntry();
75
- fieldMapEntry.setField(field_pb_1.FieldProto.IDENTIFIER);
76
- fieldMapEntry.setFieldValuePacked(security_id_packed);
77
- filters.push(fieldMapEntry);
78
- }
79
- if (portfolio !== null && portfolio !== undefined) {
80
- fieldMapEntry = new position_util_pb_1.FieldMapEntry();
81
- fieldMapEntry.setField(field_pb_1.FieldProto.PORTFOLIO_NAME);
82
- fieldMapEntry.setFieldValuePacked((0, serialization_util_1.pack)(portfolio.getPortfolioName()));
83
- filters.push(fieldMapEntry);
84
- }
85
- if (additional_filters !== null && additional_filters.length > 0) {
86
- filters.push.apply(filters, additional_filters);
87
- }
88
- filter_fields = new position_filter_pb_1.PositionFilterProto();
89
- filter_fields.setFiltersList(filters);
90
- as_of_proto = as_of.toProto();
91
- request = new query_position_request_pb_1.QueryPositionRequestProto();
92
- request.setPositionType(position_type);
93
- request.setPositionView(position_pb_1.PositionViewProto.DEFAULT_VIEW);
94
- request.setFieldsList(fields);
95
- request.setMeasuresList(measures);
96
- request.setFilterFields(filter_fields);
97
- request.setAsOf(as_of_proto);
98
- position_service = new PositionService_1.PositionService();
99
- return [4 /*yield*/, position_service.search(request)];
100
- case 1:
101
- positions = _a.sent();
102
- return [2 /*return*/, positions];
103
- }
104
- });
105
- });
106
- }
107
60
  function testPosition() {
108
61
  return __awaiter(this, void 0, void 0, function () {
109
- var fields, measures, request, positions, position;
62
+ var fields, measures, request, positions, position_1;
110
63
  return __generator(this, function (_a) {
111
64
  switch (_a.label) {
112
65
  case 0:
@@ -121,16 +74,18 @@ function testPosition() {
121
74
  return [4 /*yield*/, new PositionService_1.PositionService().search(request)];
122
75
  case 1:
123
76
  positions = _a.sent();
124
- if (positions) {
77
+ if (positions && positions.length > 0) {
125
78
  console.log(positions.length + " positions returned");
126
- position = positions[0];
127
- console.log(position.getFieldValue(field_pb_1.FieldProto.SECURITY_ID));
128
- position.toString();
79
+ position_1 = positions[0];
80
+ fields.forEach(function (field) {
81
+ position_1.getFieldValue(field);
82
+ });
83
+ return [2 /*return*/, true];
129
84
  }
130
85
  else {
131
- console.log("No positions found");
86
+ return [2 /*return*/, false];
132
87
  }
133
- return [2 /*return*/, true];
88
+ return [2 /*return*/];
134
89
  }
135
90
  });
136
91
  });
@@ -1 +1 @@
1
- {"version":3,"file":"position.test.js","sourceRoot":"","sources":["position.test.ts"],"names":[],"mappings":";AAAA,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIT,8FAA+F;AAC/F,+EAAuG;AAEvG,6EAA8E;AAE9E,6FAA6F;AAE7F,cAAc;AACd,yEAA0E;AAC1E,yFAAqF;AACrF,wDAA4D;AAC5D,4EAA6D;AAC7D,iEAA6D;AAE7D,qBAAqB;AACrB,mFAAkF;AAClF,6GAA4G;AAE5G,IAAI,CAAC,yEAAyE,EAA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E,qBAAU,CAAC,UAAU,EAAE,qBAAU,CAAC,YAAY,EAAE,qBAAU,CAAC,SAAS,EAAE,qBAAU,CAAC,YAAY,CAAC,CAAC;oBACjI,QAAQ,GAAG,CAAC,yBAAY,CAAC,iBAAiB,CAAC,CAAC;oBAE5C,OAAO,GAAG,IAAI,qDAAyB,EAAE;yBAC1C,OAAO,CAAC,wBAAa,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;yBACtC,aAAa,CAAC,MAAM,CAAC;yBACrB,eAAe,CAAC,QAAQ,CAAC;yBACzB,eAAe,CAAC,+BAAiB,CAAC,WAAW,CAAC;yBAC9C,eAAe,CAAC,+BAAiB,CAAC,YAAY,CAAC,CAAC;oBAEnC,qBAAM,IAAI,iCAAe,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,EAAA;;oBAAvD,SAAS,GAAG,SAA2C;oBAE3D,IAAI,SAAS,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;wBACtC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,GAAG,qBAAqB,CAAC,CAAA;wBAEjD,aAAW,SAAS,CAAC,CAAC,CAAC,CAAC;wBAE5B,MAAM,CAAC,OAAO,CAAC,UAAA,KAAK;4BAClB,UAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;wBAChC,CAAC,CAAC,CAAA;wBACF,sBAAO,IAAI,EAAA;oBACb,CAAC;yBAAM,CAAC;wBACN,sBAAO,KAAK,EAAC;oBACf,CAAC;;;;;CACF"}
@@ -1,88 +1,22 @@
1
1
  // Models
2
-
3
- import { PositionFilter } from '../../models/position/positionfilter';
4
- import { Position } from '../../models/position/hardcoded.position';
5
- import { IdentifierProto } from '../../../fintekkers/models/security/identifier/identifier_pb';
6
2
  import { PositionTypeProto, PositionViewProto } from '../../../fintekkers/models/position/position_pb';
7
- import { SecurityProto } from '../../../fintekkers/models/security/security_pb';
8
3
  import { MeasureProto } from '../../../fintekkers/models/position/measure_pb';
9
- import { PortfolioProto } from '../../../fintekkers/models/portfolio/portfolio_pb';
10
- import { PositionFilterProto } from '../../../fintekkers/models/position/position_filter_pb';
11
4
 
12
5
  // Model Utils
13
6
  import { FieldProto } from '../../../fintekkers/models/position/field_pb';
14
- import { FieldMapEntry } from '../../../fintekkers/models/position/position_util_pb';
15
7
  import { ZonedDateTime } from '../../models/utils/datetime';
16
- import { pack } from '../../models/utils/serialization.util';
17
- import { Any } from 'google-protobuf/google/protobuf/any_pb';
18
8
 
19
9
  //Requests & Services
20
10
  import { PositionService } from '../../services/position-service/PositionService';
21
11
  import { QueryPositionRequestProto } from '../../../fintekkers/requests/position/query_position_request_pb';
22
12
 
23
13
  test('test getting a position against the api.fintekkers.org position service', async () => {
24
- // const isTrue = await testPosition();
25
- // expect(isTrue).toBe(true);
14
+ const isTrue = await testPosition();
15
+ expect(isTrue).toBe(true);
26
16
  }, 30000);
27
17
 
28
- async function get_position(security: SecurityProto,
29
- portfolio: PortfolioProto,
30
- measures: MeasureProto[],
31
- position_type: PositionTypeProto,
32
- fields = [FieldProto.PORTFOLIO, FieldProto.SECURITY],
33
- additional_filters = [], as_of = ZonedDateTime.now()) {
34
- const filters = [];
35
-
36
- if (security !== null && security !== undefined) {
37
- const id_proto = new IdentifierProto();
38
- id_proto.setIdentifierValue(security.getIdentifier().getIdentifierValue());
39
- id_proto.setIdentifierType(security.getIdentifier().getIdentifierType());
40
-
41
- const security_id_packed = new Any();
42
- security_id_packed.pack(id_proto);
43
-
44
- const fieldMapEntry = new FieldMapEntry();
45
- fieldMapEntry.setField(FieldProto.IDENTIFIER);
46
- fieldMapEntry.setFieldValuePacked(security_id_packed);
47
-
48
- filters.push(fieldMapEntry);
49
- }
50
-
51
- if (portfolio !== null && portfolio !== undefined) {
52
- const fieldMapEntry = new FieldMapEntry();
53
- fieldMapEntry.setField(FieldProto.PORTFOLIO_NAME);
54
- fieldMapEntry.setFieldValuePacked(pack(portfolio.getPortfolioName()));
55
-
56
- filters.push(fieldMapEntry);
57
- }
58
-
59
- if (additional_filters !== null && additional_filters.length > 0) {
60
- filters.push(...additional_filters);
61
- }
62
-
63
- const filter_fields = new PositionFilterProto();
64
- filter_fields.setFiltersList(filters);
65
-
66
- const as_of_proto = as_of.toProto();
67
-
68
- const request = new QueryPositionRequestProto();
69
- request.setPositionType(position_type);
70
- request.setPositionView(PositionViewProto.DEFAULT_VIEW);
71
- request.setFieldsList(fields);
72
- request.setMeasuresList(measures);
73
- request.setFilterFields(filter_fields);
74
- request.setAsOf(as_of_proto);
75
-
76
- let position_service = new PositionService();
77
-
78
- const positions: Position[] = await position_service.search(request);
79
-
80
- return positions;
81
- }
82
-
83
18
  async function testPosition(): Promise<boolean> {
84
19
  //Get the Federal Reserve portfolio
85
-
86
20
  let fields = [FieldProto.SECURITY_ID, FieldProto.TRADE_DATE, FieldProto.PRODUCT_TYPE, FieldProto.PORTFOLIO, FieldProto.PRODUCT_TYPE];
87
21
  let measures = [MeasureProto.DIRECTED_QUANTITY];
88
22
 
@@ -95,16 +29,17 @@ async function testPosition(): Promise<boolean> {
95
29
 
96
30
  let positions = await new PositionService().search(request);
97
31
 
98
- if (positions) {
32
+ if (positions && positions.length > 0) {
99
33
  console.log(positions.length + " positions returned")
100
34
 
101
35
  let position = positions[0];
102
36
 
103
- console.log(position.getFieldValue(FieldProto.SECURITY_ID));
104
- position.toString();
37
+ fields.forEach(field => {
38
+ position.getFieldValue(field);
39
+ })
40
+ return true
105
41
  } else {
106
- console.log("No positions found");
42
+ return false;
107
43
  }
108
- return true;
109
44
  }
110
45
 
@@ -83,7 +83,6 @@ test('test the api.fintekkers.org security service by creating a maturity ladder
83
83
  }
84
84
  }
85
85
  expect(results[0]['outstandingAmount']).toBeGreaterThan(0);
86
- console.log(results);
87
86
  return [2 /*return*/];
88
87
  }
89
88
  });
@@ -1 +1 @@
1
- {"version":3,"file":"security.maturityLadder.test.js","sourceRoot":"","sources":["security.maturityLadder.test.ts"],"names":[],"mappings":";;;;;;;;;;;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C,kBAAkB,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,CAAC;4BAEpH,MAAM,GAAG;gCACT,OAAO,EAAE,EAAE;gCACX,WAAW,EAAE,QAAQ,CAAC,YAAY,EAAE;gCACpC,mBAAmB,EAAE,mBAAmB;gCACxC,cAAc,EAAE,QAAQ,CAAC,eAAe,EAAE;6BAC7C,CAAC;4BACF,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;wBACzB,CAAC;oBACL,CAAC;gBACL,CAAC;gBAED,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;;;;KAC9D,EAAE,KAAK,CAAC,CAAC"}
@@ -6,7 +6,6 @@ import assert = require('assert');
6
6
  import { FieldProto } from '../../../fintekkers/models/position/field_pb';
7
7
  import { SecurityService } from './SecurityService';
8
8
  import { PositionFilter } from '../../models/position/positionfilter';
9
- import { PositionFilterOperator } from '../../../fintekkers/models/position/position_util_pb';
10
9
  import Security from '../../models/security/security';
11
10
  import { ProtoSerializationUtil } from '../../models/utils/serialization';
12
11
 
@@ -51,6 +50,5 @@ test('test the api.fintekkers.org security service by creating a maturity ladder
51
50
  }
52
51
 
53
52
  expect(results[0]['outstandingAmount']).toBeGreaterThan(0);
54
- console.log(results);
55
53
  }, 90000);
56
54
 
@@ -72,7 +72,6 @@ function searchListTransactions() {
72
72
  throw Error('No transactions found');
73
73
  }
74
74
  else {
75
- console.log(transactions.length);
76
75
  transaction = transactions[0];
77
76
  //We can get data straight from the transaction
78
77
  transaction.getIssuerName();
@@ -1 +1 @@
1
- {"version":3,"file":"transaction.search.test.js","sourceRoot":"","sources":["transaction.search.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,cAAc;AACd,yEAA0E;AAG1E,gDAAkD;AAOlD,2DAA0D;AAK1D,uEAAsE;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yEAA0E;AAG1E,gDAAkD;AAOlD,2DAA0D;AAK1D,uEAAsE;AAEtE,IAAI,CAAC,2DAA2D,EAAE;;;;oBACjD,qBAAM,sBAAsB,EAAE,EAAA;;gBAAvC,MAAM,GAAG,SAA8B;gBAC7C,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;;;;KAC3B,EAAE,KAAK,CAAC,CAAC;AAEV,SAAe,sBAAsB;;;;;;oBAC7B,GAAG,GAAG,EAAE,CAAC,aAAa,CAAC,GAAG,EAAE,CAAC;oBAC7B,kBAAkB,GAAG,IAAI,uCAAkB,EAAE,CAAC;oBAE9C,cAAc,GAAG,IAAI,+BAAc,EAAE,CAAC;oBAC5C,cAAc,CAAC,eAAe,CAAC,qBAAU,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;oBAGlD,qBAAM,kBAAkB,CAAC,iBAAiB,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,cAAc,CAAC,EAAA;;oBAAxF,YAAY,GAAG,SAAyE;oBAC9F,OAAO,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;oBAErC,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;wBAC/B,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;wBACrC,MAAM,KAAK,CAAC,uBAAuB,CAAC,CAAC;oBACvC,CAAC;yBAAM,CAAC;wBACF,WAAW,GAAgB,YAAY,CAAC,CAAC,CAAC,CAAC;wBAE/C,+CAA+C;wBAC/C,WAAW,CAAC,aAAa,EAAE,CAAC;wBAE5B,6CAA6C;wBAC7C,WAAW,CAAC,WAAW,EAAE,CAAC,aAAa,EAAE,CAAC;oBAC5C,CAAC;oBAED,sBAAO,IAAI,EAAC;;;;CACb"}
@@ -40,8 +40,6 @@ async function searchListTransactions(): Promise<boolean> {
40
40
  console.log('No transactions found');
41
41
  throw Error('No transactions found');
42
42
  } else {
43
- console.log(transactions.length);
44
-
45
43
  let transaction: Transaction = transactions[0];
46
44
 
47
45
  //We can get data straight from the transaction
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fintekkers/ledger-models",
3
3
  "todo": "Replace the version with build script version number",
4
- "version": "0.1.71",
4
+ "version": "0.1.73",
5
5
  "description": "ledger model protos ",
6
6
  "authors": [
7
7
  "David Doherty",
@@ -37,6 +37,6 @@
37
37
  "decimal.js": "^10.4.3",
38
38
  "dotenv": "^16.3.1",
39
39
  "luxon": "^3.3.0",
40
- "uuid": "^9.0.0"
40
+ "uuid": "^9.0.1"
41
41
  }
42
42
  }