@icanbwell/bwell-sdk-ts 1.33.0 → 1.34.0

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
@@ -10,7 +10,7 @@ providers or connections. Please see the documentation for details.
10
10
  ## SDKv2 / SDKv1 Update
11
11
 
12
12
  The `main` branch will soon be updated to be for SDKv2 only. Any v1 updates are
13
- to be made to `typescript-sdk-v1` branch.
13
+ to be made to `typescript-sdk-v1` branch once that happens.
14
14
 
15
15
  ## Installation
16
16
 
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * This file is automatically generated. Please do not edit this file directly.
3
3
  */
4
- export declare const VERSION = "1.33.0";
4
+ export declare const VERSION = "1.34.0";
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * This file is automatically generated. Please do not edit this file directly.
3
3
  */
4
- export const VERSION = "1.33.0";
4
+ export const VERSION = "1.34.0";
@@ -1,7 +1,9 @@
1
- import { GetAllergyIntoleranceGroupsQueryResults, GetAllergyIntolerancesQueryResults, GetBinaryQueryResults, GetCarePlanGroupsQueryResults, GetCarePlansQueryResults, GetCareTeamsQueryResults, GetConditionGroupsQueryResults, GetConditionsQueryResults, GetDiagnosticReportLabGroupsQueryResults, GetDiagnosticReportsQueryResults, GetDocumentReferencesQueryResults, GetEncounterQueryResults, GetEncountersGroupQueryResults, GetHealthSummaryQueryResults, GetImmunizationGroupsQueryResults, GetImmunizationsQueryResults, GetLabGroupsQueryResults, GetLabKnowledgeQueryResults, GetLabsQueryResults, GetMedicationDispenseQueryResults, GetMedicationGroupsQueryResults, GetMedicationKnowledgeQueryResults, GetMedicationPricingQueryResults, GetMedicationRequestQueryResults, GetMedicationStatementsQueryResults, GetProcedureGroupsQueryResults, GetProceduresQueryResults, GetVitalSignGroupsQueryResults, GetVitalSignsQueryResults } from "../../../graphql/operations/types.js";
1
+ import { GetAllergyIntoleranceGroupsQueryResults, GetAllergyIntolerancesQueryResults, GetBinaryQueryResults, GetCarePlanGroupsQueryResults, GetCarePlansQueryResults, GetCareTeamsQueryResults, GetConditionGroupsQueryResults, GetConditionsQueryResults, GetDiagnosticReportLabGroupsQueryResults, GetDiagnosticReportsQueryResults, GetDocumentReferencesQueryResults, GetEncounterQueryResults, GetEncountersGroupQueryResults, GetHealthSummaryQueryResults, GetImmunizationGroupsQueryResults, GetImmunizationsQueryResults, GetLabGroupsQueryResults, GetLabKnowledgeQueryResults, GetLabsQueryResults, GetMedicationGroupsQueryResults, GetMedicationKnowledgeQueryResults, GetMedicationPricingQueryResults, GetMedicationStatementsQueryResults, GetProcedureGroupsQueryResults, GetProceduresQueryResults, GetVitalSignGroupsQueryResults, GetVitalSignsQueryResults } from "../../../graphql/operations/types.js";
2
2
  import type { BWellQueryResult } from "../../../results/index.js";
3
+ import { MedicationDispenseResultsType } from "../../graphql-api/healthdata/graphql-get-medication-dispense-bwell-response-factory.js";
4
+ import { MedicationRequestResultsType } from "../../graphql-api/healthdata/graphql-get-medication-request-bwell-response-factory.js";
3
5
  import type { BaseManagerError } from "../errors.js";
