@fintekkers/ledger-models 0.1.61 → 0.1.62

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 (68) hide show
  1. package/node/fintekkers/requests/transaction/query_transaction_request_pb.d.ts +3 -0
  2. package/node/fintekkers/requests/transaction/query_transaction_request_pb.js +31 -1
  3. package/node/fintekkers/requests/transaction/query_transaction_response_pb.d.ts +7 -0
  4. package/node/fintekkers/requests/transaction/query_transaction_response_pb.js +54 -1
  5. package/node/wrappers/models/position/position.js +14 -9
  6. package/node/wrappers/models/position/position.js.map +1 -1
  7. package/node/wrappers/models/position/position.test.js +43 -0
  8. package/node/wrappers/models/position/position.test.js.map +1 -0
  9. package/node/wrappers/models/position/position.test.ts +70 -0
  10. package/node/wrappers/models/position/position.ts +17 -10
  11. package/node/wrappers/models/transaction/transaction.js +2 -2
  12. package/node/wrappers/models/transaction/transaction.js.map +1 -1
  13. package/node/wrappers/models/transaction/transaction.test.js.map +1 -1
  14. package/node/wrappers/models/transaction/transaction.test.ts +0 -1
  15. package/node/wrappers/models/transaction/transaction.ts +2 -2
  16. package/node/wrappers/models/transaction/transaction_type.js +0 -1
  17. package/node/wrappers/models/transaction/transaction_type.js.map +1 -1
  18. package/node/wrappers/models/transaction/transaction_type.ts +1 -1
  19. package/node/wrappers/models/utils/requestcontext.js +55 -0
  20. package/node/wrappers/models/utils/requestcontext.js.map +1 -0
  21. package/node/wrappers/models/utils/requestcontext.ts +44 -0
  22. package/node/wrappers/models/utils/requestcontext_d.js +1 -0
  23. package/node/wrappers/models/utils/requestcontext_d.js.map +1 -0
  24. package/node/wrappers/models/utils/requestcontext_d.ts +7 -0
  25. package/node/wrappers/models/utils/serialization.js +6 -4
  26. package/node/wrappers/models/utils/serialization.js.map +1 -1
  27. package/node/wrappers/models/utils/serialization.test.js +8 -9
  28. package/node/wrappers/models/utils/serialization.test.js.map +1 -1
  29. package/node/wrappers/models/utils/serialization.test.ts +8 -10
  30. package/node/wrappers/models/utils/serialization.ts +8 -8
  31. package/node/wrappers/models/utils/serialization.util.js +76 -0
  32. package/node/wrappers/models/utils/serialization.util.js.map +1 -0
  33. package/node/wrappers/models/utils/serialization.util.test.js +24 -0
  34. package/node/wrappers/models/utils/serialization.util.test.js.map +1 -0
  35. package/node/wrappers/models/utils/serialization.util.test.ts +29 -0
  36. package/node/wrappers/models/utils/serialization.util.ts +85 -0
  37. package/node/wrappers/services/portfolio-service/PortfolioService.js +5 -5
  38. package/node/wrappers/services/portfolio-service/PortfolioService.js.map +1 -1
  39. package/node/wrappers/services/portfolio-service/PortfolioService.ts +5 -3
  40. package/node/wrappers/services/portfolio-service/portfolio.test.js +2 -2
  41. package/node/wrappers/services/portfolio-service/portfolio.test.js.map +1 -1
  42. package/node/wrappers/services/portfolio-service/portfolio.test.ts +2 -2
  43. package/node/wrappers/services/position-service/PositionService.js +4 -3
  44. package/node/wrappers/services/position-service/PositionService.js.map +1 -1
  45. package/node/wrappers/services/position-service/PositionService.ts +4 -19
  46. package/node/wrappers/services/position-service/position.test.js +17 -8
  47. package/node/wrappers/services/position-service/position.test.js.map +1 -1
  48. package/node/wrappers/services/position-service/position.test.ts +10 -7
  49. package/node/wrappers/services/security-service/SecurityService.js +4 -5
  50. package/node/wrappers/services/security-service/SecurityService.js.map +1 -1
  51. package/node/wrappers/services/security-service/SecurityService.ts +3 -3
  52. package/node/wrappers/services/security-service/security.test.js +15 -7
  53. package/node/wrappers/services/security-service/security.test.js.map +1 -1
  54. package/node/wrappers/services/security-service/security.test.ts +6 -6
  55. package/node/wrappers/services/transaction-service/TransactionService.js +40 -46
  56. package/node/wrappers/services/transaction-service/TransactionService.js.map +1 -1
  57. package/node/wrappers/services/transaction-service/TransactionService.ts +13 -10
  58. package/node/wrappers/services/transaction-service/transaction.test.js +28 -11
  59. package/node/wrappers/services/transaction-service/transaction.test.js.map +1 -1
  60. package/node/wrappers/services/transaction-service/transaction.test.ts +23 -13
  61. package/package.json +2 -1
  62. package/web/fintekkers/requests/transaction/query_transaction_request_pb.d.ts +4 -0
  63. package/web/fintekkers/requests/transaction/query_transaction_request_pb.js +31 -1
  64. package/web/fintekkers/requests/transaction/query_transaction_response_pb.d.ts +7 -0
  65. package/web/fintekkers/requests/transaction/query_transaction_response_pb.js +54 -1
  66. package/node/wrappers/models/utils/util.js +0 -28
  67. package/node/wrappers/models/utils/util.js.map +0 -1
  68. package/node/wrappers/models/utils/util.ts +0 -28
