bharosa 0.3.1 → 0.3.2
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/CHANGELOG.md +4 -0
- package/README.md +8 -5
- package/dist/client-types.d.cts +2 -1
- package/dist/client-types.d.ts +2 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/transport.cjs +1 -1
- package/docs/getting-started.md +6 -17
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.2 — 30 October 2026
|
|
4
|
+
|
|
5
|
+
Default omitted or undefined `baseUrl` to `https://app.bharosa.finance` in Bharosa and BharosaMarket. Preserve explicit overrides, origin validation, redirect rejection and credential boundaries. Remove required origin setup from beginner examples. No analytics additions or API changes.
|
|
6
|
+
|
|
3
7
|
## 0.3.1 — 30 October 2026
|
|
4
8
|
|
|
5
9
|
Correct stale publication and activation wording in the README and portfolio guide. Runtime code, API contracts, exports and dependencies are byte-identical to 0.3.0.
|
package/README.md
CHANGED
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
A TypeScript client for Bharosa accounts, investors, portfolios, and mutual funds. Use one resource interface from TypeScript, ESM, or CommonJS, with no runtime dependencies.
|
|
4
4
|
|
|
5
|
-
**
|
|
5
|
+
**SDK version:** `bharosa@0.3.2`. Both clients use the production API at `https://app.bharosa.finance` by default. Account access and credentials are still required; installing the SDK does not grant access.
|
|
6
6
|
|
|
7
7
|
## Start here
|
|
8
8
|
|
|
9
9
|
Use Node.js 22.12+ in a supported LTS release. Install the published SDK in your backend application:
|
|
10
10
|
|
|
11
11
|
```sh
|
|
12
|
-
npm install bharosa@0.3.
|
|
12
|
+
npm install bharosa@0.3.2 --ignore-scripts
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
Source contributors can build and pack a local archive using the commands in CONTRIBUTING.md.
|
|
16
16
|
|
|
17
|
-
Configure your application's
|
|
17
|
+
Configure your application's account ID and account key through its secret manager. Then:
|
|
18
18
|
|
|
19
19
|
```ts
|
|
20
20
|
import { Bharosa } from "bharosa";
|
|
@@ -25,7 +25,6 @@ function required(name: string): string {
|
|
|
25
25
|
return value;
|
|
26
26
|
}
|
|
27
27
|
const bharosa = new Bharosa({
|
|
28
|
-
baseUrl: required("BHAROSA_API_BASE_URL"),
|
|
29
28
|
account: required("BHAROSA_ACCOUNT_ID"),
|
|
30
29
|
auth: { type: "account_key", apiKey: required("BHAROSA_SECRET_KEY") },
|
|
31
30
|
});
|
|
@@ -120,4 +119,8 @@ After installing the archive, run `node node_modules/bharosa/examples/offline-sm
|
|
|
120
119
|
|
|
121
120
|
### Registered-app monthly data
|
|
122
121
|
|
|
123
|
-
Available in SDK 0.3.0 and activated at `https://app.bharosa.finance`. Server applications can use `new BharosaMarket({
|
|
122
|
+
Available in SDK 0.3.0 and activated at `https://app.bharosa.finance`. Server applications can use `new BharosaMarket({apiKey})` with an owner-issued `market_key` scoped only to `market:read`. `client.schemes.nav(id,{asOf:'2026-08-01'})`, `schemes.expenseRatio`, `funds.portfolio` and `funds.holdings` use account-independent monthly snapshot routes. These keys cannot read private accounts or portfolios and require no investor OAuth token. Keep secrets server-side; never bundle them into browser code. Existing account-key and delegated-user clients remain unchanged. The production control-plane environment is `production`. General third-party OAuth provisioning is separate and is not enabled by this feature.
|
|
123
|
+
|
|
124
|
+
### Optional API origin override
|
|
125
|
+
|
|
126
|
+
Set `baseUrl` only for another deployment or tests. Omitted or `undefined` uses `https://app.bharosa.finance`; invalid explicit values fail validation and never fall back. Overrides must be HTTPS origins without credentials, paths, queries or fragments. Local HTTP also requires `allowLocalhostHttp: true`. The SDK does not read `BHAROSA_API_BASE_URL` automatically.
|
package/dist/client-types.d.cts
CHANGED
|
@@ -17,7 +17,8 @@ export interface BharosaTransport {
|
|
|
17
17
|
send(url: string, request: RequestInit): Promise<Response>;
|
|
18
18
|
}
|
|
19
19
|
interface BharosaBaseConfig {
|
|
20
|
-
|
|
20
|
+
/** Defaults to https://app.bharosa.finance. Explicit overrides must be valid origins. */
|
|
21
|
+
readonly baseUrl?: string;
|
|
21
22
|
readonly account: string;
|
|
22
23
|
readonly allowLocalhostHttp?: boolean;
|
|
23
24
|
readonly maxResponseBytes?: number;
|
package/dist/client-types.d.ts
CHANGED
|
@@ -17,7 +17,8 @@ export interface BharosaTransport {
|
|
|
17
17
|
send(url: string, request: RequestInit): Promise<Response>;
|
|
18
18
|
}
|
|
19
19
|
interface BharosaBaseConfig {
|
|
20
|
-
|
|
20
|
+
/** Defaults to https://app.bharosa.finance. Explicit overrides must be valid origins. */
|
|
21
|
+
readonly baseUrl?: string;
|
|
21
22
|
readonly account: string;
|
|
22
23
|
readonly allowLocalhostHttp?: boolean;
|
|
23
24
|
readonly maxResponseBytes?: number;
|
package/dist/index.d.cts
CHANGED
|
@@ -16,7 +16,8 @@ export declare class Bharosa implements T.ClientSurface {
|
|
|
16
16
|
constructor(config: T.BharosaConfig);
|
|
17
17
|
}
|
|
18
18
|
export interface BharosaMarketConfig {
|
|
19
|
-
|
|
19
|
+
/** Defaults to https://app.bharosa.finance. */
|
|
20
|
+
baseUrl?: string;
|
|
20
21
|
apiKey: string;
|
|
21
22
|
allowLocalhostHttp?: boolean;
|
|
22
23
|
maxResponseBytes?: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -16,7 +16,8 @@ export declare class Bharosa implements T.ClientSurface {
|
|
|
16
16
|
constructor(config: T.BharosaConfig);
|
|
17
17
|
}
|
|
18
18
|
export interface BharosaMarketConfig {
|
|
19
|
-
|
|
19
|
+
/** Defaults to https://app.bharosa.finance. */
|
|
20
|
+
baseUrl?: string;
|
|
20
21
|
apiKey: string;
|
|
21
22
|
allowLocalhostHttp?: boolean;
|
|
22
23
|
maxResponseBytes?: number;
|
package/dist/transport.cjs
CHANGED
|
@@ -156,7 +156,7 @@ function createTransport(config, marketOnly = false) {
|
|
|
156
156
|
]);
|
|
157
157
|
check(config.allowLocalhostHttp === undefined ||
|
|
158
158
|
typeof config.allowLocalhostHttp === "boolean");
|
|
159
|
-
const base = origin(config.baseUrl, config.allowLocalhostHttp);
|
|
159
|
+
const base = origin(config.baseUrl === undefined ? "https://app.bharosa.finance" : config.baseUrl, config.allowLocalhostHttp);
|
|
160
160
|
check((0, validate_cjs_1.valid)(operations.retrieve_account.parameters[0].schema, config.account));
|
|
161
161
|
const account = config.account;
|
|
162
162
|
let headers, secrets;
|
package/docs/getting-started.md
CHANGED
|
@@ -4,25 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
Use Node.js 22.12 or later in a supported LTS release. The SDK supports ESM and CommonJS. Key-based authentication is server-only; keep credentials in your backend or server that handles browser sessions. Browser applications can supply a generic transport whose private host implementation manages sessions, origin restrictions and CSRF. Bun and Deno are unsupported.
|
|
6
6
|
|
|
7
|
-
Obtain
|
|
7
|
+
Obtain your authorized account ID and account key. Bharosa and BharosaMarket default to the production origin `https://app.bharosa.finance`; no API URL environment variable is required. The SDK neither provisions accounts nor runs an OAuth consent flow.
|
|
8
8
|
|
|
9
|
-
## Install
|
|
10
|
-
|
|
11
|
-
From the SDK directory:
|
|
12
|
-
|
|
13
|
-
```sh
|
|
14
|
-
npm --prefix tooling ci --ignore-scripts
|
|
15
|
-
npm run build
|
|
16
|
-
npm pack --pack-destination /absolute/path/to/artifacts
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
Then, from your application directory:
|
|
9
|
+
## Install
|
|
20
10
|
|
|
21
11
|
```sh
|
|
22
|
-
npm install
|
|
12
|
+
npm install bharosa@0.3.2 --ignore-scripts
|
|
23
13
|
```
|
|
24
14
|
|
|
25
|
-
|
|
15
|
+
Source contributors can build and pack a local archive as described in CONTRIBUTING.md.
|
|
26
16
|
|
|
27
17
|
## Read your account
|
|
28
18
|
|
|
@@ -38,7 +28,6 @@ function required(name) {
|
|
|
38
28
|
}
|
|
39
29
|
|
|
40
30
|
const bharosa = new Bharosa({
|
|
41
|
-
baseUrl: required("BHAROSA_API_BASE_URL"),
|
|
42
31
|
account: required("BHAROSA_ACCOUNT_ID"),
|
|
43
32
|
auth: { type: "account_key", apiKey: required("BHAROSA_SECRET_KEY") },
|
|
44
33
|
});
|
|
@@ -46,7 +35,7 @@ const account = await bharosa.accounts.retrieve();
|
|
|
46
35
|
console.log(account.id);
|
|
47
36
|
```
|
|
48
37
|
|
|
49
|
-
Supply those variables through your application's secret management, then run `node account.mjs`. Do not commit their values.
|
|
38
|
+
Supply those variables through your application's secret management, then run `node account.mjs`. Do not commit their values. For another deployment or tests, explicitly supply `baseUrl`. It must use HTTPS and contain no path, query, user information, or fragment; local HTTP additionally requires `allowLocalhostHttp: true`. Invalid explicit origins fail before sending a request.
|
|
50
39
|
|
|
51
40
|
CommonJS applications use `const { Bharosa } = require("bharosa")` inside an async function. TypeScript applications import types from the same root package; do not import files from `dist/`.
|
|
52
41
|
|
|
@@ -65,7 +54,7 @@ To try the interface without an API or credentials, use the [synthetic examples]
|
|
|
65
54
|
## Caller-owned transport and first-party market data
|
|
66
55
|
|
|
67
56
|
`BharosaTransport.send(url: string, request: RequestInit): Promise<Response>`
|
|
68
|
-
can replace credential configuration. Construct with `
|
|
57
|
+
can replace credential configuration. Construct with `account`, an optional `baseUrl`, and
|
|
69
58
|
`transport`; do not also pass `auth` or `fetch`. The host application owns its
|
|
70
59
|
private session adapter, URL/origin restrictions, per-write CSRF, cookie policy
|
|
71
60
|
and cancellation on account changes. SDK requests default to omitted credentials,
|