4
- import { AllergyIntoleranceGroupsRequest, AllergyIntolerancesRequest, BinaryRequest, CarePlanGroupsRequest, CarePlansRequest, CareTeamsRequest, ConditionGroupsRequest, ConditionsRequest, DiagnosticReportLabGroupsRequest, DocumentReferencesRequest, EncounterGroupsRequest, EncountersRequest, ImmunizationGroupsRequest, ImmunizationsRequest, LabGroupsRequest, LabsRequest, MedicationDispenseRequest, MedicationGroupsRequest, MedicationRequestRequest, MedicationStatementsRequest, ProcedureGroupsRequest, ProceduresRequest, VitalSignGroupsRequest, VitalSignsRequest } from "./health-data-request.js";
6
+ import { AllergyIntoleranceGroupsRequest, AllergyIntolerancesRequest, BinaryRequest, CarePlanGroupsRequest, CarePlansRequest, CareTeamsRequest, ConditionGroupsRequest, ConditionsRequest, DiagnosticReportLabGroupsRequest, DiagnosticReportsRequest, DocumentReferencesRequest, EncounterGroupsRequest, EncountersRequest, ImmunizationGroupsRequest, ImmunizationsRequest, LabGroupsRequest, LabsRequest, MedicationDispenseRequest, MedicationGroupsRequest, MedicationRequestRequest, MedicationStatementsRequest, ProcedureGroupsRequest, ProceduresRequest, VitalSignGroupsRequest, VitalSignsRequest } from "./health-data-request.js";
5
7
  import { LabKnowledgeRequest } from "./lab-knowledge-request.js";
6
8
  import { MedicationKnowledgeRequest } from "./medication-knowledge-request.js";
7
9
  import { MedicationPricingRequest } from "./medication-pricing-request.js";