@@ -17,11 +17,12 @@ import { TransactionService } from './TransactionService';
17
17
  import Transaction from '../../models/transaction/transaction';
18
18
  import { CreateTransactionResponseProto } from '../../../fintekkers/requests/transaction/create_transaction_response_pb';
19
19
 
20
- test('test creating a transaction against the api.fintekkers.org portfolio service', () => {
21
- const isTrue = testTransaction();
22
- expect(isTrue).resolves.toBe(true);
23
- }, 30000);
20
+ import assert = require("assert");
24
21
 
22
+ test('test creating a transaction against the portfolio service', async () => {
23
+ const isTrue = await testTransaction();
24
+ expect(isTrue).toBe(true);
25
+ }, 30000);
25
26
 
26
27
  async function testTransaction(): Promise<boolean> {
27
28
  const id_proto = uuid.UUID.random().toUUIDProto();
@@ -33,15 +34,15 @@ async function testTransaction(): Promise<boolean> {
33
34
  const transactionService = new TransactionService();
34
35
 
35
36
  let fixedIncomeSecurities = await securityService
36
- .searchSecurity(now.to_date_proto(), FieldProto.ASSET_CLASS, 'Fixed Income')
37
- .then((fixedIncomeSecurities) => {
38
- return fixedIncomeSecurities;
39
- });
37
+ .searchSecurity(now.toProto(), FieldProto.ASSET_CLASS, 'Fixed Income')
38
+ .then((fixedIncomeSecurities) => {
39
+ return fixedIncomeSecurities;
40
+ });
40
41
 
41
42
  let security = fixedIncomeSecurities[0];
42
43
 
43
44
  let portfolios = await portfolioService.searchPortfolio(
44
- now.to_date_proto(),
45
+ now.toProto(),
45
46
  FieldProto.PORTFOLIO_NAME,
46
47
  'TEST PORTFOLIO');
47
48
 
@@ -59,14 +60,14 @@ async function testTransaction(): Promise<boolean> {
59
60
  transaction.setObjectClass('Transaction');
60
61
  transaction.setVersion('0.0.1');
61
62
  transaction.setUuid(uuid.UUID.random().toUUIDProto());
62
- transaction.setAsOf(now.to_date_proto());
63
+ transaction.setAsOf(now.toProto());
63
64
  transaction.setTradeDate(today);
64
65
  transaction.setSettlementDate(today); //Same day settlement
65
66
  transaction.setTransactionType(TransactionTypeProto.BUY);
66
67
  transaction.setPrice(
67
68
  new PriceProto()
68
69
  .setObjectClass('Price')
69
- .setAsOf(now.to_date_proto())
70
+ .setAsOf(now.toProto())
70
71
  .setVersion('0.0.1')
71
72
  .setSecurity(security.proto)
72
73
  .setUuid(uuid.UUID.random().toUUIDProto())
@@ -77,11 +78,20 @@ async function testTransaction(): Promise<boolean> {
77
78
  transaction.setSecurity(security.proto);
78
79
 
79
80
  // var validationSummary = await transactionService.validateCreateTransaction(new Transaction(transaction));
80
- // console.log(validationSummary);
81
+ // assert(validationSummary.getErrorsList().length == 0, "Validation errors found");
81
82
 
82
83
  var createTransactionResponse:CreateTransactionResponseProto = await transactionService.createTransaction(new Transaction(transaction));
84
+ const transactionResponse = createTransactionResponse.getTransactionResponse();
85
+ assert(transactionResponse, "No transaction response found");
83
86
 
84
- var searchResults = await transactionService.searchTransaction(now.to_date_proto(), FieldProto.ASSET_CLASS, 'Fixed Income');
87
+ // transactionService.addListener(transactionListener);
88
+ const transactions = await transactionService.searchTransaction(now.toProto(), FieldProto.ASSET_CLASS, 'Fixed Income');
89
+
90
+ if(transactions === undefined) {
91
+ console.log('No transactions found');
92
+ } else {
93
+ console.log(transactions.length);
94
+ }
85
95
 
86
96
  return true;
87
97
  }
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.61",
4
+ "version": "0.1.62",
5
5
  "description": "ledger model protos ",
6
6
  "authors": [
7
7
  "David Doherty",
@@ -35,6 +35,7 @@
35
35
  "@grpc/grpc-js": "^1.8.18",
36
36
  "bytebuffer": "^5.0.1",
37
37
  "decimal.js": "^10.4.3",
38
+ "dotenv": "^16.3.1",
38
39
  "luxon": "^3.3.0",
39
40
  "uuid": "^9.0.0"
40
41
  }
@@ -27,6 +27,9 @@ export class QueryTransactionRequestProto extends jspb.Message {
27
27
  hasAsOf(): boolean;
28
28
  clearAsOf(): QueryTransactionRequestProto;
29
29
 
30
+ getLimit(): number;
31
+ setLimit(value: number): QueryTransactionRequestProto;
32
+
30
33
  serializeBinary(): Uint8Array;
31
34
  toObject(includeInstance?: boolean): QueryTransactionRequestProto.AsObject;
32
35
  static toObject(includeInstance: boolean, msg: QueryTransactionRequestProto): QueryTransactionRequestProto.AsObject;
@@ -42,6 +45,7 @@ export namespace QueryTransactionRequestProto {
42
45
  uuidsList: Array<fintekkers_models_util_uuid_pb.UUIDProto.AsObject>,
43
46
  searchTransactionInput?: fintekkers_models_position_position_filter_pb.PositionFilterProto.AsObject,
44
47
  asOf?: fintekkers_models_util_local_timestamp_pb.LocalTimestampProto.AsObject,
48
+ limit: number,
45
49
  }
46
50
  }
47
51
 
@@ -87,7 +87,8 @@ proto.fintekkers.requests.transaction.QueryTransactionRequestProto.toObject = fu
87
87
  uuidsList: jspb.Message.toObjectList(msg.getUuidsList(),
88
88
  fintekkers_models_util_uuid_pb.UUIDProto.toObject, includeInstance),
89
89
  searchTransactionInput: (f = msg.getSearchTransactionInput()) && fintekkers_models_position_position_filter_pb.PositionFilterProto.toObject(includeInstance, f),
90
- asOf: (f = msg.getAsOf()) && fintekkers_models_util_local_timestamp_pb.LocalTimestampProto.toObject(includeInstance, f)
90
+ asOf: (f = msg.getAsOf()) && fintekkers_models_util_local_timestamp_pb.LocalTimestampProto.toObject(includeInstance, f),
91
+ limit: jspb.Message.getFieldWithDefault(msg, 24, 0)
91
92
  };
92
93
 
93
94
  if (includeInstance) {
@@ -147,6 +148,10 @@ proto.fintekkers.requests.transaction.QueryTransactionRequestProto.deserializeBi
147
148
  reader.readMessage(value,fintekkers_models_util_local_timestamp_pb.LocalTimestampProto.deserializeBinaryFromReader);
148
149
  msg.setAsOf(value);
149
150
  break;
151
+ case 24:
152
+ var value = /** @type {number} */ (reader.readInt32());
153
+ msg.setLimit(value);
154
+ break;
150
155
  default:
151
156
  reader.skipField();
152
157
  break;
@@ -214,6 +219,13 @@ proto.fintekkers.requests.transaction.QueryTransactionRequestProto.serializeBina
214
219
  fintekkers_models_util_local_timestamp_pb.LocalTimestampProto.serializeBinaryToWriter
215
220
  );
216
221
  }
222
+ f = message.getLimit();
223
+ if (f !== 0) {
224
+ writer.writeInt32(
225
+ 24,
226
+ f
227
+ );
228
+ }
217
229
  };
218
230
 
219
231
 
@@ -365,4 +377,22 @@ proto.fintekkers.requests.transaction.QueryTransactionRequestProto.prototype.has
365
377
  };
