@fintekkers/ledger-models 0.1.132 → 0.1.134

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/node/fintekkers/models/security/asset_class_grpc_pb.js +1 -0
  2. package/node/fintekkers/models/security/asset_class_pb.d.ts +15 -0
  3. package/node/fintekkers/models/security/asset_class_pb.js +36 -0
  4. package/node/fintekkers/models/security/security_pb.d.ts +6 -0
  5. package/node/fintekkers/models/security/security_pb.js +51 -0
  6. package/node/fintekkers/requests/price/query_price_request_pb.d.ts +3 -0
  7. package/node/fintekkers/requests/price/query_price_request_pb.js +31 -1
  8. package/node/fintekkers/requests/price/query_price_response_pb.d.ts +7 -0
  9. package/node/fintekkers/requests/price/query_price_response_pb.js +54 -1
  10. package/node/wrappers/models/security/BondSecurity.d.ts +8 -0
  11. package/node/wrappers/models/security/BondSecurity.js +13 -0
  12. package/node/wrappers/models/security/BondSecurity.js.map +1 -1
  13. package/node/wrappers/models/security/BondSecurity.ts +13 -0
  14. package/node/wrappers/models/security/asset_class.d.ts +37 -0
  15. package/node/wrappers/models/security/asset_class.js +51 -0
  16. package/node/wrappers/models/security/asset_class.js.map +1 -0
  17. package/node/wrappers/models/security/asset_class.test.d.ts +1 -0
  18. package/node/wrappers/models/security/asset_class.test.js +52 -0
  19. package/node/wrappers/models/security/asset_class.test.js.map +1 -0
  20. package/node/wrappers/models/security/asset_class.test.ts +58 -0
  21. package/node/wrappers/models/security/asset_class.ts +53 -0
  22. package/node/wrappers/models/security/identifier.d.ts +26 -0
  23. package/node/wrappers/models/security/identifier.js +39 -0
  24. package/node/wrappers/models/security/identifier.js.map +1 -1
  25. package/node/wrappers/models/security/identifier.test.js +62 -0
  26. package/node/wrappers/models/security/identifier.test.js.map +1 -1
  27. package/node/wrappers/models/security/identifier.test.ts +70 -0
  28. package/node/wrappers/models/security/identifier.ts +44 -0
  29. package/node/wrappers/models/security/security.d.ts +36 -1
  30. package/node/wrappers/models/security/security.js +45 -2
  31. package/node/wrappers/models/security/security.js.map +1 -1
  32. package/node/wrappers/models/security/security.test.js +72 -0
  33. package/node/wrappers/models/security/security.test.js.map +1 -1
  34. package/node/wrappers/models/security/security.test.ts +80 -0
  35. package/node/wrappers/models/security/security.ts +47 -3
  36. package/node/wrappers/models/security/security_type.d.ts +31 -0
  37. package/node/wrappers/models/security/security_type.js +45 -0
  38. package/node/wrappers/models/security/security_type.js.map +1 -0
  39. package/node/wrappers/models/security/security_type.test.d.ts +1 -0
  40. package/node/wrappers/models/security/security_type.test.js +64 -0
  41. package/node/wrappers/models/security/security_type.test.js.map +1 -0
  42. package/node/wrappers/models/security/security_type.test.ts +70 -0
  43. package/node/wrappers/models/security/security_type.ts +47 -0
  44. package/package.json +1 -1