@@ -70,10 +72,8 @@ export interface VitalSignGroupsResults extends VitalSignGroupsResultsType {
70
72
  type DiagnosticReportLabGroupsResultsType = GetDiagnosticReportLabGroupsQueryResults["getDiagnosticReportLabGroups"];
71
73
  export interface DiagnosticReportLabGroupsResults extends DiagnosticReportLabGroupsResultsType {
72
74
  }
73
- type MedicationDispenseResultsType = GetMedicationDispenseQueryResults["getMedicationDispense"];
74
75
  export interface MedicationDispenseResults extends MedicationDispenseResultsType {
75
76
  }
76
- type MedicationRequestResultsType = GetMedicationRequestQueryResults["getMedicationRequest"];
77
77
  export interface MedicationRequestResults extends MedicationRequestResultsType {
78
78
  }
79
79
  type MedicationStatementsResultsType = GetMedicationStatementsQueryResults["getMedicationStatements"];
@@ -326,6 +326,14 @@ export interface HealthManager {
326
326
  */
327
327
  getLabKnowledge(request?: LabKnowledgeRequest): Promise<BWellQueryResult<LabKnowledgeResults>>;
328
328
  getMedicationPricing(request: MedicationPricingRequest): Promise<BWellQueryResult<MedicationPricingResults>>;
329
+ /**
330
+ * Retrieves a list of diagnostic report resources.
331
+ *
332
+ * @param {DiagnosticReportsRequest} request An optional request class for specifying the search criteria, for the retrieval of diagnostic report resources.
333
+ *
334
+ * @returns {Promise<BWellQueryResult<DiagnosticReportsResults>>} A promise resolving to an object representing the list of diagnostic reports retrieved.
335
+ */
336
+ getDiagnosticReports(request?: DiagnosticReportsRequest): Promise<BWellQueryResult<DiagnosticReportsResults>>;
329
337
  /**
330
338
  * Retrieves a list of diagnostic report lab groups resources.
331
339
  *
@@ -0,0 +1,10 @@
1
+ import { GetMedicationDispenseQueryResults } from "../../../graphql/operations/types.js";
2
+ import { BWellQueryResult, BWellQueryResultFactory } from "../../../results/index.js";
3
+ import { RenameKey } from "./graphql-health-manager.js";
4
+ export type MedicationDispenseResultsType = RenameKey<GetMedicationDispenseQueryResults["getMedicationDispense"], "itemReferenceResource", "resource">;
5
+ /**
6
+ * Factory to map the GraphQL GetMedicationDispenseResults object to a BWellQueryResult using the expected shape
7
+ */
8
+ export declare class GraphQLGetMedicationDispenseBWellResponseFactory implements BWellQueryResultFactory<BWellQueryResult<GetMedicationDispenseQueryResults>, BWellQueryResult<MedicationDispenseResultsType>> {
9
+ create(queryResult: BWellQueryResult<GetMedicationDispenseQueryResults>): BWellQueryResult<MedicationDispenseResultsType>;
10
+ }
@@ -0,0 +1,35 @@
1
+ import { BWellQueryResult, } from "../../../results/index.js";
2
+ /**
3
+ * Factory to map the GraphQL GetMedicationDispenseResults object to a BWellQueryResult using the expected shape
4
+ */
5
+ export class GraphQLGetMedicationDispenseBWellResponseFactory {
6
+ create(queryResult) {
7
+ var _a;
8
+ // Extract data from query result
9
+ const resultData = (_a = queryResult.data) === null || _a === void 0 ? void 0 : _a.getMedicationDispense;
10
+ if (!resultData) {
11
+ return new BWellQueryResult(undefined, queryResult.error);
12
+ }
13
+ // Augment result to conform to expected data type
14
+ const augmentedResult = Object.assign(Object.assign({}, resultData), ((resultData === null || resultData === void 0 ? void 0 : resultData.resources) && {
15
+ resources: resultData === null || resultData === void 0 ? void 0 : resultData.resources.map((resource) => {
16
+ var _a, _b, _c, _d, _e, _f, _g;
17
+ return (Object.assign(Object.assign({}, resource), (resource.medication && {
18
+ medication: Object.assign(Object.assign({}, resource.medication), (((_a = resource.medication) === null || _a === void 0 ? void 0 : _a.resource) && {
19
+ resource: Object.assign(Object.assign({}, (_b = resource.medication) === null || _b === void 0 ? void 0 : _b.resource), (((_d = (_c = resource.medication) === null || _c === void 0 ? void 0 : _c.resource) === null || _d === void 0 ? void 0 : _d.ingredient) && {
20
+ ingredient: (_g = (_f = (_e = resource.medication) === null || _e === void 0 ? void 0 : _e.resource) === null || _f === void 0 ? void 0 : _f.ingredient) === null || _g === void 0 ? void 0 : _g.map((ingredient) => {
21
+ var _a, _b;
22
+ return (Object.assign(Object.assign({}, ingredient), (((_a = ingredient === null || ingredient === void 0 ? void 0 : ingredient.itemReference) === null || _a === void 0 ? void 0 : _a.itemReferenceResource) && {
23
+ itemReference: {
24
+ resource: (_b = ingredient === null || ingredient === void 0 ? void 0 : ingredient.itemReference) === null || _b === void 0 ? void 0 : _b.itemReferenceResource,
25
+ },
26
+ })));
27
+ }),
28
+ })),
29
+ })),
30
+ })));
31
+ }),
32
+ }));
33
+ return new BWellQueryResult(augmentedResult, queryResult.error);
34
+ }
35
+ }
@@ -0,0 +1,10 @@
1
+ import { GetMedicationRequestQueryResults } from "../../../graphql/operations/types.js";
2
+ import { BWellQueryResult, BWellQueryResultFactory } from "../../../results/index.js";
3
+ import { RenameKey } from "./graphql-health-manager.js";
4
+ export type MedicationRequestResultsType = RenameKey<GetMedicationRequestQueryResults["getMedicationRequest"], "itemReferenceResource", "resource">;
5
+ /**
6
+ * Factory to map the GraphQL GetMedicationRequestResults object to a BWellQueryResult using the expected shape
7
+ */
8
+ export declare class GraphQLGetMedicationRequestBWellResponseFactory implements BWellQueryResultFactory<BWellQueryResult<GetMedicationRequestQueryResults>, BWellQueryResult<MedicationRequestResultsType>> {
9
+ create(queryResult: BWellQueryResult<GetMedicationRequestQueryResults>): BWellQueryResult<MedicationRequestResultsType>;
10
+ }
@@ -0,0 +1,35 @@
1
+ import { BWellQueryResult, } from "../../../results/index.js";
2
+ /**
3
+ * Factory to map the GraphQL GetMedicationRequestResults object to a BWellQueryResult using the expected shape
4
+ */
5
+ export class GraphQLGetMedicationRequestBWellResponseFactory {
6
+ create(queryResult) {
7
+ var _a;
8
+ // Extract data from query result
9
+ const resultData = (_a = queryResult.data) === null || _a === void 0 ? void 0 : _a.getMedicationRequest;
10
+ // Augment result to conform to expected data type
11
+ if (!resultData) {
12
+ return new BWellQueryResult(undefined, queryResult.error);
13
+ }
14
+ const augmentedResult = Object.assign(Object.assign({}, resultData), ((resultData === null || resultData === void 0 ? void 0 : resultData.resources) && {
15
+ resources: resultData === null || resultData === void 0 ? void 0 : resultData.resources.map((resource) => {
16
+ var _a, _b, _c, _d, _e, _f, _g;
17
+ return (Object.assign(Object.assign({}, resource), (resource.medication && {
18
+ medication: Object.assign(Object.assign({}, resource.medication), (((_a = resource.medication) === null || _a === void 0 ? void 0 : _a.resource) && {
19
+ resource: Object.assign(Object.assign({}, (_b = resource.medication) === null || _b === void 0 ? void 0 : _b.resource), (((_d = (_c = resource.medication) === null || _c === void 0 ? void 0 : _c.resource) === null || _d === void 0 ? void 0 : _d.ingredient) && {
20
+ ingredient: (_g = (_f = (_e = resource.medication) === null || _e === void 0 ? void 0 : _e.resource) === null || _f === void 0 ? void 0 : _f.ingredient) === null || _g === void 0 ? void 0 : _g.map((ingredient) => {
21
+ var _a, _b;
22
+ return (Object.assign(Object.assign({}, ingredient), (((_a = ingredient === null || ingredient === void 0 ? void 0 : ingredient.itemReference) === null || _a === void 0 ? void 0 : _a.itemReferenceResource) && {
23
+ itemReference: {
24
+ resource: (_b = ingredient === null || ingredient === void 0 ? void 0 : ingredient.itemReference) === null || _b === void 0 ? void 0 : _b.itemReferenceResource,
25
+ },
26
+ })));
27
+ }),
28
+ })),
29
+ })),
30
+ })));
31
+ }),
32
+ }));
33
+ return new BWellQueryResult(augmentedResult, queryResult.error);
34
+ }
35
+ }
@@ -6,9 +6,14 @@ import * as health from "../../base/health-data/index.js";
6
6
  import { HealthManager } from "../../base/index.js";
7
7
  import { GraphQLManager } from "../graphql-manager/index.js";
8
8
  import type { GraphQLSdk } from "../graphql-sdk/index.js";
9
+ import { GraphQLGetMedicationDispenseBWellResponseFactory } from "./graphql-get-medication-dispense-bwell-response-factory.js";
10
+ import { GraphQLGetMedicationRequestBWellResponseFactory } from "./graphql-get-medication-request-bwell-response-factory.js";
11
+ export type RenameKey<T, K extends string, N extends string> = T extends object ? {
12
+ [P in keyof T as P extends K ? N : P]: P extends K ? T[P] : RenameKey<T[P], K, N>;
13
+ } : T;
9
14
  export declare class GraphQLHealthManager extends GraphQLManager implements HealthManager {
10
15
  #private;
11
- constructor(sdk: GraphQLSdk, loggerProvider?: LoggerProvider);
16
+ constructor(sdk: GraphQLSdk, loggerProvider?: LoggerProvider, medicationRequestResponseFactory?: GraphQLGetMedicationRequestBWellResponseFactory, medicationDispenseResponseFactory?: GraphQLGetMedicationDispenseBWellResponseFactory);
12
17
  getHealthSummary(): Promise<BWellQueryResult<health.HealthSummaryResults, BaseManagerError>>;
13
18
  getAllergyIntolerances(request?: health.AllergyIntolerancesRequest): Promise<BWellQueryResult<health.AllergyIntolerancesResults, ValidationError | BaseManagerError>>;
14
19
  getAllergyIntoleranceGroups(request?: health.AllergyIntoleranceGroupsRequest): Promise<BWellQueryResult<health.AllergyIntolerancesGroupsResults, ValidationError | BaseManagerError>>;
@@ -18,17 +18,23 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
18
18
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
19
19
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
20
20
  };
21
- var _GraphQLHealthManager_sdk, _GraphQLHealthManager_logger;
21
+ var _GraphQLHealthManager_sdk, _GraphQLHealthManager_logger, _GraphQLHealthManager_medicationRequestResponseFactory, _GraphQLHealthManager_medicationDispenseResponseFactory;
22
22
  import { ConsoleLoggerProvider, } from "../../../logger/index.js";
23
23
  import { BWellQueryResult } from "../../../results/index.js";
24
24
  import { GraphQLManager } from "../graphql-manager/index.js";
25
+ import { GraphQLGetMedicationDispenseBWellResponseFactory } from "./graphql-get-medication-dispense-bwell-response-factory.js";
26
+ import { GraphQLGetMedicationRequestBWellResponseFactory } from "./graphql-get-medication-request-bwell-response-factory.js";
25
27
  export class GraphQLHealthManager extends GraphQLManager {
26
- constructor(sdk, loggerProvider = new ConsoleLoggerProvider()) {
28
+ constructor(sdk, loggerProvider = new ConsoleLoggerProvider(), medicationRequestResponseFactory = new GraphQLGetMedicationRequestBWellResponseFactory(), medicationDispenseResponseFactory = new GraphQLGetMedicationDispenseBWellResponseFactory()) {
27
29
  super();
28
30
  _GraphQLHealthManager_sdk.set(this, void 0);
29
31
  _GraphQLHealthManager_logger.set(this, void 0);
32
+ _GraphQLHealthManager_medicationRequestResponseFactory.set(this, void 0);
33
+ _GraphQLHealthManager_medicationDispenseResponseFactory.set(this, void 0);
30
34
  __classPrivateFieldSet(this, _GraphQLHealthManager_sdk, sdk, "f");
31
35
  __classPrivateFieldSet(this, _GraphQLHealthManager_logger, loggerProvider.getLogger("GraphQLHealthManager"), "f");
36
+ __classPrivateFieldSet(this, _GraphQLHealthManager_medicationRequestResponseFactory, medicationRequestResponseFactory, "f");
37
+ __classPrivateFieldSet(this, _GraphQLHealthManager_medicationDispenseResponseFactory, medicationDispenseResponseFactory, "f");
32
38
  }
33
39
  getHealthSummary() {
34
40
  return __awaiter(this, void 0, void 0, function* () {
@@ -397,7 +403,7 @@ export class GraphQLHealthManager extends GraphQLManager {
397
403
  }
398
404
  getMedicationDispense(request) {
399
405
  return __awaiter(this, void 0, void 0, function* () {
400
- var _a, _b;
406
+ var _a;
401
407
  const validationResult = this.validateRequest(request);
402
408
  if (validationResult.failure()) {
403
409
  return validationResult.toQueryResult();
@@ -410,12 +416,12 @@ export class GraphQLHealthManager extends GraphQLManager {
410
416
  if (result.hasError()) {
411
417
  __classPrivateFieldGet(this, _GraphQLHealthManager_logger, "f").error("getMedicationDispense errors", result.error);
412
418
  }
413
- return new BWellQueryResult((_b = result.data) === null || _b === void 0 ? void 0 : _b.getMedicationDispense, result.error);
419
+ return __classPrivateFieldGet(this, _GraphQLHealthManager_medicationDispenseResponseFactory, "f").create(result);
414
420
  });
415
421
  }
416
422
  getMedicationRequest(request) {
417
423
  return __awaiter(this, void 0, void 0, function* () {
418
- var _a, _b;
424
+ var _a;
419
425
  const validationResult = this.validateRequest(request);
420
426
  if (validationResult.failure()) {
421
427
  return validationResult.toQueryResult();
@@ -428,7 +434,7 @@ export class GraphQLHealthManager extends GraphQLManager {
428
434
  if (result.hasError()) {
429
435
  __classPrivateFieldGet(this, _GraphQLHealthManager_logger, "f").error("getMedicationRequest errors", result.error);
430
436
  }
431
- return new BWellQueryResult((_b = result.data) === null || _b === void 0 ? void 0 : _b.getMedicationRequest, result.error);
437
+ return __classPrivateFieldGet(this, _GraphQLHealthManager_medicationRequestResponseFactory, "f").create(result);
432
438
  });
433
439
  }
434
440
  getMedicationStatements(request) {
@@ -540,4 +546,4 @@ export class GraphQLHealthManager extends GraphQLManager {
540
546
  });
541
547
  }
542
548
  }
543
- _GraphQLHealthManager_sdk = new WeakMap(), _GraphQLHealthManager_logger = new WeakMap();
549
+ _GraphQLHealthManager_sdk = new WeakMap(), _GraphQLHealthManager_logger = new WeakMap(), _GraphQLHealthManager_medicationRequestResponseFactory = new WeakMap(), _GraphQLHealthManager_medicationDispenseResponseFactory = new WeakMap();