366
378
 
367
379
 
380
+ /**
381
+ * optional int32 limit = 24;
382
+ * @return {number}
383
+ */
384
+ proto.fintekkers.requests.transaction.QueryTransactionRequestProto.prototype.getLimit = function() {
385
+ return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 24, 0));
386
+ };
387
+
388
+
389
+ /**
390
+ * @param {number} value
391
+ * @return {!proto.fintekkers.requests.transaction.QueryTransactionRequestProto} returns this
392
+ */
393
+ proto.fintekkers.requests.transaction.QueryTransactionRequestProto.prototype.setLimit = function(value) {
394
+ return jspb.Message.setProto3IntField(this, 24, value);
395
+ };
396
+
397
+
368
398
  goog.object.extend(exports, proto.fintekkers.requests.transaction);
@@ -2,6 +2,7 @@ import * as jspb from 'google-protobuf'
2
2
 
3
3
  import * as fintekkers_models_transaction_transaction_pb from '../../../fintekkers/models/transaction/transaction_pb';
4
4
  import * as fintekkers_requests_transaction_query_transaction_request_pb from '../../../fintekkers/requests/transaction/query_transaction_request_pb';
5
+ import * as fintekkers_requests_util_errors_summary_pb from '../../../fintekkers/requests/util/errors/summary_pb';
5
6
 
