@fintekkers/ledger-models 0.1.95 → 0.1.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/node/fintekkers/models/portfolio/portfolio_grpc_pb.js +1 -0
- package/node/fintekkers/models/position/field_grpc_pb.js +1 -0
- package/node/fintekkers/models/position/measure_grpc_pb.js +1 -0
- package/node/fintekkers/models/position/position_filter_grpc_pb.js +1 -0
- package/node/fintekkers/models/position/position_grpc_pb.js +1 -0
- package/node/fintekkers/models/position/position_status_grpc_pb.js +1 -0
- package/node/fintekkers/models/position/position_util_grpc_pb.js +1 -0
- package/node/fintekkers/models/price/price_grpc_pb.js +1 -0
- package/node/fintekkers/models/security/bond/auction_type_grpc_pb.js +1 -0
- package/node/fintekkers/models/security/bond/issuance_grpc_pb.js +1 -0
- package/node/fintekkers/models/security/coupon_frequency_grpc_pb.js +1 -0
- package/node/fintekkers/models/security/coupon_type_grpc_pb.js +1 -0
- package/node/fintekkers/models/security/identifier/identifier_grpc_pb.js +1 -0
- package/node/fintekkers/models/security/identifier/identifier_type_grpc_pb.js +1 -0
- package/node/fintekkers/models/security/security_grpc_pb.js +1 -0
- package/node/fintekkers/models/security/security_pb.test.d.ts +1 -0
- package/node/fintekkers/models/security/security_pb.test.js +10 -10
- package/node/fintekkers/models/security/security_pb.test.js.map +1 -1
- package/node/fintekkers/models/security/security_quantity_type_grpc_pb.js +1 -0
- package/node/fintekkers/models/security/security_type_grpc_pb.js +1 -0
- package/node/fintekkers/models/security/tenor_grpc_pb.js +1 -0
- package/node/fintekkers/models/security/tenor_type_grpc_pb.js +1 -0
- package/node/fintekkers/models/strategy/strategy_allocation_grpc_pb.js +1 -0
- package/node/fintekkers/models/strategy/strategy_grpc_pb.js +1 -0
- package/node/fintekkers/models/transaction/transaction_grpc_pb.js +1 -0
- package/node/fintekkers/models/transaction/transaction_type_grpc_pb.js +1 -0
- package/node/fintekkers/models/util/api/api_key_grpc_pb.js +1 -0
- package/node/fintekkers/models/util/date_range_grpc_pb.js +1 -0
- package/node/fintekkers/models/util/date_range_pb.d.ts +43 -0
- package/node/fintekkers/models/util/date_range_pb.js +310 -0
- package/node/fintekkers/models/util/decimal_value_grpc_pb.js +1 -0
- package/node/fintekkers/models/util/endpoint_grpc_pb.js +1 -0
- package/node/fintekkers/models/util/local_date_grpc_pb.js +1 -0
- package/node/fintekkers/models/util/local_timestamp_grpc_pb.js +1 -0
- package/node/fintekkers/models/util/lock/node_partition_grpc_pb.js +1 -0
- package/node/fintekkers/models/util/lock/node_state_grpc_pb.js +1 -0
- package/node/fintekkers/models/util/uuid_grpc_pb.js +1 -0
- package/node/fintekkers/requests/portfolio/create_portfolio_request_grpc_pb.js +1 -0
- package/node/fintekkers/requests/portfolio/create_portfolio_response_grpc_pb.js +1 -0
- package/node/fintekkers/requests/portfolio/query_portfolio_request_grpc_pb.js +1 -0
- package/node/fintekkers/requests/portfolio/query_portfolio_response_grpc_pb.js +1 -0
- package/node/fintekkers/requests/position/query_position_request_grpc_pb.js +1 -0
- package/node/fintekkers/requests/position/query_position_response_grpc_pb.js +1 -0
- package/node/fintekkers/requests/price/create_price_request_grpc_pb.js +1 -0
- package/node/fintekkers/requests/price/create_price_response_grpc_pb.js +1 -0
- package/node/fintekkers/requests/price/query_price_request_grpc_pb.js +1 -0
- package/node/fintekkers/requests/price/query_price_request_pb.d.ts +47 -0
- package/node/fintekkers/requests/price/query_price_request_pb.js +190 -2
- package/node/fintekkers/requests/price/query_price_response_grpc_pb.js +1 -0
- package/node/fintekkers/requests/security/create_security_request_grpc_pb.js +1 -0
- package/node/fintekkers/requests/security/create_security_response_grpc_pb.js +1 -0
- package/node/fintekkers/requests/security/get_field_values_request_grpc_pb.js +1 -0
- package/node/fintekkers/requests/security/get_field_values_request_pb.js +238 -0
- package/node/fintekkers/requests/security/get_field_values_response_grpc_pb.js +1 -0
- package/node/fintekkers/requests/security/get_field_values_response_pb.js +268 -0
- package/node/fintekkers/requests/security/get_fields_response_grpc_pb.js +1 -0
- package/node/fintekkers/requests/security/get_fields_response_pb.js +266 -0
- package/node/fintekkers/requests/security/query_security_request_grpc_pb.js +1 -0
- package/node/fintekkers/requests/security/query_security_response_grpc_pb.js +1 -0
- package/node/fintekkers/requests/transaction/create_transaction_request_grpc_pb.js +1 -0
- package/node/fintekkers/requests/transaction/create_transaction_response_grpc_pb.js +1 -0
- package/node/fintekkers/requests/transaction/query_transaction_request_grpc_pb.js +1 -0
- package/node/fintekkers/requests/transaction/query_transaction_response_grpc_pb.js +1 -0
- package/node/fintekkers/requests/util/errors/error_grpc_pb.js +1 -0
- package/node/fintekkers/requests/util/errors/message_grpc_pb.js +1 -0
- package/node/fintekkers/requests/util/errors/summary_grpc_pb.js +1 -0
- package/node/fintekkers/requests/util/lock/lock_request_grpc_pb.js +1 -0
- package/node/fintekkers/requests/util/lock/lock_request_pb.js +54 -1
- package/node/fintekkers/requests/util/lock/lock_response_grpc_pb.js +1 -0
- package/node/fintekkers/requests/util/operation_grpc_pb.js +1 -0
- package/node/fintekkers/requests/valuation/valuation_request_grpc_pb.js +1 -0
- package/node/fintekkers/requests/valuation/valuation_response_grpc_pb.js +1 -0
- package/node/wrappers/models/portfolio/portfolio.d.ts +15 -0
- package/node/wrappers/models/portfolio/portfolio.js +26 -21
- package/node/wrappers/models/portfolio/portfolio.js.map +1 -1
- package/node/wrappers/models/portfolio/portfolio.ts +6 -2
- package/node/wrappers/models/position/field.d.ts +7 -0
- package/node/wrappers/models/position/field.js +10 -14
- package/node/wrappers/models/position/field.js.map +1 -1
- package/node/wrappers/models/position/field.test.d.ts +1 -0
- package/node/wrappers/models/position/field.test.js +10 -48
- package/node/wrappers/models/position/field.test.js.map +1 -1
- package/node/wrappers/models/position/field.ts +1 -2
- package/node/wrappers/models/position/position.d.ts +32 -0
- package/node/wrappers/models/position/position.js +89 -83
- package/node/wrappers/models/position/position.js.map +1 -1
- package/node/wrappers/models/position/position.test.d.ts +1 -0
- package/node/wrappers/models/position/position.test.js +128 -198
- package/node/wrappers/models/position/position.test.js.map +1 -1
- package/node/wrappers/models/position/position.test.ts +1 -1
- package/node/wrappers/models/position/position.ts +19 -12
- package/node/wrappers/models/position/positionfilter.d.ts +24 -0
- package/node/wrappers/models/position/positionfilter.js +19 -20
- package/node/wrappers/models/position/positionfilter.js.map +1 -1
- package/node/wrappers/models/position/positionfilter.ts +1 -1
- package/node/wrappers/models/security/security.d.ts +23 -0
- package/node/wrappers/models/security/security.js +55 -44
- package/node/wrappers/models/security/security.js.map +1 -1
- package/node/wrappers/models/security/security.test.d.ts +1 -0
- package/node/wrappers/models/security/security.test.js +14 -11
- package/node/wrappers/models/security/security.test.js.map +1 -1
- package/node/wrappers/models/security/security.ts +13 -6
- package/node/wrappers/models/transaction/transaction.d.ts +36 -0
- package/node/wrappers/models/transaction/transaction.js +98 -68
- package/node/wrappers/models/transaction/transaction.js.map +1 -1
- package/node/wrappers/models/transaction/transaction.test.d.ts +1 -0
- package/node/wrappers/models/transaction/transaction.test.js +12 -9
- package/node/wrappers/models/transaction/transaction.test.js.map +1 -1
- package/node/wrappers/models/transaction/transaction.ts +30 -12
- package/node/wrappers/models/transaction/transaction_type.d.ts +17 -0
- package/node/wrappers/models/transaction/transaction_type.js +12 -12
- package/node/wrappers/models/transaction/transaction_type.js.map +1 -1
- package/node/wrappers/models/transaction/transaction_type.ts +5 -5
- package/node/wrappers/models/utils/date.d.ts +11 -0
- package/node/wrappers/models/utils/date.js +16 -17
- package/node/wrappers/models/utils/date.js.map +1 -1
- package/node/wrappers/models/utils/date.test.d.ts +1 -0
- package/node/wrappers/models/utils/date.test.js +28 -58
- package/node/wrappers/models/utils/date.test.js.map +1 -1
- package/node/wrappers/models/utils/date.ts +1 -1
- package/node/wrappers/models/utils/datetime.d.ts +14 -0
- package/node/wrappers/models/utils/datetime.js +41 -34
- package/node/wrappers/models/utils/datetime.js.map +1 -1
- package/node/wrappers/models/utils/datetime.test.d.ts +1 -0
- package/node/wrappers/models/utils/datetime.test.js +40 -70
- package/node/wrappers/models/utils/datetime.test.js.map +1 -1
- package/node/wrappers/models/utils/datetime.ts +13 -8
- package/node/wrappers/models/utils/protoEnum.d.ts +12 -0
- package/node/wrappers/models/utils/protoEnum.js +22 -24
- package/node/wrappers/models/utils/protoEnum.js.map +1 -1
- package/node/wrappers/models/utils/protoEnum.test.d.ts +1 -0
- package/node/wrappers/models/utils/protoEnum.test.js +13 -13
- package/node/wrappers/models/utils/protoEnum.test.js.map +1 -1
- package/node/wrappers/models/utils/requestcontext.d.ts +13 -0
- package/node/wrappers/models/utils/requestcontext.js +52 -44
- package/node/wrappers/models/utils/requestcontext.js.map +1 -1
- package/node/wrappers/models/utils/requestcontext.ts +15 -15
- package/node/wrappers/models/utils/requestcontext_d.d.ts +6 -0
- package/node/wrappers/models/utils/requestcontext_d.js +1 -0
- package/node/wrappers/models/utils/serialization.d.ts +12 -0
- package/node/wrappers/models/utils/serialization.js +19 -22
- package/node/wrappers/models/utils/serialization.js.map +1 -1
- package/node/wrappers/models/utils/serialization.test.d.ts +1 -0
- package/node/wrappers/models/utils/serialization.test.js +14 -14
- package/node/wrappers/models/utils/serialization.test.js.map +1 -1
- package/node/wrappers/models/utils/serialization.ts +1 -1
- package/node/wrappers/models/utils/serialization.util.d.ts +4 -0
- package/node/wrappers/models/utils/serialization.util.js +25 -25
- package/node/wrappers/models/utils/serialization.util.js.map +1 -1
- package/node/wrappers/models/utils/serialization.util.test.d.ts +1 -0
- package/node/wrappers/models/utils/serialization.util.test.js +15 -15
- package/node/wrappers/models/utils/serialization.util.test.js.map +1 -1
- package/node/wrappers/models/utils/serialization.util.ts +5 -5
- package/node/wrappers/models/utils/uuid.d.ts +13 -0
- package/node/wrappers/models/utils/uuid.js +53 -31
- package/node/wrappers/models/utils/uuid.js.map +1 -1
- package/node/wrappers/models/utils/uuid.test.d.ts +1 -0
- package/node/wrappers/models/utils/uuid.test.js +7 -7
- package/node/wrappers/models/utils/uuid.test.js.map +1 -1
- package/node/wrappers/models/utils/uuid.ts +1 -1
- package/node/wrappers/requests/position/QueryPositionRequest.d.ts +19 -0
- package/node/wrappers/requests/position/QueryPositionRequest.js +19 -20
- package/node/wrappers/requests/position/QueryPositionRequest.js.map +1 -1
- package/node/wrappers/services/portfolio-service/PortfolioService.d.ts +15 -0
- package/node/wrappers/services/portfolio-service/PortfolioService.js +58 -109
- package/node/wrappers/services/portfolio-service/PortfolioService.js.map +1 -1
- package/node/wrappers/services/portfolio-service/PortfolioService.ts +2 -2
- package/node/wrappers/services/portfolio-service/portfolioService.test.d.ts +1 -0
- package/node/wrappers/services/portfolio-service/portfolioService.test.js +47 -64
- package/node/wrappers/services/portfolio-service/portfolioService.test.js.map +1 -1
- package/node/wrappers/services/position-service/PositionService.d.ts +10 -0
- package/node/wrappers/services/position-service/PositionService.js +45 -83
- package/node/wrappers/services/position-service/PositionService.js.map +1 -1
- package/node/wrappers/services/position-service/position.test.d.ts +1 -0
- package/node/wrappers/services/position-service/position.test.js +52 -118
- package/node/wrappers/services/position-service/position.test.js.map +1 -1
- package/node/wrappers/services/position-service/position.test.ts +7 -1
- package/node/wrappers/services/security-service/SecurityService.d.ts +15 -0
- package/node/wrappers/services/security-service/SecurityService.js +86 -117
- package/node/wrappers/services/security-service/SecurityService.js.map +1 -1
- package/node/wrappers/services/security-service/SecurityService.ts +2 -2
- package/node/wrappers/services/security-service/security.maturityLadder.test.d.ts +1 -0
- package/node/wrappers/services/security-service/security.maturityLadder.test.js +40 -75
- package/node/wrappers/services/security-service/security.maturityLadder.test.js.map +1 -1
- package/node/wrappers/services/security-service/security.maturityLadder.test.ts +1 -1
- package/node/wrappers/services/security-service/security.test.d.ts +1 -0
- package/node/wrappers/services/security-service/security.test.js +88 -114
- package/node/wrappers/services/security-service/security.test.js.map +1 -1
- package/node/wrappers/services/security-service/security.test.ts +2 -2
- package/node/wrappers/services/transaction-service/TransactionService.d.ts +13 -0
- package/node/wrappers/services/transaction-service/TransactionService.js +53 -98
- package/node/wrappers/services/transaction-service/TransactionService.js.map +1 -1
- package/node/wrappers/services/transaction-service/TransactionService.ts +2 -2
- package/node/wrappers/services/transaction-service/transaction.search.test.d.ts +1 -0
- package/node/wrappers/services/transaction-service/transaction.search.test.js +51 -70
- package/node/wrappers/services/transaction-service/transaction.search.test.js.map +1 -1
- package/node/wrappers/services/transaction-service/transaction.test.d.ts +1 -0
- package/node/wrappers/services/transaction-service/transaction.test.js +127 -171
- package/node/wrappers/services/transaction-service/transaction.test.js.map +1 -1
- package/node/wrappers/services/transaction-service/transaction.test.ts +3 -1
- package/package.json +4 -1
- package/tsconfig.json +15 -6
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
test('test serialization of key types',
|
|
3
|
+
const serialization_1 = require("./serialization");
|
|
4
|
+
const uuid_1 = require("./uuid");
|
|
5
|
+
const assert = require("assert");
|
|
6
|
+
test('test serialization of key types', () => {
|
|
7
7
|
testSerialization();
|
|
8
8
|
});
|
|
9
9
|
function testSerialization() {
|
|
10
10
|
checkUUID();
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
const march2023 = new Date(2023, 2, 5); //Month is zero-indexed, so 2 == March.
|
|
12
|
+
const serializedDate = serialization_1.ProtoSerializationUtil.serialize(march2023);
|
|
13
13
|
assert(serializedDate.toString().indexOf('2023,3,5') > -1);
|
|
14
|
-
|
|
14
|
+
const deserializedDate = serialization_1.ProtoSerializationUtil.deserialize(serializedDate);
|
|
15
15
|
assert(deserializedDate.toString().indexOf('Mar 05 2023') > -1);
|
|
16
|
-
|
|
16
|
+
const serializedTimestamp = serialization_1.ProtoSerializationUtil.serialize(march2023);
|
|
17
17
|
assert(serializedTimestamp.toString().indexOf('2023,3,5') > -1);
|
|
18
|
-
|
|
18
|
+
const deserializedTimestamp = serialization_1.ProtoSerializationUtil.deserialize(serializedTimestamp);
|
|
19
19
|
assert(deserializedTimestamp.toString().indexOf('Mar 05 2023') > -1);
|
|
20
20
|
}
|
|
21
21
|
function checkUUID() {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
const uuid = uuid_1.UUID.random();
|
|
23
|
+
const serializedUUID = serialization_1.ProtoSerializationUtil.serialize(uuid);
|
|
24
|
+
const uuidCopy = serialization_1.ProtoSerializationUtil.deserialize(serializedUUID);
|
|
25
|
+
const uuidString = uuid.toString();
|
|
26
|
+
const uuidCopyString = uuidCopy.toString();
|
|
27
27
|
assert.equal(uuidString, uuidCopyString);
|
|
28
28
|
assert.deepEqual(uuid.toBytes(), uuidCopy.toBytes());
|
|
29
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialization.test.js","sourceRoot":"","sources":["serialization.test.ts"],"names":[],"mappings":";;AAEA,
|
|
1
|
+
{"version":3,"file":"serialization.test.js","sourceRoot":"","sources":["serialization.test.ts"],"names":[],"mappings":";;AAEA,mDAAyD;AACzD,iCAA8B;AAE9B,iCAAkC;AAClC,IAAI,CAAC,iCAAiC,EAAE,GAAG,EAAE;IACzC,iBAAiB,EAAE,CAAC;AACxB,CAAC,CAAC,CAAC;AAEH,SAAS,iBAAiB;IACtB,SAAS,EAAE,CAAC;IAEZ,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,uCAAuC;IAC/E,MAAM,cAAc,GAAQ,sCAAsB,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IACxE,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAE3D,MAAM,gBAAgB,GAAQ,sCAAsB,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IACjF,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAEhE,MAAM,mBAAmB,GAAQ,sCAAsB,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7E,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAEhE,MAAM,qBAAqB,GAAQ,sCAAsB,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;IAC3F,MAAM,CAAC,qBAAqB,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACzE,CAAC;AAED,SAAS,SAAS;IACd,MAAM,IAAI,GAAS,WAAI,CAAC,MAAM,EAAE,CAAC;IACjC,MAAM,cAAc,GAAc,sCAAsB,CAAC,SAAS,CAAC,IAAI,CAAc,CAAC;IACtF,MAAM,QAAQ,GAAS,sCAAsB,CAAC,WAAW,CAAC,cAAc,CAAS,CAAC;IAElF,MAAM,UAAU,GAAW,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC3C,MAAM,cAAc,GAAW,QAAQ,CAAC,QAAQ,EAAE,CAAC;IAEnD,MAAM,CAAC,KAAK,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;IACzC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;AACzD,CAAC"}
|
|
@@ -29,7 +29,7 @@ export class ProtoSerializationUtil {
|
|
|
29
29
|
return new DecimalValueProto().setArbitraryPrecisionValue(obj.toString());
|
|
30
30
|
}
|
|
31
31
|
if (obj instanceof String) {
|
|
32
|
-
return StringValue.
|
|
32
|
+
return new StringValue().setValue(obj.toString());
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
throw new Error(`Could not serialize object of type ${typeof obj}. Value: ${obj}`);
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.unpack = exports.pack = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
const any_pb_1 = require("google-protobuf/google/protobuf/any_pb");
|
|
5
|
+
const wrappers_pb_1 = require("google-protobuf/google/protobuf/wrappers_pb");
|
|
6
|
+
const serialization_1 = require("./serialization");
|
|
7
|
+
const local_date_pb_1 = require("../../../fintekkers/models/util/local_date_pb");
|
|
8
|
+
const datetime_1 = require("./datetime");
|
|
9
|
+
const local_timestamp_pb_1 = require("../../../fintekkers/models/util/local_timestamp_pb");
|
|
10
|
+
const uuid_1 = require("./uuid");
|
|
11
|
+
const uuid_pb_1 = require("../../../fintekkers/models/util/uuid_pb");
|
|
12
12
|
function pack(value) {
|
|
13
13
|
if (typeof value === 'string') {
|
|
14
14
|
return packStringIntoAny(value);
|
|
15
15
|
}
|
|
16
16
|
else if (value instanceof Date) {
|
|
17
|
-
|
|
17
|
+
const localDateProto = serialization_1.ProtoSerializationUtil.serialize(value);
|
|
18
18
|
return packDateIntoAny(localDateProto);
|
|
19
19
|
}
|
|
20
20
|
else if (value instanceof datetime_1.ZonedDateTime) {
|
|
21
|
-
|
|
21
|
+
const localDateProto = serialization_1.ProtoSerializationUtil.serialize(value);
|
|
22
22
|
return packTimestampIntoAny(localDateProto);
|
|
23
23
|
}
|
|
24
24
|
else if (value instanceof uuid_1.UUID) {
|
|
@@ -31,7 +31,7 @@ function pack(value) {
|
|
|
31
31
|
}
|
|
32
32
|
exports.pack = pack;
|
|
33
33
|
function unpack(value) {
|
|
34
|
-
|
|
34
|
+
const typeUrl = value.getTypeUrl();
|
|
35
35
|
if (typeUrl === 'type.googleapis.com/google.protobuf.StringValue') {
|
|
36
36
|
return unpackStringFromAny(value);
|
|
37
37
|
}
|
|
@@ -51,58 +51,58 @@ function unpack(value) {
|
|
|
51
51
|
}
|
|
52
52
|
exports.unpack = unpack;
|
|
53
53
|
function packIDIntoAny(uuid) {
|
|
54
|
-
|
|
54
|
+
const anyMessage = new any_pb_1.Any();
|
|
55
55
|
anyMessage.pack(uuid.serializeBinary(), 'fintekkers.models.util.UUIDProto');
|
|
56
56
|
return anyMessage;
|
|
57
57
|
}
|
|
58
58
|
function unpackIDIntoAny(anyMessage) {
|
|
59
|
-
|
|
59
|
+
const typeUrl = anyMessage.getTypeUrl();
|
|
60
60
|
if (typeUrl !== 'type.googleapis.com/fintekkers.models.util.UUIDProto') {
|
|
61
61
|
throw new Error('Unexpected type URL for a date: ' + typeUrl);
|
|
62
62
|
}
|
|
63
|
-
|
|
63
|
+
const uuidProto = uuid_pb_1.UUIDProto.deserializeBinary(anyMessage.getValue_asU8());
|
|
64
64
|
return serialization_1.ProtoSerializationUtil.deserialize(uuidProto);
|
|
65
65
|
}
|
|
66
66
|
function packTimestampIntoAny(inputDate) {
|
|
67
|
-
|
|
67
|
+
const anyMessage = new any_pb_1.Any();
|
|
68
68
|
anyMessage.pack(inputDate.serializeBinary(), 'fintekkers.models.util.LocalTimestampProto');
|
|
69
69
|
return anyMessage;
|
|
70
70
|
}
|
|
71
71
|
function unpackTimestampFromAny(anyMessage) {
|
|
72
|
-
|
|
72
|
+
const typeUrl = anyMessage.getTypeUrl();
|
|
73
73
|
if (typeUrl !== 'type.googleapis.com/fintekkers.models.util.LocalTimestampProto') {
|
|
74
74
|
throw new Error('Unexpected type URL for a timestamp: ' + typeUrl);
|
|
75
75
|
}
|
|
76
|
-
|
|
76
|
+
const dateProto = local_timestamp_pb_1.LocalTimestampProto.deserializeBinary(anyMessage.getValue_asU8());
|
|
77
77
|
return serialization_1.ProtoSerializationUtil.deserialize(dateProto);
|
|
78
78
|
}
|
|
79
79
|
function packDateIntoAny(inputDate) {
|
|
80
|
-
|
|
80
|
+
const anyMessage = new any_pb_1.Any();
|
|
81
81
|
anyMessage.pack(inputDate.serializeBinary(), 'fintekkers.models.util.LocalDateProto');
|
|
82
82
|
return anyMessage;
|
|
83
83
|
}
|
|
84
84
|
function unpackDateFromAny(anyMessage) {
|
|
85
|
-
|
|
85
|
+
const typeUrl = anyMessage.getTypeUrl();
|
|
86
86
|
if (typeUrl !== 'type.googleapis.com/fintekkers.models.util.LocalDateProto') {
|
|
87
87
|
throw new Error('Unexpected type URL for a date: ' + typeUrl);
|
|
88
88
|
}
|
|
89
|
-
|
|
89
|
+
const dateProto = local_date_pb_1.LocalDateProto.deserializeBinary(anyMessage.getValue_asU8());
|
|
90
90
|
return serialization_1.ProtoSerializationUtil.deserialize(dateProto);
|
|
91
91
|
}
|
|
92
92
|
function packStringIntoAny(inputString) {
|
|
93
|
-
|
|
93
|
+
const stringValue = new wrappers_pb_1.StringValue();
|
|
94
94
|
stringValue.setValue(inputString);
|
|
95
|
-
|
|
95
|
+
const anyMessage = new any_pb_1.Any();
|
|
96
96
|
anyMessage.pack(stringValue.serializeBinary(), 'google.protobuf.StringValue');
|
|
97
97
|
return anyMessage;
|
|
98
98
|
}
|
|
99
99
|
function unpackStringFromAny(anyMessage) {
|
|
100
|
-
|
|
100
|
+
const typeUrl = anyMessage.getTypeUrl();
|
|
101
101
|
if (typeUrl !== 'type.googleapis.com/google.protobuf.StringValue') {
|
|
102
102
|
throw new Error('Unexpected type URL: ' + typeUrl);
|
|
103
103
|
}
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
const packedData = wrappers_pb_1.StringValue.deserializeBinary(anyMessage.getValue_asU8());
|
|
105
|
+
const stringValue = packedData.getValue();
|
|
106
106
|
return stringValue;
|
|
107
107
|
}
|
|
108
108
|
//# sourceMappingURL=serialization.util.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialization.util.js","sourceRoot":"","sources":["serialization.util.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"serialization.util.js","sourceRoot":"","sources":["serialization.util.ts"],"names":[],"mappings":";;;AAAA,mEAA6D;AAC7D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AW,CAAC,iBAAiB,CAAC,UAAU,CAAC,aAAa,EAAE,CAAC,CAAC;IAC7E,MAAM,WAAW,GAAG,UAAU,CAAC,QAAQ,EAAE,CAAC;IAE1C,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
test('test packing/unpacking string',
|
|
3
|
+
const serialization_util_1 = require("./serialization.util");
|
|
4
|
+
const datetime_1 = require("./datetime");
|
|
5
|
+
const assert = require("assert");
|
|
6
|
+
test('test packing/unpacking string', () => {
|
|
7
7
|
testString();
|
|
8
8
|
});
|
|
9
|
-
test('test packing/unpacking date',
|
|
9
|
+
test('test packing/unpacking date', () => {
|
|
10
10
|
testDate();
|
|
11
11
|
});
|
|
12
|
-
test('test packing/unpacking timestamp',
|
|
12
|
+
test('test packing/unpacking timestamp', () => {
|
|
13
13
|
testTimestamp();
|
|
14
14
|
});
|
|
15
15
|
function testTimestamp() {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
const now = datetime_1.ZonedDateTime.now();
|
|
17
|
+
const packedNow = (0, serialization_util_1.pack)(now);
|
|
18
|
+
const unpackedNow = (0, serialization_util_1.unpack)(packedNow);
|
|
19
19
|
assert.equal(now.getTimezone(), unpackedNow.getTimezone(), "Timezone doesn't match");
|
|
20
20
|
assert.equal(now.getSeconds(), unpackedNow.getSeconds(), "Seconds do not match");
|
|
21
21
|
assert.equal(now.getNanoSeconds(), unpackedNow.getNanoSeconds(), "Nanoseconds do not match");
|
|
22
22
|
}
|
|
23
23
|
function testDate() {
|
|
24
|
-
|
|
24
|
+
const testDate = new Date();
|
|
25
25
|
testDate.setHours(0, 0, 0, 0);
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
const packedDate = (0, serialization_util_1.pack)(testDate);
|
|
27
|
+
const unpackedDate = (0, serialization_util_1.unpack)(packedDate);
|
|
28
28
|
assert.equal(unpackedDate.getTime(), testDate.getTime(), "Date packing/unpacking failed");
|
|
29
29
|
}
|
|
30
30
|
function testString() {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
const testString = "Hello";
|
|
32
|
+
const packedString = (0, serialization_util_1.pack)(testString);
|
|
33
|
+
const unpackedString = (0, serialization_util_1.unpack)(packedString);
|
|
34
34
|
assert.equal(unpackedString, testString, "String packing/unpacking failed");
|
|
35
35
|
}
|
|
36
36
|
//# sourceMappingURL=serialization.util.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialization.util.test.js","sourceRoot":"","sources":["serialization.util.test.ts"],"names":[],"mappings":";;AAEA,
|
|
1
|
+
{"version":3,"file":"serialization.util.test.js","sourceRoot":"","sources":["serialization.util.test.ts"],"names":[],"mappings":";;AAEA,6DAAoD;AACpD,yCAA2C;AAE3C,iCAAkC;AAElC,IAAI,CAAC,+BAA+B,EAAE,GAAG,EAAE;IACzC,UAAU,EAAE,CAAC;AACf,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,6BAA6B,EAAE,GAAG,EAAE;IACvC,QAAQ,EAAE,CAAC;AACb,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,kCAAkC,EAAE,GAAG,EAAE;IAC5C,aAAa,EAAE,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,SAAS,aAAa;IACpB,MAAM,GAAG,GAAG,wBAAa,CAAC,GAAG,EAAE,CAAC;IAEhC,MAAM,SAAS,GAAQ,IAAA,yBAAI,EAAC,GAAG,CAAC,CAAC;IACjC,MAAM,WAAW,GAAkB,IAAA,2BAAM,EAAC,SAAS,CAAC,CAAC;IAErD,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,WAAW,CAAC,WAAW,EAAE,EAAE,wBAAwB,CAAC,CAAC;IACrF,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,EAAE,EAAE,WAAW,CAAC,UAAU,EAAE,EAAE,sBAAsB,CAAC,CAAC;IACjF,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,cAAc,EAAE,EAAE,WAAW,CAAC,cAAc,EAAE,EAAE,0BAA0B,CAAC,CAAC;AAC/F,CAAC;AAED,SAAS,QAAQ;IACf,MAAM,QAAQ,GAAG,IAAI,IAAI,EAAE,CAAA;IAC3B,QAAQ,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAE9B,MAAM,UAAU,GAAQ,IAAA,yBAAI,EAAC,QAAQ,CAAC,CAAC;IACvC,MAAM,YAAY,GAAS,IAAA,2BAAM,EAAC,UAAU,CAAC,CAAC;IAC9C,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,OAAO,EAAE,EAAE,+BAA+B,CAAC,CAAC;AAC5F,CAAC;AAED,SAAS,UAAU;IACjB,MAAM,UAAU,GAAG,OAAO,CAAC;IAE3B,MAAM,YAAY,GAAQ,IAAA,yBAAI,EAAC,UAAU,CAAC,CAAC;IAC3C,MAAM,cAAc,GAAW,IAAA,2BAAM,EAAC,YAAY,CAAC,CAAC;IACpD,MAAM,CAAC,KAAK,CAAC,cAAc,EAAE,UAAU,EAAE,iCAAiC,CAAC,CAAC;AAC9E,CAAC"}
|
|
@@ -11,10 +11,10 @@ function pack(value: any) {
|
|
|
11
11
|
if (typeof value === 'string') {
|
|
12
12
|
return packStringIntoAny(value);
|
|
13
13
|
} else if (value instanceof Date) {
|
|
14
|
-
const localDateProto: LocalDateProto = ProtoSerializationUtil.serialize(value);
|
|
14
|
+
const localDateProto: LocalDateProto = ProtoSerializationUtil.serialize(value) as LocalDateProto;
|
|
15
15
|
return packDateIntoAny(localDateProto);
|
|
16
16
|
} else if (value instanceof ZonedDateTime) {
|
|
17
|
-
const localDateProto: LocalTimestampProto = ProtoSerializationUtil.serialize(value);
|
|
17
|
+
const localDateProto: LocalTimestampProto = ProtoSerializationUtil.serialize(value) as LocalTimestampProto;
|
|
18
18
|
return packTimestampIntoAny(localDateProto);
|
|
19
19
|
} else if (value instanceof UUID) {
|
|
20
20
|
// const uuid: UUIDProto = ProtoSerializationUtil.serialize(value);
|
|
@@ -56,7 +56,7 @@ function unpackIDIntoAny(anyMessage: Any): UUIDProto {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
const uuidProto: UUIDProto = UUIDProto.deserializeBinary(anyMessage.getValue_asU8());
|
|
59
|
-
return ProtoSerializationUtil.deserialize(uuidProto);
|
|
59
|
+
return ProtoSerializationUtil.deserialize(uuidProto) as unknown as UUIDProto;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
function packTimestampIntoAny(inputDate: LocalTimestampProto): Any {
|
|
@@ -74,7 +74,7 @@ function unpackTimestampFromAny(anyMessage: Any): LocalTimestampProto {
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
const dateProto: LocalTimestampProto = LocalTimestampProto.deserializeBinary(anyMessage.getValue_asU8());
|
|
77
|
-
return ProtoSerializationUtil.deserialize(dateProto);
|
|
77
|
+
return ProtoSerializationUtil.deserialize(dateProto) as unknown as LocalTimestampProto;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
function packDateIntoAny(inputDate: LocalDateProto): Any {
|
|
@@ -92,7 +92,7 @@ function unpackDateFromAny(anyMessage: Any): LocalDateProto {
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
const dateProto: LocalDateProto = LocalDateProto.deserializeBinary(anyMessage.getValue_asU8());
|
|
95
|
-
return ProtoSerializationUtil.deserialize(dateProto);
|
|
95
|
+
return ProtoSerializationUtil.deserialize(dateProto) as unknown as LocalDateProto;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
function packStringIntoAny(inputString: string): Any {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { UUIDProto } from '../../../fintekkers/models/util/uuid_pb';
|
|
2
|
+
declare class UUID {
|
|
3
|
+
private bytes;
|
|
4
|
+
constructor(bytes: number[]);
|
|
5
|
+
toString(): string;
|
|
6
|
+
toBytes(): number[];
|
|
7
|
+
toUUIDProto(): UUIDProto;
|
|
8
|
+
equals(other: UUID): boolean;
|
|
9
|
+
static random(): UUID;
|
|
10
|
+
static fromU8Array(uint8Array: Uint8Array): UUID;
|
|
11
|
+
static fromString(uuidString: string): number[];
|
|
12
|
+
}
|
|
13
|
+
export { UUID };
|
|
@@ -1,55 +1,77 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
exports.UUID = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
27
|
+
const uuid_pb_1 = require("../../../fintekkers/models/util/uuid_pb");
|
|
28
|
+
const uuid = __importStar(require("uuid"));
|
|
6
29
|
/**
|
|
7
30
|
* Convert array of 16 byte values to UUID string format of the form:
|
|
8
31
|
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
9
32
|
*/
|
|
10
|
-
|
|
11
|
-
for (
|
|
33
|
+
const byteToHex = [];
|
|
34
|
+
for (let i = 0; i < 256; ++i) {
|
|
12
35
|
byteToHex.push((i + 0x100).toString(16).slice(1));
|
|
13
36
|
}
|
|
14
|
-
|
|
15
|
-
|
|
37
|
+
class UUID {
|
|
38
|
+
constructor(bytes) {
|
|
16
39
|
this.bytes = bytes;
|
|
17
40
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
41
|
+
toString() {
|
|
42
|
+
const arr = new Uint8Array(this.bytes);
|
|
43
|
+
const offset = 0;
|
|
44
|
+
const str = byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
|
|
22
45
|
return str; //uuid.stringify(byteArray);
|
|
23
|
-
}
|
|
24
|
-
|
|
46
|
+
}
|
|
47
|
+
toBytes() {
|
|
25
48
|
return this.bytes;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
49
|
+
}
|
|
50
|
+
toUUIDProto() {
|
|
51
|
+
const id_proto = new uuid_pb_1.UUIDProto();
|
|
29
52
|
id_proto.setRawUuid(new Uint8Array(this.toBytes()));
|
|
30
53
|
return id_proto;
|
|
31
|
-
}
|
|
32
|
-
|
|
54
|
+
}
|
|
55
|
+
equals(other) {
|
|
33
56
|
return this.toBytes() === other.toBytes();
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
57
|
+
}
|
|
58
|
+
static random() {
|
|
59
|
+
const random = uuid.v4();
|
|
37
60
|
return new UUID(UUID.fromString(random));
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
61
|
+
}
|
|
62
|
+
static fromU8Array(uint8Array) {
|
|
63
|
+
const array = Array.from(uint8Array, byte => byte);
|
|
41
64
|
return new UUID(array);
|
|
42
|
-
}
|
|
43
|
-
|
|
65
|
+
}
|
|
66
|
+
static fromString(uuidString) {
|
|
44
67
|
// Remove hyphens and convert to a continuous hexadecimal string
|
|
45
|
-
|
|
68
|
+
const hexString = uuidString.replace(/-/g, '');
|
|
46
69
|
// Split the continuous hexadecimal string into two-character chunks
|
|
47
|
-
|
|
70
|
+
const hexChunks = hexString.match(/.{1,2}/g);
|
|
48
71
|
// Convert each two-character chunk to a byte (number)
|
|
49
|
-
|
|
72
|
+
const bytes = hexChunks.map((chunk) => parseInt(chunk, 16));
|
|
50
73
|
return bytes;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
}());
|
|
74
|
+
}
|
|
75
|
+
}
|
|
54
76
|
exports.UUID = UUID;
|
|
55
77
|
//# sourceMappingURL=uuid.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uuid.js","sourceRoot":"","sources":["uuid.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"uuid.js","sourceRoot":"","sources":["uuid.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qEAAoE;AACpE,2CAA6B;AAE7B;;;GAGG;AACH,MAAM,SAAS,GAAa,EAAE,CAAC;AAE/B,KAAK,IAAI,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tD,MAAM,KAAK,GAAG,SAAU,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;QAE7D,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAEQ,oBAAI"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
test('test packing/unpacking string',
|
|
3
|
+
const assert = require("assert");
|
|
4
|
+
const uuid_1 = require("./uuid");
|
|
5
|
+
test('test packing/unpacking string', () => {
|
|
6
6
|
testString();
|
|
7
7
|
});
|
|
8
8
|
function testString() {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
const test_uuid_bytes = [217, 98, 253, 240, 51, 225, 77, 157, 153, 155, 126, 195, 80, 240, 203, 119];
|
|
10
|
+
const test_uuid = new uuid_1.UUID(test_uuid_bytes);
|
|
11
11
|
assert(test_uuid.toString() == 'd962fdf0-33e1-4d9d-999b-7ec350f0cb77');
|
|
12
|
-
|
|
12
|
+
const test_uuid_bytes_copy = uuid_1.UUID.fromString(test_uuid.toString());
|
|
13
13
|
assert(test_uuid_bytes.length === test_uuid_bytes_copy.length &&
|
|
14
|
-
test_uuid_bytes.every(
|
|
14
|
+
test_uuid_bytes.every((value, index) => value === test_uuid_bytes_copy[index]));
|
|
15
15
|
assert(uuid_1.UUID.random().toString().length == 36);
|
|
16
16
|
}
|
|
17
17
|
//# sourceMappingURL=uuid.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uuid.test.js","sourceRoot":"","sources":["uuid.test.ts"],"names":[],"mappings":";;AAAA
|
|
1
|
+
{"version":3,"file":"uuid.test.js","sourceRoot":"","sources":["uuid.test.ts"],"names":[],"mappings":";;AAAA,iCAAkC;AAClC,iCAA8B;AAE9B,IAAI,CAAC,+BAA+B,EAAE,GAAG,EAAE;IACzC,UAAU,EAAE,CAAC;AACf,CAAC,CAAC,CAAC;AAEH,SAAS,UAAU;IACjB,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IACrG,MAAM,SAAS,GAAG,IAAI,WAAI,CAAC,eAAe,CAAC,CAAC;IAC5C,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,sCAAsC,CAAC,CAAC;IACvE,MAAM,oBAAoB,GAAG,WAAI,CAAC,UAAU,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC;IAEnE,MAAM,CACJ,eAAe,CAAC,MAAM,KAAK,oBAAoB,CAAC,MAAM;QACtD,eAAe,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,oBAAoB,CAAC,KAAK,CAAC,CAAC,CAC/E,CAAC;IAEF,MAAM,CAAC,WAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -5,7 +5,7 @@ import * as uuid from 'uuid';
|
|
|
5
5
|
* Convert array of 16 byte values to UUID string format of the form:
|
|
6
6
|
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
7
7
|
*/
|
|
8
|
-
const byteToHex = [];
|
|
8
|
+
const byteToHex: string[] = [];
|
|
9
9
|
|
|
10
10
|
for (let i = 0; i < 256; ++i) {
|
|
11
11
|
byteToHex.push((i + 0x100).toString(16).slice(1));
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FieldProto } from "../../../fintekkers/models/position/field_pb";
|
|
2
|
+
import { PositionTypeProto, PositionViewProto } from "../../../fintekkers/models/position/position_pb";
|
|
3
|
+
import { MeasureProto } from "../../../fintekkers/models/position/measure_pb";
|
|
4
|
+
import { ZonedDateTime } from "../../models/utils/datetime";
|
|
5
|
+
import { PositionFilter } from "../../models/position/positionfilter";
|
|
6
|
+
import { QueryPositionRequestProto } from "../../../fintekkers/requests/position/query_position_request_pb";
|
|
7
|
+
export declare class QueryPositionRequest {
|
|
8
|
+
private filter;
|
|
9
|
+
private positionType;
|
|
10
|
+
private positionView;
|
|
11
|
+
private fields;
|
|
12
|
+
private measures;
|
|
13
|
+
private asOf;
|
|
14
|
+
static fromAsOf(fields: Array<FieldProto>, measures: Array<MeasureProto>, asOf: ZonedDateTime): QueryPositionRequest;
|
|
15
|
+
static from(fields: Array<FieldProto>, measures: Array<MeasureProto>): QueryPositionRequest;
|
|
16
|
+
constructor(filter: PositionFilter, positionType: PositionTypeProto, positionView: PositionViewProto, fields: Array<FieldProto>, measures: Array<MeasureProto>, asOf: ZonedDateTime);
|
|
17
|
+
toProto(): QueryPositionRequestProto;
|
|
18
|
+
getFilter(): PositionFilter;
|
|
19
|
+
}
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.QueryPositionRequest = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
const position_pb_1 = require("../../../fintekkers/models/position/position_pb");
|
|
5
|
+
const datetime_1 = require("../../models/utils/datetime");
|
|
6
|
+
const positionfilter_1 = require("../../models/position/positionfilter");
|
|
7
|
+
const operation_pb_1 = require("../../../fintekkers/requests/util/operation_pb");
|
|
8
8
|
//Requests
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const query_position_request_pb_1 = require("../../../fintekkers/requests/position/query_position_request_pb");
|
|
10
|
+
class QueryPositionRequest {
|
|
11
|
+
static fromAsOf(fields, measures, asOf) {
|
|
12
|
+
return new QueryPositionRequest(new positionfilter_1.PositionFilter(), position_pb_1.PositionTypeProto.TRANSACTION, position_pb_1.PositionViewProto.DEFAULT_VIEW, fields, measures, asOf);
|
|
13
|
+
}
|
|
14
|
+
static from(fields, measures) {
|
|
15
|
+
return QueryPositionRequest.fromAsOf(fields, measures, datetime_1.ZonedDateTime.now());
|
|
16
|
+
}
|
|
17
|
+
constructor(filter, positionType, positionView, fields, measures, asOf) {
|
|
12
18
|
this.filter = filter;
|
|
13
19
|
this.positionType = positionType;
|
|
14
20
|
this.positionView = positionView;
|
|
@@ -16,14 +22,8 @@ var QueryPositionRequest = /** @class */ (function () {
|
|
|
16
22
|
this.measures = measures;
|
|
17
23
|
this.asOf = asOf;
|
|
18
24
|
}
|
|
19
|
-
|
|
20
|
-
|
|
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()
|
|
25
|
+
toProto() {
|
|
26
|
+
const proto = new query_position_request_pb_1.QueryPositionRequestProto()
|
|
27
27
|
.setAsOf(this.asOf.toProto())
|
|
28
28
|
.setVersion("1.0.0")
|
|
29
29
|
.setPositionType(this.positionType)
|
|
@@ -34,11 +34,10 @@ var QueryPositionRequest = /** @class */ (function () {
|
|
|
34
34
|
if (this.filter && this.filter.getFilters().length > 0)
|
|
35
35
|
proto.setFilterFields(this.filter.toProto());
|
|
36
36
|
return proto;
|
|
37
|
-
}
|
|
38
|
-
|
|
37
|
+
}
|
|
38
|
+
getFilter() {
|
|
39
39
|
return this.filter;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
}());
|
|
40
|
+
}
|
|
41
|
+
}
|
|
43
42
|
exports.QueryPositionRequest = QueryPositionRequest;
|
|
44
43
|
//# sourceMappingURL=QueryPositionRequest.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryPositionRequest.js","sourceRoot":"","sources":["QueryPositionRequest.ts"],"names":[],"mappings":";;;AAEA
|
|
1
|
+
{"version":3,"file":"QueryPositionRequest.js","sourceRoot":"","sources":["QueryPositionRequest.ts"],"names":[],"mappings":";;;AAEA,iFAAuG;AAEvG,0DAA4D;AAC5D,yEAAsE;AACtE,iFAA2F;AAE3F,UAAU;AACV,+GAA4G;AAE5G,MAAa,oBAAoB;IAQ7B,MAAM,CAAC,QAAQ,CAAC,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;IAED,MAAM,CAAC,IAAI,CAAC,MAAyB,EAAE,QAA6B;QAChE,OAAO,oBAAoB,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,EAAE,wBAAa,CAAC,GAAG,EAAE,CAAC,CAAC;IAChF,CAAC;IAED,YAAY,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;IAEM,OAAO;QACV,MAAM,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,SAAS;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;CACJ;AApDD,oDAoDC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { PortfolioProto } from '../../../fintekkers/models/portfolio/portfolio_pb';
|
|
2
|
+
import { LocalTimestampProto } from '../../../fintekkers/models/util/local_timestamp_pb';
|
|
3
|
+
import { SummaryProto } from '../../../fintekkers/requests/util/errors/summary_pb';
|
|
4
|
+
import { CreatePortfolioResponseProto } from '../../../fintekkers/requests/portfolio/create_portfolio_response_pb';
|
|
5
|
+
import { PositionFilter } from '../../models/position/positionfilter';
|
|
6
|
+
import Portfolio from '../../models/portfolio/portfolio';
|
|
7
|
+
declare class PortfolioService {
|
|
8
|
+
private client;
|
|
9
|
+
static url: string;
|
|
10
|
+
constructor();
|
|
11
|
+
validateCreatePortfolio(portfolio: PortfolioProto): Promise<SummaryProto>;
|
|
12
|
+
createPortfolio(portfolio: PortfolioProto): Promise<CreatePortfolioResponseProto>;
|
|
13
|
+
searchPortfolio(asOf: LocalTimestampProto, positionFilter: PositionFilter): Promise<Portfolio[]>;
|
|
14
|
+
}
|
|
15
|
+
export { PortfolioService };
|