@fintekkers/ledger-models 0.1.75 → 0.1.76

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 (25) hide show
  1. package/node/fintekkers/models/util/api/api_key_grpc_pb.js +1 -0
  2. package/node/fintekkers/models/util/api/api_key_pb.d.ts +36 -0
  3. package/node/fintekkers/models/util/api/api_key_pb.js +266 -0
  4. package/node/wrappers/models/position/position.js +15 -0
  5. package/node/wrappers/models/position/position.js.map +1 -1
  6. package/node/wrappers/models/position/position.test.js +48 -7
  7. package/node/wrappers/models/position/position.test.js.map +1 -1
  8. package/node/wrappers/models/position/position.test.ts +54 -6
  9. package/node/wrappers/models/position/position.ts +16 -0
  10. package/node/wrappers/requests/position/QueryPositionRequest.js +44 -0
  11. package/node/wrappers/requests/position/QueryPositionRequest.js.map +1 -0
  12. package/node/wrappers/requests/position/QueryPositionRequest.ts +64 -0
  13. package/node/wrappers/services/portfolio-service/portfolio.test.js +1 -1
  14. package/node/wrappers/services/portfolio-service/portfolio.test.js.map +1 -1
  15. package/node/wrappers/services/portfolio-service/portfolio.test.ts +1 -1
  16. package/node/wrappers/services/position-service/PositionService.js +3 -2
  17. package/node/wrappers/services/position-service/PositionService.js.map +1 -1
  18. package/node/wrappers/services/position-service/PositionService.ts +3 -1
  19. package/node/wrappers/services/position-service/position.test.js +2 -9
  20. package/node/wrappers/services/position-service/position.test.js.map +1 -1
  21. package/node/wrappers/services/position-service/position.test.ts +2 -10
  22. package/package.json +1 -1
  23. package/tsconfig.json +27 -25
  24. package/web/fintekkers/models/util/api/api_key_pb.d.ts +34 -0
  25. package/web/fintekkers/models/util/api/api_key_pb.js +260 -0
@@ -0,0 +1 @@
1
+ // GENERATED CODE -- NO SERVICES IN PROTO
@@ -0,0 +1,36 @@
1
+ // package: fintekkers.models.util.api
2
+ // file: fintekkers/models/util/api/api_key.proto
3
+
4
+ /* tslint:disable */
5
+ /* eslint-disable */
6
+
7
+ import * as jspb from "google-protobuf";
8
+
9
+ export class API_Key extends jspb.Message {
10
+ getObjectClass(): string;
11
+ setObjectClass(value: string): API_Key;
12
+ getVersion(): string;
13
+ setVersion(value: string): API_Key;
14
+ getIdentity(): string;
15
+ setIdentity(value: string): API_Key;
16
+ getKey(): string;
17
+ setKey(value: string): API_Key;
18
+
19
+ serializeBinary(): Uint8Array;
20
+ toObject(includeInstance?: boolean): API_Key.AsObject;
21
+ static toObject(includeInstance: boolean, msg: API_Key): API_Key.AsObject;
22
+ static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
23
+ static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
24
+ static serializeBinaryToWriter(message: API_Key, writer: jspb.BinaryWriter): void;
25
+ static deserializeBinary(bytes: Uint8Array): API_Key;
26
+ static deserializeBinaryFromReader(message: API_Key, reader: jspb.BinaryReader): API_Key;
27
+ }
28
+
29
+ export namespace API_Key {
30
+ export type AsObject = {
31
+ objectClass: string,
32
+ version: string,
33
+ identity: string,
34
+ key: string,
35
+ }
36
+ }
@@ -0,0 +1,266 @@
1
+ // source: fintekkers/models/util/api/api_key.proto
2
+ /**
3
+ * @fileoverview
4
+ * @enhanceable
5
+ * @suppress {missingRequire} reports error on implicit type usages.
6
+ * @suppress {messageConventions} JS Compiler reports an error if a variable or
7
+ * field starts with 'MSG_' and isn't a translatable message.
8
+ * @public
9
+ */
10
+ // GENERATED CODE -- DO NOT EDIT!
11
+ /* eslint-disable */
12
+ // @ts-nocheck
13
+
14
+ var jspb = require('google-protobuf');
15
+ var goog = jspb;
16
+ var global = (function() {
17
+ if (this) { return this; }
18
+ if (typeof window !== 'undefined') { return window; }
19
+ if (typeof global !== 'undefined') { return global; }
20
+ if (typeof self !== 'undefined') { return self; }
21
+ return Function('return this')();
22
+ }.call(null));
23
+
24
+ goog.exportSymbol('proto.fintekkers.models.util.api.API_Key', null, global);
25
+ /**
26
+ * Generated by JsPbCodeGenerator.
27
+ * @param {Array=} opt_data Optional initial data array, typically from a
28
+ * server response, or constructed directly in Javascript. The array is used
29
+ * in place and becomes part of the constructed object. It is not cloned.
30
+ * If no data is provided, the constructed object will be empty, but still
31
+ * valid.
32
+ * @extends {jspb.Message}
33
+ * @constructor
34
+ */
35
+ proto.fintekkers.models.util.api.API_Key = function(opt_data) {
36
+ jspb.Message.initialize(this, opt_data, 0, -1, null, null);
37
+ };
38
+ goog.inherits(proto.fintekkers.models.util.api.API_Key, jspb.Message);
39
+ if (goog.DEBUG && !COMPILED) {
40
+ /**
41
+ * @public
42
+ * @override
43
+ */
44
+ proto.fintekkers.models.util.api.API_Key.displayName = 'proto.fintekkers.models.util.api.API_Key';
45
+ }
46
+
47
+
48
+
49
+ if (jspb.Message.GENERATE_TO_OBJECT) {
50
+ /**
51
+ * Creates an object representation of this proto.
52
+ * Field names that are reserved in JavaScript and will be renamed to pb_name.
53
+ * Optional fields that are not set will be set to undefined.
54
+ * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
55
+ * For the list of reserved names please see:
56
+ * net/proto2/compiler/js/internal/generator.cc#kKeyword.
57
+ * @param {boolean=} opt_includeInstance Deprecated. whether to include the
58
+ * JSPB instance for transitional soy proto support:
59
+ * http://goto/soy-param-migration
60
+ * @return {!Object}
61
+ */
62
+ proto.fintekkers.models.util.api.API_Key.prototype.toObject = function(opt_includeInstance) {
63
+ return proto.fintekkers.models.util.api.API_Key.toObject(opt_includeInstance, this);
64
+ };
65
+
66
+
67
+ /**
68
+ * Static version of the {@see toObject} method.
69
+ * @param {boolean|undefined} includeInstance Deprecated. Whether to include
70
+ * the JSPB instance for transitional soy proto support:
71
+ * http://goto/soy-param-migration
72
+ * @param {!proto.fintekkers.models.util.api.API_Key} msg The msg instance to transform.
73
+ * @return {!Object}
74
+ * @suppress {unusedLocalVariables} f is only used for nested messages
75
+ */
76
+ proto.fintekkers.models.util.api.API_Key.toObject = function(includeInstance, msg) {
77
+ var f, obj = {
78
+ objectClass: jspb.Message.getFieldWithDefault(msg, 1, ""),
79
+ version: jspb.Message.getFieldWithDefault(msg, 2, ""),
80
+ identity: jspb.Message.getFieldWithDefault(msg, 3, ""),
81
+ key: jspb.Message.getFieldWithDefault(msg, 4, "")
82
+ };
83
+
84
+ if (includeInstance) {
85
+ obj.$jspbMessageInstance = msg;
86
+ }
87
+ return obj;
88
+ };
89
+ }
90
+
91
+
92
+ /**
93
+ * Deserializes binary data (in protobuf wire format).
94
+ * @param {jspb.ByteSource} bytes The bytes to deserialize.
95
+ * @return {!proto.fintekkers.models.util.api.API_Key}
96
+ */
97
+ proto.fintekkers.models.util.api.API_Key.deserializeBinary = function(bytes) {
98
+ var reader = new jspb.BinaryReader(bytes);
99
+ var msg = new proto.fintekkers.models.util.api.API_Key;
100
+ return proto.fintekkers.models.util.api.API_Key.deserializeBinaryFromReader(msg, reader);
101
+ };
102
+
103
+
104
+ /**
105
+ * Deserializes binary data (in protobuf wire format) from the
106
+ * given reader into the given message object.
107
+ * @param {!proto.fintekkers.models.util.api.API_Key} msg The message object to deserialize into.
108
+ * @param {!jspb.BinaryReader} reader The BinaryReader to use.
109
+ * @return {!proto.fintekkers.models.util.api.API_Key}
110
+ */
111
+ proto.fintekkers.models.util.api.API_Key.deserializeBinaryFromReader = function(msg, reader) {
112
+ while (reader.nextField()) {
113
+ if (reader.isEndGroup()) {
114
+ break;
115
+ }
116
+ var field = reader.getFieldNumber();
117
+ switch (field) {
118
+ case 1:
119
+ var value = /** @type {string} */ (reader.readString());
120
+ msg.setObjectClass(value);
121
+ break;
122
+ case 2:
123
+ var value = /** @type {string} */ (reader.readString());
124
+ msg.setVersion(value);
125
+ break;
126
+ case 3:
127
+ var value = /** @type {string} */ (reader.readString());
128
+ msg.setIdentity(value);
129
+ break;
130
+ case 4:
131
+ var value = /** @type {string} */ (reader.readString());
132
+ msg.setKey(value);
133
+ break;
134
+ default:
135
+ reader.skipField();
136
+ break;
137
+ }
138
+ }
139
+ return msg;
140
+ };
141
+
142
+
143
+ /**
144
+ * Serializes the message to binary data (in protobuf wire format).
145
+ * @return {!Uint8Array}
146
+ */
147
+ proto.fintekkers.models.util.api.API_Key.prototype.serializeBinary = function() {
148
+ var writer = new jspb.BinaryWriter();
149
+ proto.fintekkers.models.util.api.API_Key.serializeBinaryToWriter(this, writer);
150
+ return writer.getResultBuffer();
151
+ };
152
+
153
+
154
+ /**
155
+ * Serializes the given message to binary data (in protobuf wire
156
+ * format), writing to the given BinaryWriter.
157
+ * @param {!proto.fintekkers.models.util.api.API_Key} message
158
+ * @param {!jspb.BinaryWriter} writer
159
+ * @suppress {unusedLocalVariables} f is only used for nested messages
160
+ */
161
+ proto.fintekkers.models.util.api.API_Key.serializeBinaryToWriter = function(message, writer) {
162
+ var f = undefined;
163
+ f = message.getObjectClass();
164
+ if (f.length > 0) {
165
+ writer.writeString(
166
+ 1,
167
+ f
168
+ );
169
+ }
170
+ f = message.getVersion();
171
+ if (f.length > 0) {
172
+ writer.writeString(
173
+ 2,
174
+ f
175
+ );
176
+ }
177
+ f = message.getIdentity();
178
+ if (f.length > 0) {
179
+ writer.writeString(
180
+ 3,
181
+ f
182
+ );
183
+ }
184
+ f = message.getKey();
185
+ if (f.length > 0) {
186
+ writer.writeString(
187
+ 4,
188
+ f
189
+ );
190
+ }
191
+ };
192
+
193
+
194
+ /**
195
+ * optional string object_class = 1;
196
+ * @return {string}
197
+ */
198
+ proto.fintekkers.models.util.api.API_Key.prototype.getObjectClass = function() {
199
+ return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
200
+ };
201
+
202
+
203
+ /**
204
+ * @param {string} value
205
+ * @return {!proto.fintekkers.models.util.api.API_Key} returns this
206
+ */
207
+ proto.fintekkers.models.util.api.API_Key.prototype.setObjectClass = function(value) {
208
+ return jspb.Message.setProto3StringField(this, 1, value);
209
+ };
210
+
211
+
212
+ /**
213
+ * optional string version = 2;
214
+ * @return {string}
215
+ */
216
+ proto.fintekkers.models.util.api.API_Key.prototype.getVersion = function() {
217
+ return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
218
+ };
219
+
220
+
221
+ /**
222
+ * @param {string} value
223
+ * @return {!proto.fintekkers.models.util.api.API_Key} returns this
224
+ */
225
+ proto.fintekkers.models.util.api.API_Key.prototype.setVersion = function(value) {
226
+ return jspb.Message.setProto3StringField(this, 2, value);
227
+ };
228
+
229
+
230
+ /**
231
+ * optional string identity = 3;
232
+ * @return {string}
233
+ */
234
+ proto.fintekkers.models.util.api.API_Key.prototype.getIdentity = function() {
235
+ return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
236
+ };
237
+
238
+
239
+ /**
240
+ * @param {string} value
241
+ * @return {!proto.fintekkers.models.util.api.API_Key} returns this
242
+ */
243
+ proto.fintekkers.models.util.api.API_Key.prototype.setIdentity = function(value) {
244
+ return jspb.Message.setProto3StringField(this, 3, value);
245
+ };
246
+
247
+
248
+ /**
249
+ * optional string key = 4;
250
+ * @return {string}
251
+ */
252
+ proto.fintekkers.models.util.api.API_Key.prototype.getKey = function() {
253
+ return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, ""));
254
+ };
255
+
256
+
257
+ /**
258
+ * @param {string} value
259
+ * @return {!proto.fintekkers.models.util.api.API_Key} returns this
260
+ */
261
+ proto.fintekkers.models.util.api.API_Key.prototype.setKey = function(value) {
262
+ return jspb.Message.setProto3StringField(this, 4, value);
263
+ };
264
+
265
+
266
+ goog.object.extend(exports, proto.fintekkers.models.util.api);
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Position = void 0;
4
4
  //Models