6
7
 
7
8
  export class QueryTransactionResponseProto extends jspb.Message {
@@ -21,6 +22,11 @@ export class QueryTransactionResponseProto extends jspb.Message {
21
22
  clearTransactionResponseList(): QueryTransactionResponseProto;
22
23
  addTransactionResponse(value?: fintekkers_models_transaction_transaction_pb.TransactionProto, index?: number): fintekkers_models_transaction_transaction_pb.TransactionProto;
23
24
 
25
+ getErrorsOrWarnings(): fintekkers_requests_util_errors_summary_pb.SummaryProto | undefined;
26
+ setErrorsOrWarnings(value?: fintekkers_requests_util_errors_summary_pb.SummaryProto): QueryTransactionResponseProto;
27
+ hasErrorsOrWarnings(): boolean;
28
+ clearErrorsOrWarnings(): QueryTransactionResponseProto;
29
+
24
30
  serializeBinary(): Uint8Array;
25
31
  toObject(includeInstance?: boolean): QueryTransactionResponseProto.AsObject;
26
32
  static toObject(includeInstance: boolean, msg: QueryTransactionResponseProto): QueryTransactionResponseProto.AsObject;
@@ -35,6 +41,7 @@ export namespace QueryTransactionResponseProto {
35
41
  version: string,
36
42
  createTransactionRequest?: fintekkers_requests_transaction_query_transaction_request_pb.QueryTransactionRequestProto.AsObject,
37
43
  transactionResponseList: Array<fintekkers_models_transaction_transaction_pb.TransactionProto.AsObject>,
44
+ errorsOrWarnings?: fintekkers_requests_util_errors_summary_pb.SummaryProto.AsObject,
38
45
  }
39
46
  }
40
47
 
@@ -19,6 +19,8 @@ var fintekkers_models_transaction_transaction_pb = require('../../../fintekkers/
19
19
  goog.object.extend(proto, fintekkers_models_transaction_transaction_pb);
20
20
  var fintekkers_requests_transaction_query_transaction_request_pb = require('../../../fintekkers/requests/transaction/query_transaction_request_pb.js');
21
21
  goog.object.extend(proto, fintekkers_requests_transaction_query_transaction_request_pb);
22
+ var fintekkers_requests_util_errors_summary_pb = require('../../../fintekkers/requests/util/errors/summary_pb.js');
23
+ goog.object.extend(proto, fintekkers_requests_util_errors_summary_pb);
22
24
  goog.exportSymbol('proto.fintekkers.requests.transaction.QueryTransactionResponseProto', null, global);
23
25
  /**
24
26
  * Generated by JsPbCodeGenerator.
@@ -84,7 +86,8 @@ proto.fintekkers.requests.transaction.QueryTransactionResponseProto.toObject = f
84
86
  version: jspb.Message.getFieldWithDefault(msg, 2, ""),
85
87
  createTransactionRequest: (f = msg.getCreateTransactionRequest()) && fintekkers_requests_transaction_query_transaction_request_pb.QueryTransactionRequestProto.toObject(includeInstance, f),
86
88
  transactionResponseList: jspb.Message.toObjectList(msg.getTransactionResponseList(),
87
- fintekkers_models_transaction_transaction_pb.TransactionProto.toObject, includeInstance)
89
+ fintekkers_models_transaction_transaction_pb.TransactionProto.toObject, includeInstance),
90
+ errorsOrWarnings: (f = msg.getErrorsOrWarnings()) && fintekkers_requests_util_errors_summary_pb.SummaryProto.toObject(includeInstance, f)
88
91
  };
89
92
 
90
93
  if (includeInstance) {
@@ -139,6 +142,11 @@ proto.fintekkers.requests.transaction.QueryTransactionResponseProto.deserializeB
139
142
  reader.readMessage(value,fintekkers_models_transaction_transaction_pb.TransactionProto.deserializeBinaryFromReader);
140
143
  msg.addTransactionResponse(value);
141
144
  break;
145
+ case 40:
146
+ var value = new fintekkers_requests_util_errors_summary_pb.SummaryProto;
147
+ reader.readMessage(value,fintekkers_requests_util_errors_summary_pb.SummaryProto.deserializeBinaryFromReader);
148
+ msg.setErrorsOrWarnings(value);
149
+ break;
142
150
  default:
143
151
  reader.skipField();
144
152
  break;
@@ -198,6 +206,14 @@ proto.fintekkers.requests.transaction.QueryTransactionResponseProto.serializeBin
198
206
  fintekkers_models_transaction_transaction_pb.TransactionProto.serializeBinaryToWriter
199
207
  );
200
208
  }
209
+ f = message.getErrorsOrWarnings();
210
+ if (f != null) {
211
+ writer.writeMessage(
212
+ 40,
213
+ f,
214
+ fintekkers_requests_util_errors_summary_pb.SummaryProto.serializeBinaryToWriter
215
+ );
216
+ }
201
217
  };
202
218
 
203
219
 
@@ -312,4 +328,41 @@ proto.fintekkers.requests.transaction.QueryTransactionResponseProto.prototype.cl
312
328
  };
313
329
 
314
330
 
331
+ /**
332
+ * optional fintekkers.requests.util.errors.SummaryProto errors_or_warnings = 40;
333
+ * @return {?proto.fintekkers.requests.util.errors.SummaryProto}
334
+ */
335
+ proto.fintekkers.requests.transaction.QueryTransactionResponseProto.prototype.getErrorsOrWarnings = function() {
336
+ return /** @type{?proto.fintekkers.requests.util.errors.SummaryProto} */ (
337
+ jspb.Message.getWrapperField(this, fintekkers_requests_util_errors_summary_pb.SummaryProto, 40));
338
+ };
339
+
340
+
341
+ /**
342
+ * @param {?proto.fintekkers.requests.util.errors.SummaryProto|undefined} value
343
+ * @return {!proto.fintekkers.requests.transaction.QueryTransactionResponseProto} returns this
344
+ */
345
+ proto.fintekkers.requests.transaction.QueryTransactionResponseProto.prototype.setErrorsOrWarnings = function(value) {
346
+ return jspb.Message.setWrapperField(this, 40, value);
347
+ };
348
+
349
+
350
+ /**
351
+ * Clears the message field making it undefined.
352
+ * @return {!proto.fintekkers.requests.transaction.QueryTransactionResponseProto} returns this
353
+ */
354
+ proto.fintekkers.requests.transaction.QueryTransactionResponseProto.prototype.clearErrorsOrWarnings = function() {
355
+ return this.setErrorsOrWarnings(undefined);
356
+ };
357
+
358
+
359
+ /**
360
+ * Returns whether this field is set.
361
+ * @return {boolean}
362
+ */
363
+ proto.fintekkers.requests.transaction.QueryTransactionResponseProto.prototype.hasErrorsOrWarnings = function() {
364
+ return jspb.Message.getField(this, 40) != null;
365
+ };
366
+
367
+
315
368
  goog.object.extend(exports, proto.fintekkers.requests.transaction);
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createFieldMapEntry = exports.packStringIntoAny = void 0;
4
- var position_util_pb_1 = require("../../../fintekkers/models/position/position_util_pb");
5
- var any_pb_1 = require("google-protobuf/google/protobuf/any_pb");
6
- var wrappers_pb_1 = require("google-protobuf/google/protobuf/wrappers_pb");
7
- function packStringIntoAny(inputString) {
8
- // First, create a StringValue wrapper around the string
9
- var stringValue = new wrappers_pb_1.StringValue();
10
- stringValue.setValue(inputString);
11
- // Next, create an Any message and pack the StringValue into it
12
- var anyMessage = new any_pb_1.Any();
13
- anyMessage.pack(stringValue.serializeBinary(), 'type.googleapis.com/google.protobuf.StringValue');
14
- return anyMessage;
15
- }
16
- exports.packStringIntoAny = packStringIntoAny;
17
- /**
18
- * @param {*} field FieldProto.ASSET_CLASS, as an example
19
- * @param {*} fieldValue The appropriate value for the FieldProto, e.g. FieldProto.ASSET_CLASS would have a string fieldValue
20
- */
21
- function createFieldMapEntry(field, fieldValue) {
22
- var fieldMapEntry = new position_util_pb_1.FieldMapEntry();
23
- fieldMapEntry.setField(field); //FieldProto.ASSET_CLASS);
24
- fieldMapEntry.setFieldValuePacked(packStringIntoAny(fieldValue)); //"Cash"));
25
- return fieldMapEntry;
26
- }
27
- exports.createFieldMapEntry = createFieldMapEntry;
28
- //# sourceMappingURL=util.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"util.js","sourceRoot":"","sources":["util.ts"],"names":[],"mappings":";;;AAAA,yFAAqF;AACrF,iEAA6D;AAC7D,2EAA0E;AAE1E,SAAS,iBAAiB,CAAC,WAAmB;IAC5C,wDAAwD;IACxD,IAAM,WAAW,GAAG,IAAI,yBAAW,EAAE,CAAC;IACtC,WAAW,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IAElC,+DAA+D;IAC/D,IAAM,UAAU,GAAG,IAAI,YAAG,EAAE,CAAC;IAC7B,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,eAAe,EAAE,EAAE,iDAAiD,CAAC,CAAC;IAElG,OAAO,UAAU,CAAC;AACpB,CAAC;AAaQ,8CAAiB;AAX1B;;;GAGG;AACH,SAAS,mBAAmB,CAAC,KAAa,EAAE,UAAkB;IAC5D,IAAM,aAAa,GAAG,IAAI,gCAAa,EAAE,CAAC;IAC1C,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,0BAA0B;IACzD,aAAa,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,WAAW;IAC7E,OAAO,aAAa,CAAC;AACvB,CAAC;AAE2B,kDAAmB"}
@@ -1,28 +0,0 @@
1
- import { FieldMapEntry } from '../../../fintekkers/models/position/position_util_pb';
2
- import { Any } from 'google-protobuf/google/protobuf/any_pb';
3
- import { StringValue } from 'google-protobuf/google/protobuf/wrappers_pb';
4
-
5
- function packStringIntoAny(inputString: string): Any {
6
- // First, create a StringValue wrapper around the string
7
- const stringValue = new StringValue();
8
- stringValue.setValue(inputString);
9
-
10
- // Next, create an Any message and pack the StringValue into it
11
- const anyMessage = new Any();
12
- anyMessage.pack(stringValue.serializeBinary(), 'type.googleapis.com/google.protobuf.StringValue');
13
-
14
- return anyMessage;
15
- }
16
-
17
- /**
18
- * @param {*} field FieldProto.ASSET_CLASS, as an example
19
- * @param {*} fieldValue The appropriate value for the FieldProto, e.g. FieldProto.ASSET_CLASS would have a string fieldValue
20
- */
21
- function createFieldMapEntry(field: number, fieldValue: string): FieldMapEntry {
22
- const fieldMapEntry = new FieldMapEntry();
23
- fieldMapEntry.setField(field); //FieldProto.ASSET_CLASS);
24
- fieldMapEntry.setFieldValuePacked(packStringIntoAny(fieldValue)); //"Cash"));
25
- return fieldMapEntry;
26
- }
27
-
28
- export { packStringIntoAny, createFieldMapEntry };