@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
|
@@ -8,76 +8,46 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
12
|
+
const field_pb_1 = require("../../../fintekkers/models/position/field_pb");
|
|
13
|
+
const position_pb_1 = require("../../../fintekkers/models/position/position_pb");
|
|
14
|
+
const position_util_pb_1 = require("../../../fintekkers/models/position/position_util_pb");
|
|
15
|
+
const position_1 = require("../position/position");
|
|
16
|
+
const datetime_1 = require("./datetime");
|
|
17
|
+
const any_pb_1 = require("google-protobuf/google/protobuf/any_pb");
|
|
18
|
+
const local_timestamp_pb_1 = require("../../../fintekkers/models/util/local_timestamp_pb");
|
|
19
|
+
const timestamp_pb_js_1 = require("google-protobuf/google/protobuf/timestamp_pb.js");
|
|
47
20
|
// import Timestamp from "google-protobuf/google/protobuf/timestamp_pb";
|
|
48
|
-
test('test the date time',
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
return [2 /*return*/];
|
|
81
|
-
});
|
|
82
|
-
}); });
|
|
21
|
+
test('test the date time', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
22
|
+
const localTimestampProto = new local_timestamp_pb_1.LocalTimestampProto();
|
|
23
|
+
const timestamp = new timestamp_pb_js_1.Timestamp();
|
|
24
|
+
timestamp.setSeconds(1643723400); // Set the seconds
|
|
25
|
+
timestamp.setNanos(0); // Set the nanoseconds
|
|
26
|
+
localTimestampProto.setTimestamp(timestamp);
|
|
27
|
+
// Set the time zone
|
|
28
|
+
localTimestampProto.setTimeZone('America/New_York');
|
|
29
|
+
const now = new datetime_1.ZonedDateTime(localTimestampProto);
|
|
30
|
+
let nowTimestampString = now.toDateTime().toString();
|
|
31
|
+
expect(nowTimestampString).toContain("2022-02-01");
|
|
32
|
+
expect(nowTimestampString).toContain("08:50:00");
|
|
33
|
+
const nowProto = now.toProto();
|
|
34
|
+
const nowPacked = new any_pb_1.Any();
|
|
35
|
+
nowPacked.setTypeUrl(`DUMMYTYPE_DATE`);
|
|
36
|
+
nowPacked.setValue(nowProto.serializeBinary());
|
|
37
|
+
const position = new position_pb_1.PositionProto();
|
|
38
|
+
// Set properties
|
|
39
|
+
position.setObjectClass(' MyClass');
|
|
40
|
+
position.setVersion('1.0');
|
|
41
|
+
position.setPositionView(position_pb_1.PositionViewProto.DEFAULT_VIEW);
|
|
42
|
+
position.setPositionType(position_pb_1.PositionTypeProto.TRANSACTION);
|
|
43
|
+
// Add fields
|
|
44
|
+
const field1 = new position_util_pb_1.FieldMapEntry();
|
|
45
|
+
field1.setField(field_pb_1.FieldProto.AS_OF);
|
|
46
|
+
field1.setFieldValuePacked(nowPacked);
|
|
47
|
+
position.addFields(field1);
|
|
48
|
+
const pos = new position_1.Position(position);
|
|
49
|
+
const timestampStr = pos.getFieldDisplay(field1);
|
|
50
|
+
//Expect timestamp match
|
|
51
|
+
expect(timestampStr).toMatch(/^[0-9]{4}\/[0-9]{2}\/[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$/);
|
|
52
|
+
}));
|
|
83
53
|
//# sourceMappingURL=datetime.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datetime.test.js","sourceRoot":"","sources":["datetime.test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"datetime.test.js","sourceRoot":"","sources":["datetime.test.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,2EAA0E;AAC1E,iFAAsH;AACtH,2FAAqF;AACrF,mDAAgD;AAChD,yCAA2C;AAC3C,mEAA6D;AAC7D,2FAAuF;AACvF,qFAA4E;AAC5E,wEAAwE;AAExE,IAAI,CAAC,oBAAoB,EAAE,GAAS,EAAE;IAClC,MAAM,mBAAmB,GAAG,IAAI,wCAAmB,EAAE,CAAC;IACtD,MAAM,SAAS,GAAG,IAAI,2BAAS,EAAE,CAAC;IAClC,SAAS,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,kBAAkB;IACpD,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,sBAAsB;IAC7C,mBAAmB,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;IAEhD,oBAAoB;IAChB,mBAAmB,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC;IACpD,MAAM,GAAG,GAAG,IAAI,wBAAa,CAAC,mBAAmB,CAAC,CAAC;IAEnD,IAAI,kBAAkB,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC,QAAQ,EAAE,CAAC;IACrD,MAAM,CAAC,kBAAkB,CAA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b';
|
|
3
|
-
import {DateTime} from 'luxon';
|
|
1
|
+
import { LocalTimestampProto } from '../../../fintekkers/models/util/local_timestamp_pb';
|
|
2
|
+
import { Timestamp } from 'google-protobuf/google/protobuf/timestamp_pb';
|
|
3
|
+
import { DateTime } from 'luxon';
|
|
4
4
|
|
|
5
5
|
class ZonedDateTime {
|
|
6
6
|
private proto: LocalTimestampProto;
|
|
@@ -14,17 +14,22 @@ class ZonedDateTime {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
getSeconds(): number {
|
|
17
|
-
|
|
17
|
+
const timestamp = this.proto.getTimestamp();
|
|
18
|
+
if (!timestamp) throw new Error("Timestamp is required");
|
|
19
|
+
return timestamp.getSeconds();
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
getNanoSeconds(): number {
|
|
21
|
-
|
|
23
|
+
const timestamp = this.proto.getTimestamp();
|
|
24
|
+
if (!timestamp) throw new Error("Timestamp is required");
|
|
25
|
+
return timestamp.getNanos();
|
|
22
26
|
}
|
|
23
27
|
|
|
24
28
|
toDateTime(): DateTime {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const
|
|
29
|
+
const timestamp = this.proto.getTimestamp();
|
|
30
|
+
if (!timestamp) throw new Error("Timestamp is required");
|
|
31
|
+
const unixTimestampSeconds = timestamp.getSeconds();
|
|
32
|
+
const nanoseconds = timestamp.getNanos();
|
|
28
33
|
|
|
29
34
|
let dateTime = DateTime.fromSeconds(unixTimestampSeconds, { zone: this.proto.getTimeZone() });
|
|
30
35
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare class ProtoEnum {
|
|
2
|
+
private enumValue;
|
|
3
|
+
private enumDescriptor;
|
|
4
|
+
constructor(enumDescriptor: any, enumValue: number);
|
|
5
|
+
static fromEnumName(enumName: string, enumValue: number): ProtoEnum;
|
|
6
|
+
private static getFieldDescriptorFromName;
|
|
7
|
+
getEnumDescriptor(): string;
|
|
8
|
+
getEnumName(): Error;
|
|
9
|
+
getEnumValue(): number;
|
|
10
|
+
getEnumValueName(): string;
|
|
11
|
+
toString(): string;
|
|
12
|
+
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ProtoEnum = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
const transaction_type_pb_1 = require("../../../fintekkers/models/transaction/transaction_type_pb");
|
|
5
|
+
const position_status_pb_1 = require("../../../fintekkers/models/position/position_status_pb");
|
|
6
|
+
const field_pb_1 = require("../../../fintekkers/models/position/field_pb");
|
|
7
|
+
class ProtoEnum {
|
|
8
|
+
constructor(enumDescriptor, enumValue) {
|
|
9
9
|
this.enumValue = enumValue;
|
|
10
10
|
this.enumDescriptor = enumDescriptor;
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
static fromEnumName(enumName, enumValue) {
|
|
13
13
|
return new ProtoEnum(ProtoEnum.getFieldDescriptorFromName(enumName), enumValue);
|
|
14
|
-
}
|
|
15
|
-
|
|
14
|
+
}
|
|
15
|
+
static getFieldDescriptorFromName(enumName) {
|
|
16
16
|
if (enumName === "TRANSACTION_TYPE") {
|
|
17
17
|
return transaction_type_pb_1.TransactionTypeProto;
|
|
18
18
|
}
|
|
@@ -22,33 +22,31 @@ var ProtoEnum = /** @class */ (function () {
|
|
|
22
22
|
if (enumName === "FIELD") {
|
|
23
23
|
return field_pb_1.FieldProto;
|
|
24
24
|
}
|
|
25
|
-
throw new Error(
|
|
26
|
-
}
|
|
27
|
-
|
|
25
|
+
throw new Error(`Enum has not been mapped: ${enumName}`);
|
|
26
|
+
}
|
|
27
|
+
getEnumDescriptor() {
|
|
28
28
|
return this.enumDescriptor;
|
|
29
|
-
}
|
|
30
|
-
|
|
29
|
+
}
|
|
30
|
+
getEnumName() {
|
|
31
31
|
// Assuming your enumDescriptor has a name property or similar
|
|
32
32
|
throw new Error("Not supported currently");
|
|
33
33
|
// return this.enumDescriptor.name;
|
|
34
|
-
}
|
|
35
|
-
|
|
34
|
+
}
|
|
35
|
+
getEnumValue() {
|
|
36
36
|
return this.enumValue;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
var _this = this;
|
|
37
|
+
}
|
|
38
|
+
getEnumValueName() {
|
|
40
39
|
// In TypeScript/JS, enum values can be accessed directly if you know the value
|
|
41
40
|
// Assuming your enums are simple objects or as generated by protobuf ts
|
|
42
|
-
|
|
41
|
+
const enumKey = Object.keys(this.enumDescriptor).find(key => this.enumDescriptor[key] === this.enumValue);
|
|
43
42
|
if (!enumKey) {
|
|
44
43
|
return 'UNKNOWN'; // Or handle as appropriate
|
|
45
44
|
}
|
|
46
45
|
return enumKey;
|
|
47
|
-
}
|
|
48
|
-
|
|
46
|
+
}
|
|
47
|
+
toString() {
|
|
49
48
|
return this.getEnumValueName();
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
}());
|
|
49
|
+
}
|
|
50
|
+
}
|
|
53
51
|
exports.ProtoEnum = ProtoEnum;
|
|
54
52
|
//# sourceMappingURL=protoEnum.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protoEnum.js","sourceRoot":"","sources":["protoEnum.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"protoEnum.js","sourceRoot":"","sources":["protoEnum.ts"],"names":[],"mappings":";;;AACA,oGAAkG;AAClG,+FAA6F;AAC7F,2EAA0E;AAE1E,MAAa,SAAS;IAIlB,YAAY,cAAmB,EAAE,SAAiB;QAC9C,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACzC,CAAC;IAED,MAAM,CAAC,YAAY,CAAC,QAAgB,EAAE,SAAiB;QACnD,OAAO,IAAI,SAAS,CAAC,SAAS,CAAC,0BAA0B,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,CAAC;IACpF,CA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
|
-
describe('ProtoEnum',
|
|
8
|
-
it('should correctly identify the name of the enum value for TransactionTypeProto',
|
|
9
|
-
|
|
4
|
+
const position_status_pb_1 = require("../../../fintekkers/models/position/position_status_pb");
|
|
5
|
+
const transaction_type_pb_1 = require("../../../fintekkers/models/transaction/transaction_type_pb");
|
|
6
|
+
const protoEnum_1 = require("./protoEnum");
|
|
7
|
+
describe('ProtoEnum', () => {
|
|
8
|
+
it('should correctly identify the name of the enum value for TransactionTypeProto', () => {
|
|
9
|
+
const protoEnum = new protoEnum_1.ProtoEnum(transaction_type_pb_1.TransactionTypeProto, 1);
|
|
10
10
|
expect(protoEnum.getEnumValueName()).toEqual('BUY');
|
|
11
11
|
});
|
|
12
|
-
it('should correctly return the enum value for PositionStatusProto',
|
|
13
|
-
|
|
12
|
+
it('should correctly return the enum value for PositionStatusProto', () => {
|
|
13
|
+
const protoEnum = new protoEnum_1.ProtoEnum(position_status_pb_1.PositionStatusProto.INTENDED, 2);
|
|
14
14
|
expect(protoEnum.getEnumValue()).toEqual(2);
|
|
15
15
|
});
|
|
16
|
-
it('should correctly return the enum name for PositionStatusProto',
|
|
17
|
-
|
|
18
|
-
expect(
|
|
16
|
+
it('should correctly return the enum name for PositionStatusProto', () => {
|
|
17
|
+
const protoEnum = new protoEnum_1.ProtoEnum(position_status_pb_1.PositionStatusProto.INTENDED, 2);
|
|
18
|
+
expect(() => protoEnum.getEnumName()).toThrow(Error);
|
|
19
19
|
});
|
|
20
|
-
it('should throw an error for an unmapped enum name',
|
|
21
|
-
expect(
|
|
20
|
+
it('should throw an error for an unmapped enum name', () => {
|
|
21
|
+
expect(() => protoEnum_1.ProtoEnum.fromEnumName('UNMAPPED_ENUM', 0)).toThrow('Enum has not been mapped: UNMAPPED_ENUM');
|
|
22
22
|
});
|
|
23
23
|
// Add more tests as necessary to cover your use cases
|
|
24
24
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protoEnum.test.js","sourceRoot":"","sources":["protoEn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|
1
|
+
import * as grpc from '@grpc/grpc-js';
|
|
2
|
+
declare class EnvConfig {
|
|
3
|
+
private static getEnvVar;
|
|
4
|
+
static get apiKey(): string;
|
|
5
|
+
/**
|
|
6
|
+
* Returns the URL for the backend GRPC service. It will default to
|
|
7
|
+
* api.fintekkers.org if the environment variable is not set. You
|
|
8
|
+
* cann set the environment variable by adding API_URL to your .env file.
|
|
9
|
+
*/
|
|
10
|
+
static get apiURL(): string;
|
|
11
|
+
static get apiCredentials(): grpc.ChannelCredentials;
|
|
12
|
+
}
|
|
13
|
+
export default EnvConfig;
|
|
@@ -1,55 +1,63 @@
|
|
|
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
|
+
const dotenv = __importStar(require("dotenv"));
|
|
4
27
|
dotenv.config();
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
EnvConfig.getEnvVar = function (key, defaultValue) {
|
|
10
|
-
var value = process.env[key];
|
|
28
|
+
const grpc = __importStar(require("@grpc/grpc-js"));
|
|
29
|
+
class EnvConfig {
|
|
30
|
+
static getEnvVar(key, defaultValue) {
|
|
31
|
+
const value = process.env[key];
|
|
11
32
|
if (value === undefined) {
|
|
12
33
|
if (defaultValue === undefined) {
|
|
13
|
-
throw new Error(
|
|
34
|
+
throw new Error(`Environment variable ${key} is not set.`);
|
|
14
35
|
}
|
|
15
36
|
return defaultValue;
|
|
16
37
|
}
|
|
17
38
|
return value;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
get: function () {
|
|
42
|
-
if (this.apiURL === "localhost:8082") {
|
|
43
|
-
return grpc.credentials.createInsecure();
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
return grpc.credentials.createSsl();
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
enumerable: false,
|
|
50
|
-
configurable: true
|
|
51
|
-
});
|
|
52
|
-
return EnvConfig;
|
|
53
|
-
}());
|
|
39
|
+
}
|
|
40
|
+
static get apiKey() {
|
|
41
|
+
throw new Error("API keys not supported currently.");
|
|
42
|
+
// return EnvConfig.getEnvVar('API_KEY');
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Returns the URL for the backend GRPC service. It will default to
|
|
46
|
+
* api.fintekkers.org if the environment variable is not set. You
|
|
47
|
+
* cann set the environment variable by adding API_URL to your .env file.
|
|
48
|
+
*/
|
|
49
|
+
static get apiURL() {
|
|
50
|
+
const url = EnvConfig.getEnvVar('API_URL', "api.fintekkers.org") + ":8082";
|
|
51
|
+
return url;
|
|
52
|
+
}
|
|
53
|
+
static get apiCredentials() {
|
|
54
|
+
if (this.apiURL === "localhost:8082") {
|
|
55
|
+
return grpc.credentials.createInsecure();
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
return grpc.credentials.createSsl();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
54
62
|
exports.default = EnvConfig;
|
|
55
63
|
//# sourceMappingURL=requestcontext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestcontext.js","sourceRoot":"","sources":["requestcontext.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"requestcontext.js","sourceRoot":"","sources":["requestcontext.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AACjC,MAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,oDAAsC;AAEtC,MAAM,SAAS;IACL,MAAM,CAAC,SAAS,CAAC,GAAW,EAAE,YAAqB;QACzD,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC/B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;gBAC/B,MAAM,IAAI,KAAK,CAAC,wBAAwB,GAAG,cAAc,CAAC,CAAC;YAC7D,CAAC;YACD,OAAO,YAAY,CAAC;QACtB,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,KAAK,MAAM;QACf,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAA;QACpD,yCAAyC;IAC3C,CAAC;IAED;;;;OAIG;IACH,MAAM,KAAK,MAAM;QACf,MAAM,GAAG,GAAW,SAAS,CAAC,SAAS,CAAC,SAAS,EAAE,oBAAoB,CAAC,GAAG,OAAO,CAAC;QACnF,OAAO,GAAG,CAAC;IACb,CAAC;IAED,MAAM,KAAK,cAAc;QACvB,IAAI,IAAI,CAAC,MAAM,KAAK,gBAAgB,EAAE,CAAC;YACrC,OAAO,IAAI,CAAC,WAAW,CAAC,cAAc,EAAE,CAAC;QAC3C,CAAC;aACI,CAAC;YACJ,OAAO,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,CAAC;QACtC,CAAC;IACH,CAAC;CAEF;AAED,kBAAe,SAAS,CAAC"}
|
|
@@ -4,16 +4,16 @@ dotenv.config();
|
|
|
4
4
|
import * as grpc from '@grpc/grpc-js';
|
|
5
5
|
|
|
6
6
|
class EnvConfig {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
return defaultValue;
|
|
14
|
-
}
|
|
15
|
-
return value;
|
|
7
|
+
private static getEnvVar(key: string, defaultValue?: string): string {
|
|
8
|
+
const value = process.env[key];
|
|
9
|
+
if (value === undefined) {
|
|
10
|
+
if (defaultValue === undefined) {
|
|
11
|
+
throw new Error(`Environment variable ${key} is not set.`);
|
|
16
12
|
}
|
|
13
|
+
return defaultValue;
|
|
14
|
+
}
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
17
|
|
|
18
18
|
static get apiKey(): string {
|
|
19
19
|
throw new Error("API keys not supported currently.")
|
|
@@ -26,19 +26,19 @@ class EnvConfig {
|
|
|
26
26
|
* cann set the environment variable by adding API_URL to your .env file.
|
|
27
27
|
*/
|
|
28
28
|
static get apiURL(): string {
|
|
29
|
-
const url:string = EnvConfig.getEnvVar('API_URL', "api.fintekkers.org") + ":8082";
|
|
29
|
+
const url: string = EnvConfig.getEnvVar('API_URL', "api.fintekkers.org") + ":8082";
|
|
30
30
|
return url;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
static get apiCredentials(): grpc.ChannelCredentials {
|
|
34
|
-
if(this.apiURL === "localhost:8082"){
|
|
35
|
-
|
|
34
|
+
if (this.apiURL === "localhost:8082") {
|
|
35
|
+
return grpc.credentials.createInsecure();
|
|
36
36
|
}
|
|
37
|
-
else {
|
|
38
|
-
|
|
37
|
+
else {
|
|
38
|
+
return grpc.credentials.createSsl();
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
export default EnvConfig;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DecimalValueProto } from "../../../fintekkers/models/util/decimal_value_pb";
|
|
2
|
+
import { LocalDateProto } from "../../../fintekkers/models/util/local_date_pb";
|
|
3
|
+
import { LocalTimestampProto } from "../../../fintekkers/models/util/local_timestamp_pb";
|
|
4
|
+
import { UUIDProto } from "../../../fintekkers/models/util/uuid_pb";
|
|
5
|
+
import { ZonedDateTime } from "./datetime";
|
|
6
|
+
import { ProtoEnum } from "./protoEnum";
|
|
7
|
+
import { UUID } from "./uuid";
|
|
8
|
+
import { StringValue } from 'google-protobuf/google/protobuf/wrappers_pb';
|
|
9
|
+
export declare class ProtoSerializationUtil {
|
|
10
|
+
static serialize(obj: any): DecimalValueProto | LocalDateProto | LocalTimestampProto | UUIDProto | StringValue;
|
|
11
|
+
static deserialize(obj: any): string | number | ZonedDateTime | Date | UUID | ProtoEnum;
|
|
12
|
+
}
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ProtoSerializationUtil = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
ProtoSerializationUtil.serialize = function (obj) {
|
|
4
|
+
const identifier_pb_1 = require("../../../fintekkers/models/security/identifier/identifier_pb");
|
|
5
|
+
const decimal_value_pb_1 = require("../../../fintekkers/models/util/decimal_value_pb");
|
|
6
|
+
const local_date_pb_1 = require("../../../fintekkers/models/util/local_date_pb");
|
|
7
|
+
const local_timestamp_pb_1 = require("../../../fintekkers/models/util/local_timestamp_pb");
|
|
8
|
+
const uuid_pb_1 = require("../../../fintekkers/models/util/uuid_pb");
|
|
9
|
+
const datetime_1 = require("./datetime");
|
|
10
|
+
const protoEnum_1 = require("./protoEnum");
|
|
11
|
+
const uuid_1 = require("./uuid");
|
|
12
|
+
const wrappers_pb_1 = require("google-protobuf/google/protobuf/wrappers_pb");
|
|
13
|
+
class ProtoSerializationUtil {
|
|
14
|
+
static serialize(obj) {
|
|
17
15
|
if (obj instanceof uuid_1.UUID) {
|
|
18
16
|
return obj.toUUIDProto();
|
|
19
17
|
}
|
|
@@ -30,16 +28,16 @@ var ProtoSerializationUtil = /** @class */ (function () {
|
|
|
30
28
|
return new decimal_value_pb_1.DecimalValueProto().setArbitraryPrecisionValue(obj.toString());
|
|
31
29
|
}
|
|
32
30
|
if (obj instanceof String) {
|
|
33
|
-
return wrappers_pb_1.StringValue.
|
|
31
|
+
return new wrappers_pb_1.StringValue().setValue(obj.toString());
|
|
34
32
|
}
|
|
35
|
-
throw new Error(
|
|
36
|
-
}
|
|
37
|
-
|
|
33
|
+
throw new Error(`Could not serialize object of type ${typeof obj}. Value: ${obj}`);
|
|
34
|
+
}
|
|
35
|
+
static deserialize(obj) {
|
|
38
36
|
if (obj instanceof uuid_pb_1.UUIDProto) {
|
|
39
37
|
return uuid_1.UUID.fromU8Array(obj.getRawUuid_asU8());
|
|
40
38
|
}
|
|
41
39
|
if (obj instanceof local_date_pb_1.LocalDateProto) {
|
|
42
|
-
|
|
40
|
+
const date = new Date(obj.getYear(), obj.getMonth() - 1, obj.getDay());
|
|
43
41
|
date.setHours(0, 0, 0, 0);
|
|
44
42
|
return date;
|
|
45
43
|
}
|
|
@@ -58,9 +56,8 @@ var ProtoSerializationUtil = /** @class */ (function () {
|
|
|
58
56
|
if (obj !== null && 'enum_name' in obj && typeof obj.enum_name !== 'undefined' && obj.enum_name !== null) {
|
|
59
57
|
return new protoEnum_1.ProtoEnum(obj.descriptor, obj.enum_value);
|
|
60
58
|
}
|
|
61
|
-
throw new Error(
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
}());
|
|
59
|
+
throw new Error(`Could not deserialize object of type ${typeof obj}. Value: ${obj}`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
65
62
|
exports.ProtoSerializationUtil = ProtoSerializationUtil;
|
|
66
63
|
//# sourceMappingURL=serialization.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialization.js","sourceRoot":"","sources":["serialization.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"serialization.js","sourceRoot":"","sources":["serialization.ts"],"names":[],"mappings":";;;AACA,gGAA+F;AAC/F,uFAAqF;AACrF,iFAA+E;AAC/E,2FAAyF;AACzF,qEAAoE;AAEpE,yCAA2C;AAC3C,2CAAwC;AACxC,iCAA8B;AAC9B,6EAA0E;AAG1E,MAAa,sBAAsB;IACjC,MAAM,CAAC,SAAS,CAAC,GAAQ;QACvB,IAAI,GAAG,YAAY,WAAI,EAAE,CAAC;YACxB,OAAO,GAAG,CAAC,WAAW,EAAE,CAAC;QAC3B,CAAC;QACD,IAAI,GAAG,YAAY,IAAI,EAAE,CAAC;YACxB,OAAO,IAAI,8BAAc,EAAE;iBACxB,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;iBAC1B,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;iBAC5B,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;QAC3B,CAAC;QACD,IAAI,GAAG,YAAY,wBAAa,EAAE,CAAC;YACjC,OAAO,GAAG,CAAC,OAAO,EAA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