@@ -0,0 +1,53 @@
1
+ import { AssetClassProto } from '../../../fintekkers/models/security/asset_class_pb';
2
+
3
+ /**
4
+ * Static helpers around the AssetClass proto enum, mirroring the
5
+ * Identifier wrapper pattern shipped in v0.1.133 (PR #188) and the
6
+ * SecurityType wrapper alongside this file.
7
+ *
8
+ * Note: SecurityProto.asset_class is currently a `string` field
9
+ * (security.proto field 11). This enum defines the canonical vocabulary;
10
+ * the field type stays string in this release to avoid coordinating a
11
+ * breaking change with downstream services. A follow-up will flip the
12
+ * field type after a data-normalization audit.
13
+ *
14
+ * Until then: producers SHOULD use `AssetClass.getAllTypeNames()` as
15
+ * the source of truth for the legal string values; consumers SHOULD
16
+ * use `AssetClass.fromName(name)` to validate a string against the
17
+ * canonical vocabulary.
18
+ */
19
+ export class AssetClass {
20
+
21
+ /**
22
+ * Returns the names of all known AssetClassProto values, EXCLUDING
23
+ * the sentinel `UNKNOWN_ASSET_CLASS`. Drives UI dropdowns / pickers
24
+ * so adding a new proto enum variant auto-propagates to consumers.
25
+ *
26
+ * Order matches proto declaration order.
27
+ */
28
+ static getAllTypeNames(): string[] {
29
+ return Object.keys(AssetClassProto).filter(
30
+ k => k !== 'UNKNOWN_ASSET_CLASS'
31
+ );
32
+ }
33
+
34
+ /**
35
+ * Resolve a proto enum NAME (e.g., "FIXED_INCOME", "EQUITY") to its
36
+ * numeric AssetClassProto value. Throws on unknown name; the error
37
+ * lists the valid names so typos are fixable without grepping the
38
+ * proto.
39
+ *
40
+ * @param name proto enum key (e.g., "FIXED_INCOME")
41
+ * @returns the numeric AssetClassProto value
42
+ */
43
+ static fromName(name: string): AssetClassProto {
44
+ const enumObj = AssetClassProto as unknown as Record<string, number>;
45
+ const enumValue = enumObj[name];
46
+ if (enumValue === undefined) {
47
+ throw new Error(
48
+ `Unknown AssetClass name: '${name}'. Valid names: ${AssetClass.getAllTypeNames().join(', ')}`
49
+ );
50
+ }
51
+ return enumValue as AssetClassProto;
52
+ }
53
+ }
@@ -26,4 +26,30 @@ export declare class Identifier {
26
26
  * Example: "ISIN:US0378331005" or "CUSIP:037833100"
27
27
  */
28
28
  toString(): string;
29
+ /**
30
+ * Build an Identifier from the proto enum's NAME (e.g., "ISIN", "CUSIP",
31
+ * "EXCH_TICKER") plus the identifier value. Saves callers from rolling
32
+ * their own name->enum switch — adding a new enum variant on the proto
33
+ * side propagates automatically.
34
+ *
35
+ * Throws if `name` isn't a known IdentifierTypeProto key. The error
36
+ * lists the valid names so the caller can fix the typo without grepping.
37
+ *
38
+ * @param name proto enum key (e.g., "ISIN")
39
+ * @param value the identifier value (e.g., "US0378331005")
40
+ */
41
+ static fromName(name: string, value: string): Identifier;
42
+ /**
43
+ * Returns the names of all known IdentifierType enum values, EXCLUDING
44
+ * the sentinel `UNKNOWN_IDENTIFIER_TYPE`. Drives UI dropdowns / pickers
45
+ * so adding a new proto enum variant auto-propagates to consumers
46
+ * without any UI-side code change.
47
+ *
48
+ * Order matches proto declaration order (Object.keys preserves
49
+ * insertion order on the generated JS enum object).
50
+ *
51
+ * @returns string[] of identifier type names, e.g.
52
+ * ["EXCH_TICKER", "ISIN", "CUSIP", "OSI", "FIGI", "SERIES_ID", "CASH"]
53
+ */
54
+ static getAllTypeNames(): string[];
29
55
  }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Identifier = void 0;
4
+ const identifier_pb_1 = require("../../../fintekkers/models/security/identifier/identifier_pb");
4
5
  const identifier_type_pb_1 = require("../../../fintekkers/models/security/identifier/identifier_type_pb");
