@healthcloudai/hc-telehealth-connector 0.0.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/README.md +85 -0
- package/dist/index.cjs +74 -0
- package/dist/index.d.cts +22 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +44 -0
- package/package.json +61 -0
package/README.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Healthcheck Telehealth Connector
|
|
2
|
+
|
|
3
|
+
This library provides a client for interacting with the **Healthcheck Telehealth Token API**.
|
|
4
|
+
It is built on top of the shared Healthcheck HTTP and Login connectors and can be used from
|
|
5
|
+
**TypeScript or JavaScript** applications.
|
|
6
|
+
|
|
7
|
+
The connector is responsible for securely generating a **telehealth session token**, which can
|
|
8
|
+
be used to initialize telehealth or video services on the client side.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Features
|
|
13
|
+
|
|
14
|
+
1. Generate telehealth session tokens
|
|
15
|
+
2. Built on shared Healthcheck HttpClient and authentication layer
|
|
16
|
+
3. Automatically includes authorization headers
|
|
17
|
+
4. Lightweight and reusable across web and mobile applications
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install @healthcloudai/hc-telehealth-connector \
|
|
25
|
+
@healthcloudai/hc-login-connector \
|
|
26
|
+
@healthcloudai/hc-http
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Import
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
import { HCTelehealthTokenClient } from "@healthcloudai/hc-telehealth-connector";
|
|
35
|
+
import { HCLoginClient } from "@healthcloudai/hc-login-connector";
|
|
36
|
+
import { HttpClient } from "@healthcloudai/hc-http";
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Usage
|
|
42
|
+
|
|
43
|
+
### Configuration
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
import { HCTelehealthTokenClient } from "@healthcloudai/hc-telehealth-connector";
|
|
47
|
+
import { HCLoginClient } from "@healthcloudai/hc-login-connector";
|
|
48
|
+
import { HttpClient } from "@healthcloudai/hc-http";
|
|
49
|
+
|
|
50
|
+
const httpClient = new HttpClient();
|
|
51
|
+
const authClient = new HCLoginClient(/* auth configuration */);
|
|
52
|
+
|
|
53
|
+
const telehealthClient = new HCTelehealthTokenClient(
|
|
54
|
+
httpClient,
|
|
55
|
+
authClient
|
|
56
|
+
);
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Connect to Telehealth Token Server
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
const tokenResponse = await telehealthClient.connectToTokenServer();
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
The response contains the telehealth token payload returned by the backend and can be used
|
|
68
|
+
to initialize a telehealth session (for example a video call or provider connection).
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## How It Works
|
|
73
|
+
|
|
74
|
+
- **HCLoginClient**
|
|
75
|
+
- Handles authentication
|
|
76
|
+
- Resolves base API URL
|
|
77
|
+
- Provides authorization headers
|
|
78
|
+
|
|
79
|
+
- **HttpClient**
|
|
80
|
+
- Responsible for all HTTP communication
|
|
81
|
+
|
|
82
|
+
- **HCTelehealthTokenClient**
|
|
83
|
+
- Combines authentication and HTTP layers
|
|
84
|
+
- Exposes a simple API for generating telehealth tokens
|
|
85
|
+
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
AuthError: () => AuthError,
|
|
24
|
+
ConfigError: () => ConfigError,
|
|
25
|
+
HCTelehealthTokenClient: () => HCTelehealthTokenClient,
|
|
26
|
+
HttpError: () => HttpError
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(index_exports);
|
|
29
|
+
|
|
30
|
+
// src/client.ts
|
|
31
|
+
var HCTelehealthTokenClient = class {
|
|
32
|
+
constructor(httpClient, authClient) {
|
|
33
|
+
this.http = httpClient;
|
|
34
|
+
this.auth = authClient;
|
|
35
|
+
}
|
|
36
|
+
async connectToTokenServer() {
|
|
37
|
+
return this.http.post(
|
|
38
|
+
`${this.auth.getBaseUrl()}/telehealth/token`,
|
|
39
|
+
{},
|
|
40
|
+
{
|
|
41
|
+
...this.auth.getAuthHeader(),
|
|
42
|
+
"Content-Type": "application/json"
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// src/errors.ts
|
|
49
|
+
var ConfigError = class extends Error {
|
|
50
|
+
constructor(message) {
|
|
51
|
+
super(message);
|
|
52
|
+
this.name = "ConfigError";
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
var AuthError = class extends Error {
|
|
56
|
+
constructor(message) {
|
|
57
|
+
super(message);
|
|
58
|
+
this.name = "AuthError";
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var HttpError = class extends Error {
|
|
62
|
+
constructor(status, message) {
|
|
63
|
+
super(message);
|
|
64
|
+
this.name = "HttpError";
|
|
65
|
+
this.status = status;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
69
|
+
0 && (module.exports = {
|
|
70
|
+
AuthError,
|
|
71
|
+
ConfigError,
|
|
72
|
+
HCTelehealthTokenClient,
|
|
73
|
+
HttpError
|
|
74
|
+
});
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { HCLoginClient } from '@healthcloudai/hc-login-connector';
|
|
2
|
+
import { HttpClient } from '@healthcloudai/hc-http';
|
|
3
|
+
|
|
4
|
+
declare class HCTelehealthTokenClient {
|
|
5
|
+
private http;
|
|
6
|
+
private auth;
|
|
7
|
+
constructor(httpClient: HttpClient, authClient: HCLoginClient);
|
|
8
|
+
connectToTokenServer(): Promise<any>;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare class ConfigError extends Error {
|
|
12
|
+
constructor(message: string);
|
|
13
|
+
}
|
|
14
|
+
declare class AuthError extends Error {
|
|
15
|
+
constructor(message: string);
|
|
16
|
+
}
|
|
17
|
+
declare class HttpError extends Error {
|
|
18
|
+
status: number;
|
|
19
|
+
constructor(status: number, message: string);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { AuthError, ConfigError, HCTelehealthTokenClient, HttpError };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { HCLoginClient } from '@healthcloudai/hc-login-connector';
|
|
2
|
+
import { HttpClient } from '@healthcloudai/hc-http';
|
|
3
|
+
|
|
4
|
+
declare class HCTelehealthTokenClient {
|
|
5
|
+
private http;
|
|
6
|
+
private auth;
|
|
7
|
+
constructor(httpClient: HttpClient, authClient: HCLoginClient);
|
|
8
|
+
connectToTokenServer(): Promise<any>;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare class ConfigError extends Error {
|
|
12
|
+
constructor(message: string);
|
|
13
|
+
}
|
|
14
|
+
declare class AuthError extends Error {
|
|
15
|
+
constructor(message: string);
|
|
16
|
+
}
|
|
17
|
+
declare class HttpError extends Error {
|
|
18
|
+
status: number;
|
|
19
|
+
constructor(status: number, message: string);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { AuthError, ConfigError, HCTelehealthTokenClient, HttpError };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// src/client.ts
|
|
2
|
+
var HCTelehealthTokenClient = class {
|
|
3
|
+
constructor(httpClient, authClient) {
|
|
4
|
+
this.http = httpClient;
|
|
5
|
+
this.auth = authClient;
|
|
6
|
+
}
|
|
7
|
+
async connectToTokenServer() {
|
|
8
|
+
return this.http.post(
|
|
9
|
+
`${this.auth.getBaseUrl()}/telehealth/token`,
|
|
10
|
+
{},
|
|
11
|
+
{
|
|
12
|
+
...this.auth.getAuthHeader(),
|
|
13
|
+
"Content-Type": "application/json"
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
// src/errors.ts
|
|
20
|
+
var ConfigError = class extends Error {
|
|
21
|
+
constructor(message) {
|
|
22
|
+
super(message);
|
|
23
|
+
this.name = "ConfigError";
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
var AuthError = class extends Error {
|
|
27
|
+
constructor(message) {
|
|
28
|
+
super(message);
|
|
29
|
+
this.name = "AuthError";
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
var HttpError = class extends Error {
|
|
33
|
+
constructor(status, message) {
|
|
34
|
+
super(message);
|
|
35
|
+
this.name = "HttpError";
|
|
36
|
+
this.status = status;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
AuthError,
|
|
41
|
+
ConfigError,
|
|
42
|
+
HCTelehealthTokenClient,
|
|
43
|
+
HttpError
|
|
44
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@healthcloudai/hc-telehealth-connector",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "Healthcheck Telehealth SDK with TypeScript",
|
|
5
|
+
"author": "Healthcheck Systems Inc",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"health-cloud",
|
|
9
|
+
"telehealth",
|
|
10
|
+
"video call",
|
|
11
|
+
"react-native",
|
|
12
|
+
"typescript",
|
|
13
|
+
"sdk",
|
|
14
|
+
"auth",
|
|
15
|
+
"fetch",
|
|
16
|
+
"axios"
|
|
17
|
+
],
|
|
18
|
+
"type": "module",
|
|
19
|
+
"main": "dist/index.cjs.js",
|
|
20
|
+
"module": "dist/index.esm.js",
|
|
21
|
+
"types": "dist/index.d.ts",
|
|
22
|
+
"react-native": "dist/index.esm.js",
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"import": "./dist/index.esm.js",
|
|
27
|
+
"require": "./dist/index.cjs.js"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist"
|
|
32
|
+
],
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "tsup src/index.ts --format esm,cjs --dts --clean",
|
|
35
|
+
"dev": "tsup src/index.ts --watch",
|
|
36
|
+
"lint": "eslint src --ext .ts",
|
|
37
|
+
"prepublishOnly": "npm run build"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"axios": "^1.13.4",
|
|
41
|
+
"@healthcloudai/hc-http": "^0.0.1",
|
|
42
|
+
"@healthcloudai/hc-login-connector": "^0.0.1"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"react-native": ">=0.70.0"
|
|
46
|
+
},
|
|
47
|
+
"peerDependenciesMeta": {
|
|
48
|
+
"react-native": {
|
|
49
|
+
"optional": true
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@types/node": "^20.19.30",
|
|
54
|
+
"eslint": "^8.56.0",
|
|
55
|
+
"tsup": "^8.0.0",
|
|
56
|
+
"typescript": "^5.3.0"
|
|
57
|
+
},
|
|
58
|
+
"engines": {
|
|
59
|
+
"node": ">=18"
|
|
60
|
+
}
|
|
61
|
+
}
|