@healthcloudai/hc-login-connector 0.3.1 → 0.4.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/README.md CHANGED
@@ -260,12 +260,7 @@ await loginClient.register(
260
260
  {
261
261
  isOTP: true,
262
262
  attributes: {
263
- Specialty: "Cardiology",
264
- NPINumber: "1234567890",
265
- FullName: "John Doe",
266
- PracticeLegalName: "Acme Medical Group",
267
- CurrentTreatments: "Physical Therapy,Blood Pressure Monitoring,Insulin Therapy",
268
- // CurrentTreatments: "Physical Therapy | Blood Pressure Monitoring | Insulin Therapy"
263
+ "ReferralSource": "Friend"
269
264
  }
270
265
  }
271
266
  );
@@ -287,12 +282,8 @@ Request sent for the OTP example above:
287
282
  "LastName": "Smith",
288
283
  "Email": "john.smith@example.com",
289
284
  "Attributes": {
290
- "Specialty": "Cardiology",
291
- "NPINumber": "1234567890",
292
- "FullName": "John Doe",
293
- "PracticeLegalName": "Acme Medical Group",
294
- "CurrentTreatments": "Physical Therapy,Blood Pressure Monitoring,Insulin Therapy",
295
- "VERIFY_EMAIL_CODE": "true"
285
+ "VERIFY_EMAIL_CODE": "true",
286
+ "ReferralSource": "Friend"
296
287
  }
297
288
  }
298
289
  }
package/dist/index.cjs CHANGED
@@ -89,6 +89,19 @@ var HCLoginClient = class extends import_hc_http.HCBaseConnector {
89
89
  var _a;
90
90
  return (_a = this.tokens) == null ? void 0 : _a.idToken;
91
91
  }
92
+ /**
93
+ * Directly inject tokens from an external auth source (e.g., field agent JWT).
94
+ * Bypasses the login/refresh flow when the token lifecycle is managed elsewhere.
95
+ * `expiresAt` defaults to 1 hour so `isTokenExpired()` returns false;
96
+ * the caller is responsible for refreshing before actual expiry.
97
+ */
98
+ setTokens(accessToken, refreshToken) {
99
+ this.tokens = {
100
+ accessToken,
101
+ refreshToken,
102
+ expiresAt: Date.now() + 36e5
103
+ };
104
+ }
92
105
  getAuthHeader() {
93
106
  var _a;
94
107
  this.ensureConfigured();
package/dist/index.d.cts CHANGED
@@ -154,6 +154,13 @@ declare class HCLoginClient extends HCBaseConnector {
154
154
  getTokens(): AuthTokens | undefined;
155
155
  getAccessToken(): string | undefined;
156
156
  getIDToken(): string | null | undefined;
157
+ /**
158
+ * Directly inject tokens from an external auth source (e.g., field agent JWT).
159
+ * Bypasses the login/refresh flow when the token lifecycle is managed elsewhere.
160
+ * `expiresAt` defaults to 1 hour so `isTokenExpired()` returns false;
161
+ * the caller is responsible for refreshing before actual expiry.
162
+ */
163
+ setTokens(accessToken: string, refreshToken: string): void;
157
164
  getAuthHeader(): Record<string, string>;
158
165
  isTokenExpired(): boolean;
159
166
  logout(): void;
package/dist/index.d.ts CHANGED
@@ -154,6 +154,13 @@ declare class HCLoginClient extends HCBaseConnector {
154
154
  getTokens(): AuthTokens | undefined;
155
155
  getAccessToken(): string | undefined;
156
156
  getIDToken(): string | null | undefined;
157
+ /**
158
+ * Directly inject tokens from an external auth source (e.g., field agent JWT).
159
+ * Bypasses the login/refresh flow when the token lifecycle is managed elsewhere.
160
+ * `expiresAt` defaults to 1 hour so `isTokenExpired()` returns false;
161
+ * the caller is responsible for refreshing before actual expiry.
162
+ */
163
+ setTokens(accessToken: string, refreshToken: string): void;
157
164
  getAuthHeader(): Record<string, string>;
158
165
  isTokenExpired(): boolean;
159
166
  logout(): void;
package/dist/index.js CHANGED
@@ -58,6 +58,19 @@ var HCLoginClient = class extends HCBaseConnector {
58
58
  var _a;
59
59
  return (_a = this.tokens) == null ? void 0 : _a.idToken;
60
60
  }
61
+ /**
62
+ * Directly inject tokens from an external auth source (e.g., field agent JWT).
63
+ * Bypasses the login/refresh flow when the token lifecycle is managed elsewhere.
64
+ * `expiresAt` defaults to 1 hour so `isTokenExpired()` returns false;
65
+ * the caller is responsible for refreshing before actual expiry.
66
+ */
67
+ setTokens(accessToken, refreshToken) {
68
+ this.tokens = {
69
+ accessToken,
70
+ refreshToken,
71
+ expiresAt: Date.now() + 36e5
72
+ };
73
+ }
61
74
  getAuthHeader() {
62
75
  var _a;
63
76
  this.ensureConfigured();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@healthcloudai/hc-login-connector",
3
- "version": "0.3.1",
3
+ "version": "0.4.1",
4
4
  "description": "Healthcheck Login authentication SDK with TypeScrip and token refresh",
5
5
  "author": "Healthcheck Systems Inc",
6
6
  "license": "MIT",