@awell-health/awell-extensions 2.0.193 → 2.0.194
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/extensions/medplum/index.js +2 -0
- package/dist/extensions/medplum/index.js.map +1 -1
- package/dist/extensions/medplum/webhooks/index.d.ts +1 -0
- package/dist/extensions/medplum/webhooks/index.js +6 -0
- package/dist/extensions/medplum/webhooks/index.js.map +1 -0
- package/dist/extensions/medplum/webhooks/patientCreated.d.ts +11 -0
- package/dist/extensions/medplum/webhooks/patientCreated.js +35 -0
- package/dist/extensions/medplum/webhooks/patientCreated.js.map +1 -0
- package/package.json +1 -1
@@ -37,6 +37,7 @@ exports.Medplum = void 0;
|
|
37
37
|
const extensions_core_1 = require("@awell-health/extensions-core");
|
38
38
|
const actions = __importStar(require("./actions"));
|
39
39
|
const settings_1 = require("./settings");
|
40
|
+
const webhooks_1 = require("./webhooks");
|
40
41
|
exports.Medplum = {
|
41
42
|
key: 'medplum',
|
42
43
|
title: 'Medplum',
|
@@ -48,5 +49,6 @@ exports.Medplum = {
|
|
48
49
|
},
|
49
50
|
settings: settings_1.settings,
|
50
51
|
actions,
|
52
|
+
webhooks: webhooks_1.webhooks,
|
51
53
|
};
|
52
54
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../extensions/medplum/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,mEAAoE;AACpE,mDAAoC;AACpC,yCAAqC;AAExB,QAAA,OAAO,GAAc;IAChC,GAAG,EAAE,SAAS;IACd,KAAK,EAAE,SAAS;IAChB,WAAW,EACT,qIAAqI;IACvI,QAAQ,EAAE,sCAAsC;IAChD,QAAQ,EAAE,0BAAQ,CAAC,gBAAgB;IACnC,MAAM,EAAE;QACN,UAAU,EAAE,4BAAU,CAAC,KAAK;KAC7B;IACD,QAAQ,EAAR,mBAAQ;IACR,OAAO;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../extensions/medplum/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,mEAAoE;AACpE,mDAAoC;AACpC,yCAAqC;AACrC,yCAAqC;AAExB,QAAA,OAAO,GAAc;IAChC,GAAG,EAAE,SAAS;IACd,KAAK,EAAE,SAAS;IAChB,WAAW,EACT,qIAAqI;IACvI,QAAQ,EAAE,sCAAsC;IAChD,QAAQ,EAAE,0BAAQ,CAAC,gBAAgB;IACnC,MAAM,EAAE;QACN,UAAU,EAAE,4BAAU,CAAC,KAAK;KAC7B;IACD,QAAQ,EAAR,mBAAQ;IACR,OAAO;IACP,QAAQ,EAAR,mBAAQ;CACT,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const webhooks: import("@awell-health/extensions-core").Webhook<"patientId", import("@medplum/fhirtypes").Patient, Record<string, import("@awell-health/extensions-core").Setting>>[];
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../extensions/medplum/webhooks/index.ts"],"names":[],"mappings":";;;AAAA,qDAAiD;AAEpC,QAAA,QAAQ,GAAG,CAAC,+BAAc,CAAC,CAAA"}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { type Webhook } from '@awell-health/extensions-core';
|
2
|
+
import { type Patient as MedplumPatientCreatedWebhookPayload } from '@medplum/fhirtypes';
|
3
|
+
declare const dataPoints: {
|
4
|
+
patientId: {
|
5
|
+
key: string;
|
6
|
+
valueType: "string";
|
7
|
+
};
|
8
|
+
};
|
9
|
+
export declare const patientCreated: Webhook<keyof typeof dataPoints, MedplumPatientCreatedWebhookPayload>;
|
10
|
+
export type PatientCreated = typeof patientCreated;
|
11
|
+
export {};
|
@@ -0,0 +1,35 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.patientCreated = void 0;
|
4
|
+
const lodash_1 = require("lodash");
|
5
|
+
const MEDPLUM_IDENTIFIER = 'https://www.medplum.com/docs/api/fhir/resources/patient';
|
6
|
+
const dataPoints = {
|
7
|
+
patientId: {
|
8
|
+
key: 'patientId',
|
9
|
+
valueType: 'string',
|
10
|
+
},
|
11
|
+
};
|
12
|
+
exports.patientCreated = {
|
13
|
+
key: 'patientCreated',
|
14
|
+
dataPoints,
|
15
|
+
onWebhookReceived: async ({ payload }, onSuccess, onError) => {
|
16
|
+
const patientId = payload.id;
|
17
|
+
if ((0, lodash_1.isNil)(patientId)) {
|
18
|
+
await onError({
|
19
|
+
// We should automatically send a 400 here, so no need to provide info
|
20
|
+
});
|
21
|
+
}
|
22
|
+
else {
|
23
|
+
await onSuccess({
|
24
|
+
data_points: {
|
25
|
+
patientId,
|
26
|
+
},
|
27
|
+
patient_identifier: {
|
28
|
+
system: MEDPLUM_IDENTIFIER,
|
29
|
+
value: patientId,
|
30
|
+
},
|
31
|
+
});
|
32
|
+
}
|
33
|
+
},
|
34
|
+
};
|
35
|
+
//# sourceMappingURL=patientCreated.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"patientCreated.js","sourceRoot":"","sources":["../../../../extensions/medplum/webhooks/patientCreated.ts"],"names":[],"mappings":";;;AAAA,mCAA8B;AAO9B,MAAM,kBAAkB,GAAG,yDAAyD,CAAA;AAEpF,MAAM,UAAU,GAAG;IACjB,SAAS,EAAE;QACT,GAAG,EAAE,WAAW;QAChB,SAAS,EAAE,QAAQ;KACpB;CAC4C,CAAA;AAElC,QAAA,cAAc,GAGvB;IACF,GAAG,EAAE,gBAAgB;IACrB,UAAU;IACV,iBAAiB,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE;QAC3D,MAAM,SAAS,GAAG,OAAO,CAAC,EAAE,CAAA;QAE5B,IAAI,IAAA,cAAK,EAAC,SAAS,CAAC,EAAE,CAAC;YACrB,MAAM,OAAO,CAAC;YACZ,sEAAsE;aACvE,CAAC,CAAA;QACJ,CAAC;aAAM,CAAC;YACN,MAAM,SAAS,CAAC;gBACd,WAAW,EAAE;oBACX,SAAS;iBACV;gBACD,kBAAkB,EAAE;oBAClB,MAAM,EAAE,kBAAkB;oBAC1B,KAAK,EAAE,SAAS;iBACjB;aACF,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;CACF,CAAA"}
|