@health-samurai/aidbox-client 0.0.0-alpha.2 → 0.0.0-alpha.4
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 +295 -66
- package/dist/src/auth-providers.d.ts +22 -0
- package/dist/src/auth-providers.d.ts.map +1 -1
- package/dist/src/auth-providers.js +149 -13
- package/dist/src/client.d.ts +504 -31
- package/dist/src/client.d.ts.map +1 -1
- package/dist/src/client.js +1455 -934
- package/dist/src/fhir-types/hl7-fhir-r4-core/Address.d.ts +26 -0
- package/dist/src/fhir-types/hl7-fhir-r4-core/Address.d.ts.map +1 -0
- package/dist/src/fhir-types/hl7-fhir-r4-core/Address.js +5 -0
- package/dist/src/fhir-types/hl7-fhir-r4-core/ContactPoint.d.ts +16 -0
- package/dist/src/fhir-types/hl7-fhir-r4-core/ContactPoint.d.ts.map +1 -0
- package/dist/src/fhir-types/hl7-fhir-r4-core/ContactPoint.js +5 -0
- package/dist/src/fhir-types/hl7-fhir-r4-core/DomainResource.d.ts +1 -1
- package/dist/src/fhir-types/hl7-fhir-r4-core/DomainResource.d.ts.map +1 -1
- package/dist/src/fhir-types/hl7-fhir-r4-core/HumanName.d.ts +20 -0
- package/dist/src/fhir-types/hl7-fhir-r4-core/HumanName.d.ts.map +1 -0
- package/dist/src/fhir-types/hl7-fhir-r4-core/HumanName.js +5 -0
- package/dist/src/fhir-types/hl7-fhir-r4-core/Patient.d.ts +58 -0
- package/dist/src/fhir-types/hl7-fhir-r4-core/Patient.d.ts.map +1 -0
- package/dist/src/fhir-types/hl7-fhir-r4-core/Patient.js +10 -0
- package/dist/src/fhir-types/hl7-fhir-r4-core/Resource.d.ts +1 -1
- package/dist/src/fhir-types/hl7-fhir-r4-core/Resource.d.ts.map +1 -1
- package/dist/src/fhir-types/hl7-fhir-r4-core/index.d.ts +5 -0
- package/dist/src/fhir-types/hl7-fhir-r4-core/index.d.ts.map +1 -1
- package/dist/src/fhir-types/hl7-fhir-r4-core/index.js +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -0
- package/dist/src/result.d.ts +114 -3
- package/dist/src/result.d.ts.map +1 -1
- package/dist/src/result.js +6 -2
- package/dist/src/smart-backend-services.d.ts +44 -0
- package/dist/src/smart-backend-services.d.ts.map +1 -0
- package/dist/src/smart-backend-services.js +685 -0
- package/dist/src/types.d.ts +104 -70
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +10 -2
- package/dist/src/utils.d.ts +10 -0
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +22 -0
- package/dist/test/auth-providers.test.d.ts +2 -0
- package/dist/test/auth-providers.test.d.ts.map +1 -0
- package/dist/test/basic-auth.test.d.ts +2 -0
- package/dist/test/basic-auth.test.d.ts.map +1 -0
- package/dist/test/smart-backend-services.test.d.ts +2 -0
- package/dist/test/smart-backend-services.test.d.ts.map +1 -0
- package/dist/test/utils.test.d.ts +2 -0
- package/dist/test/utils.test.d.ts.map +1 -0
- package/package.json +3 -1
- package/dist/src/fhir-http.d.ts +0 -96
- package/dist/src/fhir-http.d.ts.map +0 -1
- package/dist/src/fhir-http.js +0 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Element } from "../hl7-fhir-r4-core/Element";
|
|
2
|
+
import type { Period } from "../hl7-fhir-r4-core/Period";
|
|
3
|
+
export type { Element } from "../hl7-fhir-r4-core/Element";
|
|
4
|
+
export type { Period } from "../hl7-fhir-r4-core/Period";
|
|
5
|
+
export interface Address extends Element {
|
|
6
|
+
city?: string;
|
|
7
|
+
_city?: Element;
|
|
8
|
+
country?: string;
|
|
9
|
+
_country?: Element;
|
|
10
|
+
district?: string;
|
|
11
|
+
_district?: Element;
|
|
12
|
+
line?: string[];
|
|
13
|
+
_line?: Element;
|
|
14
|
+
period?: Period;
|
|
15
|
+
postalCode?: string;
|
|
16
|
+
_postalCode?: Element;
|
|
17
|
+
state?: string;
|
|
18
|
+
_state?: Element;
|
|
19
|
+
text?: string;
|
|
20
|
+
_text?: Element;
|
|
21
|
+
type?: ("postal" | "physical" | "both");
|
|
22
|
+
_type?: Element;
|
|
23
|
+
use?: ("home" | "work" | "temp" | "old" | "billing");
|
|
24
|
+
_use?: Element;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=Address.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Address.d.ts","sourceRoot":"","sources":["../../../../src/fhir-types/hl7-fhir-r4-core/Address.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEzD,YAAY,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAC3D,YAAY,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAGzD,MAAM,WAAW,OAAQ,SAAQ,OAAO;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,CAAC,QAAQ,GAAG,UAAU,GAAG,MAAM,CAAC,CAAC;IACxC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,GAAG,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,SAAS,CAAC,CAAC;IACrD,IAAI,CAAC,EAAE,OAAO,CAAC;CAClB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Element } from "../hl7-fhir-r4-core/Element";
|
|
2
|
+
import type { Period } from "../hl7-fhir-r4-core/Period";
|
|
3
|
+
export type { Element } from "../hl7-fhir-r4-core/Element";
|
|
4
|
+
export type { Period } from "../hl7-fhir-r4-core/Period";
|
|
5
|
+
export interface ContactPoint extends Element {
|
|
6
|
+
period?: Period;
|
|
7
|
+
rank?: number;
|
|
8
|
+
_rank?: Element;
|
|
9
|
+
system?: ("phone" | "fax" | "email" | "pager" | "url" | "sms" | "other");
|
|
10
|
+
_system?: Element;
|
|
11
|
+
use?: ("home" | "work" | "temp" | "old" | "mobile");
|
|
12
|
+
_use?: Element;
|
|
13
|
+
value?: string;
|
|
14
|
+
_value?: Element;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=ContactPoint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContactPoint.d.ts","sourceRoot":"","sources":["../../../../src/fhir-types/hl7-fhir-r4-core/ContactPoint.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEzD,YAAY,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAC3D,YAAY,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAGzD,MAAM,WAAW,YAAa,SAAQ,OAAO;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,CAAC,OAAO,GAAG,KAAK,GAAG,OAAO,GAAG,OAAO,GAAG,KAAK,GAAG,KAAK,GAAG,OAAO,CAAC,CAAC;IACzE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,GAAG,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,CAAC,CAAC;IACpD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB"}
|
|
@@ -2,7 +2,7 @@ import type { Narrative } from "../hl7-fhir-r4-core/Narrative";
|
|
|
2
2
|
import type { Resource } from "../hl7-fhir-r4-core/Resource";
|
|
3
3
|
export type { Narrative } from "../hl7-fhir-r4-core/Narrative";
|
|
4
4
|
export interface DomainResource extends Resource {
|
|
5
|
-
resourceType: "DomainResource" | "OperationOutcome";
|
|
5
|
+
resourceType: "DomainResource" | "OperationOutcome" | "Patient";
|
|
6
6
|
contained?: Resource[];
|
|
7
7
|
text?: Narrative;
|
|
8
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DomainResource.d.ts","sourceRoot":"","sources":["../../../../src/fhir-types/hl7-fhir-r4-core/DomainResource.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAE7D,YAAY,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAG/D,MAAM,WAAW,cAAe,SAAQ,QAAQ;IAC5C,YAAY,EAAE,gBAAgB,GAAG,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"DomainResource.d.ts","sourceRoot":"","sources":["../../../../src/fhir-types/hl7-fhir-r4-core/DomainResource.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAE7D,YAAY,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAG/D,MAAM,WAAW,cAAe,SAAQ,QAAQ;IAC5C,YAAY,EAAE,gBAAgB,GAAG,kBAAkB,GAAG,SAAS,CAAC;IAEhE,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB,IAAI,CAAC,EAAE,SAAS,CAAC;CACpB;AACD,eAAO,MAAM,gBAAgB,GAAI,UAAU,OAAO,KAAG,QAAQ,IAAI,cAEhE,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Element } from "../hl7-fhir-r4-core/Element";
|
|
2
|
+
import type { Period } from "../hl7-fhir-r4-core/Period";
|
|
3
|
+
export type { Element } from "../hl7-fhir-r4-core/Element";
|
|
4
|
+
export type { Period } from "../hl7-fhir-r4-core/Period";
|
|
5
|
+
export interface HumanName extends Element {
|
|
6
|
+
family?: string;
|
|
7
|
+
_family?: Element;
|
|
8
|
+
given?: string[];
|
|
9
|
+
_given?: Element;
|
|
10
|
+
period?: Period;
|
|
11
|
+
prefix?: string[];
|
|
12
|
+
_prefix?: Element;
|
|
13
|
+
suffix?: string[];
|
|
14
|
+
_suffix?: Element;
|
|
15
|
+
text?: string;
|
|
16
|
+
_text?: Element;
|
|
17
|
+
use?: ("usual" | "official" | "temp" | "nickname" | "anonymous" | "old" | "maiden");
|
|
18
|
+
_use?: Element;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=HumanName.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HumanName.d.ts","sourceRoot":"","sources":["../../../../src/fhir-types/hl7-fhir-r4-core/HumanName.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEzD,YAAY,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAC3D,YAAY,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAGzD,MAAM,WAAW,SAAU,SAAQ,OAAO;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,GAAG,CAAC,EAAE,CAAC,OAAO,GAAG,UAAU,GAAG,MAAM,GAAG,UAAU,GAAG,WAAW,GAAG,KAAK,GAAG,QAAQ,CAAC,CAAC;IACpF,IAAI,CAAC,EAAE,OAAO,CAAC;CAClB"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { Address } from "../hl7-fhir-r4-core/Address";
|
|
2
|
+
import type { BackboneElement } from "../hl7-fhir-r4-core/BackboneElement";
|
|
3
|
+
import type { CodeableConcept } from "../hl7-fhir-r4-core/CodeableConcept";
|
|
4
|
+
import type { ContactPoint } from "../hl7-fhir-r4-core/ContactPoint";
|
|
5
|
+
import type { DomainResource } from "../hl7-fhir-r4-core/DomainResource";
|
|
6
|
+
import type { HumanName } from "../hl7-fhir-r4-core/HumanName";
|
|
7
|
+
import type { Identifier } from "../hl7-fhir-r4-core/Identifier";
|
|
8
|
+
import type { Period } from "../hl7-fhir-r4-core/Period";
|
|
9
|
+
import type { Reference } from "../hl7-fhir-r4-core/Reference";
|
|
10
|
+
export type { Address } from "../hl7-fhir-r4-core/Address";
|
|
11
|
+
export type { BackboneElement } from "../hl7-fhir-r4-core/BackboneElement";
|
|
12
|
+
export type { CodeableConcept } from "../hl7-fhir-r4-core/CodeableConcept";
|
|
13
|
+
export type { ContactPoint } from "../hl7-fhir-r4-core/ContactPoint";
|
|
14
|
+
export type { HumanName } from "../hl7-fhir-r4-core/HumanName";
|
|
15
|
+
export type { Identifier } from "../hl7-fhir-r4-core/Identifier";
|
|
16
|
+
export type { Period } from "../hl7-fhir-r4-core/Period";
|
|
17
|
+
export type { Reference } from "../hl7-fhir-r4-core/Reference";
|
|
18
|
+
export interface PatientCommunication extends BackboneElement {
|
|
19
|
+
language: CodeableConcept;
|
|
20
|
+
preferred?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface PatientContact extends BackboneElement {
|
|
23
|
+
address?: Address;
|
|
24
|
+
gender?: ("male" | "female" | "other" | "unknown");
|
|
25
|
+
name?: HumanName;
|
|
26
|
+
organization?: Reference<"Organization">;
|
|
27
|
+
period?: Period;
|
|
28
|
+
relationship?: CodeableConcept[];
|
|
29
|
+
telecom?: ContactPoint[];
|
|
30
|
+
}
|
|
31
|
+
export interface PatientLink extends BackboneElement {
|
|
32
|
+
other: Reference<"Patient" | "RelatedPerson">;
|
|
33
|
+
type: ("replaced-by" | "replaces" | "refer" | "seealso");
|
|
34
|
+
}
|
|
35
|
+
export interface Patient extends DomainResource {
|
|
36
|
+
resourceType: "Patient";
|
|
37
|
+
active?: boolean;
|
|
38
|
+
_active?: Element;
|
|
39
|
+
birthDate?: string;
|
|
40
|
+
_birthDate?: Element;
|
|
41
|
+
deceasedBoolean?: boolean;
|
|
42
|
+
_deceasedBoolean?: Element;
|
|
43
|
+
deceasedDateTime?: string;
|
|
44
|
+
_deceasedDateTime?: Element;
|
|
45
|
+
gender?: ("male" | "female" | "other" | "unknown");
|
|
46
|
+
_gender?: Element;
|
|
47
|
+
generalPractitioner?: Reference<"Organization" | "Practitioner" | "PractitionerRole">[];
|
|
48
|
+
identifier?: Identifier[];
|
|
49
|
+
managingOrganization?: Reference<"Organization">;
|
|
50
|
+
maritalStatus?: CodeableConcept;
|
|
51
|
+
multipleBirthBoolean?: boolean;
|
|
52
|
+
_multipleBirthBoolean?: Element;
|
|
53
|
+
multipleBirthInteger?: number;
|
|
54
|
+
_multipleBirthInteger?: Element;
|
|
55
|
+
name?: HumanName[];
|
|
56
|
+
}
|
|
57
|
+
export declare const isPatient: (resource: unknown) => resource is Patient;
|
|
58
|
+
//# sourceMappingURL=Patient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Patient.d.ts","sourceRoot":"","sources":["../../../../src/fhir-types/hl7-fhir-r4-core/Patient.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// WARNING: This file is autogenerated by @atomic-ehr/codegen.
|
|
2
|
+
// GitHub: https://github.com/atomic-ehr/codegen
|
|
3
|
+
// Any manual changes made to this file may be overwritten.
|
|
4
|
+
function _type_of(obj) {
|
|
5
|
+
"@swc/helpers - typeof";
|
|
6
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
7
|
+
}
|
|
8
|
+
export var isPatient = function(resource) {
|
|
9
|
+
return resource !== null && (typeof resource === "undefined" ? "undefined" : _type_of(resource)) === "object" && resource.resourceType === "Patient";
|
|
10
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Meta } from "../hl7-fhir-r4-core/Meta";
|
|
2
2
|
export type { Meta } from "../hl7-fhir-r4-core/Meta";
|
|
3
3
|
export interface Resource {
|
|
4
|
-
resourceType: "Bundle" | "DomainResource" | "OperationOutcome" | "Resource";
|
|
4
|
+
resourceType: "Bundle" | "DomainResource" | "OperationOutcome" | "Patient" | "Resource";
|
|
5
5
|
id?: string;
|
|
6
6
|
_id?: Element;
|
|
7
7
|
implicitRules?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Resource.d.ts","sourceRoot":"","sources":["../../../../src/fhir-types/hl7-fhir-r4-core/Resource.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAErD,YAAY,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAGrD,MAAM,WAAW,QAAQ;IACrB,YAAY,EAAE,QAAQ,GAAG,gBAAgB,GAAG,kBAAkB,GAAG,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"Resource.d.ts","sourceRoot":"","sources":["../../../../src/fhir-types/hl7-fhir-r4-core/Resource.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAErD,YAAY,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAGrD,MAAM,WAAW,QAAQ;IACrB,YAAY,EAAE,QAAQ,GAAG,gBAAgB,GAAG,kBAAkB,GAAG,SAAS,GAAG,UAAU,CAAC;IAExF,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,IAAI,CAAC;CACf;AACD,eAAO,MAAM,UAAU,GAAI,UAAU,OAAO,KAAG,QAAQ,IAAI,QAE1D,CAAA"}
|
|
@@ -1,16 +1,21 @@
|
|
|
1
|
+
export type { Address } from "./Address";
|
|
1
2
|
export type { BackboneElement } from "./BackboneElement";
|
|
2
3
|
export type { Bundle, BundleEntry, BundleEntryRequest, BundleEntryResponse, BundleEntrySearch, BundleLink } from "./Bundle";
|
|
3
4
|
export { isBundle } from "./Bundle";
|
|
4
5
|
export type { CodeableConcept } from "./CodeableConcept";
|
|
5
6
|
export type { Coding } from "./Coding";
|
|
7
|
+
export type { ContactPoint } from "./ContactPoint";
|
|
6
8
|
export type { DomainResource } from "./DomainResource";
|
|
7
9
|
export { isDomainResource } from "./DomainResource";
|
|
8
10
|
export type { Element } from "./Element";
|
|
11
|
+
export type { HumanName } from "./HumanName";
|
|
9
12
|
export type { Identifier } from "./Identifier";
|
|
10
13
|
export type { Meta } from "./Meta";
|
|
11
14
|
export type { Narrative } from "./Narrative";
|
|
12
15
|
export type { OperationOutcome, OperationOutcomeIssue } from "./OperationOutcome";
|
|
13
16
|
export { isOperationOutcome } from "./OperationOutcome";
|
|
17
|
+
export type { Patient, PatientCommunication, PatientContact, PatientLink } from "./Patient";
|
|
18
|
+
export { isPatient } from "./Patient";
|
|
14
19
|
export type { Period } from "./Period";
|
|
15
20
|
export type { Reference } from "./Reference";
|
|
16
21
|
export type { Resource } from "./Resource";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/fhir-types/hl7-fhir-r4-core/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC5H,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,YAAY,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,YAAY,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,YAAY,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACnC,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,YAAY,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,YAAY,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,YAAY,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/fhir-types/hl7-fhir-r4-core/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC5H,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,YAAY,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,YAAY,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,YAAY,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACnC,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,YAAY,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,YAAY,EAAE,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC5F,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,YAAY,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,YAAY,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export type * from "./fhir-types/hl7-fhir-r4-core";
|
|
|
4
4
|
export * from "./fhir-types/hl7-fhir-r4-core";
|
|
5
5
|
export type * from "./result";
|
|
6
6
|
export * from "./result";
|
|
7
|
+
export * from "./smart-backend-services";
|
|
7
8
|
export type * from "./types";
|
|
8
9
|
export * from "./types";
|
|
9
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,mBAAmB,+BAA+B,CAAC;AACnD,cAAc,+BAA+B,CAAC;AAC9C,mBAAmB,UAAU,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,mBAAmB,SAAS,CAAC;AAC7B,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,mBAAmB,+BAA+B,CAAC;AACnD,cAAc,+BAA+B,CAAC;AAC9C,mBAAmB,UAAU,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,0BAA0B,CAAC;AACzC,mBAAmB,SAAS,CAAC;AAC7B,cAAc,SAAS,CAAC"}
|
package/dist/src/index.js
CHANGED
package/dist/src/result.d.ts
CHANGED
|
@@ -1,21 +1,132 @@
|
|
|
1
|
-
type Ok<T> = {
|
|
1
|
+
export type Ok<T> = {
|
|
2
2
|
ok: true;
|
|
3
3
|
value: T;
|
|
4
|
+
/**
|
|
5
|
+
* Check if `Result` is `Ok`.
|
|
6
|
+
*/
|
|
4
7
|
isOk: () => this is Ok<T>;
|
|
8
|
+
/**
|
|
9
|
+
* Check if `Result` is `Err`.
|
|
10
|
+
*/
|
|
5
11
|
isErr: () => this is Err<never>;
|
|
12
|
+
/**
|
|
13
|
+
* Map Result's success `value` to a new value by providing a transformation function.
|
|
14
|
+
*
|
|
15
|
+
* Returns a new `Result<UpdatedType, ErrorType>`:
|
|
16
|
+
*
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const x = Ok<number>(42); // Result<number, never>
|
|
19
|
+
* const y = x.map<string>((x: number) => x.toString()) // Result<string, never>
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* Does nothing if the `Result` is not `Ok`:
|
|
23
|
+
*
|
|
24
|
+
* ```typescript
|
|
25
|
+
* const x = Err<number>(42); // Result<never, number>
|
|
26
|
+
* const y = x.map<string>((x: number) => x.toString()) // Result<never, number>
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
6
29
|
map: <U>(f: (value: T) => U) => Result<U, never>;
|
|
30
|
+
/**
|
|
31
|
+
* Map Result's error `value` to a new value by providing a transformation function.
|
|
32
|
+
*
|
|
33
|
+
* Returns a new `Result<SuccessType, NewErrorType>`:
|
|
34
|
+
*
|
|
35
|
+
* ```typescript
|
|
36
|
+
* const x = Err<number>(42); // Result<never, number>
|
|
37
|
+
* const y = x.mapErr<string>((x: number) => x.toString()) // Result<never, string>
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* Does nothing if the `Result` is not `Err`:
|
|
41
|
+
*
|
|
42
|
+
* ```typescript
|
|
43
|
+
* const x = Ok<number>(42); // Result<number, never>
|
|
44
|
+
* const y = x.mapErr<string>((x: number) => x.toString()) // Result<number, never>
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
7
47
|
mapErr: <U>(f: (value: never) => U) => Result<T, never>;
|
|
8
48
|
};
|
|
9
|
-
type Err<E> = {
|
|
49
|
+
export type Err<E> = {
|
|
10
50
|
ok: false;
|
|
11
51
|
value: E;
|
|
52
|
+
/**
|
|
53
|
+
* Check if `Result` is `Ok`.
|
|
54
|
+
*/
|
|
12
55
|
isOk: () => this is Ok<never>;
|
|
56
|
+
/**
|
|
57
|
+
* Check if `Result` is `Err`.
|
|
58
|
+
*/
|
|
13
59
|
isErr: () => this is Err<E>;
|
|
60
|
+
/**
|
|
61
|
+
* Map Result's success `value` to a new value by providing a transformation function.
|
|
62
|
+
*
|
|
63
|
+
* Returns a new `Result<UpdatedType, ErrorType>`:
|
|
64
|
+
*
|
|
65
|
+
* ```typescript
|
|
66
|
+
* const x = Ok<number>(42); // Result<number, never>
|
|
67
|
+
* const y = x.map<string>((x: number) => x.toString()) // Result<string, never>
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* Does nothing if the `Result` is not `Ok`:
|
|
71
|
+
*
|
|
72
|
+
* ```typescript
|
|
73
|
+
* const x = Err<number>(42); // Result<never, number>
|
|
74
|
+
* const y = x.map<string>((x: number) => x.toString()) // Result<never, number>
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
14
77
|
map: <U>(f: (value: never) => U) => Result<never, E>;
|
|
78
|
+
/**
|
|
79
|
+
* Map Result's error `value` to a new value by providing a transformation function.
|
|
80
|
+
*
|
|
81
|
+
* Returns a new `Result<SuccessType, NewErrorType>`:
|
|
82
|
+
*
|
|
83
|
+
* ```typescript
|
|
84
|
+
* const x = Err<number>(42); // Result<never, number>
|
|
85
|
+
* const y = x.mapErr<string>((x: number) => x.toString()) // Result<never, string>
|
|
86
|
+
* ```
|
|
87
|
+
*
|
|
88
|
+
* Does nothing if the `Result` is not `Err`:
|
|
89
|
+
*
|
|
90
|
+
* ```typescript
|
|
91
|
+
* const x = Ok<number>(42); // Result<number, never>
|
|
92
|
+
* const y = x.mapErr<string>((x: number) => x.toString()) // Result<number, never>
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
15
95
|
mapErr: <U>(f: (value: E) => U) => Result<never, U>;
|
|
16
96
|
};
|
|
97
|
+
/**
|
|
98
|
+
* A classic `Result` type that can either be `Ok` or `Err`.
|
|
99
|
+
*
|
|
100
|
+
* `Result` wraps a value under the `value` field, and provides convenience methods for checking if `Result` is `Ok` or `Err`:
|
|
101
|
+
*
|
|
102
|
+
* ```typescript
|
|
103
|
+
* const answer: Result<number, never> = Ok(42);
|
|
104
|
+
*
|
|
105
|
+
* answer.isOk(); // => true
|
|
106
|
+
* answer.isErr(); // => false
|
|
107
|
+
* ```
|
|
108
|
+
*
|
|
109
|
+
* If the function returns a compatible `Result` type, instead of unwrapping the result, and wrapping it back, `map` and `mapErr` methods can be used:
|
|
110
|
+
*
|
|
111
|
+
* ```typescript
|
|
112
|
+
* function someFunctionA(x: number): Result<number, string> {
|
|
113
|
+
* if (0 === x % 2)
|
|
114
|
+
* return Err("number was even");
|
|
115
|
+
* return Ok(x);
|
|
116
|
+
* }
|
|
117
|
+
*
|
|
118
|
+
* function someFunctionB(num: number): Result<number, string> {
|
|
119
|
+
* return someFunctionA(num).map((x) => x + 1);
|
|
120
|
+
* }
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
17
123
|
export type Result<T, E> = Ok<T> | Err<E>;
|
|
124
|
+
/**
|
|
125
|
+
* Constructs the `Ok<T>` variant of `Result<T, never>`.
|
|
126
|
+
*/
|
|
18
127
|
export declare const Ok: <T>(value: T) => Result<T, never>;
|
|
128
|
+
/**
|
|
129
|
+
* Constructs the `Err<E>` variant of `Result<never, E>`.
|
|
130
|
+
*/
|
|
19
131
|
export declare const Err: <E>(error: E) => Result<never, E>;
|
|
20
|
-
export {};
|
|
21
132
|
//# sourceMappingURL=result.d.ts.map
|
package/dist/src/result.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../../src/result.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../../src/result.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,EAAE,CAAC,CAAC,IAAI;IACnB,EAAE,EAAE,IAAI,CAAC;IACT,KAAK,EAAE,CAAC,CAAC;IACT;;OAEG;IACH,IAAI,EAAE,MAAM,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC1B;;OAEG;IACH,KAAK,EAAE,MAAM,IAAI,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;IAChC;;;;;;;;;;;;;;;;OAgBG;IACH,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,KAAK,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IACjD;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,CAAC,KAAK,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;CACxD,CAAC;AAEF,MAAM,MAAM,GAAG,CAAC,CAAC,IAAI;IACpB,EAAE,EAAE,KAAK,CAAC;IACV,KAAK,EAAE,CAAC,CAAC;IACT;;OAEG;IACH,IAAI,EAAE,MAAM,IAAI,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC;IAC9B;;OAEG;IACH,KAAK,EAAE,MAAM,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC;IAC5B;;;;;;;;;;;;;;;;OAgBG;IACH,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,CAAC,KAAK,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACrD;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,KAAK,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;CACpD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;AAE1C;;GAEG;AACH,eAAO,MAAM,EAAE,GAAI,CAAC,EAAE,OAAO,CAAC,KAAG,MAAM,CAAC,CAAC,EAAE,KAAK,CAO9C,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,GAAG,GAAI,CAAC,EAAE,OAAO,CAAC,KAAG,MAAM,CAAC,KAAK,EAAE,CAAC,CAO/C,CAAC"}
|
package/dist/src/result.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Constructs the `Ok<T>` variant of `Result<T, never>`.
|
|
3
|
+
*/ export var Ok = function(value) {
|
|
2
4
|
return {
|
|
3
5
|
ok: true,
|
|
4
6
|
value: value,
|
|
@@ -16,7 +18,9 @@ export var Ok = function(value) {
|
|
|
16
18
|
}
|
|
17
19
|
};
|
|
18
20
|
};
|
|
19
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Constructs the `Err<E>` variant of `Result<never, E>`.
|
|
23
|
+
*/ export var Err = function(error) {
|
|
20
24
|
return {
|
|
21
25
|
ok: false,
|
|
22
26
|
value: error,
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { AuthProvider } from "./types";
|
|
2
|
+
export type SmartBackendServicesConfig = {
|
|
3
|
+
/** FHIR server base URL */
|
|
4
|
+
baseUrl: string;
|
|
5
|
+
/** OAuth 2.0 client ID */
|
|
6
|
+
clientId: string;
|
|
7
|
+
/** Private key for signing JWTs (CryptoKey from Web Crypto API) */
|
|
8
|
+
privateKey: CryptoKey;
|
|
9
|
+
/** Key ID (kid) - must match the kid in JWKS registered on the server */
|
|
10
|
+
keyId: string;
|
|
11
|
+
/** OAuth 2.0 scopes (e.g., "system/*.read") */
|
|
12
|
+
scope: string;
|
|
13
|
+
/** Token expiration buffer in seconds (refresh token this many seconds before expiry, default: 30) */
|
|
14
|
+
tokenExpirationBuffer?: number;
|
|
15
|
+
/** Allow insecure HTTP requests (for testing only, default: false) */
|
|
16
|
+
allowInsecureRequests?: boolean;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* SMART Backend Services authentication provider.
|
|
20
|
+
*
|
|
21
|
+
* Implements OAuth 2.0 client_credentials grant with JWT bearer assertion
|
|
22
|
+
* for server-to-server authentication per SMART Backend Services spec.
|
|
23
|
+
*
|
|
24
|
+
* @see https://hl7.org/fhir/smart-app-launch/backend-services.html
|
|
25
|
+
*/
|
|
26
|
+
export declare class SmartBackendServicesAuthProvider implements AuthProvider {
|
|
27
|
+
#private;
|
|
28
|
+
baseUrl: string;
|
|
29
|
+
constructor(config: SmartBackendServicesConfig);
|
|
30
|
+
/**
|
|
31
|
+
* Establish session - for Backend Services this means getting a token.
|
|
32
|
+
*/
|
|
33
|
+
establishSession(): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Revoke session - clear cached token.
|
|
36
|
+
*/
|
|
37
|
+
revokeSession(): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Fetch wrapper that adds Bearer token authorization.
|
|
40
|
+
* Automatically obtains token on first request and retries once on 401.
|
|
41
|
+
*/
|
|
42
|
+
fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=smart-backend-services.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"smart-backend-services.d.ts","sourceRoot":"","sources":["../../src/smart-backend-services.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAG5C,MAAM,MAAM,0BAA0B,GAAG;IACxC,2BAA2B;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,0BAA0B;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,mEAAmE;IACnE,UAAU,EAAE,SAAS,CAAC;IACtB,yEAAyE;IACzE,KAAK,EAAE,MAAM,CAAC;IACd,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,sGAAsG;IACtG,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,sEAAsE;IACtE,qBAAqB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAiBF;;;;;;;GAOG;AACH,qBAAa,gCAAiC,YAAW,YAAY;;IAC7D,OAAO,EAAE,MAAM,CAAC;gBAMX,MAAM,EAAE,0BAA0B;IAsJ9C;;OAEG;IACU,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAI9C;;OAEG;IACU,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAa3C;;;OAGG;IACU,KAAK,CACjB,KAAK,EAAE,WAAW,GAAG,GAAG,EACxB,IAAI,CAAC,EAAE,WAAW,GAChB,OAAO,CAAC,QAAQ,CAAC;CAwCpB"}
|