@icanbwell/bwell-sdk-ts 2.0.0-alpha.0-rc.1758728092 → 2.0.0-alpha.0-rc.1758914055
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/__version__.d.ts +1 -1
- package/dist/__version__.js +1 -1
- package/dist/api/base/health-data/health-manager.d.ts +24 -1
- package/dist/api/graphql-api/healthdata/get-encounters-request-factory.d.ts +7 -0
- package/dist/api/graphql-api/healthdata/get-encounters-request-factory.js +76 -0
- package/dist/api/graphql-api/healthdata/graphql-health-manager.d.ts +2 -1
- package/dist/api/graphql-api/healthdata/graphql-health-manager.js +24 -2
- package/dist/api/graphql-api/healthdata/health-data-request-factory.d.ts +7 -1
- package/dist/api/graphql-api/healthdata/health-data-request-factory.js +1 -1
- package/dist/graphql/operations/index.d.ts +32 -21
- package/dist/graphql/operations/index.js +385 -185
- package/dist/graphql/operations/types.d.ts +9623 -3851
- package/dist/graphql/schema.d.ts +28 -0
- package/dist/models/common/location.d.ts +2 -0
- package/dist/models/common/organization.d.ts +7 -1
- package/dist/models/common/practitioner-role.d.ts +1 -1
- package/dist/models/common/practitioner.d.ts +2 -0
- package/dist/models/health-data/condition.d.ts +3 -0
- package/dist/models/health-data/encounter.d.ts +79 -0
- package/dist/models/health-data/encounter.js +1 -0
- package/dist/models/health-data/immunization.d.ts +3 -1
- package/dist/models/health-data/index.d.ts +1 -0
- package/dist/models/health-data/observation.d.ts +3 -1
- package/dist/models/health-data/procedure.d.ts +3 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/parsing-utils.d.ts +11 -1
- package/dist/utils/parsing-utils.js +33 -1
- package/dist/utils/search-token-utils.d.ts +8 -0
- package/dist/utils/search-token-utils.js +23 -0
- package/package.json +1 -1
package/dist/graphql/schema.d.ts
CHANGED
|
@@ -472,6 +472,14 @@ export type AccountSubjectReference = {
|
|
|
472
472
|
resource?: Maybe<AccountSubject>;
|
|
473
473
|
type?: Maybe<Scalars['URI']['output']>;
|
|
474
474
|
};
|
|
475
|
+
/** Defines connection information after activating a direct connection */
|
|
476
|
+
export type ActivateDirectConnection = {
|
|
477
|
+
__typename?: 'ActivateDirectConnection';
|
|
478
|
+
/** Status of connection */
|
|
479
|
+
status?: Maybe<DataConnectionStatus>;
|
|
480
|
+
/** Datetime when status updated */
|
|
481
|
+
statusUpdated: Scalars['DateTime']['output'];
|
|
482
|
+
};
|
|
475
483
|
/**
|
|
476
484
|
* ActivityDefinition
|
|
477
485
|
* This resource allows for the definition of some activity to be performed,
|
|
@@ -43460,6 +43468,8 @@ export type Money = {
|
|
|
43460
43468
|
};
|
|
43461
43469
|
export type Mutation = {
|
|
43462
43470
|
__typename?: 'Mutation';
|
|
43471
|
+
/** Activate a direct connection */
|
|
43472
|
+
activateDirectConnection: ActivateDirectConnection;
|
|
43463
43473
|
createAuthCode: AuthCode;
|
|
43464
43474
|
/** Create a connection */
|
|
43465
43475
|
createConnection: Connection;
|
|
@@ -43678,6 +43688,9 @@ export type Mutation = {
|
|
|
43678
43688
|
updateUserClient: Array<UpdateUserClientOutput>;
|
|
43679
43689
|
updateUserProfile?: Maybe<Person>;
|
|
43680
43690
|
};
|
|
43691
|
+
export type MutationActivateDirectConnectionArgs = {
|
|
43692
|
+
connectionId: Scalars['String']['input'];
|
|
43693
|
+
};
|
|
43681
43694
|
export type MutationCreateAuthCodeArgs = {
|
|
43682
43695
|
clientKey: Scalars['String']['input'];
|
|
43683
43696
|
clientPersonId: Scalars['String']['input'];
|
|
@@ -45889,6 +45902,21 @@ export type ObservationSubjectReference = {
|
|
|
45889
45902
|
resource?: Maybe<ObservationSubject>;
|
|
45890
45903
|
type?: Maybe<Scalars['URI']['output']>;
|
|
45891
45904
|
};
|
|
45905
|
+
export type OnboardingComposition = {
|
|
45906
|
+
__typename?: 'OnboardingComposition';
|
|
45907
|
+
id?: Maybe<Scalars['String']['output']>;
|
|
45908
|
+
patientId?: Maybe<Scalars['String']['output']>;
|
|
45909
|
+
sections?: Maybe<Array<Maybe<OnboardingSection>>>;
|
|
45910
|
+
status?: Maybe<Scalars['String']['output']>;
|
|
45911
|
+
};
|
|
45912
|
+
export type OnboardingCompositionStatus = 'amended' | 'entered_in_error' | 'final' | 'preliminary';
|
|
45913
|
+
export type OnboardingSection = {
|
|
45914
|
+
__typename?: 'OnboardingSection';
|
|
45915
|
+
id?: Maybe<Scalars['String']['output']>;
|
|
45916
|
+
isStepCompleted?: Maybe<Scalars['Boolean']['output']>;
|
|
45917
|
+
questionnaireResponseId?: Maybe<Scalars['String']['output']>;
|
|
45918
|
+
title?: Maybe<Scalars['String']['output']>;
|
|
45919
|
+
};
|
|
45892
45920
|
export type Operation = 'CANCEL_DELETE' | 'CONFIRM_DELETE' | 'DELETION_IN_PROGRESS' | 'IMMEDIATE_EXECUTION' | 'REQUEST_DELETE';
|
|
45893
45921
|
/**
|
|
45894
45922
|
* OperationDefinition
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Endpoint } from "./endpoint.js";
|
|
2
|
-
import { Address, ContactPoint, Identifier, Reference } from "./index.js";
|
|
2
|
+
import { Address, CodeableConcept, ContactPoint, Identifier, Reference } from "./index.js";
|
|
3
3
|
/**
|
|
4
4
|
* Represents a healthcare organization.
|
|
5
5
|
*
|
|
@@ -20,6 +20,12 @@ export type Organization = {
|
|
|
20
20
|
address: (Address | null)[] | null;
|
|
21
21
|
/** Contact information */
|
|
22
22
|
telecom: (ContactPoint | null)[] | null;
|
|
23
|
+
/** Active status of the organization */
|
|
24
|
+
active: boolean | null;
|
|
25
|
+
/** The unique identifier for the organization resource */
|
|
26
|
+
id: string;
|
|
27
|
+
/** The type of the organization */
|
|
28
|
+
type: Array<CodeableConcept | null> | null;
|
|
23
29
|
};
|
|
24
30
|
/**
|
|
25
31
|
* Represents a healthcare organization.
|
|
@@ -18,7 +18,7 @@ export type PractitionerRole = {
|
|
|
18
18
|
/** The type of resource, always "PractitionerRole". */
|
|
19
19
|
resourceType: "PractitionerRole";
|
|
20
20
|
/** Logical id of the practitioner role resource. */
|
|
21
|
-
id: string
|
|
21
|
+
id: string;
|
|
22
22
|
/** Business identifiers for the practitioner role. */
|
|
23
23
|
identifier: (Identifier | null)[] | null;
|
|
24
24
|
/** Reference to the practitioner who is performing the role. */
|
|
@@ -8,6 +8,8 @@ import { HumanName, Identifier } from "./index.js";
|
|
|
8
8
|
export type Practitioner = {
|
|
9
9
|
/** The GraphQL typename for the practitioner. */
|
|
10
10
|
__typename: "Practitioner";
|
|
11
|
+
/** Logical id of the resource. */
|
|
12
|
+
id: string;
|
|
11
13
|
/** Name(s) of the practitioner. */
|
|
12
14
|
name: (HumanName | null)[] | null;
|
|
13
15
|
/** Identifiers for the practitioner. */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Annotation, CodeableConcept, EntryBundle, Extension, IdentifiedResourceEntry, Identifier, Meta, Narrative, Patient, Period, Practitioner, Reference } from "../common/index.js";
|
|
2
|
+
import { Encounter } from "./index.js";
|
|
2
3
|
/**
|
|
3
4
|
* Represents a condition resource.
|
|
4
5
|
*
|
|
@@ -81,6 +82,8 @@ export type Condition = {
|
|
|
81
82
|
bodySite: CodeableConcept[] | null;
|
|
82
83
|
/** Individual who is making the condition statement. */
|
|
83
84
|
asserter: Reference<Patient> | null;
|
|
85
|
+
/** The encounter during which this condition was made. */
|
|
86
|
+
encounter: Reference<Encounter> | null;
|
|
84
87
|
};
|
|
85
88
|
/**
|
|
86
89
|
* Represents an entry in a condition bundle.
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { CodeableConcept, Coding, EntryBundle, IdentifiedResourceEntry, Identifier, Location, Meta, Narrative, Organization, Patient, Period, Practitioner, PractitionerRole, Reference, RelatedPerson } from "../common/index.js";
|
|
2
|
+
import { Condition } from "./index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Represents an Encounter resource.
|
|
5
|
+
* @category Models
|
|
6
|
+
* @title Encounter
|
|
7
|
+
* @excerpt Represents an Encounter resource.
|
|
8
|
+
*/
|
|
9
|
+
export type Encounter = {
|
|
10
|
+
/** Resource type */
|
|
11
|
+
resourceType: string | null;
|
|
12
|
+
/** Logical id of the resource */
|
|
13
|
+
id: string;
|
|
14
|
+
/** Identifiers for this encounter */
|
|
15
|
+
identifier: (Identifier | null)[] | null;
|
|
16
|
+
/** Metadata about the resource */
|
|
17
|
+
meta: Meta | null;
|
|
18
|
+
/** Text summary of the resource, for human interpretation */
|
|
19
|
+
text: Narrative | null;
|
|
20
|
+
/** Encounter type(s) */
|
|
21
|
+
type: (CodeableConcept | null)[] | null;
|
|
22
|
+
/** Status of the encounter */
|
|
23
|
+
status: string | null;
|
|
24
|
+
/** The period during which the encounter occurred */
|
|
25
|
+
period: Period | null;
|
|
26
|
+
/** Reason codes for the encounter */
|
|
27
|
+
reasonCode: (CodeableConcept | null)[] | null;
|
|
28
|
+
/** Class of the encounter */
|
|
29
|
+
class: Coding | null;
|
|
30
|
+
/** Hospitalization details */
|
|
31
|
+
hospitalization: {
|
|
32
|
+
dischargeDisposition: CodeableConcept | null;
|
|
33
|
+
} | null;
|
|
34
|
+
/** Locations associated with the encounter */
|
|
35
|
+
location: (EncounterLocation | null)[] | null;
|
|
36
|
+
/** Participants in the encounter */
|
|
37
|
+
participant: (EncounterParticipant | null)[] | null;
|
|
38
|
+
/** Service provider organization */
|
|
39
|
+
serviceProvider: Reference<Organization> | null;
|
|
40
|
+
/** Subject of the encounter (a patient) */
|
|
41
|
+
subject: Reference<Patient> | null;
|
|
42
|
+
/** Reason reference (linked condition) */
|
|
43
|
+
reasonReference: (Reference<Condition> | null)[] | null;
|
|
44
|
+
};
|
|
45
|
+
type EncounterLocation = {
|
|
46
|
+
/** Reference to the location resource */
|
|
47
|
+
location: Reference<Location> | null;
|
|
48
|
+
/** Status of the location during the encounter (e.g., active, completed) */
|
|
49
|
+
status: string | null;
|
|
50
|
+
/** Physical type of the location (e.g., room, ward) */
|
|
51
|
+
physicalType: CodeableConcept | null;
|
|
52
|
+
/** The period of time the patient was at this location */
|
|
53
|
+
period: Period | null;
|
|
54
|
+
};
|
|
55
|
+
type EncounterParticipant = {
|
|
56
|
+
/** Reference to the individual participating in the encounter (Practitioner, PractitionerRole, or RelatedPerson) */
|
|
57
|
+
individual: Reference<PractitionerRole | RelatedPerson | Practitioner> | null;
|
|
58
|
+
/** Role(s) of the participant in the encounter (e.g., primary, consulting) */
|
|
59
|
+
type: (CodeableConcept | null)[] | null;
|
|
60
|
+
/** The period of time the participant was involved in the encounter */
|
|
61
|
+
period: Period | null;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Entry in encounter bundle.
|
|
65
|
+
*
|
|
66
|
+
* @category Models
|
|
67
|
+
* @title EncounterEntry
|
|
68
|
+
* @excerpt Entry in encounter bundle.
|
|
69
|
+
*/
|
|
70
|
+
export type EncounterEntry = IdentifiedResourceEntry<Encounter>;
|
|
71
|
+
/**
|
|
72
|
+
* Bundle of encounter results.
|
|
73
|
+
*
|
|
74
|
+
* @category Models
|
|
75
|
+
* @title EncounterBundle
|
|
76
|
+
* @excerpt Bundle of encounter results.
|
|
77
|
+
*/
|
|
78
|
+
export type EncounterBundle = EntryBundle<EncounterEntry>;
|
|
79
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CodeableConcept, EntryBundle, HumanName, IdentifiedResourceEntry, Identifier, Location, Meta, Narrative, Organization, Quantity, Reference } from "../common/index.js";
|
|
2
|
-
import { Observation } from "./index.js";
|
|
2
|
+
import { Encounter, Observation } from "./index.js";
|
|
3
3
|
/**
|
|
4
4
|
* Represents an immunization resource matching GraphQL structure.
|
|
5
5
|
* Based on FHIR Immunization resource with GraphQL-compatible structure.
|
|
@@ -53,6 +53,8 @@ export type Immunization = {
|
|
|
53
53
|
location: Reference<Location> | null;
|
|
54
54
|
/** Reason codes for immunization */
|
|
55
55
|
reasonCode: (CodeableConcept | null)[] | null;
|
|
56
|
+
/** The visit or admission or other contact between patient and health care provider the immunization was performed as part of. */
|
|
57
|
+
encounter: Reference<Encounter> | null;
|
|
56
58
|
};
|
|
57
59
|
/**
|
|
58
60
|
* Represents a reaction that occurred as a result of an immunization.
|
|
@@ -20,3 +20,4 @@ export { ConditionBundle, Condition } from "./condition.js";
|
|
|
20
20
|
export { ProcedureBundle, Procedure } from "./procedure.js";
|
|
21
21
|
export { VitalSignBundle } from "./vital-sign-bundle.js";
|
|
22
22
|
export { CareTeamBundle, CareTeam } from "./care-team.js";
|
|
23
|
+
export { EncounterBundle, Encounter } from "./encounter.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Organization, Patient, Practitioner } from "../common/index.js";
|
|
2
2
|
import { Value } from "../common/value.js";
|
|
3
|
-
import { Annotation, CodeableConcept, Component, HumanName, Identifier, Meta, Narrative, Period, Reference, ReferenceRange, ServiceRequest, Specimen } from "../index.js";
|
|
3
|
+
import { Annotation, CodeableConcept, Component, Encounter, HumanName, Identifier, Meta, Narrative, Period, Reference, ReferenceRange, ServiceRequest, Specimen } from "../index.js";
|
|
4
4
|
/**
|
|
5
5
|
* Represents a observation resource.
|
|
6
6
|
*
|
|
@@ -51,6 +51,8 @@ export type Observation = Value & {
|
|
|
51
51
|
specimen: Reference<Specimen> | null;
|
|
52
52
|
/** Provides a reason why the expected value in the element Observation.value[x] is missing. */
|
|
53
53
|
dataAbsentReason: CodeableConcept | null;
|
|
54
|
+
/** The healthcare event (e.g. a patient and healthcare provider interaction) during which this observation is made. */
|
|
55
|
+
encounter: Reference<Encounter> | null;
|
|
54
56
|
};
|
|
55
57
|
export type ObservationBasedOn = ServiceRequest;
|
|
56
58
|
export type ObservationHasMember = ObservationHasMemberObservation;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EntryBundle, IdentifiedResourceEntry } from "../common/bundle.js";
|
|
2
2
|
import { Annotation, CodeableConcept, Identifier, Location, Meta, Narrative, Organization, Patient, Period, Practitioner, Reference } from "../common/index.js";
|
|
3
|
+
import { Encounter } from "../index.js";
|
|
3
4
|
/**
|
|
4
5
|
* Represents a clinical procedure performed on a patient.
|
|
5
6
|
*
|
|
@@ -52,6 +53,8 @@ export type Procedure = {
|
|
|
52
53
|
recorder: Reference<Patient | Practitioner> | null;
|
|
53
54
|
/** The person who asserted the procedure as having been performed. */
|
|
54
55
|
asserter: Reference<Patient | Practitioner> | null;
|
|
56
|
+
/** The encounter during which this procedure was performed or created. */
|
|
57
|
+
encounter: Reference<Encounter> | null;
|
|
55
58
|
};
|
|
56
59
|
/**
|
|
57
60
|
* Indicates who performed the procedure.
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { IllegalArgumentError } from "../errors/index.js";
|
|
2
|
+
import { BWellTransactionResult } from "../index.js";
|
|
3
|
+
import type { Coding, User } from "../models/index.js";
|
|
2
4
|
export declare function retrieveEnvironmentFromClientKey(clientKey: string): string;
|
|
3
5
|
/**
|
|
4
6
|
* Returns the JSON parsed payload section of a JWT
|
|
@@ -24,3 +26,11 @@ export declare function parseTokenExpiration(token: string): number;
|
|
|
24
26
|
* @throws {InvalidTokenError} if token is invalid base64, JWT or JSON payload
|
|
25
27
|
*/
|
|
26
28
|
export declare function parseUserFromIdToken(token: string): User | null;
|
|
29
|
+
/**
|
|
30
|
+
* Parse string to JSON array of coding objects.
|
|
31
|
+
* @param {string} json - JSON array string
|
|
32
|
+
* @returns {Coding[]} parsed coding objects
|
|
33
|
+
* @throws {BWellError} If parsing fails
|
|
34
|
+
* @throw {BWellError} If coding is missing code or system
|
|
35
|
+
*/
|
|
36
|
+
export declare function parseJSONCodings(json: string): BWellTransactionResult<Coding[], IllegalArgumentError>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { InvalidTokenError } from "../errors/index.js";
|
|
1
|
+
import { IllegalArgumentError, InvalidTokenError } from "../errors/index.js";
|
|
2
|
+
import { BWellTransactionResult } from "../index.js";
|
|
2
3
|
import { base64Decode } from "./base64.js";
|
|
3
4
|
import { isNotNullOrUndefined } from "./type-utils.js";
|
|
4
5
|
export function retrieveEnvironmentFromClientKey(clientKey) {
|
|
@@ -67,3 +68,34 @@ export function parseUserFromIdToken(token) {
|
|
|
67
68
|
// A guest JWT payload will be a valid token but without the FHIR IDs.
|
|
68
69
|
return null;
|
|
69
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Parse string to JSON array of coding objects.
|
|
73
|
+
* @param {string} json - JSON array string
|
|
74
|
+
* @returns {Coding[]} parsed coding objects
|
|
75
|
+
* @throws {BWellError} If parsing fails
|
|
76
|
+
* @throw {BWellError} If coding is missing code or system
|
|
77
|
+
*/
|
|
78
|
+
export function parseJSONCodings(json) {
|
|
79
|
+
// Parse into a JSON:
|
|
80
|
+
let parsed;
|
|
81
|
+
try {
|
|
82
|
+
parsed = JSON.parse(json);
|
|
83
|
+
}
|
|
84
|
+
catch (_a) {
|
|
85
|
+
return BWellTransactionResult.failure(new IllegalArgumentError("Failed to parse JSON"));
|
|
86
|
+
}
|
|
87
|
+
// Validate it is an array:
|
|
88
|
+
if (!Array.isArray(parsed)) {
|
|
89
|
+
return BWellTransactionResult.failure(new IllegalArgumentError("Expected array of codings"));
|
|
90
|
+
}
|
|
91
|
+
// Validate array elements are codings:
|
|
92
|
+
for (const coding of parsed) {
|
|
93
|
+
if (typeof coding.code !== "string") {
|
|
94
|
+
return BWellTransactionResult.failure(new IllegalArgumentError("Invalid coding.code"));
|
|
95
|
+
}
|
|
96
|
+
if (typeof coding.system !== "string") {
|
|
97
|
+
return BWellTransactionResult.failure(new IllegalArgumentError("Invalid coding.system"));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return BWellTransactionResult.success(parsed);
|
|
101
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SearchToken } from "../api/base/requests/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Extracts SearchToken values to a string[].
|
|
4
|
+
* If token.value and token.values are present, [token.value.value] is returned.
|
|
5
|
+
* @param {SearchToken} token
|
|
6
|
+
* @returns {string[]} Values from search token
|
|
7
|
+
*/
|
|
8
|
+
export declare function getSearchTokenValues(token: SearchToken): string[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { isNotNullOrUndefined, isNullOrUndefined } from "./type-utils.js";
|
|
2
|
+
/**
|
|
3
|
+
* Extracts SearchToken values to a string[].
|
|
4
|
+
* If token.value and token.values are present, [token.value.value] is returned.
|
|
5
|
+
* @param {SearchToken} token
|
|
6
|
+
* @returns {string[]} Values from search token
|
|
7
|
+
*/
|
|
8
|
+
export function getSearchTokenValues(token) {
|
|
9
|
+
var _a;
|
|
10
|
+
if (isNotNullOrUndefined((_a = token.value) === null || _a === void 0 ? void 0 : _a.value)) {
|
|
11
|
+
return [token.value.value];
|
|
12
|
+
}
|
|
13
|
+
if (isNullOrUndefined(token.values) || token.values.length === 0) {
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
16
|
+
const values = [];
|
|
17
|
+
for (const val of token.values) {
|
|
18
|
+
if (val && val.value) {
|
|
19
|
+
values.push(val.value);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return values;
|
|
23
|
+
}
|