@decafhub/decaf-client-extras 0.0.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/.editorconfig +9 -0
- package/.env.example +4 -0
- package/.eslintignore +3 -0
- package/.eslintrc.js +23 -0
- package/.github/workflows/release-please.yml +47 -0
- package/.github/workflows/test.yml +29 -0
- package/.husky/commit-msg +4 -0
- package/.husky/pre-commit +4 -0
- package/.release-please-manifest.json +3 -0
- package/CHANGELOG.md +13 -0
- package/LICENSE +21 -0
- package/README.md +10 -0
- package/commons/-currency.d.ts +42 -0
- package/commons/-currency.js +50 -0
- package/commons/-date-type.d.ts +11 -0
- package/commons/-date-type.js +10 -0
- package/commons/-id.d.ts +58 -0
- package/commons/-id.js +2 -0
- package/commons/index.d.ts +3 -0
- package/commons/index.js +19 -0
- package/es/commons/-currency.d.ts +42 -0
- package/es/commons/-currency.js +44 -0
- package/es/commons/-date-type.d.ts +11 -0
- package/es/commons/-date-type.js +7 -0
- package/es/commons/-id.d.ts +58 -0
- package/es/commons/-id.js +1 -0
- package/es/commons/index.d.ts +3 -0
- package/es/commons/index.js +3 -0
- package/es/index.d.ts +3 -0
- package/es/index.js +3 -0
- package/es/reports/index.d.ts +1 -0
- package/es/reports/index.js +1 -0
- package/es/reports/valuation/-remote-valuation-report-consolidated.d.ts +69 -0
- package/es/reports/valuation/-remote-valuation-report-consolidated.js +56 -0
- package/es/reports/valuation/-remote-valuation-report-portfolio.d.ts +150 -0
- package/es/reports/valuation/-remote-valuation-report-portfolio.js +134 -0
- package/es/reports/valuation/-remote-valuation-report-shared.d.ts +233 -0
- package/es/reports/valuation/-remote-valuation-report-shared.js +127 -0
- package/es/reports/valuation/-valuation-report-consolidated.d.ts +35 -0
- package/es/reports/valuation/-valuation-report-consolidated.js +1 -0
- package/es/reports/valuation/-valuation-report-holdings-tree/-machinery.d.ts +10 -0
- package/es/reports/valuation/-valuation-report-holdings-tree/-machinery.js +116 -0
- package/es/reports/valuation/-valuation-report-holdings-tree/-types.d.ts +23 -0
- package/es/reports/valuation/-valuation-report-holdings-tree/-types.js +1 -0
- package/es/reports/valuation/-valuation-report-holdings-tree/-utils.d.ts +1 -0
- package/es/reports/valuation/-valuation-report-holdings-tree/-utils.js +12 -0
- package/es/reports/valuation/-valuation-report-holdings-tree/index.d.ts +2 -0
- package/es/reports/valuation/-valuation-report-holdings-tree/index.js +2 -0
- package/es/reports/valuation/-valuation-report-portfolio.d.ts +79 -0
- package/es/reports/valuation/-valuation-report-portfolio.js +1 -0
- package/es/reports/valuation/-valuation-report-shared.d.ts +189 -0
- package/es/reports/valuation/-valuation-report-shared.js +6 -0
- package/es/reports/valuation/index.d.ts +8 -0
- package/es/reports/valuation/index.js +6 -0
- package/index.d.ts +3 -0
- package/index.js +32 -0
- package/jest.config.js +6 -0
- package/package.json +79 -0
- package/postinstall.sh +16 -0
- package/release-please-config.json +9 -0
- package/reports/index.d.ts +1 -0
- package/reports/index.js +27 -0
- package/reports/valuation/-remote-valuation-report-consolidated.d.ts +69 -0
- package/reports/valuation/-remote-valuation-report-consolidated.js +113 -0
- package/reports/valuation/-remote-valuation-report-portfolio.d.ts +150 -0
- package/reports/valuation/-remote-valuation-report-portfolio.js +191 -0
- package/reports/valuation/-remote-valuation-report-shared.d.ts +233 -0
- package/reports/valuation/-remote-valuation-report-shared.js +145 -0
- package/reports/valuation/-valuation-report-consolidated.d.ts +35 -0
- package/reports/valuation/-valuation-report-consolidated.js +2 -0
- package/reports/valuation/-valuation-report-holdings-tree/-machinery.d.ts +10 -0
- package/reports/valuation/-valuation-report-holdings-tree/-machinery.js +189 -0
- package/reports/valuation/-valuation-report-holdings-tree/-types.d.ts +23 -0
- package/reports/valuation/-valuation-report-holdings-tree/-types.js +2 -0
- package/reports/valuation/-valuation-report-holdings-tree/-utils.d.ts +1 -0
- package/reports/valuation/-valuation-report-holdings-tree/-utils.js +16 -0
- package/reports/valuation/-valuation-report-holdings-tree/index.d.ts +2 -0
- package/reports/valuation/-valuation-report-holdings-tree/index.js +20 -0
- package/reports/valuation/-valuation-report-portfolio.d.ts +79 -0
- package/reports/valuation/-valuation-report-portfolio.js +2 -0
- package/reports/valuation/-valuation-report-shared.d.ts +189 -0
- package/reports/valuation/-valuation-report-shared.js +11 -0
- package/reports/valuation/index.d.ts +8 -0
- package/reports/valuation/index.js +25 -0
- package/shell.nix +21 -0
- package/src/commons/-currency.ts +55 -0
- package/src/commons/-date-type.ts +12 -0
- package/src/commons/-id.ts +72 -0
- package/src/commons/index.ts +3 -0
- package/src/index.test.ts +67 -0
- package/src/index.ts +3 -0
- package/src/reports/index.ts +1 -0
- package/src/reports/valuation/-remote-valuation-report-consolidated.ts +121 -0
- package/src/reports/valuation/-remote-valuation-report-portfolio.ts +294 -0
- package/src/reports/valuation/-remote-valuation-report-shared.ts +313 -0
- package/src/reports/valuation/-valuation-report-consolidated.ts +46 -0
- package/src/reports/valuation/-valuation-report-holdings-tree/-machinery.ts +171 -0
- package/src/reports/valuation/-valuation-report-holdings-tree/-types.ts +25 -0
- package/src/reports/valuation/-valuation-report-holdings-tree/-utils.ts +15 -0
- package/src/reports/valuation/-valuation-report-holdings-tree/index.ts +2 -0
- package/src/reports/valuation/-valuation-report-portfolio.ts +92 -0
- package/src/reports/valuation/-valuation-report-shared.ts +217 -0
- package/src/reports/valuation/index.ts +8 -0
- package/tsconfig.es.json +13 -0
- package/tsconfig.json +36 -0
- package/typedoc.json +8 -0
package/.editorconfig
ADDED
package/.env.example
ADDED
package/.eslintignore
ADDED
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
env: {
|
|
3
|
+
browser: true,
|
|
4
|
+
es6: true,
|
|
5
|
+
},
|
|
6
|
+
globals: {
|
|
7
|
+
Atomics: 'readonly',
|
|
8
|
+
SharedArrayBuffer: 'readonly',
|
|
9
|
+
},
|
|
10
|
+
parser: '@typescript-eslint/parser',
|
|
11
|
+
parserOptions: {
|
|
12
|
+
ecmaVersion: 2018,
|
|
13
|
+
sourceType: 'module',
|
|
14
|
+
},
|
|
15
|
+
plugins: ['@typescript-eslint', 'prettier'],
|
|
16
|
+
extends: ['standard', 'prettier', 'plugin:prettier/recommended', 'plugin:@typescript-eslint/eslint-recommended'],
|
|
17
|
+
rules: {
|
|
18
|
+
'prettier/prettier': 'error',
|
|
19
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
20
|
+
'no-use-before-define': 'off',
|
|
21
|
+
'@typescript-eslint/no-use-before-define': ['error'],
|
|
22
|
+
},
|
|
23
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
on:
|
|
2
|
+
push:
|
|
3
|
+
branches:
|
|
4
|
+
- main
|
|
5
|
+
|
|
6
|
+
name: release-please
|
|
7
|
+
jobs:
|
|
8
|
+
release-please:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- uses: google-github-actions/release-please-action@v3
|
|
12
|
+
id: release
|
|
13
|
+
with:
|
|
14
|
+
command: manifest
|
|
15
|
+
|
|
16
|
+
- uses: actions/checkout@v3
|
|
17
|
+
if: ${{ steps.release.outputs.release_created }}
|
|
18
|
+
|
|
19
|
+
- uses: actions/setup-node@v3
|
|
20
|
+
with:
|
|
21
|
+
node-version: 16.x
|
|
22
|
+
registry-url: 'https://registry.npmjs.org'
|
|
23
|
+
cache: 'yarn'
|
|
24
|
+
if: ${{ steps.release.outputs.release_created }}
|
|
25
|
+
|
|
26
|
+
- name: Install dependencies
|
|
27
|
+
run: yarn install --frozen-lockfile
|
|
28
|
+
if: ${{ steps.release.outputs.release_created }}
|
|
29
|
+
env:
|
|
30
|
+
DECAF_JS_SKIP_POSTINSTALL: 1
|
|
31
|
+
HUSKY: 0
|
|
32
|
+
|
|
33
|
+
- name: Build the project and generate docs
|
|
34
|
+
run: yarn build
|
|
35
|
+
if: ${{ steps.release.outputs.release_created }}
|
|
36
|
+
|
|
37
|
+
- name: Deploy docs to gh-pages
|
|
38
|
+
uses: peaceiris/actions-gh-pages@v3
|
|
39
|
+
if: ${{ steps.release.outputs.release_created }}
|
|
40
|
+
with:
|
|
41
|
+
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
42
|
+
publish_dir: ./docs
|
|
43
|
+
|
|
44
|
+
- run: yarn publish --access=public
|
|
45
|
+
env:
|
|
46
|
+
NODE_AUTH_TOKEN: ${{secrets.DECAFHUB_NPM_TOKEN}}
|
|
47
|
+
if: ${{ steps.release.outputs.release_created }}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
test:
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
steps:
|
|
10
|
+
- uses: actions/checkout@v3
|
|
11
|
+
|
|
12
|
+
- uses: actions/setup-node@v3
|
|
13
|
+
with:
|
|
14
|
+
node-version: 16.x
|
|
15
|
+
registry-url: 'https://registry.npmjs.org'
|
|
16
|
+
cache: 'yarn'
|
|
17
|
+
|
|
18
|
+
- name: Install dependencies
|
|
19
|
+
run: yarn install --frozen-lockfile
|
|
20
|
+
env:
|
|
21
|
+
DECAF_JS_SKIP_POSTINSTALL: 1
|
|
22
|
+
HUSKY: 0
|
|
23
|
+
|
|
24
|
+
- name: Run Tests
|
|
25
|
+
run: yarn test --ci
|
|
26
|
+
env:
|
|
27
|
+
TESTING_API_KEY: ${{ secrets.TESTING_API_KEY }}
|
|
28
|
+
TESTING_API_SECRET: ${{ secrets.TESTING_API_SECRET }}
|
|
29
|
+
TESTING_API_URL: ${{ secrets.TESTING_API_URL }}
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.0.1 (2022-08-15)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add reports.valuation module implementation ([81f4ae3](https://github.com/teloscube/decaf-client-javascript-extras/commit/81f4ae345687be58541f8cd12eea3146522d0116))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Miscellaneous Chores
|
|
12
|
+
|
|
13
|
+
* release please ([7fe3a5e](https://github.com/teloscube/decaf-client-javascript-extras/commit/7fe3a5e86094785c60fc710ead1310e30640bcd9))
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Teloscube Pte Ltd
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This module provides currency related definitions.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { Maybe, NewTypeWithPhantom } from '@telostat/prelude';
|
|
7
|
+
/**
|
|
8
|
+
* Type encoding for currency code values.
|
|
9
|
+
*
|
|
10
|
+
* A currency code is (typically) defined as all-uppercase, three letters.
|
|
11
|
+
*/
|
|
12
|
+
export declare type CurrencyCode = NewTypeWithPhantom<'CurrencyCode', string>;
|
|
13
|
+
/**
|
|
14
|
+
* Attempts to create a [[CurrencyCode]] value with the given currency code.
|
|
15
|
+
*
|
|
16
|
+
* This function returns a `Maybe` value. For the version that throws an
|
|
17
|
+
* error, see [[mkCurrencyCodeError]].
|
|
18
|
+
*
|
|
19
|
+
* @param x A currency code represented as string.
|
|
20
|
+
* @returns If the argument has leading or trailing spaces OR it is empty,
|
|
21
|
+
* `Nothing` is retured, `Just` [[CurrencyCode]] otherwise.
|
|
22
|
+
*/
|
|
23
|
+
export declare function mkCurrencyCode(x: string): Maybe<CurrencyCode>;
|
|
24
|
+
/**
|
|
25
|
+
* (Unsafely) attempts to create a [[CurrencyCode]] value with the given
|
|
26
|
+
* currency code.
|
|
27
|
+
*
|
|
28
|
+
* This function may throw an error if the given argument is not a valid
|
|
29
|
+
* currency code. For the monadic version, see [[mkCurrencyCode]].
|
|
30
|
+
*
|
|
31
|
+
* @param x A currency code represented as string.
|
|
32
|
+
* @returns If the argument has leading or trailing spaces OR it is empty, an
|
|
33
|
+
* error is thrown, [[CurrencyCode]] is returned otherwise.
|
|
34
|
+
*/
|
|
35
|
+
export declare function mkCurrencyCodeError(x: string): CurrencyCode;
|
|
36
|
+
/**
|
|
37
|
+
* Return the currency code as a string value.
|
|
38
|
+
*
|
|
39
|
+
* @param x [[CurrencyCode]] to be extracted string from.
|
|
40
|
+
* @returns Currency code as a string.
|
|
41
|
+
*/
|
|
42
|
+
export declare function unCurrencyCode(x: CurrencyCode): string;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This module provides currency related definitions.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.unCurrencyCode = exports.mkCurrencyCodeError = exports.mkCurrencyCode = void 0;
|
|
9
|
+
var prelude_1 = require("@telostat/prelude");
|
|
10
|
+
/**
|
|
11
|
+
* Attempts to create a [[CurrencyCode]] value with the given currency code.
|
|
12
|
+
*
|
|
13
|
+
* This function returns a `Maybe` value. For the version that throws an
|
|
14
|
+
* error, see [[mkCurrencyCodeError]].
|
|
15
|
+
*
|
|
16
|
+
* @param x A currency code represented as string.
|
|
17
|
+
* @returns If the argument has leading or trailing spaces OR it is empty,
|
|
18
|
+
* `Nothing` is retured, `Just` [[CurrencyCode]] otherwise.
|
|
19
|
+
*/
|
|
20
|
+
function mkCurrencyCode(x) {
|
|
21
|
+
return x !== x.trim() || x === '' ? prelude_1.Nothing : (0, prelude_1.Just)((0, prelude_1.mkPhantom)(x));
|
|
22
|
+
}
|
|
23
|
+
exports.mkCurrencyCode = mkCurrencyCode;
|
|
24
|
+
/**
|
|
25
|
+
* (Unsafely) attempts to create a [[CurrencyCode]] value with the given
|
|
26
|
+
* currency code.
|
|
27
|
+
*
|
|
28
|
+
* This function may throw an error if the given argument is not a valid
|
|
29
|
+
* currency code. For the monadic version, see [[mkCurrencyCode]].
|
|
30
|
+
*
|
|
31
|
+
* @param x A currency code represented as string.
|
|
32
|
+
* @returns If the argument has leading or trailing spaces OR it is empty, an
|
|
33
|
+
* error is thrown, [[CurrencyCode]] is returned otherwise.
|
|
34
|
+
*/
|
|
35
|
+
function mkCurrencyCodeError(x) {
|
|
36
|
+
return mkCurrencyCode(x).orDefaultLazy(function () {
|
|
37
|
+
throw new Error("Invalid currency code: \"".concat(x, "\""));
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
exports.mkCurrencyCodeError = mkCurrencyCodeError;
|
|
41
|
+
/**
|
|
42
|
+
* Return the currency code as a string value.
|
|
43
|
+
*
|
|
44
|
+
* @param x [[CurrencyCode]] to be extracted string from.
|
|
45
|
+
* @returns Currency code as a string.
|
|
46
|
+
*/
|
|
47
|
+
function unCurrencyCode(x) {
|
|
48
|
+
return (0, prelude_1.unPhantom)(x);
|
|
49
|
+
}
|
|
50
|
+
exports.unCurrencyCode = unCurrencyCode;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DECAF FINREA action date type type definition.
|
|
3
|
+
*/
|
|
4
|
+
export declare type DateType = 'commitment' | 'settlement';
|
|
5
|
+
/**
|
|
6
|
+
* Translation table for DECAF FINREA action date types.
|
|
7
|
+
*/
|
|
8
|
+
export declare const dateTypes: {
|
|
9
|
+
label: string;
|
|
10
|
+
value: DateType;
|
|
11
|
+
}[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dateTypes = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Translation table for DECAF FINREA action date types.
|
|
6
|
+
*/
|
|
7
|
+
exports.dateTypes = [
|
|
8
|
+
{ label: 'Trade Date', value: 'commitment' },
|
|
9
|
+
{ label: 'Value Date', value: 'settlement' },
|
|
10
|
+
];
|
package/commons/-id.d.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { NewTypeWithPhantom } from '@telostat/prelude';
|
|
2
|
+
/**
|
|
3
|
+
* Type definition for identifiers with value spaces discriminated over the
|
|
4
|
+
* given phantom type.
|
|
5
|
+
*/
|
|
6
|
+
export declare type Id<P, V> = NewTypeWithPhantom<P, V>;
|
|
7
|
+
/**
|
|
8
|
+
* Type definition for DECAF artifact identifiers.
|
|
9
|
+
*/
|
|
10
|
+
export declare type ArtifactId = NewTypeWithPhantom<'DecafArtifact', string | number>;
|
|
11
|
+
/**
|
|
12
|
+
* Type definition for DECAF artifact type identifiers.
|
|
13
|
+
*/
|
|
14
|
+
export declare type ArtifactTypeId = NewTypeWithPhantom<'DecafArtifactType', string>;
|
|
15
|
+
/**
|
|
16
|
+
* Type definition for DECAF share class identifiers.
|
|
17
|
+
*/
|
|
18
|
+
export declare type ShareClassId = NewTypeWithPhantom<'DecafShareClass', string | number>;
|
|
19
|
+
/**
|
|
20
|
+
* Type definition for DECAF principal identifiers.
|
|
21
|
+
*/
|
|
22
|
+
export declare type PrincipalId = NewTypeWithPhantom<'DecafPrincipal', string | number>;
|
|
23
|
+
/**
|
|
24
|
+
* Type definition for DECAF institution identifiers.
|
|
25
|
+
*/
|
|
26
|
+
export declare type InstitutionId = NewTypeWithPhantom<'DecafInstitution', string | number>;
|
|
27
|
+
/**
|
|
28
|
+
* Type definition for DECAF team identifiers.
|
|
29
|
+
*/
|
|
30
|
+
export declare type TeamId = NewTypeWithPhantom<'DecafTeam', string | number>;
|
|
31
|
+
/**
|
|
32
|
+
* Type definition for DECAF portfolio identifiers.
|
|
33
|
+
*/
|
|
34
|
+
export declare type PortfolioId = NewTypeWithPhantom<'DecafPortfolio', string | number>;
|
|
35
|
+
/**
|
|
36
|
+
* Type definition for DECAF portfolio group identifiers.
|
|
37
|
+
*/
|
|
38
|
+
export declare type PortfolioGroupId = NewTypeWithPhantom<'DecafPortfolioGroup', string | number>;
|
|
39
|
+
/**
|
|
40
|
+
* Type definition for DECAF account identifiers.
|
|
41
|
+
*/
|
|
42
|
+
export declare type AccountId = NewTypeWithPhantom<'DecafAccount', string | number>;
|
|
43
|
+
/**
|
|
44
|
+
* Type definition for DECAF OHLC series identifiers.
|
|
45
|
+
*/
|
|
46
|
+
export declare type OhlcSeriesId = NewTypeWithPhantom<'DecafOhlcSeries', string | number>;
|
|
47
|
+
/**
|
|
48
|
+
* Type definition for DECAF share class fee schedule identifiers.
|
|
49
|
+
*/
|
|
50
|
+
export declare type ShareClassFeeScheduleId = NewTypeWithPhantom<'DecafShareClassFeeSchedule', string | number>;
|
|
51
|
+
/**
|
|
52
|
+
* Type definition for DECAF action identifiers.
|
|
53
|
+
*/
|
|
54
|
+
export declare type ActionId = NewTypeWithPhantom<'DecafAction', string | number>;
|
|
55
|
+
/**
|
|
56
|
+
* Type definition for DECAF external valuation identifiers.
|
|
57
|
+
*/
|
|
58
|
+
export declare type ExternalValuationId = NewTypeWithPhantom<'DecafExternalValuation', string | number>;
|
package/commons/-id.js
ADDED
package/commons/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./-currency"), exports);
|
|
18
|
+
__exportStar(require("./-date-type"), exports);
|
|
19
|
+
__exportStar(require("./-id"), exports);
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This module provides currency related definitions.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { Maybe, NewTypeWithPhantom } from '@telostat/prelude';
|
|
7
|
+
/**
|
|
8
|
+
* Type encoding for currency code values.
|
|
9
|
+
*
|
|
10
|
+
* A currency code is (typically) defined as all-uppercase, three letters.
|
|
11
|
+
*/
|
|
12
|
+
export declare type CurrencyCode = NewTypeWithPhantom<'CurrencyCode', string>;
|
|
13
|
+
/**
|
|
14
|
+
* Attempts to create a [[CurrencyCode]] value with the given currency code.
|
|
15
|
+
*
|
|
16
|
+
* This function returns a `Maybe` value. For the version that throws an
|
|
17
|
+
* error, see [[mkCurrencyCodeError]].
|
|
18
|
+
*
|
|
19
|
+
* @param x A currency code represented as string.
|
|
20
|
+
* @returns If the argument has leading or trailing spaces OR it is empty,
|
|
21
|
+
* `Nothing` is retured, `Just` [[CurrencyCode]] otherwise.
|
|
22
|
+
*/
|
|
23
|
+
export declare function mkCurrencyCode(x: string): Maybe<CurrencyCode>;
|
|
24
|
+
/**
|
|
25
|
+
* (Unsafely) attempts to create a [[CurrencyCode]] value with the given
|
|
26
|
+
* currency code.
|
|
27
|
+
*
|
|
28
|
+
* This function may throw an error if the given argument is not a valid
|
|
29
|
+
* currency code. For the monadic version, see [[mkCurrencyCode]].
|
|
30
|
+
*
|
|
31
|
+
* @param x A currency code represented as string.
|
|
32
|
+
* @returns If the argument has leading or trailing spaces OR it is empty, an
|
|
33
|
+
* error is thrown, [[CurrencyCode]] is returned otherwise.
|
|
34
|
+
*/
|
|
35
|
+
export declare function mkCurrencyCodeError(x: string): CurrencyCode;
|
|
36
|
+
/**
|
|
37
|
+
* Return the currency code as a string value.
|
|
38
|
+
*
|
|
39
|
+
* @param x [[CurrencyCode]] to be extracted string from.
|
|
40
|
+
* @returns Currency code as a string.
|
|
41
|
+
*/
|
|
42
|
+
export declare function unCurrencyCode(x: CurrencyCode): string;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This module provides currency related definitions.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { Just, mkPhantom, Nothing, unPhantom } from '@telostat/prelude';
|
|
7
|
+
/**
|
|
8
|
+
* Attempts to create a [[CurrencyCode]] value with the given currency code.
|
|
9
|
+
*
|
|
10
|
+
* This function returns a `Maybe` value. For the version that throws an
|
|
11
|
+
* error, see [[mkCurrencyCodeError]].
|
|
12
|
+
*
|
|
13
|
+
* @param x A currency code represented as string.
|
|
14
|
+
* @returns If the argument has leading or trailing spaces OR it is empty,
|
|
15
|
+
* `Nothing` is retured, `Just` [[CurrencyCode]] otherwise.
|
|
16
|
+
*/
|
|
17
|
+
export function mkCurrencyCode(x) {
|
|
18
|
+
return x !== x.trim() || x === '' ? Nothing : Just(mkPhantom(x));
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* (Unsafely) attempts to create a [[CurrencyCode]] value with the given
|
|
22
|
+
* currency code.
|
|
23
|
+
*
|
|
24
|
+
* This function may throw an error if the given argument is not a valid
|
|
25
|
+
* currency code. For the monadic version, see [[mkCurrencyCode]].
|
|
26
|
+
*
|
|
27
|
+
* @param x A currency code represented as string.
|
|
28
|
+
* @returns If the argument has leading or trailing spaces OR it is empty, an
|
|
29
|
+
* error is thrown, [[CurrencyCode]] is returned otherwise.
|
|
30
|
+
*/
|
|
31
|
+
export function mkCurrencyCodeError(x) {
|
|
32
|
+
return mkCurrencyCode(x).orDefaultLazy(() => {
|
|
33
|
+
throw new Error(`Invalid currency code: "${x}"`);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Return the currency code as a string value.
|
|
38
|
+
*
|
|
39
|
+
* @param x [[CurrencyCode]] to be extracted string from.
|
|
40
|
+
* @returns Currency code as a string.
|
|
41
|
+
*/
|
|
42
|
+
export function unCurrencyCode(x) {
|
|
43
|
+
return unPhantom(x);
|
|
44
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DECAF FINREA action date type type definition.
|
|
3
|
+
*/
|
|
4
|
+
export declare type DateType = 'commitment' | 'settlement';
|
|
5
|
+
/**
|
|
6
|
+
* Translation table for DECAF FINREA action date types.
|
|
7
|
+
*/
|
|
8
|
+
export declare const dateTypes: {
|
|
9
|
+
label: string;
|
|
10
|
+
value: DateType;
|
|
11
|
+
}[];
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { NewTypeWithPhantom } from '@telostat/prelude';
|
|
2
|
+
/**
|
|
3
|
+
* Type definition for identifiers with value spaces discriminated over the
|
|
4
|
+
* given phantom type.
|
|
5
|
+
*/
|
|
6
|
+
export declare type Id<P, V> = NewTypeWithPhantom<P, V>;
|
|
7
|
+
/**
|
|
8
|
+
* Type definition for DECAF artifact identifiers.
|
|
9
|
+
*/
|
|
10
|
+
export declare type ArtifactId = NewTypeWithPhantom<'DecafArtifact', string | number>;
|
|
11
|
+
/**
|
|
12
|
+
* Type definition for DECAF artifact type identifiers.
|
|
13
|
+
*/
|
|
14
|
+
export declare type ArtifactTypeId = NewTypeWithPhantom<'DecafArtifactType', string>;
|
|
15
|
+
/**
|
|
16
|
+
* Type definition for DECAF share class identifiers.
|
|
17
|
+
*/
|
|
18
|
+
export declare type ShareClassId = NewTypeWithPhantom<'DecafShareClass', string | number>;
|
|
19
|
+
/**
|
|
20
|
+
* Type definition for DECAF principal identifiers.
|
|
21
|
+
*/
|
|
22
|
+
export declare type PrincipalId = NewTypeWithPhantom<'DecafPrincipal', string | number>;
|
|
23
|
+
/**
|
|
24
|
+
* Type definition for DECAF institution identifiers.
|
|
25
|
+
*/
|
|
26
|
+
export declare type InstitutionId = NewTypeWithPhantom<'DecafInstitution', string | number>;
|
|
27
|
+
/**
|
|
28
|
+
* Type definition for DECAF team identifiers.
|
|
29
|
+
*/
|
|
30
|
+
export declare type TeamId = NewTypeWithPhantom<'DecafTeam', string | number>;
|
|
31
|
+
/**
|
|
32
|
+
* Type definition for DECAF portfolio identifiers.
|
|
33
|
+
*/
|
|
34
|
+
export declare type PortfolioId = NewTypeWithPhantom<'DecafPortfolio', string | number>;
|
|
35
|
+
/**
|
|
36
|
+
* Type definition for DECAF portfolio group identifiers.
|
|
37
|
+
*/
|
|
38
|
+
export declare type PortfolioGroupId = NewTypeWithPhantom<'DecafPortfolioGroup', string | number>;
|
|
39
|
+
/**
|
|
40
|
+
* Type definition for DECAF account identifiers.
|
|
41
|
+
*/
|
|
42
|
+
export declare type AccountId = NewTypeWithPhantom<'DecafAccount', string | number>;
|
|
43
|
+
/**
|
|
44
|
+
* Type definition for DECAF OHLC series identifiers.
|
|
45
|
+
*/
|
|
46
|
+
export declare type OhlcSeriesId = NewTypeWithPhantom<'DecafOhlcSeries', string | number>;
|
|
47
|
+
/**
|
|
48
|
+
* Type definition for DECAF share class fee schedule identifiers.
|
|
49
|
+
*/
|
|
50
|
+
export declare type ShareClassFeeScheduleId = NewTypeWithPhantom<'DecafShareClassFeeSchedule', string | number>;
|
|
51
|
+
/**
|
|
52
|
+
* Type definition for DECAF action identifiers.
|
|
53
|
+
*/
|
|
54
|
+
export declare type ActionId = NewTypeWithPhantom<'DecafAction', string | number>;
|
|
55
|
+
/**
|
|
56
|
+
* Type definition for DECAF external valuation identifiers.
|
|
57
|
+
*/
|
|
58
|
+
export declare type ExternalValuationId = NewTypeWithPhantom<'DecafExternalValuation', string | number>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/es/index.d.ts
ADDED
package/es/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as valuation from './valuation';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as valuation from './valuation';
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { DecafClient } from '@decafhub/decaf-client';
|
|
2
|
+
import { CustomError, Either, SDate } from '@telostat/prelude';
|
|
3
|
+
import { CurrencyCode, DateType } from '../../commons';
|
|
4
|
+
import { RemoteBaseValuationReport } from './-remote-valuation-report-shared';
|
|
5
|
+
import { ConsolidatedValuationReport, ConsolidatedValuationReportContainer, ConsolidatedValuationReportContainerType } from './-valuation-report-consolidated';
|
|
6
|
+
/**
|
|
7
|
+
* Remote consolidated valuation report query type.
|
|
8
|
+
*/
|
|
9
|
+
export interface ConsolidatedValuationReportQuery {
|
|
10
|
+
/**
|
|
11
|
+
* Date of valuation report.
|
|
12
|
+
*/
|
|
13
|
+
date: SDate;
|
|
14
|
+
/**
|
|
15
|
+
* Date type of the valuation report.
|
|
16
|
+
*/
|
|
17
|
+
dateType: DateType;
|
|
18
|
+
/**
|
|
19
|
+
* Reference currency of the valuation report.
|
|
20
|
+
*/
|
|
21
|
+
currency: CurrencyCode;
|
|
22
|
+
/**
|
|
23
|
+
* Indication if we want to include/exclude sandbox portfolios (defaults to `true`).
|
|
24
|
+
*/
|
|
25
|
+
sandbox?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Container type.
|
|
28
|
+
*/
|
|
29
|
+
containerType: ConsolidatedValuationReportContainerType;
|
|
30
|
+
/**
|
|
31
|
+
* Container elements (identifiers).
|
|
32
|
+
*/
|
|
33
|
+
containerElements: (number | string)[];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Type definition for the remote (raw) consolidated valuation report data.
|
|
37
|
+
*/
|
|
38
|
+
export interface RemoteConsolidatedValuationReport extends RemoteBaseValuationReport {
|
|
39
|
+
containers: {
|
|
40
|
+
level: ConsolidatedValuationReportContainerType;
|
|
41
|
+
containers: ConsolidatedValuationReportContainer[];
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Attempts to retrieve remote consolidated valuation report.
|
|
46
|
+
*
|
|
47
|
+
* @param client DECAF Barista client.
|
|
48
|
+
* @param query Remote consolidated valuation report endpoint query parameters.
|
|
49
|
+
* @returns Remote (raw) consolidated valuation report data.
|
|
50
|
+
*/
|
|
51
|
+
export declare function fetchRemoteConsolidatedValuationReport(client: DecafClient, query: ConsolidatedValuationReportQuery): Promise<Either<CustomError, RemoteConsolidatedValuationReport>>;
|
|
52
|
+
/**
|
|
53
|
+
* Attempts to re-compile the raw, remote consolidated valuation report and
|
|
54
|
+
* return it.
|
|
55
|
+
*
|
|
56
|
+
* @param x Raw, remote consolidated valuation report.
|
|
57
|
+
* @returns Either of an error message or the re-compiled consolidated valuation
|
|
58
|
+
* report.
|
|
59
|
+
*/
|
|
60
|
+
export declare function recompileConsolidatedValuationReport(x: RemoteConsolidatedValuationReport): Either<CustomError, ConsolidatedValuationReport>;
|
|
61
|
+
/**
|
|
62
|
+
* Attempts to retrieve remote consolidated valuation report, compiles it to
|
|
63
|
+
* [[ConsolidatedValuationReport]] and return it.
|
|
64
|
+
*
|
|
65
|
+
* @param client DECAF Barista client.
|
|
66
|
+
* @param query Remote consolidated valuation report endpoint query parameters.
|
|
67
|
+
* @returns Recompiled consolidated valuation report data.
|
|
68
|
+
*/
|
|
69
|
+
export declare function fetchConsolidatedValuationReport(client: DecafClient, query: ConsolidatedValuationReportQuery): Promise<Either<CustomError, ConsolidatedValuationReport>>;
|