@metriport/commonwell-sdk 6.3.0 → 7.0.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/dist/common/__tests__/util.test.js +6 -6
- package/dist/common/__tests__/util.test.js.map +1 -1
- package/dist/common/util.d.ts +12 -2
- package/dist/common/util.d.ts.map +1 -1
- package/dist/common/util.js +37 -10
- package/dist/common/util.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/models/address.d.ts +3 -3
- package/dist/models/address.js +1 -1
- package/dist/models/address.js.map +1 -1
- package/dist/models/contact.d.ts +2 -14
- package/dist/models/contact.d.ts.map +1 -1
- package/dist/models/contact.js +2 -28
- package/dist/models/contact.js.map +1 -1
- package/dist/models/demographics.d.ts +8 -8
- package/dist/models/facility.d.ts +5 -5
- package/dist/models/patient.d.ts +155 -155
- package/package.json +3 -3
|
@@ -5,42 +5,42 @@ const util_1 = require("../util");
|
|
|
5
5
|
describe("util", () => {
|
|
6
6
|
describe("decodeCwPatientId", () => {
|
|
7
7
|
it("returns decoded patient id with all components when valid", async () => {
|
|
8
|
-
const res = (0, util_1.
|
|
8
|
+
const res = (0, util_1.decodeCwPatientIdV2)("601^^^&2.16.840.1.113883.3.2611.9.99.101.1&ISO");
|
|
9
9
|
expect(res).toBeTruthy();
|
|
10
10
|
expect(res.value).toBe("601");
|
|
11
11
|
expect(res.assignAuthority).toBe("2.16.840.1.113883.3.2611.9.99.101.1");
|
|
12
12
|
expect(res.assignAuthorityType).toBe("ISO");
|
|
13
13
|
});
|
|
14
14
|
it("returns value and assignAuthority when assignAuthType is not provided", async () => {
|
|
15
|
-
const res = (0, util_1.
|
|
15
|
+
const res = (0, util_1.decodeCwPatientIdV2)("601^^^&2.16.840.1.113883.3.2611.9.99.101.1");
|
|
16
16
|
expect(res).toBeTruthy();
|
|
17
17
|
expect(res.value).toBe("601");
|
|
18
18
|
expect(res.assignAuthority).toBe("2.16.840.1.113883.3.2611.9.99.101.1");
|
|
19
19
|
expect(res.assignAuthorityType).toBeUndefined();
|
|
20
20
|
});
|
|
21
21
|
it("doesnt return value when assignAuthority is not provided", async () => {
|
|
22
|
-
const res = (0, util_1.
|
|
22
|
+
const res = (0, util_1.decodeCwPatientIdV2)("601^^^&&ISO");
|
|
23
23
|
expect(res).toBeTruthy();
|
|
24
24
|
expect(res.value).toBeUndefined();
|
|
25
25
|
expect(res.assignAuthority).toBeUndefined();
|
|
26
26
|
expect(res.assignAuthorityType).toBeUndefined();
|
|
27
27
|
});
|
|
28
28
|
it("doesnt return value when assignAuthority and assignAuthType are not provided", async () => {
|
|
29
|
-
const res = (0, util_1.
|
|
29
|
+
const res = (0, util_1.decodeCwPatientIdV2)("601^^^");
|
|
30
30
|
expect(res).toBeTruthy();
|
|
31
31
|
expect(res.value).toBeUndefined();
|
|
32
32
|
expect(res.assignAuthority).toBeUndefined();
|
|
33
33
|
expect(res.assignAuthorityType).toBeUndefined();
|
|
34
34
|
});
|
|
35
35
|
it("doesnt return assigningAuthority when value is not provided", async () => {
|
|
36
|
-
const res = (0, util_1.
|
|
36
|
+
const res = (0, util_1.decodeCwPatientIdV2)("^^^&2.16.840.1.113883.3.2611.9.99.101.1&ISO");
|
|
37
37
|
expect(res).toBeTruthy();
|
|
38
38
|
expect(res.value).toBeUndefined();
|
|
39
39
|
expect(res.assignAuthority).toBeUndefined();
|
|
40
40
|
expect(res.assignAuthorityType).toBeUndefined();
|
|
41
41
|
});
|
|
42
42
|
it("returns emtpy object when value is empty string", async () => {
|
|
43
|
-
const res = (0, util_1.
|
|
43
|
+
const res = (0, util_1.decodeCwPatientIdV2)("");
|
|
44
44
|
expect(res).toBeTruthy();
|
|
45
45
|
expect(res.value).toBeUndefined();
|
|
46
46
|
expect(res.assignAuthority).toBeUndefined();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.test.js","sourceRoot":"","sources":["../../../src/common/__tests__/util.test.ts"],"names":[],"mappings":";;AAAA,yDAAyD;AACzD,
|
|
1
|
+
{"version":3,"file":"util.test.js","sourceRoot":"","sources":["../../../src/common/__tests__/util.test.ts"],"names":[],"mappings":";;AAAA,yDAAyD;AACzD,kCAAmE;AAEnE,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE;IACpB,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;QACjC,EAAE,CAAC,2DAA2D,EAAE,KAAK,IAAI,EAAE;YACzE,MAAM,GAAG,GAAG,IAAA,0BAAiB,EAAC,gDAAgD,CAAC,CAAC;YAChF,MAAM,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,CAAC;YACzB,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC9B,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;YACxE,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC9C,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,uEAAuE,EAAE,KAAK,IAAI,EAAE;YACrF,MAAM,GAAG,GAAG,IAAA,0BAAiB,EAAC,4CAA4C,CAAC,CAAC;YAC5E,MAAM,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,CAAC;YACzB,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC9B,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;YACxE,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC,aAAa,EAAE,CAAC;QAClD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,0DAA0D,EAAE,KAAK,IAAI,EAAE;YACxE,MAAM,GAAG,GAAG,IAAA,0BAAiB,EAAC,aAAa,CA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AC,UAAU,EAAE,CAAC;YACzB,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,aAAa,EAAE,CAAC;YAClC,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,aAAa,EAAE,CAAC;YAC5C,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC,aAAa,EAAE,CAAC;QAClD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/common/util.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export type EncodePatientIdForDocumentExchangeParams = {
|
|
|
9
9
|
* Matches: code^^^&system&assignAuthType
|
|
10
10
|
* Where assignAuthType is optional
|
|
11
11
|
*/
|
|
12
|
-
export declare const
|
|
12
|
+
export declare const CW_PATIENT_ID_REGEX_V2: RegExp;
|
|
13
13
|
/**
|
|
14
14
|
* Get the local Patient ID from the Patient Response Item's Links Self link.
|
|
15
15
|
* This ID is in the HL7 CX data type format, so it includes the system/assigninig authority's system.
|
|
@@ -26,7 +26,7 @@ export declare function getCwPatientIdFromLinks(links: PatientLinks): string;
|
|
|
26
26
|
* @returns The decoded patient ID, with the value, assignAuthority, and assignAuthorityType.
|
|
27
27
|
* @see Section "8.3.2 Get Patient" of the spec.
|
|
28
28
|
*/
|
|
29
|
-
export declare function
|
|
29
|
+
export declare function decodeCwPatientIdV2(patientId: string): {
|
|
30
30
|
value: string | undefined;
|
|
31
31
|
assignAuthority: string | undefined;
|
|
32
32
|
assignAuthorityType: string | undefined;
|
|
@@ -64,5 +64,15 @@ export declare function encodePatientIdForDocumentExchange(cwPatientId: string):
|
|
|
64
64
|
* @see Sectin "10.2.1 Document Query" of the spec.
|
|
65
65
|
*/
|
|
66
66
|
export declare function encodePatientIdForDocumentExchange({ patientId, assignAuthority, }: EncodePatientIdForDocumentExchangeParams): string;
|
|
67
|
+
/**
|
|
68
|
+
* Decodes the patient ID into its components.
|
|
69
|
+
*
|
|
70
|
+
* @param patientId - The patient's ID in the HL7 CX data type format.
|
|
71
|
+
* @returns The decoded patient ID, with the value and assignAuthority.
|
|
72
|
+
*/
|
|
73
|
+
export declare function decodeCwPatientIdV1(patientId: string): {
|
|
74
|
+
value: string | undefined;
|
|
75
|
+
assignAuthority: string | undefined;
|
|
76
|
+
};
|
|
67
77
|
export declare function buildBaseQueryMeta(orgName: string): BaseRequestMetadata;
|
|
68
78
|
//# sourceMappingURL=util.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/common/util.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,MAAM,wCAAwC,GAAG;IACrD,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/common/util.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,MAAM,wCAAwC,GAAG;IACrD,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,QAA0C,CAAC;AAE9E;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CAKnE;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG;IACtD,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,mBAAmB,EAAE,MAAM,GAAG,SAAS,CAAC;CACzC,CAOA;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,eAAe,EACf,mBAAmB,GACpB,EAAE;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,mBAAmB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1C,GAAG,MAAM,CAET;AAED;;;;;;;GAOG;AACH,wBAAgB,kCAAkC,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;AAE5F;;;;;;;;GAQG;AACH,wBAAgB,kCAAkC,CAAC,EACjD,SAAS,EACT,eAAe,GAChB,EAAE,wCAAwC,GAAG,MAAM,CAAC;AA4BrD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG;IACtD,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;CACrC,CAOA;AAMD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,mBAAmB,CAMvE"}
|
package/dist/common/util.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildBaseQueryMeta = exports.encodePatientIdForDocumentExchange = exports.encodeCwPatientId = exports.
|
|
3
|
+
exports.buildBaseQueryMeta = exports.decodeCwPatientIdV1 = exports.encodePatientIdForDocumentExchange = exports.encodeCwPatientId = exports.decodeCwPatientIdV2 = exports.getCwPatientIdFromLinks = exports.CW_PATIENT_ID_REGEX_V2 = void 0;
|
|
4
4
|
const shared_1 = require("@metriport/shared");
|
|
5
5
|
/**
|
|
6
6
|
* Regex pattern to extract code, system, and optional assignAuthType from CommonWell patient ID
|
|
7
7
|
* Matches: code^^^&system&assignAuthType
|
|
8
8
|
* Where assignAuthType is optional
|
|
9
9
|
*/
|
|
10
|
-
exports.
|
|
10
|
+
exports.CW_PATIENT_ID_REGEX_V2 = /^([^^]+)\^\^\^&([^&]+)(?:&([^&]+))?$/i;
|
|
11
11
|
/**
|
|
12
12
|
* Get the local Patient ID from the Patient Response Item's Links Self link.
|
|
13
13
|
* This ID is in the HL7 CX data type format, so it includes the system/assigninig authority's system.
|
|
@@ -30,15 +30,15 @@ exports.getCwPatientIdFromLinks = getCwPatientIdFromLinks;
|
|
|
30
30
|
* @returns The decoded patient ID, with the value, assignAuthority, and assignAuthorityType.
|
|
31
31
|
* @see Section "8.3.2 Get Patient" of the spec.
|
|
32
32
|
*/
|
|
33
|
-
function
|
|
33
|
+
function decodeCwPatientIdV2(patientId) {
|
|
34
34
|
const decoded = decodeURIComponent(decodeURI(patientId));
|
|
35
|
-
const match = decoded.match(exports.
|
|
35
|
+
const match = decoded.match(exports.CW_PATIENT_ID_REGEX_V2) ?? undefined;
|
|
36
36
|
const value = match && match[1];
|
|
37
37
|
const assignAuthority = match && match[2];
|
|
38
38
|
const assignAuthorityType = match && match[3];
|
|
39
39
|
return { value, assignAuthority, assignAuthorityType };
|
|
40
40
|
}
|
|
41
|
-
exports.
|
|
41
|
+
exports.decodeCwPatientIdV2 = decodeCwPatientIdV2;
|
|
42
42
|
/**
|
|
43
43
|
* Encodes the patient ID into the HL7 CX data type format.
|
|
44
44
|
*
|
|
@@ -54,18 +54,45 @@ function encodeCwPatientId({ patientId, assignAuthority, assignAuthorityType, })
|
|
|
54
54
|
exports.encodeCwPatientId = encodeCwPatientId;
|
|
55
55
|
function encodePatientIdForDocumentExchange(params) {
|
|
56
56
|
if (typeof params === "string") {
|
|
57
|
-
const { value, assignAuthority } =
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
const { value, assignAuthority } = decodeCwPatientIdV2(params);
|
|
58
|
+
if (value && assignAuthority) {
|
|
59
|
+
return encodePatientIdForDocumentExchange({
|
|
60
60
|
patientId: value,
|
|
61
61
|
assignAuthority,
|
|
62
|
-
})
|
|
63
|
-
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
return convertPatientIdToSubjectIdV1(params);
|
|
64
65
|
}
|
|
65
66
|
const { patientId, assignAuthority } = params;
|
|
66
67
|
return `${assignAuthority}|${patientId}`;
|
|
67
68
|
}
|
|
68
69
|
exports.encodePatientIdForDocumentExchange = encodePatientIdForDocumentExchange;
|
|
70
|
+
/**
|
|
71
|
+
* V1 only
|
|
72
|
+
* Matches: patientId^^^urn:oid:orgOid
|
|
73
|
+
*/
|
|
74
|
+
function convertPatientIdToSubjectIdV1(patientId) {
|
|
75
|
+
const { value, assignAuthority } = decodeCwPatientIdV1(patientId);
|
|
76
|
+
return value && assignAuthority ? buildPatiendIdToDocQuery(value, assignAuthority) : undefined;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Decodes the patient ID into its components.
|
|
80
|
+
*
|
|
81
|
+
* @param patientId - The patient's ID in the HL7 CX data type format.
|
|
82
|
+
* @returns The decoded patient ID, with the value and assignAuthority.
|
|
83
|
+
*/
|
|
84
|
+
function decodeCwPatientIdV1(patientId) {
|
|
85
|
+
const decoded = decodeURIComponent(decodeURI(patientId));
|
|
86
|
+
const regex = /(.+)\^\^\^(.+)/i;
|
|
87
|
+
const match = decoded.match(regex) ?? undefined;
|
|
88
|
+
const value = match && match[1];
|
|
89
|
+
const assignAuthority = match && match[2];
|
|
90
|
+
return { value, assignAuthority };
|
|
91
|
+
}
|
|
92
|
+
exports.decodeCwPatientIdV1 = decodeCwPatientIdV1;
|
|
93
|
+
function buildPatiendIdToDocQuery(code, system) {
|
|
94
|
+
return `${system}|${code}`;
|
|
95
|
+
}
|
|
69
96
|
function buildBaseQueryMeta(orgName) {
|
|
70
97
|
return {
|
|
71
98
|
purposeOfUse: shared_1.PurposeOfUse.TREATMENT,
|
package/dist/common/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/common/util.ts"],"names":[],"mappings":";;;AAAA,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AAC;AACpC,CAAC;AAVD,kDAUC;AAED,SAAS,wBAAwB,CAAC,IAAY,EAAE,MAAc;IAC5D,OAAO,GAAG,MAAM,IAAI,IAAI,EAAE,CAAC;AAC7B,CAAC;AAED,SAAgB,kBAAkB,CAAC,OAAe;IAChD,OAAO;QACL,YAAY,EAAE,qBAAY,CAAC,SAAS;QACpC,IAAI,EAAE,KAAK;QACX,SAAS,EAAE,GAAG,OAAO,cAAc;KACpC,CAAC;AACJ,CAAC;AAND,gDAMC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export { CommonWellMember } from "./client/commonwell-member";
|
|
|
5
5
|
export { CommonWellMemberAPI, MemberRequestMetadata } from "./client/commonwell-member-api";
|
|
6
6
|
export { CommonwellError } from "./common/commonwell-error";
|
|
7
7
|
export { makeJwt } from "./common/make-jwt";
|
|
8
|
-
export { buildBaseQueryMeta,
|
|
8
|
+
export { buildBaseQueryMeta, decodeCwPatientIdV2, encodeCwPatientId, encodePatientIdForDocumentExchange, getCwPatientIdFromLinks, } from "./common/util";
|
|
9
9
|
export { validateNPI } from "./common/validate-npi";
|
|
10
10
|
export * from "./models/address";
|
|
11
11
|
export * from "./models/certificates";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AACrF,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAC5F,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EACL,kBAAkB,EAClB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AACrF,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAC5F,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,kCAAkC,EAClC,uBAAuB,GACxB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.validateNPI = exports.getCwPatientIdFromLinks = exports.encodePatientIdForDocumentExchange = exports.encodeCwPatientId = exports.
|
|
17
|
+
exports.validateNPI = exports.getCwPatientIdFromLinks = exports.encodePatientIdForDocumentExchange = exports.encodeCwPatientId = exports.decodeCwPatientIdV2 = exports.buildBaseQueryMeta = exports.makeJwt = exports.CommonwellError = exports.CommonWellMember = exports.CommonWell = exports.APIMode = void 0;
|
|
18
18
|
var common_1 = require("./client/common");
|
|
19
19
|
Object.defineProperty(exports, "APIMode", { enumerable: true, get: function () { return common_1.APIMode; } });
|
|
20
20
|
var commonwell_1 = require("./client/commonwell");
|
|
@@ -27,7 +27,7 @@ var make_jwt_1 = require("./common/make-jwt");
|
|
|
27
27
|
Object.defineProperty(exports, "makeJwt", { enumerable: true, get: function () { return make_jwt_1.makeJwt; } });
|
|
28
28
|
var util_1 = require("./common/util");
|
|
29
29
|
Object.defineProperty(exports, "buildBaseQueryMeta", { enumerable: true, get: function () { return util_1.buildBaseQueryMeta; } });
|
|
30
|
-
Object.defineProperty(exports, "
|
|
30
|
+
Object.defineProperty(exports, "decodeCwPatientIdV2", { enumerable: true, get: function () { return util_1.decodeCwPatientIdV2; } });
|
|
31
31
|
Object.defineProperty(exports, "encodeCwPatientId", { enumerable: true, get: function () { return util_1.encodeCwPatientId; } });
|
|
32
32
|
Object.defineProperty(exports, "encodePatientIdForDocumentExchange", { enumerable: true, get: function () { return util_1.encodePatientIdForDocumentExchange; } });
|
|
33
33
|
Object.defineProperty(exports, "getCwPatientIdFromLinks", { enumerable: true, get: function () { return util_1.getCwPatientIdFromLinks; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,0CAA6D;AAApD,iGAAA,OAAO,OAAA;AAChB,kDAAiD;AAAxC,wGAAA,UAAU,OAAA;AAEnB,gEAA8D;AAArD,qHAAA,gBAAgB,OAAA;AAEzB,8DAA4D;AAAnD,mHAAA,eAAe,OAAA;AACxB,8CAA4C;AAAnC,mGAAA,OAAO,OAAA;AAChB,sCAMuB;AALrB,0GAAA,kBAAkB,OAAA;AAClB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,0CAA6D;AAApD,iGAAA,OAAO,OAAA;AAChB,kDAAiD;AAAxC,wGAAA,UAAU,OAAA;AAEnB,gEAA8D;AAArD,qHAAA,gBAAgB,OAAA;AAEzB,8DAA4D;AAAnD,mHAAA,eAAe,OAAA;AACxB,8CAA4C;AAAnC,mGAAA,OAAO,OAAA;AAChB,sCAMuB;AALrB,0GAAA,kBAAkB,OAAA;AAClB,2GAAA,mBAAmB,OAAA;AACnB,yGAAA,iBAAiB,OAAA;AACjB,0HAAA,kCAAkC,OAAA;AAClC,+GAAA,uBAAuB,OAAA;AAEzB,sDAAoD;AAA3C,2GAAA,WAAW,OAAA;AACpB,mDAAiC;AACjC,wDAAsC;AACtC,mDAAiC;AACjC,wDAAsC;AACtC,oDAAkC;AAClC,sDAAoC;AACpC,sDAAoC;AACpC,wDAAsC;AACtC,mDAAiC"}
|
package/dist/models/address.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export declare const addressSchema: z.ZodObject<{
|
|
|
22
22
|
city: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
23
23
|
state: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null | undefined, unknown>;
|
|
24
24
|
country: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null | undefined, unknown>;
|
|
25
|
-
postalCode: z.ZodString
|
|
25
|
+
postalCode: z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null | undefined, unknown>, z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
26
26
|
use: z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null | undefined, unknown>, z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodNativeEnum<typeof AddressUseCodes>, AddressUseCodes, unknown>>>>;
|
|
27
27
|
type: z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null | undefined, unknown>, z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodNativeEnum<typeof AddressTypeCodes>, AddressTypeCodes, unknown>>>>;
|
|
28
28
|
period: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
@@ -36,24 +36,24 @@ export declare const addressSchema: z.ZodObject<{
|
|
|
36
36
|
end?: unknown;
|
|
37
37
|
}>>>;
|
|
38
38
|
}, "strip", z.ZodTypeAny, {
|
|
39
|
-
postalCode: string;
|
|
40
39
|
type?: AddressTypeCodes | null | undefined;
|
|
41
40
|
line?: string[] | null | undefined;
|
|
42
41
|
city?: string | null | undefined;
|
|
43
42
|
state?: string | null | undefined;
|
|
44
43
|
country?: string | null | undefined;
|
|
44
|
+
postalCode?: string | null | undefined;
|
|
45
45
|
use?: AddressUseCodes | null | undefined;
|
|
46
46
|
period?: {
|
|
47
47
|
start?: string | null | undefined;
|
|
48
48
|
end?: string | null | undefined;
|
|
49
49
|
} | null | undefined;
|
|
50
50
|
}, {
|
|
51
|
-
postalCode: string;
|
|
52
51
|
type?: unknown;
|
|
53
52
|
line?: string[] | null | undefined;
|
|
54
53
|
city?: string | null | undefined;
|
|
55
54
|
state?: unknown;
|
|
56
55
|
country?: unknown;
|
|
56
|
+
postalCode?: unknown;
|
|
57
57
|
use?: unknown;
|
|
58
58
|
period?: {
|
|
59
59
|
start?: unknown;
|
package/dist/models/address.js
CHANGED
|
@@ -32,7 +32,7 @@ exports.addressSchema = zod_1.z.object({
|
|
|
32
32
|
city: zod_1.z.string().nullish(),
|
|
33
33
|
state: zod_1.z.preprocess(normalizeStatePreprocess, zod_1.z.string().nullish()),
|
|
34
34
|
country: zod_2.emptyStringToUndefinedSchema,
|
|
35
|
-
postalCode: zod_1.z.string(),
|
|
35
|
+
postalCode: zod_2.emptyStringToUndefinedSchema.pipe(zod_1.z.string().nullish()),
|
|
36
36
|
use: zod_2.emptyStringToUndefinedSchema.pipe(exports.addressUseCodesSchema.nullish()),
|
|
37
37
|
type: zod_2.emptyStringToUndefinedSchema.pipe(exports.addressTypeCodesSchema.nullish()),
|
|
38
38
|
period: period_1.periodSchema.nullish(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address.js","sourceRoot":"","sources":["../../src/models/address.ts"],"names":[],"mappings":";;;AAAA,8CAAmE;AACnE,6BAAwB;AACxB,uCAA6D;AAC7D,qCAAwC;AAExC;;;GAGG;AACH,IAAY,eAMX;AAND,WAAY,eAAe;IACzB,gCAAa,CAAA;IACb,gCAAa,CAAA;IACb,gCAAa,CAAA;IACb,8BAAW,CAAA;IACX,sCAAmB,CAAA;AACrB,CAAC,EANW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAM1B;AACY,QAAA,qBAAqB,GAAG,OAAC,CAAC,UAAU,CAAC,uBAAc,EAAE,OAAC,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC;AAEjG,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,qCAAiB,CAAA;IACjB,yCAAqB,CAAA;IACrB,iCAAa,CAAA;AACf,CAAC,EAJW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAI3B;AACY,QAAA,sBAAsB,GAAG,OAAC,CAAC,UAAU,CAAC,uBAAc,EAAE,OAAC,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC,CAAC;AAEnG,oBAAoB;AACpB,gGAAgG;AACnF,QAAA,aAAa,GAAG,OAAC,CAAC,MAAM,CAAC;IACpC,IAAI,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE;IACnC,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;IAC1B,KAAK,EAAE,OAAC,CAAC,UAAU,C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AAE,kCAA4B,CAAC,IAAI,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,CAAC;IACnE,GAAG,EAAE,kCAA4B,CAAC,IAAI,CAAC,6BAAqB,CAAC,OAAO,EAAE,CAAC;IACvE,IAAI,EAAE,kCAA4B,CAAC,IAAI,CAAC,8BAAsB,CAAC,OAAO,EAAE,CAAC;IACzE,MAAM,EAAE,qBAAY,CAAC,OAAO,EAAE;CAC/B,CAAC,CAAC;AAGH,SAAgB,wBAAwB,CAAC,GAAY;IACnD,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,EAAE,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;QAAE,OAAO,SAAS,CAAC;IAChG,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,IAAA,uBAAc,EAAC,GAAG,CAAC,CAAC;IACxD,OAAO,SAAS,CAAC;AACnB,CAAC;AAJD,4DAIC"}
|
package/dist/models/contact.d.ts
CHANGED
|
@@ -1,16 +1,4 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
/**
|
|
3
|
-
* How to use the contact/address.
|
|
4
|
-
* @see: https://hl7.org/fhir/R4/valueset-contact-point-use.html
|
|
5
|
-
*/
|
|
6
|
-
export declare enum ContactUseCodes {
|
|
7
|
-
home = "home",
|
|
8
|
-
work = "work",
|
|
9
|
-
temp = "temp",
|
|
10
|
-
old = "old",
|
|
11
|
-
mobile = "mobile"
|
|
12
|
-
}
|
|
13
|
-
export declare const contactUseCodesSchema: z.ZodPipeline<z.ZodEffects<z.ZodEffects<z.ZodString, unknown, string>, unknown, string>, z.ZodNativeEnum<typeof ContactUseCodes>>;
|
|
14
2
|
/**
|
|
15
3
|
* Describes the kind of contact.
|
|
16
4
|
* @see: https://hl7.org/fhir/R4/valueset-contact-point-system.html
|
|
@@ -28,7 +16,7 @@ export declare const contactSystemCodesSchema: z.ZodPipeline<z.ZodEffects<z.ZodE
|
|
|
28
16
|
export declare const contactSchema: z.ZodObject<{
|
|
29
17
|
value: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
30
18
|
system: z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null | undefined, unknown>, z.ZodOptional<z.ZodNullable<z.ZodPipeline<z.ZodEffects<z.ZodEffects<z.ZodString, unknown, string>, unknown, string>, z.ZodNativeEnum<typeof ContactSystemCodes>>>>>;
|
|
31
|
-
use: z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null | undefined, unknown>, z.ZodOptional<z.ZodNullable<z.
|
|
19
|
+
use: z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null | undefined, unknown>, z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
32
20
|
period: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
33
21
|
start: z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null | undefined, unknown>, z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodString]>>>>;
|
|
34
22
|
end: z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null | undefined, unknown>, z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodString]>>>>;
|
|
@@ -41,7 +29,7 @@ export declare const contactSchema: z.ZodObject<{
|
|
|
41
29
|
}>>>;
|
|
42
30
|
}, "strip", z.ZodTypeAny, {
|
|
43
31
|
value?: string | null | undefined;
|
|
44
|
-
use?:
|
|
32
|
+
use?: string | null | undefined;
|
|
45
33
|
period?: {
|
|
46
34
|
start?: string | null | undefined;
|
|
47
35
|
end?: string | null | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contact.d.ts","sourceRoot":"","sources":["../../src/models/contact.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;GAGG;AACH,oBAAY,
|
|
1
|
+
{"version":3,"file":"contact.d.ts","sourceRoot":"","sources":["../../src/models/contact.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;GAGG;AACH,oBAAY,kBAAkB;IAC5B,KAAK,UAAU;IACf,GAAG,QAAQ;IACX,KAAK,UAAU;IACf,KAAK,UAAU;IACf,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,KAAK,UAAU;CAChB;AACD,eAAO,MAAM,wBAAwB,sIAII,CAAC;AAc1C,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKxB,CAAC;AACH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC"}
|
package/dist/models/contact.js
CHANGED
|
@@ -1,36 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.contactSchema = exports.contactSystemCodesSchema = exports.ContactSystemCodes =
|
|
3
|
+
exports.contactSchema = exports.contactSystemCodesSchema = exports.ContactSystemCodes = void 0;
|
|
4
4
|
const shared_1 = require("@metriport/shared");
|
|
5
5
|
const zod_1 = require("zod");
|
|
6
6
|
const zod_2 = require("../common/zod");
|
|
7
7
|
const period_1 = require("./period");
|
|
8
|
-
/**
|
|
9
|
-
* How to use the contact/address.
|
|
10
|
-
* @see: https://hl7.org/fhir/R4/valueset-contact-point-use.html
|
|
11
|
-
*/
|
|
12
|
-
var ContactUseCodes;
|
|
13
|
-
(function (ContactUseCodes) {
|
|
14
|
-
ContactUseCodes["home"] = "home";
|
|
15
|
-
ContactUseCodes["work"] = "work";
|
|
16
|
-
ContactUseCodes["temp"] = "temp";
|
|
17
|
-
ContactUseCodes["old"] = "old";
|
|
18
|
-
ContactUseCodes["mobile"] = "mobile";
|
|
19
|
-
})(ContactUseCodes = exports.ContactUseCodes || (exports.ContactUseCodes = {}));
|
|
20
|
-
exports.contactUseCodesSchema = zod_1.z
|
|
21
|
-
.string()
|
|
22
|
-
.transform(shared_1.zodToLowerCase)
|
|
23
|
-
.transform(normalizeContactUse)
|
|
24
|
-
.pipe(zod_1.z.nativeEnum(ContactUseCodes));
|
|
25
|
-
function normalizeContactUse(use) {
|
|
26
|
-
if (typeof use !== "string")
|
|
27
|
-
return use;
|
|
28
|
-
switch (use.toLowerCase()) {
|
|
29
|
-
case "cell":
|
|
30
|
-
return "mobile";
|
|
31
|
-
}
|
|
32
|
-
return use;
|
|
33
|
-
}
|
|
34
8
|
/**
|
|
35
9
|
* Describes the kind of contact.
|
|
36
10
|
* @see: https://hl7.org/fhir/R4/valueset-contact-point-system.html
|
|
@@ -65,7 +39,7 @@ function normalizeContactSystem(system) {
|
|
|
65
39
|
exports.contactSchema = zod_1.z.object({
|
|
66
40
|
value: zod_1.z.string().nullish(),
|
|
67
41
|
system: zod_2.emptyStringToUndefinedSchema.pipe(exports.contactSystemCodesSchema.nullish()),
|
|
68
|
-
use: zod_2.emptyStringToUndefinedSchema.pipe(
|
|
42
|
+
use: zod_2.emptyStringToUndefinedSchema.pipe(zod_1.z.string().nullish()),
|
|
69
43
|
period: period_1.periodSchema.nullish(),
|
|
70
44
|
});
|
|
71
45
|
//# sourceMappingURL=contact.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contact.js","sourceRoot":"","sources":["../../src/models/contact.ts"],"names":[],"mappings":";;;AAAA,8CAAmD;AACnD,6BAAwB;AACxB,uCAA6D;AAC7D,qCAAwC;AAExC;;;GAGG;AACH,IAAY,
|
|
1
|
+
{"version":3,"file":"contact.js","sourceRoot":"","sources":["../../src/models/contact.ts"],"names":[],"mappings":";;;AAAA,8CAAmD;AACnD,6BAAwB;AACxB,uCAA6D;AAC7D,qCAAwC;AAExC;;;GAGG;AACH,IAAY,kBAQX;AARD,WAAY,kBAAkB;IAC5B,qCAAe,CAAA;IACf,iCAAW,CAAA;IACX,qCAAe,CAAA;IACf,qCAAe,CAAA;IACf,iCAAW,CAAA;IACX,iCAAW,CAAA;IACX,qCAAe,CAAA;AACjB,CAAC,EARW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAQ7B;AACY,QAAA,wBAAwB,GAAG,OAAC;KACtC,MAAM,EAAE;KACR,SAAS,CAAC,uBAAc,CAAC;KACzB,SAAS,CAAC,sBAAsB,CAAC;KACjC,IAAI,CAAC,OAAC,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC,CAAC;AAE1C,SAAS,sBAAsB,CAAC,MAAe;IAC7C,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC;IAC9C,QAAQ,MAAM,CAAC,WAAW,EAAE,EAAE;QAC5B,KAAK,QAAQ;YACX,OAAO,OAAO,CAAC;KAClB;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,2FAA2F;AAC3F,yBAAyB;AACzB,gGAAgG;AACnF,QAAA,aAAa,GAAG,OAAC,CAAC,MAAM,CAAC;IACpC,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;IAC3B,MAAM,EAAE,kCAA4B,CAAC,IAAI,CAAC,gCAAwB,CAAC,OAAO,EAAE,CAAC;IAC7E,GAAG,EAAE,kCAA4B,CAAC,IAAI,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,CAAC;IAC5D,MAAM,EAAE,qBAAY,CAAC,OAAO,EAAE;CAC/B,CAAC,CAAC"}
|
|
@@ -94,7 +94,7 @@ export declare const demographicsSchema: z.ZodObject<{
|
|
|
94
94
|
city: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
95
95
|
state: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null | undefined, unknown>;
|
|
96
96
|
country: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null | undefined, unknown>;
|
|
97
|
-
postalCode: z.ZodString
|
|
97
|
+
postalCode: z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null | undefined, unknown>, z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
98
98
|
use: z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null | undefined, unknown>, z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodNativeEnum<typeof import("./address").AddressUseCodes>, import("./address").AddressUseCodes, unknown>>>>;
|
|
99
99
|
type: z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null | undefined, unknown>, z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodNativeEnum<typeof import("./address").AddressTypeCodes>, import("./address").AddressTypeCodes, unknown>>>>;
|
|
100
100
|
period: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
@@ -108,24 +108,24 @@ export declare const demographicsSchema: z.ZodObject<{
|
|
|
108
108
|
end?: unknown;
|
|
109
109
|
}>>>;
|
|
110
110
|
}, "strip", z.ZodTypeAny, {
|
|
111
|
-
postalCode: string;
|
|
112
111
|
type?: import("./address").AddressTypeCodes | null | undefined;
|
|
113
112
|
line?: string[] | null | undefined;
|
|
114
113
|
city?: string | null | undefined;
|
|
115
114
|
state?: string | null | undefined;
|
|
116
115
|
country?: string | null | undefined;
|
|
116
|
+
postalCode?: string | null | undefined;
|
|
117
117
|
use?: import("./address").AddressUseCodes | null | undefined;
|
|
118
118
|
period?: {
|
|
119
119
|
start?: string | null | undefined;
|
|
120
120
|
end?: string | null | undefined;
|
|
121
121
|
} | null | undefined;
|
|
122
122
|
}, {
|
|
123
|
-
postalCode: string;
|
|
124
123
|
type?: unknown;
|
|
125
124
|
line?: string[] | null | undefined;
|
|
126
125
|
city?: string | null | undefined;
|
|
127
126
|
state?: unknown;
|
|
128
127
|
country?: unknown;
|
|
128
|
+
postalCode?: unknown;
|
|
129
129
|
use?: unknown;
|
|
130
130
|
period?: {
|
|
131
131
|
start?: unknown;
|
|
@@ -135,7 +135,7 @@ export declare const demographicsSchema: z.ZodObject<{
|
|
|
135
135
|
telecom: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
136
136
|
value: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
137
137
|
system: z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null | undefined, unknown>, z.ZodOptional<z.ZodNullable<z.ZodPipeline<z.ZodEffects<z.ZodEffects<z.ZodString, unknown, string>, unknown, string>, z.ZodNativeEnum<typeof import("./contact").ContactSystemCodes>>>>>;
|
|
138
|
-
use: z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null | undefined, unknown>, z.ZodOptional<z.ZodNullable<z.
|
|
138
|
+
use: z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null | undefined, unknown>, z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
139
139
|
period: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
140
140
|
start: z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null | undefined, unknown>, z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodString]>>>>;
|
|
141
141
|
end: z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null | undefined, unknown>, z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodString]>>>>;
|
|
@@ -148,7 +148,7 @@ export declare const demographicsSchema: z.ZodObject<{
|
|
|
148
148
|
}>>>;
|
|
149
149
|
}, "strip", z.ZodTypeAny, {
|
|
150
150
|
value?: string | null | undefined;
|
|
151
|
-
use?:
|
|
151
|
+
use?: string | null | undefined;
|
|
152
152
|
period?: {
|
|
153
153
|
start?: string | null | undefined;
|
|
154
154
|
end?: string | null | undefined;
|
|
@@ -189,12 +189,12 @@ export declare const demographicsSchema: z.ZodObject<{
|
|
|
189
189
|
}[];
|
|
190
190
|
birthDate: string;
|
|
191
191
|
address: {
|
|
192
|
-
postalCode: string;
|
|
193
192
|
type?: import("./address").AddressTypeCodes | null | undefined;
|
|
194
193
|
line?: string[] | null | undefined;
|
|
195
194
|
city?: string | null | undefined;
|
|
196
195
|
state?: string | null | undefined;
|
|
197
196
|
country?: string | null | undefined;
|
|
197
|
+
postalCode?: string | null | undefined;
|
|
198
198
|
use?: import("./address").AddressUseCodes | null | undefined;
|
|
199
199
|
period?: {
|
|
200
200
|
start?: string | null | undefined;
|
|
@@ -204,7 +204,7 @@ export declare const demographicsSchema: z.ZodObject<{
|
|
|
204
204
|
gender?: GenderCodes | null | undefined;
|
|
205
205
|
telecom?: {
|
|
206
206
|
value?: string | null | undefined;
|
|
207
|
-
use?:
|
|
207
|
+
use?: string | null | undefined;
|
|
208
208
|
period?: {
|
|
209
209
|
start?: string | null | undefined;
|
|
210
210
|
end?: string | null | undefined;
|
|
@@ -237,12 +237,12 @@ export declare const demographicsSchema: z.ZodObject<{
|
|
|
237
237
|
}[];
|
|
238
238
|
birthDate: string;
|
|
239
239
|
address: {
|
|
240
|
-
postalCode: string;
|
|
241
240
|
type?: unknown;
|
|
242
241
|
line?: string[] | null | undefined;
|
|
243
242
|
city?: string | null | undefined;
|
|
244
243
|
state?: unknown;
|
|
245
244
|
country?: unknown;
|
|
245
|
+
postalCode?: unknown;
|
|
246
246
|
use?: unknown;
|
|
247
247
|
period?: {
|
|
248
248
|
start?: unknown;
|
|
@@ -7,7 +7,7 @@ export declare const facilitySchema: z.ZodObject<{
|
|
|
7
7
|
city: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
8
8
|
state: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null | undefined, unknown>;
|
|
9
9
|
country: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null | undefined, unknown>;
|
|
10
|
-
postalCode: z.ZodString
|
|
10
|
+
postalCode: z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null | undefined, unknown>, z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
11
11
|
use: z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null | undefined, unknown>, z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodNativeEnum<typeof import("./address").AddressUseCodes>, import("./address").AddressUseCodes, unknown>>>>;
|
|
12
12
|
type: z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null | undefined, unknown>, z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodNativeEnum<typeof import("./address").AddressTypeCodes>, import("./address").AddressTypeCodes, unknown>>>>;
|
|
13
13
|
period: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
@@ -21,24 +21,24 @@ export declare const facilitySchema: z.ZodObject<{
|
|
|
21
21
|
end?: unknown;
|
|
22
22
|
}>>>;
|
|
23
23
|
}, "strip", z.ZodTypeAny, {
|
|
24
|
-
postalCode: string;
|
|
25
24
|
type?: import("./address").AddressTypeCodes | null | undefined;
|
|
26
25
|
line?: string[] | null | undefined;
|
|
27
26
|
city?: string | null | undefined;
|
|
28
27
|
state?: string | null | undefined;
|
|
29
28
|
country?: string | null | undefined;
|
|
29
|
+
postalCode?: string | null | undefined;
|
|
30
30
|
use?: import("./address").AddressUseCodes | null | undefined;
|
|
31
31
|
period?: {
|
|
32
32
|
start?: string | null | undefined;
|
|
33
33
|
end?: string | null | undefined;
|
|
34
34
|
} | null | undefined;
|
|
35
35
|
}, {
|
|
36
|
-
postalCode: string;
|
|
37
36
|
type?: unknown;
|
|
38
37
|
line?: string[] | null | undefined;
|
|
39
38
|
city?: string | null | undefined;
|
|
40
39
|
state?: unknown;
|
|
41
40
|
country?: unknown;
|
|
41
|
+
postalCode?: unknown;
|
|
42
42
|
use?: unknown;
|
|
43
43
|
period?: {
|
|
44
44
|
start?: unknown;
|
|
@@ -48,12 +48,12 @@ export declare const facilitySchema: z.ZodObject<{
|
|
|
48
48
|
}, "strip", z.ZodTypeAny, {
|
|
49
49
|
name?: string | null | undefined;
|
|
50
50
|
address?: {
|
|
51
|
-
postalCode: string;
|
|
52
51
|
type?: import("./address").AddressTypeCodes | null | undefined;
|
|
53
52
|
line?: string[] | null | undefined;
|
|
54
53
|
city?: string | null | undefined;
|
|
55
54
|
state?: string | null | undefined;
|
|
56
55
|
country?: string | null | undefined;
|
|
56
|
+
postalCode?: string | null | undefined;
|
|
57
57
|
use?: import("./address").AddressUseCodes | null | undefined;
|
|
58
58
|
period?: {
|
|
59
59
|
start?: string | null | undefined;
|
|
@@ -64,12 +64,12 @@ export declare const facilitySchema: z.ZodObject<{
|
|
|
64
64
|
}, {
|
|
65
65
|
name?: string | null | undefined;
|
|
66
66
|
address?: {
|
|
67
|
-
postalCode: string;
|
|
68
67
|
type?: unknown;
|
|
69
68
|
line?: string[] | null | undefined;
|
|
70
69
|
city?: string | null | undefined;
|
|
71
70
|
state?: unknown;
|
|
72
71
|
country?: unknown;
|
|
72
|
+
postalCode?: unknown;
|
|
73
73
|
use?: unknown;
|
|
74
74
|
period?: {
|
|
75
75
|
start?: unknown;
|