5
5
  var field_pb_1 = require("../../../fintekkers/models/position/field_pb");
6
+ var position_pb_1 = require("../../../fintekkers/models/position/position_pb");
6
7
  var position_util_pb_1 = require("../../../fintekkers/models/position/position_util_pb");
7
8
  var portfolio_1 = require("../portfolio/portfolio");
8
9
  var security_1 = require("../security/security");
@@ -19,6 +20,20 @@ var Position = /** @class */ (function () {
19
20
  function Position(positionProto) {
20
21
  this.proto = positionProto;
21
22
  }
23
+ /*** */
24
+ Position.prototype.toJSON = function () {
25
+ return {
26
+ proto: this.proto.serializeBinary(), // Serialize Age object to binary buffer
27
+ };
28
+ };
29
+ /**
30
+ * Experimental impelementaiton
31
+ * @param binary An array which is the raw binary of the proto object
32
+ * @returns A Position object with the deserialized binary inside it
33
+ */
34
+ Position.fromJSON = function (json) {
35
+ return new Position(position_pb_1.PositionProto.deserializeBinary(json['proto']));
36
+ };
22
37
  Position.prototype.getFieldValue = function (field) {
23
38
  return this.getField(new position_util_pb_1.FieldMapEntry().setField(field));
24
39
  };
@@ -1 +1 @@
1
- {"version":3,"file":"position.js","sourceRoot":"","sources":["position.ts"],"names":[],"mappings":";;;AAAA,QAAQ;AACR,yEAA0E;AAE1E,yFAAsG;AACtG,oDAA+C;AAC/C,iDAA4C;AAC5C,mEAAoE;AACpE,yFAAyF;AACzF,+EAA+E;AAC/E,8FAA+F;AAC/F,6EAA8E;AAE9E,wDAAgE;AAChE,2EAA0E;AAC1E,gDAA+C;AAC/C,iCAAgC;AAIhC;IAGE,kBAAY,aAA4B;QACtC,IAAI,CAAC,KAAK,GAAG,aAAa,CAAC;IAC7B,CAAC;IAEM,gCAAa,GAApB,UAAqB,KAAiB;QACpC,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,gCAAa,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;IAC5D,CAAC;IAEM,2BAAQ,GAAf,UAAgB,UAAyB;QACvC,KAAuB,UAA0B,EAA1B,KAAA,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,EAA1B,cAA0B,EAA1B,IAA0B,EAAE,CAAC;YAA/C,IAAM,QAAQ,SAAA;YACjB,IAAI,QAAQ,CAAC,QAAQ,EAAE,KAAK,UAAU,CAAC,QAAQ,EAAE,EAAE,CAAC;gBAElD,IAAI,QAAQ,CAAC,cAAc,EAAE,KAAK,SAAS,IAAI,QAAQ,CAAC,cAAc,EAAE,CAAC,MAAM,G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C3F,KAAK,qBAAU,CAAC,gBAAgB,CAAC;YACjC,KAAK,qBAAU,CAAC,eAAe;gBAC7B,mDAAmD;gBACnD,gFAAgF;gBAChF,OAAO,IAAI,CAAC,CAAC,qDAAqD;YACpE,KAAK,qBAAU,CAAC,cAAc,CAAC;YAC/B,KAAK,qBAAU,CAAC,oBAAoB,CAAC;YACrC,KAAK,qBAAU,CAAC,YAAY,CAAC;YAC7B,KAAK,qBAAU,CAAC,WAAW;gBACzB,OAAO,yBAAW,CAAC,iBAAiB,CAAC,aAAa,CAAC,mBAAmB,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;YACvF,KAAK,qBAAU,CAAC,SAAS;gBACvB,OAAO,aAAa,CAAC,mBAAmB,EAAE,CAAC;YAC7C,KAAK,qBAAU,CAAC,QAAQ;gBACtB,OAAO,aAAa,CAAC,mBAAmB,EAAE,CAAC;YAC7C;gBACE,MAAM,IAAI,KAAK,CAAC,4CAAqC,qBAAU,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC,CAAE,CAAC,CAAC;QACjG,CAAC;IACH,CAAC;IACH,eAAC;AAAD,CAAC,AAzID,IAyIC;AAzIY,4BAAQ"}
@@ -58,6 +58,10 @@ test('test the position wrapper', function () { return __awaiter(void 0, void 0,
58
58
  expect(isTrue).toBe(true);
59
59
  return [4 /*yield*/, testSerialization()];
60
60
  case 2:
61
+ isTrue = _a.sent();
62
+ expect(isTrue).toBe(true);
63
+ return [4 /*yield*/, testJsonSerialization()];
64
+ case 3:
61
65
  isTrue = _a.sent();
62
66
  expect(isTrue).toBe(true);
63
67
  return [2 /*return*/];
@@ -89,17 +93,15 @@ function testEnumSerialization() {
89
93
  });
90
94
  });
91
95
  }
92
- function testSerialization() {
96
+ function testJsonSerialization() {
93
97
  return __awaiter(this, void 0, void 0, function () {
94
- var security, portfolio, tradeDate, productType, id, measure, measureValue, tradeDatePacked, idPacked, positionProto, position, tradeDatePosition, securityPosition, portfolioPosition, positionID;
98
+ var security, portfolio, tradeDate, productType, id, tradeDatePacked, idPacked, positionProto, position, position2, tradeDatePosition;
95
99
  return __generator(this, function (_a) {
96
100
  security = new security_pb_1.SecurityProto().setAssetClass("Test");
97
101
  portfolio = new portfolio_pb_1.PortfolioProto().setPortfolioName("Test portfolio");
98
102
  tradeDate = date_1.LocalDate.today().toDate();
99
103
  productType = "Test product type";
100
104
  id = new uuid_1.UUID(uuid_1.UUID.random().toBytes());
101
- measure = measure_pb_1.MeasureProto.DIRECTED_QUANTITY;
102
- measureValue = new decimal_value_pb_1.DecimalValueProto().setArbitraryPrecisionValue("1.0");
103
105
  tradeDatePacked = new any_pb_1.Any();
104
106
  tradeDatePacked.setTypeUrl("Doesn't matter");
105
107
  tradeDatePacked.setValue(date_1.LocalDate.from(tradeDate).toProto().serializeBinary());
@@ -108,14 +110,28 @@ function testSerialization() {
108
110
  idPacked.setValue(id.toUUIDProto().serializeBinary());
109
111
  positionProto = new position_pb_1.PositionProto();
110
112
  positionProto.setFieldsList([
111
- new position_util_pb_1.FieldMapEntry().setField(field_pb_1.FieldProto.TRADE_DATE).setFieldValuePacked(tradeDatePacked),
112
- new position_util_pb_1.FieldMapEntry().setField(field_pb_1.FieldProto.SECURITY).setFieldValuePacked(security),
113
- new position_util_pb_1.FieldMapEntry().setField(field_pb_1.FieldProto.PORTFOLIO).setFieldValuePacked(portfolio),
113
+ // new FieldMapEntry().setField(FieldProto.SECURITY).setFieldValuePacked(security),
114
+ // new FieldMapEntry().setField(FieldProto.PORTFOLIO).setFieldValuePacked(portfolio),
114
115
  new position_util_pb_1.FieldMapEntry().setField(field_pb_1.FieldProto.POSITION_STATUS).setEnumValue(position_status_pb_1.PositionStatusProto.EXECUTED),
115
116
  new position_util_pb_1.FieldMapEntry().setField(field_pb_1.FieldProto.PRODUCT_TYPE).setStringValue(productType),
116
117
  new position_util_pb_1.FieldMapEntry().setField(field_pb_1.FieldProto.ID).setFieldValuePacked(idPacked),
117
118
  ]);
118
119
  position = new position_1.Position(positionProto);
120
+ position2 = position_1.Position.fromJSON(position.toJSON());
121
+ tradeDatePosition = position2.getFieldValue(field_pb_1.FieldProto.TRADE_DATE);
122
+ expect(tradeDate.getFullYear()).toBe(tradeDatePosition.getFullYear());
123
+ expect(tradeDate.getMonth()).toBe(tradeDatePosition.getMonth());
124
+ expect(tradeDate.getDay()).toBe(tradeDatePosition.getDay());
125
+ expect(tradeDate.getMonth()).toBe(tradeDatePosition.getMonth());
126
+ return [2 /*return*/, true];
127
+ });
128
+ });
129
+ }
130
+ function testSerialization() {
131
+ return __awaiter(this, void 0, void 0, function () {
132
+ var _a, position, tradeDate, security, portfolio, productType, id, tradeDatePosition, securityPosition, portfolioPosition, positionID;
133
+ return __generator(this, function (_b) {
134
+ _a = getPosition(), position = _a.position, tradeDate = _a.tradeDate, security = _a.security, portfolio = _a.portfolio, productType = _a.productType, id = _a.id;
119
135
  tradeDatePosition = position.getFieldValue(field_pb_1.FieldProto.TRADE_DATE);
120
136
  expect(tradeDate.getFullYear()).toBe(tradeDatePosition.getFullYear());
121
137
  expect(tradeDate.getMonth()).toBe(tradeDatePosition.getMonth());
@@ -132,4 +148,29 @@ function testSerialization() {
132
148
  });
133
149
  });
134
150
  }
151
+ function getPosition() {
152
+ var security = new security_pb_1.SecurityProto().setAssetClass("Test");
153
+ var portfolio = new portfolio_pb_1.PortfolioProto().setPortfolioName("Test portfolio");
154
+ var tradeDate = date_1.LocalDate.today().toDate();
155
+ var productType = "Test product type";
156
+ var id = new uuid_1.UUID(uuid_1.UUID.random().toBytes());
157
+ var measure = measure_pb_1.MeasureProto.DIRECTED_QUANTITY;
158
+ var measureValue = new decimal_value_pb_1.DecimalValueProto().setArbitraryPrecisionValue("1.0");
159
+ var tradeDatePacked = new any_pb_1.Any();
160
+ tradeDatePacked.setTypeUrl("Doesn't matter");
161
+ tradeDatePacked.setValue(date_1.LocalDate.from(tradeDate).toProto().serializeBinary());
162
+ var idPacked = new any_pb_1.Any();
163
+ idPacked.setTypeUrl("Doesn't matter");
164
+ idPacked.setValue(id.toUUIDProto().serializeBinary());
165
+ var positionProto = new position_pb_1.PositionProto();
166
+ positionProto.setFieldsList([
167
+ new position_util_pb_1.FieldMapEntry().setField(field_pb_1.FieldProto.SECURITY).setFieldValuePacked(security),
168
+ new position_util_pb_1.FieldMapEntry().setField(field_pb_1.FieldProto.PORTFOLIO).setFieldValuePacked(portfolio),
169
+ new position_util_pb_1.FieldMapEntry().setField(field_pb_1.FieldProto.POSITION_STATUS).setEnumValue(position_status_pb_1.PositionStatusProto.EXECUTED),
170
+ new position_util_pb_1.FieldMapEntry().setField(field_pb_1.FieldProto.PRODUCT_TYPE).setStringValue(productType),
171
+ new position_util_pb_1.FieldMapEntry().setField(field_pb_1.FieldProto.ID).setFieldValuePacked(idPacked),
172
+ ]);
173
+ var position = new position_1.Position(positionProto);
174
+ return { position: position, tradeDate: tradeDate, security: security, portfolio: portfolio, productType: productType, id: id };
175
+ }
135
176
  //# sourceMappingURL=position.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"position.test.js","sourceRoot":"","sources":["position.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAAqC;AACrC,iEAA6D;AAI7D,qFAAqF;AACrF,+EAAgF;AAChF,yFAAsG;AACtG,yEAA0E;AAC1E,6EAA8E;AAC9E,+EAAgF;AAChF,kFAAmF;AACnF,uCAAsC;AACtC,sCAA0C;AAC1C,6FAA6F;AAG7F,IAAI,CAAC,2BAA2B,EAAE;;;;oBACjB,qBAAM,qBAAqB,EAAE,EAAA;;gBAAtC,MAAM,GAAG,SAA6B;gBAC1C,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAEjB,qBAAM,iBAAiB,EAAE,EAAA;;gBAAlC,MAAM,GAAG,SAAyB,CAAC;gBACnC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;;;;KAC7B,CAAC,CAAC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22
22
  isTrue = await testSerialization();
23
23
  expect(isTrue).toBe(true);
24
+
25
+ isTrue = await testJsonSerialization();
26
+ expect(isTrue).toBe(true);
27
+
24
28
  });
25
29
 
26
30
  async function testEnumSerialization(): Promise<boolean> {
@@ -49,16 +53,14 @@ async function testEnumSerialization(): Promise<boolean> {
49
53
  return true;
50
54
  }
51
55
 
52
- async function testSerialization(): Promise<boolean> {
56
+
57
+ async function testJsonSerialization(): Promise<boolean> {
53
58
  let security = new SecurityProto().setAssetClass("Test");
54
59
  let portfolio = new PortfolioProto().setPortfolioName("Test portfolio");
55
60
  let tradeDate = LocalDate.today().toDate();
56
61
  let productType = "Test product type";
57
62
  let id = new UUID(UUID.random().toBytes());
58
63
 
59
- let measure = MeasureProto.DIRECTED_QUANTITY;
60
- let measureValue = new DecimalValueProto().setArbitraryPrecisionValue("1.0");
61
-
62
64
  const tradeDatePacked = new Any();
63
65
  tradeDatePacked.setTypeUrl(`Doesn't matter`);
64
66
  tradeDatePacked.setValue(LocalDate.from(tradeDate).toProto().serializeBinary());
@@ -69,15 +71,30 @@ async function testSerialization(): Promise<boolean> {
69
71
 
70
72
  let positionProto = new PositionProto();
71
73
  positionProto.setFieldsList([
74
+ // new FieldMapEntry().setField(FieldProto.SECURITY).setFieldValuePacked(security),
72
75
  new FieldMapEntry().setField(FieldProto.TRADE_DATE).setFieldValuePacked(tradeDatePacked),
73
- new FieldMapEntry().setField(FieldProto.SECURITY).setFieldValuePacked(security),
74
- new FieldMapEntry().setField(FieldProto.PORTFOLIO).setFieldValuePacked(portfolio),
75
76
  new FieldMapEntry().setField(FieldProto.POSITION_STATUS).setEnumValue(PositionStatusProto.EXECUTED),
76
77
  new FieldMapEntry().setField(FieldProto.PRODUCT_TYPE).setStringValue(productType),
77
78
  new FieldMapEntry().setField(FieldProto.ID).setFieldValuePacked(idPacked),
78
79
  ]);
79
80
  let position = new Position(positionProto);
80
81
 
82
+ let position2 = Position.fromJSON(position.toJSON());
83
+
84
+
85
+ let tradeDatePosition = position2.getFieldValue(FieldProto.TRADE_DATE);
86
+ expect(tradeDate.getFullYear()).toBe(tradeDatePosition.getFullYear());
87
+ expect(tradeDate.getMonth()).toBe(tradeDatePosition.getMonth());
88
+ expect(tradeDate.getDay()).toBe(tradeDatePosition.getDay());
89
+ expect(tradeDate.getMonth()).toBe(tradeDatePosition.getMonth());
90
+
91
+ return true;
92
+ }
93
+
94
+
95
+ async function testSerialization(): Promise<boolean> {
96
+ let { position, tradeDate, security, portfolio, productType, id } = getPosition();
97
+
81
98
  let tradeDatePosition = position.getFieldValue(FieldProto.TRADE_DATE);
82
99
  expect(tradeDate.getFullYear()).toBe(tradeDatePosition.getFullYear());
83
100
  expect(tradeDate.getMonth()).toBe(tradeDatePosition.getMonth());
@@ -98,3 +115,34 @@ async function testSerialization(): Promise<boolean> {
98
115
 
99
116
  return true;
100
117
  }
118
+
119
+ function getPosition() {
120
+ let security = new SecurityProto().setAssetClass("Test");
121
+ let portfolio = new PortfolioProto().setPortfolioName("Test portfolio");
122
+ let tradeDate = LocalDate.today().toDate();
123
+ let productType = "Test product type";
124
+ let id = new UUID(UUID.random().toBytes());
125
+
126
+ let measure = MeasureProto.DIRECTED_QUANTITY;
127
+ let measureValue = new DecimalValueProto().setArbitraryPrecisionValue("1.0");
128
+
129
+ const tradeDatePacked = new Any();
130
+ tradeDatePacked.setTypeUrl(`Doesn't matter`);
131
+ tradeDatePacked.setValue(LocalDate.from(tradeDate).toProto().serializeBinary());
132
+
133
+ const idPacked = new Any();
134
+ idPacked.setTypeUrl(`Doesn't matter`);
135
+ idPacked.setValue(id.toUUIDProto().serializeBinary());
136
+
137
+ let positionProto = new PositionProto();
138
+ positionProto.setFieldsList([
139
+ new FieldMapEntry().setField(FieldProto.SECURITY).setFieldValuePacked(security),
140
+ new FieldMapEntry().setField(FieldProto.PORTFOLIO).setFieldValuePacked(portfolio),
141
+ new FieldMapEntry().setField(FieldProto.TRADE_DATE).setFieldValuePacked(tradeDatePacked),
142
+ new FieldMapEntry().setField(FieldProto.POSITION_STATUS).setEnumValue(PositionStatusProto.EXECUTED),
143
+ new FieldMapEntry().setField(FieldProto.PRODUCT_TYPE).setStringValue(productType),
144
+ new FieldMapEntry().setField(FieldProto.ID).setFieldValuePacked(idPacked),
145
+ ]);
146
+ let position = new Position(positionProto);
147
+ return { position, tradeDate, security, portfolio, productType, id };
148
+ }
@@ -24,6 +24,22 @@ export class Position {
24
24
  this.proto = positionProto;
25
25
  }
26
26
 
27
+ /*** */
28
+ toJSON(): any {
29
+ return {
30
+ proto: this.proto.serializeBinary(), // Serialize Age object to binary buffer
31
+ };
32
+ }
33
+
34
+ /**
35
+ * Experimental impelementaiton
36
+ * @param binary An array which is the raw binary of the proto object
37
+ * @returns A Position object with the deserialized binary inside it
38
+ */
39
+ static fromJSON(json: any): Position {
40
+ return new Position(PositionProto.deserializeBinary(json['proto']));
41
+ }
42
+
27
43
  public getFieldValue(field: FieldProto): any {
28
44
  return this.getField(new FieldMapEntry().setField(field));
29
45
  }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.QueryPositionRequest = void 0;
4
+ var position_pb_1 = require("../../../fintekkers/models/position/position_pb");
5
+ var datetime_1 = require("../../models/utils/datetime");
6
+ var positionfilter_1 = require("../../models/position/positionfilter");
7
+ var operation_pb_1 = require("../../../fintekkers/requests/util/operation_pb");
8
+ //Requests
9
+ var query_position_request_pb_1 = require("../../../fintekkers/requests/position/query_position_request_pb");
10
+ var QueryPositionRequest = /** @class */ (function () {
11
+ function QueryPositionRequest(filter, positionType, positionView, fields, measures, asOf) {
12
+ this.filter = filter;
13
+ this.positionType = positionType;
14
+ this.positionView = positionView;
15
+ this.fields = fields;
16
+ this.measures = measures;
17
+ this.asOf = asOf;
18
+ }
19
+ QueryPositionRequest.fromAsOf = function (fields, measures, asOf) {
20
+ return new QueryPositionRequest(new positionfilter_1.PositionFilter(), position_pb_1.PositionTypeProto.TRANSACTION, position_pb_1.PositionViewProto.DEFAULT_VIEW, fields, measures, asOf);
21
+ };
22
+ QueryPositionRequest.from = function (fields, measures) {
23
+ return QueryPositionRequest.fromAsOf(fields, measures, datetime_1.ZonedDateTime.now());
24
+ };
25
+ QueryPositionRequest.prototype.toProto = function () {
26
+ var proto = new query_position_request_pb_1.QueryPositionRequestProto()
27
+ .setAsOf(this.asOf.toProto())
28
+ .setVersion("1.0.0")
29
+ .setPositionType(this.positionType)
30
+ .setPositionView(this.positionView)
31
+ .setFieldsList(this.fields)
32
+ .setMeasuresList(this.measures)
33
+ .setOperationType(operation_pb_1.RequestOperationTypeProto.SEARCH);
34
+ if (this.filter && this.filter.getFilters().length > 0)
35
+ proto.setFilterFields(this.filter.toProto());
36
+ return proto;
37
+ };
38
+ QueryPositionRequest.prototype.getFilter = function () {
39
+ return this.filter;
40
+ };
41
+ return QueryPositionRequest;
42
+ }());
43
+ exports.QueryPositionRequest = QueryPositionRequest;
44
+ //# sourceMappingURL=QueryPositionRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QueryPositionRequest.js","sourceRoot":"","sources":["QueryPositionRequest.ts"],"names":[],"mappings":";;;AAEA,+EAAuG;AAEvG,wDAA4D;AAC5D,uEAAsE;AACtE,+EAA2F;AAE3F,UAAU;AACV,6GAA4G;AAE5G;IAsBI,8BAAY,MAAsB,EAAE,YAA+B,EAAE,YAA+B,EAChG,MAAyB,EAAE,QAA6B,EAAE,IAAmB;QAC7E,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;IAvBM,6BAAQ,GAAf,UAAgB,MAAyB,EAAE,QAA6B,EAAE,IAAmB;QACzF,OAAO,IAAI,oBAAoB,CAC3B,IAAI,+BAAc,EAAE,EACpB,+BAAiB,CAAC,WAAW,EAC7B,+BAAiB,CAAC,YAAY,EAC9B,MAAM,EACN,QAAQ,EACR,IAAI,CAAC,CAAC;IACd,CAAC;IAEM,yBAAI,GAAX,UAAY,MAAyB,EAAE,QAA6B;QAChE,OAAO,oBAAoB,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,EAAE,wBAAa,CAAC,GAAG,EAAE,CAAC,CAAC;IAChF,CAAC;IAaM,sCAAO,GAAd;QACI,IAAM,KAAK,GAAG,IAAI,qDAAyB,EAAE;aACxC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;aAC5B,UAAU,CAAC,OAAO,CAAC;aACnB,eAAe,CAAC,IAAI,CAAC,YAAY,CAAC;aAClC,eAAe,CAAC,IAAI,CAAC,YAAY,CAAC;aAClC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC;aAC1B,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC;aAC9B,gBAAgB,CAAC,wCAAyB,CAAC,MAAM,CAAC,CAAC;QAExD,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,MAAM,GAAG,CAAC;YAClD,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAA;QAEhD,OAAO,KAAK,CAAC;IACjB,CAAC;IAEM,wCAAS,GAAhB;QACI,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IACL,2BAAC;AAAD,CAAC,AApDD,IAoDC;AApDY,oDAAoB"}
@@ -0,0 +1,64 @@
1
+ //Models
2
+ import { FieldProto } from "../../../fintekkers/models/position/field_pb";
3
+ import { PositionTypeProto, PositionViewProto } from "../../../fintekkers/models/position/position_pb";
4
+ import { MeasureProto } from "../../../fintekkers/models/position/measure_pb";
5
+ import { ZonedDateTime } from "../../models/utils/datetime";
6
+ import { PositionFilter } from "../../models/position/positionfilter";
7
+ import { RequestOperationTypeProto } from "../../../fintekkers/requests/util/operation_pb";
8
+
9
+ //Requests
10
+ import { QueryPositionRequestProto } from "../../../fintekkers/requests/position/query_position_request_pb";
11
+
12
+ export class QueryPositionRequest {
13
+ private filter: PositionFilter;
14
+ private positionType: PositionTypeProto;
15
+ private positionView: PositionViewProto;
16
+ private fields: Array<FieldProto>;
17
+ private measures: Array<MeasureProto>;
18
+ private asOf: ZonedDateTime;
19
+
20
+ static fromAsOf(fields: Array<FieldProto>, measures: Array<MeasureProto>, asOf: ZonedDateTime): QueryPositionRequest {
21
+ return new QueryPositionRequest(
22
+ new PositionFilter(),
23
+ PositionTypeProto.TRANSACTION,
24
+ PositionViewProto.DEFAULT_VIEW,
25
+ fields,
26
+ measures,
27
+ asOf);
28
+ }
29
+
30
+ static from(fields: Array<FieldProto>, measures: Array<MeasureProto>): QueryPositionRequest {
31
+ return QueryPositionRequest.fromAsOf(fields, measures, ZonedDateTime.now());
32
+ }
33
+
34
+ constructor(filter: PositionFilter, positionType: PositionTypeProto, positionView: PositionViewProto,
35
+ fields: Array<FieldProto>, measures: Array<MeasureProto>, asOf: ZonedDateTime) {
36
+ this.filter = filter;
37
+
38
+ this.positionType = positionType;
39
+ this.positionView = positionView;
40
+ this.fields = fields;
41
+ this.measures = measures;
42
+ this.asOf = asOf;
43
+ }
44
+
45
+ public toProto(): QueryPositionRequestProto {
46
+ const proto = new QueryPositionRequestProto()
47
+ .setAsOf(this.asOf.toProto())
48
+ .setVersion("1.0.0")
49
+ .setPositionType(this.positionType)
50
+ .setPositionView(this.positionView)
51
+ .setFieldsList(this.fields)
52
+ .setMeasuresList(this.measures)
53
+ .setOperationType(RequestOperationTypeProto.SEARCH);
54
+
55
+ if (this.filter && this.filter.getFilters().length > 0)
56
+ proto.setFilterFields(this.filter.toProto())
57
+
58
+ return proto;
59
+ }
60
+
61
+ public getFilter(): PositionFilter {
62
+ return this.filter;
63
+ }
64
+ }
@@ -67,7 +67,7 @@ test('test creating a portfolio against the api.fintekkers.org portfolio service
67
67
  case 2:
68
68
  createPortfolioResponse = _a.sent();
69
69
  expect(createPortfolioResponse.getPortfolioResponseList().length).toBe(1);
70
- return [4 /*yield*/, portfolioService.searchPortfolio(now.toProto(), new positionfilter_1.PositionFilter().addEqualsFilter(field_pb_1.FieldProto.PORTFOLIO_NAME, 'Federal Reserve SOMA Holdings'))];
70
+ return [4 /*yield*/, portfolioService.searchPortfolio(now.toProto(), new positionfilter_1.PositionFilter().addEqualsFilter(field_pb_1.FieldProto.PORTFOLIO_NAME, 'TEST PORTFOLIO'))];
71
71
  case 3:
72
72
  searchResults = _a.sent();
73
73
  expect(searchResults.length > 0).toBe(true);
@@ -1 +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;AAEnF,uEAAsE;AAGtE,IAAI,CAAC,4EAA4E,EAAE;;;;;gBAC3E,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,CAAC;gBAC5C,GAAG,GAAG,EAAE,CAAC,aAAa,CAAC,GAAG,EAAE,CAAC;gBAE7B,gBAAgB,GAAG,IAAI,mCAAgB,EAAE,CAAC;gBAE1C,SAAS,GAAG,IAAI,6BAAc,EAAE,CAAC;gBACvC,SAAS,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;gBACtC,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;gBAC9B,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;gBAC5B,SAAS,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;gBAC7C,SAAS,CAAC,OAAO,CAAC,GA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,IAAI,6BAAc,EAAE,CAAC;gBACvC,SAAS,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;gBACtC,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;gBAC9B,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;gBAC5B,SAAS,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;gBAC7C,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;gBAET,qBAAM,gBAAgB,CAAC,uBAAuB,CAAC,SAAS,CAAC,EAAA;;gBAA7E,iBAAiB,GAAG,SAAyD;gBACjF,MAAM,CAAC,iBAAiB,CAAC,aAAa,EAAE,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBAEG,qBAAM,gBAAgB,CAAC,eAAe,CAAC,SAAS,CAAC,EAAA;;gBAAzG,uBAAuB,GAAiC,SAAiD;gBAC7G,MAAM,CAAC,uBAAuB,CAAC,wBAAwB,EAAE,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBAEtD,qBAAM,gBAAgB,CAAC,eAAe,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,IAAI,+BAAc,EAAE,CAAC,eAAe,CAAC,qBAAU,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAAC,EAAA;;gBAAxJ,aAAa,GAAG,SAAwI;gBAC5J,MAAM,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;;;;KAC7C,EAAE,KAAK,CAAC,CAAC"}
@@ -31,6 +31,6 @@ test('test creating a portfolio against the api.fintekkers.org portfolio service
31
31
  var createPortfolioResponse: CreatePortfolioResponseProto = await portfolioService.createPortfolio(portfolio);
32
32
  expect(createPortfolioResponse.getPortfolioResponseList().length).toBe(1);
33
33
 
34
- var searchResults = await portfolioService.searchPortfolio(now.toProto(), new PositionFilter().addEqualsFilter(FieldProto.PORTFOLIO_NAME, 'Federal Reserve SOMA Holdings'));
34
+ var searchResults = await portfolioService.searchPortfolio(now.toProto(), new PositionFilter().addEqualsFilter(FieldProto.PORTFOLIO_NAME, 'TEST PORTFOLIO'));
35
35
  expect(searchResults.length > 0).toBe(true);
36
36
  }, 30000);
@@ -47,7 +47,7 @@ var PositionService = /** @class */ (function () {
47
47
  function PositionService() {
48
48
  this.client = new position_service_grpc_pb_1.PositionClient(requestcontext_1.default.apiURL, requestcontext_1.default.apiCredentials);
49
49
  }
50
- PositionService.prototype.search = function (request) {
50
+ PositionService.prototype.search = function (positionRequest) {
51
51
  return __awaiter(this, void 0, void 0, function () {
52
52
  function processStreamSynchronously() {
53
53
  return __awaiter(this, void 0, void 0, function () {
@@ -71,12 +71,13 @@ var PositionService = /** @class */ (function () {
71
71
  });
72
72
  });
73
73
  }
74
- var tmpClient, listPositions;
74
+ var tmpClient, listPositions, request;
75
75
  return __generator(this, function (_a) {
76
76
  switch (_a.label) {
77
77
  case 0:
78
78
  tmpClient = this.client;
79
79
  listPositions = [];
80
+ request = positionRequest.toProto();
80
81
  return [4 /*yield*/, processStreamSynchronously()];
81
82
  case 1: return [2 /*return*/, _a.sent()];
82
83
  }
@@ -1 +1 @@
1
- {"version":3,"file":"PositionService.js","sourceRoot":"","sources":["PositionService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS;AACT,2DAA0D;AAM1D,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,I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S,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,mBAAQ,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;;;;;wBAvBK,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC;wBACxB,aAAa,GAAe,EAAE,CAAC;wBAC/B,OAAO,GAA8B,eAAe,CAAC,OAAO,EAAE,CAAC;wBAuB9D,qBAAM,0BAA0B,EAAE,EAAA;4BAAzC,sBAAO,SAAkC,EAAC;;;;KAC3C;IACH,sBAAC;AAAD,CAAC,AAnCD,IAmCC;AAEQ,0CAAe"}
@@ -10,6 +10,7 @@ import { PositionClient } from '../../../fintekkers/services/position-service/po
10
10
 
11
11
  //Utils
12
12
  import EnvConfig from '../../models/utils/requestcontext';
13
+ import { QueryPositionRequest } from '../../requests/position/QueryPositionRequest';
13
14
 
14
15
  class PositionService {
15
16
  private client: PositionClient;
@@ -18,9 +19,10 @@ class PositionService {
18
19
  this.client = new PositionClient(EnvConfig.apiURL, EnvConfig.apiCredentials);
19
20
  }
20
21
 
21
- async search(request: QueryPositionRequestProto): Promise<Position[]> {
22
+ async search(positionRequest: QueryPositionRequest): Promise<Position[]> {
22
23
  const tmpClient = this.client;
23
24
  const listPositions: Position[] = [];
25
+ const request: QueryPositionRequestProto = positionRequest.toProto();
24
26
 
25
27
  async function processStreamSynchronously(): Promise<Position[]> {
26
28
  const stream2 = tmpClient.search(request);
@@ -37,14 +37,12 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  // Models
40
- var position_pb_1 = require("../../../fintekkers/models/position/position_pb");
41
40
  var measure_pb_1 = require("../../../fintekkers/models/position/measure_pb");
42
41
  // Model Utils
43
42
  var field_pb_1 = require("../../../fintekkers/models/position/field_pb");
44
- var datetime_1 = require("../../models/utils/datetime");
45
43
  //Requests & Services
46
44
  var PositionService_1 = require("../../services/position-service/PositionService");
47
- var query_position_request_pb_1 = require("../../../fintekkers/requests/position/query_position_request_pb");
45
+ var QueryPositionRequest_1 = require("../../requests/position/QueryPositionRequest");
48
46
  test('test getting a position against the api.fintekkers.org position service', function () { return __awaiter(void 0, void 0, void 0, function () {
49
47
  var isTrue;
50
48
  return __generator(this, function (_a) {
@@ -65,12 +63,7 @@ function testPosition() {
65
63
  case 0:
66
64
  fields = [field_pb_1.FieldProto.SECURITY_ID, field_pb_1.FieldProto.TRADE_DATE, field_pb_1.FieldProto.PRODUCT_TYPE, field_pb_1.FieldProto.PORTFOLIO, field_pb_1.FieldProto.PRODUCT_TYPE];
67
65
  measures = [measure_pb_1.MeasureProto.DIRECTED_QUANTITY];
68
- request = new query_position_request_pb_1.QueryPositionRequestProto()
69
- .setAsOf(datetime_1.ZonedDateTime.now().toProto())
70
- .setFieldsList(fields)
71
- .setMeasuresList(measures)
72
- .setPositionType(position_pb_1.PositionTypeProto.TRANSACTION)
73
- .setPositionView(position_pb_1.PositionViewProto.DEFAULT_VIEW);
66
+ request = QueryPositionRequest_1.QueryPositionRequest.from(fields, measures);
74
67
  return [4 /*yield*/, new PositionService_1.PositionService().search(request)];
75
68
  case 1:
76
69
  positions = _a.sent();
@@ -1 +1 @@
1
- {"version":3,"file":"position.test.js","sourceRoot":"","sources":["position.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS;AACT,+EAAuG;AACvG,6EAA8E;AAE9E,cAAc;AACd,yEAA0E;AAC1E,wDAA4D;AAE5D,qBAAqB;AACrB,mFAAkF;AAClF,6GAA4G;AAE5G,IAAI,CAAC,yEAAyE,EAAE;;;;oBAC/D,qBAAM,YAAY,EAAE,EAAA;;gBAA7B,MAAM,GAAG,SAAoB;gBACnC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;;;;KAC3B,EAAE,KAAK,CAAC,CAAC;AAEV,SAAe,YAAY;;;;;;oBAErB,MAAM,GAAG,CAAC,qBAAU,CAAC,WAAW,EAAE,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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AC,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,14 +1,12 @@
1
1
  // Models
2
- import { PositionTypeProto, PositionViewProto } from '../../../fintekkers/models/position/position_pb';
3
2
  import { MeasureProto } from '../../../fintekkers/models/position/measure_pb';
4
3
 
5
4
  // Model Utils
6
5
  import { FieldProto } from '../../../fintekkers/models/position/field_pb';
7
- import { ZonedDateTime } from '../../models/utils/datetime';
8
6
 
9
7
  //Requests & Services
10
8
  import { PositionService } from '../../services/position-service/PositionService';
11
- import { QueryPositionRequestProto } from '../../../fintekkers/requests/position/query_position_request_pb';
9
+ import { QueryPositionRequest } from '../../requests/position/QueryPositionRequest';
12
10
 
13
11
  test('test getting a position against the api.fintekkers.org position service', async () => {
14
12
  const isTrue = await testPosition();
@@ -20,13 +18,7 @@ async function testPosition(): Promise<boolean> {
20
18
  let fields = [FieldProto.SECURITY_ID, FieldProto.TRADE_DATE, FieldProto.PRODUCT_TYPE, FieldProto.PORTFOLIO, FieldProto.PRODUCT_TYPE];
21
19
  let measures = [MeasureProto.DIRECTED_QUANTITY];
22
20
 
23
- let request = new QueryPositionRequestProto()
24
- .setAsOf(ZonedDateTime.now().toProto())
25
- .setFieldsList(fields)
26
- .setMeasuresList(measures)
27
- .setPositionType(PositionTypeProto.TRANSACTION)
28
- .setPositionView(PositionViewProto.DEFAULT_VIEW);
29
-
21
+ let request: QueryPositionRequest = QueryPositionRequest.from(fields, measures);
30
22
  let positions = await new PositionService().search(request);
31
23
 
32
24
  if (positions && positions.length > 0) {
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.75",
4
+ "version": "0.1.76",
5
5
  "description": "ledger model protos ",
6
6
  "authors": [
7
7
  "David Doherty",
package/tsconfig.json CHANGED
@@ -1,27 +1,29 @@
1
1
  {
2
- "compileOnSave": true,
3
- "compilerOptions": {
4
- "target": "es5",
5
- "module": "commonjs",
6
- "sourceMap": true //Required for debugging .ts files
7
- }
2
+ "compileOnSave": true,
3
+ "compilerOptions": {
4
+ "target": "es5",
5
+ "module": "commonjs",
6
+ "sourceMap": true, //Required for debugging .ts files
7
+ "typeRoots": [
8
+ "node_modules/@types"
9
+ ],
8
10
  }
9
-
10
- // {
11
- // "compilerOptions": {
12
- // "outDir": "./dist/out-tsc",
13
- // "sourceMap": true,
14
- // "declaration": false,
15
- // "moduleResolution": "node",
16
- // "emitDecoratorMetadata": true,
17
- // "experimentalDecorators": true,
18
- // "target": "es5",
19
- // "typeRoots": [
20
- // "node_modules/@types"
21
- // ],
22
- // "lib": [
23
- // "es2017",
24
- // "dom"
25
- // ]
26
- // }
27
- // }
11
+ }
12
+ // {
13
+ // "compilerOptions": {
14
+ // "outDir": "./dist/out-tsc",
15
+ // "sourceMap": true,
16
+ // "declaration": false,
17
+ // "moduleResolution": "node",
18
+ // "emitDecoratorMetadata": true,
19
+ // "experimentalDecorators": true,
20
+ // "target": "es5",
21
+ // "typeRoots": [
22
+ // "node_modules/@types"
23
+ // ],
24
+ // "lib": [
25
+ // "es2017",
26
+ // "dom"
27
+ // ]
28
+ // }
29
+ // }
@@ -0,0 +1,34 @@
1
+ import * as jspb from 'google-protobuf'
2
+
3
+
4
+
5
+ export class API_Key extends jspb.Message {
6
+ getObjectClass(): string;
7
+ setObjectClass(value: string): API_Key;
8
+
9
+ getVersion(): string;
10
+ setVersion(value: string): API_Key;
11
+
12
+ getIdentity(): string;
13
+ setIdentity(value: string): API_Key;
14
+
15
+ getKey(): string;
16
+ setKey(value: string): API_Key;
17
+
18
+ serializeBinary(): Uint8Array;
19
+ toObject(includeInstance?: boolean): API_Key.AsObject;
20
+ static toObject(includeInstance: boolean, msg: API_Key): API_Key.AsObject;
21
+ static serializeBinaryToWriter(message: API_Key, writer: jspb.BinaryWriter): void;
22
+ static deserializeBinary(bytes: Uint8Array): API_Key;
23
+ static deserializeBinaryFromReader(message: API_Key, reader: jspb.BinaryReader): API_Key;
24
+ }
25
+
26
+ export namespace API_Key {
27
+ export type AsObject = {
28
+ objectClass: string,
29
+ version: string,
30
+ identity: string,
31
+ key: string,
32
+ }
33
+ }
34
+
@@ -0,0 +1,260 @@
1
+ // source: fintekkers/models/util/api/api_key.proto
2
+ /**
3
+ * @fileoverview
4
+ * @enhanceable
5
+ * @suppress {missingRequire} reports error on implicit type usages.
6
+ * @suppress {messageConventions} JS Compiler reports an error if a variable or
7
+ * field starts with 'MSG_' and isn't a translatable message.
8
+ * @public
9
+ */
10
+ // GENERATED CODE -- DO NOT EDIT!
11
+ /* eslint-disable */
12
+ // @ts-nocheck
13
+
14
+ var jspb = require('google-protobuf');
15
+ var goog = jspb;
16
+ var global = (function() { return this || window || global || self || Function('return this')(); }).call(null);
17
+
18
+ goog.exportSymbol('proto.fintekkers.models.util.api.API_Key', null, global);
19
+ /**
20
+ * Generated by JsPbCodeGenerator.
21
+ * @param {Array=} opt_data Optional initial data array, typically from a
22
+ * server response, or constructed directly in Javascript. The array is used
23
+ * in place and becomes part of the constructed object. It is not cloned.
24
+ * If no data is provided, the constructed object will be empty, but still
25
+ * valid.
26
+ * @extends {jspb.Message}
27
+ * @constructor
28
+ */
29
+ proto.fintekkers.models.util.api.API_Key = function(opt_data) {
30
+ jspb.Message.initialize(this, opt_data, 0, -1, null, null);
31
+ };
32
+ goog.inherits(proto.fintekkers.models.util.api.API_Key, jspb.Message);
33
+ if (goog.DEBUG && !COMPILED) {
34
+ /**
35
+ * @public
36
+ * @override
37
+ */
38
+ proto.fintekkers.models.util.api.API_Key.displayName = 'proto.fintekkers.models.util.api.API_Key';
39
+ }
40
+
41
+
42
+
43
+ if (jspb.Message.GENERATE_TO_OBJECT) {
44
+ /**
45
+ * Creates an object representation of this proto.
46
+ * Field names that are reserved in JavaScript and will be renamed to pb_name.
47
+ * Optional fields that are not set will be set to undefined.
48
+ * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
49
+ * For the list of reserved names please see:
50
+ * net/proto2/compiler/js/internal/generator.cc#kKeyword.
51
+ * @param {boolean=} opt_includeInstance Deprecated. whether to include the
52
+ * JSPB instance for transitional soy proto support:
53
+ * http://goto/soy-param-migration
54
+ * @return {!Object}
55
+ */
56
+ proto.fintekkers.models.util.api.API_Key.prototype.toObject = function(opt_includeInstance) {
57
+ return proto.fintekkers.models.util.api.API_Key.toObject(opt_includeInstance, this);
58
+ };
59
+
60
+
61
+ /**
62
+ * Static version of the {@see toObject} method.
63
+ * @param {boolean|undefined} includeInstance Deprecated. Whether to include
64
+ * the JSPB instance for transitional soy proto support:
65
+ * http://goto/soy-param-migration
66
+ * @param {!proto.fintekkers.models.util.api.API_Key} msg The msg instance to transform.
67
+ * @return {!Object}
68
+ * @suppress {unusedLocalVariables} f is only used for nested messages
69
+ */
70
+ proto.fintekkers.models.util.api.API_Key.toObject = function(includeInstance, msg) {
71
+ var f, obj = {
72
+ objectClass: jspb.Message.getFieldWithDefault(msg, 1, ""),
73
+ version: jspb.Message.getFieldWithDefault(msg, 2, ""),
74
+ identity: jspb.Message.getFieldWithDefault(msg, 3, ""),
75
+ key: jspb.Message.getFieldWithDefault(msg, 4, "")
76
+ };
77
+
78
+ if (includeInstance) {
79
+ obj.$jspbMessageInstance = msg;
80
+ }
81
+ return obj;
82
+ };
83
+ }
84
+
85
+
86
+ /**
87
+ * Deserializes binary data (in protobuf wire format).
88
+ * @param {jspb.ByteSource} bytes The bytes to deserialize.
89
+ * @return {!proto.fintekkers.models.util.api.API_Key}
90
+ */
91
+ proto.fintekkers.models.util.api.API_Key.deserializeBinary = function(bytes) {
92
+ var reader = new jspb.BinaryReader(bytes);
93
+ var msg = new proto.fintekkers.models.util.api.API_Key;
94
+ return proto.fintekkers.models.util.api.API_Key.deserializeBinaryFromReader(msg, reader);
95
+ };
96
+
97
+
98
+ /**
99
+ * Deserializes binary data (in protobuf wire format) from the
100
+ * given reader into the given message object.
101
+ * @param {!proto.fintekkers.models.util.api.API_Key} msg The message object to deserialize into.
102
+ * @param {!jspb.BinaryReader} reader The BinaryReader to use.
103
+ * @return {!proto.fintekkers.models.util.api.API_Key}
104
+ */
105
+ proto.fintekkers.models.util.api.API_Key.deserializeBinaryFromReader = function(msg, reader) {
106
+ while (reader.nextField()) {
107
+ if (reader.isEndGroup()) {
108
+ break;
109
+ }
110
+ var field = reader.getFieldNumber();
111
+ switch (field) {
112
+ case 1:
113
+ var value = /** @type {string} */ (reader.readString());
114
+ msg.setObjectClass(value);
115
+ break;
116
+ case 2:
117
+ var value = /** @type {string} */ (reader.readString());
118
+ msg.setVersion(value);
119
+ break;
120
+ case 3:
121
+ var value = /** @type {string} */ (reader.readString());
122
+ msg.setIdentity(value);
123
+ break;
124
+ case 4:
125
+ var value = /** @type {string} */ (reader.readString());
126
+ msg.setKey(value);
127
+ break;
128
+ default:
129
+ reader.skipField();
130
+ break;
131
+ }
132
+ }
133
+ return msg;
134
+ };
135
+
136
+
137
+ /**
138
+ * Serializes the message to binary data (in protobuf wire format).
139
+ * @return {!Uint8Array}
140
+ */
141
+ proto.fintekkers.models.util.api.API_Key.prototype.serializeBinary = function() {
142
+ var writer = new jspb.BinaryWriter();
143
+ proto.fintekkers.models.util.api.API_Key.serializeBinaryToWriter(this, writer);
144
+ return writer.getResultBuffer();
145
+ };
146
+
147
+
148
+ /**
149
+ * Serializes the given message to binary data (in protobuf wire
150
+ * format), writing to the given BinaryWriter.
151
+ * @param {!proto.fintekkers.models.util.api.API_Key} message
152
+ * @param {!jspb.BinaryWriter} writer
153
+ * @suppress {unusedLocalVariables} f is only used for nested messages
154
+ */
155
+ proto.fintekkers.models.util.api.API_Key.serializeBinaryToWriter = function(message, writer) {
156
+ var f = undefined;
157
+ f = message.getObjectClass();
158
+ if (f.length > 0) {
159
+ writer.writeString(
160
+ 1,
161
+ f
162
+ );
163
+ }
164
+ f = message.getVersion();
165
+ if (f.length > 0) {
166
+ writer.writeString(
167
+ 2,
168
+ f
169
+ );
170
+ }
171
+ f = message.getIdentity();
172
+ if (f.length > 0) {
173
+ writer.writeString(
174
+ 3,
175
+ f
176
+ );
177
+ }
178
+ f = message.getKey();
179
+ if (f.length > 0) {
180
+ writer.writeString(
181
+ 4,
182
+ f
183
+ );
184
+ }
185
+ };
186
+
187
+
188
+ /**
189
+ * optional string object_class = 1;
190
+ * @return {string}
191
+ */
192
+ proto.fintekkers.models.util.api.API_Key.prototype.getObjectClass = function() {
193
+ return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
194
+ };
195
+
196
+
197
+ /**
198
+ * @param {string} value
199
+ * @return {!proto.fintekkers.models.util.api.API_Key} returns this
200
+ */
201
+ proto.fintekkers.models.util.api.API_Key.prototype.setObjectClass = function(value) {
202
+ return jspb.Message.setProto3StringField(this, 1, value);
203
+ };
204
+
205
+
206
+ /**
207
+ * optional string version = 2;
208
+ * @return {string}
209
+ */
210
+ proto.fintekkers.models.util.api.API_Key.prototype.getVersion = function() {
211
+ return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
212
+ };
213
+
214
+
215
+ /**
216
+ * @param {string} value
217
+ * @return {!proto.fintekkers.models.util.api.API_Key} returns this
218
+ */
219
+ proto.fintekkers.models.util.api.API_Key.prototype.setVersion = function(value) {
220
+ return jspb.Message.setProto3StringField(this, 2, value);
221
+ };
222
+
223
+
224
+ /**
225
+ * optional string identity = 3;
226
+ * @return {string}
227
+ */
228
+ proto.fintekkers.models.util.api.API_Key.prototype.getIdentity = function() {
229
+ return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
230
+ };
231
+
232
+
233
+ /**
234
+ * @param {string} value
235
+ * @return {!proto.fintekkers.models.util.api.API_Key} returns this
236
+ */
237
+ proto.fintekkers.models.util.api.API_Key.prototype.setIdentity = function(value) {
238
+ return jspb.Message.setProto3StringField(this, 3, value);
239
+ };
240
+
241
+
242
+ /**
243
+ * optional string key = 4;
244
+ * @return {string}
245
+ */
246
+ proto.fintekkers.models.util.api.API_Key.prototype.getKey = function() {
247
+ return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, ""));
248
+ };
249
+
250
+
251
+ /**
252
+ * @param {string} value
253
+ * @return {!proto.fintekkers.models.util.api.API_Key} returns this
254
+ */
255
+ proto.fintekkers.models.util.api.API_Key.prototype.setKey = function(value) {
256
+ return jspb.Message.setProto3StringField(this, 4, value);
257
+ };
258
+
259
+
260
+ goog.object.extend(exports, proto.fintekkers.models.util.api);