@decafhub/decaf-client-extras 0.0.2 → 0.0.4
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/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +14 -0
- package/README.md +13 -1
- package/commons/-currency.d.ts +7 -7
- package/commons/-currency.js +7 -7
- package/es/commons/-currency.d.ts +7 -7
- package/es/commons/-currency.js +7 -7
- package/es/reports/valuation/-remote-valuation-report-consolidated.d.ts +1 -1
- package/es/reports/valuation/-remote-valuation-report-consolidated.js +1 -1
- package/es/reports/valuation/-remote-valuation-report-portfolio.d.ts +1 -1
- package/es/reports/valuation/-remote-valuation-report-portfolio.js +3 -3
- package/es/reports/valuation/-valuation-report-portfolio.d.ts +2 -2
- package/es/reports/valuation/-valuation-report-shared.d.ts +1 -1
- package/package.json +18 -18
- package/reports/valuation/-remote-valuation-report-consolidated.d.ts +1 -1
- package/reports/valuation/-remote-valuation-report-consolidated.js +1 -1
- package/reports/valuation/-remote-valuation-report-portfolio.d.ts +1 -1
- package/reports/valuation/-remote-valuation-report-portfolio.js +3 -3
- package/reports/valuation/-valuation-report-portfolio.d.ts +2 -2
- package/reports/valuation/-valuation-report-shared.d.ts +1 -1
- package/src/commons/-currency.ts +7 -7
- package/src/reports/valuation/-remote-valuation-report-consolidated.ts +1 -1
- package/src/reports/valuation/-remote-valuation-report-portfolio.ts +3 -3
- package/src/reports/valuation/-valuation-report-portfolio.ts +2 -2
- package/src/reports/valuation/-valuation-report-shared.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.4](https://github.com/teloscube/decaf-client-javascript-extras/compare/v0.0.3...v0.0.4) (2022-11-07)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Miscellaneous Chores
|
|
7
|
+
|
|
8
|
+
* release 0.0.4 ([b3f7a12](https://github.com/teloscube/decaf-client-javascript-extras/commit/b3f7a12b5dbd1ffac7db06f03958d71581889d92))
|
|
9
|
+
|
|
10
|
+
## [0.0.3](https://github.com/teloscube/decaf-client-javascript-extras/compare/v0.0.2...v0.0.3) (2022-08-25)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* pxRefCcy and pxClsCcy types are wrong in share class values ([1862e1a](https://github.com/teloscube/decaf-client-javascript-extras/commit/1862e1abde3d6e5f8a539233e1408557e9465b07)), closes [#16](https://github.com/teloscube/decaf-client-javascript-extras/issues/16)
|
|
16
|
+
|
|
3
17
|
## [0.0.2](https://github.com/teloscube/decaf-client-javascript-extras/compare/v0.0.1...v0.0.2) (2022-08-19)
|
|
4
18
|
|
|
5
19
|
|
package/README.md
CHANGED
|
@@ -4,7 +4,19 @@
|
|
|
4
4
|
[](https://www.npmjs.com/package/@decafhub/decaf-client-extras)
|
|
5
5
|

|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
Install @decafhub/decaf-client-extras along with its peer dependency @decafhub/decaf-client:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install --save @decafhub/decaf-client-extras @decafhub/decaf-client
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Or with yarn:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
yarn add @decafhub/decaf-client-extras @decafhub/decaf-client
|
|
19
|
+
```
|
|
8
20
|
|
|
9
21
|
## Testing
|
|
10
22
|
|
package/commons/-currency.d.ts
CHANGED
|
@@ -11,32 +11,32 @@ import { Maybe, NewTypeWithPhantom } from '@telostat/prelude';
|
|
|
11
11
|
*/
|
|
12
12
|
export declare type CurrencyCode = NewTypeWithPhantom<'CurrencyCode', string>;
|
|
13
13
|
/**
|
|
14
|
-
* Attempts to create a
|
|
14
|
+
* Attempts to create a {@link CurrencyCode} value with the given currency code.
|
|
15
15
|
*
|
|
16
16
|
* This function returns a `Maybe` value. For the version that throws an
|
|
17
|
-
* error, see
|
|
17
|
+
* error, see {@link mkCurrencyCodeError}.
|
|
18
18
|
*
|
|
19
19
|
* @param x A currency code represented as string.
|
|
20
20
|
* @returns If the argument has leading or trailing spaces OR it is empty,
|
|
21
|
-
* `Nothing` is retured, `Just`
|
|
21
|
+
* `Nothing` is retured, `Just` {@link CurrencyCode} otherwise.
|
|
22
22
|
*/
|
|
23
23
|
export declare function mkCurrencyCode(x: string): Maybe<CurrencyCode>;
|
|
24
24
|
/**
|
|
25
|
-
* (Unsafely) attempts to create a
|
|
25
|
+
* (Unsafely) attempts to create a {@link CurrencyCode} value with the given
|
|
26
26
|
* currency code.
|
|
27
27
|
*
|
|
28
28
|
* This function may throw an error if the given argument is not a valid
|
|
29
|
-
* currency code. For the monadic version, see
|
|
29
|
+
* currency code. For the monadic version, see {@link mkCurrencyCode}.
|
|
30
30
|
*
|
|
31
31
|
* @param x A currency code represented as string.
|
|
32
32
|
* @returns If the argument has leading or trailing spaces OR it is empty, an
|
|
33
|
-
* error is thrown,
|
|
33
|
+
* error is thrown, {@link CurrencyCode} is returned otherwise.
|
|
34
34
|
*/
|
|
35
35
|
export declare function mkCurrencyCodeError(x: string): CurrencyCode;
|
|
36
36
|
/**
|
|
37
37
|
* Return the currency code as a string value.
|
|
38
38
|
*
|
|
39
|
-
* @param x
|
|
39
|
+
* @param x {@link CurrencyCode} to be extracted string from.
|
|
40
40
|
* @returns Currency code as a string.
|
|
41
41
|
*/
|
|
42
42
|
export declare function unCurrencyCode(x: CurrencyCode): string;
|
package/commons/-currency.js
CHANGED
|
@@ -8,29 +8,29 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
8
8
|
exports.unCurrencyCode = exports.mkCurrencyCodeError = exports.mkCurrencyCode = void 0;
|
|
9
9
|
var prelude_1 = require("@telostat/prelude");
|
|
10
10
|
/**
|
|
11
|
-
* Attempts to create a
|
|
11
|
+
* Attempts to create a {@link CurrencyCode} value with the given currency code.
|
|
12
12
|
*
|
|
13
13
|
* This function returns a `Maybe` value. For the version that throws an
|
|
14
|
-
* error, see
|
|
14
|
+
* error, see {@link mkCurrencyCodeError}.
|
|
15
15
|
*
|
|
16
16
|
* @param x A currency code represented as string.
|
|
17
17
|
* @returns If the argument has leading or trailing spaces OR it is empty,
|
|
18
|
-
* `Nothing` is retured, `Just`
|
|
18
|
+
* `Nothing` is retured, `Just` {@link CurrencyCode} otherwise.
|
|
19
19
|
*/
|
|
20
20
|
function mkCurrencyCode(x) {
|
|
21
21
|
return x !== x.trim() || x === '' ? prelude_1.Nothing : (0, prelude_1.Just)((0, prelude_1.mkPhantom)(x));
|
|
22
22
|
}
|
|
23
23
|
exports.mkCurrencyCode = mkCurrencyCode;
|
|
24
24
|
/**
|
|
25
|
-
* (Unsafely) attempts to create a
|
|
25
|
+
* (Unsafely) attempts to create a {@link CurrencyCode} value with the given
|
|
26
26
|
* currency code.
|
|
27
27
|
*
|
|
28
28
|
* This function may throw an error if the given argument is not a valid
|
|
29
|
-
* currency code. For the monadic version, see
|
|
29
|
+
* currency code. For the monadic version, see {@link mkCurrencyCode}.
|
|
30
30
|
*
|
|
31
31
|
* @param x A currency code represented as string.
|
|
32
32
|
* @returns If the argument has leading or trailing spaces OR it is empty, an
|
|
33
|
-
* error is thrown,
|
|
33
|
+
* error is thrown, {@link CurrencyCode} is returned otherwise.
|
|
34
34
|
*/
|
|
35
35
|
function mkCurrencyCodeError(x) {
|
|
36
36
|
return mkCurrencyCode(x).orDefaultLazy(function () {
|
|
@@ -41,7 +41,7 @@ exports.mkCurrencyCodeError = mkCurrencyCodeError;
|
|
|
41
41
|
/**
|
|
42
42
|
* Return the currency code as a string value.
|
|
43
43
|
*
|
|
44
|
-
* @param x
|
|
44
|
+
* @param x {@link CurrencyCode} to be extracted string from.
|
|
45
45
|
* @returns Currency code as a string.
|
|
46
46
|
*/
|
|
47
47
|
function unCurrencyCode(x) {
|
|
@@ -11,32 +11,32 @@ import { Maybe, NewTypeWithPhantom } from '@telostat/prelude';
|
|
|
11
11
|
*/
|
|
12
12
|
export declare type CurrencyCode = NewTypeWithPhantom<'CurrencyCode', string>;
|
|
13
13
|
/**
|
|
14
|
-
* Attempts to create a
|
|
14
|
+
* Attempts to create a {@link CurrencyCode} value with the given currency code.
|
|
15
15
|
*
|
|
16
16
|
* This function returns a `Maybe` value. For the version that throws an
|
|
17
|
-
* error, see
|
|
17
|
+
* error, see {@link mkCurrencyCodeError}.
|
|
18
18
|
*
|
|
19
19
|
* @param x A currency code represented as string.
|
|
20
20
|
* @returns If the argument has leading or trailing spaces OR it is empty,
|
|
21
|
-
* `Nothing` is retured, `Just`
|
|
21
|
+
* `Nothing` is retured, `Just` {@link CurrencyCode} otherwise.
|
|
22
22
|
*/
|
|
23
23
|
export declare function mkCurrencyCode(x: string): Maybe<CurrencyCode>;
|
|
24
24
|
/**
|
|
25
|
-
* (Unsafely) attempts to create a
|
|
25
|
+
* (Unsafely) attempts to create a {@link CurrencyCode} value with the given
|
|
26
26
|
* currency code.
|
|
27
27
|
*
|
|
28
28
|
* This function may throw an error if the given argument is not a valid
|
|
29
|
-
* currency code. For the monadic version, see
|
|
29
|
+
* currency code. For the monadic version, see {@link mkCurrencyCode}.
|
|
30
30
|
*
|
|
31
31
|
* @param x A currency code represented as string.
|
|
32
32
|
* @returns If the argument has leading or trailing spaces OR it is empty, an
|
|
33
|
-
* error is thrown,
|
|
33
|
+
* error is thrown, {@link CurrencyCode} is returned otherwise.
|
|
34
34
|
*/
|
|
35
35
|
export declare function mkCurrencyCodeError(x: string): CurrencyCode;
|
|
36
36
|
/**
|
|
37
37
|
* Return the currency code as a string value.
|
|
38
38
|
*
|
|
39
|
-
* @param x
|
|
39
|
+
* @param x {@link CurrencyCode} to be extracted string from.
|
|
40
40
|
* @returns Currency code as a string.
|
|
41
41
|
*/
|
|
42
42
|
export declare function unCurrencyCode(x: CurrencyCode): string;
|
package/es/commons/-currency.js
CHANGED
|
@@ -5,28 +5,28 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { Just, mkPhantom, Nothing, unPhantom } from '@telostat/prelude';
|
|
7
7
|
/**
|
|
8
|
-
* Attempts to create a
|
|
8
|
+
* Attempts to create a {@link CurrencyCode} value with the given currency code.
|
|
9
9
|
*
|
|
10
10
|
* This function returns a `Maybe` value. For the version that throws an
|
|
11
|
-
* error, see
|
|
11
|
+
* error, see {@link mkCurrencyCodeError}.
|
|
12
12
|
*
|
|
13
13
|
* @param x A currency code represented as string.
|
|
14
14
|
* @returns If the argument has leading or trailing spaces OR it is empty,
|
|
15
|
-
* `Nothing` is retured, `Just`
|
|
15
|
+
* `Nothing` is retured, `Just` {@link CurrencyCode} otherwise.
|
|
16
16
|
*/
|
|
17
17
|
export function mkCurrencyCode(x) {
|
|
18
18
|
return x !== x.trim() || x === '' ? Nothing : Just(mkPhantom(x));
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
|
-
* (Unsafely) attempts to create a
|
|
21
|
+
* (Unsafely) attempts to create a {@link CurrencyCode} value with the given
|
|
22
22
|
* currency code.
|
|
23
23
|
*
|
|
24
24
|
* This function may throw an error if the given argument is not a valid
|
|
25
|
-
* currency code. For the monadic version, see
|
|
25
|
+
* currency code. For the monadic version, see {@link mkCurrencyCode}.
|
|
26
26
|
*
|
|
27
27
|
* @param x A currency code represented as string.
|
|
28
28
|
* @returns If the argument has leading or trailing spaces OR it is empty, an
|
|
29
|
-
* error is thrown,
|
|
29
|
+
* error is thrown, {@link CurrencyCode} is returned otherwise.
|
|
30
30
|
*/
|
|
31
31
|
export function mkCurrencyCodeError(x) {
|
|
32
32
|
return mkCurrencyCode(x).orDefaultLazy(() => {
|
|
@@ -36,7 +36,7 @@ export function mkCurrencyCodeError(x) {
|
|
|
36
36
|
/**
|
|
37
37
|
* Return the currency code as a string value.
|
|
38
38
|
*
|
|
39
|
-
* @param x
|
|
39
|
+
* @param x {@link CurrencyCode} to be extracted string from.
|
|
40
40
|
* @returns Currency code as a string.
|
|
41
41
|
*/
|
|
42
42
|
export function unCurrencyCode(x) {
|
|
@@ -60,7 +60,7 @@ export declare function fetchRemoteConsolidatedValuationReport(client: DecafClie
|
|
|
60
60
|
export declare function recompileConsolidatedValuationReport(x: RemoteConsolidatedValuationReport): Either<CustomError, ConsolidatedValuationReport>;
|
|
61
61
|
/**
|
|
62
62
|
* Attempts to retrieve remote consolidated valuation report, compiles it to
|
|
63
|
-
*
|
|
63
|
+
* {@link ConsolidatedValuationReport} and return it.
|
|
64
64
|
*
|
|
65
65
|
* @param client DECAF Barista client.
|
|
66
66
|
* @param query Remote consolidated valuation report endpoint query parameters.
|
|
@@ -42,7 +42,7 @@ export function recompileConsolidatedValuationReport(x) {
|
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
44
|
* Attempts to retrieve remote consolidated valuation report, compiles it to
|
|
45
|
-
*
|
|
45
|
+
* {@link ConsolidatedValuationReport} and return it.
|
|
46
46
|
*
|
|
47
47
|
* @param client DECAF Barista client.
|
|
48
48
|
* @param query Remote consolidated valuation report endpoint query parameters.
|
|
@@ -141,7 +141,7 @@ export declare function toShareClassValue(x: RemoteValuationShareClassValue): Po
|
|
|
141
141
|
export declare function recompilePortfolioValuationReport(x: RemotePortfolioValuationReport): Either<CustomError, PortfolioValuationReport>;
|
|
142
142
|
/**
|
|
143
143
|
* Attempts to retrieve remote portfolio valuation report, compiles it to
|
|
144
|
-
*
|
|
144
|
+
* {@link PortfolioValuationReport} and return it.
|
|
145
145
|
*
|
|
146
146
|
* @param client DECAF Barista client.
|
|
147
147
|
* @param query Remote portolio valuation report endpoint query parameters.
|
|
@@ -91,8 +91,8 @@ export function toShareClassValue(x) {
|
|
|
91
91
|
sharecountPrev: asDecimal(x.sharecount_prev),
|
|
92
92
|
sharecountCurr: asDecimal(x.sharecount_curr),
|
|
93
93
|
sharecountDiff: asDecimal(x.sharecount_diff),
|
|
94
|
-
pxRefCcy:
|
|
95
|
-
pxClsCcy:
|
|
94
|
+
pxRefCcy: maybeDecimal(x.px_refccy),
|
|
95
|
+
pxClsCcy: maybeDecimal(x.px_clsccy),
|
|
96
96
|
ytdExt: maybeDecimal(x.ytdext),
|
|
97
97
|
ytdInt: maybeDecimal(x.ytdint),
|
|
98
98
|
};
|
|
@@ -120,7 +120,7 @@ export function recompilePortfolioValuationReport(x) {
|
|
|
120
120
|
}
|
|
121
121
|
/**
|
|
122
122
|
* Attempts to retrieve remote portfolio valuation report, compiles it to
|
|
123
|
-
*
|
|
123
|
+
* {@link PortfolioValuationReport} and return it.
|
|
124
124
|
*
|
|
125
125
|
* @param client DECAF Barista client.
|
|
126
126
|
* @param query Remote portolio valuation report endpoint query parameters.
|
|
@@ -18,8 +18,8 @@ export interface PortfolioValuationReportShareClassValue {
|
|
|
18
18
|
sharecountPrev: Decimal;
|
|
19
19
|
sharecountCurr: Decimal;
|
|
20
20
|
sharecountDiff: Decimal;
|
|
21
|
-
pxRefCcy: Decimal
|
|
22
|
-
pxClsCcy: Decimal
|
|
21
|
+
pxRefCcy: Maybe<Decimal>;
|
|
22
|
+
pxClsCcy: Maybe<Decimal>;
|
|
23
23
|
ytdExt: Maybe<Decimal>;
|
|
24
24
|
ytdInt: Maybe<Decimal>;
|
|
25
25
|
}
|
|
@@ -63,7 +63,7 @@ export interface ValuationReportHoldingClassificationNode {
|
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
65
65
|
* Type definition for base valuation report holding (shared by
|
|
66
|
-
*
|
|
66
|
+
* {@link ValuationReportHolding} and {@link ValuationReportChildHolding}).
|
|
67
67
|
*/
|
|
68
68
|
export interface BaseValuationReportHolding {
|
|
69
69
|
artifact: ValuationReportArtifact;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decafhub/decaf-client-extras",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "DECAF Client Extras",
|
|
5
5
|
"author": "Teloscube Pte Ltd",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,36 +26,36 @@
|
|
|
26
26
|
"node": ">=14"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@decafhub/decaf-client": "
|
|
29
|
+
"@decafhub/decaf-client": "^0.3.1"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@telostat/prelude": "^0.1.1"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@commitlint/cli": "^17.0
|
|
36
|
-
"@commitlint/config-conventional": "^17.0
|
|
37
|
-
"@decafhub/decaf-client": "^0.
|
|
38
|
-
"@types/jest": "^
|
|
39
|
-
"@types/node": "^18.
|
|
40
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
41
|
-
"@typescript-eslint/parser": "^5.
|
|
42
|
-
"dotenv": "^16.0.
|
|
43
|
-
"eslint": "^8.
|
|
35
|
+
"@commitlint/cli": "^17.2.0",
|
|
36
|
+
"@commitlint/config-conventional": "^17.2.0",
|
|
37
|
+
"@decafhub/decaf-client": "^0.3.1",
|
|
38
|
+
"@types/jest": "^29.2.2",
|
|
39
|
+
"@types/node": "^18.11.9",
|
|
40
|
+
"@typescript-eslint/eslint-plugin": "^5.42.0",
|
|
41
|
+
"@typescript-eslint/parser": "^5.42.0",
|
|
42
|
+
"dotenv": "^16.0.3",
|
|
43
|
+
"eslint": "^8.27.0",
|
|
44
44
|
"eslint-config-prettier": "^8.5.0",
|
|
45
45
|
"eslint-config-standard": "^17.0.0",
|
|
46
46
|
"eslint-plugin-import": "^2.26.0",
|
|
47
|
-
"eslint-plugin-n": "^15.
|
|
47
|
+
"eslint-plugin-n": "^15.5.0",
|
|
48
48
|
"eslint-plugin-prettier": "^4.2.1",
|
|
49
|
-
"eslint-plugin-promise": "^6.
|
|
49
|
+
"eslint-plugin-promise": "^6.1.1",
|
|
50
50
|
"eslint-plugin-standard": "^5.0.0",
|
|
51
51
|
"gh-pages": "^4.0.0",
|
|
52
|
-
"husky": "^8.0.
|
|
53
|
-
"jest": "^
|
|
52
|
+
"husky": "^8.0.1",
|
|
53
|
+
"jest": "^29.2.2",
|
|
54
54
|
"lint-staged": "^13.0.3",
|
|
55
55
|
"prettier": "^2.7.1",
|
|
56
|
-
"ts-jest": "^
|
|
57
|
-
"typedoc": "^0.23.
|
|
58
|
-
"typescript": "^4.
|
|
56
|
+
"ts-jest": "^29.0.3",
|
|
57
|
+
"typedoc": "^0.23.20",
|
|
58
|
+
"typescript": "^4.8.4"
|
|
59
59
|
},
|
|
60
60
|
"lint-staged": {
|
|
61
61
|
"src/**/*.{ts,tsx}": [
|
|
@@ -60,7 +60,7 @@ export declare function fetchRemoteConsolidatedValuationReport(client: DecafClie
|
|
|
60
60
|
export declare function recompileConsolidatedValuationReport(x: RemoteConsolidatedValuationReport): Either<CustomError, ConsolidatedValuationReport>;
|
|
61
61
|
/**
|
|
62
62
|
* Attempts to retrieve remote consolidated valuation report, compiles it to
|
|
63
|
-
*
|
|
63
|
+
* {@link ConsolidatedValuationReport} and return it.
|
|
64
64
|
*
|
|
65
65
|
* @param client DECAF Barista client.
|
|
66
66
|
* @param query Remote consolidated valuation report endpoint query parameters.
|
|
@@ -90,7 +90,7 @@ function recompileConsolidatedValuationReport(x) {
|
|
|
90
90
|
exports.recompileConsolidatedValuationReport = recompileConsolidatedValuationReport;
|
|
91
91
|
/**
|
|
92
92
|
* Attempts to retrieve remote consolidated valuation report, compiles it to
|
|
93
|
-
*
|
|
93
|
+
* {@link ConsolidatedValuationReport} and return it.
|
|
94
94
|
*
|
|
95
95
|
* @param client DECAF Barista client.
|
|
96
96
|
* @param query Remote consolidated valuation report endpoint query parameters.
|
|
@@ -141,7 +141,7 @@ export declare function toShareClassValue(x: RemoteValuationShareClassValue): Po
|
|
|
141
141
|
export declare function recompilePortfolioValuationReport(x: RemotePortfolioValuationReport): Either<CustomError, PortfolioValuationReport>;
|
|
142
142
|
/**
|
|
143
143
|
* Attempts to retrieve remote portfolio valuation report, compiles it to
|
|
144
|
-
*
|
|
144
|
+
* {@link PortfolioValuationReport} and return it.
|
|
145
145
|
*
|
|
146
146
|
* @param client DECAF Barista client.
|
|
147
147
|
* @param query Remote portolio valuation report endpoint query parameters.
|
|
@@ -142,8 +142,8 @@ function toShareClassValue(x) {
|
|
|
142
142
|
sharecountPrev: (0, prelude_1.asDecimal)(x.sharecount_prev),
|
|
143
143
|
sharecountCurr: (0, prelude_1.asDecimal)(x.sharecount_curr),
|
|
144
144
|
sharecountDiff: (0, prelude_1.asDecimal)(x.sharecount_diff),
|
|
145
|
-
pxRefCcy: (0, prelude_1.
|
|
146
|
-
pxClsCcy: (0, prelude_1.
|
|
145
|
+
pxRefCcy: (0, prelude_1.maybeDecimal)(x.px_refccy),
|
|
146
|
+
pxClsCcy: (0, prelude_1.maybeDecimal)(x.px_clsccy),
|
|
147
147
|
ytdExt: (0, prelude_1.maybeDecimal)(x.ytdext),
|
|
148
148
|
ytdInt: (0, prelude_1.maybeDecimal)(x.ytdint),
|
|
149
149
|
};
|
|
@@ -168,7 +168,7 @@ function recompilePortfolioValuationReport(x) {
|
|
|
168
168
|
exports.recompilePortfolioValuationReport = recompilePortfolioValuationReport;
|
|
169
169
|
/**
|
|
170
170
|
* Attempts to retrieve remote portfolio valuation report, compiles it to
|
|
171
|
-
*
|
|
171
|
+
* {@link PortfolioValuationReport} and return it.
|
|
172
172
|
*
|
|
173
173
|
* @param client DECAF Barista client.
|
|
174
174
|
* @param query Remote portolio valuation report endpoint query parameters.
|
|
@@ -18,8 +18,8 @@ export interface PortfolioValuationReportShareClassValue {
|
|
|
18
18
|
sharecountPrev: Decimal;
|
|
19
19
|
sharecountCurr: Decimal;
|
|
20
20
|
sharecountDiff: Decimal;
|
|
21
|
-
pxRefCcy: Decimal
|
|
22
|
-
pxClsCcy: Decimal
|
|
21
|
+
pxRefCcy: Maybe<Decimal>;
|
|
22
|
+
pxClsCcy: Maybe<Decimal>;
|
|
23
23
|
ytdExt: Maybe<Decimal>;
|
|
24
24
|
ytdInt: Maybe<Decimal>;
|
|
25
25
|
}
|
|
@@ -63,7 +63,7 @@ export interface ValuationReportHoldingClassificationNode {
|
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
65
65
|
* Type definition for base valuation report holding (shared by
|
|
66
|
-
*
|
|
66
|
+
* {@link ValuationReportHolding} and {@link ValuationReportChildHolding}).
|
|
67
67
|
*/
|
|
68
68
|
export interface BaseValuationReportHolding {
|
|
69
69
|
artifact: ValuationReportArtifact;
|
package/src/commons/-currency.ts
CHANGED
|
@@ -14,29 +14,29 @@ import { Just, Maybe, mkPhantom, NewTypeWithPhantom, Nothing, unPhantom } from '
|
|
|
14
14
|
export type CurrencyCode = NewTypeWithPhantom<'CurrencyCode', string>;
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* Attempts to create a
|
|
17
|
+
* Attempts to create a {@link CurrencyCode} value with the given currency code.
|
|
18
18
|
*
|
|
19
19
|
* This function returns a `Maybe` value. For the version that throws an
|
|
20
|
-
* error, see
|
|
20
|
+
* error, see {@link mkCurrencyCodeError}.
|
|
21
21
|
*
|
|
22
22
|
* @param x A currency code represented as string.
|
|
23
23
|
* @returns If the argument has leading or trailing spaces OR it is empty,
|
|
24
|
-
* `Nothing` is retured, `Just`
|
|
24
|
+
* `Nothing` is retured, `Just` {@link CurrencyCode} otherwise.
|
|
25
25
|
*/
|
|
26
26
|
export function mkCurrencyCode(x: string): Maybe<CurrencyCode> {
|
|
27
27
|
return x !== x.trim() || x === '' ? Nothing : Just(mkPhantom(x));
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
|
-
* (Unsafely) attempts to create a
|
|
31
|
+
* (Unsafely) attempts to create a {@link CurrencyCode} value with the given
|
|
32
32
|
* currency code.
|
|
33
33
|
*
|
|
34
34
|
* This function may throw an error if the given argument is not a valid
|
|
35
|
-
* currency code. For the monadic version, see
|
|
35
|
+
* currency code. For the monadic version, see {@link mkCurrencyCode}.
|
|
36
36
|
*
|
|
37
37
|
* @param x A currency code represented as string.
|
|
38
38
|
* @returns If the argument has leading or trailing spaces OR it is empty, an
|
|
39
|
-
* error is thrown,
|
|
39
|
+
* error is thrown, {@link CurrencyCode} is returned otherwise.
|
|
40
40
|
*/
|
|
41
41
|
export function mkCurrencyCodeError(x: string): CurrencyCode {
|
|
42
42
|
return mkCurrencyCode(x).orDefaultLazy(() => {
|
|
@@ -47,7 +47,7 @@ export function mkCurrencyCodeError(x: string): CurrencyCode {
|
|
|
47
47
|
/**
|
|
48
48
|
* Return the currency code as a string value.
|
|
49
49
|
*
|
|
50
|
-
* @param x
|
|
50
|
+
* @param x {@link CurrencyCode} to be extracted string from.
|
|
51
51
|
* @returns Currency code as a string.
|
|
52
52
|
*/
|
|
53
53
|
export function unCurrencyCode(x: CurrencyCode): string {
|
|
@@ -103,7 +103,7 @@ export function recompileConsolidatedValuationReport(
|
|
|
103
103
|
|
|
104
104
|
/**
|
|
105
105
|
* Attempts to retrieve remote consolidated valuation report, compiles it to
|
|
106
|
-
*
|
|
106
|
+
* {@link ConsolidatedValuationReport} and return it.
|
|
107
107
|
*
|
|
108
108
|
* @param client DECAF Barista client.
|
|
109
109
|
* @param query Remote consolidated valuation report endpoint query parameters.
|
|
@@ -242,8 +242,8 @@ export function toShareClassValue(x: RemoteValuationShareClassValue): PortfolioV
|
|
|
242
242
|
sharecountPrev: asDecimal(x.sharecount_prev),
|
|
243
243
|
sharecountCurr: asDecimal(x.sharecount_curr),
|
|
244
244
|
sharecountDiff: asDecimal(x.sharecount_diff),
|
|
245
|
-
pxRefCcy:
|
|
246
|
-
pxClsCcy:
|
|
245
|
+
pxRefCcy: maybeDecimal(x.px_refccy),
|
|
246
|
+
pxClsCcy: maybeDecimal(x.px_clsccy),
|
|
247
247
|
ytdExt: maybeDecimal(x.ytdext),
|
|
248
248
|
ytdInt: maybeDecimal(x.ytdint),
|
|
249
249
|
};
|
|
@@ -276,7 +276,7 @@ export function recompilePortfolioValuationReport(
|
|
|
276
276
|
|
|
277
277
|
/**
|
|
278
278
|
* Attempts to retrieve remote portfolio valuation report, compiles it to
|
|
279
|
-
*
|
|
279
|
+
* {@link PortfolioValuationReport} and return it.
|
|
280
280
|
*
|
|
281
281
|
* @param client DECAF Barista client.
|
|
282
282
|
* @param query Remote portolio valuation report endpoint query parameters.
|
|
@@ -29,8 +29,8 @@ export interface PortfolioValuationReportShareClassValue {
|
|
|
29
29
|
sharecountPrev: Decimal;
|
|
30
30
|
sharecountCurr: Decimal;
|
|
31
31
|
sharecountDiff: Decimal;
|
|
32
|
-
pxRefCcy: Decimal
|
|
33
|
-
pxClsCcy: Decimal
|
|
32
|
+
pxRefCcy: Maybe<Decimal>;
|
|
33
|
+
pxClsCcy: Maybe<Decimal>;
|
|
34
34
|
ytdExt: Maybe<Decimal>;
|
|
35
35
|
ytdInt: Maybe<Decimal>;
|
|
36
36
|
}
|
|
@@ -70,7 +70,7 @@ export interface ValuationReportHoldingClassificationNode {
|
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
* Type definition for base valuation report holding (shared by
|
|
73
|
-
*
|
|
73
|
+
* {@link ValuationReportHolding} and {@link ValuationReportChildHolding}).
|
|
74
74
|
*/
|
|
75
75
|
export interface BaseValuationReportHolding {
|
|
76
76
|
artifact: ValuationReportArtifact;
|