@healthcloudai/hc-settings-connector 0.0.13 → 0.0.14

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/dist/index.d.ts CHANGED
@@ -1,24 +1,20 @@
1
1
  import { HCLoginClient } from '@healthcloudai/hc-login-connector';
2
2
  import { HttpClient } from '@healthcloudai/hc-http';
3
3
 
4
- type Environment = "dev" | "uat" | "prod";
5
- interface UserImage {
6
- ImageURL: string;
7
- FileName: string;
8
- Extension: string;
9
- imageUrl?: string;
10
- fileName?: string;
11
- extension?: string;
12
- }
13
4
  interface APIRequest<T> {
14
5
  Data: T;
15
6
  }
16
7
  interface APIResponse<T> {
17
- Data: T;
8
+ Data: T | null;
18
9
  IsOK: boolean;
19
- ErrorMessage?: string | null;
10
+ ErrorMessage: string | null;
20
11
  }
21
- interface CoverageRequest {
12
+ interface UserImage {
13
+ ImageURL: string | null;
14
+ FileName: string | null;
15
+ Extension: string | null;
16
+ }
17
+ interface CoverageData {
22
18
  InsurancePackageId: string;
23
19
  MemberId: string;
24
20
  FirstName: string;
@@ -26,51 +22,128 @@ interface CoverageRequest {
26
22
  Sex: string;
27
23
  Image: string;
28
24
  }
29
- type CoveragePayload = APIRequest<CoverageRequest>;
30
- type CaptureType = "identification" | "healthinsurance";
31
- interface CaptureData {
32
- Type: CaptureType;
33
- FileID: string;
25
+ declare enum UserStatus {
26
+ INACTIVE = 0,
27
+ ACTIVE = 1,
28
+ SUSPENDED = -1
34
29
  }
35
- type CaptureRequest = APIRequest<CaptureData>;
36
- interface UploadImageData {
37
- Extension: string;
30
+ interface PatientRecord {
31
+ Status: UserStatus;
32
+ Sex: string | null;
33
+ GenderIdentity: string | null;
34
+ HasInsurance: boolean;
35
+ HasIDCard: boolean;
36
+ HasSelfie: boolean;
37
+ Flags: Record<string, string> | null;
38
38
  }
39
- type UploadImageRequest = APIRequest<UploadImageData>;
40
- interface UpdateImageData {
41
- FileName: string;
39
+ interface Encounter {
40
+ FHIRID: string | null;
41
+ AthenaID: string | null;
42
+ Status: number;
43
+ Patient: PatientRecord | null;
44
+ EncounterClass: string | null;
45
+ EHR: string | null;
46
+ EHRType: string | null;
47
+ EHRVisitName: string | null;
48
+ EHRAppointmentID: string | null;
49
+ EHRProviderID: string | null;
50
+ EHRProviderName: string | null;
51
+ EHRDate: string | null;
52
+ EHRStatus: string | null;
53
+ EHRStage: string | null;
42
54
  }
43
- type UpdateImageRequest = APIRequest<UpdateImageData>;
44
- type EmptyRequest = APIRequest<Record<string, never>>;
45
- interface DrivingLicenseData {
46
- Image: string;
55
+ interface PatientDashboard {
56
+ Record: PatientRecord | null;
57
+ Encounters: Encounter[];
58
+ EHR: string | null;
59
+ PendingActions: string[];
60
+ }
61
+ type CaptureType = "healthinsurance" | "identification" | "userphoto";
62
+ interface InsuranceCaptureData {
63
+ FirstName: string | null;
64
+ LastName: string | null;
65
+ MemberId: string | null;
66
+ GroupNumber: string | null;
67
+ EffectiveDate: string | null;
68
+ RxBIN: string | null;
69
+ RxPCN: string | null;
70
+ RxGRP: string | null;
71
+ Carrier: string | null;
72
+ }
73
+ interface IdentificationCaptureData {
74
+ FirstName: string | null;
75
+ LastName: string | null;
76
+ StreetAddress: string | null;
77
+ City: string | null;
78
+ ZipCode: string | null;
79
+ State: string | null;
80
+ IssuedDate: string | null;
81
+ ExpiresDate: string | null;
82
+ Dob: string | null;
83
+ IDNumber: string | null;
84
+ }
85
+ interface UserPhotoCaptureData {
86
+ ImageKey: string | null;
87
+ }
88
+ interface CaptureResult<T> {
89
+ CapturedData: T | null;
90
+ IsCaptured: boolean;
91
+ InsurancePackages: object[] | null;
92
+ }
93
+ interface InsuranceRecord {
94
+ LastUpdatedBy: string | null;
95
+ IrcName: string | null;
96
+ LastUpdated: string | null;
97
+ RelationshipToInsured: string | null;
98
+ InsurancePolicyHolder: string | null;
99
+ EligibilityStatus: string | null;
100
+ InsurancePolicyHolderCountryIso3166: string | null;
101
+ ConfidentialityCode: string | null;
102
+ Created: string | null;
103
+ InsuranceId: string | null;
104
+ InsurancePolicyHolderSex: string | null;
105
+ InsurancePlanName: string | null;
106
+ InsuranceType: string | null;
107
+ InsurancePolicyHolderCountryCode: string | null;
108
+ InsurancePackageId: number | null;
109
+ InsuredEntityTypeId: number | null;
110
+ InsurancePolicyHolderFirstName: string | null;
111
+ SequenceNumber: number | null;
112
+ IrcId: number | null;
113
+ CreatedBy: string | null;
114
+ RelationshipToInsuredId: number | null;
115
+ InsurancePolicyHolderLastName: string | null;
116
+ /**
117
+ * Internal-only fields returned in backend models.
118
+ */
119
+ MemberId?: string | null;
120
+ Image?: string | null;
47
121
  }
48
- type DrivingLicenseRequest = APIRequest<DrivingLicenseData>;
49
- type DrivingLicenseResponse = APIResponse<string>;
50
- type HCUserImage = UserImage;
51
122
 
52
123
  declare class HCSettingsClient {
53
- private http;
54
- private auth;
124
+ private readonly httpClient;
125
+ private readonly loginClient;
55
126
  private apiKeyHeaderName?;
56
127
  private apiKeyValue?;
57
- constructor(httpClient: HttpClient, authClient: HCLoginClient);
128
+ constructor(httpClient: HttpClient, loginClient: HCLoginClient);
58
129
  setApiKey(headerName: string, value: string): void;
59
- getDashboard(): Promise<any>;
60
- getUserImageCannedUrl(extension: string): Promise<UserImage>;
61
- getDrivingLicenseCannedUrl(extension: string): Promise<UserImage>;
62
- getInsuranceCannedUrl(extension: string): Promise<UserImage>;
63
- captureDrivingLicense(fileKey: string): Promise<any>;
64
- captureInsurance(fileKey: string): Promise<any>;
65
- submitInsurance(payload: CoverageRequest): Promise<any>;
66
- getInsurances(): Promise<any>;
67
- submitDrivingLicense(payload: DrivingLicenseData): Promise<DrivingLicenseResponse>;
68
- updateUserImage(fileName: string): Promise<any>;
69
- deactivateUser(): Promise<any>;
130
+ getDashboard(): Promise<APIResponse<PatientDashboard>>;
131
+ getUserImageCannedUrl(extension: string): Promise<APIResponse<UserImage>>;
132
+ updateUserImage(fileName: string): Promise<APIResponse<boolean>>;
133
+ getDrivingLicenseCannedUrl(extension: string): Promise<APIResponse<UserImage>>;
134
+ captureDrivingLicense(fileKey: string): Promise<APIResponse<CaptureResult<IdentificationCaptureData>>>;
135
+ submitDrivingLicense(image: string): Promise<APIResponse<string>>;
136
+ getInsuranceCannedUrl(extension: string): Promise<APIResponse<UserImage>>;
137
+ captureInsurance(fileKey: string): Promise<APIResponse<CaptureResult<InsuranceCaptureData>>>;
138
+ submitInsurance(coverage: CoverageData): Promise<APIResponse<InsuranceRecord>>;
139
+ getInsurances(): Promise<APIResponse<InsuranceRecord[]>>;
140
+ captureUserPhoto(fileKey: string): Promise<APIResponse<CaptureResult<UserPhotoCaptureData>>>;
141
+ deactivateUser(): Promise<APIResponse<boolean>>;
70
142
  private getBaseUrl;
71
143
  private getAuthHeaders;
72
144
  private getJsonHeaders;
73
145
  private getApiKeyHeader;
146
+ private requireValue;
74
147
  }
75
148
 
76
149
  declare class ConfigError extends Error {
@@ -84,4 +157,4 @@ declare class HttpError extends Error {
84
157
  constructor(status: number, message: string);
85
158
  }
86
159
 
87
- export { type APIRequest, type APIResponse, AuthError, type CaptureData, type CaptureRequest, type CaptureType, ConfigError, type CoveragePayload, type CoverageRequest, type DrivingLicenseData, type DrivingLicenseRequest, type DrivingLicenseResponse, type EmptyRequest, type Environment, HCSettingsClient, type HCUserImage, HttpError, type UpdateImageData, type UpdateImageRequest, type UploadImageData, type UploadImageRequest, type UserImage };
160
+ export { type APIRequest, type APIResponse, AuthError, type CaptureResult, type CaptureType, ConfigError, type CoverageData, type Encounter, HCSettingsClient, HttpError, type IdentificationCaptureData, type InsuranceCaptureData, type InsuranceRecord, type PatientDashboard, type PatientRecord, type UserImage, type UserPhotoCaptureData, UserStatus };
package/dist/index.js CHANGED
@@ -21,144 +21,218 @@ var HttpError = class extends Error {
21
21
 
22
22
  // src/client.ts
23
23
  var HCSettingsClient = class {
24
- constructor(httpClient, authClient) {
25
- this.http = httpClient;
26
- this.auth = authClient;
24
+ constructor(httpClient, loginClient) {
25
+ this.httpClient = httpClient;
26
+ this.loginClient = loginClient;
27
27
  }
28
28
  setApiKey(headerName, value) {
29
29
  const trimmedHeaderName = headerName == null ? void 0 : headerName.trim();
30
30
  const trimmedValue = value == null ? void 0 : value.trim();
31
31
  if (!trimmedHeaderName) {
32
- throw new ConfigError("API key header name is required.");
32
+ throw new ConfigError(
33
+ "API key header name is required."
34
+ );
33
35
  }
34
36
  if (!trimmedValue) {
35
- throw new ConfigError("API key value is required.");
37
+ throw new ConfigError(
38
+ "API key value is required."
39
+ );
36
40
  }
37
41
  this.apiKeyHeaderName = trimmedHeaderName;
38
42
  this.apiKeyValue = trimmedValue;
39
43
  }
44
+ // ===========================================================================
45
+ // Dashboard
46
+ // ===========================================================================
40
47
  async getDashboard() {
41
- return this.http.get(
48
+ return this.httpClient.get(
42
49
  `${this.getBaseUrl()}/patient/dashboard`,
43
50
  this.getAuthHeaders()
44
51
  );
45
52
  }
53
+ // ===========================================================================
54
+ // User image
55
+ // ===========================================================================
46
56
  async getUserImageCannedUrl(extension) {
47
- const payload = {
57
+ const resolvedExtension = this.requireValue(
58
+ extension,
59
+ "extension"
60
+ );
61
+ const requestPayload = {
48
62
  Data: {
49
- Extension: extension
63
+ Extension: resolvedExtension
50
64
  }
51
65
  };
52
- return this.http.put(
66
+ return this.httpClient.put(
53
67
  `${this.getBaseUrl()}/patient/image/cannedurl`,
54
- payload,
68
+ requestPayload,
55
69
  this.getJsonHeaders()
56
70
  );
57
71
  }
58
- async getDrivingLicenseCannedUrl(extension) {
59
- const payload = {
72
+ async updateUserImage(fileName) {
73
+ const resolvedFileName = this.requireValue(
74
+ fileName,
75
+ "fileName"
76
+ );
77
+ const requestPayload = {
60
78
  Data: {
61
- Extension: extension
79
+ FileName: resolvedFileName
62
80
  }
63
81
  };
64
- return this.http.put(
65
- `${this.getBaseUrl()}/patient/id/cannedurl`,
66
- payload,
82
+ return this.httpClient.put(
83
+ `${this.getBaseUrl()}/patient/image/url`,
84
+ requestPayload,
67
85
  this.getJsonHeaders()
68
86
  );
69
87
  }
70
- async getInsuranceCannedUrl(extension) {
71
- const payload = {
88
+ // ===========================================================================
89
+ // Identification
90
+ // ===========================================================================
91
+ async getDrivingLicenseCannedUrl(extension) {
92
+ const resolvedExtension = this.requireValue(
93
+ extension,
94
+ "extension"
95
+ );
96
+ const requestPayload = {
72
97
  Data: {
73
- Extension: extension
98
+ Extension: resolvedExtension
74
99
  }
75
100
  };
76
- return this.http.put(
77
- `${this.getBaseUrl()}/patient/insurance/cannedurl`,
78
- payload,
101
+ return this.httpClient.put(
102
+ `${this.getBaseUrl()}/patient/id/cannedurl`,
103
+ requestPayload,
79
104
  this.getJsonHeaders()
80
105
  );
81
106
  }
82
107
  async captureDrivingLicense(fileKey) {
83
- const payload = {
108
+ const resolvedFileKey = this.requireValue(
109
+ fileKey,
110
+ "fileKey"
111
+ );
112
+ const requestPayload = {
84
113
  Data: {
85
114
  Type: "identification",
86
- FileID: fileKey
115
+ FileID: resolvedFileKey
87
116
  }
88
117
  };
89
- return this.http.post(
118
+ return this.httpClient.post(
90
119
  `${this.getBaseUrl()}/patient/capture`,
91
- payload,
120
+ requestPayload,
121
+ this.getJsonHeaders()
122
+ );
123
+ }
124
+ async submitDrivingLicense(image) {
125
+ const resolvedImage = this.requireValue(
126
+ image,
127
+ "image"
128
+ );
129
+ const requestPayload = {
130
+ Data: {
131
+ Image: resolvedImage
132
+ }
133
+ };
134
+ return this.httpClient.put(
135
+ `${this.getBaseUrl()}/ehr/patient/drivinglicense`,
136
+ requestPayload,
137
+ this.getJsonHeaders()
138
+ );
139
+ }
140
+ // ===========================================================================
141
+ // Insurance
142
+ // ===========================================================================
143
+ async getInsuranceCannedUrl(extension) {
144
+ const resolvedExtension = this.requireValue(
145
+ extension,
146
+ "extension"
147
+ );
148
+ const requestPayload = {
149
+ Data: {
150
+ Extension: resolvedExtension
151
+ }
152
+ };
153
+ return this.httpClient.put(
154
+ `${this.getBaseUrl()}/patient/insurance/cannedurl`,
155
+ requestPayload,
92
156
  this.getJsonHeaders()
93
157
  );
94
158
  }
95
159
  async captureInsurance(fileKey) {
96
- const payload = {
160
+ const resolvedFileKey = this.requireValue(
161
+ fileKey,
162
+ "fileKey"
163
+ );
164
+ const requestPayload = {
97
165
  Data: {
98
166
  Type: "healthinsurance",
99
- FileID: fileKey
167
+ FileID: resolvedFileKey
100
168
  }
101
169
  };
102
- return this.http.post(
170
+ return this.httpClient.post(
103
171
  `${this.getBaseUrl()}/patient/capture`,
104
- payload,
172
+ requestPayload,
105
173
  this.getJsonHeaders()
106
174
  );
107
175
  }
108
- async submitInsurance(payload) {
176
+ async submitInsurance(coverage) {
177
+ if (!coverage) {
178
+ throw new ConfigError(
179
+ "Insurance coverage data is required."
180
+ );
181
+ }
109
182
  const requestPayload = {
110
- Data: payload
183
+ Data: coverage
111
184
  };
112
- return this.http.put(
185
+ return this.httpClient.put(
113
186
  `${this.getBaseUrl()}/patient/coverage`,
114
187
  requestPayload,
115
188
  this.getJsonHeaders()
116
189
  );
117
190
  }
118
191
  async getInsurances() {
119
- return this.http.get(
192
+ return this.httpClient.get(
120
193
  `${this.getBaseUrl()}/ehr/patient/insurances`,
121
194
  this.getAuthHeaders()
122
195
  );
123
196
  }
124
- async submitDrivingLicense(payload) {
125
- const requestPayload = {
126
- Data: payload
127
- };
128
- return this.http.put(
129
- `${this.getBaseUrl()}/ehr/patient/drivinglicense`,
130
- requestPayload,
131
- this.getJsonHeaders()
197
+ // ===========================================================================
198
+ // User photo capture
199
+ // ===========================================================================
200
+ async captureUserPhoto(fileKey) {
201
+ const resolvedFileKey = this.requireValue(
202
+ fileKey,
203
+ "fileKey"
132
204
  );
133
- }
134
- async updateUserImage(fileName) {
135
- const payload = {
205
+ const requestPayload = {
136
206
  Data: {
137
- FileName: fileName
207
+ Type: "userphoto",
208
+ FileID: resolvedFileKey
138
209
  }
139
210
  };
140
- return this.http.put(
141
- `${this.getBaseUrl()}/patient/image/url`,
142
- payload,
211
+ return this.httpClient.post(
212
+ `${this.getBaseUrl()}/patient/capture`,
213
+ requestPayload,
143
214
  this.getJsonHeaders()
144
215
  );
145
216
  }
217
+ // ===========================================================================
218
+ // Account
219
+ // ===========================================================================
146
220
  async deactivateUser() {
147
- const payload = {
148
- Data: {}
149
- };
150
- return this.http.put(
221
+ return this.httpClient.put(
151
222
  `${this.getBaseUrl()}/patient/deactivate`,
152
- payload,
223
+ void 0,
153
224
  this.getJsonHeaders()
154
225
  );
155
226
  }
227
+ // ===========================================================================
228
+ // Helpers
229
+ // ===========================================================================
156
230
  getBaseUrl() {
157
- return this.auth.getBaseUrl();
231
+ return this.loginClient.getBaseUrl();
158
232
  }
159
233
  getAuthHeaders() {
160
234
  return {
161
- ...this.auth.getAuthHeader(),
235
+ ...this.loginClient.getAuthHeader(),
162
236
  ...this.getApiKeyHeader()
163
237
  };
164
238
  }
@@ -176,10 +250,28 @@ var HCSettingsClient = class {
176
250
  [this.apiKeyHeaderName]: this.apiKeyValue
177
251
  };
178
252
  }
253
+ requireValue(value, parameterName) {
254
+ const trimmedValue = value == null ? void 0 : value.trim();
255
+ if (!trimmedValue) {
256
+ throw new ConfigError(
257
+ `${parameterName} is required.`
258
+ );
259
+ }
260
+ return trimmedValue;
261
+ }
179
262
  };
263
+
264
+ // src/types.ts
265
+ var UserStatus = /* @__PURE__ */ ((UserStatus2) => {
266
+ UserStatus2[UserStatus2["INACTIVE"] = 0] = "INACTIVE";
267
+ UserStatus2[UserStatus2["ACTIVE"] = 1] = "ACTIVE";
268
+ UserStatus2[UserStatus2["SUSPENDED"] = -1] = "SUSPENDED";
269
+ return UserStatus2;
270
+ })(UserStatus || {});
180
271
  export {
181
272
  AuthError,
182
273
  ConfigError,
183
274
  HCSettingsClient,
184
- HttpError
275
+ HttpError,
276
+ UserStatus
185
277
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@healthcloudai/hc-settings-connector",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
4
4
  "description": "Healthcheck Settings SDK with TypeScript",
5
5
  "author": "Healthcheck Systems Inc",
6
6
  "license": "MIT",