@fintekkers/ledger-models 0.1.116 → 0.1.118
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/wrappers/models/position/position.d.ts +2 -1
- package/node/wrappers/models/position/position.js +4 -0
- package/node/wrappers/models/position/position.js.map +1 -1
- package/node/wrappers/models/position/position.ts +5 -2
- package/node/wrappers/models/position/positionfilter.d.ts +2 -0
- package/node/wrappers/models/position/positionfilter.js +18 -3
- package/node/wrappers/models/position/positionfilter.js.map +1 -1
- package/node/wrappers/models/position/positionfilter.test.d.ts +1 -0
- package/node/wrappers/models/position/positionfilter.test.js +146 -0
- package/node/wrappers/models/position/positionfilter.test.js.map +1 -0
- package/node/wrappers/models/position/positionfilter.test.ts +183 -0
- package/node/wrappers/models/position/positionfilter.ts +20 -4
- package/node/wrappers/models/security/coupon_type.test.js +1 -1
- package/node/wrappers/models/security/coupon_type.test.js.map +1 -1
- package/node/wrappers/models/security/coupon_type.test.ts +1 -1
- package/node/wrappers/models/security/identifier.d.ts +29 -0
- package/node/wrappers/models/security/identifier.js +51 -0
- package/node/wrappers/models/security/identifier.js.map +1 -0
- package/node/wrappers/models/security/identifier.test.d.ts +1 -0
- package/node/wrappers/models/security/identifier.test.js +55 -0
- package/node/wrappers/models/security/identifier.test.js.map +1 -0
- package/node/wrappers/models/security/identifier.test.ts +65 -0
- package/node/wrappers/models/security/identifier.ts +58 -0
- package/node/wrappers/models/security/term.test.js +6 -0
- package/node/wrappers/models/security/term.test.js.map +1 -1
- package/node/wrappers/models/security/term.test.ts +7 -0
- package/node/wrappers/models/utils/date.test.js +1 -1
- package/node/wrappers/models/utils/date.test.ts +1 -1
- package/node/wrappers/models/utils/serialization.d.ts +4 -2
- package/node/wrappers/models/utils/serialization.js +5 -1
- package/node/wrappers/models/utils/serialization.js.map +1 -1
- package/node/wrappers/models/utils/serialization.ts +7 -3
- package/node/wrappers/models/utils/serialization.util.d.ts +5 -2
- package/node/wrappers/models/utils/serialization.util.js +24 -1
- package/node/wrappers/models/utils/serialization.util.js.map +1 -1
- package/node/wrappers/models/utils/serialization.util.test.js.map +1 -1
- package/node/wrappers/models/utils/serialization.util.test.ts +3 -3
- package/node/wrappers/models/utils/serialization.util.ts +39 -14
- package/package.json +1 -1
|
@@ -6,8 +6,10 @@ import { ZonedDateTime } from './datetime';
|
|
|
6
6
|
import { LocalTimestampProto } from '../../../fintekkers/models/util/local_timestamp_pb';
|
|
7
7
|
import { UUID } from './uuid';
|
|
8
8
|
import { UUIDProto } from '../../../fintekkers/models/util/uuid_pb';
|
|
9
|
+
import { Identifier } from '../security/identifier';
|
|
10
|
+
import { IdentifierProto } from '../../../fintekkers/models/security/identifier/identifier_pb';
|
|
9
11
|
|
|
10
|
-
function pack(value:
|
|
12
|
+
function pack(value: Date | ZonedDateTime | UUID | Identifier | string | number) {
|
|
11
13
|
if (typeof value === 'string') {
|
|
12
14
|
return packStringIntoAny(value);
|
|
13
15
|
} else if (value instanceof Date) {
|
|
@@ -17,29 +19,52 @@ function pack(value: any) {
|
|
|
17
19
|
const localDateProto: LocalTimestampProto = ProtoSerializationUtil.serialize(value) as LocalTimestampProto;
|
|
18
20
|
return packTimestampIntoAny(localDateProto);
|
|
19
21
|
} else if (value instanceof UUID) {
|
|
20
|
-
// const uuid: UUIDProto = ProtoSerializationUtil.serialize(value);
|
|
21
22
|
return packIDIntoAny(value.toUUIDProto());
|
|
22
|
-
} else {
|
|
23
|
+
} else if (value instanceof Identifier) {
|
|
24
|
+
return packIdentifierProtoIntoAny(value.proto as IdentifierProto);
|
|
25
|
+
} else if (value && typeof value === 'object' && 'proto' in value && (value as any).proto instanceof IdentifierProto) {
|
|
26
|
+
return packIdentifierProtoIntoAny((value as any).proto as IdentifierProto);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
23
29
|
throw new Error("Unrecognized type cannot be packed: " + typeof value);
|
|
24
30
|
}
|
|
25
31
|
}
|
|
26
32
|
|
|
27
|
-
function unpack(value: Any):
|
|
33
|
+
function unpack(value: Any): Date | ZonedDateTime | UUID | Identifier | string | number {
|
|
28
34
|
const typeUrl = value.getTypeUrl();
|
|
29
35
|
if (typeUrl === 'type.googleapis.com/google.protobuf.StringValue') {
|
|
30
|
-
return unpackStringFromAny(value);
|
|
36
|
+
return unpackStringFromAny(value) as string;
|
|
31
37
|
} else if (typeUrl === 'type.googleapis.com/fintekkers.models.util.LocalDateProto') {
|
|
32
|
-
return unpackDateFromAny(value);
|
|
38
|
+
return unpackDateFromAny(value) as Date;
|
|
33
39
|
} else if (typeUrl === 'type.googleapis.com/fintekkers.models.util.LocalTimestampProto') {
|
|
34
40
|
return unpackTimestampFromAny(value);
|
|
35
41
|
} else if (typeUrl === 'type.googleapis.com/fintekkers.models.util.UUIDProto') {
|
|
36
|
-
return unpackIDIntoAny(value);
|
|
37
|
-
} else {
|
|
42
|
+
return unpackIDIntoAny(value) as UUID;
|
|
43
|
+
} else if (typeUrl === 'type.googleapis.com/fintekkers.models.security.IdentifierProto') {
|
|
44
|
+
return unpackIdentifierProtoFromAny(value) as Identifier;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
38
47
|
console.log(value);
|
|
39
48
|
throw new Error("Unrecognized Any type cannot be unpacked: " + typeUrl);
|
|
40
49
|
}
|
|
41
50
|
}
|
|
42
51
|
|
|
52
|
+
function unpackIdentifierProtoFromAny(anyMessage: Any): Identifier {
|
|
53
|
+
const typeUrl = anyMessage.getTypeUrl();
|
|
54
|
+
|
|
55
|
+
if (typeUrl !== 'type.googleapis.com/fintekkers.models.security.IdentifierProto') {
|
|
56
|
+
throw new Error('Unexpected type URL for an identifier: ' + typeUrl);
|
|
57
|
+
}
|
|
58
|
+
const identifierProto: IdentifierProto = IdentifierProto.deserializeBinary(anyMessage.getValue_asU8());
|
|
59
|
+
return ProtoSerializationUtil.deserialize(identifierProto) as unknown as Identifier;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function packIdentifierProtoIntoAny(input: IdentifierProto): Any {
|
|
63
|
+
const anyMessage = new Any();
|
|
64
|
+
|
|
65
|
+
anyMessage.pack(input.serializeBinary(), 'fintekkers.models.security.IdentifierProto');
|
|
66
|
+
return anyMessage;
|
|
67
|
+
}
|
|
43
68
|
|
|
44
69
|
function packIDIntoAny(uuid: UUIDProto): Any {
|
|
45
70
|
const anyMessage = new Any();
|
|
@@ -48,7 +73,7 @@ function packIDIntoAny(uuid: UUIDProto): Any {
|
|
|
48
73
|
return anyMessage;
|
|
49
74
|
}
|
|
50
75
|
|
|
51
|
-
function unpackIDIntoAny(anyMessage: Any):
|
|
76
|
+
function unpackIDIntoAny(anyMessage: Any): UUID {
|
|
52
77
|
const typeUrl = anyMessage.getTypeUrl();
|
|
53
78
|
|
|
54
79
|
if (typeUrl !== 'type.googleapis.com/fintekkers.models.util.UUIDProto') {
|
|
@@ -56,7 +81,7 @@ function unpackIDIntoAny(anyMessage: Any): UUIDProto {
|
|
|
56
81
|
}
|
|
57
82
|
|
|
58
83
|
const uuidProto: UUIDProto = UUIDProto.deserializeBinary(anyMessage.getValue_asU8());
|
|
59
|
-
return ProtoSerializationUtil.deserialize(uuidProto) as unknown as
|
|
84
|
+
return ProtoSerializationUtil.deserialize(uuidProto) as unknown as UUID;
|
|
60
85
|
}
|
|
61
86
|
|
|
62
87
|
function packTimestampIntoAny(inputDate: LocalTimestampProto): Any {
|
|
@@ -66,7 +91,7 @@ function packTimestampIntoAny(inputDate: LocalTimestampProto): Any {
|
|
|
66
91
|
return anyMessage;
|
|
67
92
|
}
|
|
68
93
|
|
|
69
|
-
function unpackTimestampFromAny(anyMessage: Any):
|
|
94
|
+
function unpackTimestampFromAny(anyMessage: Any): ZonedDateTime {
|
|
70
95
|
const typeUrl = anyMessage.getTypeUrl();
|
|
71
96
|
|
|
72
97
|
if (typeUrl !== 'type.googleapis.com/fintekkers.models.util.LocalTimestampProto') {
|
|
@@ -74,7 +99,7 @@ function unpackTimestampFromAny(anyMessage: Any): LocalTimestampProto {
|
|
|
74
99
|
}
|
|
75
100
|
|
|
76
101
|
const dateProto: LocalTimestampProto = LocalTimestampProto.deserializeBinary(anyMessage.getValue_asU8());
|
|
77
|
-
return ProtoSerializationUtil.deserialize(dateProto) as unknown as
|
|
102
|
+
return ProtoSerializationUtil.deserialize(dateProto) as unknown as ZonedDateTime;
|
|
78
103
|
}
|
|
79
104
|
|
|
80
105
|
function packDateIntoAny(inputDate: LocalDateProto): Any {
|
|
@@ -84,7 +109,7 @@ function packDateIntoAny(inputDate: LocalDateProto): Any {
|
|
|
84
109
|
return anyMessage;
|
|
85
110
|
}
|
|
86
111
|
|
|
87
|
-
function unpackDateFromAny(anyMessage: Any):
|
|
112
|
+
function unpackDateFromAny(anyMessage: Any): Date {
|
|
88
113
|
const typeUrl = anyMessage.getTypeUrl();
|
|
89
114
|
|
|
90
115
|
if (typeUrl !== 'type.googleapis.com/fintekkers.models.util.LocalDateProto') {
|
|
@@ -92,7 +117,7 @@ function unpackDateFromAny(anyMessage: Any): LocalDateProto {
|
|
|
92
117
|
}
|
|
93
118
|
|
|
94
119
|
const dateProto: LocalDateProto = LocalDateProto.deserializeBinary(anyMessage.getValue_asU8());
|
|
95
|
-
return ProtoSerializationUtil.deserialize(dateProto) as unknown as
|
|
120
|
+
return ProtoSerializationUtil.deserialize(dateProto) as unknown as Date;
|
|
96
121
|
}
|
|
97
122
|
|
|
98
123
|
function packStringIntoAny(inputString: string): Any {
|