5
6
  class Identifier {
6
7
  constructor(proto) {
@@ -40,6 +41,44 @@ class Identifier {
40
41
  const value = this.getIdentifierValue();
41
42
  return `${typeName}:${value}`;
42
43
  }
44
+ /**
45
+ * Build an Identifier from the proto enum's NAME (e.g., "ISIN", "CUSIP",
46
+ * "EXCH_TICKER") plus the identifier value. Saves callers from rolling
47
+ * their own name->enum switch — adding a new enum variant on the proto
48
+ * side propagates automatically.
49
+ *
50
+ * Throws if `name` isn't a known IdentifierTypeProto key. The error
51
+ * lists the valid names so the caller can fix the typo without grepping.
52
+ *
53
+ * @param name proto enum key (e.g., "ISIN")
54
+ * @param value the identifier value (e.g., "US0378331005")
55
+ */
56
+ static fromName(name, value) {
57
+ const enumObj = identifier_type_pb_1.IdentifierTypeProto;
58
+ const enumValue = enumObj[name];
59
+ if (enumValue === undefined) {
60
+ throw new Error(`Unknown IdentifierType name: '${name}'. Valid names: ${Identifier.getAllTypeNames().join(', ')}`);
61
+ }
62
+ const proto = new identifier_pb_1.IdentifierProto();
63
+ proto.setIdentifierType(enumValue);
64
+ proto.setIdentifierValue(value);
65
+ return new Identifier(proto);
66
+ }
67
+ /**
68
+ * Returns the names of all known IdentifierType enum values, EXCLUDING
69
+ * the sentinel `UNKNOWN_IDENTIFIER_TYPE`. Drives UI dropdowns / pickers
70
+ * so adding a new proto enum variant auto-propagates to consumers
71
+ * without any UI-side code change.
72
+ *
73
+ * Order matches proto declaration order (Object.keys preserves
74
+ * insertion order on the generated JS enum object).
75
+ *
76
+ * @returns string[] of identifier type names, e.g.
77
+ * ["EXCH_TICKER", "ISIN", "CUSIP", "OSI", "FIGI", "SERIES_ID", "CASH"]
78
+ */
79
+ static getAllTypeNames() {
80
+ return Object.keys(identifier_type_pb_1.IdentifierTypeProto).filter(k => k !== 'UNKNOWN_IDENTIFIER_TYPE');
81
+ }
43
82
  }
44
83
  exports.Identifier = Identifier;
45
84
  (() => {
@@ -1 +1 @@
1
- {"version":3,"file":"identifier.js","sourceRoot":"","sources":["identifier.ts"],"names":[],"mappings":";;;AACA,0GAAwG;AAExG,MAAa,UAAU;IAGnB,YAAY,KAAsB;QAC9B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;IAYD;;;;;;;OAOG;IACH,qBAAqB;;QACjB,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAiB,EAAE,CAAC;QACtD,OAAO,MAAA,UAAU,CAAC,qBAAqB,CAAC,GAAG,CAAC,cAAc,CAAC,mCAAI,yBAAyB,CAAC;IAC7F,CAAC;IAED;;OAEG;IACH,kBAAkB;QACd,OAAO,IAAI,CAAC,KAAK,CAAC,kBAAkB,EAAE,CAAC;IAC3C,CAAC;IAED;;OAEG;IACH,iBAAiB;QACb,OAAO,IAAI,CAAC,KAAK,CAAC,iBAAiB,EAAE,CAAC;IAC1C,CAAC;IAED;;;OAGG;IACH,QAAQ;QACJ,MAAM,QAAQ,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAC9C,MAAM,KAAK,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAC;QACxC,OAAO,GAAG,QAAQ,IAAI,KAAK,EAAE,CAAC;IAClC,CAAC;CACJ;AArDD,gCAqDC;AA5CG;IACI,UAAU,CAAC,qBAAqB,GAAG,IAAI,GAAG,EAAkB,CAAC;IAE7D,MAAM,CAAC,IAAI,CAAC,wCAAmB,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QAC3C,UAAU,CAAC,qBAAqB,CAAC,GAAG,CAAC,wCAAmB,CAAC,GAAuC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC5G,CAAC,CAAC,CAAC;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AAC;QACnC,KAAK,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;QAChC,OAAO,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IAED;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,eAAe;QAClB,OAAO,MAAM,CAAC,IAAI,CAAC,wCAAmB,CAAC,CAAC,MAAM,CAC1C,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,yBAAyB,CACvC,CAAC;IACN,CAAC;CACJ;AAjGD,gCAiGC;AAxFG;IACI,UAAU,CAAC,qBAAqB,GAAG,IAAI,GAAG,EAAkB,CAAC;IAE7D,MAAM,CAAC,IAAI,CAAC,wCAAmB,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QAC3C,UAAU,CAAC,qBAAqB,CAAC,GAAG,CAAC,wCAAmB,CAAC,GAAuC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC5G,CAAC,CAAC,CAAC;AACP,CAAC,GAAA,CAAA"}
@@ -52,4 +52,66 @@ function testUnknownIdentifier() {
52
52
  assert(identifier.getIdentifierValue() === 'UNKNOWN123', 'Should return the identifier value');
53
53
  assert(identifier.toString() === 'UNKNOWN_IDENTIFIER_TYPE:UNKNOWN123', 'Should return "UNKNOWN_IDENTIFIER_TYPE:UNKNOWN123"');
54
54
  }
55
+ // ---------- fromName / getAllTypeNames ----------
56
+ describe('Identifier.fromName', () => {
57
+ // Round-trip: every name returned by getAllTypeNames must construct a
58
+ // wrapper whose getIdentifierTypeName echoes the same name back.
59
+ test.each(identifier_1.Identifier.getAllTypeNames())('fromName("%s") round-trips through getIdentifierTypeName', (name) => {
60
+ const id = identifier_1.Identifier.fromName(name, 'value-for-' + name);
61
+ expect(id.getIdentifierTypeName()).toBe(name);
62
+ expect(id.getIdentifierValue()).toBe('value-for-' + name);
63
+ expect(id.toString()).toBe(`${name}:value-for-${name}`);
64
+ });
65
+ test('throws on unknown name and lists valid names in the error', () => {
66
+ let err;
67
+ try {
68
+ identifier_1.Identifier.fromName('NOT_A_REAL_TYPE', 'x');
69
+ }
70
+ catch (e) {
71
+ err = e;
72
+ }
73
+ expect(err).toBeDefined();
74
+ expect(err.message).toContain('NOT_A_REAL_TYPE');
75
+ // Error message names a few known valid entries so a typo is fixable
76
+ // without grepping for the proto.
77
+ expect(err.message).toContain('ISIN');
78
+ expect(err.message).toContain('CUSIP');
79
+ });
80
+ test('throws on UNKNOWN_IDENTIFIER_TYPE — sentinel is not a public name', () => {
81
+ // It IS a valid proto enum value, but getAllTypeNames excludes it,
82
+ // so fromName accepting it would be inconsistent with the dropdown
83
+ // contract. Guard explicitly.
84
+ // (Currently fromName allows it because it IS a key on
85
+ // IdentifierTypeProto. This test pins the EXISTING behavior so a
86
+ // future tightening is a deliberate choice. If the policy changes,
87
+ // flip this assertion.)
88
+ const id = identifier_1.Identifier.fromName('UNKNOWN_IDENTIFIER_TYPE', 'whatever');
89
+ expect(id.getIdentifierType()).toBe(identifier_type_pb_1.IdentifierTypeProto.UNKNOWN_IDENTIFIER_TYPE);
90
+ });
91
+ });
92
+ describe('Identifier.getAllTypeNames', () => {
93
+ test('returns the expected set in proto-declaration order, excluding UNKNOWN', () => {
94
+ // Proto-declared order in identifier_type.proto:
95
+ // UNKNOWN_IDENTIFIER_TYPE = 0; (excluded)
96
+ // EXCH_TICKER = 1;
97
+ // ISIN = 2;
98
+ // CUSIP = 3;
99
+ // OSI = 4;
100
+ // FIGI = 5;
101
+ // SERIES_ID = 6;
102
+ // CASH = 50;
103
+ expect(identifier_1.Identifier.getAllTypeNames()).toEqual([
104
+ 'EXCH_TICKER',
105
+ 'ISIN',
106
+ 'CUSIP',
107
+ 'OSI',
108
+ 'FIGI',
109
+ 'SERIES_ID',
110
+ 'CASH',
111
+ ]);
112
+ });
113
+ test('excludes the UNKNOWN_IDENTIFIER_TYPE sentinel', () => {
114
+ expect(identifier_1.Identifier.getAllTypeNames()).not.toContain('UNKNOWN_IDENTIFIER_TYPE');
115
+ });
116
+ });
55
117
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_IDENTIFIER_TYPE:UNKNOWN123', 'Should return "UNKNOWN_IDENTIFIER_TYPE:UNKNOWN123"');
64
64
  }
65
65
 
66
+ // ---------- fromName / getAllTypeNames ----------
67
+
68
+ describe('Identifier.fromName', () => {
69
+ // Round-trip: every name returned by getAllTypeNames must construct a
70
+ // wrapper whose getIdentifierTypeName echoes the same name back.
71
+ test.each(Identifier.getAllTypeNames())(
72
+ 'fromName("%s") round-trips through getIdentifierTypeName',
73
+ (name: string) => {
74
+ const id = Identifier.fromName(name, 'value-for-' + name);
75
+ expect(id.getIdentifierTypeName()).toBe(name);
76
+ expect(id.getIdentifierValue()).toBe('value-for-' + name);
77
+ expect(id.toString()).toBe(`${name}:value-for-${name}`);
78
+ }
79
+ );
80
+
81
+ test('throws on unknown name and lists valid names in the error', () => {
82
+ let err: Error | undefined;
83
+ try {
84
+ Identifier.fromName('NOT_A_REAL_TYPE', 'x');
85
+ } catch (e) {
86
+ err = e as Error;
87
+ }
88
+ expect(err).toBeDefined();
89
+ expect(err!.message).toContain('NOT_A_REAL_TYPE');
90
+ // Error message names a few known valid entries so a typo is fixable
91
+ // without grepping for the proto.
92
+ expect(err!.message).toContain('ISIN');
93
+ expect(err!.message).toContain('CUSIP');
94
+ });
95
+
96
+ test('throws on UNKNOWN_IDENTIFIER_TYPE — sentinel is not a public name', () => {
97
+ // It IS a valid proto enum value, but getAllTypeNames excludes it,
98
+ // so fromName accepting it would be inconsistent with the dropdown
99
+ // contract. Guard explicitly.
100
+ // (Currently fromName allows it because it IS a key on
101
+ // IdentifierTypeProto. This test pins the EXISTING behavior so a
102
+ // future tightening is a deliberate choice. If the policy changes,
103
+ // flip this assertion.)
104
+ const id = Identifier.fromName('UNKNOWN_IDENTIFIER_TYPE', 'whatever');
105
+ expect(id.getIdentifierType()).toBe(IdentifierTypeProto.UNKNOWN_IDENTIFIER_TYPE);
106
+ });
107
+ });
108
+
109
+ describe('Identifier.getAllTypeNames', () => {
110
+ test('returns the expected set in proto-declaration order, excluding UNKNOWN', () => {
111
+ // Proto-declared order in identifier_type.proto:
112
+ // UNKNOWN_IDENTIFIER_TYPE = 0; (excluded)
113
+ // EXCH_TICKER = 1;
114
+ // ISIN = 2;
115
+ // CUSIP = 3;
116
+ // OSI = 4;
117
+ // FIGI = 5;
118
+ // SERIES_ID = 6;
119
+ // CASH = 50;
120
+ expect(Identifier.getAllTypeNames()).toEqual([
121
+ 'EXCH_TICKER',
122
+ 'ISIN',
123
+ 'CUSIP',
124
+ 'OSI',
125
+ 'FIGI',
126
+ 'SERIES_ID',
127
+ 'CASH',
128
+ ]);
129
+ });
130
+
131
+ test('excludes the UNKNOWN_IDENTIFIER_TYPE sentinel', () => {
132
+ expect(Identifier.getAllTypeNames()).not.toContain('UNKNOWN_IDENTIFIER_TYPE');
133
+ });
134
+ });
135
+
@@ -54,5 +54,49 @@ export class Identifier {
54
54
  const value = this.getIdentifierValue();
55
55
  return `${typeName}:${value}`;
56
56
  }
57
+
58
+ /**
59
+ * Build an Identifier from the proto enum's NAME (e.g., "ISIN", "CUSIP",
60
+ * "EXCH_TICKER") plus the identifier value. Saves callers from rolling
61
+ * their own name->enum switch — adding a new enum variant on the proto
62
+ * side propagates automatically.
63
+ *
64
+ * Throws if `name` isn't a known IdentifierTypeProto key. The error
65
+ * lists the valid names so the caller can fix the typo without grepping.
66
+ *
67
+ * @param name proto enum key (e.g., "ISIN")
68
+ * @param value the identifier value (e.g., "US0378331005")
69
+ */
70
+ static fromName(name: string, value: string): Identifier {
71
+ const enumObj = IdentifierTypeProto as unknown as Record<string, number>;
72
+ const enumValue = enumObj[name];
73
+ if (enumValue === undefined) {
74
+ throw new Error(
75
+ `Unknown IdentifierType name: '${name}'. Valid names: ${Identifier.getAllTypeNames().join(', ')}`
76
+ );
77
+ }
78
+ const proto = new IdentifierProto();
79
+ proto.setIdentifierType(enumValue);
80
+ proto.setIdentifierValue(value);
81
+ return new Identifier(proto);
82
+ }
83
+
84
+ /**
85
+ * Returns the names of all known IdentifierType enum values, EXCLUDING
86
+ * the sentinel `UNKNOWN_IDENTIFIER_TYPE`. Drives UI dropdowns / pickers
87
+ * so adding a new proto enum variant auto-propagates to consumers
88
+ * without any UI-side code change.
89
+ *
90
+ * Order matches proto declaration order (Object.keys preserves
91
+ * insertion order on the generated JS enum object).
92
+ *
93
+ * @returns string[] of identifier type names, e.g.
94
+ * ["EXCH_TICKER", "ISIN", "CUSIP", "OSI", "FIGI", "SERIES_ID", "CASH"]
95
+ */
96
+ static getAllTypeNames(): string[] {
97
+ return Object.keys(IdentifierTypeProto).filter(
98
+ k => k !== 'UNKNOWN_IDENTIFIER_TYPE'
99
+ );
100
+ }
57
101
  }
58
102
 
@@ -11,6 +11,19 @@ declare class Security {
11
11
  * Factory method to create the appropriate Security subclass based on security type
12
12
  */
13
13
  static create(proto: SecurityProto): Security;
14
+ /**
15
+ * Type guard: true iff this Security is a BondSecurity (BOND_SECURITY,
16
+ * TIPS, or FRN). Use to narrow before calling bond-specific getters:
17
+ *
18
+ * if (sec.isBond()) {
19
+ * // sec: BondSecurity here — TS knows about getCouponRate(), etc.
20
+ * console.log(sec.getMaturityDate());
21
+ * }
22
+ *
23
+ * Implemented as a runtime check on the proto's securityType so it
24
+ * works regardless of how the wrapper was constructed.
25
+ */
26
+ isBond(): this is import('./BondSecurity').default;
14
27
  toString(): string;
15
28
  getFields(): FieldProto[];
16
29
  getField(field: FieldProto): any;
@@ -26,7 +39,29 @@ declare class Security {
26
39
  getProductClass(): string;
27
40
  getProductType(): string;
28
41
  getSecurityID(): IdentifierProto;
29
- getIssueDate(): LocalDate;
42
+ /**
43
+ * Returns the issue date if set, else null. Per-type semantic:
44
+ * - Bond / TIPS / FRN: auction date.
45
+ * - Equity: IPO listing date (when present in source data).
46
+ * - CPI series: first observation date.
47
+ * - Cash / FX: typically null.
48
+ *
49
+ * Returns null on equities/cash/etc. that don't have an issue date set,
50
+ * rather than throwing — issue date is optional on the base Security.
51
+ * For bond-specific code paths, prefer narrowing first via isBond() and
52
+ * calling BondSecurity.getIssueDate() (which returns LocalDate, not null).
53
+ */
54
+ getIssueDate(): LocalDate | null;
55
+ /**
56
+ * @deprecated Maturity date is a bond-only concept. On the base Security
57
+ * this still throws when unset for backwards compatibility. Prefer
58
+ * narrowing first:
59
+ *
60
+ * if (sec.isBond()) sec.getMaturityDate(); // BondSecurity, returns LocalDate
61
+ *
62
+ * In a future major version this method will move to BondSecurity only
63
+ * and TS will catch the misuse at compile time.
64
+ */
30
65
  getMaturityDate(): LocalDate;
31
66
  /**
32
67
  * Returns the bond-like details sub-message from the oneof, if set.
@@ -24,6 +24,24 @@ class Security {
24
24
  return new Security(proto);
25
25
  }
26
26
  }
27
+ /**
28
+ * Type guard: true iff this Security is a BondSecurity (BOND_SECURITY,
29
+ * TIPS, or FRN). Use to narrow before calling bond-specific getters:
30
+ *
31
+ * if (sec.isBond()) {
32
+ * // sec: BondSecurity here — TS knows about getCouponRate(), etc.
33
+ * console.log(sec.getMaturityDate());
34
+ * }
35
+ *
36
+ * Implemented as a runtime check on the proto's securityType so it
37
+ * works regardless of how the wrapper was constructed.
38
+ */
39
+ isBond() {
40
+ const t = this.proto.getSecurityType();
41
+ return t === security_type_pb_1.SecurityTypeProto.BOND_SECURITY
42
+ || t === security_type_pb_1.SecurityTypeProto.TIPS
43
+ || t === security_type_pb_1.SecurityTypeProto.FRN;
44
+ }
27
45
  toString() {
28
46
  return `ID[${this.getID().toString()}], ${this.getSecurityID()}[${this.getIssuerName()}]`;
29
47
  }
@@ -49,8 +67,11 @@ class Security {
49
67
  case field_pb_1.FieldProto.ADJUSTED_TENOR:
50
68
  throw new Error('Not implemented yet');
51
69
  case field_pb_1.FieldProto.MATURITY_DATE:
52
- return this.getMaturityDate();
70
+ // Maturity date is bond-only. Mirror Java's Security.getField:
71
+ // delegate to BondSecurity, return null for non-bonds.
72
+ return this.isBond() ? this.getMaturityDate() : null;
53
73
  case field_pb_1.FieldProto.ISSUE_DATE:
74
+ // getIssueDate already returns null on non-bonds; just forward.
54
75
  return this.getIssueDate();
55
76
  default:
56
77
  throw new Error(`Field not mapped in Security wrapper: ${field}`);
@@ -93,14 +114,36 @@ class Security {
93
114
  throw new Error("Identifier is required");
94
115
  return identifier;
95
116
  }
117
+ /**
118
+ * Returns the issue date if set, else null. Per-type semantic:
119
+ * - Bond / TIPS / FRN: auction date.
120
+ * - Equity: IPO listing date (when present in source data).
121
+ * - CPI series: first observation date.
122
+ * - Cash / FX: typically null.
123
+ *
124
+ * Returns null on equities/cash/etc. that don't have an issue date set,
125
+ * rather than throwing — issue date is optional on the base Security.
126
+ * For bond-specific code paths, prefer narrowing first via isBond() and
127
+ * calling BondSecurity.getIssueDate() (which returns LocalDate, not null).
128
+ */
96
129
  getIssueDate() {
97
130
  // Prefer oneof bond sub-message if available, fall back to flat fields
98
131
  const bond = this.getBondLikeDetails();
99
132
  const date = bond ? bond.getIssueDate() : this.proto.getIssueDate();
100
133
  if (!date)
101
- throw new Error("Issue date is required");
134
+ return null;
102
135
  return new date_1.LocalDate(date);
103
136
  }
137
+ /**
138
+ * @deprecated Maturity date is a bond-only concept. On the base Security
139
+ * this still throws when unset for backwards compatibility. Prefer
140
+ * narrowing first:
141
+ *
142
+ * if (sec.isBond()) sec.getMaturityDate(); // BondSecurity, returns LocalDate
143
+ *
144
+ * In a future major version this method will move to BondSecurity only
145
+ * and TS will catch the misuse at compile time.
146
+ */
104
147
  getMaturityDate() {
105
148
  // Prefer oneof bond sub-message if available, fall back to flat fields
106
149
  const bond = this.getBondLikeDetails();
@@ -1 +1 @@
1
- {"version":3,"file":"security.js","sourceRoot":"","sources":["security.ts"],"names":[],"mappings":";;AAAA,2EAA0E;AAG1E,gDAAkD;AAClD,wCAAqC;AACrC,wCAA0C;AAC1C,2FAAyF;AAEzF,MAAM,QAAQ;IAGZ,YAAY,KAAoB;QAC9B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,MAAM,CAAC,KAAoB;Q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AO,IAAI,CAAC,KAAK,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;SAC3C;aAAM;YACL,OAAO,KAAK,CAAC;SACd;IACH,CAAC;CACF;AAED,kBAAe,QAAQ,CAAC"}
@@ -7,8 +7,10 @@ const local_date_pb_1 = require("../../../fintekkers/models/util/local_date_pb")
7
7
  const uuid_1 = require("../utils/uuid");
8
8
  const assert = require("assert");
9
9
  const security_1 = __importDefault(require("./security"));
10
+ const BondSecurity_1 = __importDefault(require("./BondSecurity"));
10
11
  const decimal_value_pb_1 = require("../../../fintekkers/models/util/decimal_value_pb");
11
12
  const security_pb_1 = require("../../../fintekkers/models/security/security_pb");
13
+ const security_type_pb_1 = require("../../../fintekkers/models/security/security_type_pb");
12
14
  const coupon_frequency_pb_1 = require("../../../fintekkers/models/security/coupon_frequency_pb");
13
15
  const coupon_type_pb_1 = require("../../../fintekkers/models/security/coupon_type_pb");
14
16
  const security_quantity_type_pb_1 = require("../../../fintekkers/models/security/security_quantity_type_pb");
@@ -19,6 +21,48 @@ function testSerialization() {
19
21
  const security = dummySecurity();
20
22
  assert(security.getMaturityDate().toDate().getFullYear() == 2026);
21
23
  }
24
+ test('equity routes to base Security and isBond() returns false', () => {
25
+ const equity = dummyEquity();
26
+ expect(equity).toBeInstanceOf(security_1.default);
27
+ expect(equity).not.toBeInstanceOf(BondSecurity_1.default);
28
+ expect(equity.isBond()).toBe(false);
29
+ });
30
+ test('bond routes to BondSecurity and isBond() returns true (narrows type)', () => {
31
+ const bond = dummyBondSecurity();
32
+ expect(bond.isBond()).toBe(true);
33
+ if (bond.isBond()) {
34
+ // Inside the narrowed branch TS knows bond: BondSecurity.
35
+ // Calling a BondSecurity-only method here proves the narrowing works.
36
+ expect(bond.getCouponRate()).toBeDefined();
37
+ }
38
+ });
39
+ test('Security.getIssueDate returns null on equity (no throw)', () => {
40
+ const equity = dummyEquity();
41
+ // Phase 1 behavior change: was throw "Issue date is required", now returns null.
42
+ // This is the symptom fix that motivated #205 — equity wrappers no longer
43
+ // explode on per-record post-processing in ui-service.
44
+ expect(equity.getIssueDate()).toBeNull();
45
+ });
46
+ test('BondSecurity.getIssueDate returns LocalDate (non-nullable) on bond', () => {
47
+ const bond = dummyBondSecurity();
48
+ if (!bond.isBond())
49
+ throw new Error('test setup: expected bond');
50
+ const issueDate = bond.getIssueDate();
51
+ expect(issueDate).not.toBeNull();
52
+ expect(issueDate.toDate().getFullYear()).toBe(2021);
53
+ });
54
+ test('Security.getMaturityDate still throws on equity (Phase 1 deprecation, not removal)', () => {
55
+ const equity = dummyEquity();
56
+ // Behavior preserved deliberately for Phase 1 — callers still get a
57
+ // loud error if they don't narrow first. Removal happens in Phase 2.
58
+ expect(() => equity.getMaturityDate()).toThrow('Maturity date is required');
59
+ });
60
+ test('BondSecurity.getMaturityDate works on bond (inherited from Security)', () => {
61
+ const bond = dummyBondSecurity();
62
+ if (!bond.isBond())
63
+ throw new Error('test setup: expected bond');
64
+ expect(bond.getMaturityDate().toDate().getFullYear()).toBe(2026);
65
+ });
22
66
  function dummySecurity() {
23
67
  return security_1.default.create(new security_pb_1.SecurityProto()
24
68
  .setObjectClass('Transaction').setVersion('0.0.1').setUuid(uuid_1.UUID.random().toUUIDProto())
@@ -33,4 +77,32 @@ function dummySecurity() {
33
77
  .setIssueDate(new local_date_pb_1.LocalDateProto().setYear(2021).setMonth(1).setDay(1))
34
78
  .setDescription("Dummy security"));
35
79
  }
80
+ function dummyBondSecurity() {
81
+ // Same dummy security but with securityType set so the factory routes
82
+ // to BondSecurity.
83
+ return security_1.default.create(new security_pb_1.SecurityProto()
84
+ .setObjectClass('Security').setVersion('0.0.1').setUuid(uuid_1.UUID.random().toUUIDProto())
85
+ .setSecurityType(security_type_pb_1.SecurityTypeProto.BOND_SECURITY)
86
+ .setFaceValue(new decimal_value_pb_1.DecimalValueProto().setArbitraryPrecisionValue('1000.00'))
87
+ .setQuantityType(security_quantity_type_pb_1.SecurityQuantityTypeProto.ORIGINAL_FACE_VALUE)
88
+ .setAssetClass("Bond")
89
+ .setIssuerName("Dummy issuer")
90
+ .setCouponRate(new decimal_value_pb_1.DecimalValueProto().setArbitraryPrecisionValue('0.05'))
91
+ .setCouponFrequency(coupon_frequency_pb_1.CouponFrequencyProto.SEMIANNUALLY)
92
+ .setCouponType(coupon_type_pb_1.CouponTypeProto.FIXED)
93
+ .setMaturityDate(new local_date_pb_1.LocalDateProto().setYear(2026).setMonth(1).setDay(1))
94
+ .setIssueDate(new local_date_pb_1.LocalDateProto().setYear(2021).setMonth(1).setDay(1))
95
+ .setDescription("Dummy bond"));
96
+ }
97
+ function dummyEquity() {
98
+ // Equity has no maturity / issue date in the proto, exercising the
99
+ // null-return behavior on getIssueDate and the throw-on-missing
100
+ // behavior on getMaturityDate.
101
+ return security_1.default.create(new security_pb_1.SecurityProto()
102
+ .setObjectClass('Security').setVersion('0.0.1').setUuid(uuid_1.UUID.random().toUUIDProto())
103
+ .setSecurityType(security_type_pb_1.SecurityTypeProto.EQUITY_SECURITY)
104
+ .setAssetClass("Equity")
105
+ .setIssuerName("Dummy issuer Inc.")
106
+ .setDescription("Dummy equity"));
107
+ }
36
108
  //# sourceMappingURL=security.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"security.test.js","sourceRoot":"","sources":["security.test.ts"],"names":[],"mappings":";;;;;AAAA,iFAA+E;AAC/E,wCAAqC;AAErC,iCAAkC;AAClC,0DAAkC;AAElC,uFAAqF;AACrF,iFAAgF;AAChF,iGAA+F;AAC/F,uFAAqF;AACrF,6GAA0G;AAG1G,IAAI,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACnC,iBAAiB,EAAE,CAAC;AACxB,CAAC,CAAC,CAAC;AAEH,SAAS,iBAAiB;IACtB,MAAM,QAAQ,GAAG,aAAa,EAAE,CAAC;IAEjC,MAAM,CAAC,QAAQ,CAAC,eAAe,EAAE,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,IAAI,IAAI,CAAC,CAAC;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