@fintekkers/ledger-models 0.1.143 → 0.2.1
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/hierarchy.json +131 -0
- package/node/fintekkers/models/security/asset_class_pb.d.ts +1 -0
- package/node/fintekkers/models/security/asset_class_pb.js +2 -1
- package/node/fintekkers/models/security/instrument_type_pb.d.ts +14 -0
- package/node/fintekkers/models/security/{security_type_pb.js → instrument_type_pb.js} +7 -14
- package/node/fintekkers/models/security/product_type_grpc_pb.js +1 -0
- package/node/fintekkers/models/security/product_type_pb.d.ts +37 -0
- package/node/fintekkers/models/security/product_type_pb.js +58 -0
- package/node/fintekkers/models/security/security_id_grpc_pb.js +1 -0
- package/node/fintekkers/models/security/security_id_pb.d.ts +31 -0
- package/node/fintekkers/models/security/security_id_pb.js +199 -0
- package/node/fintekkers/models/security/security_pb.d.ts +14 -4
- package/node/fintekkers/models/security/security_pb.js +100 -13
- package/node/fintekkers/models/security/security_pb.test.js +2 -2
- package/node/fintekkers/models/security/security_pb.test.js.map +1 -1
- package/node/fintekkers/models/security/security_pb.test.ts +2 -2
- package/node/wrappers/models/position/position_filter_operator.js +1 -1
- package/node/wrappers/models/position/position_filter_operator.js.map +1 -1
- package/node/wrappers/models/position/position_filter_operator.ts +1 -1
- package/node/wrappers/models/price/Price.cash.test.js +2 -2
- package/node/wrappers/models/price/Price.cash.test.js.map +1 -1
- package/node/wrappers/models/price/Price.cash.test.ts +2 -2
- package/node/wrappers/models/security/BondSecurity.js +11 -3
- package/node/wrappers/models/security/BondSecurity.js.map +1 -1
- package/node/wrappers/models/security/BondSecurity.priceScale.test.js +2 -2
- package/node/wrappers/models/security/BondSecurity.priceScale.test.js.map +1 -1
- package/node/wrappers/models/security/BondSecurity.priceScale.test.ts +2 -2
- package/node/wrappers/models/security/BondSecurity.test.js +5 -5
- package/node/wrappers/models/security/BondSecurity.test.js.map +1 -1
- package/node/wrappers/models/security/BondSecurity.test.ts +5 -5
- package/node/wrappers/models/security/BondSecurity.ts +11 -3
- package/node/wrappers/models/security/asset_class.test.js +2 -0
- package/node/wrappers/models/security/asset_class.test.js.map +1 -1
- package/node/wrappers/models/security/asset_class.test.ts +2 -0
- package/node/wrappers/models/security/product_hierarchy.d.ts +42 -0
- package/node/wrappers/models/security/product_hierarchy.js +157 -0
- package/node/wrappers/models/security/product_hierarchy.js.map +1 -0
- package/node/wrappers/models/security/product_hierarchy.ts +159 -0
- package/node/wrappers/models/security/security-roundtrip.test.js +13 -13
- package/node/wrappers/models/security/security-roundtrip.test.js.map +1 -1
- package/node/wrappers/models/security/security-roundtrip.test.ts +13 -13
- package/node/wrappers/models/security/security.js +11 -11
- package/node/wrappers/models/security/security.js.map +1 -1
- package/node/wrappers/models/security/security.test.js +3 -3
- package/node/wrappers/models/security/security.test.js.map +1 -1
- package/node/wrappers/models/security/security.test.ts +3 -3
- package/node/wrappers/models/security/security.ts +12 -12
- package/node/wrappers/models/transaction/transaction.derived.test.js +5 -5
- package/node/wrappers/models/transaction/transaction.derived.test.js.map +1 -1
- package/node/wrappers/models/transaction/transaction.derived.test.ts +5 -5
- package/node/wrappers/models/transaction/transaction.js +14 -14
- package/node/wrappers/models/transaction/transaction.js.map +1 -1
- package/node/wrappers/models/transaction/transaction.ts +14 -14
- package/node/wrappers/services/security-service/security.test.js +2 -2
- package/node/wrappers/services/security-service/security.test.js.map +1 -1
- package/node/wrappers/services/security-service/security.test.ts +2 -2
- package/package.json +1 -1
- package/tsconfig.json +2 -1
- package/node/fintekkers/models/security/security_type_pb.d.ts +0 -21
- package/node/wrappers/models/security/security_type.d.ts +0 -31
- package/node/wrappers/models/security/security_type.js +0 -45
- package/node/wrappers/models/security/security_type.js.map +0 -1
- package/node/wrappers/models/security/security_type.test.d.ts +0 -1
- package/node/wrappers/models/security/security_type.test.js +0 -68
- package/node/wrappers/models/security/security_type.test.js.map +0 -1
- package/node/wrappers/models/security/security_type.test.ts +0 -74
- package/node/wrappers/models/security/security_type.ts +0 -47
- /package/node/fintekkers/models/security/{security_type_grpc_pb.js → instrument_type_grpc_pb.js} +0 -0
package/tsconfig.json
CHANGED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// package: fintekkers.models.security
|
|
2
|
-
// file: fintekkers/models/security/security_type.proto
|
|
3
|
-
|
|
4
|
-
/* tslint:disable */
|
|
5
|
-
/* eslint-disable */
|
|
6
|
-
|
|
7
|
-
import * as jspb from "google-protobuf";
|
|
8
|
-
|
|
9
|
-
export enum SecurityTypeProto {
|
|
10
|
-
UNKNOWN_SECURITY_TYPE = 0,
|
|
11
|
-
CASH_SECURITY = 1,
|
|
12
|
-
EQUITY_SECURITY = 2,
|
|
13
|
-
BOND_SECURITY = 3,
|
|
14
|
-
TIPS = 4,
|
|
15
|
-
FRN = 5,
|
|
16
|
-
INDEX_SECURITY = 6,
|
|
17
|
-
FX_SPOT = 7,
|
|
18
|
-
EQUITY_INDEX_SECURITY = 8,
|
|
19
|
-
STRIPS_SECURITY = 9,
|
|
20
|
-
T_BILL = 10,
|
|
21
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { SecurityTypeProto } from '../../../fintekkers/models/security/security_type_pb';
|
|
2
|
-
/**
|
|
3
|
-
* Static helpers around the SecurityType proto enum, mirroring the
|
|
4
|
-
* Identifier wrapper pattern shipped in v0.1.133 (PR #188).
|
|
5
|
-
*
|
|
6
|
-
* Lets TS/JS consumers stop hand-typing literal unions and switch
|
|
7
|
-
* statements over `'BOND_SECURITY' | 'TIPS' | 'FRN' | ...` — adding a
|
|
8
|
-
* new variant on the proto side propagates automatically.
|
|
9
|
-
*/
|
|
10
|
-
export declare class SecurityType {
|
|
11
|
-
/**
|
|
12
|
-
* Returns the names of all known SecurityTypeProto values, EXCLUDING
|
|
13
|
-
* the sentinel `UNKNOWN_SECURITY_TYPE`. Drives UI dropdowns / pickers
|
|
14
|
-
* so a new proto enum variant auto-propagates to consumers without
|
|
15
|
-
* any UI-side code change.
|
|
16
|
-
*
|
|
17
|
-
* Order matches proto declaration order (Object.keys preserves
|
|
18
|
-
* insertion order on the generated JS enum object).
|
|
19
|
-
*/
|
|
20
|
-
static getAllTypeNames(): string[];
|
|
21
|
-
/**
|
|
22
|
-
* Resolve a proto enum NAME (e.g., "BOND_SECURITY", "EQUITY_SECURITY")
|
|
23
|
-
* to its numeric SecurityTypeProto value. Throws on unknown name; the
|
|
24
|
-
* error lists the valid names so typos are fixable without grepping
|
|
25
|
-
* the proto.
|
|
26
|
-
*
|
|
27
|
-
* @param name proto enum key (e.g., "BOND_SECURITY")
|
|
28
|
-
* @returns the numeric SecurityTypeProto value
|
|
29
|
-
*/
|
|
30
|
-
static fromName(name: string): SecurityTypeProto;
|
|
31
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SecurityType = void 0;
|
|
4
|
-
const security_type_pb_1 = require("../../../fintekkers/models/security/security_type_pb");
|
|
5
|
-
/**
|
|
6
|
-
* Static helpers around the SecurityType proto enum, mirroring the
|
|
7
|
-
* Identifier wrapper pattern shipped in v0.1.133 (PR #188).
|
|
8
|
-
*
|
|
9
|
-
* Lets TS/JS consumers stop hand-typing literal unions and switch
|
|
10
|
-
* statements over `'BOND_SECURITY' | 'TIPS' | 'FRN' | ...` — adding a
|
|
11
|
-
* new variant on the proto side propagates automatically.
|
|
12
|
-
*/
|
|
13
|
-
class SecurityType {
|
|
14
|
-
/**
|
|
15
|
-
* Returns the names of all known SecurityTypeProto values, EXCLUDING
|
|
16
|
-
* the sentinel `UNKNOWN_SECURITY_TYPE`. Drives UI dropdowns / pickers
|
|
17
|
-
* so a new proto enum variant auto-propagates to consumers without
|
|
18
|
-
* any UI-side code change.
|
|
19
|
-
*
|
|
20
|
-
* Order matches proto declaration order (Object.keys preserves
|
|
21
|
-
* insertion order on the generated JS enum object).
|
|
22
|
-
*/
|
|
23
|
-
static getAllTypeNames() {
|
|
24
|
-
return Object.keys(security_type_pb_1.SecurityTypeProto).filter(k => k !== 'UNKNOWN_SECURITY_TYPE');
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Resolve a proto enum NAME (e.g., "BOND_SECURITY", "EQUITY_SECURITY")
|
|
28
|
-
* to its numeric SecurityTypeProto value. Throws on unknown name; the
|
|
29
|
-
* error lists the valid names so typos are fixable without grepping
|
|
30
|
-
* the proto.
|
|
31
|
-
*
|
|
32
|
-
* @param name proto enum key (e.g., "BOND_SECURITY")
|
|
33
|
-
* @returns the numeric SecurityTypeProto value
|
|
34
|
-
*/
|
|
35
|
-
static fromName(name) {
|
|
36
|
-
const enumObj = security_type_pb_1.SecurityTypeProto;
|
|
37
|
-
const enumValue = enumObj[name];
|
|
38
|
-
if (enumValue === undefined) {
|
|
39
|
-
throw new Error(`Unknown SecurityType name: '${name}'. Valid names: ${SecurityType.getAllTypeNames().join(', ')}`);
|
|
40
|
-
}
|
|
41
|
-
return enumValue;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
exports.SecurityType = SecurityType;
|
|
45
|
-
//# sourceMappingURL=security_type.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"security_type.js","sourceRoot":"","sources":["security_type.ts"],"names":[],"mappings":";;;AAAA,2FAAyF;AAEzF;;;;;;;GAOG;AACH,MAAa,YAAY;IAErB;;;;;;;;OAQG;IACH,MAAM,CAAC,eAAe;QAClB,OAAO,MAAM,CAAC,IAAI,CAAC,oCAAiB,CAAC,CAAC,MAAM,CACxC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,uBAAuB,CACrC,CAAC;IACN,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAY;QACxB,MAAM,OAAO,GAAG,oCAAsD,CAAC;QACvE,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,IAAI,SAAS,KAAK,SAAS,EAAE;YACzB,MAAM,IAAI,KAAK,CACX,+BAA+B,IAAI,mBAAmB,YAAY,CAAC,eAAe,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACpG,CAAC;SACL;QACD,OAAO,SAA8B,CAAC;IAC1C,CAAC;CACJ;AApCD,oCAoCC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const security_type_1 = require("./security_type");
|
|
4
|
-
const security_type_pb_1 = require("../../../fintekkers/models/security/security_type_pb");
|
|
5
|
-
describe('SecurityType.fromName', () => {
|
|
6
|
-
// Round-trip: every name returned by getAllTypeNames must resolve to
|
|
7
|
-
// a numeric enum value that maps back to the same name.
|
|
8
|
-
test.each(security_type_1.SecurityType.getAllTypeNames())('fromName("%s") returns the matching numeric enum value', (name) => {
|
|
9
|
-
const value = security_type_1.SecurityType.fromName(name);
|
|
10
|
-
// The proto-generated enum is bidirectionally indexable
|
|
11
|
-
// (Object.keys / numeric-key lookups both work in google-protobuf JS).
|
|
12
|
-
const expected = security_type_pb_1.SecurityTypeProto[name];
|
|
13
|
-
expect(value).toBe(expected);
|
|
14
|
-
});
|
|
15
|
-
test('throws on unknown name and lists valid names in the error', () => {
|
|
16
|
-
let err;
|
|
17
|
-
try {
|
|
18
|
-
security_type_1.SecurityType.fromName('NOT_A_REAL_TYPE');
|
|
19
|
-
}
|
|
20
|
-
catch (e) {
|
|
21
|
-
err = e;
|
|
22
|
-
}
|
|
23
|
-
expect(err).toBeDefined();
|
|
24
|
-
expect(err.message).toContain('NOT_A_REAL_TYPE');
|
|
25
|
-
// Error message should hint with known valid entries.
|
|
26
|
-
expect(err.message).toContain('BOND_SECURITY');
|
|
27
|
-
expect(err.message).toContain('EQUITY_SECURITY');
|
|
28
|
-
});
|
|
29
|
-
test('accepts UNKNOWN_SECURITY_TYPE — sentinel is a valid enum key', () => {
|
|
30
|
-
// It's excluded from getAllTypeNames (so it doesn't appear in
|
|
31
|
-
// dropdowns), but it IS a valid proto enum value, so fromName
|
|
32
|
-
// accepts it. Pinning the existing behavior — flip if policy
|
|
33
|
-
// ever tightens.
|
|
34
|
-
expect(security_type_1.SecurityType.fromName('UNKNOWN_SECURITY_TYPE')).toBe(security_type_pb_1.SecurityTypeProto.UNKNOWN_SECURITY_TYPE);
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
describe('SecurityType.getAllTypeNames', () => {
|
|
38
|
-
test('returns the expected set in proto-declaration order, excluding UNKNOWN', () => {
|
|
39
|
-
// Proto-declared order in security_type.proto:
|
|
40
|
-
// UNKNOWN_SECURITY_TYPE = 0; (excluded)
|
|
41
|
-
// CASH_SECURITY = 1;
|
|
42
|
-
// EQUITY_SECURITY = 2;
|
|
43
|
-
// BOND_SECURITY = 3;
|
|
44
|
-
// TIPS = 4;
|
|
45
|
-
// FRN = 5;
|
|
46
|
-
// INDEX_SECURITY = 6;
|
|
47
|
-
// FX_SPOT = 7;
|
|
48
|
-
// EQUITY_INDEX_SECURITY = 8;
|
|
49
|
-
// STRIPS_SECURITY = 9; (added in #246)
|
|
50
|
-
// T_BILL = 10; (added in #246)
|
|
51
|
-
expect(security_type_1.SecurityType.getAllTypeNames()).toEqual([
|
|
52
|
-
'CASH_SECURITY',
|
|
53
|
-
'EQUITY_SECURITY',
|
|
54
|
-
'BOND_SECURITY',
|
|
55
|
-
'TIPS',
|
|
56
|
-
'FRN',
|
|
57
|
-
'INDEX_SECURITY',
|
|
58
|
-
'FX_SPOT',
|
|
59
|
-
'EQUITY_INDEX_SECURITY',
|
|
60
|
-
'STRIPS_SECURITY',
|
|
61
|
-
'T_BILL',
|
|
62
|
-
]);
|
|
63
|
-
});
|
|
64
|
-
test('excludes the UNKNOWN_SECURITY_TYPE sentinel', () => {
|
|
65
|
-
expect(security_type_1.SecurityType.getAllTypeNames()).not.toContain('UNKNOWN_SECURITY_TYPE');
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
//# sourceMappingURL=security_type.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"security_type.test.js","sourceRoot":"","sources":["security_type.test.ts"],"names":[],"mappings":";;AAAA,mDAA+C;AAC/C,2FAAyF;AAEzF,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACnC,qEAAqE;IACrE,wDAAwD;IACxD,IAAI,CAAC,IAAI,CAAC,4BAAY,CAAC,eAAe,EAAE,CAAC,CACrC,wDAAwD,EACxD,CAAC,IAAY,EAAE,EAAE;QACb,MAAM,KAAK,GAAG,4BAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC1C,wDAAwD;QACxD,uEAAuE;QACvE,MAAM,QAAQ,GAAI,oCAAuD,CAAC,IAAI,CAAC,CAAC;QAChF,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC,CACJ,CAAC;IAEF,IAAI,CAAC,2DAA2D,EAAE,GAAG,EAAE;QACnE,IAAI,GAAsB,CAAC;QAC3B,IAAI;YACA,4BAAY,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC;SAC5C;QAAC,OAAO,CAAC,EAAE;YACR,GAAG,GAAG,CAAU,CAAC;SACpB;QACD,MAAM,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;QAC1B,MAAM,CAAC,GAAI,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;QAClD,sDAAsD;QACtD,MAAM,CAAC,GAAI,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;QAChD,MAAM,CAAC,GAAI,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,8DAA8D,EAAE,GAAG,EAAE;QACtE,8DAA8D;QAC9D,8DAA8D;QAC9D,6DAA6D;QAC7D,iBAAiB;QACjB,MAAM,CAAC,4BAAY,CAAC,QAAQ,CAAC,uBAAuB,CAAC,CAAC,CAAC,IAAI,CACvD,oCAAiB,CAAC,qBAAqB,CAC1C,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,8BAA8B,EAAE,GAAG,EAAE;IAC1C,IAAI,CAAC,wEAAwE,EAAE,GAAG,EAAE;QAChF,+CAA+C;QAC/C,2CAA2C;QAC3C,uBAAuB;QACvB,yBAAyB;QACzB,uBAAuB;QACvB,cAAc;QACd,aAAa;QACb,wBAAwB;QACxB,iBAAiB;QACjB,+BAA+B;QAC/B,kDAAkD;QAClD,kDAAkD;QAClD,MAAM,CAAC,4BAAY,CAAC,eAAe,EAAE,CAAC,CAAC,OAAO,CAAC;YAC3C,eAAe;YACf,iBAAiB;YACjB,eAAe;YACf,MAAM;YACN,KAAK;YACL,gBAAgB;YAChB,SAAS;YACT,uBAAuB;YACvB,iBAAiB;YACjB,QAAQ;SACX,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,6CAA6C,EAAE,GAAG,EAAE;QACrD,MAAM,CAAC,4BAAY,CAAC,eAAe,EAAE,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,uBAAuB,CAAC,CAAC;IAClF,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { SecurityType } from './security_type';
|
|
2
|
-
import { SecurityTypeProto } from '../../../fintekkers/models/security/security_type_pb';
|
|
3
|
-
|
|
4
|
-
describe('SecurityType.fromName', () => {
|
|
5
|
-
// Round-trip: every name returned by getAllTypeNames must resolve to
|
|
6
|
-
// a numeric enum value that maps back to the same name.
|
|
7
|
-
test.each(SecurityType.getAllTypeNames())(
|
|
8
|
-
'fromName("%s") returns the matching numeric enum value',
|
|
9
|
-
(name: string) => {
|
|
10
|
-
const value = SecurityType.fromName(name);
|
|
11
|
-
// The proto-generated enum is bidirectionally indexable
|
|
12
|
-
// (Object.keys / numeric-key lookups both work in google-protobuf JS).
|
|
13
|
-
const expected = (SecurityTypeProto as unknown as Record<string, number>)[name];
|
|
14
|
-
expect(value).toBe(expected);
|
|
15
|
-
}
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
test('throws on unknown name and lists valid names in the error', () => {
|
|
19
|
-
let err: Error | undefined;
|
|
20
|
-
try {
|
|
21
|
-
SecurityType.fromName('NOT_A_REAL_TYPE');
|
|
22
|
-
} catch (e) {
|
|
23
|
-
err = e as Error;
|
|
24
|
-
}
|
|
25
|
-
expect(err).toBeDefined();
|
|
26
|
-
expect(err!.message).toContain('NOT_A_REAL_TYPE');
|
|
27
|
-
// Error message should hint with known valid entries.
|
|
28
|
-
expect(err!.message).toContain('BOND_SECURITY');
|
|
29
|
-
expect(err!.message).toContain('EQUITY_SECURITY');
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
test('accepts UNKNOWN_SECURITY_TYPE — sentinel is a valid enum key', () => {
|
|
33
|
-
// It's excluded from getAllTypeNames (so it doesn't appear in
|
|
34
|
-
// dropdowns), but it IS a valid proto enum value, so fromName
|
|
35
|
-
// accepts it. Pinning the existing behavior — flip if policy
|
|
36
|
-
// ever tightens.
|
|
37
|
-
expect(SecurityType.fromName('UNKNOWN_SECURITY_TYPE')).toBe(
|
|
38
|
-
SecurityTypeProto.UNKNOWN_SECURITY_TYPE
|
|
39
|
-
);
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
describe('SecurityType.getAllTypeNames', () => {
|
|
44
|
-
test('returns the expected set in proto-declaration order, excluding UNKNOWN', () => {
|
|
45
|
-
// Proto-declared order in security_type.proto:
|
|
46
|
-
// UNKNOWN_SECURITY_TYPE = 0; (excluded)
|
|
47
|
-
// CASH_SECURITY = 1;
|
|
48
|
-
// EQUITY_SECURITY = 2;
|
|
49
|
-
// BOND_SECURITY = 3;
|
|
50
|
-
// TIPS = 4;
|
|
51
|
-
// FRN = 5;
|
|
52
|
-
// INDEX_SECURITY = 6;
|
|
53
|
-
// FX_SPOT = 7;
|
|
54
|
-
// EQUITY_INDEX_SECURITY = 8;
|
|
55
|
-
// STRIPS_SECURITY = 9; (added in #246)
|
|
56
|
-
// T_BILL = 10; (added in #246)
|
|
57
|
-
expect(SecurityType.getAllTypeNames()).toEqual([
|
|
58
|
-
'CASH_SECURITY',
|
|
59
|
-
'EQUITY_SECURITY',
|
|
60
|
-
'BOND_SECURITY',
|
|
61
|
-
'TIPS',
|
|
62
|
-
'FRN',
|
|
63
|
-
'INDEX_SECURITY',
|
|
64
|
-
'FX_SPOT',
|
|
65
|
-
'EQUITY_INDEX_SECURITY',
|
|
66
|
-
'STRIPS_SECURITY',
|
|
67
|
-
'T_BILL',
|
|
68
|
-
]);
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
test('excludes the UNKNOWN_SECURITY_TYPE sentinel', () => {
|
|
72
|
-
expect(SecurityType.getAllTypeNames()).not.toContain('UNKNOWN_SECURITY_TYPE');
|
|
73
|
-
});
|
|
74
|
-
});
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { SecurityTypeProto } from '../../../fintekkers/models/security/security_type_pb';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Static helpers around the SecurityType proto enum, mirroring the
|
|
5
|
-
* Identifier wrapper pattern shipped in v0.1.133 (PR #188).
|
|
6
|
-
*
|
|
7
|
-
* Lets TS/JS consumers stop hand-typing literal unions and switch
|
|
8
|
-
* statements over `'BOND_SECURITY' | 'TIPS' | 'FRN' | ...` — adding a
|
|
9
|
-
* new variant on the proto side propagates automatically.
|
|
10
|
-
*/
|
|
11
|
-
export class SecurityType {
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Returns the names of all known SecurityTypeProto values, EXCLUDING
|
|
15
|
-
* the sentinel `UNKNOWN_SECURITY_TYPE`. Drives UI dropdowns / pickers
|
|
16
|
-
* so a new proto enum variant auto-propagates to consumers without
|
|
17
|
-
* any UI-side code change.
|
|
18
|
-
*
|
|
19
|
-
* Order matches proto declaration order (Object.keys preserves
|
|
20
|
-
* insertion order on the generated JS enum object).
|
|
21
|
-
*/
|
|
22
|
-
static getAllTypeNames(): string[] {
|
|
23
|
-
return Object.keys(SecurityTypeProto).filter(
|
|
24
|
-
k => k !== 'UNKNOWN_SECURITY_TYPE'
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Resolve a proto enum NAME (e.g., "BOND_SECURITY", "EQUITY_SECURITY")
|
|
30
|
-
* to its numeric SecurityTypeProto value. Throws on unknown name; the
|
|
31
|
-
* error lists the valid names so typos are fixable without grepping
|
|
32
|
-
* the proto.
|
|
33
|
-
*
|
|
34
|
-
* @param name proto enum key (e.g., "BOND_SECURITY")
|
|
35
|
-
* @returns the numeric SecurityTypeProto value
|
|
36
|
-
*/
|
|
37
|
-
static fromName(name: string): SecurityTypeProto {
|
|
38
|
-
const enumObj = SecurityTypeProto as unknown as Record<string, number>;
|
|
39
|
-
const enumValue = enumObj[name];
|
|
40
|
-
if (enumValue === undefined) {
|
|
41
|
-
throw new Error(
|
|
42
|
-
`Unknown SecurityType name: '${name}'. Valid names: ${SecurityType.getAllTypeNames().join(', ')}`
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
return enumValue as SecurityTypeProto;
|
|
46
|
-
}
|
|
47
|
-
}
|
/package/node/fintekkers/models/security/{security_type_grpc_pb.js → instrument_type_grpc_pb.js}
RENAMED
|
File without changes
|